Compare commits
38
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7f3ae3d574 | ||
|
|
80f82acdf8 | ||
|
|
78146bb14c | ||
|
|
c61f97dbce | ||
|
|
c823f837c0 | ||
|
|
f8252fcc91 | ||
|
|
98ed8b98b1 | ||
|
|
5f5a73a8f6 | ||
|
|
50be2a7e56 | ||
|
|
4fdbac7207 | ||
|
|
8199076878 | ||
|
|
c49de41ef3 | ||
|
|
ad5681c45b | ||
|
|
daf76f1ff6 | ||
|
|
cdff4b2bb5 | ||
|
|
d3a1a97db8 | ||
|
|
962464629d | ||
|
|
3291c2e560 | ||
|
|
b797a84b5d | ||
|
|
45b0460019 | ||
|
|
5d0919855e | ||
|
|
6d2d283954 | ||
|
|
49db06b604 | ||
|
|
85012b6074 | ||
|
|
14271c72f3 | ||
|
|
d73922e407 | ||
|
|
c8d23a5f01 | ||
|
|
4d8c8cdeda | ||
|
|
148d8c4995 | ||
|
|
4ae517e24e | ||
|
|
1fd4703907 | ||
|
|
024221d448 | ||
|
|
bfe046b60f | ||
|
|
1bfa90cb1f | ||
|
|
0c2e3308a5 | ||
|
|
11fc77b704 | ||
|
|
28af0d58c6 | ||
|
|
bca544448f |
No files matched your search
@@ -30,7 +30,9 @@ class JobOs(Enum):
|
||||
Ubuntu22_04 = "ubuntu-22.04"
|
||||
Ubuntu24_04 = "ubuntu-24.04"
|
||||
Ubuntu24_04_arm = "ubuntu-24.04-arm"
|
||||
Macos13 = "macos-13"
|
||||
Macos14 = "macos-14" # macOS Sonoma (2023)
|
||||
Macos15 = "macos-15" # macOS Sequoia (2024)
|
||||
Macos26 = "macos-26" # macOS Tahoe (2025)
|
||||
|
||||
|
||||
class SdlPlatform(Enum):
|
||||
@@ -115,7 +117,7 @@ JOB_SPECS = {
|
||||
"steamrt-sniper": JobSpec(name="Steam Linux Runtime (Sniper)", os=JobOs.UbuntuLatest, platform=SdlPlatform.Linux, artifact="SDL-slrsniper", container="registry.gitlab.steamos.cloud/steamrt/sniper/sdk:beta", ),
|
||||
"ubuntu-intel-icx": JobSpec(name="Ubuntu 22.04 (Intel oneAPI)", os=JobOs.Ubuntu22_04, platform=SdlPlatform.Linux, artifact="SDL-ubuntu22.04-oneapi", intel=IntelCompiler.Icx, ),
|
||||
"ubuntu-intel-icc": JobSpec(name="Ubuntu 22.04 (Intel Compiler)", os=JobOs.Ubuntu22_04, platform=SdlPlatform.Linux, artifact="SDL-ubuntu22.04-icc", intel=IntelCompiler.Icc, ),
|
||||
"macos-framework-x64": JobSpec(name="MacOS (Framework) (x64)", os=JobOs.Macos13, platform=SdlPlatform.MacOS, artifact="SDL-macos-framework", apple_framework=True, apple_archs={AppleArch.Aarch64, AppleArch.X86_64, }, xcode=True, ),
|
||||
"macos-framework-x64": JobSpec(name="MacOS (Framework) (x64)", os=JobOs.Macos14, platform=SdlPlatform.MacOS, artifact="SDL-macos-framework", apple_framework=True, apple_archs={AppleArch.Aarch64, AppleArch.X86_64, }, xcode=True, ),
|
||||
"macos-framework-arm64": JobSpec(name="MacOS (Framework) (arm64)", os=JobOs.MacosLatest, platform=SdlPlatform.MacOS, artifact=None, apple_framework=True, apple_archs={AppleArch.Aarch64, AppleArch.X86_64, }, ),
|
||||
"macos-gnu-arm64": JobSpec(name="MacOS (GNU prefix)", os=JobOs.MacosLatest, platform=SdlPlatform.MacOS, artifact="SDL-macos-arm64-gnu", apple_framework=False, apple_archs={AppleArch.Aarch64, }, ),
|
||||
"ios": JobSpec(name="iOS (CMake & xcode)", os=JobOs.MacosLatest, platform=SdlPlatform.Ios, artifact="SDL-ios-arm64", xcode=True, ),
|
||||
@@ -512,8 +514,6 @@ def spec_to_job(spec: JobSpec, key: str, trackmem_symbol_names: bool) -> JobDeta
|
||||
job.shared_lib = SharedLibType.DYLIB
|
||||
job.static_lib = StaticLibType.A
|
||||
job.ccache = True
|
||||
if spec.os == JobOs.Macos13:
|
||||
job.ccache = False
|
||||
job.apt_packages = []
|
||||
job.brew_packages.extend((
|
||||
"ninja",
|
||||
|
||||
@@ -204,10 +204,22 @@ jobs:
|
||||
-DCMAKE_PREFIX_PATH="${{ steps.mount.outputs.mount_point }}" \
|
||||
-DCMAKE_SYSTEM_NAME=iOS \
|
||||
-DCMAKE_OSX_ARCHITECTURES="arm64" \
|
||||
-DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 \
|
||||
-DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 \
|
||||
-Werror=dev \
|
||||
-B build_ios
|
||||
cmake --build build_ios --config Release --verbose
|
||||
|
||||
cmake -S "${{ steps.src.outputs.path }}/cmake/test" \
|
||||
-DTEST_FULL=FALSE \
|
||||
-DTEST_STATIC=FALSE \
|
||||
-DTEST_TEST=FALSE \
|
||||
-DCMAKE_PREFIX_PATH="${{ steps.mount.outputs.mount_point }}/SDL3.xcframework/ios-arm64" \
|
||||
-DCMAKE_SYSTEM_NAME=iOS \
|
||||
-DCMAKE_OSX_ARCHITECTURES="arm64" \
|
||||
-DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 \
|
||||
-Werror=dev \
|
||||
-B build_ios2
|
||||
cmake --build build_ios2 --config Release --verbose
|
||||
- name: 'CMake (configure + build) tvOS'
|
||||
run: |
|
||||
cmake -S "${{ steps.src.outputs.path }}/cmake/test" \
|
||||
@@ -217,10 +229,22 @@ jobs:
|
||||
-DCMAKE_PREFIX_PATH="${{ steps.mount.outputs.mount_point }}" \
|
||||
-DCMAKE_SYSTEM_NAME=tvOS \
|
||||
-DCMAKE_OSX_ARCHITECTURES="arm64" \
|
||||
-DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 \
|
||||
-DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 \
|
||||
-Werror=dev \
|
||||
-B build_tvos
|
||||
cmake --build build_tvos --config Release --verbose
|
||||
|
||||
cmake -S "${{ steps.src.outputs.path }}/cmake/test" \
|
||||
-DTEST_FULL=FALSE \
|
||||
-DTEST_STATIC=FALSE \
|
||||
-DTEST_TEST=FALSE \
|
||||
-DCMAKE_PREFIX_PATH="${{ steps.mount.outputs.mount_point }}/SDL3.xcframework/tvos-arm64" \
|
||||
-DCMAKE_SYSTEM_NAME=tvOS \
|
||||
-DCMAKE_OSX_ARCHITECTURES="arm64" \
|
||||
-DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 \
|
||||
-Werror=dev \
|
||||
-B build_tvos2
|
||||
cmake --build build_tvos2 --config Release --verbose
|
||||
- name: 'CMake (configure + build) iOS simulator'
|
||||
run: |
|
||||
sysroot=$(xcodebuild -version -sdk iphonesimulator Path)
|
||||
@@ -237,6 +261,19 @@ jobs:
|
||||
-Werror=dev \
|
||||
-B build_ios_simulator
|
||||
cmake --build build_ios_simulator --config Release --verbose
|
||||
|
||||
cmake -S "${{ steps.src.outputs.path }}/cmake/test" \
|
||||
-DTEST_FULL=FALSE \
|
||||
-DTEST_STATIC=FALSE \
|
||||
-DTEST_TEST=FALSE \
|
||||
-DCMAKE_PREFIX_PATH="${{ steps.mount.outputs.mount_point }}/SDL3.xcframework/ios-arm64_x86_64-simulator" \
|
||||
-DCMAKE_SYSTEM_NAME=iOS \
|
||||
-DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" \
|
||||
-DCMAKE_OSX_SYSROOT="${sysroot}" \
|
||||
-DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 \
|
||||
-Werror=dev \
|
||||
-B build_ios_simulator2
|
||||
cmake --build build_ios_simulator2 --config Release --verbose
|
||||
- name: 'CMake (configure + build) tvOS simulator'
|
||||
run: |
|
||||
sysroot=$(xcodebuild -version -sdk appletvsimulator Path)
|
||||
@@ -254,6 +291,19 @@ jobs:
|
||||
-B build_tvos_simulator
|
||||
cmake --build build_tvos_simulator --config Release --verbose
|
||||
|
||||
cmake -S "${{ steps.src.outputs.path }}/cmake/test" \
|
||||
-DTEST_FULL=FALSE \
|
||||
-DTEST_STATIC=FALSE \
|
||||
-DTEST_TEST=FALSE \
|
||||
-DCMAKE_PREFIX_PATH="${{ steps.mount.outputs.mount_point }}/SDL3.xcframework/tvos-arm64_x86_64-simulator" \
|
||||
-DCMAKE_SYSTEM_NAME=tvOS \
|
||||
-DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" \
|
||||
-DCMAKE_OSX_SYSROOT="${sysroot}" \
|
||||
-DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 \
|
||||
-Werror=dev \
|
||||
-B build_tvos_simulator2
|
||||
cmake --build build_tvos_simulator2 --config Release --verbose
|
||||
|
||||
msvc:
|
||||
needs: [src]
|
||||
runs-on: windows-2025
|
||||
|
||||
+12
-2
@@ -5,7 +5,7 @@ if(NOT DEFINED CMAKE_BUILD_TYPE)
|
||||
endif()
|
||||
|
||||
# See docs/release_checklist.md
|
||||
project(SDL3 LANGUAGES C VERSION "3.2.26")
|
||||
project(SDL3 LANGUAGES C VERSION "3.2.28")
|
||||
|
||||
if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
|
||||
set(SDL3_MAINPROJECT ON)
|
||||
@@ -898,7 +898,17 @@ if(SDL_ASSEMBLY)
|
||||
cmake_pop_check_state()
|
||||
|
||||
if(COMPILER_SUPPORTS_LSX AND HAVE_LSXINTRIN_H)
|
||||
set_property(SOURCE "${SDL3_SOURCE_DIR}/src/video/yuv2rgb/yuv_rgb_lsx.c" APPEND PROPERTY COMPILE_OPTIONS "-mlsx")
|
||||
set_property(SOURCE
|
||||
"${SDL3_SOURCE_DIR}/src/video/yuv2rgb/yuv_rgb_lsx.c"
|
||||
"${SDL3_SOURCE_DIR}/src/video/SDL_blit_A.c"
|
||||
"${SDL3_SOURCE_DIR}/src/video/SDL_fillrect.c"
|
||||
APPEND PROPERTY COMPILE_OPTIONS "-mlsx")
|
||||
|
||||
set_property(SOURCE
|
||||
"${SDL3_SOURCE_DIR}/src/video/yuv2rgb/yuv_rgb_lsx.c"
|
||||
"${SDL3_SOURCE_DIR}/src/video/SDL_blit_A.c"
|
||||
"${SDL3_SOURCE_DIR}/src/video/SDL_fillrect.c"
|
||||
PROPERTY SKIP_PRECOMPILE_HEADERS 1)
|
||||
set(HAVE_LSX TRUE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@@ -19,10 +19,10 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>3.2.26</string>
|
||||
<string>3.2.28</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>SDLX</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>3.2.26</string>
|
||||
<string>3.2.28</string>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -3082,7 +3082,7 @@
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
DEPLOYMENT_POSTPROCESSING = YES;
|
||||
DYLIB_COMPATIBILITY_VERSION = 201.0.0;
|
||||
DYLIB_CURRENT_VERSION = 201.26.0;
|
||||
DYLIB_CURRENT_VERSION = 201.28.0;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
GCC_ALTIVEC_EXTENSIONS = YES;
|
||||
@@ -3117,7 +3117,7 @@
|
||||
"@loader_path/Frameworks",
|
||||
);
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.13;
|
||||
MARKETING_VERSION = 3.2.26;
|
||||
MARKETING_VERSION = 3.2.28;
|
||||
OTHER_LDFLAGS = "$(CONFIG_FRAMEWORK_LDFLAGS)";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = org.libsdl.SDL3;
|
||||
PRODUCT_NAME = SDL3;
|
||||
@@ -3148,7 +3148,7 @@
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
DYLIB_COMPATIBILITY_VERSION = 201.0.0;
|
||||
DYLIB_CURRENT_VERSION = 201.26.0;
|
||||
DYLIB_CURRENT_VERSION = 201.28.0;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_TESTABILITY = YES;
|
||||
@@ -3180,7 +3180,7 @@
|
||||
"@loader_path/Frameworks",
|
||||
);
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.13;
|
||||
MARKETING_VERSION = 3.2.26;
|
||||
MARKETING_VERSION = 3.2.28;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
OTHER_LDFLAGS = "$(CONFIG_FRAMEWORK_LDFLAGS)";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = org.libsdl.SDL3;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
Title SDL 3.2.26
|
||||
Title SDL 3.2.28
|
||||
Version 1
|
||||
Description SDL Library for macOS (http://www.libsdl.org)
|
||||
DefaultLocation /Library/Frameworks
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
# SDL3 CMake configuration file:
|
||||
# This file is meant to be placed in Resources/CMake of a SDL3 framework
|
||||
# This file is meant to be placed in Resources/CMake of a SDL3 framework for macOS,
|
||||
# or in the CMake directory of a SDL3 framework for iOS / tvOS / visionOS.
|
||||
|
||||
# INTERFACE_LINK_OPTIONS needs CMake 3.12
|
||||
cmake_minimum_required(VERSION 3.12)
|
||||
cmake_minimum_required(VERSION 3.12...4.0)
|
||||
|
||||
include(FeatureSummary)
|
||||
set_package_properties(SDL3 PROPERTIES
|
||||
@@ -31,16 +32,31 @@ endmacro()
|
||||
|
||||
set(SDL3_FOUND TRUE)
|
||||
|
||||
# Compute the installation prefix relative to this file.
|
||||
set(_sdl3_framework_path "${CMAKE_CURRENT_LIST_DIR}") # > /SDL3.framework/Resources/CMake/
|
||||
get_filename_component(_sdl3_framework_path "${_sdl3_framework_path}" REALPATH) # > /SDL3.framework/Versions/Current/Resources/CMake
|
||||
get_filename_component(_sdl3_framework_path "${_sdl3_framework_path}" REALPATH) # > /SDL3.framework/Versions/A/Resources/CMake/
|
||||
get_filename_component(_sdl3_framework_path "${_sdl3_framework_path}" PATH) # > /SDL3.framework/Versions/A/Resources/
|
||||
get_filename_component(_sdl3_framework_path "${_sdl3_framework_path}" PATH) # > /SDL3.framework/Versions/A/
|
||||
get_filename_component(_sdl3_framework_path "${_sdl3_framework_path}" PATH) # > /SDL3.framework/Versions/
|
||||
get_filename_component(_sdl3_framework_path "${_sdl3_framework_path}" PATH) # > /SDL3.framework/
|
||||
get_filename_component(_sdl3_framework_parent_path "${_sdl3_framework_path}" PATH) # > /
|
||||
# Compute the installation prefix relative to this file:
|
||||
# search upwards for the .framework directory
|
||||
set(_current_path "${CMAKE_CURRENT_LIST_DIR}")
|
||||
get_filename_component(_current_path "${_current_path}" REALPATH)
|
||||
set(_sdl3_framework_path "")
|
||||
|
||||
while(NOT _sdl3_framework_path)
|
||||
if(IS_DIRECTORY "${_current_path}" AND "${_current_path}" MATCHES "/SDL3\\.framework$")
|
||||
set(_sdl3_framework_path "${_current_path}")
|
||||
break()
|
||||
endif()
|
||||
get_filename_component(_next_current_path "${_current_path}" DIRECTORY)
|
||||
if("${_current_path}" STREQUAL "${_next_current_path}")
|
||||
break()
|
||||
endif()
|
||||
set(_current_path "${_next_current_path}")
|
||||
endwhile()
|
||||
unset(_current_path)
|
||||
unset(_next_current_path)
|
||||
|
||||
if(NOT _sdl3_framework_path)
|
||||
message(FATAL_ERROR "Could not find SDL3.framework root from ${CMAKE_CURRENT_LIST_DIR}")
|
||||
endif()
|
||||
|
||||
get_filename_component(_sdl3_framework_parent_path "${_sdl3_framework_path}" PATH)
|
||||
|
||||
# All targets are created, even when some might not be requested though COMPONENTS.
|
||||
# This is done for compatibility with CMake generated SDL3-target.cmake files.
|
||||
|
||||
@@ -1,16 +1,26 @@
|
||||
# based on the files generated by CMake's write_basic_package_version_file
|
||||
|
||||
# SDL CMake version configuration file:
|
||||
# This file is meant to be placed in Resources/CMake of a SDL3 framework
|
||||
# This file is meant to be placed in Resources/CMake of a SDL3 framework for macOS,
|
||||
# or in the CMake directory of a SDL3 framework for iOS / tvOS / visionOS.
|
||||
|
||||
cmake_minimum_required(VERSION 3.12)
|
||||
cmake_minimum_required(VERSION 3.12...4.0)
|
||||
|
||||
if(NOT EXISTS "${CMAKE_CURRENT_LIST_DIR}/../../Headers/SDL_version.h")
|
||||
message(AUTHOR_WARNING "Could not find SDL_version.h. This script is meant to be placed in the Resources/CMake directory of SDL2.framework")
|
||||
# Find SDL_version.h
|
||||
set(_sdl_version_h_path "")
|
||||
if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/../../Headers/SDL_version.h")
|
||||
set(_sdl_version_h_path "${CMAKE_CURRENT_LIST_DIR}/../../Headers/SDL_version.h")
|
||||
elseif(EXISTS "${CMAKE_CURRENT_LIST_DIR}/../Headers/SDL_version.h")
|
||||
set(_sdl_version_h_path "${CMAKE_CURRENT_LIST_DIR}/../Headers/SDL_version.h")
|
||||
endif()
|
||||
|
||||
if(NOT _sdl_version_h_path)
|
||||
message(AUTHOR_WARNING "Could not find SDL_version.h. This script is meant to be placed in the Resources/CMake directory or the CMake directory of SDL3.framework.")
|
||||
set(PACKAGE_VERSION_UNSUITABLE TRUE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
file(READ "${CMAKE_CURRENT_LIST_DIR}/../../Headers/SDL_version.h" _sdl_version_h)
|
||||
file(READ "${_sdl_version_h_path}" _sdl_version_h)
|
||||
string(REGEX MATCH "#define[ \t]+SDL_MAJOR_VERSION[ \t]+([0-9]+)" _sdl_major_re "${_sdl_version_h}")
|
||||
set(_sdl_major "${CMAKE_MATCH_1}")
|
||||
string(REGEX MATCH "#define[ \t]+SDL_MINOR_VERSION[ \t]+([0-9]+)" _sdl_minor_re "${_sdl_version_h}")
|
||||
@@ -21,9 +31,12 @@ if(_sdl_major_re AND _sdl_minor_re AND _sdl_micro_re)
|
||||
set(PACKAGE_VERSION "${_sdl_major}.${_sdl_minor}.${_sdl_micro}")
|
||||
else()
|
||||
message(AUTHOR_WARNING "Could not extract version from SDL_version.h.")
|
||||
set(PACKAGE_VERSION_UNSUITABLE TRUE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
unset(_sdl_version_h)
|
||||
unset(_sdl_version_h_path)
|
||||
unset(_sdl_major_re)
|
||||
unset(_sdl_major)
|
||||
unset(_sdl_minor_re)
|
||||
|
||||
@@ -16,6 +16,7 @@ set(_sdl3_version_h "${_sdl3_framework}/Headers/SDL_version.h")
|
||||
|
||||
if(NOT EXISTS "${_sdl3_version_h}")
|
||||
message(AUTHOR_WARNING "Cannot not find ${_sdl3_framework}. This script is meant to be placed in share/cmake/SDL3, next to SDL3.xcframework")
|
||||
set(PACKAGE_VERSION_UNSUITABLE TRUE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
@@ -36,6 +37,7 @@ if(_sdl_major_re AND _sdl_minor_re AND _sdl_micro_re)
|
||||
set(PACKAGE_VERSION "${_sdl_major}.${_sdl_minor}.${_sdl_micro}")
|
||||
else()
|
||||
message(AUTHOR_WARNING "Could not extract version from SDL_version.h.")
|
||||
set(PACKAGE_VERSION_UNSUITABLE TRUE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
|
||||
@@ -61,7 +61,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 = 26;
|
||||
private static final int SDL_MICRO_VERSION = 28;
|
||||
/*
|
||||
// Display InputType.SOURCE/CLASS of events and devices
|
||||
//
|
||||
|
||||
@@ -1028,6 +1028,7 @@ class Releaser:
|
||||
# NDK 21e does not support -ffile-prefix-map
|
||||
# f'''-DCMAKE_C_FLAGS="-ffile-prefix-map={self.root}=/src/{self.project}"''',
|
||||
# f'''-DCMAKE_CXX_FLAGS="-ffile-prefix-map={self.root}=/src/{self.project}"''',
|
||||
f"-DANDROID_USE_LEGACY_TOOLCHAIN=0",
|
||||
f"-DCMAKE_EXE_LINKER_FLAGS={extra_link_options}",
|
||||
f"-DCMAKE_SHARED_LINKER_FLAGS={extra_link_options}",
|
||||
f"-DCMAKE_TOOLCHAIN_FILE={cmake_toolchain_file}",
|
||||
@@ -1126,8 +1127,7 @@ class Releaser:
|
||||
for dep, depinfo in self.release_info.get("dependencies", {}).items():
|
||||
startswith = depinfo["startswith"]
|
||||
dep_repo = depinfo["repo"]
|
||||
# FIXME: dropped "--exclude-pre-releases"
|
||||
dep_string_data = self.executer.check_output(["gh", "-R", dep_repo, "release", "list", "--exclude-drafts", "--json", "name,createdAt,tagName", "--jq", f'[.[]|select(.name|startswith("{startswith}"))]|max_by(.createdAt)']).strip()
|
||||
dep_string_data = self.executer.check_output(["gh", "-R", dep_repo, "release", "list", "--exclude-drafts", "--exclude-pre-releases", "--json", "name,createdAt,tagName", "--jq", f'[.[]|select(.name|startswith("{startswith}"))]|max_by(.createdAt)']).strip()
|
||||
dep_data = json.loads(dep_string_data)
|
||||
dep_tag = dep_data["tagName"]
|
||||
dep_version = dep_data["name"]
|
||||
@@ -1517,7 +1517,7 @@ def main(argv=None) -> int:
|
||||
if args.android_home is None or not Path(args.android_home).is_dir():
|
||||
parser.error("Invalid $ANDROID_HOME or --android-home: must be a directory containing the Android SDK")
|
||||
if args.android_ndk_home is None or not Path(args.android_ndk_home).is_dir():
|
||||
parser.error("Invalid $ANDROID_NDK_HOME or --android_ndk_home: must be a directory containing the Android NDK")
|
||||
parser.error("Invalid $ANDROID_NDK_HOME or --android-ndk-home: must be a directory containing the Android NDK")
|
||||
if args.android_api is None:
|
||||
with section_printer.group("Detect Android APIS"):
|
||||
args.android_api = releaser._detect_android_api(android_home=args.android_home)
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Main include header for the SDL library, version 3.2.26
|
||||
* Main include header for the SDL library, version 3.2.28
|
||||
*
|
||||
* It is almost always best to include just this one header instead of
|
||||
* picking out individual headers included here. There are exceptions to
|
||||
|
||||
@@ -280,12 +280,14 @@ _m_prefetch(void *__P)
|
||||
* \sa SDL_TARGETING
|
||||
*/
|
||||
#define SDL_HAS_TARGET_ATTRIBS
|
||||
|
||||
#elif defined(__loongarch64) && defined(__GNUC__) && (__GNUC__ >= 15)
|
||||
/* LoongArch requires GCC 15+ for target attribute support */
|
||||
# define SDL_HAS_TARGET_ATTRIBS
|
||||
#elif defined(__clang__) && defined(__has_attribute)
|
||||
# if __has_attribute(target)
|
||||
# define SDL_HAS_TARGET_ATTRIBS
|
||||
# endif
|
||||
#elif defined(__GNUC__) && (__GNUC__ + (__GNUC_MINOR__ >= 9) > 4) /* gcc >= 4.9 */
|
||||
#elif defined(__GNUC__) && !defined(__loongarch64) && (__GNUC__ + (__GNUC_MINOR__ >= 9) > 4) /* gcc >= 4.9 */
|
||||
# define SDL_HAS_TARGET_ATTRIBS
|
||||
#elif defined(__ICC) && __ICC >= 1600
|
||||
# define SDL_HAS_TARGET_ATTRIBS
|
||||
|
||||
@@ -62,7 +62,7 @@ extern "C" {
|
||||
*
|
||||
* \since This macro is available since SDL 3.2.0.
|
||||
*/
|
||||
#define SDL_MICRO_VERSION 26
|
||||
#define SDL_MICRO_VERSION 28
|
||||
|
||||
/**
|
||||
* This macro turns the version numbers into a numeric value.
|
||||
|
||||
@@ -1254,7 +1254,11 @@ void SDL_PlaybackAudioThreadShutdown(SDL_AudioDevice *device)
|
||||
const int frames = device->buffer_size / SDL_AUDIO_FRAMESIZE(device->spec);
|
||||
// Wait for the audio to drain if device didn't die.
|
||||
if (!SDL_GetAtomicInt(&device->zombie)) {
|
||||
SDL_Delay(((frames * 1000) / device->spec.freq) * 2);
|
||||
int delay = ((frames * 1000) / device->spec.freq) * 2;
|
||||
if (delay > 100) {
|
||||
delay = 100;
|
||||
}
|
||||
SDL_Delay(delay);
|
||||
}
|
||||
current_audio.impl.ThreadDeinit(device);
|
||||
SDL_AudioThreadFinalize(device);
|
||||
|
||||
@@ -461,8 +461,6 @@ static void ALSA_CloseDevice(SDL_AudioDevice *device)
|
||||
{
|
||||
if (device->hidden) {
|
||||
if (device->hidden->pcm) {
|
||||
// Wait for the submitted audio to drain. ALSA_snd_pcm_drop() can hang, so don't use that.
|
||||
SDL_Delay(((device->sample_frames * 1000) / device->spec.freq) * 2);
|
||||
ALSA_snd_pcm_close(device->hidden->pcm);
|
||||
}
|
||||
SDL_free(device->hidden->mixbuf);
|
||||
|
||||
@@ -595,6 +595,71 @@ static void PulseStreamStateChangeCallback(pa_stream *stream, void *userdata)
|
||||
PULSEAUDIO_pa_threaded_mainloop_signal(pulseaudio_threaded_mainloop, 0); // just signal any waiting code, it can look up the details.
|
||||
}
|
||||
|
||||
// Channel maps that match the order in SDL_Audio.h
|
||||
static const pa_channel_position_t Pulse_map_1[] = { PA_CHANNEL_POSITION_MONO };
|
||||
static const pa_channel_position_t Pulse_map_2[] = { PA_CHANNEL_POSITION_FRONT_LEFT, PA_CHANNEL_POSITION_FRONT_RIGHT };
|
||||
|
||||
static const pa_channel_position_t Pulse_map_3[] = { PA_CHANNEL_POSITION_FRONT_LEFT, PA_CHANNEL_POSITION_FRONT_RIGHT,
|
||||
PA_CHANNEL_POSITION_LFE };
|
||||
|
||||
static const pa_channel_position_t Pulse_map_4[] = { PA_CHANNEL_POSITION_FRONT_LEFT, PA_CHANNEL_POSITION_FRONT_RIGHT,
|
||||
PA_CHANNEL_POSITION_REAR_LEFT, PA_CHANNEL_POSITION_REAR_RIGHT };
|
||||
|
||||
static const pa_channel_position_t Pulse_map_5[] = { PA_CHANNEL_POSITION_FRONT_LEFT, PA_CHANNEL_POSITION_FRONT_RIGHT,
|
||||
PA_CHANNEL_POSITION_LFE,
|
||||
PA_CHANNEL_POSITION_REAR_LEFT, PA_CHANNEL_POSITION_REAR_RIGHT };
|
||||
|
||||
static const pa_channel_position_t Pulse_map_6[] = { PA_CHANNEL_POSITION_FRONT_LEFT, PA_CHANNEL_POSITION_FRONT_RIGHT,
|
||||
PA_CHANNEL_POSITION_FRONT_CENTER, PA_CHANNEL_POSITION_LFE,
|
||||
PA_CHANNEL_POSITION_REAR_LEFT, PA_CHANNEL_POSITION_REAR_RIGHT };
|
||||
|
||||
static const pa_channel_position_t Pulse_map_7[] = { PA_CHANNEL_POSITION_FRONT_LEFT, PA_CHANNEL_POSITION_FRONT_RIGHT,
|
||||
PA_CHANNEL_POSITION_FRONT_CENTER, PA_CHANNEL_POSITION_LFE,
|
||||
PA_CHANNEL_POSITION_REAR_CENTER,
|
||||
PA_CHANNEL_POSITION_SIDE_LEFT, PA_CHANNEL_POSITION_SIDE_RIGHT };
|
||||
|
||||
static const pa_channel_position_t Pulse_map_8[] = { PA_CHANNEL_POSITION_FRONT_LEFT, PA_CHANNEL_POSITION_FRONT_RIGHT,
|
||||
PA_CHANNEL_POSITION_FRONT_CENTER, PA_CHANNEL_POSITION_LFE,
|
||||
PA_CHANNEL_POSITION_REAR_LEFT, PA_CHANNEL_POSITION_REAR_RIGHT,
|
||||
PA_CHANNEL_POSITION_SIDE_LEFT, PA_CHANNEL_POSITION_SIDE_RIGHT };
|
||||
|
||||
#define COPY_CHANNEL_MAP(c) SDL_memcpy(pacmap->map, Pulse_map_##c, sizeof(Pulse_map_##c))
|
||||
|
||||
static void PulseCreateChannelMap(pa_channel_map *pacmap, uint8_t channels)
|
||||
{
|
||||
SDL_assert(channels <= PA_CHANNELS_MAX);
|
||||
|
||||
pacmap->channels = channels;
|
||||
|
||||
switch (channels) {
|
||||
case 1:
|
||||
COPY_CHANNEL_MAP(1);
|
||||
break;
|
||||
case 2:
|
||||
COPY_CHANNEL_MAP(2);
|
||||
break;
|
||||
case 3:
|
||||
COPY_CHANNEL_MAP(3);
|
||||
break;
|
||||
case 4:
|
||||
COPY_CHANNEL_MAP(4);
|
||||
break;
|
||||
case 5:
|
||||
COPY_CHANNEL_MAP(5);
|
||||
break;
|
||||
case 6:
|
||||
COPY_CHANNEL_MAP(6);
|
||||
break;
|
||||
case 7:
|
||||
COPY_CHANNEL_MAP(7);
|
||||
break;
|
||||
case 8:
|
||||
COPY_CHANNEL_MAP(8);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static bool PULSEAUDIO_OpenDevice(SDL_AudioDevice *device)
|
||||
{
|
||||
const bool recording = device->recording;
|
||||
@@ -683,9 +748,8 @@ static bool PULSEAUDIO_OpenDevice(SDL_AudioDevice *device)
|
||||
PULSEAUDIO_pa_threaded_mainloop_lock(pulseaudio_threaded_mainloop);
|
||||
|
||||
const char *name = SDL_GetHint(SDL_HINT_AUDIO_DEVICE_STREAM_NAME);
|
||||
// The SDL ALSA output hints us that we use Windows' channel mapping
|
||||
// https://bugzilla.libsdl.org/show_bug.cgi?id=110
|
||||
PULSEAUDIO_pa_channel_map_init_auto(&pacmap, device->spec.channels, PA_CHANNEL_MAP_WAVEEX);
|
||||
|
||||
PulseCreateChannelMap(&pacmap, device->spec.channels);
|
||||
|
||||
h->stream = PULSEAUDIO_pa_stream_new(
|
||||
pulseaudio_context,
|
||||
|
||||
@@ -570,7 +570,7 @@ static bool V4L2_OpenDevice(SDL_Camera *device, const SDL_CameraSpec *spec)
|
||||
setfps.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
|
||||
if (xioctl(fd, VIDIOC_G_PARM, &setfps) == 0) {
|
||||
if ( (setfps.parm.capture.timeperframe.denominator != spec->framerate_numerator) ||
|
||||
(setfps.parm.capture.timeperframe.numerator = spec->framerate_denominator) ) {
|
||||
(setfps.parm.capture.timeperframe.numerator != spec->framerate_denominator) ) {
|
||||
setfps.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
|
||||
setfps.parm.capture.timeperframe.numerator = spec->framerate_denominator;
|
||||
setfps.parm.capture.timeperframe.denominator = spec->framerate_numerator;
|
||||
|
||||
@@ -207,7 +207,6 @@ Sint32 JNI_OnLoad(void *vm, void *reserved)
|
||||
{
|
||||
(void)vm;
|
||||
(void)reserved;
|
||||
SDL_Unsupported();
|
||||
return -1; // JNI_ERR
|
||||
return 0x00010004; // JNI_VERSION_1_4
|
||||
}
|
||||
#endif
|
||||
@@ -270,6 +270,24 @@ static BOOL IsWindowsVersionOrGreater(WORD wMajorVersion, WORD wMinorVersion, WO
|
||||
return result;
|
||||
#endif
|
||||
|
||||
BOOL WIN_IsWine(void)
|
||||
{
|
||||
static bool checked;
|
||||
static bool is_wine;
|
||||
|
||||
if (!checked) {
|
||||
HMODULE ntdll = LoadLibrary(TEXT("ntdll.dll"));
|
||||
if (ntdll) {
|
||||
if (GetProcAddress(ntdll, "wine_get_version") != NULL) {
|
||||
is_wine = true;
|
||||
}
|
||||
FreeLibrary(ntdll);
|
||||
}
|
||||
checked = true;
|
||||
}
|
||||
return is_wine;
|
||||
}
|
||||
|
||||
// this is the oldest thing we run on (and we may lose support for this in SDL3 at any time!),
|
||||
// so there's no "OrGreater" as that would always be TRUE. The other functions are here to
|
||||
// ask "can we support a specific feature?" but this function is here to ask "do we need to do
|
||||
|
||||
@@ -133,6 +133,9 @@ extern void WIN_CoUninitialize(void);
|
||||
extern HRESULT WIN_RoInitialize(void);
|
||||
extern void WIN_RoUninitialize(void);
|
||||
|
||||
// Returns true if we're running on Wine
|
||||
extern BOOL WIN_IsWine(void);
|
||||
|
||||
// Returns true if we're running on Windows XP (any service pack). DOES NOT CHECK XP "OR GREATER"!
|
||||
extern BOOL WIN_IsWindowsXP(void);
|
||||
|
||||
|
||||
@@ -9,8 +9,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 3,2,26,0
|
||||
PRODUCTVERSION 3,2,26,0
|
||||
FILEVERSION 3,2,28,0
|
||||
PRODUCTVERSION 3,2,28,0
|
||||
FILEFLAGSMASK 0x3fL
|
||||
FILEFLAGS 0x0L
|
||||
FILEOS 0x40004L
|
||||
@@ -23,12 +23,12 @@ BEGIN
|
||||
BEGIN
|
||||
VALUE "CompanyName", "\0"
|
||||
VALUE "FileDescription", "SDL\0"
|
||||
VALUE "FileVersion", "3, 2, 26, 0\0"
|
||||
VALUE "FileVersion", "3, 2, 28, 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, 26, 0\0"
|
||||
VALUE "ProductVersion", "3, 2, 28, 0\0"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
|
||||
@@ -1108,7 +1108,8 @@ static int SDL_PeepEventsInternal(SDL_Event *events, int numevents, SDL_EventAct
|
||||
if (action == SDL_ADDEVENT) {
|
||||
if (!events) {
|
||||
SDL_UnlockMutex(SDL_EventQ.lock);
|
||||
return SDL_InvalidParamError("events");
|
||||
SDL_InvalidParamError("events");
|
||||
return -1;
|
||||
}
|
||||
for (i = 0; i < numevents; ++i) {
|
||||
used += SDL_AddEvent(&events[i]);
|
||||
|
||||
@@ -46,8 +46,10 @@ static bool send_foregrounding_pending = false;
|
||||
|
||||
static void SDL_HandleSIG(int sig)
|
||||
{
|
||||
// Reset the signal handler
|
||||
#ifndef HAVE_SIGACTION
|
||||
// Reset the signal handler if it was installed with signal()
|
||||
(void)signal(sig, SDL_HandleSIG);
|
||||
#endif
|
||||
|
||||
// Send a quit event next time the event loop pumps.
|
||||
// We can't send it in signal handler; SDL_malloc() might be interrupted!
|
||||
|
||||
@@ -876,7 +876,7 @@ struct D3D12Renderer
|
||||
SDL_SharedObject *d3d12_dll;
|
||||
ID3D12Device *device;
|
||||
PFN_D3D12_SERIALIZE_ROOT_SIGNATURE D3D12SerializeRootSignature_func;
|
||||
const char *semantic;
|
||||
char *semantic;
|
||||
SDL_iconv_t iconv;
|
||||
|
||||
ID3D12CommandQueue *commandQueue;
|
||||
@@ -1739,6 +1739,7 @@ static void D3D12_INTERNAL_DestroyRenderer(D3D12Renderer *renderer)
|
||||
SDL_DestroyMutex(renderer->windowLock);
|
||||
SDL_DestroyMutex(renderer->fenceLock);
|
||||
SDL_DestroyMutex(renderer->disposeLock);
|
||||
SDL_free(renderer->semantic);
|
||||
SDL_free(renderer);
|
||||
}
|
||||
|
||||
@@ -5952,7 +5953,7 @@ static void D3D12_UploadToTexture(
|
||||
SDL_memcpy(
|
||||
temporaryBuffer->mapPointer + (sliceIndex * rowsPerSlice) + (rowIndex * alignedRowPitch),
|
||||
transferBufferContainer->activeBuffer->mapPointer + source->offset + (sliceIndex * bytesPerSlice) + (rowIndex * rowPitch),
|
||||
alignedRowPitch);
|
||||
rowPitch);
|
||||
}
|
||||
Uint32 offset = source->offset + (sliceIndex * bytesPerSlice) + ((rowsPerSlice - 1) * rowPitch);
|
||||
SDL_memcpy(
|
||||
@@ -9212,7 +9213,7 @@ static SDL_GPUDevice *D3D12_CreateDevice(bool debugMode, bool preferLowPower, SD
|
||||
renderer->debug_mode = debugMode;
|
||||
renderer->allowedFramesInFlight = 2;
|
||||
|
||||
renderer->semantic = SDL_GetStringProperty(props, SDL_PROP_GPU_DEVICE_CREATE_D3D12_SEMANTIC_NAME_STRING, "TEXCOORD");
|
||||
renderer->semantic = SDL_strdup(SDL_GetStringProperty(props, SDL_PROP_GPU_DEVICE_CREATE_D3D12_SEMANTIC_NAME_STRING, "TEXCOORD"));
|
||||
|
||||
// Blit resources
|
||||
D3D12_INTERNAL_InitBlitResources(renderer);
|
||||
|
||||
@@ -7169,6 +7169,8 @@ static VkRenderPass VULKAN_INTERNAL_FetchRenderPass(
|
||||
key.sampleCount = VK_SAMPLE_COUNT_1_BIT;
|
||||
if (numColorTargets > 0) {
|
||||
key.sampleCount = SDLToVK_SampleCount[((VulkanTextureContainer *)colorTargetInfos[0].texture)->header.info.sample_count];
|
||||
} else if (numColorTargets == 0 && depthStencilTargetInfo != NULL) {
|
||||
key.sampleCount = SDLToVK_SampleCount[((VulkanTextureContainer *)depthStencilTargetInfo->texture)->header.info.sample_count];
|
||||
}
|
||||
|
||||
key.numColorTargets = numColorTargets;
|
||||
|
||||
@@ -32,10 +32,11 @@
|
||||
#include "hidapi/SDL_hidapi_nintendo.h"
|
||||
#include "../events/SDL_events_c.h"
|
||||
|
||||
|
||||
#ifdef SDL_PLATFORM_ANDROID
|
||||
#ifdef SDL_PLATFORM_WIN32
|
||||
#include "../core/windows/SDL_windows.h"
|
||||
#endif
|
||||
|
||||
|
||||
// Many gamepads turn the center button into an instantaneous button press
|
||||
#define SDL_MINIMUM_GUIDE_BUTTON_DELAY_MS 250
|
||||
|
||||
@@ -822,7 +823,7 @@ static GamepadMapping_t *SDL_CreateMappingForHIDAPIGamepad(SDL_GUID guid)
|
||||
|
||||
if (SDL_IsJoystickSteamController(vendor, product)) {
|
||||
// Steam controllers have 2 back paddle buttons
|
||||
SDL_strlcat(mapping_string, "paddle1:b12,paddle2:b11,", sizeof(mapping_string));
|
||||
SDL_strlcat(mapping_string, "paddle1:b11,paddle2:b12,", sizeof(mapping_string));
|
||||
} else if (SDL_IsJoystickNintendoSwitchPro(vendor, product) ||
|
||||
SDL_IsJoystickNintendoSwitchProInputOnly(vendor, product)) {
|
||||
// Nintendo Switch Pro controllers have a screenshot button
|
||||
@@ -1774,17 +1775,6 @@ static GamepadMapping_t *SDL_PrivateGetGamepadMappingForNameAndGUID(const char *
|
||||
SDL_AssertJoysticksLocked();
|
||||
|
||||
mapping = SDL_PrivateGetGamepadMappingForGUID(guid, false);
|
||||
#ifdef SDL_PLATFORM_LINUX
|
||||
if (!mapping && name) {
|
||||
if (SDL_strstr(name, "Xbox 360 Wireless Receiver")) {
|
||||
// The Linux driver xpad.c maps the wireless dpad to buttons
|
||||
bool existing;
|
||||
mapping = SDL_PrivateAddMappingForGUID(guid,
|
||||
"none,X360 Wireless Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b11,dpright:b12,dpup:b13,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
|
||||
&existing, SDL_GAMEPAD_MAPPING_PRIORITY_DEFAULT);
|
||||
}
|
||||
}
|
||||
#endif // SDL_PLATFORM_LINUX
|
||||
|
||||
return mapping;
|
||||
}
|
||||
@@ -2737,10 +2727,10 @@ bool SDL_ShouldIgnoreGamepad(Uint16 vendor_id, Uint16 product_id, Uint16 version
|
||||
|
||||
#ifdef SDL_PLATFORM_WIN32
|
||||
if (SDL_GetHintBoolean("SDL_GAMECONTROLLER_ALLOW_STEAM_VIRTUAL_GAMEPAD", false) &&
|
||||
SDL_GetHintBoolean("STEAM_COMPAT_PROTON", false)) {
|
||||
// We are launched by Steam and running under Proton
|
||||
WIN_IsWine()) {
|
||||
// We are launched by Steam and running under Proton or Wine
|
||||
// We can't tell whether this controller is a Steam Virtual Gamepad,
|
||||
// so assume that Proton is doing the appropriate filtering of controllers
|
||||
// so assume that is doing the appropriate filtering of controllers
|
||||
// and anything we see here is fine to use.
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -540,7 +540,6 @@ static const char *s_GamepadMappings[] = {
|
||||
"03000000503200000210000000000000,Atari Game Controller,a:b0,b:b1,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a4,rightx:a2,righty:a3,start:b8,x:b2,y:b3,",
|
||||
"05000000503200000210000000000000,Atari Game Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b3,y:b2,",
|
||||
"05000000503200000210000000000000128804098,Atari Game Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b3,y:b2,",
|
||||
"030000005e0400008e02000047010000,Atari Xbox 360 Game Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
|
||||
"03000000c62400001b89000011010000,BDA MOGA XP5-X Plus,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,",
|
||||
"03000000d62000002a79000011010000,BDA PS4 Fightpad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
|
||||
"03000000120c0000f70e000011010000,Brook Universal Fighting Board,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:,lefty:,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:,righty:,start:b9,x:b0,y:b3,",
|
||||
@@ -630,8 +629,6 @@ static const char *s_GamepadMappings[] = {
|
||||
"03000000790000004418000010010000,Mayflash GameCube Controller,a:b1,b:b2,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:a4,rightx:a5,righty:a2,start:b9,x:b0,y:b3,",
|
||||
"03000000780000000600000010010000,Microntek USB Joystick,a:b2,b:b1,back:b8,leftshoulder:b6,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b5,start:b9,x:b3,y:b0,",
|
||||
"030000005e0400000e00000000010000,Microsoft SideWinder,a:b0,b:b1,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,rightshoulder:b7,start:b8,x:b3,y:b4,",
|
||||
"030000005e0400008e02000004010000,Microsoft X-Box 360 pad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
|
||||
"030000005e0400008e02000062230000,Microsoft X-Box 360 pad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
|
||||
"030000005e040000d102000003020000,Microsoft X-Box One pad v2,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
|
||||
"030000005e040000d102000001010000,Microsoft X-Box One pad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
|
||||
"030000005e0400008502000000010000,Microsoft X-Box pad (Japan),a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b5,leftstick:b8,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b2,rightstick:b9,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b3,y:b4,",
|
||||
@@ -746,8 +743,6 @@ static const char *s_GamepadMappings[] = {
|
||||
"03000000f025000021c1000010010000,ShanWan Gioteck PS3 Wired Controller,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,",
|
||||
"03000000632500002305000010010000,ShanWan USB Gamepad,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,",
|
||||
"03000000250900000500000000010000,Sony PS2 pad with SmartJoy adapter,a:b2,b:b1,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a2,righty:a3,start:b8,x:b3,y:b0,",
|
||||
"030000005e0400008e02000020200000,SpeedLink XEOX Pro Analog Gamepad pad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
|
||||
"030000005e0400008e02000073050000,Speedlink TORID Wireless Gamepad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
|
||||
"03000000de2800000112000001000000,Steam Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,paddle1:b11,paddle2:b10,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,",
|
||||
"03000000de2800000112000011010000,Steam Controller,a:b2,b:b3,back:b10,dpdown:+a5,dpleft:-a4,dpright:+a4,dpup:-a5,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a7,leftx:a0,lefty:a1,paddle1:b15,paddle2:b16,rightshoulder:b7,rightstick:b14,righttrigger:a6,rightx:a2,righty:a3,start:b11,x:b4,y:b5,",
|
||||
"03000000de2800000211000001000000,Steam Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,paddle1:b11,paddle2:b10,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,",
|
||||
@@ -784,15 +779,8 @@ static const char *s_GamepadMappings[] = {
|
||||
"030000006f0e00000702000011010000,Victrix Pro Fight Stick for PS4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,",
|
||||
"030000000d0f0000ab01000011010000,Wireless HORIPAD For Steam,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,misc2:b2,misc3:b16,misc4:b17,paddle1:b19,paddle2:b18,paddle3:b15,paddle4:b5,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,",
|
||||
"050000000d0f00009601000091000000,Wireless HORIPAD For Steam,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,misc2:b2,misc3:b16,misc4:b17,paddle1:b19,paddle2:b18,paddle3:b15,paddle4:b5,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,",
|
||||
"030000005e0400008e02000010010000,X360 Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
|
||||
"030000005e0400008e02000014010000,X360 Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
|
||||
"030000005e0400001907000000010000,X360 Wireless Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b11,dpright:b12,dpup:b13,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
|
||||
"030000005e0400009102000007010000,X360 Wireless Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b11,dpright:b12,dpup:b13,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
|
||||
"030000005e040000a102000000010000,X360 Wireless Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b11,dpright:b12,dpup:b13,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
|
||||
"030000005e040000a102000007010000,X360 Wireless Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
|
||||
"03000000450c00002043000010010000,XEOX Gamepad SL-6556-BK,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,",
|
||||
"0000000058626f782033363020576900,Xbox 360 Wireless Controller,a:b0,b:b1,back:b14,dpdown:b11,dpleft:b12,dpright:b13,dpup:b10,guide:b7,leftshoulder:b4,leftstick:b8,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a5,rightx:a3,righty:a4,start:b6,x:b2,y:b3,",
|
||||
"030000005e040000a102000014010000,Xbox 360 Wireless Receiver (XBOX),a:b0,b:b1,back:b6,dpdown:b14,dpleft:b11,dpright:b12,dpup:b13,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
|
||||
"0000000058626f782047616d65706100,Xbox Gamepad (userspace driver),a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a4,rightx:a2,righty:a3,start:b7,x:b2,y:b3,",
|
||||
"050000005e040000e002000003090000,Xbox One Wireless Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b8,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,",
|
||||
"050000005e040000fd02000003090000,Xbox One Wireless Controller,a:b0,b:b1,back:b15,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,guide:b16,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,",
|
||||
|
||||
@@ -23,6 +23,9 @@
|
||||
#include "SDL_joystick_c.h"
|
||||
#include "SDL_steam_virtual_gamepad.h"
|
||||
|
||||
#ifdef SDL_PLATFORM_LINUX
|
||||
#include "../core/unix/SDL_appid.h"
|
||||
#endif
|
||||
#ifdef SDL_PLATFORM_WIN32
|
||||
#include "../core/windows/SDL_windows.h"
|
||||
#else
|
||||
@@ -134,6 +137,15 @@ void SDL_InitSteamVirtualGamepadInfo(void)
|
||||
|
||||
file = SDL_GetHint(SDL_HINT_STEAM_VIRTUAL_GAMEPAD_INFO_FILE);
|
||||
if (file && *file) {
|
||||
#ifdef SDL_PLATFORM_LINUX
|
||||
// Older versions of Wine will blacklist the Steam Virtual Gamepad if
|
||||
// it appears to have the real controller's VID/PID, so ignore this.
|
||||
const char *exe = SDL_GetExeName();
|
||||
if (exe && SDL_strcmp(exe, "wine64-preloader") == 0) {
|
||||
SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, "Wine launched by Steam, ignoring %s", SDL_HINT_STEAM_VIRTUAL_GAMEPAD_INFO_FILE);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
SDL_steam_virtual_gamepad_info_file = SDL_strdup(file);
|
||||
}
|
||||
SDL_UpdateSteamVirtualGamepadInfo();
|
||||
|
||||
@@ -706,13 +706,6 @@ static void RotatePad(int *pX, int *pY, float flAngleInRad)
|
||||
*pX = (int)(SDL_cosf(flAngleInRad) * origX - SDL_sinf(flAngleInRad) * origY);
|
||||
*pY = (int)(SDL_sinf(flAngleInRad) * origX + SDL_cosf(flAngleInRad) * origY);
|
||||
}
|
||||
static void RotatePadShort(short *pX, short *pY, float flAngleInRad)
|
||||
{
|
||||
int origX = *pX, origY = *pY;
|
||||
|
||||
*pX = (short)(SDL_cosf(flAngleInRad) * origX - SDL_sinf(flAngleInRad) * origY);
|
||||
*pY = (short)(SDL_sinf(flAngleInRad) * origX + SDL_cosf(flAngleInRad) * origY);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
// Format the first part of the state packet
|
||||
@@ -836,9 +829,16 @@ static void FormatStatePacketUntilGyro(SteamControllerStateInternal_t *pState, V
|
||||
//---------------------------------------------------------------------------
|
||||
static bool UpdateBLESteamControllerState(const uint8_t *pData, int nDataSize, SteamControllerStateInternal_t *pState)
|
||||
{
|
||||
const float flRotationAngle = 0.261799f;
|
||||
int nLeftPadX;
|
||||
int nLeftPadY;
|
||||
int nRightPadX;
|
||||
int nRightPadY;
|
||||
int nPadOffset;
|
||||
uint32_t ucOptionDataMask;
|
||||
|
||||
// 15 degrees in rad
|
||||
const float flRotationAngle = 0.261799f;
|
||||
|
||||
pState->unPacketNum++;
|
||||
ucOptionDataMask = (*pData++ & 0xF0);
|
||||
ucOptionDataMask |= (uint32_t)(*pData++) << 8;
|
||||
@@ -867,7 +867,6 @@ static bool UpdateBLESteamControllerState(const uint8_t *pData, int nDataSize, S
|
||||
}
|
||||
if (ucOptionDataMask & k_EBLELeftTrackpadChunk) {
|
||||
int nLength = sizeof(pState->sLeftPadX) + sizeof(pState->sLeftPadY);
|
||||
int nPadOffset;
|
||||
SDL_memcpy(&pState->sLeftPadX, pData, nLength);
|
||||
if (pState->ulButtons & STEAM_LEFTPAD_FINGERDOWN_MASK) {
|
||||
nPadOffset = 1000;
|
||||
@@ -875,14 +874,15 @@ static bool UpdateBLESteamControllerState(const uint8_t *pData, int nDataSize, S
|
||||
nPadOffset = 0;
|
||||
}
|
||||
|
||||
RotatePadShort(&pState->sLeftPadX, &pState->sLeftPadY, -flRotationAngle);
|
||||
pState->sLeftPadX = (short)clamp(pState->sLeftPadX + nPadOffset, SDL_MIN_SINT16, SDL_MAX_SINT16);
|
||||
pState->sLeftPadY = (short)clamp(pState->sLeftPadY + nPadOffset, SDL_MIN_SINT16, SDL_MAX_SINT16);
|
||||
nLeftPadX = pState->sLeftPadX;
|
||||
nLeftPadY = pState->sLeftPadY;
|
||||
RotatePad(&nLeftPadX, &nLeftPadY, -flRotationAngle);
|
||||
pState->sLeftPadX = (short)clamp(nLeftPadX + nPadOffset, SDL_MIN_SINT16, SDL_MAX_SINT16);
|
||||
pState->sLeftPadY = (short)clamp(nLeftPadY + nPadOffset, SDL_MIN_SINT16, SDL_MAX_SINT16);
|
||||
pData += nLength;
|
||||
}
|
||||
if (ucOptionDataMask & k_EBLERightTrackpadChunk) {
|
||||
int nLength = sizeof(pState->sRightPadX) + sizeof(pState->sRightPadY);
|
||||
int nPadOffset = 0;
|
||||
|
||||
SDL_memcpy(&pState->sRightPadX, pData, nLength);
|
||||
|
||||
@@ -892,9 +892,11 @@ static bool UpdateBLESteamControllerState(const uint8_t *pData, int nDataSize, S
|
||||
nPadOffset = 0;
|
||||
}
|
||||
|
||||
RotatePadShort(&pState->sRightPadX, &pState->sRightPadY, flRotationAngle);
|
||||
pState->sRightPadX = (short)clamp(pState->sRightPadX + nPadOffset, SDL_MIN_SINT16, SDL_MAX_SINT16);
|
||||
pState->sRightPadY = (short)clamp(pState->sRightPadY + nPadOffset, SDL_MIN_SINT16, SDL_MAX_SINT16);
|
||||
nRightPadX = pState->sRightPadX;
|
||||
nRightPadY = pState->sRightPadY;
|
||||
RotatePad(&nRightPadX, &nRightPadY, flRotationAngle);
|
||||
pState->sRightPadX = (short)clamp(nRightPadX + nPadOffset, SDL_MIN_SINT16, SDL_MAX_SINT16);
|
||||
pState->sRightPadY = (short)clamp(nRightPadY + nPadOffset, SDL_MIN_SINT16, SDL_MAX_SINT16);
|
||||
pData += nLength;
|
||||
}
|
||||
if (ucOptionDataMask & k_EBLEIMUAccelChunk) {
|
||||
|
||||
@@ -159,20 +159,21 @@ typedef struct
|
||||
Uint8 ucVibrationCode;
|
||||
} SwitchControllerStatePacket_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Sint16 sAccelX;
|
||||
Sint16 sAccelY;
|
||||
Sint16 sAccelZ;
|
||||
|
||||
Sint16 sGyroX;
|
||||
Sint16 sGyroY;
|
||||
Sint16 sGyroZ;
|
||||
} SwitchControllerIMUState_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
SwitchControllerStatePacket_t controllerState;
|
||||
|
||||
struct
|
||||
{
|
||||
Sint16 sAccelX;
|
||||
Sint16 sAccelY;
|
||||
Sint16 sAccelZ;
|
||||
|
||||
Sint16 sGyroX;
|
||||
Sint16 sGyroY;
|
||||
Sint16 sGyroZ;
|
||||
} imuState[3];
|
||||
SwitchControllerIMUState_t imuState[3];
|
||||
} SwitchStatePacket_t;
|
||||
|
||||
typedef struct
|
||||
@@ -388,7 +389,7 @@ static int WriteOutput(SDL_DriverSwitch_Context *ctx, const Uint8 *data, int siz
|
||||
#endif // SWITCH_SYNCHRONOUS_WRITES
|
||||
}
|
||||
|
||||
static SwitchSubcommandInputPacket_t *ReadSubcommandReply(SDL_DriverSwitch_Context *ctx, ESwitchSubcommandIDs expectedID)
|
||||
static SwitchSubcommandInputPacket_t *ReadSubcommandReply(SDL_DriverSwitch_Context *ctx, ESwitchSubcommandIDs expectedID, const Uint8 *pBuf, Uint8 ucLen)
|
||||
{
|
||||
// Average response time for messages is ~30ms
|
||||
Uint64 endTicks = SDL_GetTicks() + 100;
|
||||
@@ -398,9 +399,17 @@ static SwitchSubcommandInputPacket_t *ReadSubcommandReply(SDL_DriverSwitch_Conte
|
||||
if (nRead > 0) {
|
||||
if (ctx->m_rgucReadBuffer[0] == k_eSwitchInputReportIDs_SubcommandReply) {
|
||||
SwitchSubcommandInputPacket_t *reply = (SwitchSubcommandInputPacket_t *)&ctx->m_rgucReadBuffer[1];
|
||||
if (reply->ucSubcommandID == expectedID && (reply->ucSubcommandAck & 0x80)) {
|
||||
return reply;
|
||||
if (reply->ucSubcommandID != expectedID || !(reply->ucSubcommandAck & 0x80)) {
|
||||
continue;
|
||||
}
|
||||
if (reply->ucSubcommandID == k_eSwitchSubcommandIDs_SPIFlashRead) {
|
||||
SDL_assert(ucLen == sizeof(reply->spiReadData.opData));
|
||||
if (SDL_memcmp(&reply->spiReadData.opData, pBuf, ucLen) != 0) {
|
||||
// This was a reply for another SPI read command
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return reply;
|
||||
}
|
||||
} else {
|
||||
SDL_Delay(1);
|
||||
@@ -487,7 +496,7 @@ static bool WriteSubcommand(SDL_DriverSwitch_Context *ctx, ESwitchSubcommandIDs
|
||||
continue;
|
||||
}
|
||||
|
||||
reply = ReadSubcommandReply(ctx, ucCommandID);
|
||||
reply = ReadSubcommandReply(ctx, ucCommandID, pBuf, ucLen);
|
||||
}
|
||||
|
||||
if (ppReply) {
|
||||
@@ -2589,9 +2598,14 @@ static void HandleFullControllerState(SDL_Joystick *joystick, SDL_DriverSwitch_C
|
||||
SDL_SendJoystickPowerInfo(joystick, state, percent);
|
||||
|
||||
if (ctx->m_bReportSensors) {
|
||||
bool bHasSensorData = (packet->imuState[0].sAccelZ != 0 ||
|
||||
packet->imuState[0].sAccelY != 0 ||
|
||||
packet->imuState[0].sAccelX != 0);
|
||||
// Need to copy the imuState to an aligned variable
|
||||
SwitchControllerIMUState_t imuState[3];
|
||||
SDL_assert(sizeof(imuState) == sizeof(packet->imuState));
|
||||
SDL_memcpy(imuState, packet->imuState, sizeof(imuState));
|
||||
|
||||
bool bHasSensorData = (imuState[0].sAccelZ != 0 ||
|
||||
imuState[0].sAccelY != 0 ||
|
||||
imuState[0].sAccelX != 0);
|
||||
if (bHasSensorData) {
|
||||
const Uint32 IMU_UPDATE_RATE_SAMPLE_FREQUENCY = 1000;
|
||||
Uint64 sensor_timestamp[3];
|
||||
@@ -2620,37 +2634,37 @@ static void HandleFullControllerState(SDL_Joystick *joystick, SDL_DriverSwitch_C
|
||||
|
||||
if (!ctx->device->parent ||
|
||||
ctx->m_eControllerType == k_eSwitchDeviceInfoControllerType_JoyConRight) {
|
||||
SendSensorUpdate(timestamp, joystick, ctx, SDL_SENSOR_GYRO, sensor_timestamp[0], &packet->imuState[2].sGyroX);
|
||||
SendSensorUpdate(timestamp, joystick, ctx, SDL_SENSOR_ACCEL, sensor_timestamp[0], &packet->imuState[2].sAccelX);
|
||||
SendSensorUpdate(timestamp, joystick, ctx, SDL_SENSOR_GYRO, sensor_timestamp[0], &imuState[2].sGyroX);
|
||||
SendSensorUpdate(timestamp, joystick, ctx, SDL_SENSOR_ACCEL, sensor_timestamp[0], &imuState[2].sAccelX);
|
||||
|
||||
SendSensorUpdate(timestamp, joystick, ctx, SDL_SENSOR_GYRO, sensor_timestamp[1], &packet->imuState[1].sGyroX);
|
||||
SendSensorUpdate(timestamp, joystick, ctx, SDL_SENSOR_ACCEL, sensor_timestamp[1], &packet->imuState[1].sAccelX);
|
||||
SendSensorUpdate(timestamp, joystick, ctx, SDL_SENSOR_GYRO, sensor_timestamp[1], &imuState[1].sGyroX);
|
||||
SendSensorUpdate(timestamp, joystick, ctx, SDL_SENSOR_ACCEL, sensor_timestamp[1], &imuState[1].sAccelX);
|
||||
|
||||
SendSensorUpdate(timestamp, joystick, ctx, SDL_SENSOR_GYRO, sensor_timestamp[2], &packet->imuState[0].sGyroX);
|
||||
SendSensorUpdate(timestamp, joystick, ctx, SDL_SENSOR_ACCEL, sensor_timestamp[2], &packet->imuState[0].sAccelX);
|
||||
SendSensorUpdate(timestamp, joystick, ctx, SDL_SENSOR_GYRO, sensor_timestamp[2], &imuState[0].sGyroX);
|
||||
SendSensorUpdate(timestamp, joystick, ctx, SDL_SENSOR_ACCEL, sensor_timestamp[2], &imuState[0].sAccelX);
|
||||
}
|
||||
|
||||
if (ctx->device->parent &&
|
||||
ctx->m_eControllerType == k_eSwitchDeviceInfoControllerType_JoyConLeft) {
|
||||
SendSensorUpdate(timestamp, joystick, ctx, SDL_SENSOR_GYRO_L, sensor_timestamp[0], &packet->imuState[2].sGyroX);
|
||||
SendSensorUpdate(timestamp, joystick, ctx, SDL_SENSOR_ACCEL_L, sensor_timestamp[0], &packet->imuState[2].sAccelX);
|
||||
SendSensorUpdate(timestamp, joystick, ctx, SDL_SENSOR_GYRO_L, sensor_timestamp[0], &imuState[2].sGyroX);
|
||||
SendSensorUpdate(timestamp, joystick, ctx, SDL_SENSOR_ACCEL_L, sensor_timestamp[0], &imuState[2].sAccelX);
|
||||
|
||||
SendSensorUpdate(timestamp, joystick, ctx, SDL_SENSOR_GYRO_L, sensor_timestamp[1], &packet->imuState[1].sGyroX);
|
||||
SendSensorUpdate(timestamp, joystick, ctx, SDL_SENSOR_ACCEL_L, sensor_timestamp[1], &packet->imuState[1].sAccelX);
|
||||
SendSensorUpdate(timestamp, joystick, ctx, SDL_SENSOR_GYRO_L, sensor_timestamp[1], &imuState[1].sGyroX);
|
||||
SendSensorUpdate(timestamp, joystick, ctx, SDL_SENSOR_ACCEL_L, sensor_timestamp[1], &imuState[1].sAccelX);
|
||||
|
||||
SendSensorUpdate(timestamp, joystick, ctx, SDL_SENSOR_GYRO_L, sensor_timestamp[2], &packet->imuState[0].sGyroX);
|
||||
SendSensorUpdate(timestamp, joystick, ctx, SDL_SENSOR_ACCEL_L, sensor_timestamp[2], &packet->imuState[0].sAccelX);
|
||||
SendSensorUpdate(timestamp, joystick, ctx, SDL_SENSOR_GYRO_L, sensor_timestamp[2], &imuState[0].sGyroX);
|
||||
SendSensorUpdate(timestamp, joystick, ctx, SDL_SENSOR_ACCEL_L, sensor_timestamp[2], &imuState[0].sAccelX);
|
||||
}
|
||||
if (ctx->device->parent &&
|
||||
ctx->m_eControllerType == k_eSwitchDeviceInfoControllerType_JoyConRight) {
|
||||
SendSensorUpdate(timestamp, joystick, ctx, SDL_SENSOR_GYRO_R, sensor_timestamp[0], &packet->imuState[2].sGyroX);
|
||||
SendSensorUpdate(timestamp, joystick, ctx, SDL_SENSOR_ACCEL_R, sensor_timestamp[0], &packet->imuState[2].sAccelX);
|
||||
SendSensorUpdate(timestamp, joystick, ctx, SDL_SENSOR_GYRO_R, sensor_timestamp[0], &imuState[2].sGyroX);
|
||||
SendSensorUpdate(timestamp, joystick, ctx, SDL_SENSOR_ACCEL_R, sensor_timestamp[0], &imuState[2].sAccelX);
|
||||
|
||||
SendSensorUpdate(timestamp, joystick, ctx, SDL_SENSOR_GYRO_R, sensor_timestamp[1], &packet->imuState[1].sGyroX);
|
||||
SendSensorUpdate(timestamp, joystick, ctx, SDL_SENSOR_ACCEL_R, sensor_timestamp[1], &packet->imuState[1].sAccelX);
|
||||
SendSensorUpdate(timestamp, joystick, ctx, SDL_SENSOR_GYRO_R, sensor_timestamp[1], &imuState[1].sGyroX);
|
||||
SendSensorUpdate(timestamp, joystick, ctx, SDL_SENSOR_ACCEL_R, sensor_timestamp[1], &imuState[1].sAccelX);
|
||||
|
||||
SendSensorUpdate(timestamp, joystick, ctx, SDL_SENSOR_GYRO_R, sensor_timestamp[2], &packet->imuState[0].sGyroX);
|
||||
SendSensorUpdate(timestamp, joystick, ctx, SDL_SENSOR_ACCEL_R, sensor_timestamp[2], &packet->imuState[0].sAccelX);
|
||||
SendSensorUpdate(timestamp, joystick, ctx, SDL_SENSOR_GYRO_R, sensor_timestamp[2], &imuState[0].sGyroX);
|
||||
SendSensorUpdate(timestamp, joystick, ctx, SDL_SENSOR_ACCEL_R, sensor_timestamp[2], &imuState[0].sAccelX);
|
||||
}
|
||||
|
||||
} else if (ctx->m_bHasSensorData) {
|
||||
|
||||
@@ -150,6 +150,8 @@ typedef struct SDL_joylist_item
|
||||
{
|
||||
SDL_JoystickID device_instance;
|
||||
char *path; // "/dev/input/event2" or whatever
|
||||
Uint16 vendor;
|
||||
Uint16 product;
|
||||
char *name; // "SideWinder 3D Pro" or whatever
|
||||
SDL_GUID guid;
|
||||
dev_t devnum;
|
||||
@@ -486,6 +488,8 @@ static void MaybeAddDevice(const char *path)
|
||||
item->devnum = sb.st_rdev;
|
||||
item->steam_virtual_gamepad_slot = -1;
|
||||
item->path = SDL_strdup(path);
|
||||
item->vendor = vendor;
|
||||
item->product = product;
|
||||
item->name = name;
|
||||
item->guid = guid;
|
||||
|
||||
@@ -1844,6 +1848,20 @@ static void PollAllValues(Uint64 timestamp, SDL_Joystick *joystick)
|
||||
// Joyballs are relative input, so there's no poll state. Events only!
|
||||
}
|
||||
|
||||
static void CorrectSensorData(struct joystick_hwdata *hwdata, float *values, float *data)
|
||||
{
|
||||
if (hwdata->item->vendor == USB_VENDOR_NINTENDO) {
|
||||
// The Nintendo driver uses a different axis order than SDL
|
||||
data[0] = -values[1];
|
||||
data[1] = values[2];
|
||||
data[2] = -values[0];
|
||||
} else {
|
||||
data[0] = values[0];
|
||||
data[1] = values[1];
|
||||
data[2] = values[2];
|
||||
}
|
||||
}
|
||||
|
||||
static void PollAllSensors(Uint64 timestamp, SDL_Joystick *joystick)
|
||||
{
|
||||
struct input_absinfo absinfo;
|
||||
@@ -1854,27 +1872,31 @@ static void PollAllSensors(Uint64 timestamp, SDL_Joystick *joystick)
|
||||
SDL_assert(joystick->hwdata->fd_sensor >= 0);
|
||||
|
||||
if (joystick->hwdata->has_gyro) {
|
||||
float data[3] = {0.0f, 0.0f, 0.0f};
|
||||
float values[3] = {0.0f, 0.0f, 0.0f};
|
||||
for (i = 0; i < 3; i++) {
|
||||
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];
|
||||
values[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", i, data[i]);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
float data[3];
|
||||
CorrectSensorData(joystick->hwdata, values, data);
|
||||
SDL_SendJoystickSensor(timestamp, joystick, SDL_SENSOR_GYRO, SDL_US_TO_NS(joystick->hwdata->sensor_tick), data, 3);
|
||||
}
|
||||
if (joystick->hwdata->has_accelerometer) {
|
||||
float data[3] = {0.0f, 0.0f, 0.0f};
|
||||
float values[3] = {0.0f, 0.0f, 0.0f};
|
||||
for (i = 0; i < 3; i++) {
|
||||
if (ioctl(joystick->hwdata->fd_sensor, EVIOCGABS(ABS_X + i), &absinfo) >= 0) {
|
||||
data[i] = absinfo.value * SDL_STANDARD_GRAVITY / joystick->hwdata->accelerometer_scale[i];
|
||||
values[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", i, data[i]);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
float data[3];
|
||||
CorrectSensorData(joystick->hwdata, values, data);
|
||||
SDL_SendJoystickSensor(timestamp, joystick, SDL_SENSOR_ACCEL, SDL_US_TO_NS(joystick->hwdata->sensor_tick), data, 3);
|
||||
}
|
||||
}
|
||||
@@ -2058,12 +2080,15 @@ static void HandleInputEvents(SDL_Joystick *joystick)
|
||||
PollAllSensors(SDL_GetTicksNS(), joystick); // try to sync up to current state now
|
||||
} else {
|
||||
Uint64 timestamp = SDL_EVDEV_GetEventTimestamp(event);
|
||||
float data[3];
|
||||
CorrectSensorData(joystick->hwdata, joystick->hwdata->gyro_data, data);
|
||||
SDL_SendJoystickSensor(timestamp, joystick, SDL_SENSOR_GYRO,
|
||||
SDL_US_TO_NS(joystick->hwdata->sensor_tick),
|
||||
joystick->hwdata->gyro_data, 3);
|
||||
data, 3);
|
||||
CorrectSensorData(joystick->hwdata, joystick->hwdata->accel_data, data);
|
||||
SDL_SendJoystickSensor(timestamp, joystick, SDL_SENSOR_ACCEL,
|
||||
SDL_US_TO_NS(joystick->hwdata->sensor_tick),
|
||||
joystick->hwdata->accel_data, 3);
|
||||
data, 3);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -907,7 +907,7 @@ static void VULKAN_RecordPipelineImageBarrier(VULKAN_RenderData *rendererData, V
|
||||
|
||||
static VkResult VULKAN_AcquireNextSwapchainImage(SDL_Renderer *renderer)
|
||||
{
|
||||
VULKAN_RenderData *rendererData = ( VULKAN_RenderData * )renderer->internal;
|
||||
VULKAN_RenderData *rendererData = (VULKAN_RenderData *)renderer->internal;
|
||||
|
||||
VkResult result;
|
||||
|
||||
@@ -915,10 +915,12 @@ static VkResult VULKAN_AcquireNextSwapchainImage(SDL_Renderer *renderer)
|
||||
result = vkAcquireNextImageKHR(rendererData->device, rendererData->swapchain, UINT64_MAX,
|
||||
rendererData->imageAvailableSemaphores[rendererData->currentCommandBufferIndex], VK_NULL_HANDLE, &rendererData->currentSwapchainImageIndex);
|
||||
if (result == VK_ERROR_OUT_OF_DATE_KHR || result == VK_ERROR_SURFACE_LOST_KHR) {
|
||||
result = VULKAN_CreateWindowSizeDependentResources(renderer);
|
||||
if (!(renderer->window->flags & SDL_WINDOW_MINIMIZED)) {
|
||||
result = VULKAN_CreateWindowSizeDependentResources(renderer);
|
||||
}
|
||||
return result;
|
||||
} else if(result == VK_SUBOPTIMAL_KHR) {
|
||||
// Suboptimal, but we can contiue
|
||||
// Suboptimal, but we can continue
|
||||
} else if (result != VK_SUCCESS) {
|
||||
SET_ERROR_CODE("vkAcquireNextImageKHR()", result);
|
||||
return result;
|
||||
|
||||
@@ -79,7 +79,7 @@ static bool GENERIC_EnumerateStorageDirectory(void *userdata, const char *path,
|
||||
|
||||
char *fullpath = GENERIC_INTERNAL_CreateFullPath((char *)userdata, path);
|
||||
if (fullpath) {
|
||||
wrap_data.base_len = SDL_strlen((char *)userdata);
|
||||
wrap_data.base_len = userdata ? SDL_strlen((char *)userdata) : 0;
|
||||
wrap_data.real_callback = callback;
|
||||
wrap_data.real_userdata = callback_userdata;
|
||||
|
||||
|
||||
+15
-6
@@ -64,17 +64,26 @@ static bool SDLCALL SDL_SoftBlit(SDL_Surface *src, const SDL_Rect *srcrect,
|
||||
SDL_BlitInfo *info = &src->map.info;
|
||||
|
||||
// Set up the blit information
|
||||
info->src = (Uint8 *)src->pixels +
|
||||
(Uint16)srcrect->y * src->pitch +
|
||||
(Uint16)srcrect->x * info->src_fmt->bytes_per_pixel;
|
||||
if (info->src_fmt->bits_per_pixel >= 8) {
|
||||
info->src = (Uint8 *)src->pixels +
|
||||
srcrect->y * src->pitch +
|
||||
srcrect->x * info->src_fmt->bytes_per_pixel;
|
||||
} else {
|
||||
info->src = (Uint8 *)src->pixels +
|
||||
srcrect->y * src->pitch +
|
||||
(srcrect->x * info->src_fmt->bits_per_pixel) / 8;
|
||||
info->leading_skip =
|
||||
((srcrect->x * info->src_fmt->bits_per_pixel) % 8) /
|
||||
info->src_fmt->bits_per_pixel;
|
||||
}
|
||||
info->src_w = srcrect->w;
|
||||
info->src_h = srcrect->h;
|
||||
info->src_pitch = src->pitch;
|
||||
info->src_skip =
|
||||
info->src_pitch - info->src_w * info->src_fmt->bytes_per_pixel;
|
||||
info->dst =
|
||||
(Uint8 *)dst->pixels + (Uint16)dstrect->y * dst->pitch +
|
||||
(Uint16)dstrect->x * info->dst_fmt->bytes_per_pixel;
|
||||
info->dst = (Uint8 *)dst->pixels +
|
||||
dstrect->y * dst->pitch +
|
||||
dstrect->x * info->dst_fmt->bytes_per_pixel;
|
||||
info->dst_w = dstrect->w;
|
||||
info->dst_h = dstrect->h;
|
||||
info->dst_pitch = dst->pitch;
|
||||
|
||||
@@ -60,6 +60,7 @@ typedef struct
|
||||
int src_w, src_h;
|
||||
int src_pitch;
|
||||
int src_skip;
|
||||
int leading_skip;
|
||||
SDL_Surface *dst_surface;
|
||||
Uint8 *dst;
|
||||
int dst_w, dst_h;
|
||||
|
||||
+188
-30
@@ -45,6 +45,8 @@ SDL_FORCE_INLINE void BlitBto1(SDL_BlitInfo *info, const Uint32 srcbpp)
|
||||
dstskip = info->dst_skip;
|
||||
map = info->table;
|
||||
|
||||
width += info->leading_skip;
|
||||
|
||||
if (srcbpp == 4)
|
||||
srcskip += width - (width + 1) / 2;
|
||||
else if (srcbpp == 2)
|
||||
@@ -56,7 +58,13 @@ SDL_FORCE_INLINE void BlitBto1(SDL_BlitInfo *info, const Uint32 srcbpp)
|
||||
if (SDL_PIXELORDER(info->src_fmt->format) == SDL_BITMAPORDER_4321) {
|
||||
while (height--) {
|
||||
Uint8 byte = 0, bit;
|
||||
for (c = 0; c < width; ++c) {
|
||||
for (c = 0; c < info->leading_skip; ++c) {
|
||||
if (!(c & align)) {
|
||||
byte = *src++;
|
||||
}
|
||||
byte >>= srcbpp;
|
||||
}
|
||||
for (; c < width; ++c) {
|
||||
if (!(c & align)) {
|
||||
byte = *src++;
|
||||
}
|
||||
@@ -73,7 +81,13 @@ SDL_FORCE_INLINE void BlitBto1(SDL_BlitInfo *info, const Uint32 srcbpp)
|
||||
} else {
|
||||
while (height--) {
|
||||
Uint8 byte = 0, bit;
|
||||
for (c = 0; c < width; ++c) {
|
||||
for (c = 0; c < info->leading_skip; ++c) {
|
||||
if (!(c & align)) {
|
||||
byte = *src++;
|
||||
}
|
||||
byte <<= srcbpp;
|
||||
}
|
||||
for (; c < width; ++c) {
|
||||
if (!(c & align)) {
|
||||
byte = *src++;
|
||||
}
|
||||
@@ -92,7 +106,13 @@ SDL_FORCE_INLINE void BlitBto1(SDL_BlitInfo *info, const Uint32 srcbpp)
|
||||
if (SDL_PIXELORDER(info->src_fmt->format) == SDL_BITMAPORDER_4321) {
|
||||
while (height--) {
|
||||
Uint8 byte = 0, bit;
|
||||
for (c = 0; c < width; ++c) {
|
||||
for (c = 0; c < info->leading_skip; ++c) {
|
||||
if (!(c & align)) {
|
||||
byte = *src++;
|
||||
}
|
||||
byte >>= srcbpp;
|
||||
}
|
||||
for (; c < width; ++c) {
|
||||
if (!(c & align)) {
|
||||
byte = *src++;
|
||||
}
|
||||
@@ -109,7 +129,13 @@ SDL_FORCE_INLINE void BlitBto1(SDL_BlitInfo *info, const Uint32 srcbpp)
|
||||
} else {
|
||||
while (height--) {
|
||||
Uint8 byte = 0, bit;
|
||||
for (c = 0; c < width; ++c) {
|
||||
for (c = 0; c < info->leading_skip; ++c) {
|
||||
if (!(c & align)) {
|
||||
byte = *src++;
|
||||
}
|
||||
byte <<= srcbpp;
|
||||
}
|
||||
for (; c < width; ++c) {
|
||||
if (!(c & align)) {
|
||||
byte = *src++;
|
||||
}
|
||||
@@ -147,6 +173,8 @@ SDL_FORCE_INLINE void BlitBto2(SDL_BlitInfo *info, const Uint32 srcbpp)
|
||||
dstskip = info->dst_skip / 2;
|
||||
map = (Uint16 *)info->table;
|
||||
|
||||
width += info->leading_skip;
|
||||
|
||||
if (srcbpp == 4)
|
||||
srcskip += width - (width + 1) / 2;
|
||||
else if (srcbpp == 2)
|
||||
@@ -157,7 +185,13 @@ SDL_FORCE_INLINE void BlitBto2(SDL_BlitInfo *info, const Uint32 srcbpp)
|
||||
if (SDL_PIXELORDER(info->src_fmt->format) == SDL_BITMAPORDER_4321) {
|
||||
while (height--) {
|
||||
Uint8 byte = 0, bit;
|
||||
for (c = 0; c < width; ++c) {
|
||||
for (c = 0; c < info->leading_skip; ++c) {
|
||||
if (!(c & align)) {
|
||||
byte = *src++;
|
||||
}
|
||||
byte >>= srcbpp;
|
||||
}
|
||||
for (; c < width; ++c) {
|
||||
if (!(c & align)) {
|
||||
byte = *src++;
|
||||
}
|
||||
@@ -174,7 +208,13 @@ SDL_FORCE_INLINE void BlitBto2(SDL_BlitInfo *info, const Uint32 srcbpp)
|
||||
} else {
|
||||
while (height--) {
|
||||
Uint8 byte = 0, bit;
|
||||
for (c = 0; c < width; ++c) {
|
||||
for (c = 0; c < info->leading_skip; ++c) {
|
||||
if (!(c & align)) {
|
||||
byte = *src++;
|
||||
}
|
||||
byte <<= srcbpp;
|
||||
}
|
||||
for (; c < width; ++c) {
|
||||
if (!(c & align)) {
|
||||
byte = *src++;
|
||||
}
|
||||
@@ -210,6 +250,8 @@ SDL_FORCE_INLINE void BlitBto3(SDL_BlitInfo *info, const Uint32 srcbpp)
|
||||
dstskip = info->dst_skip;
|
||||
map = info->table;
|
||||
|
||||
width += info->leading_skip;
|
||||
|
||||
if (srcbpp == 4)
|
||||
srcskip += width - (width + 1) / 2;
|
||||
else if (srcbpp == 2)
|
||||
@@ -220,7 +262,13 @@ SDL_FORCE_INLINE void BlitBto3(SDL_BlitInfo *info, const Uint32 srcbpp)
|
||||
if (SDL_PIXELORDER(info->src_fmt->format) == SDL_BITMAPORDER_4321) {
|
||||
while (height--) {
|
||||
Uint8 byte = 0, bit;
|
||||
for (c = 0; c < width; ++c) {
|
||||
for (c = 0; c < info->leading_skip; ++c) {
|
||||
if (!(c & align)) {
|
||||
byte = *src++;
|
||||
}
|
||||
byte >>= srcbpp;
|
||||
}
|
||||
for (; c < width; ++c) {
|
||||
if (!(c & align)) {
|
||||
byte = *src++;
|
||||
}
|
||||
@@ -240,7 +288,13 @@ SDL_FORCE_INLINE void BlitBto3(SDL_BlitInfo *info, const Uint32 srcbpp)
|
||||
} else {
|
||||
while (height--) {
|
||||
Uint8 byte = 0, bit;
|
||||
for (c = 0; c < width; ++c) {
|
||||
for (c = 0; c < info->leading_skip; ++c) {
|
||||
if (!(c & align)) {
|
||||
byte = *src++;
|
||||
}
|
||||
byte <<= srcbpp;
|
||||
}
|
||||
for (; c < width; ++c) {
|
||||
if (!(c & align)) {
|
||||
byte = *src++;
|
||||
}
|
||||
@@ -280,6 +334,8 @@ SDL_FORCE_INLINE void BlitBto4(SDL_BlitInfo *info, const Uint32 srcbpp)
|
||||
dstskip = info->dst_skip / 4;
|
||||
map = (Uint32 *)info->table;
|
||||
|
||||
width += info->leading_skip;
|
||||
|
||||
if (srcbpp == 4)
|
||||
srcskip += width - (width + 1) / 2;
|
||||
else if (srcbpp == 2)
|
||||
@@ -290,7 +346,13 @@ SDL_FORCE_INLINE void BlitBto4(SDL_BlitInfo *info, const Uint32 srcbpp)
|
||||
if (SDL_PIXELORDER(info->src_fmt->format) == SDL_BITMAPORDER_4321) {
|
||||
while (height--) {
|
||||
Uint8 byte = 0, bit;
|
||||
for (c = 0; c < width; ++c) {
|
||||
for (c = 0; c < info->leading_skip; ++c) {
|
||||
if (!(c & align)) {
|
||||
byte = *src++;
|
||||
}
|
||||
byte >>= srcbpp;
|
||||
}
|
||||
for (; c < width; ++c) {
|
||||
if (!(c & align)) {
|
||||
byte = *src++;
|
||||
}
|
||||
@@ -307,7 +369,13 @@ SDL_FORCE_INLINE void BlitBto4(SDL_BlitInfo *info, const Uint32 srcbpp)
|
||||
} else {
|
||||
while (height--) {
|
||||
Uint8 byte = 0, bit;
|
||||
for (c = 0; c < width; ++c) {
|
||||
for (c = 0; c < info->leading_skip; ++c) {
|
||||
if (!(c & align)) {
|
||||
byte = *src++;
|
||||
}
|
||||
byte <<= srcbpp;
|
||||
}
|
||||
for (; c < width; ++c) {
|
||||
if (!(c & align)) {
|
||||
byte = *src++;
|
||||
}
|
||||
@@ -339,7 +407,8 @@ SDL_FORCE_INLINE void BlitBto1Key(SDL_BlitInfo *info, const Uint32 srcbpp)
|
||||
Uint8 *palmap = info->table;
|
||||
int c;
|
||||
|
||||
// Set up some basic variables
|
||||
width += info->leading_skip;
|
||||
|
||||
if (srcbpp == 4)
|
||||
srcskip += width - (width + 1) / 2;
|
||||
else if (srcbpp == 2)
|
||||
@@ -351,7 +420,13 @@ SDL_FORCE_INLINE void BlitBto1Key(SDL_BlitInfo *info, const Uint32 srcbpp)
|
||||
if (SDL_PIXELORDER(info->src_fmt->format) == SDL_BITMAPORDER_4321) {
|
||||
while (height--) {
|
||||
Uint8 byte = 0, bit;
|
||||
for (c = 0; c < width; ++c) {
|
||||
for (c = 0; c < info->leading_skip; ++c) {
|
||||
if (!(c & align)) {
|
||||
byte = *src++;
|
||||
}
|
||||
byte >>= srcbpp;
|
||||
}
|
||||
for (; c < width; ++c) {
|
||||
if (!(c & align)) {
|
||||
byte = *src++;
|
||||
}
|
||||
@@ -368,7 +443,13 @@ SDL_FORCE_INLINE void BlitBto1Key(SDL_BlitInfo *info, const Uint32 srcbpp)
|
||||
} else {
|
||||
while (height--) {
|
||||
Uint8 byte = 0, bit;
|
||||
for (c = 0; c < width; ++c) {
|
||||
for (c = 0; c < info->leading_skip; ++c) {
|
||||
if (!(c & align)) {
|
||||
byte = *src++;
|
||||
}
|
||||
byte <<= srcbpp;
|
||||
}
|
||||
for (; c < width; ++c) {
|
||||
if (!(c & align)) {
|
||||
byte = *src++;
|
||||
}
|
||||
@@ -387,7 +468,13 @@ SDL_FORCE_INLINE void BlitBto1Key(SDL_BlitInfo *info, const Uint32 srcbpp)
|
||||
if (SDL_PIXELORDER(info->src_fmt->format) == SDL_BITMAPORDER_4321) {
|
||||
while (height--) {
|
||||
Uint8 byte = 0, bit;
|
||||
for (c = 0; c < width; ++c) {
|
||||
for (c = 0; c < info->leading_skip; ++c) {
|
||||
if (!(c & align)) {
|
||||
byte = *src++;
|
||||
}
|
||||
byte >>= srcbpp;
|
||||
}
|
||||
for (; c < width; ++c) {
|
||||
if (!(c & align)) {
|
||||
byte = *src++;
|
||||
}
|
||||
@@ -404,7 +491,13 @@ SDL_FORCE_INLINE void BlitBto1Key(SDL_BlitInfo *info, const Uint32 srcbpp)
|
||||
} else {
|
||||
while (height--) {
|
||||
Uint8 byte = 0, bit;
|
||||
for (c = 0; c < width; ++c) {
|
||||
for (c = 0; c < info->leading_skip; ++c) {
|
||||
if (!(c & align)) {
|
||||
byte = *src++;
|
||||
}
|
||||
byte <<= srcbpp;
|
||||
}
|
||||
for (; c < width; ++c) {
|
||||
if (!(c & align)) {
|
||||
byte = *src++;
|
||||
}
|
||||
@@ -437,7 +530,8 @@ SDL_FORCE_INLINE void BlitBto2Key(SDL_BlitInfo *info, const Uint32 srcbpp)
|
||||
Uint8 *palmap = info->table;
|
||||
int c;
|
||||
|
||||
// Set up some basic variables
|
||||
width += info->leading_skip;
|
||||
|
||||
if (srcbpp == 4)
|
||||
srcskip += width - (width + 1) / 2;
|
||||
else if (srcbpp == 2)
|
||||
@@ -449,7 +543,13 @@ SDL_FORCE_INLINE void BlitBto2Key(SDL_BlitInfo *info, const Uint32 srcbpp)
|
||||
if (SDL_PIXELORDER(info->src_fmt->format) == SDL_BITMAPORDER_4321) {
|
||||
while (height--) {
|
||||
Uint8 byte = 0, bit;
|
||||
for (c = 0; c < width; ++c) {
|
||||
for (c = 0; c < info->leading_skip; ++c) {
|
||||
if (!(c & align)) {
|
||||
byte = *src++;
|
||||
}
|
||||
byte >>= srcbpp;
|
||||
}
|
||||
for (; c < width; ++c) {
|
||||
if (!(c & align)) {
|
||||
byte = *src++;
|
||||
}
|
||||
@@ -466,7 +566,13 @@ SDL_FORCE_INLINE void BlitBto2Key(SDL_BlitInfo *info, const Uint32 srcbpp)
|
||||
} else {
|
||||
while (height--) {
|
||||
Uint8 byte = 0, bit;
|
||||
for (c = 0; c < width; ++c) {
|
||||
for (c = 0; c < info->leading_skip; ++c) {
|
||||
if (!(c & align)) {
|
||||
byte = *src++;
|
||||
}
|
||||
byte <<= srcbpp;
|
||||
}
|
||||
for (; c < width; ++c) {
|
||||
if (!(c & align)) {
|
||||
byte = *src++;
|
||||
}
|
||||
@@ -498,7 +604,8 @@ SDL_FORCE_INLINE void BlitBto3Key(SDL_BlitInfo *info, const Uint32 srcbpp)
|
||||
Uint8 *palmap = info->table;
|
||||
int c;
|
||||
|
||||
// Set up some basic variables
|
||||
width += info->leading_skip;
|
||||
|
||||
if (srcbpp == 4)
|
||||
srcskip += width - (width + 1) / 2;
|
||||
else if (srcbpp == 2)
|
||||
@@ -509,7 +616,13 @@ SDL_FORCE_INLINE void BlitBto3Key(SDL_BlitInfo *info, const Uint32 srcbpp)
|
||||
if (SDL_PIXELORDER(info->src_fmt->format) == SDL_BITMAPORDER_4321) {
|
||||
while (height--) {
|
||||
Uint8 byte = 0, bit;
|
||||
for (c = 0; c < width; ++c) {
|
||||
for (c = 0; c < info->leading_skip; ++c) {
|
||||
if (!(c & align)) {
|
||||
byte = *src++;
|
||||
}
|
||||
byte >>= srcbpp;
|
||||
}
|
||||
for (; c < width; ++c) {
|
||||
if (!(c & align)) {
|
||||
byte = *src++;
|
||||
}
|
||||
@@ -526,7 +639,13 @@ SDL_FORCE_INLINE void BlitBto3Key(SDL_BlitInfo *info, const Uint32 srcbpp)
|
||||
} else {
|
||||
while (height--) {
|
||||
Uint8 byte = 0, bit;
|
||||
for (c = 0; c < width; ++c) {
|
||||
for (c = 0; c < info->leading_skip; ++c) {
|
||||
if (!(c & align)) {
|
||||
byte = *src++;
|
||||
}
|
||||
byte <<= srcbpp;
|
||||
}
|
||||
for (; c < width; ++c) {
|
||||
if (!(c & align)) {
|
||||
byte = *src++;
|
||||
}
|
||||
@@ -558,7 +677,8 @@ SDL_FORCE_INLINE void BlitBto4Key(SDL_BlitInfo *info, const Uint32 srcbpp)
|
||||
Uint8 *palmap = info->table;
|
||||
int c;
|
||||
|
||||
// Set up some basic variables
|
||||
width += info->leading_skip;
|
||||
|
||||
if (srcbpp == 4)
|
||||
srcskip += width - (width + 1) / 2;
|
||||
else if (srcbpp == 2)
|
||||
@@ -570,7 +690,13 @@ SDL_FORCE_INLINE void BlitBto4Key(SDL_BlitInfo *info, const Uint32 srcbpp)
|
||||
if (SDL_PIXELORDER(info->src_fmt->format) == SDL_BITMAPORDER_4321) {
|
||||
while (height--) {
|
||||
Uint8 byte = 0, bit;
|
||||
for (c = 0; c < width; ++c) {
|
||||
for (c = 0; c < info->leading_skip; ++c) {
|
||||
if (!(c & align)) {
|
||||
byte = *src++;
|
||||
}
|
||||
byte >>= srcbpp;
|
||||
}
|
||||
for (; c < width; ++c) {
|
||||
if (!(c & align)) {
|
||||
byte = *src++;
|
||||
}
|
||||
@@ -587,7 +713,13 @@ SDL_FORCE_INLINE void BlitBto4Key(SDL_BlitInfo *info, const Uint32 srcbpp)
|
||||
} else {
|
||||
while (height--) {
|
||||
Uint8 byte = 0, bit;
|
||||
for (c = 0; c < width; ++c) {
|
||||
for (c = 0; c < info->leading_skip; ++c) {
|
||||
if (!(c & align)) {
|
||||
byte = *src++;
|
||||
}
|
||||
byte <<= srcbpp;
|
||||
}
|
||||
for (; c < width; ++c) {
|
||||
if (!(c & align)) {
|
||||
byte = *src++;
|
||||
}
|
||||
@@ -622,7 +754,8 @@ static void BlitBtoNAlpha(SDL_BlitInfo *info)
|
||||
unsigned dR, dG, dB, dA;
|
||||
const unsigned A = info->a;
|
||||
|
||||
// Set up some basic variables
|
||||
width += info->leading_skip;
|
||||
|
||||
srcbpp = srcfmt->bytes_per_pixel;
|
||||
dstbpp = dstfmt->bytes_per_pixel;
|
||||
if (srcbpp == 4)
|
||||
@@ -637,7 +770,13 @@ static void BlitBtoNAlpha(SDL_BlitInfo *info)
|
||||
if (SDL_PIXELORDER(info->src_fmt->format) == SDL_BITMAPORDER_4321) {
|
||||
while (height--) {
|
||||
Uint8 byte = 0, bit;
|
||||
for (c = 0; c < width; ++c) {
|
||||
for (c = 0; c < info->leading_skip; ++c) {
|
||||
if (!(c & align)) {
|
||||
byte = *src++;
|
||||
}
|
||||
byte >>= srcbpp;
|
||||
}
|
||||
for (; c < width; ++c) {
|
||||
if (!(c & align)) {
|
||||
byte = *src++;
|
||||
}
|
||||
@@ -659,7 +798,13 @@ static void BlitBtoNAlpha(SDL_BlitInfo *info)
|
||||
} else {
|
||||
while (height--) {
|
||||
Uint8 byte = 0, bit;
|
||||
for (c = 0; c < width; ++c) {
|
||||
for (c = 0; c < info->leading_skip; ++c) {
|
||||
if (!(c & align)) {
|
||||
byte = *src++;
|
||||
}
|
||||
byte <<= srcbpp;
|
||||
}
|
||||
for (; c < width; ++c) {
|
||||
if (!(c & align)) {
|
||||
byte = *src++;
|
||||
}
|
||||
@@ -700,7 +845,8 @@ static void BlitBtoNAlphaKey(SDL_BlitInfo *info)
|
||||
const unsigned A = info->a;
|
||||
Uint32 ckey = info->colorkey;
|
||||
|
||||
// Set up some basic variables
|
||||
width += info->leading_skip;
|
||||
|
||||
srcbpp = srcfmt->bytes_per_pixel;
|
||||
dstbpp = dstfmt->bytes_per_pixel;
|
||||
if (srcbpp == 4)
|
||||
@@ -715,7 +861,13 @@ static void BlitBtoNAlphaKey(SDL_BlitInfo *info)
|
||||
if (SDL_PIXELORDER(info->src_fmt->format) == SDL_BITMAPORDER_4321) {
|
||||
while (height--) {
|
||||
Uint8 byte = 0, bit;
|
||||
for (c = 0; c < width; ++c) {
|
||||
for (c = 0; c < info->leading_skip; ++c) {
|
||||
if (!(c & align)) {
|
||||
byte = *src++;
|
||||
}
|
||||
byte >>= srcbpp;
|
||||
}
|
||||
for (; c < width; ++c) {
|
||||
if (!(c & align)) {
|
||||
byte = *src++;
|
||||
}
|
||||
@@ -737,7 +889,13 @@ static void BlitBtoNAlphaKey(SDL_BlitInfo *info)
|
||||
} else {
|
||||
while (height--) {
|
||||
Uint8 byte = 0, bit;
|
||||
for (c = 0; c < width; ++c) {
|
||||
for (c = 0; c < info->leading_skip; ++c) {
|
||||
if (!(c & align)) {
|
||||
byte = *src++;
|
||||
}
|
||||
byte <<= srcbpp;
|
||||
}
|
||||
for (; c < width; ++c) {
|
||||
if (!(c & align)) {
|
||||
byte = *src++;
|
||||
}
|
||||
|
||||
+104
-2
@@ -242,6 +242,103 @@ static void SDL_TARGETING("sse2") Blit888to888SurfaceAlphaSSE2(SDL_BlitInfo *inf
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef SDL_LSX_INTRINSICS
|
||||
|
||||
static void SDL_TARGETING("lsx") Blit8888to8888PixelAlphaSwizzleLSX(SDL_BlitInfo *info)
|
||||
{
|
||||
int width = info->dst_w;
|
||||
int height = info->dst_h;
|
||||
Uint8 *src = info->src;
|
||||
int srcskip = info->src_skip;
|
||||
Uint8 *dst = info->dst;
|
||||
int dstskip = info->dst_skip;
|
||||
const SDL_PixelFormatDetails *srcfmt = info->src_fmt;
|
||||
const SDL_PixelFormatDetails *dstfmt = info->dst_fmt;
|
||||
bool fill_alpha = !dstfmt->Amask;
|
||||
Uint32 dstAmask, dstAshift;
|
||||
const Uint8 offsets[] = {0, 0, 0, 0, 4, 4, 4, 4, 8, 8, 8, 8, 12, 12, 12, 12};
|
||||
|
||||
SDL_Get8888AlphaMaskAndShift(dstfmt, &dstAmask, &dstAshift);
|
||||
|
||||
const __m128i const_0xff00 = __lsx_vreplgr2vr_h(0xff00);
|
||||
const __m128i const_128 = __lsx_vreplgr2vr_b((Uint8)128);
|
||||
const __m128i const_32641 = __lsx_vreplgr2vr_h(32641);
|
||||
const __m128i const_257 = __lsx_vreplgr2vr_h(257);
|
||||
|
||||
// The byte offsets for the start of each pixel
|
||||
const __m128i mask_offsets = __lsx_vld(offsets, 0);
|
||||
|
||||
const __m128i convert_mask = __lsx_vadd_w(
|
||||
__lsx_vreplgr2vr_w(
|
||||
((srcfmt->Rshift >> 3) << dstfmt->Rshift) |
|
||||
((srcfmt->Gshift >> 3) << dstfmt->Gshift) |
|
||||
((srcfmt->Bshift >> 3) << dstfmt->Bshift)),
|
||||
mask_offsets);
|
||||
|
||||
const __m128i alpha_splat_mask = __lsx_vadd_b(__lsx_vreplgr2vr_b(srcfmt->Ashift >> 3), mask_offsets);
|
||||
const __m128i alpha_fill_mask = __lsx_vreplgr2vr_w((int)dstAmask);
|
||||
|
||||
while (height--) {
|
||||
int i = 0;
|
||||
|
||||
for (; i + 4 <= width; i += 4) {
|
||||
__m128i src128 = __lsx_vld(src, 0);
|
||||
__m128i dst128 = __lsx_vld(dst, 0);
|
||||
|
||||
__m128i srcA = __lsx_vshuf_b(src128, src128, alpha_splat_mask);
|
||||
src128 = __lsx_vshuf_b(src128, src128, convert_mask);
|
||||
|
||||
src128 = __lsx_vor_v(src128, alpha_fill_mask);
|
||||
|
||||
__m128i srca_lo = __lsx_vilvl_b(srcA, srcA);
|
||||
__m128i srca_hi = __lsx_vilvh_b(srcA, srcA);
|
||||
|
||||
srca_lo = __lsx_vxor_v(srca_lo, const_0xff00);
|
||||
srca_hi = __lsx_vxor_v(srca_hi, const_0xff00);
|
||||
|
||||
src128 = __lsx_vsub_b(src128, const_128);
|
||||
dst128 = __lsx_vsub_b(dst128, const_128);
|
||||
|
||||
__m128i tmp = __lsx_vilvl_b(dst128, src128);
|
||||
__m128i dst_lo = __lsx_vsadd_h(__lsx_vmulwev_h_bu_b(srca_lo, tmp), __lsx_vmulwod_h_bu_b(srca_lo, tmp));
|
||||
tmp = __lsx_vilvh_b(dst128, src128);
|
||||
__m128i dst_hi = __lsx_vsadd_h(__lsx_vmulwev_h_bu_b(srca_hi, tmp), __lsx_vmulwod_h_bu_b(srca_hi, tmp));
|
||||
|
||||
dst_lo = __lsx_vadd_h(dst_lo, const_32641);
|
||||
dst_hi = __lsx_vadd_h(dst_hi, const_32641);
|
||||
|
||||
dst_lo = __lsx_vmuh_hu(dst_lo, const_257);
|
||||
dst_hi = __lsx_vmuh_hu(dst_hi, const_257);
|
||||
|
||||
dst128 = __lsx_vssrarni_bu_h(dst_hi, dst_lo, 0);
|
||||
if (fill_alpha) {
|
||||
dst128 = __lsx_vor_v(dst128, alpha_fill_mask);
|
||||
}
|
||||
__lsx_vst(dst128, dst, 0);
|
||||
|
||||
src += 16;
|
||||
dst += 16;
|
||||
}
|
||||
|
||||
for (; i < width; ++i) {
|
||||
Uint32 src32 = *(Uint32 *)src;
|
||||
Uint32 dst32 = *(Uint32 *)dst;
|
||||
ALPHA_BLEND_SWIZZLE_8888(src32, dst32, srcfmt, dstfmt);
|
||||
if (fill_alpha) {
|
||||
dst32 |= dstAmask;
|
||||
}
|
||||
*(Uint32 *)dst = dst32;
|
||||
src += 4;
|
||||
dst += 4;
|
||||
}
|
||||
|
||||
src += srcskip;
|
||||
dst += dstskip;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// fast RGB888->(A)RGB888 blending with surface alpha=128 special case
|
||||
static void BlitRGBtoRGBSurfaceAlpha128(SDL_BlitInfo *info)
|
||||
{
|
||||
@@ -1202,7 +1299,7 @@ static void SDL_TARGETING("avx2") Blit8888to8888PixelAlphaSwizzleAVX2(SDL_BlitIn
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(SDL_NEON_INTRINSICS) && (__ARM_ARCH >= 8)
|
||||
#if defined(SDL_NEON_INTRINSICS) && (__ARM_ARCH >= 8) && (defined(__aarch64__) || defined(_M_ARM64))
|
||||
|
||||
static void Blit8888to8888PixelAlphaSwizzleNEON(SDL_BlitInfo *info)
|
||||
{
|
||||
@@ -1402,7 +1499,12 @@ SDL_BlitFunc SDL_CalculateBlitA(SDL_Surface *surface)
|
||||
return Blit8888to8888PixelAlphaSwizzleSSE41;
|
||||
}
|
||||
#endif
|
||||
#if defined(SDL_NEON_INTRINSICS) && (__ARM_ARCH >= 8)
|
||||
#ifdef SDL_LSX_INTRINSICS
|
||||
if (SDL_HasLSX()) {
|
||||
return Blit8888to8888PixelAlphaSwizzleLSX;
|
||||
}
|
||||
#endif
|
||||
#if defined(SDL_NEON_INTRINSICS) && (__ARM_ARCH >= 8) && (defined(__aarch64__) || defined(_M_ARM64))
|
||||
// To prevent "unused function" compiler warnings/errors
|
||||
(void)Blit8888to8888PixelAlpha;
|
||||
(void)Blit8888to8888PixelAlphaSwizzle;
|
||||
|
||||
@@ -2719,7 +2719,7 @@ static void SDL_TARGETING("avx2") Blit8888to8888PixelSwizzleAVX2(SDL_BlitInfo *i
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(SDL_NEON_INTRINSICS) && (__ARM_ARCH >= 8)
|
||||
#if defined(SDL_NEON_INTRINSICS) && (__ARM_ARCH >= 8) && (defined(__aarch64__) || defined(_M_ARM64))
|
||||
|
||||
static void Blit8888to8888PixelSwizzleNEON(SDL_BlitInfo *info)
|
||||
{
|
||||
@@ -3135,7 +3135,7 @@ SDL_BlitFunc SDL_CalculateBlitN(SDL_Surface *surface)
|
||||
return Blit8888to8888PixelSwizzleSSE41;
|
||||
}
|
||||
#endif
|
||||
#if defined(SDL_NEON_INTRINSICS) && (__ARM_ARCH >= 8)
|
||||
#if defined(SDL_NEON_INTRINSICS) && (__ARM_ARCH >= 8) && (defined(__aarch64__) || defined(_M_ARM64))
|
||||
return Blit8888to8888PixelSwizzleNEON;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -85,8 +85,8 @@ void SDL_Blit_Slow(SDL_BlitInfo *info)
|
||||
last_index = SDL_LookupRGBAColor(palette_map, last_pixel, dst_pal);
|
||||
}
|
||||
|
||||
incy = ((Uint64)info->src_h << 16) / info->dst_h;
|
||||
incx = ((Uint64)info->src_w << 16) / info->dst_w;
|
||||
incy = info->dst_h ? ((Uint64)info->src_h << 16) / info->dst_h : 0;
|
||||
incx = info->dst_w ? ((Uint64)info->src_w << 16) / info->dst_w : 0;
|
||||
posy = incy / 2; // start at the middle of pixel
|
||||
|
||||
while (info->dst_h--) {
|
||||
|
||||
@@ -133,6 +133,69 @@ DEFINE_SSE_FILLRECT(4, Uint32)
|
||||
/* *INDENT-ON* */ // clang-format on
|
||||
#endif // __SSE__
|
||||
|
||||
#ifdef SDL_LSX_INTRINSICS
|
||||
/* *INDENT-OFF* */ // clang-format off
|
||||
|
||||
#define LSX_BEGIN __m128i c128 = __lsx_vreplgr2vr_w(color);
|
||||
|
||||
#define LSX_WORK \
|
||||
for (i = n / 64; i--;) { \
|
||||
__lsx_vst(c128, p, 0); \
|
||||
__lsx_vst(c128, p, 16); \
|
||||
__lsx_vst(c128, p, 32); \
|
||||
__lsx_vst(c128, p, 48); \
|
||||
p += 64; \
|
||||
}
|
||||
|
||||
#define DEFINE_LSX_FILLRECT(bpp, type) \
|
||||
static void SDL_TARGETING("lsx") SDL_FillSurfaceRect##bpp##LSX(Uint8 *pixels, int pitch, Uint32 color, int w, int h) \
|
||||
{ \
|
||||
int i, n; \
|
||||
Uint8 *p = NULL; \
|
||||
\
|
||||
/* If the number of bytes per row is equal to the pitch, treat */ \
|
||||
/* all rows as one long continuous row (for better performance) */ \
|
||||
if ((w) * (bpp) == pitch) { \
|
||||
w = w * h; \
|
||||
h = 1; \
|
||||
} \
|
||||
\
|
||||
LSX_BEGIN; \
|
||||
\
|
||||
while (h--) { \
|
||||
n = (w) * (bpp); \
|
||||
p = pixels; \
|
||||
\
|
||||
if (n > 63) { \
|
||||
int adjust = 16 - ((uintptr_t)p & 15); \
|
||||
if (adjust < 16) { \
|
||||
n -= adjust; \
|
||||
adjust /= (bpp); \
|
||||
while (adjust--) { \
|
||||
*((type *)p) = (type)color; \
|
||||
p += (bpp); \
|
||||
} \
|
||||
} \
|
||||
LSX_WORK; \
|
||||
} \
|
||||
if (n & 63) { \
|
||||
int remainder = (n & 63); \
|
||||
remainder /= (bpp); \
|
||||
while (remainder--) { \
|
||||
*((type *)p) = (type)color; \
|
||||
p += (bpp); \
|
||||
} \
|
||||
} \
|
||||
pixels += pitch; \
|
||||
} \
|
||||
\
|
||||
}
|
||||
|
||||
DEFINE_LSX_FILLRECT(4, Uint32)
|
||||
|
||||
/* *INDENT-ON* */ // clang-format on
|
||||
#endif /* __LSX__ */
|
||||
|
||||
static void SDL_FillSurfaceRect1(Uint8 *pixels, int pitch, Uint32 color, int w, int h)
|
||||
{
|
||||
int n;
|
||||
@@ -340,6 +403,12 @@ bool SDL_FillSurfaceRects(SDL_Surface *dst, const SDL_Rect *rects, int count, Ui
|
||||
fill_function = SDL_FillSurfaceRect4SSE;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
#ifdef SDL_LSX_INTRINSICS
|
||||
if (SDL_HasLSX()) {
|
||||
fill_function = SDL_FillSurfaceRect4LSX;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
fill_function = SDL_FillSurfaceRect4;
|
||||
break;
|
||||
|
||||
+18
-16
@@ -295,20 +295,6 @@ static Uint32 SDL_DefaultGraphicsBackends(SDL_VideoDevice *_this)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void SDLCALL SDL_CleanupWindowTextureData(void *userdata, void *value)
|
||||
{
|
||||
SDL_WindowTextureData *data = (SDL_WindowTextureData *)value;
|
||||
|
||||
if (data->texture) {
|
||||
SDL_DestroyTexture(data->texture);
|
||||
}
|
||||
if (data->renderer) {
|
||||
SDL_DestroyRenderer(data->renderer);
|
||||
}
|
||||
SDL_free(data->pixels);
|
||||
SDL_free(data);
|
||||
}
|
||||
|
||||
static bool SDL_CreateWindowTexture(SDL_VideoDevice *_this, SDL_Window *window, SDL_PixelFormat *format, void **pixels, int *pitch)
|
||||
{
|
||||
SDL_PropertiesID props = SDL_GetWindowProperties(window);
|
||||
@@ -399,7 +385,7 @@ static bool SDL_CreateWindowTexture(SDL_VideoDevice *_this, SDL_Window *window,
|
||||
SDL_DestroyRenderer(renderer);
|
||||
return false;
|
||||
}
|
||||
if (!SDL_SetPointerPropertyWithCleanup(props, SDL_PROP_WINDOW_TEXTUREDATA_POINTER, data, SDL_CleanupWindowTextureData, NULL)) {
|
||||
if (!SDL_SetPointerProperty(props, SDL_PROP_WINDOW_TEXTUREDATA_POINTER, data)) {
|
||||
SDL_DestroyRenderer(renderer);
|
||||
return false;
|
||||
}
|
||||
@@ -526,7 +512,21 @@ static bool SDL_UpdateWindowTexture(SDL_VideoDevice *_this, SDL_Window *window,
|
||||
|
||||
static void SDL_DestroyWindowTexture(SDL_VideoDevice *_this, SDL_Window *window)
|
||||
{
|
||||
SDL_ClearProperty(SDL_GetWindowProperties(window), SDL_PROP_WINDOW_TEXTUREDATA_POINTER);
|
||||
SDL_PropertiesID props = SDL_GetWindowProperties(window);
|
||||
if (SDL_HasProperty(props, SDL_PROP_WINDOW_TEXTUREDATA_POINTER)) {
|
||||
SDL_WindowTextureData *data = SDL_GetPointerProperty(props, SDL_PROP_WINDOW_TEXTUREDATA_POINTER, NULL);
|
||||
|
||||
if (data->texture) {
|
||||
SDL_DestroyTexture(data->texture);
|
||||
}
|
||||
if (data->renderer) {
|
||||
SDL_DestroyRenderer(data->renderer);
|
||||
}
|
||||
SDL_free(data->pixels);
|
||||
SDL_free(data);
|
||||
|
||||
SDL_ClearProperty(props, SDL_PROP_WINDOW_TEXTUREDATA_POINTER);
|
||||
}
|
||||
}
|
||||
|
||||
static SDL_VideoDevice *_this = NULL;
|
||||
@@ -4291,6 +4291,8 @@ void SDL_DestroyWindow(SDL_Window *window)
|
||||
}
|
||||
|
||||
SDL_DestroyProperties(window->text_input_props);
|
||||
|
||||
SDL_DestroyWindowTexture(_this, window);
|
||||
SDL_DestroyProperties(window->props);
|
||||
|
||||
/* Clear the modal status, but don't unset the parent just yet, as it
|
||||
|
||||
@@ -1019,6 +1019,14 @@ bool WIN_HandleIMEMessage(HWND hwnd, UINT msg, WPARAM wParam, LPARAM *lParam, SD
|
||||
SDL_DebugIMELog("WM_KEYDOWN normal");
|
||||
}
|
||||
break;
|
||||
case WM_SYSKEYDOWN:
|
||||
if (wParam == VK_PROCESSKEY) {
|
||||
SDL_DebugIMELog("WM_SYSKEYDOWN VK_PROCESSKEY");
|
||||
trap = true;
|
||||
} else {
|
||||
SDL_DebugIMELog("WM_SYSKEYDOWN normal");
|
||||
}
|
||||
break;
|
||||
case WM_INPUTLANGCHANGE:
|
||||
SDL_DebugIMELog("WM_INPUTLANGCHANGE");
|
||||
IME_InputLangChanged(videodata);
|
||||
|
||||
@@ -1535,6 +1535,11 @@ void X11_ShowWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||
bool set_position = false;
|
||||
XEvent event;
|
||||
|
||||
// If the window was previously shown, pump events to avoid possible positioning issues.
|
||||
if (data->was_shown) {
|
||||
X11_PumpEvents(_this);
|
||||
}
|
||||
|
||||
if (SDL_WINDOW_IS_POPUP(window)) {
|
||||
// Update the position in case the parent moved while we were hidden
|
||||
X11_ConstrainPopup(window, true);
|
||||
@@ -1577,14 +1582,12 @@ void X11_ShowWindow(SDL_VideoDevice *_this, SDL_Window *window)
|
||||
}
|
||||
|
||||
if (set_position) {
|
||||
// Apply the window position, accounting for offsets due to the borders appearing.
|
||||
const int tx = data->pending_position ? window->pending.x : window->x;
|
||||
const int ty = data->pending_position ? window->pending.y : window->y;
|
||||
// Apply the window position, accounting for offsets due to the borders appearing, but only when initially mapping.
|
||||
const int tx = (data->pending_position ? window->pending.x : window->x) - (data->was_shown ? 0 : data->border_left);
|
||||
const int ty = (data->pending_position ? window->pending.y : window->y) - (data->was_shown ? 0 : data->border_top);
|
||||
int x, y;
|
||||
|
||||
SDL_RelativeToGlobalForWindow(window,
|
||||
tx - data->border_left, ty - data->border_top,
|
||||
&x, &y);
|
||||
SDL_RelativeToGlobalForWindow(window, tx, ty, &x, &y);
|
||||
|
||||
data->pending_position = false;
|
||||
X11_XMoveWindow(display, data->xwindow, x, y);
|
||||
|
||||
@@ -959,6 +959,83 @@ static int SDLCALL surface_testBlitBlendMul(void *arg)
|
||||
return TEST_COMPLETED;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests blitting bitmaps
|
||||
*/
|
||||
static int SDLCALL surface_testBlitBitmap(void *arg)
|
||||
{
|
||||
const SDL_PixelFormat formats[] = {
|
||||
SDL_PIXELFORMAT_INDEX1LSB,
|
||||
SDL_PIXELFORMAT_INDEX1MSB,
|
||||
SDL_PIXELFORMAT_INDEX2LSB,
|
||||
SDL_PIXELFORMAT_INDEX2MSB,
|
||||
SDL_PIXELFORMAT_INDEX4LSB,
|
||||
SDL_PIXELFORMAT_INDEX4MSB
|
||||
};
|
||||
Uint8 pixel;
|
||||
int i, j;
|
||||
bool result;
|
||||
SDL_Surface *dst = SDL_CreateSurface(1, 1, SDL_PIXELFORMAT_ARGB8888);
|
||||
SDL_Color colors[] = {
|
||||
{ 0x00, 0x00, 0x00, 0xFF },
|
||||
{ 0xFF, 0xFF, 0xFF, 0xFF }
|
||||
};
|
||||
SDL_Palette *palette;
|
||||
Uint32 value, expected = 0xFFFFFFFF;
|
||||
|
||||
palette = SDL_CreatePalette(SDL_arraysize(colors));
|
||||
SDLTest_AssertCheck(palette != NULL, "SDL_CreatePalette() != NULL, result = %p", palette);
|
||||
|
||||
result = SDL_SetPaletteColors(palette, colors, 0, SDL_arraysize(colors));
|
||||
SDLTest_AssertCheck(result, "SDL_SetPaletteColors, result = %s", result ? "true" : "false");
|
||||
|
||||
for (i = 0; i < SDL_arraysize(formats); ++i) {
|
||||
SDL_PixelFormat format = formats[i];
|
||||
int bpp = SDL_BITSPERPIXEL(format);
|
||||
int width = (8 / bpp);
|
||||
|
||||
if (SDL_PIXELORDER(format) == SDL_BITMAPORDER_1234) {
|
||||
switch (bpp) {
|
||||
case 1:
|
||||
pixel = 0x80;
|
||||
break;
|
||||
case 2:
|
||||
pixel = 0x40;
|
||||
break;
|
||||
case 4:
|
||||
pixel = 0x10;
|
||||
break;
|
||||
default:
|
||||
SDL_assert(!"Unexpected bpp");
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
pixel = 0x01;
|
||||
}
|
||||
for (j = 0; j < width; ++j) {
|
||||
SDL_Rect rect = { j, 0, 1, 1 };
|
||||
SDL_Surface *src = SDL_CreateSurfaceFrom(width, 1, format, &pixel, 1);
|
||||
SDL_SetSurfacePalette(src, palette);
|
||||
*(Uint32 *)dst->pixels = 0;
|
||||
result = SDL_BlitSurface(src, &rect, dst, NULL);
|
||||
SDLTest_AssertCheck(result, "SDL_BlitSurface(%s pixel %d), result = %s", SDL_GetPixelFormatName(format), j, result ? "true" : "false");
|
||||
value = *(Uint32 *)dst->pixels;
|
||||
SDLTest_AssertCheck(value == expected, "Expected value == 0x%" SDL_PRIx32 ", actually = 0x%" SDL_PRIx32, expected, value);
|
||||
SDL_DestroySurface(src);
|
||||
|
||||
if (SDL_PIXELORDER(format) == SDL_BITMAPORDER_1234) {
|
||||
pixel >>= bpp;
|
||||
} else {
|
||||
pixel <<= bpp;
|
||||
}
|
||||
}
|
||||
}
|
||||
SDL_DestroyPalette(palette);
|
||||
SDL_DestroySurface(dst);
|
||||
|
||||
return TEST_COMPLETED;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests blitting invalid surfaces.
|
||||
*/
|
||||
@@ -974,14 +1051,14 @@ static int SDLCALL surface_testBlitInvalid(void *arg)
|
||||
SDLTest_AssertCheck(invalid->pixels == NULL, "Check surface pixels are NULL");
|
||||
|
||||
result = SDL_BlitSurface(invalid, NULL, valid, NULL);
|
||||
SDLTest_AssertCheck(result == true, "SDL_BlitSurface(invalid, NULL, valid, NULL), result = %s\n", result ? "true" : "false");
|
||||
SDLTest_AssertCheck(result == true, "SDL_BlitSurface(invalid, NULL, valid, NULL), result = %s", result ? "true" : "false");
|
||||
result = SDL_BlitSurface(valid, NULL, invalid, NULL);
|
||||
SDLTest_AssertCheck(result == true, "SDL_BlitSurface(valid, NULL, invalid, NULL), result = %s\n", result ? "true" : "false");
|
||||
SDLTest_AssertCheck(result == true, "SDL_BlitSurface(valid, NULL, invalid, NULL), result = %s", result ? "true" : "false");
|
||||
|
||||
result = SDL_BlitSurfaceScaled(invalid, NULL, valid, NULL, SDL_SCALEMODE_NEAREST);
|
||||
SDLTest_AssertCheck(result == false, "SDL_BlitSurfaceScaled(invalid, NULL, valid, NULL, SDL_SCALEMODE_NEAREST), result = %s\n", result ? "true" : "false");
|
||||
SDLTest_AssertCheck(result == false, "SDL_BlitSurfaceScaled(invalid, NULL, valid, NULL, SDL_SCALEMODE_NEAREST), result = %s", result ? "true" : "false");
|
||||
result = SDL_BlitSurfaceScaled(valid, NULL, invalid, NULL, SDL_SCALEMODE_NEAREST);
|
||||
SDLTest_AssertCheck(result == false, "SDL_BlitSurfaceScaled(valid, NULL, invalid, NULL, SDL_SCALEMODE_NEAREST), result = %s\n", result ? "true" : "false");
|
||||
SDLTest_AssertCheck(result == false, "SDL_BlitSurfaceScaled(valid, NULL, invalid, NULL, SDL_SCALEMODE_NEAREST), result = %s", result ? "true" : "false");
|
||||
|
||||
SDL_DestroySurface(valid);
|
||||
SDL_DestroySurface(invalid);
|
||||
@@ -1699,6 +1776,10 @@ static const SDLTest_TestCaseReference surfaceTestBlitBlendMul = {
|
||||
surface_testBlitBlendMul, "surface_testBlitBlendMul", "Tests blitting routines with mul blending mode.", TEST_ENABLED
|
||||
};
|
||||
|
||||
static const SDLTest_TestCaseReference surfaceTestBlitBitmap = {
|
||||
surface_testBlitBitmap, "surface_testBlitBitmap", "Tests blitting routines with bitmap surfaces.", TEST_ENABLED
|
||||
};
|
||||
|
||||
static const SDLTest_TestCaseReference surfaceTestBlitInvalid = {
|
||||
surface_testBlitInvalid, "surface_testBlitInvalid", "Tests blitting routines with invalid surfaces.", TEST_ENABLED
|
||||
};
|
||||
@@ -1755,6 +1836,7 @@ static const SDLTest_TestCaseReference *surfaceTests[] = {
|
||||
&surfaceTestBlitBlendAddPremultiplied,
|
||||
&surfaceTestBlitBlendMod,
|
||||
&surfaceTestBlitBlendMul,
|
||||
&surfaceTestBlitBitmap,
|
||||
&surfaceTestBlitInvalid,
|
||||
&surfaceTestBlitsWithBadCoordinates,
|
||||
&surfaceTestOverflow,
|
||||
|
||||
Reference in new issue
Block a user