diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f05c09149..911c6b999 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -18,7 +18,7 @@ jobs: - name: add libs for glfw run: | sudo apt-get -y update - sudo apt install xorg-dev + sudo apt install xorg-dev libxkbcommon-dev libwayland-dev # for GLFW - name: configure glfw diff --git a/lib/linux/x64/cimgui.a b/lib/linux/x64/cimgui.a index 0aed1a029..077c16c13 100644 Binary files a/lib/linux/x64/cimgui.a and b/lib/linux/x64/cimgui.a differ diff --git a/lib/linux/x64/libSDL2.a b/lib/linux/x64/libSDL2.a index 81e99a1dd..b10fc4762 100644 Binary files a/lib/linux/x64/libSDL2.a and b/lib/linux/x64/libSDL2.a differ diff --git a/lib/linux/x64/libglfw3.a b/lib/linux/x64/libglfw3.a index 427dcece7..ee5671d8a 100644 Binary files a/lib/linux/x64/libglfw3.a and b/lib/linux/x64/libglfw3.a differ diff --git a/lib/macos/arm64/cimgui.a b/lib/macos/arm64/cimgui.a index daf419940..18cf15254 100644 Binary files a/lib/macos/arm64/cimgui.a and b/lib/macos/arm64/cimgui.a differ diff --git a/lib/macos/arm64/libSDL2.a b/lib/macos/arm64/libSDL2.a index 69d77aac7..f3d5c0a63 100644 Binary files a/lib/macos/arm64/libSDL2.a and b/lib/macos/arm64/libSDL2.a differ diff --git a/lib/macos/arm64/libglfw3.a b/lib/macos/arm64/libglfw3.a index 448f26cc2..06406a3c8 100644 Binary files a/lib/macos/arm64/libglfw3.a and b/lib/macos/arm64/libglfw3.a differ diff --git a/lib/macos/x64/cimgui.a b/lib/macos/x64/cimgui.a index 1a66a4e43..fda437956 100644 Binary files a/lib/macos/x64/cimgui.a and b/lib/macos/x64/cimgui.a differ diff --git a/lib/macos/x64/libSDL2.a b/lib/macos/x64/libSDL2.a index 69e34d515..a9e65b8c9 100644 Binary files a/lib/macos/x64/libSDL2.a and b/lib/macos/x64/libSDL2.a differ diff --git a/lib/macos/x64/libglfw3.a b/lib/macos/x64/libglfw3.a index 94de1d678..bf85ba8a2 100644 Binary files a/lib/macos/x64/libglfw3.a and b/lib/macos/x64/libglfw3.a differ diff --git a/lib/windows/x64/cimgui.a b/lib/windows/x64/cimgui.a index 7f7d839a4..377f9ad8e 100644 Binary files a/lib/windows/x64/cimgui.a and b/lib/windows/x64/cimgui.a differ diff --git a/lib/windows/x64/libSDL2.a b/lib/windows/x64/libSDL2.a index eb874006d..7b5a10cc0 100644 Binary files a/lib/windows/x64/libSDL2.a and b/lib/windows/x64/libSDL2.a differ diff --git a/lib/windows/x64/libglfw3.a b/lib/windows/x64/libglfw3.a index 83bd7c29e..59b3e50d4 100644 Binary files a/lib/windows/x64/libglfw3.a and b/lib/windows/x64/libglfw3.a differ diff --git a/thirdparty/SDL/.github/workflows/android.yml b/thirdparty/SDL/.github/workflows/android.yml index ccc02666f..a2d2b0b50 100644 --- a/thirdparty/SDL/.github/workflows/android.yml +++ b/thirdparty/SDL/.github/workflows/android.yml @@ -15,7 +15,7 @@ jobs: - { name: CMake, cmake: 1, android_abi: "arm64-v8a", android_platform: 23, arch: "aarch64" } steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: nttld/setup-ndk@v1 id: setup_ndk with: diff --git a/thirdparty/SDL/.github/workflows/cpactions.yml b/thirdparty/SDL/.github/workflows/cpactions.yml index 9b3a905be..acd40a930 100644 --- a/thirdparty/SDL/.github/workflows/cpactions.yml +++ b/thirdparty/SDL/.github/workflows/cpactions.yml @@ -8,12 +8,12 @@ jobs: name: FreeBSD timeout-minutes: 30 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Build - uses: cross-platform-actions/action@v0.19.1 + uses: cross-platform-actions/action@v0.24.0 with: operating_system: freebsd - version: '13.2' + version: '13.3' shell: bash run: | sudo pkg update diff --git a/thirdparty/SDL/.github/workflows/emscripten.yml b/thirdparty/SDL/.github/workflows/emscripten.yml index 5603e20fa..ee7974e5b 100644 --- a/thirdparty/SDL/.github/workflows/emscripten.yml +++ b/thirdparty/SDL/.github/workflows/emscripten.yml @@ -6,8 +6,8 @@ jobs: emscripten: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: mymindstorm/setup-emsdk@v12 + - uses: actions/checkout@v4 + - uses: mymindstorm/setup-emsdk@v14 with: version: 3.1.35 - name: Install ninja diff --git a/thirdparty/SDL/.github/workflows/ios.yml b/thirdparty/SDL/.github/workflows/ios.yml index 6034ce071..1eb57359f 100644 --- a/thirdparty/SDL/.github/workflows/ios.yml +++ b/thirdparty/SDL/.github/workflows/ios.yml @@ -15,6 +15,6 @@ jobs: - { name: tvOS, target: Static Library-tvOS, sdk: appletvos } steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Build run: xcodebuild -project Xcode/SDL/SDL.xcodeproj -target '${{ matrix.platform.target }}' -configuration Release -sdk ${{ matrix.platform.sdk }} clean build \ No newline at end of file diff --git a/thirdparty/SDL/.github/workflows/main.yml b/thirdparty/SDL/.github/workflows/main.yml index b1d435426..21ea7de3f 100644 --- a/thirdparty/SDL/.github/workflows/main.yml +++ b/thirdparty/SDL/.github/workflows/main.yml @@ -64,22 +64,27 @@ jobs: if: runner.os == 'macOS' run: | brew install \ + autoconf \ ninja \ pkg-config - name: Setup Intel oneAPI if: matrix.platform.intel run: | - # Setup oneAPI repo - wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB - sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB - sudo echo "deb https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list + # Download the key to system keyring + wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB \ + | gpg --dearmor | sudo tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null + + # Add signed entry to apt sources and configure the APT client to use Intel repository: + echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list + + # Update package list sudo apt-get update -y # Install oneAPI sudo apt-get install -y intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Check that versioning is consistent # We only need to run this once: arbitrarily use the Linux/CMake build if: "runner.os == 'Linux' && ! matrix.platform.autotools" diff --git a/thirdparty/SDL/.github/workflows/msvc.yml b/thirdparty/SDL/.github/workflows/msvc.yml index 2f962a0c4..241cc551d 100644 --- a/thirdparty/SDL/.github/workflows/msvc.yml +++ b/thirdparty/SDL/.github/workflows/msvc.yml @@ -23,7 +23,7 @@ jobs: project: VisualC-WinRT/SDL-UWP.sln, projectflags: '/p:Platform=x64 /p:WindowsTargetPlatformVersion=10.0.17763.0' } steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Create CMake project using SDL as a subproject shell: python run: | @@ -34,8 +34,14 @@ jobs: os.makedirs(builddir) with open(f"{ builddir }/CMakeLists.txt", "w") as f: f.write(textwrap.dedent(f"""\ - cmake_minimum_required(VERSION 3.0...3.5) + # Always build .PDB symbol file + set(CMAKE_POLICY_DEFAULT_CMP0141 "NEW" CACHE STRING "MSVC debug information format flags are selected by an abstraction") + set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "ProgramDatabase" CACHE STRING "MSVC debug information format") + set(CMAKE_EXE_LINKER_FLAGS "-DEBUG" CACHE STRING "Linker flags for executables") + set(CMAKE_SHARED_LINKER_FLAGS "-DEBUG" CACHE STRING "Linker flag for shared libraries") + cmake_minimum_required(VERSION 3.0...3.25) project(sdl_user) + enable_testing() add_subdirectory("{ srcdir }" SDL) """)) - name: Configure (CMake) @@ -68,7 +74,7 @@ jobs: - name: Add msbuild to PATH if: ${{ matrix.platform.project != '' }} - uses: microsoft/setup-msbuild@v1.1.3 + uses: microsoft/setup-msbuild@v2 - name: Build msbuild if: ${{ matrix.platform.project != '' }} run: msbuild ${{ matrix.platform.project }} /m /p:BuildInParallel=true /p:Configuration=Release ${{ matrix.platform.projectflags }} diff --git a/thirdparty/SDL/.github/workflows/n3ds.yml b/thirdparty/SDL/.github/workflows/n3ds.yml index 20f7a15ff..c7a135a07 100644 --- a/thirdparty/SDL/.github/workflows/n3ds.yml +++ b/thirdparty/SDL/.github/workflows/n3ds.yml @@ -8,7 +8,7 @@ jobs: container: image: devkitpro/devkitarm:latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install build requirements run: | apt update diff --git a/thirdparty/SDL/.github/workflows/ps2.yaml b/thirdparty/SDL/.github/workflows/ps2.yaml index fdf6329fc..2fb97f27b 100644 --- a/thirdparty/SDL/.github/workflows/ps2.yaml +++ b/thirdparty/SDL/.github/workflows/ps2.yaml @@ -7,7 +7,7 @@ jobs: runs-on: ubuntu-latest container: ps2dev/ps2dev:latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Setup dependencies run: | apk update diff --git a/thirdparty/SDL/.github/workflows/psp.yaml b/thirdparty/SDL/.github/workflows/psp.yaml index d9f7620bd..83e5dc31c 100644 --- a/thirdparty/SDL/.github/workflows/psp.yaml +++ b/thirdparty/SDL/.github/workflows/psp.yaml @@ -7,7 +7,7 @@ jobs: runs-on: ubuntu-latest container: pspdev/pspdev:latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Setup dependencies run: | apk update diff --git a/thirdparty/SDL/.github/workflows/riscos.yml b/thirdparty/SDL/.github/workflows/riscos.yml index 1fec84066..9f4c14028 100644 --- a/thirdparty/SDL/.github/workflows/riscos.yml +++ b/thirdparty/SDL/.github/workflows/riscos.yml @@ -18,7 +18,7 @@ jobs: steps: - name: Setup dependencies run: apt-get update && apt-get install -y cmake ninja-build - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Configure (autotools) if: ${{ contains(matrix.platform.name, 'autotools') }} run: | diff --git a/thirdparty/SDL/.github/workflows/vita.yaml b/thirdparty/SDL/.github/workflows/vita.yaml index b9f998d3a..808940823 100644 --- a/thirdparty/SDL/.github/workflows/vita.yaml +++ b/thirdparty/SDL/.github/workflows/vita.yaml @@ -19,7 +19,7 @@ jobs: - { name: GLES (pib), os: windows-latest, pib: true } - { name: GLES (PVR_PSP2 + gl4es4vita), os: windows-latest, pvr: true } steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install build requirements run: | apk update diff --git a/thirdparty/SDL/.github/workflows/watcom.yml b/thirdparty/SDL/.github/workflows/watcom.yml index bef3cf957..a79cc96ba 100644 --- a/thirdparty/SDL/.github/workflows/watcom.yml +++ b/thirdparty/SDL/.github/workflows/watcom.yml @@ -14,7 +14,7 @@ jobs: - { name: OS/2, makefile: Makefile.os2 } steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: open-watcom/setup-watcom@v0 - name: Build SDL2 run: | diff --git a/thirdparty/SDL/.gitignore b/thirdparty/SDL/.gitignore index fb013e8bf..cced2f8ed 100644 --- a/thirdparty/SDL/.gitignore +++ b/thirdparty/SDL/.gitignore @@ -103,6 +103,7 @@ VisualC/visualtest/testsprite2_sample.actions VisualC/visualtest/testsprite2_sample.config VisualC/visualtest/testsprite2_sample.parameters VisualC-GDK/**/Layout +VisualC-GDK/shaders/*.h # for Android android-project/local.properties diff --git a/thirdparty/SDL/CMakeLists.txt b/thirdparty/SDL/CMakeLists.txt index b38a8bbc1..7e135490a 100644 --- a/thirdparty/SDL/CMakeLists.txt +++ b/thirdparty/SDL/CMakeLists.txt @@ -86,8 +86,8 @@ endif() # See docs/release_checklist.md set(SDL_MAJOR_VERSION 2) -set(SDL_MINOR_VERSION 28) -set(SDL_MICRO_VERSION 5) +set(SDL_MINOR_VERSION 30) +set(SDL_MICRO_VERSION 7) set(SDL_VERSION "${SDL_MAJOR_VERSION}.${SDL_MINOR_VERSION}.${SDL_MICRO_VERSION}") # Set defaults preventing destination file conflicts @@ -241,6 +241,11 @@ endif() if(UNIX OR MINGW OR MSYS OR (USE_CLANG AND NOT WINDOWS) OR VITA OR PSP OR PS2 OR N3DS) set(OPT_DEF_LIBC ON) endif() +if(WINDOWS OR DARWIN OR MACOSX OR IOS OR TVOS) + set(SDL_SYSTEM_ICONV_DEFAULT OFF) +else() + set(SDL_SYSTEM_ICONV_DEFAULT ON) +endif() if(NOT ("$ENV{CFLAGS}" STREQUAL "")) if(CMAKE_VERSION VERSION_LESS 3.11.0) @@ -420,7 +425,8 @@ set_option(SDL_DIRECTFB "Use DirectFB video driver" OFF) dep_option(SDL_DIRECTFB_SHARED "Dynamically load directfb support" ON "SDL_DIRECTFB" OFF) set_option(SDL_DUMMYVIDEO "Use dummy video driver" ON) dep_option(SDL_IBUS "Enable IBus support" ON ${UNIX_SYS} OFF) -set_option(SDL_SYSTEM_ICONV "Use iconv() from system-installed libraries" ON) +set_option(SDL_SYSTEM_ICONV "Use iconv() from system-installed libraries" ${SDL_SYSTEM_ICONV_DEFAULT}) +set_option(SDL_LIBICONV "Prefer iconv() from libiconv, if available, over libc version" OFF) set_option(SDL_OPENGL "Include OpenGL support" ON) set_option(SDL_OPENGLES "Include OpenGL ES support" ON) set_option(SDL_PTHREADS "Use POSIX threads for multi-threading" ${SDL_PTHREADS_ENABLED_BY_DEFAULT}) @@ -585,11 +591,50 @@ if(USE_GCC OR USE_CLANG OR USE_INTELCC OR USE_QCC) endif() endif() + check_c_compiler_flag(-Wundef HAVE_GCC_WUNDEF) + if(HAVE_GCC_WUNDEF) + list(APPEND EXTRA_CFLAGS "-Wundef") + endif() + check_c_compiler_flag(-fno-strict-aliasing HAVE_GCC_NO_STRICT_ALIASING) if(HAVE_GCC_NO_STRICT_ALIASING) list(APPEND EXTRA_CFLAGS "-fno-strict-aliasing") endif() + check_c_compiler_flag(-Wdocumentation HAVE_GCC_WDOCUMENTATION) + if(HAVE_GCC_WDOCUMENTATION) + if(SDL_WERROR) + check_c_compiler_flag(-Werror=documentation HAVE_GCC_WERROR_DOCUMENTATION) + if(HAVE_GCC_WERROR_DOCUMENTATION) + list(APPEND EXTRA_CFLAGS "-Werror=documentation") + endif() + endif() + list(APPEND EXTRA_CFLAGS "-Wdocumentation") + endif() + + check_c_compiler_flag(-Wdocumentation-unknown-command HAVE_GCC_WDOCUMENTATION_UNKNOWN_COMMAND) + if(HAVE_GCC_WDOCUMENTATION_UNKNOWN_COMMAND) + if(SDL_WERROR) + check_c_compiler_flag(-Werror=documentation-unknown-command HAVE_GCC_WERROR_DOCUMENTATION_UNKNOWN_COMMAND) + if(HAVE_GCC_WERROR_DOCUMENTATION_UNKNOWN_COMMAND) + list(APPEND EXTRA_CFLAGS "-Werror=documentation-unknown-command") + endif() + endif() + list(APPEND EXTRA_CFLAGS "-Wdocumentation-unknown-command") + endif() + + check_c_compiler_flag(-fcomment-block-commands=threadsafety HAVE_GCC_COMMENT_BLOCK_COMMANDS) + if(HAVE_GCC_COMMENT_BLOCK_COMMANDS) + list(APPEND EXTRA_CFLAGS "-fcomment-block-commands=threadsafety") + list(APPEND EXTRA_CFLAGS "-fcomment-block-commands=deprecated") + else() + check_c_compiler_flag(/clang:-fcomment-block-commands=threadsafety HAVE_CLANG_COMMENT_BLOCK_COMMANDS) + if(HAVE_CLANG_COMMENT_BLOCK_COMMANDS) + list(APPEND EXTRA_CFLAGS "/clang:-fcomment-block-commands=threadsafety") + list(APPEND EXTRA_CFLAGS "/clang:-fcomment-block-commands=deprecated") + endif() + endif() + check_c_compiler_flag(-Wdeclaration-after-statement HAVE_GCC_WDECLARATION_AFTER_STATEMENT) if(HAVE_GCC_WDECLARATION_AFTER_STATEMENT) if(SDL_WERROR) @@ -866,7 +911,7 @@ if(SDL_ASSEMBLY) if(SDL_LSX) cmake_push_check_state() - list(APPEND CMAKE_REQUIRED_FLAGS "-mlsx") + set(CMAKE_REQUIRED_FLAGS "-mlsx") check_c_source_compiles(" #ifndef __loongarch_sx #error Assembler CPP flag not enabled @@ -881,22 +926,6 @@ if(SDL_ASSEMBLY) endif() endif() - if(SDL_LASX) - cmake_push_check_state() - list(APPEND CMAKE_REQUIRED_FLAGS "-mlasx") - check_c_source_compiles(" - #ifndef __loongarch_asx - #error Assembler CPP flag not enabled - #endif - int main(int argc, char **argv) { return 0; }" CPU_SUPPORTS_LASX) - check_include_file("lasxintrin.h" HAVE_LASXINTRIN_H) - cmake_pop_check_state() - if(CPU_SUPPORTS_LASX AND HAVE_LASXINTRIN_H) - list(APPEND EXTRA_CFLAGS "-mlasx") - set(HAVE_LASX TRUE) - endif() - endif() - if(SDL_ARMSIMD) set(ORIG_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}") set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -x assembler-with-cpp") @@ -1026,15 +1055,11 @@ if(SDL_LIBC) sys/types.h wchar.h ) - if(NOT EMSCRIPTEN) - list(APPEND headers_to_check libunwind.h) - endif() foreach(_HEADER ${headers_to_check}) string(TOUPPER "HAVE_${_HEADER}" _UPPER) string(REGEX REPLACE "[./]" "_" _HAVE_H ${_UPPER}) check_include_file("${_HEADER}" ${_HAVE_H}) endforeach() - check_include_file(linux/input.h HAVE_LINUX_INPUT_H) set(STDC_HEADER_NAMES "stddef.h;stdarg.h;stdlib.h;string.h;stdio.h;wchar.h;float.h") check_include_files("${STDC_HEADER_NAMES}" STDC_HEADERS) @@ -1066,6 +1091,8 @@ if(SDL_LIBC) check_symbol_exists(getauxval "sys/auxv.h" HAVE_GETAUXVAL) check_symbol_exists(elf_aux_info "sys/auxv.h" HAVE_ELF_AUX_INFO) check_symbol_exists(poll "poll.h" HAVE_POLL) + check_symbol_exists(memfd_create "sys/mman.h" HAVE_MEMFD_CREATE) + check_symbol_exists(posix_fallocate "fcntl.h" HAVE_POSIX_FALLOCATE) check_library_exists(m pow "" HAVE_LIBM) if(HAVE_LIBM) @@ -1088,16 +1115,31 @@ if(SDL_LIBC) endif() if(SDL_SYSTEM_ICONV) - check_library_exists(iconv iconv_open "" HAVE_LIBICONV) - if(HAVE_LIBICONV) - list(APPEND EXTRA_LIBS iconv) + check_c_source_compiles(" + #define LIBICONV_PLUG 1 /* in case libiconv header is in include path */ + #include + #include + int main(int argc, char **argv) { + return !iconv_open(NULL,NULL); + }" ICONV_IN_LIBC) + + cmake_push_check_state() + list(APPEND CMAKE_REQUIRED_LIBRARIES iconv) + check_c_source_compiles(" + #include + #include + int main(int argc, char **argv) { + return !iconv_open(NULL,NULL); + }" ICONV_IN_LIBICONV) + cmake_pop_check_state() + + if(ICONV_IN_LIBC OR ICONV_IN_LIBICONV) set(HAVE_ICONV 1) set(HAVE_SYSTEM_ICONV TRUE) - else() - check_library_exists(c iconv_open "" HAVE_BUILTIN_ICONV) - if(HAVE_BUILTIN_ICONV) - set(HAVE_ICONV 1) - set(HAVE_SYSTEM_ICONV TRUE) + if(ICONV_IN_LIBICONV AND (SDL_LIBICONV OR (NOT ICONV_IN_LIBC))) + set(SDL_USE_LIBICONV 1) + set(HAVE_LIBICONV TRUE) + list(APPEND EXTRA_LIBS iconv) endif() endif() endif() @@ -1408,10 +1450,7 @@ elseif(EMSCRIPTEN) endif() CheckPTHREAD() - - if(HAVE_LIBUNWIND_H) - list(APPEND EXTRA_TEST_LIBS unwind) - endif() + CheckLibUnwind() elseif(UNIX AND NOT APPLE AND NOT RISCOS AND NOT HAIKU) if(SDL_AUDIO) @@ -1479,7 +1518,7 @@ elseif(UNIX AND NOT APPLE AND NOT RISCOS AND NOT HAIKU) #ifndef EVIOCGNAME #error EVIOCGNAME() ioctl not available #endif - int main(int argc, char** argv) { return 0; }" HAVE_INPUT_EVENTS) + int main(int argc, char** argv) { return 0; }" HAVE_LINUX_INPUT_H) if(LINUX) check_c_source_compiles(" @@ -1515,11 +1554,11 @@ elseif(UNIX AND NOT APPLE AND NOT RISCOS AND NOT HAIKU) }" HAVE_INPUT_WSCONS) endif() - if(HAVE_INPUT_EVENTS) + if(HAVE_LINUX_INPUT_H) set(SDL_INPUT_LINUXEV 1) endif() - if(SDL_HAPTIC AND HAVE_INPUT_EVENTS) + if(SDL_HAPTIC AND HAVE_LINUX_INPUT_H) set(SDL_HAPTIC_LINUX 1) file(GLOB HAPTIC_SOURCES ${SDL2_SOURCE_DIR}/src/haptic/linux/*.c) list(APPEND SOURCE_FILES ${HAPTIC_SOURCES}) @@ -1582,15 +1621,8 @@ elseif(UNIX AND NOT APPLE AND NOT RISCOS AND NOT HAIKU) endif() endif() - if(HAVE_LIBUNWIND_H) - # We've already found the header, so link the lib if present. - # NB: This .pc file is not present on FreeBSD where the implicitly - # linked base system libgcc_s includes all libunwind ABI. - pkg_search_module(UNWIND libunwind) - pkg_search_module(UNWIND_GENERIC libunwind-generic) - list(APPEND EXTRA_TEST_LIBS ${UNWIND_LIBRARIES} ${UNWIND_GENERIC_LIBRARIES}) - endif() endif() + CheckLibUnwind() if(HAVE_DBUS_DBUS_H) list(APPEND SOURCE_FILES "${SDL2_SOURCE_DIR}/src/core/linux/SDL_dbus.c") @@ -1612,7 +1644,7 @@ elseif(UNIX AND NOT APPLE AND NOT RISCOS AND NOT HAIKU) list(APPEND SOURCE_FILES "${SDL2_SOURCE_DIR}/src/core/linux/SDL_udev.c") endif() - if(HAVE_INPUT_EVENTS) + if(HAVE_LINUX_INPUT_H) list(APPEND SOURCE_FILES "${SDL2_SOURCE_DIR}/src/core/linux/SDL_evdev.c") list(APPEND SOURCE_FILES "${SDL2_SOURCE_DIR}/src/core/linux/SDL_evdev_kbd.c") endif() @@ -1621,6 +1653,11 @@ elseif(UNIX AND NOT APPLE AND NOT RISCOS AND NOT HAIKU) list(APPEND SOURCE_FILES "${SDL2_SOURCE_DIR}/src/core/freebsd/SDL_evdev_kbd_freebsd.c") endif() + if(HAVE_INPUT_WSCONS) + list(APPEND SOURCE_FILES "${SDL2_SOURCE_DIR}/src/core/openbsd/SDL_wscons_kbd.c") + list(APPEND SOURCE_FILES "${SDL2_SOURCE_DIR}/src/core/openbsd/SDL_wscons_mouse.c") + endif() + # Always compiled for Linux, unconditionally: list(APPEND SOURCE_FILES "${SDL2_SOURCE_DIR}/src/core/linux/SDL_evdev_capabilities.c") list(APPEND SOURCE_FILES "${SDL2_SOURCE_DIR}/src/core/linux/SDL_threadprio.c") @@ -1637,7 +1674,7 @@ elseif(UNIX AND NOT APPLE AND NOT RISCOS AND NOT HAIKU) if(FREEBSD OR NETBSD OR OPENBSD OR BSDI) CheckUSBHID() endif() - if(LINUX AND HAVE_LINUX_INPUT_H AND NOT ANDROID) + if((LINUX OR FREEBSD) AND HAVE_LINUX_INPUT_H AND NOT ANDROID) set(SDL_JOYSTICK_LINUX 1) file(GLOB JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/linux/*.c ${SDL2_SOURCE_DIR}/src/joystick/steam/*.c) list(APPEND SOURCE_FILES ${JOYSTICK_SOURCES}) @@ -1740,14 +1777,6 @@ elseif(WINDOWS) list(APPEND SOURCE_FILES ${WINRT_SOURCE_FILES}) endif() - if(MSVC AND NOT SDL_LIBC) - # Prevent codegen that would use the VC runtime libraries. - set_property(DIRECTORY . APPEND PROPERTY COMPILE_OPTIONS "/GS-;/Gs1048576") - if(NOT ARCH_64 AND NOT CMAKE_GENERATOR_PLATFORM STREQUAL "ARM") - set_property(DIRECTORY . APPEND PROPERTY COMPILE_OPTIONS "/arch:SSE") - endif() - endif() - if(SDL_MISC) if(WINDOWS_STORE) file(GLOB MISC_SOURCES ${SDL2_SOURCE_DIR}/src/misc/winrt/*.cpp) @@ -1773,13 +1802,11 @@ elseif(WINDOWS) check_include_file(d3d9.h HAVE_D3D_H) check_include_file(d3d11_1.h HAVE_D3D11_H) check_c_source_compiles(" - #include - #include #include + #include ID3D12Device1 *device; - #if WDK_NTDDI_VERSION > 0x0A000008 - int main(int argc, char **argv) { return 0; } - #endif" HAVE_D3D12_H) + int main(int argc, char **argv) {return 0; } + " HAVE_D3D12_H) check_include_file(ddraw.h HAVE_DDRAW_H) check_include_file(dsound.h HAVE_DSOUND_H) check_include_file(dinput.h HAVE_DINPUT_H) @@ -1804,16 +1831,6 @@ elseif(WINDOWS) #include #include int main(int argc, char **argv) { return 0; }" HAVE_XINPUT_H) - check_c_source_compiles(" - #include - #include - XINPUT_GAMEPAD_EX x1; - int main(int argc, char **argv) { return 0; }" HAVE_XINPUT_GAMEPAD_EX) - check_c_source_compiles(" - #include - #include - XINPUT_STATE_EX s1; - int main(int argc, char **argv) { return 0; }" HAVE_XINPUT_STATE_EX) check_c_source_compiles(" #define COBJMACROS #include @@ -2489,7 +2506,7 @@ elseif(VITA) ${SDL2_SOURCE_DIR}/src/thread/vita/SDL_sysmutex.c ${SDL2_SOURCE_DIR}/src/thread/vita/SDL_syssem.c ${SDL2_SOURCE_DIR}/src/thread/vita/SDL_systhread.c - ${SDL2_SOURCE_DIR}/src/thread/vita/SDL_syscond.c + ${SDL2_SOURCE_DIR}/src/thread/generic/SDL_syscond.c ${SDL2_SOURCE_DIR}/src/thread/generic/SDL_systls.c) set(HAVE_SDL_THREADS TRUE) endif() @@ -2641,7 +2658,10 @@ elseif(PSP) endif() if(SDL_THREADS) set(SDL_THREAD_PSP 1) - file(GLOB PSP_THREAD_SOURCES ${SDL2_SOURCE_DIR}/src/thread/generic/SDL_systls.c ${SDL2_SOURCE_DIR}/src/thread/psp/*.c) + file(GLOB PSP_THREAD_SOURCES + ${SDL2_SOURCE_DIR}/src/thread/generic/SDL_systls.c + ${SDL2_SOURCE_DIR}/src/thread/generic/SDL_syscond.c + ${SDL2_SOURCE_DIR}/src/thread/psp/*.c) list(APPEND SOURCE_FILES ${PSP_THREAD_SOURCES}) set(HAVE_SDL_THREADS TRUE) endif() @@ -2702,7 +2722,11 @@ elseif(PS2) endif() if(SDL_THREADS) set(SDL_THREAD_PS2 1) - file(GLOB PS2_THREAD_SOURCES ${SDL2_SOURCE_DIR}/src/thread/generic/SDL_systls.c ${SDL2_SOURCE_DIR}/src/thread/generic/SDL_sysmutex.c ${SDL2_SOURCE_DIR}/src/thread/ps2/*.c) + file(GLOB PS2_THREAD_SOURCES + ${SDL2_SOURCE_DIR}/src/thread/generic/SDL_systls.c + ${SDL2_SOURCE_DIR}/src/thread/generic/SDL_sysmutex.c + ${SDL2_SOURCE_DIR}/src/thread/generic/SDL_syscond.c + ${SDL2_SOURCE_DIR}/src/thread/ps2/*.c) list(APPEND SOURCE_FILES ${PS2_THREAD_SOURCES}) set(HAVE_SDL_THREADS TRUE) endif() @@ -2833,7 +2857,9 @@ elseif(N3DS) if(SDL_THREADS) set(SDL_THREAD_N3DS 1) file(GLOB N3DS_THREAD_SOURCES ${SDL2_SOURCE_DIR}/src/thread/n3ds/*.c) - list(APPEND SOURCE_FILES ${N3DS_THREAD_SOURCES} ${SDL2_SOURCE_DIR}/src/thread/generic/SDL_systls.c) + list(APPEND SOURCE_FILES ${N3DS_THREAD_SOURCES} + ${SDL2_SOURCE_DIR}/src/thread/generic/SDL_systls.c + ${SDL2_SOURCE_DIR}/src/thread/generic/SDL_syscond.c) set(HAVE_SDL_THREADS TRUE) endif() @@ -3021,6 +3047,10 @@ endif() listtostr(EXTRA_CFLAGS _EXTRA_CFLAGS) set(EXTRA_CFLAGS ${_EXTRA_CFLAGS}) +if(USE_GCC OR USE_CLANG) + string(REGEX REPLACE "(^| )-I" "\\1 -isystem" EXTRA_CFLAGS "${EXTRA_CFLAGS}") +endif() + # Compat helpers for the configuration files if(EXISTS "${PROJECT_SOURCE_DIR}/VERSION.txt") @@ -3484,10 +3514,28 @@ if(SDL_TEST) "$" "$") target_link_libraries(SDL2_test PRIVATE ${EXTRA_TEST_LIBS}) + target_include_directories(SDL2_test PRIVATE ${EXTRA_TEST_INCLUDES}) set_property(TARGET SDL2_test APPEND PROPERTY COMPATIBLE_INTERFACE_STRING "SDL_VERSION") set_property(TARGET SDL2_test PROPERTY INTERFACE_SDL_VERSION "SDL2") endif() +if(MSVC AND NOT SDL_LIBC) + set(targets ) + if(TARGET SDL2) + list(APPEND targets SDL2) + endif() + if(TARGET SDL2-static) + list(APPEND targets SDL2-static) + endif() + if(TARGET SDL2_test) + list(APPEND targets SDL2_test) + endif() + set_property(TARGET ${targets} APPEND PROPERTY COMPILE_OPTIONS "/GS-;/Gs1048576") + if(NOT ARCH_64 AND NOT CMAKE_GENERATOR_PLATFORM STREQUAL "ARM") + set_property(TARGET ${targets} APPEND PROPERTY COMPILE_OPTIONS "/arch:SSE") + endif() +endif() + ##### Installation targets ##### if(NOT SDL2_DISABLE_INSTALL) if(SDL_SHARED) @@ -3495,6 +3543,9 @@ if(NOT SDL2_DISABLE_INSTALL) LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") + if(MSVC) + SDL_install_pdb(SDL2 "${CMAKE_INSTALL_BINDIR}") + endif() endif() if(NOT WINDOWS_STORE AND NOT SDL2_DISABLE_SDL2MAIN) @@ -3502,6 +3553,9 @@ if(NOT SDL2_DISABLE_INSTALL) LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") + if(MSVC) + SDL_install_pdb(SDL2main "${CMAKE_INSTALL_LIBDIR}") + endif() endif() if(SDL_STATIC) @@ -3509,6 +3563,9 @@ if(NOT SDL2_DISABLE_INSTALL) LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") + if(MSVC) + SDL_install_pdb(SDL2-static "${CMAKE_INSTALL_LIBDIR}") + endif() endif() if(SDL_TEST) @@ -3516,6 +3573,9 @@ if(NOT SDL2_DISABLE_INSTALL) LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") + if(MSVC) + SDL_install_pdb(SDL2_test "${CMAKE_INSTALL_LIBDIR}") + endif() endif() ##### Export files ##### diff --git a/thirdparty/SDL/LICENSE.txt b/thirdparty/SDL/LICENSE.txt index 83d8937ef..74bb56cdd 100644 --- a/thirdparty/SDL/LICENSE.txt +++ b/thirdparty/SDL/LICENSE.txt @@ -1,4 +1,4 @@ -Copyright (C) 1997-2023 Sam Lantinga +Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/Makefile.in b/thirdparty/SDL/Makefile.in index eb4c4bc1a..27e0bbbf3 100644 --- a/thirdparty/SDL/Makefile.in +++ b/thirdparty/SDL/Makefile.in @@ -52,7 +52,7 @@ WAYLAND_SCANNER_CODE_MODE = @WAYLAND_SCANNER_CODE_MODE@ INSTALL_SDL2_CONFIG = @INSTALL_SDL2_CONFIG@ -SRC_DIST = *.md *.txt acinclude Android.mk autogen.sh android-project build-scripts cmake cmake_uninstall.cmake.in configure configure.ac docs include Makefile.* mingw sdl2-config.cmake.in sdl2-config-version.cmake.in sdl2-config.in sdl2.m4 sdl2.pc.in SDL2.spec.in SDL2Config.cmake.in src test VisualC VisualC-WinRT Xcode Xcode-iOS wayland-protocols +SRC_DIST = *.md *.txt acinclude Android.mk autogen.sh android-project build-scripts cmake cmake_uninstall.cmake.in configure configure.ac docs include Makefile.* mingw sdl2-config.cmake.in sdl2-config-version.cmake.in sdl2-config.in sdl2.m4 sdl2.pc.in SDL2.spec.in SDL2Config.cmake.in src test VisualC VisualC-GDK VisualC-WinRT Xcode Xcode-iOS wayland-protocols GEN_DIST = SDL2.spec ifneq ($V,1) diff --git a/thirdparty/SDL/Makefile.os2 b/thirdparty/SDL/Makefile.os2 index bb1b231a6..ff95021bb 100644 --- a/thirdparty/SDL/Makefile.os2 +++ b/thirdparty/SDL/Makefile.os2 @@ -1,4 +1,4 @@ -# Open Watcom makefile to build SDL2.dll for OS/2 +# Open Watcom makefile to build SDL2.dll for OS/2: # wmake -f Makefile.os2 # # If you have GNU libiconv installed (iconv2.dll), you @@ -14,8 +14,8 @@ LIBNAME = SDL2 MAJOR_VERSION = 2 -MINOR_VERSION = 28 -MICRO_VERSION = 5 +MINOR_VERSION = 30 +MICRO_VERSION = 7 VERSION = $(MAJOR_VERSION).$(MINOR_VERSION).$(MICRO_VERSION) DESCRIPTION = Simple DirectMedia Layer 2 @@ -56,7 +56,7 @@ CFLAGS_DLL+= -bd # iconv: LIBICONV_LIB=iconv2.lib !ifeq LIBICONV 1 -CFLAGS_DLL+= -DHAVE_ICONV=1 -DHAVE_ICONV_H=1 +CFLAGS_DLL+= -DHAVE_ICONV=1 -DHAVE_ICONV_H=1 -DSDL_USE_LIBICONV LIBS+= $(ICONVLIB) !else LIBS+= libuls.lib libconv.lib @@ -81,7 +81,7 @@ SRCS+= SDL_events.c SDL_quit.c SDL_keyboard.c SDL_mouse.c SDL_windowevents.c & SDL_clipboardevents.c SDL_dropevents.c SDL_displayevents.c SDL_gesture.c & SDL_sensor.c SDL_touch.c SRCS+= SDL_haptic.c SDL_hidapi.c SDL_gamecontroller.c SDL_joystick.c controller_type.c -SRCS+= SDL_render.c yuv_rgb.c SDL_yuv.c SDL_yuv_sw.c SDL_blendfillrect.c & +SRCS+= SDL_render.c yuv_rgb_sse.c yuv_rgb_std.c SDL_yuv.c SDL_yuv_sw.c SDL_blendfillrect.c & SDL_blendline.c SDL_blendpoint.c SDL_drawline.c SDL_drawpoint.c & SDL_render_sw.c SDL_rotate.c SDL_triangle.c SRCS+= SDL_blit.c SDL_blit_0.c SDL_blit_1.c SDL_blit_A.c SDL_blit_auto.c & @@ -94,7 +94,7 @@ SRCS+= SDL_systimer.c SRCS+= SDL_sysloadso.c SRCS+= SDL_sysfilesystem.c SRCS+= SDL_os2joystick.c SDL_syshaptic.c SDL_sysjoystick.c SDL_virtualjoystick.c -SRCS+= SDL_hidapijoystick.c SDL_hidapi_rumble.c SDL_hidapi_combined.c SDL_hidapi_gamecube.c SDL_hidapi_luna.c SDL_hidapi_ps3.c SDL_hidapi_ps4.c SDL_hidapi_ps5.c SDL_hidapi_shield.c SDL_hidapi_stadia.c SDL_hidapi_switch.c SDL_hidapi_wii.c SDL_hidapi_xbox360.c SDL_hidapi_xbox360w.c SDL_hidapi_xboxone.c SDL_hidapi_steam.c +SRCS+= SDL_hidapijoystick.c SDL_hidapi_rumble.c SDL_hidapi_combined.c SDL_hidapi_gamecube.c SDL_hidapi_luna.c SDL_hidapi_ps3.c SDL_hidapi_ps4.c SDL_hidapi_ps5.c SDL_hidapi_shield.c SDL_hidapi_stadia.c SDL_hidapi_switch.c SDL_hidapi_wii.c SDL_hidapi_xbox360.c SDL_hidapi_xbox360w.c SDL_hidapi_xboxone.c SDL_hidapi_steam.c SDL_hidapi_steamdeck.c SDL_steam_virtual_gamepad.c SRCS+= SDL_dummyaudio.c SDL_diskaudio.c SRCS+= SDL_nullvideo.c SDL_nullframebuffer.c SDL_nullevents.c SRCS+= SDL_dummysensor.c @@ -152,6 +152,8 @@ SDL_blendpoint.obj: SDL_blendpoint.c wcc386 $(CFLAGS_DLL) -wcd=200 -fo=$^@ $< SDL_RLEaccel.obj: SDL_RLEaccel.c wcc386 $(CFLAGS_DLL) -wcd=201 -fo=$^@ $< +yuv_rgb_sse.obj: yuv_rgb_sse.c + wcc386 $(CFLAGS_DLL) -wcd=202 -fo=$^@ $< !ifeq HIDAPI 1 # c99 mode needed because of structs with flexible array members in libusb.h SDL_hidapi.obj: SDL_hidapi.c diff --git a/thirdparty/SDL/Makefile.w32 b/thirdparty/SDL/Makefile.w32 index 6b14fc317..076f7954c 100644 --- a/thirdparty/SDL/Makefile.w32 +++ b/thirdparty/SDL/Makefile.w32 @@ -1,12 +1,12 @@ -# Open Watcom makefile to build SDL2.dll for Win32 +# Open Watcom makefile to build SDL2.dll for Win32: # wmake -f Makefile.w32 # # To error out upon warnings: wmake -f Makefile.w32 ENABLE_WERROR=1 LIBNAME = SDL2 MAJOR_VERSION = 2 -MINOR_VERSION = 28 -MICRO_VERSION = 5 +MINOR_VERSION = 30 +MICRO_VERSION = 7 VERSION = $(MAJOR_VERSION).$(MINOR_VERSION).$(MICRO_VERSION) LIBHOME = . @@ -60,7 +60,7 @@ SRCS+= SDL_events.c SDL_quit.c SDL_keyboard.c SDL_mouse.c SDL_windowevents.c & SDL_clipboardevents.c SDL_dropevents.c SDL_displayevents.c SDL_gesture.c & SDL_sensor.c SDL_touch.c SRCS+= SDL_haptic.c SDL_hidapi.c SDL_gamecontroller.c SDL_joystick.c controller_type.c -SRCS+= SDL_render.c yuv_rgb.c SDL_yuv.c SDL_yuv_sw.c SDL_blendfillrect.c & +SRCS+= SDL_render.c yuv_rgb_sse.c yuv_rgb_std.c SDL_yuv.c SDL_yuv_sw.c SDL_blendfillrect.c & SDL_blendline.c SDL_blendpoint.c SDL_drawline.c SDL_drawpoint.c & SDL_render_sw.c SDL_rotate.c SDL_triangle.c SRCS+= SDL_blit.c SDL_blit_0.c SDL_blit_1.c SDL_blit_A.c SDL_blit_auto.c & @@ -73,7 +73,7 @@ SRCS+= SDL_systimer.c SRCS+= SDL_sysloadso.c SRCS+= SDL_sysfilesystem.c SRCS+= SDL_syshaptic.c SDL_sysjoystick.c SDL_virtualjoystick.c -SRCS+= SDL_hidapijoystick.c SDL_hidapi_rumble.c SDL_hidapi_combined.c SDL_hidapi_gamecube.c SDL_hidapi_luna.c SDL_hidapi_ps3.c SDL_hidapi_ps4.c SDL_hidapi_ps5.c SDL_hidapi_shield.c SDL_hidapi_stadia.c SDL_hidapi_switch.c SDL_hidapi_wii.c SDL_hidapi_xbox360.c SDL_hidapi_xbox360w.c SDL_hidapi_xboxone.c SDL_hidapi_steam.c +SRCS+= SDL_hidapijoystick.c SDL_hidapi_rumble.c SDL_hidapi_combined.c SDL_hidapi_gamecube.c SDL_hidapi_luna.c SDL_hidapi_ps3.c SDL_hidapi_ps4.c SDL_hidapi_ps5.c SDL_hidapi_shield.c SDL_hidapi_stadia.c SDL_hidapi_switch.c SDL_hidapi_wii.c SDL_hidapi_xbox360.c SDL_hidapi_xbox360w.c SDL_hidapi_xboxone.c SDL_hidapi_steam.c SDL_hidapi_steamdeck.c SRCS+= SDL_dummyaudio.c SDL_diskaudio.c SRCS+= SDL_nullvideo.c SDL_nullframebuffer.c SDL_nullevents.c SRCS+= SDL_dummysensor.c @@ -93,7 +93,7 @@ SRCS+= SDL_render_gl.c SDL_shaders_gl.c SRCS+= SDL_render_gles2.c SDL_shaders_gles2.c SRCS+= SDL_windowssensor.c SRCS+= SDL_syscond_cv.c -SRCS+= SDL_windowsclipboard.c SDL_windowsevents.c SDL_windowsframebuffer.c SDL_windowskeyboard.c SDL_windowsmessagebox.c SDL_windowsmodes.c SDL_windowsmouse.c SDL_windowsopengl.c SDL_windowsopengles.c SDL_windowsshape.c SDL_windowsvideo.c SDL_windowsvulkan.c SDL_windowswindow.c +SRCS+= SDL_windowsclipboard.c SDL_windowsevents.c SDL_windowsframebuffer.c SDL_windowskeyboard.c SDL_windowsmessagebox.c SDL_windowsmodes.c SDL_windowsmouse.c SDL_windowsopengl.c SDL_windowsopengles.c SDL_windowsshape.c SDL_windowsvideo.c SDL_windowsvulkan.c SDL_windowswindow.c SDL_steam_virtual_gamepad.c SRCS+= SDL_dynapi.c @@ -147,6 +147,9 @@ SDL_RLEaccel.obj: SDL_RLEaccel.c SDL_malloc.obj: SDL_malloc.c wcc386 $(CFLAGS_DLL) -wcd=201 -fo=$^@ $< +yuv_rgb_sse.obj: yuv_rgb_sse.c + wcc386 $(CFLAGS_DLL) -wcd=202 -fo=$^@ $< + # SDL2libm MSRCS= e_atan2.c e_exp.c e_fmod.c e_log10.c e_log.c e_pow.c e_rem_pio2.c e_sqrt.c & k_cos.c k_rem_pio2.c k_sin.c k_tan.c & diff --git a/thirdparty/SDL/VisualC-GDK/SDL/SDL.vcxproj b/thirdparty/SDL/VisualC-GDK/SDL/SDL.vcxproj index c8208b41f..2097e6944 100644 --- a/thirdparty/SDL/VisualC-GDK/SDL/SDL.vcxproj +++ b/thirdparty/SDL/VisualC-GDK/SDL/SDL.vcxproj @@ -173,6 +173,12 @@ Windows true + + $(SolutionDir)\shaders\buildshaders.bat $(SolutionDir) + + + Building shader blobs (Xbox Series) + @@ -201,6 +207,12 @@ Windows true + + $(SolutionDir)\shaders\buildshaders.bat $(SolutionDir) one + + + Building shader blobs (Xbox One) + @@ -259,6 +271,12 @@ true true + + $(SolutionDir)\shaders\buildshaders.bat $(SolutionDir) + + + Building shader blobs (Xbox Series) + @@ -288,6 +306,12 @@ true true + + $(SolutionDir)\shaders\buildshaders.bat $(SolutionDir) one + + + Building shader blobs (Xbox One) + @@ -412,6 +436,7 @@ + @@ -474,7 +499,6 @@ - @@ -519,7 +543,13 @@ + + + + + + @@ -563,7 +593,7 @@ - + @@ -601,6 +631,7 @@ + @@ -608,6 +639,7 @@ + @@ -752,7 +784,9 @@ - + + + diff --git a/thirdparty/SDL/VisualC-GDK/SDL/SDL.vcxproj.filters b/thirdparty/SDL/VisualC-GDK/SDL/SDL.vcxproj.filters index 02dc97ef3..56494d483 100644 --- a/thirdparty/SDL/VisualC-GDK/SDL/SDL.vcxproj.filters +++ b/thirdparty/SDL/VisualC-GDK/SDL/SDL.vcxproj.filters @@ -31,7 +31,7 @@ {377061e4-3856-4f05-b916-0d3b360df0f6} - + {226a6643-1c65-4c7f-92aa-861313d974bb} @@ -501,6 +501,9 @@ joystick + + joystick + joystick @@ -777,9 +780,6 @@ video\khronos\vulkan - - video\khronos\vulkan - video\khronos\vulkan @@ -925,8 +925,8 @@ file - - filesystem\windows + + filesystem\gdk haptic @@ -943,6 +943,9 @@ joystick + + joystick + libm @@ -1081,6 +1084,9 @@ joystick\hidapi + + joystick\hidapi + joystick\hidapi diff --git a/thirdparty/SDL/VisualC-GDK/clean.sh b/thirdparty/SDL/VisualC-GDK/clean.sh index a026b71a3..235b79c49 100755 --- a/thirdparty/SDL/VisualC-GDK/clean.sh +++ b/thirdparty/SDL/VisualC-GDK/clean.sh @@ -4,3 +4,4 @@ find . -type f \( -name '*.bmp' -o -name '*.wav' -o -name '*.dat' \) -print -del find . -depth -type d \( -name Gaming.Desktop.x64 \) -exec rm -rv {} \; find . -depth -type d \( -name Gaming.Xbox.Scarlett.x64 \) -exec rm -rv {} \; find . -depth -type d \( -name Gaming.Xbox.XboxOne.x64 \) -exec rm -rv {} \; +rm shaders/*.h diff --git a/thirdparty/SDL/VisualC-GDK/shaders/D3D12_PixelShader_Colors.hlsl b/thirdparty/SDL/VisualC-GDK/shaders/D3D12_PixelShader_Colors.hlsl new file mode 100644 index 000000000..47eff4cc2 --- /dev/null +++ b/thirdparty/SDL/VisualC-GDK/shaders/D3D12_PixelShader_Colors.hlsl @@ -0,0 +1,19 @@ +struct PixelShaderInput +{ + float4 pos : SV_POSITION; + float2 tex : TEXCOORD0; + float4 color : COLOR0; +}; + +#define ColorRS \ + "RootFlags ( ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT |" \ + "DENY_DOMAIN_SHADER_ROOT_ACCESS |" \ + "DENY_GEOMETRY_SHADER_ROOT_ACCESS |" \ + "DENY_HULL_SHADER_ROOT_ACCESS )," \ + "RootConstants(num32BitConstants=32, b0)" + +[RootSignature(ColorRS)] +float4 main(PixelShaderInput input) : SV_TARGET0 +{ + return input.color; +} \ No newline at end of file diff --git a/thirdparty/SDL/VisualC-GDK/shaders/D3D12_PixelShader_NV12_BT601.hlsl b/thirdparty/SDL/VisualC-GDK/shaders/D3D12_PixelShader_NV12_BT601.hlsl new file mode 100644 index 000000000..cffbc2261 --- /dev/null +++ b/thirdparty/SDL/VisualC-GDK/shaders/D3D12_PixelShader_NV12_BT601.hlsl @@ -0,0 +1,43 @@ +Texture2D theTextureY : register(t0); +Texture2D theTextureUV : register(t1); +SamplerState theSampler : register(s0); + +struct PixelShaderInput +{ + float4 pos : SV_POSITION; + float2 tex : TEXCOORD0; + float4 color : COLOR0; +}; + +#define NVRS \ + "RootFlags ( ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT |" \ + " DENY_DOMAIN_SHADER_ROOT_ACCESS |" \ + " DENY_GEOMETRY_SHADER_ROOT_ACCESS |" \ + " DENY_HULL_SHADER_ROOT_ACCESS )," \ + "RootConstants(num32BitConstants=32, b0),"\ + "DescriptorTable ( SRV(t0), visibility = SHADER_VISIBILITY_PIXEL ),"\ + "DescriptorTable ( SRV(t1), visibility = SHADER_VISIBILITY_PIXEL ),"\ + "DescriptorTable ( Sampler(s0), visibility = SHADER_VISIBILITY_PIXEL )" + +[RootSignature(NVRS)] +float4 main(PixelShaderInput input) : SV_TARGET +{ + const float3 offset = {-0.0627451017, -0.501960814, -0.501960814}; + const float3 Rcoeff = {1.1644, 0.0000, 1.5960}; + const float3 Gcoeff = {1.1644, -0.3918, -0.8130}; + const float3 Bcoeff = {1.1644, 2.0172, 0.0000}; + + float4 Output; + + float3 yuv; + yuv.x = theTextureY.Sample(theSampler, input.tex).r; + yuv.yz = theTextureUV.Sample(theSampler, input.tex).rg; + + yuv += offset; + Output.r = dot(yuv, Rcoeff); + Output.g = dot(yuv, Gcoeff); + Output.b = dot(yuv, Bcoeff); + Output.a = 1.0f; + + return Output * input.color; +} \ No newline at end of file diff --git a/thirdparty/SDL/VisualC-GDK/shaders/D3D12_PixelShader_NV12_BT709.hlsl b/thirdparty/SDL/VisualC-GDK/shaders/D3D12_PixelShader_NV12_BT709.hlsl new file mode 100644 index 000000000..81d409c94 --- /dev/null +++ b/thirdparty/SDL/VisualC-GDK/shaders/D3D12_PixelShader_NV12_BT709.hlsl @@ -0,0 +1,43 @@ +Texture2D theTextureY : register(t0); +Texture2D theTextureUV : register(t1); +SamplerState theSampler : register(s0); + +struct PixelShaderInput +{ + float4 pos : SV_POSITION; + float2 tex : TEXCOORD0; + float4 color : COLOR0; +}; + +#define NVRS \ + "RootFlags ( ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT |" \ + " DENY_DOMAIN_SHADER_ROOT_ACCESS |" \ + " DENY_GEOMETRY_SHADER_ROOT_ACCESS |" \ + " DENY_HULL_SHADER_ROOT_ACCESS )," \ + "RootConstants(num32BitConstants=32, b0),"\ + "DescriptorTable ( SRV(t0), visibility = SHADER_VISIBILITY_PIXEL ),"\ + "DescriptorTable ( SRV(t1), visibility = SHADER_VISIBILITY_PIXEL ),"\ + "DescriptorTable ( Sampler(s0), visibility = SHADER_VISIBILITY_PIXEL )" + +[RootSignature(NVRS)] +float4 main(PixelShaderInput input) : SV_TARGET +{ + const float3 offset = {-0.0627451017, -0.501960814, -0.501960814}; + const float3 Rcoeff = {1.1644, 0.0000, 1.7927}; + const float3 Gcoeff = {1.1644, -0.2132, -0.5329}; + const float3 Bcoeff = {1.1644, 2.1124, 0.0000}; + + float4 Output; + + float3 yuv; + yuv.x = theTextureY.Sample(theSampler, input.tex).r; + yuv.yz = theTextureUV.Sample(theSampler, input.tex).rg; + + yuv += offset; + Output.r = dot(yuv, Rcoeff); + Output.g = dot(yuv, Gcoeff); + Output.b = dot(yuv, Bcoeff); + Output.a = 1.0f; + + return Output * input.color; +} \ No newline at end of file diff --git a/thirdparty/SDL/VisualC-GDK/shaders/D3D12_PixelShader_NV12_JPEG.hlsl b/thirdparty/SDL/VisualC-GDK/shaders/D3D12_PixelShader_NV12_JPEG.hlsl new file mode 100644 index 000000000..494bce519 --- /dev/null +++ b/thirdparty/SDL/VisualC-GDK/shaders/D3D12_PixelShader_NV12_JPEG.hlsl @@ -0,0 +1,43 @@ +Texture2D theTextureY : register(t0); +Texture2D theTextureUV : register(t1); +SamplerState theSampler : register(s0); + +struct PixelShaderInput +{ + float4 pos : SV_POSITION; + float2 tex : TEXCOORD0; + float4 color : COLOR0; +}; + +#define NVRS \ + "RootFlags ( ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT |" \ + " DENY_DOMAIN_SHADER_ROOT_ACCESS |" \ + " DENY_GEOMETRY_SHADER_ROOT_ACCESS |" \ + " DENY_HULL_SHADER_ROOT_ACCESS )," \ + "RootConstants(num32BitConstants=32, b0),"\ + "DescriptorTable ( SRV(t0), visibility = SHADER_VISIBILITY_PIXEL ),"\ + "DescriptorTable ( SRV(t1), visibility = SHADER_VISIBILITY_PIXEL ),"\ + "DescriptorTable ( Sampler(s0), visibility = SHADER_VISIBILITY_PIXEL )" + +[RootSignature(NVRS)] +float4 main(PixelShaderInput input) : SV_TARGET +{ + const float3 offset = {0.0, -0.501960814, -0.501960814}; + const float3 Rcoeff = {1.0000, 0.0000, 1.4020}; + const float3 Gcoeff = {1.0000, -0.3441, -0.7141}; + const float3 Bcoeff = {1.0000, 1.7720, 0.0000}; + + float4 Output; + + float3 yuv; + yuv.x = theTextureY.Sample(theSampler, input.tex).r; + yuv.yz = theTextureUV.Sample(theSampler, input.tex).rg; + + yuv += offset; + Output.r = dot(yuv, Rcoeff); + Output.g = dot(yuv, Gcoeff); + Output.b = dot(yuv, Bcoeff); + Output.a = 1.0f; + + return Output * input.color; +} \ No newline at end of file diff --git a/thirdparty/SDL/VisualC-GDK/shaders/D3D12_PixelShader_NV21_BT601.hlsl b/thirdparty/SDL/VisualC-GDK/shaders/D3D12_PixelShader_NV21_BT601.hlsl new file mode 100644 index 000000000..794c76372 --- /dev/null +++ b/thirdparty/SDL/VisualC-GDK/shaders/D3D12_PixelShader_NV21_BT601.hlsl @@ -0,0 +1,43 @@ +Texture2D theTextureY : register(t0); +Texture2D theTextureUV : register(t1); +SamplerState theSampler : register(s0); + +struct PixelShaderInput +{ + float4 pos : SV_POSITION; + float2 tex : TEXCOORD0; + float4 color : COLOR0; +}; + +#define NVRS \ + "RootFlags ( ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT |" \ + " DENY_DOMAIN_SHADER_ROOT_ACCESS |" \ + " DENY_GEOMETRY_SHADER_ROOT_ACCESS |" \ + " DENY_HULL_SHADER_ROOT_ACCESS )," \ + "RootConstants(num32BitConstants=32, b0),"\ + "DescriptorTable ( SRV(t0), visibility = SHADER_VISIBILITY_PIXEL ),"\ + "DescriptorTable ( SRV(t1), visibility = SHADER_VISIBILITY_PIXEL ),"\ + "DescriptorTable ( Sampler(s0), visibility = SHADER_VISIBILITY_PIXEL )" + +[RootSignature(NVRS)] +float4 main(PixelShaderInput input) : SV_TARGET +{ + const float3 offset = {-0.0627451017, -0.501960814, -0.501960814}; + const float3 Rcoeff = {1.1644, 0.0000, 1.5960}; + const float3 Gcoeff = {1.1644, -0.3918, -0.8130}; + const float3 Bcoeff = {1.1644, 2.0172, 0.0000}; + + float4 Output; + + float3 yuv; + yuv.x = theTextureY.Sample(theSampler, input.tex).r; + yuv.yz = theTextureUV.Sample(theSampler, input.tex).gr; + + yuv += offset; + Output.r = dot(yuv, Rcoeff); + Output.g = dot(yuv, Gcoeff); + Output.b = dot(yuv, Bcoeff); + Output.a = 1.0f; + + return Output * input.color; +} \ No newline at end of file diff --git a/thirdparty/SDL/VisualC-GDK/shaders/D3D12_PixelShader_NV21_BT709.hlsl b/thirdparty/SDL/VisualC-GDK/shaders/D3D12_PixelShader_NV21_BT709.hlsl new file mode 100644 index 000000000..f5b9522c0 --- /dev/null +++ b/thirdparty/SDL/VisualC-GDK/shaders/D3D12_PixelShader_NV21_BT709.hlsl @@ -0,0 +1,43 @@ +Texture2D theTextureY : register(t0); +Texture2D theTextureUV : register(t1); +SamplerState theSampler : register(s0); + +struct PixelShaderInput +{ + float4 pos : SV_POSITION; + float2 tex : TEXCOORD0; + float4 color : COLOR0; +}; + +#define NVRS \ + "RootFlags ( ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT |" \ + " DENY_DOMAIN_SHADER_ROOT_ACCESS |" \ + " DENY_GEOMETRY_SHADER_ROOT_ACCESS |" \ + " DENY_HULL_SHADER_ROOT_ACCESS )," \ + "RootConstants(num32BitConstants=32, b0),"\ + "DescriptorTable ( SRV(t0), visibility = SHADER_VISIBILITY_PIXEL ),"\ + "DescriptorTable ( SRV(t1), visibility = SHADER_VISIBILITY_PIXEL ),"\ + "DescriptorTable ( Sampler(s0), visibility = SHADER_VISIBILITY_PIXEL )" + +[RootSignature(NVRS)] +float4 main(PixelShaderInput input) : SV_TARGET +{ + const float3 offset = {-0.0627451017, -0.501960814, -0.501960814}; + const float3 Rcoeff = {1.1644, 0.0000, 1.7927}; + const float3 Gcoeff = {1.1644, -0.2132, -0.5329}; + const float3 Bcoeff = {1.1644, 2.1124, 0.0000}; + + float4 Output; + + float3 yuv; + yuv.x = theTextureY.Sample(theSampler, input.tex).r; + yuv.yz = theTextureUV.Sample(theSampler, input.tex).gr; + + yuv += offset; + Output.r = dot(yuv, Rcoeff); + Output.g = dot(yuv, Gcoeff); + Output.b = dot(yuv, Bcoeff); + Output.a = 1.0f; + + return Output * input.color; +} \ No newline at end of file diff --git a/thirdparty/SDL/VisualC-GDK/shaders/D3D12_PixelShader_NV21_JPEG.hlsl b/thirdparty/SDL/VisualC-GDK/shaders/D3D12_PixelShader_NV21_JPEG.hlsl new file mode 100644 index 000000000..1b467b480 --- /dev/null +++ b/thirdparty/SDL/VisualC-GDK/shaders/D3D12_PixelShader_NV21_JPEG.hlsl @@ -0,0 +1,43 @@ +Texture2D theTextureY : register(t0); +Texture2D theTextureUV : register(t1); +SamplerState theSampler : register(s0); + +struct PixelShaderInput +{ + float4 pos : SV_POSITION; + float2 tex : TEXCOORD0; + float4 color : COLOR0; +}; + +#define NVRS \ + "RootFlags ( ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT |" \ + " DENY_DOMAIN_SHADER_ROOT_ACCESS |" \ + " DENY_GEOMETRY_SHADER_ROOT_ACCESS |" \ + " DENY_HULL_SHADER_ROOT_ACCESS )," \ + "RootConstants(num32BitConstants=32, b0),"\ + "DescriptorTable ( SRV(t0), visibility = SHADER_VISIBILITY_PIXEL ),"\ + "DescriptorTable ( SRV(t1), visibility = SHADER_VISIBILITY_PIXEL ),"\ + "DescriptorTable ( Sampler(s0), visibility = SHADER_VISIBILITY_PIXEL )" + +[RootSignature(NVRS)] +float4 main(PixelShaderInput input) : SV_TARGET +{ + const float3 offset = {0.0, -0.501960814, -0.501960814}; + const float3 Rcoeff = {1.0000, 0.0000, 1.4020}; + const float3 Gcoeff = {1.0000, -0.3441, -0.7141}; + const float3 Bcoeff = {1.0000, 1.7720, 0.0000}; + + float4 Output; + + float3 yuv; + yuv.x = theTextureY.Sample(theSampler, input.tex).r; + yuv.yz = theTextureUV.Sample(theSampler, input.tex).gr; + + yuv += offset; + Output.r = dot(yuv, Rcoeff); + Output.g = dot(yuv, Gcoeff); + Output.b = dot(yuv, Bcoeff); + Output.a = 1.0f; + + return Output * input.color; +} \ No newline at end of file diff --git a/thirdparty/SDL/VisualC-GDK/shaders/D3D12_PixelShader_Textures.hlsl b/thirdparty/SDL/VisualC-GDK/shaders/D3D12_PixelShader_Textures.hlsl new file mode 100644 index 000000000..0dcdf89c6 --- /dev/null +++ b/thirdparty/SDL/VisualC-GDK/shaders/D3D12_PixelShader_Textures.hlsl @@ -0,0 +1,24 @@ +Texture2D theTexture : register(t0); +SamplerState theSampler : register(s0); + +struct PixelShaderInput +{ + float4 pos : SV_POSITION; + float2 tex : TEXCOORD0; + float4 color : COLOR0; +}; + +#define TextureRS \ + "RootFlags ( ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT |" \ + " DENY_DOMAIN_SHADER_ROOT_ACCESS |" \ + " DENY_GEOMETRY_SHADER_ROOT_ACCESS |" \ + " DENY_HULL_SHADER_ROOT_ACCESS )," \ + "RootConstants(num32BitConstants=32, b0),"\ + "DescriptorTable ( SRV(t0), visibility = SHADER_VISIBILITY_PIXEL ),"\ + "DescriptorTable ( Sampler(s0), visibility = SHADER_VISIBILITY_PIXEL )" + +[RootSignature(TextureRS)] +float4 main(PixelShaderInput input) : SV_TARGET +{ + return theTexture.Sample(theSampler, input.tex) * input.color; +} \ No newline at end of file diff --git a/thirdparty/SDL/VisualC-GDK/shaders/D3D12_PixelShader_YUV_BT601.hlsl b/thirdparty/SDL/VisualC-GDK/shaders/D3D12_PixelShader_YUV_BT601.hlsl new file mode 100644 index 000000000..09e58943a --- /dev/null +++ b/thirdparty/SDL/VisualC-GDK/shaders/D3D12_PixelShader_YUV_BT601.hlsl @@ -0,0 +1,46 @@ +Texture2D theTextureY : register(t0); +Texture2D theTextureU : register(t1); +Texture2D theTextureV : register(t2); +SamplerState theSampler : register(s0); + +struct PixelShaderInput +{ + float4 pos : SV_POSITION; + float2 tex : TEXCOORD0; + float4 color : COLOR0; +}; + +#define YUVRS \ + "RootFlags ( ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT |" \ + " DENY_DOMAIN_SHADER_ROOT_ACCESS |" \ + " DENY_GEOMETRY_SHADER_ROOT_ACCESS |" \ + " DENY_HULL_SHADER_ROOT_ACCESS )," \ + "RootConstants(num32BitConstants=32, b0),"\ + "DescriptorTable ( SRV(t0), visibility = SHADER_VISIBILITY_PIXEL ),"\ + "DescriptorTable ( SRV(t1), visibility = SHADER_VISIBILITY_PIXEL ),"\ + "DescriptorTable ( SRV(t2), visibility = SHADER_VISIBILITY_PIXEL ),"\ + "DescriptorTable ( Sampler(s0), visibility = SHADER_VISIBILITY_PIXEL )" + +[RootSignature(YUVRS)] +float4 main(PixelShaderInput input) : SV_TARGET +{ + const float3 offset = {-0.0627451017, -0.501960814, -0.501960814}; + const float3 Rcoeff = {1.1644, 0.0000, 1.5960}; + const float3 Gcoeff = {1.1644, -0.3918, -0.8130}; + const float3 Bcoeff = {1.1644, 2.0172, 0.0000}; + + float4 Output; + + float3 yuv; + yuv.x = theTextureY.Sample(theSampler, input.tex).r; + yuv.y = theTextureU.Sample(theSampler, input.tex).r; + yuv.z = theTextureV.Sample(theSampler, input.tex).r; + + yuv += offset; + Output.r = dot(yuv, Rcoeff); + Output.g = dot(yuv, Gcoeff); + Output.b = dot(yuv, Bcoeff); + Output.a = 1.0f; + + return Output * input.color; +} \ No newline at end of file diff --git a/thirdparty/SDL/VisualC-GDK/shaders/D3D12_PixelShader_YUV_BT709.hlsl b/thirdparty/SDL/VisualC-GDK/shaders/D3D12_PixelShader_YUV_BT709.hlsl new file mode 100644 index 000000000..f5aa0cd7e --- /dev/null +++ b/thirdparty/SDL/VisualC-GDK/shaders/D3D12_PixelShader_YUV_BT709.hlsl @@ -0,0 +1,46 @@ +Texture2D theTextureY : register(t0); +Texture2D theTextureU : register(t1); +Texture2D theTextureV : register(t2); +SamplerState theSampler : register(s0); + +struct PixelShaderInput +{ + float4 pos : SV_POSITION; + float2 tex : TEXCOORD0; + float4 color : COLOR0; +}; + +#define YUVRS \ + "RootFlags ( ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT |" \ + " DENY_DOMAIN_SHADER_ROOT_ACCESS |" \ + " DENY_GEOMETRY_SHADER_ROOT_ACCESS |" \ + " DENY_HULL_SHADER_ROOT_ACCESS )," \ + "RootConstants(num32BitConstants=32, b0),"\ + "DescriptorTable ( SRV(t0), visibility = SHADER_VISIBILITY_PIXEL ),"\ + "DescriptorTable ( SRV(t1), visibility = SHADER_VISIBILITY_PIXEL ),"\ + "DescriptorTable ( SRV(t2), visibility = SHADER_VISIBILITY_PIXEL ),"\ + "DescriptorTable ( Sampler(s0), visibility = SHADER_VISIBILITY_PIXEL )" + +[RootSignature(YUVRS)] +float4 main(PixelShaderInput input) : SV_TARGET +{ + const float3 offset = {-0.0627451017, -0.501960814, -0.501960814}; + const float3 Rcoeff = {1.1644, 0.0000, 1.7927}; + const float3 Gcoeff = {1.1644, -0.2132, -0.5329}; + const float3 Bcoeff = {1.1644, 2.1124, 0.0000}; + + float4 Output; + + float3 yuv; + yuv.x = theTextureY.Sample(theSampler, input.tex).r; + yuv.y = theTextureU.Sample(theSampler, input.tex).r; + yuv.z = theTextureV.Sample(theSampler, input.tex).r; + + yuv += offset; + Output.r = dot(yuv, Rcoeff); + Output.g = dot(yuv, Gcoeff); + Output.b = dot(yuv, Bcoeff); + Output.a = 1.0f; + + return Output * input.color; +} \ No newline at end of file diff --git a/thirdparty/SDL/VisualC-GDK/shaders/D3D12_PixelShader_YUV_JPEG.hlsl b/thirdparty/SDL/VisualC-GDK/shaders/D3D12_PixelShader_YUV_JPEG.hlsl new file mode 100644 index 000000000..84d09b8bf --- /dev/null +++ b/thirdparty/SDL/VisualC-GDK/shaders/D3D12_PixelShader_YUV_JPEG.hlsl @@ -0,0 +1,46 @@ +Texture2D theTextureY : register(t0); +Texture2D theTextureU : register(t1); +Texture2D theTextureV : register(t2); +SamplerState theSampler : register(s0); + +struct PixelShaderInput +{ + float4 pos : SV_POSITION; + float2 tex : TEXCOORD0; + float4 color : COLOR0; +}; + +#define YUVRS \ + "RootFlags ( ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT |" \ + " DENY_DOMAIN_SHADER_ROOT_ACCESS |" \ + " DENY_GEOMETRY_SHADER_ROOT_ACCESS |" \ + " DENY_HULL_SHADER_ROOT_ACCESS )," \ + "RootConstants(num32BitConstants=32, b0),"\ + "DescriptorTable ( SRV(t0), visibility = SHADER_VISIBILITY_PIXEL ),"\ + "DescriptorTable ( SRV(t1), visibility = SHADER_VISIBILITY_PIXEL ),"\ + "DescriptorTable ( SRV(t2), visibility = SHADER_VISIBILITY_PIXEL ),"\ + "DescriptorTable ( Sampler(s0), visibility = SHADER_VISIBILITY_PIXEL )" + +[RootSignature(YUVRS)] +float4 main(PixelShaderInput input) : SV_TARGET +{ + const float3 offset = {0.0, -0.501960814, -0.501960814}; + const float3 Rcoeff = {1.0000, 0.0000, 1.4020}; + const float3 Gcoeff = {1.0000, -0.3441, -0.7141}; + const float3 Bcoeff = {1.0000, 1.7720, 0.0000}; + + float4 Output; + + float3 yuv; + yuv.x = theTextureY.Sample(theSampler, input.tex).r; + yuv.y = theTextureU.Sample(theSampler, input.tex).r; + yuv.z = theTextureV.Sample(theSampler, input.tex).r; + + yuv += offset; + Output.r = dot(yuv, Rcoeff); + Output.g = dot(yuv, Gcoeff); + Output.b = dot(yuv, Bcoeff); + Output.a = 1.0f; + + return Output * input.color; +} \ No newline at end of file diff --git a/thirdparty/SDL/VisualC-GDK/shaders/D3D12_VertexShader.hlsl b/thirdparty/SDL/VisualC-GDK/shaders/D3D12_VertexShader.hlsl new file mode 100644 index 000000000..e10b48892 --- /dev/null +++ b/thirdparty/SDL/VisualC-GDK/shaders/D3D12_VertexShader.hlsl @@ -0,0 +1,95 @@ +#pragma pack_matrix( row_major ) + +struct VertexShaderConstants +{ + matrix model; + matrix projectionAndView; +}; +ConstantBuffer Constants : register(b0); + +struct VertexShaderInput +{ + float3 pos : POSITION; + float2 tex : TEXCOORD0; + float4 color : COLOR0; +}; + +struct VertexShaderOutput +{ + float4 pos : SV_POSITION; + float2 tex : TEXCOORD0; + float4 color : COLOR0; +}; + +#define ColorRS \ + "RootFlags ( ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT |" \ + "DENY_DOMAIN_SHADER_ROOT_ACCESS |" \ + "DENY_GEOMETRY_SHADER_ROOT_ACCESS |" \ + "DENY_HULL_SHADER_ROOT_ACCESS )," \ + "RootConstants(num32BitConstants=32, b0)" + +#define TextureRS \ + "RootFlags ( ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT |" \ + " DENY_DOMAIN_SHADER_ROOT_ACCESS |" \ + " DENY_GEOMETRY_SHADER_ROOT_ACCESS |" \ + " DENY_HULL_SHADER_ROOT_ACCESS )," \ + "RootConstants(num32BitConstants=32, b0),"\ + "DescriptorTable ( SRV(t0), visibility = SHADER_VISIBILITY_PIXEL ),"\ + "DescriptorTable ( Sampler(s0), visibility = SHADER_VISIBILITY_PIXEL )" + +#define YUVRS \ + "RootFlags ( ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT |" \ + " DENY_DOMAIN_SHADER_ROOT_ACCESS |" \ + " DENY_GEOMETRY_SHADER_ROOT_ACCESS |" \ + " DENY_HULL_SHADER_ROOT_ACCESS )," \ + "RootConstants(num32BitConstants=32, b0),"\ + "DescriptorTable ( SRV(t0), visibility = SHADER_VISIBILITY_PIXEL ),"\ + "DescriptorTable ( SRV(t1), visibility = SHADER_VISIBILITY_PIXEL ),"\ + "DescriptorTable ( SRV(t2), visibility = SHADER_VISIBILITY_PIXEL ),"\ + "DescriptorTable ( Sampler(s0), visibility = SHADER_VISIBILITY_PIXEL )" + +#define NVRS \ + "RootFlags ( ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT |" \ + " DENY_DOMAIN_SHADER_ROOT_ACCESS |" \ + " DENY_GEOMETRY_SHADER_ROOT_ACCESS |" \ + " DENY_HULL_SHADER_ROOT_ACCESS )," \ + "RootConstants(num32BitConstants=32, b0),"\ + "DescriptorTable ( SRV(t0), visibility = SHADER_VISIBILITY_PIXEL ),"\ + "DescriptorTable ( SRV(t1), visibility = SHADER_VISIBILITY_PIXEL ),"\ + "DescriptorTable ( Sampler(s0), visibility = SHADER_VISIBILITY_PIXEL )" + +[RootSignature(ColorRS)] +VertexShaderOutput mainColor(VertexShaderInput input) +{ + VertexShaderOutput output; + float4 pos = float4(input.pos, 1.0f); + + // Transform the vertex position into projected space. + pos = mul(pos, Constants.model); + pos = mul(pos, Constants.projectionAndView); + output.pos = pos; + + // Pass through texture coordinates and color values without transformation + output.tex = input.tex; + output.color = input.color; + + return output; +} + +[RootSignature(TextureRS)] +VertexShaderOutput mainTexture(VertexShaderInput input) +{ + return mainColor(input); +} + +[RootSignature(YUVRS)] +VertexShaderOutput mainYUV(VertexShaderInput input) +{ + return mainColor(input); +} + +[RootSignature(NVRS)] +VertexShaderOutput mainNV(VertexShaderInput input) +{ + return mainColor(input); +} \ No newline at end of file diff --git a/thirdparty/SDL/VisualC-GDK/shaders/buildshaders.bat b/thirdparty/SDL/VisualC-GDK/shaders/buildshaders.bat new file mode 100644 index 000000000..4447b5e2f --- /dev/null +++ b/thirdparty/SDL/VisualC-GDK/shaders/buildshaders.bat @@ -0,0 +1,35 @@ +if %2.==one. goto setxboxone +rem Xbox Series compile +set XBOXDXC="%GameDKLatest%\GXDK\bin\Scarlett\DXC.exe" +set SUFFIX=_Series.h +goto startbuild + +:setxboxone +set XBOXDXC="%GameDKLatest%\GXDK\bin\XboxOne\DXC.exe" +set SUFFIX=_One.h + +:startbuild +echo Building with %XBOXDXC% +cd "%1\shaders" +rem Root Signatures +%XBOXDXC% -E ColorRS -T rootsig_1_1 -rootsig-define ColorRS -Fh D3D12_RootSig_Color%SUFFIX% -Vn D3D12_RootSig_Color D3D12_VertexShader.hlsl +%XBOXDXC% -E TextureRS -T rootsig_1_1 -rootsig-define TextureRS -Fh D3D12_RootSig_Texture%SUFFIX% -Vn D3D12_RootSig_Texture D3D12_VertexShader.hlsl +%XBOXDXC% -E YUVRS -T rootsig_1_1 -rootsig-define YUVRS -Fh D3D12_RootSig_YUV%SUFFIX% -Vn D3D12_RootSig_YUV D3D12_VertexShader.hlsl +%XBOXDXC% -E NVRS -T rootsig_1_1 -rootsig-define NVRS -Fh D3D12_RootSig_NV%SUFFIX% -Vn D3D12_RootSig_NV D3D12_VertexShader.hlsl +rem Vertex Shaders +%XBOXDXC% -E mainColor -T vs_6_0 -Fh D3D12_VertexShader_Color%SUFFIX% -Vn D3D12_VertexShader_Color D3D12_VertexShader.hlsl +%XBOXDXC% -E mainTexture -T vs_6_0 -Fh D3D12_VertexShader_Texture%SUFFIX% -Vn D3D12_VertexShader_Texture D3D12_VertexShader.hlsl +%XBOXDXC% -E mainNV -T vs_6_0 -Fh D3D12_VertexShader_NV%SUFFIX% -Vn D3D12_VertexShader_NV D3D12_VertexShader.hlsl +%XBOXDXC% -E mainYUV -T vs_6_0 -Fh D3D12_VertexShader_YUV%SUFFIX% -Vn D3D12_VertexShader_YUV D3D12_VertexShader.hlsl +rem Pixel Shaders +%XBOXDXC% -E main -T ps_6_0 -Fh D3D12_PixelShader_Colors%SUFFIX% -Vn D3D12_PixelShader_Colors D3D12_PixelShader_Colors.hlsl +%XBOXDXC% -E main -T ps_6_0 -Fh D3D12_PixelShader_NV12_BT601%SUFFIX% -Vn D3D12_PixelShader_NV12_BT601 D3D12_PixelShader_NV12_BT601.hlsl +%XBOXDXC% -E main -T ps_6_0 -Fh D3D12_PixelShader_NV12_BT709%SUFFIX% -Vn D3D12_PixelShader_NV12_BT709 D3D12_PixelShader_NV12_BT709.hlsl +%XBOXDXC% -E main -T ps_6_0 -Fh D3D12_PixelShader_NV12_JPEG%SUFFIX% -Vn D3D12_PixelShader_NV12_JPEG D3D12_PixelShader_NV12_JPEG.hlsl +%XBOXDXC% -E main -T ps_6_0 -Fh D3D12_PixelShader_NV21_BT601%SUFFIX% -Vn D3D12_PixelShader_NV21_BT601 D3D12_PixelShader_NV21_BT601.hlsl +%XBOXDXC% -E main -T ps_6_0 -Fh D3D12_PixelShader_NV21_BT709%SUFFIX% -Vn D3D12_PixelShader_NV21_BT709 D3D12_PixelShader_NV21_BT709.hlsl +%XBOXDXC% -E main -T ps_6_0 -Fh D3D12_PixelShader_NV21_JPEG%SUFFIX% -Vn D3D12_PixelShader_NV21_JPEG D3D12_PixelShader_NV21_JPEG.hlsl +%XBOXDXC% -E main -T ps_6_0 -Fh D3D12_PixelShader_Textures%SUFFIX% -Vn D3D12_PixelShader_Textures D3D12_PixelShader_Textures.hlsl +%XBOXDXC% -E main -T ps_6_0 -Fh D3D12_PixelShader_YUV_BT601%SUFFIX% -Vn D3D12_PixelShader_YUV_BT601 D3D12_PixelShader_YUV_BT601.hlsl +%XBOXDXC% -E main -T ps_6_0 -Fh D3D12_PixelShader_YUV_BT709%SUFFIX% -Vn D3D12_PixelShader_YUV_BT709 D3D12_PixelShader_YUV_BT709.hlsl +%XBOXDXC% -E main -T ps_6_0 -Fh D3D12_PixelShader_YUV_JPEG%SUFFIX% -Vn D3D12_PixelShader_YUV_JPEG D3D12_PixelShader_YUV_JPEG.hlsl \ No newline at end of file diff --git a/thirdparty/SDL/VisualC-GDK/tests/testgamecontroller/testgamecontroller.vcxproj b/thirdparty/SDL/VisualC-GDK/tests/testgamecontroller/testgamecontroller.vcxproj index ca6473c8c..473293478 100644 --- a/thirdparty/SDL/VisualC-GDK/tests/testgamecontroller/testgamecontroller.vcxproj +++ b/thirdparty/SDL/VisualC-GDK/tests/testgamecontroller/testgamecontroller.vcxproj @@ -139,7 +139,7 @@ Windows - xgameruntime.lib;../Microsoft.Xbox.Services.141.GDK.C.Thunks.lib;%(AdditionalDependencies) + xgameruntime.lib;../Microsoft.Xbox.Services.GDK.C.Thunks.lib;%(AdditionalDependencies) @@ -211,7 +211,7 @@ true Windows - xgameruntime.lib;../Microsoft.Xbox.Services.141.GDK.C.Thunks.lib;%(AdditionalDependencies) + xgameruntime.lib;../Microsoft.Xbox.Services.GDK.C.Thunks.lib;%(AdditionalDependencies) @@ -409,7 +409,7 @@ - + Document true true diff --git a/thirdparty/SDL/VisualC-GDK/tests/testgdk/src/testgdk.cpp b/thirdparty/SDL/VisualC-GDK/tests/testgdk/src/testgdk.cpp index 6aea4cc3e..668baea2c 100644 --- a/thirdparty/SDL/VisualC-GDK/tests/testgdk/src/testgdk.cpp +++ b/thirdparty/SDL/VisualC-GDK/tests/testgdk/src/testgdk.cpp @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -383,7 +383,7 @@ main(int argc, char *argv[]) /* Initialize test framework */ state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO | SDL_INIT_AUDIO); - if (state == NULL) { + if (!state) { return 1; } @@ -446,7 +446,7 @@ main(int argc, char *argv[]) /* Create the windows, initialize the renderers, and load the textures */ sprites = (SDL_Texture **) SDL_malloc(state->num_windows * sizeof(*sprites)); - if (sprites == NULL) { + if (!sprites) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory!\n"); quit(2); } @@ -461,7 +461,7 @@ main(int argc, char *argv[]) soundname = GetResourceFilename(argc > 1 ? argv[1] : NULL, "sample.wav"); - if (soundname == NULL) { + if (!soundname) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "%s\n", SDL_GetError()); quit(1); } diff --git a/thirdparty/SDL/VisualC-WinRT/SDL-UWP.vcxproj b/thirdparty/SDL/VisualC-WinRT/SDL-UWP.vcxproj index 9d7c01351..696505f35 100644 --- a/thirdparty/SDL/VisualC-WinRT/SDL-UWP.vcxproj +++ b/thirdparty/SDL/VisualC-WinRT/SDL-UWP.vcxproj @@ -125,6 +125,7 @@ + @@ -184,6 +185,14 @@ + + + + + + + + @@ -237,6 +246,7 @@ + @@ -344,7 +354,9 @@ true - + + + {89e9b32e-a86a-47c3-a948-d2b1622925ce} diff --git a/thirdparty/SDL/VisualC-WinRT/SDL-UWP.vcxproj.filters b/thirdparty/SDL/VisualC-WinRT/SDL-UWP.vcxproj.filters index 6599cdabb..0045d5476 100644 --- a/thirdparty/SDL/VisualC-WinRT/SDL-UWP.vcxproj.filters +++ b/thirdparty/SDL/VisualC-WinRT/SDL-UWP.vcxproj.filters @@ -255,6 +255,9 @@ Source Files + + Source Files + Source Files @@ -558,6 +561,9 @@ Source Files + + Source Files + Source Files @@ -846,4 +852,4 @@ Source Files - \ No newline at end of file + diff --git a/thirdparty/SDL/VisualC/SDL/SDL.vcxproj b/thirdparty/SDL/VisualC/SDL/SDL.vcxproj index 957dabe1b..a798514a1 100644 --- a/thirdparty/SDL/VisualC/SDL/SDL.vcxproj +++ b/thirdparty/SDL/VisualC/SDL/SDL.vcxproj @@ -336,6 +336,7 @@ + @@ -393,7 +394,6 @@ - @@ -438,7 +438,13 @@ + + + + + + @@ -493,6 +499,7 @@ + @@ -500,6 +507,7 @@ + @@ -621,7 +629,9 @@ - + + + diff --git a/thirdparty/SDL/VisualC/SDL/SDL.vcxproj.filters b/thirdparty/SDL/VisualC/SDL/SDL.vcxproj.filters index 082e257b4..60899f55c 100644 --- a/thirdparty/SDL/VisualC/SDL/SDL.vcxproj.filters +++ b/thirdparty/SDL/VisualC/SDL/SDL.vcxproj.filters @@ -501,6 +501,9 @@ joystick + + joystick + joystick @@ -777,9 +780,6 @@ video\khronos\vulkan - - video\khronos\vulkan - video\khronos\vulkan @@ -934,6 +934,9 @@ joystick + + joystick + libm @@ -1072,6 +1075,9 @@ joystick\hidapi + + joystick\hidapi + joystick\hidapi diff --git a/thirdparty/SDL/VisualC/tests/testautomation/testautomation.vcxproj b/thirdparty/SDL/VisualC/tests/testautomation/testautomation.vcxproj index d58dc0b32..b781dcac9 100644 --- a/thirdparty/SDL/VisualC/tests/testautomation/testautomation.vcxproj +++ b/thirdparty/SDL/VisualC/tests/testautomation/testautomation.vcxproj @@ -210,6 +210,7 @@ + @@ -224,6 +225,7 @@ + @@ -231,4 +233,4 @@ - + \ No newline at end of file diff --git a/thirdparty/SDL/WhatsNew.txt b/thirdparty/SDL/WhatsNew.txt index 1d7c27e20..90d94243d 100644 --- a/thirdparty/SDL/WhatsNew.txt +++ b/thirdparty/SDL/WhatsNew.txt @@ -1,9 +1,28 @@ This is a list of major changes in SDL's version history. +--------------------------------------------------------------------------- +2.30.0: +--------------------------------------------------------------------------- + +General: +* Added support for 2 bits-per-pixel indexed surface formats +* Added the function SDL_GameControllerGetSteamHandle() to get the Steam API handle for a controller, if available +* Added the event SDL_CONTROLLERSTEAMHANDLEUPDATED which is sent when the Steam API handle for a controller changes. This could also change the name, VID, and PID of the controller. +* Added the environment variable SDL_LOGGING to control default log output + +macOS: +* Added the hint SDL_HINT_JOYSTICK_IOKIT to control whether the IOKit controller driver should be used +* Added the hint SDL_HINT_JOYSTICK_MFI to control whether the GCController controller driver should be used +* Added the hint SDL_HINT_RENDER_METAL_PREFER_LOW_POWER_DEVICE to choose whether high or low power GPU should be used for rendering, in the case where there are multiple GPUs available + +Xbox: +* Added the function SDL_GDKGetDefaultUser() + --------------------------------------------------------------------------- 2.28.2: --------------------------------------------------------------------------- + General: * Added the hint SDL_HINT_JOYSTICK_WGI to control whether to use Windows.Gaming.Input for controllers diff --git a/thirdparty/SDL/Xcode-iOS/Demos/src/accelerometer.c b/thirdparty/SDL/Xcode-iOS/Demos/src/accelerometer.c index 3ce812513..4c166a621 100644 --- a/thirdparty/SDL/Xcode-iOS/Demos/src/accelerometer.c +++ b/thirdparty/SDL/Xcode-iOS/Demos/src/accelerometer.c @@ -118,7 +118,7 @@ initializeTextures(SDL_Renderer *renderer) /* load the ship */ bmp_surface = SDL_LoadBMP("ship.bmp"); - if (bmp_surface == NULL) { + if (!bmp_surface) { fatalError("could not ship.bmp"); } /* set blue to transparent on the ship */ @@ -127,7 +127,7 @@ initializeTextures(SDL_Renderer *renderer) /* create ship texture from surface */ ship = SDL_CreateTextureFromSurface(renderer, bmp_surface); - if (ship == NULL) { + if (!ship) { fatalError("could not create ship texture"); } SDL_SetTextureBlendMode(ship, SDL_BLENDMODE_BLEND); @@ -140,12 +140,12 @@ initializeTextures(SDL_Renderer *renderer) /* load the space background */ bmp_surface = SDL_LoadBMP("space.bmp"); - if (bmp_surface == NULL) { + if (!bmp_surface) { fatalError("could not load space.bmp"); } /* create space texture from surface */ space = SDL_CreateTextureFromSurface(renderer, bmp_surface); - if (space == NULL) { + if (!space) { fatalError("could not create space texture"); } SDL_FreeSurface(bmp_surface); @@ -179,7 +179,7 @@ main(int argc, char *argv[]) printf("There are %d joysticks available\n", SDL_NumJoysticks()); printf("Default joystick (index 0) is %s\n", SDL_JoystickName(0)); accelerometer = SDL_JoystickOpen(0); - if (accelerometer == NULL) { + if (!accelerometer) { fatalError("Could not open joystick (accelerometer)"); } printf("joystick number of axis = %d\n", diff --git a/thirdparty/SDL/Xcode-iOS/Demos/src/fireworks.c b/thirdparty/SDL/Xcode-iOS/Demos/src/fireworks.c index eb3bb4cde..55762bd08 100644 --- a/thirdparty/SDL/Xcode-iOS/Demos/src/fireworks.c +++ b/thirdparty/SDL/Xcode-iOS/Demos/src/fireworks.c @@ -52,9 +52,9 @@ void spawnTrailFromEmitter(struct particle *emitter); void spawnEmitterParticle(GLfloat x, GLfloat y); void explodeEmitter(struct particle *emitter); void initializeParticles(void); -void initializeTexture(); +void initializeTexture(void); int nextPowerOfTwo(int x); -void drawParticles(); +void drawParticles(void); void stepParticles(double deltaTime); /* helper function (used in texture loading) @@ -159,7 +159,7 @@ stepParticles(double deltaTime) This draws all the particles shown on screen */ void -drawParticles() +drawParticles(void) { /* draw the background */ @@ -324,7 +324,7 @@ initializeParticles(void) loads the particle texture */ void -initializeTexture() +initializeTexture(void) { int bpp; /* texture bits per pixel */ @@ -334,7 +334,7 @@ initializeTexture() to format passed into OpenGL */ bmp_surface = SDL_LoadBMP("stroke.bmp"); - if (bmp_surface == NULL) { + if (!bmp_surface) { fatalError("could not load stroke.bmp"); } diff --git a/thirdparty/SDL/Xcode-iOS/Demos/src/happy.c b/thirdparty/SDL/Xcode-iOS/Demos/src/happy.c index 42562007e..163d3463f 100644 --- a/thirdparty/SDL/Xcode-iOS/Demos/src/happy.c +++ b/thirdparty/SDL/Xcode-iOS/Demos/src/happy.c @@ -108,7 +108,7 @@ initializeTexture(SDL_Renderer *renderer) SDL_Surface *bmp_surface; /* load the bmp */ bmp_surface = SDL_LoadBMP("icon.bmp"); - if (bmp_surface == NULL) { + if (!bmp_surface) { fatalError("could not load bmp"); } /* set white to transparent on the happyface */ @@ -117,7 +117,7 @@ initializeTexture(SDL_Renderer *renderer) /* convert RGBA surface to texture */ texture = SDL_CreateTextureFromSurface(renderer, bmp_surface); - if (texture == NULL) { + if (!texture) { fatalError("could not create texture"); } SDL_SetTextureBlendMode(texture, SDL_BLENDMODE_BLEND); diff --git a/thirdparty/SDL/Xcode-iOS/Demos/src/keyboard.c b/thirdparty/SDL/Xcode-iOS/Demos/src/keyboard.c index 6ab1db213..3e1bedf5b 100644 --- a/thirdparty/SDL/Xcode-iOS/Demos/src/keyboard.c +++ b/thirdparty/SDL/Xcode-iOS/Demos/src/keyboard.c @@ -165,7 +165,7 @@ loadFont(void) { SDL_Surface *surface = SDL_LoadBMP("kromasky_16x16.bmp"); - if (surface == NULL) { + if (!surface) { printf("Error loading bitmap: %s\n", SDL_GetError()); return 0; } else { @@ -183,7 +183,7 @@ loadFont(void) SDL_BlitSurface(surface, NULL, converted, NULL); /* create our texture */ texture = SDL_CreateTextureFromSurface(renderer, converted); - if (texture == NULL) { + if (!texture) { printf("texture creation failed: %s\n", SDL_GetError()); } else { /* set blend mode for our texture */ @@ -196,7 +196,7 @@ loadFont(void) } void -draw() +draw(void) { SDL_SetRenderDrawColor(renderer, bg_color.r, bg_color.g, bg_color.b, bg_color.a); SDL_RenderClear(renderer); diff --git a/thirdparty/SDL/Xcode-iOS/Demos/src/rectangles.c b/thirdparty/SDL/Xcode-iOS/Demos/src/rectangles.c index 9102cf279..a08f99790 100644 --- a/thirdparty/SDL/Xcode-iOS/Demos/src/rectangles.c +++ b/thirdparty/SDL/Xcode-iOS/Demos/src/rectangles.c @@ -58,11 +58,11 @@ main(int argc, char *argv[]) /* create window and renderer */ window = SDL_CreateWindow(NULL, 0, 0, 320, 480, SDL_WINDOW_ALLOW_HIGHDPI); - if (window == NULL) { + if (!window) { fatalError("Could not initialize Window"); } renderer = SDL_CreateRenderer(window, -1, 0); - if (renderer == NULL) { + if (!renderer) { fatalError("Could not create renderer"); } diff --git a/thirdparty/SDL/Xcode-iOS/Demos/src/touch.c b/thirdparty/SDL/Xcode-iOS/Demos/src/touch.c index 22a251be1..4b7ff9548 100644 --- a/thirdparty/SDL/Xcode-iOS/Demos/src/touch.c +++ b/thirdparty/SDL/Xcode-iOS/Demos/src/touch.c @@ -57,13 +57,13 @@ initializeTexture(SDL_Renderer *renderer) { SDL_Surface *bmp_surface; bmp_surface = SDL_LoadBMP("stroke.bmp"); - if (bmp_surface == NULL) { + if (!bmp_surface) { fatalError("could not load stroke.bmp"); } brush = SDL_CreateTextureFromSurface(renderer, bmp_surface); SDL_FreeSurface(bmp_surface); - if (brush == NULL) { + if (!brush) { fatalError("could not create brush texture"); } /* additive blending -- laying strokes on top of eachother makes them brighter */ diff --git a/thirdparty/SDL/Xcode/SDL/Info-Framework.plist b/thirdparty/SDL/Xcode/SDL/Info-Framework.plist index a0ddc4ef2..342da0ec7 100644 --- a/thirdparty/SDL/Xcode/SDL/Info-Framework.plist +++ b/thirdparty/SDL/Xcode/SDL/Info-Framework.plist @@ -19,10 +19,10 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 2.28.5 + 2.30.7 CFBundleSignature SDLX CFBundleVersion - 2.28.5 + 2.30.7 diff --git a/thirdparty/SDL/Xcode/SDL/SDL.xcodeproj/project.pbxproj b/thirdparty/SDL/Xcode/SDL/SDL.xcodeproj/project.pbxproj index 816ef9784..217add597 100644 --- a/thirdparty/SDL/Xcode/SDL/SDL.xcodeproj/project.pbxproj +++ b/thirdparty/SDL/Xcode/SDL/SDL.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 52; + objectVersion = 54; objects = { /* Begin PBXBuildFile section */ @@ -160,7 +160,6 @@ A75FCD1023E25AB700529352 /* SDL_uikitview.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A61923E2513D00DCD162 /* SDL_uikitview.h */; }; A75FCD1123E25AB700529352 /* SDL_bits.h in Headers */ = {isa = PBXBuildFile; fileRef = AADA5B8616CCAB3000107CF7 /* SDL_bits.h */; settings = {ATTRIBUTES = (Public, ); }; }; A75FCD1223E25AB700529352 /* SDL_uikitappdelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A62F23E2513D00DCD162 /* SDL_uikitappdelegate.h */; }; - A75FCD1323E25AB700529352 /* keyinfotable.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A62823E2513D00DCD162 /* keyinfotable.h */; }; A75FCD1423E25AB700529352 /* SDL_blendmode.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557CC1595D4D800BBD41B /* SDL_blendmode.h */; settings = {ATTRIBUTES = (Public, ); }; }; A75FCD1523E25AB700529352 /* SDL_dropevents_c.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A92E23E2514000DCD162 /* SDL_dropevents_c.h */; }; A75FCD1623E25AB700529352 /* SDL_haptic_c.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A5C623E2513D00DCD162 /* SDL_haptic_c.h */; }; @@ -207,7 +206,6 @@ A75FCD4823E25AB700529352 /* SDL_keycode.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557DB1595D4D800BBD41B /* SDL_keycode.h */; settings = {ATTRIBUTES = (Public, ); }; }; A75FCD4A23E25AB700529352 /* SDL_cocoakeyboard.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A68023E2513E00DCD162 /* SDL_cocoakeyboard.h */; }; A75FCD4B23E25AB700529352 /* SDL_uikitvulkan.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A63323E2513D00DCD162 /* SDL_uikitvulkan.h */; }; - A75FCD4E23E25AB700529352 /* vulkan.hpp in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A73223E2513E00DCD162 /* vulkan.hpp */; }; A75FCD4F23E25AB700529352 /* SDL_loadso.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557DC1595D4D800BBD41B /* SDL_loadso.h */; settings = {ATTRIBUTES = (Public, ); }; }; A75FCD5023E25AB700529352 /* gl2ext.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A72323E2513E00DCD162 /* gl2ext.h */; }; A75FCD5123E25AB700529352 /* SDL_clipboardevents_c.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A93923E2514000DCD162 /* SDL_clipboardevents_c.h */; }; @@ -283,7 +281,6 @@ A75FCDA123E25AB700529352 /* vulkan_xlib.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A73A23E2513E00DCD162 /* vulkan_xlib.h */; }; A75FCDA223E25AB700529352 /* SDL_uikitwindow.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A62723E2513D00DCD162 /* SDL_uikitwindow.h */; }; A75FCDA323E25AB700529352 /* vulkan_vi.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A72F23E2513E00DCD162 /* vulkan_vi.h */; }; - A75FCDA423E25AB700529352 /* vulkan_mir.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A73923E2513E00DCD162 /* vulkan_mir.h */; }; A75FCDA523E25AB700529352 /* SDL_quit.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557E81595D4D800BBD41B /* SDL_quit.h */; settings = {ATTRIBUTES = (Public, ); }; }; A75FCDA623E25AB700529352 /* default_cursor.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A93323E2514000DCD162 /* default_cursor.h */; }; A75FCDA723E25AB700529352 /* SDL_render_sw_c.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A8F523E2514000DCD162 /* SDL_render_sw_c.h */; }; @@ -371,7 +368,6 @@ A75FCE0223E25AB700529352 /* SDL_log.c in Sources */ = {isa = PBXBuildFile; fileRef = A7D8A5DD23E2513D00DCD162 /* SDL_log.c */; }; A75FCE0323E25AB700529352 /* SDL_cocoaopengl.m in Sources */ = {isa = PBXBuildFile; fileRef = A7D8A67F23E2513E00DCD162 /* SDL_cocoaopengl.m */; }; A75FCE0423E25AB700529352 /* SDL_offscreenframebuffer.c in Sources */ = {isa = PBXBuildFile; fileRef = A7D8A5F223E2513D00DCD162 /* SDL_offscreenframebuffer.c */; }; - A75FCE0523E25AB700529352 /* yuv_rgb.c in Sources */ = {isa = PBXBuildFile; fileRef = A7D8A76E23E2513E00DCD162 /* yuv_rgb.c */; }; A75FCE0623E25AB700529352 /* SDL_render_gles.c in Sources */ = {isa = PBXBuildFile; fileRef = A7D8A90123E2514000DCD162 /* SDL_render_gles.c */; }; A75FCE0723E25AB700529352 /* SDL_systhread.c in Sources */ = {isa = PBXBuildFile; fileRef = A7D8A78623E2513E00DCD162 /* SDL_systhread.c */; }; A75FCE0823E25AB700529352 /* SDL_windowevents.c in Sources */ = {isa = PBXBuildFile; fileRef = A7D8A92F23E2514000DCD162 /* SDL_windowevents.c */; }; @@ -536,7 +532,6 @@ A75FCEC923E25AC700529352 /* SDL_uikitview.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A61923E2513D00DCD162 /* SDL_uikitview.h */; }; A75FCECA23E25AC700529352 /* SDL_bits.h in Headers */ = {isa = PBXBuildFile; fileRef = AADA5B8616CCAB3000107CF7 /* SDL_bits.h */; settings = {ATTRIBUTES = (Public, ); }; }; A75FCECB23E25AC700529352 /* SDL_uikitappdelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A62F23E2513D00DCD162 /* SDL_uikitappdelegate.h */; }; - A75FCECC23E25AC700529352 /* keyinfotable.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A62823E2513D00DCD162 /* keyinfotable.h */; }; A75FCECD23E25AC700529352 /* SDL_blendmode.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557CC1595D4D800BBD41B /* SDL_blendmode.h */; settings = {ATTRIBUTES = (Public, ); }; }; A75FCECE23E25AC700529352 /* SDL_dropevents_c.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A92E23E2514000DCD162 /* SDL_dropevents_c.h */; }; A75FCECF23E25AC700529352 /* SDL_haptic_c.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A5C623E2513D00DCD162 /* SDL_haptic_c.h */; }; @@ -583,7 +578,6 @@ A75FCF0123E25AC700529352 /* SDL_keycode.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557DB1595D4D800BBD41B /* SDL_keycode.h */; settings = {ATTRIBUTES = (Public, ); }; }; A75FCF0323E25AC700529352 /* SDL_cocoakeyboard.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A68023E2513E00DCD162 /* SDL_cocoakeyboard.h */; }; A75FCF0423E25AC700529352 /* SDL_uikitvulkan.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A63323E2513D00DCD162 /* SDL_uikitvulkan.h */; }; - A75FCF0723E25AC700529352 /* vulkan.hpp in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A73223E2513E00DCD162 /* vulkan.hpp */; }; A75FCF0823E25AC700529352 /* SDL_loadso.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557DC1595D4D800BBD41B /* SDL_loadso.h */; settings = {ATTRIBUTES = (Public, ); }; }; A75FCF0923E25AC700529352 /* gl2ext.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A72323E2513E00DCD162 /* gl2ext.h */; }; A75FCF0A23E25AC700529352 /* SDL_clipboardevents_c.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A93923E2514000DCD162 /* SDL_clipboardevents_c.h */; }; @@ -659,7 +653,6 @@ A75FCF5A23E25AC700529352 /* vulkan_xlib.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A73A23E2513E00DCD162 /* vulkan_xlib.h */; }; A75FCF5B23E25AC700529352 /* SDL_uikitwindow.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A62723E2513D00DCD162 /* SDL_uikitwindow.h */; }; A75FCF5C23E25AC700529352 /* vulkan_vi.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A72F23E2513E00DCD162 /* vulkan_vi.h */; }; - A75FCF5D23E25AC700529352 /* vulkan_mir.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A73923E2513E00DCD162 /* vulkan_mir.h */; }; A75FCF5E23E25AC700529352 /* SDL_quit.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557E81595D4D800BBD41B /* SDL_quit.h */; settings = {ATTRIBUTES = (Public, ); }; }; A75FCF5F23E25AC700529352 /* default_cursor.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A93323E2514000DCD162 /* default_cursor.h */; }; A75FCF6023E25AC700529352 /* SDL_render_sw_c.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A8F523E2514000DCD162 /* SDL_render_sw_c.h */; }; @@ -747,7 +740,6 @@ A75FCFBB23E25AC700529352 /* SDL_log.c in Sources */ = {isa = PBXBuildFile; fileRef = A7D8A5DD23E2513D00DCD162 /* SDL_log.c */; }; A75FCFBC23E25AC700529352 /* SDL_cocoaopengl.m in Sources */ = {isa = PBXBuildFile; fileRef = A7D8A67F23E2513E00DCD162 /* SDL_cocoaopengl.m */; }; A75FCFBD23E25AC700529352 /* SDL_offscreenframebuffer.c in Sources */ = {isa = PBXBuildFile; fileRef = A7D8A5F223E2513D00DCD162 /* SDL_offscreenframebuffer.c */; }; - A75FCFBE23E25AC700529352 /* yuv_rgb.c in Sources */ = {isa = PBXBuildFile; fileRef = A7D8A76E23E2513E00DCD162 /* yuv_rgb.c */; }; A75FCFBF23E25AC700529352 /* SDL_render_gles.c in Sources */ = {isa = PBXBuildFile; fileRef = A7D8A90123E2514000DCD162 /* SDL_render_gles.c */; }; A75FCFC023E25AC700529352 /* SDL_systhread.c in Sources */ = {isa = PBXBuildFile; fileRef = A7D8A78623E2513E00DCD162 /* SDL_systhread.c */; }; A75FCFC123E25AC700529352 /* SDL_windowevents.c in Sources */ = {isa = PBXBuildFile; fileRef = A7D8A92F23E2514000DCD162 /* SDL_windowevents.c */; }; @@ -947,7 +939,6 @@ A769B09623E259AE00872273 /* SDL_coremotionsensor.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A57B23E2513D00DCD162 /* SDL_coremotionsensor.h */; }; A769B09723E259AE00872273 /* SDL_uikitview.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A61923E2513D00DCD162 /* SDL_uikitview.h */; }; A769B09923E259AE00872273 /* SDL_uikitappdelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A62F23E2513D00DCD162 /* SDL_uikitappdelegate.h */; }; - A769B09A23E259AE00872273 /* keyinfotable.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A62823E2513D00DCD162 /* keyinfotable.h */; }; A769B09C23E259AE00872273 /* SDL_dropevents_c.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A92E23E2514000DCD162 /* SDL_dropevents_c.h */; }; A769B09D23E259AE00872273 /* SDL_haptic_c.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A5C623E2513D00DCD162 /* SDL_haptic_c.h */; }; A769B09F23E259AE00872273 /* SDL_dataqueue.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A57023E2513D00DCD162 /* SDL_dataqueue.h */; }; @@ -979,7 +970,6 @@ A769B0CD23E259AE00872273 /* SDL_systhread_c.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A78423E2513E00DCD162 /* SDL_systhread_c.h */; }; A769B0D023E259AE00872273 /* SDL_cocoakeyboard.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A68023E2513E00DCD162 /* SDL_cocoakeyboard.h */; }; A769B0D123E259AE00872273 /* SDL_uikitvulkan.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A63323E2513D00DCD162 /* SDL_uikitvulkan.h */; }; - A769B0D423E259AE00872273 /* vulkan.hpp in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A73223E2513E00DCD162 /* vulkan.hpp */; }; A769B0D623E259AE00872273 /* gl2ext.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A72323E2513E00DCD162 /* gl2ext.h */; }; A769B0D723E259AE00872273 /* SDL_clipboardevents_c.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A93923E2514000DCD162 /* SDL_clipboardevents_c.h */; }; A769B0D923E259AE00872273 /* SDL_syshaptic_c.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A5CF23E2513D00DCD162 /* SDL_syshaptic_c.h */; }; @@ -1041,7 +1031,6 @@ A769B12923E259AE00872273 /* vulkan_xlib.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A73A23E2513E00DCD162 /* vulkan_xlib.h */; }; A769B12A23E259AE00872273 /* SDL_uikitwindow.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A62723E2513D00DCD162 /* SDL_uikitwindow.h */; }; A769B12B23E259AE00872273 /* vulkan_vi.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A72F23E2513E00DCD162 /* vulkan_vi.h */; }; - A769B12C23E259AE00872273 /* vulkan_mir.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A73923E2513E00DCD162 /* vulkan_mir.h */; }; A769B12E23E259AE00872273 /* default_cursor.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A93323E2514000DCD162 /* default_cursor.h */; }; A769B12F23E259AE00872273 /* SDL_render_sw_c.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A8F523E2514000DCD162 /* SDL_render_sw_c.h */; }; A769B13223E259AE00872273 /* SDL_nullvideo.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A60A23E2513D00DCD162 /* SDL_nullvideo.h */; }; @@ -1107,7 +1096,6 @@ A769B18B23E259AE00872273 /* SDL_log.c in Sources */ = {isa = PBXBuildFile; fileRef = A7D8A5DD23E2513D00DCD162 /* SDL_log.c */; }; A769B18C23E259AE00872273 /* SDL_cocoaopengl.m in Sources */ = {isa = PBXBuildFile; fileRef = A7D8A67F23E2513E00DCD162 /* SDL_cocoaopengl.m */; }; A769B18D23E259AE00872273 /* SDL_offscreenframebuffer.c in Sources */ = {isa = PBXBuildFile; fileRef = A7D8A5F223E2513D00DCD162 /* SDL_offscreenframebuffer.c */; }; - A769B18E23E259AE00872273 /* yuv_rgb.c in Sources */ = {isa = PBXBuildFile; fileRef = A7D8A76E23E2513E00DCD162 /* yuv_rgb.c */; }; A769B18F23E259AE00872273 /* SDL_render_gles.c in Sources */ = {isa = PBXBuildFile; fileRef = A7D8A90123E2514000DCD162 /* SDL_render_gles.c */; }; A769B19023E259AE00872273 /* SDL_systhread.c in Sources */ = {isa = PBXBuildFile; fileRef = A7D8A78623E2513E00DCD162 /* SDL_systhread.c */; }; A769B19123E259AE00872273 /* SDL_windowevents.c in Sources */ = {isa = PBXBuildFile; fileRef = A7D8A92F23E2514000DCD162 /* SDL_windowevents.c */; }; @@ -1760,10 +1748,6 @@ A7D8AC9B23E2514100DCD162 /* SDL_uikitwindow.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A62723E2513D00DCD162 /* SDL_uikitwindow.h */; }; A7D8AC9D23E2514100DCD162 /* SDL_uikitwindow.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A62723E2513D00DCD162 /* SDL_uikitwindow.h */; }; A7D8AC9E23E2514100DCD162 /* SDL_uikitwindow.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A62723E2513D00DCD162 /* SDL_uikitwindow.h */; }; - A7D8ACA023E2514100DCD162 /* keyinfotable.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A62823E2513D00DCD162 /* keyinfotable.h */; }; - A7D8ACA123E2514100DCD162 /* keyinfotable.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A62823E2513D00DCD162 /* keyinfotable.h */; }; - A7D8ACA323E2514100DCD162 /* keyinfotable.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A62823E2513D00DCD162 /* keyinfotable.h */; }; - A7D8ACA423E2514100DCD162 /* keyinfotable.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A62823E2513D00DCD162 /* keyinfotable.h */; }; A7D8ACA623E2514100DCD162 /* SDL_uikitview.m in Sources */ = {isa = PBXBuildFile; fileRef = A7D8A62923E2513D00DCD162 /* SDL_uikitview.m */; }; A7D8ACA723E2514100DCD162 /* SDL_uikitview.m in Sources */ = {isa = PBXBuildFile; fileRef = A7D8A62923E2513D00DCD162 /* SDL_uikitview.m */; }; A7D8ACA923E2514100DCD162 /* SDL_uikitview.m in Sources */ = {isa = PBXBuildFile; fileRef = A7D8A62923E2513D00DCD162 /* SDL_uikitview.m */; }; @@ -2120,12 +2104,6 @@ A7D8B26923E2514200DCD162 /* vk_platform.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A73123E2513E00DCD162 /* vk_platform.h */; }; A7D8B26A23E2514200DCD162 /* vk_platform.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A73123E2513E00DCD162 /* vk_platform.h */; }; A7D8B26B23E2514200DCD162 /* vk_platform.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A73123E2513E00DCD162 /* vk_platform.h */; }; - A7D8B26C23E2514200DCD162 /* vulkan.hpp in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A73223E2513E00DCD162 /* vulkan.hpp */; }; - A7D8B26D23E2514200DCD162 /* vulkan.hpp in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A73223E2513E00DCD162 /* vulkan.hpp */; }; - A7D8B26E23E2514200DCD162 /* vulkan.hpp in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A73223E2513E00DCD162 /* vulkan.hpp */; }; - A7D8B26F23E2514200DCD162 /* vulkan.hpp in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A73223E2513E00DCD162 /* vulkan.hpp */; }; - A7D8B27023E2514200DCD162 /* vulkan.hpp in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A73223E2513E00DCD162 /* vulkan.hpp */; }; - A7D8B27123E2514200DCD162 /* vulkan.hpp in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A73223E2513E00DCD162 /* vulkan.hpp */; }; A7D8B27223E2514200DCD162 /* vulkan_fuchsia.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A73323E2513E00DCD162 /* vulkan_fuchsia.h */; }; A7D8B27323E2514200DCD162 /* vulkan_fuchsia.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A73323E2513E00DCD162 /* vulkan_fuchsia.h */; }; A7D8B27423E2514200DCD162 /* vulkan_fuchsia.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A73323E2513E00DCD162 /* vulkan_fuchsia.h */; }; @@ -2162,12 +2140,6 @@ A7D8B29323E2514200DCD162 /* vulkan_xcb.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A73823E2513E00DCD162 /* vulkan_xcb.h */; }; A7D8B29423E2514200DCD162 /* vulkan_xcb.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A73823E2513E00DCD162 /* vulkan_xcb.h */; }; A7D8B29523E2514200DCD162 /* vulkan_xcb.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A73823E2513E00DCD162 /* vulkan_xcb.h */; }; - A7D8B29623E2514200DCD162 /* vulkan_mir.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A73923E2513E00DCD162 /* vulkan_mir.h */; }; - A7D8B29723E2514200DCD162 /* vulkan_mir.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A73923E2513E00DCD162 /* vulkan_mir.h */; }; - A7D8B29823E2514200DCD162 /* vulkan_mir.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A73923E2513E00DCD162 /* vulkan_mir.h */; }; - A7D8B29923E2514200DCD162 /* vulkan_mir.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A73923E2513E00DCD162 /* vulkan_mir.h */; }; - A7D8B29A23E2514200DCD162 /* vulkan_mir.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A73923E2513E00DCD162 /* vulkan_mir.h */; }; - A7D8B29B23E2514200DCD162 /* vulkan_mir.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A73923E2513E00DCD162 /* vulkan_mir.h */; }; A7D8B29C23E2514200DCD162 /* vulkan_xlib.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A73A23E2513E00DCD162 /* vulkan_xlib.h */; }; A7D8B29D23E2514200DCD162 /* vulkan_xlib.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A73A23E2513E00DCD162 /* vulkan_xlib.h */; }; A7D8B29E23E2514200DCD162 /* vulkan_xlib.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A73A23E2513E00DCD162 /* vulkan_xlib.h */; }; @@ -2246,12 +2218,6 @@ A7D8B3B923E2514200DCD162 /* SDL_blit.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A76B23E2513E00DCD162 /* SDL_blit.h */; }; A7D8B3BA23E2514200DCD162 /* SDL_blit.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A76B23E2513E00DCD162 /* SDL_blit.h */; }; A7D8B3BB23E2514200DCD162 /* SDL_blit.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A76B23E2513E00DCD162 /* SDL_blit.h */; }; - A7D8B3BF23E2514200DCD162 /* yuv_rgb.c in Sources */ = {isa = PBXBuildFile; fileRef = A7D8A76E23E2513E00DCD162 /* yuv_rgb.c */; }; - A7D8B3C023E2514200DCD162 /* yuv_rgb.c in Sources */ = {isa = PBXBuildFile; fileRef = A7D8A76E23E2513E00DCD162 /* yuv_rgb.c */; }; - A7D8B3C123E2514200DCD162 /* yuv_rgb.c in Sources */ = {isa = PBXBuildFile; fileRef = A7D8A76E23E2513E00DCD162 /* yuv_rgb.c */; }; - A7D8B3C223E2514200DCD162 /* yuv_rgb.c in Sources */ = {isa = PBXBuildFile; fileRef = A7D8A76E23E2513E00DCD162 /* yuv_rgb.c */; }; - A7D8B3C323E2514200DCD162 /* yuv_rgb.c in Sources */ = {isa = PBXBuildFile; fileRef = A7D8A76E23E2513E00DCD162 /* yuv_rgb.c */; }; - A7D8B3C423E2514200DCD162 /* yuv_rgb.c in Sources */ = {isa = PBXBuildFile; fileRef = A7D8A76E23E2513E00DCD162 /* yuv_rgb.c */; }; A7D8B3C823E2514200DCD162 /* yuv_rgb_sse_func.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A77023E2513E00DCD162 /* yuv_rgb_sse_func.h */; }; A7D8B3C923E2514300DCD162 /* yuv_rgb_sse_func.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A77023E2513E00DCD162 /* yuv_rgb_sse_func.h */; }; A7D8B3CA23E2514300DCD162 /* yuv_rgb_sse_func.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A77023E2513E00DCD162 /* yuv_rgb_sse_func.h */; }; @@ -3188,7 +3154,6 @@ A7D8BBC723E2561500DCD162 /* SDL_steamcontroller.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A7A523E2513E00DCD162 /* SDL_steamcontroller.h */; }; A7D8BBCB23E2561600DCD162 /* SDL_steamcontroller.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A7A523E2513E00DCD162 /* SDL_steamcontroller.h */; }; A7D8BBCF23E2561600DCD162 /* SDL_steamcontroller.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A7A523E2513E00DCD162 /* SDL_steamcontroller.h */; }; - A7D8BBD123E2574800DCD162 /* keyinfotable.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A62823E2513D00DCD162 /* keyinfotable.h */; }; A7D8BBD223E2574800DCD162 /* SDL_uikitappdelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A62F23E2513D00DCD162 /* SDL_uikitappdelegate.h */; }; A7D8BBD323E2574800DCD162 /* SDL_uikitappdelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = A7D8A61E23E2513D00DCD162 /* SDL_uikitappdelegate.m */; }; A7D8BBD423E2574800DCD162 /* SDL_uikitclipboard.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A62123E2513D00DCD162 /* SDL_uikitclipboard.h */; }; @@ -3215,7 +3180,6 @@ A7D8BBE923E2574800DCD162 /* SDL_uikitvulkan.m in Sources */ = {isa = PBXBuildFile; fileRef = A7D8A62523E2513D00DCD162 /* SDL_uikitvulkan.m */; }; A7D8BBEA23E2574800DCD162 /* SDL_uikitwindow.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A62723E2513D00DCD162 /* SDL_uikitwindow.h */; }; A7D8BBEB23E2574800DCD162 /* SDL_uikitwindow.m in Sources */ = {isa = PBXBuildFile; fileRef = A7D8A61A23E2513D00DCD162 /* SDL_uikitwindow.m */; }; - A7D8BBEC23E2574800DCD162 /* keyinfotable.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A62823E2513D00DCD162 /* keyinfotable.h */; }; A7D8BBED23E2574800DCD162 /* SDL_uikitappdelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A62F23E2513D00DCD162 /* SDL_uikitappdelegate.h */; }; A7D8BBEE23E2574800DCD162 /* SDL_uikitappdelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = A7D8A61E23E2513D00DCD162 /* SDL_uikitappdelegate.m */; }; A7D8BBEF23E2574800DCD162 /* SDL_uikitclipboard.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D8A62123E2513D00DCD162 /* SDL_uikitclipboard.h */; }; @@ -3364,6 +3328,87 @@ DB31407017554B71006C0E22 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0073179F0858DECD00B2BC32 /* IOKit.framework */; }; DB31407217554B71006C0E22 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 007317C10858E15000B2BC32 /* Carbon.framework */; }; DB31408D17554D3C006C0E22 /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 00CFA89C106B4BA100758660 /* ForceFeedback.framework */; }; + F316AB852B5A02C3002EF551 /* yuv_rgb_common.h in Headers */ = {isa = PBXBuildFile; fileRef = F316AB7C2B5A02C2002EF551 /* yuv_rgb_common.h */; }; + F316AB862B5A02C3002EF551 /* yuv_rgb_common.h in Headers */ = {isa = PBXBuildFile; fileRef = F316AB7C2B5A02C2002EF551 /* yuv_rgb_common.h */; }; + F316AB872B5A02C3002EF551 /* yuv_rgb_common.h in Headers */ = {isa = PBXBuildFile; fileRef = F316AB7C2B5A02C2002EF551 /* yuv_rgb_common.h */; }; + F316AB882B5A02C3002EF551 /* yuv_rgb_common.h in Headers */ = {isa = PBXBuildFile; fileRef = F316AB7C2B5A02C2002EF551 /* yuv_rgb_common.h */; }; + F316AB892B5A02C3002EF551 /* yuv_rgb_common.h in Headers */ = {isa = PBXBuildFile; fileRef = F316AB7C2B5A02C2002EF551 /* yuv_rgb_common.h */; }; + F316AB8A2B5A02C3002EF551 /* yuv_rgb_common.h in Headers */ = {isa = PBXBuildFile; fileRef = F316AB7C2B5A02C2002EF551 /* yuv_rgb_common.h */; }; + F316AB8B2B5A02C3002EF551 /* yuv_rgb_common.h in Headers */ = {isa = PBXBuildFile; fileRef = F316AB7C2B5A02C2002EF551 /* yuv_rgb_common.h */; }; + F316AB8C2B5A02C3002EF551 /* yuv_rgb_common.h in Headers */ = {isa = PBXBuildFile; fileRef = F316AB7C2B5A02C2002EF551 /* yuv_rgb_common.h */; }; + F316AB8D2B5A02C3002EF551 /* yuv_rgb_common.h in Headers */ = {isa = PBXBuildFile; fileRef = F316AB7C2B5A02C2002EF551 /* yuv_rgb_common.h */; }; + F316AB8E2B5A02C3002EF551 /* yuv_rgb_internal.h in Headers */ = {isa = PBXBuildFile; fileRef = F316AB7D2B5A02C2002EF551 /* yuv_rgb_internal.h */; }; + F316AB8F2B5A02C3002EF551 /* yuv_rgb_internal.h in Headers */ = {isa = PBXBuildFile; fileRef = F316AB7D2B5A02C2002EF551 /* yuv_rgb_internal.h */; }; + F316AB902B5A02C3002EF551 /* yuv_rgb_internal.h in Headers */ = {isa = PBXBuildFile; fileRef = F316AB7D2B5A02C2002EF551 /* yuv_rgb_internal.h */; }; + F316AB912B5A02C3002EF551 /* yuv_rgb_internal.h in Headers */ = {isa = PBXBuildFile; fileRef = F316AB7D2B5A02C2002EF551 /* yuv_rgb_internal.h */; }; + F316AB922B5A02C3002EF551 /* yuv_rgb_internal.h in Headers */ = {isa = PBXBuildFile; fileRef = F316AB7D2B5A02C2002EF551 /* yuv_rgb_internal.h */; }; + F316AB932B5A02C3002EF551 /* yuv_rgb_internal.h in Headers */ = {isa = PBXBuildFile; fileRef = F316AB7D2B5A02C2002EF551 /* yuv_rgb_internal.h */; }; + F316AB942B5A02C3002EF551 /* yuv_rgb_internal.h in Headers */ = {isa = PBXBuildFile; fileRef = F316AB7D2B5A02C2002EF551 /* yuv_rgb_internal.h */; }; + F316AB952B5A02C3002EF551 /* yuv_rgb_internal.h in Headers */ = {isa = PBXBuildFile; fileRef = F316AB7D2B5A02C2002EF551 /* yuv_rgb_internal.h */; }; + F316AB962B5A02C3002EF551 /* yuv_rgb_internal.h in Headers */ = {isa = PBXBuildFile; fileRef = F316AB7D2B5A02C2002EF551 /* yuv_rgb_internal.h */; }; + F316AB972B5A02C3002EF551 /* yuv_rgb_std.c in Sources */ = {isa = PBXBuildFile; fileRef = F316AB7E2B5A02C3002EF551 /* yuv_rgb_std.c */; }; + F316AB982B5A02C3002EF551 /* yuv_rgb_std.c in Sources */ = {isa = PBXBuildFile; fileRef = F316AB7E2B5A02C3002EF551 /* yuv_rgb_std.c */; }; + F316AB992B5A02C3002EF551 /* yuv_rgb_std.c in Sources */ = {isa = PBXBuildFile; fileRef = F316AB7E2B5A02C3002EF551 /* yuv_rgb_std.c */; }; + F316AB9A2B5A02C3002EF551 /* yuv_rgb_std.c in Sources */ = {isa = PBXBuildFile; fileRef = F316AB7E2B5A02C3002EF551 /* yuv_rgb_std.c */; }; + F316AB9B2B5A02C3002EF551 /* yuv_rgb_std.c in Sources */ = {isa = PBXBuildFile; fileRef = F316AB7E2B5A02C3002EF551 /* yuv_rgb_std.c */; }; + F316AB9C2B5A02C3002EF551 /* yuv_rgb_std.c in Sources */ = {isa = PBXBuildFile; fileRef = F316AB7E2B5A02C3002EF551 /* yuv_rgb_std.c */; }; + F316AB9D2B5A02C3002EF551 /* yuv_rgb_std.c in Sources */ = {isa = PBXBuildFile; fileRef = F316AB7E2B5A02C3002EF551 /* yuv_rgb_std.c */; }; + F316AB9E2B5A02C3002EF551 /* yuv_rgb_std.c in Sources */ = {isa = PBXBuildFile; fileRef = F316AB7E2B5A02C3002EF551 /* yuv_rgb_std.c */; }; + F316AB9F2B5A02C3002EF551 /* yuv_rgb_std.c in Sources */ = {isa = PBXBuildFile; fileRef = F316AB7E2B5A02C3002EF551 /* yuv_rgb_std.c */; }; + F316ABA02B5A02C3002EF551 /* yuv_rgb_sse.c in Sources */ = {isa = PBXBuildFile; fileRef = F316AB7F2B5A02C3002EF551 /* yuv_rgb_sse.c */; }; + F316ABA12B5A02C3002EF551 /* yuv_rgb_sse.c in Sources */ = {isa = PBXBuildFile; fileRef = F316AB7F2B5A02C3002EF551 /* yuv_rgb_sse.c */; }; + F316ABA22B5A02C3002EF551 /* yuv_rgb_sse.c in Sources */ = {isa = PBXBuildFile; fileRef = F316AB7F2B5A02C3002EF551 /* yuv_rgb_sse.c */; }; + F316ABA32B5A02C3002EF551 /* yuv_rgb_sse.c in Sources */ = {isa = PBXBuildFile; fileRef = F316AB7F2B5A02C3002EF551 /* yuv_rgb_sse.c */; }; + F316ABA42B5A02C3002EF551 /* yuv_rgb_sse.c in Sources */ = {isa = PBXBuildFile; fileRef = F316AB7F2B5A02C3002EF551 /* yuv_rgb_sse.c */; }; + F316ABA52B5A02C3002EF551 /* yuv_rgb_sse.c in Sources */ = {isa = PBXBuildFile; fileRef = F316AB7F2B5A02C3002EF551 /* yuv_rgb_sse.c */; }; + F316ABA62B5A02C3002EF551 /* yuv_rgb_sse.c in Sources */ = {isa = PBXBuildFile; fileRef = F316AB7F2B5A02C3002EF551 /* yuv_rgb_sse.c */; }; + F316ABA72B5A02C3002EF551 /* yuv_rgb_sse.c in Sources */ = {isa = PBXBuildFile; fileRef = F316AB7F2B5A02C3002EF551 /* yuv_rgb_sse.c */; }; + F316ABA82B5A02C3002EF551 /* yuv_rgb_sse.c in Sources */ = {isa = PBXBuildFile; fileRef = F316AB7F2B5A02C3002EF551 /* yuv_rgb_sse.c */; }; + F316ABA92B5A02C3002EF551 /* yuv_rgb_lsx.h in Headers */ = {isa = PBXBuildFile; fileRef = F316AB802B5A02C3002EF551 /* yuv_rgb_lsx.h */; }; + F316ABAA2B5A02C3002EF551 /* yuv_rgb_lsx.h in Headers */ = {isa = PBXBuildFile; fileRef = F316AB802B5A02C3002EF551 /* yuv_rgb_lsx.h */; }; + F316ABAB2B5A02C3002EF551 /* yuv_rgb_lsx.h in Headers */ = {isa = PBXBuildFile; fileRef = F316AB802B5A02C3002EF551 /* yuv_rgb_lsx.h */; }; + F316ABAC2B5A02C3002EF551 /* yuv_rgb_lsx.h in Headers */ = {isa = PBXBuildFile; fileRef = F316AB802B5A02C3002EF551 /* yuv_rgb_lsx.h */; }; + F316ABAD2B5A02C3002EF551 /* yuv_rgb_lsx.h in Headers */ = {isa = PBXBuildFile; fileRef = F316AB802B5A02C3002EF551 /* yuv_rgb_lsx.h */; }; + F316ABAE2B5A02C3002EF551 /* yuv_rgb_lsx.h in Headers */ = {isa = PBXBuildFile; fileRef = F316AB802B5A02C3002EF551 /* yuv_rgb_lsx.h */; }; + F316ABAF2B5A02C3002EF551 /* yuv_rgb_lsx.h in Headers */ = {isa = PBXBuildFile; fileRef = F316AB802B5A02C3002EF551 /* yuv_rgb_lsx.h */; }; + F316ABB02B5A02C3002EF551 /* yuv_rgb_lsx.h in Headers */ = {isa = PBXBuildFile; fileRef = F316AB802B5A02C3002EF551 /* yuv_rgb_lsx.h */; }; + F316ABB12B5A02C3002EF551 /* yuv_rgb_lsx.h in Headers */ = {isa = PBXBuildFile; fileRef = F316AB802B5A02C3002EF551 /* yuv_rgb_lsx.h */; }; + F316ABB22B5A02C3002EF551 /* yuv_rgb_lsx.c in Sources */ = {isa = PBXBuildFile; fileRef = F316AB812B5A02C3002EF551 /* yuv_rgb_lsx.c */; }; + F316ABB32B5A02C3002EF551 /* yuv_rgb_lsx.c in Sources */ = {isa = PBXBuildFile; fileRef = F316AB812B5A02C3002EF551 /* yuv_rgb_lsx.c */; }; + F316ABB42B5A02C3002EF551 /* yuv_rgb_lsx.c in Sources */ = {isa = PBXBuildFile; fileRef = F316AB812B5A02C3002EF551 /* yuv_rgb_lsx.c */; }; + F316ABB52B5A02C3002EF551 /* yuv_rgb_lsx.c in Sources */ = {isa = PBXBuildFile; fileRef = F316AB812B5A02C3002EF551 /* yuv_rgb_lsx.c */; }; + F316ABB62B5A02C3002EF551 /* yuv_rgb_lsx.c in Sources */ = {isa = PBXBuildFile; fileRef = F316AB812B5A02C3002EF551 /* yuv_rgb_lsx.c */; }; + F316ABB72B5A02C3002EF551 /* yuv_rgb_lsx.c in Sources */ = {isa = PBXBuildFile; fileRef = F316AB812B5A02C3002EF551 /* yuv_rgb_lsx.c */; }; + F316ABB82B5A02C3002EF551 /* yuv_rgb_lsx.c in Sources */ = {isa = PBXBuildFile; fileRef = F316AB812B5A02C3002EF551 /* yuv_rgb_lsx.c */; }; + F316ABB92B5A02C3002EF551 /* yuv_rgb_lsx.c in Sources */ = {isa = PBXBuildFile; fileRef = F316AB812B5A02C3002EF551 /* yuv_rgb_lsx.c */; }; + F316ABBA2B5A02C3002EF551 /* yuv_rgb_lsx.c in Sources */ = {isa = PBXBuildFile; fileRef = F316AB812B5A02C3002EF551 /* yuv_rgb_lsx.c */; }; + F316ABBB2B5A02C3002EF551 /* yuv_rgb_sse.h in Headers */ = {isa = PBXBuildFile; fileRef = F316AB822B5A02C3002EF551 /* yuv_rgb_sse.h */; }; + F316ABBC2B5A02C3002EF551 /* yuv_rgb_sse.h in Headers */ = {isa = PBXBuildFile; fileRef = F316AB822B5A02C3002EF551 /* yuv_rgb_sse.h */; }; + F316ABBD2B5A02C3002EF551 /* yuv_rgb_sse.h in Headers */ = {isa = PBXBuildFile; fileRef = F316AB822B5A02C3002EF551 /* yuv_rgb_sse.h */; }; + F316ABBE2B5A02C3002EF551 /* yuv_rgb_sse.h in Headers */ = {isa = PBXBuildFile; fileRef = F316AB822B5A02C3002EF551 /* yuv_rgb_sse.h */; }; + F316ABBF2B5A02C3002EF551 /* yuv_rgb_sse.h in Headers */ = {isa = PBXBuildFile; fileRef = F316AB822B5A02C3002EF551 /* yuv_rgb_sse.h */; }; + F316ABC02B5A02C3002EF551 /* yuv_rgb_sse.h in Headers */ = {isa = PBXBuildFile; fileRef = F316AB822B5A02C3002EF551 /* yuv_rgb_sse.h */; }; + F316ABC12B5A02C3002EF551 /* yuv_rgb_sse.h in Headers */ = {isa = PBXBuildFile; fileRef = F316AB822B5A02C3002EF551 /* yuv_rgb_sse.h */; }; + F316ABC22B5A02C3002EF551 /* yuv_rgb_sse.h in Headers */ = {isa = PBXBuildFile; fileRef = F316AB822B5A02C3002EF551 /* yuv_rgb_sse.h */; }; + F316ABC32B5A02C3002EF551 /* yuv_rgb_sse.h in Headers */ = {isa = PBXBuildFile; fileRef = F316AB822B5A02C3002EF551 /* yuv_rgb_sse.h */; }; + F316ABC42B5A02C3002EF551 /* yuv_rgb_std.h in Headers */ = {isa = PBXBuildFile; fileRef = F316AB832B5A02C3002EF551 /* yuv_rgb_std.h */; }; + F316ABC52B5A02C3002EF551 /* yuv_rgb_std.h in Headers */ = {isa = PBXBuildFile; fileRef = F316AB832B5A02C3002EF551 /* yuv_rgb_std.h */; }; + F316ABC62B5A02C3002EF551 /* yuv_rgb_std.h in Headers */ = {isa = PBXBuildFile; fileRef = F316AB832B5A02C3002EF551 /* yuv_rgb_std.h */; }; + F316ABC72B5A02C3002EF551 /* yuv_rgb_std.h in Headers */ = {isa = PBXBuildFile; fileRef = F316AB832B5A02C3002EF551 /* yuv_rgb_std.h */; }; + F316ABC82B5A02C3002EF551 /* yuv_rgb_std.h in Headers */ = {isa = PBXBuildFile; fileRef = F316AB832B5A02C3002EF551 /* yuv_rgb_std.h */; }; + F316ABC92B5A02C3002EF551 /* yuv_rgb_std.h in Headers */ = {isa = PBXBuildFile; fileRef = F316AB832B5A02C3002EF551 /* yuv_rgb_std.h */; }; + F316ABCA2B5A02C3002EF551 /* yuv_rgb_std.h in Headers */ = {isa = PBXBuildFile; fileRef = F316AB832B5A02C3002EF551 /* yuv_rgb_std.h */; }; + F316ABCB2B5A02C3002EF551 /* yuv_rgb_std.h in Headers */ = {isa = PBXBuildFile; fileRef = F316AB832B5A02C3002EF551 /* yuv_rgb_std.h */; }; + F316ABCC2B5A02C3002EF551 /* yuv_rgb_std.h in Headers */ = {isa = PBXBuildFile; fileRef = F316AB832B5A02C3002EF551 /* yuv_rgb_std.h */; }; + F316ABCD2B5A02C3002EF551 /* yuv_rgb_lsx_func.h in Headers */ = {isa = PBXBuildFile; fileRef = F316AB842B5A02C3002EF551 /* yuv_rgb_lsx_func.h */; }; + F316ABCE2B5A02C3002EF551 /* yuv_rgb_lsx_func.h in Headers */ = {isa = PBXBuildFile; fileRef = F316AB842B5A02C3002EF551 /* yuv_rgb_lsx_func.h */; }; + F316ABCF2B5A02C3002EF551 /* yuv_rgb_lsx_func.h in Headers */ = {isa = PBXBuildFile; fileRef = F316AB842B5A02C3002EF551 /* yuv_rgb_lsx_func.h */; }; + F316ABD02B5A02C3002EF551 /* yuv_rgb_lsx_func.h in Headers */ = {isa = PBXBuildFile; fileRef = F316AB842B5A02C3002EF551 /* yuv_rgb_lsx_func.h */; }; + F316ABD12B5A02C3002EF551 /* yuv_rgb_lsx_func.h in Headers */ = {isa = PBXBuildFile; fileRef = F316AB842B5A02C3002EF551 /* yuv_rgb_lsx_func.h */; }; + F316ABD22B5A02C3002EF551 /* yuv_rgb_lsx_func.h in Headers */ = {isa = PBXBuildFile; fileRef = F316AB842B5A02C3002EF551 /* yuv_rgb_lsx_func.h */; }; + F316ABD32B5A02C3002EF551 /* yuv_rgb_lsx_func.h in Headers */ = {isa = PBXBuildFile; fileRef = F316AB842B5A02C3002EF551 /* yuv_rgb_lsx_func.h */; }; + F316ABD42B5A02C3002EF551 /* yuv_rgb_lsx_func.h in Headers */ = {isa = PBXBuildFile; fileRef = F316AB842B5A02C3002EF551 /* yuv_rgb_lsx_func.h */; }; + F316ABD52B5A02C3002EF551 /* yuv_rgb_lsx_func.h in Headers */ = {isa = PBXBuildFile; fileRef = F316AB842B5A02C3002EF551 /* yuv_rgb_lsx_func.h */; }; F31A92C828D4CB39003BFD6A /* SDL_offscreenopengles.h in Headers */ = {isa = PBXBuildFile; fileRef = F31A92C628D4CB39003BFD6A /* SDL_offscreenopengles.h */; }; F31A92C928D4CB39003BFD6A /* SDL_offscreenopengles.h in Headers */ = {isa = PBXBuildFile; fileRef = F31A92C628D4CB39003BFD6A /* SDL_offscreenopengles.h */; }; F31A92CA28D4CB39003BFD6A /* SDL_offscreenopengles.h in Headers */ = {isa = PBXBuildFile; fileRef = F31A92C628D4CB39003BFD6A /* SDL_offscreenopengles.h */; }; @@ -3396,6 +3441,51 @@ F34B9895291DEFF500AAC96E /* SDL_hidapi_steam.c in Sources */ = {isa = PBXBuildFile; fileRef = A75FDAAC23E2795C00529352 /* SDL_hidapi_steam.c */; }; F34B9896291DEFF700AAC96E /* SDL_hidapi_steam.c in Sources */ = {isa = PBXBuildFile; fileRef = A75FDAAC23E2795C00529352 /* SDL_hidapi_steam.c */; }; F34B9897291DEFFA00AAC96E /* SDL_hidapi_steam.c in Sources */ = {isa = PBXBuildFile; fileRef = A75FDAAC23E2795C00529352 /* SDL_hidapi_steam.c */; }; + F362B9322B33916600D30B94 /* controller_list.h in Headers */ = {isa = PBXBuildFile; fileRef = F362B91F2B33916600D30B94 /* controller_list.h */; }; + F362B9332B33916600D30B94 /* controller_list.h in Headers */ = {isa = PBXBuildFile; fileRef = F362B91F2B33916600D30B94 /* controller_list.h */; }; + F362B9342B33916600D30B94 /* controller_list.h in Headers */ = {isa = PBXBuildFile; fileRef = F362B91F2B33916600D30B94 /* controller_list.h */; }; + F362B9352B33916600D30B94 /* controller_list.h in Headers */ = {isa = PBXBuildFile; fileRef = F362B91F2B33916600D30B94 /* controller_list.h */; }; + F362B9362B33916600D30B94 /* controller_list.h in Headers */ = {isa = PBXBuildFile; fileRef = F362B91F2B33916600D30B94 /* controller_list.h */; }; + F362B9372B33916600D30B94 /* controller_list.h in Headers */ = {isa = PBXBuildFile; fileRef = F362B91F2B33916600D30B94 /* controller_list.h */; }; + F362B9382B33916600D30B94 /* controller_list.h in Headers */ = {isa = PBXBuildFile; fileRef = F362B91F2B33916600D30B94 /* controller_list.h */; }; + F362B9392B33916600D30B94 /* controller_list.h in Headers */ = {isa = PBXBuildFile; fileRef = F362B91F2B33916600D30B94 /* controller_list.h */; }; + F362B93A2B33916600D30B94 /* controller_list.h in Headers */ = {isa = PBXBuildFile; fileRef = F362B91F2B33916600D30B94 /* controller_list.h */; }; + F362B93D2B33920500D30B94 /* SDL_hidapi_steamdeck.c in Sources */ = {isa = PBXBuildFile; fileRef = F362B93B2B33920400D30B94 /* SDL_hidapi_steamdeck.c */; }; + F362B93E2B33920500D30B94 /* SDL_hidapi_steamdeck.c in Sources */ = {isa = PBXBuildFile; fileRef = F362B93B2B33920400D30B94 /* SDL_hidapi_steamdeck.c */; }; + F362B93F2B33920500D30B94 /* SDL_hidapi_steamdeck.c in Sources */ = {isa = PBXBuildFile; fileRef = F362B93B2B33920400D30B94 /* SDL_hidapi_steamdeck.c */; }; + F362B9402B33920500D30B94 /* SDL_hidapi_steamdeck.c in Sources */ = {isa = PBXBuildFile; fileRef = F362B93B2B33920400D30B94 /* SDL_hidapi_steamdeck.c */; }; + F362B9412B33920500D30B94 /* SDL_hidapi_steamdeck.c in Sources */ = {isa = PBXBuildFile; fileRef = F362B93B2B33920400D30B94 /* SDL_hidapi_steamdeck.c */; }; + F362B9422B33920500D30B94 /* SDL_hidapi_steamdeck.c in Sources */ = {isa = PBXBuildFile; fileRef = F362B93B2B33920400D30B94 /* SDL_hidapi_steamdeck.c */; }; + F362B9432B33920500D30B94 /* SDL_hidapi_steamdeck.c in Sources */ = {isa = PBXBuildFile; fileRef = F362B93B2B33920400D30B94 /* SDL_hidapi_steamdeck.c */; }; + F362B9442B33920500D30B94 /* SDL_hidapi_steamdeck.c in Sources */ = {isa = PBXBuildFile; fileRef = F362B93B2B33920400D30B94 /* SDL_hidapi_steamdeck.c */; }; + F362B9452B33920500D30B94 /* SDL_hidapi_steamdeck.c in Sources */ = {isa = PBXBuildFile; fileRef = F362B93B2B33920400D30B94 /* SDL_hidapi_steamdeck.c */; }; + F362B9462B33920500D30B94 /* SDL_hidapi_nintendo.h in Headers */ = {isa = PBXBuildFile; fileRef = F362B93C2B33920400D30B94 /* SDL_hidapi_nintendo.h */; }; + F362B9472B33920500D30B94 /* SDL_hidapi_nintendo.h in Headers */ = {isa = PBXBuildFile; fileRef = F362B93C2B33920400D30B94 /* SDL_hidapi_nintendo.h */; }; + F362B9482B33920500D30B94 /* SDL_hidapi_nintendo.h in Headers */ = {isa = PBXBuildFile; fileRef = F362B93C2B33920400D30B94 /* SDL_hidapi_nintendo.h */; }; + F362B9492B33920500D30B94 /* SDL_hidapi_nintendo.h in Headers */ = {isa = PBXBuildFile; fileRef = F362B93C2B33920400D30B94 /* SDL_hidapi_nintendo.h */; }; + F362B94A2B33920500D30B94 /* SDL_hidapi_nintendo.h in Headers */ = {isa = PBXBuildFile; fileRef = F362B93C2B33920400D30B94 /* SDL_hidapi_nintendo.h */; }; + F362B94B2B33920500D30B94 /* SDL_hidapi_nintendo.h in Headers */ = {isa = PBXBuildFile; fileRef = F362B93C2B33920400D30B94 /* SDL_hidapi_nintendo.h */; }; + F362B94C2B33920500D30B94 /* SDL_hidapi_nintendo.h in Headers */ = {isa = PBXBuildFile; fileRef = F362B93C2B33920400D30B94 /* SDL_hidapi_nintendo.h */; }; + F362B94D2B33920500D30B94 /* SDL_hidapi_nintendo.h in Headers */ = {isa = PBXBuildFile; fileRef = F362B93C2B33920400D30B94 /* SDL_hidapi_nintendo.h */; }; + F362B94E2B33920500D30B94 /* SDL_hidapi_nintendo.h in Headers */ = {isa = PBXBuildFile; fileRef = F362B93C2B33920400D30B94 /* SDL_hidapi_nintendo.h */; }; + F362B9522B33EB7300D30B94 /* SDL_steam_virtual_gamepad.h in Headers */ = {isa = PBXBuildFile; fileRef = F362B9502B33EB7300D30B94 /* SDL_steam_virtual_gamepad.h */; }; + F362B9532B33EB7300D30B94 /* SDL_steam_virtual_gamepad.h in Headers */ = {isa = PBXBuildFile; fileRef = F362B9502B33EB7300D30B94 /* SDL_steam_virtual_gamepad.h */; }; + F362B9542B33EB7300D30B94 /* SDL_steam_virtual_gamepad.h in Headers */ = {isa = PBXBuildFile; fileRef = F362B9502B33EB7300D30B94 /* SDL_steam_virtual_gamepad.h */; }; + F362B9552B33EB7300D30B94 /* SDL_steam_virtual_gamepad.h in Headers */ = {isa = PBXBuildFile; fileRef = F362B9502B33EB7300D30B94 /* SDL_steam_virtual_gamepad.h */; }; + F362B9562B33EB7300D30B94 /* SDL_steam_virtual_gamepad.h in Headers */ = {isa = PBXBuildFile; fileRef = F362B9502B33EB7300D30B94 /* SDL_steam_virtual_gamepad.h */; }; + F362B9572B33EB7300D30B94 /* SDL_steam_virtual_gamepad.h in Headers */ = {isa = PBXBuildFile; fileRef = F362B9502B33EB7300D30B94 /* SDL_steam_virtual_gamepad.h */; }; + F362B9582B33EB7300D30B94 /* SDL_steam_virtual_gamepad.h in Headers */ = {isa = PBXBuildFile; fileRef = F362B9502B33EB7300D30B94 /* SDL_steam_virtual_gamepad.h */; }; + F362B9592B33EB7300D30B94 /* SDL_steam_virtual_gamepad.h in Headers */ = {isa = PBXBuildFile; fileRef = F362B9502B33EB7300D30B94 /* SDL_steam_virtual_gamepad.h */; }; + F362B95A2B33EB7300D30B94 /* SDL_steam_virtual_gamepad.h in Headers */ = {isa = PBXBuildFile; fileRef = F362B9502B33EB7300D30B94 /* SDL_steam_virtual_gamepad.h */; }; + F362B95B2B33EB7300D30B94 /* SDL_steam_virtual_gamepad.c in Sources */ = {isa = PBXBuildFile; fileRef = F362B9512B33EB7300D30B94 /* SDL_steam_virtual_gamepad.c */; }; + F362B95C2B33EB7300D30B94 /* SDL_steam_virtual_gamepad.c in Sources */ = {isa = PBXBuildFile; fileRef = F362B9512B33EB7300D30B94 /* SDL_steam_virtual_gamepad.c */; }; + F362B95D2B33EB7300D30B94 /* SDL_steam_virtual_gamepad.c in Sources */ = {isa = PBXBuildFile; fileRef = F362B9512B33EB7300D30B94 /* SDL_steam_virtual_gamepad.c */; }; + F362B95E2B33EB7300D30B94 /* SDL_steam_virtual_gamepad.c in Sources */ = {isa = PBXBuildFile; fileRef = F362B9512B33EB7300D30B94 /* SDL_steam_virtual_gamepad.c */; }; + F362B95F2B33EB7300D30B94 /* SDL_steam_virtual_gamepad.c in Sources */ = {isa = PBXBuildFile; fileRef = F362B9512B33EB7300D30B94 /* SDL_steam_virtual_gamepad.c */; }; + F362B9602B33EB7300D30B94 /* SDL_steam_virtual_gamepad.c in Sources */ = {isa = PBXBuildFile; fileRef = F362B9512B33EB7300D30B94 /* SDL_steam_virtual_gamepad.c */; }; + F362B9612B33EB7300D30B94 /* SDL_steam_virtual_gamepad.c in Sources */ = {isa = PBXBuildFile; fileRef = F362B9512B33EB7300D30B94 /* SDL_steam_virtual_gamepad.c */; }; + F362B9622B33EB7300D30B94 /* SDL_steam_virtual_gamepad.c in Sources */ = {isa = PBXBuildFile; fileRef = F362B9512B33EB7300D30B94 /* SDL_steam_virtual_gamepad.c */; }; + F362B9632B33EB7300D30B94 /* SDL_steam_virtual_gamepad.c in Sources */ = {isa = PBXBuildFile; fileRef = F362B9512B33EB7300D30B94 /* SDL_steam_virtual_gamepad.c */; }; F3631C6424884ACF004F28EA /* SDL_locale.h in Headers */ = {isa = PBXBuildFile; fileRef = 566E26792462701100718109 /* SDL_locale.h */; settings = {ATTRIBUTES = (Public, ); }; }; F3631C652488534E004F28EA /* SDL_locale.h in Headers */ = {isa = PBXBuildFile; fileRef = 566E26792462701100718109 /* SDL_locale.h */; settings = {ATTRIBUTES = (Public, ); }; }; F376F6192559B29300CFC0BC /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F376F6182559B29300CFC0BC /* OpenGLES.framework */; platformFilter = ios; }; @@ -3797,7 +3887,6 @@ A7D8A62523E2513D00DCD162 /* SDL_uikitvulkan.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDL_uikitvulkan.m; sourceTree = ""; }; A7D8A62623E2513D00DCD162 /* SDL_uikitmessagebox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_uikitmessagebox.h; sourceTree = ""; }; A7D8A62723E2513D00DCD162 /* SDL_uikitwindow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_uikitwindow.h; sourceTree = ""; }; - A7D8A62823E2513D00DCD162 /* keyinfotable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = keyinfotable.h; sourceTree = ""; }; A7D8A62923E2513D00DCD162 /* SDL_uikitview.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDL_uikitview.m; sourceTree = ""; }; A7D8A62A23E2513D00DCD162 /* SDL_uikitclipboard.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDL_uikitclipboard.m; sourceTree = ""; }; A7D8A62B23E2513D00DCD162 /* SDL_uikitopenglview.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_uikitopenglview.h; sourceTree = ""; }; @@ -3861,14 +3950,12 @@ A7D8A72F23E2513E00DCD162 /* vulkan_vi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = vulkan_vi.h; sourceTree = ""; }; A7D8A73023E2513E00DCD162 /* vulkan.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = vulkan.h; sourceTree = ""; }; A7D8A73123E2513E00DCD162 /* vk_platform.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = vk_platform.h; sourceTree = ""; }; - A7D8A73223E2513E00DCD162 /* vulkan.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = vulkan.hpp; sourceTree = ""; }; A7D8A73323E2513E00DCD162 /* vulkan_fuchsia.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = vulkan_fuchsia.h; sourceTree = ""; }; A7D8A73423E2513E00DCD162 /* vulkan_wayland.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = vulkan_wayland.h; sourceTree = ""; }; A7D8A73523E2513E00DCD162 /* vulkan_win32.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = vulkan_win32.h; sourceTree = ""; }; A7D8A73623E2513E00DCD162 /* vulkan_macos.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = vulkan_macos.h; sourceTree = ""; }; A7D8A73723E2513E00DCD162 /* vulkan_xlib_xrandr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = vulkan_xlib_xrandr.h; sourceTree = ""; }; A7D8A73823E2513E00DCD162 /* vulkan_xcb.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = vulkan_xcb.h; sourceTree = ""; }; - A7D8A73923E2513E00DCD162 /* vulkan_mir.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = vulkan_mir.h; sourceTree = ""; }; A7D8A73A23E2513E00DCD162 /* vulkan_xlib.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = vulkan_xlib.h; sourceTree = ""; }; A7D8A73B23E2513E00DCD162 /* vulkan_ios.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = vulkan_ios.h; sourceTree = ""; }; A7D8A73C23E2513E00DCD162 /* vulkan_core.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = vulkan_core.h; sourceTree = ""; }; @@ -3882,7 +3969,6 @@ A7D8A76923E2513E00DCD162 /* SDL_shape.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_shape.c; sourceTree = ""; }; A7D8A76A23E2513E00DCD162 /* SDL_yuv_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_yuv_c.h; sourceTree = ""; }; A7D8A76B23E2513E00DCD162 /* SDL_blit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_blit.h; sourceTree = ""; }; - A7D8A76E23E2513E00DCD162 /* yuv_rgb.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = yuv_rgb.c; sourceTree = ""; }; A7D8A77023E2513E00DCD162 /* yuv_rgb_sse_func.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = yuv_rgb_sse_func.h; sourceTree = ""; }; A7D8A77123E2513E00DCD162 /* yuv_rgb_std_func.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = yuv_rgb_std_func.h; sourceTree = ""; }; A7D8A77223E2513E00DCD162 /* yuv_rgb.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = yuv_rgb.h; sourceTree = ""; }; @@ -4104,9 +4190,23 @@ DB31407717554B71006C0E22 /* libSDL2.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libSDL2.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; E2D187CF28A5673500D2B4F1 /* SDL2.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SDL2.framework; sourceTree = BUILT_PRODUCTS_DIR; }; E2D187D228A5673500D2B4F1 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + F316AB7C2B5A02C2002EF551 /* yuv_rgb_common.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = yuv_rgb_common.h; sourceTree = ""; }; + F316AB7D2B5A02C2002EF551 /* yuv_rgb_internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = yuv_rgb_internal.h; sourceTree = ""; }; + F316AB7E2B5A02C3002EF551 /* yuv_rgb_std.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = yuv_rgb_std.c; sourceTree = ""; }; + F316AB7F2B5A02C3002EF551 /* yuv_rgb_sse.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = yuv_rgb_sse.c; sourceTree = ""; }; + F316AB802B5A02C3002EF551 /* yuv_rgb_lsx.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = yuv_rgb_lsx.h; sourceTree = ""; }; + F316AB812B5A02C3002EF551 /* yuv_rgb_lsx.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = yuv_rgb_lsx.c; sourceTree = ""; }; + F316AB822B5A02C3002EF551 /* yuv_rgb_sse.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = yuv_rgb_sse.h; sourceTree = ""; }; + F316AB832B5A02C3002EF551 /* yuv_rgb_std.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = yuv_rgb_std.h; sourceTree = ""; }; + F316AB842B5A02C3002EF551 /* yuv_rgb_lsx_func.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = yuv_rgb_lsx_func.h; sourceTree = ""; }; F31A92C628D4CB39003BFD6A /* SDL_offscreenopengles.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_offscreenopengles.h; sourceTree = ""; }; F31A92C728D4CB39003BFD6A /* SDL_offscreenopengles.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_offscreenopengles.c; sourceTree = ""; }; F32305FE28939F6400E66D30 /* SDL_hidapi_combined.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_hidapi_combined.c; sourceTree = ""; }; + F362B91F2B33916600D30B94 /* controller_list.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = controller_list.h; sourceTree = ""; }; + F362B93B2B33920400D30B94 /* SDL_hidapi_steamdeck.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_hidapi_steamdeck.c; sourceTree = ""; }; + F362B93C2B33920400D30B94 /* SDL_hidapi_nintendo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_hidapi_nintendo.h; sourceTree = ""; }; + F362B9502B33EB7300D30B94 /* SDL_steam_virtual_gamepad.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_steam_virtual_gamepad.h; sourceTree = ""; }; + F362B9512B33EB7300D30B94 /* SDL_steam_virtual_gamepad.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_steam_virtual_gamepad.c; sourceTree = ""; }; F376F6182559B29300CFC0BC /* OpenGLES.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGLES.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.1.sdk/System/Library/Frameworks/OpenGLES.framework; sourceTree = DEVELOPER_DIR; }; F376F61A2559B2AF00CFC0BC /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/iOSSupport/System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; F376F6312559B31D00CFC0BC /* GameController.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GameController.framework; path = System/iOSSupport/System/Library/Frameworks/GameController.framework; sourceTree = SDKROOT; }; @@ -4769,7 +4869,6 @@ A7D8A61823E2513D00DCD162 /* uikit */ = { isa = PBXGroup; children = ( - A7D8A62823E2513D00DCD162 /* keyinfotable.h */, A7D8A62F23E2513D00DCD162 /* SDL_uikitappdelegate.h */, A7D8A61E23E2513D00DCD162 /* SDL_uikitappdelegate.m */, A7D8A62123E2513D00DCD162 /* SDL_uikitclipboard.h */, @@ -4884,7 +4983,6 @@ A7D8A73323E2513E00DCD162 /* vulkan_fuchsia.h */, A7D8A73B23E2513E00DCD162 /* vulkan_ios.h */, A7D8A73623E2513E00DCD162 /* vulkan_macos.h */, - A7D8A73923E2513E00DCD162 /* vulkan_mir.h */, A7D8A72F23E2513E00DCD162 /* vulkan_vi.h */, A7D8A73423E2513E00DCD162 /* vulkan_wayland.h */, A7D8A73523E2513E00DCD162 /* vulkan_win32.h */, @@ -4892,7 +4990,6 @@ A7D8A73723E2513E00DCD162 /* vulkan_xlib_xrandr.h */, A7D8A73A23E2513E00DCD162 /* vulkan_xlib.h */, A7D8A73023E2513E00DCD162 /* vulkan.h */, - A7D8A73223E2513E00DCD162 /* vulkan.hpp */, ); path = vulkan; sourceTree = ""; @@ -4900,9 +4997,17 @@ A7D8A76C23E2513E00DCD162 /* yuv2rgb */ = { isa = PBXGroup; children = ( + F316AB7C2B5A02C2002EF551 /* yuv_rgb_common.h */, + F316AB7D2B5A02C2002EF551 /* yuv_rgb_internal.h */, + F316AB842B5A02C3002EF551 /* yuv_rgb_lsx_func.h */, + F316AB812B5A02C3002EF551 /* yuv_rgb_lsx.c */, + F316AB802B5A02C3002EF551 /* yuv_rgb_lsx.h */, A7D8A77023E2513E00DCD162 /* yuv_rgb_sse_func.h */, + F316AB7F2B5A02C3002EF551 /* yuv_rgb_sse.c */, + F316AB822B5A02C3002EF551 /* yuv_rgb_sse.h */, A7D8A77123E2513E00DCD162 /* yuv_rgb_std_func.h */, - A7D8A76E23E2513E00DCD162 /* yuv_rgb.c */, + F316AB7E2B5A02C3002EF551 /* yuv_rgb_std.c */, + F316AB832B5A02C3002EF551 /* yuv_rgb_std.h */, A7D8A77223E2513E00DCD162 /* yuv_rgb.h */, ); path = yuv2rgb; @@ -4950,12 +5055,15 @@ A7D8A7AA23E2513E00DCD162 /* iphoneos */, A7D8A7A123E2513E00DCD162 /* steam */, 75E09157241EA924004729E1 /* virtual */, - A7D8A7AD23E2513E00DCD162 /* SDL_gamecontroller.c */, - A7D8A7A923E2513E00DCD162 /* SDL_joystick.c */, + F362B91F2B33916600D30B94 /* controller_list.h */, F3820712284F3609004DD584 /* controller_type.c */, A7D8A7D923E2513E00DCD162 /* controller_type.h */, + A7D8A7AD23E2513E00DCD162 /* SDL_gamecontroller.c */, A7D8A79E23E2513E00DCD162 /* SDL_gamecontrollerdb.h */, A7D8A7D023E2513E00DCD162 /* SDL_joystick_c.h */, + A7D8A7A923E2513E00DCD162 /* SDL_joystick.c */, + F362B9512B33EB7300D30B94 /* SDL_steam_virtual_gamepad.c */, + F362B9502B33EB7300D30B94 /* SDL_steam_virtual_gamepad.h */, A7D8A7CF23E2513E00DCD162 /* SDL_sysjoystick.h */, A7D8A7CB23E2513E00DCD162 /* usb_ids.h */, ); @@ -4994,6 +5102,7 @@ F32305FE28939F6400E66D30 /* SDL_hidapi_combined.c */, A7D8A7C923E2513E00DCD162 /* SDL_hidapi_gamecube.c */, F3F07D59269640160074468B /* SDL_hidapi_luna.c */, + F362B93C2B33920400D30B94 /* SDL_hidapi_nintendo.h */, F388C95428B5F6F600661ECF /* SDL_hidapi_ps3.c */, A7D8A7C323E2513E00DCD162 /* SDL_hidapi_ps4.c */, F3A4909D2554D38500E92A8B /* SDL_hidapi_ps5.c */, @@ -5002,6 +5111,7 @@ 9846B07B287A9020000C35C8 /* SDL_hidapi_shield.c */, F3984CCF25BCC92800374F43 /* SDL_hidapi_stadia.c */, A75FDAAC23E2795C00529352 /* SDL_hidapi_steam.c */, + F362B93B2B33920400D30B94 /* SDL_hidapi_steamdeck.c */, A7D8A7C623E2513E00DCD162 /* SDL_hidapi_switch.c */, F3D60A8228C16A1800788A3A /* SDL_hidapi_wii.c */, A7D8A7C223E2513E00DCD162 /* SDL_hidapi_xbox360.c */, @@ -5393,6 +5503,7 @@ A75FCD0223E25AB700529352 /* close_code.h in Headers */, A75FCD0323E25AB700529352 /* SDL.h in Headers */, A75FCD0423E25AB700529352 /* SDL_uikitmetalview.h in Headers */, + F362B9592B33EB7300D30B94 /* SDL_steam_virtual_gamepad.h in Headers */, A75FCD0523E25AB700529352 /* SDL_assert.h in Headers */, A75FCD0623E25AB700529352 /* SDL_shape_internals.h in Headers */, A75FCD0723E25AB700529352 /* SDL_glfuncs.h in Headers */, @@ -5408,7 +5519,6 @@ A75FCD1023E25AB700529352 /* SDL_uikitview.h in Headers */, A75FCD1123E25AB700529352 /* SDL_bits.h in Headers */, A75FCD1223E25AB700529352 /* SDL_uikitappdelegate.h in Headers */, - A75FCD1323E25AB700529352 /* keyinfotable.h in Headers */, A75FCD1423E25AB700529352 /* SDL_blendmode.h in Headers */, A75FCD1523E25AB700529352 /* SDL_dropevents_c.h in Headers */, A75FCD1623E25AB700529352 /* SDL_haptic_c.h in Headers */, @@ -5456,6 +5566,7 @@ A75FCD4323E25AB700529352 /* SDL_keyboard.h in Headers */, A75FCD4423E25AB700529352 /* SDL_uikitevents.h in Headers */, A75FCD4523E25AB700529352 /* SDL_gesture_c.h in Headers */, + F362B9392B33916600D30B94 /* controller_list.h in Headers */, A75FCD4623E25AB700529352 /* SDL_shaders_gl.h in Headers */, A75FCD4723E25AB700529352 /* SDL_systhread_c.h in Headers */, A1BB8B7327F6CF330057CFA8 /* SDL_list.h in Headers */, @@ -5463,11 +5574,11 @@ 5616CA63252BB35F005D5928 /* SDL_sysurl.h in Headers */, A75FCD4A23E25AB700529352 /* SDL_cocoakeyboard.h in Headers */, A75FCD4B23E25AB700529352 /* SDL_uikitvulkan.h in Headers */, - A75FCD4E23E25AB700529352 /* vulkan.hpp in Headers */, A75FCD4F23E25AB700529352 /* SDL_loadso.h in Headers */, A75FCD5023E25AB700529352 /* gl2ext.h in Headers */, A75FCD5123E25AB700529352 /* SDL_clipboardevents_c.h in Headers */, A75FCD5323E25AB700529352 /* SDL_syshaptic_c.h in Headers */, + F316ABC22B5A02C3002EF551 /* yuv_rgb_sse.h in Headers */, A75FCD5423E25AB700529352 /* SDL_hints_c.h in Headers */, A75FCD5523E25AB700529352 /* SDL_audiodev_c.h in Headers */, A75FCD5623E25AB700529352 /* SDL_audio_c.h in Headers */, @@ -5481,6 +5592,7 @@ A75FCD5E23E25AB700529352 /* yuv_rgb_std_func.h in Headers */, A75FCD5F23E25AB700529352 /* vulkan_core.h in Headers */, A75FCD6023E25AB700529352 /* SDL_syssensor.h in Headers */, + F316ABD42B5A02C3002EF551 /* yuv_rgb_lsx_func.h in Headers */, A75FCD6123E25AB700529352 /* SDL_dynapi.h in Headers */, A75FCD6223E25AB700529352 /* SDL_assert_c.h in Headers */, A75FCD6323E25AB700529352 /* SDL_diskaudio.h in Headers */, @@ -5490,6 +5602,7 @@ A75FCD6723E25AB700529352 /* SDL_wave.h in Headers */, A75FCD6823E25AB700529352 /* SDL_cocoaopengl.h in Headers */, A75FCD6923E25AB700529352 /* yuv_rgb_sse_func.h in Headers */, + F316ABCB2B5A02C3002EF551 /* yuv_rgb_std.h in Headers */, A75FCD6B23E25AB700529352 /* SDL_offscreenevents_c.h in Headers */, F3973FA928A59BDD00B84553 /* SDL_vacopy.h in Headers */, A1626A592617008D003F1973 /* SDL_triangle.h in Headers */, @@ -5513,6 +5626,8 @@ A75FCD7F23E25AB700529352 /* SDL_opengles.h in Headers */, A75FCD8023E25AB700529352 /* SDL_shaders_gles2.h in Headers */, A75FCD8123E25AB700529352 /* SDL_opengles2.h in Headers */, + F316AB8C2B5A02C3002EF551 /* yuv_rgb_common.h in Headers */, + F316ABB02B5A02C3002EF551 /* yuv_rgb_lsx.h in Headers */, A75FCD8223E25AB700529352 /* SDL_glesfuncs.h in Headers */, A75FCD8323E25AB700529352 /* SDL_blendpoint.h in Headers */, A75FCD8423E25AB700529352 /* SDL_offscreenvideo.h in Headers */, @@ -5542,7 +5657,6 @@ A75FCDA123E25AB700529352 /* vulkan_xlib.h in Headers */, A75FCDA223E25AB700529352 /* SDL_uikitwindow.h in Headers */, A75FCDA323E25AB700529352 /* vulkan_vi.h in Headers */, - A75FCDA423E25AB700529352 /* vulkan_mir.h in Headers */, A75FCDA523E25AB700529352 /* SDL_quit.h in Headers */, A75FCDA623E25AB700529352 /* default_cursor.h in Headers */, A75FCDA723E25AB700529352 /* SDL_render_sw_c.h in Headers */, @@ -5602,11 +5716,13 @@ A75FCDDE23E25AB700529352 /* SDL_video.h in Headers */, A75FCDDF23E25AB700529352 /* SDL_opengles2_gl2.h in Headers */, A75FCDE023E25AB700529352 /* SDL_sensor.h in Headers */, + F362B94D2B33920500D30B94 /* SDL_hidapi_nintendo.h in Headers */, A75FCDE123E25AB700529352 /* SDL_sysvideo.h in Headers */, F386F6EE2884663E001840AA /* SDL_log_c.h in Headers */, A75FCDE223E25AB700529352 /* SDL_opengles2_gl2platform.h in Headers */, A75FCDE323E25AB700529352 /* SDL_opengles2_gl2ext.h in Headers */, A75FCDE523E25AB700529352 /* SDL_dynapi_overrides.h in Headers */, + F316AB952B5A02C3002EF551 /* yuv_rgb_internal.h in Headers */, A75FCDE623E25AB700529352 /* SDL_cocoawindow.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; @@ -5622,6 +5738,7 @@ A75FCEBB23E25AC700529352 /* close_code.h in Headers */, A75FCEBC23E25AC700529352 /* SDL.h in Headers */, A75FCEBD23E25AC700529352 /* SDL_uikitmetalview.h in Headers */, + F362B95A2B33EB7300D30B94 /* SDL_steam_virtual_gamepad.h in Headers */, A75FCEBE23E25AC700529352 /* SDL_assert.h in Headers */, A75FCEBF23E25AC700529352 /* SDL_shape_internals.h in Headers */, A75FCEC023E25AC700529352 /* SDL_glfuncs.h in Headers */, @@ -5637,7 +5754,6 @@ A75FCEC923E25AC700529352 /* SDL_uikitview.h in Headers */, A75FCECA23E25AC700529352 /* SDL_bits.h in Headers */, A75FCECB23E25AC700529352 /* SDL_uikitappdelegate.h in Headers */, - A75FCECC23E25AC700529352 /* keyinfotable.h in Headers */, A75FCECD23E25AC700529352 /* SDL_blendmode.h in Headers */, A75FCECE23E25AC700529352 /* SDL_dropevents_c.h in Headers */, A75FCECF23E25AC700529352 /* SDL_haptic_c.h in Headers */, @@ -5685,6 +5801,7 @@ A75FCEFC23E25AC700529352 /* SDL_keyboard.h in Headers */, A75FCEFD23E25AC700529352 /* SDL_uikitevents.h in Headers */, A75FCEFE23E25AC700529352 /* SDL_gesture_c.h in Headers */, + F362B93A2B33916600D30B94 /* controller_list.h in Headers */, A75FCEFF23E25AC700529352 /* SDL_shaders_gl.h in Headers */, A75FCF0023E25AC700529352 /* SDL_systhread_c.h in Headers */, A1BB8B7427F6CF330057CFA8 /* SDL_list.h in Headers */, @@ -5692,11 +5809,11 @@ 5616CA66252BB361005D5928 /* SDL_sysurl.h in Headers */, A75FCF0323E25AC700529352 /* SDL_cocoakeyboard.h in Headers */, A75FCF0423E25AC700529352 /* SDL_uikitvulkan.h in Headers */, - A75FCF0723E25AC700529352 /* vulkan.hpp in Headers */, A75FCF0823E25AC700529352 /* SDL_loadso.h in Headers */, A75FCF0923E25AC700529352 /* gl2ext.h in Headers */, A75FCF0A23E25AC700529352 /* SDL_clipboardevents_c.h in Headers */, A75FCF0C23E25AC700529352 /* SDL_syshaptic_c.h in Headers */, + F316ABC32B5A02C3002EF551 /* yuv_rgb_sse.h in Headers */, A75FCF0D23E25AC700529352 /* SDL_hints_c.h in Headers */, A75FCF0E23E25AC700529352 /* SDL_audiodev_c.h in Headers */, A75FCF0F23E25AC700529352 /* SDL_audio_c.h in Headers */, @@ -5710,6 +5827,7 @@ A75FCF1723E25AC700529352 /* yuv_rgb_std_func.h in Headers */, A75FCF1823E25AC700529352 /* vulkan_core.h in Headers */, A75FCF1923E25AC700529352 /* SDL_syssensor.h in Headers */, + F316ABD52B5A02C3002EF551 /* yuv_rgb_lsx_func.h in Headers */, A75FCF1A23E25AC700529352 /* SDL_dynapi.h in Headers */, A75FCF1B23E25AC700529352 /* SDL_assert_c.h in Headers */, A75FCF1C23E25AC700529352 /* SDL_diskaudio.h in Headers */, @@ -5719,6 +5837,7 @@ A75FCF2023E25AC700529352 /* SDL_wave.h in Headers */, A75FCF2123E25AC700529352 /* SDL_cocoaopengl.h in Headers */, A75FCF2223E25AC700529352 /* yuv_rgb_sse_func.h in Headers */, + F316ABCC2B5A02C3002EF551 /* yuv_rgb_std.h in Headers */, A75FCF2423E25AC700529352 /* SDL_offscreenevents_c.h in Headers */, F3973FAA28A59BDD00B84553 /* SDL_vacopy.h in Headers */, A1626A5A2617008D003F1973 /* SDL_triangle.h in Headers */, @@ -5742,6 +5861,8 @@ A75FCF3823E25AC700529352 /* SDL_opengles.h in Headers */, A75FCF3923E25AC700529352 /* SDL_shaders_gles2.h in Headers */, A75FCF3A23E25AC700529352 /* SDL_opengles2.h in Headers */, + F316AB8D2B5A02C3002EF551 /* yuv_rgb_common.h in Headers */, + F316ABB12B5A02C3002EF551 /* yuv_rgb_lsx.h in Headers */, A75FCF3B23E25AC700529352 /* SDL_glesfuncs.h in Headers */, A75FCF3C23E25AC700529352 /* SDL_blendpoint.h in Headers */, A75FCF3D23E25AC700529352 /* SDL_offscreenvideo.h in Headers */, @@ -5771,7 +5892,6 @@ A75FCF5A23E25AC700529352 /* vulkan_xlib.h in Headers */, A75FCF5B23E25AC700529352 /* SDL_uikitwindow.h in Headers */, A75FCF5C23E25AC700529352 /* vulkan_vi.h in Headers */, - A75FCF5D23E25AC700529352 /* vulkan_mir.h in Headers */, A75FCF5E23E25AC700529352 /* SDL_quit.h in Headers */, A75FCF5F23E25AC700529352 /* default_cursor.h in Headers */, A75FCF6023E25AC700529352 /* SDL_render_sw_c.h in Headers */, @@ -5831,11 +5951,13 @@ A75FCF9723E25AC700529352 /* SDL_video.h in Headers */, A75FCF9823E25AC700529352 /* SDL_opengles2_gl2.h in Headers */, A75FCF9923E25AC700529352 /* SDL_sensor.h in Headers */, + F362B94E2B33920500D30B94 /* SDL_hidapi_nintendo.h in Headers */, A75FCF9A23E25AC700529352 /* SDL_sysvideo.h in Headers */, F386F6EF2884663E001840AA /* SDL_log_c.h in Headers */, A75FCF9B23E25AC700529352 /* SDL_opengles2_gl2platform.h in Headers */, A75FCF9C23E25AC700529352 /* SDL_opengles2_gl2ext.h in Headers */, A75FCF9E23E25AC700529352 /* SDL_dynapi_overrides.h in Headers */, + F316AB962B5A02C3002EF551 /* yuv_rgb_internal.h in Headers */, A75FCF9F23E25AC700529352 /* SDL_cocoawindow.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; @@ -5856,7 +5978,6 @@ A769B09623E259AE00872273 /* SDL_coremotionsensor.h in Headers */, A769B09723E259AE00872273 /* SDL_uikitview.h in Headers */, A769B09923E259AE00872273 /* SDL_uikitappdelegate.h in Headers */, - A769B09A23E259AE00872273 /* keyinfotable.h in Headers */, A769B09C23E259AE00872273 /* SDL_dropevents_c.h in Headers */, A769B09D23E259AE00872273 /* SDL_haptic_c.h in Headers */, A769B09F23E259AE00872273 /* SDL_dataqueue.h in Headers */, @@ -5880,6 +6001,7 @@ A769B0BC23E259AE00872273 /* SDL_sysaudio.h in Headers */, A769B0BF23E259AE00872273 /* math_libm.h in Headers */, A769B0C023E259AE00872273 /* SDL_uikitvideo.h in Headers */, + F316ABC02B5A02C3002EF551 /* yuv_rgb_sse.h in Headers */, A769B0C123E259AE00872273 /* SDL_cocoamouse.h in Headers */, A769B0C323E259AE00872273 /* SDL_blit_slow.h in Headers */, F3973FA728A59BDD00B84553 /* SDL_vacopy.h in Headers */, @@ -5895,7 +6017,6 @@ A769B0D023E259AE00872273 /* SDL_cocoakeyboard.h in Headers */, 5616CA5D252BB35E005D5928 /* SDL_sysurl.h in Headers */, A769B0D123E259AE00872273 /* SDL_uikitvulkan.h in Headers */, - A769B0D423E259AE00872273 /* vulkan.hpp in Headers */, A769B0D623E259AE00872273 /* gl2ext.h in Headers */, A769B0D723E259AE00872273 /* SDL_clipboardevents_c.h in Headers */, A769B0D923E259AE00872273 /* SDL_syshaptic_c.h in Headers */, @@ -5911,13 +6032,16 @@ A769B0E523E259AE00872273 /* vulkan_android.h in Headers */, A769B0E623E259AE00872273 /* yuv_rgb_std_func.h in Headers */, A769B0E723E259AE00872273 /* vulkan_core.h in Headers */, + F362B9572B33EB7300D30B94 /* SDL_steam_virtual_gamepad.h in Headers */, A769B0E823E259AE00872273 /* SDL_syssensor.h in Headers */, + F316AB8A2B5A02C3002EF551 /* yuv_rgb_common.h in Headers */, A769B0E923E259AE00872273 /* SDL_dynapi.h in Headers */, A769B0EA23E259AE00872273 /* SDL_assert_c.h in Headers */, A769B0EB23E259AE00872273 /* SDL_diskaudio.h in Headers */, A769B0ED23E259AE00872273 /* SDL_drawpoint.h in Headers */, A769B0EF23E259AE00872273 /* SDL_wave.h in Headers */, A769B0F023E259AE00872273 /* SDL_cocoaopengl.h in Headers */, + F316ABC92B5A02C3002EF551 /* yuv_rgb_std.h in Headers */, A1626A572617008D003F1973 /* SDL_triangle.h in Headers */, A769B0F123E259AE00872273 /* yuv_rgb_sse_func.h in Headers */, A769B0F323E259AE00872273 /* SDL_offscreenevents_c.h in Headers */, @@ -5938,9 +6062,11 @@ A769B10A23E259AE00872273 /* SDL_blendpoint.h in Headers */, A769B10B23E259AE00872273 /* SDL_offscreenvideo.h in Headers */, A769B10C23E259AE00872273 /* SDL_nullevents_c.h in Headers */, + F316ABD22B5A02C3002EF551 /* yuv_rgb_lsx_func.h in Headers */, A769B10D23E259AE00872273 /* SDL_sysjoystick.h in Headers */, A769B10E23E259AE00872273 /* scancodes_linux.h in Headers */, A769B11023E259AE00872273 /* SDL_touch_c.h in Headers */, + F362B94B2B33920500D30B94 /* SDL_hidapi_nintendo.h in Headers */, A769B11123E259AE00872273 /* SDL_gamecontrollerdb.h in Headers */, A769B11223E259AE00872273 /* SDL_cocoavulkan.h in Headers */, A769B11323E259AE00872273 /* gl2platform.h in Headers */, @@ -5952,6 +6078,7 @@ A769B11D23E259AE00872273 /* vulkan_xlib_xrandr.h in Headers */, A769B11E23E259AE00872273 /* SDL_sensor_c.h in Headers */, A769B11F23E259AE00872273 /* SDL_sysrender.h in Headers */, + F316AB932B5A02C3002EF551 /* yuv_rgb_internal.h in Headers */, A769B12023E259AE00872273 /* SDL_rotate.h in Headers */, A769B12523E259AE00872273 /* scancodes_darwin.h in Headers */, A769B12623E259AE00872273 /* controller_type.h in Headers */, @@ -5960,7 +6087,6 @@ F386F6F52884663E001840AA /* SDL_utils_c.h in Headers */, A769B12A23E259AE00872273 /* SDL_uikitwindow.h in Headers */, A769B12B23E259AE00872273 /* vulkan_vi.h in Headers */, - A769B12C23E259AE00872273 /* vulkan_mir.h in Headers */, A769B12E23E259AE00872273 /* default_cursor.h in Headers */, A769B12F23E259AE00872273 /* SDL_render_sw_c.h in Headers */, A769B13223E259AE00872273 /* SDL_nullvideo.h in Headers */, @@ -5997,11 +6123,13 @@ A769B15623E259AE00872273 /* SDL_syshaptic.h in Headers */, A769B15723E259AE00872273 /* SDL_vulkan_internal.h in Headers */, A769B15923E259AE00872273 /* SDL_cocoaevents.h in Headers */, + F362B9372B33916600D30B94 /* controller_list.h in Headers */, A769B15A23E259AE00872273 /* vk_icd.h in Headers */, A769B15B23E259AE00872273 /* SDL_nullframebuffer_c.h in Headers */, A769B15D23E259AE00872273 /* SDL_dynapi_procs.h in Headers */, A769B15E23E259AE00872273 /* vulkan_fuchsia.h in Headers */, A769B16123E259AE00872273 /* usb_ids.h in Headers */, + F316ABAE2B5A02C3002EF551 /* yuv_rgb_lsx.h in Headers */, A769B16323E259AE00872273 /* SDL_gles2funcs.h in Headers */, A769B16923E259AE00872273 /* SDL_sysvideo.h in Headers */, A769B16D23E259AE00872273 /* SDL_dynapi_overrides.h in Headers */, @@ -6024,6 +6152,7 @@ A7D88A1E23E2437C00DCD162 /* SDL_bits.h in Headers */, A7D8BA0223E2514400DCD162 /* SDL_blendfillrect.h in Headers */, A7D8B9EA23E2514400DCD162 /* SDL_blendline.h in Headers */, + F316ABC52B5A02C3002EF551 /* yuv_rgb_std.h in Headers */, A7D88A1F23E2437C00DCD162 /* SDL_blendmode.h in Headers */, A7D8BA0E23E2514400DCD162 /* SDL_blendpoint.h in Headers */, A7D8B3B723E2514200DCD162 /* SDL_blit.h in Headers */, @@ -6059,6 +6188,7 @@ A7D8BB4023E2514500DCD162 /* SDL_displayevents_c.h in Headers */, A7D8BA1A23E2514400DCD162 /* SDL_draw.h in Headers */, A7D8BA0823E2514400DCD162 /* SDL_drawline.h in Headers */, + F316ABBC2B5A02C3002EF551 /* yuv_rgb_sse.h in Headers */, A7D8B9F023E2514400DCD162 /* SDL_drawpoint.h in Headers */, A7D8BB2E23E2514500DCD162 /* SDL_dropevents_c.h in Headers */, A7D8B79523E2514400DCD162 /* SDL_dummyaudio.h in Headers */, @@ -6083,14 +6213,17 @@ A7D8BA7A23E2514400DCD162 /* SDL_glfuncs.h in Headers */, A7D88A2D23E2437C00DCD162 /* SDL_haptic.h in Headers */, A7D8AABD23E2514100DCD162 /* SDL_haptic_c.h in Headers */, + F316AB8F2B5A02C3002EF551 /* yuv_rgb_internal.h in Headers */, A75FDBC623EA380300529352 /* SDL_hidapi_rumble.h in Headers */, A7D8B55823E2514300DCD162 /* SDL_hidapijoystick_c.h in Headers */, A7D88A2E23E2437C00DCD162 /* SDL_hints.h in Headers */, A7D8B94B23E2514400DCD162 /* SDL_hints_c.h in Headers */, + F316ABCE2B5A02C3002EF551 /* yuv_rgb_lsx_func.h in Headers */, A7D8A99A23E2514000DCD162 /* SDL_internal.h in Headers */, F395C1942569C68F00942BFF /* SDL_iokitjoystick_c.h in Headers */, A7D88A2F23E2437C00DCD162 /* SDL_joystick.h in Headers */, A7D8B58823E2514300DCD162 /* SDL_joystick_c.h in Headers */, + F316AB862B5A02C3002EF551 /* yuv_rgb_common.h in Headers */, A7D88A3023E2437C00DCD162 /* SDL_keyboard.h in Headers */, A7D8BB8823E2514500DCD162 /* SDL_keyboard_c.h in Headers */, A7D88A3323E2437C00DCD162 /* SDL_keycode.h in Headers */, @@ -6161,6 +6294,8 @@ A7D8B5D623E2514300DCD162 /* SDL_syspower.h in Headers */, A7D8B61223E2514300DCD162 /* SDL_syspower.h in Headers */, A7D8B9D823E2514400DCD162 /* SDL_sysrender.h in Headers */, + F362B9472B33920500D30B94 /* SDL_hidapi_nintendo.h in Headers */, + F316ABAA2B5A02C3002EF551 /* yuv_rgb_lsx.h in Headers */, A7D8A97C23E2514000DCD162 /* SDL_syssensor.h in Headers */, A7D88A5323E2437C00DCD162 /* SDL_system.h in Headers */, A7D8B3E723E2514300DCD162 /* SDL_systhread.h in Headers */, @@ -6199,6 +6334,7 @@ A7D8B9CC23E2514400DCD162 /* SDL_yuv_sw_c.h in Headers */, A7D88A1623E2437C00DCD162 /* begin_code.h in Headers */, A7D8BB4623E2514500DCD162 /* blank_cursor.h in Headers */, + F362B9532B33EB7300D30B94 /* SDL_steam_virtual_gamepad.h in Headers */, A7D88A1823E2437C00DCD162 /* close_code.h in Headers */, A7D8B5B823E2514300DCD162 /* controller_type.h in Headers */, A7D8BB4C23E2514500DCD162 /* default_cursor.h in Headers */, @@ -6209,7 +6345,6 @@ A7D8B22523E2514200DCD162 /* gl2ext.h in Headers */, A7D8B23123E2514200DCD162 /* gl2platform.h in Headers */, A75FDB5923E39E6100529352 /* hidapi.h in Headers */, - A7D8ACA023E2514100DCD162 /* keyinfotable.h in Headers */, A7D8B23723E2514200DCD162 /* khrplatform.h in Headers */, A7D8BB0423E2514500DCD162 /* math_libm.h in Headers */, A7D8BAC223E2514500DCD162 /* math_private.h in Headers */, @@ -6224,16 +6359,15 @@ A7D8B26723E2514200DCD162 /* vk_platform.h in Headers */, A7D8B2AF23E2514200DCD162 /* vk_sdk_platform.h in Headers */, A7D8B26123E2514200DCD162 /* vulkan.h in Headers */, - A7D8B26D23E2514200DCD162 /* vulkan.hpp in Headers */, A7D8B2B523E2514200DCD162 /* vulkan_android.h in Headers */, A7D8B2A923E2514200DCD162 /* vulkan_core.h in Headers */, A7D8B27323E2514200DCD162 /* vulkan_fuchsia.h in Headers */, A7D8B2A323E2514200DCD162 /* vulkan_ios.h in Headers */, A7D8B28523E2514200DCD162 /* vulkan_macos.h in Headers */, - A7D8B29723E2514200DCD162 /* vulkan_mir.h in Headers */, A7D8B25B23E2514200DCD162 /* vulkan_vi.h in Headers */, A7D8B27923E2514200DCD162 /* vulkan_wayland.h in Headers */, A7D8B27F23E2514200DCD162 /* vulkan_win32.h in Headers */, + F362B9332B33916600D30B94 /* controller_list.h in Headers */, A7D8B29123E2514200DCD162 /* vulkan_xcb.h in Headers */, A7D8B29D23E2514200DCD162 /* vulkan_xlib.h in Headers */, A7D8B28B23E2514200DCD162 /* vulkan_xlib_xrandr.h in Headers */, @@ -6258,6 +6392,7 @@ A7D88BD523E24BED00DCD162 /* SDL_bits.h in Headers */, A7D8BA0323E2514400DCD162 /* SDL_blendfillrect.h in Headers */, A7D8B9EB23E2514400DCD162 /* SDL_blendline.h in Headers */, + F316ABC62B5A02C3002EF551 /* yuv_rgb_std.h in Headers */, A7D88BD623E24BED00DCD162 /* SDL_blendmode.h in Headers */, A7D8BA0F23E2514400DCD162 /* SDL_blendpoint.h in Headers */, A7D8B3B823E2514200DCD162 /* SDL_blit.h in Headers */, @@ -6293,6 +6428,7 @@ A7D8BB4123E2514500DCD162 /* SDL_displayevents_c.h in Headers */, A7D8BA1B23E2514400DCD162 /* SDL_draw.h in Headers */, A7D8BA0923E2514400DCD162 /* SDL_drawline.h in Headers */, + F316ABBD2B5A02C3002EF551 /* yuv_rgb_sse.h in Headers */, A7D8B9F123E2514400DCD162 /* SDL_drawpoint.h in Headers */, A7D8BB2F23E2514500DCD162 /* SDL_dropevents_c.h in Headers */, A7D8B79623E2514400DCD162 /* SDL_dummyaudio.h in Headers */, @@ -6317,14 +6453,17 @@ A7D8BA7B23E2514400DCD162 /* SDL_glfuncs.h in Headers */, A7D88BE423E24BED00DCD162 /* SDL_haptic.h in Headers */, A7D8AABE23E2514100DCD162 /* SDL_haptic_c.h in Headers */, + F316AB902B5A02C3002EF551 /* yuv_rgb_internal.h in Headers */, A75FDBC723EA380300529352 /* SDL_hidapi_rumble.h in Headers */, A7D8B55923E2514300DCD162 /* SDL_hidapijoystick_c.h in Headers */, A7D88BE523E24BED00DCD162 /* SDL_hints.h in Headers */, A7D8B94C23E2514400DCD162 /* SDL_hints_c.h in Headers */, + F316ABCF2B5A02C3002EF551 /* yuv_rgb_lsx_func.h in Headers */, A7D8A99B23E2514000DCD162 /* SDL_internal.h in Headers */, F395C1952569C68F00942BFF /* SDL_iokitjoystick_c.h in Headers */, A7D88BE623E24BED00DCD162 /* SDL_joystick.h in Headers */, A7D8B58923E2514300DCD162 /* SDL_joystick_c.h in Headers */, + F316AB872B5A02C3002EF551 /* yuv_rgb_common.h in Headers */, A7D88BE723E24BED00DCD162 /* SDL_keyboard.h in Headers */, A7D8BB8923E2514500DCD162 /* SDL_keyboard_c.h in Headers */, A7D88BEB23E24BED00DCD162 /* SDL_keycode.h in Headers */, @@ -6395,6 +6534,8 @@ A7D8B5D723E2514300DCD162 /* SDL_syspower.h in Headers */, A7D8B61323E2514300DCD162 /* SDL_syspower.h in Headers */, A7D8B9D923E2514400DCD162 /* SDL_sysrender.h in Headers */, + F362B9482B33920500D30B94 /* SDL_hidapi_nintendo.h in Headers */, + F316ABAB2B5A02C3002EF551 /* yuv_rgb_lsx.h in Headers */, A7D8A97D23E2514000DCD162 /* SDL_syssensor.h in Headers */, A7D88C0E23E24BED00DCD162 /* SDL_system.h in Headers */, A7D8B3E823E2514300DCD162 /* SDL_systhread.h in Headers */, @@ -6433,6 +6574,7 @@ A7D8B9CD23E2514400DCD162 /* SDL_yuv_sw_c.h in Headers */, A7D88BCC23E24BED00DCD162 /* begin_code.h in Headers */, A7D8BB4723E2514500DCD162 /* blank_cursor.h in Headers */, + F362B9542B33EB7300D30B94 /* SDL_steam_virtual_gamepad.h in Headers */, A7D88BCE23E24BED00DCD162 /* close_code.h in Headers */, A7D8B5B923E2514300DCD162 /* controller_type.h in Headers */, A7D8BB4D23E2514500DCD162 /* default_cursor.h in Headers */, @@ -6443,7 +6585,6 @@ A7D8B22623E2514200DCD162 /* gl2ext.h in Headers */, A7D8B23223E2514200DCD162 /* gl2platform.h in Headers */, A75FDB5A23E39E6100529352 /* hidapi.h in Headers */, - A7D8ACA123E2514100DCD162 /* keyinfotable.h in Headers */, A7D8B23823E2514200DCD162 /* khrplatform.h in Headers */, A7D8BB0523E2514500DCD162 /* math_libm.h in Headers */, A7D8BAC323E2514500DCD162 /* math_private.h in Headers */, @@ -6458,16 +6599,15 @@ A7D8B26823E2514200DCD162 /* vk_platform.h in Headers */, A7D8B2B023E2514200DCD162 /* vk_sdk_platform.h in Headers */, A7D8B26223E2514200DCD162 /* vulkan.h in Headers */, - A7D8B26E23E2514200DCD162 /* vulkan.hpp in Headers */, A7D8B2B623E2514200DCD162 /* vulkan_android.h in Headers */, A7D8B2AA23E2514200DCD162 /* vulkan_core.h in Headers */, A7D8B27423E2514200DCD162 /* vulkan_fuchsia.h in Headers */, A7D8B2A423E2514200DCD162 /* vulkan_ios.h in Headers */, A7D8B28623E2514200DCD162 /* vulkan_macos.h in Headers */, - A7D8B29823E2514200DCD162 /* vulkan_mir.h in Headers */, A7D8B25C23E2514200DCD162 /* vulkan_vi.h in Headers */, A7D8B27A23E2514200DCD162 /* vulkan_wayland.h in Headers */, A7D8B28023E2514200DCD162 /* vulkan_win32.h in Headers */, + F362B9342B33916600D30B94 /* controller_list.h in Headers */, A7D8B29223E2514200DCD162 /* vulkan_xcb.h in Headers */, A7D8B29E23E2514200DCD162 /* vulkan_xlib.h in Headers */, A7D8B28C23E2514200DCD162 /* vulkan_xlib_xrandr.h in Headers */, @@ -6493,7 +6633,6 @@ A7D8A97323E2514000DCD162 /* SDL_coremotionsensor.h in Headers */, A7D8AC4923E2514100DCD162 /* SDL_uikitview.h in Headers */, A7D8ACCD23E2514100DCD162 /* SDL_uikitappdelegate.h in Headers */, - A7D8ACA323E2514100DCD162 /* keyinfotable.h in Headers */, A7D8BB3123E2514500DCD162 /* SDL_dropevents_c.h in Headers */, A7D8AAC023E2514100DCD162 /* SDL_haptic_c.h in Headers */, A7D8A94923E2514000DCD162 /* SDL_dataqueue.h in Headers */, @@ -6517,6 +6656,7 @@ A7D8B85E23E2514400DCD162 /* SDL_sysaudio.h in Headers */, A7D8BB0723E2514500DCD162 /* math_libm.h in Headers */, A7D8AC7F23E2514100DCD162 /* SDL_uikitvideo.h in Headers */, + F316ABBF2B5A02C3002EF551 /* yuv_rgb_sse.h in Headers */, A7D8AF2223E2514100DCD162 /* SDL_cocoamouse.h in Headers */, A7D8ADF023E2514100DCD162 /* SDL_blit_slow.h in Headers */, F3973FA628A59BDD00B84553 /* SDL_vacopy.h in Headers */, @@ -6532,7 +6672,6 @@ A7D8AE9223E2514100DCD162 /* SDL_cocoakeyboard.h in Headers */, 5616CA5A252BB35D005D5928 /* SDL_sysurl.h in Headers */, A7D8ACE523E2514100DCD162 /* SDL_uikitvulkan.h in Headers */, - A7D8B27023E2514200DCD162 /* vulkan.hpp in Headers */, A7D8B22823E2514200DCD162 /* gl2ext.h in Headers */, A7D8BB7323E2514500DCD162 /* SDL_clipboardevents_c.h in Headers */, A7D8AAE423E2514100DCD162 /* SDL_syshaptic_c.h in Headers */, @@ -6548,13 +6687,16 @@ A7D8B2B823E2514200DCD162 /* vulkan_android.h in Headers */, A7D8B3D223E2514300DCD162 /* yuv_rgb_std_func.h in Headers */, A7D8B2AC23E2514200DCD162 /* vulkan_core.h in Headers */, + F362B9562B33EB7300D30B94 /* SDL_steam_virtual_gamepad.h in Headers */, A7D8A97F23E2514000DCD162 /* SDL_syssensor.h in Headers */, + F316AB892B5A02C3002EF551 /* yuv_rgb_common.h in Headers */, A7D8AB0E23E2514100DCD162 /* SDL_dynapi.h in Headers */, A7D8B61B23E2514300DCD162 /* SDL_assert_c.h in Headers */, A7D8B8A623E2514400DCD162 /* SDL_diskaudio.h in Headers */, A7D8B9F323E2514400DCD162 /* SDL_drawpoint.h in Headers */, A7D8B87023E2514400DCD162 /* SDL_wave.h in Headers */, A7D8AEE023E2514100DCD162 /* SDL_cocoaopengl.h in Headers */, + F316ABC82B5A02C3002EF551 /* yuv_rgb_std.h in Headers */, A1626A562617008D003F1973 /* SDL_triangle.h in Headers */, A7D8B3CC23E2514300DCD162 /* yuv_rgb_sse_func.h in Headers */, A7D8AB5F23E2514100DCD162 /* SDL_offscreenevents_c.h in Headers */, @@ -6575,9 +6717,11 @@ A7D8BA1123E2514400DCD162 /* SDL_blendpoint.h in Headers */, A7D8AB7123E2514100DCD162 /* SDL_offscreenvideo.h in Headers */, A7D8AC0123E2514100DCD162 /* SDL_nullevents_c.h in Headers */, + F316ABD12B5A02C3002EF551 /* yuv_rgb_lsx_func.h in Headers */, A7D8B58523E2514300DCD162 /* SDL_sysjoystick.h in Headers */, A7D8BB6123E2514500DCD162 /* scancodes_linux.h in Headers */, A7D8BB6723E2514500DCD162 /* SDL_touch_c.h in Headers */, + F362B94A2B33920500D30B94 /* SDL_hidapi_nintendo.h in Headers */, A7D8B4B023E2514300DCD162 /* SDL_gamecontrollerdb.h in Headers */, A7D8AEEC23E2514100DCD162 /* SDL_cocoavulkan.h in Headers */, A7D8B23423E2514200DCD162 /* gl2platform.h in Headers */, @@ -6589,6 +6733,7 @@ A7D8B28E23E2514200DCD162 /* vulkan_xlib_xrandr.h in Headers */, A7D8A99123E2514000DCD162 /* SDL_sensor_c.h in Headers */, A7D8B9DB23E2514400DCD162 /* SDL_sysrender.h in Headers */, + F316AB922B5A02C3002EF551 /* yuv_rgb_internal.h in Headers */, A7D8BA3523E2514400DCD162 /* SDL_rotate.h in Headers */, A7D8BB5523E2514500DCD162 /* scancodes_darwin.h in Headers */, A7D8B5BB23E2514300DCD162 /* controller_type.h in Headers */, @@ -6597,7 +6742,6 @@ F386F6F42884663E001840AA /* SDL_utils_c.h in Headers */, A7D8AC9D23E2514100DCD162 /* SDL_uikitwindow.h in Headers */, A7D8B25E23E2514200DCD162 /* vulkan_vi.h in Headers */, - A7D8B29A23E2514200DCD162 /* vulkan_mir.h in Headers */, A7D8BB4F23E2514500DCD162 /* default_cursor.h in Headers */, A7D8B9FF23E2514400DCD162 /* SDL_render_sw_c.h in Headers */, A7D8ABFB23E2514100DCD162 /* SDL_nullvideo.h in Headers */, @@ -6634,11 +6778,13 @@ A7D8AAD823E2514100DCD162 /* SDL_syshaptic.h in Headers */, A7D8AD2123E2514100DCD162 /* SDL_vulkan_internal.h in Headers */, A7D8AF1623E2514100DCD162 /* SDL_cocoaevents.h in Headers */, + F362B9362B33916600D30B94 /* controller_list.h in Headers */, A7D8B25823E2514200DCD162 /* vk_icd.h in Headers */, A7D8ABE923E2514100DCD162 /* SDL_nullframebuffer_c.h in Headers */, A7D8AB2023E2514100DCD162 /* SDL_dynapi_procs.h in Headers */, A7D8B27623E2514200DCD162 /* vulkan_fuchsia.h in Headers */, A7D8B57323E2514300DCD162 /* usb_ids.h in Headers */, + F316ABAD2B5A02C3002EF551 /* yuv_rgb_lsx.h in Headers */, A7D8BA5923E2514400DCD162 /* SDL_gles2funcs.h in Headers */, A7D8AC4323E2514100DCD162 /* SDL_sysvideo.h in Headers */, A7D8AB1423E2514100DCD162 /* SDL_dynapi_overrides.h in Headers */, @@ -6661,6 +6807,7 @@ AADA5B8716CCAB3000107CF7 /* SDL_bits.h in Headers */, A7D8BA0123E2514400DCD162 /* SDL_blendfillrect.h in Headers */, A7D8B9E923E2514400DCD162 /* SDL_blendline.h in Headers */, + F316ABC42B5A02C3002EF551 /* yuv_rgb_std.h in Headers */, AA7558041595D4D800BBD41B /* SDL_blendmode.h in Headers */, A7D8BA0D23E2514400DCD162 /* SDL_blendpoint.h in Headers */, A7D8B3B623E2514200DCD162 /* SDL_blit.h in Headers */, @@ -6696,6 +6843,7 @@ A7D8BB3F23E2514500DCD162 /* SDL_displayevents_c.h in Headers */, A7D8BA1923E2514400DCD162 /* SDL_draw.h in Headers */, A7D8BA0723E2514400DCD162 /* SDL_drawline.h in Headers */, + F316ABBB2B5A02C3002EF551 /* yuv_rgb_sse.h in Headers */, A7D8B9EF23E2514400DCD162 /* SDL_drawpoint.h in Headers */, A7D8BB2D23E2514500DCD162 /* SDL_dropevents_c.h in Headers */, A7D8B79423E2514400DCD162 /* SDL_dummyaudio.h in Headers */, @@ -6720,14 +6868,17 @@ A7D8BA7923E2514400DCD162 /* SDL_glfuncs.h in Headers */, AA7558181595D4D800BBD41B /* SDL_haptic.h in Headers */, A7D8AABC23E2514100DCD162 /* SDL_haptic_c.h in Headers */, + F316AB8E2B5A02C3002EF551 /* yuv_rgb_internal.h in Headers */, A75FDBC523EA380300529352 /* SDL_hidapi_rumble.h in Headers */, A7D8B55723E2514300DCD162 /* SDL_hidapijoystick_c.h in Headers */, AA75581A1595D4D800BBD41B /* SDL_hints.h in Headers */, A7D8B94A23E2514400DCD162 /* SDL_hints_c.h in Headers */, + F316ABCD2B5A02C3002EF551 /* yuv_rgb_lsx_func.h in Headers */, A7D8A99923E2514000DCD162 /* SDL_internal.h in Headers */, F395C1932569C68F00942BFF /* SDL_iokitjoystick_c.h in Headers */, AA75581E1595D4D800BBD41B /* SDL_joystick.h in Headers */, A7D8B58723E2514300DCD162 /* SDL_joystick_c.h in Headers */, + F316AB852B5A02C3002EF551 /* yuv_rgb_common.h in Headers */, AA7558201595D4D800BBD41B /* SDL_keyboard.h in Headers */, A7D8BB8723E2514500DCD162 /* SDL_keyboard_c.h in Headers */, AA7558221595D4D800BBD41B /* SDL_keycode.h in Headers */, @@ -6798,6 +6949,8 @@ A7D8B5D523E2514300DCD162 /* SDL_syspower.h in Headers */, A7D8B61123E2514300DCD162 /* SDL_syspower.h in Headers */, A7D8B9D723E2514400DCD162 /* SDL_sysrender.h in Headers */, + F362B9462B33920500D30B94 /* SDL_hidapi_nintendo.h in Headers */, + F316ABA92B5A02C3002EF551 /* yuv_rgb_lsx.h in Headers */, A7D8A97B23E2514000DCD162 /* SDL_syssensor.h in Headers */, AA75584E1595D4D800BBD41B /* SDL_system.h in Headers */, A7D8B3E623E2514300DCD162 /* SDL_systhread.h in Headers */, @@ -6836,6 +6989,7 @@ A7D8B9CB23E2514400DCD162 /* SDL_yuv_sw_c.h in Headers */, AA7557FA1595D4D800BBD41B /* begin_code.h in Headers */, A7D8BB4523E2514500DCD162 /* blank_cursor.h in Headers */, + F362B9522B33EB7300D30B94 /* SDL_steam_virtual_gamepad.h in Headers */, AA7557FC1595D4D800BBD41B /* close_code.h in Headers */, A7D8B5B723E2514300DCD162 /* controller_type.h in Headers */, A7D8BB4B23E2514500DCD162 /* default_cursor.h in Headers */, @@ -6846,7 +7000,6 @@ A7D8B22423E2514200DCD162 /* gl2ext.h in Headers */, A7D8B23023E2514200DCD162 /* gl2platform.h in Headers */, A75FDB5823E39E6100529352 /* hidapi.h in Headers */, - A7D8BBD123E2574800DCD162 /* keyinfotable.h in Headers */, A7D8B23623E2514200DCD162 /* khrplatform.h in Headers */, A7D8BB0323E2514500DCD162 /* math_libm.h in Headers */, A7D8BAC123E2514500DCD162 /* math_private.h in Headers */, @@ -6861,16 +7014,15 @@ A7D8B26623E2514200DCD162 /* vk_platform.h in Headers */, A7D8B2AE23E2514200DCD162 /* vk_sdk_platform.h in Headers */, A7D8B26023E2514200DCD162 /* vulkan.h in Headers */, - A7D8B26C23E2514200DCD162 /* vulkan.hpp in Headers */, A7D8B2B423E2514200DCD162 /* vulkan_android.h in Headers */, A7D8B2A823E2514200DCD162 /* vulkan_core.h in Headers */, A7D8B27223E2514200DCD162 /* vulkan_fuchsia.h in Headers */, A7D8B2A223E2514200DCD162 /* vulkan_ios.h in Headers */, A7D8B28423E2514200DCD162 /* vulkan_macos.h in Headers */, - A7D8B29623E2514200DCD162 /* vulkan_mir.h in Headers */, A7D8B25A23E2514200DCD162 /* vulkan_vi.h in Headers */, A7D8B27823E2514200DCD162 /* vulkan_wayland.h in Headers */, A7D8B27E23E2514200DCD162 /* vulkan_win32.h in Headers */, + F362B9322B33916600D30B94 /* controller_list.h in Headers */, A7D8B29023E2514200DCD162 /* vulkan_xcb.h in Headers */, A7D8B29C23E2514200DCD162 /* vulkan_xlib.h in Headers */, A7D8B28A23E2514200DCD162 /* vulkan_xlib_xrandr.h in Headers */, @@ -6885,9 +7037,11 @@ buildActionMask = 2147483647; files = ( A7D8B9A423E2514400DCD162 /* SDL_shaders_metal_tvos.h in Headers */, + F316ABBE2B5A02C3002EF551 /* yuv_rgb_sse.h in Headers */, A7D8AC0C23E2514100DCD162 /* SDL_shape_internals.h in Headers */, A7D8BA7C23E2514400DCD162 /* SDL_glfuncs.h in Headers */, A7D8AC0623E2514100DCD162 /* SDL_rect_c.h in Headers */, + F362B9352B33916600D30B94 /* controller_list.h in Headers */, 75E09166241EA924004729E1 /* SDL_virtualjoystick_c.h in Headers */, A7D8B99E23E2514400DCD162 /* SDL_shaders_metal_osx.h in Headers */, A7D8B98F23E2514400DCD162 /* SDL_shaders_metal_ios.h in Headers */, @@ -6904,7 +7058,9 @@ A7D8B3EF23E2514300DCD162 /* SDL_thread_c.h in Headers */, A7D8AF0923E2514100DCD162 /* SDL_cocoamessagebox.h in Headers */, A7D8BA0423E2514400DCD162 /* SDL_blendfillrect.h in Headers */, + F362B9552B33EB7300D30B94 /* SDL_steam_virtual_gamepad.h in Headers */, A7D8B55A23E2514300DCD162 /* SDL_hidapijoystick_c.h in Headers */, + F316ABAC2B5A02C3002EF551 /* yuv_rgb_lsx.h in Headers */, A7D8B2C323E2514200DCD162 /* SDL_pixels_c.h in Headers */, A7D8B58A23E2514300DCD162 /* SDL_joystick_c.h in Headers */, A75FDB5B23E39E6100529352 /* hidapi.h in Headers */, @@ -6919,13 +7075,13 @@ A7D8B9CE23E2514400DCD162 /* SDL_yuv_sw_c.h in Headers */, A7D8BBFD23E2574800DCD162 /* SDL_uikitvideo.h in Headers */, A7D8BBAE23E2514500DCD162 /* SDL_windowevents_c.h in Headers */, + F316AB912B5A02C3002EF551 /* yuv_rgb_internal.h in Headers */, A7D8AF0323E2514100DCD162 /* SDL_cocoavideo.h in Headers */, A7D8BB3C23E2514500DCD162 /* SDL_gesture_c.h in Headers */, A7D8BBEF23E2574800DCD162 /* SDL_uikitclipboard.h in Headers */, A7D8BA7623E2514400DCD162 /* SDL_shaders_gl.h in Headers */, A7D8B42B23E2514300DCD162 /* SDL_systhread_c.h in Headers */, A7D8AE9123E2514100DCD162 /* SDL_cocoakeyboard.h in Headers */, - A7D8B26F23E2514200DCD162 /* vulkan.hpp in Headers */, A7D8B22723E2514200DCD162 /* gl2ext.h in Headers */, A7D8BB7223E2514500DCD162 /* SDL_clipboardevents_c.h in Headers */, A7D8AAE323E2514100DCD162 /* SDL_syshaptic_c.h in Headers */, @@ -6962,6 +7118,7 @@ A7D8BBF123E2574800DCD162 /* SDL_uikitevents.h in Headers */, A7D8BBFF23E2574800DCD162 /* SDL_uikitview.h in Headers */, A7D8BBA823E2514500DCD162 /* SDL_events_c.h in Headers */, + F316ABC72B5A02C3002EF551 /* yuv_rgb_std.h in Headers */, A7D8BAC423E2514500DCD162 /* math_private.h in Headers */, A7D8B27B23E2514200DCD162 /* vulkan_wayland.h in Headers */, A7D8BBF523E2574800DCD162 /* SDL_uikitmetalview.h in Headers */, @@ -6969,7 +7126,6 @@ A7D8BA5223E2514400DCD162 /* SDL_shaders_gles2.h in Headers */, A7D8BA4623E2514400DCD162 /* SDL_glesfuncs.h in Headers */, A7D8BA1023E2514400DCD162 /* SDL_blendpoint.h in Headers */, - A7D8BBEC23E2574800DCD162 /* keyinfotable.h in Headers */, A7D8AB7023E2514100DCD162 /* SDL_offscreenvideo.h in Headers */, A7D8AC0023E2514100DCD162 /* SDL_nullevents_c.h in Headers */, A7D8B58423E2514300DCD162 /* SDL_sysjoystick.h in Headers */, @@ -6995,11 +7151,12 @@ A7D8B5BA23E2514300DCD162 /* controller_type.h in Headers */, A7D8B29F23E2514200DCD162 /* vulkan_xlib.h in Headers */, A7D8B25D23E2514200DCD162 /* vulkan_vi.h in Headers */, - A7D8B29923E2514200DCD162 /* vulkan_mir.h in Headers */, + F316AB882B5A02C3002EF551 /* yuv_rgb_common.h in Headers */, A1BB8B6F27F6CF330057CFA8 /* SDL_list.h in Headers */, A7D8BB4E23E2514500DCD162 /* default_cursor.h in Headers */, A7D8B9FE23E2514400DCD162 /* SDL_render_sw_c.h in Headers */, A7D8BBED23E2574800DCD162 /* SDL_uikitappdelegate.h in Headers */, + F362B9492B33920500D30B94 /* SDL_hidapi_nintendo.h in Headers */, A7D8BBF923E2574800DCD162 /* SDL_uikitopengles.h in Headers */, F31A92CC28D4CB39003BFD6A /* SDL_offscreenopengles.h in Headers */, A7D8ABFA23E2514100DCD162 /* SDL_nullvideo.h in Headers */, @@ -7020,6 +7177,7 @@ A7D8BB2423E2514500DCD162 /* scancodes_windows.h in Headers */, A7D8B5C623E2514300DCD162 /* SDL_rwopsbundlesupport.h in Headers */, A7D8B61423E2514300DCD162 /* SDL_syspower.h in Headers */, + F316ABD02B5A02C3002EF551 /* yuv_rgb_lsx_func.h in Headers */, A7D8B28723E2514200DCD162 /* vulkan_macos.h in Headers */, A7D8B29323E2514200DCD162 /* vulkan_xcb.h in Headers */, A7D8B2A523E2514200DCD162 /* vulkan_ios.h in Headers */, @@ -7059,6 +7217,7 @@ DB313FC917554B71006C0E22 /* close_code.h in Headers */, DB313FF917554B71006C0E22 /* SDL.h in Headers */, A7D8AC6223E2514100DCD162 /* SDL_uikitmetalview.h in Headers */, + F362B9582B33EB7300D30B94 /* SDL_steam_virtual_gamepad.h in Headers */, DB313FCA17554B71006C0E22 /* SDL_assert.h in Headers */, A7D8AC0E23E2514100DCD162 /* SDL_shape_internals.h in Headers */, A7D8BA7E23E2514400DCD162 /* SDL_glfuncs.h in Headers */, @@ -7075,7 +7234,6 @@ A7D8AC4A23E2514100DCD162 /* SDL_uikitview.h in Headers */, DB313FFC17554B71006C0E22 /* SDL_bits.h in Headers */, A7D8ACCE23E2514100DCD162 /* SDL_uikitappdelegate.h in Headers */, - A7D8ACA423E2514100DCD162 /* keyinfotable.h in Headers */, DB313FCD17554B71006C0E22 /* SDL_blendmode.h in Headers */, A7D8BB3223E2514500DCD162 /* SDL_dropevents_c.h in Headers */, A7D8AAC123E2514100DCD162 /* SDL_haptic_c.h in Headers */, @@ -7122,18 +7280,19 @@ DB313FDA17554B71006C0E22 /* SDL_keyboard.h in Headers */, A7D8ACC223E2514100DCD162 /* SDL_uikitevents.h in Headers */, A7D8BB3E23E2514500DCD162 /* SDL_gesture_c.h in Headers */, + F362B9382B33916600D30B94 /* controller_list.h in Headers */, A7D8BA7823E2514400DCD162 /* SDL_shaders_gl.h in Headers */, A7D8B42D23E2514300DCD162 /* SDL_systhread_c.h in Headers */, A1BB8B7227F6CF330057CFA8 /* SDL_list.h in Headers */, DB313FDB17554B71006C0E22 /* SDL_keycode.h in Headers */, A7D8AE9323E2514100DCD162 /* SDL_cocoakeyboard.h in Headers */, A7D8ACE623E2514100DCD162 /* SDL_uikitvulkan.h in Headers */, - A7D8B27123E2514200DCD162 /* vulkan.hpp in Headers */, DB313FDC17554B71006C0E22 /* SDL_loadso.h in Headers */, A7D8B22923E2514200DCD162 /* gl2ext.h in Headers */, A7D8BB7423E2514500DCD162 /* SDL_clipboardevents_c.h in Headers */, A7D8AAE523E2514100DCD162 /* SDL_syshaptic_c.h in Headers */, A7D8B94F23E2514400DCD162 /* SDL_hints_c.h in Headers */, + F316ABC12B5A02C3002EF551 /* yuv_rgb_sse.h in Headers */, A7D8B7B723E2514400DCD162 /* SDL_audiodev_c.h in Headers */, A7D8B7A523E2514400DCD162 /* SDL_audio_c.h in Headers */, A7D8AC6E23E2514100DCD162 /* SDL_uikitmodes.h in Headers */, @@ -7147,6 +7306,7 @@ A7D8B2AD23E2514200DCD162 /* vulkan_core.h in Headers */, A7D8A98023E2514000DCD162 /* SDL_syssensor.h in Headers */, A7D8AB0F23E2514100DCD162 /* SDL_dynapi.h in Headers */, + F316ABD32B5A02C3002EF551 /* yuv_rgb_lsx_func.h in Headers */, A7D8B61C23E2514300DCD162 /* SDL_assert_c.h in Headers */, A7D8B8A723E2514400DCD162 /* SDL_diskaudio.h in Headers */, DB313FDE17554B71006C0E22 /* SDL_main.h in Headers */, @@ -7156,6 +7316,7 @@ A7D8AEE123E2514100DCD162 /* SDL_cocoaopengl.h in Headers */, A7D8B3CD23E2514300DCD162 /* yuv_rgb_sse_func.h in Headers */, 5605721B2473688D00B46B66 /* SDL_syslocale.h in Headers */, + F316ABCA2B5A02C3002EF551 /* yuv_rgb_std.h in Headers */, A7D8AB6023E2514100DCD162 /* SDL_offscreenevents_c.h in Headers */, F3973FA828A59BDD00B84553 /* SDL_vacopy.h in Headers */, A1626A582617008D003F1973 /* SDL_triangle.h in Headers */, @@ -7179,6 +7340,8 @@ A7D8BA5423E2514400DCD162 /* SDL_shaders_gles2.h in Headers */, DB313FE417554B71006C0E22 /* SDL_opengles2.h in Headers */, A7D8BA4823E2514400DCD162 /* SDL_glesfuncs.h in Headers */, + F316AB8B2B5A02C3002EF551 /* yuv_rgb_common.h in Headers */, + F316ABAF2B5A02C3002EF551 /* yuv_rgb_lsx.h in Headers */, A7D8BA1223E2514400DCD162 /* SDL_blendpoint.h in Headers */, A7D8AB7223E2514100DCD162 /* SDL_offscreenvideo.h in Headers */, A7D8AC0223E2514100DCD162 /* SDL_nullevents_c.h in Headers */, @@ -7207,7 +7370,6 @@ A7D8B2A123E2514200DCD162 /* vulkan_xlib.h in Headers */, A7D8AC9E23E2514100DCD162 /* SDL_uikitwindow.h in Headers */, A7D8B25F23E2514200DCD162 /* vulkan_vi.h in Headers */, - A7D8B29B23E2514200DCD162 /* vulkan_mir.h in Headers */, DB313FE817554B71006C0E22 /* SDL_quit.h in Headers */, A7D8BB5023E2514500DCD162 /* default_cursor.h in Headers */, A7D8BA0023E2514400DCD162 /* SDL_render_sw_c.h in Headers */, @@ -7268,11 +7430,13 @@ AAC070FE195606770073DCDF /* SDL_opengles2_gl2.h in Headers */, F3950CDA212BC88D00F51292 /* SDL_sensor.h in Headers */, A75FDBCB23EA380300529352 /* SDL_hidapi_rumble.h in Headers */, + F362B94C2B33920500D30B94 /* SDL_hidapi_nintendo.h in Headers */, A7D8AC4423E2514100DCD162 /* SDL_sysvideo.h in Headers */, F386F6ED2884663E001840AA /* SDL_log_c.h in Headers */, AAC07104195606770073DCDF /* SDL_opengles2_gl2platform.h in Headers */, AAC07101195606770073DCDF /* SDL_opengles2_gl2ext.h in Headers */, A7D8AB1523E2514100DCD162 /* SDL_dynapi_overrides.h in Headers */, + F316AB942B5A02C3002EF551 /* yuv_rgb_internal.h in Headers */, A7D8AEFF23E2514100DCD162 /* SDL_cocoawindow.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; @@ -7756,7 +7920,6 @@ A75FCE0223E25AB700529352 /* SDL_log.c in Sources */, A75FCE0323E25AB700529352 /* SDL_cocoaopengl.m in Sources */, A75FCE0423E25AB700529352 /* SDL_offscreenframebuffer.c in Sources */, - A75FCE0523E25AB700529352 /* yuv_rgb.c in Sources */, F323060628939F6400E66D30 /* SDL_hidapi_combined.c in Sources */, A75FCE0623E25AB700529352 /* SDL_render_gles.c in Sources */, A75FCE0723E25AB700529352 /* SDL_systhread.c in Sources */, @@ -7779,6 +7942,7 @@ A75FCE1923E25AB700529352 /* SDL_offscreenevents.c in Sources */, A75FCE1A23E25AB700529352 /* SDL_uikitview.m in Sources */, A75FCE1B23E25AB700529352 /* SDL_nullevents.c in Sources */, + F362B9442B33920500D30B94 /* SDL_hidapi_steamdeck.c in Sources */, A75FCE1C23E25AB700529352 /* SDL_audiodev.c in Sources */, A75FCE1D23E25AB700529352 /* SDL_cocoaclipboard.m in Sources */, A75FCE1E23E25AB700529352 /* SDL_blit_slow.c in Sources */, @@ -7842,6 +8006,7 @@ A75FCE5323E25AB700529352 /* SDL_mixer.c in Sources */, 5616CA64252BB35F005D5928 /* SDL_url.c in Sources */, A75FCE5423E25AB700529352 /* SDL_events.c in Sources */, + F316AB9E2B5A02C3002EF551 /* yuv_rgb_std.c in Sources */, F386F7002884663E001840AA /* SDL_utils.c in Sources */, A75FCE5523E25AB700529352 /* SDL_blit_0.c in Sources */, A75FCE5623E25AB700529352 /* k_tan.c in Sources */, @@ -7858,6 +8023,7 @@ F3ADAB922576F0B400A6B1D9 /* SDL_sysurl.m in Sources */, A75FCE6323E25AB700529352 /* SDL_string.c in Sources */, A75FCE6423E25AB700529352 /* SDL_render_gl.c in Sources */, + F316ABA72B5A02C3002EF551 /* yuv_rgb_sse.c in Sources */, A75FCE6523E25AB700529352 /* SDL_uikitopengles.m in Sources */, A75FCE6723E25AB700529352 /* SDL_cocoamodes.m in Sources */, A75FCE6823E25AB700529352 /* k_rem_pio2.c in Sources */, @@ -7910,10 +8076,12 @@ A75FCE9B23E25AB700529352 /* SDL_drawpoint.c in Sources */, A75FCE9C23E25AB700529352 /* e_sqrt.c in Sources */, A75FCE9D23E25AB700529352 /* SDL_cocoavideo.m in Sources */, + F362B9622B33EB7300D30B94 /* SDL_steam_virtual_gamepad.c in Sources */, A75FCE9F23E25AB700529352 /* SDL.c in Sources */, A75FCEA123E25AB700529352 /* SDL_cocoavulkan.m in Sources */, A75FCEA223E25AB700529352 /* SDL_uikitappdelegate.m in Sources */, A75FCEA323E25AB700529352 /* SDL_offscreenwindow.c in Sources */, + F316ABB92B5A02C3002EF551 /* yuv_rgb_lsx.c in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -7952,7 +8120,6 @@ A75FCFBB23E25AC700529352 /* SDL_log.c in Sources */, A75FCFBC23E25AC700529352 /* SDL_cocoaopengl.m in Sources */, A75FCFBD23E25AC700529352 /* SDL_offscreenframebuffer.c in Sources */, - A75FCFBE23E25AC700529352 /* yuv_rgb.c in Sources */, F323060728939F6400E66D30 /* SDL_hidapi_combined.c in Sources */, A75FCFBF23E25AC700529352 /* SDL_render_gles.c in Sources */, A75FCFC023E25AC700529352 /* SDL_systhread.c in Sources */, @@ -7975,6 +8142,7 @@ A75FCFD223E25AC700529352 /* SDL_offscreenevents.c in Sources */, A75FCFD323E25AC700529352 /* SDL_uikitview.m in Sources */, A75FCFD423E25AC700529352 /* SDL_nullevents.c in Sources */, + F362B9452B33920500D30B94 /* SDL_hidapi_steamdeck.c in Sources */, A75FCFD523E25AC700529352 /* SDL_audiodev.c in Sources */, A75FCFD623E25AC700529352 /* SDL_cocoaclipboard.m in Sources */, A75FCFD723E25AC700529352 /* SDL_blit_slow.c in Sources */, @@ -8038,6 +8206,7 @@ A75FD00C23E25AC700529352 /* SDL_mixer.c in Sources */, 5616CA67252BB361005D5928 /* SDL_url.c in Sources */, A75FD00D23E25AC700529352 /* SDL_events.c in Sources */, + F316AB9F2B5A02C3002EF551 /* yuv_rgb_std.c in Sources */, F386F7012884663E001840AA /* SDL_utils.c in Sources */, A75FD00E23E25AC700529352 /* SDL_blit_0.c in Sources */, A75FD00F23E25AC700529352 /* k_tan.c in Sources */, @@ -8054,6 +8223,7 @@ F3ADAB932576F0B400A6B1D9 /* SDL_sysurl.m in Sources */, A75FD01C23E25AC700529352 /* SDL_string.c in Sources */, A75FD01D23E25AC700529352 /* SDL_render_gl.c in Sources */, + F316ABA82B5A02C3002EF551 /* yuv_rgb_sse.c in Sources */, A75FD01E23E25AC700529352 /* SDL_uikitopengles.m in Sources */, A75FD02023E25AC700529352 /* SDL_cocoamodes.m in Sources */, A75FD02123E25AC700529352 /* k_rem_pio2.c in Sources */, @@ -8106,10 +8276,12 @@ A75FD05423E25AC700529352 /* SDL_drawpoint.c in Sources */, A75FD05523E25AC700529352 /* e_sqrt.c in Sources */, A75FD05623E25AC700529352 /* SDL_cocoavideo.m in Sources */, + F362B9632B33EB7300D30B94 /* SDL_steam_virtual_gamepad.c in Sources */, A75FD05823E25AC700529352 /* SDL.c in Sources */, A75FD05A23E25AC700529352 /* SDL_cocoavulkan.m in Sources */, A75FD05B23E25AC700529352 /* SDL_uikitappdelegate.m in Sources */, A75FD05C23E25AC700529352 /* SDL_offscreenwindow.c in Sources */, + F316ABBA2B5A02C3002EF551 /* yuv_rgb_lsx.c in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -8140,11 +8312,12 @@ A769B18723E259AE00872273 /* SDL_hidapi_xbox360w.c in Sources */, A769B18823E259AE00872273 /* SDL_atomic.c in Sources */, A769B18923E259AE00872273 /* SDL_displayevents.c in Sources */, + F316ABA52B5A02C3002EF551 /* yuv_rgb_sse.c in Sources */, A769B18B23E259AE00872273 /* SDL_log.c in Sources */, A769B18C23E259AE00872273 /* SDL_cocoaopengl.m in Sources */, A769B18D23E259AE00872273 /* SDL_offscreenframebuffer.c in Sources */, - A769B18E23E259AE00872273 /* yuv_rgb.c in Sources */, A769B18F23E259AE00872273 /* SDL_render_gles.c in Sources */, + F362B9602B33EB7300D30B94 /* SDL_steam_virtual_gamepad.c in Sources */, A769B19023E259AE00872273 /* SDL_systhread.c in Sources */, A769B19123E259AE00872273 /* SDL_windowevents.c in Sources */, A769B19223E259AE00872273 /* s_scalbn.c in Sources */, @@ -8157,6 +8330,7 @@ A769B19A23E259AE00872273 /* SDL_syssem.c in Sources */, A769B19B23E259AE00872273 /* SDL_hidapi_xbox360.c in Sources */, A769B19C23E259AE00872273 /* SDL_coreaudio.m in Sources */, + F362B9422B33920500D30B94 /* SDL_hidapi_steamdeck.c in Sources */, A769B19D23E259AE00872273 /* SDL_blendline.c in Sources */, A769B19E23E259AE00872273 /* SDL_blit_A.c in Sources */, A769B19F23E259AE00872273 /* SDL_d3dmath.c in Sources */, @@ -8235,6 +8409,7 @@ A769B1E923E259AE00872273 /* SDL_uikit_main.c in Sources */, F3F07D5F269640160074468B /* SDL_hidapi_luna.c in Sources */, A769B1EA23E259AE00872273 /* SDL_stdlib.c in Sources */, + F316ABB72B5A02C3002EF551 /* yuv_rgb_lsx.c in Sources */, A769B1EB23E259AE00872273 /* SDL_dummyaudio.c in Sources */, A769B1EC23E259AE00872273 /* SDL_fillrect.c in Sources */, A769B1ED23E259AE00872273 /* SDL_nullframebuffer.c in Sources */, @@ -8250,6 +8425,7 @@ A769B1F923E259AE00872273 /* SDL_joystick.c in Sources */, A769B1FA23E259AE00872273 /* SDL_render_gles2.c in Sources */, A769B1FB23E259AE00872273 /* SDL_surface.c in Sources */, + F316AB9C2B5A02C3002EF551 /* yuv_rgb_std.c in Sources */, F395BF6A25633B2400942BFF /* SDL_crc32.c in Sources */, A769B1FC23E259AE00872273 /* SDL_hidapi_xboxone.c in Sources */, A769B1FD23E259AE00872273 /* SDL_blit_auto.c in Sources */, @@ -8343,7 +8519,6 @@ A7D8AB2623E2514100DCD162 /* SDL_log.c in Sources */, A7D8AE8923E2514100DCD162 /* SDL_cocoaopengl.m in Sources */, A7D8AB7423E2514100DCD162 /* SDL_offscreenframebuffer.c in Sources */, - A7D8B3C023E2514200DCD162 /* yuv_rgb.c in Sources */, A7D8BA3E23E2514400DCD162 /* SDL_render_gles.c in Sources */, A7D8B43523E2514300DCD162 /* SDL_systhread.c in Sources */, F323060028939F6400E66D30 /* SDL_hidapi_combined.c in Sources */, @@ -8368,6 +8543,7 @@ A7D8ABF223E2514100DCD162 /* SDL_nullevents.c in Sources */, A7D8B81923E2514400DCD162 /* SDL_audiodev.c in Sources */, A7D8AF0D23E2514100DCD162 /* SDL_cocoaclipboard.m in Sources */, + F362B93E2B33920500D30B94 /* SDL_hidapi_steamdeck.c in Sources */, A7D8ABCE23E2514100DCD162 /* SDL_blit_slow.c in Sources */, A7D8BA9823E2514400DCD162 /* s_copysign.c in Sources */, A7D8AAB723E2514100DCD162 /* SDL_haptic.c in Sources */, @@ -8431,6 +8607,7 @@ A7D8ADE723E2514100DCD162 /* SDL_blit_0.c in Sources */, A7D8BB0A23E2514500DCD162 /* k_tan.c in Sources */, A75FDBCF23EA380300529352 /* SDL_hidapi_rumble.c in Sources */, + F316AB982B5A02C3002EF551 /* yuv_rgb_std.c in Sources */, F386F6FA2884663E001840AA /* SDL_utils.c in Sources */, A7D8B8A923E2514400DCD162 /* SDL_diskaudio.c in Sources */, A7D8AFC123E2514200DCD162 /* SDL_egl.c in Sources */, @@ -8447,6 +8624,7 @@ F3ADAB8E2576F0B400A6B1D9 /* SDL_sysurl.m in Sources */, A7D8AC8223E2514100DCD162 /* SDL_uikitopengles.m in Sources */, A7D8AE9523E2514100DCD162 /* SDL_cocoamodes.m in Sources */, + F316ABA12B5A02C3002EF551 /* yuv_rgb_sse.c in Sources */, A7D8BAA423E2514400DCD162 /* k_rem_pio2.c in Sources */, A7D8BB9A23E2514500DCD162 /* SDL_gesture.c in Sources */, A7D8B95723E2514400DCD162 /* SDL_getenv.c in Sources */, @@ -8499,10 +8677,12 @@ A7D8BA2623E2514400DCD162 /* SDL_drawpoint.c in Sources */, A7D8BAF823E2514500DCD162 /* e_sqrt.c in Sources */, A7D8AEAD23E2514100DCD162 /* SDL_cocoavideo.m in Sources */, + F362B95C2B33EB7300D30B94 /* SDL_steam_virtual_gamepad.c in Sources */, A7D8A94C23E2514000DCD162 /* SDL.c in Sources */, A7D8AEA123E2514100DCD162 /* SDL_cocoavulkan.m in Sources */, A7D8AC6423E2514100DCD162 /* SDL_uikitappdelegate.m in Sources */, A7D8AB6223E2514100DCD162 /* SDL_offscreenwindow.c in Sources */, + F316ABB32B5A02C3002EF551 /* yuv_rgb_lsx.c in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -8539,7 +8719,6 @@ A7D8AB2723E2514100DCD162 /* SDL_log.c in Sources */, A7D8AE8A23E2514100DCD162 /* SDL_cocoaopengl.m in Sources */, A7D8AB7523E2514100DCD162 /* SDL_offscreenframebuffer.c in Sources */, - A7D8B3C123E2514200DCD162 /* yuv_rgb.c in Sources */, A7D8BA3F23E2514400DCD162 /* SDL_render_gles.c in Sources */, A7D8B43623E2514300DCD162 /* SDL_systhread.c in Sources */, F323060128939F6400E66D30 /* SDL_hidapi_combined.c in Sources */, @@ -8564,6 +8743,7 @@ A7D8ABF323E2514100DCD162 /* SDL_nullevents.c in Sources */, A7D8B81A23E2514400DCD162 /* SDL_audiodev.c in Sources */, A7D8AF0E23E2514100DCD162 /* SDL_cocoaclipboard.m in Sources */, + F362B93F2B33920500D30B94 /* SDL_hidapi_steamdeck.c in Sources */, A7D8ABCF23E2514100DCD162 /* SDL_blit_slow.c in Sources */, A7D8BA9923E2514400DCD162 /* s_copysign.c in Sources */, A7D8AAB823E2514100DCD162 /* SDL_haptic.c in Sources */, @@ -8627,6 +8807,7 @@ A7D8ADE823E2514100DCD162 /* SDL_blit_0.c in Sources */, A7D8BB0B23E2514500DCD162 /* k_tan.c in Sources */, A75FDBD023EA380300529352 /* SDL_hidapi_rumble.c in Sources */, + F316AB992B5A02C3002EF551 /* yuv_rgb_std.c in Sources */, F386F6FB2884663E001840AA /* SDL_utils.c in Sources */, A7D8B8AA23E2514400DCD162 /* SDL_diskaudio.c in Sources */, A7D8AFC223E2514200DCD162 /* SDL_egl.c in Sources */, @@ -8643,6 +8824,7 @@ F3ADAB8F2576F0B400A6B1D9 /* SDL_sysurl.m in Sources */, A7D8AC8323E2514100DCD162 /* SDL_uikitopengles.m in Sources */, A7D8AE9623E2514100DCD162 /* SDL_cocoamodes.m in Sources */, + F316ABA22B5A02C3002EF551 /* yuv_rgb_sse.c in Sources */, A7D8BAA523E2514400DCD162 /* k_rem_pio2.c in Sources */, A7D8BB9B23E2514500DCD162 /* SDL_gesture.c in Sources */, A7D8B95823E2514400DCD162 /* SDL_getenv.c in Sources */, @@ -8695,10 +8877,12 @@ A7D8BA2723E2514400DCD162 /* SDL_drawpoint.c in Sources */, A7D8BAF923E2514500DCD162 /* e_sqrt.c in Sources */, A7D8AEAE23E2514100DCD162 /* SDL_cocoavideo.m in Sources */, + F362B95D2B33EB7300D30B94 /* SDL_steam_virtual_gamepad.c in Sources */, A7D8A94D23E2514000DCD162 /* SDL.c in Sources */, A7D8AEA223E2514100DCD162 /* SDL_cocoavulkan.m in Sources */, A7D8AC6523E2514100DCD162 /* SDL_uikitappdelegate.m in Sources */, A7D8AB6323E2514100DCD162 /* SDL_offscreenwindow.c in Sources */, + F316ABB42B5A02C3002EF551 /* yuv_rgb_lsx.c in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -8729,11 +8913,12 @@ A7D8B56123E2514300DCD162 /* SDL_hidapi_xbox360w.c in Sources */, A7D8A95B23E2514000DCD162 /* SDL_atomic.c in Sources */, A7D8BB2B23E2514500DCD162 /* SDL_displayevents.c in Sources */, + F316ABA42B5A02C3002EF551 /* yuv_rgb_sse.c in Sources */, A7D8AB2923E2514100DCD162 /* SDL_log.c in Sources */, A7D8AE8C23E2514100DCD162 /* SDL_cocoaopengl.m in Sources */, A7D8AB7723E2514100DCD162 /* SDL_offscreenframebuffer.c in Sources */, - A7D8B3C323E2514200DCD162 /* yuv_rgb.c in Sources */, A7D8BA4123E2514400DCD162 /* SDL_render_gles.c in Sources */, + F362B95F2B33EB7300D30B94 /* SDL_steam_virtual_gamepad.c in Sources */, A7D8B43823E2514300DCD162 /* SDL_systhread.c in Sources */, A7D8BB3723E2514500DCD162 /* SDL_windowevents.c in Sources */, A7D8BABF23E2514400DCD162 /* s_scalbn.c in Sources */, @@ -8746,6 +8931,7 @@ A7D8B42623E2514300DCD162 /* SDL_syssem.c in Sources */, A7D8B53D23E2514300DCD162 /* SDL_hidapi_xbox360.c in Sources */, A7D8B8D623E2514400DCD162 /* SDL_coreaudio.m in Sources */, + F362B9412B33920500D30B94 /* SDL_hidapi_steamdeck.c in Sources */, A7D8BA2323E2514400DCD162 /* SDL_blendline.c in Sources */, A7D8ADF623E2514100DCD162 /* SDL_blit_A.c in Sources */, A7D8BA3B23E2514400DCD162 /* SDL_d3dmath.c in Sources */, @@ -8824,6 +9010,7 @@ A7D8BC0723E2590800DCD162 /* SDL_uikit_main.c in Sources */, F3F07D5E269640160074468B /* SDL_hidapi_luna.c in Sources */, A7D8B97223E2514400DCD162 /* SDL_stdlib.c in Sources */, + F316ABB62B5A02C3002EF551 /* yuv_rgb_lsx.c in Sources */, A7D8B79E23E2514400DCD162 /* SDL_dummyaudio.c in Sources */, A7D8B3A823E2514200DCD162 /* SDL_fillrect.c in Sources */, A7D8ABE323E2514100DCD162 /* SDL_nullframebuffer.c in Sources */, @@ -8839,6 +9026,7 @@ A7D8B4E023E2514300DCD162 /* SDL_joystick.c in Sources */, A7D8BA4D23E2514400DCD162 /* SDL_render_gles2.c in Sources */, A7D8AC3123E2514100DCD162 /* SDL_surface.c in Sources */, + F316AB9B2B5A02C3002EF551 /* yuv_rgb_std.c in Sources */, F395BF6925633B2400942BFF /* SDL_crc32.c in Sources */, A7D8B54F23E2514300DCD162 /* SDL_hidapi_xboxone.c in Sources */, A7D8AD2723E2514100DCD162 /* SDL_blit_auto.c in Sources */, @@ -8937,7 +9125,6 @@ A7D8AB2523E2514100DCD162 /* SDL_log.c in Sources */, A7D8AE8823E2514100DCD162 /* SDL_cocoaopengl.m in Sources */, A7D8AB7323E2514100DCD162 /* SDL_offscreenframebuffer.c in Sources */, - A7D8B3BF23E2514200DCD162 /* yuv_rgb.c in Sources */, A7D8BA3D23E2514400DCD162 /* SDL_render_gles.c in Sources */, A7D8B43423E2514300DCD162 /* SDL_systhread.c in Sources */, A7D8BB3323E2514500DCD162 /* SDL_windowevents.c in Sources */, @@ -8966,6 +9153,7 @@ A7D8BBE523E2574800DCD162 /* SDL_uikitview.m in Sources */, A7D8BBE923E2574800DCD162 /* SDL_uikitvulkan.m in Sources */, A7D8ABCD23E2514100DCD162 /* SDL_blit_slow.c in Sources */, + F362B93D2B33920500D30B94 /* SDL_hidapi_steamdeck.c in Sources */, A7D8BA9723E2514400DCD162 /* s_copysign.c in Sources */, F3984CD025BCC92900374F43 /* SDL_hidapi_stadia.c in Sources */, A7D8AAB623E2514100DCD162 /* SDL_haptic.c in Sources */, @@ -8974,6 +9162,8 @@ A7D8BBC523E2561500DCD162 /* SDL_steamcontroller.c in Sources */, A7D8AD3223E2514100DCD162 /* SDL_blit_N.c in Sources */, A7D8BB7B23E2514500DCD162 /* SDL_dropevents.c in Sources */, + F362B95B2B33EB7300D30B94 /* SDL_steam_virtual_gamepad.c in Sources */, + F316AB972B5A02C3002EF551 /* yuv_rgb_std.c in Sources */, A7D8BACD23E2514500DCD162 /* e_atan2.c in Sources */, A7D8BA8B23E2514400DCD162 /* s_sin.c in Sources */, A7D8BBEB23E2574800DCD162 /* SDL_uikitwindow.m in Sources */, @@ -9047,9 +9237,11 @@ A7D8BB6923E2514500DCD162 /* SDL_keyboard.c in Sources */, A7D8ACE723E2514100DCD162 /* SDL_rect.c in Sources */, A7D8AE9A23E2514100DCD162 /* SDL_cocoaopengles.m in Sources */, + F316ABB22B5A02C3002EF551 /* yuv_rgb_lsx.c in Sources */, A7D8B96823E2514400DCD162 /* SDL_qsort.c in Sources */, A7D8B55123E2514300DCD162 /* SDL_hidapi_switch.c in Sources */, A7D8B96223E2514400DCD162 /* SDL_strtokr.c in Sources */, + F316ABA02B5A02C3002EF551 /* yuv_rgb_sse.c in Sources */, A7D8BB7523E2514500DCD162 /* SDL_clipboardevents.c in Sources */, A1BB8B6327F6CF330057CFA8 /* SDL_list.c in Sources */, A7D8BAB523E2514400DCD162 /* k_cos.c in Sources */, @@ -9134,7 +9326,6 @@ A7D8AE8B23E2514100DCD162 /* SDL_cocoaopengl.m in Sources */, A7D8AB7623E2514100DCD162 /* SDL_offscreenframebuffer.c in Sources */, 5616CA58252BB35C005D5928 /* SDL_url.c in Sources */, - A7D8B3C223E2514200DCD162 /* yuv_rgb.c in Sources */, A7D8BA4023E2514400DCD162 /* SDL_render_gles.c in Sources */, A7D8B43723E2514300DCD162 /* SDL_systhread.c in Sources */, F3973FAE28A59BDD00B84553 /* SDL_crc16.c in Sources */, @@ -9161,6 +9352,7 @@ A7D8ABD023E2514100DCD162 /* SDL_blit_slow.c in Sources */, A7D8BA9A23E2514400DCD162 /* s_copysign.c in Sources */, A7D8AAB923E2514100DCD162 /* SDL_haptic.c in Sources */, + F362B9402B33920500D30B94 /* SDL_hidapi_steamdeck.c in Sources */, F3984CD325BCC92900374F43 /* SDL_hidapi_stadia.c in Sources */, A7D8AF2723E2514100DCD162 /* SDL_cocoametalview.m in Sources */, A7D8B86323E2514400DCD162 /* SDL_audiotypecvt.c in Sources */, @@ -9169,6 +9361,8 @@ A7D8BBFA23E2574800DCD162 /* SDL_uikitopengles.m in Sources */, A7D8BAD023E2514500DCD162 /* e_atan2.c in Sources */, A7D8BA8E23E2514400DCD162 /* s_sin.c in Sources */, + F362B95E2B33EB7300D30B94 /* SDL_steam_virtual_gamepad.c in Sources */, + F316AB9A2B5A02C3002EF551 /* yuv_rgb_std.c in Sources */, A7D8B5EA23E2514300DCD162 /* SDL_power.c in Sources */, A7D8AED923E2514100DCD162 /* SDL_cocoakeyboard.m in Sources */, A7D8AB1923E2514100DCD162 /* SDL_dynapi.c in Sources */, @@ -9242,9 +9436,11 @@ A7D8BC0023E2574800DCD162 /* SDL_uikitview.m in Sources */, A7D8AE9D23E2514100DCD162 /* SDL_cocoaopengles.m in Sources */, A7D8B96B23E2514400DCD162 /* SDL_qsort.c in Sources */, + F316ABB52B5A02C3002EF551 /* yuv_rgb_lsx.c in Sources */, A7D8B55423E2514300DCD162 /* SDL_hidapi_switch.c in Sources */, A7D8B96523E2514400DCD162 /* SDL_strtokr.c in Sources */, A7D8BB7823E2514500DCD162 /* SDL_clipboardevents.c in Sources */, + F316ABA32B5A02C3002EF551 /* yuv_rgb_sse.c in Sources */, A7D8BAB823E2514400DCD162 /* k_cos.c in Sources */, A1BB8B6627F6CF330057CFA8 /* SDL_list.c in Sources */, A7D8B54823E2514300DCD162 /* SDL_hidapijoystick.c in Sources */, @@ -9326,7 +9522,6 @@ A7D8AB2A23E2514100DCD162 /* SDL_log.c in Sources */, A7D8AE8D23E2514100DCD162 /* SDL_cocoaopengl.m in Sources */, A7D8AB7823E2514100DCD162 /* SDL_offscreenframebuffer.c in Sources */, - A7D8B3C423E2514200DCD162 /* yuv_rgb.c in Sources */, A7D8BA4223E2514400DCD162 /* SDL_render_gles.c in Sources */, 5616CA61252BB35E005D5928 /* SDL_url.c in Sources */, A7D8B43923E2514300DCD162 /* SDL_systhread.c in Sources */, @@ -9356,6 +9551,7 @@ A7D8BA9C23E2514400DCD162 /* s_copysign.c in Sources */, A7D8AABB23E2514100DCD162 /* SDL_haptic.c in Sources */, A7D8AC9223E2514100DCD162 /* SDL_uikitvulkan.m in Sources */, + F362B9432B33920500D30B94 /* SDL_hidapi_steamdeck.c in Sources */, F3984CD625BCC92900374F43 /* SDL_hidapi_stadia.c in Sources */, A7D8AF2923E2514100DCD162 /* SDL_cocoametalview.m in Sources */, A7D8B86523E2514400DCD162 /* SDL_audiotypecvt.c in Sources */, @@ -9364,6 +9560,8 @@ A7D8AD3723E2514100DCD162 /* SDL_blit_N.c in Sources */, A7D8BB8023E2514500DCD162 /* SDL_dropevents.c in Sources */, A7D8BAD223E2514500DCD162 /* e_atan2.c in Sources */, + F362B9612B33EB7300D30B94 /* SDL_steam_virtual_gamepad.c in Sources */, + F316AB9D2B5A02C3002EF551 /* yuv_rgb_std.c in Sources */, A7D8BA9023E2514400DCD162 /* s_sin.c in Sources */, A7D8B5EC23E2514300DCD162 /* SDL_power.c in Sources */, A7D8AEDB23E2514100DCD162 /* SDL_cocoakeyboard.m in Sources */, @@ -9437,9 +9635,11 @@ A7D8ACEC23E2514100DCD162 /* SDL_rect.c in Sources */, A7D8AE9F23E2514100DCD162 /* SDL_cocoaopengles.m in Sources */, A7D8B96D23E2514400DCD162 /* SDL_qsort.c in Sources */, + F316ABB82B5A02C3002EF551 /* yuv_rgb_lsx.c in Sources */, A7D8B55623E2514300DCD162 /* SDL_hidapi_switch.c in Sources */, A7D8B96723E2514400DCD162 /* SDL_strtokr.c in Sources */, A7D8BB7A23E2514500DCD162 /* SDL_clipboardevents.c in Sources */, + F316ABA62B5A02C3002EF551 /* yuv_rgb_sse.c in Sources */, A7D8BABA23E2514400DCD162 /* k_cos.c in Sources */, A1BB8B6927F6CF330057CFA8 /* SDL_list.c in Sources */, A7D8B54A23E2514300DCD162 /* SDL_hidapijoystick.c in Sources */, @@ -9528,8 +9728,8 @@ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEPLOYMENT_POSTPROCESSING = YES; - DYLIB_COMPATIBILITY_VERSION = 2801.0.0; - DYLIB_CURRENT_VERSION = 2801.5.0; + DYLIB_COMPATIBILITY_VERSION = 3001.0.0; + DYLIB_CURRENT_VERSION = 3001.7.0; DYLIB_INSTALL_NAME_BASE = "@rpath"; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_ALTIVEC_EXTENSIONS = YES; @@ -9570,7 +9770,7 @@ isa = XCBuildConfiguration; buildSettings = { CLANG_LINK_OBJC_RUNTIME = NO; - MARKETING_VERSION = 2.28.5; + MARKETING_VERSION = 2.30.7; OTHER_LDFLAGS = "-liconv"; }; name = Release; @@ -9613,8 +9813,8 @@ CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; DEBUG_INFORMATION_FORMAT = dwarf; - DYLIB_COMPATIBILITY_VERSION = 2801.0.0; - DYLIB_CURRENT_VERSION = 2801.5.0; + DYLIB_COMPATIBILITY_VERSION = 3001.0.0; + DYLIB_CURRENT_VERSION = 3001.7.0; DYLIB_INSTALL_NAME_BASE = "@rpath"; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; @@ -9656,7 +9856,7 @@ isa = XCBuildConfiguration; buildSettings = { CLANG_LINK_OBJC_RUNTIME = NO; - MARKETING_VERSION = 2.28.5; + MARKETING_VERSION = 2.30.7; OTHER_LDFLAGS = "-liconv"; }; name = Debug; @@ -9862,8 +10062,8 @@ CURRENT_PROJECT_VERSION = 1; DEFINES_MODULE = YES; DEVELOPMENT_TEAM = ""; - DYLIB_COMPATIBILITY_VERSION = 2801.0.0; - DYLIB_CURRENT_VERSION = 2801.5.0; + DYLIB_COMPATIBILITY_VERSION = 3001.0.0; + DYLIB_CURRENT_VERSION = 3001.7.0; DYLIB_INSTALL_NAME_BASE = "@rpath"; GCC_C_LANGUAGE_STANDARD = gnu11; GCC_DYNAMIC_NO_PIC = NO; @@ -9914,8 +10114,8 @@ CURRENT_PROJECT_VERSION = 1; DEFINES_MODULE = YES; DEVELOPMENT_TEAM = ""; - DYLIB_COMPATIBILITY_VERSION = 2801.0.0; - DYLIB_CURRENT_VERSION = 2801.5.0; + DYLIB_COMPATIBILITY_VERSION = 3001.0.0; + DYLIB_CURRENT_VERSION = 3001.7.0; DYLIB_INSTALL_NAME_BASE = "@rpath"; ENABLE_NS_ASSERTIONS = NO; GCC_C_LANGUAGE_STANDARD = gnu11; diff --git a/thirdparty/SDL/Xcode/SDL/pkg-support/SDL.info b/thirdparty/SDL/Xcode/SDL/pkg-support/SDL.info index 637653bc6..0e289444d 100644 --- a/thirdparty/SDL/Xcode/SDL/pkg-support/SDL.info +++ b/thirdparty/SDL/Xcode/SDL/pkg-support/SDL.info @@ -1,4 +1,4 @@ -Title SDL 2.28.5 +Title SDL 2.30.7 Version 1 Description SDL Library for Mac OS X (http://www.libsdl.org) DefaultLocation /Library/Frameworks diff --git a/thirdparty/SDL/Xcode/SDL/pkg-support/resources/License.txt b/thirdparty/SDL/Xcode/SDL/pkg-support/resources/License.txt index 523c51e49..42f37361d 100644 --- a/thirdparty/SDL/Xcode/SDL/pkg-support/resources/License.txt +++ b/thirdparty/SDL/Xcode/SDL/pkg-support/resources/License.txt @@ -1,6 +1,6 @@ Simple DirectMedia Layer -Copyright (C) 1997-2023 Sam Lantinga +Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/Xcode/SDLTest/SDLTest.xcodeproj/project.pbxproj b/thirdparty/SDL/Xcode/SDLTest/SDLTest.xcodeproj/project.pbxproj index 1d5183a7d..543d100d7 100644 --- a/thirdparty/SDL/Xcode/SDLTest/SDLTest.xcodeproj/project.pbxproj +++ b/thirdparty/SDL/Xcode/SDLTest/SDLTest.xcodeproj/project.pbxproj @@ -155,6 +155,100 @@ DBEC54ED1A1A828A005B1EAB /* axis.bmp in CopyFiles */ = {isa = PBXBuildFile; fileRef = DBEC54D61A1A8145005B1EAB /* axis.bmp */; }; DBEC54EE1A1A828D005B1EAB /* button.bmp in CopyFiles */ = {isa = PBXBuildFile; fileRef = DBEC54D71A1A8145005B1EAB /* button.bmp */; }; DBEC54EF1A1A828F005B1EAB /* controllermap.bmp in CopyFiles */ = {isa = PBXBuildFile; fileRef = DBEC54D81A1A8145005B1EAB /* controllermap.bmp */; }; + F3A249DB2B389C7A00A5162D /* SDL2.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA643093FFD41000C53B3 /* SDL2.framework */; }; + F3A249DC2B389C7A00A5162D /* SDL2.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA643093FFD41000C53B3 /* SDL2.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + F3A249DE2B389CCA00A5162D /* SDL2.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA643093FFD41000C53B3 /* SDL2.framework */; }; + F3A249DF2B389CCA00A5162D /* SDL2.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA643093FFD41000C53B3 /* SDL2.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + F3A249E12B389CDB00A5162D /* SDL2.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA643093FFD41000C53B3 /* SDL2.framework */; }; + F3A249E22B389CDB00A5162D /* SDL2.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA643093FFD41000C53B3 /* SDL2.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + F3A249E42B389CE700A5162D /* SDL2.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA643093FFD41000C53B3 /* SDL2.framework */; }; + F3A249E52B389CE700A5162D /* SDL2.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA643093FFD41000C53B3 /* SDL2.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + F3A249E72B389CF000A5162D /* SDL2.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA643093FFD41000C53B3 /* SDL2.framework */; }; + F3A249E82B389CF000A5162D /* SDL2.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA643093FFD41000C53B3 /* SDL2.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + F3A249EA2B389CFB00A5162D /* SDL2.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA643093FFD41000C53B3 /* SDL2.framework */; }; + F3A249EB2B389CFB00A5162D /* SDL2.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA643093FFD41000C53B3 /* SDL2.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + F3A249ED2B389D0900A5162D /* SDL2.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA643093FFD41000C53B3 /* SDL2.framework */; }; + F3A249EE2B389D0900A5162D /* SDL2.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA643093FFD41000C53B3 /* SDL2.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + F3A249F02B389D3100A5162D /* SDL2.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA643093FFD41000C53B3 /* SDL2.framework */; }; + F3A249F12B389D3100A5162D /* SDL2.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA643093FFD41000C53B3 /* SDL2.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + F3A249F32B389D3B00A5162D /* SDL2.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA643093FFD41000C53B3 /* SDL2.framework */; }; + F3A249F42B389D3B00A5162D /* SDL2.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA643093FFD41000C53B3 /* SDL2.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + F3A249F62B389D4400A5162D /* SDL2.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA643093FFD41000C53B3 /* SDL2.framework */; }; + F3A249F72B389D4400A5162D /* SDL2.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA643093FFD41000C53B3 /* SDL2.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + F3A249F92B389D5200A5162D /* SDL2.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA643093FFD41000C53B3 /* SDL2.framework */; }; + F3A249FA2B389D5200A5162D /* SDL2.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA643093FFD41000C53B3 /* SDL2.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + F3A249FC2B389D5B00A5162D /* SDL2.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA643093FFD41000C53B3 /* SDL2.framework */; }; + F3A249FD2B389D5B00A5162D /* SDL2.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA643093FFD41000C53B3 /* SDL2.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + F3A249FF2B389D6600A5162D /* SDL2.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA643093FFD41000C53B3 /* SDL2.framework */; }; + F3A24A002B389D6600A5162D /* SDL2.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA643093FFD41000C53B3 /* SDL2.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + F3A24A022B389D6F00A5162D /* SDL2.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA643093FFD41000C53B3 /* SDL2.framework */; }; + F3A24A032B389D6F00A5162D /* SDL2.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA643093FFD41000C53B3 /* SDL2.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + F3A24A052B389D7C00A5162D /* SDL2.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA643093FFD41000C53B3 /* SDL2.framework */; }; + F3A24A062B389D7C00A5162D /* SDL2.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA643093FFD41000C53B3 /* SDL2.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + F3A24A082B389D8A00A5162D /* SDL2.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA643093FFD41000C53B3 /* SDL2.framework */; }; + F3A24A092B389D8A00A5162D /* SDL2.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA643093FFD41000C53B3 /* SDL2.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + F3A24A0B2B389D9B00A5162D /* SDL2.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA643093FFD41000C53B3 /* SDL2.framework */; }; + F3A24A0C2B389D9B00A5162D /* SDL2.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA643093FFD41000C53B3 /* SDL2.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + F3A24A0E2B389DA800A5162D /* SDL2.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA643093FFD41000C53B3 /* SDL2.framework */; }; + F3A24A0F2B389DA800A5162D /* SDL2.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA643093FFD41000C53B3 /* SDL2.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + F3A24A112B389DB400A5162D /* SDL2.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA643093FFD41000C53B3 /* SDL2.framework */; }; + F3A24A122B389DB400A5162D /* SDL2.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA643093FFD41000C53B3 /* SDL2.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + F3A24A142B389DC000A5162D /* SDL2.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA643093FFD41000C53B3 /* SDL2.framework */; }; + F3A24A152B389DC000A5162D /* SDL2.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA643093FFD41000C53B3 /* SDL2.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + F3A24A172B389DCA00A5162D /* SDL2.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA643093FFD41000C53B3 /* SDL2.framework */; }; + F3A24A182B389DCA00A5162D /* SDL2.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA643093FFD41000C53B3 /* SDL2.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + F3A24A1A2B389DD600A5162D /* SDL2.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA643093FFD41000C53B3 /* SDL2.framework */; }; + F3A24A1B2B389DD600A5162D /* SDL2.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA643093FFD41000C53B3 /* SDL2.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + F3A24A1D2B389DE100A5162D /* SDL2.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA643093FFD41000C53B3 /* SDL2.framework */; }; + F3A24A1E2B389DE100A5162D /* SDL2.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA643093FFD41000C53B3 /* SDL2.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + F3A24A202B389DEB00A5162D /* SDL2.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA643093FFD41000C53B3 /* SDL2.framework */; }; + F3A24A212B389DEB00A5162D /* SDL2.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA643093FFD41000C53B3 /* SDL2.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + F3A24A232B389DF500A5162D /* SDL2.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA643093FFD41000C53B3 /* SDL2.framework */; }; + F3A24A242B389DF500A5162D /* SDL2.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA643093FFD41000C53B3 /* SDL2.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + F3A24A262B389DFF00A5162D /* SDL2.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA643093FFD41000C53B3 /* SDL2.framework */; }; + F3A24A272B389DFF00A5162D /* SDL2.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA643093FFD41000C53B3 /* SDL2.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + F3A24A292B389E0900A5162D /* SDL2.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA643093FFD41000C53B3 /* SDL2.framework */; }; + F3A24A2A2B389E0900A5162D /* SDL2.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA643093FFD41000C53B3 /* SDL2.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + F3A24A2C2B389E1400A5162D /* SDL2.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA643093FFD41000C53B3 /* SDL2.framework */; }; + F3A24A2D2B389E1400A5162D /* SDL2.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA643093FFD41000C53B3 /* SDL2.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + F3A24A302B389E2800A5162D /* SDL2.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA643093FFD41000C53B3 /* SDL2.framework */; }; + F3A24A312B389E2800A5162D /* SDL2.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA643093FFD41000C53B3 /* SDL2.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + F3A24A332B389E3200A5162D /* SDL2.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA643093FFD41000C53B3 /* SDL2.framework */; }; + F3A24A342B389E3200A5162D /* SDL2.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA643093FFD41000C53B3 /* SDL2.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + F3A24A362B389E4F00A5162D /* SDL2.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA643093FFD41000C53B3 /* SDL2.framework */; }; + F3A24A372B389E4F00A5162D /* SDL2.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA643093FFD41000C53B3 /* SDL2.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + F3A24A392B389E5D00A5162D /* SDL2.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA643093FFD41000C53B3 /* SDL2.framework */; }; + F3A24A3A2B389E5D00A5162D /* SDL2.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA643093FFD41000C53B3 /* SDL2.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + F3A24A3C2B389E6600A5162D /* SDL2.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA643093FFD41000C53B3 /* SDL2.framework */; }; + F3A24A3D2B389E6600A5162D /* SDL2.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA643093FFD41000C53B3 /* SDL2.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + F3A24A3F2B389E7200A5162D /* SDL2.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA643093FFD41000C53B3 /* SDL2.framework */; }; + F3A24A402B389E7200A5162D /* SDL2.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA643093FFD41000C53B3 /* SDL2.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + F3A24A422B389E7C00A5162D /* SDL2.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA643093FFD41000C53B3 /* SDL2.framework */; }; + F3A24A432B389E7C00A5162D /* SDL2.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA643093FFD41000C53B3 /* SDL2.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + F3A24A452B389E8700A5162D /* SDL2.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA643093FFD41000C53B3 /* SDL2.framework */; }; + F3A24A462B389E8700A5162D /* SDL2.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA643093FFD41000C53B3 /* SDL2.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + F3A24A482B389E9100A5162D /* SDL2.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA643093FFD41000C53B3 /* SDL2.framework */; }; + F3A24A492B389E9100A5162D /* SDL2.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA643093FFD41000C53B3 /* SDL2.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + F3A24A4B2B389E9C00A5162D /* SDL2.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA643093FFD41000C53B3 /* SDL2.framework */; }; + F3A24A4C2B389E9C00A5162D /* SDL2.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA643093FFD41000C53B3 /* SDL2.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + F3A24A4E2B389EA500A5162D /* SDL2.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA643093FFD41000C53B3 /* SDL2.framework */; }; + F3A24A4F2B389EA500A5162D /* SDL2.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA643093FFD41000C53B3 /* SDL2.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + F3A24A512B389EB600A5162D /* SDL2.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA643093FFD41000C53B3 /* SDL2.framework */; }; + F3A24A522B389EB600A5162D /* SDL2.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA643093FFD41000C53B3 /* SDL2.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + F3A24A542B389EC200A5162D /* SDL2.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA643093FFD41000C53B3 /* SDL2.framework */; }; + F3A24A552B389EC200A5162D /* SDL2.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA643093FFD41000C53B3 /* SDL2.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + F3A24A572B389ECD00A5162D /* SDL2.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA643093FFD41000C53B3 /* SDL2.framework */; }; + F3A24A582B389ECD00A5162D /* SDL2.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA643093FFD41000C53B3 /* SDL2.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + F3A24A5A2B389ED800A5162D /* SDL2.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA643093FFD41000C53B3 /* SDL2.framework */; }; + F3A24A5B2B389ED800A5162D /* SDL2.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA643093FFD41000C53B3 /* SDL2.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + F3A24A5D2B389EE200A5162D /* SDL2.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA643093FFD41000C53B3 /* SDL2.framework */; }; + F3A24A5E2B389EE200A5162D /* SDL2.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA643093FFD41000C53B3 /* SDL2.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + F3A24A602B389EED00A5162D /* SDL2.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA643093FFD41000C53B3 /* SDL2.framework */; }; + F3A24A612B389EED00A5162D /* SDL2.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA643093FFD41000C53B3 /* SDL2.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + F3A24A632B389EF900A5162D /* SDL2.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA643093FFD41000C53B3 /* SDL2.framework */; }; + F3A24A642B389EF900A5162D /* SDL2.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA643093FFD41000C53B3 /* SDL2.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + F3A24A662B389F0400A5162D /* SDL2.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA643093FFD41000C53B3 /* SDL2.framework */; }; + F3A24A672B389F0400A5162D /* SDL2.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA643093FFD41000C53B3 /* SDL2.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; F3C17C6B28E4022A00E1A26D /* libSDL_test.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DB166D7F16A1D12400A1396C /* libSDL_test.a */; }; F3C17C7428E40AF000E1A26D /* testutils.c in Sources */ = {isa = PBXBuildFile; fileRef = F3C17C7328E40ADE00E1A26D /* testutils.c */; }; F3C17C7628E40BA200E1A26D /* controllermap_back.bmp in CopyFiles */ = {isa = PBXBuildFile; fileRef = F3C17C7528E40B6B00E1A26D /* controllermap_back.bmp */; }; @@ -727,47 +821,564 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + F3A249DD2B389C7A00A5162D /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + F3A249DC2B389C7A00A5162D /* SDL2.framework in Embed Frameworks */, + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; + F3A249E02B389CCA00A5162D /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + F3A249DF2B389CCA00A5162D /* SDL2.framework in Embed Frameworks */, + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; + F3A249E32B389CDB00A5162D /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + F3A249E22B389CDB00A5162D /* SDL2.framework in Embed Frameworks */, + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; + F3A249E62B389CE700A5162D /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + F3A249E52B389CE700A5162D /* SDL2.framework in Embed Frameworks */, + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; + F3A249E92B389CF000A5162D /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + F3A249E82B389CF000A5162D /* SDL2.framework in Embed Frameworks */, + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; + F3A249EC2B389CFB00A5162D /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + F3A249EB2B389CFB00A5162D /* SDL2.framework in Embed Frameworks */, + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; + F3A249EF2B389D0900A5162D /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + F3A249EE2B389D0900A5162D /* SDL2.framework in Embed Frameworks */, + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; + F3A249F22B389D3100A5162D /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + F3A249F12B389D3100A5162D /* SDL2.framework in Embed Frameworks */, + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; + F3A249F52B389D3B00A5162D /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + F3A249F42B389D3B00A5162D /* SDL2.framework in Embed Frameworks */, + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; + F3A249F82B389D4400A5162D /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + F3A249F72B389D4400A5162D /* SDL2.framework in Embed Frameworks */, + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; + F3A249FB2B389D5200A5162D /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + F3A249FA2B389D5200A5162D /* SDL2.framework in Embed Frameworks */, + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; + F3A249FE2B389D5B00A5162D /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + F3A249FD2B389D5B00A5162D /* SDL2.framework in Embed Frameworks */, + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; + F3A24A012B389D6600A5162D /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + F3A24A002B389D6600A5162D /* SDL2.framework in Embed Frameworks */, + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; + F3A24A042B389D6F00A5162D /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + F3A24A032B389D6F00A5162D /* SDL2.framework in Embed Frameworks */, + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; + F3A24A072B389D7C00A5162D /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + F3A24A062B389D7C00A5162D /* SDL2.framework in Embed Frameworks */, + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; + F3A24A0A2B389D8A00A5162D /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + F3A24A092B389D8A00A5162D /* SDL2.framework in Embed Frameworks */, + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; + F3A24A0D2B389D9B00A5162D /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + F3A24A0C2B389D9B00A5162D /* SDL2.framework in Embed Frameworks */, + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; + F3A24A102B389DA800A5162D /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + F3A24A0F2B389DA800A5162D /* SDL2.framework in Embed Frameworks */, + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; + F3A24A132B389DB400A5162D /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + F3A24A122B389DB400A5162D /* SDL2.framework in Embed Frameworks */, + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; + F3A24A162B389DC000A5162D /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + F3A24A152B389DC000A5162D /* SDL2.framework in Embed Frameworks */, + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; + F3A24A192B389DCA00A5162D /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + F3A24A182B389DCA00A5162D /* SDL2.framework in Embed Frameworks */, + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; + F3A24A1C2B389DD600A5162D /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + F3A24A1B2B389DD600A5162D /* SDL2.framework in Embed Frameworks */, + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; + F3A24A1F2B389DE100A5162D /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + F3A24A1E2B389DE100A5162D /* SDL2.framework in Embed Frameworks */, + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; + F3A24A222B389DEB00A5162D /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + F3A24A212B389DEB00A5162D /* SDL2.framework in Embed Frameworks */, + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; + F3A24A252B389DF500A5162D /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + F3A24A242B389DF500A5162D /* SDL2.framework in Embed Frameworks */, + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; + F3A24A282B389E0000A5162D /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + F3A24A272B389DFF00A5162D /* SDL2.framework in Embed Frameworks */, + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; + F3A24A2B2B389E0900A5162D /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + F3A24A2A2B389E0900A5162D /* SDL2.framework in Embed Frameworks */, + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; + F3A24A2E2B389E1500A5162D /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + F3A24A2D2B389E1400A5162D /* SDL2.framework in Embed Frameworks */, + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; + F3A24A322B389E2800A5162D /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + F3A24A312B389E2800A5162D /* SDL2.framework in Embed Frameworks */, + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; + F3A24A352B389E3200A5162D /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + F3A24A342B389E3200A5162D /* SDL2.framework in Embed Frameworks */, + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; + F3A24A382B389E4F00A5162D /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + F3A24A372B389E4F00A5162D /* SDL2.framework in Embed Frameworks */, + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; + F3A24A3B2B389E5D00A5162D /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + F3A24A3A2B389E5D00A5162D /* SDL2.framework in Embed Frameworks */, + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; + F3A24A3E2B389E6600A5162D /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + F3A24A3D2B389E6600A5162D /* SDL2.framework in Embed Frameworks */, + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; + F3A24A412B389E7200A5162D /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + F3A24A402B389E7200A5162D /* SDL2.framework in Embed Frameworks */, + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; + F3A24A442B389E7C00A5162D /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + F3A24A432B389E7C00A5162D /* SDL2.framework in Embed Frameworks */, + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; + F3A24A472B389E8700A5162D /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + F3A24A462B389E8700A5162D /* SDL2.framework in Embed Frameworks */, + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; + F3A24A4A2B389E9100A5162D /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + F3A24A492B389E9100A5162D /* SDL2.framework in Embed Frameworks */, + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; + F3A24A4D2B389E9C00A5162D /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + F3A24A4C2B389E9C00A5162D /* SDL2.framework in Embed Frameworks */, + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; + F3A24A502B389EA600A5162D /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + F3A24A4F2B389EA500A5162D /* SDL2.framework in Embed Frameworks */, + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; + F3A24A532B389EB600A5162D /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + F3A24A522B389EB600A5162D /* SDL2.framework in Embed Frameworks */, + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; + F3A24A562B389EC200A5162D /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + F3A24A552B389EC200A5162D /* SDL2.framework in Embed Frameworks */, + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; + F3A24A592B389ECD00A5162D /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + F3A24A582B389ECD00A5162D /* SDL2.framework in Embed Frameworks */, + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; + F3A24A5C2B389ED800A5162D /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + F3A24A5B2B389ED800A5162D /* SDL2.framework in Embed Frameworks */, + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; + F3A24A5F2B389EE200A5162D /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + F3A24A5E2B389EE200A5162D /* SDL2.framework in Embed Frameworks */, + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; + F3A24A622B389EED00A5162D /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + F3A24A612B389EED00A5162D /* SDL2.framework in Embed Frameworks */, + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; + F3A24A652B389EF900A5162D /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + F3A24A642B389EF900A5162D /* SDL2.framework in Embed Frameworks */, + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; + F3A24A682B389F0400A5162D /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + F3A24A672B389F0400A5162D /* SDL2.framework in Embed Frameworks */, + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ - 0017958C10741F7900F5D044 /* testatomic */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; name = testatomic; path = testatomic.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 0017958C10741F7900F5D044 /* testatomic.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = testatomic.app; sourceTree = BUILT_PRODUCTS_DIR; }; 0017958F1074216E00F5D044 /* testatomic.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = testatomic.c; sourceTree = ""; }; - 001795AD107421BF00F5D044 /* testaudioinfo */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; name = testaudioinfo; path = testaudioinfo.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 001795AD107421BF00F5D044 /* testaudioinfo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = testaudioinfo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 001795B01074222D00F5D044 /* testaudioinfo.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = testaudioinfo.c; sourceTree = ""; }; 0017972110742F3200F5D044 /* testgl2.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = testgl2.app; sourceTree = BUILT_PRODUCTS_DIR; }; 0017972710742FB900F5D044 /* testgl2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = testgl2.c; sourceTree = ""; }; - 00179748107430D600F5D044 /* testhaptic */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; name = testhaptic; path = testhaptic.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 00179748107430D600F5D044 /* testhaptic.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = testhaptic.app; sourceTree = BUILT_PRODUCTS_DIR; }; 0017974E1074315700F5D044 /* testhaptic.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = testhaptic.c; sourceTree = ""; }; - 0017976E107431B300F5D044 /* testdraw2 */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; name = testdraw2; path = testdraw2.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 0017976E107431B300F5D044 /* testdraw2.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = testdraw2.app; sourceTree = BUILT_PRODUCTS_DIR; }; 001797711074320D00F5D044 /* testdraw2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = testdraw2.c; sourceTree = ""; }; - 0017978E107432AE00F5D044 /* testime */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; name = testime; path = testime.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 0017978E107432AE00F5D044 /* testime.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = testime.app; sourceTree = BUILT_PRODUCTS_DIR; }; 00179791107432FA00F5D044 /* testime.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = testime.c; sourceTree = ""; }; - 001797AE1074334C00F5D044 /* testintersections */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; name = testintersections; path = testintersections.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 001797AE1074334C00F5D044 /* testintersections.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = testintersections.app; sourceTree = BUILT_PRODUCTS_DIR; }; 001797B31074339C00F5D044 /* testintersections.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = testintersections.c; sourceTree = ""; }; - 001797D0107433C600F5D044 /* testloadso */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; name = testloadso; path = testloadso.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 001797D0107433C600F5D044 /* testloadso.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = testloadso.app; sourceTree = BUILT_PRODUCTS_DIR; }; 001797D31074343E00F5D044 /* testloadso.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = testloadso.c; sourceTree = ""; }; - 001798121074355200F5D044 /* testmultiaudio */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; name = testmultiaudio; path = testmultiaudio.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 001798121074355200F5D044 /* testmultiaudio.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = testmultiaudio.app; sourceTree = BUILT_PRODUCTS_DIR; }; 001798151074359B00F5D044 /* testmultiaudio.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = testmultiaudio.c; sourceTree = ""; }; 0017985A107436ED00F5D044 /* testnative.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = testnative.c; sourceTree = ""; }; 0017985B107436ED00F5D044 /* testnative.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = testnative.h; sourceTree = ""; }; 0017985C107436ED00F5D044 /* testnativecocoa.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = testnativecocoa.m; sourceTree = ""; }; 00179872107438D000F5D044 /* testnativex11.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = testnativex11.c; sourceTree = ""; }; 001798941074392D00F5D044 /* testnative.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = testnative.app; sourceTree = BUILT_PRODUCTS_DIR; }; - 001798B5107439DF00F5D044 /* testpower */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; name = testpower; path = testpower.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 001798B5107439DF00F5D044 /* testpower.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = testpower.app; sourceTree = BUILT_PRODUCTS_DIR; }; 001798B910743A4900F5D044 /* testpower.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = testpower.c; sourceTree = ""; }; - 001798F210743BEC00F5D044 /* testresample */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; name = testresample; path = testresample.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 001798F210743BEC00F5D044 /* testresample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = testresample.app; sourceTree = BUILT_PRODUCTS_DIR; }; 001798F910743E9200F5D044 /* testresample.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = testresample.c; sourceTree = ""; }; - 0017991610743F1000F5D044 /* testsprite2 */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; name = testsprite2; path = testsprite2.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 0017991610743F1000F5D044 /* testsprite2.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = testsprite2.app; sourceTree = BUILT_PRODUCTS_DIR; }; 0017991910743F5300F5D044 /* testsprite2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = testsprite2.c; sourceTree = ""; }; - 0017993810743FB700F5D044 /* testwm2 */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; name = testwm2; path = testwm2.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 0017993810743FB700F5D044 /* testwm2.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = testwm2.app; sourceTree = BUILT_PRODUCTS_DIR; }; 0017993B10743FEF00F5D044 /* testwm2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = testwm2.c; sourceTree = ""; }; - 002F341209CA1BFF00EBEB88 /* testfile */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; name = testfile; path = testfile.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 002F341209CA1BFF00EBEB88 /* testfile.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = testfile.app; sourceTree = BUILT_PRODUCTS_DIR; }; 002F341709CA1C5B00EBEB88 /* testfile.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = testfile.c; sourceTree = ""; }; - 002F343109CA1F0300EBEB88 /* testiconv */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; name = testiconv; path = testiconv.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 002F343109CA1F0300EBEB88 /* testiconv.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = testiconv.app; sourceTree = BUILT_PRODUCTS_DIR; }; 002F343609CA1F6F00EBEB88 /* testiconv.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = testiconv.c; sourceTree = ""; }; - 002F344D09CA1FB300EBEB88 /* testoverlay2 */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; name = testoverlay2; path = testoverlay2.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 002F344D09CA1FB300EBEB88 /* testoverlay2.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = testoverlay2.app; sourceTree = BUILT_PRODUCTS_DIR; }; 002F345209CA201C00EBEB88 /* testoverlay2.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = testoverlay2.c; sourceTree = ""; }; - 002F346A09CA204F00EBEB88 /* testplatform */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; name = testplatform; path = testplatform.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 002F346A09CA204F00EBEB88 /* testplatform.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = testplatform.app; sourceTree = BUILT_PRODUCTS_DIR; }; 002F346F09CA20A600EBEB88 /* testplatform.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = testplatform.c; sourceTree = ""; }; 003FA63A093FFD41000C53B3 /* SDL.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = SDL.xcodeproj; path = ../SDL/SDL.xcodeproj; sourceTree = SOURCE_ROOT; }; 00794E5D09D20839003FC8A1 /* icon.bmp */ = {isa = PBXFileReference; lastKnownFileType = image.bmp; path = icon.bmp; sourceTree = ""; }; @@ -787,27 +1398,27 @@ 092D6D62FFB312AA7F000001 /* testjoystick.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = testjoystick.c; sourceTree = ""; }; 092D6D6CFFB313437F000001 /* testkeys.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = testkeys.c; sourceTree = ""; }; 092D6D75FFB313BB7F000001 /* testlock.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = testlock.c; sourceTree = ""; }; - 4537749212091504002F0F45 /* testshape */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; name = testshape; path = testshape.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 4537749212091504002F0F45 /* testshape.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = testshape.app; sourceTree = BUILT_PRODUCTS_DIR; }; 453774A4120915E3002F0F45 /* testshape.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = testshape.c; sourceTree = ""; }; 66E88E8A203B778F0004D44E /* testyuv_cvt.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = testyuv_cvt.c; sourceTree = ""; }; AAF02FF41F90089800B9A9FB /* SDL_test_memory.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_test_memory.c; sourceTree = ""; }; BBFC088E164C6820003E6A99 /* testgamecontroller.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = testgamecontroller.c; sourceTree = ""; }; - BBFC08CD164C6862003E6A99 /* testgamecontroller */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; name = testgamecontroller; path = testgamecontroller.app; sourceTree = BUILT_PRODUCTS_DIR; }; - BEC566B60761D90300A33029 /* checkkeys */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; name = checkkeys; path = checkkeys.app; sourceTree = BUILT_PRODUCTS_DIR; }; - BEC566D10761D90300A33029 /* loopwave */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; name = loopwave; path = loopwave.app; sourceTree = BUILT_PRODUCTS_DIR; }; - BEC567060761D90400A33029 /* testerror */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; name = testerror; path = testerror.app; sourceTree = BUILT_PRODUCTS_DIR; }; - BEC5672E0761D90400A33029 /* testthread */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; name = testthread; path = testthread.app; sourceTree = BUILT_PRODUCTS_DIR; }; - BEC5673B0761D90400A33029 /* testjoystick */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; name = testjoystick; path = testjoystick.app; sourceTree = BUILT_PRODUCTS_DIR; }; - BEC567480761D90400A33029 /* testkeys */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; name = testkeys; path = testkeys.app; sourceTree = BUILT_PRODUCTS_DIR; }; - BEC567550761D90400A33029 /* testlock */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; name = testlock; path = testlock.app; sourceTree = BUILT_PRODUCTS_DIR; }; - BEC5677D0761D90500A33029 /* testsem */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; name = testsem; path = testsem.app; sourceTree = BUILT_PRODUCTS_DIR; }; - BEC567980761D90500A33029 /* testtimer */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; name = testtimer; path = testtimer.app; sourceTree = BUILT_PRODUCTS_DIR; }; - BEC567B20761D90500A33029 /* testversion */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; name = testversion; path = testversion.app; sourceTree = BUILT_PRODUCTS_DIR; }; - BEC567F50761D90600A33029 /* torturethread */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; name = torturethread; path = torturethread.app; sourceTree = BUILT_PRODUCTS_DIR; }; + BBFC08CD164C6862003E6A99 /* testgamecontroller.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = testgamecontroller.app; sourceTree = BUILT_PRODUCTS_DIR; }; + BEC566B60761D90300A33029 /* checkkeys.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = checkkeys.app; sourceTree = BUILT_PRODUCTS_DIR; }; + BEC566D10761D90300A33029 /* loopwave.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = loopwave.app; sourceTree = BUILT_PRODUCTS_DIR; }; + BEC567060761D90400A33029 /* testerror.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = testerror.app; sourceTree = BUILT_PRODUCTS_DIR; }; + BEC5672E0761D90400A33029 /* testthread.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = testthread.app; sourceTree = BUILT_PRODUCTS_DIR; }; + BEC5673B0761D90400A33029 /* testjoystick.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = testjoystick.app; sourceTree = BUILT_PRODUCTS_DIR; }; + BEC567480761D90400A33029 /* testkeys.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = testkeys.app; sourceTree = BUILT_PRODUCTS_DIR; }; + BEC567550761D90400A33029 /* testlock.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = testlock.app; sourceTree = BUILT_PRODUCTS_DIR; }; + BEC5677D0761D90500A33029 /* testsem.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = testsem.app; sourceTree = BUILT_PRODUCTS_DIR; }; + BEC567980761D90500A33029 /* testtimer.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = testtimer.app; sourceTree = BUILT_PRODUCTS_DIR; }; + BEC567B20761D90500A33029 /* testversion.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = testversion.app; sourceTree = BUILT_PRODUCTS_DIR; }; + BEC567F50761D90600A33029 /* torturethread.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = torturethread.app; sourceTree = BUILT_PRODUCTS_DIR; }; DB0F48D717CA51D2008798C5 /* testdrawchessboard.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = testdrawchessboard.c; sourceTree = ""; }; DB0F48D817CA51D2008798C5 /* testfilesystem.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = testfilesystem.c; sourceTree = ""; }; - DB0F48EC17CA51E5008798C5 /* testdrawchessboard */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; name = testdrawchessboard; path = testdrawchessboard.app; sourceTree = BUILT_PRODUCTS_DIR; }; - DB0F490117CA5212008798C5 /* testfilesystem */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; name = testfilesystem; path = testfilesystem.app; sourceTree = BUILT_PRODUCTS_DIR; }; + DB0F48EC17CA51E5008798C5 /* testdrawchessboard.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = testdrawchessboard.app; sourceTree = BUILT_PRODUCTS_DIR; }; + DB0F490117CA5212008798C5 /* testfilesystem.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = testfilesystem.app; sourceTree = BUILT_PRODUCTS_DIR; }; DB166CBB16A1C74100A1396C /* testgesture.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = testgesture.c; sourceTree = ""; }; DB166CBC16A1C74100A1396C /* testgles.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = testgles.c; sourceTree = ""; }; DB166CBD16A1C74100A1396C /* testmessage.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = testmessage.c; sourceTree = ""; }; @@ -835,27 +1446,28 @@ DB166D9016A1D1A500A1396C /* SDL_test_log.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_test_log.c; sourceTree = ""; }; DB166D9116A1D1A500A1396C /* SDL_test_md5.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_test_md5.c; sourceTree = ""; }; DB166D9216A1D1A500A1396C /* SDL_test_random.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_test_random.c; sourceTree = ""; }; - DB166DBF16A1D2F600A1396C /* testgesture */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; name = testgesture; path = testgesture.app; sourceTree = BUILT_PRODUCTS_DIR; }; - DB166DD516A1D36A00A1396C /* testmessage */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; name = testmessage; path = testmessage.app; sourceTree = BUILT_PRODUCTS_DIR; }; - DB166DEE16A1D50C00A1396C /* testrelative */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; name = testrelative; path = testrelative.app; sourceTree = BUILT_PRODUCTS_DIR; }; - DB166E0516A1D57C00A1396C /* testrendercopyex */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; name = testrendercopyex; path = testrendercopyex.app; sourceTree = BUILT_PRODUCTS_DIR; }; - DB166E1C16A1D5AD00A1396C /* testrendertarget */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; name = testrendertarget; path = testrendertarget.app; sourceTree = BUILT_PRODUCTS_DIR; }; - DB166E3816A1D64D00A1396C /* testrumble */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; name = testrumble; path = testrumble.app; sourceTree = BUILT_PRODUCTS_DIR; }; - DB166E5216A1D69000A1396C /* testscale */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; name = testscale; path = testscale.app; sourceTree = BUILT_PRODUCTS_DIR; }; - DB166E6816A1D6F300A1396C /* testshader */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; name = testshader; path = testshader.app; sourceTree = BUILT_PRODUCTS_DIR; }; - DB166E7E16A1D78400A1396C /* testspriteminimal */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; name = testspriteminimal; path = testspriteminimal.app; sourceTree = BUILT_PRODUCTS_DIR; }; - DB166E9116A1D78C00A1396C /* teststreaming */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; name = teststreaming; path = teststreaming.app; sourceTree = BUILT_PRODUCTS_DIR; }; + DB166DBF16A1D2F600A1396C /* testgesture.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = testgesture.app; sourceTree = BUILT_PRODUCTS_DIR; }; + DB166DD516A1D36A00A1396C /* testmessage.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = testmessage.app; sourceTree = BUILT_PRODUCTS_DIR; }; + DB166DEE16A1D50C00A1396C /* testrelative.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = testrelative.app; sourceTree = BUILT_PRODUCTS_DIR; }; + DB166E0516A1D57C00A1396C /* testrendercopyex.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = testrendercopyex.app; sourceTree = BUILT_PRODUCTS_DIR; }; + DB166E1C16A1D5AD00A1396C /* testrendertarget.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = testrendertarget.app; sourceTree = BUILT_PRODUCTS_DIR; }; + DB166E3816A1D64D00A1396C /* testrumble.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = testrumble.app; sourceTree = BUILT_PRODUCTS_DIR; }; + DB166E5216A1D69000A1396C /* testscale.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = testscale.app; sourceTree = BUILT_PRODUCTS_DIR; }; + DB166E6816A1D6F300A1396C /* testshader.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = testshader.app; sourceTree = BUILT_PRODUCTS_DIR; }; + DB166E7E16A1D78400A1396C /* testspriteminimal.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = testspriteminimal.app; sourceTree = BUILT_PRODUCTS_DIR; }; + DB166E9116A1D78C00A1396C /* teststreaming.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = teststreaming.app; sourceTree = BUILT_PRODUCTS_DIR; }; DB166ECF16A1D87000A1396C /* shapes */ = {isa = PBXFileReference; lastKnownFileType = folder; path = shapes; sourceTree = ""; }; DB445EF818184B7000B306B0 /* testdropfile.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = testdropfile.app; sourceTree = BUILT_PRODUCTS_DIR; }; DB445EFA18184BB600B306B0 /* testdropfile.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = testdropfile.c; sourceTree = ""; }; - DB89957E18A19ABA0092407C /* testhotplug */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; name = testhotplug; path = testhotplug.app; sourceTree = BUILT_PRODUCTS_DIR; }; + DB89957E18A19ABA0092407C /* testhotplug.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = testhotplug.app; sourceTree = BUILT_PRODUCTS_DIR; }; DB89958318A19B130092407C /* testhotplug.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = testhotplug.c; sourceTree = ""; }; DBBC552C182831D700F3CA8D /* TestDropFile-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "TestDropFile-Info.plist"; sourceTree = SOURCE_ROOT; }; DBEC54D11A1A811D005B1EAB /* controllermap.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = controllermap.c; sourceTree = ""; }; DBEC54D61A1A8145005B1EAB /* axis.bmp */ = {isa = PBXFileReference; lastKnownFileType = image.bmp; path = axis.bmp; sourceTree = ""; }; DBEC54D71A1A8145005B1EAB /* button.bmp */ = {isa = PBXFileReference; lastKnownFileType = image.bmp; path = button.bmp; sourceTree = ""; }; DBEC54D81A1A8145005B1EAB /* controllermap.bmp */ = {isa = PBXFileReference; lastKnownFileType = image.bmp; path = controllermap.bmp; sourceTree = ""; }; - DBEC54EA1A1A81C3005B1EAB /* controllermap */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; name = controllermap; path = controllermap.app; sourceTree = BUILT_PRODUCTS_DIR; }; + DBEC54EA1A1A81C3005B1EAB /* controllermap.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = controllermap.app; sourceTree = BUILT_PRODUCTS_DIR; }; + F3A24A2F2B389E1D00A5162D /* testoverlay2-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = "testoverlay2-Info.plist"; sourceTree = ""; }; F3C17C6A28E3FD4400E1A26D /* config.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = config.xcconfig; sourceTree = ""; }; F3C17C7328E40ADE00E1A26D /* testutils.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = testutils.c; sourceTree = ""; }; F3C17C7528E40B6B00E1A26D /* controllermap_back.bmp */ = {isa = PBXFileReference; lastKnownFileType = image.bmp; path = controllermap_back.bmp; sourceTree = ""; }; @@ -869,6 +1481,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + F3A249E72B389CF000A5162D /* SDL2.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -876,6 +1489,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + F3A249EA2B389CFB00A5162D /* SDL2.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -884,6 +1498,7 @@ buildActionMask = 2147483647; files = ( DB166DA316A1D1FA00A1396C /* libSDL_test.a in Frameworks */, + F3A24A082B389D8A00A5162D /* SDL2.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -891,6 +1506,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + F3A24A0B2B389D9B00A5162D /* SDL2.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -899,6 +1515,7 @@ buildActionMask = 2147483647; files = ( DB166DA216A1D1E900A1396C /* libSDL_test.a in Frameworks */, + F3A249ED2B389D0900A5162D /* SDL2.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -907,6 +1524,7 @@ buildActionMask = 2147483647; files = ( DB166DA716A1D24D00A1396C /* libSDL_test.a in Frameworks */, + F3A24A142B389DC000A5162D /* SDL2.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -915,6 +1533,7 @@ buildActionMask = 2147483647; files = ( DB166DAA16A1D27700A1396C /* libSDL_test.a in Frameworks */, + F3A24A172B389DCA00A5162D /* SDL2.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -922,6 +1541,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + F3A24A202B389DEB00A5162D /* SDL2.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -929,6 +1549,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + F3A24A292B389E0900A5162D /* SDL2.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -936,6 +1557,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + F3A24A2C2B389E1400A5162D /* SDL2.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -943,6 +1565,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + F3A24A362B389E4F00A5162D /* SDL2.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -950,6 +1573,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + F3A24A422B389E7C00A5162D /* SDL2.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -958,6 +1582,7 @@ buildActionMask = 2147483647; files = ( DB166DAB16A1D27C00A1396C /* libSDL_test.a in Frameworks */, + F3A249DB2B389C7A00A5162D /* SDL2.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -966,6 +1591,7 @@ buildActionMask = 2147483647; files = ( DB166DAC16A1D29000A1396C /* libSDL_test.a in Frameworks */, + F3A24A632B389EF900A5162D /* SDL2.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -973,6 +1599,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + F3A249F92B389D5200A5162D /* SDL2.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -980,6 +1607,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + F3A24A112B389DB400A5162D /* SDL2.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -987,6 +1615,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + F3A24A302B389E2800A5162D /* SDL2.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -994,6 +1623,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + F3A24A332B389E3200A5162D /* SDL2.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1002,6 +1632,7 @@ buildActionMask = 2147483647; files = ( DB166DA416A1D21700A1396C /* libSDL_test.a in Frameworks */, + F3A24A512B389EB600A5162D /* SDL2.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1009,6 +1640,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + F3A249FF2B389D6600A5162D /* SDL2.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1017,6 +1649,7 @@ buildActionMask = 2147483647; files = ( F3C17C6B28E4022A00E1A26D /* libSDL_test.a in Frameworks */, + F3A249DE2B389CCA00A5162D /* SDL2.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1024,6 +1657,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + F3A249E42B389CE700A5162D /* SDL2.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1031,6 +1665,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + F3A249F62B389D4400A5162D /* SDL2.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1038,6 +1673,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + F3A24A5A2B389ED800A5162D /* SDL2.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1045,6 +1681,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + F3A24A1A2B389DD600A5162D /* SDL2.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1052,6 +1689,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + F3A24A1D2B389DE100A5162D /* SDL2.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1059,6 +1697,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + F3A24A232B389DF500A5162D /* SDL2.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1066,6 +1705,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + F3A24A4B2B389E9C00A5162D /* SDL2.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1073,6 +1713,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + F3A24A5D2B389EE200A5162D /* SDL2.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1080,6 +1721,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + F3A24A602B389EED00A5162D /* SDL2.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1087,6 +1729,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + F3A24A662B389F0400A5162D /* SDL2.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1094,6 +1737,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + F3A249F02B389D3100A5162D /* SDL2.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1101,6 +1745,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + F3A249FC2B389D5B00A5162D /* SDL2.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1116,6 +1761,7 @@ buildActionMask = 2147483647; files = ( F3C17C7A28E40CA600E1A26D /* libSDL_test.a in Frameworks */, + F3A24A052B389D7C00A5162D /* SDL2.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1123,6 +1769,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + F3A24A262B389DFF00A5162D /* SDL2.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1131,6 +1778,7 @@ buildActionMask = 2147483647; files = ( DB166DEA16A1D50C00A1396C /* libSDL_test.a in Frameworks */, + F3A24A392B389E5D00A5162D /* SDL2.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1139,6 +1787,7 @@ buildActionMask = 2147483647; files = ( DB166E0116A1D57C00A1396C /* libSDL_test.a in Frameworks */, + F3A24A3C2B389E6600A5162D /* SDL2.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1147,6 +1796,7 @@ buildActionMask = 2147483647; files = ( DB166E1816A1D5AD00A1396C /* libSDL_test.a in Frameworks */, + F3A24A3F2B389E7200A5162D /* SDL2.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1154,6 +1804,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + F3A24A452B389E8700A5162D /* SDL2.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1162,6 +1813,7 @@ buildActionMask = 2147483647; files = ( DB166E4B16A1D69000A1396C /* libSDL_test.a in Frameworks */, + F3A24A482B389E9100A5162D /* SDL2.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1169,6 +1821,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + F3A24A4E2B389EA500A5162D /* SDL2.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1176,6 +1829,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + F3A24A542B389EC200A5162D /* SDL2.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1183,6 +1837,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + F3A24A572B389ECD00A5162D /* SDL2.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1191,6 +1846,7 @@ buildActionMask = 2147483647; files = ( DB445EF418184B7000B306B0 /* libSDL_test.a in Frameworks */, + F3A249F32B389D3B00A5162D /* SDL2.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1198,6 +1854,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + F3A24A0E2B389DA800A5162D /* SDL2.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1205,6 +1862,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + F3A249E12B389CDB00A5162D /* SDL2.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1213,6 +1871,7 @@ buildActionMask = 2147483647; files = ( F3C17CED28E417F400E1A26D /* libSDL_test.a in Frameworks */, + F3A24A022B389D6F00A5162D /* SDL2.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1260,12 +1919,14 @@ 08FB7794FE84155DC02AAC07 /* SDLTest */ = { isa = PBXGroup; children = ( + F3A24A2F2B389E1D00A5162D /* testoverlay2-Info.plist */, F3C17C6A28E3FD4400E1A26D /* config.xcconfig */, 003FA63A093FFD41000C53B3 /* SDL.xcodeproj */, 08FB7795FE84155DC02AAC07 /* Source */, DB166D8316A1D17E00A1396C /* SDL_Test */, 00794E4609D207B4003FC8A1 /* Resources */, 1AB674ADFE9D54B511CA2CBB /* Products */, + F3A249CF2B389C7A00A5162D /* Frameworks */, ); comments = "I made these tests link against our \"default\" framework which includes X11 stuff. If you didn't install the X11 headers with Xcode, you might have problems building the SDL.framework (which is a dependency). You can swap the dependencies around to get around this, or you can modify the default SDL.framework target to not include X11 stuff. (Go into its target build options and remove all the Preprocessor macros.)\n\n\n\nWe are sort of in a half-way state at the moment. Going \"all-the-way\" means we copy the SDL.framework inside the app bundle so we can run the test without the step of the user \"installing\" the framework. But there is an oversight/bug in Xcode that doesn't correctly find the location of the framework when in an embedded/nested Xcode project. We could probably try to hack this with a shell script that checks multiple directories for existence, but this is messier and more work than I prefer, so I rather just wait for Apple to fix this. In the meantime...\n\nThe \"All\" target will build the SDL framework from the Xcode project. The other targets do not have this dependency set (for flexibility reasons in case we make changes). If you have not built the framework, you will probably be unable to link. You will either need to build the framework, or you need to add \"-framework SDL\" to the link options and make sure you have the SDL.framework installed somewhere where it can be seen (like /Library/Frameworks...I think we already set this one up.) \n\nTo run though, you should have a copy of the SDL.framework in /Library/Frameworks or ~/Library/Frameworks.\n\n\n\n\ntestgl and testdyngl need -DHAVE_OPENGL\ntestgl needs to link against OpenGL.framework\n\n"; name = SDLTest; @@ -1336,53 +1997,53 @@ 1AB674ADFE9D54B511CA2CBB /* Products */ = { isa = PBXGroup; children = ( - BEC566B60761D90300A33029 /* checkkeys */, - BEC566D10761D90300A33029 /* loopwave */, - BEC567060761D90400A33029 /* testerror */, - BEC5672E0761D90400A33029 /* testthread */, - BEC5673B0761D90400A33029 /* testjoystick */, - BEC567480761D90400A33029 /* testkeys */, - BEC567550761D90400A33029 /* testlock */, - BEC5677D0761D90500A33029 /* testsem */, - BEC567980761D90500A33029 /* testtimer */, - BEC567B20761D90500A33029 /* testversion */, - BEC567F50761D90600A33029 /* torturethread */, - 002F341209CA1BFF00EBEB88 /* testfile */, - 002F343109CA1F0300EBEB88 /* testiconv */, - 002F344D09CA1FB300EBEB88 /* testoverlay2 */, - 002F346A09CA204F00EBEB88 /* testplatform */, - 0017958C10741F7900F5D044 /* testatomic */, - 001795AD107421BF00F5D044 /* testaudioinfo */, + BEC566B60761D90300A33029 /* checkkeys.app */, + BEC566D10761D90300A33029 /* loopwave.app */, + BEC567060761D90400A33029 /* testerror.app */, + BEC5672E0761D90400A33029 /* testthread.app */, + BEC5673B0761D90400A33029 /* testjoystick.app */, + BEC567480761D90400A33029 /* testkeys.app */, + BEC567550761D90400A33029 /* testlock.app */, + BEC5677D0761D90500A33029 /* testsem.app */, + BEC567980761D90500A33029 /* testtimer.app */, + BEC567B20761D90500A33029 /* testversion.app */, + BEC567F50761D90600A33029 /* torturethread.app */, + 002F341209CA1BFF00EBEB88 /* testfile.app */, + 002F343109CA1F0300EBEB88 /* testiconv.app */, + 002F344D09CA1FB300EBEB88 /* testoverlay2.app */, + 002F346A09CA204F00EBEB88 /* testplatform.app */, + 0017958C10741F7900F5D044 /* testatomic.app */, + 001795AD107421BF00F5D044 /* testaudioinfo.app */, 0017972110742F3200F5D044 /* testgl2.app */, - 00179748107430D600F5D044 /* testhaptic */, - 0017976E107431B300F5D044 /* testdraw2 */, - 0017978E107432AE00F5D044 /* testime */, - 001797AE1074334C00F5D044 /* testintersections */, - 001797D0107433C600F5D044 /* testloadso */, - 001798121074355200F5D044 /* testmultiaudio */, + 00179748107430D600F5D044 /* testhaptic.app */, + 0017976E107431B300F5D044 /* testdraw2.app */, + 0017978E107432AE00F5D044 /* testime.app */, + 001797AE1074334C00F5D044 /* testintersections.app */, + 001797D0107433C600F5D044 /* testloadso.app */, + 001798121074355200F5D044 /* testmultiaudio.app */, 001798941074392D00F5D044 /* testnative.app */, - 001798B5107439DF00F5D044 /* testpower */, - 001798F210743BEC00F5D044 /* testresample */, - 0017991610743F1000F5D044 /* testsprite2 */, - 0017993810743FB700F5D044 /* testwm2 */, - 4537749212091504002F0F45 /* testshape */, - BBFC08CD164C6862003E6A99 /* testgamecontroller */, + 001798B5107439DF00F5D044 /* testpower.app */, + 001798F210743BEC00F5D044 /* testresample.app */, + 0017991610743F1000F5D044 /* testsprite2.app */, + 0017993810743FB700F5D044 /* testwm2.app */, + 4537749212091504002F0F45 /* testshape.app */, + BBFC08CD164C6862003E6A99 /* testgamecontroller.app */, DB166D7F16A1D12400A1396C /* libSDL_test.a */, - DB166DBF16A1D2F600A1396C /* testgesture */, - DB166DD516A1D36A00A1396C /* testmessage */, - DB166DEE16A1D50C00A1396C /* testrelative */, - DB166E0516A1D57C00A1396C /* testrendercopyex */, - DB166E1C16A1D5AD00A1396C /* testrendertarget */, - DB166E3816A1D64D00A1396C /* testrumble */, - DB166E5216A1D69000A1396C /* testscale */, - DB166E6816A1D6F300A1396C /* testshader */, - DB166E7E16A1D78400A1396C /* testspriteminimal */, - DB166E9116A1D78C00A1396C /* teststreaming */, - DB0F48EC17CA51E5008798C5 /* testdrawchessboard */, - DB0F490117CA5212008798C5 /* testfilesystem */, - DB89957E18A19ABA0092407C /* testhotplug */, + DB166DBF16A1D2F600A1396C /* testgesture.app */, + DB166DD516A1D36A00A1396C /* testmessage.app */, + DB166DEE16A1D50C00A1396C /* testrelative.app */, + DB166E0516A1D57C00A1396C /* testrendercopyex.app */, + DB166E1C16A1D5AD00A1396C /* testrendertarget.app */, + DB166E3816A1D64D00A1396C /* testrumble.app */, + DB166E5216A1D69000A1396C /* testscale.app */, + DB166E6816A1D6F300A1396C /* testshader.app */, + DB166E7E16A1D78400A1396C /* testspriteminimal.app */, + DB166E9116A1D78C00A1396C /* teststreaming.app */, + DB0F48EC17CA51E5008798C5 /* testdrawchessboard.app */, + DB0F490117CA5212008798C5 /* testfilesystem.app */, + DB89957E18A19ABA0092407C /* testhotplug.app */, DB445EF818184B7000B306B0 /* testdropfile.app */, - DBEC54EA1A1A81C3005B1EAB /* controllermap */, + DBEC54EA1A1A81C3005B1EAB /* controllermap.app */, F3C17CDC28E416CF00E1A26D /* testgeometry.app */, ); name = Products; @@ -1412,6 +2073,13 @@ path = ../../src/test; sourceTree = ""; }; + F3A249CF2B389C7A00A5162D /* Frameworks */ = { + isa = PBXGroup; + children = ( + ); + name = Frameworks; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ @@ -1431,6 +2099,7 @@ buildPhases = ( 0017957910741F7900F5D044 /* Sources */, 0017957A10741F7900F5D044 /* Frameworks */, + F3A249E92B389CF000A5162D /* Embed Frameworks */, ); buildRules = ( ); @@ -1438,7 +2107,7 @@ ); name = testatomic; productName = testalpha; - productReference = 0017958C10741F7900F5D044 /* testatomic */; + productReference = 0017958C10741F7900F5D044 /* testatomic.app */; productType = "com.apple.product-type.application"; }; 00179595107421BF00F5D044 /* testaudioinfo */ = { @@ -1447,6 +2116,7 @@ buildPhases = ( 0017959A107421BF00F5D044 /* Sources */, 0017959B107421BF00F5D044 /* Frameworks */, + F3A249EC2B389CFB00A5162D /* Embed Frameworks */, ); buildRules = ( ); @@ -1454,7 +2124,7 @@ ); name = testaudioinfo; productName = testalpha; - productReference = 001795AD107421BF00F5D044 /* testaudioinfo */; + productReference = 001795AD107421BF00F5D044 /* testaudioinfo.app */; productType = "com.apple.product-type.application"; }; 0017970910742F3200F5D044 /* testgl2 */ = { @@ -1463,6 +2133,7 @@ buildPhases = ( 0017970E10742F3200F5D044 /* Sources */, 0017970F10742F3200F5D044 /* Frameworks */, + F3A24A0A2B389D8A00A5162D /* Embed Frameworks */, ); buildRules = ( ); @@ -1479,6 +2150,7 @@ buildPhases = ( 00179735107430D600F5D044 /* Sources */, 00179736107430D600F5D044 /* Frameworks */, + F3A24A0D2B389D9B00A5162D /* Embed Frameworks */, ); buildRules = ( ); @@ -1486,7 +2158,7 @@ ); name = testhaptic; productName = testalpha; - productReference = 00179748107430D600F5D044 /* testhaptic */; + productReference = 00179748107430D600F5D044 /* testhaptic.app */; productType = "com.apple.product-type.application"; }; 00179756107431B300F5D044 /* testdraw2 */ = { @@ -1495,6 +2167,7 @@ buildPhases = ( 0017975B107431B300F5D044 /* Sources */, 0017975C107431B300F5D044 /* Frameworks */, + F3A249EF2B389D0900A5162D /* Embed Frameworks */, ); buildRules = ( ); @@ -1502,7 +2175,7 @@ ); name = testdraw2; productName = testalpha; - productReference = 0017976E107431B300F5D044 /* testdraw2 */; + productReference = 0017976E107431B300F5D044 /* testdraw2.app */; productType = "com.apple.product-type.application"; }; 00179776107432AE00F5D044 /* testime */ = { @@ -1511,6 +2184,7 @@ buildPhases = ( 0017977B107432AE00F5D044 /* Sources */, 0017977C107432AE00F5D044 /* Frameworks */, + F3A24A162B389DC000A5162D /* Embed Frameworks */, ); buildRules = ( ); @@ -1518,7 +2192,7 @@ ); name = testime; productName = testalpha; - productReference = 0017978E107432AE00F5D044 /* testime */; + productReference = 0017978E107432AE00F5D044 /* testime.app */; productType = "com.apple.product-type.application"; }; 001797961074334C00F5D044 /* testintersections */ = { @@ -1527,6 +2201,7 @@ buildPhases = ( 0017979B1074334C00F5D044 /* Sources */, 0017979C1074334C00F5D044 /* Frameworks */, + F3A24A192B389DCA00A5162D /* Embed Frameworks */, ); buildRules = ( ); @@ -1534,7 +2209,7 @@ ); name = testintersections; productName = testalpha; - productReference = 001797AE1074334C00F5D044 /* testintersections */; + productReference = 001797AE1074334C00F5D044 /* testintersections.app */; productType = "com.apple.product-type.application"; }; 001797B8107433C600F5D044 /* testloadso */ = { @@ -1543,6 +2218,7 @@ buildPhases = ( 001797BD107433C600F5D044 /* Sources */, 001797BE107433C600F5D044 /* Frameworks */, + F3A24A222B389DEB00A5162D /* Embed Frameworks */, ); buildRules = ( ); @@ -1550,7 +2226,7 @@ ); name = testloadso; productName = testalpha; - productReference = 001797D0107433C600F5D044 /* testloadso */; + productReference = 001797D0107433C600F5D044 /* testloadso.app */; productType = "com.apple.product-type.application"; }; 001797FA1074355200F5D044 /* testmultiaudio */ = { @@ -1560,6 +2236,7 @@ 001797FF1074355200F5D044 /* Sources */, 001798001074355200F5D044 /* Frameworks */, F3C17D3828E424B100E1A26D /* Resources */, + F3A24A2B2B389E0900A5162D /* Embed Frameworks */, ); buildRules = ( ); @@ -1567,7 +2244,7 @@ ); name = testmultiaudio; productName = testalpha; - productReference = 001798121074355200F5D044 /* testmultiaudio */; + productReference = 001798121074355200F5D044 /* testmultiaudio.app */; productType = "com.apple.product-type.application"; }; 001798781074392D00F5D044 /* testnative */ = { @@ -1577,6 +2254,7 @@ 0017987E1074392D00F5D044 /* Sources */, 001798821074392D00F5D044 /* Frameworks */, DB166DDA16A1D40F00A1396C /* CopyFiles */, + F3A24A2E2B389E1500A5162D /* Embed Frameworks */, ); buildRules = ( ); @@ -1593,6 +2271,7 @@ buildPhases = ( 001798A2107439DF00F5D044 /* Sources */, 001798A3107439DF00F5D044 /* Frameworks */, + F3A24A382B389E4F00A5162D /* Embed Frameworks */, ); buildRules = ( ); @@ -1600,7 +2279,7 @@ ); name = testpower; productName = testalpha; - productReference = 001798B5107439DF00F5D044 /* testpower */; + productReference = 001798B5107439DF00F5D044 /* testpower.app */; productType = "com.apple.product-type.application"; }; 001798DA10743BEC00F5D044 /* testresample */ = { @@ -1609,6 +2288,7 @@ buildPhases = ( 001798DF10743BEC00F5D044 /* Sources */, 001798E010743BEC00F5D044 /* Frameworks */, + F3A24A442B389E7C00A5162D /* Embed Frameworks */, ); buildRules = ( ); @@ -1616,7 +2296,7 @@ ); name = testresample; productName = testalpha; - productReference = 001798F210743BEC00F5D044 /* testresample */; + productReference = 001798F210743BEC00F5D044 /* testresample.app */; productType = "com.apple.product-type.application"; }; 001798FE10743F1000F5D044 /* testsprite2 */ = { @@ -1626,6 +2306,7 @@ 0017990310743F1000F5D044 /* Sources */, 0017990410743F1000F5D044 /* Frameworks */, F3C17D3A28E4252200E1A26D /* Resources */, + F3A249DD2B389C7A00A5162D /* Embed Frameworks */, ); buildRules = ( ); @@ -1633,7 +2314,7 @@ ); name = testsprite2; productName = testalpha; - productReference = 0017991610743F1000F5D044 /* testsprite2 */; + productReference = 0017991610743F1000F5D044 /* testsprite2.app */; productType = "com.apple.product-type.application"; }; 0017992010743FB700F5D044 /* testwm2 */ = { @@ -1642,6 +2323,7 @@ buildPhases = ( 0017992510743FB700F5D044 /* Sources */, 0017992610743FB700F5D044 /* Frameworks */, + F3A24A652B389EF900A5162D /* Embed Frameworks */, ); buildRules = ( ); @@ -1649,7 +2331,7 @@ ); name = testwm2; productName = testalpha; - productReference = 0017993810743FB700F5D044 /* testwm2 */; + productReference = 0017993810743FB700F5D044 /* testwm2.app */; productType = "com.apple.product-type.application"; }; 002F340109CA1BFF00EBEB88 /* testfile */ = { @@ -1658,6 +2340,7 @@ buildPhases = ( 002F340709CA1BFF00EBEB88 /* Sources */, 002F340809CA1BFF00EBEB88 /* Frameworks */, + F3A249FB2B389D5200A5162D /* Embed Frameworks */, ); buildRules = ( ); @@ -1665,7 +2348,7 @@ ); name = testfile; productName = testalpha; - productReference = 002F341209CA1BFF00EBEB88 /* testfile */; + productReference = 002F341209CA1BFF00EBEB88 /* testfile.app */; productType = "com.apple.product-type.application"; }; 002F342009CA1F0300EBEB88 /* testiconv */ = { @@ -1675,6 +2358,7 @@ 002F342609CA1F0300EBEB88 /* Sources */, 002F342709CA1F0300EBEB88 /* Frameworks */, 00794EEC09D2371F003FC8A1 /* CopyFiles */, + F3A24A132B389DB400A5162D /* Embed Frameworks */, ); buildRules = ( ); @@ -1682,7 +2366,7 @@ ); name = testiconv; productName = testalpha; - productReference = 002F343109CA1F0300EBEB88 /* testiconv */; + productReference = 002F343109CA1F0300EBEB88 /* testiconv.app */; productType = "com.apple.product-type.application"; }; 002F343C09CA1FB300EBEB88 /* testoverlay2 */ = { @@ -1692,6 +2376,7 @@ 002F344209CA1FB300EBEB88 /* Sources */, 002F344309CA1FB300EBEB88 /* Frameworks */, 00794EF409D237C7003FC8A1 /* CopyFiles */, + F3A24A322B389E2800A5162D /* Embed Frameworks */, ); buildRules = ( ); @@ -1699,7 +2384,7 @@ ); name = testoverlay2; productName = testalpha; - productReference = 002F344D09CA1FB300EBEB88 /* testoverlay2 */; + productReference = 002F344D09CA1FB300EBEB88 /* testoverlay2.app */; productType = "com.apple.product-type.application"; }; 002F345909CA204F00EBEB88 /* testplatform */ = { @@ -1708,6 +2393,7 @@ buildPhases = ( 002F345F09CA204F00EBEB88 /* Sources */, 002F346009CA204F00EBEB88 /* Frameworks */, + F3A24A352B389E3200A5162D /* Embed Frameworks */, ); buildRules = ( ); @@ -1715,7 +2401,7 @@ ); name = testplatform; productName = testalpha; - productReference = 002F346A09CA204F00EBEB88 /* testplatform */; + productReference = 002F346A09CA204F00EBEB88 /* testplatform.app */; productType = "com.apple.product-type.application"; }; 4537749112091504002F0F45 /* testshape */ = { @@ -1725,6 +2411,7 @@ 4537748F12091504002F0F45 /* Sources */, 4537749012091504002F0F45 /* Frameworks */, DB166ECE16A1D85400A1396C /* CopyFiles */, + F3A24A532B389EB600A5162D /* Embed Frameworks */, ); buildRules = ( ); @@ -1732,7 +2419,7 @@ ); name = testshape; productName = testshape; - productReference = 4537749212091504002F0F45 /* testshape */; + productReference = 4537749212091504002F0F45 /* testshape.app */; productType = "com.apple.product-type.application"; }; BBFC08B7164C6862003E6A99 /* testgamecontroller */ = { @@ -1742,6 +2429,7 @@ BBFC08BC164C6862003E6A99 /* Sources */, BBFC08BE164C6862003E6A99 /* Frameworks */, F3C17D3528E4242100E1A26D /* Resources */, + F3A24A012B389D6600A5162D /* Embed Frameworks */, ); buildRules = ( ); @@ -1749,7 +2437,7 @@ ); name = testgamecontroller; productName = testjoystick; - productReference = BBFC08CD164C6862003E6A99 /* testgamecontroller */; + productReference = BBFC08CD164C6862003E6A99 /* testgamecontroller.app */; productType = "com.apple.product-type.application"; }; BEC566AB0761D90300A33029 /* checkkeys */ = { @@ -1758,6 +2446,7 @@ buildPhases = ( BEC566B00761D90300A33029 /* Sources */, BEC566B20761D90300A33029 /* Frameworks */, + F3A249E02B389CCA00A5162D /* Embed Frameworks */, ); buildRules = ( ); @@ -1765,7 +2454,7 @@ ); name = checkkeys; productName = checkkeys; - productReference = BEC566B60761D90300A33029 /* checkkeys */; + productReference = BEC566B60761D90300A33029 /* checkkeys.app */; productType = "com.apple.product-type.application"; }; BEC566C50761D90300A33029 /* loopwave */ = { @@ -1775,6 +2464,7 @@ BEC566CA0761D90300A33029 /* Sources */, BEC566CC0761D90300A33029 /* Frameworks */, 00794E6409D2084F003FC8A1 /* CopyFiles */, + F3A249E62B389CE700A5162D /* Embed Frameworks */, ); buildRules = ( ); @@ -1782,7 +2472,7 @@ ); name = loopwave; productName = loopwave; - productReference = BEC566D10761D90300A33029 /* loopwave */; + productReference = BEC566D10761D90300A33029 /* loopwave.app */; productType = "com.apple.product-type.application"; }; BEC566FB0761D90300A33029 /* testerror */ = { @@ -1791,6 +2481,7 @@ buildPhases = ( BEC567000761D90300A33029 /* Sources */, BEC567020761D90300A33029 /* Frameworks */, + F3A249F82B389D4400A5162D /* Embed Frameworks */, ); buildRules = ( ); @@ -1798,7 +2489,7 @@ ); name = testerror; productName = testerror; - productReference = BEC567060761D90400A33029 /* testerror */; + productReference = BEC567060761D90400A33029 /* testerror.app */; productType = "com.apple.product-type.application"; }; BEC567230761D90400A33029 /* testthread */ = { @@ -1807,6 +2498,7 @@ buildPhases = ( BEC567280761D90400A33029 /* Sources */, BEC5672A0761D90400A33029 /* Frameworks */, + F3A24A5C2B389ED800A5162D /* Embed Frameworks */, ); buildRules = ( ); @@ -1814,7 +2506,7 @@ ); name = testthread; productName = testthread; - productReference = BEC5672E0761D90400A33029 /* testthread */; + productReference = BEC5672E0761D90400A33029 /* testthread.app */; productType = "com.apple.product-type.application"; }; BEC567300761D90400A33029 /* testjoystick */ = { @@ -1823,6 +2515,7 @@ buildPhases = ( BEC567350761D90400A33029 /* Sources */, BEC567370761D90400A33029 /* Frameworks */, + F3A24A1C2B389DD600A5162D /* Embed Frameworks */, ); buildRules = ( ); @@ -1830,7 +2523,7 @@ ); name = testjoystick; productName = testjoystick; - productReference = BEC5673B0761D90400A33029 /* testjoystick */; + productReference = BEC5673B0761D90400A33029 /* testjoystick.app */; productType = "com.apple.product-type.application"; }; BEC5673D0761D90400A33029 /* testkeys */ = { @@ -1839,6 +2532,7 @@ buildPhases = ( BEC567420761D90400A33029 /* Sources */, BEC567440761D90400A33029 /* Frameworks */, + F3A24A1F2B389DE100A5162D /* Embed Frameworks */, ); buildRules = ( ); @@ -1846,7 +2540,7 @@ ); name = testkeys; productName = testkeys; - productReference = BEC567480761D90400A33029 /* testkeys */; + productReference = BEC567480761D90400A33029 /* testkeys.app */; productType = "com.apple.product-type.application"; }; BEC5674A0761D90400A33029 /* testlock */ = { @@ -1855,6 +2549,7 @@ buildPhases = ( BEC5674F0761D90400A33029 /* Sources */, BEC567510761D90400A33029 /* Frameworks */, + F3A24A252B389DF500A5162D /* Embed Frameworks */, ); buildRules = ( ); @@ -1862,7 +2557,7 @@ ); name = testlock; productName = testlock; - productReference = BEC567550761D90400A33029 /* testlock */; + productReference = BEC567550761D90400A33029 /* testlock.app */; productType = "com.apple.product-type.application"; }; BEC567720761D90500A33029 /* testsem */ = { @@ -1871,6 +2566,7 @@ buildPhases = ( BEC567770761D90500A33029 /* Sources */, BEC567790761D90500A33029 /* Frameworks */, + F3A24A4D2B389E9C00A5162D /* Embed Frameworks */, ); buildRules = ( ); @@ -1878,7 +2574,7 @@ ); name = testsem; productName = testsem; - productReference = BEC5677D0761D90500A33029 /* testsem */; + productReference = BEC5677D0761D90500A33029 /* testsem.app */; productType = "com.apple.product-type.application"; }; BEC5678D0761D90500A33029 /* testtimer */ = { @@ -1887,6 +2583,7 @@ buildPhases = ( BEC567920761D90500A33029 /* Sources */, BEC567940761D90500A33029 /* Frameworks */, + F3A24A5F2B389EE200A5162D /* Embed Frameworks */, ); buildRules = ( ); @@ -1894,7 +2591,7 @@ ); name = testtimer; productName = testtimer; - productReference = BEC567980761D90500A33029 /* testtimer */; + productReference = BEC567980761D90500A33029 /* testtimer.app */; productType = "com.apple.product-type.application"; }; BEC567A70761D90500A33029 /* testversion */ = { @@ -1903,6 +2600,7 @@ buildPhases = ( BEC567AC0761D90500A33029 /* Sources */, BEC567AE0761D90500A33029 /* Frameworks */, + F3A24A622B389EED00A5162D /* Embed Frameworks */, ); buildRules = ( ); @@ -1910,7 +2608,7 @@ ); name = testversion; productName = testversion; - productReference = BEC567B20761D90500A33029 /* testversion */; + productReference = BEC567B20761D90500A33029 /* testversion.app */; productType = "com.apple.product-type.application"; }; BEC567EA0761D90600A33029 /* torturethread */ = { @@ -1919,6 +2617,7 @@ buildPhases = ( BEC567EF0761D90600A33029 /* Sources */, BEC567F10761D90600A33029 /* Frameworks */, + F3A24A682B389F0400A5162D /* Embed Frameworks */, ); buildRules = ( ); @@ -1926,7 +2625,7 @@ ); name = torturethread; productName = torturethread; - productReference = BEC567F50761D90600A33029 /* torturethread */; + productReference = BEC567F50761D90600A33029 /* torturethread.app */; productType = "com.apple.product-type.application"; }; DB0F48D917CA51E5008798C5 /* testdrawchessboard */ = { @@ -1935,6 +2634,7 @@ buildPhases = ( DB0F48DA17CA51E5008798C5 /* Sources */, DB0F48DC17CA51E5008798C5 /* Frameworks */, + F3A249F22B389D3100A5162D /* Embed Frameworks */, ); buildRules = ( ); @@ -1942,7 +2642,7 @@ ); name = testdrawchessboard; productName = testalpha; - productReference = DB0F48EC17CA51E5008798C5 /* testdrawchessboard */; + productReference = DB0F48EC17CA51E5008798C5 /* testdrawchessboard.app */; productType = "com.apple.product-type.application"; }; DB0F48EF17CA5212008798C5 /* testfilesystem */ = { @@ -1951,6 +2651,7 @@ buildPhases = ( DB0F48F017CA5212008798C5 /* Sources */, DB0F48F217CA5212008798C5 /* Frameworks */, + F3A249FE2B389D5B00A5162D /* Embed Frameworks */, ); buildRules = ( ); @@ -1958,7 +2659,7 @@ ); name = testfilesystem; productName = testalpha; - productReference = DB0F490117CA5212008798C5 /* testfilesystem */; + productReference = DB0F490117CA5212008798C5 /* testfilesystem.app */; productType = "com.apple.product-type.application"; }; DB166D7E16A1D12400A1396C /* SDL_test */ = { @@ -1984,6 +2685,7 @@ buildPhases = ( DB166DAE16A1D2F600A1396C /* Sources */, DB166DB016A1D2F600A1396C /* Frameworks */, + F3A24A072B389D7C00A5162D /* Embed Frameworks */, ); buildRules = ( ); @@ -1991,7 +2693,7 @@ ); name = testgesture; productName = testalpha; - productReference = DB166DBF16A1D2F600A1396C /* testgesture */; + productReference = DB166DBF16A1D2F600A1396C /* testgesture.app */; productType = "com.apple.product-type.application"; }; DB166DC416A1D36A00A1396C /* testmessage */ = { @@ -2000,6 +2702,7 @@ buildPhases = ( DB166DC516A1D36A00A1396C /* Sources */, DB166DC716A1D36A00A1396C /* Frameworks */, + F3A24A282B389E0000A5162D /* Embed Frameworks */, ); buildRules = ( ); @@ -2007,7 +2710,7 @@ ); name = testmessage; productName = testalpha; - productReference = DB166DD516A1D36A00A1396C /* testmessage */; + productReference = DB166DD516A1D36A00A1396C /* testmessage.app */; productType = "com.apple.product-type.application"; }; DB166DDC16A1D50C00A1396C /* testrelative */ = { @@ -2016,6 +2719,7 @@ buildPhases = ( DB166DDD16A1D50C00A1396C /* Sources */, DB166DDF16A1D50C00A1396C /* Frameworks */, + F3A24A3B2B389E5D00A5162D /* Embed Frameworks */, ); buildRules = ( ); @@ -2023,7 +2727,7 @@ ); name = testrelative; productName = testalpha; - productReference = DB166DEE16A1D50C00A1396C /* testrelative */; + productReference = DB166DEE16A1D50C00A1396C /* testrelative.app */; productType = "com.apple.product-type.application"; }; DB166DF316A1D57C00A1396C /* testrendercopyex */ = { @@ -2033,6 +2737,7 @@ DB166DF416A1D57C00A1396C /* Sources */, DB166DF616A1D57C00A1396C /* Frameworks */, DB166E2116A1D5DF00A1396C /* CopyFiles */, + F3A24A3E2B389E6600A5162D /* Embed Frameworks */, ); buildRules = ( ); @@ -2040,7 +2745,7 @@ ); name = testrendercopyex; productName = testalpha; - productReference = DB166E0516A1D57C00A1396C /* testrendercopyex */; + productReference = DB166E0516A1D57C00A1396C /* testrendercopyex.app */; productType = "com.apple.product-type.application"; }; DB166E0A16A1D5AD00A1396C /* testrendertarget */ = { @@ -2050,6 +2755,7 @@ DB166E0B16A1D5AD00A1396C /* Sources */, DB166E0D16A1D5AD00A1396C /* Frameworks */, DB166E2416A1D61000A1396C /* CopyFiles */, + F3A24A412B389E7200A5162D /* Embed Frameworks */, ); buildRules = ( ); @@ -2057,7 +2763,7 @@ ); name = testrendertarget; productName = testalpha; - productReference = DB166E1C16A1D5AD00A1396C /* testrendertarget */; + productReference = DB166E1C16A1D5AD00A1396C /* testrendertarget.app */; productType = "com.apple.product-type.application"; }; DB166E2716A1D64D00A1396C /* testrumble */ = { @@ -2066,6 +2772,7 @@ buildPhases = ( DB166E2816A1D64D00A1396C /* Sources */, DB166E2A16A1D64D00A1396C /* Frameworks */, + F3A24A472B389E8700A5162D /* Embed Frameworks */, ); buildRules = ( ); @@ -2073,7 +2780,7 @@ ); name = testrumble; productName = testalpha; - productReference = DB166E3816A1D64D00A1396C /* testrumble */; + productReference = DB166E3816A1D64D00A1396C /* testrumble.app */; productType = "com.apple.product-type.application"; }; DB166E3D16A1D69000A1396C /* testscale */ = { @@ -2083,6 +2790,7 @@ DB166E3E16A1D69000A1396C /* Sources */, DB166E4016A1D69000A1396C /* Frameworks */, DB166E4C16A1D69000A1396C /* CopyFiles */, + F3A24A4A2B389E9100A5162D /* Embed Frameworks */, ); buildRules = ( ); @@ -2090,7 +2798,7 @@ ); name = testscale; productName = testalpha; - productReference = DB166E5216A1D69000A1396C /* testscale */; + productReference = DB166E5216A1D69000A1396C /* testscale.app */; productType = "com.apple.product-type.application"; }; DB166E5716A1D6F300A1396C /* testshader */ = { @@ -2099,6 +2807,7 @@ buildPhases = ( DB166E5816A1D6F300A1396C /* Sources */, DB166E5A16A1D6F300A1396C /* Frameworks */, + F3A24A502B389EA600A5162D /* Embed Frameworks */, ); buildRules = ( ); @@ -2106,7 +2815,7 @@ ); name = testshader; productName = testsem; - productReference = DB166E6816A1D6F300A1396C /* testshader */; + productReference = DB166E6816A1D6F300A1396C /* testshader.app */; productType = "com.apple.product-type.application"; }; DB166E6D16A1D78400A1396C /* testspriteminimal */ = { @@ -2116,6 +2825,7 @@ DB166E6E16A1D78400A1396C /* Sources */, DB166E7016A1D78400A1396C /* Frameworks */, DB166E9B16A1D7FC00A1396C /* CopyFiles */, + F3A24A562B389EC200A5162D /* Embed Frameworks */, ); buildRules = ( ); @@ -2123,7 +2833,7 @@ ); name = testspriteminimal; productName = testspriteminimal; - productReference = DB166E7E16A1D78400A1396C /* testspriteminimal */; + productReference = DB166E7E16A1D78400A1396C /* testspriteminimal.app */; productType = "com.apple.product-type.application"; }; DB166E8016A1D78C00A1396C /* teststreaming */ = { @@ -2133,6 +2843,7 @@ DB166E8116A1D78C00A1396C /* Sources */, DB166E8316A1D78C00A1396C /* Frameworks */, DB166E9916A1D7EE00A1396C /* CopyFiles */, + F3A24A592B389ECD00A5162D /* Embed Frameworks */, ); buildRules = ( ); @@ -2140,7 +2851,7 @@ ); name = teststreaming; productName = teststreaming; - productReference = DB166E9116A1D78C00A1396C /* teststreaming */; + productReference = DB166E9116A1D78C00A1396C /* teststreaming.app */; productType = "com.apple.product-type.application"; }; DB445EE618184B7000B306B0 /* testdropfile */ = { @@ -2149,6 +2860,7 @@ buildPhases = ( DB445EE718184B7000B306B0 /* Sources */, DB445EE918184B7000B306B0 /* Frameworks */, + F3A249F52B389D3B00A5162D /* Embed Frameworks */, ); buildRules = ( ); @@ -2165,6 +2877,7 @@ buildPhases = ( DB89956E18A19ABA0092407C /* Sources */, DB89957018A19ABA0092407C /* Frameworks */, + F3A24A102B389DA800A5162D /* Embed Frameworks */, ); buildRules = ( ); @@ -2172,7 +2885,7 @@ ); name = testhotplug; productName = testalpha; - productReference = DB89957E18A19ABA0092407C /* testhotplug */; + productReference = DB89957E18A19ABA0092407C /* testhotplug.app */; productType = "com.apple.product-type.application"; }; DBEC54D91A1A81C3005B1EAB /* controllermap */ = { @@ -2182,6 +2895,7 @@ DBEC54DA1A1A81C3005B1EAB /* Sources */, DBEC54DC1A1A81C3005B1EAB /* Frameworks */, DBEC54EC1A1A827C005B1EAB /* CopyFiles */, + F3A249E32B389CDB00A5162D /* Embed Frameworks */, ); buildRules = ( ); @@ -2189,7 +2903,7 @@ ); name = controllermap; productName = checkkeys; - productReference = DBEC54EA1A1A81C3005B1EAB /* controllermap */; + productReference = DBEC54EA1A1A81C3005B1EAB /* controllermap.app */; productType = "com.apple.product-type.application"; }; F3C17CDB28E416CF00E1A26D /* testgeometry */ = { @@ -2198,6 +2912,7 @@ buildPhases = ( F3C17CD828E416CF00E1A26D /* Sources */, F3C17CD928E416CF00E1A26D /* Frameworks */, + F3A24A042B389D6F00A5162D /* Embed Frameworks */, ); buildRules = ( ); @@ -2217,8 +2932,153 @@ LastSwiftUpdateCheck = 1400; LastUpgradeCheck = 0420; TargetAttributes = { + 0017957410741F7900F5D044 = { + DevelopmentTeam = EH385AYQ6F; + }; + 00179595107421BF00F5D044 = { + DevelopmentTeam = EH385AYQ6F; + }; + 0017970910742F3200F5D044 = { + DevelopmentTeam = EH385AYQ6F; + }; + 00179730107430D600F5D044 = { + DevelopmentTeam = EH385AYQ6F; + }; + 00179756107431B300F5D044 = { + DevelopmentTeam = EH385AYQ6F; + }; + 00179776107432AE00F5D044 = { + DevelopmentTeam = EH385AYQ6F; + }; + 001797961074334C00F5D044 = { + DevelopmentTeam = EH385AYQ6F; + }; + 001797B8107433C600F5D044 = { + DevelopmentTeam = EH385AYQ6F; + }; + 001797FA1074355200F5D044 = { + DevelopmentTeam = EH385AYQ6F; + }; + 001798781074392D00F5D044 = { + DevelopmentTeam = EH385AYQ6F; + }; + 0017989D107439DF00F5D044 = { + DevelopmentTeam = EH385AYQ6F; + }; + 001798DA10743BEC00F5D044 = { + DevelopmentTeam = EH385AYQ6F; + }; + 001798FE10743F1000F5D044 = { + DevelopmentTeam = EH385AYQ6F; + }; + 0017992010743FB700F5D044 = { + DevelopmentTeam = EH385AYQ6F; + }; + 002F340109CA1BFF00EBEB88 = { + DevelopmentTeam = EH385AYQ6F; + }; + 002F342009CA1F0300EBEB88 = { + DevelopmentTeam = EH385AYQ6F; + }; + 002F343C09CA1FB300EBEB88 = { + DevelopmentTeam = EH385AYQ6F; + }; + 002F345909CA204F00EBEB88 = { + DevelopmentTeam = EH385AYQ6F; + }; + 4537749112091504002F0F45 = { + DevelopmentTeam = EH385AYQ6F; + }; + BBFC08B7164C6862003E6A99 = { + DevelopmentTeam = EH385AYQ6F; + }; + BEC566920761D90300A33029 = { + DevelopmentTeam = EH385AYQ6F; + }; + BEC566AB0761D90300A33029 = { + DevelopmentTeam = EH385AYQ6F; + }; + BEC566C50761D90300A33029 = { + DevelopmentTeam = EH385AYQ6F; + }; + BEC566FB0761D90300A33029 = { + DevelopmentTeam = EH385AYQ6F; + }; + BEC567230761D90400A33029 = { + DevelopmentTeam = EH385AYQ6F; + }; + BEC567300761D90400A33029 = { + DevelopmentTeam = EH385AYQ6F; + }; + BEC5673D0761D90400A33029 = { + DevelopmentTeam = EH385AYQ6F; + }; + BEC5674A0761D90400A33029 = { + DevelopmentTeam = EH385AYQ6F; + }; + BEC567720761D90500A33029 = { + DevelopmentTeam = EH385AYQ6F; + }; + BEC5678D0761D90500A33029 = { + DevelopmentTeam = EH385AYQ6F; + }; + BEC567A70761D90500A33029 = { + DevelopmentTeam = EH385AYQ6F; + }; + BEC567EA0761D90600A33029 = { + DevelopmentTeam = EH385AYQ6F; + }; + DB0F48D917CA51E5008798C5 = { + DevelopmentTeam = EH385AYQ6F; + }; + DB0F48EF17CA5212008798C5 = { + DevelopmentTeam = EH385AYQ6F; + }; + DB166D7E16A1D12400A1396C = { + DevelopmentTeam = EH385AYQ6F; + }; + DB166DAD16A1D2F600A1396C = { + DevelopmentTeam = EH385AYQ6F; + }; + DB166DC416A1D36A00A1396C = { + DevelopmentTeam = EH385AYQ6F; + }; + DB166DDC16A1D50C00A1396C = { + DevelopmentTeam = EH385AYQ6F; + }; + DB166DF316A1D57C00A1396C = { + DevelopmentTeam = EH385AYQ6F; + }; + DB166E0A16A1D5AD00A1396C = { + DevelopmentTeam = EH385AYQ6F; + }; + DB166E2716A1D64D00A1396C = { + DevelopmentTeam = EH385AYQ6F; + }; + DB166E3D16A1D69000A1396C = { + DevelopmentTeam = EH385AYQ6F; + }; + DB166E5716A1D6F300A1396C = { + DevelopmentTeam = EH385AYQ6F; + }; + DB166E6D16A1D78400A1396C = { + DevelopmentTeam = EH385AYQ6F; + }; + DB166E8016A1D78C00A1396C = { + DevelopmentTeam = EH385AYQ6F; + }; + DB445EE618184B7000B306B0 = { + DevelopmentTeam = EH385AYQ6F; + }; + DB89956D18A19ABA0092407C = { + DevelopmentTeam = EH385AYQ6F; + }; + DBEC54D91A1A81C3005B1EAB = { + DevelopmentTeam = EH385AYQ6F; + }; F3C17CDB28E416CF00E1A26D = { CreatedOnToolsVersion = 14.0.1; + DevelopmentTeam = EH385AYQ6F; }; }; }; @@ -3387,6 +4247,8 @@ 002A85C51073008E007319AE /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + INFOPLIST_FILE = "testoverlay2-Info.plist"; + INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; PRODUCT_NAME = testoverlay2; }; name = Debug; @@ -3524,6 +4386,8 @@ 002A85E71073009D007319AE /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + INFOPLIST_FILE = "testoverlay2-Info.plist"; + INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; PRODUCT_NAME = testoverlay2; }; name = Release; diff --git a/thirdparty/SDL/acinclude/libtool.m4 b/thirdparty/SDL/acinclude/libtool.m4 index 3236ddab0..5afe55ea0 100644 --- a/thirdparty/SDL/acinclude/libtool.m4 +++ b/thirdparty/SDL/acinclude/libtool.m4 @@ -219,8 +219,8 @@ esac ofile=libtool can_build_shared=yes -# All known linkers require a '.a' archive for static linking (except MSVC, -# which needs '.lib'). +# All known linkers require a '.a' archive for static linking (except MSVC and +# ICC, which need '.lib'). libext=a with_gnu_ld=$lt_cv_prog_gnu_ld @@ -1365,7 +1365,7 @@ mips64*-*linux*) ;; x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ -s390*-*linux*|s390*-*tpf*|sparc*-*linux*) +s390*-*linux*|s390*-*tpf*|sparc*-*linux*|x86_64-gnu*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. Note that the listed cases only cover the # situations where additional linker options are needed (such as when @@ -1380,7 +1380,7 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_i386_fbsd" ;; - x86_64-*linux*) + x86_64-*linux*|x86_64-gnu*) case `/usr/bin/file conftest.o` in *x86-64*) LD="${LD-ld} -m elf32_x86_64" @@ -1409,7 +1409,7 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_x86_64_fbsd" ;; - x86_64-*linux*) + x86_64-*linux*|x86_64-gnu*) LD="${LD-ld} -m elf_x86_64" ;; powerpcle-*linux*|powerpc64le-*linux*) @@ -1540,15 +1540,8 @@ old_postinstall_cmds='chmod 644 $oldlib' old_postuninstall_cmds= if test -n "$RANLIB"; then - case $host_os in - bitrig* | openbsd*) - old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" - ;; - *) - old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" - ;; - esac old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib" + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" fi case $host_os in @@ -1687,7 +1680,7 @@ AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl lt_cv_sys_max_cmd_len=-1; ;; - cygwin* | mingw* | cegcc*) + cygwin* | mingw* | windows* | cegcc*) # On Win9x/ME, this test blows up -- it succeeds, but takes # about 5 minutes as the teststring grows exponentially. # Worse, since 9x/ME are not pre-emptively multitasking, @@ -1930,7 +1923,7 @@ else lt_cv_dlopen_self=yes ;; - mingw* | pw32* | cegcc*) + mingw* | windows* | pw32* | cegcc*) lt_cv_dlopen=LoadLibrary lt_cv_dlopen_libs= ;; @@ -2298,7 +2291,7 @@ if test yes = "$GCC"; then *) lt_awk_arg='/^libraries:/' ;; esac case $host_os in - mingw* | cegcc*) lt_sed_strip_eq='s|=\([[A-Za-z]]:\)|\1|g' ;; + mingw* | windows* | cegcc*) lt_sed_strip_eq='s|=\([[A-Za-z]]:\)|\1|g' ;; *) lt_sed_strip_eq='s|=/|/|g' ;; esac lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` @@ -2356,7 +2349,7 @@ BEGIN {RS = " "; FS = "/|\n";} { # AWK program above erroneously prepends '/' to C:/dos/paths # for these hosts. case $host_os in - mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ + mingw* | windows* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ $SED 's|/\([[A-Za-z]]:\)|\1|g'` ;; esac sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` @@ -2525,7 +2518,7 @@ bsdi[[45]]*) # libtool to hard-code these into programs ;; -cygwin* | mingw* | pw32* | cegcc*) +cygwin* | mingw* | windows* | pw32* | cegcc*) version_type=windows shrext_cmds=.dll need_version=no @@ -2558,7 +2551,7 @@ cygwin* | mingw* | pw32* | cegcc*) m4_if([$1], [],[ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"]) ;; - mingw* | cegcc*) + mingw* | windows* | cegcc*) # MinGW DLLs use traditional 'lib' prefix #soname_spec='$libname`echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext' soname_spec='`echo $libname | $SED -e 's/^lib//'`$shared_ext' # SDL customization @@ -2571,14 +2564,14 @@ m4_if([$1], [],[ dynamic_linker='Win32 ld.exe' ;; - *,cl*) - # Native MSVC + *,cl* | *,icl*) + # Native MSVC or ICC libname_spec='$name' soname_spec='$libname`echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext' library_names_spec='$libname.dll.lib' case $build_os in - mingw*) + mingw* | windows*) sys_lib_search_path_spec= lt_save_ifs=$IFS IFS=';' @@ -2628,7 +2621,7 @@ m4_if([$1], [],[ ;; *) - # Assume MSVC wrapper + # Assume MSVC and ICC wrapper library_names_spec='$libname`echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext $libname.lib' dynamic_linker='Win32 ld.exe' ;; @@ -3267,7 +3260,7 @@ if test yes = "$GCC"; then # Check if gcc -print-prog-name=ld gives a path. AC_MSG_CHECKING([for ld used by $CC]) case $host in - *-*-mingw*) + *-*-mingw* | *-*-windows*) # gcc leaves a trailing carriage return, which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) @@ -3376,7 +3369,7 @@ case $reload_flag in esac reload_cmds='$LD$reload_flag -o $output$reload_objs' case $host_os in - cygwin* | mingw* | pw32* | cegcc*) + cygwin* | mingw* | windows* | pw32* | cegcc*) if test yes != "$GCC"; then reload_cmds=false fi @@ -3476,7 +3469,7 @@ cygwin*) lt_cv_deplibs_check_method=pass_all # SDL customization ;; -mingw* | pw32*) +mingw* | windows* | pw32*) # Base MSYS/MinGW do not provide the 'file' command needed by # func_win32_libid shell function, so use a weaker test based on 'objdump', # unless we find 'file', for example because we are cross-compiling. @@ -3641,7 +3634,7 @@ file_magic_glob= want_nocaseglob=no if test "$build" = "$host"; then case $host_os in - mingw* | pw32*) + mingw* | windows* | pw32*) if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then want_nocaseglob=yes else @@ -3693,7 +3686,7 @@ else # Tru64's nm complains that /dev/null is an invalid object file # MSYS converts /dev/null to NUL, MinGW nm treats NUL as empty case $build_os in - mingw*) lt_bad_file=conftest.nm/nofile ;; + mingw* | windows*) lt_bad_file=conftest.nm/nofile ;; *) lt_bad_file=/dev/null ;; esac case `"$tmp_nm" -B $lt_bad_file 2>&1 | sed '1q'` in @@ -3784,7 +3777,7 @@ lt_cv_sharedlib_from_linklib_cmd, [lt_cv_sharedlib_from_linklib_cmd='unknown' case $host_os in -cygwin* | mingw* | pw32* | cegcc*) +cygwin* | mingw* | windows* | pw32* | cegcc*) # two different shell functions defined in ltmain.sh; # decide which one to use based on capabilities of $DLLTOOL case `$DLLTOOL --help 2>&1` in @@ -3929,7 +3922,7 @@ case $host_os in aix*) symcode='[[BCDT]]' ;; -cygwin* | mingw* | pw32* | cegcc*) +cygwin* | mingw* | windows* | pw32* | cegcc*) symcode='[[ABCDGISTW]]' ;; hpux*) @@ -4008,7 +4001,7 @@ $lt_c_name_lib_hook\ # Handle CRLF in mingw tool chain opt_cr= case $build_os in -mingw*) +mingw* | windows*) opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp ;; esac @@ -4023,7 +4016,7 @@ for ac_symprfx in "" "_"; do if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Fake it for dumpbin and say T for any non-static function, # D for any global variable and I for any imported variable. - # Also find C++ and __fastcall symbols from MSVC++, + # Also find C++ and __fastcall symbols from MSVC++ or ICC, # which start with @ or ?. lt_cv_sys_global_symbol_pipe="$AWK ['"\ " {last_section=section; section=\$ 3};"\ @@ -4235,7 +4228,7 @@ m4_if([$1], [CXX], [ beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; - mingw* | cygwin* | os2* | pw32* | cegcc*) + mingw* | windows* | cygwin* | os2* | pw32* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style @@ -4311,7 +4304,7 @@ m4_if([$1], [CXX], [ ;; esac ;; - mingw* | cygwin* | os2* | pw32* | cegcc*) + mingw* | windows* | cygwin* | os2* | pw32* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). m4_if([$1], [GCJ], [], @@ -4559,7 +4552,7 @@ m4_if([$1], [CXX], [ # PIC is the default for these OSes. ;; - mingw* | cygwin* | pw32* | os2* | cegcc*) + mingw* | windows* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style @@ -4663,7 +4656,7 @@ m4_if([$1], [CXX], [ esac ;; - mingw* | cygwin* | pw32* | os2* | cegcc*) + mingw* | windows* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). m4_if([$1], [GCJ], [], @@ -4938,9 +4931,9 @@ m4_if([$1], [CXX], [ pw32*) _LT_TAGVAR(export_symbols_cmds, $1)=$ltdll_cmds ;; - cygwin* | mingw* | cegcc*) + cygwin* | mingw* | windows* | cegcc*) case $cc_basename in - cl*) + cl* | icl*) _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' ;; *) @@ -4996,16 +4989,16 @@ dnl Note also adjust exclude_expsyms for C++ above. extract_expsyms_cmds= case $host_os in - cygwin* | mingw* | pw32* | cegcc*) - # FIXME: the MSVC++ port hasn't been tested in a loooong time + cygwin* | mingw* | windows* | pw32* | cegcc*) + # FIXME: the MSVC++ and ICC port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. + # Microsoft Visual C++ or Intel C++ Compiler. if test yes != "$GCC"; then with_gnu_ld=no fi ;; interix*) - # we just hope/assume this is gcc and not c89 (= MSVC++) + # we just hope/assume this is gcc and not c89 (= MSVC++ or ICC) with_gnu_ld=yes ;; openbsd* | bitrig*) @@ -5111,7 +5104,7 @@ _LT_EOF fi ;; - cygwin* | mingw* | pw32* | cegcc*) + cygwin* | mingw* | windows* | pw32* | cegcc*) # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, # as there is no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' @@ -5568,14 +5561,14 @@ _LT_EOF _LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic ;; - cygwin* | mingw* | pw32* | cegcc*) + cygwin* | mingw* | windows* | pw32* | cegcc*) # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. + # Microsoft Visual C++ or Intel C++ Compiler. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. case $cc_basename in - cl*) - # Native MSVC + cl* | icl*) + # Native MSVC or ICC _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=yes @@ -5585,14 +5578,14 @@ _LT_EOF # Tell ltmain to make .dll files, not .so files. shrext_cmds=.dll # FIXME: Setting linknames here is a bad hack. - _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames=' + _LT_TAGVAR(archive_cmds, $1)='$CC -Fe $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames=' _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then cp "$export_symbols" "$output_objdir/$soname.def"; echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp"; else $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp; fi~ - $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ + $CC -Fe $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' @@ -5616,7 +5609,7 @@ _LT_EOF fi' ;; *) - # Assume MSVC wrapper + # Assume MSVC and ICC wrapper _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Tell ltmain to make .lib files, not .a files. @@ -6435,7 +6428,7 @@ if test yes != "$_lt_caught_CXX_error"; then # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "[[-]]L"' else GXX=no @@ -6644,10 +6637,10 @@ if test yes != "$_lt_caught_CXX_error"; then esac ;; - cygwin* | mingw* | pw32* | cegcc*) + cygwin* | mingw* | windows* | pw32* | cegcc*) case $GXX,$cc_basename in - ,cl* | no,cl*) - # Native MSVC + ,cl* | no,cl* | ,icl* | no,icl*) + # Native MSVC or ICC # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' @@ -6811,7 +6804,7 @@ if test yes != "$_lt_caught_CXX_error"; then # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "[[-]]L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test yes = "$GXX"; then @@ -6876,7 +6869,7 @@ if test yes != "$_lt_caught_CXX_error"; then # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "[[-]]L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test yes = "$GXX"; then @@ -7215,7 +7208,7 @@ if test yes != "$_lt_caught_CXX_error"; then # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "[[-]]L"' else # FIXME: insert proper C++ library support @@ -7299,7 +7292,7 @@ if test yes != "$_lt_caught_CXX_error"; then # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "[[-]]L"' else # g++ 2.7 appears to require '-G' NOT '-shared' on this # platform. @@ -7310,7 +7303,7 @@ if test yes != "$_lt_caught_CXX_error"; then # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. - output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' + output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "[[-]]L"' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R $wl$libdir' @@ -8331,7 +8324,7 @@ AC_CACHE_VAL(lt_cv_to_host_file_cmd, [case $host in *-*-mingw* ) case $build in - *-*-mingw* ) # actually msys + *-*-mingw* | *-*-windows* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 ;; *-*-cygwin* ) @@ -8344,7 +8337,7 @@ AC_CACHE_VAL(lt_cv_to_host_file_cmd, ;; *-*-cygwin* ) case $build in - *-*-mingw* ) # actually msys + *-*-mingw* | *-*-windows* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin ;; *-*-cygwin* ) @@ -8370,9 +8363,9 @@ AC_CACHE_VAL(lt_cv_to_tool_file_cmd, [#assume ordinary cross tools, or native build. lt_cv_to_tool_file_cmd=func_convert_file_noop case $host in - *-*-mingw* ) + *-*-mingw* | *-*-windows* ) case $build in - *-*-mingw* ) # actually msys + *-*-mingw* | *-*-windows* ) # actually msys lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 ;; esac diff --git a/thirdparty/SDL/acinclude/ltoptions.m4 b/thirdparty/SDL/acinclude/ltoptions.m4 index 94b082976..7d7e68864 100644 --- a/thirdparty/SDL/acinclude/ltoptions.m4 +++ b/thirdparty/SDL/acinclude/ltoptions.m4 @@ -128,7 +128,7 @@ LT_OPTION_DEFINE([LT_INIT], [win32-dll], [enable_win32_dll=yes case $host in -*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*) +*-*-cygwin* | *-*-mingw* | *-*-windows* | *-*-pw32* | *-*-cegcc*) AC_CHECK_TOOL(AS, as, false) AC_CHECK_TOOL(DLLTOOL, dlltool, false) AC_CHECK_TOOL(OBJDUMP, objdump, false) diff --git a/thirdparty/SDL/android-project/app/src/main/AndroidManifest.xml b/thirdparty/SDL/android-project/app/src/main/AndroidManifest.xml index e0d033410..5157374b5 100644 --- a/thirdparty/SDL/android-project/app/src/main/AndroidManifest.xml +++ b/thirdparty/SDL/android-project/app/src/main/AndroidManifest.xml @@ -62,7 +62,7 @@ - - diff --git a/thirdparty/SDL/build-scripts/config.guess b/thirdparty/SDL/build-scripts/config.guess index cdfc43920..f6d217a49 100755 --- a/thirdparty/SDL/build-scripts/config.guess +++ b/thirdparty/SDL/build-scripts/config.guess @@ -1,10 +1,10 @@ #! /bin/sh # Attempt to guess a canonical system name. -# Copyright 1992-2023 Free Software Foundation, Inc. +# Copyright 1992-2024 Free Software Foundation, Inc. # shellcheck disable=SC2006,SC2268 # see below for rationale -timestamp='2023-08-22' +timestamp='2024-01-01' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -60,7 +60,7 @@ version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. -Copyright 1992-2023 Free Software Foundation, Inc. +Copyright 1992-2024 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -165,6 +165,8 @@ Linux|GNU|GNU/*) LIBC=dietlibc #elif defined(__GLIBC__) LIBC=gnu + #elif defined(__LLVM_LIBC__) + LIBC=llvm #else #include /* First heuristic to detect musl libc. */ @@ -1593,6 +1595,9 @@ EOF *:Unleashed:*:*) GUESS=$UNAME_MACHINE-unknown-unleashed$UNAME_RELEASE ;; + *:Ironclad:*:*) + GUESS=$UNAME_MACHINE-unknown-ironclad + ;; esac # Do we have a guess based on uname results? diff --git a/thirdparty/SDL/build-scripts/config.sub b/thirdparty/SDL/build-scripts/config.sub index defe52c0c..2c6a07ab3 100755 --- a/thirdparty/SDL/build-scripts/config.sub +++ b/thirdparty/SDL/build-scripts/config.sub @@ -1,10 +1,10 @@ #! /bin/sh # Configuration validation subroutine script. -# Copyright 1992-2023 Free Software Foundation, Inc. +# Copyright 1992-2024 Free Software Foundation, Inc. # shellcheck disable=SC2006,SC2268 # see below for rationale -timestamp='2023-09-19' +timestamp='2024-01-01' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -76,7 +76,7 @@ Report bugs and patches to ." version="\ GNU config.sub ($timestamp) -Copyright 1992-2023 Free Software Foundation, Inc. +Copyright 1992-2024 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -1222,6 +1222,7 @@ case $cpu-$vendor in | moxie \ | mt \ | msp430 \ + | nanomips* \ | nds32 | nds32le | nds32be \ | nfp \ | nios | nios2 | nios2eb | nios2el \ @@ -1253,6 +1254,7 @@ case $cpu-$vendor in | ubicom32 \ | v70 | v850 | v850e | v850e1 | v850es | v850e2 | v850e2v3 \ | vax \ + | vc4 \ | visium \ | w65 \ | wasm32 | wasm64 \ @@ -1597,7 +1599,7 @@ case $cpu-$vendor in os= obj=elf ;; - mips*-*) + mips*-*|nanomips*-*) os= obj=elf ;; @@ -1721,7 +1723,7 @@ fi case $os in # Sometimes we do "kernel-libc", so those need to count as OSes. - musl* | newlib* | relibc* | uclibc*) + llvm* | musl* | newlib* | relibc* | uclibc*) ;; # Likewise for "kernel-abi" eabi* | gnueabi*) @@ -1766,12 +1768,19 @@ case $os in | onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \ | midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi* \ | nsk* | powerunix* | genode* | zvmoe* | qnx* | emx* | zephyr* \ - | fiwix* | mlibc* | cos* | mbr* ) + | fiwix* | mlibc* | cos* | mbr* | ironclad* ) ;; # This one is extra strict with allowed versions sco3.2v2 | sco3.2v[4-9]* | sco5v6*) # Don't forget version if it is 3.2v4 or newer. ;; + # This refers to builds using the UEFI calling convention + # (which depends on the architecture) and PE file format. + # Note that this is both a different calling convention and + # different file format than that of GNU-EFI + # (x86_64-w64-mingw32). + uefi) + ;; none) ;; kernel* | msvc* ) @@ -1818,8 +1827,9 @@ esac # As a final step for OS-related things, validate the OS-kernel combination # (given a valid OS), if there is a kernel. case $kernel-$os-$obj in - linux-gnu*- | linux-dietlibc*- | linux-android*- | linux-newlib*- \ - | linux-musl*- | linux-relibc*- | linux-uclibc*- | linux-mlibc*- ) + linux-gnu*- | linux-android*- | linux-dietlibc*- | linux-llvm*- \ + | linux-mlibc*- | linux-musl*- | linux-newlib*- \ + | linux-relibc*- | linux-uclibc*- ) ;; uclinux-uclibc*- ) ;; @@ -1827,7 +1837,8 @@ case $kernel-$os-$obj in ;; windows*-msvc*-) ;; - -dietlibc*- | -newlib*- | -musl*- | -relibc*- | -uclibc*- | -mlibc*- ) + -dietlibc*- | -llvm*- | -mlibc*- | -musl*- | -newlib*- | -relibc*- \ + | -uclibc*- ) # These are just libc implementations, not actual OSes, and thus # require a kernel. echo "Invalid configuration '$1': libc '$os' needs explicit kernel." 1>&2 diff --git a/thirdparty/SDL/build-scripts/gen_audio_channel_conversion.c b/thirdparty/SDL/build-scripts/gen_audio_channel_conversion.c index 99c40b71d..5d5841d9e 100644 --- a/thirdparty/SDL/build-scripts/gen_audio_channel_conversion.c +++ b/thirdparty/SDL/build-scripts/gen_audio_channel_conversion.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -395,7 +395,7 @@ int main(void) printf( "/*\n" " Simple DirectMedia Layer\n" - " Copyright (C) 1997-2023 Sam Lantinga \n" + " Copyright (C) 1997-2024 Sam Lantinga \n" "\n" " This software is provided 'as-is', without any express or implied\n" " warranty. In no event will the authors be held liable for any damages\n" diff --git a/thirdparty/SDL/build-scripts/gen_audio_resampler_filter.c b/thirdparty/SDL/build-scripts/gen_audio_resampler_filter.c index d5c301373..22b743740 100644 --- a/thirdparty/SDL/build-scripts/gen_audio_resampler_filter.c +++ b/thirdparty/SDL/build-scripts/gen_audio_resampler_filter.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -113,7 +113,7 @@ int main(void) printf( "/*\n" " Simple DirectMedia Layer\n" - " Copyright (C) 1997-2023 Sam Lantinga \n" + " Copyright (C) 1997-2024 Sam Lantinga \n" "\n" " This software is provided 'as-is', without any express or implied\n" " warranty. In no event will the authors be held liable for any damages\n" diff --git a/thirdparty/SDL/build-scripts/ltmain.sh b/thirdparty/SDL/build-scripts/ltmain.sh index 70a3e8253..7be7193b4 100644 --- a/thirdparty/SDL/build-scripts/ltmain.sh +++ b/thirdparty/SDL/build-scripts/ltmain.sh @@ -2418,7 +2418,7 @@ libtool_validate_options () case $host in # Solaris2 added to fix http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16452 # see also: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59788 - *cygwin* | *mingw* | *pw32* | *cegcc* | *solaris2* | *os2*) + *cygwin* | *mingw* | *windows* | *pw32* | *cegcc* | *solaris2* | *os2*) # don't eliminate duplications in $postdeps and $predeps opt_duplicate_compiler_generated_deps=: ;; @@ -2750,7 +2750,7 @@ EOF # func_convert_core_file_wine_to_w32 ARG # Helper function used by file name conversion functions when $build is *nix, -# and $host is mingw, cygwin, or some other w32 environment. Relies on a +# and $host is mingw, windows, cygwin, or some other w32 environment. Relies on a # correctly configured wine environment available, with the winepath program # in $build's $PATH. # @@ -2782,9 +2782,10 @@ func_convert_core_file_wine_to_w32 () # func_convert_core_path_wine_to_w32 ARG # Helper function used by path conversion functions when $build is *nix, and -# $host is mingw, cygwin, or some other w32 environment. Relies on a correctly -# configured wine environment available, with the winepath program in $build's -# $PATH. Assumes ARG has no leading or trailing path separator characters. +# $host is mingw, windows, cygwin, or some other w32 environment. Relies on a +# correctly configured wine environment available, with the winepath program +# in $build's $PATH. Assumes ARG has no leading or trailing path separator +# characters. # # ARG is path to be converted from $build format to win32. # Result is available in $func_convert_core_path_wine_to_w32_result. @@ -3439,7 +3440,7 @@ func_mode_compile () # On Cygwin there's no "real" PIC flag so we must build both object types case $host_os in - cygwin* | mingw* | pw32* | os2* | cegcc*) + cygwin* | mingw* | windows* | pw32* | os2* | cegcc*) pic_mode=default ;; esac @@ -4316,7 +4317,7 @@ func_mode_install () 'exit $?' tstripme=$stripme case $host_os in - cygwin* | mingw* | pw32* | cegcc*) + cygwin* | mingw* | windows* | pw32* | cegcc*) case $realname in *.dll.a) tstripme= @@ -4429,7 +4430,7 @@ func_mode_install () # Do a test to see if this is really a libtool program. case $host in - *cygwin* | *mingw*) + *cygwin* | *mingw* | *windows*) if func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" wrapper=$func_ltwrapper_scriptname_result @@ -4657,7 +4658,7 @@ extern \"C\" { $RM $export_symbols eval "$SED -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' case $host in - *cygwin* | *mingw* | *cegcc* ) + *cygwin* | *mingw* | *windows* | *cegcc* ) eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' ;; @@ -4669,7 +4670,7 @@ extern \"C\" { eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' case $host in - *cygwin* | *mingw* | *cegcc* ) + *cygwin* | *mingw* | *windows* | *cegcc* ) eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' ;; @@ -4683,7 +4684,7 @@ extern \"C\" { func_basename "$dlprefile" name=$func_basename_result case $host in - *cygwin* | *mingw* | *cegcc* ) + *cygwin* | *mingw* | *windows* | *cegcc* ) # if an import library, we need to obtain dlname if func_win32_import_lib_p "$dlprefile"; then func_tr_sh "$dlprefile" @@ -4858,7 +4859,7 @@ static const void *lt_preloaded_setup() { # Transform the symbol file into the correct name. symfileobj=$output_objdir/${my_outputname}S.$objext case $host in - *cygwin* | *mingw* | *cegcc* ) + *cygwin* | *mingw* | *windows* | *cegcc* ) if test -f "$output_objdir/$my_outputname.def"; then compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` @@ -5201,7 +5202,7 @@ func_extract_archives () # # Emit a libtool wrapper script on stdout. # Don't directly open a file because we may want to -# incorporate the script contents within a cygwin/mingw +# incorporate the script contents within a cygwin/mingw/windows # wrapper executable. Must ONLY be called from within # func_mode_link because it depends on a number of variables # set therein. @@ -5209,7 +5210,7 @@ func_extract_archives () # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR # variable will take. If 'yes', then the emitted script # will assume that the directory where it is stored is -# the $objdir directory. This is a cygwin/mingw-specific +# the $objdir directory. This is a cygwin/mingw/windows-specific # behavior. func_emit_wrapper () { @@ -5333,7 +5334,7 @@ func_exec_program_core () " case $host in # Backslashes separate directories on plain windows - *-*-mingw | *-*-os2* | *-cegcc*) + *-*-mingw* | *-*-windows* | *-*-os2* | *-cegcc*) $ECHO "\ if test -n \"\$lt_option_debug\"; then \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir\\\\\$program\" 1>&2 @@ -5401,7 +5402,7 @@ func_exec_program () file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\` done - # Usually 'no', except on cygwin/mingw when embedded into + # Usually 'no', except on cygwin/mingw/windows when embedded into # the cwrapper. WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1 if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then @@ -5558,7 +5559,7 @@ EOF /* declarations of non-ANSI functions */ #if defined __MINGW32__ # ifdef __STRICT_ANSI__ -int _putenv (const char *); +_CRTIMP int __cdecl _putenv (const char *); # endif #elif defined __CYGWIN__ # ifdef __STRICT_ANSI__ @@ -5756,7 +5757,7 @@ main (int argc, char *argv[]) { EOF case $host in - *mingw* | *cygwin* ) + *mingw* | *windows* | *cygwin* ) # make stdout use "unix" line endings echo " setmode(1,_O_BINARY);" ;; @@ -5859,7 +5860,7 @@ EOF EOF case $host_os in - mingw*) + mingw* | windows*) cat <<"EOF" { char* p; @@ -5901,7 +5902,7 @@ EOF EOF case $host_os in - mingw*) + mingw* | windows*) cat <<"EOF" /* execv doesn't actually work on mingw as expected on unix */ newargz = prepare_spawn (newargz); @@ -6320,7 +6321,7 @@ lt_update_lib_path (const char *name, const char *value) EOF case $host_os in - mingw*) + mingw* | windows*) cat <<"EOF" /* Prepares an argument vector before calling spawn(). @@ -6495,7 +6496,7 @@ func_mode_link () $debug_cmd case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) + *-*-cygwin* | *-*-mingw* | *-*-windows* | *-*-pw32* | *-*-os2* | *-cegcc*) # It is impossible to link a dll without this setting, and # we shouldn't force the makefile maintainer to figure out # what system we are compiling for in order to pass an extra @@ -7003,7 +7004,7 @@ func_mode_link () ;; esac case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) + *-*-cygwin* | *-*-mingw* | *-*-windows* | *-*-pw32* | *-*-os2* | *-cegcc*) testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'` case :$dllsearchpath: in *":$dir:"*) ;; @@ -7023,7 +7024,7 @@ func_mode_link () -l*) if test X-lc = "X$arg" || test X-lm = "X$arg"; then case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*) + *-*-cygwin* | *-*-mingw* | *-*-windows* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*) # These systems don't actually have a C or math library (as such) continue ;; @@ -7118,7 +7119,7 @@ func_mode_link () -no-install) case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*) + *-*-cygwin* | *-*-mingw* | *-*-windows* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*) # The PATH hackery in wrapper scripts is required on Windows # and Darwin in order for the loader to find any dlls it needs. func_warning "'-no-install' is ignored for $host" @@ -7303,13 +7304,26 @@ func_mode_link () # -O*, -g*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization # -specs=* GCC specs files # -stdlib=* select c++ std lib with clang + # -fdiagnostics-color* simply affects output + # -frecord-gcc-switches used to verify flags were respected # -fsanitize=* Clang/GCC memory and address sanitizer + # -fno-sanitize* Clang/GCC memory and address sanitizer + # -shared-libsan Link with shared sanitizer runtimes (Clang) + # -static-libsan Link with static sanitizer runtimes (Clang) # -fuse-ld=* Linker select flags for GCC + # -rtlib=* select c runtime lib with clang + # --unwindlib=* select unwinder library with clang + # -f{file|debug|macro|profile}-prefix-map=* needed for lto linking # -Wa,* Pass flags directly to the assembler + # -Werror, -Werror=* Report (specified) warnings as errors -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \ - -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*| \ - -specs=*|-fsanitize=*|-fuse-ld=*|-Wa,*) + -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*| \ + -stdlib=*|-rtlib=*|--unwindlib=*| \ + -specs=*|-fsanitize=*|-fno-sanitize*|-shared-libsan|-static-libsan| \ + -ffile-prefix-map=*|-fdebug-prefix-map=*|-fmacro-prefix-map=*|-fprofile-prefix-map=*| \ + -fdiagnostics-color*|-frecord-gcc-switches| \ + -fuse-ld=*|-Wa,*|-Werror|-Werror=*) func_quote_for_eval "$arg" arg=$func_quote_for_eval_result func_append compile_command " $arg" @@ -8022,7 +8036,7 @@ func_mode_link () fi case $host in # special handling for platforms with PE-DLLs. - *cygwin* | *mingw* | *cegcc* ) + *cygwin* | *mingw* | *windows* | *cegcc* ) # Linker will automatically link against shared library if both # static and shared are present. Therefore, ensure we extract # symbols from the import library if a shared library is present @@ -8166,7 +8180,7 @@ func_mode_link () if test -n "$library_names" && { test no = "$use_static_libs" || test -z "$old_library"; }; then case $host in - *cygwin* | *mingw* | *cegcc* | *os2*) + *cygwin* | *mingw* | *windows* | *cegcc* | *os2*) # No point in relinking DLLs because paths are not encoded func_append notinst_deplibs " $lib" need_relink=no @@ -8236,7 +8250,7 @@ func_mode_link () elif test -n "$soname_spec"; then # bleh windows case $host in - *cygwin* | mingw* | *cegcc*) # | *os2* # SDL customization: removed OS/2 versioning support. + *cygwin* | mingw* | *windows* | *cegcc*) # | *os2* # SDL customization: removed OS/2 versioning support. func_arith $current - $age major=$func_arith_result versuffix=-$major @@ -8845,7 +8859,7 @@ func_mode_link () age=$number_minor revision=$number_revision ;; - freebsd-aout|qnx|sunos) + freebsd-aout|qnx|sco|sunos) current=$number_major revision=$number_minor age=0 @@ -9146,7 +9160,7 @@ func_mode_link () if test yes = "$build_libtool_libs"; then if test -n "$rpath"; then case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*) + *-*-cygwin* | *-*-mingw* | *-*-windows* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*) # these systems don't actually have a c library (as such)! ;; *-*-rhapsody* | *-*-darwin1.[012]) @@ -9660,7 +9674,7 @@ EOF orig_export_symbols= case $host_os in - cygwin* | mingw* | cegcc*) + cygwin* | mingw* | windows* | cegcc*) if test -n "$export_symbols" && test -z "$export_symbols_regex"; then # exporting using user supplied symfile func_dll_def_p "$export_symbols" || { @@ -10330,7 +10344,7 @@ EOF esac fi case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) + *-*-cygwin* | *-*-mingw* | *-*-windows* | *-*-pw32* | *-*-os2* | *-cegcc*) testbindir=`$ECHO "$libdir" | $SED -e 's*/lib$*/bin*'` case :$dllsearchpath: in *":$libdir:"*) ;; @@ -10408,7 +10422,7 @@ EOF # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway. wrappers_required=false ;; - *cygwin* | *mingw* ) + *cygwin* | *mingw* | *windows* ) test yes = "$build_libtool_libs" || wrappers_required=false ;; *) @@ -10561,7 +10575,7 @@ EOF *) exeext= ;; esac case $host in - *cygwin* | *mingw* ) + *cygwin* | *mingw* | windows* ) func_dirname_and_basename "$output" "" "." output_name=$func_basename_result output_path=$func_dirname_result @@ -10893,7 +10907,7 @@ EOF # tests/bindir.at for full details. tdlname=$dlname case $host,$output,$installed,$module,$dlname in - *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) + *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *windows*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) # If a -bindir argument was supplied, place the dll there. if test -n "$bindir"; then func_relative_path "$install_libdir" "$bindir" diff --git a/thirdparty/SDL/build-scripts/update-copyright.sh b/thirdparty/SDL/build-scripts/update-copyright.sh index c69ec7293..9bb46eac5 100755 --- a/thirdparty/SDL/build-scripts/update-copyright.sh +++ b/thirdparty/SDL/build-scripts/update-copyright.sh @@ -1,7 +1,15 @@ #!/bin/sh -find . -type f -exec grep -Il "Copyright" {} \; \ +if [ "$SED" = "" ]; then + if type gsed >/dev/null; then + SED=gsed + else + SED=sed + fi +fi + +find . -type f \ | grep -v \.git \ | while read file; do \ - LC_ALL=C sed -b -i "s/\(.*Copyright.*\)[0-9]\{4\}\( *Sam Lantinga\)/\1`date +%Y`\2/" "$file"; \ + LC_ALL=C $SED -b -i "s/\(.*Copyright.*\)[0-9]\{4\}\( *Sam Lantinga\)/\1`date +%Y`\2/" "$file"; \ done diff --git a/thirdparty/SDL/cmake/macros.cmake b/thirdparty/SDL/cmake/macros.cmake index 69a5d5464..5060923e8 100644 --- a/thirdparty/SDL/cmake/macros.cmake +++ b/thirdparty/SDL/cmake/macros.cmake @@ -124,3 +124,25 @@ if(CMAKE_VERSION VERSION_LESS 3.13.0) link_directories(${ARGN}) endmacro() endif() + +# CMP0087: install(CODE) and install(SCRIPT) support generator expressions. +if(POLICY CMP0087) + cmake_policy(SET CMP0087 NEW) +endif() +function(SDL_install_pdb TARGET DIRECTORY) + get_property(type TARGET ${TARGET} PROPERTY TYPE) + if(type MATCHES "^(SHARED_LIBRARY|EXECUTABLE)$") + if(NOT CMAKE_VERSION VERSION_LESS 3.1) + install(FILES $ DESTINATION "${DIRECTORY}" OPTIONAL) + endif() + elseif(type STREQUAL "STATIC_LIBRARY") + if(NOT CMAKE_VERSION VERSION_LESS 3.15) + # FIXME: Use $) + target_include_directories(sdl-build-options SYSTEM INTERFACE $) set(SDL_AUDIO_DRIVER_ALSA_DYNAMIC "\"${ASOUND_LIB_SONAME}\"") set(HAVE_ALSA_SHARED TRUE) else() @@ -160,7 +166,7 @@ endmacro() # - HAVE_SDL_LOADSO opt macro(CheckPulseAudio) if(SDL_PULSEAUDIO) - pkg_check_modules(PKG_PULSEAUDIO libpulse-simple) + pkg_check_modules(PKG_PULSEAUDIO libpulse>=0.9.15) if(PKG_PULSEAUDIO_FOUND) set(HAVE_PULSEAUDIO TRUE) file(GLOB PULSEAUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/pulseaudio/*.c) @@ -170,9 +176,9 @@ macro(CheckPulseAudio) if(SDL_PULSEAUDIO_SHARED AND NOT HAVE_SDL_LOADSO) message_warn("You must have SDL_LoadObject() support for dynamic PulseAudio loading") endif() - FindLibraryAndSONAME("pulse-simple" LIBDIRS ${PKG_PULSEAUDIO_LIBRARY_DIRS}) - if(SDL_PULSEAUDIO_SHARED AND PULSE_SIMPLE_LIB AND HAVE_SDL_LOADSO) - set(SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC "\"${PULSE_SIMPLE_LIB_SONAME}\"") + FindLibraryAndSONAME("pulse" LIBDIRS ${PKG_PULSEAUDIO_LIBRARY_DIRS}) + if(SDL_PULSEAUDIO_SHARED AND PULSE_LIB AND HAVE_SDL_LOADSO) + set(SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC "\"${PULSE_LIB_SONAME}\"") set(HAVE_PULSEAUDIO_SHARED TRUE) else() list(APPEND EXTRA_LDFLAGS ${PKG_PULSEAUDIO_LDFLAGS}) @@ -374,7 +380,7 @@ macro(CheckLibSampleRate) set(HAVE_LIBSAMPLERATE TRUE) set(HAVE_LIBSAMPLERATE_H TRUE) if(SDL_LIBSAMPLERATE_SHARED) - target_include_directories(sdl-build-options INTERFACE $) + target_include_directories(sdl-build-options SYSTEM INTERFACE $) if(NOT HAVE_SDL_LOADSO) message_warn("You must have SDL_LoadObject() support for dynamic libsamplerate loading") else() @@ -465,7 +471,9 @@ macro(CheckX11) list(APPEND SOURCE_FILES ${X11_SOURCES}) set(SDL_VIDEO_DRIVER_X11 1) - # !!! FIXME: why is this disabled for Apple? + # Note: Disabled on Apple because the dynamic mode backend for X11 doesn't + # work properly on Apple during several issues like inconsistent paths + # among platforms. See #6778 (https://github.com/libsdl-org/SDL/issues/6778) if(APPLE) set(SDL_X11_SHARED OFF) endif() @@ -677,7 +685,7 @@ macro(CheckWayland) if(WAYLAND_FOUND) target_link_directories(sdl-build-options INTERFACE "${PKG_WAYLAND_LIBRARY_DIRS}") - target_include_directories(sdl-build-options INTERFACE "${PKG_WAYLAND_INCLUDE_DIRS}") + target_include_directories(sdl-build-options SYSTEM INTERFACE "${PKG_WAYLAND_INCLUDE_DIRS}") set(HAVE_WAYLAND TRUE) set(HAVE_SDL_VIDEO TRUE) @@ -687,7 +695,7 @@ macro(CheckWayland) # We have to generate some protocol interface code for some unstable Wayland features. file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/wayland-generated-protocols") - target_include_directories(sdl-build-options INTERFACE "${CMAKE_CURRENT_BINARY_DIR}/wayland-generated-protocols") + target_include_directories(sdl-build-options SYSTEM INTERFACE "${CMAKE_CURRENT_BINARY_DIR}/wayland-generated-protocols") file(GLOB WAYLAND_PROTOCOLS_XML RELATIVE "${SDL2_SOURCE_DIR}/wayland-protocols/" "${SDL2_SOURCE_DIR}/wayland-protocols/*.xml") foreach(_XML ${WAYLAND_PROTOCOLS_XML}) @@ -723,7 +731,7 @@ macro(CheckWayland) set(HAVE_WAYLAND_LIBDECOR TRUE) set(HAVE_LIBDECOR_H 1) target_link_directories(sdl-build-options INTERFACE "${PKG_LIBDECOR_LIBRARY_DIRS}") - target_include_directories(sdl-build-options INTERFACE "${PKG_LIBDECOR_INCLUDE_DIRS}") + target_include_directories(sdl-build-options SYSTEM INTERFACE "${PKG_LIBDECOR_INCLUDE_DIRS}") if(SDL_WAYLAND_LIBDECOR_SHARED AND NOT HAVE_SDL_LOADSO) message_warn("You must have SDL_LoadObject() support for dynamic libdecor loading") endif() @@ -1315,7 +1323,7 @@ macro(CheckKMSDRM) pkg_check_modules(PKG_KMSDRM libdrm gbm egl) if(PKG_KMSDRM_FOUND AND HAVE_OPENGL_EGL) target_link_directories(sdl-build-options INTERFACE ${PKG_KMSDRM_LIBRARY_DIRS}) - target_include_directories(sdl-build-options INTERFACE "${PKG_KMSDRM_INCLUDE_DIRS}") + target_include_directories(sdl-build-options SYSTEM INTERFACE "${PKG_KMSDRM_INCLUDE_DIRS}") set(HAVE_KMSDRM TRUE) set(HAVE_SDL_VIDEO TRUE) @@ -1344,13 +1352,61 @@ endmacro() macro(CheckLibUDev) if(SDL_LIBUDEV) - check_include_file("libudev.h" have_libudev_header) - if(have_libudev_header) + check_include_file("libudev.h" HAVE_LIBUDEV_HEADER) + if(HAVE_LIBUDEV_HEADER) set(HAVE_LIBUDEV_H TRUE) FindLibraryAndSONAME(udev) if(UDEV_LIB_SONAME) set(SDL_UDEV_DYNAMIC "\"${UDEV_LIB_SONAME}\"") + set(HAVE_LIBUDEV TRUE) endif() endif() endif() endmacro() + + +macro(CheckLibUnwind) + set(found_libunwind FALSE) + set(_libunwind_src "#include \nint main() {unw_context_t context; unw_getcontext(&context); return 0;}") + + if(NOT found_libunwind) + cmake_push_check_state() + check_c_source_compiles("${_libunwind_src}" LIBC_HAS_WORKING_LIBUNWIND) + cmake_pop_check_state() + if(LIBC_HAS_WORKING_LIBUNWIND) + set(found_libunwind TRUE) + endif() + endif() + + if(NOT found_libunwind) + cmake_push_check_state() + list(APPEND CMAKE_REQUIRED_LIBRARIES "unwind") + check_c_source_compiles("${_libunwind_src}" LIBUNWIND_HAS_WORKINGLIBUNWIND) + cmake_pop_check_state() + if(LIBUNWIND_HAS_WORKINGLIBUNWIND) + set(found_libunwind TRUE) + list(APPEND EXTRA_TEST_LIBS unwind) + endif() + endif() + + if(NOT found_libunwind) + set(LibUnwind_PKG_CONFIG_SPEC libunwind libunwind-generic) + pkg_check_modules(PC_LIBUNWIND IMPORTED_TARGET ${LibUnwind_PKG_CONFIG_SPEC}) + if(PC_LIBUNWIND_FOUND) + cmake_push_check_state() + list(APPEND CMAKE_REQUIRED_LIBRARIES ${PC_LIBUNWIND_LIBRARIES}) + list(APPEND CMAKE_REQUIRED_INCLUDES ${PC_LIBUNWIND_INCLUDE_DIRS}) + check_c_source_compiles("${_libunwind_src}" PC_LIBUNWIND_HAS_WORKING_LIBUNWIND) + cmake_pop_check_state() + if(PC_LIBUNWIND_HAS_WORKING_LIBUNWIND) + set(found_libunwind TRUE) + list(APPEND EXTRA_TEST_LIBS ${PC_LIBUNWIND_LIBRARIES}) + list(APPEND EXTRA_TEST_INCLUDES ${PC_LIBUNWIND_INCLUDE_DIRS}) + endif() + endif() + endif() + + if(found_libunwind) + set(HAVE_LIBUNWIND_H TRUE) + endif() +endmacro() diff --git a/thirdparty/SDL/cmake/test/main_gui.c b/thirdparty/SDL/cmake/test/main_gui.c index 4ffe9be1c..ca2d92ecd 100644 --- a/thirdparty/SDL/cmake/test/main_gui.c +++ b/thirdparty/SDL/cmake/test/main_gui.c @@ -14,7 +14,7 @@ int main(int argc, char *argv[]) { 640, 480, SDL_WINDOW_SHOWN ); - if (window == NULL) { + if (!window) { fprintf(stderr, "could not create window: %s\n", SDL_GetError()); return 1; } diff --git a/thirdparty/SDL/configure b/thirdparty/SDL/configure index c5b466b5f..6d39b056a 100755 --- a/thirdparty/SDL/configure +++ b/thirdparty/SDL/configure @@ -845,6 +845,7 @@ enable_assertions enable_dependency_tracking enable_libc enable_system_iconv +enable_libiconv enable_gcc_atomics enable_atomic enable_audio @@ -872,7 +873,6 @@ enable_sse2 enable_sse3 enable_altivec enable_lsx -enable_lasx enable_oss enable_alsa with_alsa_prefix @@ -1641,7 +1641,9 @@ Optional Features: Use gcc -MMD -MT dependency tracking [default=yes] --enable-libc Use the system C library [default=yes] --enable-system-iconv Use iconv() from system-installed libraries - [default=yes] + [default=no for windows, yes for others] + --enable-libiconv Prefer iconv() from libiconv, if available, over + libc version [default=no] --enable-gcc-atomics Use gcc builtin atomics [default=yes] --enable-atomic Enable the atomic operations subsystem [default=yes] --enable-audio Enable the audio subsystem [default=yes] @@ -1672,7 +1674,6 @@ Optional Features: --enable-sse3 use SSE3 assembly routines [default=maybe] --enable-altivec use Altivec assembly routines [default=yes] --enable-lsx use LSX assembly routines [default=yes] - --enable-lasx use LASX assembly routines [default=yes] --enable-oss support the OSS audio API [default=maybe] --enable-alsa support the ALSA audio API [default=yes] --disable-alsatest Do not try to compile and run a test Alsa program @@ -3506,8 +3507,8 @@ orig_CFLAGS="$CFLAGS" # See docs/release_checklist.md SDL_MAJOR_VERSION=2 -SDL_MINOR_VERSION=28 -SDL_MICRO_VERSION=5 +SDL_MINOR_VERSION=30 +SDL_MICRO_VERSION=7 SDL_VERSION=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION.$SDL_MICRO_VERSION SDL_BINARY_AGE=`expr $SDL_MINOR_VERSION \* 100 + $SDL_MICRO_VERSION` @@ -5032,7 +5033,7 @@ if test yes = "$GCC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 printf %s "checking for ld used by $CC... " >&6; } case $host in - *-*-mingw*) + *-*-mingw* | *-*-windows*) # gcc leaves a trailing carriage return, which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) @@ -5159,7 +5160,7 @@ else # Tru64's nm complains that /dev/null is an invalid object file # MSYS converts /dev/null to NUL, MinGW nm treats NUL as empty case $build_os in - mingw*) lt_bad_file=conftest.nm/nofile ;; + mingw* | windows*) lt_bad_file=conftest.nm/nofile ;; *) lt_bad_file=/dev/null ;; esac case `"$tmp_nm" -B $lt_bad_file 2>&1 | sed '1q'` in @@ -5388,7 +5389,7 @@ else $as_nop lt_cv_sys_max_cmd_len=-1; ;; - cygwin* | mingw* | cegcc*) + cygwin* | mingw* | windows* | cegcc*) # On Win9x/ME, this test blows up -- it succeeds, but takes # about 5 minutes as the teststring grows exponentially. # Worse, since 9x/ME are not pre-emptively multitasking, @@ -5552,7 +5553,7 @@ else $as_nop case $host in *-*-mingw* ) case $build in - *-*-mingw* ) # actually msys + *-*-mingw* | *-*-windows* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 ;; *-*-cygwin* ) @@ -5565,7 +5566,7 @@ else $as_nop ;; *-*-cygwin* ) case $build in - *-*-mingw* ) # actually msys + *-*-mingw* | *-*-windows* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin ;; *-*-cygwin* ) @@ -5600,9 +5601,9 @@ else $as_nop #assume ordinary cross tools, or native build. lt_cv_to_tool_file_cmd=func_convert_file_noop case $host in - *-*-mingw* ) + *-*-mingw* | *-*-windows* ) case $build in - *-*-mingw* ) # actually msys + *-*-mingw* | *-*-windows* ) # actually msys lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 ;; esac @@ -5636,7 +5637,7 @@ case $reload_flag in esac reload_cmds='$LD$reload_flag -o $output$reload_objs' case $host_os in - cygwin* | mingw* | pw32* | cegcc*) + cygwin* | mingw* | windows* | pw32* | cegcc*) if test yes != "$GCC"; then reload_cmds=false fi @@ -5809,7 +5810,7 @@ cygwin*) lt_cv_deplibs_check_method=pass_all # SDL customization ;; -mingw* | pw32*) +mingw* | windows* | pw32*) # Base MSYS/MinGW do not provide the 'file' command needed by # func_win32_libid shell function, so use a weaker test based on 'objdump', # unless we find 'file', for example because we are cross-compiling. @@ -5977,7 +5978,7 @@ file_magic_glob= want_nocaseglob=no if test "$build" = "$host"; then case $host_os in - mingw* | pw32*) + mingw* | windows* | pw32*) if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then want_nocaseglob=yes else @@ -6131,7 +6132,7 @@ else $as_nop lt_cv_sharedlib_from_linklib_cmd='unknown' case $host_os in -cygwin* | mingw* | pw32* | cegcc*) +cygwin* | mingw* | windows* | pw32* | cegcc*) # two different shell functions defined in ltmain.sh; # decide which one to use based on capabilities of $DLLTOOL case `$DLLTOOL --help 2>&1` in @@ -6569,15 +6570,8 @@ old_postinstall_cmds='chmod 644 $oldlib' old_postuninstall_cmds= if test -n "$RANLIB"; then - case $host_os in - bitrig* | openbsd*) - old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" - ;; - *) - old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" - ;; - esac old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib" + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" fi case $host_os in @@ -6704,7 +6698,7 @@ case $host_os in aix*) symcode='[BCDT]' ;; -cygwin* | mingw* | pw32* | cegcc*) +cygwin* | mingw* | windows* | pw32* | cegcc*) symcode='[ABCDGISTW]' ;; hpux*) @@ -6783,7 +6777,7 @@ $lt_c_name_lib_hook\ # Handle CRLF in mingw tool chain opt_cr= case $build_os in -mingw*) +mingw* | windows*) opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp ;; esac @@ -6798,7 +6792,7 @@ for ac_symprfx in "" "_"; do if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Fake it for dumpbin and say T for any non-static function, # D for any global variable and I for any imported variable. - # Also find C++ and __fastcall symbols from MSVC++, + # Also find C++ and __fastcall symbols from MSVC++ or ICC, # which start with @ or ?. lt_cv_sys_global_symbol_pipe="$AWK '"\ " {last_section=section; section=\$ 3};"\ @@ -7232,7 +7226,7 @@ mips64*-*linux*) ;; x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ -s390*-*linux*|s390*-*tpf*|sparc*-*linux*) +s390*-*linux*|s390*-*tpf*|sparc*-*linux*|x86_64-gnu*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. Note that the listed cases only cover the # situations where additional linker options are needed (such as when @@ -7251,7 +7245,7 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_i386_fbsd" ;; - x86_64-*linux*) + x86_64-*linux*|x86_64-gnu*) case `/usr/bin/file conftest.o` in *x86-64*) LD="${LD-ld} -m elf32_x86_64" @@ -7280,7 +7274,7 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_x86_64_fbsd" ;; - x86_64-*linux*) + x86_64-*linux*|x86_64-gnu*) LD="${LD-ld} -m elf_x86_64" ;; powerpcle-*linux*|powerpc64le-*linux*) @@ -8276,7 +8270,7 @@ fi enable_win32_dll=yes case $host in -*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*) +*-*-cygwin* | *-*-mingw* | *-*-windows* | *-*-pw32* | *-*-cegcc*) if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}as", so it can be a program name with args. set dummy ${ac_tool_prefix}as; ac_word=$2 @@ -8892,8 +8886,8 @@ esac ofile=libtool can_build_shared=yes -# All known linkers require a '.a' archive for static linking (except MSVC, -# which needs '.lib'). +# All known linkers require a '.a' archive for static linking (except MSVC and +# ICC, which need '.lib'). libext=a with_gnu_ld=$lt_cv_prog_gnu_ld @@ -9217,7 +9211,7 @@ lt_prog_compiler_static= # PIC is the default for these OSes. ;; - mingw* | cygwin* | pw32* | os2* | cegcc*) + mingw* | windows* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style @@ -9320,7 +9314,7 @@ lt_prog_compiler_static= esac ;; - mingw* | cygwin* | pw32* | os2* | cegcc*) + mingw* | windows* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic='-DDLL_EXPORT' @@ -9827,16 +9821,16 @@ printf %s "checking whether the $compiler linker ($LD) supports shared libraries extract_expsyms_cmds= case $host_os in - cygwin* | mingw* | pw32* | cegcc*) - # FIXME: the MSVC++ port hasn't been tested in a loooong time + cygwin* | mingw* | windows* | pw32* | cegcc*) + # FIXME: the MSVC++ and ICC port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. + # Microsoft Visual C++ or Intel C++ Compiler. if test yes != "$GCC"; then with_gnu_ld=no fi ;; interix*) - # we just hope/assume this is gcc and not c89 (= MSVC++) + # we just hope/assume this is gcc and not c89 (= MSVC++ or ICC) with_gnu_ld=yes ;; openbsd* | bitrig*) @@ -9942,7 +9936,7 @@ _LT_EOF fi ;; - cygwin* | mingw* | pw32* | cegcc*) + cygwin* | mingw* | windows* | pw32* | cegcc*) # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, # as there is no search path for DLLs. hardcode_libdir_flag_spec='-L$libdir' @@ -10487,14 +10481,14 @@ fi export_dynamic_flag_spec=-rdynamic ;; - cygwin* | mingw* | pw32* | cegcc*) + cygwin* | mingw* | windows* | pw32* | cegcc*) # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. + # Microsoft Visual C++ or Intel C++ Compiler. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. case $cc_basename in - cl*) - # Native MSVC + cl* | icl*) + # Native MSVC or ICC hardcode_libdir_flag_spec=' ' allow_undefined_flag=unsupported always_export_symbols=yes @@ -10504,14 +10498,14 @@ fi # Tell ltmain to make .dll files, not .so files. shrext_cmds=.dll # FIXME: Setting linknames here is a bad hack. - archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames=' + archive_cmds='$CC -Fe $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames=' archive_expsym_cmds='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; then cp "$export_symbols" "$output_objdir/$soname.def"; echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp"; else $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp; fi~ - $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ + $CC -Fe $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, )='true' @@ -10535,7 +10529,7 @@ fi fi' ;; *) - # Assume MSVC wrapper + # Assume MSVC and ICC wrapper hardcode_libdir_flag_spec=' ' allow_undefined_flag=unsupported # Tell ltmain to make .lib files, not .a files. @@ -11301,7 +11295,7 @@ if test yes = "$GCC"; then *) lt_awk_arg='/^libraries:/' ;; esac case $host_os in - mingw* | cegcc*) lt_sed_strip_eq='s|=\([A-Za-z]:\)|\1|g' ;; + mingw* | windows* | cegcc*) lt_sed_strip_eq='s|=\([A-Za-z]:\)|\1|g' ;; *) lt_sed_strip_eq='s|=/|/|g' ;; esac lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` @@ -11359,7 +11353,7 @@ BEGIN {RS = " "; FS = "/|\n";} { # AWK program above erroneously prepends '/' to C:/dos/paths # for these hosts. case $host_os in - mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ + mingw* | windows* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ $SED 's|/\([A-Za-z]:\)|\1|g'` ;; esac sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` @@ -11527,7 +11521,7 @@ bsdi[45]*) # libtool to hard-code these into programs ;; -cygwin* | mingw* | pw32* | cegcc*) +cygwin* | mingw* | windows* | pw32* | cegcc*) version_type=windows shrext_cmds=.dll need_version=no @@ -11560,7 +11554,7 @@ cygwin* | mingw* | pw32* | cegcc*) sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api" ;; - mingw* | cegcc*) + mingw* | windows* | cegcc*) # MinGW DLLs use traditional 'lib' prefix #soname_spec='$libname`echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext' soname_spec='`echo $libname | $SED -e 's/^lib//'`$shared_ext' # SDL customization @@ -11573,14 +11567,14 @@ cygwin* | mingw* | pw32* | cegcc*) dynamic_linker='Win32 ld.exe' ;; - *,cl*) - # Native MSVC + *,cl* | *,icl*) + # Native MSVC or ICC libname_spec='$name' soname_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' library_names_spec='$libname.dll.lib' case $build_os in - mingw*) + mingw* | windows*) sys_lib_search_path_spec= lt_save_ifs=$IFS IFS=';' @@ -11630,7 +11624,7 @@ cygwin* | mingw* | pw32* | cegcc*) ;; *) - # Assume MSVC wrapper + # Assume MSVC and ICC wrapper library_names_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext $libname.lib' dynamic_linker='Win32 ld.exe' ;; @@ -12300,7 +12294,7 @@ else lt_cv_dlopen_self=yes ;; - mingw* | pw32* | cegcc*) + mingw* | windows* | pw32* | cegcc*) lt_cv_dlopen=LoadLibrary lt_cv_dlopen_libs= ;; @@ -14576,7 +14570,7 @@ if test yes = "$GCC"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 printf %s "checking for ld used by $CC... " >&6; } case $host in - *-*-mingw*) + *-*-mingw* | *-*-windows*) # gcc leaves a trailing carriage return, which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) @@ -14710,7 +14704,7 @@ with_gnu_ld=$lt_cv_prog_gnu_ld # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "[-]L"' else GXX=no @@ -15008,10 +15002,10 @@ fi esac ;; - cygwin* | mingw* | pw32* | cegcc*) + cygwin* | mingw* | windows* | pw32* | cegcc*) case $GXX,$cc_basename in - ,cl* | no,cl*) - # Native MSVC + ,cl* | no,cl* | ,icl* | no,icl*) + # Native MSVC or ICC # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. hardcode_libdir_flag_spec_CXX=' ' @@ -15207,7 +15201,7 @@ fi # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "[-]L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test yes = "$GXX"; then @@ -15272,7 +15266,7 @@ fi # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "[-]L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test yes = "$GXX"; then @@ -15611,7 +15605,7 @@ fi # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "[-]L"' else # FIXME: insert proper C++ library support @@ -15695,7 +15689,7 @@ fi # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "[-]L"' else # g++ 2.7 appears to require '-G' NOT '-shared' on this # platform. @@ -15706,7 +15700,7 @@ fi # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. - output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' + output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "[-]L"' fi hardcode_libdir_flag_spec_CXX='$wl-R $wl$libdir' @@ -16020,7 +16014,7 @@ lt_prog_compiler_static_CXX= beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; - mingw* | cygwin* | os2* | pw32* | cegcc*) + mingw* | windows* | cygwin* | os2* | pw32* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style @@ -16095,7 +16089,7 @@ lt_prog_compiler_static_CXX= ;; esac ;; - mingw* | cygwin* | os2* | pw32* | cegcc*) + mingw* | windows* | cygwin* | os2* | pw32* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic_CXX='-DDLL_EXPORT' @@ -16589,9 +16583,9 @@ printf %s "checking whether the $compiler linker ($LD) supports shared libraries pw32*) export_symbols_cmds_CXX=$ltdll_cmds ;; - cygwin* | mingw* | cegcc*) + cygwin* | mingw* | windows* | cegcc*) case $cc_basename in - cl*) + cl* | icl*) exclude_expsyms_CXX='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' ;; *) @@ -16911,7 +16905,7 @@ bsdi[45]*) # libtool to hard-code these into programs ;; -cygwin* | mingw* | pw32* | cegcc*) +cygwin* | mingw* | windows* | pw32* | cegcc*) version_type=windows shrext_cmds=.dll need_version=no @@ -16943,7 +16937,7 @@ cygwin* | mingw* | pw32* | cegcc*) soname_spec='`echo $libname | sed -e 's/^lib//'`$shared_ext' # SDL customization ;; - mingw* | cegcc*) + mingw* | windows* | cegcc*) # MinGW DLLs use traditional 'lib' prefix #soname_spec='$libname`echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext' soname_spec='`echo $libname | $SED -e 's/^lib//'`$shared_ext' # SDL customization @@ -16956,14 +16950,14 @@ cygwin* | mingw* | pw32* | cegcc*) dynamic_linker='Win32 ld.exe' ;; - *,cl*) - # Native MSVC + *,cl* | *,icl*) + # Native MSVC or ICC libname_spec='$name' soname_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' library_names_spec='$libname.dll.lib' case $build_os in - mingw*) + mingw* | windows*) sys_lib_search_path_spec= lt_save_ifs=$IFS IFS=';' @@ -17013,7 +17007,7 @@ cygwin* | mingw* | pw32* | cegcc*) ;; *) - # Assume MSVC wrapper + # Assume MSVC and ICC wrapper library_names_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext $libname.lib' dynamic_linker='Win32 ld.exe' ;; @@ -18820,12 +18814,26 @@ else $as_nop fi +enable_system_iconv_default=yes +case "$host" in + *-*-cygwin*|*-*-mingw*|*-*-darwin*|*-ios-*) + enable_system_iconv_default=no + ;; +esac # Check whether --enable-system-iconv was given. if test ${enable_system_iconv+y} then : enableval=$enable_system_iconv; else $as_nop - enable_system_iconv=yes + enable_system_iconv=$enable_system_iconv_default +fi + +# Check whether --enable-libiconv was given. +if test ${enable_libiconv+y} +then : + enableval=$enable_libiconv; +else $as_nop + enable_libiconv=no fi @@ -18942,12 +18950,6 @@ if test "x$ac_cv_header_signal_h" = xyes then : printf "%s\n" "#define HAVE_SIGNAL_H 1" >>confdefs.h -fi -ac_fn_c_check_header_compile "$LINENO" "linux/input.h" "ac_cv_header_linux_input_h" "$ac_includes_default" -if test "x$ac_cv_header_linux_input_h" = xyes -then : - printf "%s\n" "#define HAVE_LINUX_INPUT_H 1" >>confdefs.h - fi @@ -19745,6 +19747,18 @@ if test "x$ac_cv_func_poll" = xyes then : printf "%s\n" "#define HAVE_POLL 1" >>confdefs.h +fi +ac_fn_c_check_func "$LINENO" "memfd_create" "ac_cv_func_memfd_create" +if test "x$ac_cv_func_memfd_create" = xyes +then : + printf "%s\n" "#define HAVE_MEMFD_CREATE 1" >>confdefs.h + +fi +ac_fn_c_check_func "$LINENO" "posix_fallocate" "ac_cv_func_posix_fallocate" +if test "x$ac_cv_func_posix_fallocate" = xyes +then : + printf "%s\n" "#define HAVE_POSIX_FALLOCATE 1" >>confdefs.h + fi ac_fn_c_check_func "$LINENO" "_Exit" "ac_cv_func__Exit" if test "x$ac_cv_func__Exit" = xyes @@ -20049,53 +20063,90 @@ fi if test x$enable_system_iconv = xyes; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for iconv_open in -liconv" >&5 -printf %s "checking for iconv_open in -liconv... " >&6; } -if test ${ac_cv_lib_iconv_iconv_open+y} -then : - printf %s "(cached) " >&6 -else $as_nop - ac_check_lib_save_LIBS=$LIBS -LIBS="-liconv $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for iconv in libc" >&5 +printf %s "checking for iconv in libc... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -char iconv_open (); + #define LIBICONV_PLUG 1 /* in case libiconv header is in include path */ + #include + #include + int main (void) { -return iconv_open (); + + iconv_open(NULL,NULL); + ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO" then : - ac_cv_lib_iconv_iconv_open=yes + have_libc_iconv=yes else $as_nop - ac_cv_lib_iconv_iconv_open=no + have_libc_iconv=no fi rm -f core conftest.err conftest.$ac_objext conftest.beam \ conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_iconv_iconv_open" >&5 -printf "%s\n" "$ac_cv_lib_iconv_iconv_open" >&6; } -if test "x$ac_cv_lib_iconv_iconv_open" = xyes + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_libc_iconv" >&5 +printf "%s\n" "$have_libc_iconv" >&6; } + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for iconv in libiconv" >&5 +printf %s "checking for iconv in libiconv... " >&6; } + save_LIBS="$LIBS" + LIBS="$LIBS -liconv" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #include + #include + +int +main (void) +{ + + iconv_open(NULL,NULL); + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" then : - LIBS="$LIBS -liconv"; EXTRA_LDFLAGS="$EXTRA_LDFLAGS -liconv" + have_libiconv=yes +else $as_nop + have_libiconv=no fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + LIBS="$save_LIBS" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_libiconv" >&5 +printf "%s\n" "$have_libiconv" >&6; } - ac_fn_c_check_func "$LINENO" "iconv" "ac_cv_func_iconv" -if test "x$ac_cv_func_iconv" = xyes -then : - printf "%s\n" "#define HAVE_ICONV 1" >>confdefs.h + if test x$have_libc_iconv = xyes || test x$have_libiconv = xyes; then + +printf "%s\n" "#define HAVE_ICONV 1" >>confdefs.h -fi + if test x$have_libiconv = xyes; then + if test x$have_libc_iconv != xyes; then + use_libiconv=yes + elif test x$enable_libiconv = xyes; then + use_libiconv=yes + fi + fi + if test x$use_libiconv = xyes; then + +printf "%s\n" "#define SDL_USE_LIBICONV 1" >>confdefs.h + + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -liconv" + echo "-- Using iconv from libiconv" + else + echo "-- Using iconv from libc" + fi + fi fi ac_fn_c_check_member "$LINENO" "struct sigaction" "sa_sigaction" "ac_cv_member_struct_sigaction_sa_sigaction" "#include @@ -21059,80 +21110,6 @@ printf "%s\n" "#define HAVE_LSXINTRIN_H 1" >>confdefs.h fi - # Check whether --enable-lasx was given. -if test ${enable_lasx+y} -then : - enableval=$enable_lasx; -else $as_nop - enable_LASX=yes -fi - - if test x$enable_LASX = xyes; then - save_CFLAGS="$CFLAGS" - have_gcc_lasx=no - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GCC -mlasx option" >&5 -printf %s "checking for GCC -mlasx option... " >&6; } - lasx_CFLAGS="-mlasx" - CFLAGS="$save_CFLAGS $lasx_CFLAGS" - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - #ifndef __loongarch_asx - #error Assembler CPP flag not enabled - #endif - -int -main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - have_gcc_lasx=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_gcc_lasx" >&5 -printf "%s\n" "$have_gcc_lasx" >&6; } - CFLAGS="$save_CFLAGS" - - if test x$have_gcc_lasx = xyes; then - EXTRA_CFLAGS="$EXTRA_CFLAGS $lasx_CFLAGS" - SUMMARY_math="${SUMMARY_math} lasx" - fi - fi - - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for lasxintrin.h" >&5 -printf %s "checking for lasxintrin.h... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -int -main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - have_lasxintrin_h_hdr=yes -else $as_nop - have_lasxintrin_h_hdr=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_lasxintrin_h_hdr" >&5 -printf "%s\n" "$have_lasxintrin_h_hdr" >&6; } - if test x$have_lasxintrin_h_hdr = xyes; then - -printf "%s\n" "#define HAVE_LASXINTRIN_H 1" >>confdefs.h - - fi - CheckOSS() { # Check whether --enable-oss was given. @@ -22083,19 +22060,19 @@ fi if test x$enable_audio = xyes -a x$enable_pulseaudio = xyes; then pkg_failed=no -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for libpulse-simple >= 0.9" >&5 -printf %s "checking for libpulse-simple >= 0.9... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for libpulse >= 0.9.15" >&5 +printf %s "checking for libpulse >= 0.9.15... " >&6; } if test -n "$PULSEAUDIO_CFLAGS"; then pkg_cv_PULSEAUDIO_CFLAGS="$PULSEAUDIO_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libpulse-simple >= 0.9\""; } >&5 - ($PKG_CONFIG --exists --print-errors "libpulse-simple >= 0.9") 2>&5 + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libpulse >= 0.9.15\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libpulse >= 0.9.15") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - pkg_cv_PULSEAUDIO_CFLAGS=`$PKG_CONFIG --cflags "libpulse-simple >= 0.9" 2>/dev/null` + pkg_cv_PULSEAUDIO_CFLAGS=`$PKG_CONFIG --cflags "libpulse >= 0.9.15" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes @@ -22107,12 +22084,12 @@ if test -n "$PULSEAUDIO_LIBS"; then pkg_cv_PULSEAUDIO_LIBS="$PULSEAUDIO_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libpulse-simple >= 0.9\""; } >&5 - ($PKG_CONFIG --exists --print-errors "libpulse-simple >= 0.9") 2>&5 + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libpulse >= 0.9.15\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libpulse >= 0.9.15") 2>&5 ac_status=$? printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then - pkg_cv_PULSEAUDIO_LIBS=`$PKG_CONFIG --libs "libpulse-simple >= 0.9" 2>/dev/null` + pkg_cv_PULSEAUDIO_LIBS=`$PKG_CONFIG --libs "libpulse >= 0.9.15" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes @@ -22133,9 +22110,9 @@ else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then - PULSEAUDIO_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libpulse-simple >= 0.9" 2>&1` + PULSEAUDIO_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libpulse >= 0.9.15" 2>&1` else - PULSEAUDIO_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libpulse-simple >= 0.9" 2>&1` + PULSEAUDIO_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libpulse >= 0.9.15" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$PULSEAUDIO_PKG_ERRORS" >&5 @@ -22162,7 +22139,7 @@ else $as_nop enable_pulseaudio_shared=yes fi - pulseaudio_lib=`find_lib "libpulse-simple.so.*" "$PULSEAUDIO_LIBS" | sed 's/.*\/\(.*\)/\1/; q'` + pulseaudio_lib=`find_lib "libpulse.so.*" "$PULSEAUDIO_LIBS" | sed 's/.*\/\(.*\)/\1/; q'` printf "%s\n" "#define SDL_AUDIO_DRIVER_PULSEAUDIO 1" >>confdefs.h @@ -22176,7 +22153,7 @@ printf "%s\n" "$as_me: WARNING: You must have SDL_LoadObject() support for dynam fi if test x$have_loadso = xyes && \ test x$enable_pulseaudio_shared = xyes && test x$pulseaudio_lib != x; then - echo "-- dynamic libpulse-simple -> $pulseaudio_lib" + echo "-- dynamic libpulse -> $pulseaudio_lib" printf "%s\n" "#define SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC \"$pulseaudio_lib\"" >>confdefs.h @@ -26405,6 +26382,14 @@ printf "%s\n" "#define SDL_VIDEO_VULKAN 1" >>confdefs.h CheckInputEvents() { + ac_fn_c_check_header_compile "$LINENO" "linux/input.h" "ac_cv_header_linux_input_h" "$ac_includes_default" +if test "x$ac_cv_header_linux_input_h" = xyes +then : + printf "%s\n" "#define HAVE_LINUX_INPUT_H 1" >>confdefs.h + +fi + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for Linux 2.4 unified input interface" >&5 printf %s "checking for Linux 2.4 unified input interface... " >&6; } use_input_events=no @@ -27528,18 +27513,14 @@ then : have_d3d11=yes fi - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for d3d12 Windows SDK version" >&5 -printf %s "checking for d3d12 Windows SDK version... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for compatible d3d12 headers" >&5 +printf %s "checking for compatible d3d12 headers... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#include -#include #include +#include ID3D12Device1 *device; -#if WDK_NTDDI_VERSION <= 0x0A000008 -asdf -#endif int main (void) @@ -27558,6 +27539,7 @@ fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_d3d12" >&5 printf "%s\n" "$have_d3d12" >&6; } + ac_fn_c_check_header_compile "$LINENO" "ddraw.h" "ac_cv_header_ddraw_h" "$ac_includes_default" if test "x$ac_cv_header_ddraw_h" = xyes then : @@ -27622,77 +27604,16 @@ else $as_nop fi if test x$enable_xinput = xyes; then - have_xinput_gamepadex=no - have_xinput_stateex=no ac_fn_c_check_header_compile "$LINENO" "xinput.h" "ac_cv_header_xinput_h" "$ac_includes_default" if test "x$ac_cv_header_xinput_h" = xyes then : have_xinput=yes fi - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for struct XINPUT_GAMEPAD_EX" >&5 -printf %s "checking for struct XINPUT_GAMEPAD_EX... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include -#include -XINPUT_GAMEPAD_EX x1; - -int -main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - have_xinput_gamepadex=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_xinput_gamepadex" >&5 -printf "%s\n" "$have_xinput_gamepadex" >&6; } - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for struct XINPUT_STATE_EX" >&5 -printf %s "checking for struct XINPUT_STATE_EX... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#include -#include -XINPUT_STATE_EX s1; - -int -main (void) -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO" -then : - have_xinput_stateex=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $have_xinput_stateex" >&5 -printf "%s\n" "$have_xinput_stateex" >&6; } - if test x$have_xinput = xyes; then printf "%s\n" "#define HAVE_XINPUT_H 1" >>confdefs.h - fi - if test x$have_xinput_gamepadex = xyes; then - -printf "%s\n" "#define HAVE_XINPUT_GAMEPAD_EX 1" >>confdefs.h - - fi - if test x$have_xinput_stateex = xyes; then - -printf "%s\n" "#define HAVE_XINPUT_STATE_EX 1" >>confdefs.h - fi fi diff --git a/thirdparty/SDL/configure.ac b/thirdparty/SDL/configure.ac index 558895859..7be3b5c3f 100644 --- a/thirdparty/SDL/configure.ac +++ b/thirdparty/SDL/configure.ac @@ -1,5 +1,5 @@ dnl Process this file with autoconf to produce a configure script. -AC_PREREQ([2.63]) +AC_PREREQ([2.65]) AC_INIT AC_CONFIG_SRCDIR([src/SDL.c]) AC_CONFIG_HEADERS([include/SDL_config.h]) @@ -12,8 +12,8 @@ orig_CFLAGS="$CFLAGS" dnl Set various version strings - taken gratefully from the GTk sources # See docs/release_checklist.md SDL_MAJOR_VERSION=2 -SDL_MINOR_VERSION=28 -SDL_MICRO_VERSION=5 +SDL_MINOR_VERSION=30 +SDL_MICRO_VERSION=7 SDL_VERSION=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION.$SDL_MICRO_VERSION SDL_BINARY_AGE=`expr $SDL_MINOR_VERSION \* 100 + $SDL_MICRO_VERSION` @@ -319,10 +319,20 @@ AC_ARG_ENABLE(libc, [AS_HELP_STRING([--enable-libc], [Use the system C library [default=yes]])], , enable_libc=yes) -dnl See whether we are allowed to use libiconv +dnl See whether we are allowed to use system iconv +enable_system_iconv_default=yes +case "$host" in + *-*-cygwin*|*-*-mingw*|*-*-darwin*|*-ios-*) + enable_system_iconv_default=no + ;; +esac AC_ARG_ENABLE(system-iconv, -[AS_HELP_STRING([--enable-system-iconv], [Use iconv() from system-installed libraries [default=yes]])], - , enable_system_iconv=yes) +[AS_HELP_STRING([--enable-system-iconv], [Use iconv() from system-installed libraries [default=no for windows, yes for others]])], + , enable_system_iconv=$enable_system_iconv_default) +dnl See whether we prefer libiconv over libc +AC_ARG_ENABLE(libiconv, +[AS_HELP_STRING([--enable-libiconv], [Prefer iconv() from libiconv, if available, over libc version [default=no]])], + , enable_libiconv=no) if test x$enable_libc = xyes; then AC_DEFINE(HAVE_LIBC, 1, [ ]) @@ -330,7 +340,7 @@ if test x$enable_libc = xyes; then dnl Check for C library headers dnl AC_CHECK_INCLUDES_DEFAULT is an autoconf-2.7x thing where AC_HEADER_STDC is deprecated. m4_ifdef([AC_CHECK_INCLUDES_DEFAULT], [AC_CHECK_INCLUDES_DEFAULT], [AC_HEADER_STDC]) - AC_CHECK_HEADERS(sys/types.h stdio.h stdlib.h stddef.h stdarg.h malloc.h memory.h string.h strings.h wchar.h inttypes.h stdint.h limits.h ctype.h math.h float.h iconv.h signal.h linux/input.h) + AC_CHECK_HEADERS(sys/types.h stdio.h stdlib.h stddef.h stdarg.h malloc.h memory.h string.h strings.h wchar.h inttypes.h stdint.h limits.h ctype.h math.h float.h iconv.h signal.h) dnl Check for typedefs, structures, etc. AC_TYPE_SIZE_T @@ -349,14 +359,52 @@ dnl Checks for library functions. AC_DEFINE(HAVE_MPROTECT, 1, [ ]) ],[]), ) - AC_CHECK_FUNCS(malloc calloc realloc free getenv setenv putenv unsetenv bsearch qsort abs bcopy memset memcmp memcpy memmove wcslen wcslcpy wcslcat _wcsdup wcsdup wcsstr wcscmp wcsncmp wcscasecmp _wcsicmp wcsncasecmp _wcsnicmp strlen strlcpy strlcat _strrev _strupr _strlwr index rindex strchr strrchr strstr strtok_r itoa _ltoa _uitoa _ultoa strtod strtol strtoul _i64toa _ui64toa strtoll strtoull atoi atof strcmp strncmp _stricmp strcasecmp _strnicmp strncasecmp strcasestr vsscanf vsnprintf fopen64 fseeko fseeko64 sigaction setjmp nanosleep sysconf sysctlbyname getauxval elf_aux_info poll _Exit) + AC_CHECK_FUNCS(malloc calloc realloc free getenv setenv putenv unsetenv bsearch qsort abs bcopy memset memcmp memcpy memmove wcslen wcslcpy wcslcat _wcsdup wcsdup wcsstr wcscmp wcsncmp wcscasecmp _wcsicmp wcsncasecmp _wcsnicmp strlen strlcpy strlcat _strrev _strupr _strlwr index rindex strchr strrchr strstr strtok_r itoa _ltoa _uitoa _ultoa strtod strtol strtoul _i64toa _ui64toa strtoll strtoull atoi atof strcmp strncmp _stricmp strcasecmp _strnicmp strncasecmp strcasestr vsscanf vsnprintf fopen64 fseeko fseeko64 sigaction setjmp nanosleep sysconf sysctlbyname getauxval elf_aux_info poll memfd_create posix_fallocate _Exit) AC_CHECK_LIB(m, pow, [LIBS="$LIBS -lm"; EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm"]) AC_CHECK_FUNCS(acos acosf asin asinf atan atanf atan2 atan2f ceil ceilf copysign copysignf cos cosf exp expf fabs fabsf floor floorf trunc truncf fmod fmodf log logf log10 log10f lround lroundf pow powf round roundf scalbn scalbnf sin sinf sqrt sqrtf tan tanf) if test x$enable_system_iconv = xyes; then - AC_CHECK_LIB(iconv, iconv_open, [LIBS="$LIBS -liconv"; EXTRA_LDFLAGS="$EXTRA_LDFLAGS -liconv"]) - AC_CHECK_FUNCS(iconv) + AC_MSG_CHECKING(for iconv in libc) + AC_LINK_IFELSE([AC_LANG_PROGRAM([[ + #define LIBICONV_PLUG 1 /* in case libiconv header is in include path */ + #include + #include + ]],[[ + iconv_open(NULL,NULL); + ]])], [have_libc_iconv=yes],[have_libc_iconv=no]) + AC_MSG_RESULT($have_libc_iconv) + + AC_MSG_CHECKING(for iconv in libiconv) + save_LIBS="$LIBS" + LIBS="$LIBS -liconv" + AC_LINK_IFELSE([AC_LANG_PROGRAM([[ + #include + #include + ]],[[ + iconv_open(NULL,NULL); + ]])], [have_libiconv=yes],[have_libiconv=no]) + LIBS="$save_LIBS" + AC_MSG_RESULT($have_libiconv) + + if test x$have_libc_iconv = xyes || test x$have_libiconv = xyes; then + AC_DEFINE(HAVE_ICONV,1,[ ]) + + if test x$have_libiconv = xyes; then + if test x$have_libc_iconv != xyes; then + use_libiconv=yes + elif test x$enable_libiconv = xyes; then + use_libiconv=yes + fi + fi + if test x$use_libiconv = xyes; then + AC_DEFINE(SDL_USE_LIBICONV,1,[ ]) + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -liconv" + echo "-- Using iconv from libiconv" + else + echo "-- Using iconv from libc" + fi + fi fi AC_CHECK_MEMBER(struct sigaction.sa_sigaction,[AC_DEFINE([HAVE_SA_SIGACTION], 1, [ ])], ,[#include ]) @@ -890,38 +938,6 @@ fi AC_DEFINE(HAVE_LSXINTRIN_H, 1, [ ]) fi - AC_ARG_ENABLE(lasx, -[AS_HELP_STRING([--enable-lasx], [use LASX assembly routines [default=yes]])], - , enable_LASX=yes) - if test x$enable_LASX = xyes; then - save_CFLAGS="$CFLAGS" - have_gcc_lasx=no - AC_MSG_CHECKING(for GCC -mlasx option) - lasx_CFLAGS="-mlasx" - CFLAGS="$save_CFLAGS $lasx_CFLAGS" - - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ - #ifndef __loongarch_asx - #error Assembler CPP flag not enabled - #endif - ]], [])], [have_gcc_lasx=yes], []) - AC_MSG_RESULT($have_gcc_lasx) - CFLAGS="$save_CFLAGS" - - if test x$have_gcc_lasx = xyes; then - EXTRA_CFLAGS="$EXTRA_CFLAGS $lasx_CFLAGS" - SUMMARY_math="${SUMMARY_math} lasx" - fi - fi - - AC_MSG_CHECKING(for lasxintrin.h) - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]])], - [have_lasxintrin_h_hdr=yes],[have_lasxintrin_h_hdr=no]) - AC_MSG_RESULT($have_lasxintrin_h_hdr) - if test x$have_lasxintrin_h_hdr = xyes; then - AC_DEFINE(HAVE_LASXINTRIN_H, 1, [ ]) - fi - dnl See if the OSS audio interface is supported CheckOSS() { @@ -1122,13 +1138,13 @@ CheckPulseAudio() [AS_HELP_STRING([--enable-pulseaudio], [use PulseAudio [default=yes]])], , enable_pulseaudio=yes) if test x$enable_audio = xyes -a x$enable_pulseaudio = xyes; then - PKG_CHECK_MODULES([PULSEAUDIO], [libpulse-simple >= 0.9], audio_pulseaudio=yes, audio_pulseaudio=no) + PKG_CHECK_MODULES([PULSEAUDIO], [libpulse >= 0.9.15], audio_pulseaudio=yes, audio_pulseaudio=no) if test x$audio_pulseaudio = xyes; then AC_ARG_ENABLE(pulseaudio-shared, [AS_HELP_STRING([--enable-pulseaudio-shared], [dynamically load PulseAudio support [default=yes]])], , enable_pulseaudio_shared=yes) - pulseaudio_lib=[`find_lib "libpulse-simple.so.*" "$PULSEAUDIO_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`] + pulseaudio_lib=[`find_lib "libpulse.so.*" "$PULSEAUDIO_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`] AC_DEFINE(SDL_AUDIO_DRIVER_PULSEAUDIO, 1, [ ]) SOURCES="$SOURCES $srcdir/src/audio/pulseaudio/*.c" @@ -1139,7 +1155,7 @@ CheckPulseAudio() fi if test x$have_loadso = xyes && \ test x$enable_pulseaudio_shared = xyes && test x$pulseaudio_lib != x; then - echo "-- dynamic libpulse-simple -> $pulseaudio_lib" + echo "-- dynamic libpulse -> $pulseaudio_lib" AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC, "$pulseaudio_lib", [ ]) SUMMARY_audio="${SUMMARY_audio} pulse(dynamic)" @@ -2758,6 +2774,8 @@ dnl See if we can use the new unified event interface in Linux 2.4 CheckInputEvents() { dnl Check for Linux 2.4 unified input event interface support + AC_CHECK_HEADERS(linux/input.h) + AC_MSG_CHECKING(for Linux 2.4 unified input interface) use_input_events=no AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ @@ -3325,17 +3343,14 @@ CheckDIRECTX() if test x$enable_directx = xyes; then AC_CHECK_HEADER(d3d9.h, have_d3d=yes) AC_CHECK_HEADER(d3d11_1.h, have_d3d11=yes) - AC_MSG_CHECKING(for d3d12 Windows SDK version) + AC_MSG_CHECKING(for compatible d3d12 headers) AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ -#include -#include #include +#include ID3D12Device1 *device; -#if WDK_NTDDI_VERSION <= 0x0A000008 -asdf -#endif ]])], [have_d3d12=yes],[have_d3d12=no]) AC_MSG_RESULT($have_d3d12) + AC_CHECK_HEADER(ddraw.h, have_ddraw=yes) AC_CHECK_HEADER(dsound.h, have_dsound=yes) AC_CHECK_HEADER(dinput.h, have_dinput=yes) @@ -3367,33 +3382,10 @@ asdf [AS_HELP_STRING([--enable-xinput], [use Xinput for Windows [default=yes]])], , enable_xinput=yes) if test x$enable_xinput = xyes; then - have_xinput_gamepadex=no - have_xinput_stateex=no AC_CHECK_HEADER(xinput.h, have_xinput=yes) - AC_MSG_CHECKING(for struct XINPUT_GAMEPAD_EX) - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ -#include -#include -XINPUT_GAMEPAD_EX x1; - ]],[])], [have_xinput_gamepadex=yes],[]) - AC_MSG_RESULT($have_xinput_gamepadex) - AC_MSG_CHECKING(for struct XINPUT_STATE_EX) - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ -#include -#include -XINPUT_STATE_EX s1; - ]],[])], [have_xinput_stateex=yes],[]) - AC_MSG_RESULT($have_xinput_stateex) - if test x$have_xinput = xyes; then AC_DEFINE(HAVE_XINPUT_H, 1, [ ]) fi - if test x$have_xinput_gamepadex = xyes; then - AC_DEFINE(HAVE_XINPUT_GAMEPAD_EX, 1, [ ]) - fi - if test x$have_xinput_stateex = xyes; then - AC_DEFINE(HAVE_XINPUT_STATE_EX, 1, [ ]) - fi fi AC_MSG_CHECKING(for windows.gaming.input.h) diff --git a/thirdparty/SDL/docs/README-android.md b/thirdparty/SDL/docs/README-android.md index 5e25cab77..b886f06db 100644 --- a/thirdparty/SDL/docs/README-android.md +++ b/thirdparty/SDL/docs/README-android.md @@ -72,7 +72,7 @@ done in the build directory for the app! For more complex projects, follow these instructions: 1. Get the source code for SDL and copy the 'android-project' directory located at SDL/android-project to a suitable location. Also make sure to rename it to your project name (In these examples: YOURPROJECT). - + (The 'android-project' directory can basically be seen as a sort of starting point for the android-port of your project. It contains the glue code between the Android Java 'frontend' and the SDL code 'backend'. It also contains some standard behaviour, like how events should be handled, which you will be able to change.) 2. Move or [symlink](https://en.wikipedia.org/wiki/Symbolic_link) the SDL directory into the "YOURPROJECT/app/jni" directory diff --git a/thirdparty/SDL/docs/README-dynapi.md b/thirdparty/SDL/docs/README-dynapi.md index 7649c1d93..76b868ce6 100644 --- a/thirdparty/SDL/docs/README-dynapi.md +++ b/thirdparty/SDL/docs/README-dynapi.md @@ -35,7 +35,7 @@ SDL now has, internally, a table of function pointers. So, this is what SDL_Init now looks like: ```c -UInt32 SDL_Init(Uint32 flags) +Uint32 SDL_Init(Uint32 flags) { return jump_table.SDL_Init(flags); } @@ -100,7 +100,7 @@ a shared library of its own). If so, it loads that library and looks for and calls a single function: ```c -SInt32 SDL_DYNAPI_entry(Uint32 version, void *table, Uint32 tablesize); +Sint32 SDL_DYNAPI_entry(Uint32 version, void *table, Uint32 tablesize); ``` That function takes a version number (more on that in a moment), the address of diff --git a/thirdparty/SDL/docs/README-emscripten.md b/thirdparty/SDL/docs/README-emscripten.md index 147e18d8e..1a13eb1c3 100644 --- a/thirdparty/SDL/docs/README-emscripten.md +++ b/thirdparty/SDL/docs/README-emscripten.md @@ -1,27 +1,187 @@ # Emscripten -(This documentation is not very robust; we will update and expand this later.) +## The state of things -## A quick note about audio +(As of September 2023, but things move quickly and we don't update this +document often.) + +In modern times, all the browsers you probably care about (Chrome, Firefox, +Edge, and Safari, on Windows, macOS, Linux, iOS and Android), support some +reasonable base configurations: + +- WebAssembly (don't bother with asm.js any more) +- WebGL (which will look like OpenGL ES 2 or 3 to your app). +- Threads (see caveats, though!) +- Game controllers +- Autoupdating (so you can assume they have a recent version of the browser) + +All this to say we're at the point where you don't have to make a lot of +concessions to get even a fairly complex SDL-based game up and running. + + +## RTFM + +This document is a quick rundown of some high-level details. The +documentation at [emscripten.org](https://emscripten.org/) is vast +and extremely detailed for a wide variety of topics, and you should at +least skim through it at some point. + + +## Porting your app to Emscripten + +Many many things just need some simple adjustments and they'll compile +like any other C/C++ code, as long as SDL was handling the platform-specific +work for your program. + +First, you probably need this in at least one of your source files: + +```c +#ifdef __EMSCRIPTEN__ +#include +#endif +``` + +Second: assembly language code has to go. Replace it with C. You can even use +[x86 SIMD intrinsic functions in Emscripten](https://emscripten.org/docs/porting/simd.html)! + +Third: Middleware has to go. If you have a third-party library you link +against, you either need an Emscripten port of it, or the source code to it +to compile yourself, or you need to remove it. + +Fourth: You still start in a function called main(), but you need to get out of +it and into a function that gets called repeatedly, and returns quickly, +called a mainloop. + +Somewhere in your program, you probably have something that looks like a more +complicated version of this: + +```c +void main(void) +{ + initialize_the_game(); + while (game_is_still_running) { + check_for_new_input(); + think_about_stuff(); + draw_the_next_frame(); + } + deinitialize_the_game(); +} +``` + +This will not work on Emscripten, because the main thread needs to be free +to do stuff and can't sit in this loop forever. So Emscripten lets you set up +a [mainloop](https://emscripten.org/docs/porting/emscripten-runtime-environment.html#browser-main-loop). + +```c +static void mainloop(void) /* this will run often, possibly at the monitor's refresh rate */ +{ + if (!game_is_still_running) { + deinitialize_the_game(); + #ifdef __EMSCRIPTEN__ + emscripten_cancel_main_loop(); /* this should "kill" the app. */ + #else + exit(0); + #endif + } + + check_for_new_input(); + think_about_stuff(); + draw_the_next_frame(); +} + +void main(void) +{ + initialize_the_game(); + #ifdef __EMSCRIPTEN__ + emscripten_set_main_loop(mainloop, 0, 1); + #else + while (1) { mainloop(); } + #endif +} +``` + +Basically, `emscripten_set_main_loop(mainloop, 0, 1);` says "run +`mainloop` over and over until I end the program." The function will +run, and return, freeing the main thread for other tasks, and then +run again when it's time. The `1` parameter does some magic to make +your main() function end immediately; this is useful because you +don't want any shutdown code that might be sitting below this code +to actually run if main() were to continue on, since we're just +getting started. + +There's a lot of little details that are beyond the scope of this +document, but that's the biggest intial set of hurdles to porting +your app to the web. + + +## Do you need threads? + +If you plan to use threads, they work on all major browsers now. HOWEVER, +they bring with them a lot of careful considerations. Rendering _must_ +be done on the main thread. This is a general guideline for many +platforms, but a hard requirement on the web. + +Many other things also must happen on the main thread; often times SDL +and Emscripten make efforts to "proxy" work to the main thread that +must be there, but you have to be careful (and read more detailed +documentation than this for the finer points). + +Even when using threads, your main thread needs to set an Emscripten +mainloop that runs quickly and returns, or things will fail to work +correctly. + +You should definitely read [Emscripten's pthreads docs](https://emscripten.org/docs/porting/pthreads.html) +for all the finer points. Mostly SDL's thread API will work as expected, +but is built on pthreads, so it shares the same little incompatibilities +that are documented there, such as where you can use a mutex, and when +a thread will start running, etc. + + +IMPORTANT: You have to decide to either build something that uses +threads or something that doesn't; you can't have one build +that works everywhere. This is an Emscripten (or maybe WebAssembly? +Or just web browsers in general?) limitation. If you aren't using +threads, it's easier to not enable them at all, at build time. + +If you use threads, you _have to_ run from a web server that has +[COOP/COEP headers set correctly](https://web.dev/why-coop-coep/) +or your program will fail to start at all. + +If building with threads, `__EMSCRIPTEN_PTHREADS__` will be defined +for checking with the C preprocessor, so you can build something +different depending on what sort of build you're compiling. + + +## Audio + +Audio works as expected at the API level, but not exactly like other +platforms. + +You'll only see a single default audio device. Audio capture also works; +if the browser pops up a prompt to ask for permission to access the +microphone, the SDL_OpenAudioDevice call will succeed and start producing +silence at a regular interval. Once the user approves the request, real +audio data will flow. If the user denies it, the app is not informed and +will just continue to receive silence. Modern web browsers will not permit web pages to produce sound before the -user has interacted with them; this is for several reasons, not the least -of which being that no one likes when a random browser tab suddenly starts -making noise and the user has to scramble to figure out which and silence -it. - -To solve this, most browsers will refuse to let a web app use the audio -subsystem at all before the user has interacted with (clicked on) the page -in a meaningful way. SDL-based apps also have to deal with this problem; if -the user hasn't interacted with the page, SDL_OpenAudioDevice will fail. - -There are two reasonable ways to deal with this: if you are writing some -sort of media player thing, where the user expects there to be a volume -control when you mouseover the canvas, just default that control to a muted -state; if the user clicks on the control to unmute it, on this first click, -open the audio device. This allows the media to play at start, the user can -reasonably opt-in to listening, and you never get access denied to the audio -device. +user has interacted with them (clicked or tapped on them, usually); this is +for several reasons, not the least of which being that no one likes when a +random browser tab suddenly starts making noise and the user has to scramble +to figure out which and silence it. + +SDL will allow you to open the audio device for playback in this +circumstance, and your audio callback will fire, but SDL will throw the audio +data away until the user interacts with the page. This helps apps that depend +on the audio callback to make progress, and also keeps audio playback in sync +once the app is finally allowed to make noise. + +There are two reasonable ways to deal with the silence at the app level: +if you are writing some sort of media player thing, where the user expects +there to be a volume control when you mouseover the canvas, just default +that control to a muted state; if the user clicks on the control to unmute +it, on this first click, open the audio device. This allows the media to +play at start, and the user can reasonably opt-in to listening. Many games do not have this sort of UI, and are more rigid about starting audio along with everything else at the start of the process. For these, your @@ -36,41 +196,179 @@ Please see the discussion at https://github.com/libsdl-org/SDL/issues/6385 for some Javascript code to steal for this approach. +## Rendering + +If you use SDL's 2D render API, it will use GLES2 internally, which +Emscripten will turn into WebGL calls. You can also use OpenGL ES 2 +directly by creating a GL context and drawing into it. + +Calling SDL_RenderPresent (or SDL_GL_SwapWindow) will not actually +present anything on the screen until your return from your mainloop +function. + + ## Building SDL/emscripten +First: do you _really_ need to build SDL from source? + +If you aren't developing SDL itself, have a desire to mess with its source +code, or need something on the bleeding edge, don't build SDL. Just use +Emscripten's packaged version! + +Compile and link your app with `-sUSE_SDL=2` and it'll use a build of +SDL packaged with Emscripten. This comes from the same source code and +fixes the Emscripten project makes to SDL are generally merged into SDL's +revision control, so often this is much easier for app developers. + +`-sUSE_SDL=1` will select Emscripten's JavaScript reimplementation of SDL +1.2 instead; if you need SDL 1.2, this might be fine, but we generally +recommend you don't use SDL 1.2 in modern times. + + +If you want to build SDL, though... + SDL currently requires at least Emscripten 3.1.35 to build. Newer versions are likely to work, as well. Build: - $ mkdir build - $ cd build - $ emconfigure ../configure --host=asmjs-unknown-emscripten --disable-assembly --disable-threads --disable-cpuinfo CFLAGS="-O2" - $ emmake make +This works on Linux/Unix and macOS. Please send comments about Windows. + +Make sure you've [installed emsdk](https://emscripten.org/docs/getting_started/downloads.html) +first, and run `source emsdk_env.sh` at the command line so it finds the +tools. + +(These configure options might be overkill, but this has worked for me.) + +```bash +cd SDL +mkdir build +cd build +emconfigure ../configure --host=wasm32-unknown-emscripten --disable-pthreads --disable-assembly --disable-cpuinfo CFLAGS="-sUSE_SDL=0 -O3" +emmake make -j4 +``` + +If you want to build with thread support, something like this works: + +```bash +emconfigure ../configure --host=wasm32-unknown-emscripten --enable-pthreads --disable-assembly --disable-cpuinfo CFLAGS="-sUSE_SDL=0 -O3 -pthread" LDFLAGS="-pthread" +``` Or with cmake: - $ mkdir build - $ cd build - $ emcmake cmake .. - $ emmake make +```bash +mkdir build +cd build +emcmake cmake .. +emmake make -j4 +``` To build one of the tests: - $ cd test/ - $ emcc -O2 --js-opts 0 -g4 testdraw2.c -I../include ../build/.libs/libSDL2.a ../build/libSDL2_test.a -o a.html +```bash +cd test/ +emcc -O2 --js-opts 0 -g4 testdraw2.c -I../include ../build/.libs/libSDL2.a ../build/libSDL2_test.a -o a.html +``` + +## Building your app + +You need to compile with `emcc` instead of `gcc` or `clang` or whatever, but +mostly it uses the same command line arguments as Clang. + +Link against the SDL/build/.libs/libSDL2.a file you generated by building SDL, +link with `-sUSE_SDL=2` to use Emscripten's prepackaged SDL2 build. + +Usually you would produce a binary like this: + +```bash +gcc -o mygame mygame.c # or whatever +``` + +But for Emscripten, you want to output something else: + +```bash +emcc -o index.html mygame.c +``` + +This will produce several files...support Javascript and WebAssembly (.wasm) +files. The `-o index.html` will produce a simple HTML page that loads and +runs your app. You will (probably) eventually want to replace or customize +that file and do `-o index.js` instead to just build the code pieces. + +If you're working on a program of any serious size, you'll likely need to +link with `-sALLOW_MEMORY_GROWTH=1 -sMAXIMUM_MEMORY=1gb` to get access +to more memory. If using pthreads, you'll need the `-sMAXIMUM_MEMORY=1gb` +or the app will fail to start on iOS browsers, but this might be a bug that +goes away in the future. + + +## Data files + +Your game probably has data files. Here's how to access them. + +Filesystem access works like a Unix filesystem; you have a single directory +tree, possibly interpolated from several mounted locations, no drive letters, +'/' for a path separator. You can access them with standard file APIs like +open() or fopen() or SDL_RWops. You can read or write from the filesystem. + +By default, you probably have a "MEMFS" filesystem (all files are stored in +memory, but access to them is immediate and doesn't need to block). There are +other options, like "IDBFS" (files are stored in a local database, so they +don't need to be in RAM all the time and they can persist between runs of the +program, but access is not synchronous). You can mix and match these file +systems, mounting a MEMFS filesystem at one place and idbfs elsewhere, etc, +but that's beyond the scope of this document. Please refer to Emscripten's +[page on the topic](https://emscripten.org/docs/porting/files/file_systems_overview.html) +for more info. + +The _easiest_ (but not the best) way to get at your data files is to embed +them in the app itself. Emscripten's linker has support for automating this. + +```bash +emcc -o index.html loopwave.c --embed-file=../test/sample.wav@/sounds/sample.wav +``` + +This will pack ../test/sample.wav in your app, and make it available at +"/sounds/sample.wav" at runtime. Emscripten makes sure this data is available +before your main() function runs, and since it's in MEMFS, you can just +read it like you do on other platforms. `--embed-file` can also accept a +directory to pack an entire tree, and you can specify the argument multiple +times to pack unrelated things into the final installation. + +Note that this is absolutely the best approach if you have a few small +files to include and shouldn't worry about the issue further. However, if you +have hundreds of megabytes and/or thousands of files, this is not so great, +since the user will download it all every time they load your page, and it +all has to live in memory at runtime. + +[Emscripten's documentation on the matter](https://emscripten.org/docs/porting/files/packaging_files.html) +gives other options and details, and is worth a read. + + +## Debugging + +Debugging web apps is a mixed bag. You should compile and link with +`-gsource-map`, which embeds a ton of source-level debugging information into +the build, and make sure _the app source code is available on the web server_, +which is often a scary proposition for various reasons. + +When you debug from the browser's tools and hit a breakpoint, you can step +through the actual C/C++ source code, though, which can be nice. + +If you try debugging in Firefox and it doesn't work well for no apparent +reason, try Chrome, and vice-versa. These tools are still relatively new, +and improving all the time. + +SDL_Log() (or even plain old printf) will write to the Javascript console, +and honestly I find printf-style debugging to be easier than setting up a build +for proper debugging, so use whatever tools work best for you. -Uses GLES2 renderer or software -Some other SDL2 libraries can be easily built (assuming SDL2 is installed somewhere): +## Questions? -SDL_mixer (http://www.libsdl.org/projects/SDL_mixer/): +Please give us feedback on this document at [the SDL bug tracker](https://github.com/libsdl-org/SDL/issues). +If something is wrong or unclear, we want to know! - $ EMCONFIGURE_JS=1 emconfigure ../configure - build as usual... -SDL_gfx (http://cms.ferzkopp.net/index.php/software/13-sdl-gfx): - $ EMCONFIGURE_JS=1 emconfigure ../configure --disable-mmx - build as usual... diff --git a/thirdparty/SDL/docs/README-gdk.md b/thirdparty/SDL/docs/README-gdk.md index b8ba2b433..6718a6177 100644 --- a/thirdparty/SDL/docs/README-gdk.md +++ b/thirdparty/SDL/docs/README-gdk.md @@ -3,7 +3,7 @@ GDK This port allows SDL applications to run via Microsoft's Game Development Kit (GDK). -Windows (GDK) and Xbox One/Xbox Series (GDKX) are supported. Although most of the Xbox code is included in the public SDL source code, NDA access is required for a small number of source files. If you have access to GDKX, these required Xbox files are posted on the GDK forums [here](https://forums.xboxlive.com/questions/130003/). +Windows (GDK) and Xbox One/Xbox Series (GDKX) are both supported and all the required code is included in this public SDL release. However, only licensed Xbox developers have access to the GDKX libraries which will allow you to build the Xbox targets. Requirements @@ -11,6 +11,7 @@ Requirements * Microsoft Visual Studio 2022 (in theory, it should also work in 2017 or 2019, but this has not been tested) * Microsoft GDK June 2022 or newer (public release [here](https://github.com/microsoft/GDK/releases/tag/June_2022)) +* For Xbox, you will need the corresponding GDKX version (licensed developers only) * To publish a package or successfully authenticate a user, you will need to create an app id/configure services in Partner Center. However, for local testing purposes (without authenticating on Xbox Live), the identifiers used by the GDK test programs in the included solution will work. @@ -29,6 +30,12 @@ The Windows GDK port supports the full set of Win32 APIs, renderers, controllers * Global task queue callbacks are dispatched during `SDL_PumpEvents` (which is also called internally if using `SDL_PollEvent`). * You can get the handle of the global task queue through `SDL_GDKGetTaskQueue`, if needed. When done with the queue, be sure to use `XTaskQueueCloseHandle` to decrement the reference count (otherwise it will cause a resource leak). +* Single-player games have some additional features available: + * Call `SDL_GDKGetDefaultUser` to get the default XUserHandle pointer. + * `SDL_GetPrefPath` still works, but only for single-player titles. + + These functions mostly wrap around async APIs, and thus should be treated as synchronous alternatives. Also note that the single-player functions return on any OS errors, so be sure to validate the return values! + * What doesn't work: * Compilation with anything other than through the included Visual C++ solution file @@ -139,6 +146,20 @@ To create the package: 6. Once the package is installed, you can run it from the start menu. 7. As with when running from Visual Studio, if you need to test any Xbox Live functionality you must switch to the correct sandbox. +Xbox GDKX Setup +--------------------- +In general, the same process in the Windows GDK instructions work. There are just a few additional notes: +* For Xbox One consoles, use the Gaming.Xbox.XboxOne.x64 target +* For Xbox Series consoles, use the Gaming.Xbox.Scarlett.x64 target +* The Xbox One target sets the `__XBOXONE__` define and the Xbox Series target sets the `__XBOXSERIES__` define +* You don't need to link against the Xbox.Services Thunks lib nor include that dll in your package (it doesn't exist for Xbox) +* The shader blobs for Xbox are created in a pre-build step for the Xbox targets, rather than included in the source (due to NDA and version compatability reasons) +* To create a package, use: + `makepkg pack /f PackageLayout.xml /lt /d . /pd Package` +* To install the package, use: + `xbapp install [PACKAGE].xvc` +* For some reason, if you make changes that require SDL2.dll to build, and you are running through the debugger (instead of a package), you have to rebuild your .exe target for the debugger to recognize the dll has changed and needs to be transferred to the console again +* While there are successful releases of Xbox titles using this port, it is not as extensively tested as other targets Troubleshooting --------------- diff --git a/thirdparty/SDL/docs/README-ios.md b/thirdparty/SDL/docs/README-ios.md index 90ef987a9..94c24b503 100644 --- a/thirdparty/SDL/docs/README-ios.md +++ b/thirdparty/SDL/docs/README-ios.md @@ -273,7 +273,7 @@ e.g. { ... initialize game ... - #if __IPHONEOS__ + #ifdef __IPHONEOS__ // Initialize the Game Center for scoring and matchmaking InitGameCenter(); diff --git a/thirdparty/SDL/docs/README-macos.md b/thirdparty/SDL/docs/README-macos.md index 634d456bf..bcf695627 100644 --- a/thirdparty/SDL/docs/README-macos.md +++ b/thirdparty/SDL/docs/README-macos.md @@ -261,10 +261,10 @@ Some things that may be of interest about how it all works... ## Working directory In SDL 1.2, the working directory of your SDL app is by default set to its -parent, but this is no longer the case in SDL 2.0. SDL2 does change the -working directory, which means it'll be whatever the command line prompt -that launched the program was using, or if launched by double-clicking in -the finger, it will be "/", the _root of the filesystem_. Plan accordingly! +parent, but this is no longer the case in SDL 2.0 and later. SDL2 does not +change the working directory, which means it'll be whatever the command line +prompt that launched the program was using, or if launched by double-clicking +in the Finder, it will be "/", the _root of the filesystem_. Plan accordingly! You can use SDL_GetBasePath() to find where the program is running from and chdir() there directly. diff --git a/thirdparty/SDL/include/SDL.h b/thirdparty/SDL/include/SDL.h index 9ba8f68c6..20c903b2f 100644 --- a/thirdparty/SDL/include/SDL.h +++ b/thirdparty/SDL/include/SDL.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/include/SDL_assert.h b/thirdparty/SDL/include/SDL_assert.h index 7ce823ec5..a396d4e02 100644 --- a/thirdparty/SDL/include/SDL_assert.h +++ b/thirdparty/SDL/include/SDL_assert.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/include/SDL_atomic.h b/thirdparty/SDL/include/SDL_atomic.h index 1dd816a38..1fa18f49f 100644 --- a/thirdparty/SDL/include/SDL_atomic.h +++ b/thirdparty/SDL/include/SDL_atomic.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -209,7 +209,7 @@ typedef void (*SDL_KernelMemoryBarrierFunc)(); #if defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7EM__) || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7S__) || defined(__ARM_ARCH_8A__) #define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("dmb ish" : : : "memory") #define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("dmb ish" : : : "memory") -#elif defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6T2__) || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__) || defined(__ARM_ARCH_5TE__) +#elif defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6T2__) || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__) #ifdef __thumb__ /* The mcr instruction isn't available in thumb mode, use real functions */ #define SDL_MEMORY_BARRIER_USES_FUNCTION diff --git a/thirdparty/SDL/include/SDL_audio.h b/thirdparty/SDL/include/SDL_audio.h index ccd35982d..bd8e7ab6f 100644 --- a/thirdparty/SDL/include/SDL_audio.h +++ b/thirdparty/SDL/include/SDL_audio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/include/SDL_bits.h b/thirdparty/SDL/include/SDL_bits.h index 81161ae5f..83e8a78c7 100644 --- a/thirdparty/SDL/include/SDL_bits.h +++ b/thirdparty/SDL/include/SDL_bits.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/include/SDL_blendmode.h b/thirdparty/SDL/include/SDL_blendmode.h index 4ecbe5078..09d01477d 100644 --- a/thirdparty/SDL/include/SDL_blendmode.h +++ b/thirdparty/SDL/include/SDL_blendmode.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -65,8 +65,8 @@ typedef enum typedef enum { SDL_BLENDOPERATION_ADD = 0x1, /**< dst + src: supported by all renderers */ - SDL_BLENDOPERATION_SUBTRACT = 0x2, /**< dst - src : supported by D3D9, D3D11, OpenGL, OpenGLES */ - SDL_BLENDOPERATION_REV_SUBTRACT = 0x3, /**< src - dst : supported by D3D9, D3D11, OpenGL, OpenGLES */ + SDL_BLENDOPERATION_SUBTRACT = 0x2, /**< src - dst : supported by D3D9, D3D11, OpenGL, OpenGLES */ + SDL_BLENDOPERATION_REV_SUBTRACT = 0x3, /**< dst - src : supported by D3D9, D3D11, OpenGL, OpenGLES */ SDL_BLENDOPERATION_MINIMUM = 0x4, /**< min(dst, src) : supported by D3D9, D3D11 */ SDL_BLENDOPERATION_MAXIMUM = 0x5 /**< max(dst, src) : supported by D3D9, D3D11 */ } SDL_BlendOperation; diff --git a/thirdparty/SDL/include/SDL_clipboard.h b/thirdparty/SDL/include/SDL_clipboard.h index 7c351fbb9..bd4b044c6 100644 --- a/thirdparty/SDL/include/SDL_clipboard.h +++ b/thirdparty/SDL/include/SDL_clipboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/include/SDL_config.h b/thirdparty/SDL/include/SDL_config.h index fd2fe8876..49605b1e8 100644 --- a/thirdparty/SDL/include/SDL_config.h +++ b/thirdparty/SDL/include/SDL_config.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/include/SDL_config.h.cmake b/thirdparty/SDL/include/SDL_config.h.cmake index 35923d020..ffcafd895 100644 --- a/thirdparty/SDL/include/SDL_config.h.cmake +++ b/thirdparty/SDL/include/SDL_config.h.cmake @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -49,7 +49,7 @@ /* Comment this if you want to build without any C library requirements */ #cmakedefine HAVE_LIBC 1 -#if HAVE_LIBC +#ifdef HAVE_LIBC /* Useful headers */ #cmakedefine STDC_HEADERS 1 @@ -190,6 +190,8 @@ #cmakedefine HAVE_FOPEN64 1 #cmakedefine HAVE_FSEEKO 1 #cmakedefine HAVE_FSEEKO64 1 +#cmakedefine HAVE_MEMFD_CREATE 1 +#cmakedefine HAVE_POSIX_FALLOCATE 1 #cmakedefine HAVE_SIGACTION 1 #cmakedefine HAVE_SA_SIGACTION 1 #cmakedefine HAVE_SETJMP 1 @@ -200,6 +202,7 @@ #cmakedefine HAVE_GETPAGESIZE 1 #cmakedefine HAVE_MPROTECT 1 #cmakedefine HAVE_ICONV 1 +#cmakedefine SDL_USE_LIBICONV 1 #cmakedefine HAVE_PTHREAD_SETNAME_NP 1 #cmakedefine HAVE_PTHREAD_SET_NAME_NP 1 #cmakedefine HAVE_SEM_TIMEDWAIT 1 @@ -240,7 +243,7 @@ #cmakedefine HAVE_LIBUDEV_H 1 #cmakedefine HAVE_LIBSAMPLERATE_H 1 -#cmakedefine HAVE_LIBDECOR_H 1 +#cmakedefine HAVE_LIBDECOR_H 1 #cmakedefine HAVE_D3D_H @HAVE_D3D_H@ #cmakedefine HAVE_D3D11_H @HAVE_D3D11_H@ @@ -259,9 +262,6 @@ #cmakedefine HAVE_ROAPI_H @HAVE_ROAPI_H@ #cmakedefine HAVE_SHELLSCALINGAPI_H @HAVE_SHELLSCALINGAPI_H@ -#cmakedefine HAVE_XINPUT_GAMEPAD_EX @HAVE_XINPUT_GAMEPAD_EX@ -#cmakedefine HAVE_XINPUT_STATE_EX @HAVE_XINPUT_STATE_EX@ - #cmakedefine USE_POSIX_SPAWN @USE_POSIX_SPAWN@ /* SDL internal assertion support */ @@ -527,7 +527,7 @@ #cmakedefine SDL_ARM_NEON_BLITTERS @SDL_ARM_NEON_BLITTERS@ /* Whether SDL_DYNAMIC_API needs dlopen */ -#cmakedefine DYNAPI_NEEDS_DLOPEN @DYNAPI_NEEDS_DLOPEN@ +#cmakedefine DYNAPI_NEEDS_DLOPEN @DYNAPI_NEEDS_DLOPEN@ /* Enable dynamic libsamplerate support */ #cmakedefine SDL_LIBSAMPLERATE_DYNAMIC @SDL_LIBSAMPLERATE_DYNAMIC@ diff --git a/thirdparty/SDL/include/SDL_config.h.in b/thirdparty/SDL/include/SDL_config.h.in index d6460b783..f5dd166ff 100644 --- a/thirdparty/SDL/include/SDL_config.h.in +++ b/thirdparty/SDL/include/SDL_config.h.in @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -53,7 +53,7 @@ /* Comment this if you want to build without any C library requirements */ #undef HAVE_LIBC -#if HAVE_LIBC +#ifdef HAVE_LIBC /* Useful headers */ #undef STDC_HEADERS @@ -204,12 +204,15 @@ #undef HAVE_GETPAGESIZE #undef HAVE_MPROTECT #undef HAVE_ICONV +#undef SDL_USE_LIBICONV #undef HAVE_PTHREAD_SETNAME_NP #undef HAVE_PTHREAD_SET_NAME_NP #undef HAVE_SEM_TIMEDWAIT #undef HAVE_GETAUXVAL #undef HAVE_ELF_AUX_INFO #undef HAVE_POLL +#undef HAVE_MEMFD_CREATE +#undef HAVE_POSIX_FALLOCATE #undef HAVE__EXIT #else @@ -241,8 +244,6 @@ #undef HAVE_DXGI_H #undef HAVE_WINDOWS_GAMING_INPUT_H #undef HAVE_XINPUT_H -#undef HAVE_XINPUT_GAMEPAD_EX -#undef HAVE_XINPUT_STATE_EX #undef HAVE_MMDEVICEAPI_H #undef HAVE_AUDIOCLIENT_H diff --git a/thirdparty/SDL/include/SDL_config_android.h b/thirdparty/SDL/include/SDL_config_android.h index d88c026be..00ffef852 100644 --- a/thirdparty/SDL/include/SDL_config_android.h +++ b/thirdparty/SDL/include/SDL_config_android.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/include/SDL_config_emscripten.h b/thirdparty/SDL/include/SDL_config_emscripten.h index 68660a14a..637cdae50 100644 --- a/thirdparty/SDL/include/SDL_config_emscripten.h +++ b/thirdparty/SDL/include/SDL_config_emscripten.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/include/SDL_config_iphoneos.h b/thirdparty/SDL/include/SDL_config_iphoneos.h index 02011c4c8..2743901fe 100644 --- a/thirdparty/SDL/include/SDL_config_iphoneos.h +++ b/thirdparty/SDL/include/SDL_config_iphoneos.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/include/SDL_config_macosx.h b/thirdparty/SDL/include/SDL_config_macosx.h index d7ad6cc71..2db760a9f 100644 --- a/thirdparty/SDL/include/SDL_config_macosx.h +++ b/thirdparty/SDL/include/SDL_config_macosx.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/include/SDL_config_minimal.h b/thirdparty/SDL/include/SDL_config_minimal.h index d6dee64d6..ceedda2d6 100644 --- a/thirdparty/SDL/include/SDL_config_minimal.h +++ b/thirdparty/SDL/include/SDL_config_minimal.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/include/SDL_config_ngage.h b/thirdparty/SDL/include/SDL_config_ngage.h index 25453b3a2..61c26c2cf 100644 --- a/thirdparty/SDL/include/SDL_config_ngage.h +++ b/thirdparty/SDL/include/SDL_config_ngage.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/include/SDL_config_os2.h b/thirdparty/SDL/include/SDL_config_os2.h index 2effe1a88..b2b061d71 100644 --- a/thirdparty/SDL/include/SDL_config_os2.h +++ b/thirdparty/SDL/include/SDL_config_os2.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -47,7 +47,7 @@ /* dynamically loaded libusb-1.0 dll: */ #define SDL_LIBUSB_DYNAMIC "usb100.dll" #endif -/*#undef SDL_JOYSTICK_VIRTUAL */ +#define SDL_JOYSTICK_VIRTUAL 1 /* Enable OpenGL support */ /* #undef SDL_VIDEO_OPENGL */ @@ -114,9 +114,6 @@ #define HAVE_MEMCPY 1 #define HAVE_MEMMOVE 1 #define HAVE_MEMCMP 1 -#define HAVE_WCSLEN 1 -#define HAVE_WCSLCPY 1 -#define HAVE_WCSLCAT 1 #define HAVE_WCSCMP 1 #define HAVE__WCSICMP 1 #define HAVE__WCSNICMP 1 diff --git a/thirdparty/SDL/include/SDL_config_pandora.h b/thirdparty/SDL/include/SDL_config_pandora.h index c74fa0c2f..27b858df1 100644 --- a/thirdparty/SDL/include/SDL_config_pandora.h +++ b/thirdparty/SDL/include/SDL_config_pandora.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/include/SDL_config_windows.h b/thirdparty/SDL/include/SDL_config_windows.h index 01322c182..aae52ebc6 100644 --- a/thirdparty/SDL/include/SDL_config_windows.h +++ b/thirdparty/SDL/include/SDL_config_windows.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -99,9 +99,11 @@ typedef unsigned int uintptr_t; #define HAVE_D3D11_H 1 #define HAVE_ROAPI_H 1 #endif -#if defined(WDK_NTDDI_VERSION) && WDK_NTDDI_VERSION > 0x0A000008 /* 10.0.19041.0 */ +#if defined(__has_include) +#if __has_include() && __has_include() #define HAVE_D3D12_H 1 #endif +#endif #if defined(_WIN32_MAXVER) && _WIN32_MAXVER >= 0x0603 /* Windows 8.1 SDK */ #define HAVE_SHELLSCALINGAPI_H 1 #endif diff --git a/thirdparty/SDL/include/SDL_config_wingdk.h b/thirdparty/SDL/include/SDL_config_wingdk.h index f9d3ff46d..c2a63b5ba 100644 --- a/thirdparty/SDL/include/SDL_config_wingdk.h +++ b/thirdparty/SDL/include/SDL_config_wingdk.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/include/SDL_config_winrt.h b/thirdparty/SDL/include/SDL_config_winrt.h index 8efde9099..3a1145643 100644 --- a/thirdparty/SDL/include/SDL_config_winrt.h +++ b/thirdparty/SDL/include/SDL_config_winrt.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -54,7 +54,7 @@ /* Useful headers */ #define HAVE_DXGI_H 1 -#if WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP +#if !SDL_WINAPI_FAMILY_PHONE #define HAVE_XINPUT_H 1 #endif @@ -161,7 +161,7 @@ #define SDL_AUDIO_DRIVER_DUMMY 1 /* Enable various input drivers */ -#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP +#if SDL_WINAPI_FAMILY_PHONE #define SDL_JOYSTICK_DISABLED 1 #define SDL_HAPTIC_DISABLED 1 #else @@ -208,9 +208,9 @@ #define SDL_VIDEO_RENDER_D3D11 1 /* Disable D3D12 as it's not implemented for WinRT */ -#define SDL_VIDEO_RENDER_D3D12 0 +/* #undef SDL_VIDEO_RENDER_D3D12 */ -#if SDL_VIDEO_OPENGL_ES2 +#ifdef SDL_VIDEO_OPENGL_ES2 #define SDL_VIDEO_RENDER_OGL_ES2 1 #endif diff --git a/thirdparty/SDL/include/SDL_config_xbox.h b/thirdparty/SDL/include/SDL_config_xbox.h index 8baf78ed7..a2ea8cbac 100644 --- a/thirdparty/SDL/include/SDL_config_xbox.h +++ b/thirdparty/SDL/include/SDL_config_xbox.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/include/SDL_copying.h b/thirdparty/SDL/include/SDL_copying.h index b6028bab2..da9089312 100644 --- a/thirdparty/SDL/include/SDL_copying.h +++ b/thirdparty/SDL/include/SDL_copying.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/include/SDL_cpuinfo.h b/thirdparty/SDL/include/SDL_cpuinfo.h index ed5e97915..2a9dd380c 100644 --- a/thirdparty/SDL/include/SDL_cpuinfo.h +++ b/thirdparty/SDL/include/SDL_cpuinfo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/include/SDL_egl.h b/thirdparty/SDL/include/SDL_egl.h index 6f51c0831..a4276e681 100644 --- a/thirdparty/SDL/include/SDL_egl.h +++ b/thirdparty/SDL/include/SDL_egl.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/include/SDL_endian.h b/thirdparty/SDL/include/SDL_endian.h index 71bc06729..591ccac42 100644 --- a/thirdparty/SDL/include/SDL_endian.h +++ b/thirdparty/SDL/include/SDL_endian.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/include/SDL_error.h b/thirdparty/SDL/include/SDL_error.h index 31c22616c..2df6463ad 100644 --- a/thirdparty/SDL/include/SDL_error.h +++ b/thirdparty/SDL/include/SDL_error.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/include/SDL_events.h b/thirdparty/SDL/include/SDL_events.h index 9d0970318..eccbba255 100644 --- a/thirdparty/SDL/include/SDL_events.h +++ b/thirdparty/SDL/include/SDL_events.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -131,6 +131,8 @@ typedef enum SDL_CONTROLLERTOUCHPADMOTION, /**< Game controller touchpad finger was moved */ SDL_CONTROLLERTOUCHPADUP, /**< Game controller touchpad finger was lifted */ SDL_CONTROLLERSENSORUPDATE, /**< Game controller sensor was updated */ + SDL_CONTROLLERUPDATECOMPLETE_RESERVED_FOR_SDL3, + SDL_CONTROLLERSTEAMHANDLEUPDATED, /**< Game controller Steam handle has changed */ /* Touch events */ SDL_FINGERDOWN = 0x700, @@ -446,7 +448,7 @@ typedef struct SDL_ControllerButtonEvent */ typedef struct SDL_ControllerDeviceEvent { - Uint32 type; /**< ::SDL_CONTROLLERDEVICEADDED, ::SDL_CONTROLLERDEVICEREMOVED, or ::SDL_CONTROLLERDEVICEREMAPPED */ + Uint32 type; /**< ::SDL_CONTROLLERDEVICEADDED, ::SDL_CONTROLLERDEVICEREMOVED, ::SDL_CONTROLLERDEVICEREMAPPED, or ::SDL_CONTROLLERSTEAMHANDLEUPDATED */ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Sint32 which; /**< The joystick device index for the ADDED event, instance id for the REMOVED or REMAPPED event */ } SDL_ControllerDeviceEvent; @@ -580,15 +582,6 @@ typedef struct SDL_QuitEvent Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ } SDL_QuitEvent; -/** - * \brief OS Specific event - */ -typedef struct SDL_OSEvent -{ - Uint32 type; /**< ::SDL_QUIT */ - Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ -} SDL_OSEvent; - /** * \brief A user-defined event type (event.user.*) */ diff --git a/thirdparty/SDL/include/SDL_filesystem.h b/thirdparty/SDL/include/SDL_filesystem.h index 4cad657ec..07498898d 100644 --- a/thirdparty/SDL/include/SDL_filesystem.h +++ b/thirdparty/SDL/include/SDL_filesystem.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -64,7 +64,7 @@ extern "C" { * directory of the application as it is uncommon to store resources outside * the executable. As such it is not a writable directory. * - * The returned path is guaranteed to end with a path separator ('\' on + * The returned path is guaranteed to end with a path separator ('\\' on * Windows, '/' on most other platforms). * * The pointer returned is owned by the caller. Please call SDL_free() on the @@ -120,7 +120,7 @@ extern DECLSPEC char *SDLCALL SDL_GetBasePath(void); * - ...only use letters, numbers, and spaces. Avoid punctuation like "Game * Name 2: Bad Guy's Revenge!" ... "Game Name 2" is sufficient. * - * The returned path is guaranteed to end with a path separator ('\' on + * The returned path is guaranteed to end with a path separator ('\\' on * Windows, '/' on most other platforms). * * The pointer returned is owned by the caller. Please call SDL_free() on the diff --git a/thirdparty/SDL/include/SDL_gamecontroller.h b/thirdparty/SDL/include/SDL_gamecontroller.h index 140054d36..281fa356c 100644 --- a/thirdparty/SDL/include/SDL_gamecontroller.h +++ b/thirdparty/SDL/include/SDL_gamecontroller.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -73,7 +73,8 @@ typedef enum SDL_CONTROLLER_TYPE_NVIDIA_SHIELD, SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_JOYCON_LEFT, SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_JOYCON_RIGHT, - SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_JOYCON_PAIR + SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_JOYCON_PAIR, + SDL_CONTROLLER_TYPE_MAX } SDL_GameControllerType; typedef enum @@ -523,6 +524,20 @@ extern DECLSPEC Uint16 SDLCALL SDL_GameControllerGetFirmwareVersion(SDL_GameCont */ extern DECLSPEC const char * SDLCALL SDL_GameControllerGetSerial(SDL_GameController *gamecontroller); +/** + * Get the Steam Input handle of an opened controller, if available. + * + * Returns an InputHandle_t for the controller that can be used with Steam Input API: + * https://partner.steamgames.com/doc/api/ISteamInput + * + * \param gamecontroller the game controller object to query. + * \returns the gamepad handle, or 0 if unavailable. + * + * \since This function is available since SDL 2.30.0. + */ +extern DECLSPEC Uint64 SDLCALL SDL_GameControllerGetSteamHandle(SDL_GameController *gamecontroller); + + /** * Check if a controller has been opened and is currently connected. * @@ -598,7 +613,9 @@ extern DECLSPEC void SDLCALL SDL_GameControllerUpdate(void); * and are centered within ~8000 of zero, though advanced UI will allow users to set * or autodetect the dead zone, which varies between controllers. * - * Trigger axis values range from 0 to SDL_JOYSTICK_AXIS_MAX. + * Trigger axis values range from 0 (released) to SDL_JOYSTICK_AXIS_MAX + * (fully pressed) when reported by SDL_GameControllerGetAxis(). Note that this is not the + * same range that will be reported by the lower-level SDL_GetJoystickAxis(). */ typedef enum { @@ -687,8 +704,13 @@ SDL_GameControllerHasAxis(SDL_GameController *gamecontroller, SDL_GameController * * The axis indices start at index 0. * - * The state is a value ranging from -32768 to 32767. Triggers, however, range - * from 0 to 32767 (they never return a negative value). + * For thumbsticks, the state is a value ranging from -32768 (up/left) + * to 32767 (down/right). + * + * Triggers range from 0 when released to 32767 when fully pressed, and + * never return a negative value. Note that this differs from the value + * reported by the lower-level SDL_GetJoystickAxis(), which normally uses + * the full range. * * \param gamecontroller a game controller * \param axis an axis index (one of the SDL_GameControllerAxis values) diff --git a/thirdparty/SDL/include/SDL_gesture.h b/thirdparty/SDL/include/SDL_gesture.h index db70b4dd8..4fffa5f3e 100644 --- a/thirdparty/SDL/include/SDL_gesture.h +++ b/thirdparty/SDL/include/SDL_gesture.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/include/SDL_guid.h b/thirdparty/SDL/include/SDL_guid.h index d964223c6..7daa5f1f5 100644 --- a/thirdparty/SDL/include/SDL_guid.h +++ b/thirdparty/SDL/include/SDL_guid.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/include/SDL_haptic.h b/thirdparty/SDL/include/SDL_haptic.h index 2462a1e47..c9ed847df 100644 --- a/thirdparty/SDL/include/SDL_haptic.h +++ b/thirdparty/SDL/include/SDL_haptic.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/include/SDL_hidapi.h b/thirdparty/SDL/include/SDL_hidapi.h index 057510035..b9d8ffac3 100644 --- a/thirdparty/SDL/include/SDL_hidapi.h +++ b/thirdparty/SDL/include/SDL_hidapi.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/include/SDL_hints.h b/thirdparty/SDL/include/SDL_hints.h index 00beef51e..a26ab60e8 100644 --- a/thirdparty/SDL/include/SDL_hints.h +++ b/thirdparty/SDL/include/SDL_hints.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -631,6 +631,110 @@ extern "C" { */ #define SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS "SDL_JOYSTICK_ALLOW_BACKGROUND_EVENTS" +/** + * A variable containing a list of arcade stick style controllers. + * + * The format of the string is a comma separated list of USB VID/PID pairs + * in hexadecimal form, e.g. + * + * 0xAAAA/0xBBBB,0xCCCC/0xDDDD + * + * The variable can also take the form of @file, in which case the named + * file will be loaded and interpreted as the value of the variable. + */ +#define SDL_HINT_JOYSTICK_ARCADESTICK_DEVICES "SDL_JOYSTICK_ARCADESTICK_DEVICES" + +/** + * A variable containing a list of devices that are not arcade stick style controllers. This will override SDL_HINT_JOYSTICK_ARCADESTICK_DEVICES and the built in device list. + * + * The format of the string is a comma separated list of USB VID/PID pairs + * in hexadecimal form, e.g. + * + * 0xAAAA/0xBBBB,0xCCCC/0xDDDD + * + * The variable can also take the form of @file, in which case the named + * file will be loaded and interpreted as the value of the variable. + */ +#define SDL_HINT_JOYSTICK_ARCADESTICK_DEVICES_EXCLUDED "SDL_JOYSTICK_ARCADESTICK_DEVICES_EXCLUDED" + +/** + * A variable containing a list of devices that should not be considerd joysticks. + * + * The format of the string is a comma separated list of USB VID/PID pairs + * in hexadecimal form, e.g. + * + * 0xAAAA/0xBBBB,0xCCCC/0xDDDD + * + * The variable can also take the form of @file, in which case the named + * file will be loaded and interpreted as the value of the variable. + */ +#define SDL_HINT_JOYSTICK_BLACKLIST_DEVICES "SDL_JOYSTICK_BLACKLIST_DEVICES" + +/** + * A variable containing a list of devices that should be considered joysticks. This will override SDL_HINT_JOYSTICK_BLACKLIST_DEVICES and the built in device list. + * + * The format of the string is a comma separated list of USB VID/PID pairs + * in hexadecimal form, e.g. + * + * 0xAAAA/0xBBBB,0xCCCC/0xDDDD + * + * The variable can also take the form of @file, in which case the named + * file will be loaded and interpreted as the value of the variable. + */ +#define SDL_HINT_JOYSTICK_BLACKLIST_DEVICES_EXCLUDED "SDL_JOYSTICK_BLACKLIST_DEVICES_EXCLUDED" + +/** + * A variable containing a list of flightstick style controllers. + * + * The format of the string is a comma separated list of USB VID/PID pairs + * in hexadecimal form, e.g. + * + * 0xAAAA/0xBBBB,0xCCCC/0xDDDD + * + * The variable can also take the form of @file, in which case the named + * file will be loaded and interpreted as the value of the variable. + */ +#define SDL_HINT_JOYSTICK_FLIGHTSTICK_DEVICES "SDL_JOYSTICK_FLIGHTSTICK_DEVICES" + +/** + * A variable containing a list of devices that are not flightstick style controllers. This will override SDL_HINT_JOYSTICK_FLIGHTSTICK_DEVICES and the built in device list. + * + * The format of the string is a comma separated list of USB VID/PID pairs + * in hexadecimal form, e.g. + * + * 0xAAAA/0xBBBB,0xCCCC/0xDDDD + * + * The variable can also take the form of @file, in which case the named + * file will be loaded and interpreted as the value of the variable. + */ +#define SDL_HINT_JOYSTICK_FLIGHTSTICK_DEVICES_EXCLUDED "SDL_JOYSTICK_FLIGHTSTICK_DEVICES_EXCLUDED" + +/** + * A variable containing a list of devices known to have a GameCube form factor. + * + * The format of the string is a comma separated list of USB VID/PID pairs + * in hexadecimal form, e.g. + * + * 0xAAAA/0xBBBB,0xCCCC/0xDDDD + * + * The variable can also take the form of @file, in which case the named + * file will be loaded and interpreted as the value of the variable. + */ +#define SDL_HINT_JOYSTICK_GAMECUBE_DEVICES "SDL_JOYSTICK_GAMECUBE_DEVICES" + +/** + * A variable containing a list of devices known not to have a GameCube form factor. This will override SDL_HINT_JOYSTICK_GAMECUBE_DEVICES and the built in device list. + * + * The format of the string is a comma separated list of USB VID/PID pairs + * in hexadecimal form, e.g. + * + * 0xAAAA/0xBBBB,0xCCCC/0xDDDD + * + * The variable can also take the form of @file, in which case the named + * file will be loaded and interpreted as the value of the variable. + */ +#define SDL_HINT_JOYSTICK_GAMECUBE_DEVICES_EXCLUDED "SDL_JOYSTICK_GAMECUBE_DEVICES_EXCLUDED" + /** * \brief A variable controlling whether the HIDAPI joystick drivers should be used. * @@ -839,6 +943,17 @@ extern "C" { */ #define SDL_HINT_JOYSTICK_HIDAPI_STEAM "SDL_JOYSTICK_HIDAPI_STEAM" +/** + * \brief A variable controlling whether the HIDAPI driver for the Steam Deck builtin controller should be used. + * + * This variable can be set to the following values: + * "0" - HIDAPI driver is not used + * "1" - HIDAPI driver is used + * + * The default is the value of SDL_HINT_JOYSTICK_HIDAPI + */ +#define SDL_HINT_JOYSTICK_HIDAPI_STEAMDECK "SDL_JOYSTICK_HIDAPI_STEAMDECK" + /** * \brief A variable controlling whether the HIDAPI driver for Nintendo Switch controllers should be used. * @@ -965,6 +1080,24 @@ extern "C" { */ #define SDL_HINT_JOYSTICK_HIDAPI_XBOX_ONE_HOME_LED "SDL_JOYSTICK_HIDAPI_XBOX_ONE_HOME_LED" +/** + * A variable controlling whether IOKit should be used for controller handling. + * + * This variable can be set to the following values: + * "0" - IOKit is not used + * "1" - IOKit is used (the default) + */ +#define SDL_HINT_JOYSTICK_IOKIT "SDL_JOYSTICK_IOKIT" + +/** + * A variable controlling whether GCController should be used for controller handling. + * + * This variable can be set to the following values: + * "0" - GCController is not used + * "1" - GCController is used (the default) + */ +#define SDL_HINT_JOYSTICK_MFI "SDL_JOYSTICK_MFI" + /** * \brief A variable controlling whether the RAWINPUT joystick drivers should be used for better handling XInput-capable devices. * @@ -1007,6 +1140,32 @@ extern "C" { */ #define SDL_HINT_JOYSTICK_THREAD "SDL_JOYSTICK_THREAD" +/** + * A variable containing a list of throttle style controllers. + * + * The format of the string is a comma separated list of USB VID/PID pairs + * in hexadecimal form, e.g. + * + * 0xAAAA/0xBBBB,0xCCCC/0xDDDD + * + * The variable can also take the form of @file, in which case the named + * file will be loaded and interpreted as the value of the variable. + */ +#define SDL_HINT_JOYSTICK_THROTTLE_DEVICES "SDL_JOYSTICK_THROTTLE_DEVICES" + +/** + * A variable containing a list of devices that are not throttle style controllers. This will override SDL_HINT_JOYSTICK_THROTTLE_DEVICES and the built in device list. + * + * The format of the string is a comma separated list of USB VID/PID pairs + * in hexadecimal form, e.g. + * + * 0xAAAA/0xBBBB,0xCCCC/0xDDDD + * + * The variable can also take the form of @file, in which case the named + * file will be loaded and interpreted as the value of the variable. + */ +#define SDL_HINT_JOYSTICK_THROTTLE_DEVICES_EXCLUDED "SDL_JOYSTICK_THROTTLE_DEVICES_EXCLUDED" + /** * \brief A variable controlling whether Windows.Gaming.Input should be used for controller handling. * @@ -1016,6 +1175,45 @@ extern "C" { */ #define SDL_HINT_JOYSTICK_WGI "SDL_JOYSTICK_WGI" +/** + * A variable containing a list of wheel style controllers. + * + * The format of the string is a comma separated list of USB VID/PID pairs + * in hexadecimal form, e.g. + * + * 0xAAAA/0xBBBB,0xCCCC/0xDDDD + * + * The variable can also take the form of @file, in which case the named + * file will be loaded and interpreted as the value of the variable. + */ +#define SDL_HINT_JOYSTICK_WHEEL_DEVICES "SDL_JOYSTICK_WHEEL_DEVICES" + +/** + * A variable containing a list of devices that are not wheel style controllers. This will override SDL_HINT_JOYSTICK_WHEEL_DEVICES and the built in device list. + * + * The format of the string is a comma separated list of USB VID/PID pairs + * in hexadecimal form, e.g. + * + * 0xAAAA/0xBBBB,0xCCCC/0xDDDD + * + * The variable can also take the form of @file, in which case the named + * file will be loaded and interpreted as the value of the variable. + */ +#define SDL_HINT_JOYSTICK_WHEEL_DEVICES_EXCLUDED "SDL_JOYSTICK_WHEEL_DEVICES_EXCLUDED" + +/** + * A variable containing a list of devices known to have all axes centered at zero. + * + * The format of the string is a comma separated list of USB VID/PID pairs + * in hexadecimal form, e.g. + * + * 0xAAAA/0xBBBB,0xCCCC/0xDDDD + * + * The variable can also take the form of @file, in which case the named + * file will be loaded and interpreted as the value of the variable. + */ +#define SDL_HINT_JOYSTICK_ZERO_CENTERED_DEVICES "SDL_JOYSTICK_ZERO_CENTERED_DEVICES" + /** * \brief Determines whether SDL enforces that DRM master is required in order * to initialize the KMSDRM video backend. @@ -1084,6 +1282,22 @@ extern "C" { */ #define SDL_HINT_LINUX_JOYSTICK_DEADZONES "SDL_LINUX_JOYSTICK_DEADZONES" +/** + * \brief A variable controlling the default SDL log levels. + * + * This variable is a comma separated set of category=level tokens that define the default logging levels for SDL applications. + * + * The category can be a numeric category, one of "app", "error", "assert", "system", "audio", "video", "render", "input", "test", or `*` for any unspecified category. + * + * The level can be a numeric level, one of "verbose", "debug", "info", "warn", "error", "critical", or "quiet" to disable that category. + * + * You can omit the category if you want to set the logging level for all categories. + * + * If this hint isn't set, the default log levels are equivalent to: + * "app=info,assert=warn,test=verbose,*=error" + */ +#define SDL_HINT_LOGGING "SDL_LOGGING" + /** * \brief When set don't force the SDL app to become a foreground process * @@ -1210,7 +1424,19 @@ extern "C" { #define SDL_HINT_MOUSE_RELATIVE_WARP_MOTION "SDL_MOUSE_RELATIVE_WARP_MOTION" /** - * \brief A variable controlling whether mouse events should generate synthetic touch events + * \brief A variable controlling whether the hardware cursor stays visible when relative mode is active. + * + * This variable can be set to the following values: + * "0" - The cursor will be hidden while relative mode is active (default) + * "1" - The cursor will remain visible while relative mode is active + * + * Note that for systems without raw hardware inputs, relative mode is implemented using warping, so the hardware cursor will visibly warp between frames if this is enabled on those systems. + */ +#define SDL_HINT_MOUSE_RELATIVE_CURSOR_VISIBLE "SDL_MOUSE_RELATIVE_CURSOR_VISIBLE" + +/** + * A variable controlling whether mouse events should generate synthetic touch + * events * * This variable can be set to the following values: * "0" - Mouse events will not generate touch events (default for desktop platforms) @@ -1485,6 +1711,32 @@ extern "C" { */ #define SDL_HINT_RENDER_METAL_PREFER_LOW_POWER_DEVICE "SDL_RENDER_METAL_PREFER_LOW_POWER_DEVICE" +/** + * A variable containing a list of ROG gamepad capable mice. + * + * The format of the string is a comma separated list of USB VID/PID pairs + * in hexadecimal form, e.g. + * + * 0xAAAA/0xBBBB,0xCCCC/0xDDDD + * + * The variable can also take the form of @file, in which case the named + * file will be loaded and interpreted as the value of the variable. + */ +#define SDL_HINT_ROG_GAMEPAD_MICE "SDL_ROG_GAMEPAD_MICE" + +/** + * A variable containing a list of devices that are not ROG gamepad capable mice. This will override SDL_HINT_ROG_GAMEPAD_MICE and the built in device list. + * + * The format of the string is a comma separated list of USB VID/PID pairs + * in hexadecimal form, e.g. + * + * 0xAAAA/0xBBBB,0xCCCC/0xDDDD + * + * The variable can also take the form of @file, in which case the named + * file will be loaded and interpreted as the value of the variable. + */ +#define SDL_HINT_ROG_GAMEPAD_MICE_EXCLUDED "SDL_ROG_GAMEPAD_MICE_EXCLUDED" + /** * \brief A variable controlling if VSYNC is automatically disable if doesn't reach the enough FPS * @@ -2442,6 +2694,22 @@ extern "C" { */ #define SDL_HINT_TRACKPAD_IS_TOUCH_ONLY "SDL_TRACKPAD_IS_TOUCH_ONLY" +/** + * Cause SDL to call dbus_shutdown() on quit. + * + * This is useful as a debug tool to validate memory leaks, but shouldn't ever + * be set in production applications, as other libraries used by the application + * might use dbus under the hood and this cause cause crashes if they continue + * after SDL_Quit(). + * + * This variable can be set to the following values: + * "0" - SDL will not call dbus_shutdown() on quit (default) + * "1" - SDL will call dbus_shutdown() on quit + * + * This hint is available since SDL 2.30.0. + */ +#define SDL_HINT_SHUTDOWN_DBUS_ON_QUIT "SDL_SHUTDOWN_DBUS_ON_QUIT" + /** * \brief An enumeration of hint priorities diff --git a/thirdparty/SDL/include/SDL_joystick.h b/thirdparty/SDL/include/SDL_joystick.h index b9b4f6228..7a3faf841 100644 --- a/thirdparty/SDL/include/SDL_joystick.h +++ b/thirdparty/SDL/include/SDL_joystick.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -790,12 +790,17 @@ extern DECLSPEC void SDLCALL SDL_JoystickUpdate(void); * **WARNING**: Calling this function may delete all events currently in SDL's * event queue. * - * \param state can be one of `SDL_QUERY`, `SDL_IGNORE`, or `SDL_ENABLE` - * \returns 1 if enabled, 0 if disabled, or a negative error code on failure; - * call SDL_GetError() for more information. + * While `param` is meant to be one of `SDL_QUERY`, `SDL_IGNORE`, or + * `SDL_ENABLE`, this function accepts any value, with any non-zero value that + * isn't `SDL_QUERY` being treated as `SDL_ENABLE`. * - * If `state` is `SDL_QUERY` then the current state is returned, - * otherwise the new processing state is returned. + * If SDL was built with events disabled (extremely uncommon!), this will + * do nothing and always return `SDL_IGNORE`. + * + * \param state can be one of `SDL_QUERY`, `SDL_IGNORE`, or `SDL_ENABLE` + * \returns If `state` is `SDL_QUERY` then the current state is returned, + * otherwise `state` is returned (even if it was not one of the + * allowed values). * * \since This function is available since SDL 2.0.0. * diff --git a/thirdparty/SDL/include/SDL_keyboard.h b/thirdparty/SDL/include/SDL_keyboard.h index 86a37ad1a..03c7b5a37 100644 --- a/thirdparty/SDL/include/SDL_keyboard.h +++ b/thirdparty/SDL/include/SDL_keyboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -298,8 +298,10 @@ extern DECLSPEC void SDLCALL SDL_ClearComposition(void); extern DECLSPEC SDL_bool SDLCALL SDL_IsTextInputShown(void); /** - * Set the rectangle used to type Unicode text inputs. - * + * Set the rectangle used to type Unicode text inputs. Native input methods + * will place a window with word suggestions near it, without covering the + * text being inputted. + * * To start text input in a given location, this function is intended to be * called before SDL_StartTextInput, although some platforms support moving * the rectangle even while text input (and a composition) is active. diff --git a/thirdparty/SDL/include/SDL_keycode.h b/thirdparty/SDL/include/SDL_keycode.h index 710622302..57a71bd79 100644 --- a/thirdparty/SDL/include/SDL_keycode.h +++ b/thirdparty/SDL/include/SDL_keycode.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/include/SDL_loadso.h b/thirdparty/SDL/include/SDL_loadso.h index ca59b681c..4edc22e9e 100644 --- a/thirdparty/SDL/include/SDL_loadso.h +++ b/thirdparty/SDL/include/SDL_loadso.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/include/SDL_locale.h b/thirdparty/SDL/include/SDL_locale.h index 482dbefe7..0b6118f0e 100644 --- a/thirdparty/SDL/include/SDL_locale.h +++ b/thirdparty/SDL/include/SDL_locale.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/include/SDL_log.h b/thirdparty/SDL/include/SDL_log.h index da733c402..bd030c6d2 100644 --- a/thirdparty/SDL/include/SDL_log.h +++ b/thirdparty/SDL/include/SDL_log.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -59,7 +59,7 @@ extern "C" { * By default the application category is enabled at the INFO level, * the assert category is enabled at the WARN level, test is enabled * at the VERBOSE level and all other categories are enabled at the - * CRITICAL level. + * ERROR level. */ typedef enum { @@ -352,7 +352,7 @@ extern DECLSPEC void SDLCALL SDL_LogMessage(int category, */ extern DECLSPEC void SDLCALL SDL_LogMessageV(int category, SDL_LogPriority priority, - const char *fmt, va_list ap); + SDL_PRINTF_FORMAT_STRING const char *fmt, va_list ap) SDL_PRINTF_VARARG_FUNCV(3); /** * The prototype for the log output callback function. diff --git a/thirdparty/SDL/include/SDL_main.h b/thirdparty/SDL/include/SDL_main.h index 5cc8e5913..a66c84b4e 100644 --- a/thirdparty/SDL/include/SDL_main.h +++ b/thirdparty/SDL/include/SDL_main.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/include/SDL_messagebox.h b/thirdparty/SDL/include/SDL_messagebox.h index 7896fd129..5ace6f2dd 100644 --- a/thirdparty/SDL/include/SDL_messagebox.h +++ b/thirdparty/SDL/include/SDL_messagebox.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/include/SDL_metal.h b/thirdparty/SDL/include/SDL_metal.h index f36e34878..50f7b2aeb 100644 --- a/thirdparty/SDL/include/SDL_metal.h +++ b/thirdparty/SDL/include/SDL_metal.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/include/SDL_misc.h b/thirdparty/SDL/include/SDL_misc.h index 13ed9c771..113ba7a15 100644 --- a/thirdparty/SDL/include/SDL_misc.h +++ b/thirdparty/SDL/include/SDL_misc.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/include/SDL_mouse.h b/thirdparty/SDL/include/SDL_mouse.h index aa0757573..687ff122d 100644 --- a/thirdparty/SDL/include/SDL_mouse.h +++ b/thirdparty/SDL/include/SDL_mouse.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/include/SDL_mutex.h b/thirdparty/SDL/include/SDL_mutex.h index e679d3808..eaa21f293 100644 --- a/thirdparty/SDL/include/SDL_mutex.h +++ b/thirdparty/SDL/include/SDL_mutex.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/include/SDL_name.h b/thirdparty/SDL/include/SDL_name.h index 5c3e07ab7..71e935455 100644 --- a/thirdparty/SDL/include/SDL_name.h +++ b/thirdparty/SDL/include/SDL_name.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/include/SDL_opengl.h b/thirdparty/SDL/include/SDL_opengl.h index 0ba89127a..2bb38c5c0 100644 --- a/thirdparty/SDL/include/SDL_opengl.h +++ b/thirdparty/SDL/include/SDL_opengl.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/include/SDL_opengles.h b/thirdparty/SDL/include/SDL_opengles.h index f4465eaa9..7e9a1ab8d 100644 --- a/thirdparty/SDL/include/SDL_opengles.h +++ b/thirdparty/SDL/include/SDL_opengles.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/include/SDL_opengles2.h b/thirdparty/SDL/include/SDL_opengles2.h index 5e3b717de..96971344d 100644 --- a/thirdparty/SDL/include/SDL_opengles2.h +++ b/thirdparty/SDL/include/SDL_opengles2.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/include/SDL_pixels.h b/thirdparty/SDL/include/SDL_pixels.h index 9abd57b42..44757cdcf 100644 --- a/thirdparty/SDL/include/SDL_pixels.h +++ b/thirdparty/SDL/include/SDL_pixels.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -61,7 +61,10 @@ typedef enum SDL_PIXELTYPE_ARRAYU16, SDL_PIXELTYPE_ARRAYU32, SDL_PIXELTYPE_ARRAYF16, - SDL_PIXELTYPE_ARRAYF32 + SDL_PIXELTYPE_ARRAYF32, + + /* This must be at the end of the list to avoid breaking the existing ABI */ + SDL_PIXELTYPE_INDEX2 } SDL_PixelType; /** Bitmap pixel order, high bit -> low bit. */ @@ -134,6 +137,7 @@ typedef enum #define SDL_ISPIXELFORMAT_INDEXED(format) \ (!SDL_ISPIXELFORMAT_FOURCC(format) && \ ((SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX1) || \ + (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX2) || \ (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX4) || \ (SDL_PIXELTYPE(format) == SDL_PIXELTYPE_INDEX8))) @@ -177,6 +181,12 @@ typedef enum SDL_PIXELFORMAT_INDEX1MSB = SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX1, SDL_BITMAPORDER_1234, 0, 1, 0), + SDL_PIXELFORMAT_INDEX2LSB = + SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX2, SDL_BITMAPORDER_4321, 0, + 2, 0), + SDL_PIXELFORMAT_INDEX2MSB = + SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX2, SDL_BITMAPORDER_1234, 0, + 2, 0), SDL_PIXELFORMAT_INDEX4LSB = SDL_DEFINE_PIXELFORMAT(SDL_PIXELTYPE_INDEX4, SDL_BITMAPORDER_4321, 0, 4, 0), @@ -276,11 +286,19 @@ typedef enum SDL_PIXELFORMAT_ARGB32 = SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_BGRA32 = SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_ABGR32 = SDL_PIXELFORMAT_ABGR8888, + SDL_PIXELFORMAT_RGBX32 = SDL_PIXELFORMAT_RGBX8888, + SDL_PIXELFORMAT_XRGB32 = SDL_PIXELFORMAT_XRGB8888, + SDL_PIXELFORMAT_BGRX32 = SDL_PIXELFORMAT_BGRX8888, + SDL_PIXELFORMAT_XBGR32 = SDL_PIXELFORMAT_XBGR8888, #else SDL_PIXELFORMAT_RGBA32 = SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_ARGB32 = SDL_PIXELFORMAT_BGRA8888, SDL_PIXELFORMAT_BGRA32 = SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_ABGR32 = SDL_PIXELFORMAT_RGBA8888, + SDL_PIXELFORMAT_RGBX32 = SDL_PIXELFORMAT_XBGR8888, + SDL_PIXELFORMAT_XRGB32 = SDL_PIXELFORMAT_BGRX8888, + SDL_PIXELFORMAT_BGRX32 = SDL_PIXELFORMAT_XRGB8888, + SDL_PIXELFORMAT_XBGR32 = SDL_PIXELFORMAT_RGBX8888, #endif SDL_PIXELFORMAT_YV12 = /**< Planar mode: Y + V + U (3 planes) */ diff --git a/thirdparty/SDL/include/SDL_platform.h b/thirdparty/SDL/include/SDL_platform.h index d2a7e052d..2b11bf201 100644 --- a/thirdparty/SDL/include/SDL_platform.h +++ b/thirdparty/SDL/include/SDL_platform.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -73,7 +73,13 @@ #if defined(__APPLE__) /* lets us know what version of Mac OS X we're compiling on */ #include +#ifndef __has_extension /* Older compilers don't support this */ +#define __has_extension(x) 0 #include +#undef __has_extension +#else +#include +#endif /* Fix building with older SDKs that don't define these See this for more information: @@ -166,6 +172,12 @@ #define WINAPI_FAMILY_WINRT 0 #endif /* HAVE_WINAPIFAMILY_H */ +#if (HAVE_WINAPIFAMILY_H) && defined(WINAPI_FAMILY_PHONE_APP) +#define SDL_WINAPI_FAMILY_PHONE (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) +#else +#define SDL_WINAPI_FAMILY_PHONE 0 +#endif + #if WINAPI_FAMILY_WINRT #undef __WINRT__ #define __WINRT__ 1 @@ -193,8 +205,10 @@ #undef __GDK__ #define __GDK__ 1 #endif -#if defined(__PSP__) +#if defined(__PSP__) || defined(__psp__) +#ifdef __PSP__ #undef __PSP__ +#endif #define __PSP__ 1 #endif #if defined(PS2) diff --git a/thirdparty/SDL/include/SDL_power.h b/thirdparty/SDL/include/SDL_power.h index 1d75704c4..0520065ce 100644 --- a/thirdparty/SDL/include/SDL_power.h +++ b/thirdparty/SDL/include/SDL_power.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/include/SDL_quit.h b/thirdparty/SDL/include/SDL_quit.h index d8ceb8943..3f69dc9f2 100644 --- a/thirdparty/SDL/include/SDL_quit.h +++ b/thirdparty/SDL/include/SDL_quit.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/include/SDL_rect.h b/thirdparty/SDL/include/SDL_rect.h index 9611a311c..5ce1f0b45 100644 --- a/thirdparty/SDL/include/SDL_rect.h +++ b/thirdparty/SDL/include/SDL_rect.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/include/SDL_render.h b/thirdparty/SDL/include/SDL_render.h index 2d3f07366..b7135bb9d 100644 --- a/thirdparty/SDL/include/SDL_render.h +++ b/thirdparty/SDL/include/SDL_render.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -42,7 +42,7 @@ * of the many good 3D engines. * * These functions must be called from the main thread. - * See this bug for details: http://bugzilla.libsdl.org/show_bug.cgi?id=1995 + * See this bug for details: https://github.com/libsdl-org/SDL/issues/986 */ #ifndef SDL_render_h_ diff --git a/thirdparty/SDL/include/SDL_rwops.h b/thirdparty/SDL/include/SDL_rwops.h index 8615cb542..9dd99f92b 100644 --- a/thirdparty/SDL/include/SDL_rwops.h +++ b/thirdparty/SDL/include/SDL_rwops.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/include/SDL_scancode.h b/thirdparty/SDL/include/SDL_scancode.h index a960a7991..fe13d5b7a 100644 --- a/thirdparty/SDL/include/SDL_scancode.h +++ b/thirdparty/SDL/include/SDL_scancode.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/include/SDL_sensor.h b/thirdparty/SDL/include/SDL_sensor.h index 9ecce44b1..8b89ef6a5 100644 --- a/thirdparty/SDL/include/SDL_sensor.h +++ b/thirdparty/SDL/include/SDL_sensor.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/include/SDL_shape.h b/thirdparty/SDL/include/SDL_shape.h index f66babc01..4783cf290 100644 --- a/thirdparty/SDL/include/SDL_shape.h +++ b/thirdparty/SDL/include/SDL_shape.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/include/SDL_stdinc.h b/thirdparty/SDL/include/SDL_stdinc.h index 182ed86ee..8113f453f 100644 --- a/thirdparty/SDL/include/SDL_stdinc.h +++ b/thirdparty/SDL/include/SDL_stdinc.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -107,7 +107,7 @@ # elif defined(__MRC__) void *alloca(unsigned); # else -char *alloca(); +void *alloca(size_t); # endif #endif @@ -253,44 +253,44 @@ typedef uint64_t Uint64; * should define these but this is not true all platforms. * (for example win32) */ #ifndef SDL_PRIs64 -#ifdef PRIs64 -#define SDL_PRIs64 PRIs64 -#elif defined(__WIN32__) || defined(__GDK__) +#if defined(__WIN32__) || defined(__GDK__) #define SDL_PRIs64 "I64d" -#elif defined(__LINUX__) && defined(__LP64__) +#elif defined(PRIs64) +#define SDL_PRIs64 PRIs64 +#elif defined(__LP64__) && !defined(__APPLE__) #define SDL_PRIs64 "ld" #else #define SDL_PRIs64 "lld" #endif #endif #ifndef SDL_PRIu64 -#ifdef PRIu64 -#define SDL_PRIu64 PRIu64 -#elif defined(__WIN32__) || defined(__GDK__) +#if defined(__WIN32__) || defined(__GDK__) #define SDL_PRIu64 "I64u" -#elif defined(__LINUX__) && defined(__LP64__) +#elif defined(PRIu64) +#define SDL_PRIu64 PRIu64 +#elif defined(__LP64__) && !defined(__APPLE__) #define SDL_PRIu64 "lu" #else #define SDL_PRIu64 "llu" #endif #endif #ifndef SDL_PRIx64 -#ifdef PRIx64 -#define SDL_PRIx64 PRIx64 -#elif defined(__WIN32__) || defined(__GDK__) +#if defined(__WIN32__) || defined(__GDK__) #define SDL_PRIx64 "I64x" -#elif defined(__LINUX__) && defined(__LP64__) +#elif defined(PRIx64) +#define SDL_PRIx64 PRIx64 +#elif defined(__LP64__) && !defined(__APPLE__) #define SDL_PRIx64 "lx" #else #define SDL_PRIx64 "llx" #endif #endif #ifndef SDL_PRIX64 -#ifdef PRIX64 -#define SDL_PRIX64 PRIX64 -#elif defined(__WIN32__) || defined(__GDK__) +#if defined(__WIN32__) || defined(__GDK__) #define SDL_PRIX64 "I64X" -#elif defined(__LINUX__) && defined(__LP64__) +#elif defined(PRIX64) +#define SDL_PRIX64 PRIX64 +#elif defined(__LP64__) && !defined(__APPLE__) #define SDL_PRIX64 "lX" #else #define SDL_PRIX64 "llX" @@ -336,7 +336,9 @@ typedef uint64_t Uint64; #define SDL_PRINTF_FORMAT_STRING #define SDL_SCANF_FORMAT_STRING #define SDL_PRINTF_VARARG_FUNC( fmtargnumber ) +#define SDL_PRINTF_VARARG_FUNCV( fmtargnumber ) #define SDL_SCANF_VARARG_FUNC( fmtargnumber ) +#define SDL_SCANF_VARARG_FUNCV( fmtargnumber ) #else #if defined(_MSC_VER) && (_MSC_VER >= 1600) /* VS 2010 and above */ #include @@ -362,18 +364,25 @@ typedef uint64_t Uint64; #endif #if defined(__GNUC__) #define SDL_PRINTF_VARARG_FUNC( fmtargnumber ) __attribute__ (( format( __printf__, fmtargnumber, fmtargnumber+1 ))) +#define SDL_PRINTF_VARARG_FUNCV( fmtargnumber ) __attribute__(( format( __printf__, fmtargnumber, 0 ))) #define SDL_SCANF_VARARG_FUNC( fmtargnumber ) __attribute__ (( format( __scanf__, fmtargnumber, fmtargnumber+1 ))) +#define SDL_SCANF_VARARG_FUNCV( fmtargnumber ) __attribute__(( format( __scanf__, fmtargnumber, 0 ))) #else #define SDL_PRINTF_VARARG_FUNC( fmtargnumber ) +#define SDL_PRINTF_VARARG_FUNCV( fmtargnumber ) #define SDL_SCANF_VARARG_FUNC( fmtargnumber ) +#define SDL_SCANF_VARARG_FUNCV( fmtargnumber ) #endif #endif /* SDL_DISABLE_ANALYZE_MACROS */ #ifndef SDL_COMPILE_TIME_ASSERT #if defined(__cplusplus) +/* Keep C++ case alone: Some versions of gcc will define __STDC_VERSION__ even when compiling in C++ mode. */ #if (__cplusplus >= 201103L) #define SDL_COMPILE_TIME_ASSERT(name, x) static_assert(x, #x) #endif +#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 202311L) +#define SDL_COMPILE_TIME_ASSERT(name, x) static_assert(x, #x) #elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) #define SDL_COMPILE_TIME_ASSERT(name, x) _Static_assert(x, #x) #endif @@ -603,11 +612,11 @@ extern DECLSPEC int SDLCALL SDL_strcasecmp(const char *str1, const char *str2); extern DECLSPEC int SDLCALL SDL_strncasecmp(const char *str1, const char *str2, size_t len); extern DECLSPEC int SDLCALL SDL_sscanf(const char *text, SDL_SCANF_FORMAT_STRING const char *fmt, ...) SDL_SCANF_VARARG_FUNC(2); -extern DECLSPEC int SDLCALL SDL_vsscanf(const char *text, const char *fmt, va_list ap); +extern DECLSPEC int SDLCALL SDL_vsscanf(const char *text, SDL_SCANF_FORMAT_STRING const char *fmt, va_list ap) SDL_SCANF_VARARG_FUNCV(2); extern DECLSPEC int SDLCALL SDL_snprintf(SDL_OUT_Z_CAP(maxlen) char *text, size_t maxlen, SDL_PRINTF_FORMAT_STRING const char *fmt, ... ) SDL_PRINTF_VARARG_FUNC(3); -extern DECLSPEC int SDLCALL SDL_vsnprintf(SDL_OUT_Z_CAP(maxlen) char *text, size_t maxlen, const char *fmt, va_list ap); +extern DECLSPEC int SDLCALL SDL_vsnprintf(SDL_OUT_Z_CAP(maxlen) char *text, size_t maxlen, SDL_PRINTF_FORMAT_STRING const char *fmt, va_list ap) SDL_PRINTF_VARARG_FUNCV(3); extern DECLSPEC int SDLCALL SDL_asprintf(char **strp, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2); -extern DECLSPEC int SDLCALL SDL_vasprintf(char **strp, const char *fmt, va_list ap); +extern DECLSPEC int SDLCALL SDL_vasprintf(char **strp, SDL_PRINTF_FORMAT_STRING const char *fmt, va_list ap) SDL_PRINTF_VARARG_FUNCV(2); #ifndef HAVE_M_PI #ifndef M_PI @@ -688,8 +697,8 @@ extern DECLSPEC size_t SDLCALL SDL_iconv(SDL_iconv_t cd, const char **inbuf, size_t * outbytesleft); /** - * This function converts a buffer or string between encodings in one pass, returning a - * string that must be freed with SDL_free() or NULL on error. + * This function converts a buffer or string between encodings in one pass, + * returning a string that must be freed with SDL_free() or NULL on error. * * \since This function is available since SDL 2.0.0. */ @@ -698,8 +707,8 @@ extern DECLSPEC char *SDLCALL SDL_iconv_string(const char *tocode, const char *inbuf, size_t inbytesleft); #define SDL_iconv_utf8_locale(S) SDL_iconv_string("", "UTF-8", S, SDL_strlen(S)+1) -#define SDL_iconv_utf8_ucs2(S) (Uint16 *)SDL_iconv_string("UCS-2-INTERNAL", "UTF-8", S, SDL_strlen(S)+1) -#define SDL_iconv_utf8_ucs4(S) (Uint32 *)SDL_iconv_string("UCS-4-INTERNAL", "UTF-8", S, SDL_strlen(S)+1) +#define SDL_iconv_utf8_ucs2(S) (Uint16 *)SDL_iconv_string("UCS-2", "UTF-8", S, SDL_strlen(S)+1) +#define SDL_iconv_utf8_ucs4(S) (Uint32 *)SDL_iconv_string("UCS-4", "UTF-8", S, SDL_strlen(S)+1) #define SDL_iconv_wchar_utf8(S) SDL_iconv_string("UTF-8", "WCHAR_T", (char *)S, (SDL_wcslen(S)+1)*sizeof(wchar_t)) /* force builds using Clang's static analysis tools to use literal C runtime diff --git a/thirdparty/SDL/include/SDL_surface.h b/thirdparty/SDL/include/SDL_surface.h index d6ee615c5..ceeb86bd8 100644 --- a/thirdparty/SDL/include/SDL_surface.h +++ b/thirdparty/SDL/include/SDL_surface.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/include/SDL_system.h b/thirdparty/SDL/include/SDL_system.h index 4b7eaddcc..ddae4f8cc 100644 --- a/thirdparty/SDL/include/SDL_system.h +++ b/thirdparty/SDL/include/SDL_system.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -593,7 +593,8 @@ extern DECLSPEC void SDLCALL SDL_OnApplicationDidChangeStatusBarOrientation(void /* Functions used only by GDK */ #if defined(__GDK__) -typedef struct XTaskQueueObject * XTaskQueueHandle; +typedef struct XTaskQueueObject *XTaskQueueHandle; +typedef struct XUser *XUserHandle; /** * Gets a reference to the global async task queue handle for GDK, @@ -610,6 +611,20 @@ typedef struct XTaskQueueObject * XTaskQueueHandle; */ extern DECLSPEC int SDLCALL SDL_GDKGetTaskQueue(XTaskQueueHandle * outTaskQueue); +/** + * Gets a reference to the default user handle for GDK. + * + * This is effectively a synchronous version of XUserAddAsync, which always + * prefers the default user and allows a sign-in UI. + * + * \param outUserHandle a pointer to be filled in with the default user + * handle. + * \returns 0 if success, -1 if any error occurs. + * + * \since This function is available since SDL 2.28.0. + */ +extern DECLSPEC int SDLCALL SDL_GDKGetDefaultUser(XUserHandle * outUserHandle); + #endif /* Ends C function definitions when using C++ */ diff --git a/thirdparty/SDL/include/SDL_syswm.h b/thirdparty/SDL/include/SDL_syswm.h index b35734deb..7b8bd6ef9 100644 --- a/thirdparty/SDL/include/SDL_syswm.h +++ b/thirdparty/SDL/include/SDL_syswm.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/include/SDL_test.h b/thirdparty/SDL/include/SDL_test.h index 80daaafbd..e5acbee4e 100644 --- a/thirdparty/SDL/include/SDL_test.h +++ b/thirdparty/SDL/include/SDL_test.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/include/SDL_test_assert.h b/thirdparty/SDL/include/SDL_test_assert.h index 341e490fa..4f983350a 100644 --- a/thirdparty/SDL/include/SDL_test_assert.h +++ b/thirdparty/SDL/include/SDL_test_assert.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/include/SDL_test_common.h b/thirdparty/SDL/include/SDL_test_common.h index 6de63cad6..d977e463f 100644 --- a/thirdparty/SDL/include/SDL_test_common.h +++ b/thirdparty/SDL/include/SDL_test_common.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/include/SDL_test_compare.h b/thirdparty/SDL/include/SDL_test_compare.h index 5fce25ca1..61a38d090 100644 --- a/thirdparty/SDL/include/SDL_test_compare.h +++ b/thirdparty/SDL/include/SDL_test_compare.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/include/SDL_test_crc32.h b/thirdparty/SDL/include/SDL_test_crc32.h index bf3478210..e3478318d 100644 --- a/thirdparty/SDL/include/SDL_test_crc32.h +++ b/thirdparty/SDL/include/SDL_test_crc32.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/include/SDL_test_font.h b/thirdparty/SDL/include/SDL_test_font.h index 18a82ffc8..620c82116 100644 --- a/thirdparty/SDL/include/SDL_test_font.h +++ b/thirdparty/SDL/include/SDL_test_font.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/include/SDL_test_fuzzer.h b/thirdparty/SDL/include/SDL_test_fuzzer.h index cfe6a14f2..a847ccb01 100644 --- a/thirdparty/SDL/include/SDL_test_fuzzer.h +++ b/thirdparty/SDL/include/SDL_test_fuzzer.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/include/SDL_test_harness.h b/thirdparty/SDL/include/SDL_test_harness.h index 26231dcd6..bd9e4f8de 100644 --- a/thirdparty/SDL/include/SDL_test_harness.h +++ b/thirdparty/SDL/include/SDL_test_harness.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/include/SDL_test_images.h b/thirdparty/SDL/include/SDL_test_images.h index 121137175..b5bcb0a00 100644 --- a/thirdparty/SDL/include/SDL_test_images.h +++ b/thirdparty/SDL/include/SDL_test_images.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/include/SDL_test_log.h b/thirdparty/SDL/include/SDL_test_log.h index a27ffc209..ea9ae5e1c 100644 --- a/thirdparty/SDL/include/SDL_test_log.h +++ b/thirdparty/SDL/include/SDL_test_log.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/include/SDL_test_md5.h b/thirdparty/SDL/include/SDL_test_md5.h index 538c7ae3e..3764b0425 100644 --- a/thirdparty/SDL/include/SDL_test_md5.h +++ b/thirdparty/SDL/include/SDL_test_md5.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/include/SDL_test_memory.h b/thirdparty/SDL/include/SDL_test_memory.h index f959177d2..9bd143252 100644 --- a/thirdparty/SDL/include/SDL_test_memory.h +++ b/thirdparty/SDL/include/SDL_test_memory.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/include/SDL_test_random.h b/thirdparty/SDL/include/SDL_test_random.h index 0035a8030..344646aa8 100644 --- a/thirdparty/SDL/include/SDL_test_random.h +++ b/thirdparty/SDL/include/SDL_test_random.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/include/SDL_thread.h b/thirdparty/SDL/include/SDL_thread.h index b829bbad5..dc7f5363a 100644 --- a/thirdparty/SDL/include/SDL_thread.h +++ b/thirdparty/SDL/include/SDL_thread.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/include/SDL_timer.h b/thirdparty/SDL/include/SDL_timer.h index 98f9ad16c..8123e432f 100644 --- a/thirdparty/SDL/include/SDL_timer.h +++ b/thirdparty/SDL/include/SDL_timer.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/include/SDL_touch.h b/thirdparty/SDL/include/SDL_touch.h index c12d4a1c8..f6a5db413 100644 --- a/thirdparty/SDL/include/SDL_touch.h +++ b/thirdparty/SDL/include/SDL_touch.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/include/SDL_types.h b/thirdparty/SDL/include/SDL_types.h index b5d7192ff..e8d33c651 100644 --- a/thirdparty/SDL/include/SDL_types.h +++ b/thirdparty/SDL/include/SDL_types.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/include/SDL_version.h b/thirdparty/SDL/include/SDL_version.h index 7585eece5..517811f32 100644 --- a/thirdparty/SDL/include/SDL_version.h +++ b/thirdparty/SDL/include/SDL_version.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -58,8 +58,8 @@ typedef struct SDL_version /* Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL */ #define SDL_MAJOR_VERSION 2 -#define SDL_MINOR_VERSION 28 -#define SDL_PATCHLEVEL 5 +#define SDL_MINOR_VERSION 30 +#define SDL_PATCHLEVEL 7 /** * Macro to determine SDL version program was compiled against. diff --git a/thirdparty/SDL/include/SDL_video.h b/thirdparty/SDL/include/SDL_video.h index c8b2d7a0d..fa47d3099 100644 --- a/thirdparty/SDL/include/SDL_video.h +++ b/thirdparty/SDL/include/SDL_video.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -1278,7 +1278,8 @@ extern DECLSPEC int SDLCALL SDL_SetWindowFullscreen(SDL_Window * window, /** * Return whether the window has a surface associated with it. * - * \returns SDL_TRUE if there is a surface associated with the window, or SDL_FALSE otherwise. + * \returns SDL_TRUE if there is a surface associated with the window, or + * SDL_FALSE otherwise. * * \since This function is available since SDL 2.28.0. * @@ -1340,6 +1341,11 @@ extern DECLSPEC int SDLCALL SDL_UpdateWindowSurface(SDL_Window * window); * * This function is equivalent to the SDL 1.2 API SDL_UpdateRects(). * + * Note that this function will update _at least_ the rectangles specified, + * but this is only intended as an optimization; in practice, this might + * update more of the screen (or all of the screen!), depending on what + * method SDL uses to send pixels to the system. + * * \param window the window to update * \param rects an array of SDL_Rect structures representing areas of the * surface to copy, in pixels diff --git a/thirdparty/SDL/include/begin_code.h b/thirdparty/SDL/include/begin_code.h index 4142ffeba..a47a7d2b6 100644 --- a/thirdparty/SDL/include/begin_code.h +++ b/thirdparty/SDL/include/begin_code.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -36,6 +36,8 @@ #ifndef SDL_DEPRECATED # if defined(__GNUC__) && (__GNUC__ >= 4) /* technically, this arrived in gcc 3.1, but oh well. */ # define SDL_DEPRECATED __attribute__((deprecated)) +# elif defined(_MSC_VER) +# define SDL_DEPRECATED __declspec(deprecated) # else # define SDL_DEPRECATED # endif diff --git a/thirdparty/SDL/include/close_code.h b/thirdparty/SDL/include/close_code.h index b5ff3e204..50a0e6f3b 100644 --- a/thirdparty/SDL/include/close_code.h +++ b/thirdparty/SDL/include/close_code.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/include/dummy.go b/thirdparty/SDL/include/dummy.go index 41053ace0..3a5a69a0a 100644 --- a/thirdparty/SDL/include/dummy.go +++ b/thirdparty/SDL/include/dummy.go @@ -1,4 +1,3 @@ // +build required -// Package dummy prevents go tooling from stripping the c dependencies. package dummy diff --git a/thirdparty/SDL/sdl2.m4 b/thirdparty/SDL/sdl2.m4 index 75b60f6ea..274753b11 100644 --- a/thirdparty/SDL/sdl2.m4 +++ b/thirdparty/SDL/sdl2.m4 @@ -9,8 +9,9 @@ # * also look for SDL2.framework under Mac OS X # * removed HP/UX 9 support. # * updated for newer autoconf. +# * (v3) use $PKG_CONFIG for pkg-config cross-compiling support -# serial 2 +# serial 3 dnl AM_PATH_SDL2([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) dnl Test for SDL, and define SDL_CFLAGS and SDL_LIBS @@ -54,7 +55,7 @@ AC_ARG_VAR(SDL2_FRAMEWORK, [Path to SDL2.framework]) if test "x$sdl_pc" = xyes ; then no_sdl="" - SDL2_CONFIG="pkg-config sdl2" + SDL2_CONFIG="$PKG_CONFIG sdl2" else as_save_PATH="$PATH" if test "x$prefix" != xNONE && test "$cross_compiling" != yes; then diff --git a/thirdparty/SDL/src/SDL.c b/thirdparty/SDL/src/SDL.c index 56049adf0..2b2704cd2 100644 --- a/thirdparty/SDL/src/SDL.c +++ b/thirdparty/SDL/src/SDL.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -29,9 +29,6 @@ #endif #if defined(__OS2__) #include "core/os2/SDL_os2.h" -#if SDL_THREAD_OS2 -#include "thread/os2/SDL_systls_c.h" -#endif #endif /* this checks for HAVE_DBUS_DBUS_H internally. */ @@ -52,12 +49,13 @@ #include "haptic/SDL_haptic_c.h" #include "joystick/SDL_joystick_c.h" #include "sensor/SDL_sensor_c.h" +#include "thread/SDL_thread_c.h" /* Initialization/Cleanup routines */ -#if !SDL_TIMERS_DISABLED +#ifndef SDL_TIMERS_DISABLED #include "timer/SDL_timer_c.h" #endif -#if SDL_VIDEO_DRIVER_WINDOWS +#ifdef SDL_VIDEO_DRIVER_WINDOWS extern int SDL_HelperWindowCreate(void); extern int SDL_HelperWindowDestroy(void); #endif @@ -116,6 +114,7 @@ static SDL_bool SDL_MainIsReady = SDL_FALSE; #else static SDL_bool SDL_MainIsReady = SDL_TRUE; #endif +static SDL_bool SDL_main_thread_initialized = SDL_FALSE; static SDL_bool SDL_bInMainQuit = SDL_FALSE; static Uint8 SDL_SubsystemRefCount[32]; @@ -160,11 +159,57 @@ static SDL_bool SDL_PrivateShouldQuitSubsystem(Uint32 subsystem) return (((subsystem_index >= 0) && (SDL_SubsystemRefCount[subsystem_index] == 1)) || SDL_bInMainQuit) ? SDL_TRUE : SDL_FALSE; } +/* Private helper to either increment's existing ref counter, + * or fully init a new subsystem. */ +static SDL_bool SDL_PrivateInitOrIncrSubsystem(Uint32 subsystem) +{ + int subsystem_index = SDL_MostSignificantBitIndex32(subsystem); + SDL_assert((subsystem_index < 0) || (SDL_SubsystemRefCount[subsystem_index] < 255)); + if (subsystem_index < 0) { + return SDL_FALSE; + } + if (SDL_SubsystemRefCount[subsystem_index] > 0) { + ++SDL_SubsystemRefCount[subsystem_index]; + return SDL_TRUE; + } + return SDL_InitSubSystem(subsystem) == 0; +} + void SDL_SetMainReady(void) { SDL_MainIsReady = SDL_TRUE; } +void SDL_InitMainThread(void) +{ + if (SDL_main_thread_initialized) { + return; + } + + SDL_InitTLSData(); +#ifndef SDL_TIMERS_DISABLED + SDL_TicksInit(); +#endif + SDL_LogInit(); + + SDL_main_thread_initialized = SDL_TRUE; +} + +static void SDL_QuitMainThread(void) +{ + if (!SDL_main_thread_initialized) { + return; + } + + SDL_LogQuit(); +#ifndef SDL_TIMERS_DISABLED + SDL_TicksQuit(); +#endif + SDL_QuitTLSData(); + + SDL_main_thread_initialized = SDL_FALSE; +} + int SDL_InitSubSystem(Uint32 flags) { Uint32 flags_initialized = 0; @@ -173,30 +218,14 @@ int SDL_InitSubSystem(Uint32 flags) return SDL_SetError("Application didn't initialize properly, did you include SDL_main.h in the file containing your main() function?"); } - SDL_LogInit(); - /* Clear the error message */ SDL_ClearError(); -#if SDL_USE_LIBDBUS +#ifdef SDL_USE_LIBDBUS SDL_DBus_Init(); #endif - if (flags & SDL_INIT_GAMECONTROLLER) { - /* game controller implies joystick */ - flags |= SDL_INIT_JOYSTICK; - } - - if (flags & (SDL_INIT_VIDEO | SDL_INIT_JOYSTICK | SDL_INIT_AUDIO)) { - /* video or joystick or audio implies events */ - flags |= SDL_INIT_EVENTS; - } - -#if SDL_THREAD_OS2 - SDL_OS2TLSAlloc(); /* thread/os2/SDL_systls.c */ -#endif - -#if SDL_VIDEO_DRIVER_WINDOWS +#ifdef SDL_VIDEO_DRIVER_WINDOWS if (flags & (SDL_INIT_HAPTIC | SDL_INIT_JOYSTICK)) { if (SDL_HelperWindowCreate() < 0) { goto quit_and_error; @@ -204,13 +233,9 @@ int SDL_InitSubSystem(Uint32 flags) } #endif -#if !SDL_TIMERS_DISABLED - SDL_TicksInit(); -#endif - /* Initialize the event subsystem */ if (flags & SDL_INIT_EVENTS) { -#if !SDL_EVENTS_DISABLED +#ifndef SDL_EVENTS_DISABLED if (SDL_PrivateShouldInitSubsystem(SDL_INIT_EVENTS)) { if (SDL_EventsInit() < 0) { goto quit_and_error; @@ -226,7 +251,7 @@ int SDL_InitSubSystem(Uint32 flags) /* Initialize the timer subsystem */ if (flags & SDL_INIT_TIMER) { -#if !SDL_TIMERS_DISABLED && !SDL_TIMER_DUMMY +#if !defined(SDL_TIMERS_DISABLED) && !defined(SDL_TIMER_DUMMY) if (SDL_PrivateShouldInitSubsystem(SDL_INIT_TIMER)) { if (SDL_TimerInit() < 0) { goto quit_and_error; @@ -242,8 +267,13 @@ int SDL_InitSubSystem(Uint32 flags) /* Initialize the video subsystem */ if (flags & SDL_INIT_VIDEO) { -#if !SDL_VIDEO_DISABLED +#ifndef SDL_VIDEO_DISABLED if (SDL_PrivateShouldInitSubsystem(SDL_INIT_VIDEO)) { + /* video implies events */ + if (!SDL_PrivateInitOrIncrSubsystem(SDL_INIT_EVENTS)) { + goto quit_and_error; + } + if (SDL_VideoInit(NULL) < 0) { goto quit_and_error; } @@ -258,8 +288,13 @@ int SDL_InitSubSystem(Uint32 flags) /* Initialize the audio subsystem */ if (flags & SDL_INIT_AUDIO) { -#if !SDL_AUDIO_DISABLED +#ifndef SDL_AUDIO_DISABLED if (SDL_PrivateShouldInitSubsystem(SDL_INIT_AUDIO)) { + /* audio implies events */ + if (!SDL_PrivateInitOrIncrSubsystem(SDL_INIT_EVENTS)) { + goto quit_and_error; + } + if (SDL_AudioInit(NULL) < 0) { goto quit_and_error; } @@ -274,8 +309,13 @@ int SDL_InitSubSystem(Uint32 flags) /* Initialize the joystick subsystem */ if (flags & SDL_INIT_JOYSTICK) { -#if !SDL_JOYSTICK_DISABLED +#ifndef SDL_JOYSTICK_DISABLED if (SDL_PrivateShouldInitSubsystem(SDL_INIT_JOYSTICK)) { + /* joystick implies events */ + if (!SDL_PrivateInitOrIncrSubsystem(SDL_INIT_EVENTS)) { + goto quit_and_error; + } + if (SDL_JoystickInit() < 0) { goto quit_and_error; } @@ -289,8 +329,13 @@ int SDL_InitSubSystem(Uint32 flags) } if (flags & SDL_INIT_GAMECONTROLLER) { -#if !SDL_JOYSTICK_DISABLED +#ifndef SDL_JOYSTICK_DISABLED if (SDL_PrivateShouldInitSubsystem(SDL_INIT_GAMECONTROLLER)) { + /* game controller implies joystick */ + if (!SDL_PrivateInitOrIncrSubsystem(SDL_INIT_JOYSTICK)) { + goto quit_and_error; + } + if (SDL_GameControllerInit() < 0) { goto quit_and_error; } @@ -305,7 +350,7 @@ int SDL_InitSubSystem(Uint32 flags) /* Initialize the haptic subsystem */ if (flags & SDL_INIT_HAPTIC) { -#if !SDL_HAPTIC_DISABLED +#ifndef SDL_HAPTIC_DISABLED if (SDL_PrivateShouldInitSubsystem(SDL_INIT_HAPTIC)) { if (SDL_HapticInit() < 0) { goto quit_and_error; @@ -321,7 +366,7 @@ int SDL_InitSubSystem(Uint32 flags) /* Initialize the sensor subsystem */ if (flags & SDL_INIT_SENSOR) { -#if !SDL_SENSOR_DISABLED +#ifndef SDL_SENSOR_DISABLED if (SDL_PrivateShouldInitSubsystem(SDL_INIT_SENSOR)) { if (SDL_SensorInit() < 0) { goto quit_and_error; @@ -352,14 +397,11 @@ int SDL_Init(Uint32 flags) void SDL_QuitSubSystem(Uint32 flags) { #if defined(__OS2__) -#if SDL_THREAD_OS2 - SDL_OS2TLSFree(); /* thread/os2/SDL_systls.c */ -#endif SDL_OS2Quit(); #endif /* Shut down requested initialized subsystems */ -#if !SDL_SENSOR_DISABLED +#ifndef SDL_SENSOR_DISABLED if (flags & SDL_INIT_SENSOR) { if (SDL_PrivateShouldQuitSubsystem(SDL_INIT_SENSOR)) { SDL_SensorQuit(); @@ -368,29 +410,27 @@ void SDL_QuitSubSystem(Uint32 flags) } #endif -#if !SDL_JOYSTICK_DISABLED +#ifndef SDL_JOYSTICK_DISABLED if (flags & SDL_INIT_GAMECONTROLLER) { - /* game controller implies joystick */ - flags |= SDL_INIT_JOYSTICK; - if (SDL_PrivateShouldQuitSubsystem(SDL_INIT_GAMECONTROLLER)) { SDL_GameControllerQuit(); + /* game controller implies joystick */ + SDL_QuitSubSystem(SDL_INIT_JOYSTICK); } SDL_PrivateSubsystemRefCountDecr(SDL_INIT_GAMECONTROLLER); } if (flags & SDL_INIT_JOYSTICK) { - /* joystick implies events */ - flags |= SDL_INIT_EVENTS; - if (SDL_PrivateShouldQuitSubsystem(SDL_INIT_JOYSTICK)) { SDL_JoystickQuit(); + /* joystick implies events */ + SDL_QuitSubSystem(SDL_INIT_EVENTS); } SDL_PrivateSubsystemRefCountDecr(SDL_INIT_JOYSTICK); } #endif -#if !SDL_HAPTIC_DISABLED +#ifndef SDL_HAPTIC_DISABLED if (flags & SDL_INIT_HAPTIC) { if (SDL_PrivateShouldQuitSubsystem(SDL_INIT_HAPTIC)) { SDL_HapticQuit(); @@ -399,31 +439,29 @@ void SDL_QuitSubSystem(Uint32 flags) } #endif -#if !SDL_AUDIO_DISABLED +#ifndef SDL_AUDIO_DISABLED if (flags & SDL_INIT_AUDIO) { - /* audio implies events */ - flags |= SDL_INIT_EVENTS; - if (SDL_PrivateShouldQuitSubsystem(SDL_INIT_AUDIO)) { SDL_AudioQuit(); + /* audio implies events */ + SDL_QuitSubSystem(SDL_INIT_EVENTS); } SDL_PrivateSubsystemRefCountDecr(SDL_INIT_AUDIO); } #endif -#if !SDL_VIDEO_DISABLED +#ifndef SDL_VIDEO_DISABLED if (flags & SDL_INIT_VIDEO) { - /* video implies events */ - flags |= SDL_INIT_EVENTS; - if (SDL_PrivateShouldQuitSubsystem(SDL_INIT_VIDEO)) { SDL_VideoQuit(); + /* video implies events */ + SDL_QuitSubSystem(SDL_INIT_EVENTS); } SDL_PrivateSubsystemRefCountDecr(SDL_INIT_VIDEO); } #endif -#if !SDL_TIMERS_DISABLED && !SDL_TIMER_DUMMY +#if !defined(SDL_TIMERS_DISABLED) && !defined(SDL_TIMER_DUMMY) if (flags & SDL_INIT_TIMER) { if (SDL_PrivateShouldQuitSubsystem(SDL_INIT_TIMER)) { SDL_TimerQuit(); @@ -432,7 +470,7 @@ void SDL_QuitSubSystem(Uint32 flags) } #endif -#if !SDL_EVENTS_DISABLED +#ifndef SDL_EVENTS_DISABLED if (flags & SDL_INIT_EVENTS) { if (SDL_PrivateShouldQuitSubsystem(SDL_INIT_EVENTS)) { SDL_EventsQuit(); @@ -477,30 +515,24 @@ void SDL_Quit(void) SDL_bInMainQuit = SDL_TRUE; /* Quit all subsystems */ -#if SDL_VIDEO_DRIVER_WINDOWS +#ifdef SDL_VIDEO_DRIVER_WINDOWS SDL_HelperWindowDestroy(); #endif SDL_QuitSubSystem(SDL_INIT_EVERYTHING); -#if !SDL_TIMERS_DISABLED - SDL_TicksQuit(); +#ifdef SDL_USE_LIBDBUS + SDL_DBus_Quit(); #endif SDL_ClearHints(); SDL_AssertionsQuit(); -#if SDL_USE_LIBDBUS - SDL_DBus_Quit(); -#endif - - SDL_LogQuit(); - /* Now that every subsystem has been quit, we reset the subsystem refcount * and the list of initialized subsystems. */ SDL_memset(SDL_SubsystemRefCount, 0x0, sizeof(SDL_SubsystemRefCount)); - SDL_TLSCleanup(); + SDL_QuitMainThread(); SDL_bInMainQuit = SDL_FALSE; } @@ -511,7 +543,7 @@ void SDL_GetVersion(SDL_version *ver) static SDL_bool check_hint = SDL_TRUE; static SDL_bool legacy_version = SDL_FALSE; - if (ver == NULL) { + if (!ver) { return; } @@ -544,71 +576,71 @@ int SDL_GetRevisionNumber(void) /* Get the name of the platform */ const char *SDL_GetPlatform(void) { -#if __AIX__ +#if defined(__AIX__) return "AIX"; -#elif __ANDROID__ +#elif defined(__ANDROID__) return "Android"; -#elif __BSDI__ +#elif defined(__BSDI__) return "BSDI"; -#elif __DREAMCAST__ +#elif defined(__DREAMCAST__) return "Dreamcast"; -#elif __EMSCRIPTEN__ +#elif defined(__EMSCRIPTEN__) return "Emscripten"; -#elif __FREEBSD__ +#elif defined(__FREEBSD__) return "FreeBSD"; -#elif __HAIKU__ +#elif defined(__HAIKU__) return "Haiku"; -#elif __HPUX__ +#elif defined(__HPUX__) return "HP-UX"; -#elif __IRIX__ +#elif defined(__IRIX__) return "Irix"; -#elif __LINUX__ +#elif defined(__LINUX__) return "Linux"; -#elif __MINT__ +#elif defined(__MINT__) return "Atari MiNT"; -#elif __MACOS__ +#elif defined(__MACOS__) return "MacOS Classic"; -#elif __MACOSX__ +#elif defined(__MACOSX__) return "Mac OS X"; -#elif __NACL__ +#elif defined(__NACL__) return "NaCl"; -#elif __NETBSD__ +#elif defined(__NETBSD__) return "NetBSD"; -#elif __OPENBSD__ +#elif defined(__OPENBSD__) return "OpenBSD"; -#elif __OS2__ +#elif defined(__OS2__) return "OS/2"; -#elif __OSF__ +#elif defined(__OSF__) return "OSF/1"; -#elif __QNXNTO__ +#elif defined(__QNXNTO__) return "QNX Neutrino"; -#elif __RISCOS__ +#elif defined(__RISCOS__) return "RISC OS"; -#elif __SOLARIS__ +#elif defined(__SOLARIS__) return "Solaris"; -#elif __WIN32__ +#elif defined(__WIN32__) return "Windows"; -#elif __WINRT__ +#elif defined(__WINRT__) return "WinRT"; -#elif __WINGDK__ +#elif defined(__WINGDK__) return "WinGDK"; -#elif __XBOXONE__ +#elif defined(__XBOXONE__) return "Xbox One"; -#elif __XBOXSERIES__ +#elif defined(__XBOXSERIES__) return "Xbox Series X|S"; -#elif __TVOS__ +#elif defined(__TVOS__) return "tvOS"; -#elif __IPHONEOS__ +#elif defined(__IPHONEOS__) return "iOS"; -#elif __PS2__ +#elif defined(__PS2__) return "PlayStation 2"; -#elif __PSP__ +#elif defined(__PSP__) return "PlayStation Portable"; -#elif __VITA__ +#elif defined(__VITA__) return "PlayStation Vita"; -#elif __NGAGE__ +#elif defined(__NGAGE__) return "Nokia N-Gage"; -#elif __3DS__ +#elif defined(__3DS__) return "Nintendo 3DS"; #else return "Unknown (see SDL_platform.h)"; @@ -617,10 +649,10 @@ const char *SDL_GetPlatform(void) SDL_bool SDL_IsTablet(void) { -#if __ANDROID__ +#if defined(__ANDROID__) extern SDL_bool SDL_IsAndroidTablet(void); return SDL_IsAndroidTablet(); -#elif __IPHONEOS__ +#elif defined(__IPHONEOS__) extern SDL_bool SDL_IsIPad(void); return SDL_IsIPad(); #else diff --git a/thirdparty/SDL/src/SDL_assert.c b/thirdparty/SDL/src/SDL_assert.c index fe7619be1..1ca41e76f 100644 --- a/thirdparty/SDL/src/SDL_assert.c +++ b/thirdparty/SDL/src/SDL_assert.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -114,11 +114,11 @@ static void SDL_GenerateAssertionReport(void) const SDL_assert_data *item = triggered_assertions; /* only do this if the app hasn't assigned an assertion handler. */ - if ((item != NULL) && (assertion_handler != SDL_PromptAssertion)) { + if ((item) && (assertion_handler != SDL_PromptAssertion)) { debug_print("\n\nSDL assertion report.\n"); debug_print("All SDL assertions between last init/quit:\n\n"); - while (item != NULL) { + while (item) { debug_print( "'%s'\n" " * %s (%s:%d)\n" @@ -206,7 +206,7 @@ static SDL_assert_state SDLCALL SDL_PromptAssertion(const SDL_assert_data *data, /* let env. variable override, so unit tests won't block in a GUI. */ envr = SDL_getenv("SDL_ASSERT"); - if (envr != NULL) { + if (envr) { if (message != stack_buf) { SDL_free(message); } @@ -342,9 +342,9 @@ SDL_assert_state SDL_ReportAssertion(SDL_assert_data *data, const char *func, co #ifndef SDL_THREADS_DISABLED static SDL_SpinLock spinlock = 0; SDL_AtomicLock(&spinlock); - if (assertion_mutex == NULL) { /* never called SDL_Init()? */ + if (!assertion_mutex) { /* never called SDL_Init()? */ assertion_mutex = SDL_CreateMutex(); - if (assertion_mutex == NULL) { + if (!assertion_mutex) { SDL_AtomicUnlock(&spinlock); return SDL_ASSERTION_IGNORE; /* oh well, I guess. */ } @@ -409,7 +409,7 @@ void SDL_AssertionsQuit(void) #if SDL_ASSERT_LEVEL > 0 SDL_GenerateAssertionReport(); #ifndef SDL_THREADS_DISABLED - if (assertion_mutex != NULL) { + if (assertion_mutex) { SDL_DestroyMutex(assertion_mutex); assertion_mutex = NULL; } @@ -437,7 +437,7 @@ void SDL_ResetAssertionReport(void) { SDL_assert_data *next = NULL; SDL_assert_data *item; - for (item = triggered_assertions; item != NULL; item = next) { + for (item = triggered_assertions; item; item = next) { next = (SDL_assert_data *)item->next; item->always_ignore = SDL_FALSE; item->trigger_count = 0; @@ -454,7 +454,7 @@ SDL_AssertionHandler SDL_GetDefaultAssertionHandler(void) SDL_AssertionHandler SDL_GetAssertionHandler(void **userdata) { - if (userdata != NULL) { + if (userdata) { *userdata = assertion_userdata; } return assertion_handler; diff --git a/thirdparty/SDL/src/SDL_assert_c.h b/thirdparty/SDL/src/SDL_assert_c.h index 246a946e5..330acb87c 100644 --- a/thirdparty/SDL/src/SDL_assert_c.h +++ b/thirdparty/SDL/src/SDL_assert_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/SDL_dataqueue.c b/thirdparty/SDL/src/SDL_dataqueue.c index 2019c3083..e32ba3199 100644 --- a/thirdparty/SDL/src/SDL_dataqueue.c +++ b/thirdparty/SDL/src/SDL_dataqueue.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -54,7 +54,7 @@ SDL_DataQueue *SDL_NewDataQueue(const size_t _packetlen, const size_t initialsla { SDL_DataQueue *queue = (SDL_DataQueue *)SDL_calloc(1, sizeof(SDL_DataQueue)); - if (queue == NULL) { + if (!queue) { SDL_OutOfMemory(); } else { const size_t packetlen = _packetlen ? _packetlen : 1024; @@ -101,7 +101,7 @@ void SDL_ClearDataQueue(SDL_DataQueue *queue, const size_t slack) SDL_DataQueuePacket *prev = NULL; size_t i; - if (queue == NULL) { + if (!queue) { return; } @@ -147,13 +147,13 @@ static SDL_DataQueuePacket *AllocateDataQueuePacket(SDL_DataQueue *queue) SDL_assert(queue != NULL); packet = queue->pool; - if (packet != NULL) { + if (packet) { /* we have one available in the pool. */ queue->pool = packet->next; } else { /* Have to allocate a new one! */ packet = (SDL_DataQueuePacket *)SDL_malloc(sizeof(SDL_DataQueuePacket) + queue->packet_size); - if (packet == NULL) { + if (!packet) { return NULL; } } @@ -163,7 +163,7 @@ static SDL_DataQueuePacket *AllocateDataQueuePacket(SDL_DataQueue *queue) packet->next = NULL; SDL_assert((queue->head != NULL) == (queue->queued_bytes != 0)); - if (queue->tail == NULL) { + if (!queue->tail) { queue->head = packet; } else { queue->tail->next = packet; @@ -182,7 +182,7 @@ int SDL_WriteToDataQueue(SDL_DataQueue *queue, const void *_data, const size_t _ size_t origlen; size_t datalen; - if (queue == NULL) { + if (!queue) { return SDL_InvalidParamError("queue"); } @@ -195,12 +195,12 @@ int SDL_WriteToDataQueue(SDL_DataQueue *queue, const void *_data, const size_t _ while (len > 0) { SDL_DataQueuePacket *packet = queue->tail; SDL_assert(packet == NULL || (packet->datalen <= packet_size)); - if (packet == NULL || (packet->datalen >= packet_size)) { + if (!packet || (packet->datalen >= packet_size)) { /* tail packet missing or completely full; we need a new packet. */ packet = AllocateDataQueuePacket(queue); - if (packet == NULL) { + if (!packet) { /* uhoh, reset so we've queued nothing new, free what we can. */ - if (origtail == NULL) { + if (!origtail) { packet = queue->head; /* whole queue. */ } else { packet = origtail->next; /* what we added to existing queue. */ @@ -238,7 +238,7 @@ SDL_PeekIntoDataQueue(SDL_DataQueue *queue, void *_buf, const size_t _len) Uint8 *ptr = buf; SDL_DataQueuePacket *packet; - if (queue == NULL) { + if (!queue) { return 0; } @@ -267,7 +267,7 @@ SDL_ReadFromDataQueue(SDL_DataQueue *queue, void *_buf, const size_t _len) Uint8 *ptr = buf; SDL_DataQueuePacket *packet; - if (queue == NULL) { + if (!queue) { return 0; } @@ -294,7 +294,7 @@ SDL_ReadFromDataQueue(SDL_DataQueue *queue, void *_buf, const size_t _len) SDL_assert((queue->head != NULL) == (queue->queued_bytes != 0)); - if (queue->head == NULL) { + if (!queue->head) { queue->tail = NULL; /* in case we drained the queue entirely. */ } diff --git a/thirdparty/SDL/src/SDL_dataqueue.h b/thirdparty/SDL/src/SDL_dataqueue.h index aee2cda62..972a52138 100644 --- a/thirdparty/SDL/src/SDL_dataqueue.h +++ b/thirdparty/SDL/src/SDL_dataqueue.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/SDL_error.c b/thirdparty/SDL/src/SDL_error.c index 501d39584..d5c45fb6c 100644 --- a/thirdparty/SDL/src/SDL_error.c +++ b/thirdparty/SDL/src/SDL_error.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -28,7 +28,7 @@ int SDL_SetError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) { /* Ignore call if invalid format pointer was passed */ - if (fmt != NULL) { + if (fmt) { va_list ap; int result; SDL_error *error = SDL_GetErrBuf(); diff --git a/thirdparty/SDL/src/SDL_error_c.h b/thirdparty/SDL/src/SDL_error_c.h index be6f8ac8e..1aae3be71 100644 --- a/thirdparty/SDL/src/SDL_error_c.h +++ b/thirdparty/SDL/src/SDL_error_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/SDL_guid.c b/thirdparty/SDL/src/SDL_guid.c index f8c4c6008..2f91edb18 100644 --- a/thirdparty/SDL/src/SDL_guid.c +++ b/thirdparty/SDL/src/SDL_guid.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -29,7 +29,7 @@ void SDL_GUIDToString(SDL_GUID guid, char *pszGUID, int cbGUID) static const char k_rgchHexToASCII[] = "0123456789abcdef"; int i; - if ((pszGUID == NULL) || (cbGUID <= 0)) { + if ((!pszGUID) || (cbGUID <= 0)) { return; } diff --git a/thirdparty/SDL/src/SDL_hints.c b/thirdparty/SDL/src/SDL_hints.c index ceec0d5fb..2455cc13a 100644 --- a/thirdparty/SDL/src/SDL_hints.c +++ b/thirdparty/SDL/src/SDL_hints.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -51,7 +51,7 @@ SDL_bool SDL_SetHintWithPriority(const char *name, const char *value, SDL_HintPr SDL_Hint *hint; SDL_HintWatch *entry; - if (name == NULL) { + if (!name) { return SDL_FALSE; } @@ -66,7 +66,7 @@ SDL_bool SDL_SetHintWithPriority(const char *name, const char *value, SDL_HintPr return SDL_FALSE; } if (hint->value != value && - (value == NULL || !hint->value || SDL_strcmp(hint->value, value) != 0)) { + (!value || !hint->value || SDL_strcmp(hint->value, value) != 0)) { for (entry = hint->callbacks; entry;) { /* Save the next entry in case this one is deleted */ SDL_HintWatch *next = entry->next; @@ -83,7 +83,7 @@ SDL_bool SDL_SetHintWithPriority(const char *name, const char *value, SDL_HintPr /* Couldn't find the hint, add a new one */ hint = (SDL_Hint *)SDL_malloc(sizeof(*hint)); - if (hint == NULL) { + if (!hint) { return SDL_FALSE; } hint->name = SDL_strdup(name); @@ -101,16 +101,16 @@ SDL_bool SDL_ResetHint(const char *name) SDL_Hint *hint; SDL_HintWatch *entry; - if (name == NULL) { + if (!name) { return SDL_FALSE; } env = SDL_getenv(name); for (hint = SDL_hints; hint; hint = hint->next) { if (SDL_strcmp(name, hint->name) == 0) { - if ((env == NULL && hint->value != NULL) || - (env != NULL && hint->value == NULL) || - (env != NULL && SDL_strcmp(env, hint->value) != 0)) { + if ((!env && hint->value) || + (env && !hint->value) || + (env && SDL_strcmp(env, hint->value) != 0)) { for (entry = hint->callbacks; entry;) { /* Save the next entry in case this one is deleted */ SDL_HintWatch *next = entry->next; @@ -135,9 +135,9 @@ void SDL_ResetHints(void) for (hint = SDL_hints; hint; hint = hint->next) { env = SDL_getenv(hint->name); - if ((env == NULL && hint->value != NULL) || - (env != NULL && hint->value == NULL) || - (env != NULL && SDL_strcmp(env, hint->value) != 0)) { + if ((!env && hint->value) || + (env && !hint->value) || + (env && SDL_strcmp(env, hint->value) != 0)) { for (entry = hint->callbacks; entry;) { /* Save the next entry in case this one is deleted */ SDL_HintWatch *next = entry->next; @@ -161,10 +161,14 @@ const char *SDL_GetHint(const char *name) const char *env; SDL_Hint *hint; + if (!name) { + return NULL; + } + env = SDL_getenv(name); for (hint = SDL_hints; hint; hint = hint->next) { if (SDL_strcmp(name, hint->name) == 0) { - if (env == NULL || hint->priority == SDL_HINT_OVERRIDE) { + if (!env || hint->priority == SDL_HINT_OVERRIDE) { return hint->value; } break; @@ -175,7 +179,7 @@ const char *SDL_GetHint(const char *name) SDL_bool SDL_GetStringBoolean(const char *value, SDL_bool default_value) { - if (value == NULL || !*value) { + if (!value || !*value) { return default_value; } if (*value == '0' || SDL_strcasecmp(value, "false") == 0) { @@ -196,7 +200,7 @@ void SDL_AddHintCallback(const char *name, SDL_HintCallback callback, void *user SDL_HintWatch *entry; const char *value; - if (name == NULL || !*name) { + if (!name || !*name) { SDL_InvalidParamError("name"); return; } @@ -208,7 +212,7 @@ void SDL_AddHintCallback(const char *name, SDL_HintCallback callback, void *user SDL_DelHintCallback(name, callback, userdata); entry = (SDL_HintWatch *)SDL_malloc(sizeof(*entry)); - if (entry == NULL) { + if (!entry) { SDL_OutOfMemory(); return; } @@ -220,10 +224,10 @@ void SDL_AddHintCallback(const char *name, SDL_HintCallback callback, void *user break; } } - if (hint == NULL) { + if (!hint) { /* Need to add a hint entry for this watcher */ hint = (SDL_Hint *)SDL_malloc(sizeof(*hint)); - if (hint == NULL) { + if (!hint) { SDL_OutOfMemory(); SDL_free(entry); return; diff --git a/thirdparty/SDL/src/SDL_hints_c.h b/thirdparty/SDL/src/SDL_hints_c.h index a17968123..8af9fc538 100644 --- a/thirdparty/SDL/src/SDL_hints_c.h +++ b/thirdparty/SDL/src/SDL_hints_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/SDL_internal.h b/thirdparty/SDL/src/SDL_internal.h index 2514eeda8..511c65240 100644 --- a/thirdparty/SDL/src/SDL_internal.h +++ b/thirdparty/SDL/src/SDL_internal.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -125,9 +125,91 @@ #define SDL_HAVE_YUV !SDL_LEAN_AND_MEAN #endif +#ifndef SDL_RENDER_DISABLED +/* define the not defined ones as 0 */ +#ifndef SDL_VIDEO_RENDER_D3D +#define SDL_VIDEO_RENDER_D3D 0 +#endif +#ifndef SDL_VIDEO_RENDER_D3D11 +#define SDL_VIDEO_RENDER_D3D11 0 +#endif +#ifndef SDL_VIDEO_RENDER_D3D12 +#define SDL_VIDEO_RENDER_D3D12 0 +#endif +#ifndef SDL_VIDEO_RENDER_METAL +#define SDL_VIDEO_RENDER_METAL 0 +#endif +#ifndef SDL_VIDEO_RENDER_OGL +#define SDL_VIDEO_RENDER_OGL 0 +#endif +#ifndef SDL_VIDEO_RENDER_OGL_ES +#define SDL_VIDEO_RENDER_OGL_ES 0 +#endif +#ifndef SDL_VIDEO_RENDER_OGL_ES2 +#define SDL_VIDEO_RENDER_OGL_ES2 0 +#endif +#ifndef SDL_VIDEO_RENDER_DIRECTFB +#define SDL_VIDEO_RENDER_DIRECTFB 0 +#endif +#ifndef SDL_VIDEO_RENDER_PS2 +#define SDL_VIDEO_RENDER_PS2 0 +#endif +#ifndef SDL_VIDEO_RENDER_PSP +#define SDL_VIDEO_RENDER_PSP 0 +#endif +#ifndef SDL_VIDEO_RENDER_VITA_GXM +#define SDL_VIDEO_RENDER_VITA_GXM 0 +#endif +#else /* define all as 0 */ +#undef SDL_VIDEO_RENDER_SW +#define SDL_VIDEO_RENDER_SW 0 +#undef SDL_VIDEO_RENDER_D3D +#define SDL_VIDEO_RENDER_D3D 0 +#undef SDL_VIDEO_RENDER_D3D11 +#define SDL_VIDEO_RENDER_D3D11 0 +#undef SDL_VIDEO_RENDER_D3D12 +#define SDL_VIDEO_RENDER_D3D12 0 +#undef SDL_VIDEO_RENDER_METAL +#define SDL_VIDEO_RENDER_METAL 0 +#undef SDL_VIDEO_RENDER_OGL +#define SDL_VIDEO_RENDER_OGL 0 +#undef SDL_VIDEO_RENDER_OGL_ES +#define SDL_VIDEO_RENDER_OGL_ES 0 +#undef SDL_VIDEO_RENDER_OGL_ES2 +#define SDL_VIDEO_RENDER_OGL_ES2 0 +#undef SDL_VIDEO_RENDER_DIRECTFB +#define SDL_VIDEO_RENDER_DIRECTFB 0 +#undef SDL_VIDEO_RENDER_PS2 +#define SDL_VIDEO_RENDER_PS2 0 +#undef SDL_VIDEO_RENDER_PSP +#define SDL_VIDEO_RENDER_PSP 0 +#undef SDL_VIDEO_RENDER_VITA_GXM +#define SDL_VIDEO_RENDER_VITA_GXM 0 +#endif /* SDL_RENDER_DISABLED */ + +#define SDL_HAS_RENDER_DRIVER \ + (SDL_VIDEO_RENDER_SW | \ + SDL_VIDEO_RENDER_D3D | \ + SDL_VIDEO_RENDER_D3D11 | \ + SDL_VIDEO_RENDER_D3D12 | \ + SDL_VIDEO_RENDER_METAL | \ + SDL_VIDEO_RENDER_OGL | \ + SDL_VIDEO_RENDER_OGL_ES | \ + SDL_VIDEO_RENDER_OGL_ES2 | \ + SDL_VIDEO_RENDER_DIRECTFB | \ + SDL_VIDEO_RENDER_PS2 | \ + SDL_VIDEO_RENDER_PSP | \ + SDL_VIDEO_RENDER_VITA_GXM) + +#if !defined(SDL_RENDER_DISABLED) && !SDL_HAS_RENDER_DRIVER +#error SDL_RENDER enabled without any backend drivers. +#endif + #include "SDL_assert.h" #include "SDL_log.h" +extern void SDL_InitMainThread(void); + #endif /* SDL_internal_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/thirdparty/SDL/src/SDL_list.c b/thirdparty/SDL/src/SDL_list.c index b08919642..b7f45de44 100644 --- a/thirdparty/SDL/src/SDL_list.c +++ b/thirdparty/SDL/src/SDL_list.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -28,7 +28,7 @@ int SDL_ListAdd(SDL_ListNode **head, void *ent) { SDL_ListNode *node = SDL_malloc(sizeof(*node)); - if (node == NULL) { + if (!node) { return SDL_OutOfMemory(); } @@ -44,7 +44,7 @@ void SDL_ListPop(SDL_ListNode **head, void **ent) SDL_ListNode **ptr = head; /* Invalid or empty */ - if (head == NULL || *head == NULL) { + if (!head || !*head) { return; } diff --git a/thirdparty/SDL/src/SDL_list.h b/thirdparty/SDL/src/SDL_list.h index f1ee7ffa6..f855e9bd7 100644 --- a/thirdparty/SDL/src/SDL_list.h +++ b/thirdparty/SDL/src/SDL_list.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/SDL_log.c b/thirdparty/SDL/src/SDL_log.c index ab6e7c2cb..9e324e3dd 100644 --- a/thirdparty/SDL/src/SDL_log.c +++ b/thirdparty/SDL/src/SDL_log.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -28,10 +28,11 @@ #include "SDL_error.h" #include "SDL_log.h" +#include "SDL_hints.h" #include "SDL_mutex.h" #include "SDL_log_c.h" -#if HAVE_STDIO_H +#ifdef HAVE_STDIO_H #include #endif @@ -44,10 +45,7 @@ /* The size of the stack buffer to use for rendering log messages. */ #define SDL_MAX_LOG_MESSAGE_STACK 256 -#define DEFAULT_PRIORITY SDL_LOG_PRIORITY_CRITICAL -#define DEFAULT_ASSERT_PRIORITY SDL_LOG_PRIORITY_WARN -#define DEFAULT_APPLICATION_PRIORITY SDL_LOG_PRIORITY_INFO -#define DEFAULT_TEST_PRIORITY SDL_LOG_PRIORITY_VERBOSE +#define DEFAULT_CATEGORY -1 typedef struct SDL_LogLevel { @@ -60,15 +58,14 @@ typedef struct SDL_LogLevel static void SDLCALL SDL_LogOutput(void *userdata, int category, SDL_LogPriority priority, const char *message); static SDL_LogLevel *SDL_loglevels; -static SDL_LogPriority SDL_default_priority = DEFAULT_PRIORITY; -static SDL_LogPriority SDL_assert_priority = DEFAULT_ASSERT_PRIORITY; -static SDL_LogPriority SDL_application_priority = DEFAULT_APPLICATION_PRIORITY; -static SDL_LogPriority SDL_test_priority = DEFAULT_TEST_PRIORITY; +static SDL_bool SDL_forced_priority = SDL_FALSE; +static SDL_LogPriority SDL_forced_priority_level; static SDL_LogOutputFunction SDL_log_function = SDL_LogOutput; static void *SDL_log_userdata = NULL; static SDL_mutex *log_function_mutex = NULL; -static const char *SDL_priority_prefixes[SDL_NUM_LOG_PRIORITIES] = { +/* If this list changes, update the documentation for SDL_HINT_LOGGING */ +static const char *SDL_priority_prefixes[] = { NULL, "VERBOSE", "DEBUG", @@ -77,8 +74,9 @@ static const char *SDL_priority_prefixes[SDL_NUM_LOG_PRIORITIES] = { "ERROR", "CRITICAL" }; +SDL_COMPILE_TIME_ASSERT(priority_prefixes, SDL_arraysize(SDL_priority_prefixes) == SDL_NUM_LOG_PRIORITIES); -#ifdef __ANDROID__ +/* If this list changes, update the documentation for SDL_HINT_LOGGING */ static const char *SDL_category_prefixes[] = { "APP", "ERROR", @@ -90,9 +88,9 @@ static const char *SDL_category_prefixes[] = { "INPUT", "TEST" }; +SDL_COMPILE_TIME_ASSERT(category_prefixes, SDL_arraysize(SDL_category_prefixes) == SDL_LOG_CATEGORY_RESERVED1); -SDL_COMPILE_TIME_ASSERT(category_prefixes_enum, SDL_TABLESIZE(SDL_category_prefixes) == SDL_LOG_CATEGORY_RESERVED1); - +#ifdef __ANDROID__ static int SDL_android_priority[SDL_NUM_LOG_PRIORITIES] = { ANDROID_LOG_UNKNOWN, ANDROID_LOG_VERBOSE, @@ -106,7 +104,7 @@ static int SDL_android_priority[SDL_NUM_LOG_PRIORITIES] = { void SDL_LogInit(void) { - if (log_function_mutex == NULL) { + if (!log_function_mutex) { /* if this fails we'll try to continue without it. */ log_function_mutex = SDL_CreateMutex(); } @@ -128,9 +126,9 @@ void SDL_LogSetAllPriority(SDL_LogPriority priority) for (entry = SDL_loglevels; entry; entry = entry->next) { entry->priority = priority; } - SDL_default_priority = priority; - SDL_assert_priority = priority; - SDL_application_priority = priority; + + SDL_forced_priority = SDL_TRUE; + SDL_forced_priority_level = priority; } void SDL_LogSetPriority(int category, SDL_LogPriority priority) @@ -154,6 +152,122 @@ void SDL_LogSetPriority(int category, SDL_LogPriority priority) } } +static SDL_bool SDL_ParseLogCategory(const char *string, size_t length, int *category) +{ + int i; + + if (SDL_isdigit(*string)) { + *category = SDL_atoi(string); + return SDL_TRUE; + } + + if (*string == '*') { + *category = DEFAULT_CATEGORY; + return SDL_TRUE; + } + + for (i = 0; i < SDL_arraysize(SDL_category_prefixes); ++i) { + if (SDL_strncasecmp(string, SDL_category_prefixes[i], length) == 0) { + *category = i; + return SDL_TRUE; + } + } + return SDL_FALSE; +} + +static SDL_bool SDL_ParseLogPriority(const char *string, size_t length, SDL_LogPriority *priority) +{ + int i; + + if (SDL_isdigit(*string)) { + i = SDL_atoi(string); + if (i == 0) { + /* 0 has a special meaning of "disable this category" */ + *priority = SDL_NUM_LOG_PRIORITIES; + return SDL_TRUE; + } + if (i >= SDL_LOG_PRIORITY_VERBOSE && i < SDL_NUM_LOG_PRIORITIES) { + *priority = (SDL_LogPriority)i; + return SDL_TRUE; + } + return SDL_FALSE; + } + + if (SDL_strncasecmp(string, "quiet", length) == 0) { + *priority = SDL_NUM_LOG_PRIORITIES; + return SDL_TRUE; + } + + for (i = SDL_LOG_PRIORITY_VERBOSE; i < SDL_NUM_LOG_PRIORITIES; ++i) { + if (SDL_strncasecmp(string, SDL_priority_prefixes[i], length) == 0) { + *priority = (SDL_LogPriority)i; + return SDL_TRUE; + } + } + return SDL_FALSE; +} + +static SDL_bool SDL_ParseLogCategoryPriority(const char *hint, int category, SDL_LogPriority *priority) +{ + const char *name, *next; + int current_category; + + if (category == DEFAULT_CATEGORY && SDL_strchr(hint, '=') == NULL) { + return SDL_ParseLogPriority(hint, SDL_strlen(hint), priority); + } + + for (name = hint; name; name = next) { + const char *sep = SDL_strchr(name, '='); + if (!sep) { + break; + } + next = SDL_strchr(sep, ','); + if (next) { + ++next; + } + + if (SDL_ParseLogCategory(name, (sep - name), ¤t_category)) { + if (current_category == category) { + const char *value = sep + 1; + size_t len; + if (next) { + len = (next - value - 1); + } else { + len = SDL_strlen(value); + } + return SDL_ParseLogPriority(value, len, priority); + } + } + } + return SDL_FALSE; +} + +static SDL_LogPriority SDL_GetDefaultLogPriority(int category) +{ + const char *hint = SDL_GetHint(SDL_HINT_LOGGING); + if (hint) { + SDL_LogPriority priority; + + if (SDL_ParseLogCategoryPriority(hint, category, &priority)) { + return priority; + } + if (SDL_ParseLogCategoryPriority(hint, DEFAULT_CATEGORY, &priority)) { + return priority; + } + } + + switch (category) { + case SDL_LOG_CATEGORY_APPLICATION: + return SDL_LOG_PRIORITY_INFO; + case SDL_LOG_CATEGORY_ASSERT: + return SDL_LOG_PRIORITY_WARN; + case SDL_LOG_CATEGORY_TEST: + return SDL_LOG_PRIORITY_VERBOSE; + default: + return SDL_LOG_PRIORITY_ERROR; + } +} + SDL_LogPriority SDL_LogGetPriority(int category) { SDL_LogLevel *entry; @@ -164,15 +278,11 @@ SDL_LogPriority SDL_LogGetPriority(int category) } } - if (category == SDL_LOG_CATEGORY_TEST) { - return SDL_test_priority; - } else if (category == SDL_LOG_CATEGORY_APPLICATION) { - return SDL_application_priority; - } else if (category == SDL_LOG_CATEGORY_ASSERT) { - return SDL_assert_priority; - } else { - return SDL_default_priority; + if (SDL_forced_priority) { + return SDL_forced_priority_level; } + + return SDL_GetDefaultLogPriority(category); } void SDL_LogResetPriorities(void) @@ -184,11 +294,7 @@ void SDL_LogResetPriorities(void) SDL_loglevels = entry->next; SDL_free(entry); } - - SDL_default_priority = DEFAULT_PRIORITY; - SDL_assert_priority = DEFAULT_ASSERT_PRIORITY; - SDL_application_priority = DEFAULT_APPLICATION_PRIORITY; - SDL_test_priority = DEFAULT_TEST_PRIORITY; + SDL_forced_priority = SDL_FALSE; } void SDL_Log(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) @@ -299,7 +405,7 @@ void SDL_LogMessageV(int category, SDL_LogPriority priority, const char *fmt, va return; } - if (log_function_mutex == NULL) { + if (!log_function_mutex) { /* this mutex creation can race if you log from two threads at startup. You should have called SDL_Init first! */ log_function_mutex = SDL_CreateMutex(); } @@ -317,7 +423,7 @@ void SDL_LogMessageV(int category, SDL_LogPriority priority, const char *fmt, va if (len >= sizeof(stack_buf) && SDL_size_add_overflow(len, 1, &len_plus_term) == 0) { /* Allocate exactly what we need, including the zero-terminator */ message = (char *)SDL_malloc(len_plus_term); - if (message == NULL) { + if (!message) { return; } va_copy(aq, ap); @@ -453,7 +559,7 @@ static void SDLCALL SDL_LogOutput(void *userdata, int category, SDL_LogPriority { FILE *pFile; pFile = fopen("SDL_Log.txt", "a"); - if (pFile != NULL) { + if (pFile) { (void)fprintf(pFile, "%s: %s\n", SDL_priority_prefixes[priority], message); (void)fclose(pFile); } @@ -462,7 +568,7 @@ static void SDLCALL SDL_LogOutput(void *userdata, int category, SDL_LogPriority { FILE *pFile; pFile = fopen("ux0:/data/SDL_Log.txt", "a"); - if (pFile != NULL) { + if (pFile) { (void)fprintf(pFile, "%s: %s\n", SDL_priority_prefixes[priority], message); (void)fclose(pFile); } @@ -471,16 +577,16 @@ static void SDLCALL SDL_LogOutput(void *userdata, int category, SDL_LogPriority { FILE *pFile; pFile = fopen("sdmc:/3ds/SDL_Log.txt", "a"); - if (pFile != NULL) { + if (pFile) { (void)fprintf(pFile, "%s: %s\n", SDL_priority_prefixes[priority], message); (void)fclose(pFile); } } #endif -#if HAVE_STDIO_H && \ +#if defined(HAVE_STDIO_H) && \ !(defined(__APPLE__) && (defined(SDL_VIDEO_DRIVER_COCOA) || defined(SDL_VIDEO_DRIVER_UIKIT))) fprintf(stderr, "%s: %s\n", SDL_priority_prefixes[priority], message); -#if __NACL__ +#ifdef __NACL__ fflush(stderr); #endif #endif diff --git a/thirdparty/SDL/src/SDL_log_c.h b/thirdparty/SDL/src/SDL_log_c.h index 4aae691e8..4d6676d30 100644 --- a/thirdparty/SDL/src/SDL_log_c.h +++ b/thirdparty/SDL/src/SDL_log_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/SDL_utils.c b/thirdparty/SDL/src/SDL_utils.c index 36e9e0368..10a30836b 100644 --- a/thirdparty/SDL/src/SDL_utils.c +++ b/thirdparty/SDL/src/SDL_utils.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/SDL_utils_c.h b/thirdparty/SDL/src/SDL_utils_c.h index 08b90e64a..4c00d8b3a 100644 --- a/thirdparty/SDL/src/SDL_utils_c.h +++ b/thirdparty/SDL/src/SDL_utils_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/atomic/SDL_atomic.c b/thirdparty/SDL/src/atomic/SDL_atomic.c index 4e10d52db..e843c8d2c 100644 --- a/thirdparty/SDL/src/atomic/SDL_atomic.c +++ b/thirdparty/SDL/src/atomic/SDL_atomic.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -103,10 +103,10 @@ extern __inline int _SDL_xadd_watcom(volatile int *a, int v); */ #if !defined(HAVE_MSC_ATOMICS) && !defined(HAVE_GCC_ATOMICS) && !defined(__MACOSX__) && !defined(__SOLARIS__) && !defined(HAVE_WATCOM_ATOMICS) -#define EMULATE_CAS 1 +#define EMULATE_CAS #endif -#if EMULATE_CAS +#ifdef EMULATE_CAS static SDL_SpinLock locks[32]; static SDL_INLINE void enterLock(void *a) @@ -137,7 +137,7 @@ SDL_bool SDL_AtomicCAS(SDL_atomic_t *a, int oldval, int newval) return (SDL_bool) OSAtomicCompareAndSwap32Barrier(oldval, newval, &a->value); #elif defined(__SOLARIS__) return (SDL_bool)((int)atomic_cas_uint((volatile uint_t *)&a->value, (uint_t)oldval, (uint_t)newval) == oldval); -#elif EMULATE_CAS +#elif defined(EMULATE_CAS) SDL_bool retval = SDL_FALSE; enterLock(a); @@ -167,7 +167,7 @@ SDL_bool SDL_AtomicCASPtr(void **a, void *oldval, void *newval) return (SDL_bool) OSAtomicCompareAndSwap32Barrier((int32_t)oldval, (int32_t)newval, (int32_t*) a); #elif defined(__SOLARIS__) return (SDL_bool)(atomic_cas_ptr(a, oldval, newval) == oldval); -#elif EMULATE_CAS +#elif defined(EMULATE_CAS) SDL_bool retval = SDL_FALSE; enterLock(a); diff --git a/thirdparty/SDL/src/atomic/SDL_spinlock.c b/thirdparty/SDL/src/atomic/SDL_spinlock.c index 9fd3e6167..a2d1d3f9d 100644 --- a/thirdparty/SDL/src/atomic/SDL_spinlock.c +++ b/thirdparty/SDL/src/atomic/SDL_spinlock.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -63,11 +63,11 @@ extern __inline int _SDL_xchg_watcom(volatile int *a, int v); /* This function is where all the magic happens... */ SDL_bool SDL_AtomicTryLock(SDL_SpinLock *lock) { -#if SDL_ATOMIC_DISABLED +#ifdef SDL_ATOMIC_DISABLED /* Terrible terrible damage */ static SDL_mutex *_spinlock_mutex; - if (_spinlock_mutex == NULL) { + if (!_spinlock_mutex) { /* Race condition on first lock... */ _spinlock_mutex = SDL_CreateMutex(); } @@ -81,7 +81,7 @@ SDL_bool SDL_AtomicTryLock(SDL_SpinLock *lock) return SDL_FALSE; } -#elif HAVE_GCC_ATOMICS || HAVE_GCC_SYNC_LOCK_TEST_AND_SET +#elif defined(HAVE_GCC_ATOMICS) || defined(HAVE_GCC_SYNC_LOCK_TEST_AND_SET) return __sync_lock_test_and_set(lock, 1) == 0; #elif defined(_MSC_VER) && (defined(_M_ARM) || defined(_M_ARM64)) @@ -186,7 +186,7 @@ void SDL_AtomicLock(SDL_SpinLock *lock) void SDL_AtomicUnlock(SDL_SpinLock *lock) { -#if HAVE_GCC_ATOMICS || HAVE_GCC_SYNC_LOCK_TEST_AND_SET +#if defined(HAVE_GCC_ATOMICS) || defined(HAVE_GCC_SYNC_LOCK_TEST_AND_SET) __sync_lock_release(lock); #elif defined(_MSC_VER) && (defined(_M_ARM) || defined(_M_ARM64)) diff --git a/thirdparty/SDL/src/audio/SDL_audio.c b/thirdparty/SDL/src/audio/SDL_audio.c index 60242e60a..96586fe77 100644 --- a/thirdparty/SDL/src/audio/SDL_audio.c +++ b/thirdparty/SDL/src/audio/SDL_audio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -31,102 +31,108 @@ #define _THIS SDL_AudioDevice *_this +typedef struct AudioThreadStartupData +{ + SDL_AudioDevice *device; + SDL_sem *startup_semaphore; +} AudioThreadStartupData; + static SDL_AudioDriver current_audio; static SDL_AudioDevice *open_devices[16]; /* Available audio drivers */ static const AudioBootStrap *const bootstrap[] = { -#if SDL_AUDIO_DRIVER_PULSEAUDIO +#ifdef SDL_AUDIO_DRIVER_PULSEAUDIO &PULSEAUDIO_bootstrap, #endif -#if SDL_AUDIO_DRIVER_ALSA +#ifdef SDL_AUDIO_DRIVER_ALSA &ALSA_bootstrap, #endif -#if SDL_AUDIO_DRIVER_SNDIO +#ifdef SDL_AUDIO_DRIVER_SNDIO &SNDIO_bootstrap, #endif -#if SDL_AUDIO_DRIVER_NETBSD +#ifdef SDL_AUDIO_DRIVER_NETBSD &NETBSDAUDIO_bootstrap, #endif -#if SDL_AUDIO_DRIVER_QSA +#ifdef SDL_AUDIO_DRIVER_QSA &QSAAUDIO_bootstrap, #endif -#if SDL_AUDIO_DRIVER_SUNAUDIO +#ifdef SDL_AUDIO_DRIVER_SUNAUDIO &SUNAUDIO_bootstrap, #endif -#if SDL_AUDIO_DRIVER_ARTS +#ifdef SDL_AUDIO_DRIVER_ARTS &ARTS_bootstrap, #endif -#if SDL_AUDIO_DRIVER_ESD +#ifdef SDL_AUDIO_DRIVER_ESD &ESD_bootstrap, #endif -#if SDL_AUDIO_DRIVER_NACL +#ifdef SDL_AUDIO_DRIVER_NACL &NACLAUDIO_bootstrap, #endif -#if SDL_AUDIO_DRIVER_NAS +#ifdef SDL_AUDIO_DRIVER_NAS &NAS_bootstrap, #endif -#if SDL_AUDIO_DRIVER_WASAPI +#ifdef SDL_AUDIO_DRIVER_WASAPI &WASAPI_bootstrap, #endif -#if SDL_AUDIO_DRIVER_DSOUND +#ifdef SDL_AUDIO_DRIVER_DSOUND &DSOUND_bootstrap, #endif -#if SDL_AUDIO_DRIVER_WINMM +#ifdef SDL_AUDIO_DRIVER_WINMM &WINMM_bootstrap, #endif -#if SDL_AUDIO_DRIVER_PAUDIO +#ifdef SDL_AUDIO_DRIVER_PAUDIO &PAUDIO_bootstrap, #endif -#if SDL_AUDIO_DRIVER_HAIKU +#ifdef SDL_AUDIO_DRIVER_HAIKU &HAIKUAUDIO_bootstrap, #endif -#if SDL_AUDIO_DRIVER_COREAUDIO +#ifdef SDL_AUDIO_DRIVER_COREAUDIO &COREAUDIO_bootstrap, #endif -#if SDL_AUDIO_DRIVER_FUSIONSOUND +#ifdef SDL_AUDIO_DRIVER_FUSIONSOUND &FUSIONSOUND_bootstrap, #endif -#if SDL_AUDIO_DRIVER_AAUDIO +#ifdef SDL_AUDIO_DRIVER_AAUDIO &aaudio_bootstrap, #endif -#if SDL_AUDIO_DRIVER_OPENSLES +#ifdef SDL_AUDIO_DRIVER_OPENSLES &openslES_bootstrap, #endif -#if SDL_AUDIO_DRIVER_ANDROID +#ifdef SDL_AUDIO_DRIVER_ANDROID &ANDROIDAUDIO_bootstrap, #endif -#if SDL_AUDIO_DRIVER_PS2 +#ifdef SDL_AUDIO_DRIVER_PS2 &PS2AUDIO_bootstrap, #endif -#if SDL_AUDIO_DRIVER_PSP +#ifdef SDL_AUDIO_DRIVER_PSP &PSPAUDIO_bootstrap, #endif -#if SDL_AUDIO_DRIVER_VITA +#ifdef SDL_AUDIO_DRIVER_VITA &VITAAUD_bootstrap, #endif -#if SDL_AUDIO_DRIVER_N3DS +#ifdef SDL_AUDIO_DRIVER_N3DS &N3DSAUDIO_bootstrap, #endif -#if SDL_AUDIO_DRIVER_EMSCRIPTEN +#ifdef SDL_AUDIO_DRIVER_EMSCRIPTEN &EMSCRIPTENAUDIO_bootstrap, #endif -#if SDL_AUDIO_DRIVER_JACK +#ifdef SDL_AUDIO_DRIVER_JACK &JACK_bootstrap, #endif -#if SDL_AUDIO_DRIVER_PIPEWIRE +#ifdef SDL_AUDIO_DRIVER_PIPEWIRE &PIPEWIRE_bootstrap, #endif -#if SDL_AUDIO_DRIVER_OSS +#ifdef SDL_AUDIO_DRIVER_OSS &DSP_bootstrap, #endif -#if SDL_AUDIO_DRIVER_OS2 +#ifdef SDL_AUDIO_DRIVER_OS2 &OS2AUDIO_bootstrap, #endif -#if SDL_AUDIO_DRIVER_DISK +#ifdef SDL_AUDIO_DRIVER_DISK &DISKAUDIO_bootstrap, #endif -#if SDL_AUDIO_DRIVER_DUMMY +#ifdef SDL_AUDIO_DRIVER_DUMMY &DUMMYAUDIO_bootstrap, #endif NULL @@ -658,22 +664,24 @@ void SDL_ClearQueuedAudio(SDL_AudioDeviceID devid) current_audio.impl.UnlockDevice(device); } -#if SDL_AUDIO_DRIVER_ANDROID +#ifdef SDL_AUDIO_DRIVER_ANDROID extern void Android_JNI_AudioSetThreadPriority(int, int); #endif /* The general mixing thread function */ -static int SDLCALL SDL_RunAudio(void *devicep) +static int SDLCALL SDL_RunAudio(void *userdata) { - SDL_AudioDevice *device = (SDL_AudioDevice *)devicep; + const AudioThreadStartupData *startup_data = (const AudioThreadStartupData *) userdata; + SDL_AudioDevice *device = startup_data->device; void *udata = device->callbackspec.userdata; SDL_AudioCallback callback = device->callbackspec.callback; int data_len = 0; Uint8 *data; + Uint8 *device_buf_keepsafe = NULL; SDL_assert(!device->iscapture); -#if SDL_AUDIO_DRIVER_ANDROID +#ifdef SDL_AUDIO_DRIVER_ANDROID { /* Set thread priority to THREAD_PRIORITY_AUDIO */ Android_JNI_AudioSetThreadPriority(device->iscapture, device->id); @@ -685,6 +693,9 @@ static int SDLCALL SDL_RunAudio(void *devicep) /* Perform any thread setup */ device->threadid = SDL_ThreadID(); + + SDL_SemPost(startup_data->startup_semaphore); /* SDL_OpenAudioDevice may now continue. */ + current_audio.impl.ThreadInit(device); /* Loop, filling the audio buffers */ @@ -693,8 +704,16 @@ static int SDLCALL SDL_RunAudio(void *devicep) /* Fill the current buffer with sound */ if (!device->stream && SDL_AtomicGet(&device->enabled)) { - SDL_assert(data_len == device->spec.size); data = current_audio.impl.GetDeviceBuf(device); + + if (device->stream && SDL_AtomicGet(&device->enabled)) { + /* Oops. Audio device reset and now we suddenly use a stream, */ + /* so save this devicebuf for later, to prevent de-sync */ + if (data != NULL) { + device_buf_keepsafe = data; + } + data = NULL; + } } else { /* if the device isn't enabled, we still write to the work_buffer, so the app's callback will fire with @@ -725,7 +744,19 @@ static int SDLCALL SDL_RunAudio(void *devicep) while (SDL_AudioStreamAvailable(device->stream) >= ((int)device->spec.size)) { int got; - data = SDL_AtomicGet(&device->enabled) ? current_audio.impl.GetDeviceBuf(device) : NULL; + if (SDL_AtomicGet(&device->enabled)) { + /* if device reset occured - a switch from direct output to streaming */ + /* use the already aquired device buffer */ + if (device_buf_keepsafe) { + data = device_buf_keepsafe; + device_buf_keepsafe = NULL; + } else { + /* else - normal flow, just acquire the device buffer here */ + data = current_audio.impl.GetDeviceBuf(device); + } + } else { + data = NULL; + } got = SDL_AudioStreamGet(device->stream, data ? data : device->work_buffer, device->spec.size); SDL_assert((got <= 0) || (got == device->spec.size)); @@ -740,6 +771,14 @@ static int SDLCALL SDL_RunAudio(void *devicep) current_audio.impl.WaitDevice(device); } } + + /* it seems resampling was not fast enough, device_buf_keepsafe was not released yet, so play silence here */ + if (device_buf_keepsafe) { + SDL_memset(device_buf_keepsafe, device->spec.silence, device->spec.size); + current_audio.impl.PlayDevice(device); + current_audio.impl.WaitDevice(device); + device_buf_keepsafe = NULL; + } } else if (data == device->work_buffer) { /* nothing to do; pause like we queued a buffer to play. */ const Uint32 delay = ((device->spec.samples * 1000) / device->spec.freq); @@ -761,9 +800,10 @@ static int SDLCALL SDL_RunAudio(void *devicep) /* !!! FIXME: this needs to deal with device spec changes. */ /* The general capture thread function */ -static int SDLCALL SDL_CaptureAudio(void *devicep) +static int SDLCALL SDL_CaptureAudio(void *userdata) { - SDL_AudioDevice *device = (SDL_AudioDevice *)devicep; + const AudioThreadStartupData *startup_data = (const AudioThreadStartupData *) userdata; + SDL_AudioDevice *device = startup_data->device; const int silence = (int)device->spec.silence; const Uint32 delay = ((device->spec.samples * 1000) / device->spec.freq); const int data_len = device->spec.size; @@ -773,7 +813,7 @@ static int SDLCALL SDL_CaptureAudio(void *devicep) SDL_assert(device->iscapture); -#if SDL_AUDIO_DRIVER_ANDROID +#ifdef SDL_AUDIO_DRIVER_ANDROID { /* Set thread priority to THREAD_PRIORITY_AUDIO */ Android_JNI_AudioSetThreadPriority(device->iscapture, device->id); @@ -785,6 +825,9 @@ static int SDLCALL SDL_CaptureAudio(void *devicep) /* Perform any thread setup */ device->threadid = SDL_ThreadID(); + + SDL_SemPost(startup_data->startup_semaphore); /* SDL_OpenAudioDevice may now continue. */ + current_audio.impl.ThreadInit(device); /* Loop, filling the audio buffers */ @@ -932,7 +975,7 @@ int SDL_AudioInit(const char *driver_name) const char *driver_attempt_end = SDL_strchr(driver_attempt, ','); size_t driver_attempt_len = (driver_attempt_end != NULL) ? (driver_attempt_end - driver_attempt) : SDL_strlen(driver_attempt); -#if SDL_AUDIO_DRIVER_DSOUND +#ifdef SDL_AUDIO_DRIVER_DSOUND /* SDL 1.2 uses the name "dsound", so we'll support both. */ if (driver_attempt_len == SDL_strlen("dsound") && (SDL_strncasecmp(driver_attempt, "dsound", driver_attempt_len) == 0)) { @@ -941,7 +984,7 @@ int SDL_AudioInit(const char *driver_name) } #endif -#if SDL_AUDIO_DRIVER_PULSEAUDIO +#ifdef SDL_AUDIO_DRIVER_PULSEAUDIO /* SDL 1.2 uses the name "pulse", so we'll support both. */ if (driver_attempt_len == SDL_strlen("pulse") && (SDL_strncasecmp(driver_attempt, "pulse", driver_attempt_len) == 0)) { @@ -962,7 +1005,7 @@ int SDL_AudioInit(const char *driver_name) } } - driver_attempt = (driver_attempt_end != NULL) ? (driver_attempt_end + 1) : NULL; + driver_attempt = (driver_attempt_end) ? (driver_attempt_end + 1) : NULL; } } else { for (i = 0; (!initialized) && (bootstrap[i]); ++i) { @@ -1009,7 +1052,7 @@ int SDL_AudioInit(const char *driver_name) /* * Get the current audio driver name */ -const char *SDL_GetCurrentAudioDriver() +const char *SDL_GetCurrentAudioDriver(void) { return current_audio.name; } @@ -1261,7 +1304,6 @@ static SDL_AudioDeviceID open_audio_device(const char *devname, int iscapture, const SDL_AudioSpec *desired, SDL_AudioSpec *obtained, int allowed_changes, int min_id) { - const SDL_bool is_internal_thread = (desired->callback == NULL); SDL_AudioDeviceID id = 0; SDL_AudioSpec _obtained; SDL_AudioDevice *device; @@ -1279,25 +1321,10 @@ static SDL_AudioDeviceID open_audio_device(const char *devname, int iscapture, return 0; } - SDL_LockMutex(current_audio.detectionLock); - /* Find an available device ID... */ - for (id = min_id - 1; id < SDL_arraysize(open_devices); id++) { - if (open_devices[id] == NULL) { - break; - } - } - - if (id == SDL_arraysize(open_devices)) { - SDL_SetError("Too many open audio devices"); - SDL_UnlockMutex(current_audio.detectionLock); - return 0; - } - if (!obtained) { obtained = &_obtained; } if (!prepare_audiospec(desired, obtained)) { - SDL_UnlockMutex(current_audio.detectionLock); return 0; } @@ -1319,11 +1346,11 @@ static SDL_AudioDeviceID open_audio_device(const char *devname, int iscapture, if ((iscapture) && (current_audio.impl.OnlyHasDefaultCaptureDevice)) { if ((devname) && (SDL_strcmp(devname, DEFAULT_INPUT_DEVNAME) != 0)) { SDL_SetError("No such device"); - SDL_UnlockMutex(current_audio.detectionLock); return 0; } devname = NULL; + SDL_LockMutex(current_audio.detectionLock); for (i = 0; i < SDL_arraysize(open_devices); i++) { if ((open_devices[i]) && (open_devices[i]->iscapture)) { SDL_SetError("Audio device already open"); @@ -1331,14 +1358,15 @@ static SDL_AudioDeviceID open_audio_device(const char *devname, int iscapture, return 0; } } + SDL_UnlockMutex(current_audio.detectionLock); } else if ((!iscapture) && (current_audio.impl.OnlyHasDefaultOutputDevice)) { if ((devname) && (SDL_strcmp(devname, DEFAULT_OUTPUT_DEVNAME) != 0)) { - SDL_UnlockMutex(current_audio.detectionLock); SDL_SetError("No such device"); return 0; } devname = NULL; + SDL_LockMutex(current_audio.detectionLock); for (i = 0; i < SDL_arraysize(open_devices); i++) { if ((open_devices[i]) && (!open_devices[i]->iscapture)) { SDL_UnlockMutex(current_audio.detectionLock); @@ -1346,6 +1374,7 @@ static SDL_AudioDeviceID open_audio_device(const char *devname, int iscapture, return 0; } } + SDL_UnlockMutex(current_audio.detectionLock); } else if (devname != NULL) { /* if the app specifies an exact string, we can pass the backend an actual device handle thingey, which saves them the effort of @@ -1354,19 +1383,20 @@ static SDL_AudioDeviceID open_audio_device(const char *devname, int iscapture, It might still need to open a device based on the string for, say, a network audio server, but this optimizes some cases. */ SDL_AudioDeviceItem *item; + SDL_LockMutex(current_audio.detectionLock); for (item = iscapture ? current_audio.inputDevices : current_audio.outputDevices; item; item = item->next) { if ((item->handle != NULL) && (SDL_strcmp(item->name, devname) == 0)) { handle = item->handle; break; } } + SDL_UnlockMutex(current_audio.detectionLock); } if (!current_audio.impl.AllowsArbitraryDeviceNames) { /* has to be in our device list, or the default device. */ if ((handle == NULL) && (devname != NULL)) { SDL_SetError("No such device."); - SDL_UnlockMutex(current_audio.detectionLock); return 0; } } @@ -1374,10 +1404,8 @@ static SDL_AudioDeviceID open_audio_device(const char *devname, int iscapture, device = (SDL_AudioDevice *)SDL_calloc(1, sizeof(SDL_AudioDevice)); if (device == NULL) { SDL_OutOfMemory(); - SDL_UnlockMutex(current_audio.detectionLock); return 0; } - device->id = id + 1; device->spec = *obtained; device->iscapture = iscapture ? SDL_TRUE : SDL_FALSE; device->handle = handle; @@ -1391,7 +1419,6 @@ static SDL_AudioDeviceID open_audio_device(const char *devname, int iscapture, device->mixer_lock = SDL_CreateMutex(); if (device->mixer_lock == NULL) { close_audio_device(device); - SDL_UnlockMutex(current_audio.detectionLock); SDL_SetError("Couldn't create mixer lock"); return 0; } @@ -1406,7 +1433,6 @@ static SDL_AudioDeviceID open_audio_device(const char *devname, int iscapture, if (current_audio.impl.OpenDevice(device, devname) < 0) { close_audio_device(device); - SDL_UnlockMutex(current_audio.detectionLock); return 0; } @@ -1462,7 +1488,6 @@ static SDL_AudioDeviceID open_audio_device(const char *devname, int iscapture, if (!device->stream) { close_audio_device(device); - SDL_UnlockMutex(current_audio.detectionLock); return 0; } } @@ -1472,7 +1497,6 @@ static SDL_AudioDeviceID open_audio_device(const char *devname, int iscapture, device->buffer_queue = SDL_NewDataQueue(SDL_AUDIOBUFFERQUEUE_PACKETLEN, obtained->size * 2); if (!device->buffer_queue) { close_audio_device(device); - SDL_UnlockMutex(current_audio.detectionLock); SDL_SetError("Couldn't create audio buffer queue"); return 0; } @@ -1490,32 +1514,56 @@ static SDL_AudioDeviceID open_audio_device(const char *devname, int iscapture, device->work_buffer = (Uint8 *)SDL_malloc(device->work_buffer_len); if (device->work_buffer == NULL) { close_audio_device(device); - SDL_UnlockMutex(current_audio.detectionLock); SDL_OutOfMemory(); return 0; } + /* Find an available device ID... */ + SDL_LockMutex(current_audio.detectionLock); + for (id = min_id - 1; id < SDL_arraysize(open_devices); id++) { + if (open_devices[id] == NULL) { + break; + } + } + + if (id == SDL_arraysize(open_devices)) { + close_audio_device(device); + SDL_SetError("Too many open audio devices"); + SDL_UnlockMutex(current_audio.detectionLock); + return 0; + } + + device->id = id + 1; open_devices[id] = device; /* add it to our list of open devices. */ + SDL_UnlockMutex(current_audio.detectionLock); /* Start the audio thread if necessary */ if (!current_audio.impl.ProvidesOwnCallbackThread) { /* Start the audio thread */ - /* !!! FIXME: we don't force the audio thread stack size here if it calls into user code, but maybe we should? */ - /* buffer queueing callback only needs a few bytes, so make the stack tiny. */ - const size_t stacksize = is_internal_thread ? 64 * 1024 : 0; char threadname[64]; + AudioThreadStartupData startup_data; + + startup_data.device = device; + startup_data.startup_semaphore = SDL_CreateSemaphore(0); + if (!startup_data.startup_semaphore) { + close_audio_device(device); + SDL_SetError("Couldn't create audio thread startup semaphore"); + return 0; + } (void)SDL_snprintf(threadname, sizeof(threadname), "SDLAudio%c%" SDL_PRIu32, (iscapture) ? 'C' : 'P', device->id); - device->thread = SDL_CreateThreadInternal(iscapture ? SDL_CaptureAudio : SDL_RunAudio, threadname, stacksize, device); + device->thread = SDL_CreateThreadInternal(iscapture ? SDL_CaptureAudio : SDL_RunAudio, threadname, 0, &startup_data); if (device->thread == NULL) { + SDL_DestroySemaphore(startup_data.startup_semaphore); close_audio_device(device); SDL_SetError("Couldn't create audio thread"); - SDL_UnlockMutex(current_audio.detectionLock); return 0; } + + SDL_SemWait(startup_data.startup_semaphore); + SDL_DestroySemaphore(startup_data.startup_semaphore); } - SDL_UnlockMutex(current_audio.detectionLock); return device->id; } diff --git a/thirdparty/SDL/src/audio/SDL_audio_c.h b/thirdparty/SDL/src/audio/SDL_audio_c.h index 9ec79edc4..5bc2b41da 100644 --- a/thirdparty/SDL/src/audio/SDL_audio_c.h +++ b/thirdparty/SDL/src/audio/SDL_audio_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/audio/SDL_audio_channel_converters.h b/thirdparty/SDL/src/audio/SDL_audio_channel_converters.h index 72cb511d0..95e22b1c3 100644 --- a/thirdparty/SDL/src/audio/SDL_audio_channel_converters.h +++ b/thirdparty/SDL/src/audio/SDL_audio_channel_converters.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/audio/SDL_audio_resampler_filter.h b/thirdparty/SDL/src/audio/SDL_audio_resampler_filter.h index 83cde7cb5..a6dff392d 100644 --- a/thirdparty/SDL/src/audio/SDL_audio_resampler_filter.h +++ b/thirdparty/SDL/src/audio/SDL_audio_resampler_filter.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/audio/SDL_audiocvt.c b/thirdparty/SDL/src/audio/SDL_audiocvt.c index ed4333eca..9087317bc 100644 --- a/thirdparty/SDL/src/audio/SDL_audiocvt.c +++ b/thirdparty/SDL/src/audio/SDL_audiocvt.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -93,7 +93,7 @@ * 8 channels (7.1) layout: FL+FR+FC+LFE+BL+BR+SL+SR */ -#if HAVE_SSE3_INTRINSICS +#ifdef HAVE_SSE3_INTRINSICS /* Convert from stereo to mono. Average left and right. */ static void SDLCALL SDL_ConvertStereoToMono_SSE3(SDL_AudioCVT *cvt, SDL_AudioFormat format) { @@ -130,7 +130,7 @@ static void SDLCALL SDL_ConvertStereoToMono_SSE3(SDL_AudioCVT *cvt, SDL_AudioFor } #endif -#if HAVE_SSE_INTRINSICS +#ifdef HAVE_SSE_INTRINSICS /* Convert from mono to stereo. Duplicate to stereo left and right. */ static void SDLCALL SDL_ConvertMonoToStereo_SSE(SDL_AudioCVT *cvt, SDL_AudioFormat format) { @@ -266,7 +266,7 @@ int SDL_ConvertAudio(SDL_AudioCVT *cvt) /* !!! FIXME: (actually, we can't...len_cvt needs to be updated. Grr.) */ /* Make sure there's data to convert */ - if (cvt->buf == NULL) { + if (!cvt->buf) { return SDL_SetError("No buffer allocated for conversion"); } @@ -473,10 +473,12 @@ static void SDL_ResampleCVT_SRC(SDL_AudioCVT *cvt, const int chans, const SDL_Au result = SRC_src_simple(&data, SRC_converter, chans); /* Simple API converts the whole buffer at once. No need for initialization. */ /* !!! FIXME: Handle library failures? */ -#ifdef DEBUG_CONVERT +#if DEBUG_CONVERT if (result != 0) { SDL_Log("src_simple() failed: %s", SRC_src_strerror(result)); } +#else + (void)result; #endif cvt->len_cvt = data.output_frames_gen * framelen; @@ -517,7 +519,7 @@ static void SDL_ResampleCVT(SDL_AudioCVT *cvt, const int chans, const SDL_AudioF /* we keep no streaming state here, so pad with silence on both ends. */ padding = (float *)SDL_calloc(paddingsamples ? paddingsamples : 1, sizeof(float)); - if (padding == NULL) { + if (!padding) { SDL_OutOfMemory(); return; } @@ -614,7 +616,7 @@ static int SDL_BuildAudioResampleCVT(SDL_AudioCVT *cvt, const int dst_channels, } filter = ChooseCVTResampler(dst_channels); - if (filter == NULL) { + if (!filter) { return SDL_SetError("No conversion available for these rates"); } @@ -687,7 +689,7 @@ int SDL_BuildAudioCVT(SDL_AudioCVT *cvt, SDL_AudioFilter channel_converter = NULL; /* Sanity check target pointer */ - if (cvt == NULL) { + if (!cvt) { return SDL_InvalidParamError("cvt"); } @@ -782,14 +784,14 @@ int SDL_BuildAudioCVT(SDL_AudioCVT *cvt, SDL_assert(dst_channels <= SDL_arraysize(channel_converters[0])); channel_converter = channel_converters[src_channels - 1][dst_channels - 1]; - if ((channel_converter == NULL) != (src_channels == dst_channels)) { + if ((!channel_converter) != (src_channels == dst_channels)) { /* All combinations of supported channel counts should have been handled by now, but let's be defensive */ return SDL_SetError("Invalid channel combination"); } else if (channel_converter != NULL) { /* swap in some SIMD versions for a few of these. */ if (channel_converter == SDL_ConvertStereoToMono) { SDL_AudioFilter filter = NULL; -#if HAVE_SSE3_INTRINSICS +#ifdef HAVE_SSE3_INTRINSICS if (!filter && SDL_HasSSE3()) { filter = SDL_ConvertStereoToMono_SSE3; } @@ -799,7 +801,7 @@ int SDL_BuildAudioCVT(SDL_AudioCVT *cvt, } } else if (channel_converter == SDL_ConvertMonoToStereo) { SDL_AudioFilter filter = NULL; -#if HAVE_SSE_INTRINSICS +#ifdef HAVE_SSE_INTRINSICS if (!filter && SDL_HasSSE()) { filter = SDL_ConvertMonoToStereo_SSE; } @@ -878,7 +880,7 @@ static Uint8 *EnsureStreamBufferSize(SDL_AudioStream *stream, int newlen) ptr = stream->work_buffer_base; } else { ptr = (Uint8 *)SDL_realloc(stream->work_buffer_base, (size_t)newlen + 32); - if (ptr == NULL) { + if (!ptr) { SDL_OutOfMemory(); return NULL; } @@ -950,12 +952,12 @@ static SDL_bool SetupLibSampleRateResampling(SDL_AudioStream *stream) if (SRC_available) { state = SRC_src_new(SRC_converter, stream->pre_resample_channels, &result); - if (state == NULL) { + if (!state) { SDL_SetError("src_new() failed: %s", SRC_src_strerror(result)); } } - if (state == NULL) { + if (!state) { SDL_CleanupAudioStreamResampler_SRC(stream); return SDL_FALSE; } @@ -1027,7 +1029,7 @@ SDL_AudioStream *SDL_NewAudioStream(const SDL_AudioFormat src_format, } retval = (SDL_AudioStream *)SDL_calloc(1, sizeof(SDL_AudioStream)); - if (retval == NULL) { + if (!retval) { SDL_OutOfMemory(); return NULL; } @@ -1053,7 +1055,7 @@ SDL_AudioStream *SDL_NewAudioStream(const SDL_AudioFormat src_format, retval->resampler_padding_samples = ResamplerPadding(retval->src_rate, retval->dst_rate) * pre_resample_channels; retval->resampler_padding = (float *)SDL_calloc(retval->resampler_padding_samples ? retval->resampler_padding_samples : 1, sizeof(float)); - if (retval->resampler_padding == NULL) { + if (!retval->resampler_padding) { SDL_FreeAudioStream(retval); SDL_OutOfMemory(); return NULL; @@ -1062,7 +1064,7 @@ SDL_AudioStream *SDL_NewAudioStream(const SDL_AudioFormat src_format, retval->staging_buffer_size = ((retval->resampler_padding_samples / retval->pre_resample_channels) * retval->src_sample_frame_size); if (retval->staging_buffer_size > 0) { retval->staging_buffer = (Uint8 *)SDL_malloc(retval->staging_buffer_size); - if (retval->staging_buffer == NULL) { + if (!retval->staging_buffer) { SDL_FreeAudioStream(retval); SDL_OutOfMemory(); return NULL; @@ -1169,7 +1171,7 @@ static int SDL_AudioStreamPutInternal(SDL_AudioStream *stream, const void *buf, #endif workbuf = EnsureStreamBufferSize(stream, workbuflen); - if (workbuf == NULL) { + if (!workbuf) { return -1; /* probably out of memory. */ } @@ -1260,10 +1262,10 @@ int SDL_AudioStreamPut(SDL_AudioStream *stream, const void *buf, int len) SDL_Log("AUDIOSTREAM: wants to put %d preconverted bytes\n", buflen); #endif - if (stream == NULL) { + if (!stream) { return SDL_InvalidParamError("stream"); } - if (buf == NULL) { + if (!buf) { return SDL_InvalidParamError("buf"); } if (len == 0) { @@ -1315,7 +1317,7 @@ int SDL_AudioStreamPut(SDL_AudioStream *stream, const void *buf, int len) int SDL_AudioStreamFlush(SDL_AudioStream *stream) { - if (stream == NULL) { + if (!stream) { return SDL_InvalidParamError("stream"); } @@ -1373,10 +1375,10 @@ int SDL_AudioStreamGet(SDL_AudioStream *stream, void *buf, int len) SDL_Log("AUDIOSTREAM: want to get %d converted bytes\n", len); #endif - if (stream == NULL) { + if (!stream) { return SDL_InvalidParamError("stream"); } - if (buf == NULL) { + if (!buf) { return SDL_InvalidParamError("buf"); } if (len <= 0) { @@ -1397,7 +1399,7 @@ int SDL_AudioStreamAvailable(SDL_AudioStream *stream) void SDL_AudioStreamClear(SDL_AudioStream *stream) { - if (stream == NULL) { + if (!stream) { SDL_InvalidParamError("stream"); } else { SDL_ClearDataQueue(stream->queue, (size_t)stream->packetlen * 2); diff --git a/thirdparty/SDL/src/audio/SDL_audiodev.c b/thirdparty/SDL/src/audio/SDL_audiodev.c index ac35cb265..903ba9e76 100644 --- a/thirdparty/SDL/src/audio/SDL_audiodev.c +++ b/thirdparty/SDL/src/audio/SDL_audiodev.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -22,7 +22,7 @@ /* Get the name of the audio device we use for output */ -#if SDL_AUDIO_DRIVER_NETBSD || SDL_AUDIO_DRIVER_OSS || SDL_AUDIO_DRIVER_SUNAUDIO +#if defined(SDL_AUDIO_DRIVER_NETBSD) || defined(SDL_AUDIO_DRIVER_OSS) || defined(SDL_AUDIO_DRIVER_SUNAUDIO) #include #include @@ -81,16 +81,16 @@ static void SDL_EnumUnixAudioDevices_Internal(const int iscapture, const int cla const char *audiodev; char audiopath[1024]; - if (test == NULL) { + if (!test) { test = test_stub; } /* Figure out what our audio device is */ audiodev = SDL_getenv("SDL_PATH_DSP"); - if (audiodev == NULL) { + if (!audiodev) { audiodev = SDL_getenv("AUDIODEV"); } - if (audiodev == NULL) { + if (!audiodev) { if (classic) { audiodev = _PATH_DEV_AUDIO; } else { diff --git a/thirdparty/SDL/src/audio/SDL_audiodev_c.h b/thirdparty/SDL/src/audio/SDL_audiodev_c.h index 9e890c395..1235ea445 100644 --- a/thirdparty/SDL/src/audio/SDL_audiodev_c.h +++ b/thirdparty/SDL/src/audio/SDL_audiodev_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/audio/SDL_audiotypecvt.c b/thirdparty/SDL/src/audio/SDL_audiotypecvt.c index 7ffa4dd19..221bfbb8d 100644 --- a/thirdparty/SDL/src/audio/SDL_audiotypecvt.c +++ b/thirdparty/SDL/src/audio/SDL_audiotypecvt.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -29,16 +29,16 @@ #endif #ifdef __SSE2__ -#define HAVE_SSE2_INTRINSICS 1 +#define HAVE_SSE2_INTRINSICS #endif -#if defined(__x86_64__) && HAVE_SSE2_INTRINSICS +#if defined(__x86_64__) && defined(HAVE_SSE2_INTRINSICS) #define NEED_SCALAR_CONVERTER_FALLBACKS 0 /* x86_64 guarantees SSE2. */ -#elif __MACOSX__ && HAVE_SSE2_INTRINSICS +#elif defined(__MACOSX__) && defined(HAVE_SSE2_INTRINSICS) #define NEED_SCALAR_CONVERTER_FALLBACKS 0 /* Mac OS X/Intel guarantees SSE2. */ -#elif defined(__ARM_ARCH) && (__ARM_ARCH >= 8) && HAVE_NEON_INTRINSICS +#elif defined(__ARM_ARCH) && (__ARM_ARCH >= 8) && defined(HAVE_NEON_INTRINSICS) #define NEED_SCALAR_CONVERTER_FALLBACKS 0 /* ARMv8+ promise NEON. */ -#elif defined(__APPLE__) && defined(__ARM_ARCH) && (__ARM_ARCH >= 7) && HAVE_NEON_INTRINSICS +#elif defined(__APPLE__) && defined(__ARM_ARCH) && (__ARM_ARCH >= 7) && defined(HAVE_NEON_INTRINSICS) #define NEED_SCALAR_CONVERTER_FALLBACKS 0 /* All Apple ARMv7 chips promise NEON support. */ #endif @@ -62,18 +62,36 @@ SDL_AudioFilter SDL_Convert_F32_to_S32 = NULL; #define DIVBY128 0.0078125f #define DIVBY32768 0.000030517578125f #define DIVBY8388607 0.00000011920930376163766f +#define DIVBY2147483648 0.0000000004656612873077392578125f /* 0x1p-31f */ #if NEED_SCALAR_CONVERTER_FALLBACKS + +/* This code requires that floats are in the IEEE-754 binary32 format */ +SDL_COMPILE_TIME_ASSERT(float_bits, sizeof(float) == sizeof(Uint32)); + +union float_bits { + Uint32 u32; + float f32; +}; + +/* Create a bit-mask based on the sign-bit. Should optimize to a single arithmetic-shift-right */ +#define SIGNMASK(x) (Uint32)(0u - ((Uint32)(x) >> 31)) + static void SDLCALL SDL_Convert_S8_to_F32_Scalar(SDL_AudioCVT *cvt, SDL_AudioFormat format) { - const Sint8 *src = ((const Sint8 *)(cvt->buf + cvt->len_cvt)) - 1; - float *dst = ((float *)(cvt->buf + cvt->len_cvt * 4)) - 1; + const int num_samples = cvt->len_cvt; + const Sint8 *src = (const Sint8 *)cvt->buf; + float *dst = (float *)cvt->buf; int i; LOG_DEBUG_CONVERT("AUDIO_S8", "AUDIO_F32"); - for (i = cvt->len_cvt; i; --i, --src, --dst) { - *dst = ((float)*src) * DIVBY128; + for (i = num_samples - 1; i >= 0; --i) { + /* 1) Construct a float in the range [65536.0, 65538.0) + * 2) Shift the float range to [-1.0, 1.0) */ + union float_bits x; + x.u32 = (Uint8)src[i] ^ 0x47800080u; + dst[i] = x.f32 - 65537.0f; } cvt->len_cvt *= 4; @@ -84,14 +102,19 @@ static void SDLCALL SDL_Convert_S8_to_F32_Scalar(SDL_AudioCVT *cvt, SDL_AudioFor static void SDLCALL SDL_Convert_U8_to_F32_Scalar(SDL_AudioCVT *cvt, SDL_AudioFormat format) { - const Uint8 *src = ((const Uint8 *)(cvt->buf + cvt->len_cvt)) - 1; - float *dst = ((float *)(cvt->buf + cvt->len_cvt * 4)) - 1; + const int num_samples = cvt->len_cvt; + const Uint8 *src = (const Uint8 *)cvt->buf; + float *dst = (float *)cvt->buf; int i; LOG_DEBUG_CONVERT("AUDIO_U8", "AUDIO_F32"); - for (i = cvt->len_cvt; i; --i, --src, --dst) { - *dst = (((float)*src) * DIVBY128) - 1.0f; + for (i = num_samples - 1; i >= 0; --i) { + /* 1) Construct a float in the range [65536.0, 65538.0) + * 2) Shift the float range to [-1.0, 1.0) */ + union float_bits x; + x.u32 = src[i] ^ 0x47800000u; + dst[i] = x.f32 - 65537.0f; } cvt->len_cvt *= 4; @@ -102,14 +125,19 @@ static void SDLCALL SDL_Convert_U8_to_F32_Scalar(SDL_AudioCVT *cvt, SDL_AudioFor static void SDLCALL SDL_Convert_S16_to_F32_Scalar(SDL_AudioCVT *cvt, SDL_AudioFormat format) { - const Sint16 *src = ((const Sint16 *)(cvt->buf + cvt->len_cvt)) - 1; - float *dst = ((float *)(cvt->buf + cvt->len_cvt * 2)) - 1; + const int num_samples = cvt->len_cvt / sizeof(Sint16); + const Sint16 *src = (const Sint16 *)cvt->buf; + float *dst = (float *)cvt->buf; int i; LOG_DEBUG_CONVERT("AUDIO_S16", "AUDIO_F32"); - for (i = cvt->len_cvt / sizeof(Sint16); i; --i, --src, --dst) { - *dst = ((float)*src) * DIVBY32768; + for (i = num_samples - 1; i >= 0; --i) { + /* 1) Construct a float in the range [256.0, 258.0) + * 2) Shift the float range to [-1.0, 1.0) */ + union float_bits x; + x.u32 = (Uint16)src[i] ^ 0x43808000u; + dst[i] = x.f32 - 257.0f; } cvt->len_cvt *= 2; @@ -155,21 +183,26 @@ static void SDLCALL SDL_Convert_S32_to_F32_Scalar(SDL_AudioCVT *cvt, SDL_AudioFo static void SDLCALL SDL_Convert_F32_to_S8_Scalar(SDL_AudioCVT *cvt, SDL_AudioFormat format) { + const int num_samples = cvt->len_cvt / sizeof (float); const float *src = (const float *)cvt->buf; Sint8 *dst = (Sint8 *)cvt->buf; int i; LOG_DEBUG_CONVERT("AUDIO_F32", "AUDIO_S8"); - for (i = cvt->len_cvt / sizeof(float); i; --i, ++src, ++dst) { - const float sample = *src; - if (sample >= 1.0f) { - *dst = 127; - } else if (sample <= -1.0f) { - *dst = -128; - } else { - *dst = (Sint8)(sample * 127.0f); - } + for (i = 0; i < num_samples; ++i) { + /* 1) Shift the float range from [-1.0, 1.0] to [98303.0, 98305.0] + * 2) Shift the integer range from [0x47BFFF80, 0x47C00080] to [-128, 128] + * 3) Clamp the value to [-128, 127] */ + union float_bits x; + Uint32 y, z; + x.f32 = src[i] + 98304.0f; + + y = x.u32 - 0x47C00000u; + z = 0x7Fu - (y ^ SIGNMASK(y)); + y = y ^ (z & SIGNMASK(z)); + + dst[i] = (Sint8)(y & 0xFF); } cvt->len_cvt /= 4; @@ -180,21 +213,27 @@ static void SDLCALL SDL_Convert_F32_to_S8_Scalar(SDL_AudioCVT *cvt, SDL_AudioFor static void SDLCALL SDL_Convert_F32_to_U8_Scalar(SDL_AudioCVT *cvt, SDL_AudioFormat format) { + const int num_samples = cvt->len_cvt / sizeof (float); const float *src = (const float *)cvt->buf; Uint8 *dst = (Uint8 *)cvt->buf; int i; LOG_DEBUG_CONVERT("AUDIO_F32", "AUDIO_U8"); - for (i = cvt->len_cvt / sizeof(float); i; --i, ++src, ++dst) { - const float sample = *src; - if (sample >= 1.0f) { - *dst = 255; - } else if (sample <= -1.0f) { - *dst = 0; - } else { - *dst = (Uint8)((sample + 1.0f) * 127.0f); - } + for (i = 0; i < num_samples; ++i) { + /* 1) Shift the float range from [-1.0, 1.0] to [98303.0, 98305.0] + * 2) Shift the integer range from [0x47BFFF80, 0x47C00080] to [-128, 128] + * 3) Clamp the value to [-128, 127] + * 4) Shift the integer range from [-128, 127] to [0, 255] */ + union float_bits x; + Uint32 y, z; + x.f32 = src[i] + 98304.0f; + + y = x.u32 - 0x47C00000u; + z = 0x7Fu - (y ^ SIGNMASK(y)); + y = (y ^ 0x80u) ^ (z & SIGNMASK(z)); + + dst[i] = (Uint8)(y & 0xFF); } cvt->len_cvt /= 4; @@ -205,21 +244,26 @@ static void SDLCALL SDL_Convert_F32_to_U8_Scalar(SDL_AudioCVT *cvt, SDL_AudioFor static void SDLCALL SDL_Convert_F32_to_S16_Scalar(SDL_AudioCVT *cvt, SDL_AudioFormat format) { + const int num_samples = cvt->len_cvt / sizeof (float); const float *src = (const float *)cvt->buf; Sint16 *dst = (Sint16 *)cvt->buf; int i; LOG_DEBUG_CONVERT("AUDIO_F32", "AUDIO_S16"); - for (i = cvt->len_cvt / sizeof(float); i; --i, ++src, ++dst) { - const float sample = *src; - if (sample >= 1.0f) { - *dst = 32767; - } else if (sample <= -1.0f) { - *dst = -32768; - } else { - *dst = (Sint16)(sample * 32767.0f); - } + for (i = 0; i < num_samples; ++i) { + /* 1) Shift the float range from [-1.0, 1.0] to [383.0, 385.0] + * 2) Shift the integer range from [0x43BF8000, 0x43C08000] to [-32768, 32768] + * 3) Clamp values outside the [-32768, 32767] range */ + union float_bits x; + Uint32 y, z; + x.f32 = src[i] + 384.0f; + + y = x.u32 - 0x43C00000u; + z = 0x7FFFu - (y ^ SIGNMASK(y)); + y = y ^ (z & SIGNMASK(z)); + + dst[i] = (Sint16)(y & 0xFFFF); } cvt->len_cvt /= 2; @@ -255,21 +299,27 @@ static void SDLCALL SDL_Convert_F32_to_U16_Scalar(SDL_AudioCVT *cvt, SDL_AudioFo static void SDLCALL SDL_Convert_F32_to_S32_Scalar(SDL_AudioCVT *cvt, SDL_AudioFormat format) { + const int num_samples = cvt->len_cvt / sizeof (float); const float *src = (const float *)cvt->buf; Sint32 *dst = (Sint32 *)cvt->buf; int i; LOG_DEBUG_CONVERT("AUDIO_F32", "AUDIO_S32"); - for (i = cvt->len_cvt / sizeof(float); i; --i, ++src, ++dst) { - const float sample = *src; - if (sample >= 1.0f) { - *dst = 2147483647; - } else if (sample <= -1.0f) { - *dst = (Sint32)-2147483648LL; - } else { - *dst = ((Sint32)(sample * 8388607.0f)) << 8; - } + for (i = 0; i < num_samples; ++i) { + /* 1) Shift the float range from [-1.0, 1.0] to [-2147483648.0, 2147483648.0] + * 2) Set values outside the [-2147483648.0, 2147483647.0] range to -2147483648.0 + * 3) Convert the float to an integer, and fixup values outside the valid range */ + union float_bits x; + Uint32 y, z; + x.f32 = src[i]; + + y = x.u32 + 0x0F800000u; + z = y - 0xCF000000u; + z &= SIGNMASK(y ^ z); + x.u32 = y - z; + + dst[i] = (Sint32)x.f32 ^ (Sint32)SIGNMASK(z); } if (cvt->filters[++cvt->filter_index]) { @@ -278,63 +328,48 @@ static void SDLCALL SDL_Convert_F32_to_S32_Scalar(SDL_AudioCVT *cvt, SDL_AudioFo } #endif -#if HAVE_SSE2_INTRINSICS +#ifdef HAVE_SSE2_INTRINSICS static void SDLCALL SDL_Convert_S8_to_F32_SSE2(SDL_AudioCVT *cvt, SDL_AudioFormat format) { - const Sint8 *src = ((const Sint8 *)(cvt->buf + cvt->len_cvt)) - 1; - float *dst = ((float *)(cvt->buf + cvt->len_cvt * 4)) - 1; - int i; + const Sint8 *src = (const Sint8 *)cvt->buf; + float *dst = (float *)cvt->buf; + int i = cvt->len_cvt; + + /* 1) Flip the sign bit to convert from S8 to U8 format + * 2) Construct a float in the range [65536.0, 65538.0) + * 3) Shift the float range to [-1.0, 1.0) + * dst[i] = i2f((src[i] ^ 0x80) | 0x47800000) - 65537.0 */ + const __m128i zero = _mm_setzero_si128(); + const __m128i flipper = _mm_set1_epi8(-0x80); + const __m128i caster = _mm_set1_epi16(0x4780 /* 0x47800000 = f2i(65536.0) */); + const __m128 offset = _mm_set1_ps(-65537.0); LOG_DEBUG_CONVERT("AUDIO_S8", "AUDIO_F32 (using SSE2)"); - /* Get dst aligned to 16 bytes (since buffer is growing, we don't have to worry about overreading from src) */ - for (i = cvt->len_cvt; i && (((size_t)(dst - 15)) & 15); --i, --src, --dst) { - *dst = ((float)*src) * DIVBY128; - } + while (i >= 16) { + i -= 16; - src -= 15; - dst -= 15; /* adjust to read SSE blocks from the start. */ - SDL_assert(!i || !(((size_t)dst) & 15)); + { + const __m128i bytes = _mm_xor_si128(_mm_loadu_si128((const __m128i *)&src[i]), flipper); - /* Make sure src is aligned too. */ - if (!(((size_t)src) & 15)) { - /* Aligned! Do SSE blocks as long as we have 16 bytes available. */ - const __m128i *mmsrc = (const __m128i *)src; - const __m128i zero = _mm_setzero_si128(); - const __m128 divby128 = _mm_set1_ps(DIVBY128); - while (i >= 16) { /* 16 * 8-bit */ - const __m128i bytes = _mm_load_si128(mmsrc); /* get 16 sint8 into an XMM register. */ - /* treat as int16, shift left to clear every other sint16, then back right with sign-extend. Now sint16. */ - const __m128i shorts1 = _mm_srai_epi16(_mm_slli_epi16(bytes, 8), 8); - /* right-shift-sign-extend gets us sint16 with the other set of values. */ - const __m128i shorts2 = _mm_srai_epi16(bytes, 8); - /* unpack against zero to make these int32, shift to make them sign-extend, convert to float, multiply. Whew! */ - const __m128 floats1 = _mm_mul_ps(_mm_cvtepi32_ps(_mm_srai_epi32(_mm_slli_epi32(_mm_unpacklo_epi16(shorts1, zero), 16), 16)), divby128); - const __m128 floats2 = _mm_mul_ps(_mm_cvtepi32_ps(_mm_srai_epi32(_mm_slli_epi32(_mm_unpacklo_epi16(shorts2, zero), 16), 16)), divby128); - const __m128 floats3 = _mm_mul_ps(_mm_cvtepi32_ps(_mm_srai_epi32(_mm_slli_epi32(_mm_unpackhi_epi16(shorts1, zero), 16), 16)), divby128); - const __m128 floats4 = _mm_mul_ps(_mm_cvtepi32_ps(_mm_srai_epi32(_mm_slli_epi32(_mm_unpackhi_epi16(shorts2, zero), 16), 16)), divby128); - /* Interleave back into correct order, store. */ - _mm_store_ps(dst, _mm_unpacklo_ps(floats1, floats2)); - _mm_store_ps(dst + 4, _mm_unpackhi_ps(floats1, floats2)); - _mm_store_ps(dst + 8, _mm_unpacklo_ps(floats3, floats4)); - _mm_store_ps(dst + 12, _mm_unpackhi_ps(floats3, floats4)); - i -= 16; - mmsrc--; - dst -= 16; - } + const __m128i shorts1 = _mm_unpacklo_epi8(bytes, zero); + const __m128i shorts2 = _mm_unpackhi_epi8(bytes, zero); - src = (const Sint8 *)mmsrc; - } + const __m128 floats1 = _mm_add_ps(_mm_castsi128_ps(_mm_unpacklo_epi16(shorts1, caster)), offset); + const __m128 floats2 = _mm_add_ps(_mm_castsi128_ps(_mm_unpackhi_epi16(shorts1, caster)), offset); + const __m128 floats3 = _mm_add_ps(_mm_castsi128_ps(_mm_unpacklo_epi16(shorts2, caster)), offset); + const __m128 floats4 = _mm_add_ps(_mm_castsi128_ps(_mm_unpackhi_epi16(shorts2, caster)), offset); - src += 15; - dst += 15; /* adjust for any scalar finishing. */ + _mm_storeu_ps(&dst[i], floats1); + _mm_storeu_ps(&dst[i + 4], floats2); + _mm_storeu_ps(&dst[i + 8], floats3); + _mm_storeu_ps(&dst[i + 12], floats4); + } + } - /* Finish off any leftovers with scalar operations. */ while (i) { - *dst = ((float)*src) * DIVBY128; - i--; - src--; - dst--; + --i; + _mm_store_ss(&dst[i], _mm_add_ss(_mm_castsi128_ps(_mm_cvtsi32_si128((Uint8)src[i] ^ 0x47800080u)), offset)); } cvt->len_cvt *= 4; @@ -345,62 +380,43 @@ static void SDLCALL SDL_Convert_S8_to_F32_SSE2(SDL_AudioCVT *cvt, SDL_AudioForma static void SDLCALL SDL_Convert_U8_to_F32_SSE2(SDL_AudioCVT *cvt, SDL_AudioFormat format) { - const Uint8 *src = ((const Uint8 *)(cvt->buf + cvt->len_cvt)) - 1; - float *dst = ((float *)(cvt->buf + cvt->len_cvt * 4)) - 1; - int i; + const Sint8 *src = (const Sint8 *)cvt->buf; + float *dst = (float *)cvt->buf; + int i = cvt->len_cvt; + + /* 1) Construct a float in the range [65536.0, 65538.0) + * 2) Shift the float range to [-1.0, 1.0) + * dst[i] = i2f(src[i] | 0x47800000) - 65537.0 */ + const __m128i zero = _mm_setzero_si128(); + const __m128i caster = _mm_set1_epi16(0x4780 /* 0x47800000 = f2i(65536.0) */); + const __m128 offset = _mm_set1_ps(-65537.0); LOG_DEBUG_CONVERT("AUDIO_U8", "AUDIO_F32 (using SSE2)"); - /* Get dst aligned to 16 bytes (since buffer is growing, we don't have to worry about overreading from src) */ - for (i = cvt->len_cvt; i && (((size_t)(dst - 15)) & 15); --i, --src, --dst) { - *dst = (((float)*src) * DIVBY128) - 1.0f; - } + while (i >= 16) { + i -= 16; - src -= 15; - dst -= 15; /* adjust to read SSE blocks from the start. */ - SDL_assert(!i || !(((size_t)dst) & 15)); + { + const __m128i bytes = _mm_loadu_si128((const __m128i *)&src[i]); - /* Make sure src is aligned too. */ - if (!(((size_t)src) & 15)) { - /* Aligned! Do SSE blocks as long as we have 16 bytes available. */ - const __m128i *mmsrc = (const __m128i *)src; - const __m128i zero = _mm_setzero_si128(); - const __m128 divby128 = _mm_set1_ps(DIVBY128); - const __m128 minus1 = _mm_set1_ps(-1.0f); - while (i >= 16) { /* 16 * 8-bit */ - const __m128i bytes = _mm_load_si128(mmsrc); /* get 16 uint8 into an XMM register. */ - /* treat as int16, shift left to clear every other sint16, then back right with zero-extend. Now uint16. */ - const __m128i shorts1 = _mm_srli_epi16(_mm_slli_epi16(bytes, 8), 8); - /* right-shift-zero-extend gets us uint16 with the other set of values. */ - const __m128i shorts2 = _mm_srli_epi16(bytes, 8); - /* unpack against zero to make these int32, convert to float, multiply, add. Whew! */ - /* Note that AVX2 can do floating point multiply+add in one instruction, fwiw. SSE2 cannot. */ - const __m128 floats1 = _mm_add_ps(_mm_mul_ps(_mm_cvtepi32_ps(_mm_unpacklo_epi16(shorts1, zero)), divby128), minus1); - const __m128 floats2 = _mm_add_ps(_mm_mul_ps(_mm_cvtepi32_ps(_mm_unpacklo_epi16(shorts2, zero)), divby128), minus1); - const __m128 floats3 = _mm_add_ps(_mm_mul_ps(_mm_cvtepi32_ps(_mm_unpackhi_epi16(shorts1, zero)), divby128), minus1); - const __m128 floats4 = _mm_add_ps(_mm_mul_ps(_mm_cvtepi32_ps(_mm_unpackhi_epi16(shorts2, zero)), divby128), minus1); - /* Interleave back into correct order, store. */ - _mm_store_ps(dst, _mm_unpacklo_ps(floats1, floats2)); - _mm_store_ps(dst + 4, _mm_unpackhi_ps(floats1, floats2)); - _mm_store_ps(dst + 8, _mm_unpacklo_ps(floats3, floats4)); - _mm_store_ps(dst + 12, _mm_unpackhi_ps(floats3, floats4)); - i -= 16; - mmsrc--; - dst -= 16; - } + const __m128i shorts1 = _mm_unpacklo_epi8(bytes, zero); + const __m128i shorts2 = _mm_unpackhi_epi8(bytes, zero); - src = (const Uint8 *)mmsrc; - } + const __m128 floats1 = _mm_add_ps(_mm_castsi128_ps(_mm_unpacklo_epi16(shorts1, caster)), offset); + const __m128 floats2 = _mm_add_ps(_mm_castsi128_ps(_mm_unpackhi_epi16(shorts1, caster)), offset); + const __m128 floats3 = _mm_add_ps(_mm_castsi128_ps(_mm_unpacklo_epi16(shorts2, caster)), offset); + const __m128 floats4 = _mm_add_ps(_mm_castsi128_ps(_mm_unpackhi_epi16(shorts2, caster)), offset); - src += 15; - dst += 15; /* adjust for any scalar finishing. */ + _mm_storeu_ps(&dst[i], floats1); + _mm_storeu_ps(&dst[i + 4], floats2); + _mm_storeu_ps(&dst[i + 8], floats3); + _mm_storeu_ps(&dst[i + 12], floats4); + } + } - /* Finish off any leftovers with scalar operations. */ while (i) { - *dst = (((float)*src) * DIVBY128) - 1.0f; - i--; - src--; - dst--; + --i; + _mm_store_ss(&dst[i], _mm_add_ss(_mm_castsi128_ps(_mm_cvtsi32_si128((Uint8)src[i] ^ 0x47800000u)), offset)); } cvt->len_cvt *= 4; @@ -411,49 +427,42 @@ static void SDLCALL SDL_Convert_U8_to_F32_SSE2(SDL_AudioCVT *cvt, SDL_AudioForma static void SDLCALL SDL_Convert_S16_to_F32_SSE2(SDL_AudioCVT *cvt, SDL_AudioFormat format) { - const Sint16 *src = ((const Sint16 *)(cvt->buf + cvt->len_cvt)) - 1; - float *dst = ((float *)(cvt->buf + cvt->len_cvt * 2)) - 1; - int i; + const Sint16 *src = (const Sint16 *)cvt->buf; + float *dst = (float *)cvt->buf; + int i = cvt->len_cvt / 2; + + /* 1) Flip the sign bit to convert from S16 to U16 format + * 2) Construct a float in the range [256.0, 258.0) + * 3) Shift the float range to [-1.0, 1.0) + * dst[i] = i2f((src[i] ^ 0x8000) | 0x43800000) - 257.0 */ + const __m128i flipper = _mm_set1_epi16(-0x8000); + const __m128i caster = _mm_set1_epi16(0x4380 /* 0x43800000 = f2i(256.0) */); + const __m128 offset = _mm_set1_ps(-257.0f); LOG_DEBUG_CONVERT("AUDIO_S16", "AUDIO_F32 (using SSE2)"); - /* Get dst aligned to 16 bytes (since buffer is growing, we don't have to worry about overreading from src) */ - for (i = cvt->len_cvt / sizeof(Sint16); i && (((size_t)(dst - 7)) & 15); --i, --src, --dst) { - *dst = ((float)*src) * DIVBY32768; - } + while (i >= 16) { + i -= 16; - src -= 7; - dst -= 7; /* adjust to read SSE blocks from the start. */ - SDL_assert(!i || !(((size_t)dst) & 15)); + { + const __m128i shorts1 = _mm_xor_si128(_mm_loadu_si128((const __m128i *)&src[i]), flipper); + const __m128i shorts2 = _mm_xor_si128(_mm_loadu_si128((const __m128i *)&src[i + 8]), flipper); - /* Make sure src is aligned too. */ - if (!(((size_t)src) & 15)) { - /* Aligned! Do SSE blocks as long as we have 16 bytes available. */ - const __m128 divby32768 = _mm_set1_ps(DIVBY32768); - while (i >= 8) { /* 8 * 16-bit */ - const __m128i ints = _mm_load_si128((__m128i const *)src); /* get 8 sint16 into an XMM register. */ - /* treat as int32, shift left to clear every other sint16, then back right with sign-extend. Now sint32. */ - const __m128i a = _mm_srai_epi32(_mm_slli_epi32(ints, 16), 16); - /* right-shift-sign-extend gets us sint32 with the other set of values. */ - const __m128i b = _mm_srai_epi32(ints, 16); - /* Interleave these back into the right order, convert to float, multiply, store. */ - _mm_store_ps(dst, _mm_mul_ps(_mm_cvtepi32_ps(_mm_unpacklo_epi32(a, b)), divby32768)); - _mm_store_ps(dst + 4, _mm_mul_ps(_mm_cvtepi32_ps(_mm_unpackhi_epi32(a, b)), divby32768)); - i -= 8; - src -= 8; - dst -= 8; + const __m128 floats1 = _mm_add_ps(_mm_castsi128_ps(_mm_unpacklo_epi16(shorts1, caster)), offset); + const __m128 floats2 = _mm_add_ps(_mm_castsi128_ps(_mm_unpackhi_epi16(shorts1, caster)), offset); + const __m128 floats3 = _mm_add_ps(_mm_castsi128_ps(_mm_unpacklo_epi16(shorts2, caster)), offset); + const __m128 floats4 = _mm_add_ps(_mm_castsi128_ps(_mm_unpackhi_epi16(shorts2, caster)), offset); + + _mm_storeu_ps(&dst[i], floats1); + _mm_storeu_ps(&dst[i + 4], floats2); + _mm_storeu_ps(&dst[i + 8], floats3); + _mm_storeu_ps(&dst[i + 12], floats4); } } - src += 7; - dst += 7; /* adjust for any scalar finishing. */ - - /* Finish off any leftovers with scalar operations. */ while (i) { - *dst = ((float)*src) * DIVBY32768; - i--; - src--; - dst--; + --i; + _mm_store_ss(&dst[i], _mm_add_ss(_mm_castsi128_ps(_mm_cvtsi32_si128((Uint16)src[i] ^ 0x43808000u)), offset)); } cvt->len_cvt *= 2; @@ -520,38 +529,37 @@ static void SDLCALL SDL_Convert_S32_to_F32_SSE2(SDL_AudioCVT *cvt, SDL_AudioForm { const Sint32 *src = (const Sint32 *)cvt->buf; float *dst = (float *)cvt->buf; - int i; + int i = cvt->len_cvt / 4; + + /* dst[i] = f32(src[i]) / f32(0x80000000) */ + const __m128 scaler = _mm_set1_ps(DIVBY2147483648); LOG_DEBUG_CONVERT("AUDIO_S32", "AUDIO_F32 (using SSE2)"); - /* Get dst aligned to 16 bytes */ - for (i = cvt->len_cvt / sizeof(Sint32); i && (((size_t)dst) & 15); --i, ++src, ++dst) { - *dst = ((float)(*src >> 8)) * DIVBY8388607; - } + while (i >= 16) { + i -= 16; - SDL_assert(!i || !(((size_t)dst) & 15)); + { + const __m128i ints1 = _mm_loadu_si128((const __m128i *)&src[i]); + const __m128i ints2 = _mm_loadu_si128((const __m128i *)&src[i + 4]); + const __m128i ints3 = _mm_loadu_si128((const __m128i *)&src[i + 8]); + const __m128i ints4 = _mm_loadu_si128((const __m128i *)&src[i + 12]); - /* Make sure src is aligned too. */ - if (!(((size_t)src) & 15)) { - /* Aligned! Do SSE blocks as long as we have 16 bytes available. */ - const __m128 divby8388607 = _mm_set1_ps(DIVBY8388607); - const __m128i *mmsrc = (const __m128i *)src; - while (i >= 4) { /* 4 * sint32 */ - /* shift out lowest bits so int fits in a float32. Small precision loss, but much faster. */ - _mm_store_ps(dst, _mm_mul_ps(_mm_cvtepi32_ps(_mm_srai_epi32(_mm_load_si128(mmsrc), 8)), divby8388607)); - i -= 4; - mmsrc++; - dst += 4; + const __m128 floats1 = _mm_mul_ps(_mm_cvtepi32_ps(ints1), scaler); + const __m128 floats2 = _mm_mul_ps(_mm_cvtepi32_ps(ints2), scaler); + const __m128 floats3 = _mm_mul_ps(_mm_cvtepi32_ps(ints3), scaler); + const __m128 floats4 = _mm_mul_ps(_mm_cvtepi32_ps(ints4), scaler); + + _mm_storeu_ps(&dst[i], floats1); + _mm_storeu_ps(&dst[i + 4], floats2); + _mm_storeu_ps(&dst[i + 8], floats3); + _mm_storeu_ps(&dst[i + 12], floats4); } - src = (const Sint32 *)mmsrc; } - /* Finish off any leftovers with scalar operations. */ while (i) { - *dst = ((float)(*src >> 8)) * DIVBY8388607; - i--; - src++; - dst++; + --i; + _mm_store_ss(&dst[i], _mm_mul_ss(_mm_cvt_si2ss(_mm_setzero_ps(), src[i]), scaler)); } if (cvt->filters[++cvt->filter_index]) { @@ -563,57 +571,47 @@ static void SDLCALL SDL_Convert_F32_to_S8_SSE2(SDL_AudioCVT *cvt, SDL_AudioForma { const float *src = (const float *)cvt->buf; Sint8 *dst = (Sint8 *)cvt->buf; - int i; + int i = cvt->len_cvt / 4; + + /* 1) Shift the float range from [-1.0, 1.0] to [98303.0, 98305.0] + * 2) Extract the lowest 16 bits and clamp to [-128, 127] + * Overflow is correctly handled for inputs between roughly [-255.0, 255.0] + * dst[i] = clamp(i16(f2i(src[i] + 98304.0) & 0xFFFF), -128, 127) */ + const __m128 offset = _mm_set1_ps(98304.0f); + const __m128i mask = _mm_set1_epi16(0xFF); LOG_DEBUG_CONVERT("AUDIO_F32", "AUDIO_S8 (using SSE2)"); - /* Get dst aligned to 16 bytes */ - for (i = cvt->len_cvt / sizeof(float); i && (((size_t)dst) & 15); --i, ++src, ++dst) { - const float sample = *src; - if (sample >= 1.0f) { - *dst = 127; - } else if (sample <= -1.0f) { - *dst = -128; - } else { - *dst = (Sint8)(sample * 127.0f); - } - } + while (i >= 16) { + const __m128 floats1 = _mm_loadu_ps(&src[0]); + const __m128 floats2 = _mm_loadu_ps(&src[4]); + const __m128 floats3 = _mm_loadu_ps(&src[8]); + const __m128 floats4 = _mm_loadu_ps(&src[12]); - SDL_assert(!i || !(((size_t)dst) & 15)); + const __m128i ints1 = _mm_castps_si128(_mm_add_ps(floats1, offset)); + const __m128i ints2 = _mm_castps_si128(_mm_add_ps(floats2, offset)); + const __m128i ints3 = _mm_castps_si128(_mm_add_ps(floats3, offset)); + const __m128i ints4 = _mm_castps_si128(_mm_add_ps(floats4, offset)); - /* Make sure src is aligned too. */ - if (!(((size_t)src) & 15)) { - /* Aligned! Do SSE blocks as long as we have 16 bytes available. */ - const __m128 one = _mm_set1_ps(1.0f); - const __m128 negone = _mm_set1_ps(-1.0f); - const __m128 mulby127 = _mm_set1_ps(127.0f); - __m128i *mmdst = (__m128i *)dst; - while (i >= 16) { /* 16 * float32 */ - const __m128i ints1 = _mm_cvtps_epi32(_mm_mul_ps(_mm_min_ps(_mm_max_ps(negone, _mm_load_ps(src)), one), mulby127)); /* load 4 floats, clamp, convert to sint32 */ - const __m128i ints2 = _mm_cvtps_epi32(_mm_mul_ps(_mm_min_ps(_mm_max_ps(negone, _mm_load_ps(src + 4)), one), mulby127)); /* load 4 floats, clamp, convert to sint32 */ - const __m128i ints3 = _mm_cvtps_epi32(_mm_mul_ps(_mm_min_ps(_mm_max_ps(negone, _mm_load_ps(src + 8)), one), mulby127)); /* load 4 floats, clamp, convert to sint32 */ - const __m128i ints4 = _mm_cvtps_epi32(_mm_mul_ps(_mm_min_ps(_mm_max_ps(negone, _mm_load_ps(src + 12)), one), mulby127)); /* load 4 floats, clamp, convert to sint32 */ - _mm_store_si128(mmdst, _mm_packs_epi16(_mm_packs_epi32(ints1, ints2), _mm_packs_epi32(ints3, ints4))); /* pack down, store out. */ - i -= 16; - src += 16; - mmdst++; - } - dst = (Sint8 *)mmdst; + const __m128i shorts1 = _mm_and_si128(_mm_packs_epi16(ints1, ints2), mask); + const __m128i shorts2 = _mm_and_si128(_mm_packs_epi16(ints3, ints4), mask); + + const __m128i bytes = _mm_packus_epi16(shorts1, shorts2); + + _mm_storeu_si128((__m128i*)dst, bytes); + + i -= 16; + src += 16; + dst += 16; } - /* Finish off any leftovers with scalar operations. */ while (i) { - const float sample = *src; - if (sample >= 1.0f) { - *dst = 127; - } else if (sample <= -1.0f) { - *dst = -128; - } else { - *dst = (Sint8)(sample * 127.0f); - } - i--; - src++; - dst++; + const __m128i ints = _mm_castps_si128(_mm_add_ss(_mm_load_ss(src), offset)); + *dst = (Sint8)(_mm_cvtsi128_si32(_mm_packs_epi16(ints, ints)) & 0xFF); + + --i; + ++src; + ++dst; } cvt->len_cvt /= 4; @@ -626,57 +624,47 @@ static void SDLCALL SDL_Convert_F32_to_U8_SSE2(SDL_AudioCVT *cvt, SDL_AudioForma { const float *src = (const float *)cvt->buf; Uint8 *dst = cvt->buf; - int i; + int i = cvt->len_cvt / 4; + + /* 1) Shift the float range from [-1.0, 1.0] to [98304.0, 98306.0] + * 2) Extract the lowest 16 bits and clamp to [0, 255] + * Overflow is correctly handled for inputs between roughly [-254.0, 254.0] + * dst[i] = clamp(i16(f2i(src[i] + 98305.0) & 0xFFFF), 0, 255) */ + const __m128 offset = _mm_set1_ps(98305.0f); + const __m128i mask = _mm_set1_epi16(0xFF); LOG_DEBUG_CONVERT("AUDIO_F32", "AUDIO_U8 (using SSE2)"); - /* Get dst aligned to 16 bytes */ - for (i = cvt->len_cvt / sizeof(float); i && (((size_t)dst) & 15); --i, ++src, ++dst) { - const float sample = *src; - if (sample >= 1.0f) { - *dst = 255; - } else if (sample <= -1.0f) { - *dst = 0; - } else { - *dst = (Uint8)((sample + 1.0f) * 127.0f); - } - } + while (i >= 16) { + const __m128 floats1 = _mm_loadu_ps(&src[0]); + const __m128 floats2 = _mm_loadu_ps(&src[4]); + const __m128 floats3 = _mm_loadu_ps(&src[8]); + const __m128 floats4 = _mm_loadu_ps(&src[12]); - SDL_assert(!i || !(((size_t)dst) & 15)); + const __m128i ints1 = _mm_castps_si128(_mm_add_ps(floats1, offset)); + const __m128i ints2 = _mm_castps_si128(_mm_add_ps(floats2, offset)); + const __m128i ints3 = _mm_castps_si128(_mm_add_ps(floats3, offset)); + const __m128i ints4 = _mm_castps_si128(_mm_add_ps(floats4, offset)); - /* Make sure src is aligned too. */ - if (!(((size_t)src) & 15)) { - /* Aligned! Do SSE blocks as long as we have 16 bytes available. */ - const __m128 one = _mm_set1_ps(1.0f); - const __m128 negone = _mm_set1_ps(-1.0f); - const __m128 mulby127 = _mm_set1_ps(127.0f); - __m128i *mmdst = (__m128i *)dst; - while (i >= 16) { /* 16 * float32 */ - const __m128i ints1 = _mm_cvtps_epi32(_mm_mul_ps(_mm_add_ps(_mm_min_ps(_mm_max_ps(negone, _mm_load_ps(src)), one), one), mulby127)); /* load 4 floats, clamp, convert to sint32 */ - const __m128i ints2 = _mm_cvtps_epi32(_mm_mul_ps(_mm_add_ps(_mm_min_ps(_mm_max_ps(negone, _mm_load_ps(src + 4)), one), one), mulby127)); /* load 4 floats, clamp, convert to sint32 */ - const __m128i ints3 = _mm_cvtps_epi32(_mm_mul_ps(_mm_add_ps(_mm_min_ps(_mm_max_ps(negone, _mm_load_ps(src + 8)), one), one), mulby127)); /* load 4 floats, clamp, convert to sint32 */ - const __m128i ints4 = _mm_cvtps_epi32(_mm_mul_ps(_mm_add_ps(_mm_min_ps(_mm_max_ps(negone, _mm_load_ps(src + 12)), one), one), mulby127)); /* load 4 floats, clamp, convert to sint32 */ - _mm_store_si128(mmdst, _mm_packus_epi16(_mm_packs_epi32(ints1, ints2), _mm_packs_epi32(ints3, ints4))); /* pack down, store out. */ - i -= 16; - src += 16; - mmdst++; - } - dst = (Uint8 *)mmdst; + const __m128i shorts1 = _mm_and_si128(_mm_packus_epi16(ints1, ints2), mask); + const __m128i shorts2 = _mm_and_si128(_mm_packus_epi16(ints3, ints4), mask); + + const __m128i bytes = _mm_packus_epi16(shorts1, shorts2); + + _mm_storeu_si128((__m128i*)dst, bytes); + + i -= 16; + src += 16; + dst += 16; } - /* Finish off any leftovers with scalar operations. */ while (i) { - const float sample = *src; - if (sample >= 1.0f) { - *dst = 255; - } else if (sample <= -1.0f) { - *dst = 0; - } else { - *dst = (Uint8)((sample + 1.0f) * 127.0f); - } - i--; - src++; - dst++; + const __m128i ints = _mm_castps_si128(_mm_add_ss(_mm_load_ss(src), offset)); + *dst = (Uint8)(_mm_cvtsi128_si32(_mm_packus_epi16(ints, ints)) & 0xFF); + + --i; + ++src; + ++dst; } cvt->len_cvt /= 4; @@ -689,55 +677,46 @@ static void SDLCALL SDL_Convert_F32_to_S16_SSE2(SDL_AudioCVT *cvt, SDL_AudioForm { const float *src = (const float *)cvt->buf; Sint16 *dst = (Sint16 *)cvt->buf; - int i; + int i = cvt->len_cvt / 4; + + /* 1) Shift the float range from [-1.0, 1.0] to [256.0, 258.0] + * 2) Shift the int range from [0x43800000, 0x43810000] to [-32768,32768] + * 3) Clamp to range [-32768,32767] + * Overflow is correctly handled for inputs between roughly [-257.0, +inf) + * dst[i] = clamp(f2i(src[i] + 257.0) - 0x43808000, -32768, 32767) */ + const __m128 offset = _mm_set1_ps(257.0f); LOG_DEBUG_CONVERT("AUDIO_F32", "AUDIO_S16 (using SSE2)"); - /* Get dst aligned to 16 bytes */ - for (i = cvt->len_cvt / sizeof(float); i && (((size_t)dst) & 15); --i, ++src, ++dst) { - const float sample = *src; - if (sample >= 1.0f) { - *dst = 32767; - } else if (sample <= -1.0f) { - *dst = -32768; - } else { - *dst = (Sint16)(sample * 32767.0f); - } - } + while (i >= 16) { + const __m128 floats1 = _mm_loadu_ps(&src[0]); + const __m128 floats2 = _mm_loadu_ps(&src[4]); + const __m128 floats3 = _mm_loadu_ps(&src[8]); + const __m128 floats4 = _mm_loadu_ps(&src[12]); - SDL_assert(!i || !(((size_t)dst) & 15)); + const __m128i ints1 = _mm_sub_epi32(_mm_castps_si128(_mm_add_ps(floats1, offset)), _mm_castps_si128(offset)); + const __m128i ints2 = _mm_sub_epi32(_mm_castps_si128(_mm_add_ps(floats2, offset)), _mm_castps_si128(offset)); + const __m128i ints3 = _mm_sub_epi32(_mm_castps_si128(_mm_add_ps(floats3, offset)), _mm_castps_si128(offset)); + const __m128i ints4 = _mm_sub_epi32(_mm_castps_si128(_mm_add_ps(floats4, offset)), _mm_castps_si128(offset)); - /* Make sure src is aligned too. */ - if (!(((size_t)src) & 15)) { - /* Aligned! Do SSE blocks as long as we have 16 bytes available. */ - const __m128 one = _mm_set1_ps(1.0f); - const __m128 negone = _mm_set1_ps(-1.0f); - const __m128 mulby32767 = _mm_set1_ps(32767.0f); - __m128i *mmdst = (__m128i *)dst; - while (i >= 8) { /* 8 * float32 */ - const __m128i ints1 = _mm_cvtps_epi32(_mm_mul_ps(_mm_min_ps(_mm_max_ps(negone, _mm_load_ps(src)), one), mulby32767)); /* load 4 floats, clamp, convert to sint32 */ - const __m128i ints2 = _mm_cvtps_epi32(_mm_mul_ps(_mm_min_ps(_mm_max_ps(negone, _mm_load_ps(src + 4)), one), mulby32767)); /* load 4 floats, clamp, convert to sint32 */ - _mm_store_si128(mmdst, _mm_packs_epi32(ints1, ints2)); /* pack to sint16, store out. */ - i -= 8; - src += 8; - mmdst++; - } - dst = (Sint16 *)mmdst; + const __m128i shorts1 = _mm_packs_epi32(ints1, ints2); + const __m128i shorts2 = _mm_packs_epi32(ints3, ints4); + + _mm_storeu_si128((__m128i*)&dst[0], shorts1); + _mm_storeu_si128((__m128i*)&dst[8], shorts2); + + i -= 16; + src += 16; + dst += 16; } - /* Finish off any leftovers with scalar operations. */ while (i) { - const float sample = *src; - if (sample >= 1.0f) { - *dst = 32767; - } else if (sample <= -1.0f) { - *dst = -32768; - } else { - *dst = (Sint16)(sample * 32767.0f); - } - i--; - src++; - dst++; + const __m128i ints = _mm_sub_epi32(_mm_castps_si128(_mm_add_ss(_mm_load_ss(src), offset)), _mm_castps_si128(offset)); + *dst = (Sint16)(_mm_cvtsi128_si32(_mm_packs_epi32(ints, ints)) & 0xFFFF); + + --i; + ++src; + ++dst; } cvt->len_cvt /= 2; @@ -819,53 +798,51 @@ static void SDLCALL SDL_Convert_F32_to_S32_SSE2(SDL_AudioCVT *cvt, SDL_AudioForm { const float *src = (const float *)cvt->buf; Sint32 *dst = (Sint32 *)cvt->buf; - int i; + int i = cvt->len_cvt / 4; + + /* 1) Scale the float range from [-1.0, 1.0] to [-2147483648.0, 2147483648.0] + * 2) Convert to integer (values too small/large become 0x80000000 = -2147483648) + * 3) Fixup values which were too large (0x80000000 ^ 0xFFFFFFFF = 2147483647) + * dst[i] = i32(src[i] * 2147483648.0) ^ ((src[i] >= 2147483648.0) ? 0xFFFFFFFF : 0x00000000) */ + const __m128 limit = _mm_set1_ps(2147483648.0f); LOG_DEBUG_CONVERT("AUDIO_F32", "AUDIO_S32 (using SSE2)"); - /* Get dst aligned to 16 bytes */ - for (i = cvt->len_cvt / sizeof(float); i && (((size_t)dst) & 15); --i, ++src, ++dst) { - const float sample = *src; - if (sample >= 1.0f) { - *dst = 2147483647; - } else if (sample <= -1.0f) { - *dst = (Sint32)-2147483648LL; - } else { - *dst = ((Sint32)(sample * 8388607.0f)) << 8; - } - } + while (i >= 16) { + const __m128 floats1 = _mm_loadu_ps(&src[0]); + const __m128 floats2 = _mm_loadu_ps(&src[4]); + const __m128 floats3 = _mm_loadu_ps(&src[8]); + const __m128 floats4 = _mm_loadu_ps(&src[12]); - SDL_assert(!i || !(((size_t)dst) & 15)); - SDL_assert(!i || !(((size_t)src) & 15)); + const __m128 values1 = _mm_mul_ps(floats1, limit); + const __m128 values2 = _mm_mul_ps(floats2, limit); + const __m128 values3 = _mm_mul_ps(floats3, limit); + const __m128 values4 = _mm_mul_ps(floats4, limit); - { - /* Aligned! Do SSE blocks as long as we have 16 bytes available. */ - const __m128 one = _mm_set1_ps(1.0f); - const __m128 negone = _mm_set1_ps(-1.0f); - const __m128 mulby8388607 = _mm_set1_ps(8388607.0f); - __m128i *mmdst = (__m128i *)dst; - while (i >= 4) { /* 4 * float32 */ - _mm_store_si128(mmdst, _mm_slli_epi32(_mm_cvtps_epi32(_mm_mul_ps(_mm_min_ps(_mm_max_ps(negone, _mm_load_ps(src)), one), mulby8388607)), 8)); /* load 4 floats, clamp, convert to sint32 */ - i -= 4; - src += 4; - mmdst++; - } - dst = (Sint32 *)mmdst; + const __m128i ints1 = _mm_xor_si128(_mm_cvttps_epi32(values1), _mm_castps_si128(_mm_cmpge_ps(values1, limit))); + const __m128i ints2 = _mm_xor_si128(_mm_cvttps_epi32(values2), _mm_castps_si128(_mm_cmpge_ps(values2, limit))); + const __m128i ints3 = _mm_xor_si128(_mm_cvttps_epi32(values3), _mm_castps_si128(_mm_cmpge_ps(values3, limit))); + const __m128i ints4 = _mm_xor_si128(_mm_cvttps_epi32(values4), _mm_castps_si128(_mm_cmpge_ps(values4, limit))); + + _mm_storeu_si128((__m128i*)&dst[0], ints1); + _mm_storeu_si128((__m128i*)&dst[4], ints2); + _mm_storeu_si128((__m128i*)&dst[8], ints3); + _mm_storeu_si128((__m128i*)&dst[12], ints4); + + i -= 16; + src += 16; + dst += 16; } - /* Finish off any leftovers with scalar operations. */ while (i) { - const float sample = *src; - if (sample >= 1.0f) { - *dst = 2147483647; - } else if (sample <= -1.0f) { - *dst = (Sint32)-2147483648LL; - } else { - *dst = ((Sint32)(sample * 8388607.0f)) << 8; - } - i--; - src++; - dst++; + const __m128 floats = _mm_load_ss(src); + const __m128 values = _mm_mul_ss(floats, limit); + const __m128i ints = _mm_xor_si128(_mm_cvttps_epi32(values), _mm_castps_si128(_mm_cmpge_ss(values, limit))); + *dst = (Sint32)_mm_cvtsi128_si32(ints); + + --i; + ++src; + ++dst; } if (cvt->filters[++cvt->filter_index]) { @@ -874,7 +851,7 @@ static void SDLCALL SDL_Convert_F32_to_S32_SSE2(SDL_AudioCVT *cvt, SDL_AudioForm } #endif -#if HAVE_NEON_INTRINSICS +#ifdef HAVE_NEON_INTRINSICS static void SDLCALL SDL_Convert_S8_to_F32_NEON(SDL_AudioCVT *cvt, SDL_AudioFormat format) { const Sint8 *src = ((const Sint8 *)(cvt->buf + cvt->len_cvt)) - 1; @@ -1463,14 +1440,14 @@ void SDL_ChooseAudioConverters(void) SDL_Convert_F32_to_S32 = SDL_Convert_F32_to_S32_##fntype; \ converters_chosen = SDL_TRUE -#if HAVE_SSE2_INTRINSICS +#ifdef HAVE_SSE2_INTRINSICS if (SDL_HasSSE2()) { SET_CONVERTER_FUNCS(SSE2); return; } #endif -#if HAVE_NEON_INTRINSICS +#ifdef HAVE_NEON_INTRINSICS if (SDL_HasNEON()) { SET_CONVERTER_FUNCS(NEON); return; diff --git a/thirdparty/SDL/src/audio/SDL_mixer.c b/thirdparty/SDL/src/audio/SDL_mixer.c index 9a6a75ee1..9cf96a6b3 100644 --- a/thirdparty/SDL/src/audio/SDL_mixer.c +++ b/thirdparty/SDL/src/audio/SDL_mixer.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/audio/SDL_sysaudio.h b/thirdparty/SDL/src/audio/SDL_sysaudio.h index c755d4341..d569ba76a 100644 --- a/thirdparty/SDL/src/audio/SDL_sysaudio.h +++ b/thirdparty/SDL/src/audio/SDL_sysaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/audio/SDL_wave.c b/thirdparty/SDL/src/audio/SDL_wave.c index 209a577c0..1ecce9b91 100644 --- a/thirdparty/SDL/src/audio/SDL_wave.c +++ b/thirdparty/SDL/src/audio/SDL_wave.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -264,7 +264,7 @@ static void WaveDebugDumpFormat(WaveFile *file, Uint32 rifflen, Uint32 fmtlen, U int res; dumpstr = SDL_malloc(bufsize); - if (dumpstr == NULL) { + if (!dumpstr) { return; } dumpstr[0] = 0; @@ -441,7 +441,7 @@ static int MS_ADPCM_Init(WaveFile *file, size_t datalength) coeffdata = (MS_ADPCM_CoeffData *)SDL_malloc(sizeof(MS_ADPCM_CoeffData) + coeffcount * 4); file->decoderdata = coeffdata; /* Freed in cleanup. */ - if (coeffdata == NULL) { + if (!coeffdata) { return SDL_OutOfMemory(); } coeffdata->coeff = &coeffdata->aligndummy; @@ -684,7 +684,7 @@ static int MS_ADPCM_Decode(WaveFile *file, Uint8 **audio_buf, Uint32 *audio_len) state.output.pos = 0; state.output.size = outputsize / sizeof(Sint16); state.output.data = (Sint16 *)SDL_calloc(1, outputsize); - if (state.output.data == NULL) { + if (!state.output.data) { return SDL_OutOfMemory(); } @@ -1075,12 +1075,12 @@ static int IMA_ADPCM_Decode(WaveFile *file, Uint8 **audio_buf, Uint32 *audio_len state.output.pos = 0; state.output.size = outputsize / sizeof(Sint16); state.output.data = (Sint16 *)SDL_malloc(outputsize); - if (state.output.data == NULL) { + if (!state.output.data) { return SDL_OutOfMemory(); } cstate = (Sint8 *)SDL_calloc(state.channels, sizeof(Sint8)); - if (cstate == NULL) { + if (!cstate) { SDL_free(state.output.data); return SDL_OutOfMemory(); } @@ -1235,7 +1235,7 @@ static int LAW_Decode(WaveFile *file, Uint8 **audio_buf, Uint32 *audio_len) /* 1 to avoid allocating zero bytes, to keep static analysis happy. */ src = (Uint8 *)SDL_realloc(chunk->data, expanded_len ? expanded_len : 1); - if (src == NULL) { + if (!src) { return SDL_OutOfMemory(); } chunk->data = NULL; @@ -1366,7 +1366,7 @@ static int PCM_ConvertSint24ToSint32(WaveFile *file, Uint8 **audio_buf, Uint32 * /* 1 to avoid allocating zero bytes, to keep static analysis happy. */ ptr = (Uint8 *)SDL_realloc(chunk->data, expanded_len ? expanded_len : 1); - if (ptr == NULL) { + if (!ptr) { return SDL_OutOfMemory(); } @@ -1438,11 +1438,11 @@ static int PCM_Decode(WaveFile *file, Uint8 **audio_buf, Uint32 *audio_len) return 0; } -static WaveRiffSizeHint WaveGetRiffSizeHint() +static WaveRiffSizeHint WaveGetRiffSizeHint(void) { const char *hint = SDL_GetHint(SDL_HINT_WAVE_RIFF_CHUNK_SIZE); - if (hint != NULL) { + if (hint) { if (SDL_strcmp(hint, "force") == 0) { return RiffSizeForce; } else if (SDL_strcmp(hint, "ignore") == 0) { @@ -1457,11 +1457,11 @@ static WaveRiffSizeHint WaveGetRiffSizeHint() return RiffSizeNoHint; } -static WaveTruncationHint WaveGetTruncationHint() +static WaveTruncationHint WaveGetTruncationHint(void) { const char *hint = SDL_GetHint(SDL_HINT_WAVE_TRUNCATION); - if (hint != NULL) { + if (hint) { if (SDL_strcmp(hint, "verystrict") == 0) { return TruncVeryStrict; } else if (SDL_strcmp(hint, "strict") == 0) { @@ -1476,11 +1476,11 @@ static WaveTruncationHint WaveGetTruncationHint() return TruncNoHint; } -static WaveFactChunkHint WaveGetFactChunkHint() +static WaveFactChunkHint WaveGetFactChunkHint(void) { const char *hint = SDL_GetHint(SDL_HINT_WAVE_FACT_CHUNK); - if (hint != NULL) { + if (hint) { if (SDL_strcmp(hint, "truncate") == 0) { return FactTruncate; } else if (SDL_strcmp(hint, "strict") == 0) { @@ -1497,7 +1497,7 @@ static WaveFactChunkHint WaveGetFactChunkHint() static void WaveFreeChunkData(WaveChunk *chunk) { - if (chunk->data != NULL) { + if (chunk->data) { SDL_free(chunk->data); chunk->data = NULL; } @@ -1546,7 +1546,7 @@ static int WaveReadPartialChunkData(SDL_RWops *src, WaveChunk *chunk, size_t len if (length > 0) { chunk->data = (Uint8 *)SDL_malloc(length); - if (chunk->data == NULL) { + if (!chunk->data) { return SDL_OutOfMemory(); } @@ -1612,7 +1612,7 @@ static int WaveReadFormat(WaveFile *file) return SDL_SetError("Data of WAVE fmt chunk too big"); } fmtsrc = SDL_RWFromConstMem(chunk->data, (int)chunk->size); - if (fmtsrc == NULL) { + if (!fmtsrc) { return SDL_OutOfMemory(); } @@ -1787,7 +1787,7 @@ static int WaveLoad(SDL_RWops *src, WaveFile *file, SDL_AudioSpec *spec, Uint8 * SDL_zero(datachunk); envchunkcountlimit = SDL_getenv("SDL_WAVE_CHUNK_LIMIT"); - if (envchunkcountlimit != NULL) { + if (envchunkcountlimit) { unsigned int count; if (SDL_sscanf(envchunkcountlimit, "%u", &count) == 1) { chunkcountlimit = count <= SDL_MAX_UINT32 ? count : SDL_MAX_UINT32; @@ -2085,16 +2085,16 @@ SDL_AudioSpec *SDL_LoadWAV_RW(SDL_RWops *src, int freesrc, SDL_AudioSpec *spec, SDL_zero(file); /* Make sure we are passed a valid data source */ - if (src == NULL) { + if (!src) { /* Error may come from RWops. */ return NULL; - } else if (spec == NULL) { + } else if (!spec) { SDL_InvalidParamError("spec"); return NULL; - } else if (audio_buf == NULL) { + } else if (!audio_buf) { SDL_InvalidParamError("audio_buf"); return NULL; - } else if (audio_len == NULL) { + } else if (!audio_len) { SDL_InvalidParamError("audio_len"); return NULL; } diff --git a/thirdparty/SDL/src/audio/SDL_wave.h b/thirdparty/SDL/src/audio/SDL_wave.h index 83acb4452..6d71e47dc 100644 --- a/thirdparty/SDL/src/audio/SDL_wave.h +++ b/thirdparty/SDL/src/audio/SDL_wave.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/audio/aaudio/SDL_aaudio.c b/thirdparty/SDL/src/audio/aaudio/SDL_aaudio.c index 8dfd16ce0..401fef6a8 100644 --- a/thirdparty/SDL/src/audio/aaudio/SDL_aaudio.c +++ b/thirdparty/SDL/src/audio/aaudio/SDL_aaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_AUDIO_DRIVER_AAUDIO +#ifdef SDL_AUDIO_DRIVER_AAUDIO #include "SDL_audio.h" #include "SDL_loadso.h" @@ -94,33 +94,29 @@ static int aaudio_OpenDevice(_THIS, const char *devname) } this->hidden = (struct SDL_PrivateAudioData *)SDL_calloc(1, sizeof(*this->hidden)); - if (this->hidden == NULL) { + if (!this->hidden) { return SDL_OutOfMemory(); } private = this->hidden; ctx.AAudioStreamBuilder_setSampleRate(ctx.builder, this->spec.freq); ctx.AAudioStreamBuilder_setChannelCount(ctx.builder, this->spec.channels); - if(devname != NULL) { - int aaudio_device_id = SDL_atoi(devname); - LOGI("Opening device id %d", aaudio_device_id); - ctx.AAudioStreamBuilder_setDeviceId(ctx.builder, aaudio_device_id); + if(devname) { + private->devid = SDL_atoi(devname); + LOGI("Opening device id %d", private->devid); + ctx.AAudioStreamBuilder_setDeviceId(ctx.builder, private->devid); } { - aaudio_direction_t direction = (iscapture ? AAUDIO_DIRECTION_INPUT : AAUDIO_DIRECTION_OUTPUT); + const aaudio_direction_t direction = (iscapture ? AAUDIO_DIRECTION_INPUT : AAUDIO_DIRECTION_OUTPUT); ctx.AAudioStreamBuilder_setDirection(ctx.builder, direction); } { - aaudio_format_t format = AAUDIO_FORMAT_PCM_FLOAT; - if (this->spec.format == AUDIO_S16SYS) { - format = AAUDIO_FORMAT_PCM_I16; - } else if (this->spec.format == AUDIO_S16SYS) { - format = AAUDIO_FORMAT_PCM_FLOAT; - } + const aaudio_format_t format = (this->spec.format == AUDIO_S16SYS) ? AAUDIO_FORMAT_PCM_I16 : AAUDIO_FORMAT_PCM_FLOAT; ctx.AAudioStreamBuilder_setFormat(ctx.builder, format); } ctx.AAudioStreamBuilder_setErrorCallback(ctx.builder, aaudio_errorCallback, private); + ctx.AAudioStreamBuilder_setPerformanceMode(ctx.builder, AAUDIO_PERFORMANCE_MODE_LOW_LATENCY); LOGI("AAudio Try to open %u hz %u bit chan %u %s samples %u", this->spec.freq, SDL_AUDIO_BITSIZE(this->spec.format), @@ -153,7 +149,7 @@ static int aaudio_OpenDevice(_THIS, const char *devname) if (!iscapture) { private->mixlen = this->spec.size; private->mixbuf = (Uint8 *)SDL_malloc(private->mixlen); - if (private->mixbuf == NULL) { + if (!private->mixbuf) { return SDL_OutOfMemory(); } SDL_memset(private->mixbuf, this->spec.silence, this->spec.size); @@ -211,6 +207,97 @@ static Uint8 *aaudio_GetDeviceBuf(_THIS) return private->mixbuf; } +/* Try to reestablish an AAudioStream. + + This needs to get a stream with the same format as the previous one, + even if this means AAudio needs to handle a conversion it didn't when + we initially opened the device. If we can't get that, we are forced + to give up here. + + (This is more robust in SDL3, which is designed to handle + abrupt format changes.) +*/ +static int RebuildAAudioStream(SDL_AudioDevice *device) +{ + struct SDL_PrivateAudioData *hidden = device->hidden; + const SDL_bool iscapture = device->iscapture; + aaudio_result_t res; + + ctx.AAudioStreamBuilder_setSampleRate(ctx.builder, device->spec.freq); + ctx.AAudioStreamBuilder_setChannelCount(ctx.builder, device->spec.channels); + if(hidden->devid) { + LOGI("Reopening device id %d", hidden->devid); + ctx.AAudioStreamBuilder_setDeviceId(ctx.builder, hidden->devid); + } + { + const aaudio_direction_t direction = (iscapture ? AAUDIO_DIRECTION_INPUT : AAUDIO_DIRECTION_OUTPUT); + ctx.AAudioStreamBuilder_setDirection(ctx.builder, direction); + } + { + const aaudio_format_t format = (device->spec.format == AUDIO_S16SYS) ? AAUDIO_FORMAT_PCM_I16 : AAUDIO_FORMAT_PCM_FLOAT; + ctx.AAudioStreamBuilder_setFormat(ctx.builder, format); + } + + ctx.AAudioStreamBuilder_setErrorCallback(ctx.builder, aaudio_errorCallback, hidden); + ctx.AAudioStreamBuilder_setPerformanceMode(ctx.builder, AAUDIO_PERFORMANCE_MODE_LOW_LATENCY); + + LOGI("AAudio Try to reopen %u hz %u bit chan %u %s samples %u", + device->spec.freq, SDL_AUDIO_BITSIZE(device->spec.format), + device->spec.channels, (device->spec.format & 0x1000) ? "BE" : "LE", device->spec.samples); + + res = ctx.AAudioStreamBuilder_openStream(ctx.builder, &hidden->stream); + if (res != AAUDIO_OK) { + LOGI("SDL Failed AAudioStreamBuilder_openStream %d", res); + return SDL_SetError("%s : %s", __func__, ctx.AAudio_convertResultToText(res)); + } + + { + const aaudio_format_t fmt = ctx.AAudioStream_getFormat(hidden->stream); + SDL_AudioFormat sdlfmt = (SDL_AudioFormat) 0; + if (fmt == AAUDIO_FORMAT_PCM_I16) { + sdlfmt = AUDIO_S16SYS; + } else if (fmt == AAUDIO_FORMAT_PCM_FLOAT) { + sdlfmt = AUDIO_F32SYS; + } + + /* We handle this better in SDL3, but this _needs_ to match the previous stream for SDL2. */ + if ( (device->spec.freq != ctx.AAudioStream_getSampleRate(hidden->stream)) || + (device->spec.channels != ctx.AAudioStream_getChannelCount(hidden->stream)) || + (device->spec.format != sdlfmt) ) { + LOGI("Didn't get an identical spec from AAudioStream during reopen!"); + ctx.AAudioStream_close(hidden->stream); + hidden->stream = NULL; + return SDL_SetError("Didn't get an identical spec from AAudioStream during reopen!"); + } + } + + res = ctx.AAudioStream_requestStart(hidden->stream); + if (res != AAUDIO_OK) { + LOGI("SDL Failed AAudioStream_requestStart %d iscapture:%d", res, iscapture); + return SDL_SetError("%s : %s", __func__, ctx.AAudio_convertResultToText(res)); + } + + return 0; +} + +static int RecoverAAudioDevice(SDL_AudioDevice *device) +{ + struct SDL_PrivateAudioData *hidden = device->hidden; + AAudioStream *stream = hidden->stream; + + /* attempt to build a new stream, in case there's a new default device. */ + hidden->stream = NULL; + ctx.AAudioStream_requestStop(stream); + ctx.AAudioStream_close(stream); + + if (RebuildAAudioStream(device) < 0) { + return -1; // oh well, we tried. + } + + return 0; +} + + static void aaudio_PlayDevice(_THIS) { struct SDL_PrivateAudioData *private = this->hidden; @@ -219,6 +306,9 @@ static void aaudio_PlayDevice(_THIS) res = ctx.AAudioStream_write(private->stream, private->mixbuf, private->mixlen / private->frame_size, timeoutNanoseconds); if (res < 0) { LOGI("%s : %s", __func__, ctx.AAudio_convertResultToText(res)); + if (RecoverAAudioDevice(this) < 0) { + return; /* oh well, we went down hard. */ + } } else { LOGI("SDL AAudio play: %d frames, wanted:%d frames", (int)res, private->mixlen / private->frame_size); } @@ -285,7 +375,7 @@ static SDL_bool aaudio_Init(SDL_AudioDriverImpl *impl) SDL_zero(ctx); ctx.handle = SDL_LoadObject(LIB_AAUDIO_SO); - if (ctx.handle == NULL) { + if (!ctx.handle) { LOGI("SDL couldn't find " LIB_AAUDIO_SO); goto failure; } @@ -300,7 +390,7 @@ static SDL_bool aaudio_Init(SDL_AudioDriverImpl *impl) goto failure; } - if (ctx.builder == NULL) { + if (!ctx.builder) { LOGI("SDL Failed AAudio_createStreamBuilder - builder NULL"); goto failure; } @@ -344,9 +434,9 @@ void aaudio_PauseDevices(void) { /* TODO: Handle multiple devices? */ struct SDL_PrivateAudioData *private; - if (audioDevice != NULL && audioDevice->hidden != NULL) { + if (audioDevice && audioDevice->hidden) { + SDL_LockMutex(audioDevice->mixer_lock); private = (struct SDL_PrivateAudioData *)audioDevice->hidden; - if (private->stream) { aaudio_result_t res = ctx.AAudioStream_requestPause(private->stream); if (res != AAUDIO_OK) { @@ -354,20 +444,11 @@ void aaudio_PauseDevices(void) SDL_SetError("%s : %s", __func__, ctx.AAudio_convertResultToText(res)); } } - - if (SDL_AtomicGet(&audioDevice->paused)) { - /* The device is already paused, leave it alone */ - private->resume = SDL_FALSE; - } else { - SDL_LockMutex(audioDevice->mixer_lock); - SDL_AtomicSet(&audioDevice->paused, 1); - private->resume = SDL_TRUE; - } } - if (captureDevice != NULL && captureDevice->hidden != NULL) { + if (captureDevice && captureDevice->hidden) { + SDL_LockMutex(captureDevice->mixer_lock); private = (struct SDL_PrivateAudioData *)captureDevice->hidden; - if (private->stream) { /* Pause() isn't implemented for 'capture', use Stop() */ aaudio_result_t res = ctx.AAudioStream_requestStop(private->stream); @@ -376,15 +457,6 @@ void aaudio_PauseDevices(void) SDL_SetError("%s : %s", __func__, ctx.AAudio_convertResultToText(res)); } } - - if (SDL_AtomicGet(&captureDevice->paused)) { - /* The device is already paused, leave it alone */ - private->resume = SDL_FALSE; - } else { - SDL_LockMutex(captureDevice->mixer_lock); - SDL_AtomicSet(&captureDevice->paused, 1); - private->resume = SDL_TRUE; - } } } @@ -393,15 +465,8 @@ void aaudio_ResumeDevices(void) { /* TODO: Handle multiple devices? */ struct SDL_PrivateAudioData *private; - if (audioDevice != NULL && audioDevice->hidden != NULL) { + if (audioDevice && audioDevice->hidden) { private = (struct SDL_PrivateAudioData *)audioDevice->hidden; - - if (private->resume) { - SDL_AtomicSet(&audioDevice->paused, 0); - private->resume = SDL_FALSE; - SDL_UnlockMutex(audioDevice->mixer_lock); - } - if (private->stream) { aaudio_result_t res = ctx.AAudioStream_requestStart(private->stream); if (res != AAUDIO_OK) { @@ -409,17 +474,11 @@ void aaudio_ResumeDevices(void) SDL_SetError("%s : %s", __func__, ctx.AAudio_convertResultToText(res)); } } + SDL_UnlockMutex(audioDevice->mixer_lock); } - if (captureDevice != NULL && captureDevice->hidden != NULL) { + if (captureDevice && captureDevice->hidden) { private = (struct SDL_PrivateAudioData *)captureDevice->hidden; - - if (private->resume) { - SDL_AtomicSet(&captureDevice->paused, 0); - private->resume = SDL_FALSE; - SDL_UnlockMutex(captureDevice->mixer_lock); - } - if (private->stream) { aaudio_result_t res = ctx.AAudioStream_requestStart(private->stream); if (res != AAUDIO_OK) { @@ -427,6 +486,7 @@ void aaudio_ResumeDevices(void) SDL_SetError("%s : %s", __func__, ctx.AAudio_convertResultToText(res)); } } + SDL_UnlockMutex(captureDevice->mixer_lock); } } @@ -437,19 +497,24 @@ void aaudio_ResumeDevices(void) */ SDL_bool aaudio_DetectBrokenPlayState(void) { + AAudioStream *stream; struct SDL_PrivateAudioData *private; int64_t framePosition, timeNanoseconds; aaudio_result_t res; - if (audioDevice == NULL || !audioDevice->hidden) { + if (!audioDevice || !audioDevice->hidden) { return SDL_FALSE; } private = audioDevice->hidden; + stream = private->stream; + if (!stream) { + return SDL_FALSE; + } - res = ctx.AAudioStream_getTimestamp(private->stream, CLOCK_MONOTONIC, &framePosition, &timeNanoseconds); + res = ctx.AAudioStream_getTimestamp(stream, CLOCK_MONOTONIC, &framePosition, &timeNanoseconds); if (res == AAUDIO_ERROR_INVALID_STATE) { - aaudio_stream_state_t currentState = ctx.AAudioStream_getState(private->stream); + aaudio_stream_state_t currentState = ctx.AAudioStream_getState(stream); /* AAudioStream_getTimestamp() will also return AAUDIO_ERROR_INVALID_STATE while the stream is still initially starting. But we only care if it silently went invalid while playing. */ if (currentState == AAUDIO_STREAM_STATE_STARTED) { LOGI("SDL aaudio_DetectBrokenPlayState: detected invalid audio device state: AAudioStream_getTimestamp result=%d, framePosition=%lld, timeNanoseconds=%lld, getState=%d", (int)res, (long long)framePosition, (long long)timeNanoseconds, (int)currentState); diff --git a/thirdparty/SDL/src/audio/aaudio/SDL_aaudio.h b/thirdparty/SDL/src/audio/aaudio/SDL_aaudio.h index d051e1ea2..d61d1b02b 100644 --- a/thirdparty/SDL/src/audio/aaudio/SDL_aaudio.h +++ b/thirdparty/SDL/src/audio/aaudio/SDL_aaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -38,9 +38,7 @@ struct SDL_PrivateAudioData Uint8 *mixbuf; int mixlen; int frame_size; - - /* Resume device if it was paused automatically */ - int resume; + int devid; }; void aaudio_ResumeDevices(void); diff --git a/thirdparty/SDL/src/audio/aaudio/SDL_aaudiofuncs.h b/thirdparty/SDL/src/audio/aaudio/SDL_aaudiofuncs.h index 3f0749ca6..2bc674c03 100644 --- a/thirdparty/SDL/src/audio/aaudio/SDL_aaudiofuncs.h +++ b/thirdparty/SDL/src/audio/aaudio/SDL_aaudiofuncs.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright , (C) 1997-2023 Sam Lantinga + Copyright , (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -32,7 +32,7 @@ SDL_PROC(void, AAudioStreamBuilder_setFormat, (AAudioStreamBuilder * builder, aa SDL_PROC_UNUSED(void, AAudioStreamBuilder_setSharingMode, (AAudioStreamBuilder * builder, aaudio_sharing_mode_t sharingMode)) SDL_PROC(void, AAudioStreamBuilder_setDirection, (AAudioStreamBuilder * builder, aaudio_direction_t direction)) SDL_PROC_UNUSED(void, AAudioStreamBuilder_setBufferCapacityInFrames, (AAudioStreamBuilder * builder, int32_t numFrames)) -SDL_PROC_UNUSED(void, AAudioStreamBuilder_setPerformanceMode, (AAudioStreamBuilder * builder, aaudio_performance_mode_t mode)) +SDL_PROC(void, AAudioStreamBuilder_setPerformanceMode, (AAudioStreamBuilder * builder, aaudio_performance_mode_t mode)) SDL_PROC_UNUSED(void, AAudioStreamBuilder_setUsage, (AAudioStreamBuilder * builder, aaudio_usage_t usage)) /* API 28 */ SDL_PROC_UNUSED(void, AAudioStreamBuilder_setContentType, (AAudioStreamBuilder * builder, aaudio_content_type_t contentType)) /* API 28 */ SDL_PROC_UNUSED(void, AAudioStreamBuilder_setInputPreset, (AAudioStreamBuilder * builder, aaudio_input_preset_t inputPreset)) /* API 28 */ diff --git a/thirdparty/SDL/src/audio/alsa/SDL_alsa_audio.c b/thirdparty/SDL/src/audio/alsa/SDL_alsa_audio.c index c53161357..3ed66f290 100644 --- a/thirdparty/SDL/src/audio/alsa/SDL_alsa_audio.c +++ b/thirdparty/SDL/src/audio/alsa/SDL_alsa_audio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_AUDIO_DRIVER_ALSA +#ifdef SDL_AUDIO_DRIVER_ALSA #ifndef SDL_ALSA_NON_BLOCKING #define SDL_ALSA_NON_BLOCKING 0 @@ -98,7 +98,7 @@ static void *alsa_handle = NULL; static int load_alsa_sym(const char *fn, void **addr) { *addr = SDL_LoadFunction(alsa_handle, fn); - if (*addr == NULL) { + if (!*addr) { /* Don't call SDL_SetError(): SDL_LoadFunction already did. */ return 0; } @@ -166,7 +166,7 @@ static int load_alsa_syms(void) static void UnloadALSALibrary(void) { - if (alsa_handle != NULL) { + if (alsa_handle) { SDL_UnloadObject(alsa_handle); alsa_handle = NULL; } @@ -175,9 +175,9 @@ static void UnloadALSALibrary(void) static int LoadALSALibrary(void) { int retval = 0; - if (alsa_handle == NULL) { + if (!alsa_handle) { alsa_handle = SDL_LoadObject(alsa_library); - if (alsa_handle == NULL) { + if (!alsa_handle) { retval = -1; /* Don't call SDL_SetError(): SDL_LoadObject already did. */ } else { @@ -208,13 +208,13 @@ static const char *get_audio_device(void *handle, const int channels) { const char *device; - if (handle != NULL) { + if (handle) { return (const char *)handle; } /* !!! FIXME: we also check "SDL_AUDIO_DEVICE_NAME" at the higher level. */ device = SDL_getenv("AUDIODEV"); /* Is there a standard variable name? */ - if (device != NULL) { + if (device) { return device; } @@ -539,7 +539,7 @@ static int ALSA_OpenDevice(_THIS, const char *devname) /* Initialize all variables that we clean on shutdown */ this->hidden = (struct SDL_PrivateAudioData *)SDL_malloc(sizeof(*this->hidden)); - if (this->hidden == NULL) { + if (!this->hidden) { return SDL_OutOfMemory(); } SDL_zerop(this->hidden); @@ -687,7 +687,7 @@ static int ALSA_OpenDevice(_THIS, const char *devname) if (!iscapture) { this->hidden->mixlen = this->spec.size; this->hidden->mixbuf = (Uint8 *)SDL_malloc(this->hidden->mixlen); - if (this->hidden->mixbuf == NULL) { + if (!this->hidden->mixbuf) { return SDL_OutOfMemory(); } SDL_memset(this->hidden->mixbuf, this->spec.silence, this->hidden->mixlen); @@ -717,7 +717,7 @@ static void add_device(const int iscapture, const char *name, void *hint, ALSA_D char *handle = NULL; char *ptr; - if (dev == NULL) { + if (!dev) { return; } @@ -727,7 +727,7 @@ static void add_device(const int iscapture, const char *name, void *hint, ALSA_D Make sure not to free the storage associated with desc in this case */ if (hint) { desc = ALSA_snd_device_name_get_hint(hint, "DESC"); - if (desc == NULL) { + if (!desc) { SDL_free(dev); return; } @@ -741,14 +741,14 @@ static void add_device(const int iscapture, const char *name, void *hint, ALSA_D just chop the extra lines off, this seems to get a reasonable device name without extra details. */ ptr = SDL_strchr(desc, '\n'); - if (ptr != NULL) { + if (ptr) { *ptr = '\0'; } /*printf("ALSA: adding %s device '%s' (%s)\n", iscapture ? "capture" : "output", name, desc);*/ handle = SDL_strdup(name); - if (handle == NULL) { + if (!handle) { if (hint) { free(desc); } @@ -800,7 +800,7 @@ static void ALSA_HotplugIteration(void) if we can find a preferred prefix for the system. */ for (i = 0; hints[i]; i++) { char *name = ALSA_snd_device_name_get_hint(hints[i], "NAME"); - if (name == NULL) { + if (!name) { continue; } @@ -829,20 +829,20 @@ static void ALSA_HotplugIteration(void) char *name; /* if we didn't find a device name prefix we like at all... */ - if ((match == NULL) && (defaultdev != i)) { + if ((!match) && (defaultdev != i)) { continue; /* ...skip anything that isn't the default device. */ } name = ALSA_snd_device_name_get_hint(hints[i], "NAME"); - if (name == NULL) { + if (!name) { continue; } /* only want physical hardware interfaces */ - if (match == NULL || (SDL_strncmp(name, match, match_len) == 0)) { + if (!match || (SDL_strncmp(name, match, match_len) == 0)) { char *ioid = ALSA_snd_device_name_get_hint(hints[i], "IOID"); - const SDL_bool isoutput = (ioid == NULL) || (SDL_strcmp(ioid, "Output") == 0); - const SDL_bool isinput = (ioid == NULL) || (SDL_strcmp(ioid, "Input") == 0); + const SDL_bool isoutput = (!ioid) || (SDL_strcmp(ioid, "Output") == 0); + const SDL_bool isinput = (!ioid) || (SDL_strcmp(ioid, "Input") == 0); SDL_bool have_output = SDL_FALSE; SDL_bool have_input = SDL_FALSE; @@ -940,7 +940,7 @@ static void ALSA_Deinitialize(void) ALSA_Device *next; #if SDL_ALSA_HOTPLUG_THREAD - if (ALSA_hotplug_thread != NULL) { + if (ALSA_hotplug_thread) { SDL_AtomicSet(&ALSA_hotplug_shutdown, 1); SDL_WaitThread(ALSA_hotplug_thread, NULL); ALSA_hotplug_thread = NULL; diff --git a/thirdparty/SDL/src/audio/alsa/SDL_alsa_audio.h b/thirdparty/SDL/src/audio/alsa/SDL_alsa_audio.h index 1ce2e5888..fb3f15490 100644 --- a/thirdparty/SDL/src/audio/alsa/SDL_alsa_audio.h +++ b/thirdparty/SDL/src/audio/alsa/SDL_alsa_audio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/audio/android/SDL_androidaudio.c b/thirdparty/SDL/src/audio/android/SDL_androidaudio.c index b46fdda09..817368680 100644 --- a/thirdparty/SDL/src/audio/android/SDL_androidaudio.c +++ b/thirdparty/SDL/src/audio/android/SDL_androidaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_AUDIO_DRIVER_ANDROID +#ifdef SDL_AUDIO_DRIVER_ANDROID /* Output audio to Android */ @@ -51,7 +51,7 @@ static int ANDROIDAUDIO_OpenDevice(_THIS, const char *devname) } this->hidden = (struct SDL_PrivateAudioData *)SDL_calloc(1, sizeof(*this->hidden)); - if (this->hidden == NULL) { + if (!this->hidden) { return SDL_OutOfMemory(); } @@ -71,7 +71,7 @@ static int ANDROIDAUDIO_OpenDevice(_THIS, const char *devname) { int audio_device_id = 0; - if (devname != NULL) { + if (devname) { audio_device_id = SDL_atoi(devname); } if (Android_JNI_OpenAudioDevice(iscapture, audio_device_id, &this->spec) < 0) { @@ -148,29 +148,12 @@ AudioBootStrap ANDROIDAUDIO_bootstrap = { void ANDROIDAUDIO_PauseDevices(void) { /* TODO: Handle multiple devices? */ - struct SDL_PrivateAudioData *private; - if (audioDevice != NULL && audioDevice->hidden != NULL) { - private = (struct SDL_PrivateAudioData *)audioDevice->hidden; - if (SDL_AtomicGet(&audioDevice->paused)) { - /* The device is already paused, leave it alone */ - private->resume = SDL_FALSE; - } else { - SDL_LockMutex(audioDevice->mixer_lock); - SDL_AtomicSet(&audioDevice->paused, 1); - private->resume = SDL_TRUE; - } + if (audioDevice && audioDevice->hidden) { + SDL_LockMutex(audioDevice->mixer_lock); } - if (captureDevice != NULL && captureDevice->hidden != NULL) { - private = (struct SDL_PrivateAudioData *)captureDevice->hidden; - if (SDL_AtomicGet(&captureDevice->paused)) { - /* The device is already paused, leave it alone */ - private->resume = SDL_FALSE; - } else { - SDL_LockMutex(captureDevice->mixer_lock); - SDL_AtomicSet(&captureDevice->paused, 1); - private->resume = SDL_TRUE; - } + if (captureDevice && captureDevice->hidden) { + SDL_LockMutex(captureDevice->mixer_lock); } } @@ -178,23 +161,12 @@ void ANDROIDAUDIO_PauseDevices(void) void ANDROIDAUDIO_ResumeDevices(void) { /* TODO: Handle multiple devices? */ - struct SDL_PrivateAudioData *private; - if (audioDevice != NULL && audioDevice->hidden != NULL) { - private = (struct SDL_PrivateAudioData *)audioDevice->hidden; - if (private->resume) { - SDL_AtomicSet(&audioDevice->paused, 0); - private->resume = SDL_FALSE; - SDL_UnlockMutex(audioDevice->mixer_lock); - } + if (audioDevice && audioDevice->hidden) { + SDL_UnlockMutex(audioDevice->mixer_lock); } - if (captureDevice != NULL && captureDevice->hidden != NULL) { - private = (struct SDL_PrivateAudioData *)captureDevice->hidden; - if (private->resume) { - SDL_AtomicSet(&captureDevice->paused, 0); - private->resume = SDL_FALSE; - SDL_UnlockMutex(captureDevice->mixer_lock); - } + if (captureDevice && captureDevice->hidden) { + SDL_UnlockMutex(captureDevice->mixer_lock); } } diff --git a/thirdparty/SDL/src/audio/android/SDL_androidaudio.h b/thirdparty/SDL/src/audio/android/SDL_androidaudio.h index 4e103795a..4e9df10f1 100644 --- a/thirdparty/SDL/src/audio/android/SDL_androidaudio.h +++ b/thirdparty/SDL/src/audio/android/SDL_androidaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -30,8 +30,7 @@ struct SDL_PrivateAudioData { - /* Resume device if it was paused automatically */ - int resume; + int unused; }; void ANDROIDAUDIO_ResumeDevices(void); diff --git a/thirdparty/SDL/src/audio/arts/SDL_artsaudio.c b/thirdparty/SDL/src/audio/arts/SDL_artsaudio.c index f3aa94b15..6e088d116 100644 --- a/thirdparty/SDL/src/audio/arts/SDL_artsaudio.c +++ b/thirdparty/SDL/src/audio/arts/SDL_artsaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_AUDIO_DRIVER_ARTS +#ifdef SDL_AUDIO_DRIVER_ARTS /* Allow access to a raw mixing buffer */ @@ -86,9 +86,9 @@ static struct #undef SDL_ARTS_SYM -static void UnloadARTSLibrary() +static void UnloadARTSLibrary(void) { - if (arts_handle != NULL) { + if (arts_handle) { SDL_UnloadObject(arts_handle); arts_handle = NULL; } @@ -98,9 +98,9 @@ static int LoadARTSLibrary(void) { int i, retval = -1; - if (arts_handle == NULL) { + if (!arts_handle) { arts_handle = SDL_LoadObject(arts_library); - if (arts_handle != NULL) { + if (arts_handle) { retval = 0; for (i = 0; i < SDL_arraysize(arts_functions); ++i) { *arts_functions[i].func = @@ -119,7 +119,7 @@ static int LoadARTSLibrary(void) #else -static void UnloadARTSLibrary() +static void UnloadARTSLibrary(void) { return; } @@ -214,7 +214,7 @@ static int ARTS_OpenDevice(_THIS, const char *devname) /* Initialize all variables that we clean on shutdown */ this->hidden = (struct SDL_PrivateAudioData *)SDL_malloc(sizeof(*this->hidden)); - if (this->hidden == NULL) { + if (!this->hidden) { return SDL_OutOfMemory(); } SDL_zerop(this->hidden); @@ -281,7 +281,7 @@ static int ARTS_OpenDevice(_THIS, const char *devname) /* Allocate mixing buffer */ this->hidden->mixlen = this->spec.size; this->hidden->mixbuf = (Uint8 *) SDL_malloc(this->hidden->mixlen); - if (this->hidden->mixbuf == NULL) { + if (!this->hidden->mixbuf) { return SDL_OutOfMemory(); } SDL_memset(this->hidden->mixbuf, this->spec.silence, this->spec.size); diff --git a/thirdparty/SDL/src/audio/arts/SDL_artsaudio.h b/thirdparty/SDL/src/audio/arts/SDL_artsaudio.h index f2ccaea1b..fe55bcd61 100644 --- a/thirdparty/SDL/src/audio/arts/SDL_artsaudio.h +++ b/thirdparty/SDL/src/audio/arts/SDL_artsaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/audio/coreaudio/SDL_coreaudio.h b/thirdparty/SDL/src/audio/coreaudio/SDL_coreaudio.h index 08b8cfbbc..d5d11ca51 100644 --- a/thirdparty/SDL/src/audio/coreaudio/SDL_coreaudio.h +++ b/thirdparty/SDL/src/audio/coreaudio/SDL_coreaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -26,10 +26,10 @@ #include "../SDL_sysaudio.h" #if !defined(__IPHONEOS__) -#define MACOSX_COREAUDIO 1 +#define MACOSX_COREAUDIO #endif -#if MACOSX_COREAUDIO +#ifdef MACOSX_COREAUDIO #include #else #import @@ -40,7 +40,7 @@ #include /* Things named "Master" were renamed to "Main" in macOS 12.0's SDK. */ -#if MACOSX_COREAUDIO +#ifdef MACOSX_COREAUDIO #include #ifndef MAC_OS_VERSION_12_0 #define kAudioObjectPropertyElementMain kAudioObjectPropertyElementMaster @@ -62,7 +62,7 @@ struct SDL_PrivateAudioData AudioStreamBasicDescription strdesc; SDL_sem *ready_semaphore; char *thread_error; -#if MACOSX_COREAUDIO +#ifdef MACOSX_COREAUDIO AudioDeviceID deviceID; SDL_atomic_t device_change_flag; #else diff --git a/thirdparty/SDL/src/audio/coreaudio/SDL_coreaudio.m b/thirdparty/SDL/src/audio/coreaudio/SDL_coreaudio.m index 974fe8681..26da64d7e 100644 --- a/thirdparty/SDL/src/audio/coreaudio/SDL_coreaudio.m +++ b/thirdparty/SDL/src/audio/coreaudio/SDL_coreaudio.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_AUDIO_DRIVER_COREAUDIO +#ifdef SDL_AUDIO_DRIVER_COREAUDIO /* !!! FIXME: clean out some of the macro salsa in here. */ @@ -48,7 +48,7 @@ } #endif -#if MACOSX_COREAUDIO +#ifdef MACOSX_COREAUDIO static const AudioObjectPropertyAddress devlist_address = { kAudioHardwarePropertyDevices, kAudioObjectPropertyScopeGlobal, @@ -289,11 +289,11 @@ static OSStatus device_list_changed(AudioObjectID systemObj, UInt32 num_addr, co static int num_open_devices; static SDL_AudioDevice **open_devices; -#if !MACOSX_COREAUDIO +#ifndef MACOSX_COREAUDIO static BOOL session_active = NO; -static void pause_audio_devices() +static void pause_audio_devices(void) { int i; @@ -309,7 +309,7 @@ static void pause_audio_devices() } } -static void resume_audio_devices() +static void resume_audio_devices(void) { int i; @@ -532,6 +532,9 @@ static void outputCallback(void *inUserData, AudioQueueRef inAQ, AudioQueueBuffe if (!SDL_AtomicGet(&this->enabled) || SDL_AtomicGet(&this->paused)) { /* Supply silence if audio is not enabled or paused */ SDL_memset(inBuffer->mAudioData, this->spec.silence, inBuffer->mAudioDataBytesCapacity); + if (this->stream) { + SDL_AudioStreamClear(this->stream); + } } else if (this->stream) { UInt32 remaining = inBuffer->mAudioDataBytesCapacity; Uint8 *ptr = (Uint8 *)inBuffer->mAudioData; @@ -627,7 +630,7 @@ static void inputCallback(void *inUserData, AudioQueueRef inAQ, AudioQueueBuffer AudioQueueEnqueueBuffer(this->hidden->audioQueue, inBuffer, 0, NULL); } -#if MACOSX_COREAUDIO +#ifdef MACOSX_COREAUDIO static const AudioObjectPropertyAddress alive_address = { kAudioDevicePropertyDeviceIsAlive, kAudioObjectPropertyScopeGlobal, @@ -681,7 +684,7 @@ static void COREAUDIO_CloseDevice(_THIS) /* !!! FIXME: what does iOS do when a bluetooth audio device vanishes? Headphones unplugged? */ /* !!! FIXME: (we only do a "default" device on iOS right now...can we do more?) */ -#if MACOSX_COREAUDIO +#ifdef MACOSX_COREAUDIO if (this->handle != NULL) { /* we don't register this listener for default devices. */ AudioObjectRemovePropertyListener(this->hidden->deviceID, &alive_address, device_unplugged, this); } @@ -708,7 +711,7 @@ static void COREAUDIO_CloseDevice(_THIS) open_playback_devices--; } -#if !MACOSX_COREAUDIO +#ifndef MACOSX_COREAUDIO update_audio_session(this, SDL_FALSE, SDL_TRUE); #endif @@ -737,7 +740,7 @@ static void COREAUDIO_CloseDevice(_THIS) SDL_free(this->hidden); } -#if MACOSX_COREAUDIO +#ifdef MACOSX_COREAUDIO static int prepare_device(_THIS) { void *handle = this->handle; @@ -830,7 +833,7 @@ static int prepare_audioqueue(_THIS) CHECK_RESULT("AudioQueueNewOutput"); } -#if MACOSX_COREAUDIO +#ifdef MACOSX_COREAUDIO if (!assign_device_to_audioqueue(this)) { return 0; } @@ -938,7 +941,7 @@ static int audioqueue_thread(void *arg) SDL_AudioDevice *this = (SDL_AudioDevice *)arg; int rc; -#if MACOSX_COREAUDIO +#ifdef MACOSX_COREAUDIO const AudioObjectPropertyAddress default_device_address = { this->iscapture ? kAudioHardwarePropertyDefaultInputDevice : kAudioHardwarePropertyDefaultOutputDevice, kAudioObjectPropertyScopeGlobal, @@ -966,7 +969,7 @@ static int audioqueue_thread(void *arg) while (!SDL_AtomicGet(&this->shutdown)) { CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0.10, 1); -#if MACOSX_COREAUDIO +#ifdef MACOSX_COREAUDIO if ((this->handle == NULL) && SDL_AtomicGet(&this->hidden->device_change_flag)) { const AudioDeviceID prev_devid = this->hidden->deviceID; SDL_AtomicSet(&this->hidden->device_change_flag, 0); @@ -999,7 +1002,7 @@ output device (in which case we'll try again). */ CFRunLoopRunInMode(kCFRunLoopDefaultMode, secs, 0); } -#if MACOSX_COREAUDIO +#ifdef MACOSX_COREAUDIO if (this->handle == NULL) { /* we don't care if this fails; we just won't change to new default devices, but we still otherwise function in this case. */ AudioObjectRemovePropertyListener(kAudioObjectSystemObject, &default_device_address, default_device_changed, this); @@ -1037,7 +1040,7 @@ static int COREAUDIO_OpenDevice(_THIS, const char *devname) open_devices[num_open_devices++] = this; } -#if !MACOSX_COREAUDIO +#ifndef MACOSX_COREAUDIO if (!update_audio_session(this, SDL_TRUE, SDL_TRUE)) { return -1; } @@ -1106,7 +1109,7 @@ static int COREAUDIO_OpenDevice(_THIS, const char *devname) strdesc->mBytesPerFrame = strdesc->mChannelsPerFrame * strdesc->mBitsPerChannel / 8; strdesc->mBytesPerPacket = strdesc->mBytesPerFrame * strdesc->mFramesPerPacket; -#if MACOSX_COREAUDIO +#ifdef MACOSX_COREAUDIO if (!prepare_device(this)) { return -1; } @@ -1134,7 +1137,7 @@ static int COREAUDIO_OpenDevice(_THIS, const char *devname) return (this->hidden->thread != NULL) ? 0 : -1; } -#if !MACOSX_COREAUDIO +#ifndef MACOSX_COREAUDIO static int COREAUDIO_GetDefaultAudioInfo(char **name, SDL_AudioSpec *spec, int iscapture) { AVAudioSession *session = [AVAudioSession sharedInstance]; @@ -1272,7 +1275,7 @@ static int COREAUDIO_GetDefaultAudioInfo(char **name, SDL_AudioSpec *spec, int i static void COREAUDIO_Deinitialize(void) { -#if MACOSX_COREAUDIO +#ifdef MACOSX_COREAUDIO AudioObjectRemovePropertyListener(kAudioObjectSystemObject, &devlist_address, device_list_changed, NULL); free_audio_device_list(&capture_devs); free_audio_device_list(&output_devs); @@ -1287,7 +1290,7 @@ static SDL_bool COREAUDIO_Init(SDL_AudioDriverImpl *impl) impl->Deinitialize = COREAUDIO_Deinitialize; impl->GetDefaultAudioInfo = COREAUDIO_GetDefaultAudioInfo; -#if MACOSX_COREAUDIO +#ifdef MACOSX_COREAUDIO impl->DetectDevices = COREAUDIO_DetectDevices; AudioObjectAddPropertyListener(kAudioObjectSystemObject, &devlist_address, device_list_changed, NULL); #else diff --git a/thirdparty/SDL/src/audio/directsound/SDL_directsound.c b/thirdparty/SDL/src/audio/directsound/SDL_directsound.c index a61a068f7..a98a1645f 100644 --- a/thirdparty/SDL/src/audio/directsound/SDL_directsound.c +++ b/thirdparty/SDL/src/audio/directsound/SDL_directsound.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_AUDIO_DRIVER_DSOUND +#ifdef SDL_AUDIO_DRIVER_DSOUND /* Allow access to a raw mixing buffer */ @@ -30,7 +30,7 @@ #include "../SDL_audio_c.h" #include "SDL_directsound.h" #include -#if HAVE_MMDEVICEAPI_H +#ifdef HAVE_MMDEVICEAPI_H #include "../../core/windows/SDL_immdevice.h" #endif /* HAVE_MMDEVICEAPI_H */ @@ -39,7 +39,7 @@ #endif /* For Vista+, we can enumerate DSound devices with IMMDevice */ -#if HAVE_MMDEVICEAPI_H +#ifdef HAVE_MMDEVICEAPI_H static SDL_bool SupportsIMMDevice = SDL_FALSE; #endif /* HAVE_MMDEVICEAPI_H */ @@ -64,7 +64,7 @@ static void DSOUND_Unload(void) pDirectSoundCaptureCreate8 = NULL; pDirectSoundCaptureEnumerateW = NULL; - if (DSoundDLL != NULL) { + if (DSoundDLL) { SDL_UnloadObject(DSoundDLL); DSoundDLL = NULL; } @@ -77,7 +77,7 @@ static int DSOUND_Load(void) DSOUND_Unload(); DSoundDLL = SDL_LoadObject("DSOUND.DLL"); - if (DSoundDLL == NULL) { + if (!DSoundDLL) { SDL_SetError("DirectSound: failed to load DSOUND.DLL"); } else { /* Now make sure we have DirectX 8 or better... */ @@ -159,7 +159,7 @@ static void DSOUND_FreeDeviceHandle(void *handle) static int DSOUND_GetDefaultAudioInfo(char **name, SDL_AudioSpec *spec, int iscapture) { -#if HAVE_MMDEVICEAPI_H +#ifdef HAVE_MMDEVICEAPI_H if (SupportsIMMDevice) { return SDL_IMMDevice_GetDefaultAudioInfo(name, spec, iscapture); } @@ -172,7 +172,7 @@ static BOOL CALLBACK FindAllDevs(LPGUID guid, LPCWSTR desc, LPCWSTR module, LPVO const int iscapture = (int)((size_t)data); if (guid != NULL) { /* skip default device */ char *str = WIN_LookupAudioDeviceName(desc, guid); - if (str != NULL) { + if (str) { LPGUID cpyguid = (LPGUID)SDL_malloc(sizeof(GUID)); SDL_memcpy(cpyguid, guid, sizeof(GUID)); @@ -189,14 +189,14 @@ static BOOL CALLBACK FindAllDevs(LPGUID guid, LPCWSTR desc, LPCWSTR module, LPVO static void DSOUND_DetectDevices(void) { -#if HAVE_MMDEVICEAPI_H +#ifdef HAVE_MMDEVICEAPI_H if (SupportsIMMDevice) { SDL_IMMDevice_EnumerateEndpoints(SDL_TRUE); } else { #endif /* HAVE_MMDEVICEAPI_H */ pDirectSoundCaptureEnumerateW(FindAllDevs, (void *)((size_t)1)); pDirectSoundEnumerateW(FindAllDevs, (void *)((size_t)0)); -#if HAVE_MMDEVICEAPI_H +#ifdef HAVE_MMDEVICEAPI_H } #endif /* HAVE_MMDEVICEAPI_H*/ } @@ -379,18 +379,18 @@ static void DSOUND_FlushCapture(_THIS) static void DSOUND_CloseDevice(_THIS) { - if (this->hidden->mixbuf != NULL) { + if (this->hidden->mixbuf) { IDirectSoundBuffer_Stop(this->hidden->mixbuf); IDirectSoundBuffer_Release(this->hidden->mixbuf); } - if (this->hidden->sound != NULL) { + if (this->hidden->sound) { IDirectSound_Release(this->hidden->sound); } - if (this->hidden->capturebuf != NULL) { + if (this->hidden->capturebuf) { IDirectSoundCaptureBuffer_Stop(this->hidden->capturebuf); IDirectSoundCaptureBuffer_Release(this->hidden->capturebuf); } - if (this->hidden->capture != NULL) { + if (this->hidden->capture) { IDirectSoundCapture_Release(this->hidden->capture); } SDL_free(this->hidden); @@ -493,7 +493,7 @@ static int DSOUND_OpenDevice(_THIS, const char *devname) /* Initialize all variables that we clean on shutdown */ this->hidden = (struct SDL_PrivateAudioData *)SDL_malloc(sizeof(*this->hidden)); - if (this->hidden == NULL) { + if (!this->hidden) { return SDL_OutOfMemory(); } SDL_zerop(this->hidden); @@ -612,7 +612,7 @@ static int DSOUND_OpenDevice(_THIS, const char *devname) static void DSOUND_Deinitialize(void) { -#if HAVE_MMDEVICEAPI_H +#ifdef HAVE_MMDEVICEAPI_H if (SupportsIMMDevice) { SDL_IMMDevice_Quit(); SupportsIMMDevice = SDL_FALSE; @@ -627,7 +627,7 @@ static SDL_bool DSOUND_Init(SDL_AudioDriverImpl *impl) return SDL_FALSE; } -#if HAVE_MMDEVICEAPI_H +#ifdef HAVE_MMDEVICEAPI_H SupportsIMMDevice = !(SDL_IMMDevice_Init() < 0); #endif /* HAVE_MMDEVICEAPI_H */ diff --git a/thirdparty/SDL/src/audio/directsound/SDL_directsound.h b/thirdparty/SDL/src/audio/directsound/SDL_directsound.h index 297769ef8..051b9d703 100644 --- a/thirdparty/SDL/src/audio/directsound/SDL_directsound.h +++ b/thirdparty/SDL/src/audio/directsound/SDL_directsound.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/audio/disk/SDL_diskaudio.c b/thirdparty/SDL/src/audio/disk/SDL_diskaudio.c index e98dbea7e..d9d4aae05 100644 --- a/thirdparty/SDL/src/audio/disk/SDL_diskaudio.c +++ b/thirdparty/SDL/src/audio/disk/SDL_diskaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,11 +20,11 @@ */ #include "../../SDL_internal.h" -#if SDL_AUDIO_DRIVER_DISK +#ifdef SDL_AUDIO_DRIVER_DISK /* Output raw audio data to a file. */ -#if HAVE_STDIO_H +#ifdef HAVE_STDIO_H #include #endif @@ -98,7 +98,7 @@ static void DISKAUDIO_FlushCapture(_THIS) static void DISKAUDIO_CloseDevice(_THIS) { - if (_this->hidden->io != NULL) { + if (_this->hidden->io) { SDL_RWclose(_this->hidden->io); } SDL_free(_this->hidden->mixbuf); @@ -107,9 +107,9 @@ static void DISKAUDIO_CloseDevice(_THIS) static const char *get_filename(const SDL_bool iscapture, const char *devname) { - if (devname == NULL) { + if (!devname) { devname = SDL_getenv(iscapture ? DISKENVR_INFILE : DISKENVR_OUTFILE); - if (devname == NULL) { + if (!devname) { devname = iscapture ? DISKDEFAULT_INFILE : DISKDEFAULT_OUTFILE; } } @@ -126,12 +126,12 @@ static int DISKAUDIO_OpenDevice(_THIS, const char *devname) _this->hidden = (struct SDL_PrivateAudioData *) SDL_malloc(sizeof(*_this->hidden)); - if (_this->hidden == NULL) { + if (!_this->hidden) { return SDL_OutOfMemory(); } SDL_zerop(_this->hidden); - if (envr != NULL) { + if (envr) { _this->hidden->io_delay = SDL_atoi(envr); } else { _this->hidden->io_delay = ((_this->spec.samples * 1000) / _this->spec.freq); @@ -139,14 +139,14 @@ static int DISKAUDIO_OpenDevice(_THIS, const char *devname) /* Open the audio device */ _this->hidden->io = SDL_RWFromFile(fname, iscapture ? "rb" : "wb"); - if (_this->hidden->io == NULL) { + if (!_this->hidden->io) { return -1; } /* Allocate mixing buffer */ if (!iscapture) { _this->hidden->mixbuf = (Uint8 *)SDL_malloc(_this->spec.size); - if (_this->hidden->mixbuf == NULL) { + if (!_this->hidden->mixbuf) { return SDL_OutOfMemory(); } SDL_memset(_this->hidden->mixbuf, _this->spec.silence, _this->spec.size); diff --git a/thirdparty/SDL/src/audio/disk/SDL_diskaudio.h b/thirdparty/SDL/src/audio/disk/SDL_diskaudio.h index f134820ea..8ae237f1e 100644 --- a/thirdparty/SDL/src/audio/disk/SDL_diskaudio.h +++ b/thirdparty/SDL/src/audio/disk/SDL_diskaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/audio/dsp/SDL_dspaudio.c b/thirdparty/SDL/src/audio/dsp/SDL_dspaudio.c index 441aa2574..fdbad8fee 100644 --- a/thirdparty/SDL/src/audio/dsp/SDL_dspaudio.c +++ b/thirdparty/SDL/src/audio/dsp/SDL_dspaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_AUDIO_DRIVER_OSS +#ifdef SDL_AUDIO_DRIVER_OSS /* Allow access to a raw mixing buffer */ @@ -67,9 +67,9 @@ static int DSP_OpenDevice(_THIS, const char *devname) /* We don't care what the devname is...we'll try to open anything. */ /* ...but default to first name in the list... */ - if (devname == NULL) { + if (!devname) { devname = SDL_GetAudioDeviceName(0, iscapture); - if (devname == NULL) { + if (!devname) { return SDL_SetError("No such audio device"); } } @@ -86,7 +86,7 @@ static int DSP_OpenDevice(_THIS, const char *devname) /* Initialize all variables that we clean on shutdown */ this->hidden = (struct SDL_PrivateAudioData *) SDL_malloc(sizeof(*this->hidden)); - if (this->hidden == NULL) { + if (!this->hidden) { return SDL_OutOfMemory(); } SDL_zerop(this->hidden); @@ -228,7 +228,7 @@ static int DSP_OpenDevice(_THIS, const char *devname) if (!iscapture) { this->hidden->mixlen = this->spec.size; this->hidden->mixbuf = (Uint8 *)SDL_malloc(this->hidden->mixlen); - if (this->hidden->mixbuf == NULL) { + if (!this->hidden->mixbuf) { return SDL_OutOfMemory(); } SDL_memset(this->hidden->mixbuf, this->spec.silence, this->spec.size); diff --git a/thirdparty/SDL/src/audio/dsp/SDL_dspaudio.h b/thirdparty/SDL/src/audio/dsp/SDL_dspaudio.h index 78c94e407..11214a52f 100644 --- a/thirdparty/SDL/src/audio/dsp/SDL_dspaudio.h +++ b/thirdparty/SDL/src/audio/dsp/SDL_dspaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/audio/dummy/SDL_dummyaudio.c b/thirdparty/SDL/src/audio/dummy/SDL_dummyaudio.c index 9255e28a6..b17cd44ac 100644 --- a/thirdparty/SDL/src/audio/dummy/SDL_dummyaudio.c +++ b/thirdparty/SDL/src/audio/dummy/SDL_dummyaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,6 +20,8 @@ */ #include "../../SDL_internal.h" +#ifdef SDL_AUDIO_DRIVER_DUMMY + /* Output audio to nowhere... */ #include "SDL_timer.h" @@ -61,4 +63,6 @@ AudioBootStrap DUMMYAUDIO_bootstrap = { "dummy", "SDL dummy audio driver", DUMMYAUDIO_Init, SDL_TRUE }; +#endif + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/thirdparty/SDL/src/audio/dummy/SDL_dummyaudio.h b/thirdparty/SDL/src/audio/dummy/SDL_dummyaudio.h index e93b5f94b..500f5d97d 100644 --- a/thirdparty/SDL/src/audio/dummy/SDL_dummyaudio.h +++ b/thirdparty/SDL/src/audio/dummy/SDL_dummyaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/audio/emscripten/SDL_emscriptenaudio.c b/thirdparty/SDL/src/audio/emscripten/SDL_emscriptenaudio.c index 341c9dfcd..8d21dab59 100644 --- a/thirdparty/SDL/src/audio/emscripten/SDL_emscriptenaudio.c +++ b/thirdparty/SDL/src/audio/emscripten/SDL_emscriptenaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_AUDIO_DRIVER_EMSCRIPTEN +#ifdef SDL_AUDIO_DRIVER_EMSCRIPTEN #include "SDL_audio.h" #include "../SDL_audio_c.h" @@ -70,7 +70,7 @@ static void HandleAudioProcess(_THIS) return; } - if (this->stream == NULL) { /* no conversion necessary. */ + if (!this->stream) { /* no conversion necessary. */ SDL_assert(this->spec.size == stream_len); callback(this->callbackspec.userdata, this->work_buffer, stream_len); } else { /* streaming/converting */ @@ -130,7 +130,7 @@ static void HandleCaptureProcess(_THIS) /* okay, we've got an interleaved float32 array in C now. */ - if (this->stream == NULL) { /* no conversion necessary. */ + if (!this->stream) { /* no conversion necessary. */ SDL_assert(this->spec.size == stream_len); callback(this->callbackspec.userdata, this->work_buffer, stream_len); } else { /* streaming/converting */ @@ -156,32 +156,28 @@ static void EMSCRIPTENAUDIO_CloseDevice(_THIS) var SDL2 = Module['SDL2']; if ($0) { if (SDL2.capture.silenceTimer !== undefined) { - clearTimeout(SDL2.capture.silenceTimer); + clearInterval(SDL2.capture.silenceTimer); } if (SDL2.capture.stream !== undefined) { var tracks = SDL2.capture.stream.getAudioTracks(); for (var i = 0; i < tracks.length; i++) { SDL2.capture.stream.removeTrack(tracks[i]); } - SDL2.capture.stream = undefined; } if (SDL2.capture.scriptProcessorNode !== undefined) { SDL2.capture.scriptProcessorNode.onaudioprocess = function(audioProcessingEvent) {}; SDL2.capture.scriptProcessorNode.disconnect(); - SDL2.capture.scriptProcessorNode = undefined; } if (SDL2.capture.mediaStreamNode !== undefined) { SDL2.capture.mediaStreamNode.disconnect(); - SDL2.capture.mediaStreamNode = undefined; - } - if (SDL2.capture.silenceBuffer !== undefined) { - SDL2.capture.silenceBuffer = undefined } SDL2.capture = undefined; } else { if (SDL2.audio.scriptProcessorNode != undefined) { SDL2.audio.scriptProcessorNode.disconnect(); - SDL2.audio.scriptProcessorNode = undefined; + } + if (SDL2.audio.silenceTimer !== undefined) { + clearInterval(SDL2.audio.silenceTimer); } SDL2.audio = undefined; } @@ -227,7 +223,9 @@ static int EMSCRIPTENAUDIO_OpenDevice(_THIS, const char *devname) SDL2.audioContext = new webkitAudioContext(); } if (SDL2.audioContext) { - autoResumeAudioContext(SDL2.audioContext); + if ((typeof navigator.userActivation) === 'undefined') { // Firefox doesn't have this (as of August 2023), use autoResumeAudioContext instead. + autoResumeAudioContext(SDL2.audioContext); + } } } return SDL2.audioContext === undefined ? -1 : 0; @@ -296,8 +294,9 @@ static int EMSCRIPTENAUDIO_OpenDevice(_THIS, const char *devname) var have_microphone = function(stream) { //console.log('SDL audio capture: we have a microphone! Replacing silence callback.'); if (SDL2.capture.silenceTimer !== undefined) { - clearTimeout(SDL2.capture.silenceTimer); + clearInterval(SDL2.capture.silenceTimer); SDL2.capture.silenceTimer = undefined; + SDL2.capture.silenceBuffer = undefined } SDL2.capture.mediaStreamNode = SDL2.audioContext.createMediaStreamSource(stream); SDL2.capture.scriptProcessorNode = SDL2.audioContext.createScriptProcessor($1, $0, 1); @@ -324,7 +323,7 @@ static int EMSCRIPTENAUDIO_OpenDevice(_THIS, const char *devname) dynCall('vi', $2, [$3]); }; - SDL2.capture.silenceTimer = setTimeout(silence_callback, ($1 / SDL2.audioContext.sampleRate) * 1000); + SDL2.capture.silenceTimer = setInterval(silence_callback, ($1 / SDL2.audioContext.sampleRate) * 1000); if ((navigator.mediaDevices !== undefined) && (navigator.mediaDevices.getUserMedia !== undefined)) { navigator.mediaDevices.getUserMedia({ audio: true, video: false }).then(have_microphone).catch(no_microphone); @@ -339,10 +338,37 @@ static int EMSCRIPTENAUDIO_OpenDevice(_THIS, const char *devname) SDL2.audio.scriptProcessorNode = SDL2.audioContext['createScriptProcessor']($1, 0, $0); SDL2.audio.scriptProcessorNode['onaudioprocess'] = function (e) { if ((SDL2 === undefined) || (SDL2.audio === undefined)) { return; } + // if we're actually running the node, we don't need the fake callback anymore, so kill it. + if (SDL2.audio.silenceTimer !== undefined) { + clearInterval(SDL2.audio.silenceTimer); + SDL2.audio.silenceTimer = undefined; + SDL2.audio.silenceBuffer = undefined; + } SDL2.audio.currentOutputBuffer = e['outputBuffer']; dynCall('vi', $2, [$3]); }; + SDL2.audio.scriptProcessorNode['connect'](SDL2.audioContext['destination']); + + if (SDL2.audioContext.state === 'suspended') { // uhoh, autoplay is blocked. + SDL2.audio.silenceBuffer = SDL2.audioContext.createBuffer($0, $1, SDL2.audioContext.sampleRate); + SDL2.audio.silenceBuffer.getChannelData(0).fill(0.0); + var silence_callback = function() { + if ((typeof navigator.userActivation) !== 'undefined') { // Almost everything modern except Firefox (as of August 2023) + if (navigator.userActivation.hasBeenActive) { + SDL2.audioContext.resume(); + } + } + + // the buffer that gets filled here just gets ignored, so the app can make progress + // and/or avoid flooding audio queues until we can actually play audio. + SDL2.audio.currentOutputBuffer = SDL2.audio.silenceBuffer; + dynCall('vi', $2, [$3]); + SDL2.audio.currentOutputBuffer = undefined; + }; + + SDL2.audio.silenceTimer = setInterval(silence_callback, ($1 / SDL2.audioContext.sampleRate) * 1000); + } }, this->spec.channels, this->spec.samples, HandleAudioProcess, this); } /* *INDENT-ON* */ /* clang-format on */ diff --git a/thirdparty/SDL/src/audio/emscripten/SDL_emscriptenaudio.h b/thirdparty/SDL/src/audio/emscripten/SDL_emscriptenaudio.h index 13cadcfc4..54f605724 100644 --- a/thirdparty/SDL/src/audio/emscripten/SDL_emscriptenaudio.h +++ b/thirdparty/SDL/src/audio/emscripten/SDL_emscriptenaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/audio/esd/SDL_esdaudio.c b/thirdparty/SDL/src/audio/esd/SDL_esdaudio.c index 800caaf0b..10ecdfdf9 100644 --- a/thirdparty/SDL/src/audio/esd/SDL_esdaudio.c +++ b/thirdparty/SDL/src/audio/esd/SDL_esdaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_AUDIO_DRIVER_ESD +#ifdef SDL_AUDIO_DRIVER_ESD /* Allow access to an ESD network stream mixing buffer */ @@ -64,9 +64,9 @@ static struct #undef SDL_ESD_SYM -static void UnloadESDLibrary() +static void UnloadESDLibrary(void) { - if (esd_handle != NULL) { + if (esd_handle) { SDL_UnloadObject(esd_handle); esd_handle = NULL; } @@ -76,7 +76,7 @@ static int LoadESDLibrary(void) { int i, retval = -1; - if (esd_handle == NULL) { + if (!esd_handle) { esd_handle = SDL_LoadObject(esd_library); if (esd_handle) { retval = 0; @@ -96,7 +96,7 @@ static int LoadESDLibrary(void) #else -static void UnloadESDLibrary() +static void UnloadESDLibrary(void) { return; } @@ -185,7 +185,7 @@ static char *get_progname(void) if (fp != NULL) { if (fgets(temp, sizeof(temp) - 1, fp)) { progname = SDL_strrchr(temp, '/'); - if (progname == NULL) { + if (!progname) { progname = temp; } else { progname = progname + 1; @@ -206,7 +206,7 @@ static int ESD_OpenDevice(_THIS, const char *devname) /* Initialize all variables that we clean on shutdown */ this->hidden = (struct SDL_PrivateAudioData *)SDL_malloc(sizeof(*this->hidden)); - if (this->hidden == NULL) { + if (!this->hidden) { return SDL_OutOfMemory(); } SDL_zerop(this->hidden); @@ -264,7 +264,7 @@ static int ESD_OpenDevice(_THIS, const char *devname) /* Allocate mixing buffer */ this->hidden->mixlen = this->spec.size; this->hidden->mixbuf = (Uint8 *) SDL_malloc(this->hidden->mixlen); - if (this->hidden->mixbuf == NULL) { + if (!this->hidden->mixbuf) { return SDL_OutOfMemory(); } SDL_memset(this->hidden->mixbuf, this->spec.silence, this->spec.size); diff --git a/thirdparty/SDL/src/audio/esd/SDL_esdaudio.h b/thirdparty/SDL/src/audio/esd/SDL_esdaudio.h index 01ef9fb31..15e3d4e1d 100644 --- a/thirdparty/SDL/src/audio/esd/SDL_esdaudio.h +++ b/thirdparty/SDL/src/audio/esd/SDL_esdaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/audio/fusionsound/SDL_fsaudio.c b/thirdparty/SDL/src/audio/fusionsound/SDL_fsaudio.c index f79ab22f7..b05b5d485 100644 --- a/thirdparty/SDL/src/audio/fusionsound/SDL_fsaudio.c +++ b/thirdparty/SDL/src/audio/fusionsound/SDL_fsaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_AUDIO_DRIVER_FUSIONSOUND +#ifdef SDL_AUDIO_DRIVER_FUSIONSOUND /* !!! FIXME: why is this is SDL_FS_* instead of FUSIONSOUND_*? */ @@ -77,9 +77,9 @@ static struct #undef SDL_FS_SYM -static void UnloadFusionSoundLibrary() +static void UnloadFusionSoundLibrary(void) { - if (fs_handle != NULL) { + if (fs_handle) { SDL_UnloadObject(fs_handle); fs_handle = NULL; } @@ -89,9 +89,9 @@ static int LoadFusionSoundLibrary(void) { int i, retval = -1; - if (fs_handle == NULL) { + if (!fs_handle) { fs_handle = SDL_LoadObject(fs_library); - if (fs_handle != NULL) { + if (fs_handle) { retval = 0; for (i = 0; i < SDL_arraysize(fs_functions); ++i) { *fs_functions[i].func = @@ -110,7 +110,7 @@ static int LoadFusionSoundLibrary(void) #else -static void UnloadFusionSoundLibrary() +static void UnloadFusionSoundLibrary(void) { return; } @@ -175,7 +175,7 @@ static int SDL_FS_OpenDevice(_THIS, const char *devname) /* Initialize all variables that we clean on shutdown */ this->hidden = (struct SDL_PrivateAudioData *)SDL_malloc(sizeof(*this->hidden)); - if (this->hidden == NULL) { + if (!this->hidden) { return SDL_OutOfMemory(); } SDL_zerop(this->hidden); @@ -250,7 +250,7 @@ static int SDL_FS_OpenDevice(_THIS, const char *devname) /* Allocate mixing buffer */ this->hidden->mixlen = this->spec.size; this->hidden->mixbuf = (Uint8 *) SDL_malloc(this->hidden->mixlen); - if (this->hidden->mixbuf == NULL) { + if (!this->hidden->mixbuf) { return SDL_OutOfMemory(); } SDL_memset(this->hidden->mixbuf, this->spec.silence, this->spec.size); diff --git a/thirdparty/SDL/src/audio/fusionsound/SDL_fsaudio.h b/thirdparty/SDL/src/audio/fusionsound/SDL_fsaudio.h index fd1841761..556ea54c6 100644 --- a/thirdparty/SDL/src/audio/fusionsound/SDL_fsaudio.h +++ b/thirdparty/SDL/src/audio/fusionsound/SDL_fsaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/audio/haiku/SDL_haikuaudio.cc b/thirdparty/SDL/src/audio/haiku/SDL_haikuaudio.cc index ca946ed75..39b8d8ca7 100644 --- a/thirdparty/SDL/src/audio/haiku/SDL_haikuaudio.cc +++ b/thirdparty/SDL/src/audio/haiku/SDL_haikuaudio.cc @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_AUDIO_DRIVER_HAIKU +#ifdef SDL_AUDIO_DRIVER_HAIKU /* Allow access to the audio stream on Haiku */ @@ -59,7 +59,7 @@ static void FillSound(void *device, void *stream, size_t len, } else { SDL_assert(audio->spec.size == len); - if (audio->stream == NULL) { /* no conversion necessary. */ + if (!audio->stream) { /* no conversion necessary. */ callback(audio->callbackspec.userdata, (Uint8 *) stream, len); } else { /* streaming/converting */ const int stream_len = audio->callbackspec.size; diff --git a/thirdparty/SDL/src/audio/haiku/SDL_haikuaudio.h b/thirdparty/SDL/src/audio/haiku/SDL_haikuaudio.h index f40aae164..9acb6e1b3 100644 --- a/thirdparty/SDL/src/audio/haiku/SDL_haikuaudio.h +++ b/thirdparty/SDL/src/audio/haiku/SDL_haikuaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/audio/jack/SDL_jackaudio.c b/thirdparty/SDL/src/audio/jack/SDL_jackaudio.c index f9e942c57..9be8799b4 100644 --- a/thirdparty/SDL/src/audio/jack/SDL_jackaudio.c +++ b/thirdparty/SDL/src/audio/jack/SDL_jackaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_AUDIO_DRIVER_JACK +#ifdef SDL_AUDIO_DRIVER_JACK #include "SDL_timer.h" #include "SDL_audio.h" @@ -58,7 +58,7 @@ static void *jack_handle = NULL; static int load_jack_sym(const char *fn, void **addr) { *addr = SDL_LoadFunction(jack_handle, fn); - if (*addr == NULL) { + if (!*addr) { /* Don't call SDL_SetError(): SDL_LoadFunction already did. */ return 0; } @@ -73,7 +73,7 @@ static int load_jack_sym(const char *fn, void **addr) static void UnloadJackLibrary(void) { - if (jack_handle != NULL) { + if (jack_handle) { SDL_UnloadObject(jack_handle); jack_handle = NULL; } @@ -82,9 +82,9 @@ static void UnloadJackLibrary(void) static int LoadJackLibrary(void) { int retval = 0; - if (jack_handle == NULL) { + if (!jack_handle) { jack_handle = SDL_LoadObject(jack_library); - if (jack_handle == NULL) { + if (!jack_handle) { retval = -1; /* Don't call SDL_SetError(): SDL_LoadObject already did. */ } else { @@ -341,7 +341,7 @@ static int JACK_OpenDevice(_THIS, const char *devname) /* Build SDL's ports, which we will connect to the device ports. */ this->hidden->sdlports = (jack_port_t **)SDL_calloc(channels, sizeof(jack_port_t *)); - if (this->hidden->sdlports == NULL) { + if (!this->hidden->sdlports) { SDL_free(audio_ports); return SDL_OutOfMemory(); } @@ -400,7 +400,7 @@ static SDL_bool JACK_Init(SDL_AudioDriverImpl *impl) /* Make sure a JACK server is running and available. */ jack_status_t status; jack_client_t *client = JACK_jack_client_open("SDL", JackNoStartServer, &status, NULL); - if (client == NULL) { + if (!client) { UnloadJackLibrary(); return SDL_FALSE; } diff --git a/thirdparty/SDL/src/audio/jack/SDL_jackaudio.h b/thirdparty/SDL/src/audio/jack/SDL_jackaudio.h index 3b58d7a81..e0ac2e90b 100644 --- a/thirdparty/SDL/src/audio/jack/SDL_jackaudio.h +++ b/thirdparty/SDL/src/audio/jack/SDL_jackaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/audio/n3ds/SDL_n3dsaudio.c b/thirdparty/SDL/src/audio/n3ds/SDL_n3dsaudio.c index ddf4e3aae..ea20a7ce3 100644 --- a/thirdparty/SDL/src/audio/n3ds/SDL_n3dsaudio.c +++ b/thirdparty/SDL/src/audio/n3ds/SDL_n3dsaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -38,6 +38,7 @@ static SDL_AudioDevice *audio_device; static void FreePrivateData(_THIS); static int FindAudioFormat(_THIS); +/* fully local functions related to the wavebufs / DSP, not the same as the SDL-wide mixer lock */ static SDL_INLINE void contextLock(_THIS) { LightLock_Lock(&this->hidden->lock); @@ -48,16 +49,6 @@ static SDL_INLINE void contextUnlock(_THIS) LightLock_Unlock(&this->hidden->lock); } -static void N3DSAUD_LockAudio(_THIS) -{ - contextLock(this); -} - -static void N3DSAUD_UnlockAudio(_THIS) -{ - contextUnlock(this); -} - static void N3DSAUD_DspHook(DSP_HookType hook) { if (hook == DSPHOOK_ONCANCEL) { @@ -98,7 +89,7 @@ static int N3DSAUDIO_OpenDevice(_THIS, const char *devname) float mix[12]; this->hidden = (struct SDL_PrivateAudioData *)SDL_calloc(1, sizeof(*this->hidden)); - if (this->hidden == NULL) { + if (!this->hidden) { return SDL_OutOfMemory(); } @@ -136,14 +127,14 @@ static int N3DSAUDIO_OpenDevice(_THIS, const char *devname) this->hidden->mixlen = this->spec.size; this->hidden->mixbuf = (Uint8 *)SDL_malloc(this->spec.size); - if (this->hidden->mixbuf == NULL) { + if (!this->hidden->mixbuf) { return SDL_OutOfMemory(); } SDL_memset(this->hidden->mixbuf, this->spec.silence, this->spec.size); data_vaddr = (Uint8 *)linearAlloc(this->hidden->mixlen * NUM_BUFFERS); - if (data_vaddr == NULL) { + if (!data_vaddr) { return SDL_OutOfMemory(); } @@ -195,6 +186,7 @@ static void N3DSAUDIO_PlayDevice(_THIS) { size_t nextbuf; size_t sampleLen; + contextLock(this); nextbuf = this->hidden->nextbuf; @@ -254,7 +246,7 @@ static void N3DSAUDIO_CloseDevice(_THIS) static void N3DSAUDIO_ThreadInit(_THIS) { - s32 current_priority; + s32 current_priority = 0x30; svcGetThreadPriority(¤t_priority, CUR_THREAD_HANDLE); current_priority--; /* 0x18 is reserved for video, 0x30 is the default for main thread */ @@ -271,8 +263,6 @@ static SDL_bool N3DSAUDIO_Init(SDL_AudioDriverImpl *impl) impl->GetDeviceBuf = N3DSAUDIO_GetDeviceBuf; impl->CloseDevice = N3DSAUDIO_CloseDevice; impl->ThreadInit = N3DSAUDIO_ThreadInit; - impl->LockDevice = N3DSAUD_LockAudio; - impl->UnlockDevice = N3DSAUD_UnlockAudio; impl->OnlyHasDefaultOutputDevice = SDL_TRUE; /* Should be possible, but micInit would fail */ diff --git a/thirdparty/SDL/src/audio/n3ds/SDL_n3dsaudio.h b/thirdparty/SDL/src/audio/n3ds/SDL_n3dsaudio.h index 7321f6c17..274e9f362 100644 --- a/thirdparty/SDL/src/audio/n3ds/SDL_n3dsaudio.h +++ b/thirdparty/SDL/src/audio/n3ds/SDL_n3dsaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -27,7 +27,7 @@ /* Hidden "this" pointer for the audio functions */ #define _THIS SDL_AudioDevice *this -#define NUM_BUFFERS 2 /* -- Don't lower this! */ +#define NUM_BUFFERS 3 /* -- Minimum 2! */ struct SDL_PrivateAudioData { diff --git a/thirdparty/SDL/src/audio/nacl/SDL_naclaudio.c b/thirdparty/SDL/src/audio/nacl/SDL_naclaudio.c index cdb01bcb7..f189256cb 100644 --- a/thirdparty/SDL/src/audio/nacl/SDL_naclaudio.c +++ b/thirdparty/SDL/src/audio/nacl/SDL_naclaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,7 +21,7 @@ #include "../../SDL_internal.h" -#if SDL_AUDIO_DRIVER_NACL +#ifdef SDL_AUDIO_DRIVER_NACL #include "SDL_naclaudio.h" @@ -62,7 +62,7 @@ static void nacl_audio_callback(void* stream, uint32_t buffer_size, PP_TimeDelta } else { SDL_assert(_this->spec.size == len); - if (_this->stream == NULL) { /* no conversion necessary. */ + if (!_this->stream) { /* no conversion necessary. */ callback(_this->callbackspec.userdata, stream, len); } else { /* streaming/converting */ const int stream_len = _this->callbackspec.size; @@ -103,7 +103,7 @@ static int NACLAUDIO_OpenDevice(_THIS, const char *devname) const PPB_AudioConfig *ppb_audiocfg = PSInterfaceAudioConfig(); private = (SDL_PrivateAudioData *)SDL_calloc(1, sizeof(*private)); - if (private == NULL) { + if (!private) { return SDL_OutOfMemory(); } diff --git a/thirdparty/SDL/src/audio/nacl/SDL_naclaudio.h b/thirdparty/SDL/src/audio/nacl/SDL_naclaudio.h index 5ca01029e..c08702be4 100644 --- a/thirdparty/SDL/src/audio/nacl/SDL_naclaudio.h +++ b/thirdparty/SDL/src/audio/nacl/SDL_naclaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/audio/nas/SDL_nasaudio.c b/thirdparty/SDL/src/audio/nas/SDL_nasaudio.c index d6807203d..f3eb68f33 100644 --- a/thirdparty/SDL/src/audio/nas/SDL_nasaudio.c +++ b/thirdparty/SDL/src/audio/nas/SDL_nasaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_AUDIO_DRIVER_NAS +#ifdef SDL_AUDIO_DRIVER_NAS /* Allow access to a raw mixing buffer */ @@ -59,7 +59,7 @@ static void *nas_handle = NULL; static int load_nas_sym(const char *fn, void **addr) { *addr = SDL_LoadFunction(nas_handle, fn); - if (*addr == NULL) { + if (!*addr) { return 0; } return 1; @@ -94,7 +94,7 @@ static int load_nas_syms(void) static void UnloadNASLibrary(void) { - if (nas_handle != NULL) { + if (nas_handle) { SDL_UnloadObject(nas_handle); nas_handle = NULL; } @@ -103,9 +103,9 @@ static void UnloadNASLibrary(void) static int LoadNASLibrary(void) { int retval = 0; - if (nas_handle == NULL) { + if (!nas_handle) { nas_handle = SDL_LoadObject(nas_library); - if (nas_handle == NULL) { + if (!nas_handle) { /* Copy error string so we can use it in a new SDL_SetError(). */ const char *origerr = SDL_GetError(); const size_t len = SDL_strlen(origerr) + 1; @@ -305,7 +305,7 @@ static int NAS_OpenDevice(_THIS, const char *devname) /* Initialize all variables that we clean on shutdown */ this->hidden = (struct SDL_PrivateAudioData *)SDL_malloc(sizeof(*this->hidden)); - if (this->hidden == NULL) { + if (!this->hidden) { return SDL_OutOfMemory(); } SDL_zerop(this->hidden); @@ -389,7 +389,7 @@ static int NAS_OpenDevice(_THIS, const char *devname) if (!iscapture) { this->hidden->mixlen = this->spec.size; this->hidden->mixbuf = (Uint8 *) SDL_malloc(this->hidden->mixlen); - if (this->hidden->mixbuf == NULL) { + if (!this->hidden->mixbuf) { return SDL_OutOfMemory(); } SDL_memset(this->hidden->mixbuf, this->spec.silence, this->spec.size); @@ -410,7 +410,7 @@ static SDL_bool NAS_Init(SDL_AudioDriverImpl * impl) return SDL_FALSE; } else { AuServer *aud = NAS_AuOpenServer("", 0, NULL, 0, NULL, NULL); - if (aud == NULL) { + if (!aud) { SDL_SetError("NAS: AuOpenServer() failed (no audio server?)"); return SDL_FALSE; } diff --git a/thirdparty/SDL/src/audio/nas/SDL_nasaudio.h b/thirdparty/SDL/src/audio/nas/SDL_nasaudio.h index af191e41c..0275c06d6 100644 --- a/thirdparty/SDL/src/audio/nas/SDL_nasaudio.h +++ b/thirdparty/SDL/src/audio/nas/SDL_nasaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/audio/netbsd/SDL_netbsdaudio.c b/thirdparty/SDL/src/audio/netbsd/SDL_netbsdaudio.c index d90f28a94..cc515995b 100644 --- a/thirdparty/SDL/src/audio/netbsd/SDL_netbsdaudio.c +++ b/thirdparty/SDL/src/audio/netbsd/SDL_netbsdaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_AUDIO_DRIVER_NETBSD +#ifdef SDL_AUDIO_DRIVER_NETBSD /* * Driver for native NetBSD audio(4). @@ -202,16 +202,16 @@ static int NETBSDAUDIO_OpenDevice(_THIS, const char *devname) /* We don't care what the devname is...we'll try to open anything. */ /* ...but default to first name in the list... */ - if (devname == NULL) { + if (!devname) { devname = SDL_GetAudioDeviceName(0, iscapture); - if (devname == NULL) { + if (!devname) { return SDL_SetError("No such audio device"); } } /* Initialize all variables that we clean on shutdown */ this->hidden = (struct SDL_PrivateAudioData *) SDL_malloc(sizeof(*this->hidden)); - if (this->hidden == NULL) { + if (!this->hidden) { return SDL_OutOfMemory(); } SDL_zerop(this->hidden); @@ -296,7 +296,7 @@ static int NETBSDAUDIO_OpenDevice(_THIS, const char *devname) /* Allocate mixing buffer */ this->hidden->mixlen = this->spec.size; this->hidden->mixbuf = (Uint8 *)SDL_malloc(this->hidden->mixlen); - if (this->hidden->mixbuf == NULL) { + if (!this->hidden->mixbuf) { return SDL_OutOfMemory(); } SDL_memset(this->hidden->mixbuf, this->spec.silence, this->spec.size); diff --git a/thirdparty/SDL/src/audio/netbsd/SDL_netbsdaudio.h b/thirdparty/SDL/src/audio/netbsd/SDL_netbsdaudio.h index c863bb5ab..81fd4e6d0 100644 --- a/thirdparty/SDL/src/audio/netbsd/SDL_netbsdaudio.h +++ b/thirdparty/SDL/src/audio/netbsd/SDL_netbsdaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/audio/openslES/SDL_openslES.c b/thirdparty/SDL/src/audio/openslES/SDL_openslES.c index 998104c24..d93fb5ac1 100644 --- a/thirdparty/SDL/src/audio/openslES/SDL_openslES.c +++ b/thirdparty/SDL/src/audio/openslES/SDL_openslES.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_AUDIO_DRIVER_OPENSLES +#ifdef SDL_AUDIO_DRIVER_OPENSLES /* For more discussion of low latency audio on Android, see this: https://googlesamples.github.io/android-audio-high-performance/guides/opensl_es.html @@ -320,7 +320,7 @@ static int openslES_CreatePCMRecorder(_THIS) /* Create the sound buffers */ audiodata->mixbuff = (Uint8 *)SDL_malloc(NUM_BUFFERS * this->spec.size); - if (audiodata->mixbuff == NULL) { + if (!audiodata->mixbuff) { LOGE("mixbuffer allocate - out of memory"); goto failed; } @@ -566,7 +566,7 @@ static int openslES_CreatePCMPlayer(_THIS) /* Create the sound buffers */ audiodata->mixbuff = (Uint8 *)SDL_malloc(NUM_BUFFERS * this->spec.size); - if (audiodata->mixbuff == NULL) { + if (!audiodata->mixbuff) { LOGE("mixbuffer allocate - out of memory"); goto failed; } @@ -591,7 +591,7 @@ static int openslES_CreatePCMPlayer(_THIS) static int openslES_OpenDevice(_THIS, const char *devname) { this->hidden = (struct SDL_PrivateAudioData *)SDL_calloc(1, sizeof(*this->hidden)); - if (this->hidden == NULL) { + if (!this->hidden) { return SDL_OutOfMemory(); } diff --git a/thirdparty/SDL/src/audio/openslES/SDL_openslES.h b/thirdparty/SDL/src/audio/openslES/SDL_openslES.h index 01464b7e5..b9943d89d 100644 --- a/thirdparty/SDL/src/audio/openslES/SDL_openslES.h +++ b/thirdparty/SDL/src/audio/openslES/SDL_openslES.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/audio/os2/SDL_os2audio.c b/thirdparty/SDL/src/audio/os2/SDL_os2audio.c index 2f1e6bc66..c61c641c8 100644 --- a/thirdparty/SDL/src/audio/os2/SDL_os2audio.c +++ b/thirdparty/SDL/src/audio/os2/SDL_os2audio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_AUDIO_DRIVER_OS2 +#ifdef SDL_AUDIO_DRIVER_OS2 /* Allow access to a raw mixing buffer */ @@ -43,7 +43,7 @@ static ULONG _getEnvULong(const char *name, ULONG ulMax, ULONG ulDefault) char* end; char* envval = SDL_getenv(name); - if (envval == NULL) + if (!envval) return ulDefault; ulValue = SDL_strtoul(envval, &end, 10); @@ -351,7 +351,7 @@ static void OS2_CloseDevice(_THIS) debug_os2("Enter"); - if (pAData == NULL) + if (!pAData) return; pAData->ulState = 2; @@ -429,7 +429,7 @@ static int OS2_OpenDevice(_THIS, const char *devname) } pAData = (SDL_PrivateAudioData *) SDL_calloc(1, sizeof(struct SDL_PrivateAudioData)); - if (pAData == NULL) + if (!pAData) return SDL_OutOfMemory(); _this->hidden = pAData; diff --git a/thirdparty/SDL/src/audio/os2/SDL_os2audio.h b/thirdparty/SDL/src/audio/os2/SDL_os2audio.h index fb6a832b6..41f091fa0 100644 --- a/thirdparty/SDL/src/audio/os2/SDL_os2audio.h +++ b/thirdparty/SDL/src/audio/os2/SDL_os2audio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/audio/paudio/SDL_paudio.c b/thirdparty/SDL/src/audio/paudio/SDL_paudio.c index 5c5c36fc2..b82ec8e97 100644 --- a/thirdparty/SDL/src/audio/paudio/SDL_paudio.c +++ b/thirdparty/SDL/src/audio/paudio/SDL_paudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_AUDIO_DRIVER_PAUDIO +#ifdef SDL_AUDIO_DRIVER_PAUDIO /* Allow access to a raw mixing buffer */ @@ -78,11 +78,11 @@ static int OpenUserDefinedDevice(char *path, int maxlen, int flags) if ((audiodev = SDL_getenv("SDL_PATH_DSP")) == NULL) { audiodev = SDL_getenv("AUDIODEV"); } - if (audiodev == NULL) { + if (!audiodev) { return -1; } fd = open(audiodev, flags, 0); - if (path != NULL) { + if (path) { SDL_strlcpy(path, audiodev, maxlen); path[maxlen - 1] = '\0'; } @@ -110,7 +110,7 @@ static int OpenAudioPath(char *path, int maxlen, int flags, int classic) if (stat(audiopath, &sb) == 0) { fd = open(audiopath, flags, 0); if (fd >= 0) { - if (path != NULL) { + if (path) { SDL_strlcpy(path, audiopath, maxlen); } return fd; @@ -232,7 +232,7 @@ static int PAUDIO_OpenDevice(_THIS, const char *devname) /* Initialize all variables that we clean on shutdown */ this->hidden = (struct SDL_PrivateAudioData *)SDL_malloc(sizeof(*this->hidden)); - if (this->hidden == NULL) { + if (!this->hidden) { return SDL_OutOfMemory(); } SDL_zerop(this->hidden); @@ -403,7 +403,7 @@ static int PAUDIO_OpenDevice(_THIS, const char *devname) /* Allocate mixing buffer */ this->hidden->mixlen = this->spec.size; this->hidden->mixbuf = (Uint8 *) SDL_malloc(this->hidden->mixlen); - if (this->hidden->mixbuf == NULL) { + if (!this->hidden->mixbuf) { return SDL_OutOfMemory(); } SDL_memset(this->hidden->mixbuf, this->spec.silence, this->spec.size); @@ -445,7 +445,7 @@ static int PAUDIO_OpenDevice(_THIS, const char *devname) } /* Check to see if we need to use SDL_IOReady() workaround */ - if (workaround != NULL) { + if (workaround) { this->hidden->frame_ticks = (float) (this->spec.samples * 1000) / this->spec.freq; this->hidden->next_frame = SDL_GetTicks() + this->hidden->frame_ticks; diff --git a/thirdparty/SDL/src/audio/paudio/SDL_paudio.h b/thirdparty/SDL/src/audio/paudio/SDL_paudio.h index 1646b03da..7c870ca9b 100644 --- a/thirdparty/SDL/src/audio/paudio/SDL_paudio.h +++ b/thirdparty/SDL/src/audio/paudio/SDL_paudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/audio/pipewire/SDL_pipewire.c b/thirdparty/SDL/src/audio/pipewire/SDL_pipewire.c index f9694334d..b473a318c 100644 --- a/thirdparty/SDL/src/audio/pipewire/SDL_pipewire.c +++ b/thirdparty/SDL/src/audio/pipewire/SDL_pipewire.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -22,7 +22,7 @@ #include "../../SDL_internal.h" #include "SDL_hints.h" -#if SDL_AUDIO_DRIVER_PIPEWIRE +#ifdef SDL_AUDIO_DRIVER_PIPEWIRE #include "SDL_audio.h" #include "SDL_loadso.h" @@ -129,7 +129,7 @@ static void *pipewire_handle = NULL; static int pipewire_dlsym(const char *fn, void **addr) { *addr = SDL_LoadFunction(pipewire_handle, fn); - if (*addr == NULL) { + if (!*addr) { /* Don't call SDL_SetError(): SDL_LoadFunction already did. */ return 0; } @@ -142,13 +142,13 @@ static int pipewire_dlsym(const char *fn, void **addr) return -1; \ } -static int load_pipewire_library() +static int load_pipewire_library(void) { pipewire_handle = SDL_LoadObject(pipewire_library); - return pipewire_handle != NULL ? 0 : -1; + return pipewire_handle ? 0 : -1; } -static void unload_pipewire_library() +static void unload_pipewire_library(void) { if (pipewire_handle) { SDL_UnloadObject(pipewire_handle); @@ -160,18 +160,18 @@ static void unload_pipewire_library() #define SDL_PIPEWIRE_SYM(x) PIPEWIRE_##x = x -static int load_pipewire_library() +static int load_pipewire_library(void) { return 0; } -static void unload_pipewire_library() +static void unload_pipewire_library(void) { /* Nothing to do */ } #endif /* SDL_AUDIO_DRIVER_PIPEWIRE_DYNAMIC */ -static int load_pipewire_syms() +static int load_pipewire_syms(void) { SDL_PIPEWIRE_SYM(pw_get_library_version); SDL_PIPEWIRE_SYM(pw_init); @@ -212,7 +212,7 @@ SDL_FORCE_INLINE SDL_bool pipewire_version_at_least(int major, int minor, int pa (pipewire_version_major > major || pipewire_version_minor > minor || pipewire_version_patch >= patch); } -static int init_pipewire_library() +static int init_pipewire_library(void) { if (!load_pipewire_library()) { if (!load_pipewire_syms()) { @@ -234,7 +234,7 @@ static int init_pipewire_library() return -1; } -static void deinit_pipewire_library() +static void deinit_pipewire_library(void) { PIPEWIRE_pw_deinit(); unload_pipewire_library(); @@ -340,17 +340,17 @@ static void io_list_remove(Uint32 id) } } -static void io_list_sort() +static void io_list_sort(void) { struct io_node *default_sink = NULL, *default_source = NULL; struct io_node *n, *temp; /* Find and move the default nodes to the beginning of the list */ spa_list_for_each_safe (n, temp, &hotplug_io_list, link) { - if (pipewire_default_sink_id != NULL && SDL_strcmp(n->path, pipewire_default_sink_id) == 0) { + if (pipewire_default_sink_id && SDL_strcmp(n->path, pipewire_default_sink_id) == 0) { default_sink = n; spa_list_remove(&n->link); - } else if (pipewire_default_source_id != NULL && SDL_strcmp(n->path, pipewire_default_source_id) == 0) { + } else if (pipewire_default_source_id && SDL_strcmp(n->path, pipewire_default_source_id) == 0) { default_source = n; spa_list_remove(&n->link); } @@ -365,7 +365,7 @@ static void io_list_sort() } } -static void io_list_clear() +static void io_list_clear(void) { struct io_node *n, *temp; @@ -399,7 +399,7 @@ static struct io_node *io_list_get_by_path(char *path) static void node_object_destroy(struct node_object *node) { - SDL_assert(node); + SDL_assert(node != NULL); spa_list_remove(&node->link); spa_hook_remove(&node->node_listener); @@ -411,7 +411,7 @@ static void node_object_destroy(struct node_object *node) /* The pending node list */ static void pending_list_add(struct node_object *node) { - SDL_assert(node); + SDL_assert(node != NULL); spa_list_append(&hotplug_pending_list, &node->link); } @@ -426,7 +426,7 @@ static void pending_list_remove(Uint32 id) } } -static void pending_list_clear() +static void pending_list_clear(void) { struct node_object *node, *temp; @@ -442,7 +442,7 @@ static void *node_object_new(Uint32 id, const char *type, Uint32 version, const /* Create the proxy object */ proxy = pw_registry_bind(hotplug_registry, id, type, version, sizeof(struct node_object)); - if (proxy == NULL) { + if (!proxy) { SDL_SetError("Pipewire: Failed to create proxy object (%i)", errno); return NULL; } @@ -648,15 +648,15 @@ static int metadata_property(void *object, Uint32 subject, const char *key, cons { struct node_object *node = object; - if (subject == PW_ID_CORE && key != NULL && value != NULL) { + if (subject == PW_ID_CORE && key && value) { if (!SDL_strcmp(key, "default.audio.sink")) { - if (pipewire_default_sink_id != NULL) { + if (pipewire_default_sink_id) { SDL_free(pipewire_default_sink_id); } pipewire_default_sink_id = get_name_from_json(value); node->persist = SDL_TRUE; } else if (!SDL_strcmp(key, "default.audio.source")) { - if (pipewire_default_source_id != NULL) { + if (pipewire_default_source_id) { SDL_free(pipewire_default_source_id); } pipewire_default_source_id = get_name_from_json(value); @@ -701,7 +701,7 @@ static void registry_event_global_callback(void *object, uint32_t id, uint32_t p if (node_desc && node_path) { node = node_object_new(id, type, version, &interface_node_events, &interface_core_events); - if (node == NULL) { + if (!node) { SDL_SetError("Pipewire: Failed to allocate interface node"); return; } @@ -710,7 +710,7 @@ static void registry_event_global_callback(void *object, uint32_t id, uint32_t p desc_buffer_len = SDL_strlen(node_desc) + 1; path_buffer_len = SDL_strlen(node_path) + 1; node->userdata = io = SDL_calloc(1, sizeof(struct io_node) + desc_buffer_len + path_buffer_len); - if (io == NULL) { + if (!io) { node_object_destroy(node); SDL_OutOfMemory(); return; @@ -731,7 +731,7 @@ static void registry_event_global_callback(void *object, uint32_t id, uint32_t p } } else if (!SDL_strcmp(type, PW_TYPE_INTERFACE_Metadata)) { node = node_object_new(id, type, version, &metadata_node_events, &metadata_core_events); - if (node == NULL) { + if (!node) { SDL_SetError("Pipewire: Failed to allocate metadata node"); return; } @@ -751,7 +751,7 @@ static const struct pw_registry_events registry_events = { PW_VERSION_REGISTRY_E .global_remove = registry_event_remove_callback }; /* The hotplug thread */ -static int hotplug_loop_init() +static int hotplug_loop_init(void) { int res; @@ -759,22 +759,22 @@ static int hotplug_loop_init() spa_list_init(&hotplug_io_list); hotplug_loop = PIPEWIRE_pw_thread_loop_new("SDLAudioHotplug", NULL); - if (hotplug_loop == NULL) { + if (!hotplug_loop) { return SDL_SetError("Pipewire: Failed to create hotplug detection loop (%i)", errno); } hotplug_context = PIPEWIRE_pw_context_new(PIPEWIRE_pw_thread_loop_get_loop(hotplug_loop), NULL, 0); - if (hotplug_context == NULL) { + if (!hotplug_context) { return SDL_SetError("Pipewire: Failed to create hotplug detection context (%i)", errno); } hotplug_core = PIPEWIRE_pw_context_connect(hotplug_context, NULL, 0); - if (hotplug_core == NULL) { + if (!hotplug_core) { return SDL_SetError("Pipewire: Failed to connect hotplug detection context (%i)", errno); } hotplug_registry = pw_core_get_registry(hotplug_core, PW_VERSION_REGISTRY, 0); - if (hotplug_registry == NULL) { + if (!hotplug_registry) { return SDL_SetError("Pipewire: Failed to acquire hotplug detection registry (%i)", errno); } @@ -794,7 +794,7 @@ static int hotplug_loop_init() return 0; } -static void hotplug_loop_destroy() +static void hotplug_loop_destroy(void) { if (hotplug_loop) { PIPEWIRE_pw_thread_loop_stop(hotplug_loop); @@ -806,11 +806,11 @@ static void hotplug_loop_destroy() hotplug_init_complete = SDL_FALSE; hotplug_events_enabled = SDL_FALSE; - if (pipewire_default_sink_id != NULL) { + if (pipewire_default_sink_id) { SDL_free(pipewire_default_sink_id); pipewire_default_sink_id = NULL; } - if (pipewire_default_source_id != NULL) { + if (pipewire_default_source_id) { SDL_free(pipewire_default_source_id); pipewire_default_source_id = NULL; } @@ -836,7 +836,7 @@ static void hotplug_loop_destroy() } } -static void PIPEWIRE_DetectDevices() +static void PIPEWIRE_DetectDevices(void) { struct io_node *io; @@ -961,7 +961,7 @@ static void output_callback(void *data) /* See if a buffer is available */ pw_buf = PIPEWIRE_pw_stream_dequeue_buffer(stream); - if (pw_buf == NULL) { + if (!pw_buf) { return; } @@ -1025,13 +1025,13 @@ static void input_callback(void *data) } pw_buf = PIPEWIRE_pw_stream_dequeue_buffer(stream); - if (pw_buf == NULL) { + if (!pw_buf) { return; } spa_buf = pw_buf->buffer; (src = (Uint8 *)spa_buf->datas[0].data); - if (src == NULL) { + if (!src) { return; } @@ -1079,7 +1079,7 @@ static void stream_add_buffer_callback(void *data, struct pw_buffer *buffer) this->spec.samples = buffer->buffer->datas[0].maxsize / this->hidden->stride; this->spec.size = buffer->buffer->datas[0].maxsize; } - } else if (this->hidden->buffer == NULL) { + } else if (!this->hidden->buffer) { /* * The latency of source nodes can change, so buffering is always required. * @@ -1137,7 +1137,7 @@ static int PIPEWIRE_OpenDevice(_THIS, const char *devname) struct SDL_PrivateAudioData *priv; struct pw_properties *props; const char *app_name, *stream_name, *stream_role, *error; - Uint32 node_id = this->handle == NULL ? PW_ID_ANY : PW_HANDLE_TO_ID(this->handle); + Uint32 node_id = !this->handle ? PW_ID_ANY : PW_HANDLE_TO_ID(this->handle); SDL_bool iscapture = this->iscapture; int res; @@ -1146,15 +1146,15 @@ static int PIPEWIRE_OpenDevice(_THIS, const char *devname) /* Get the hints for the application name, stream name and role */ app_name = SDL_GetHint(SDL_HINT_AUDIO_DEVICE_APP_NAME); - if (app_name == NULL || *app_name == '\0') { + if (!app_name || *app_name == '\0') { app_name = SDL_GetHint(SDL_HINT_APP_NAME); - if (app_name == NULL || *app_name == '\0') { + if (!app_name || *app_name == '\0') { app_name = "SDL Application"; } } stream_name = SDL_GetHint(SDL_HINT_AUDIO_DEVICE_STREAM_NAME); - if (stream_name == NULL || *stream_name == '\0') { + if (!stream_name || *stream_name == '\0') { stream_name = "Audio Stream"; } @@ -1163,20 +1163,20 @@ static int PIPEWIRE_OpenDevice(_THIS, const char *devname) * but 'Game' seems more appropriate for the majority of SDL applications. */ stream_role = SDL_GetHint(SDL_HINT_AUDIO_DEVICE_STREAM_ROLE); - if (stream_role == NULL || *stream_role == '\0') { + if (!stream_role || *stream_role == '\0') { stream_role = "Game"; } /* Initialize the Pipewire stream info from the SDL audio spec */ initialize_spa_info(&this->spec, &spa_info); params = spa_format_audio_raw_build(&b, SPA_PARAM_EnumFormat, &spa_info); - if (params == NULL) { + if (!params) { return SDL_SetError("Pipewire: Failed to set audio format parameters"); } priv = SDL_calloc(1, sizeof(struct SDL_PrivateAudioData)); this->hidden = priv; - if (priv == NULL) { + if (!priv) { return SDL_OutOfMemory(); } @@ -1190,23 +1190,23 @@ static int PIPEWIRE_OpenDevice(_THIS, const char *devname) (void)SDL_snprintf(thread_name, sizeof(thread_name), "SDLAudio%c%ld", (iscapture) ? 'C' : 'P', (long)this->handle); priv->loop = PIPEWIRE_pw_thread_loop_new(thread_name, NULL); - if (priv->loop == NULL) { + if (!priv->loop) { return SDL_SetError("Pipewire: Failed to create stream loop (%i)", errno); } /* Load the realtime module so Pipewire can set the loop thread to the appropriate priority. */ props = PIPEWIRE_pw_properties_new(PW_KEY_CONFIG_NAME, "client-rt.conf", NULL); - if (props == NULL) { + if (!props) { return SDL_SetError("Pipewire: Failed to create stream context properties (%i)", errno); } priv->context = PIPEWIRE_pw_context_new(PIPEWIRE_pw_thread_loop_get_loop(priv->loop), props, 0); - if (priv->context == NULL) { + if (!priv->context) { return SDL_SetError("Pipewire: Failed to create stream context (%i)", errno); } props = PIPEWIRE_pw_properties_new(NULL, NULL); - if (props == NULL) { + if (!props) { return SDL_SetError("Pipewire: Failed to create stream properties (%i)", errno); } @@ -1232,7 +1232,7 @@ static int PIPEWIRE_OpenDevice(_THIS, const char *devname) PIPEWIRE_pw_thread_loop_lock(hotplug_loop); node = io_list_get_by_id(node_id); - if (node != NULL) { + if (node) { PIPEWIRE_pw_properties_set(props, PW_KEY_TARGET_OBJECT, node->path); } PIPEWIRE_pw_thread_loop_unlock(hotplug_loop); @@ -1244,7 +1244,7 @@ static int PIPEWIRE_OpenDevice(_THIS, const char *devname) /* Create the new stream */ priv->stream = PIPEWIRE_pw_stream_new_simple(PIPEWIRE_pw_thread_loop_get_loop(priv->loop), stream_name, props, iscapture ? &stream_input_events : &stream_output_events, this); - if (priv->stream == NULL) { + if (!priv->stream) { return SDL_SetError("Pipewire: Failed to create stream (%i)", errno); } @@ -1272,7 +1272,7 @@ static int PIPEWIRE_OpenDevice(_THIS, const char *devname) } /* If this is a capture stream, make sure the intermediate buffer was successfully allocated. */ - if (iscapture && priv->buffer == NULL) { + if (iscapture && !priv->buffer) { return SDL_SetError("Pipewire: Failed to allocate source buffer"); } @@ -1313,13 +1313,13 @@ static int PIPEWIRE_GetDefaultAudioInfo(char **name, SDL_AudioSpec *spec, int is PIPEWIRE_pw_thread_loop_lock(hotplug_loop); if (iscapture) { - if (pipewire_default_source_id == NULL) { + if (!pipewire_default_source_id) { ret = SDL_SetError("PipeWire could not find a default source"); goto failed; } target = pipewire_default_source_id; } else { - if (pipewire_default_sink_id == NULL) { + if (!pipewire_default_sink_id) { ret = SDL_SetError("PipeWire could not find a default sink"); goto failed; } @@ -1327,12 +1327,12 @@ static int PIPEWIRE_GetDefaultAudioInfo(char **name, SDL_AudioSpec *spec, int is } node = io_list_get_by_path(target); - if (node == NULL) { + if (!node) { ret = SDL_SetError("PipeWire device list is out of sync with defaults"); goto failed; } - if (name != NULL) { + if (name) { *name = SDL_strdup(node->name); } SDL_copyp(spec, &node->spec); @@ -1342,7 +1342,7 @@ static int PIPEWIRE_GetDefaultAudioInfo(char **name, SDL_AudioSpec *spec, int is return ret; } -static void PIPEWIRE_Deinitialize() +static void PIPEWIRE_Deinitialize(void) { if (pipewire_initialized) { hotplug_loop_destroy(); diff --git a/thirdparty/SDL/src/audio/pipewire/SDL_pipewire.h b/thirdparty/SDL/src/audio/pipewire/SDL_pipewire.h index 0f706a2be..cf5817b1a 100644 --- a/thirdparty/SDL/src/audio/pipewire/SDL_pipewire.h +++ b/thirdparty/SDL/src/audio/pipewire/SDL_pipewire.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/audio/ps2/SDL_ps2audio.c b/thirdparty/SDL/src/audio/ps2/SDL_ps2audio.c index ffbf6c5cf..da5c5d328 100644 --- a/thirdparty/SDL/src/audio/ps2/SDL_ps2audio.c +++ b/thirdparty/SDL/src/audio/ps2/SDL_ps2audio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -42,7 +42,7 @@ static int PS2AUDIO_OpenDevice(_THIS, const char *devname) this->hidden = (struct SDL_PrivateAudioData *) SDL_malloc(sizeof(*this->hidden)); - if (this->hidden == NULL) { + if (!this->hidden) { return SDL_OutOfMemory(); } SDL_zerop(this->hidden); @@ -90,7 +90,7 @@ static int PS2AUDIO_OpenDevice(_THIS, const char *devname) 64, so spec->size should be a multiple of 64 as well. */ mixlen = this->spec.size * NUM_BUFFERS; this->hidden->rawbuf = (Uint8 *)memalign(64, mixlen); - if (this->hidden->rawbuf == NULL) { + if (!this->hidden->rawbuf) { return SDL_SetError("Couldn't allocate mixing buffer"); } @@ -129,7 +129,7 @@ static void PS2AUDIO_CloseDevice(_THIS) this->hidden->channel = -1; } - if (this->hidden->rawbuf != NULL) { + if (this->hidden->rawbuf) { free(this->hidden->rawbuf); this->hidden->rawbuf = NULL; } diff --git a/thirdparty/SDL/src/audio/ps2/SDL_ps2audio.h b/thirdparty/SDL/src/audio/ps2/SDL_ps2audio.h index 0f0223cbc..5f5989dc6 100644 --- a/thirdparty/SDL/src/audio/ps2/SDL_ps2audio.h +++ b/thirdparty/SDL/src/audio/ps2/SDL_ps2audio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/audio/psp/SDL_pspaudio.c b/thirdparty/SDL/src/audio/psp/SDL_pspaudio.c index 3b0156489..30e1c234f 100644 --- a/thirdparty/SDL/src/audio/psp/SDL_pspaudio.c +++ b/thirdparty/SDL/src/audio/psp/SDL_pspaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_AUDIO_DRIVER_PSP +#ifdef SDL_AUDIO_DRIVER_PSP #include #include @@ -52,7 +52,7 @@ static int PSPAUDIO_OpenDevice(_THIS, const char *devname) this->hidden = (struct SDL_PrivateAudioData *) SDL_malloc(sizeof(*this->hidden)); - if (this->hidden == NULL) { + if (!this->hidden) { return SDL_OutOfMemory(); } SDL_zerop(this->hidden); @@ -108,7 +108,7 @@ static int PSPAUDIO_OpenDevice(_THIS, const char *devname) 64, so spec->size should be a multiple of 64 as well. */ mixlen = this->spec.size * NUM_BUFFERS; this->hidden->rawbuf = (Uint8 *)memalign(64, mixlen); - if (this->hidden->rawbuf == NULL) { + if (!this->hidden->rawbuf) { return SDL_SetError("Couldn't allocate mixing buffer"); } @@ -156,7 +156,7 @@ static void PSPAUDIO_CloseDevice(_THIS) this->hidden->channel = -1; } - if (this->hidden->rawbuf != NULL) { + if (this->hidden->rawbuf) { free(this->hidden->rawbuf); this->hidden->rawbuf = NULL; } diff --git a/thirdparty/SDL/src/audio/psp/SDL_pspaudio.h b/thirdparty/SDL/src/audio/psp/SDL_pspaudio.h index 943e9a38b..ba351025d 100644 --- a/thirdparty/SDL/src/audio/psp/SDL_pspaudio.h +++ b/thirdparty/SDL/src/audio/psp/SDL_pspaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/audio/pulseaudio/SDL_pulseaudio.c b/thirdparty/SDL/src/audio/pulseaudio/SDL_pulseaudio.c index 27c6e755e..5039d0547 100644 --- a/thirdparty/SDL/src/audio/pulseaudio/SDL_pulseaudio.c +++ b/thirdparty/SDL/src/audio/pulseaudio/SDL_pulseaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,16 +19,10 @@ 3. This notice may not be removed or altered from any source distribution. */ -/* - The PulseAudio target for SDL 1.3 is based on the 1.3 arts target, with - the appropriate parts replaced with the 1.2 PulseAudio target code. This - was the cleanest way to move it to 1.3. The 1.2 target was written by - Stéphan Kochen: stephan .a.t. kochen.nl -*/ #include "../../SDL_internal.h" #include "SDL_hints.h" -#if SDL_AUDIO_DRIVER_PULSEAUDIO +#ifdef SDL_AUDIO_DRIVER_PULSEAUDIO /* Allow access to a raw mixing buffer */ @@ -37,7 +31,6 @@ #endif #include #include -#include #include "SDL_timer.h" #include "SDL_audio.h" @@ -49,29 +42,34 @@ /* should we include monitors in the device list? Set at SDL_Init time */ static SDL_bool include_monitors = SDL_FALSE; -#if (PA_API_VERSION < 12) -/** Return non-zero if the passed state is one of the connected states */ -static SDL_INLINE int PA_CONTEXT_IS_GOOD(pa_context_state_t x) -{ - return x == PA_CONTEXT_CONNECTING || x == PA_CONTEXT_AUTHORIZING || x == PA_CONTEXT_SETTING_NAME || x == PA_CONTEXT_READY; -} -/** Return non-zero if the passed state is one of the connected states */ -static SDL_INLINE int PA_STREAM_IS_GOOD(pa_stream_state_t x) -{ - return x == PA_STREAM_CREATING || x == PA_STREAM_READY; -} -#endif /* pulseaudio <= 0.9.10 */ +static pa_threaded_mainloop *pulseaudio_threaded_mainloop = NULL; +static pa_context *pulseaudio_context = NULL; +static SDL_Thread *pulseaudio_hotplug_thread = NULL; +static SDL_atomic_t pulseaudio_hotplug_thread_active; + +/* These are the OS identifiers (i.e. ALSA strings)... */ +static char *default_sink_path = NULL; +static char *default_source_path = NULL; +/* ... and these are the descriptions we use in GetDefaultAudioInfo. */ +static char *default_sink_name = NULL; +static char *default_source_name = NULL; + static const char *(*PULSEAUDIO_pa_get_library_version)(void); static pa_channel_map *(*PULSEAUDIO_pa_channel_map_init_auto)( pa_channel_map *, unsigned, pa_channel_map_def_t); static const char *(*PULSEAUDIO_pa_strerror)(int); -static pa_mainloop *(*PULSEAUDIO_pa_mainloop_new)(void); -static pa_mainloop_api *(*PULSEAUDIO_pa_mainloop_get_api)(pa_mainloop *); -static int (*PULSEAUDIO_pa_mainloop_iterate)(pa_mainloop *, int, int *); -static int (*PULSEAUDIO_pa_mainloop_run)(pa_mainloop *, int *); -static void (*PULSEAUDIO_pa_mainloop_quit)(pa_mainloop *, int); -static void (*PULSEAUDIO_pa_mainloop_free)(pa_mainloop *); + +static pa_threaded_mainloop *(*PULSEAUDIO_pa_threaded_mainloop_new)(void); +static void (*PULSEAUDIO_pa_threaded_mainloop_set_name)(pa_threaded_mainloop *, const char *); +static pa_mainloop_api *(*PULSEAUDIO_pa_threaded_mainloop_get_api)(pa_threaded_mainloop *); +static int (*PULSEAUDIO_pa_threaded_mainloop_start)(pa_threaded_mainloop *); +static void (*PULSEAUDIO_pa_threaded_mainloop_stop)(pa_threaded_mainloop *); +static void (*PULSEAUDIO_pa_threaded_mainloop_lock)(pa_threaded_mainloop *); +static void (*PULSEAUDIO_pa_threaded_mainloop_unlock)(pa_threaded_mainloop *); +static void (*PULSEAUDIO_pa_threaded_mainloop_wait)(pa_threaded_mainloop *); +static void (*PULSEAUDIO_pa_threaded_mainloop_signal)(pa_threaded_mainloop *, int); +static void (*PULSEAUDIO_pa_threaded_mainloop_free)(pa_threaded_mainloop *); static pa_operation_state_t (*PULSEAUDIO_pa_operation_get_state)( const pa_operation *); @@ -80,6 +78,7 @@ static void (*PULSEAUDIO_pa_operation_unref)(pa_operation *); static pa_context *(*PULSEAUDIO_pa_context_new)(pa_mainloop_api *, const char *); +static void (*PULSEAUDIO_pa_context_set_state_callback)(pa_context *, pa_context_notify_cb_t, void *); static int (*PULSEAUDIO_pa_context_connect)(pa_context *, const char *, pa_context_flags_t, const pa_spawn_api *); static pa_operation *(*PULSEAUDIO_pa_context_get_sink_info_list)(pa_context *, pa_sink_info_cb_t, void *); @@ -94,6 +93,7 @@ static void (*PULSEAUDIO_pa_context_unref)(pa_context *); static pa_stream *(*PULSEAUDIO_pa_stream_new)(pa_context *, const char *, const pa_sample_spec *, const pa_channel_map *); +static void (*PULSEAUDIO_pa_stream_set_state_callback)(pa_stream *, pa_stream_notify_cb_t, void *); static int (*PULSEAUDIO_pa_stream_connect_playback)(pa_stream *, const char *, const pa_buffer_attr *, pa_stream_flags_t, const pa_cvolume *, pa_stream *); static int (*PULSEAUDIO_pa_stream_connect_record)(pa_stream *, const char *, @@ -112,6 +112,7 @@ static pa_operation *(*PULSEAUDIO_pa_stream_flush)(pa_stream *, static int (*PULSEAUDIO_pa_stream_disconnect)(pa_stream *); static void (*PULSEAUDIO_pa_stream_unref)(pa_stream *); static void (*PULSEAUDIO_pa_stream_set_write_callback)(pa_stream *, pa_stream_request_cb_t, void *); +static void (*PULSEAUDIO_pa_stream_set_read_callback)(pa_stream *, pa_stream_request_cb_t, void *); static pa_operation *(*PULSEAUDIO_pa_context_get_server_info)(pa_context *, pa_server_info_cb_t, void *); static int load_pulseaudio_syms(void); @@ -124,7 +125,7 @@ static void *pulseaudio_handle = NULL; static int load_pulseaudio_sym(const char *fn, void **addr) { *addr = SDL_LoadFunction(pulseaudio_handle, fn); - if (*addr == NULL) { + if (!*addr) { /* Don't call SDL_SetError(): SDL_LoadFunction already did. */ return 0; } @@ -139,7 +140,7 @@ static int load_pulseaudio_sym(const char *fn, void **addr) static void UnloadPulseAudioLibrary(void) { - if (pulseaudio_handle != NULL) { + if (pulseaudio_handle) { SDL_UnloadObject(pulseaudio_handle); pulseaudio_handle = NULL; } @@ -148,9 +149,9 @@ static void UnloadPulseAudioLibrary(void) static int LoadPulseAudioLibrary(void) { int retval = 0; - if (pulseaudio_handle == NULL) { + if (!pulseaudio_handle) { pulseaudio_handle = SDL_LoadObject(pulseaudio_library); - if (pulseaudio_handle == NULL) { + if (!pulseaudio_handle) { retval = -1; /* Don't call SDL_SetError(): SDL_LoadObject already did. */ } else { @@ -182,16 +183,20 @@ static int LoadPulseAudioLibrary(void) static int load_pulseaudio_syms(void) { SDL_PULSEAUDIO_SYM(pa_get_library_version); - SDL_PULSEAUDIO_SYM(pa_mainloop_new); - SDL_PULSEAUDIO_SYM(pa_mainloop_get_api); - SDL_PULSEAUDIO_SYM(pa_mainloop_iterate); - SDL_PULSEAUDIO_SYM(pa_mainloop_run); - SDL_PULSEAUDIO_SYM(pa_mainloop_quit); - SDL_PULSEAUDIO_SYM(pa_mainloop_free); + SDL_PULSEAUDIO_SYM(pa_threaded_mainloop_new); + SDL_PULSEAUDIO_SYM(pa_threaded_mainloop_get_api); + SDL_PULSEAUDIO_SYM(pa_threaded_mainloop_start); + SDL_PULSEAUDIO_SYM(pa_threaded_mainloop_stop); + SDL_PULSEAUDIO_SYM(pa_threaded_mainloop_lock); + SDL_PULSEAUDIO_SYM(pa_threaded_mainloop_unlock); + SDL_PULSEAUDIO_SYM(pa_threaded_mainloop_wait); + SDL_PULSEAUDIO_SYM(pa_threaded_mainloop_signal); + SDL_PULSEAUDIO_SYM(pa_threaded_mainloop_free); SDL_PULSEAUDIO_SYM(pa_operation_get_state); SDL_PULSEAUDIO_SYM(pa_operation_cancel); SDL_PULSEAUDIO_SYM(pa_operation_unref); SDL_PULSEAUDIO_SYM(pa_context_new); + SDL_PULSEAUDIO_SYM(pa_context_set_state_callback); SDL_PULSEAUDIO_SYM(pa_context_connect); SDL_PULSEAUDIO_SYM(pa_context_get_sink_info_list); SDL_PULSEAUDIO_SYM(pa_context_get_source_info_list); @@ -203,6 +208,7 @@ static int load_pulseaudio_syms(void) SDL_PULSEAUDIO_SYM(pa_context_disconnect); SDL_PULSEAUDIO_SYM(pa_context_unref); SDL_PULSEAUDIO_SYM(pa_stream_new); + SDL_PULSEAUDIO_SYM(pa_stream_set_state_callback); SDL_PULSEAUDIO_SYM(pa_stream_connect_playback); SDL_PULSEAUDIO_SYM(pa_stream_connect_record); SDL_PULSEAUDIO_SYM(pa_stream_get_state); @@ -218,7 +224,18 @@ static int load_pulseaudio_syms(void) SDL_PULSEAUDIO_SYM(pa_channel_map_init_auto); SDL_PULSEAUDIO_SYM(pa_strerror); SDL_PULSEAUDIO_SYM(pa_stream_set_write_callback); + SDL_PULSEAUDIO_SYM(pa_stream_set_read_callback); SDL_PULSEAUDIO_SYM(pa_context_get_server_info); + + /* optional */ +#ifdef SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC + load_pulseaudio_sym("pa_threaded_mainloop_set_name", (void **)(char *)&PULSEAUDIO_pa_threaded_mainloop_set_name); +#elif (PA_PROTOCOL_VERSION >= 29) + PULSEAUDIO_pa_threaded_mainloop_set_name = pa_threaded_mainloop_set_name; +#else + PULSEAUDIO_pa_threaded_mainloop_set_name = NULL; +#endif + return 0; } @@ -240,7 +257,7 @@ static const char *getAppName(void) } else { const char *verstr = PULSEAUDIO_pa_get_library_version(); retval = "SDL Application"; /* the "oh well" default. */ - if (verstr != NULL) { + if (verstr) { int maj, min, patch; if (SDL_sscanf(verstr, "%d.%d.%d", &maj, &min, &patch) == 3) { if (squashVersion(maj, min, patch) >= squashVersion(0, 9, 15)) { @@ -252,87 +269,103 @@ static const char *getAppName(void) return retval; } -static void WaitForPulseOperation(pa_mainloop *mainloop, pa_operation *o) +/* This function assume you are holding `mainloop`'s lock and that `o` has a callback that will signal pulseaudio_threaded_mainloop. + The caller may optionally call pa_threaded_mainloop_accept() if the signal is blocking. The operation is + unref'd in here, assuming you did the work in the callback and just want to know it's done, though. */ +static void WaitForPulseOperation(pa_operation *o) { /* This checks for NO errors currently. Either fix that, check results elsewhere, or do things you don't care about. */ - if (mainloop && o) { - SDL_bool okay = SDL_TRUE; - while (okay && (PULSEAUDIO_pa_operation_get_state(o) == PA_OPERATION_RUNNING)) { - okay = (PULSEAUDIO_pa_mainloop_iterate(mainloop, 1, NULL) >= 0); + SDL_assert(pulseaudio_threaded_mainloop != NULL); + if (o) { + while (PULSEAUDIO_pa_operation_get_state(o) == PA_OPERATION_RUNNING) { + PULSEAUDIO_pa_threaded_mainloop_wait(pulseaudio_threaded_mainloop); /* this releases the lock and blocks on an internal condition variable. */ } PULSEAUDIO_pa_operation_unref(o); } } -static void DisconnectFromPulseServer(pa_mainloop *mainloop, pa_context *context) +static void DisconnectFromPulseServer(void) { - if (context) { - PULSEAUDIO_pa_context_disconnect(context); - PULSEAUDIO_pa_context_unref(context); + if (pulseaudio_threaded_mainloop) { + PULSEAUDIO_pa_threaded_mainloop_stop(pulseaudio_threaded_mainloop); + } + if (pulseaudio_context) { + PULSEAUDIO_pa_context_disconnect(pulseaudio_context); + PULSEAUDIO_pa_context_unref(pulseaudio_context); + pulseaudio_context = NULL; } - if (mainloop != NULL) { - PULSEAUDIO_pa_mainloop_free(mainloop); + if (pulseaudio_threaded_mainloop) { + PULSEAUDIO_pa_threaded_mainloop_free(pulseaudio_threaded_mainloop); + pulseaudio_threaded_mainloop = NULL; } } -static int ConnectToPulseServer_Internal(pa_mainloop **_mainloop, pa_context **_context) +static void PulseContextStateChangeCallback(pa_context *context, void *userdata) +{ + PULSEAUDIO_pa_threaded_mainloop_signal(pulseaudio_threaded_mainloop, 0); /* just signal any waiting code, it can look up the details. */ +} + +static int ConnectToPulseServer(void) { - pa_mainloop *mainloop = NULL; - pa_context *context = NULL; pa_mainloop_api *mainloop_api = NULL; int state = 0; - *_mainloop = NULL; - *_context = NULL; + SDL_assert(pulseaudio_threaded_mainloop == NULL); + SDL_assert(pulseaudio_context == NULL); /* Set up a new main loop */ - if (!(mainloop = PULSEAUDIO_pa_mainloop_new())) { - return SDL_SetError("pa_mainloop_new() failed"); + if (!(pulseaudio_threaded_mainloop = PULSEAUDIO_pa_threaded_mainloop_new())) { + return SDL_SetError("pa_threaded_mainloop_new() failed"); } - mainloop_api = PULSEAUDIO_pa_mainloop_get_api(mainloop); - SDL_assert(mainloop_api); /* this never fails, right? */ + if (PULSEAUDIO_pa_threaded_mainloop_set_name) { + PULSEAUDIO_pa_threaded_mainloop_set_name(pulseaudio_threaded_mainloop, "PulseMainloop"); + } - context = PULSEAUDIO_pa_context_new(mainloop_api, getAppName()); - if (context == NULL) { - PULSEAUDIO_pa_mainloop_free(mainloop); - return SDL_SetError("pa_context_new() failed"); + if (PULSEAUDIO_pa_threaded_mainloop_start(pulseaudio_threaded_mainloop) < 0) { + PULSEAUDIO_pa_threaded_mainloop_free(pulseaudio_threaded_mainloop); + pulseaudio_threaded_mainloop = NULL; + return SDL_SetError("pa_threaded_mainloop_start() failed"); } + PULSEAUDIO_pa_threaded_mainloop_lock(pulseaudio_threaded_mainloop); + + mainloop_api = PULSEAUDIO_pa_threaded_mainloop_get_api(pulseaudio_threaded_mainloop); + SDL_assert(mainloop_api != NULL); /* this never fails, right? */ + + pulseaudio_context = PULSEAUDIO_pa_context_new(mainloop_api, getAppName()); + if (!pulseaudio_context) { + SDL_SetError("pa_context_new() failed"); + goto failed; + } + + PULSEAUDIO_pa_context_set_state_callback(pulseaudio_context, PulseContextStateChangeCallback, NULL); + /* Connect to the PulseAudio server */ - if (PULSEAUDIO_pa_context_connect(context, NULL, 0, NULL) < 0) { - PULSEAUDIO_pa_context_unref(context); - PULSEAUDIO_pa_mainloop_free(mainloop); - return SDL_SetError("Could not setup connection to PulseAudio"); + if (PULSEAUDIO_pa_context_connect(pulseaudio_context, NULL, 0, NULL) < 0) { + SDL_SetError("Could not setup connection to PulseAudio"); + goto failed; } - do { - if (PULSEAUDIO_pa_mainloop_iterate(mainloop, 1, NULL) < 0) { - PULSEAUDIO_pa_context_unref(context); - PULSEAUDIO_pa_mainloop_free(mainloop); - return SDL_SetError("pa_mainloop_iterate() failed"); - } - state = PULSEAUDIO_pa_context_get_state(context); - if (!PA_CONTEXT_IS_GOOD(state)) { - PULSEAUDIO_pa_context_unref(context); - PULSEAUDIO_pa_mainloop_free(mainloop); - return SDL_SetError("Could not connect to PulseAudio"); - } - } while (state != PA_CONTEXT_READY); + state = PULSEAUDIO_pa_context_get_state(pulseaudio_context); + while (PA_CONTEXT_IS_GOOD(state) && (state != PA_CONTEXT_READY)) { + PULSEAUDIO_pa_threaded_mainloop_wait(pulseaudio_threaded_mainloop); + state = PULSEAUDIO_pa_context_get_state(pulseaudio_context); + } + + if (state != PA_CONTEXT_READY) { + return SDL_SetError("Could not connect to PulseAudio"); + goto failed; + } - *_context = context; - *_mainloop = mainloop; + PULSEAUDIO_pa_threaded_mainloop_unlock(pulseaudio_threaded_mainloop); return 0; /* connected and ready! */ -} -static int ConnectToPulseServer(pa_mainloop **_mainloop, pa_context **_context) -{ - const int retval = ConnectToPulseServer_Internal(_mainloop, _context); - if (retval < 0) { - DisconnectFromPulseServer(*_mainloop, *_context); - } - return retval; +failed: + PULSEAUDIO_pa_threaded_mainloop_unlock(pulseaudio_threaded_mainloop); + DisconnectFromPulseServer(); + return -1; } /* This function waits until it is possible to write a full sound buffer */ @@ -346,6 +379,7 @@ static void WriteCallback(pa_stream *p, size_t nbytes, void *userdata) struct SDL_PrivateAudioData *h = (struct SDL_PrivateAudioData *)userdata; /*printf("PULSEAUDIO WRITE CALLBACK! nbytes=%u\n", (unsigned int) nbytes);*/ h->bytes_requested += nbytes; + PULSEAUDIO_pa_threaded_mainloop_signal(pulseaudio_threaded_mainloop, 0); } static void PULSEAUDIO_PlayDevice(_THIS) @@ -357,12 +391,14 @@ static void PULSEAUDIO_PlayDevice(_THIS) /*printf("PULSEAUDIO PLAYDEVICE START! mixlen=%d\n", available);*/ + PULSEAUDIO_pa_threaded_mainloop_lock(pulseaudio_threaded_mainloop); + while (SDL_AtomicGet(&this->enabled) && (available > 0)) { cpy = SDL_min(h->bytes_requested, available); if (cpy) { if (PULSEAUDIO_pa_stream_write(h->stream, h->mixbuf + written, cpy, NULL, 0LL, PA_SEEK_RELATIVE) < 0) { SDL_OpenedAudioDeviceDisconnected(this); - return; + break; } /*printf("PULSEAUDIO FEED! nbytes=%u\n", (unsigned int) cpy);*/ h->bytes_requested -= cpy; @@ -370,16 +406,21 @@ static void PULSEAUDIO_PlayDevice(_THIS) available -= cpy; } - /* let WriteCallback fire if necessary. */ - /*printf("PULSEAUDIO ITERATE!\n");*/ - if (PULSEAUDIO_pa_context_get_state(h->context) != PA_CONTEXT_READY || - PULSEAUDIO_pa_stream_get_state(h->stream) != PA_STREAM_READY || - PULSEAUDIO_pa_mainloop_iterate(h->mainloop, 1, NULL) < 0) { - SDL_OpenedAudioDeviceDisconnected(this); - return; + if (available > 0) { + /* let WriteCallback fire if necessary. */ + /*printf("PULSEAUDIO WAIT IN PLAYDEVICE!\n");*/ + PULSEAUDIO_pa_threaded_mainloop_wait(pulseaudio_threaded_mainloop); + + if ((PULSEAUDIO_pa_context_get_state(pulseaudio_context) != PA_CONTEXT_READY) || (PULSEAUDIO_pa_stream_get_state(h->stream) != PA_STREAM_READY)) { + /*printf("PULSEAUDIO DEVICE FAILURE IN PLAYDEVICE!\n");*/ + SDL_OpenedAudioDeviceDisconnected(this); + break; + } } } + PULSEAUDIO_pa_threaded_mainloop_unlock(pulseaudio_threaded_mainloop); + /*printf("PULSEAUDIO PLAYDEVICE END! written=%d\n", written);*/ } @@ -388,14 +429,23 @@ static Uint8 *PULSEAUDIO_GetDeviceBuf(_THIS) return this->hidden->mixbuf; } +static void ReadCallback(pa_stream *p, size_t nbytes, void *userdata) +{ + /*printf("PULSEAUDIO READ CALLBACK! nbytes=%u\n", (unsigned int) nbytes);*/ + PULSEAUDIO_pa_threaded_mainloop_signal(pulseaudio_threaded_mainloop, 0); /* the capture code queries what it needs, we just need to signal to end any wait */ +} + static int PULSEAUDIO_CaptureFromDevice(_THIS, void *buffer, int buflen) { struct SDL_PrivateAudioData *h = this->hidden; const void *data = NULL; size_t nbytes = 0; + int retval = 0; + + PULSEAUDIO_pa_threaded_mainloop_lock(pulseaudio_threaded_mainloop); while (SDL_AtomicGet(&this->enabled)) { - if (h->capturebuf != NULL) { + if (h->capturebuf) { const int cpy = SDL_min(buflen, h->capturelen); SDL_memcpy(buffer, h->capturebuf, cpy); /*printf("PULSEAUDIO: fed %d captured bytes\n", cpy);*/ @@ -405,25 +455,30 @@ static int PULSEAUDIO_CaptureFromDevice(_THIS, void *buffer, int buflen) h->capturebuf = NULL; PULSEAUDIO_pa_stream_drop(h->stream); /* done with this fragment. */ } - return cpy; /* new data, return it. */ + retval = cpy; /* new data, return it. */ + break; } - if (PULSEAUDIO_pa_context_get_state(h->context) != PA_CONTEXT_READY || - PULSEAUDIO_pa_stream_get_state(h->stream) != PA_STREAM_READY || - PULSEAUDIO_pa_mainloop_iterate(h->mainloop, 1, NULL) < 0) { - SDL_OpenedAudioDeviceDisconnected(this); - return -1; /* uhoh, pulse failed! */ + while (SDL_AtomicGet(&this->enabled) && (PULSEAUDIO_pa_stream_readable_size(h->stream) == 0)) { + PULSEAUDIO_pa_threaded_mainloop_wait(pulseaudio_threaded_mainloop); + if ((PULSEAUDIO_pa_context_get_state(pulseaudio_context) != PA_CONTEXT_READY) || (PULSEAUDIO_pa_stream_get_state(h->stream) != PA_STREAM_READY)) { + /*printf("PULSEAUDIO DEVICE FAILURE IN CAPTUREFROMDEVICE!\n");*/ + SDL_OpenedAudioDeviceDisconnected(this); + retval = -1; + break; + } } - if (PULSEAUDIO_pa_stream_readable_size(h->stream) == 0) { - continue; /* no data available yet. */ + if ((retval == -1) || !SDL_AtomicGet(&this->enabled)) { /* in case this happened while we were blocking. */ + retval = -1; + break; } /* a new fragment is available! */ PULSEAUDIO_pa_stream_peek(h->stream, &data, &nbytes); SDL_assert(nbytes > 0); /* If data == NULL, then the buffer had a hole, ignore that */ - if (data == NULL) { + if (!data) { PULSEAUDIO_pa_stream_drop(h->stream); /* drop this fragment. */ } else { /* store this fragment's data, start feeding it to SDL. */ @@ -433,7 +488,9 @@ static int PULSEAUDIO_CaptureFromDevice(_THIS, void *buffer, int buflen) } } - return -1; /* not enabled? */ + PULSEAUDIO_pa_threaded_mainloop_unlock(pulseaudio_threaded_mainloop); + + return retval; } static void PULSEAUDIO_FlushCapture(_THIS) @@ -442,41 +499,46 @@ static void PULSEAUDIO_FlushCapture(_THIS) const void *data = NULL; size_t nbytes = 0; - if (h->capturebuf != NULL) { + PULSEAUDIO_pa_threaded_mainloop_lock(pulseaudio_threaded_mainloop); + + if (h->capturebuf) { PULSEAUDIO_pa_stream_drop(h->stream); h->capturebuf = NULL; h->capturelen = 0; } - while (SDL_AtomicGet(&this->enabled)) { - if (PULSEAUDIO_pa_context_get_state(h->context) != PA_CONTEXT_READY || - PULSEAUDIO_pa_stream_get_state(h->stream) != PA_STREAM_READY || - PULSEAUDIO_pa_mainloop_iterate(h->mainloop, 1, NULL) < 0) { + while (SDL_AtomicGet(&this->enabled) && (PULSEAUDIO_pa_stream_readable_size(h->stream) > 0)) { + PULSEAUDIO_pa_threaded_mainloop_wait(pulseaudio_threaded_mainloop); + if ((PULSEAUDIO_pa_context_get_state(pulseaudio_context) != PA_CONTEXT_READY) || (PULSEAUDIO_pa_stream_get_state(h->stream) != PA_STREAM_READY)) { + /*printf("PULSEAUDIO DEVICE FAILURE IN FLUSHCAPTURE!\n");*/ SDL_OpenedAudioDeviceDisconnected(this); - return; /* uhoh, pulse failed! */ + break; } - if (PULSEAUDIO_pa_stream_readable_size(h->stream) == 0) { - break; /* no data available, so we're done. */ + if (PULSEAUDIO_pa_stream_readable_size(h->stream) > 0) { + /* a new fragment is available! Just dump it. */ + PULSEAUDIO_pa_stream_peek(h->stream, &data, &nbytes); + PULSEAUDIO_pa_stream_drop(h->stream); /* drop this fragment. */ } - - /* a new fragment is available! Just dump it. */ - PULSEAUDIO_pa_stream_peek(h->stream, &data, &nbytes); - PULSEAUDIO_pa_stream_drop(h->stream); /* drop this fragment. */ } + + PULSEAUDIO_pa_threaded_mainloop_unlock(pulseaudio_threaded_mainloop); } static void PULSEAUDIO_CloseDevice(_THIS) { + PULSEAUDIO_pa_threaded_mainloop_lock(pulseaudio_threaded_mainloop); + if (this->hidden->stream) { - if (this->hidden->capturebuf != NULL) { + if (this->hidden->capturebuf) { PULSEAUDIO_pa_stream_drop(this->hidden->stream); } PULSEAUDIO_pa_stream_disconnect(this->hidden->stream); PULSEAUDIO_pa_stream_unref(this->hidden->stream); } - DisconnectFromPulseServer(this->hidden->mainloop, this->hidden->context); + PULSEAUDIO_pa_threaded_mainloop_unlock(pulseaudio_threaded_mainloop); + SDL_free(this->hidden->mixbuf); SDL_free(this->hidden->device_name); SDL_free(this->hidden); @@ -488,6 +550,7 @@ static void SinkDeviceNameCallback(pa_context *c, const pa_sink_info *i, int is_ char **devname = (char **)data; *devname = SDL_strdup(i->name); } + PULSEAUDIO_pa_threaded_mainloop_signal(pulseaudio_threaded_mainloop, 0); } static void SourceDeviceNameCallback(pa_context *c, const pa_source_info *i, int is_last, void *data) @@ -496,29 +559,31 @@ static void SourceDeviceNameCallback(pa_context *c, const pa_source_info *i, int char **devname = (char **)data; *devname = SDL_strdup(i->name); } + PULSEAUDIO_pa_threaded_mainloop_signal(pulseaudio_threaded_mainloop, 0); } static SDL_bool FindDeviceName(struct SDL_PrivateAudioData *h, const SDL_bool iscapture, void *handle) { const uint32_t idx = ((uint32_t)((intptr_t)handle)) - 1; - if (handle == NULL) { /* NULL == default device. */ + if (!handle) { /* NULL == default device. */ return SDL_TRUE; } if (iscapture) { - WaitForPulseOperation(h->mainloop, - PULSEAUDIO_pa_context_get_source_info_by_index(h->context, idx, - SourceDeviceNameCallback, &h->device_name)); + WaitForPulseOperation(PULSEAUDIO_pa_context_get_source_info_by_index(pulseaudio_context, idx, SourceDeviceNameCallback, &h->device_name)); } else { - WaitForPulseOperation(h->mainloop, - PULSEAUDIO_pa_context_get_sink_info_by_index(h->context, idx, - SinkDeviceNameCallback, &h->device_name)); + WaitForPulseOperation(PULSEAUDIO_pa_context_get_sink_info_by_index(pulseaudio_context, idx, SinkDeviceNameCallback, &h->device_name)); } return h->device_name != NULL; } +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. */ +} + static int PULSEAUDIO_OpenDevice(_THIS, const char *devname) { struct SDL_PrivateAudioData *h = NULL; @@ -527,14 +592,16 @@ static int PULSEAUDIO_OpenDevice(_THIS, const char *devname) pa_buffer_attr paattr; pa_channel_map pacmap; pa_stream_flags_t flags = 0; - const char *name = NULL; SDL_bool iscapture = this->iscapture; - int state = 0, format = PA_SAMPLE_INVALID; - int rc = 0; + int format = PA_SAMPLE_INVALID; + int retval = 0; + + SDL_assert(pulseaudio_threaded_mainloop != NULL); + SDL_assert(pulseaudio_context != NULL); /* Initialize all variables that we clean on shutdown */ h = this->hidden = (struct SDL_PrivateAudioData *)SDL_malloc(sizeof(*this->hidden)); - if (this->hidden == NULL) { + if (!this->hidden) { return SDL_OutOfMemory(); } SDL_zerop(this->hidden); @@ -572,7 +639,7 @@ static int PULSEAUDIO_OpenDevice(_THIS, const char *devname) break; } if (!test_format) { - return SDL_SetError("%s: Unsupported audio format", "pulseaudio"); + return SDL_SetError("pulseaudio: Unsupported audio format"); } this->spec.format = test_format; paspec.format = format; @@ -584,7 +651,7 @@ static int PULSEAUDIO_OpenDevice(_THIS, const char *devname) if (!iscapture) { h->mixlen = this->spec.size; h->mixbuf = (Uint8 *)SDL_malloc(h->mixlen); - if (h->mixbuf == NULL) { + if (!h->mixbuf) { return SDL_OutOfMemory(); } SDL_memset(h->mixbuf, this->spec.silence, this->spec.size); @@ -601,73 +668,66 @@ static int PULSEAUDIO_OpenDevice(_THIS, const char *devname) paattr.minreq = -1; flags |= PA_STREAM_ADJUST_LATENCY; - if (ConnectToPulseServer(&h->mainloop, &h->context) < 0) { - return SDL_SetError("Could not connect to PulseAudio server"); - } + PULSEAUDIO_pa_threaded_mainloop_lock(pulseaudio_threaded_mainloop); if (!FindDeviceName(h, iscapture, this->handle)) { - return SDL_SetError("Requested PulseAudio sink/source missing?"); - } - - /* The SDL ALSA output hints us that we use Windows' channel mapping */ - /* http://bugzilla.libsdl.org/show_bug.cgi?id=110 */ - PULSEAUDIO_pa_channel_map_init_auto(&pacmap, this->spec.channels, - PA_CHANNEL_MAP_WAVEEX); - - name = SDL_GetHint(SDL_HINT_AUDIO_DEVICE_STREAM_NAME); + retval = SDL_SetError("Requested PulseAudio sink/source missing?"); + } else { + 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, this->spec.channels, + PA_CHANNEL_MAP_WAVEEX); + + h->stream = PULSEAUDIO_pa_stream_new( + pulseaudio_context, + (name && *name) ? name : "Audio Stream", /* stream description */ + &paspec, /* sample format spec */ + &pacmap /* channel map */ + ); + + if (!h->stream) { + retval = SDL_SetError("Could not set up PulseAudio stream"); + } else { + int rc; - h->stream = PULSEAUDIO_pa_stream_new( - h->context, - (name && *name) ? name : "Audio Stream", /* stream description */ - &paspec, /* sample format spec */ - &pacmap /* channel map */ - ); + PULSEAUDIO_pa_stream_set_state_callback(h->stream, PulseStreamStateChangeCallback, NULL); + /* now that we have multi-device support, don't move a stream from + a device that was unplugged to something else, unless we're default. */ + if (h->device_name) { + flags |= PA_STREAM_DONT_MOVE; + } - if (h->stream == NULL) { - return SDL_SetError("Could not set up PulseAudio stream"); - } + if (iscapture) { + PULSEAUDIO_pa_stream_set_read_callback(h->stream, ReadCallback, h); + rc = PULSEAUDIO_pa_stream_connect_record(h->stream, h->device_name, &paattr, flags); + } else { + PULSEAUDIO_pa_stream_set_write_callback(h->stream, WriteCallback, h); + rc = PULSEAUDIO_pa_stream_connect_playback(h->stream, h->device_name, &paattr, flags, NULL, NULL); + } - /* now that we have multi-device support, don't move a stream from - a device that was unplugged to something else, unless we're default. */ - if (h->device_name != NULL) { - flags |= PA_STREAM_DONT_MOVE; - } + if (rc < 0) { + retval = SDL_SetError("Could not connect PulseAudio stream"); + } else { + int state = PULSEAUDIO_pa_stream_get_state(h->stream); + while (PA_STREAM_IS_GOOD(state) && (state != PA_STREAM_READY)) { + PULSEAUDIO_pa_threaded_mainloop_wait(pulseaudio_threaded_mainloop); + state = PULSEAUDIO_pa_stream_get_state(h->stream); + } - if (iscapture) { - rc = PULSEAUDIO_pa_stream_connect_record(h->stream, h->device_name, &paattr, flags); - } else { - PULSEAUDIO_pa_stream_set_write_callback(h->stream, WriteCallback, h); - rc = PULSEAUDIO_pa_stream_connect_playback(h->stream, h->device_name, &paattr, flags, NULL, NULL); + if (!PA_STREAM_IS_GOOD(state)) { + retval = SDL_SetError("Could not connect PulseAudio stream"); + } + } + } } - if (rc < 0) { - return SDL_SetError("Could not connect PulseAudio stream"); - } + PULSEAUDIO_pa_threaded_mainloop_unlock(pulseaudio_threaded_mainloop); - do { - if (PULSEAUDIO_pa_mainloop_iterate(h->mainloop, 1, NULL) < 0) { - return SDL_SetError("pa_mainloop_iterate() failed"); - } - state = PULSEAUDIO_pa_stream_get_state(h->stream); - if (!PA_STREAM_IS_GOOD(state)) { - return SDL_SetError("Could not connect PulseAudio stream"); - } - } while (state != PA_STREAM_READY); - - /* We're ready to rock and roll. :-) */ - return 0; + /* We're (hopefully) ready to rock and roll. :-) */ + return retval; } -static pa_mainloop *hotplug_mainloop = NULL; -static pa_context *hotplug_context = NULL; -static SDL_Thread *hotplug_thread = NULL; - -/* These are the OS identifiers (i.e. ALSA strings)... */ -static char *default_sink_path = NULL; -static char *default_source_path = NULL; -/* ... and these are the descriptions we use in GetDefaultAudioInfo. */ -static char *default_sink_name = NULL; -static char *default_source_name = NULL; /* device handles are device index + 1, cast to void*, so we never pass a NULL. */ @@ -712,13 +772,14 @@ static void SinkInfoCallback(pa_context *c, const pa_sink_info *i, int is_last, SDL_AddAudioDevice(SDL_FALSE, i->description, &spec, (void *)((intptr_t)i->index + 1)); } - if (default_sink_path != NULL && SDL_strcmp(i->name, default_sink_path) == 0) { - if (default_sink_name != NULL) { + if (default_sink_path && SDL_strcmp(i->name, default_sink_path) == 0) { + if (default_sink_name) { SDL_free(default_sink_name); } default_sink_name = SDL_strdup(i->description); } } + PULSEAUDIO_pa_threaded_mainloop_signal(pulseaudio_threaded_mainloop, 0); } /* This is called when PulseAudio adds a capture ("source") device. */ @@ -742,26 +803,24 @@ static void SourceInfoCallback(pa_context *c, const pa_source_info *i, int is_la SDL_AddAudioDevice(SDL_TRUE, i->description, &spec, (void *)((intptr_t)i->index + 1)); } - if (default_source_path != NULL && SDL_strcmp(i->name, default_source_path) == 0) { - if (default_source_name != NULL) { + if (default_source_path && SDL_strcmp(i->name, default_source_path) == 0) { + if (default_source_name) { SDL_free(default_source_name); } default_source_name = SDL_strdup(i->description); } } } + PULSEAUDIO_pa_threaded_mainloop_signal(pulseaudio_threaded_mainloop, 0); } static void ServerInfoCallback(pa_context *c, const pa_server_info *i, void *data) { - if (default_sink_path != NULL) { - SDL_free(default_sink_path); - } - if (default_source_path != NULL) { - SDL_free(default_source_path); - } + SDL_free(default_sink_path); + SDL_free(default_source_path); default_sink_path = SDL_strdup(i->default_sink_name); default_source_path = SDL_strdup(i->default_source_name); + PULSEAUDIO_pa_threaded_mainloop_signal(pulseaudio_threaded_mainloop, 0); } /* This is called when PulseAudio has a device connected/removed/changed. */ @@ -776,43 +835,71 @@ static void HotplugCallback(pa_context *c, pa_subscription_event_type_t t, uint3 const SDL_bool source = ((t & PA_SUBSCRIPTION_EVENT_FACILITY_MASK) == PA_SUBSCRIPTION_EVENT_SOURCE); /* adds need sink details from the PulseAudio server. Another callback... */ + /* (just unref all these operations right away, because we aren't going to wait on them and their callbacks will handle any work, so they can free as soon as that happens.) */ if ((added || changed) && sink) { if (changed) { - PULSEAUDIO_pa_context_get_server_info(hotplug_context, ServerInfoCallback, NULL); + PULSEAUDIO_pa_operation_unref(PULSEAUDIO_pa_context_get_server_info(pulseaudio_context, ServerInfoCallback, NULL)); } - PULSEAUDIO_pa_context_get_sink_info_by_index(hotplug_context, idx, SinkInfoCallback, (void *)((intptr_t)added)); + PULSEAUDIO_pa_operation_unref(PULSEAUDIO_pa_context_get_sink_info_by_index(pulseaudio_context, idx, SinkInfoCallback, (void *)((intptr_t)added))); } else if ((added || changed) && source) { if (changed) { - PULSEAUDIO_pa_context_get_server_info(hotplug_context, ServerInfoCallback, NULL); + PULSEAUDIO_pa_operation_unref(PULSEAUDIO_pa_context_get_server_info(pulseaudio_context, ServerInfoCallback, NULL)); } - PULSEAUDIO_pa_context_get_source_info_by_index(hotplug_context, idx, SourceInfoCallback, (void *)((intptr_t)added)); + PULSEAUDIO_pa_operation_unref(PULSEAUDIO_pa_context_get_source_info_by_index(pulseaudio_context, idx, SourceInfoCallback, (void *)((intptr_t)added))); } else if (removed && (sink || source)) { /* removes we can handle just with the device index. */ SDL_RemoveAudioDevice(source != 0, (void *)((intptr_t)idx + 1)); } } + PULSEAUDIO_pa_threaded_mainloop_signal(pulseaudio_threaded_mainloop, 0); } /* this runs as a thread while the Pulse target is initialized to catch hotplug events. */ static int SDLCALL HotplugThread(void *data) { - pa_operation *o; + pa_operation *op; + SDL_SetThreadPriority(SDL_THREAD_PRIORITY_LOW); - PULSEAUDIO_pa_context_set_subscribe_callback(hotplug_context, HotplugCallback, NULL); - o = PULSEAUDIO_pa_context_subscribe(hotplug_context, PA_SUBSCRIPTION_MASK_SINK | PA_SUBSCRIPTION_MASK_SOURCE, NULL, NULL); - PULSEAUDIO_pa_operation_unref(o); /* don't wait for it, just do our thing. */ - PULSEAUDIO_pa_mainloop_run(hotplug_mainloop, NULL); + PULSEAUDIO_pa_threaded_mainloop_lock(pulseaudio_threaded_mainloop); + PULSEAUDIO_pa_context_set_subscribe_callback(pulseaudio_context, HotplugCallback, NULL); + + /* don't WaitForPulseOperation on the subscription; when it's done we'll be able to get hotplug events, but waiting doesn't changing anything. */ + op = PULSEAUDIO_pa_context_subscribe(pulseaudio_context, PA_SUBSCRIPTION_MASK_SINK | PA_SUBSCRIPTION_MASK_SOURCE, NULL, NULL); + + SDL_SemPost(data); + + while (SDL_AtomicGet(&pulseaudio_hotplug_thread_active)) { + PULSEAUDIO_pa_threaded_mainloop_wait(pulseaudio_threaded_mainloop); + if (op && PULSEAUDIO_pa_operation_get_state(op) != PA_OPERATION_RUNNING) { + PULSEAUDIO_pa_operation_unref(op); + op = NULL; + } + } + + if (op) { + PULSEAUDIO_pa_operation_unref(op); + } + + PULSEAUDIO_pa_context_set_subscribe_callback(pulseaudio_context, NULL, NULL); + PULSEAUDIO_pa_threaded_mainloop_unlock(pulseaudio_threaded_mainloop); return 0; } -static void PULSEAUDIO_DetectDevices() +static void PULSEAUDIO_DetectDevices(void) { - WaitForPulseOperation(hotplug_mainloop, PULSEAUDIO_pa_context_get_server_info(hotplug_context, ServerInfoCallback, NULL)); - WaitForPulseOperation(hotplug_mainloop, PULSEAUDIO_pa_context_get_sink_info_list(hotplug_context, SinkInfoCallback, (void *)((intptr_t)SDL_TRUE))); - WaitForPulseOperation(hotplug_mainloop, PULSEAUDIO_pa_context_get_source_info_list(hotplug_context, SourceInfoCallback, (void *)((intptr_t)SDL_TRUE))); + SDL_sem *ready_sem = SDL_CreateSemaphore(0); + + PULSEAUDIO_pa_threaded_mainloop_lock(pulseaudio_threaded_mainloop); + WaitForPulseOperation(PULSEAUDIO_pa_context_get_server_info(pulseaudio_context, ServerInfoCallback, NULL)); + WaitForPulseOperation(PULSEAUDIO_pa_context_get_sink_info_list(pulseaudio_context, SinkInfoCallback, (void *)((intptr_t)SDL_TRUE))); + WaitForPulseOperation(PULSEAUDIO_pa_context_get_source_info_list(pulseaudio_context, SourceInfoCallback, (void *)((intptr_t)SDL_TRUE))); + PULSEAUDIO_pa_threaded_mainloop_unlock(pulseaudio_threaded_mainloop); /* ok, we have a sane list, let's set up hotplug notifications now... */ - hotplug_thread = SDL_CreateThreadInternal(HotplugThread, "PulseHotplug", 256 * 1024, NULL); + SDL_AtomicSet(&pulseaudio_hotplug_thread_active, 1); + pulseaudio_hotplug_thread = SDL_CreateThreadInternal(HotplugThread, "PulseHotplug", 256 * 1024, ready_sem); /* !!! FIXME: this can probably survive in significantly less stack space. */ + SDL_SemWait(ready_sem); + SDL_DestroySemaphore(ready_sem); } static int PULSEAUDIO_GetDefaultAudioInfo(char **name, SDL_AudioSpec *spec, int iscapture) @@ -822,12 +909,12 @@ static int PULSEAUDIO_GetDefaultAudioInfo(char **name, SDL_AudioSpec *spec, int char *target; if (iscapture) { - if (default_source_name == NULL) { + if (!default_source_name) { return SDL_SetError("PulseAudio could not find a default source"); } target = default_source_name; } else { - if (default_sink_name == NULL) { + if (!default_sink_name) { return SDL_SetError("PulseAudio could not find a default sink"); } target = default_sink_name; @@ -836,7 +923,7 @@ static int PULSEAUDIO_GetDefaultAudioInfo(char **name, SDL_AudioSpec *spec, int numdevices = SDL_GetNumAudioDevices(iscapture); for (i = 0; i < numdevices; i += 1) { if (SDL_strcmp(SDL_GetAudioDeviceName(i, iscapture), target) == 0) { - if (name != NULL) { + if (name) { *name = SDL_strdup(target); } SDL_GetAudioDeviceSpec(i, iscapture, spec); @@ -848,32 +935,25 @@ static int PULSEAUDIO_GetDefaultAudioInfo(char **name, SDL_AudioSpec *spec, int static void PULSEAUDIO_Deinitialize(void) { - if (hotplug_thread) { - PULSEAUDIO_pa_mainloop_quit(hotplug_mainloop, 0); - SDL_WaitThread(hotplug_thread, NULL); - hotplug_thread = NULL; + if (pulseaudio_hotplug_thread) { + PULSEAUDIO_pa_threaded_mainloop_lock(pulseaudio_threaded_mainloop); + SDL_AtomicSet(&pulseaudio_hotplug_thread_active, 0); + PULSEAUDIO_pa_threaded_mainloop_signal(pulseaudio_threaded_mainloop, 0); + PULSEAUDIO_pa_threaded_mainloop_unlock(pulseaudio_threaded_mainloop); + SDL_WaitThread(pulseaudio_hotplug_thread, NULL); + pulseaudio_hotplug_thread = NULL; } - DisconnectFromPulseServer(hotplug_mainloop, hotplug_context); - hotplug_mainloop = NULL; - hotplug_context = NULL; + DisconnectFromPulseServer(); - if (default_sink_path != NULL) { - SDL_free(default_sink_path); - default_sink_path = NULL; - } - if (default_source_path != NULL) { - SDL_free(default_source_path); - default_source_path = NULL; - } - if (default_sink_name != NULL) { - SDL_free(default_sink_name); - default_sink_name = NULL; - } - if (default_source_name != NULL) { - SDL_free(default_source_name); - default_source_name = NULL; - } + SDL_free(default_sink_path); + default_sink_path = NULL; + SDL_free(default_source_path); + default_source_path = NULL; + SDL_free(default_sink_name); + default_sink_name = NULL; + SDL_free(default_source_name); + default_source_name = NULL; UnloadPulseAudioLibrary(); } @@ -882,9 +962,7 @@ static SDL_bool PULSEAUDIO_Init(SDL_AudioDriverImpl *impl) { if (LoadPulseAudioLibrary() < 0) { return SDL_FALSE; - } - - if (ConnectToPulseServer(&hotplug_mainloop, &hotplug_context) < 0) { + } else if (ConnectToPulseServer() < 0) { UnloadPulseAudioLibrary(); return SDL_FALSE; } diff --git a/thirdparty/SDL/src/audio/pulseaudio/SDL_pulseaudio.h b/thirdparty/SDL/src/audio/pulseaudio/SDL_pulseaudio.h index 3b2ee3253..b4ad3822c 100644 --- a/thirdparty/SDL/src/audio/pulseaudio/SDL_pulseaudio.h +++ b/thirdparty/SDL/src/audio/pulseaudio/SDL_pulseaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -23,7 +23,7 @@ #ifndef SDL_pulseaudio_h_ #define SDL_pulseaudio_h_ -#include +#include #include "../SDL_sysaudio.h" @@ -35,8 +35,6 @@ struct SDL_PrivateAudioData char *device_name; /* pulseaudio structures */ - pa_mainloop *mainloop; - pa_context *context; pa_stream *stream; /* Raw mixing buffer */ diff --git a/thirdparty/SDL/src/audio/qsa/SDL_qsa_audio.c b/thirdparty/SDL/src/audio/qsa/SDL_qsa_audio.c index 1a80f94f0..be0532cf9 100644 --- a/thirdparty/SDL/src/audio/qsa/SDL_qsa_audio.c +++ b/thirdparty/SDL/src/audio/qsa/SDL_qsa_audio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -30,7 +30,7 @@ #include "../../SDL_internal.h" -#if SDL_AUDIO_DRIVER_QSA +#ifdef SDL_AUDIO_DRIVER_QSA #include #include @@ -232,7 +232,7 @@ static Uint8 *QSA_GetDeviceBuf(_THIS) static void QSA_CloseDevice(_THIS) { - if (this->hidden->audio_handle != NULL) { + if (this->hidden->audio_handle) { #if _NTO_VERSION < 710 if (!this->iscapture) { /* Finish playing available samples */ @@ -267,14 +267,14 @@ static int QSA_OpenDevice(_THIS, const char *devname) (sizeof (struct SDL_PrivateAudioData))); - if (this->hidden == NULL) { + if (!this->hidden) { return SDL_OutOfMemory(); } /* Initialize channel transfer parameters to default */ QSA_InitAudioParams(&cparams); - if (device != NULL) { + if (device) { /* Open requested audio device */ this->hidden->deviceno = device->deviceno; this->hidden->cardno = device->cardno; @@ -387,7 +387,7 @@ static int QSA_OpenDevice(_THIS, const char *devname) */ this->hidden->pcm_buf = (Uint8 *) SDL_malloc(this->hidden->pcm_len); - if (this->hidden->pcm_buf == NULL) { + if (!this->hidden->pcm_buf) { return SDL_OutOfMemory(); } SDL_memset(this->hidden->pcm_buf, this->spec.silence, diff --git a/thirdparty/SDL/src/audio/qsa/SDL_qsa_audio.h b/thirdparty/SDL/src/audio/qsa/SDL_qsa_audio.h index e177074b0..1e69f26c9 100644 --- a/thirdparty/SDL/src/audio/qsa/SDL_qsa_audio.h +++ b/thirdparty/SDL/src/audio/qsa/SDL_qsa_audio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/audio/sndio/SDL_sndioaudio.c b/thirdparty/SDL/src/audio/sndio/SDL_sndioaudio.c index d62d179d4..499b8478c 100644 --- a/thirdparty/SDL/src/audio/sndio/SDL_sndioaudio.c +++ b/thirdparty/SDL/src/audio/sndio/SDL_sndioaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,11 +21,11 @@ #include "../../SDL_internal.h" -#if SDL_AUDIO_DRIVER_SNDIO +#ifdef SDL_AUDIO_DRIVER_SNDIO /* OpenBSD sndio target */ -#if HAVE_STDIO_H +#ifdef HAVE_STDIO_H #include #endif @@ -73,7 +73,7 @@ static void *sndio_handle = NULL; static int load_sndio_sym(const char *fn, void **addr) { *addr = SDL_LoadFunction(sndio_handle, fn); - if (*addr == NULL) { + if (!*addr) { /* Don't call SDL_SetError(): SDL_LoadFunction already did. */ return 0; } @@ -113,7 +113,7 @@ static int load_sndio_syms(void) static void UnloadSNDIOLibrary(void) { - if (sndio_handle != NULL) { + if (sndio_handle) { SDL_UnloadObject(sndio_handle); sndio_handle = NULL; } @@ -122,9 +122,9 @@ static void UnloadSNDIOLibrary(void) static int LoadSNDIOLibrary(void) { int retval = 0; - if (sndio_handle == NULL) { + if (!sndio_handle) { sndio_handle = SDL_LoadObject(sndio_library); - if (sndio_handle == NULL) { + if (!sndio_handle) { retval = -1; /* Don't call SDL_SetError(): SDL_LoadObject already did. */ } else { @@ -211,10 +211,10 @@ static Uint8 *SNDIO_GetDeviceBuf(_THIS) static void SNDIO_CloseDevice(_THIS) { - if (this->hidden->pfd != NULL) { + if (this->hidden->pfd) { SDL_free(this->hidden->pfd); } - if (this->hidden->dev != NULL) { + if (this->hidden->dev) { SNDIO_sio_stop(this->hidden->dev); SNDIO_sio_close(this->hidden->dev); } @@ -230,7 +230,7 @@ static int SNDIO_OpenDevice(_THIS, const char *devname) this->hidden = (struct SDL_PrivateAudioData *) SDL_malloc(sizeof(*this->hidden)); - if (this->hidden == NULL) { + if (!this->hidden) { return SDL_OutOfMemory(); } SDL_zerop(this->hidden); @@ -238,16 +238,16 @@ static int SNDIO_OpenDevice(_THIS, const char *devname) this->hidden->mixlen = this->spec.size; /* Capture devices must be non-blocking for SNDIO_FlushCapture */ - this->hidden->dev = SNDIO_sio_open(devname != NULL ? devname : SIO_DEVANY, + this->hidden->dev = SNDIO_sio_open(devname ? devname : SIO_DEVANY, iscapture ? SIO_REC : SIO_PLAY, iscapture); - if (this->hidden->dev == NULL) { + if (!this->hidden->dev) { return SDL_SetError("sio_open() failed"); } /* Allocate the pollfd array for capture devices */ if (iscapture) { this->hidden->pfd = SDL_malloc(sizeof(struct pollfd) * SNDIO_sio_nfds(this->hidden->dev)); - if (this->hidden->pfd == NULL) { + if (!this->hidden->pfd) { return SDL_OutOfMemory(); } } @@ -315,7 +315,7 @@ static int SNDIO_OpenDevice(_THIS, const char *devname) /* Allocate mixing buffer */ this->hidden->mixlen = this->spec.size; this->hidden->mixbuf = (Uint8 *)SDL_malloc(this->hidden->mixlen); - if (this->hidden->mixbuf == NULL) { + if (!this->hidden->mixbuf) { return SDL_OutOfMemory(); } SDL_memset(this->hidden->mixbuf, this->spec.silence, this->hidden->mixlen); diff --git a/thirdparty/SDL/src/audio/sndio/SDL_sndioaudio.h b/thirdparty/SDL/src/audio/sndio/SDL_sndioaudio.h index d447c1693..ffd4df895 100644 --- a/thirdparty/SDL/src/audio/sndio/SDL_sndioaudio.h +++ b/thirdparty/SDL/src/audio/sndio/SDL_sndioaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/audio/sun/SDL_sunaudio.c b/thirdparty/SDL/src/audio/sun/SDL_sunaudio.c index 25deb9098..442cf2b5e 100644 --- a/thirdparty/SDL/src/audio/sun/SDL_sunaudio.c +++ b/thirdparty/SDL/src/audio/sun/SDL_sunaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_AUDIO_DRIVER_SUNAUDIO +#ifdef SDL_AUDIO_DRIVER_SUNAUDIO /* Allow access to a raw mixing buffer */ @@ -194,16 +194,16 @@ static int SUNAUDIO_OpenDevice(_THIS, const char *devname) /* We don't care what the devname is...we'll try to open anything. */ /* ...but default to first name in the list... */ - if (devname == NULL) { + if (!devname) { devname = SDL_GetAudioDeviceName(0, iscapture); - if (devname == NULL) { + if (!devname) { return SDL_SetError("No such audio device"); } } /* Initialize all variables that we clean on shutdown */ this->hidden = (struct SDL_PrivateAudioData *)SDL_malloc(sizeof(*this->hidden)); - if (this->hidden == NULL) { + if (!this->hidden) { return SDL_OutOfMemory(); } SDL_zerop(this->hidden); @@ -281,7 +281,7 @@ static int SUNAUDIO_OpenDevice(_THIS, const char *devname) break; /* try again */ case AUDIO_ENCODING_LINEAR: - /* linear 16bit didn't work either, resort to -law */ + /* linear 16bit didn't work either, resort to �-law */ enc = AUDIO_ENCODING_ULAW; this->spec.channels = 1; this->spec.freq = 8000; @@ -305,7 +305,7 @@ static int SUNAUDIO_OpenDevice(_THIS, const char *devname) (this->spec.freq / 8); this->hidden->frequency = 8; this->hidden->ulaw_buf = (Uint8 *) SDL_malloc(this->hidden->fragsize); - if (this->hidden->ulaw_buf == NULL) { + if (!this->hidden->ulaw_buf) { return SDL_OutOfMemory(); } this->spec.channels = 1; @@ -325,7 +325,7 @@ static int SUNAUDIO_OpenDevice(_THIS, const char *devname) /* Allocate mixing buffer */ this->hidden->mixbuf = (Uint8 *) SDL_malloc(this->spec.size); - if (this->hidden->mixbuf == NULL) { + if (!this->hidden->mixbuf) { return SDL_OutOfMemory(); } SDL_memset(this->hidden->mixbuf, this->spec.silence, this->spec.size); diff --git a/thirdparty/SDL/src/audio/sun/SDL_sunaudio.h b/thirdparty/SDL/src/audio/sun/SDL_sunaudio.h index 63a887d1e..095254333 100644 --- a/thirdparty/SDL/src/audio/sun/SDL_sunaudio.h +++ b/thirdparty/SDL/src/audio/sun/SDL_sunaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/audio/vita/SDL_vitaaudio.c b/thirdparty/SDL/src/audio/vita/SDL_vitaaudio.c index 058896be2..bd8732381 100644 --- a/thirdparty/SDL/src/audio/vita/SDL_vitaaudio.c +++ b/thirdparty/SDL/src/audio/vita/SDL_vitaaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_AUDIO_DRIVER_VITA +#ifdef SDL_AUDIO_DRIVER_VITA #include #include @@ -67,7 +67,7 @@ static int VITAAUD_OpenDevice(_THIS, const char *devname) this->hidden = (struct SDL_PrivateAudioData *) SDL_malloc(sizeof(*this->hidden)); - if (this->hidden == NULL) { + if (!this->hidden) { return SDL_OutOfMemory(); } SDL_memset(this->hidden, 0, sizeof(*this->hidden)); @@ -98,7 +98,7 @@ static int VITAAUD_OpenDevice(_THIS, const char *devname) 64, so spec->size should be a multiple of 64 as well. */ mixlen = this->spec.size * NUM_BUFFERS; this->hidden->rawbuf = (Uint8 *)memalign(64, mixlen); - if (this->hidden->rawbuf == NULL) { + if (!this->hidden->rawbuf) { return SDL_SetError("Couldn't allocate mixing buffer"); } @@ -162,7 +162,7 @@ static void VITAAUD_CloseDevice(_THIS) this->hidden->port = -1; } - if (!this->iscapture && this->hidden->rawbuf != NULL) { + if (!this->iscapture && this->hidden->rawbuf) { free(this->hidden->rawbuf); /* this uses memalign(), not SDL_malloc(). */ this->hidden->rawbuf = NULL; } diff --git a/thirdparty/SDL/src/audio/vita/SDL_vitaaudio.h b/thirdparty/SDL/src/audio/vita/SDL_vitaaudio.h index 52feb9bee..cb0aba8ec 100644 --- a/thirdparty/SDL/src/audio/vita/SDL_vitaaudio.h +++ b/thirdparty/SDL/src/audio/vita/SDL_vitaaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/audio/wasapi/SDL_wasapi.c b/thirdparty/SDL/src/audio/wasapi/SDL_wasapi.c index c46577664..cf90efc0f 100644 --- a/thirdparty/SDL/src/audio/wasapi/SDL_wasapi.c +++ b/thirdparty/SDL/src/audio/wasapi/SDL_wasapi.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_AUDIO_DRIVER_WASAPI +#ifdef SDL_AUDIO_DRIVER_WASAPI #include "../../core/windows/SDL_windows.h" #include "../../core/windows/SDL_immdevice.h" @@ -114,7 +114,7 @@ static int UpdateAudioStream(_THIS, const SDL_AudioSpec *oldspec) /* make sure our scratch buffer can cover the new device spec. */ if (this->spec.size > this->work_buffer_len) { Uint8 *ptr = (Uint8 *)SDL_realloc(this->work_buffer, this->spec.size); - if (ptr == NULL) { + if (!ptr) { return SDL_OutOfMemory(); } this->work_buffer = ptr; @@ -172,13 +172,18 @@ static SDL_bool RecoverWasapiIfLost(_THIS) return lost ? RecoverWasapiDevice(this) : SDL_TRUE; } +static void WASAPI_WaitDevice(_THIS); + static Uint8 *WASAPI_GetDeviceBuf(_THIS) { /* get an endpoint buffer from WASAPI. */ BYTE *buffer = NULL; while (RecoverWasapiIfLost(this) && this->hidden->render) { - if (!WasapiFailed(this, IAudioRenderClient_GetBuffer(this->hidden->render, this->spec.samples, &buffer))) { + const HRESULT ret = IAudioRenderClient_GetBuffer(this->hidden->render, this->spec.samples, &buffer); + if (ret == AUDCLNT_E_BUFFER_TOO_LARGE) { + WASAPI_WaitDevice(this); /* see if we can wait on the buffer to drain some more first... */ + } else if (!WasapiFailed(this, ret)) { return (Uint8 *)buffer; } SDL_assert(buffer == NULL); @@ -189,7 +194,7 @@ static Uint8 *WASAPI_GetDeviceBuf(_THIS) static void WASAPI_PlayDevice(_THIS) { - if (this->hidden->render != NULL) { /* definitely activated? */ + if (this->hidden->render) { /* definitely activated? */ /* WasapiFailed() will mark the device for reacquisition or removal elsewhere. */ WasapiFailed(this, IAudioRenderClient_ReleaseBuffer(this->hidden->render, this->spec.samples, 0)); } @@ -415,7 +420,7 @@ int WASAPI_PrepDevice(_THIS, const SDL_bool updatestream) this->hidden->event = CreateEventW(NULL, 0, 0, NULL); #endif - if (this->hidden->event == NULL) { + if (!this->hidden->event) { return WIN_SetError("WASAPI can't create an event handle"); } @@ -486,6 +491,11 @@ int WASAPI_PrepDevice(_THIS, const SDL_bool updatestream) this->spec.samples = (Uint16)SDL_ceilf(period_frames); } + /* regardless of what we calculated for the period size, clamp it to the expected hardware buffer size. */ + if (this->spec.samples > bufsize) { + this->spec.samples = bufsize; + } + /* Update the fragment size as size in bytes */ SDL_CalculateAudioSpec(&this->spec); @@ -537,7 +547,7 @@ static int WASAPI_OpenDevice(_THIS, const char *devname) /* Initialize all variables that we clean on shutdown */ this->hidden = (struct SDL_PrivateAudioData *) SDL_malloc(sizeof(*this->hidden)); - if (this->hidden == NULL) { + if (!this->hidden) { return SDL_OutOfMemory(); } SDL_zerop(this->hidden); diff --git a/thirdparty/SDL/src/audio/wasapi/SDL_wasapi.h b/thirdparty/SDL/src/audio/wasapi/SDL_wasapi.h index 96c206123..804e0b74e 100644 --- a/thirdparty/SDL/src/audio/wasapi/SDL_wasapi.h +++ b/thirdparty/SDL/src/audio/wasapi/SDL_wasapi.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/audio/wasapi/SDL_wasapi_win32.c b/thirdparty/SDL/src/audio/wasapi/SDL_wasapi_win32.c index 965e7ff69..88823c5ac 100644 --- a/thirdparty/SDL/src/audio/wasapi/SDL_wasapi_win32.c +++ b/thirdparty/SDL/src/audio/wasapi/SDL_wasapi_win32.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -26,7 +26,7 @@ The code in SDL_wasapi.c is used by both standard Windows and WinRT builds to deal with audio and calls into these functions. */ -#if SDL_AUDIO_DRIVER_WASAPI && !defined(__WINRT__) +#if defined(SDL_AUDIO_DRIVER_WASAPI) && !defined(__WINRT__) #include "../../core/windows/SDL_windows.h" #include "../../core/windows/SDL_immdevice.h" diff --git a/thirdparty/SDL/src/audio/wasapi/SDL_wasapi_winrt.cpp b/thirdparty/SDL/src/audio/wasapi/SDL_wasapi_winrt.cpp index 93ed3b834..26f483878 100644 --- a/thirdparty/SDL/src/audio/wasapi/SDL_wasapi_winrt.cpp +++ b/thirdparty/SDL/src/audio/wasapi/SDL_wasapi_winrt.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,7 +25,7 @@ // is in SDL_wasapi_win32.c. The code in SDL_wasapi.c is used by both standard // Windows and WinRT builds to deal with audio and calls into these functions. -#if SDL_AUDIO_DRIVER_WASAPI && defined(__WINRT__) +#if defined(SDL_AUDIO_DRIVER_WASAPI) && defined(__WINRT__) #include #include @@ -405,7 +405,7 @@ static void WASAPI_AddDevice(const SDL_bool iscapture, const char *devname, WAVE } devidlist = (DevIdList *)SDL_malloc(sizeof(*devidlist)); - if (devidlist == NULL) { + if (!devidlist) { return; /* oh well. */ } diff --git a/thirdparty/SDL/src/audio/winmm/SDL_winmm.c b/thirdparty/SDL/src/audio/winmm/SDL_winmm.c index d0c4b9768..47cb4ba7d 100644 --- a/thirdparty/SDL/src/audio/winmm/SDL_winmm.c +++ b/thirdparty/SDL/src/audio/winmm/SDL_winmm.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_AUDIO_DRIVER_WINMM +#ifdef SDL_AUDIO_DRIVER_WINMM /* Allow access to a raw mixing buffer */ @@ -279,7 +279,7 @@ static int WINMM_OpenDevice(_THIS, const char *devname) UINT devId = WAVE_MAPPER; /* WAVE_MAPPER == choose system's default */ UINT i; - if (handle != NULL) { /* specific device requested? */ + if (handle) { /* specific device requested? */ /* -1 because we increment the original value to avoid NULL. */ const size_t val = ((size_t) handle) - 1; devId = (UINT) val; @@ -287,7 +287,7 @@ static int WINMM_OpenDevice(_THIS, const char *devname) /* Initialize all variables that we clean on shutdown */ this->hidden = (struct SDL_PrivateAudioData *)SDL_malloc(sizeof(*this->hidden)); - if (this->hidden == NULL) { + if (!this->hidden) { return SDL_OutOfMemory(); } SDL_zerop(this->hidden); @@ -365,14 +365,14 @@ static int WINMM_OpenDevice(_THIS, const char *devname) /* Create the audio buffer semaphore */ this->hidden->audio_sem = CreateSemaphore(NULL, iscapture ? 0 : NUM_BUFFERS - 1, NUM_BUFFERS, NULL); - if (this->hidden->audio_sem == NULL) { + if (!this->hidden->audio_sem) { return SDL_SetError("Couldn't create semaphore"); } /* Create the sound buffers */ this->hidden->mixbuf = (Uint8 *) SDL_malloc(NUM_BUFFERS * this->spec.size); - if (this->hidden->mixbuf == NULL) { + if (!this->hidden->mixbuf) { return SDL_OutOfMemory(); } diff --git a/thirdparty/SDL/src/audio/winmm/SDL_winmm.h b/thirdparty/SDL/src/audio/winmm/SDL_winmm.h index 6e966d5c4..8d0744a2d 100644 --- a/thirdparty/SDL/src/audio/winmm/SDL_winmm.h +++ b/thirdparty/SDL/src/audio/winmm/SDL_winmm.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/core/android/SDL_android.c b/thirdparty/SDL/src/core/android/SDL_android.c index 0c8811c99..25b75f51e 100644 --- a/thirdparty/SDL/src/core/android/SDL_android.c +++ b/thirdparty/SDL/src/core/android/SDL_android.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -420,12 +420,12 @@ JNIEnv *Android_JNI_GetEnv(void) { /* Get JNIEnv from the Thread local storage */ JNIEnv *env = pthread_getspecific(mThreadKey); - if (env == NULL) { + if (!env) { /* If it fails, try to attach ! (e.g the thread isn't created with SDL_CreateThread() */ int status; /* There should be a JVM */ - if (mJavaVM == NULL) { + if (!mJavaVM) { __android_log_print(ANDROID_LOG_ERROR, "SDL", "Failed, there is no JavaVM"); return NULL; } @@ -454,7 +454,7 @@ int Android_JNI_SetupThread(void) int status; /* There should be a JVM */ - if (mJavaVM == NULL) { + if (!mJavaVM) { __android_log_print(ANDROID_LOG_ERROR, "SDL", "Failed, there is no JavaVM"); return 0; } @@ -480,7 +480,7 @@ static void Android_JNI_ThreadDestroyed(void *value) { /* The thread is being destroyed, detach it from the Java VM and set the mThreadKey value to NULL as required */ JNIEnv *env = (JNIEnv *)value; - if (env != NULL) { + if (env) { (*mJavaVM)->DetachCurrentThread(mJavaVM); Android_JNI_SetEnv(NULL); } @@ -506,7 +506,7 @@ static void Android_JNI_CreateKey_once(void) static void register_methods(JNIEnv *env, const char *classname, JNINativeMethod *methods, int nb) { jclass clazz = (*env)->FindClass(env, classname); - if (clazz == NULL || (*env)->RegisterNatives(env, clazz, methods, nb) < 0) { + if (!clazz || (*env)->RegisterNatives(env, clazz, methods, nb) < 0) { __android_log_print(ANDROID_LOG_ERROR, "SDL", "Failed to register methods of %s", classname); return; } @@ -566,28 +566,28 @@ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeSetupJNI)(JNIEnv *env, jclass cl /* Save JNIEnv of SDLActivity */ Android_JNI_SetEnv(env); - if (mJavaVM == NULL) { + if (!mJavaVM) { __android_log_print(ANDROID_LOG_ERROR, "SDL", "failed to found a JavaVM"); } /* Use a mutex to prevent concurrency issues between Java Activity and Native thread code, when using 'Android_Window'. * (Eg. Java sending Touch events, while native code is destroying the main SDL_Window. ) */ - if (Android_ActivityMutex == NULL) { + if (!Android_ActivityMutex) { Android_ActivityMutex = SDL_CreateMutex(); /* Could this be created twice if onCreate() is called a second time ? */ } - if (Android_ActivityMutex == NULL) { + if (!Android_ActivityMutex) { __android_log_print(ANDROID_LOG_ERROR, "SDL", "failed to create Android_ActivityMutex mutex"); } Android_PauseSem = SDL_CreateSemaphore(0); - if (Android_PauseSem == NULL) { + if (!Android_PauseSem) { __android_log_print(ANDROID_LOG_ERROR, "SDL", "failed to create Android_PauseSem semaphore"); } Android_ResumeSem = SDL_CreateSemaphore(0); - if (Android_ResumeSem == NULL) { + if (!Android_ResumeSem) { __android_log_print(ANDROID_LOG_ERROR, "SDL", "failed to create Android_ResumeSem semaphore"); } @@ -842,18 +842,18 @@ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeDropFile)( } /* Lock / Unlock Mutex */ -void Android_ActivityMutex_Lock() +void Android_ActivityMutex_Lock(void) { SDL_LockMutex(Android_ActivityMutex); } -void Android_ActivityMutex_Unlock() +void Android_ActivityMutex_Unlock(void) { SDL_UnlockMutex(Android_ActivityMutex); } /* Lock the Mutex when the Activity is in its 'Running' state */ -void Android_ActivityMutex_Lock_Running() +void Android_ActivityMutex_Lock_Running(void) { int pauseSignaled = 0; int resumeSignaled = 0; @@ -1056,7 +1056,7 @@ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeSurfaceChanged)(JNIEnv *env, j { SDL_LockMutex(Android_ActivityMutex); -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL if (Android_Window) { SDL_VideoDevice *_this = SDL_GetVideoDevice(); SDL_WindowData *data = (SDL_WindowData *)Android_Window->driverdata; @@ -1098,7 +1098,7 @@ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeSurfaceDestroyed)(JNIEnv *env, } } -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL if (data->egl_surface != EGL_NO_SURFACE) { SDL_EGL_DestroySurface(_this, data->egl_surface); data->egl_surface = EGL_NO_SURFACE; @@ -1439,13 +1439,13 @@ void Android_JNI_SetOrientation(int w, int h, int resizable, const char *hint) (*env)->DeleteLocalRef(env, jhint); } -void Android_JNI_MinizeWindow() +void Android_JNI_MinizeWindow(void) { JNIEnv *env = Android_JNI_GetEnv(); (*env)->CallStaticVoidMethod(env, mActivityClass, midMinimizeWindow); } -SDL_bool Android_JNI_ShouldMinimizeOnFocusLoss() +SDL_bool Android_JNI_ShouldMinimizeOnFocusLoss(void) { JNIEnv *env = Android_JNI_GetEnv(); return (*env)->CallStaticBooleanMethod(env, mActivityClass, midShouldMinimizeOnFocusLoss); @@ -1557,7 +1557,7 @@ int Android_JNI_OpenAudioDevice(int iscapture, int device_id, SDL_AudioSpec *spe __android_log_print(ANDROID_LOG_VERBOSE, "SDL", "SDL audio: opening device for output"); result = (*env)->CallStaticObjectMethod(env, mAudioManagerClass, midAudioOpen, spec->freq, audioformat, spec->channels, spec->samples, device_id); } - if (result == NULL) { + if (!result) { /* Error during audio initialization, error printed from Java */ return SDL_SetError("Java-side initialization failed"); } @@ -1618,7 +1618,7 @@ int Android_JNI_OpenAudioDevice(int iscapture, int device_id, SDL_AudioSpec *spe return SDL_SetError("Unexpected audio format from Java: %d\n", audioformat); } - if (jbufobj == NULL) { + if (!jbufobj) { __android_log_print(ANDROID_LOG_WARN, "SDL", "SDL audio: could not allocate an audio buffer"); return SDL_OutOfMemory(); } @@ -1879,7 +1879,7 @@ static SDL_bool Android_JNI_ExceptionOccurred(SDL_bool silent) return SDL_FALSE; } -static void Internal_Android_Create_AssetManager() +static void Internal_Android_Create_AssetManager(void) { struct LocalReferenceHolder refs = LocalReferenceHolder_Setup(__FUNCTION__); @@ -1910,7 +1910,7 @@ static void Internal_Android_Create_AssetManager() javaAssetManagerRef = (*env)->NewGlobalRef(env, javaAssetManager); asset_manager = AAssetManager_fromJava(env, javaAssetManagerRef); - if (asset_manager == NULL) { + if (!asset_manager) { (*env)->DeleteGlobalRef(env, javaAssetManagerRef); Android_JNI_ExceptionOccurred(SDL_TRUE); } @@ -1918,7 +1918,7 @@ static void Internal_Android_Create_AssetManager() LocalReferenceHolder_Cleanup(&refs); } -static void Internal_Android_Destroy_AssetManager() +static void Internal_Android_Destroy_AssetManager(void) { JNIEnv *env = Android_JNI_GetEnv(); @@ -1934,16 +1934,16 @@ int Android_JNI_FileOpen(SDL_RWops *ctx, AAsset *asset = NULL; ctx->hidden.androidio.asset = NULL; - if (asset_manager == NULL) { + if (!asset_manager) { Internal_Android_Create_AssetManager(); } - if (asset_manager == NULL) { + if (!asset_manager) { return SDL_SetError("Couldn't create asset manager"); } asset = AAssetManager_open(asset_manager, fileName, AASSET_MODE_UNKNOWN); - if (asset == NULL) { + if (!asset) { return SDL_SetError("Couldn't open asset '%s'", fileName); } @@ -2022,7 +2022,7 @@ char *Android_JNI_GetClipboardText(void) (*env)->DeleteLocalRef(env, string); } - return (text == NULL) ? SDL_strdup("") : text; + return (!text) ? SDL_strdup("") : text; } SDL_bool Android_JNI_HasClipboardText(void) @@ -2153,7 +2153,7 @@ int Android_JNI_GetPowerInfo(int *plugged, int *charged, int *battery, int *seco } /* Add all touch devices */ -void Android_JNI_InitTouch() +void Android_JNI_InitTouch(void) { JNIEnv *env = Android_JNI_GetEnv(); (*env)->CallStaticVoidMethod(env, mActivityClass, midInitTouch); @@ -2208,7 +2208,7 @@ void Android_JNI_SuspendScreenSaver(SDL_bool suspend) Android_JNI_SendMessage(COMMAND_SET_KEEP_SCREEN_ON, (suspend == SDL_FALSE) ? 0 : 1); } -void Android_JNI_ShowTextInput(SDL_Rect *inputRect) +void Android_JNI_ShowScreenKeyboard(SDL_Rect *inputRect) { JNIEnv *env = Android_JNI_GetEnv(); (*env)->CallStaticBooleanMethod(env, mActivityClass, midShowTextInput, @@ -2218,7 +2218,7 @@ void Android_JNI_ShowTextInput(SDL_Rect *inputRect) inputRect->h); } -void Android_JNI_HideTextInput(void) +void Android_JNI_HideScreenKeyboard(void) { /* has to match Activity constant */ const int COMMAND_TEXTEDIT_HIDE = 3; @@ -2343,7 +2343,7 @@ void *SDL_AndroidGetActivity(void) /* See SDL_system.h for caveats on using this function. */ JNIEnv *env = Android_JNI_GetEnv(); - if (env == NULL) { + if (!env) { return NULL; } @@ -2397,7 +2397,7 @@ const char *SDL_AndroidGetInternalStoragePath(void) { static char *s_AndroidInternalFilesPath = NULL; - if (s_AndroidInternalFilesPath == NULL) { + if (!s_AndroidInternalFilesPath) { struct LocalReferenceHolder refs = LocalReferenceHolder_Setup(__FUNCTION__); jmethodID mid; jobject context; @@ -2490,7 +2490,7 @@ const char *SDL_AndroidGetExternalStoragePath(void) { static char *s_AndroidExternalFilesPath = NULL; - if (s_AndroidExternalFilesPath == NULL) { + if (!s_AndroidExternalFilesPath) { struct LocalReferenceHolder refs = LocalReferenceHolder_Setup(__FUNCTION__); jmethodID mid; jobject context; @@ -2646,16 +2646,16 @@ int Android_JNI_GetLocale(char *buf, size_t buflen) /* Need to re-create the asset manager if locale has changed (SDL_LOCALECHANGED) */ Internal_Android_Destroy_AssetManager(); - if (asset_manager == NULL) { + if (!asset_manager) { Internal_Android_Create_AssetManager(); } - if (asset_manager == NULL) { + if (!asset_manager) { return -1; } cfg = AConfiguration_new(); - if (cfg == NULL) { + if (!cfg) { return -1; } diff --git a/thirdparty/SDL/src/core/android/SDL_android.h b/thirdparty/SDL/src/core/android/SDL_android.h index a54b2cf7d..20d1fc521 100644 --- a/thirdparty/SDL/src/core/android/SDL_android.h +++ b/thirdparty/SDL/src/core/android/SDL_android.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -43,8 +43,8 @@ extern void Android_JNI_MinizeWindow(void); extern SDL_bool Android_JNI_ShouldMinimizeOnFocusLoss(void); extern SDL_bool Android_JNI_GetAccelerometerValues(float values[3]); -extern void Android_JNI_ShowTextInput(SDL_Rect *inputRect); -extern void Android_JNI_HideTextInput(void); +extern void Android_JNI_ShowScreenKeyboard(SDL_Rect *inputRect); +extern void Android_JNI_HideScreenKeyboard(void); extern SDL_bool Android_JNI_IsScreenKeyboardShown(void); extern ANativeWindow *Android_JNI_GetNativeWindow(void); diff --git a/thirdparty/SDL/src/core/freebsd/SDL_evdev_kbd_freebsd.c b/thirdparty/SDL/src/core/freebsd/SDL_evdev_kbd_freebsd.c index 57a469725..1d54bab12 100644 --- a/thirdparty/SDL/src/core/freebsd/SDL_evdev_kbd_freebsd.c +++ b/thirdparty/SDL/src/core/freebsd/SDL_evdev_kbd_freebsd.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -88,7 +88,7 @@ static void kbd_cleanup(void) { struct mouse_info mData; SDL_EVDEV_keyboard_state *kbd = kbd_cleanup_state; - if (kbd == NULL) { + if (!kbd) { return; } kbd_cleanup_state = NULL; @@ -134,7 +134,7 @@ static void kbd_cleanup_signal_action(int signum, siginfo_t *info, void *ucontex SDL_EVDEV_kbd_reraise_signal(signum); } -static void kbd_unregister_emerg_cleanup() +static void kbd_unregister_emerg_cleanup(void) { int tabidx, signum; @@ -179,7 +179,7 @@ static void kbd_register_emerg_cleanup(SDL_EVDEV_keyboard_state *kbd) { int tabidx, signum; - if (kbd_cleanup_state != NULL) { + if (kbd_cleanup_state) { return; } kbd_cleanup_state = kbd; @@ -231,7 +231,7 @@ SDL_EVDEV_keyboard_state *SDL_EVDEV_kbd_init(void) SDL_zero(mData); mData.operation = MOUSE_HIDE; kbd = (SDL_EVDEV_keyboard_state *)SDL_calloc(1, sizeof(SDL_EVDEV_keyboard_state)); - if (kbd == NULL) { + if (!kbd) { return NULL; } @@ -297,7 +297,7 @@ void SDL_EVDEV_kbd_quit(SDL_EVDEV_keyboard_state *kbd) { struct mouse_info mData; - if (kbd == NULL) { + if (!kbd) { return; } SDL_zero(mData); @@ -321,6 +321,18 @@ void SDL_EVDEV_kbd_quit(SDL_EVDEV_keyboard_state *kbd) SDL_free(kbd); } +void SDL_EVDEV_kbd_set_muted(SDL_EVDEV_keyboard_state *state, SDL_bool muted) +{ +} + +void SDL_EVDEV_kbd_set_vt_switch_callbacks(SDL_EVDEV_keyboard_state *state, void (*release_callback)(void*), void *release_callback_data, void (*acquire_callback)(void*), void *acquire_callback_data) +{ +} + +void SDL_EVDEV_kbd_update(SDL_EVDEV_keyboard_state *state) +{ +} + /* * Helper Functions. */ @@ -475,7 +487,7 @@ void SDL_EVDEV_kbd_keycode(SDL_EVDEV_keyboard_state *kbd, unsigned int keycode, unsigned int final_key_state; unsigned int map_from_key_sym; - if (kbd == NULL) { + if (!kbd) { return; } diff --git a/thirdparty/SDL/src/core/gdk/SDL_gdk.cpp b/thirdparty/SDL/src/core/gdk/SDL_gdk.cpp index 61617fdcd..069956867 100644 --- a/thirdparty/SDL/src/core/gdk/SDL_gdk.cpp +++ b/thirdparty/SDL/src/core/gdk/SDL_gdk.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -36,6 +36,7 @@ extern "C" { static XTaskQueueHandle GDK_GlobalTaskQueue; PAPPSTATE_REGISTRATION hPLM = {}; +PAPPCONSTRAIN_REGISTRATION hCPLM = {}; HANDLE plmSuspendComplete = nullptr; extern "C" DECLSPEC int @@ -177,6 +178,23 @@ SDL_GDKRunApp(SDL_main_func mainFunction, void *reserved) return -1; } + /* Register constrain/unconstrain handling */ + auto raccn = [](BOOLEAN constrained, PVOID context) { + SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, "[GDK] in RegisterAppConstrainedChangeNotification handler"); + SDL_VideoDevice *_this = SDL_GetVideoDevice(); + if (_this) { + if (constrained) { + SDL_SetKeyboardFocus(NULL); + } else { + SDL_SetKeyboardFocus(_this->windows); + } + } + }; + if (RegisterAppConstrainedChangeNotification(raccn, NULL, &hCPLM)) { + SDL_SetError("[GDK] Unable to call RegisterAppConstrainedChangeNotification"); + return -1; + } + /* Run the application main() code */ result = mainFunction(argc, argv); @@ -184,6 +202,9 @@ SDL_GDKRunApp(SDL_main_func mainFunction, void *reserved) UnregisterAppStateChangeNotification(hPLM); CloseHandle(plmSuspendComplete); + /* Unregister constrain/unconstrain handling */ + UnregisterAppConstrainedChangeNotification(hCPLM); + /* !!! FIXME: This follows the docs exactly, but for some reason still leaks handles on exit? */ /* Terminate the task queue and dispatch any pending tasks */ XTaskQueueTerminate(taskQueue, false, nullptr, nullptr); @@ -218,3 +239,24 @@ SDL_GDKSuspendComplete() SetEvent(plmSuspendComplete); } } + +extern "C" DECLSPEC int +SDL_GDKGetDefaultUser(XUserHandle *outUserHandle) +{ + XAsyncBlock block = { 0 }; + HRESULT result; + + if (FAILED(result = XUserAddAsync(XUserAddOptions::AddDefaultUserAllowingUI, &block))) { + return WIN_SetErrorFromHRESULT("XUserAddAsync", result); + } + + do { + result = XUserAddResult(&block, outUserHandle); + } while (result == E_PENDING); + if (FAILED(result)) { + return WIN_SetErrorFromHRESULT("XUserAddResult", result); + } + + return 0; +} + diff --git a/thirdparty/SDL/src/core/gdk/SDL_gdk.h b/thirdparty/SDL/src/core/gdk/SDL_gdk.h index a49d0683d..75f13ab81 100644 --- a/thirdparty/SDL/src/core/gdk/SDL_gdk.h +++ b/thirdparty/SDL/src/core/gdk/SDL_gdk.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/core/linux/SDL_dbus.c b/thirdparty/SDL/src/core/linux/SDL_dbus.c index f2358343f..7d706c238 100644 --- a/thirdparty/SDL/src/core/linux/SDL_dbus.c +++ b/thirdparty/SDL/src/core/linux/SDL_dbus.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,7 +25,7 @@ #include "SDL_sandbox.h" #include "../../stdlib/SDL_vacopy.h" -#if SDL_USE_LIBDBUS +#ifdef SDL_USE_LIBDBUS /* we never link directly to libdbus. */ #include "SDL_loadso.h" static const char *dbus_library = "libdbus-1.so.3"; @@ -99,7 +99,7 @@ static int LoadDBUSSyms(void) static void UnloadDBUSLibrary(void) { - if (dbus_handle != NULL) { + if (dbus_handle) { SDL_UnloadObject(dbus_handle); dbus_handle = NULL; } @@ -108,9 +108,9 @@ static void UnloadDBUSLibrary(void) static int LoadDBUSLibrary(void) { int retval = 0; - if (dbus_handle == NULL) { + if (!dbus_handle) { dbus_handle = SDL_LoadObject(dbus_library); - if (dbus_handle == NULL) { + if (!dbus_handle) { retval = -1; /* Don't call SDL_SetError(): SDL_LoadObject already did. */ } else { @@ -186,14 +186,13 @@ void SDL_DBus_Quit(void) dbus.connection_close(dbus.session_conn); dbus.connection_unref(dbus.session_conn); } -/* Don't do this - bug 3950 - dbus_shutdown() is a debug feature which closes all global resources in the dbus library. Calling this should be done by the app, not a library, because if there are multiple users of dbus in the process then SDL could shut it down even though another part is using it. -*/ -#if 0 - if (dbus.shutdown) { - dbus.shutdown(); + + if (SDL_GetHintBoolean(SDL_HINT_SHUTDOWN_DBUS_ON_QUIT, SDL_FALSE)) { + if (dbus.shutdown) { + dbus.shutdown(); + } } -#endif + SDL_zero(dbus); UnloadDBUSLibrary(); SDL_free(inhibit_handle); @@ -202,7 +201,7 @@ void SDL_DBus_Quit(void) SDL_DBusContext *SDL_DBus_GetContext(void) { - if (dbus_handle == NULL || !dbus.session_conn) { + if (!dbus_handle || !dbus.session_conn) { SDL_DBus_Init(); } @@ -363,7 +362,7 @@ SDL_bool SDL_DBus_QueryProperty(const char *node, const char *path, const char * void SDL_DBus_ScreensaverTickle(void) { - if (screensaver_cookie == 0 && inhibit_handle == NULL) { /* no need to tickle if we're inhibiting. */ + if (screensaver_cookie == 0 && !inhibit_handle) { /* no need to tickle if we're inhibiting. */ /* org.gnome.ScreenSaver is the legacy interface, but it'll either do nothing or just be a second harmless tickle on newer systems, so we leave it for now. */ SDL_DBus_CallVoidMethod("org.gnome.ScreenSaver", "/org/gnome/ScreenSaver", "org.gnome.ScreenSaver", "SimulateUserActivity", DBUS_TYPE_INVALID); SDL_DBus_CallVoidMethod("org.freedesktop.ScreenSaver", "/org/freedesktop/ScreenSaver", "org.freedesktop.ScreenSaver", "SimulateUserActivity", DBUS_TYPE_INVALID); @@ -411,7 +410,7 @@ SDL_bool SDL_DBus_ScreensaverInhibit(SDL_bool inhibit) { const char *default_inhibit_reason = "Playing a game"; - if ((inhibit && (screensaver_cookie != 0 || inhibit_handle != NULL)) || (!inhibit && (screensaver_cookie == 0 && inhibit_handle == NULL))) { + if ((inhibit && (screensaver_cookie != 0 || inhibit_handle)) || (!inhibit && (screensaver_cookie == 0 && !inhibit_handle))) { return SDL_TRUE; } @@ -435,12 +434,12 @@ SDL_bool SDL_DBus_ScreensaverInhibit(SDL_bool inhibit) const char *key = "reason"; const char *reply = NULL; const char *reason = SDL_GetHint(SDL_HINT_SCREENSAVER_INHIBIT_ACTIVITY_NAME); - if (reason == NULL || !reason[0]) { + if (!reason || !reason[0]) { reason = default_inhibit_reason; } msg = dbus.message_new_method_call(bus_name, path, interface, "Inhibit"); - if (msg == NULL) { + if (!msg) { return SDL_FALSE; } @@ -477,10 +476,10 @@ SDL_bool SDL_DBus_ScreensaverInhibit(SDL_bool inhibit) if (inhibit) { const char *app = SDL_GetHint(SDL_HINT_APP_NAME); const char *reason = SDL_GetHint(SDL_HINT_SCREENSAVER_INHIBIT_ACTIVITY_NAME); - if (app == NULL || !app[0]) { + if (!app || !app[0]) { app = "My SDL application"; } - if (reason == NULL || !reason[0]) { + if (!reason || !reason[0]) { reason = default_inhibit_reason; } @@ -534,6 +533,71 @@ char *SDL_DBus_GetLocalMachineId(void) return NULL; } + +/* + * Convert file drops with mime type "application/vnd.portal.filetransfer" to file paths + * Result must be freed with dbus->free_string_array(). + * https://flatpak.github.io/xdg-desktop-portal/#gdbus-method-org-freedesktop-portal-FileTransfer.RetrieveFiles + */ +char **SDL_DBus_DocumentsPortalRetrieveFiles(const char *key, int *path_count) +{ + DBusError err; + DBusMessageIter iter, iterDict; + char **paths = NULL; + DBusMessage *reply = NULL; + DBusMessage *msg = dbus.message_new_method_call("org.freedesktop.portal.Documents", /* Node */ + "/org/freedesktop/portal/documents", /* Path */ + "org.freedesktop.portal.FileTransfer", /* Interface */ + "RetrieveFiles"); /* Method */ + + /* Make sure we have a connection to the dbus session bus */ + if (!SDL_DBus_GetContext() || !dbus.session_conn) { + /* We either cannot connect to the session bus or were unable to + * load the D-Bus library at all. */ + return NULL; + } + + dbus.error_init(&err); + + /* First argument is a "application/vnd.portal.filetransfer" key from a DnD or clipboard event */ + if (!dbus.message_append_args(msg, DBUS_TYPE_STRING, &key, DBUS_TYPE_INVALID)) { + SDL_OutOfMemory(); + dbus.message_unref(msg); + goto failed; + } + + /* Second argument is a variant dictionary for options. + * The spec doesn't define any entries yet so it's empty. */ + dbus.message_iter_init_append(msg, &iter); + if (!dbus.message_iter_open_container(&iter, DBUS_TYPE_ARRAY, "{sv}", &iterDict) || + !dbus.message_iter_close_container(&iter, &iterDict)) { + SDL_OutOfMemory(); + dbus.message_unref(msg); + goto failed; + } + + reply = dbus.connection_send_with_reply_and_block(dbus.session_conn, msg, DBUS_TIMEOUT_USE_DEFAULT, &err); + dbus.message_unref(msg); + + if (reply) { + dbus.message_get_args(reply, &err, DBUS_TYPE_ARRAY, DBUS_TYPE_STRING, &paths, path_count, DBUS_TYPE_INVALID); + dbus.message_unref(reply); + } + + if (paths) { + return paths; + } + +failed: + if (dbus.error_is_set(&err)) { + SDL_SetError("%s: %s", err.name, err.message); + dbus.error_free(&err); + } else { + SDL_SetError("Error retrieving paths for documents portal \"%s\"", key); + } + + return NULL; +} #endif /* vi: set ts=4 sw=4 expandtab: */ diff --git a/thirdparty/SDL/src/core/linux/SDL_dbus.h b/thirdparty/SDL/src/core/linux/SDL_dbus.h index cda279eca..572ea47f9 100644 --- a/thirdparty/SDL/src/core/linux/SDL_dbus.h +++ b/thirdparty/SDL/src/core/linux/SDL_dbus.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -29,6 +29,10 @@ #include "SDL_stdinc.h" #include +#ifndef DBUS_TIMEOUT_USE_DEFAULT +#define DBUS_TIMEOUT_USE_DEFAULT -1 +#endif + typedef struct SDL_DBusContext { DBusConnection *session_conn; @@ -98,6 +102,8 @@ extern SDL_bool SDL_DBus_ScreensaverInhibit(SDL_bool inhibit); extern char *SDL_DBus_GetLocalMachineId(void); +extern char **SDL_DBus_DocumentsPortalRetrieveFiles(const char *key, int *files_count); + #endif /* HAVE_DBUS_DBUS_H */ #endif /* SDL_dbus_h_ */ diff --git a/thirdparty/SDL/src/core/linux/SDL_evdev.c b/thirdparty/SDL/src/core/linux/SDL_evdev.c index e997aae49..e3b836cf7 100644 --- a/thirdparty/SDL/src/core/linux/SDL_evdev.c +++ b/thirdparty/SDL/src/core/linux/SDL_evdev.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -66,6 +66,7 @@ typedef struct SDL_evdevlist_item { char *path; int fd; + int udev_class; /* TODO: use this for every device, not just touchscreen */ SDL_bool out_of_sync; @@ -105,6 +106,8 @@ typedef struct SDL_evdevlist_item SDL_bool relative_mouse; int mouse_x, mouse_y; int mouse_wheel, mouse_hwheel; + int min_x, max_x, range_x; + int min_y, max_y, range_y; struct SDL_evdevlist_item *next; } SDL_evdevlist_item; @@ -127,7 +130,7 @@ static void SDL_EVDEV_sync_device(SDL_evdevlist_item *item); static int SDL_EVDEV_device_removed(const char *dev_path); static int SDL_EVDEV_device_added(const char *dev_path, int udev_class); -#if SDL_USE_LIBUDEV +#ifdef SDL_USE_LIBUDEV static void SDL_EVDEV_udev_callback(SDL_UDEV_deviceevent udev_event, int udev_class, const char *dev_path); #endif /* SDL_USE_LIBUDEV */ @@ -148,15 +151,24 @@ static int SDL_EVDEV_SetRelativeMouseMode(SDL_bool enabled) return 0; } +static void SDL_EVDEV_UpdateKeyboardMute(void) +{ + if (SDL_EVDEV_GetDeviceCount(SDL_UDEV_DEVICE_KEYBOARD) > 0) { + SDL_EVDEV_kbd_set_muted(_this->kbd, SDL_TRUE); + } else { + SDL_EVDEV_kbd_set_muted(_this->kbd, SDL_FALSE); + } +} + int SDL_EVDEV_Init(void) { - if (_this == NULL) { + if (!_this) { _this = (SDL_EVDEV_PrivateData *)SDL_calloc(1, sizeof(*_this)); - if (_this == NULL) { + if (!_this) { return SDL_OutOfMemory(); } -#if SDL_USE_LIBUDEV +#ifdef SDL_USE_LIBUDEV if (SDL_UDEV_Init() < 0) { SDL_free(_this); _this = NULL; @@ -201,6 +213,8 @@ int SDL_EVDEV_Init(void) #endif /* SDL_USE_LIBUDEV */ _this->kbd = SDL_EVDEV_kbd_init(); + + SDL_EVDEV_UpdateKeyboardMute(); } SDL_GetMouse()->SetRelativeMouseMode = SDL_EVDEV_SetRelativeMouseMode; @@ -212,25 +226,25 @@ int SDL_EVDEV_Init(void) void SDL_EVDEV_Quit(void) { - if (_this == NULL) { + if (!_this) { return; } _this->ref_count -= 1; if (_this->ref_count < 1) { -#if SDL_USE_LIBUDEV +#ifdef SDL_USE_LIBUDEV SDL_UDEV_DelCallback(SDL_EVDEV_udev_callback); SDL_UDEV_Quit(); #endif /* SDL_USE_LIBUDEV */ - SDL_EVDEV_kbd_quit(_this->kbd); - /* Remove existing devices */ - while (_this->first != NULL) { + while (_this->first) { SDL_EVDEV_device_removed(_this->first->path); } + SDL_EVDEV_kbd_quit(_this->kbd); + SDL_assert(_this->first == NULL); SDL_assert(_this->last == NULL); SDL_assert(_this->num_devices == 0); @@ -240,11 +254,11 @@ void SDL_EVDEV_Quit(void) } } -#if SDL_USE_LIBUDEV +#ifdef SDL_USE_LIBUDEV static void SDL_EVDEV_udev_callback(SDL_UDEV_deviceevent udev_event, int udev_class, const char *dev_path) { - if (dev_path == NULL) { + if (!dev_path) { return; } @@ -269,6 +283,27 @@ static void SDL_EVDEV_udev_callback(SDL_UDEV_deviceevent udev_event, int udev_cl } #endif /* SDL_USE_LIBUDEV */ +void SDL_EVDEV_SetVTSwitchCallbacks(void (*release_callback)(void*), void *release_callback_data, + void (*acquire_callback)(void*), void *acquire_callback_data) +{ + SDL_EVDEV_kbd_set_vt_switch_callbacks(_this->kbd, + release_callback, release_callback_data, + acquire_callback, acquire_callback_data); +} + +int SDL_EVDEV_GetDeviceCount(int device_class) +{ + SDL_evdevlist_item *item; + int count = 0; + + for (item = _this->first; item; item = item->next) { + if ((item->udev_class & device_class) == device_class) { + ++count; + } + } + return count; +} + void SDL_EVDEV_Poll(void) { struct input_event events[32]; @@ -283,13 +318,15 @@ void SDL_EVDEV_Poll(void) return; } -#if SDL_USE_LIBUDEV +#ifdef SDL_USE_LIBUDEV SDL_UDEV_Poll(); #endif + SDL_EVDEV_kbd_update(_this->kbd); + mouse = SDL_GetMouse(); - for (item = _this->first; item != NULL; item = item->next) { + for (item = _this->first; item; item = item->next) { while ((len = read(item->fd, events, sizeof(events))) > 0) { len /= sizeof(events[0]); for (i = 0; i < len; ++i) { @@ -391,7 +428,6 @@ void SDL_EVDEV_Poll(void) } item->touchscreen_data->slots[0].x = events[i].value; } else if (!item->relative_mouse) { - /* FIXME: Normalize to input device's reported input range (EVIOCGABS) */ item->mouse_x = events[i].value; } break; @@ -402,7 +438,6 @@ void SDL_EVDEV_Poll(void) } item->touchscreen_data->slots[0].y = events[i].value; } else if (!item->relative_mouse) { - /* FIXME: Normalize to input device's reported input range (EVIOCGABS) */ item->mouse_y = events[i].value; } break; @@ -448,10 +483,20 @@ void SDL_EVDEV_Poll(void) switch (events[i].code) { case SYN_REPORT: /* Send mouse axis changes together to ensure consistency and reduce event processing overhead */ - if (item->mouse_x != 0 || item->mouse_y != 0) { - SDL_SendMouseMotion(mouse->focus, (SDL_MouseID)item->fd, item->relative_mouse, item->mouse_x, item->mouse_y); - item->mouse_x = item->mouse_y = 0; + if (item->relative_mouse) { + if (item->mouse_x != 0 || item->mouse_y != 0) { + SDL_SendMouseMotion(mouse->focus, (SDL_MouseID)item->fd, item->relative_mouse, item->mouse_x, item->mouse_y); + item->mouse_x = item->mouse_y = 0; + } + } else if (item->range_x > 0 && item->range_y > 0) { + /* TODO: test with multiple display scenarios */ + SDL_DisplayMode mode; + SDL_GetCurrentDisplayMode(0, &mode); + SDL_SendMouseMotion(mouse->focus, (SDL_MouseID)item->fd, item->relative_mouse, + (item->mouse_x - item->min_x) * mode.w / item->range_x, + (item->mouse_y - item->min_y) * mode.h / item->range_y); } + if (item->mouse_wheel != 0 || item->mouse_hwheel != 0) { SDL_SendMouseWheel(mouse->focus, (SDL_MouseID)item->fd, item->mouse_hwheel / (item->high_res_hwheel ? 120.0f : 1.0f), @@ -542,6 +587,32 @@ static SDL_Scancode SDL_EVDEV_translate_keycode(int keycode) return scancode; } +static int SDL_EVDEV_init_mouse(SDL_evdevlist_item *item, int udev_class) +{ + int ret; + struct input_absinfo abs_info; + + ret = ioctl(item->fd, EVIOCGABS(ABS_X), &abs_info); + if (ret < 0) { + // no absolute mode info, continue + return 0; + } + item->min_x = abs_info.minimum; + item->max_x = abs_info.maximum; + item->range_x = abs_info.maximum - abs_info.minimum; + + ret = ioctl(item->fd, EVIOCGABS(ABS_Y), &abs_info); + if (ret < 0) { + // no absolute mode info, continue + return 0; + } + item->min_y = abs_info.minimum; + item->max_y = abs_info.maximum; + item->range_y = abs_info.maximum - abs_info.minimum; + + return 0; +} + static int SDL_EVDEV_init_touchscreen(SDL_evdevlist_item *item, int udev_class) { int ret, i; @@ -554,7 +625,7 @@ static int SDL_EVDEV_init_touchscreen(SDL_evdevlist_item *item, int udev_class) } item->touchscreen_data = SDL_calloc(1, sizeof(*item->touchscreen_data)); - if (item->touchscreen_data == NULL) { + if (!item->touchscreen_data) { return SDL_OutOfMemory(); } @@ -565,7 +636,7 @@ static int SDL_EVDEV_init_touchscreen(SDL_evdevlist_item *item, int udev_class) } item->touchscreen_data->name = SDL_strdup(name); - if (item->touchscreen_data->name == NULL) { + if (!item->touchscreen_data->name) { SDL_free(item->touchscreen_data); return SDL_OutOfMemory(); } @@ -620,7 +691,7 @@ static int SDL_EVDEV_init_touchscreen(SDL_evdevlist_item *item, int udev_class) item->touchscreen_data->slots = SDL_calloc( item->touchscreen_data->max_slots, sizeof(*item->touchscreen_data->slots)); - if (item->touchscreen_data->slots == NULL) { + if (!item->touchscreen_data->slots) { SDL_free(item->touchscreen_data->name); SDL_free(item->touchscreen_data); return SDL_OutOfMemory(); @@ -681,7 +752,7 @@ static void SDL_EVDEV_sync_device(SDL_evdevlist_item *item) sizeof(*mt_req_values) * item->touchscreen_data->max_slots; mt_req_code = SDL_calloc(1, mt_req_size); - if (mt_req_code == NULL) { + if (!mt_req_code) { return; } @@ -787,14 +858,14 @@ static int SDL_EVDEV_device_added(const char *dev_path, int udev_class) unsigned long relbit[NBITS(REL_MAX)] = { 0 }; /* Check to make sure it's not already in list. */ - for (item = _this->first; item != NULL; item = item->next) { + for (item = _this->first; item; item = item->next) { if (SDL_strcmp(dev_path, item->path) == 0) { return -1; /* already have this one */ } } item = (SDL_evdevlist_item *)SDL_calloc(1, sizeof(SDL_evdevlist_item)); - if (item == NULL) { + if (!item) { return SDL_OutOfMemory(); } @@ -805,12 +876,14 @@ static int SDL_EVDEV_device_added(const char *dev_path, int udev_class) } item->path = SDL_strdup(dev_path); - if (item->path == NULL) { + if (!item->path) { close(item->fd); SDL_free(item); return SDL_OutOfMemory(); } + item->udev_class = udev_class; + if (ioctl(item->fd, EVIOCGBIT(EV_REL, sizeof(relbit)), relbit) >= 0) { item->relative_mouse = test_bit(REL_X, relbit) && test_bit(REL_Y, relbit); item->high_res_wheel = test_bit(REL_WHEEL_HI_RES, relbit); @@ -827,9 +900,17 @@ static int SDL_EVDEV_device_added(const char *dev_path, int udev_class) SDL_free(item); return ret; } + } else if (udev_class & SDL_UDEV_DEVICE_MOUSE) { + ret = SDL_EVDEV_init_mouse(item, udev_class); + if (ret < 0) { + close(item->fd); + SDL_free(item->path); + SDL_free(item); + return ret; + } } - if (_this->last == NULL) { + if (!_this->last) { _this->first = _this->last = item; } else { _this->last->next = item; @@ -838,6 +919,8 @@ static int SDL_EVDEV_device_added(const char *dev_path, int udev_class) SDL_EVDEV_sync_device(item); + SDL_EVDEV_UpdateKeyboardMute(); + return _this->num_devices++; } @@ -846,10 +929,10 @@ static int SDL_EVDEV_device_removed(const char *dev_path) SDL_evdevlist_item *item; SDL_evdevlist_item *prev = NULL; - for (item = _this->first; item != NULL; item = item->next) { + for (item = _this->first; item; item = item->next) { /* found it, remove it. */ if (SDL_strcmp(dev_path, item->path) == 0) { - if (prev != NULL) { + if (prev) { prev->next = item->next; } else { SDL_assert(_this->first == item); @@ -864,6 +947,7 @@ static int SDL_EVDEV_device_removed(const char *dev_path) close(item->fd); SDL_free(item->path); SDL_free(item); + SDL_EVDEV_UpdateKeyboardMute(); _this->num_devices--; return 0; } diff --git a/thirdparty/SDL/src/core/linux/SDL_evdev.h b/thirdparty/SDL/src/core/linux/SDL_evdev.h index 2681768bc..c3e9c5369 100644 --- a/thirdparty/SDL/src/core/linux/SDL_evdev.h +++ b/thirdparty/SDL/src/core/linux/SDL_evdev.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -30,6 +30,9 @@ extern int SDL_EVDEV_Init(void); extern void SDL_EVDEV_Quit(void); +extern void SDL_EVDEV_SetVTSwitchCallbacks(void (*release_callback)(void*), void *release_callback_data, + void (*acquire_callback)(void*), void *acquire_callback_data); +extern int SDL_EVDEV_GetDeviceCount(int device_class); extern void SDL_EVDEV_Poll(void); #endif /* SDL_INPUT_LINUXEV */ diff --git a/thirdparty/SDL/src/core/linux/SDL_evdev_capabilities.c b/thirdparty/SDL/src/core/linux/SDL_evdev_capabilities.c index b8f112b51..e1b5d74d1 100644 --- a/thirdparty/SDL/src/core/linux/SDL_evdev_capabilities.c +++ b/thirdparty/SDL/src/core/linux/SDL_evdev_capabilities.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga Copyright (C) 2020 Collabora Ltd. This software is provided 'as-is', without any express or implied @@ -23,7 +23,7 @@ #include "SDL_evdev_capabilities.h" -#if HAVE_LINUX_INPUT_H +#ifdef HAVE_LINUX_INPUT_H /* missing defines in older Linux kernel headers */ #ifndef BTN_TRIGGER_HAPPY diff --git a/thirdparty/SDL/src/core/linux/SDL_evdev_capabilities.h b/thirdparty/SDL/src/core/linux/SDL_evdev_capabilities.h index 8fcdcb686..8d3830aec 100644 --- a/thirdparty/SDL/src/core/linux/SDL_evdev_capabilities.h +++ b/thirdparty/SDL/src/core/linux/SDL_evdev_capabilities.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga Copyright (C) 2020 Collabora Ltd. This software is provided 'as-is', without any express or implied @@ -24,7 +24,7 @@ #ifndef SDL_evdev_capabilities_h_ #define SDL_evdev_capabilities_h_ -#if HAVE_LINUX_INPUT_H +#ifdef HAVE_LINUX_INPUT_H #include diff --git a/thirdparty/SDL/src/core/linux/SDL_evdev_kbd.c b/thirdparty/SDL/src/core/linux/SDL_evdev_kbd.c index 632bbd248..3f2c7203a 100644 --- a/thirdparty/SDL/src/core/linux/SDL_evdev_kbd.c +++ b/thirdparty/SDL/src/core/linux/SDL_evdev_kbd.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -85,6 +85,7 @@ static fn_handler_fn *fn_handler[] = { struct SDL_EVDEV_keyboard_state { int console_fd; + SDL_bool muted; int old_kbd_mode; unsigned short **key_maps; unsigned char shift_down[NR_SHIFT]; /* shift state counters.. */ @@ -99,6 +100,10 @@ struct SDL_EVDEV_keyboard_state char shift_state; char text[128]; unsigned int text_len; + void (*vt_release_callback)(void *); + void *vt_release_callback_data; + void (*vt_acquire_callback)(void *); + void *vt_acquire_callback_data; }; #ifdef DUMP_ACCENTS @@ -169,7 +174,7 @@ static int fatal_signals[] = { static void kbd_cleanup(void) { SDL_EVDEV_keyboard_state *kbd = kbd_cleanup_state; - if (kbd == NULL) { + if (!kbd) { return; } kbd_cleanup_state = NULL; @@ -209,7 +214,7 @@ static void kbd_cleanup_signal_action(int signum, siginfo_t *info, void *ucontex SDL_EVDEV_kbd_reraise_signal(signum); } -static void kbd_unregister_emerg_cleanup() +static void kbd_unregister_emerg_cleanup(void) { int tabidx, signum; @@ -254,7 +259,7 @@ static void kbd_register_emerg_cleanup(SDL_EVDEV_keyboard_state *kbd) { int tabidx, signum; - if (kbd_cleanup_state != NULL) { + if (kbd_cleanup_state) { return; } kbd_cleanup_state = kbd; @@ -296,6 +301,126 @@ static void kbd_register_emerg_cleanup(SDL_EVDEV_keyboard_state *kbd) } } +enum { + VT_SIGNAL_NONE, + VT_SIGNAL_RELEASE, + VT_SIGNAL_ACQUIRE, +}; +static int vt_release_signal; +static int vt_acquire_signal; +static SDL_atomic_t vt_signal_pending; + +typedef void (*signal_handler)(int signum); + +static void kbd_vt_release_signal_action(int signum) +{ + SDL_AtomicSet(&vt_signal_pending, VT_SIGNAL_RELEASE); +} + +static void kbd_vt_acquire_signal_action(int signum) +{ + SDL_AtomicSet(&vt_signal_pending, VT_SIGNAL_ACQUIRE); +} + +static SDL_bool setup_vt_signal(int signum, signal_handler handler) +{ + struct sigaction *old_action_p; + struct sigaction new_action; + old_action_p = &(old_sigaction[signum]); + SDL_zero(new_action); + new_action.sa_handler = handler; + new_action.sa_flags = SA_RESTART; + if (sigaction(signum, &new_action, old_action_p) < 0) { + return SDL_FALSE; + } + if (old_action_p->sa_handler != SIG_DFL) { + /* This signal is already in use */ + sigaction(signum, old_action_p, NULL); + return SDL_FALSE; + } + return SDL_TRUE; +} + +static int find_free_signal(signal_handler handler) +{ +#ifdef SIGRTMIN + int i; + + for (i = SIGRTMIN + 2; i <= SIGRTMAX; ++i) { + if (setup_vt_signal(i, handler)) { + return i; + } + } +#endif + if (setup_vt_signal(SIGUSR1, handler)) { + return SIGUSR1; + } + if (setup_vt_signal(SIGUSR2, handler)) { + return SIGUSR2; + } + return 0; +} + +static void kbd_vt_quit(int console_fd) +{ + struct vt_mode mode; + + if (vt_release_signal) { + sigaction(vt_release_signal, &old_sigaction[vt_release_signal], NULL); + vt_release_signal = 0; + } + if (vt_acquire_signal) { + sigaction(vt_acquire_signal, &old_sigaction[vt_acquire_signal], NULL); + vt_acquire_signal = 0; + } + + SDL_zero(mode); + mode.mode = VT_AUTO; + ioctl(console_fd, VT_SETMODE, &mode); +} + +static int kbd_vt_init(int console_fd) +{ + struct vt_mode mode; + + vt_release_signal = find_free_signal(kbd_vt_release_signal_action); + vt_acquire_signal = find_free_signal(kbd_vt_acquire_signal_action); + if (!vt_release_signal || !vt_acquire_signal) { + kbd_vt_quit(console_fd); + return -1; + } + + SDL_zero(mode); + mode.mode = VT_PROCESS; + mode.relsig = vt_release_signal; + mode.acqsig = vt_acquire_signal; + mode.frsig = SIGIO; + if (ioctl(console_fd, VT_SETMODE, &mode) < 0) { + kbd_vt_quit(console_fd); + return -1; + } + return 0; +} + +static void kbd_vt_update(SDL_EVDEV_keyboard_state *state) +{ + int signal_pending = SDL_AtomicGet(&vt_signal_pending); + if (signal_pending != VT_SIGNAL_NONE) { + if (signal_pending == VT_SIGNAL_RELEASE) { + if (state->vt_release_callback) { + state->vt_release_callback(state->vt_release_callback_data); + } + ioctl(state->console_fd, VT_RELDISP, 1); + } else { + if (state->vt_acquire_callback) { + state->vt_acquire_callback(state->vt_acquire_callback_data); + } + ioctl(state->console_fd, VT_RELDISP, VT_ACKACQ); + } + SDL_AtomicCAS(&vt_signal_pending, signal_pending, VT_SIGNAL_NONE); + } +} + SDL_EVDEV_keyboard_state *SDL_EVDEV_kbd_init(void) { SDL_EVDEV_keyboard_state *kbd; @@ -304,7 +429,7 @@ SDL_EVDEV_keyboard_state *SDL_EVDEV_kbd_init(void) char shift_state[sizeof(long)] = { TIOCL_GETSHIFTSTATE, 0 }; kbd = (SDL_EVDEV_keyboard_state *)SDL_calloc(1, sizeof(*kbd)); - if (kbd == NULL) { + if (!kbd) { return NULL; } @@ -333,35 +458,77 @@ SDL_EVDEV_keyboard_state *SDL_EVDEV_kbd_init(void) ioctl(kbd->console_fd, KDSKBMODE, K_UNICODE); } - /* Allow inhibiting keyboard mute with env. variable for debugging etc. */ - if (SDL_getenv("SDL_INPUT_LINUX_KEEP_KBD") == NULL) { - /* Mute the keyboard so keystrokes only generate evdev events - * and do not leak through to the console - */ - ioctl(kbd->console_fd, KDSKBMODE, K_OFF); + kbd_vt_init(kbd->console_fd); - /* Make sure to restore keyboard if application fails to call - * SDL_Quit before exit or fatal signal is raised. - */ - if (!SDL_GetHintBoolean(SDL_HINT_NO_SIGNAL_HANDLERS, SDL_FALSE)) { - kbd_register_emerg_cleanup(kbd); - } - } return kbd; } -void SDL_EVDEV_kbd_quit(SDL_EVDEV_keyboard_state *state) +void SDL_EVDEV_kbd_set_muted(SDL_EVDEV_keyboard_state *state, SDL_bool muted) { - if (state == NULL) { + if (!state) { return; } - kbd_unregister_emerg_cleanup(); + if (muted == state->muted) { + return; + } + + if (muted) { + /* Allow inhibiting keyboard mute with env. variable for debugging etc. */ + if (SDL_getenv("SDL_INPUT_LINUX_KEEP_KBD") == NULL) { + /* Mute the keyboard so keystrokes only generate evdev events + * and do not leak through to the console + */ + ioctl(state->console_fd, KDSKBMODE, K_OFF); + + /* Make sure to restore keyboard if application fails to call + * SDL_Quit before exit or fatal signal is raised. + */ + if (!SDL_GetHintBoolean(SDL_HINT_NO_SIGNAL_HANDLERS, SDL_FALSE)) { + kbd_register_emerg_cleanup(state); + } + } + } else { + kbd_unregister_emerg_cleanup(); - if (state->console_fd >= 0) { /* Restore the original keyboard mode */ ioctl(state->console_fd, KDSKBMODE, state->old_kbd_mode); + } + state->muted = muted; +} +void SDL_EVDEV_kbd_set_vt_switch_callbacks(SDL_EVDEV_keyboard_state *state, void (*release_callback)(void*), void *release_callback_data, void (*acquire_callback)(void*), void *acquire_callback_data) +{ + if (!state) { + return; + } + + state->vt_release_callback = release_callback; + state->vt_release_callback_data = release_callback_data; + state->vt_acquire_callback = acquire_callback; + state->vt_acquire_callback_data = acquire_callback_data; +} + +void SDL_EVDEV_kbd_update(SDL_EVDEV_keyboard_state *state) +{ + if (!state) { + return; + } + + kbd_vt_update(state); +} + +void SDL_EVDEV_kbd_quit(SDL_EVDEV_keyboard_state *state) +{ + if (!state) { + return; + } + + SDL_EVDEV_kbd_set_muted(state, SDL_FALSE); + + kbd_vt_quit(state->console_fd); + + if (state->console_fd >= 0) { close(state->console_fd); state->console_fd = -1; } @@ -726,7 +893,7 @@ void SDL_EVDEV_kbd_keycode(SDL_EVDEV_keyboard_state *state, unsigned int keycode unsigned short *key_map; unsigned short keysym; - if (state == NULL) { + if (!state) { return; } @@ -734,7 +901,7 @@ void SDL_EVDEV_kbd_keycode(SDL_EVDEV_keyboard_state *state, unsigned int keycode shift_final = (state->shift_state | state->slockstate) ^ state->lockstate; key_map = state->key_maps[shift_final]; - if (key_map == NULL) { + if (!key_map) { /* Unsupported shift state (e.g. ctrl = 4, alt = 8), just reset to the default state */ state->shift_state = 0; state->slockstate = 0; @@ -809,6 +976,18 @@ SDL_EVDEV_keyboard_state *SDL_EVDEV_kbd_init(void) return NULL; } +void SDL_EVDEV_kbd_set_muted(SDL_EVDEV_keyboard_state *state, SDL_bool muted) +{ +} + +void SDL_EVDEV_kbd_set_vt_switch_callbacks(SDL_EVDEV_keyboard_state *state, void (*release_callback)(void*), void *release_callback_data, void (*acquire_callback)(void*), void *acquire_callback_data) +{ +} + +void SDL_EVDEV_kbd_update(SDL_EVDEV_keyboard_state *state) +{ +} + void SDL_EVDEV_kbd_keycode(SDL_EVDEV_keyboard_state *state, unsigned int keycode, int down) { } diff --git a/thirdparty/SDL/src/core/linux/SDL_evdev_kbd.h b/thirdparty/SDL/src/core/linux/SDL_evdev_kbd.h index 8105ab8be..52a4778e8 100644 --- a/thirdparty/SDL/src/core/linux/SDL_evdev_kbd.h +++ b/thirdparty/SDL/src/core/linux/SDL_evdev_kbd.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -26,6 +26,9 @@ struct SDL_EVDEV_keyboard_state; typedef struct SDL_EVDEV_keyboard_state SDL_EVDEV_keyboard_state; extern SDL_EVDEV_keyboard_state *SDL_EVDEV_kbd_init(void); +extern void SDL_EVDEV_kbd_set_muted(SDL_EVDEV_keyboard_state *state, SDL_bool muted); +extern void SDL_EVDEV_kbd_set_vt_switch_callbacks(SDL_EVDEV_keyboard_state *state, void (*release_callback)(void*), void *release_callback_data, void (*acquire_callback)(void*), void *acquire_callback_data); +extern void SDL_EVDEV_kbd_update(SDL_EVDEV_keyboard_state *state); extern void SDL_EVDEV_kbd_keycode(SDL_EVDEV_keyboard_state *state, unsigned int keycode, int down); extern void SDL_EVDEV_kbd_quit(SDL_EVDEV_keyboard_state *state); diff --git a/thirdparty/SDL/src/core/linux/SDL_evdev_kbd_default_accents.h b/thirdparty/SDL/src/core/linux/SDL_evdev_kbd_default_accents.h index 4b33a17ca..d0d523455 100644 --- a/thirdparty/SDL/src/core/linux/SDL_evdev_kbd_default_accents.h +++ b/thirdparty/SDL/src/core/linux/SDL_evdev_kbd_default_accents.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/core/linux/SDL_evdev_kbd_default_keymap.h b/thirdparty/SDL/src/core/linux/SDL_evdev_kbd_default_keymap.h index 04e71277d..d744a54a2 100644 --- a/thirdparty/SDL/src/core/linux/SDL_evdev_kbd_default_keymap.h +++ b/thirdparty/SDL/src/core/linux/SDL_evdev_kbd_default_keymap.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/core/linux/SDL_fcitx.c b/thirdparty/SDL/src/core/linux/SDL_fcitx.c index 5f76a626e..cfbf70b8e 100644 --- a/thirdparty/SDL/src/core/linux/SDL_fcitx.c +++ b/thirdparty/SDL/src/core/linux/SDL_fcitx.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -28,7 +28,7 @@ #include "../../events/SDL_keyboard_c.h" #include "SDL_dbus.h" #include "SDL_syswm.h" -#if SDL_VIDEO_DRIVER_X11 +#ifdef SDL_VIDEO_DRIVER_X11 # include "../../video/x11/SDL_x11video.h" #endif #include "SDL_hints.h" @@ -55,7 +55,7 @@ typedef struct _FcitxClient static FcitxClient fcitx_client; -static char *GetAppName() +static char *GetAppName(void) { #if defined(__LINUX__) || defined(__FREEBSD__) char *spot; @@ -368,7 +368,7 @@ static Uint32 Fcitx_ModState(void) return fcitx_mods; } -SDL_bool SDL_Fcitx_Init() +SDL_bool SDL_Fcitx_Init(void) { fcitx_client.dbus = SDL_DBus_GetContext(); @@ -380,7 +380,7 @@ SDL_bool SDL_Fcitx_Init() return FcitxClientCreateIC(&fcitx_client); } -void SDL_Fcitx_Quit() +void SDL_Fcitx_Quit(void) { FcitxClientICCallMethod(&fcitx_client, "DestroyIC"); if (fcitx_client.ic_path) { @@ -438,7 +438,7 @@ void SDL_Fcitx_UpdateTextRect(const SDL_Rect *rect) } focused_win = SDL_GetKeyboardFocus(); - if (focused_win == NULL) { + if (!focused_win) { return; } @@ -449,7 +449,7 @@ void SDL_Fcitx_UpdateTextRect(const SDL_Rect *rect) SDL_GetWindowPosition(focused_win, &x, &y); -#if SDL_VIDEO_DRIVER_X11 +#ifdef SDL_VIDEO_DRIVER_X11 if (info.subsystem == SDL_SYSWM_X11) { SDL_DisplayData *displaydata = (SDL_DisplayData *) SDL_GetDisplayForWindow(focused_win)->driverdata; @@ -485,7 +485,6 @@ void SDL_Fcitx_PumpEvents(void) while (dbus->connection_dispatch(conn) == DBUS_DISPATCH_DATA_REMAINS) { /* Do nothing, actual work happens in DBus_MessageFilter */ - usleep(10); } } diff --git a/thirdparty/SDL/src/core/linux/SDL_fcitx.h b/thirdparty/SDL/src/core/linux/SDL_fcitx.h index 3e5699e74..4a893f2f9 100644 --- a/thirdparty/SDL/src/core/linux/SDL_fcitx.h +++ b/thirdparty/SDL/src/core/linux/SDL_fcitx.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/core/linux/SDL_ibus.c b/thirdparty/SDL/src/core/linux/SDL_ibus.c index 4241cd4ad..31179d4fa 100644 --- a/thirdparty/SDL/src/core/linux/SDL_ibus.c +++ b/thirdparty/SDL/src/core/linux/SDL_ibus.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -29,7 +29,7 @@ #include "../../video/SDL_sysvideo.h" #include "../../events/SDL_keyboard_c.h" -#if SDL_VIDEO_DRIVER_X11 +#ifdef SDL_VIDEO_DRIVER_X11 #include "../../video/x11/SDL_x11video.h" #endif @@ -112,7 +112,7 @@ static SDL_bool IBus_EnterVariant(DBusConnection *conn, DBusMessageIter *iter, S } dbus->message_iter_get_basic(inside, &struct_id); - if (struct_id == NULL || SDL_strncmp(struct_id, struct_id, id_size) != 0) { + if (!struct_id || SDL_strncmp(struct_id, struct_id, id_size) != 0) { return SDL_FALSE; } return SDL_TRUE; @@ -306,7 +306,7 @@ static char *IBus_ReadAddressFromFile(const char *file_path) FILE *addr_file; addr_file = fopen(file_path, "r"); - if (addr_file == NULL) { + if (!addr_file) { return NULL; } @@ -351,7 +351,7 @@ static char *IBus_GetDBusAddressFilename(void) } dbus = SDL_DBus_GetContext(); - if (dbus == NULL) { + if (!dbus) { return NULL; } @@ -365,7 +365,7 @@ static char *IBus_GetDBusAddressFilename(void) and look up the address from a filepath using all those bits, eek. */ disp_env = SDL_getenv("DISPLAY"); - if (disp_env == NULL || !*disp_env) { + if (!disp_env || !*disp_env) { display = SDL_strdup(":0.0"); } else { display = SDL_strdup(disp_env); @@ -375,7 +375,7 @@ static char *IBus_GetDBusAddressFilename(void) disp_num = SDL_strrchr(display, ':'); screen_num = SDL_strrchr(display, '.'); - if (disp_num == NULL) { + if (!disp_num) { SDL_free(display); return NULL; } @@ -389,7 +389,7 @@ static char *IBus_GetDBusAddressFilename(void) if (!*host) { const char *session = SDL_getenv("XDG_SESSION_TYPE"); - if (session != NULL && SDL_strcmp(session, "wayland") == 0) { + if (session && SDL_strcmp(session, "wayland") == 0) { host = "unix-wayland"; } else { host = "unix"; @@ -403,7 +403,7 @@ static char *IBus_GetDBusAddressFilename(void) SDL_strlcpy(config_dir, conf_env, sizeof(config_dir)); } else { const char *home_env = SDL_getenv("HOME"); - if (home_env == NULL || !*home_env) { + if (!home_env || !*home_env) { SDL_free(display); return NULL; } @@ -412,7 +412,7 @@ static char *IBus_GetDBusAddressFilename(void) key = SDL_DBus_GetLocalMachineId(); - if (key == NULL) { + if (!key) { SDL_free(display); return NULL; } @@ -473,7 +473,7 @@ static SDL_bool IBus_SetupConnection(SDL_DBusContext *dbus, const char *addr) ibus_input_interface = IBUS_INPUT_INTERFACE; ibus_conn = dbus->connection_open_private(addr, NULL); - if (ibus_conn == NULL) { + if (!ibus_conn) { return SDL_FALSE; /* oh well. */ } @@ -513,7 +513,7 @@ static SDL_bool IBus_SetupConnection(SDL_DBusContext *dbus, const char *addr) static SDL_bool IBus_CheckConnection(SDL_DBusContext *dbus) { - if (dbus == NULL) { + if (!dbus) { return SDL_FALSE; } @@ -533,7 +533,7 @@ static SDL_bool IBus_CheckConnection(SDL_DBusContext *dbus) struct inotify_event *event = (struct inotify_event *)p; if (event->len > 0) { char *addr_file_no_path = SDL_strrchr(ibus_addr_file, '/'); - if (addr_file_no_path == NULL) { + if (!addr_file_no_path) { return SDL_FALSE; } @@ -570,19 +570,21 @@ SDL_bool SDL_IBus_Init(void) char *addr; char *addr_file_dir; - if (addr_file == NULL) { + if (!addr_file) { return SDL_FALSE; } - /* !!! FIXME: if ibus_addr_file != NULL, this will overwrite it and leak (twice!) */ - ibus_addr_file = SDL_strdup(addr_file); - addr = IBus_ReadAddressFromFile(addr_file); - if (addr == NULL) { + if (!addr) { SDL_free(addr_file); return SDL_FALSE; } + if (ibus_addr_file) { + SDL_free(ibus_addr_file); + } + ibus_addr_file = SDL_strdup(addr_file); + if (inotify_fd < 0) { inotify_fd = inotify_init(); fcntl(inotify_fd, F_SETFL, O_NONBLOCK); @@ -659,7 +661,7 @@ static void IBus_SimpleMessage(const char *method) { SDL_DBusContext *dbus = SDL_DBus_GetContext(); - if ((input_ctx_path != NULL) && (IBus_CheckConnection(dbus))) { + if ((input_ctx_path) && (IBus_CheckConnection(dbus))) { SDL_DBus_CallVoidMethodOnConnection(ibus_conn, ibus_service, input_ctx_path, ibus_input_interface, method, DBUS_TYPE_INVALID); } } @@ -710,7 +712,7 @@ void SDL_IBus_UpdateTextRect(const SDL_Rect *rect) } focused_win = SDL_GetKeyboardFocus(); - if (focused_win == NULL) { + if (!focused_win) { return; } @@ -721,7 +723,7 @@ void SDL_IBus_UpdateTextRect(const SDL_Rect *rect) SDL_GetWindowPosition(focused_win, &x, &y); -#if SDL_VIDEO_DRIVER_X11 +#ifdef SDL_VIDEO_DRIVER_X11 if (info.subsystem == SDL_SYSWM_X11) { SDL_DisplayData *displaydata = (SDL_DisplayData *) SDL_GetDisplayForWindow(focused_win)->driverdata; diff --git a/thirdparty/SDL/src/core/linux/SDL_ibus.h b/thirdparty/SDL/src/core/linux/SDL_ibus.h index da00741df..a4ea140b5 100644 --- a/thirdparty/SDL/src/core/linux/SDL_ibus.h +++ b/thirdparty/SDL/src/core/linux/SDL_ibus.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/core/linux/SDL_ime.c b/thirdparty/SDL/src/core/linux/SDL_ime.c index f40e83c5a..2a87a7a00 100644 --- a/thirdparty/SDL/src/core/linux/SDL_ime.c +++ b/thirdparty/SDL/src/core/linux/SDL_ime.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -40,7 +40,7 @@ static _SDL_IME_ProcessKeyEvent SDL_IME_ProcessKeyEvent_Real = NULL; static _SDL_IME_UpdateTextRect SDL_IME_UpdateTextRect_Real = NULL; static _SDL_IME_PumpEvents SDL_IME_PumpEvents_Real = NULL; -static void InitIME() +static void InitIME(void) { static SDL_bool inited = SDL_FALSE; #ifdef HAVE_FCITX @@ -56,9 +56,9 @@ static void InitIME() /* See if fcitx IME support is being requested */ #ifdef HAVE_FCITX - if (SDL_IME_Init_Real == NULL && + if (!SDL_IME_Init_Real && ((im_module && SDL_strcmp(im_module, "fcitx") == 0) || - (im_module == NULL && xmodifiers && SDL_strstr(xmodifiers, "@im=fcitx") != NULL))) { + (!im_module && xmodifiers && SDL_strstr(xmodifiers, "@im=fcitx") != NULL))) { SDL_IME_Init_Real = SDL_Fcitx_Init; SDL_IME_Quit_Real = SDL_Fcitx_Quit; SDL_IME_SetFocus_Real = SDL_Fcitx_SetFocus; @@ -71,7 +71,7 @@ static void InitIME() /* default to IBus */ #ifdef HAVE_IBUS_IBUS_H - if (SDL_IME_Init_Real == NULL) { + if (!SDL_IME_Init_Real) { SDL_IME_Init_Real = SDL_IBus_Init; SDL_IME_Quit_Real = SDL_IBus_Quit; SDL_IME_SetFocus_Real = SDL_IBus_SetFocus; @@ -142,7 +142,7 @@ void SDL_IME_UpdateTextRect(const SDL_Rect *rect) } } -void SDL_IME_PumpEvents() +void SDL_IME_PumpEvents(void) { if (SDL_IME_PumpEvents_Real) { SDL_IME_PumpEvents_Real(); diff --git a/thirdparty/SDL/src/core/linux/SDL_ime.h b/thirdparty/SDL/src/core/linux/SDL_ime.h index 8e4851be8..0c1e2d07e 100644 --- a/thirdparty/SDL/src/core/linux/SDL_ime.h +++ b/thirdparty/SDL/src/core/linux/SDL_ime.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/core/linux/SDL_sandbox.c b/thirdparty/SDL/src/core/linux/SDL_sandbox.c index 153903172..e93e18301 100644 --- a/thirdparty/SDL/src/core/linux/SDL_sandbox.c +++ b/thirdparty/SDL/src/core/linux/SDL_sandbox.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga Copyright (C) 2022 Collabora Ltd. This software is provided 'as-is', without any express or implied diff --git a/thirdparty/SDL/src/core/linux/SDL_sandbox.h b/thirdparty/SDL/src/core/linux/SDL_sandbox.h index eecac0749..4e6691806 100644 --- a/thirdparty/SDL/src/core/linux/SDL_sandbox.h +++ b/thirdparty/SDL/src/core/linux/SDL_sandbox.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga Copyright (C) 2022 Collabora Ltd. This software is provided 'as-is', without any express or implied diff --git a/thirdparty/SDL/src/core/linux/SDL_threadprio.c b/thirdparty/SDL/src/core/linux/SDL_threadprio.c index 57406c6df..ec0d4c914 100644 --- a/thirdparty/SDL/src/core/linux/SDL_threadprio.c +++ b/thirdparty/SDL/src/core/linux/SDL_threadprio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -26,7 +26,7 @@ #include "SDL_stdinc.h" #include "SDL_thread.h" -#if !SDL_THREADS_DISABLED +#ifndef SDL_THREADS_DISABLED #include #include #include @@ -44,7 +44,7 @@ #include "SDL_dbus.h" -#if SDL_USE_LIBDBUS +#ifdef SDL_USE_LIBDBUS #include /* d-bus queries to org.freedesktop.RealtimeKit1. */ @@ -79,7 +79,7 @@ static SDL_bool realtime_portal_supported(DBusConnection *conn) "RTTimeUSecMax", DBUS_TYPE_INT64, &res); } -static void set_rtkit_interface() +static void set_rtkit_interface(void) { SDL_DBusContext *dbus = SDL_DBus_GetContext(); @@ -108,7 +108,7 @@ static DBusConnection *get_rtkit_dbus_connection() return NULL; } -static void rtkit_initialize() +static void rtkit_initialize(void) { DBusConnection *dbus_conn; @@ -116,25 +116,25 @@ static void rtkit_initialize() dbus_conn = get_rtkit_dbus_connection(); /* Try getting minimum nice level: this is often greater than PRIO_MIN (-20). */ - if (dbus_conn == NULL || !SDL_DBus_QueryPropertyOnConnection(dbus_conn, rtkit_dbus_node, rtkit_dbus_path, rtkit_dbus_interface, "MinNiceLevel", + if (!dbus_conn || !SDL_DBus_QueryPropertyOnConnection(dbus_conn, rtkit_dbus_node, rtkit_dbus_path, rtkit_dbus_interface, "MinNiceLevel", DBUS_TYPE_INT32, &rtkit_min_nice_level)) { rtkit_min_nice_level = -20; } /* Try getting maximum realtime priority: this can be less than the POSIX default (99). */ - if (dbus_conn == NULL || !SDL_DBus_QueryPropertyOnConnection(dbus_conn, rtkit_dbus_node, rtkit_dbus_path, rtkit_dbus_interface, "MaxRealtimePriority", + if (!dbus_conn || !SDL_DBus_QueryPropertyOnConnection(dbus_conn, rtkit_dbus_node, rtkit_dbus_path, rtkit_dbus_interface, "MaxRealtimePriority", DBUS_TYPE_INT32, &rtkit_max_realtime_priority)) { rtkit_max_realtime_priority = 99; } /* Try getting maximum rttime allowed by rtkit: exceeding this value will result in SIGKILL */ - if (dbus_conn == NULL || !SDL_DBus_QueryPropertyOnConnection(dbus_conn, rtkit_dbus_node, rtkit_dbus_path, rtkit_dbus_interface, "RTTimeUSecMax", + if (!dbus_conn || !SDL_DBus_QueryPropertyOnConnection(dbus_conn, rtkit_dbus_node, rtkit_dbus_path, rtkit_dbus_interface, "RTTimeUSecMax", DBUS_TYPE_INT64, &rtkit_max_rttime_usec)) { rtkit_max_rttime_usec = 200000; } } -static SDL_bool rtkit_initialize_realtime_thread() +static SDL_bool rtkit_initialize_realtime_thread(void) { // Following is an excerpt from rtkit README that outlines the requirements // a thread must meet before making rtkit requests: @@ -207,7 +207,7 @@ static SDL_bool rtkit_setpriority_nice(pid_t thread, int nice_level) nice = rtkit_min_nice_level; } - if (dbus_conn == NULL || !SDL_DBus_CallMethodOnConnection(dbus_conn, + if (!dbus_conn || !SDL_DBus_CallMethodOnConnection(dbus_conn, rtkit_dbus_node, rtkit_dbus_path, rtkit_dbus_interface, "MakeThreadHighPriorityWithPID", DBUS_TYPE_UINT64, &pid, DBUS_TYPE_UINT64, &tid, DBUS_TYPE_INT32, &nice, DBUS_TYPE_INVALID, DBUS_TYPE_INVALID)) { @@ -238,7 +238,7 @@ static SDL_bool rtkit_setpriority_realtime(pid_t thread, int rt_priority) // go through to determine whether it really needs to fail or not. rtkit_initialize_realtime_thread(); - if (dbus_conn == NULL || !SDL_DBus_CallMethodOnConnection(dbus_conn, + if (!dbus_conn || !SDL_DBus_CallMethodOnConnection(dbus_conn, rtkit_dbus_node, rtkit_dbus_path, rtkit_dbus_interface, "MakeThreadRealtimeWithPID", DBUS_TYPE_UINT64, &pid, DBUS_TYPE_UINT64, &tid, DBUS_TYPE_UINT32, &priority, DBUS_TYPE_INVALID, DBUS_TYPE_INVALID)) { @@ -256,14 +256,14 @@ static SDL_bool rtkit_setpriority_realtime(pid_t thread, int rt_priority) /* this is a public symbol, so it has to exist even if threads are disabled. */ int SDL_LinuxSetThreadPriority(Sint64 threadID, int priority) { -#if SDL_THREADS_DISABLED +#ifdef SDL_THREADS_DISABLED return SDL_Unsupported(); #else if (setpriority(PRIO_PROCESS, (id_t)threadID, priority) == 0) { return 0; } -#if SDL_USE_LIBDBUS +#ifdef SDL_USE_LIBDBUS /* Note that this fails you most likely: * Have your process's scheduler incorrectly configured. See the requirements at: @@ -288,7 +288,7 @@ int SDL_LinuxSetThreadPriority(Sint64 threadID, int priority) /* this is a public symbol, so it has to exist even if threads are disabled. */ int SDL_LinuxSetThreadPriorityAndPolicy(Sint64 threadID, int sdlPriority, int schedPolicy) { -#if SDL_THREADS_DISABLED +#ifdef SDL_THREADS_DISABLED return SDL_Unsupported(); #else int osPriority; @@ -319,7 +319,7 @@ int SDL_LinuxSetThreadPriorityAndPolicy(Sint64 threadID, int sdlPriority, int sc } } -#if SDL_USE_LIBDBUS +#ifdef SDL_USE_LIBDBUS /* Note that this fails you most likely: * Have your process's scheduler incorrectly configured. See the requirements at: diff --git a/thirdparty/SDL/src/core/linux/SDL_udev.c b/thirdparty/SDL/src/core/linux/SDL_udev.c index 39368c7e0..5bdfc0db8 100644 --- a/thirdparty/SDL/src/core/linux/SDL_udev.c +++ b/thirdparty/SDL/src/core/linux/SDL_udev.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -31,6 +31,7 @@ #ifdef SDL_USE_LIBUDEV #include +#include #include "SDL_assert.h" #include "SDL_evdev_capabilities.h" @@ -47,12 +48,15 @@ static _THIS = NULL; static SDL_bool SDL_UDEV_load_sym(const char *fn, void **addr); static int SDL_UDEV_load_syms(void); static SDL_bool SDL_UDEV_hotplug_update_available(void); +static void get_caps(struct udev_device *dev, struct udev_device *pdev, const char *attr, unsigned long *bitmask, size_t bitmask_len); +static int guess_device_class(struct udev_device *dev); +static int device_class(struct udev_device *dev); static void device_event(SDL_UDEV_deviceevent type, struct udev_device *dev); static SDL_bool SDL_UDEV_load_sym(const char *fn, void **addr) { *addr = SDL_LoadFunction(_this->udev_handle, fn); - if (*addr == NULL) { + if (!*addr) { /* Don't call SDL_SetError(): SDL_LoadFunction already did. */ return SDL_FALSE; } @@ -100,7 +104,7 @@ static int SDL_UDEV_load_syms(void) static SDL_bool SDL_UDEV_hotplug_update_available(void) { - if (_this->udev_mon != NULL) { + if (_this->udev_mon) { const int fd = _this->syms.udev_monitor_get_fd(_this->udev_mon); if (SDL_IOReady(fd, SDL_IOR_READ, 0)) { return SDL_TRUE; @@ -113,9 +117,9 @@ int SDL_UDEV_Init(void) { int retval = 0; - if (_this == NULL) { + if (!_this) { _this = (SDL_UDEV_PrivateData *)SDL_calloc(1, sizeof(*_this)); - if (_this == NULL) { + if (!_this) { return SDL_OutOfMemory(); } @@ -130,13 +134,13 @@ int SDL_UDEV_Init(void) */ _this->udev = _this->syms.udev_new(); - if (_this->udev == NULL) { + if (!_this->udev) { SDL_UDEV_Quit(); return SDL_SetError("udev_new() failed"); } _this->udev_mon = _this->syms.udev_monitor_new_from_netlink(_this->udev, "udev"); - if (_this->udev_mon == NULL) { + if (!_this->udev_mon) { SDL_UDEV_Quit(); return SDL_SetError("udev_monitor_new_from_netlink() failed"); } @@ -158,7 +162,7 @@ void SDL_UDEV_Quit(void) { SDL_UDEV_CallbackList *item; - if (_this == NULL) { + if (!_this) { return; } @@ -166,17 +170,17 @@ void SDL_UDEV_Quit(void) if (_this->ref_count < 1) { - if (_this->udev_mon != NULL) { + if (_this->udev_mon) { _this->syms.udev_monitor_unref(_this->udev_mon); _this->udev_mon = NULL; } - if (_this->udev != NULL) { + if (_this->udev) { _this->syms.udev_unref(_this->udev); _this->udev = NULL; } /* Remove existing devices */ - while (_this->first != NULL) { + while (_this->first) { item = _this->first; _this->first = _this->first->next; SDL_free(item); @@ -194,12 +198,12 @@ void SDL_UDEV_Scan(void) struct udev_list_entry *devs = NULL; struct udev_list_entry *item = NULL; - if (_this == NULL) { + if (!_this) { return; } enumerate = _this->syms.udev_enumerate_new(_this->udev); - if (enumerate == NULL) { + if (!enumerate) { SDL_UDEV_Quit(); SDL_SetError("udev_enumerate_new() failed"); return; @@ -213,7 +217,7 @@ void SDL_UDEV_Scan(void) for (item = devs; item; item = _this->syms.udev_list_entry_get_next(item)) { const char *path = _this->syms.udev_list_entry_get_name(item); struct udev_device *dev = _this->syms.udev_device_new_from_syspath(_this->udev, path); - if (dev != NULL) { + if (dev) { device_event(SDL_UDEV_DEVICEADDED, dev); _this->syms.udev_device_unref(dev); } @@ -222,66 +226,70 @@ void SDL_UDEV_Scan(void) _this->syms.udev_enumerate_unref(enumerate); } -SDL_bool SDL_UDEV_GetProductInfo(const char *device_path, Uint16 *vendor, Uint16 *product, Uint16 *version) +SDL_bool SDL_UDEV_GetProductInfo(const char *device_path, Uint16 *vendor, Uint16 *product, Uint16 *version, int *class) { - struct udev_enumerate *enumerate = NULL; - struct udev_list_entry *devs = NULL; - struct udev_list_entry *item = NULL; - SDL_bool found = SDL_FALSE; + struct stat statbuf; + char type; + struct udev_device *dev; + const char* val; + int class_temp; - if (_this == NULL) { + if (!_this) { return SDL_FALSE; } - enumerate = _this->syms.udev_enumerate_new(_this->udev); - if (enumerate == NULL) { - SDL_SetError("udev_enumerate_new() failed"); + if (stat(device_path, &statbuf) == -1) { return SDL_FALSE; } - _this->syms.udev_enumerate_scan_devices(enumerate); - devs = _this->syms.udev_enumerate_get_list_entry(enumerate); - for (item = devs; item && !found; item = _this->syms.udev_list_entry_get_next(item)) { - const char *path = _this->syms.udev_list_entry_get_name(item); - struct udev_device *dev = _this->syms.udev_device_new_from_syspath(_this->udev, path); - if (dev != NULL) { - const char *val = NULL; - const char *existing_path; + if (S_ISBLK(statbuf.st_mode)) { + type = 'b'; + } + else if (S_ISCHR(statbuf.st_mode)) { + type = 'c'; + } + else { + return SDL_FALSE; + } - existing_path = _this->syms.udev_device_get_devnode(dev); - if (existing_path && SDL_strcmp(device_path, existing_path) == 0) { - found = SDL_TRUE; + dev = _this->syms.udev_device_new_from_devnum(_this->udev, type, statbuf.st_rdev); - val = _this->syms.udev_device_get_property_value(dev, "ID_VENDOR_ID"); - if (val != NULL) { - *vendor = (Uint16)SDL_strtol(val, NULL, 16); - } + if (!dev) { + return SDL_FALSE; + } - val = _this->syms.udev_device_get_property_value(dev, "ID_MODEL_ID"); - if (val != NULL) { - *product = (Uint16)SDL_strtol(val, NULL, 16); - } + val = _this->syms.udev_device_get_property_value(dev, "ID_VENDOR_ID"); + if (val) { + *vendor = (Uint16)SDL_strtol(val, NULL, 16); + } - val = _this->syms.udev_device_get_property_value(dev, "ID_REVISION"); - if (val != NULL) { - *version = (Uint16)SDL_strtol(val, NULL, 16); - } - } - _this->syms.udev_device_unref(dev); - } + val = _this->syms.udev_device_get_property_value(dev, "ID_MODEL_ID"); + if (val) { + *product = (Uint16)SDL_strtol(val, NULL, 16); } - _this->syms.udev_enumerate_unref(enumerate); - return found; + val = _this->syms.udev_device_get_property_value(dev, "ID_REVISION"); + if (val) { + *version = (Uint16)SDL_strtol(val, NULL, 16); + } + + class_temp = device_class(dev); + if (class_temp) { + *class = class_temp; + } + + _this->syms.udev_device_unref(dev); + + return SDL_TRUE; } void SDL_UDEV_UnloadLibrary(void) { - if (_this == NULL) { + if (!_this) { return; } - if (_this->udev_handle != NULL) { + if (_this->udev_handle) { SDL_UnloadObject(_this->udev_handle); _this->udev_handle = NULL; } @@ -291,7 +299,7 @@ int SDL_UDEV_LoadLibrary(void) { int retval = 0, i; - if (_this == NULL) { + if (!_this) { return SDL_SetError("UDEV not initialized"); } @@ -302,9 +310,9 @@ int SDL_UDEV_LoadLibrary(void) #ifdef SDL_UDEV_DYNAMIC /* Check for the build environment's libudev first */ - if (_this->udev_handle == NULL) { + if (!_this->udev_handle) { _this->udev_handle = SDL_LoadObject(SDL_UDEV_DYNAMIC); - if (_this->udev_handle != NULL) { + if (_this->udev_handle) { retval = SDL_UDEV_load_syms(); if (retval < 0) { SDL_UDEV_UnloadLibrary(); @@ -313,10 +321,10 @@ int SDL_UDEV_LoadLibrary(void) } #endif - if (_this->udev_handle == NULL) { + if (!_this->udev_handle) { for (i = 0; i < SDL_arraysize(SDL_UDEV_LIBS); i++) { _this->udev_handle = SDL_LoadObject(SDL_UDEV_LIBS[i]); - if (_this->udev_handle != NULL) { + if (_this->udev_handle) { retval = SDL_UDEV_load_syms(); if (retval < 0) { SDL_UDEV_UnloadLibrary(); @@ -326,7 +334,7 @@ int SDL_UDEV_LoadLibrary(void) } } - if (_this->udev_handle == NULL) { + if (!_this->udev_handle) { retval = -1; /* Don't call SDL_SetError(): SDL_LoadObject already did. */ } @@ -345,7 +353,7 @@ static void get_caps(struct udev_device *dev, struct udev_device *pdev, const ch SDL_memset(bitmask, 0, bitmask_len * sizeof(*bitmask)); value = _this->syms.udev_device_get_sysattr_value(pdev, attr); - if (value == NULL) { + if (!value) { return; } @@ -379,7 +387,7 @@ static int guess_device_class(struct udev_device *dev) while (pdev && !_this->syms.udev_device_get_sysattr_value(pdev, "capabilities/ev")) { pdev = _this->syms.udev_device_get_parent_with_subsystem_devtype(pdev, "input", NULL); } - if (pdev == NULL) { + if (!pdev) { return 0; } @@ -394,43 +402,40 @@ static int guess_device_class(struct udev_device *dev) &bitmask_rel[0]); } -static void device_event(SDL_UDEV_deviceevent type, struct udev_device *dev) +static int device_class(struct udev_device *dev) { const char *subsystem; const char *val = NULL; int devclass = 0; - const char *path; - SDL_UDEV_CallbackList *item; - path = _this->syms.udev_device_get_devnode(dev); - if (path == NULL) { - return; + subsystem = _this->syms.udev_device_get_subsystem(dev); + if (!subsystem) { + return 0; } - subsystem = _this->syms.udev_device_get_subsystem(dev); if (SDL_strcmp(subsystem, "sound") == 0) { devclass = SDL_UDEV_DEVICE_SOUND; } else if (SDL_strcmp(subsystem, "input") == 0) { /* udev rules reference: http://cgit.freedesktop.org/systemd/systemd/tree/src/udev/udev-builtin-input_id.c */ val = _this->syms.udev_device_get_property_value(dev, "ID_INPUT_JOYSTICK"); - if (val != NULL && SDL_strcmp(val, "1") == 0) { + if (val && SDL_strcmp(val, "1") == 0) { devclass |= SDL_UDEV_DEVICE_JOYSTICK; } val = _this->syms.udev_device_get_property_value(dev, "ID_INPUT_ACCELEROMETER"); if (SDL_GetHintBoolean(SDL_HINT_ACCELEROMETER_AS_JOYSTICK, SDL_TRUE) && - val != NULL && SDL_strcmp(val, "1") == 0) { + val && SDL_strcmp(val, "1") == 0) { devclass |= SDL_UDEV_DEVICE_JOYSTICK; } val = _this->syms.udev_device_get_property_value(dev, "ID_INPUT_MOUSE"); - if (val != NULL && SDL_strcmp(val, "1") == 0) { + if (val && SDL_strcmp(val, "1") == 0) { devclass |= SDL_UDEV_DEVICE_MOUSE; } val = _this->syms.udev_device_get_property_value(dev, "ID_INPUT_TOUCHSCREEN"); - if (val != NULL && SDL_strcmp(val, "1") == 0) { + if (val && SDL_strcmp(val, "1") == 0) { devclass |= SDL_UDEV_DEVICE_TOUCHSCREEN; } @@ -441,34 +446,49 @@ static void device_event(SDL_UDEV_deviceevent type, struct udev_device *dev) Ref: http://cgit.freedesktop.org/systemd/systemd/tree/src/udev/udev-builtin-input_id.c#n183 */ val = _this->syms.udev_device_get_property_value(dev, "ID_INPUT_KEY"); - if (val != NULL && SDL_strcmp(val, "1") == 0) { + if (val && SDL_strcmp(val, "1") == 0) { devclass |= SDL_UDEV_DEVICE_KEYBOARD; } if (devclass == 0) { /* Fall back to old style input classes */ val = _this->syms.udev_device_get_property_value(dev, "ID_CLASS"); - if (val != NULL) { + if (val) { if (SDL_strcmp(val, "joystick") == 0) { devclass = SDL_UDEV_DEVICE_JOYSTICK; } else if (SDL_strcmp(val, "mouse") == 0) { devclass = SDL_UDEV_DEVICE_MOUSE; } else if (SDL_strcmp(val, "kbd") == 0) { devclass = SDL_UDEV_DEVICE_KEYBOARD; - } else { - return; } } else { /* We could be linked with libudev on a system that doesn't have udev running */ devclass = guess_device_class(dev); } } - } else { + } + + return devclass; +} + +static void device_event(SDL_UDEV_deviceevent type, struct udev_device *dev) +{ + int devclass = 0; + const char *path; + SDL_UDEV_CallbackList *item; + + path = _this->syms.udev_device_get_devnode(dev); + if (!path) { return; } + devclass = device_class(dev); + if (!devclass) { + return; + } + /* Process callbacks */ - for (item = _this->first; item != NULL; item = item->next) { + for (item = _this->first; item; item = item->next) { item->callback(type, devclass, path); } } @@ -478,13 +498,13 @@ void SDL_UDEV_Poll(void) struct udev_device *dev = NULL; const char *action = NULL; - if (_this == NULL) { + if (!_this) { return; } while (SDL_UDEV_hotplug_update_available()) { dev = _this->syms.udev_monitor_receive_device(_this->udev_mon); - if (dev == NULL) { + if (!dev) { break; } action = _this->syms.udev_device_get_action(dev); @@ -505,13 +525,13 @@ int SDL_UDEV_AddCallback(SDL_UDEV_Callback cb) { SDL_UDEV_CallbackList *item; item = (SDL_UDEV_CallbackList *)SDL_calloc(1, sizeof(SDL_UDEV_CallbackList)); - if (item == NULL) { + if (!item) { return SDL_OutOfMemory(); } item->callback = cb; - if (_this->last == NULL) { + if (!_this->last) { _this->first = _this->last = item; } else { _this->last->next = item; @@ -526,14 +546,14 @@ void SDL_UDEV_DelCallback(SDL_UDEV_Callback cb) SDL_UDEV_CallbackList *item; SDL_UDEV_CallbackList *prev = NULL; - if (_this == NULL) { + if (!_this) { return; } - for (item = _this->first; item != NULL; item = item->next) { + for (item = _this->first; item; item = item->next) { /* found it, remove it. */ if (item->callback == cb) { - if (prev != NULL) { + if (prev) { prev->next = item->next; } else { SDL_assert(_this->first == item); diff --git a/thirdparty/SDL/src/core/linux/SDL_udev.h b/thirdparty/SDL/src/core/linux/SDL_udev.h index b8920b71c..1489a852b 100644 --- a/thirdparty/SDL/src/core/linux/SDL_udev.h +++ b/thirdparty/SDL/src/core/linux/SDL_udev.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -24,7 +24,7 @@ #ifndef SDL_udev_h_ #define SDL_udev_h_ -#if HAVE_LIBUDEV_H && HAVE_LINUX_INPUT_H +#if defined(HAVE_LIBUDEV_H) && defined(HAVE_LINUX_INPUT_H) #ifndef SDL_USE_LIBUDEV #define SDL_USE_LIBUDEV 1 @@ -103,7 +103,7 @@ extern void SDL_UDEV_UnloadLibrary(void); extern int SDL_UDEV_LoadLibrary(void); extern void SDL_UDEV_Poll(void); extern void SDL_UDEV_Scan(void); -extern SDL_bool SDL_UDEV_GetProductInfo(const char *device_path, Uint16 *vendor, Uint16 *product, Uint16 *version); +extern SDL_bool SDL_UDEV_GetProductInfo(const char *device_path, Uint16 *vendor, Uint16 *product, Uint16 *version, int *class); extern int SDL_UDEV_AddCallback(SDL_UDEV_Callback cb); extern void SDL_UDEV_DelCallback(SDL_UDEV_Callback cb); extern const SDL_UDEV_Symbols *SDL_UDEV_GetUdevSyms(void); diff --git a/thirdparty/SDL/src/core/openbsd/SDL_wscons.h b/thirdparty/SDL/src/core/openbsd/SDL_wscons.h index e53e57423..40e102d00 100644 --- a/thirdparty/SDL/src/core/openbsd/SDL_wscons.h +++ b/thirdparty/SDL/src/core/openbsd/SDL_wscons.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/core/openbsd/SDL_wscons_kbd.c b/thirdparty/SDL/src/core/openbsd/SDL_wscons_kbd.c index 583c42014..0a79cb711 100644 --- a/thirdparty/SDL/src/core/openbsd/SDL_wscons_kbd.c +++ b/thirdparty/SDL/src/core/openbsd/SDL_wscons_kbd.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -423,7 +423,7 @@ static SDL_WSCONS_input_data *SDL_WSCONS_Init_Keyboard(const char *dev) #endif SDL_WSCONS_input_data *input = (SDL_WSCONS_input_data *)SDL_calloc(1, sizeof(SDL_WSCONS_input_data)); - if (input == NULL) { + if (!input) { return input; } input->fd = open(dev, O_RDWR | O_NONBLOCK | O_CLOEXEC); @@ -433,7 +433,7 @@ static SDL_WSCONS_input_data *SDL_WSCONS_Init_Keyboard(const char *dev) return NULL; } input->keymap.map = SDL_calloc(sizeof(struct wscons_keymap), KS_NUMKEYCODES); - if (input->keymap.map == NULL) { + if (!input->keymap.map) { free(input); return NULL; } @@ -449,7 +449,7 @@ static SDL_WSCONS_input_data *SDL_WSCONS_Init_Keyboard(const char *dev) return input; } -void SDL_WSCONS_Init() +void SDL_WSCONS_Init(void) { inputs[0] = SDL_WSCONS_Init_Keyboard("/dev/wskbd0"); inputs[1] = SDL_WSCONS_Init_Keyboard("/dev/wskbd1"); @@ -460,7 +460,7 @@ void SDL_WSCONS_Init() return; } -void SDL_WSCONS_Quit() +void SDL_WSCONS_Quit(void) { int i = 0; SDL_WSCONS_input_data *input = NULL; @@ -583,7 +583,7 @@ static void updateKeyboard(SDL_WSCONS_input_data *input) keysym_t *group; keysym_t ksym, result; - if (input == NULL) { + if (!input) { return; } if ((n = read(input->fd, events, sizeof(events))) > 0) { @@ -921,13 +921,13 @@ static void updateKeyboard(SDL_WSCONS_input_data *input) } } -void SDL_WSCONS_PumpEvents() +void SDL_WSCONS_PumpEvents(void) { int i = 0; for (i = 0; i < 4; i++) { updateKeyboard(inputs[i]); } - if (mouseInputData != NULL) { + if (mouseInputData) { updateMouse(mouseInputData); } } diff --git a/thirdparty/SDL/src/core/openbsd/SDL_wscons_mouse.c b/thirdparty/SDL/src/core/openbsd/SDL_wscons_mouse.c index 617cea7bc..5a8664c03 100644 --- a/thirdparty/SDL/src/core/openbsd/SDL_wscons_mouse.c +++ b/thirdparty/SDL/src/core/openbsd/SDL_wscons_mouse.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -42,7 +42,7 @@ SDL_WSCONS_mouse_input_data *SDL_WSCONS_Init_Mouse() #endif SDL_WSCONS_mouse_input_data *mouseInputData = SDL_calloc(1, sizeof(SDL_WSCONS_mouse_input_data)); - if (mouseInputData == NULL) { + if (!mouseInputData) { return NULL; } mouseInputData->fd = open("/dev/wsmouse", O_RDWR | O_NONBLOCK | O_CLOEXEC); @@ -126,7 +126,7 @@ void updateMouse(SDL_WSCONS_mouse_input_data *inputData) void SDL_WSCONS_Quit_Mouse(SDL_WSCONS_mouse_input_data *inputData) { - if (inputData == NULL) { + if (!inputData) { return; } close(inputData->fd); diff --git a/thirdparty/SDL/src/core/os2/SDL_os2.c b/thirdparty/SDL/src/core/os2/SDL_os2.c index 66d15a435..76ad59d4a 100644 --- a/thirdparty/SDL/src/core/os2/SDL_os2.c +++ b/thirdparty/SDL/src/core/os2/SDL_os2.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/core/os2/SDL_os2.h b/thirdparty/SDL/src/core/os2/SDL_os2.h index a7deec2f6..9f88c70c4 100644 --- a/thirdparty/SDL/src/core/os2/SDL_os2.h +++ b/thirdparty/SDL/src/core/os2/SDL_os2.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/core/os2/geniconv/geniconv.c b/thirdparty/SDL/src/core/os2/geniconv/geniconv.c index f85e8b3ad..df9c7c78d 100644 --- a/thirdparty/SDL/src/core/os2/geniconv/geniconv.c +++ b/thirdparty/SDL/src/core/os2/geniconv/geniconv.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/core/os2/geniconv/geniconv.h b/thirdparty/SDL/src/core/os2/geniconv/geniconv.h index 5c3f9592b..463255b96 100644 --- a/thirdparty/SDL/src/core/os2/geniconv/geniconv.h +++ b/thirdparty/SDL/src/core/os2/geniconv/geniconv.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/core/os2/geniconv/os2cp.c b/thirdparty/SDL/src/core/os2/geniconv/os2cp.c index ae8bec7b4..36d808eed 100644 --- a/thirdparty/SDL/src/core/os2/geniconv/os2cp.c +++ b/thirdparty/SDL/src/core/os2/geniconv/os2cp.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -357,7 +357,7 @@ unsigned long os2cpFromName(char *cp) PCHAR pcEnd; CHAR acBuf[64]; - if (cp == NULL) { + if (!cp) { ULONG aulCP[3]; ULONG cCP; return (DosQueryCp(sizeof(aulCP), aulCP, &cCP) != NO_ERROR)? 0 : aulCP[0]; @@ -368,7 +368,7 @@ unsigned long os2cpFromName(char *cp) } pcEnd = SDL_strchr(cp, ' '); - if (pcEnd == NULL) { + if (!pcEnd) { pcEnd = SDL_strchr(cp, '\0'); } ulNext = pcEnd - cp; diff --git a/thirdparty/SDL/src/core/os2/geniconv/os2cp.h b/thirdparty/SDL/src/core/os2/geniconv/os2cp.h index 7f5be1050..7024e9daf 100644 --- a/thirdparty/SDL/src/core/os2/geniconv/os2cp.h +++ b/thirdparty/SDL/src/core/os2/geniconv/os2cp.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/core/os2/geniconv/os2iconv.c b/thirdparty/SDL/src/core/os2/geniconv/os2iconv.c index 0e75484cf..4c6a024e2 100644 --- a/thirdparty/SDL/src/core/os2/geniconv/os2iconv.c +++ b/thirdparty/SDL/src/core/os2/geniconv/os2iconv.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -76,7 +76,7 @@ static int _createUconvObj(const char *code, UconvObject *uobj) const unsigned char *ch = (const unsigned char *)code; - if (code == NULL) + if (!code) uc_code[0] = 0; else { for (i = 0; i < MAX_CP_NAME_LEN; i++) { @@ -119,10 +119,10 @@ iconv_t _System os2_iconv_open(const char* tocode, const char* fromcode) int rc; iuconv_obj *iuobj; - if (tocode == NULL) { + if (!tocode) { tocode = ""; } - if (fromcode == NULL) { + if (!fromcode) { fromcode = ""; } @@ -169,7 +169,7 @@ size_t _System os2_iconv(iconv_t cd, int rc; size_t ret = (size_t)(-1); - if (uo_tocode == NULL && uo_fromcode == NULL) { + if (!uo_tocode && !uo_fromcode) { uc_buf_len = SDL_min(*inbytesleft, *outbytesleft); SDL_memcpy(*outbuf, *inbuf, uc_buf_len); *inbytesleft -= uc_buf_len; diff --git a/thirdparty/SDL/src/core/os2/geniconv/sys2utf8.c b/thirdparty/SDL/src/core/os2/geniconv/sys2utf8.c index 1c8be8a17..75dd7dd64 100644 --- a/thirdparty/SDL/src/core/os2/geniconv/sys2utf8.c +++ b/thirdparty/SDL/src/core/os2/geniconv/sys2utf8.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -95,7 +95,7 @@ char *StrUTF8New(int to_utf8, char *str, int c_str) int c_newstr = (((c_str > 4) ? c_str : 4) + 1) * 2; char * newstr = (char *) SDL_malloc(c_newstr); - if (newstr == NULL) { + if (!newstr) { return NULL; } diff --git a/thirdparty/SDL/src/core/os2/geniconv/test.c b/thirdparty/SDL/src/core/os2/geniconv/test.c index 2214b9789..2fe19acef 100644 --- a/thirdparty/SDL/src/core/os2/geniconv/test.c +++ b/thirdparty/SDL/src/core/os2/geniconv/test.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -27,7 +27,7 @@ int main(void) { char acBuf[128]; - char *inbuf = " - "; /* KOI8-R string */ + char *inbuf = "\xf4\xc5\xd3\xd4\x20\x2d\x20\xd0\xd2\xcf\xd7\xc5\xd2\xcb\xc1"; /* KOI8-R encoding of "Тест - проверка" */ size_t inbytesleft = strlen(inbuf); char *outbuf = acBuf; size_t outbytesleft = sizeof(acBuf); diff --git a/thirdparty/SDL/src/core/unix/SDL_poll.c b/thirdparty/SDL/src/core/unix/SDL_poll.c index 9254981d5..1a34c57d2 100644 --- a/thirdparty/SDL/src/core/unix/SDL_poll.c +++ b/thirdparty/SDL/src/core/unix/SDL_poll.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/core/unix/SDL_poll.h b/thirdparty/SDL/src/core/unix/SDL_poll.h index f86267352..67e52ecda 100644 --- a/thirdparty/SDL/src/core/unix/SDL_poll.h +++ b/thirdparty/SDL/src/core/unix/SDL_poll.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/core/windows/SDL_directx.h b/thirdparty/SDL/src/core/windows/SDL_directx.h index 6c2ad7da1..98c63ec37 100644 --- a/thirdparty/SDL/src/core/windows/SDL_directx.h +++ b/thirdparty/SDL/src/core/windows/SDL_directx.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/core/windows/SDL_hid.c b/thirdparty/SDL/src/core/windows/SDL_hid.c index 40829502e..60b9d14eb 100644 --- a/thirdparty/SDL/src/core/windows/SDL_hid.c +++ b/thirdparty/SDL/src/core/windows/SDL_hid.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -58,9 +58,9 @@ int WIN_LoadHIDDLL(void) SDL_HidP_GetValueCaps = (HidP_GetValueCaps_t)GetProcAddress(s_pHIDDLL, "HidP_GetValueCaps"); SDL_HidP_MaxDataListLength = (HidP_MaxDataListLength_t)GetProcAddress(s_pHIDDLL, "HidP_MaxDataListLength"); SDL_HidP_GetData = (HidP_GetData_t)GetProcAddress(s_pHIDDLL, "HidP_GetData"); - if (SDL_HidD_GetManufacturerString == NULL || SDL_HidD_GetProductString == NULL || - SDL_HidP_GetCaps == NULL || SDL_HidP_GetButtonCaps == NULL || - SDL_HidP_GetValueCaps == NULL || SDL_HidP_MaxDataListLength == NULL || SDL_HidP_GetData == NULL) { + if (!SDL_HidD_GetManufacturerString || !SDL_HidD_GetProductString || + !SDL_HidP_GetCaps || !SDL_HidP_GetButtonCaps || + !SDL_HidP_GetValueCaps || !SDL_HidP_MaxDataListLength || !SDL_HidP_GetData) { WIN_UnloadHIDDLL(); return -1; } diff --git a/thirdparty/SDL/src/core/windows/SDL_hid.h b/thirdparty/SDL/src/core/windows/SDL_hid.h index d1348b7a5..f75ea24af 100644 --- a/thirdparty/SDL/src/core/windows/SDL_hid.h +++ b/thirdparty/SDL/src/core/windows/SDL_hid.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/core/windows/SDL_immdevice.c b/thirdparty/SDL/src/core/windows/SDL_immdevice.c index d2900f9cc..a8e8b458a 100644 --- a/thirdparty/SDL/src/core/windows/SDL_immdevice.c +++ b/thirdparty/SDL/src/core/windows/SDL_immdevice.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if (defined(__WIN32__) || defined(__GDK__)) && HAVE_MMDEVICEAPI_H +#if (defined(__WIN32__) || defined(__GDK__)) && defined(HAVE_MMDEVICEAPI_H) #include "SDL_windows.h" #include "SDL_immdevice.h" @@ -136,7 +136,7 @@ static void SDL_IMMDevice_Add(const SDL_bool iscapture, const char *devname, WAV } devidlist = (DevIdList *)SDL_malloc(sizeof(*devidlist)); - if (devidlist == NULL) { + if (!devidlist) { return; /* oh well. */ } @@ -364,7 +364,7 @@ int SDL_IMMDevice_Get(LPCWSTR devid, IMMDevice **device, SDL_bool iscapture) SDL_assert(device != NULL); while (SDL_TRUE) { - if (devid == NULL) { + if (!devid) { const EDataFlow dataflow = iscapture ? eCapture : eRender; ret = IMMDeviceEnumerator_GetDefaultAudioEndpoint(enumerator, dataflow, SDL_IMMDevice_role, device); } else { @@ -443,7 +443,7 @@ static void EnumerateEndpointsForFlow(const SDL_bool iscapture) } items = (EndpointItem *)SDL_calloc(total, sizeof(EndpointItem)); - if (items == NULL) { + if (!items) { return; /* oh well. */ } @@ -500,7 +500,7 @@ int SDL_IMMDevice_GetDefaultAudioInfo(char **name, SDL_AudioSpec *spec, int isca return WIN_SetErrorFromHRESULT("WASAPI can't find default audio endpoint", ret); } - if (name == NULL) { + if (!name) { name = &filler; } diff --git a/thirdparty/SDL/src/core/windows/SDL_immdevice.h b/thirdparty/SDL/src/core/windows/SDL_immdevice.h index e5b7008cb..b15b90335 100644 --- a/thirdparty/SDL/src/core/windows/SDL_immdevice.h +++ b/thirdparty/SDL/src/core/windows/SDL_immdevice.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/core/windows/SDL_windows.c b/thirdparty/SDL/src/core/windows/SDL_windows.c index 350198eb7..1da941813 100644 --- a/thirdparty/SDL/src/core/windows/SDL_windows.c +++ b/thirdparty/SDL/src/core/windows/SDL_windows.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -285,7 +285,7 @@ char *WIN_LookupAudioDeviceName(const WCHAR *name, const GUID *guid) } strw = (WCHAR *)SDL_malloc(len + sizeof(WCHAR)); - if (strw == NULL) { + if (!strw) { RegCloseKey(hkey); return WIN_StringToUTF8(name); /* oh well. */ } diff --git a/thirdparty/SDL/src/core/windows/SDL_windows.h b/thirdparty/SDL/src/core/windows/SDL_windows.h index 3842e082b..2bd6257d1 100644 --- a/thirdparty/SDL/src/core/windows/SDL_windows.h +++ b/thirdparty/SDL/src/core/windows/SDL_windows.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -36,7 +36,7 @@ #endif #undef WINVER #undef _WIN32_WINNT -#if defined(SDL_VIDEO_RENDER_D3D12) +#if SDL_VIDEO_RENDER_D3D12 #define _WIN32_WINNT 0xA00 /* For D3D12, 0xA00 is required */ #elif defined(HAVE_SHELLSCALINGAPI_H) #define _WIN32_WINNT 0x603 /* For DPI support */ @@ -92,16 +92,6 @@ #include #include /* for REFIID with broken mingw.org headers */ -/* Older Visual C++ headers don't have the Win64-compatible typedefs... */ -#if defined(_MSC_VER) && (_MSC_VER <= 1200) -#ifndef DWORD_PTR -#define DWORD_PTR DWORD -#endif -#ifndef LONG_PTR -#define LONG_PTR LONG -#endif -#endif - #include "SDL_rect.h" /* Routines to convert from UTF8 to native Windows text */ diff --git a/thirdparty/SDL/src/core/windows/SDL_xinput.c b/thirdparty/SDL/src/core/windows/SDL_xinput.c index 1ebefcf2c..053473e0c 100644 --- a/thirdparty/SDL/src/core/windows/SDL_xinput.c +++ b/thirdparty/SDL/src/core/windows/SDL_xinput.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -30,6 +30,7 @@ extern "C" { XInputGetState_t SDL_XInputGetState = NULL; XInputSetState_t SDL_XInputSetState = NULL; XInputGetCapabilities_t SDL_XInputGetCapabilities = NULL; +XInputGetCapabilitiesEx_t SDL_XInputGetCapabilitiesEx = NULL; XInputGetBatteryInformation_t SDL_XInputGetBatteryInformation = NULL; DWORD SDL_XInputVersion = 0; @@ -106,13 +107,15 @@ int WIN_LoadXInputDLL(void) /* 100 is the ordinal for _XInputGetStateEx, which returns the same struct as XinputGetState, but with extra data in wButtons for the guide button, we think... */ SDL_XInputGetState = (XInputGetState_t)GetProcAddress(s_pXInputDLL, (LPCSTR)100); - if (SDL_XInputGetState == NULL) { + if (!SDL_XInputGetState) { SDL_XInputGetState = (XInputGetState_t)GetProcAddress(s_pXInputDLL, "XInputGetState"); } SDL_XInputSetState = (XInputSetState_t)GetProcAddress(s_pXInputDLL, "XInputSetState"); SDL_XInputGetCapabilities = (XInputGetCapabilities_t)GetProcAddress(s_pXInputDLL, "XInputGetCapabilities"); + /* 108 is the ordinal for _XInputGetCapabilitiesEx, which additionally returns VID/PID of the controller. */ + SDL_XInputGetCapabilitiesEx = (XInputGetCapabilitiesEx_t)GetProcAddress(s_pXInputDLL, (LPCSTR)108); SDL_XInputGetBatteryInformation = (XInputGetBatteryInformation_t)GetProcAddress(s_pXInputDLL, "XInputGetBatteryInformation"); - if (SDL_XInputGetState == NULL || SDL_XInputSetState == NULL || SDL_XInputGetCapabilities == NULL) { + if (!SDL_XInputGetState || !SDL_XInputSetState || !SDL_XInputGetCapabilities) { WIN_UnloadXInputDLL(); return -1; } diff --git a/thirdparty/SDL/src/core/windows/SDL_xinput.h b/thirdparty/SDL/src/core/windows/SDL_xinput.h index acdd8d5d4..efdb86282 100644 --- a/thirdparty/SDL/src/core/windows/SDL_xinput.h +++ b/thirdparty/SDL/src/core/windows/SDL_xinput.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -28,6 +28,7 @@ #ifdef HAVE_XINPUT_H #if defined(__XBOXONE__) || defined(__XBOXSERIES__) /* Xbox supports an XInput wrapper which is a C++-only header... */ +#include /* Required to compile with recent MSVC... */ #include using namespace XInputOnGameInput; #else @@ -44,6 +45,9 @@ using namespace XInputOnGameInput; #ifndef XINPUT_CAPS_FFB_SUPPORTED #define XINPUT_CAPS_FFB_SUPPORTED 0x0001 #endif +#ifndef XINPUT_CAPS_WIRELESS +#define XINPUT_CAPS_WIRELESS 0x0002 +#endif #ifndef XINPUT_DEVSUBTYPE_UNKNOWN #define XINPUT_DEVSUBTYPE_UNKNOWN 0x00 @@ -163,28 +167,8 @@ extern "C" { /* typedef's for XInput structs we use */ -#ifndef HAVE_XINPUT_GAMEPAD_EX -typedef struct -{ - WORD wButtons; - BYTE bLeftTrigger; - BYTE bRightTrigger; - SHORT sThumbLX; - SHORT sThumbLY; - SHORT sThumbRX; - SHORT sThumbRY; - DWORD dwPaddingReserved; -} XINPUT_GAMEPAD_EX; -#endif - -#ifndef HAVE_XINPUT_STATE_EX -typedef struct -{ - DWORD dwPacketNumber; - XINPUT_GAMEPAD_EX Gamepad; -} XINPUT_STATE_EX; -#endif +/* This is the same as XINPUT_BATTERY_INFORMATION, but always defined instead of just if WIN32_WINNT >= _WIN32_WINNT_WIN8 */ typedef struct { BYTE BatteryType; @@ -204,6 +188,12 @@ typedef struct SHORT sThumbRY; } XINPUT_GAMEPAD; +typedef struct +{ + DWORD dwPacketNumber; + XINPUT_GAMEPAD Gamepad; +} XINPUT_STATE; + typedef struct { WORD wLeftMotorSpeed; @@ -221,10 +211,21 @@ typedef struct #endif /* HAVE_XINPUT_H */ +/* This struct is not defined in XInput headers. */ +typedef struct +{ + XINPUT_CAPABILITIES Capabilities; + WORD VendorId; + WORD ProductId; + WORD ProductVersion; + WORD unk1; + DWORD unk2; +} SDL_XINPUT_CAPABILITIES_EX; + /* Forward decl's for XInput API's we load dynamically and use if available */ typedef DWORD(WINAPI *XInputGetState_t)( DWORD dwUserIndex, /* [in] Index of the gamer associated with the device */ - XINPUT_STATE_EX *pState /* [out] Receives the current state */ + XINPUT_STATE *pState /* [out] Receives the current state */ ); typedef DWORD(WINAPI *XInputSetState_t)( @@ -238,6 +239,14 @@ typedef DWORD(WINAPI *XInputGetCapabilities_t)( XINPUT_CAPABILITIES *pCapabilities /* [out] Receives the capabilities */ ); +/* Only available in XInput 1.4 that is shipped with Windows 8 and newer. */ +typedef DWORD(WINAPI *XInputGetCapabilitiesEx_t)( + DWORD dwReserved, /* [in] Must be 1 */ + DWORD dwUserIndex, /* [in] Index of the gamer associated with the device */ + DWORD dwFlags, /* [in] Input flags that identify the device type */ + SDL_XINPUT_CAPABILITIES_EX *pCapabilitiesEx /* [out] Receives the capabilities */ +); + typedef DWORD(WINAPI *XInputGetBatteryInformation_t)( DWORD dwUserIndex, BYTE devType, @@ -249,6 +258,7 @@ extern void WIN_UnloadXInputDLL(void); extern XInputGetState_t SDL_XInputGetState; extern XInputSetState_t SDL_XInputSetState; extern XInputGetCapabilities_t SDL_XInputGetCapabilities; +extern XInputGetCapabilitiesEx_t SDL_XInputGetCapabilitiesEx; extern XInputGetBatteryInformation_t SDL_XInputGetBatteryInformation; extern DWORD SDL_XInputVersion; /* ((major << 16) & 0xFF00) | (minor & 0xFF) */ @@ -260,6 +270,7 @@ extern DWORD SDL_XInputVersion; /* ((major << 16) & 0xFF00) | (minor & 0xFF) */ #define XINPUTGETSTATE SDL_XInputGetState #define XINPUTSETSTATE SDL_XInputSetState #define XINPUTGETCAPABILITIES SDL_XInputGetCapabilities +#define XINPUTGETCAPABILITIESEX SDL_XInputGetCapabilitiesEx #define XINPUTGETBATTERYINFORMATION SDL_XInputGetBatteryInformation #endif /* SDL_xinput_h_ */ diff --git a/thirdparty/SDL/src/core/winrt/SDL_winrtapp_common.cpp b/thirdparty/SDL/src/core/winrt/SDL_winrtapp_common.cpp index 52618b2bc..9d1649237 100644 --- a/thirdparty/SDL/src/core/winrt/SDL_winrtapp_common.cpp +++ b/thirdparty/SDL/src/core/winrt/SDL_winrtapp_common.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/core/winrt/SDL_winrtapp_common.h b/thirdparty/SDL/src/core/winrt/SDL_winrtapp_common.h index e1a89df01..fdc8294da 100644 --- a/thirdparty/SDL/src/core/winrt/SDL_winrtapp_common.h +++ b/thirdparty/SDL/src/core/winrt/SDL_winrtapp_common.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/core/winrt/SDL_winrtapp_direct3d.cpp b/thirdparty/SDL/src/core/winrt/SDL_winrtapp_direct3d.cpp index 5fe6f3314..0115c5da4 100644 --- a/thirdparty/SDL/src/core/winrt/SDL_winrtapp_direct3d.cpp +++ b/thirdparty/SDL/src/core/winrt/SDL_winrtapp_direct3d.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,12 +20,6 @@ */ #include "../../SDL_internal.h" -/* Standard C++11 includes */ -#include -#include -#include -using namespace std; - /* Windows includes */ #include "ppltasks.h" using namespace concurrency; @@ -39,7 +33,7 @@ using namespace Windows::System; using namespace Windows::UI::Core; using namespace Windows::UI::Input; -#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP +#if SDL_WINAPI_FAMILY_PHONE using namespace Windows::Phone::UI::Input; #endif @@ -64,7 +58,7 @@ extern "C" { #include "SDL_winrtapp_common.h" #include "SDL_winrtapp_direct3d.h" -#if SDL_VIDEO_RENDER_D3D11 && !SDL_RENDER_DISABLED +#if SDL_VIDEO_RENDER_D3D11 /* Calling IDXGIDevice3::Trim on the active Direct3D 11.x device is necessary * when Windows 8.1 apps are about to get suspended. */ @@ -126,7 +120,7 @@ static void WINRT_ProcessWindowSizeChange() // TODO: Pass an SDL_Window-identify int w = WINRT_DIPS_TO_PHYSICAL_PIXELS(data->coreWindow->Bounds.Width); int h = WINRT_DIPS_TO_PHYSICAL_PIXELS(data->coreWindow->Bounds.Height); -#if (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) && (NTDDI_VERSION == NTDDI_WIN8) +#if SDL_WINAPI_FAMILY_PHONE && (NTDDI_VERSION == NTDDI_WIN8) /* WinPhone 8.0 always keeps its native window size in portrait, regardless of orientation. This changes in WinPhone 8.1, in which the native window's size changes along with @@ -227,7 +221,7 @@ void SDL_WinRTApp::OnOrientationChanged(Object ^ sender) WINRT_ProcessWindowSizeChange(); -#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP +#if SDL_WINAPI_FAMILY_PHONE // HACK: Make sure that orientation changes // lead to the Direct3D renderer's viewport getting updated: // @@ -273,7 +267,7 @@ void SDL_WinRTApp::SetWindow(CoreWindow ^ window) window->Closed += ref new TypedEventHandler(this, &SDL_WinRTApp::OnWindowClosed); -#if WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP +#if !SDL_WINAPI_FAMILY_PHONE window->PointerCursor = ref new CoreCursor(CoreCursorType::Arrow, 0); #endif @@ -295,7 +289,7 @@ void SDL_WinRTApp::SetWindow(CoreWindow ^ window) window->PointerWheelChanged += ref new TypedEventHandler(this, &SDL_WinRTApp::OnPointerWheelChanged); -#if WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP +#if !SDL_WINAPI_FAMILY_PHONE // Retrieves relative-only mouse movements: Windows::Devices::Input::MouseDevice::GetForCurrentView()->MouseMoved += ref new TypedEventHandler(this, &SDL_WinRTApp::OnMouseMoved); @@ -313,7 +307,7 @@ void SDL_WinRTApp::SetWindow(CoreWindow ^ window) #if NTDDI_VERSION >= NTDDI_WIN10 Windows::UI::Core::SystemNavigationManager::GetForCurrentView()->BackRequested += ref new EventHandler(this, &SDL_WinRTApp::OnBackButtonPressed); -#elif WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP +#elif SDL_WINAPI_FAMILY_PHONE HardwareButtons::BackPressed += ref new EventHandler(this, &SDL_WinRTApp::OnBackButtonPressed); #endif @@ -348,7 +342,7 @@ void SDL_WinRTApp::Run() // representation of command line arguments. int argc = 1; char **argv = (char **)SDL_malloc(2 * sizeof(*argv)); - if (argv == NULL) { + if (!argv) { return; } argv[0] = SDL_strdup("WinRTApp"); @@ -555,7 +549,7 @@ void SDL_WinRTApp::OnWindowActivated(CoreWindow ^ sender, WindowActivatedEventAr Don't do it on WinPhone 8.0 though, as CoreWindow's 'PointerPosition' property isn't available. */ -#if (WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP) || (NTDDI_VERSION >= NTDDI_WINBLUE) +#if !SDL_WINAPI_FAMILY_PHONE || (NTDDI_VERSION >= NTDDI_WINBLUE) Point cursorPos = WINRT_TransformCursorPosition(window, sender->PointerPosition, TransformToSDLWindowSize); SDL_SendMouseMotion(window, 0, 0, (int)cursorPos.X, (int)cursorPos.Y); #endif @@ -628,7 +622,7 @@ void SDL_WinRTApp::OnSuspending(Platform::Object ^ sender, SuspendingEventArgs ^ // Let the Direct3D 11 renderer prepare for the app to be backgrounded. // This is necessary for Windows 8.1, possibly elsewhere in the future. // More details at: http://msdn.microsoft.com/en-us/library/windows/apps/Hh994929.aspx -#if SDL_VIDEO_RENDER_D3D11 && !SDL_RENDER_DISABLED +#if SDL_VIDEO_RENDER_D3D11 if (WINRT_GlobalSDLWindow) { SDL_Renderer *renderer = SDL_GetRenderer(WINRT_GlobalSDLWindow); if (renderer && (SDL_strcmp(renderer->info.name, "direct3d11") == 0)) { @@ -762,7 +756,7 @@ void SDL_WinRTApp::OnBackButtonPressed(Platform::Object ^ sender, Windows::UI::C { WINRT_OnBackButtonPressed(args); } -#elif WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP +#elif SDL_WINAPI_FAMILY_PHONE void SDL_WinRTApp::OnBackButtonPressed(Platform::Object ^ sender, Windows::Phone::UI::Input::BackPressedEventArgs ^ args) { diff --git a/thirdparty/SDL/src/core/winrt/SDL_winrtapp_direct3d.h b/thirdparty/SDL/src/core/winrt/SDL_winrtapp_direct3d.h index 0208a6a4d..fcd6ab791 100644 --- a/thirdparty/SDL/src/core/winrt/SDL_winrtapp_direct3d.h +++ b/thirdparty/SDL/src/core/winrt/SDL_winrtapp_direct3d.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -77,7 +77,7 @@ ref class SDL_WinRTApp sealed : public Windows::ApplicationModel::Core::IFramewo #if NTDDI_VERSION >= NTDDI_WIN10 void OnBackButtonPressed(Platform::Object ^ sender, Windows::UI::Core::BackRequestedEventArgs ^ args); -#elif WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP +#elif SDL_WINAPI_FAMILY_PHONE void OnBackButtonPressed(Platform::Object ^ sender, Windows::Phone::UI::Input::BackPressedEventArgs ^ args); #endif diff --git a/thirdparty/SDL/src/core/winrt/SDL_winrtapp_xaml.cpp b/thirdparty/SDL/src/core/winrt/SDL_winrtapp_xaml.cpp index 118f64bb6..9174f0d23 100644 --- a/thirdparty/SDL/src/core/winrt/SDL_winrtapp_xaml.cpp +++ b/thirdparty/SDL/src/core/winrt/SDL_winrtapp_xaml.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -88,7 +88,7 @@ static void WINRT_OnRenderViaXAML(_In_ Platform::Object ^ sender, _In_ Platform: int SDL_WinRTInitXAMLApp(int (*mainFunction)(int, char **), void *backgroundPanelAsIInspectable) { -#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP +#if SDL_WINAPI_FAMILY_PHONE return SDL_SetError("XAML support is not yet available in Windows Phone."); #else // Declare C++/CX namespaces: @@ -143,5 +143,5 @@ int SDL_WinRTInitXAMLApp(int (*mainFunction)(int, char **), void *backgroundPane // All done, for now. return 0; -#endif // WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP / else +#endif // SDL_WINAPI_FAMILY_PHONE / else } diff --git a/thirdparty/SDL/src/core/winrt/SDL_winrtapp_xaml.h b/thirdparty/SDL/src/core/winrt/SDL_winrtapp_xaml.h index 5ee15e899..b41475383 100644 --- a/thirdparty/SDL/src/core/winrt/SDL_winrtapp_xaml.h +++ b/thirdparty/SDL/src/core/winrt/SDL_winrtapp_xaml.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/cpuinfo/SDL_cpuinfo.c b/thirdparty/SDL/src/cpuinfo/SDL_cpuinfo.c index 337ae335a..1664b2e89 100644 --- a/thirdparty/SDL/src/cpuinfo/SDL_cpuinfo.c +++ b/thirdparty/SDL/src/cpuinfo/SDL_cpuinfo.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -57,7 +57,7 @@ #elif defined(__FreeBSD__) && defined(__powerpc__) #include #include -#elif SDL_ALTIVEC_BLITTERS && HAVE_SETJMP +#elif defined(SDL_ALTIVEC_BLITTERS) && defined(HAVE_SETJMP) #include #include #endif @@ -123,7 +123,7 @@ #define CPU_CFG2_LSX (1 << 6) #define CPU_CFG2_LASX (1 << 7) -#if SDL_ALTIVEC_BLITTERS && HAVE_SETJMP && !__MACOSX__ && !__OpenBSD__ && !__FreeBSD__ +#if defined(SDL_ALTIVEC_BLITTERS) && defined(HAVE_SETJMP) && !defined(__MACOSX__) && !defined(__OpenBSD__) && !defined(__FreeBSD__) /* This is the brute force way of detecting instruction sets... the idea is borrowed from the libmpeg2 library - thanks! */ @@ -352,7 +352,7 @@ static int CPU_haveAltiVec(void) elf_aux_info(AT_HWCAP, &cpufeatures, sizeof(cpufeatures)); altivec = cpufeatures & PPC_FEATURE_HAS_ALTIVEC; return altivec; -#elif SDL_ALTIVEC_BLITTERS && HAVE_SETJMP +#elif defined(SDL_ALTIVEC_BLITTERS) && defined(HAVE_SETJMP) void (*handler)(int sig); handler = signal(SIGILL, illegal_instruction); if (setjmp(jmpbuf) == 0) { @@ -468,9 +468,9 @@ static int CPU_haveNEON(void) return IsProcessorFeaturePresent(PF_ARM_NEON_INSTRUCTIONS_AVAILABLE) != 0; #elif (defined(__ARM_ARCH) && (__ARM_ARCH >= 8)) || defined(__aarch64__) return 1; /* ARMv8 always has non-optional NEON support. */ -#elif __VITA__ +#elif defined(__VITA__) return 1; -#elif __3DS__ +#elif defined(__3DS__) return 0; #elif defined(__APPLE__) && defined(__ARM_ARCH) && (__ARM_ARCH >= 7) /* (note that sysctlbyname("hw.optional.neon") doesn't work!) */ @@ -1079,16 +1079,19 @@ int SDL_GetSystemRAM(void) #endif #ifdef HAVE_SYSCTLBYNAME if (SDL_SystemRAM <= 0) { -#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__) || defined(__DragonFly__) -#ifdef HW_REALMEM +#ifdef HW_PHYSMEM64 + /* (64-bit): NetBSD since 2003, OpenBSD */ + int mib[2] = { CTL_HW, HW_PHYSMEM64 }; +#elif defined(HW_REALMEM) + /* (64-bit): FreeBSD since 2005, DragonFly */ int mib[2] = { CTL_HW, HW_REALMEM }; +#elif defined(HW_MEMSIZE) + /* (64-bit): Darwin */ + int mib[2] = { CTL_HW, HW_MEMSIZE }; #else - /* might only report up to 2 GiB */ + /* (32-bit): very old BSD, might only report up to 2 GiB */ int mib[2] = { CTL_HW, HW_PHYSMEM }; -#endif /* HW_REALMEM */ -#else - int mib[2] = { CTL_HW, HW_MEMSIZE }; -#endif /* __FreeBSD__ || __FreeBSD_kernel__ */ +#endif /* HW_PHYSMEM64 */ Uint64 memsize = 0; size_t len = sizeof(memsize); @@ -1198,7 +1201,7 @@ void *SDL_SIMDRealloc(void *mem, const size_t len) ptr = (Uint8 *)SDL_realloc(mem, to_allocate); - if (ptr == NULL) { + if (!ptr) { return NULL; /* Out of memory, bail! */ } @@ -1236,7 +1239,7 @@ void SDL_SIMDFree(void *ptr) #include -int main() +int main(void) { printf("CPU count: %d\n", SDL_GetCPUCount()); printf("CPU type: %s\n", SDL_GetCPUType()); diff --git a/thirdparty/SDL/src/dynapi/SDL2.exports b/thirdparty/SDL/src/dynapi/SDL2.exports index 696e2be9d..5b6718278 100644 --- a/thirdparty/SDL/src/dynapi/SDL2.exports +++ b/thirdparty/SDL/src/dynapi/SDL2.exports @@ -870,3 +870,5 @@ # ++'_SDL_GDKSuspendComplete'.'SDL2.dll'.'SDL_GDKSuspendComplete' ++'_SDL_HasWindowSurface'.'SDL2.dll'.'SDL_HasWindowSurface' ++'_SDL_DestroyWindowSurface'.'SDL2.dll'.'SDL_DestroyWindowSurface' +# ++'_SDL_GDKGetDefaultUser'.'SDL2.dll'.'SDL_GDKGetDefaultUser' +++'_SDL_GameControllerGetSteamHandle'.'SDL2.dll'.'SDL_GameControllerGetSteamHandle' diff --git a/thirdparty/SDL/src/dynapi/SDL_dynapi.c b/thirdparty/SDL/src/dynapi/SDL_dynapi.c index 6151f0148..861f88a55 100644 --- a/thirdparty/SDL/src/dynapi/SDL_dynapi.c +++ b/thirdparty/SDL/src/dynapi/SDL_dynapi.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -195,7 +195,7 @@ static SDL_DYNAPI_jump_table jump_table = { SDL_InitDynamicAPI(); \ ret jump_table.fn args; \ } -#define SDL_DYNAPI_PROC_NO_VARARGS 1 +#define SDL_DYNAPI_PROC_NO_VARARGS #include "SDL_dynapi_procs.h" #undef SDL_DYNAPI_PROC #undef SDL_DYNAPI_PROC_NO_VARARGS @@ -212,7 +212,7 @@ SDL_DYNAPI_VARARGS(static, _DEFAULT, SDL_InitDynamicAPI()) { \ ret jump_table.fn args; \ } -#define SDL_DYNAPI_PROC_NO_VARARGS 1 +#define SDL_DYNAPI_PROC_NO_VARARGS #include "SDL_dynapi_procs.h" #undef SDL_DYNAPI_PROC #undef SDL_DYNAPI_PROC_NO_VARARGS @@ -295,7 +295,7 @@ SDL_DYNAPI_VARARGS_LOGFN_LOGSDLCALLS(Error, ERROR) SDL_DYNAPI_VARARGS_LOGFN_LOGSDLCALLS(Critical, CRITICAL) #define SDL_DYNAPI_PROC(rc,fn,params,args,ret) \ rc SDLCALL fn##_LOGSDLCALLS params { SDL_Log_REAL("SDL2CALL %s", #fn); ret fn##_REAL args; } -#define SDL_DYNAPI_PROC_NO_VARARGS 1 +#define SDL_DYNAPI_PROC_NO_VARARGS #include "SDL_dynapi_procs.h" #undef SDL_DYNAPI_PROC #undef SDL_DYNAPI_PROC_NO_VARARGS @@ -372,7 +372,7 @@ static SDL_INLINE void *get_sdlapi_entry(const char *fname, const char *sym) void *retval = NULL; if (lib) { retval = (void *) GetProcAddress(lib, sym); - if (retval == NULL) { + if (!retval) { FreeLibrary(lib); } } @@ -385,9 +385,9 @@ static SDL_INLINE void *get_sdlapi_entry(const char *fname, const char *sym) { void *lib = dlopen(fname, RTLD_NOW | RTLD_LOCAL); void *retval = NULL; - if (lib != NULL) { + if (lib) { retval = dlsym(lib, sym); - if (retval == NULL) { + if (!retval) { dlclose(lib); } } @@ -505,7 +505,7 @@ static void SDL_InitDynamicAPI(void) /* SDL_AtomicLock calls SDL mutex functions to emulate if SDL_ATOMIC_DISABLED, which we can't do here, so in such a configuration, you're on your own. */ - #if !SDL_ATOMIC_DISABLED + #ifndef SDL_ATOMIC_DISABLED static SDL_SpinLock lock = 0; SDL_AtomicLock_REAL(&lock); #endif @@ -515,7 +515,7 @@ static void SDL_InitDynamicAPI(void) already_initialized = SDL_TRUE; } - #if !SDL_ATOMIC_DISABLED + #ifndef SDL_ATOMIC_DISABLED SDL_AtomicUnlock_REAL(&lock); #endif } diff --git a/thirdparty/SDL/src/dynapi/SDL_dynapi.h b/thirdparty/SDL/src/dynapi/SDL_dynapi.h index 99ca08008..95b20aaef 100644 --- a/thirdparty/SDL/src/dynapi/SDL_dynapi.h +++ b/thirdparty/SDL/src/dynapi/SDL_dynapi.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -53,7 +53,7 @@ #define SDL_DYNAMIC_API 0 #elif defined(SDL_BUILDING_WINRT) && SDL_BUILDING_WINRT /* probably not useful on WinRT, given current .dll loading restrictions */ #define SDL_DYNAMIC_API 0 -#elif defined(__PS2__) && __PS2__ +#elif defined(__PS2__) #define SDL_DYNAMIC_API 0 #elif defined(__PSP__) && __PSP__ #define SDL_DYNAMIC_API 0 diff --git a/thirdparty/SDL/src/dynapi/SDL_dynapi_overrides.h b/thirdparty/SDL/src/dynapi/SDL_dynapi_overrides.h index 0b59a2174..f57c5222e 100644 --- a/thirdparty/SDL/src/dynapi/SDL_dynapi_overrides.h +++ b/thirdparty/SDL/src/dynapi/SDL_dynapi_overrides.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -896,3 +896,5 @@ #define SDL_GDKSuspendComplete SDL_GDKSuspendComplete_REAL #define SDL_HasWindowSurface SDL_HasWindowSurface_REAL #define SDL_DestroyWindowSurface SDL_DestroyWindowSurface_REAL +#define SDL_GDKGetDefaultUser SDL_GDKGetDefaultUser_REAL +#define SDL_GameControllerGetSteamHandle SDL_GameControllerGetSteamHandle_REAL diff --git a/thirdparty/SDL/src/dynapi/SDL_dynapi_procs.h b/thirdparty/SDL/src/dynapi/SDL_dynapi_procs.h index 8e1d36d06..7f5d32525 100644 --- a/thirdparty/SDL/src/dynapi/SDL_dynapi_procs.h +++ b/thirdparty/SDL/src/dynapi/SDL_dynapi_procs.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -30,7 +30,7 @@ */ /* direct jump magic can use these, the rest needs special code. */ -#if !SDL_DYNAPI_PROC_NO_VARARGS +#ifndef SDL_DYNAPI_PROC_NO_VARARGS SDL_DYNAPI_PROC(int,SDL_SetError,(SDL_PRINTF_FORMAT_STRING const char *a, ...),(a),return) SDL_DYNAPI_PROC(void,SDL_Log,(SDL_PRINTF_FORMAT_STRING const char *a, ...),(a),) SDL_DYNAPI_PROC(void,SDL_LogVerbose,(int a, SDL_PRINTF_FORMAT_STRING const char *b, ...),(a,b),) @@ -888,7 +888,7 @@ SDL_DYNAPI_PROC(void*,SDL_GetTextureUserData,(SDL_Texture *a),(a),return) SDL_DYNAPI_PROC(int,SDL_RenderGeometry,(SDL_Renderer *a, SDL_Texture *b, const SDL_Vertex *c, int d, const int *e, int f),(a,b,c,d,e,f),return) SDL_DYNAPI_PROC(int,SDL_RenderGeometryRaw,(SDL_Renderer *a, SDL_Texture *b, const float *c, int d, const SDL_Color *e, int f, const float *g, int h, int i, const void *j, int k, int l),(a,b,c,d,e,f,g,h,i,j,k,l),return) SDL_DYNAPI_PROC(int,SDL_RenderSetVSync,(SDL_Renderer *a, int b),(a,b),return) -#if !SDL_DYNAPI_PROC_NO_VARARGS +#ifndef SDL_DYNAPI_PROC_NO_VARARGS SDL_DYNAPI_PROC(int,SDL_asprintf,(char **a, SDL_PRINTF_FORMAT_STRING const char *b, ...),(a,b),return) #endif SDL_DYNAPI_PROC(int,SDL_vasprintf,(char **a, const char *b, va_list c),(a,b,c),return) @@ -981,3 +981,7 @@ SDL_DYNAPI_PROC(void,SDL_GDKSuspendComplete,(void),(),) #endif SDL_DYNAPI_PROC(SDL_bool,SDL_HasWindowSurface,(SDL_Window *a),(a),return) SDL_DYNAPI_PROC(int,SDL_DestroyWindowSurface,(SDL_Window *a),(a),return) +#if defined(__GDK__) +SDL_DYNAPI_PROC(int,SDL_GDKGetDefaultUser,(XUserHandle *a),(a),return) +#endif +SDL_DYNAPI_PROC(Uint64,SDL_GameControllerGetSteamHandle,(SDL_GameController *a),(a),return) diff --git a/thirdparty/SDL/src/dynapi/gendynapi.pl b/thirdparty/SDL/src/dynapi/gendynapi.pl index 47509f847..dad2bc487 100755 --- a/thirdparty/SDL/src/dynapi/gendynapi.pl +++ b/thirdparty/SDL/src/dynapi/gendynapi.pl @@ -1,7 +1,7 @@ #!/usr/bin/perl -w # Simple DirectMedia Layer -# Copyright (C) 1997-2023 Sam Lantinga +# Copyright (C) 1997-2024 Sam Lantinga # # This software is provided 'as-is', without any express or implied # warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/events/SDL_clipboardevents.c b/thirdparty/SDL/src/events/SDL_clipboardevents.c index 050807450..68b9a7636 100644 --- a/thirdparty/SDL/src/events/SDL_clipboardevents.c +++ b/thirdparty/SDL/src/events/SDL_clipboardevents.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/events/SDL_clipboardevents_c.h b/thirdparty/SDL/src/events/SDL_clipboardevents_c.h index abbdb1f49..77e2e42e4 100644 --- a/thirdparty/SDL/src/events/SDL_clipboardevents_c.h +++ b/thirdparty/SDL/src/events/SDL_clipboardevents_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/events/SDL_displayevents.c b/thirdparty/SDL/src/events/SDL_displayevents.c index ec5e158bb..9777d5d7a 100644 --- a/thirdparty/SDL/src/events/SDL_displayevents.c +++ b/thirdparty/SDL/src/events/SDL_displayevents.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -29,7 +29,7 @@ int SDL_SendDisplayEvent(SDL_VideoDisplay *display, Uint8 displayevent, int data { int posted; - if (display == NULL) { + if (!display) { return 0; } switch (displayevent) { diff --git a/thirdparty/SDL/src/events/SDL_displayevents_c.h b/thirdparty/SDL/src/events/SDL_displayevents_c.h index 0f0c9d3dd..d2e2b5764 100644 --- a/thirdparty/SDL/src/events/SDL_displayevents_c.h +++ b/thirdparty/SDL/src/events/SDL_displayevents_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/events/SDL_dropevents.c b/thirdparty/SDL/src/events/SDL_dropevents.c index 3665a17d2..7c7cc5607 100644 --- a/thirdparty/SDL/src/events/SDL_dropevents.c +++ b/thirdparty/SDL/src/events/SDL_dropevents.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/events/SDL_dropevents_c.h b/thirdparty/SDL/src/events/SDL_dropevents_c.h index 1a7864720..83177a875 100644 --- a/thirdparty/SDL/src/events/SDL_dropevents_c.h +++ b/thirdparty/SDL/src/events/SDL_dropevents_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/events/SDL_events.c b/thirdparty/SDL/src/events/SDL_events.c index 05c2bf830..b432703b4 100644 --- a/thirdparty/SDL/src/events/SDL_events.c +++ b/thirdparty/SDL/src/events/SDL_events.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -28,19 +28,12 @@ #include "SDL_events_c.h" #include "../SDL_hints_c.h" #include "../timer/SDL_timer_c.h" -#if !SDL_JOYSTICK_DISABLED +#ifndef SDL_JOYSTICK_DISABLED #include "../joystick/SDL_joystick_c.h" #endif #include "../video/SDL_sysvideo.h" #include "SDL_syswm.h" -#undef SDL_PRIs64 -#if (defined(__WIN32__) || defined(__GDK__)) && !defined(__CYGWIN__) -#define SDL_PRIs64 "I64d" -#else -#define SDL_PRIs64 "lld" -#endif - /* An arbitrary limit so we don't have unbounded growth */ #define SDL_MAX_QUEUED_EVENTS 65535 @@ -98,7 +91,7 @@ static struct SDL_SysWMEntry *wmmsg_free; } SDL_EventQ = { NULL, SDL_FALSE, { 0 }, 0, NULL, NULL, NULL, NULL, NULL }; -#if !SDL_JOYSTICK_DISABLED +#ifndef SDL_JOYSTICK_DISABLED static SDL_bool SDL_update_joysticks = SDL_TRUE; @@ -119,7 +112,7 @@ static void SDLCALL SDL_AutoUpdateJoysticksChanged(void *userdata, const char *n #endif /* !SDL_JOYSTICK_DISABLED */ -#if !SDL_SENSOR_DISABLED +#ifndef SDL_SENSOR_DISABLED static SDL_bool SDL_update_sensors = SDL_TRUE; @@ -425,6 +418,9 @@ static void SDL_LogEvent(const SDL_Event *event) SDL_EVENT_CASE(SDL_CONTROLLERDEVICEREMAPPED) PRINT_CONTROLLERDEV_EVENT(event); break; + SDL_EVENT_CASE(SDL_CONTROLLERSTEAMHANDLEUPDATED) + PRINT_CONTROLLERDEV_EVENT(event); + break; #undef PRINT_CONTROLLERDEV_EVENT #define PRINT_CTOUCHPAD_EVENT(event) \ @@ -451,8 +447,8 @@ static void SDL_LogEvent(const SDL_Event *event) #define PRINT_FINGER_EVENT(event) \ (void)SDL_snprintf(details, sizeof(details), " (timestamp=%u touchid=%" SDL_PRIs64 " fingerid=%" SDL_PRIs64 " x=%f y=%f dx=%f dy=%f pressure=%f)", \ - (uint)event->tfinger.timestamp, (long long)event->tfinger.touchId, \ - (long long)event->tfinger.fingerId, event->tfinger.x, event->tfinger.y, \ + (uint)event->tfinger.timestamp, event->tfinger.touchId, \ + event->tfinger.fingerId, event->tfinger.x, event->tfinger.y, \ event->tfinger.dx, event->tfinger.dy, event->tfinger.pressure) SDL_EVENT_CASE(SDL_FINGERDOWN) PRINT_FINGER_EVENT(event); @@ -467,8 +463,8 @@ static void SDL_LogEvent(const SDL_Event *event) #define PRINT_DOLLAR_EVENT(event) \ (void)SDL_snprintf(details, sizeof(details), " (timestamp=%u touchid=%" SDL_PRIs64 " gestureid=%" SDL_PRIs64 " numfingers=%u error=%f x=%f y=%f)", \ - (uint)event->dgesture.timestamp, (long long)event->dgesture.touchId, \ - (long long)event->dgesture.gestureId, (uint)event->dgesture.numFingers, \ + (uint)event->dgesture.timestamp, event->dgesture.touchId, \ + event->dgesture.gestureId, (uint)event->dgesture.numFingers, \ event->dgesture.error, event->dgesture.x, event->dgesture.y) SDL_EVENT_CASE(SDL_DOLLARGESTURE) PRINT_DOLLAR_EVENT(event); @@ -480,7 +476,7 @@ static void SDL_LogEvent(const SDL_Event *event) SDL_EVENT_CASE(SDL_MULTIGESTURE) (void)SDL_snprintf(details, sizeof(details), " (timestamp=%u touchid=%" SDL_PRIs64 " dtheta=%f ddist=%f x=%f y=%f numfingers=%u)", - (uint)event->mgesture.timestamp, (long long)event->mgesture.touchId, + (uint)event->mgesture.timestamp, event->mgesture.touchId, event->mgesture.dTheta, event->mgesture.dDist, event->mgesture.x, event->mgesture.y, (uint)event->mgesture.numFingers); break; @@ -621,7 +617,7 @@ int SDL_StartEventLoop(void) */ /* Create the lock and set ourselves active */ -#if !SDL_THREADS_DISABLED +#ifndef SDL_THREADS_DISABLED if (!SDL_EventQ.lock) { SDL_EventQ.lock = SDL_CreateMutex(); if (SDL_EventQ.lock == NULL) { @@ -737,7 +733,7 @@ static void SDL_CutEvent(SDL_EventEntry *entry) SDL_AtomicAdd(&SDL_EventQ.count, -1); } -static int SDL_SendWakeupEvent() +static int SDL_SendWakeupEvent(void) { SDL_VideoDevice *_this = SDL_GetVideoDevice(); if (_this == NULL || !_this->SendWakeupEvent) { @@ -922,14 +918,14 @@ static void SDL_PumpEventsInternal(SDL_bool push_sentinel) _this->PumpEvents(_this); } -#if !SDL_JOYSTICK_DISABLED +#ifndef SDL_JOYSTICK_DISABLED /* Check for joystick state change */ if (SDL_update_joysticks) { SDL_JoystickUpdate(); } #endif -#if !SDL_SENSOR_DISABLED +#ifndef SDL_SENSOR_DISABLED /* Check for sensor state change */ if (SDL_update_sensors) { SDL_SensorUpdate(); @@ -952,7 +948,7 @@ static void SDL_PumpEventsInternal(SDL_bool push_sentinel) } } -void SDL_PumpEvents() +void SDL_PumpEvents(void) { SDL_PumpEventsInternal(SDL_FALSE); } @@ -964,16 +960,16 @@ int SDL_PollEvent(SDL_Event *event) return SDL_WaitEventTimeout(event, 0); } -static SDL_bool SDL_events_need_periodic_poll() +static SDL_bool SDL_events_need_periodic_poll(void) { SDL_bool need_periodic_poll = SDL_FALSE; -#if !SDL_JOYSTICK_DISABLED +#ifndef SDL_JOYSTICK_DISABLED need_periodic_poll = SDL_WasInit(SDL_INIT_JOYSTICK) && SDL_update_joysticks; #endif -#if !SDL_SENSOR_DISABLED +#ifndef SDL_SENSOR_DISABLED need_periodic_poll = need_periodic_poll || (SDL_WasInit(SDL_INIT_SENSOR) && SDL_update_sensors); #endif @@ -1049,18 +1045,18 @@ static int SDL_WaitEventTimeout_Device(_THIS, SDL_Window *wakeup_window, SDL_Eve return 0; } -static SDL_bool SDL_events_need_polling() +static SDL_bool SDL_events_need_polling(void) { SDL_bool need_polling = SDL_FALSE; -#if !SDL_JOYSTICK_DISABLED +#ifndef SDL_JOYSTICK_DISABLED need_polling = SDL_WasInit(SDL_INIT_JOYSTICK) && SDL_update_joysticks && (SDL_NumJoysticks() > 0); #endif -#if !SDL_SENSOR_DISABLED +#ifndef SDL_SENSOR_DISABLED need_polling = need_polling || (SDL_WasInit(SDL_INIT_SENSOR) && SDL_update_sensors && (SDL_NumSensors() > 0)); #endif @@ -1342,10 +1338,10 @@ Uint8 SDL_EventState(Uint32 type, int state) SDL_disabled_events[hi]->bits[lo / 32] &= ~(1 << (lo & 31)); } -#if !SDL_JOYSTICK_DISABLED +#ifndef SDL_JOYSTICK_DISABLED SDL_CalculateShouldUpdateJoysticks(SDL_GetHintBoolean(SDL_HINT_AUTO_UPDATE_JOYSTICKS, SDL_TRUE)); #endif -#if !SDL_SENSOR_DISABLED +#ifndef SDL_SENSOR_DISABLED SDL_CalculateShouldUpdateSensors(SDL_GetHintBoolean(SDL_HINT_AUTO_UPDATE_SENSORS, SDL_TRUE)); #endif } @@ -1413,10 +1409,10 @@ int SDL_SendLocaleChangedEvent(void) int SDL_EventsInit(void) { -#if !SDL_JOYSTICK_DISABLED +#ifndef SDL_JOYSTICK_DISABLED SDL_AddHintCallback(SDL_HINT_AUTO_UPDATE_JOYSTICKS, SDL_AutoUpdateJoysticksChanged, NULL); #endif -#if !SDL_SENSOR_DISABLED +#ifndef SDL_SENSOR_DISABLED SDL_AddHintCallback(SDL_HINT_AUTO_UPDATE_SENSORS, SDL_AutoUpdateSensorsChanged, NULL); #endif SDL_AddHintCallback(SDL_HINT_EVENT_LOGGING, SDL_EventLoggingChanged, NULL); @@ -1437,10 +1433,10 @@ void SDL_EventsQuit(void) SDL_StopEventLoop(); SDL_DelHintCallback(SDL_HINT_POLL_SENTINEL, SDL_PollSentinelChanged, NULL); SDL_DelHintCallback(SDL_HINT_EVENT_LOGGING, SDL_EventLoggingChanged, NULL); -#if !SDL_JOYSTICK_DISABLED +#ifndef SDL_JOYSTICK_DISABLED SDL_DelHintCallback(SDL_HINT_AUTO_UPDATE_JOYSTICKS, SDL_AutoUpdateJoysticksChanged, NULL); #endif -#if !SDL_SENSOR_DISABLED +#ifndef SDL_SENSOR_DISABLED SDL_DelHintCallback(SDL_HINT_AUTO_UPDATE_SENSORS, SDL_AutoUpdateSensorsChanged, NULL); #endif } diff --git a/thirdparty/SDL/src/events/SDL_events_c.h b/thirdparty/SDL/src/events/SDL_events_c.h index 7f27b1a2f..6a9cf4ce6 100644 --- a/thirdparty/SDL/src/events/SDL_events_c.h +++ b/thirdparty/SDL/src/events/SDL_events_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/events/SDL_gesture.c b/thirdparty/SDL/src/events/SDL_gesture.c index 1769457eb..63362c0f6 100644 --- a/thirdparty/SDL/src/events/SDL_gesture.c +++ b/thirdparty/SDL/src/events/SDL_gesture.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -61,7 +61,7 @@ typedef struct typedef struct { SDL_FloatPoint path[DOLLARNPOINTS]; - unsigned long hash; + Sint64 hash; } SDL_DollarTemplate; typedef struct @@ -110,7 +110,7 @@ int SDL_RecordGesture(SDL_TouchID touchId) return touchId < 0; } -void SDL_GestureQuit() +void SDL_GestureQuit(void) { SDL_free(SDL_gestureTouch); SDL_gestureTouch = NULL; @@ -129,7 +129,7 @@ static unsigned long SDL_HashDollar(SDL_FloatPoint *points) static int SaveTemplate(SDL_DollarTemplate *templ, SDL_RWops *dst) { - if (dst == NULL) { + if (!dst) { return 0; } @@ -200,7 +200,7 @@ static int SDL_AddDollarGesture_one(SDL_GestureTouch *inTouch, SDL_FloatPoint *p (SDL_DollarTemplate *)SDL_realloc(inTouch->dollarTemplate, (index + 1) * sizeof(SDL_DollarTemplate)); - if (dollarTemplate == NULL) { + if (!dollarTemplate) { return SDL_OutOfMemory(); } inTouch->dollarTemplate = dollarTemplate; @@ -217,7 +217,7 @@ static int SDL_AddDollarGesture(SDL_GestureTouch *inTouch, SDL_FloatPoint *path) { int index = -1; int i = 0; - if (inTouch == NULL) { + if (!inTouch) { if (SDL_numGestureTouches == 0) { return SDL_SetError("no gesture touch devices registered"); } @@ -238,7 +238,7 @@ int SDL_LoadDollarTemplates(SDL_TouchID touchId, SDL_RWops *src) { int i, loaded = 0; SDL_GestureTouch *touch = NULL; - if (src == NULL) { + if (!src) { return 0; } if (touchId >= 0) { @@ -247,7 +247,7 @@ int SDL_LoadDollarTemplates(SDL_TouchID touchId, SDL_RWops *src) touch = &SDL_gestureTouch[i]; } } - if (touch == NULL) { + if (!touch) { return SDL_SetError("given touch id not found"); } } @@ -475,7 +475,7 @@ int SDL_GestureAddTouch(SDL_TouchID touchId) (SDL_numGestureTouches + 1) * sizeof(SDL_GestureTouch)); - if (gestureTouch == NULL) { + if (!gestureTouch) { return SDL_OutOfMemory(); } @@ -589,7 +589,7 @@ void SDL_GestureProcessEvent(SDL_Event *event) SDL_GestureTouch *inTouch = SDL_GetGestureTouch(event->tfinger.touchId); /* Shouldn't be possible */ - if (inTouch == NULL) { + if (!inTouch) { return; } @@ -630,7 +630,7 @@ void SDL_GestureProcessEvent(SDL_Event *event) &bestTempl, inTouch); if (bestTempl >= 0) { /* Send Event */ - unsigned long gestureId = inTouch->dollarTemplate[bestTempl].hash; + Sint64 gestureId = inTouch->dollarTemplate[bestTempl].hash; SDL_SendGestureDollar(inTouch, gestureId, error); /* printf ("%s\n",);("Dollar error: %f\n",error); */ } diff --git a/thirdparty/SDL/src/events/SDL_gesture_c.h b/thirdparty/SDL/src/events/SDL_gesture_c.h index d359290c7..04320d525 100644 --- a/thirdparty/SDL/src/events/SDL_gesture_c.h +++ b/thirdparty/SDL/src/events/SDL_gesture_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/events/SDL_keyboard.c b/thirdparty/SDL/src/events/SDL_keyboard.c index 5a14f85bf..58a95c907 100644 --- a/thirdparty/SDL/src/events/SDL_keyboard.c +++ b/thirdparty/SDL/src/events/SDL_keyboard.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -768,7 +768,7 @@ void SDL_SetKeyboardFocus(SDL_Window *window) { SDL_Keyboard *keyboard = &SDL_keyboard; - if (keyboard->focus && window == NULL) { + if (keyboard->focus && !window) { /* We won't get anymore keyboard messages, so reset keyboard state */ SDL_ResetKeyboard(); } @@ -1183,7 +1183,7 @@ const char *SDL_GetScancodeName(SDL_Scancode scancode) } name = SDL_scancode_names[scancode]; - if (name != NULL) { + if (name) { return name; } @@ -1194,7 +1194,7 @@ SDL_Scancode SDL_GetScancodeFromName(const char *name) { int i; - if (name == NULL || !*name) { + if (!name || !*name) { SDL_InvalidParamError("name"); return SDL_SCANCODE_UNKNOWN; } @@ -1254,7 +1254,7 @@ SDL_Keycode SDL_GetKeyFromName(const char *name) SDL_Keycode key; /* Check input */ - if (name == NULL) { + if (!name) { return SDLK_UNKNOWN; } diff --git a/thirdparty/SDL/src/events/SDL_keyboard_c.h b/thirdparty/SDL/src/events/SDL_keyboard_c.h index 16a5fad2e..4c5cd2f8b 100644 --- a/thirdparty/SDL/src/events/SDL_keyboard_c.h +++ b/thirdparty/SDL/src/events/SDL_keyboard_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/events/SDL_keysym_to_scancode.c b/thirdparty/SDL/src/events/SDL_keysym_to_scancode.c index df0b6b12f..ddf4ae3fb 100644 --- a/thirdparty/SDL/src/events/SDL_keysym_to_scancode.c +++ b/thirdparty/SDL/src/events/SDL_keysym_to_scancode.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,7 +21,7 @@ #include "../SDL_internal.h" -#if SDL_VIDEO_DRIVER_WAYLAND || SDL_VIDEO_DRIVER_X11 +#if defined(SDL_VIDEO_DRIVER_WAYLAND) || defined(SDL_VIDEO_DRIVER_X11) #include "SDL_keyboard_c.h" #include "SDL_scancode_tables_c.h" diff --git a/thirdparty/SDL/src/events/SDL_keysym_to_scancode_c.h b/thirdparty/SDL/src/events/SDL_keysym_to_scancode_c.h index e9f28d8c6..11e2d370a 100644 --- a/thirdparty/SDL/src/events/SDL_keysym_to_scancode_c.h +++ b/thirdparty/SDL/src/events/SDL_keysym_to_scancode_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/events/SDL_mouse.c b/thirdparty/SDL/src/events/SDL_mouse.c index 000b22deb..b13383279 100644 --- a/thirdparty/SDL/src/events/SDL_mouse.c +++ b/thirdparty/SDL/src/events/SDL_mouse.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -170,8 +170,15 @@ static void SDLCALL SDL_MouseRelativeWarpMotionChanged(void *userdata, const cha mouse->relative_mode_warp_motion = SDL_GetStringBoolean(hint, SDL_FALSE); } +static void SDLCALL SDL_MouseRelativeCursorVisibleChanged(void *userdata, const char *name, const char *oldValue, const char *hint) +{ + SDL_Mouse *mouse = (SDL_Mouse *)userdata; + + mouse->relative_mode_cursor_visible = SDL_GetStringBoolean(hint, SDL_FALSE); +} + /* Public functions */ -int SDL_MouseInit(void) +int SDL_MousePreInit(void) { SDL_Mouse *mouse = SDL_GetMouse(); @@ -209,6 +216,9 @@ int SDL_MouseInit(void) SDL_AddHintCallback(SDL_HINT_MOUSE_RELATIVE_WARP_MOTION, SDL_MouseRelativeWarpMotionChanged, mouse); + SDL_AddHintCallback(SDL_HINT_MOUSE_RELATIVE_CURSOR_VISIBLE, + SDL_MouseRelativeCursorVisibleChanged, mouse); + mouse->was_touch_mouse_events = SDL_FALSE; /* no touch to mouse movement event pending */ mouse->cursor_shown = SDL_TRUE; @@ -216,11 +226,62 @@ int SDL_MouseInit(void) return 0; } +void SDL_MousePostInit(void) +{ + SDL_Mouse *mouse = SDL_GetMouse(); + + /* Create a dummy mouse cursor for video backends that don't support true cursors, + * so that mouse grab and focus functionality will work. + */ + if (!mouse->def_cursor) { + SDL_Surface *surface = SDL_CreateRGBSurface(0, 1, 1, 32, 0xFF, 0xFF, 0xFF, 0xFF); + if (surface) { + SDL_memset(surface->pixels, 0, (size_t)surface->h * surface->pitch); + SDL_SetDefaultCursor(SDL_CreateColorCursor(surface, 0, 0)); + SDL_FreeSurface(surface); + } + } +} + void SDL_SetDefaultCursor(SDL_Cursor *cursor) { SDL_Mouse *mouse = SDL_GetMouse(); + if (cursor == mouse->def_cursor) { + return; + } + + if (mouse->def_cursor) { + SDL_Cursor *default_cursor = mouse->def_cursor; + SDL_Cursor *prev, *curr; + + if (mouse->cur_cursor == mouse->def_cursor) { + mouse->cur_cursor = NULL; + } + mouse->def_cursor = NULL; + + for (prev = NULL, curr = mouse->cursors; curr; + prev = curr, curr = curr->next) { + if (curr == default_cursor) { + if (prev) { + prev->next = curr->next; + } else { + mouse->cursors = curr->next; + } + + break; + } + } + + if (mouse->FreeCursor && default_cursor->driverdata) { + mouse->FreeCursor(default_cursor); + } else { + SDL_free(default_cursor); + } + } + mouse->def_cursor = cursor; + if (!mouse->cur_cursor) { SDL_SetCursor(cursor); } @@ -440,7 +501,7 @@ int SDL_SetMouseSystemScale(int num_values, const float *values) } v = (float *)SDL_realloc(mouse->system_scale_values, num_values * sizeof(*values)); - if (v == NULL) { + if (!v) { return SDL_OutOfMemory(); } SDL_memcpy(v, values, num_values * sizeof(*values)); @@ -661,7 +722,7 @@ static SDL_MouseClickState *GetMouseClickState(SDL_Mouse *mouse, Uint8 button) if (button >= mouse->num_clickstates) { int i, count = button + 1; SDL_MouseClickState *clickstate = (SDL_MouseClickState *)SDL_realloc(mouse->clickstate, count * sizeof(*mouse->clickstate)); - if (clickstate == NULL) { + if (!clickstate) { return NULL; } mouse->clickstate = clickstate; @@ -683,7 +744,7 @@ static int SDL_PrivateSendMouseButton(SDL_Window *window, SDL_MouseID mouseID, U SDL_MouseInputSource *source; source = GetMouseInputSource(mouse, mouseID); - if (source == NULL) { + if (!source) { return 0; } buttonstate = source->buttonstate; @@ -941,6 +1002,9 @@ void SDL_MouseQuit(void) SDL_DelHintCallback(SDL_HINT_MOUSE_RELATIVE_WARP_MOTION, SDL_MouseRelativeWarpMotionChanged, mouse); + + SDL_DelHintCallback(SDL_HINT_MOUSE_RELATIVE_CURSOR_VISIBLE, + SDL_MouseRelativeCursorVisibleChanged, mouse); } Uint32 SDL_GetMouseState(int *x, int *y) @@ -979,10 +1043,10 @@ Uint32 SDL_GetGlobalMouseState(int *x, int *y) int tmpx, tmpy; /* make sure these are never NULL for the backend implementations... */ - if (x == NULL) { + if (!x) { x = &tmpx; } - if (y == NULL) { + if (!y) { y = &tmpy; } @@ -998,11 +1062,11 @@ void SDL_PerformWarpMouseInWindow(SDL_Window *window, int x, int y, SDL_bool ign { SDL_Mouse *mouse = SDL_GetMouse(); - if (window == NULL) { + if (!window) { window = mouse->focus; } - if (window == NULL) { + if (!window) { return; } @@ -1127,7 +1191,7 @@ int SDL_SetRelativeMouseMode(SDL_bool enabled) return 0; } -SDL_bool SDL_GetRelativeMouseMode() +SDL_bool SDL_GetRelativeMouseMode(void) { SDL_Mouse *mouse = SDL_GetMouse(); @@ -1233,7 +1297,7 @@ SDL_Cursor *SDL_CreateCursor(const Uint8 *data, const Uint8 *mask, 0x0000FF00, 0x000000FF, 0xFF000000); - if (surface == NULL) { + if (!surface) { return NULL; } for (y = 0; y < h; ++y) { @@ -1266,16 +1330,11 @@ SDL_Cursor *SDL_CreateColorCursor(SDL_Surface *surface, int hot_x, int hot_y) SDL_Surface *temp = NULL; SDL_Cursor *cursor; - if (surface == NULL) { + if (!surface) { SDL_InvalidParamError("surface"); return NULL; } - if (!mouse->CreateCursor) { - SDL_SetError("Cursors are not currently supported"); - return NULL; - } - /* Sanity check the hot spot */ if ((hot_x < 0) || (hot_y < 0) || (hot_x >= surface->w) || (hot_y >= surface->h)) { @@ -1285,13 +1344,21 @@ SDL_Cursor *SDL_CreateColorCursor(SDL_Surface *surface, int hot_x, int hot_y) if (surface->format->format != SDL_PIXELFORMAT_ARGB8888) { temp = SDL_ConvertSurfaceFormat(surface, SDL_PIXELFORMAT_ARGB8888, 0); - if (temp == NULL) { + if (!temp) { return NULL; } surface = temp; } - cursor = mouse->CreateCursor(surface, hot_x, hot_y); + if (mouse->CreateCursor) { + cursor = mouse->CreateCursor(surface, hot_x, hot_y); + } else { + cursor = SDL_calloc(1, sizeof(*cursor)); + if (!cursor) { + SDL_OutOfMemory(); + } + } + if (cursor) { cursor->next = mouse->cursors; mouse->cursors = cursor; @@ -1344,7 +1411,7 @@ void SDL_SetCursor(SDL_Cursor *cursor) break; } } - if (found == NULL) { + if (!found) { SDL_SetError("Cursor not associated with the current mouse"); return; } @@ -1358,7 +1425,7 @@ void SDL_SetCursor(SDL_Cursor *cursor) } } - if (cursor && mouse->cursor_shown && !mouse->relative_mode) { + if (cursor && mouse->cursor_shown && (!mouse->relative_mode || mouse->relative_mode_cursor_visible)) { if (mouse->ShowCursor) { mouse->ShowCursor(cursor); } @@ -1373,7 +1440,7 @@ SDL_Cursor *SDL_GetCursor(void) { SDL_Mouse *mouse = SDL_GetMouse(); - if (mouse == NULL) { + if (!mouse) { return NULL; } return mouse->cur_cursor; @@ -1383,7 +1450,7 @@ SDL_Cursor *SDL_GetDefaultCursor(void) { SDL_Mouse *mouse = SDL_GetMouse(); - if (mouse == NULL) { + if (!mouse) { return NULL; } return mouse->def_cursor; @@ -1394,7 +1461,7 @@ void SDL_FreeCursor(SDL_Cursor *cursor) SDL_Mouse *mouse = SDL_GetMouse(); SDL_Cursor *curr, *prev; - if (cursor == NULL) { + if (!cursor) { return; } @@ -1416,6 +1483,8 @@ void SDL_FreeCursor(SDL_Cursor *cursor) if (mouse->FreeCursor) { mouse->FreeCursor(curr); + } else { + SDL_free(curr); } return; } @@ -1427,7 +1496,7 @@ int SDL_ShowCursor(int toggle) SDL_Mouse *mouse = SDL_GetMouse(); SDL_bool shown; - if (mouse == NULL) { + if (!mouse) { return 0; } diff --git a/thirdparty/SDL/src/events/SDL_mouse_c.h b/thirdparty/SDL/src/events/SDL_mouse_c.h index 64e82ab8e..db1c6c4f6 100644 --- a/thirdparty/SDL/src/events/SDL_mouse_c.h +++ b/thirdparty/SDL/src/events/SDL_mouse_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -92,6 +92,7 @@ typedef struct SDL_bool relative_mode; SDL_bool relative_mode_warp; SDL_bool relative_mode_warp_motion; + SDL_bool relative_mode_cursor_visible; SDL_bool enable_normal_speed_scale; float normal_speed_scale; SDL_bool enable_relative_speed_scale; @@ -131,7 +132,8 @@ typedef struct } SDL_Mouse; /* Initialize the mouse subsystem */ -extern int SDL_MouseInit(void); +extern int SDL_MousePreInit(void); +extern void SDL_MousePostInit(void); /* Get the mouse state structure */ SDL_Mouse *SDL_GetMouse(void); diff --git a/thirdparty/SDL/src/events/SDL_quit.c b/thirdparty/SDL/src/events/SDL_quit.c index dba801a68..cd629a927 100644 --- a/thirdparty/SDL/src/events/SDL_quit.c +++ b/thirdparty/SDL/src/events/SDL_quit.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -85,7 +85,7 @@ static void SDL_EventSignal_Init(const int sig) action.sa_handler = SDL_HandleSIG; sigaction(sig, &action, NULL); } -#elif HAVE_SIGNAL_H +#elif defined(HAVE_SIGNAL_H) void (*ohandler)(int) = signal(sig, SDL_HandleSIG); if (ohandler != SIG_DFL) { signal(sig, ohandler); @@ -102,7 +102,7 @@ static void SDL_EventSignal_Quit(const int sig) action.sa_handler = SIG_DFL; sigaction(sig, &action, NULL); } -#elif HAVE_SIGNAL_H +#elif defined(HAVE_SIGNAL_H) void (*ohandler)(int) = signal(sig, SIG_DFL); if (ohandler != SDL_HandleSIG) { signal(sig, ohandler); diff --git a/thirdparty/SDL/src/events/SDL_scancode_tables.c b/thirdparty/SDL/src/events/SDL_scancode_tables.c index 359feb1e6..db6d86196 100644 --- a/thirdparty/SDL/src/events/SDL_scancode_tables.c +++ b/thirdparty/SDL/src/events/SDL_scancode_tables.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../SDL_internal.h" -#if SDL_INPUT_LINUXEV || SDL_VIDEO_DRIVER_DIRECTFB || SDL_VIDEO_DRIVER_WAYLAND || SDL_VIDEO_DRIVER_X11 +#if defined(SDL_INPUT_LINUXEV) || defined(SDL_VIDEO_DRIVER_DIRECTFB) || defined(SDL_VIDEO_DRIVER_WAYLAND) || defined(SDL_VIDEO_DRIVER_X11) #include "SDL_scancode_tables_c.h" diff --git a/thirdparty/SDL/src/events/SDL_scancode_tables_c.h b/thirdparty/SDL/src/events/SDL_scancode_tables_c.h index b1181e243..481e7a59e 100644 --- a/thirdparty/SDL/src/events/SDL_scancode_tables_c.h +++ b/thirdparty/SDL/src/events/SDL_scancode_tables_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/events/SDL_touch.c b/thirdparty/SDL/src/events/SDL_touch.c index cff41b056..b5ec77bd5 100644 --- a/thirdparty/SDL/src/events/SDL_touch.c +++ b/thirdparty/SDL/src/events/SDL_touch.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -138,7 +138,7 @@ int SDL_GetNumTouchFingers(SDL_TouchID touchID) SDL_Finger *SDL_GetTouchFinger(SDL_TouchID touchID, int index) { SDL_Touch *touch = SDL_GetTouch(touchID); - if (touch == NULL) { + if (!touch) { return NULL; } if (index < 0 || index >= touch->num_fingers) { @@ -161,7 +161,7 @@ int SDL_AddTouch(SDL_TouchID touchID, SDL_TouchDeviceType type, const char *name /* Add the touch to the list of touch */ touchDevices = (SDL_Touch **)SDL_realloc(SDL_touchDevices, (SDL_num_touch + 1) * sizeof(*touchDevices)); - if (touchDevices == NULL) { + if (!touchDevices) { return SDL_OutOfMemory(); } @@ -198,7 +198,7 @@ static int SDL_AddFinger(SDL_Touch *touch, SDL_FingerID fingerid, float x, float if (touch->num_fingers == touch->max_fingers) { SDL_Finger **new_fingers; new_fingers = (SDL_Finger **)SDL_realloc(touch->fingers, (touch->max_fingers + 1) * sizeof(*touch->fingers)); - if (new_fingers == NULL) { + if (!new_fingers) { return SDL_OutOfMemory(); } touch->fingers = new_fingers; @@ -241,7 +241,7 @@ int SDL_SendTouch(SDL_TouchID id, SDL_FingerID fingerid, SDL_Window *window, SDL_Mouse *mouse; SDL_Touch *touch = SDL_GetTouch(id); - if (touch == NULL) { + if (!touch) { return -1; } @@ -334,7 +334,7 @@ int SDL_SendTouch(SDL_TouchID id, SDL_FingerID fingerid, SDL_Window *window, posted = (SDL_PushEvent(&event) > 0); } } else { - if (finger == NULL) { + if (!finger) { /* This finger is already up */ return 0; } @@ -370,7 +370,7 @@ int SDL_SendTouchMotion(SDL_TouchID id, SDL_FingerID fingerid, SDL_Window *windo float xrel, yrel, prel; touch = SDL_GetTouch(id); - if (touch == NULL) { + if (!touch) { return -1; } @@ -413,7 +413,7 @@ int SDL_SendTouchMotion(SDL_TouchID id, SDL_FingerID fingerid, SDL_Window *windo } finger = SDL_GetFinger(touch, fingerid); - if (finger == NULL) { + if (!finger) { return SDL_SendTouch(id, fingerid, window, SDL_TRUE, x, y, pressure); } @@ -464,7 +464,7 @@ void SDL_DelTouch(SDL_TouchID id) index = SDL_GetTouchIndex(id); touch = SDL_GetTouch(id); - if (touch == NULL) { + if (!touch) { return; } diff --git a/thirdparty/SDL/src/events/SDL_touch_c.h b/thirdparty/SDL/src/events/SDL_touch_c.h index 1ece04cff..85f1f90c8 100644 --- a/thirdparty/SDL/src/events/SDL_touch_c.h +++ b/thirdparty/SDL/src/events/SDL_touch_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/events/SDL_windowevents.c b/thirdparty/SDL/src/events/SDL_windowevents.c index 800c8aae5..2ef1e745e 100644 --- a/thirdparty/SDL/src/events/SDL_windowevents.c +++ b/thirdparty/SDL/src/events/SDL_windowevents.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -84,7 +84,7 @@ int SDL_SendWindowEvent(SDL_Window *window, Uint8 windowevent, int data1, { int posted; - if (window == NULL) { + if (!window) { return 0; } switch (windowevent) { diff --git a/thirdparty/SDL/src/events/SDL_windowevents_c.h b/thirdparty/SDL/src/events/SDL_windowevents_c.h index fa2c353b6..cf7fc3a77 100644 --- a/thirdparty/SDL/src/events/SDL_windowevents_c.h +++ b/thirdparty/SDL/src/events/SDL_windowevents_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/events/blank_cursor.h b/thirdparty/SDL/src/events/blank_cursor.h index 020474b2a..1c317b712 100644 --- a/thirdparty/SDL/src/events/blank_cursor.h +++ b/thirdparty/SDL/src/events/blank_cursor.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/events/default_cursor.h b/thirdparty/SDL/src/events/default_cursor.h index e8758f15a..3eecf6c45 100644 --- a/thirdparty/SDL/src/events/default_cursor.h +++ b/thirdparty/SDL/src/events/default_cursor.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -27,7 +27,7 @@ #define DEFAULT_CHOTX 0 #define DEFAULT_CHOTY 0 -/* Added a real MacOS cursor, at the request of Luc-Olivier de Charrire */ +/* Added a real MacOS cursor, at the request of Luc-Olivier de Charrière */ #define USE_MACOS_CURSOR #ifdef USE_MACOS_CURSOR diff --git a/thirdparty/SDL/src/events/imKStoUCS.c b/thirdparty/SDL/src/events/imKStoUCS.c index 4aa85d423..d851dc1b6 100644 --- a/thirdparty/SDL/src/events/imKStoUCS.c +++ b/thirdparty/SDL/src/events/imKStoUCS.c @@ -26,7 +26,7 @@ DEALINGS IN THE SOFTWARE. #include "../SDL_internal.h" -#if SDL_VIDEO_DRIVER_X11 || SDL_VIDEO_DRIVER_WAYLAND +#if defined(SDL_VIDEO_DRIVER_X11) || defined(SDL_VIDEO_DRIVER_WAYLAND) #include "imKStoUCS.h" static unsigned short const keysym_to_unicode_1a1_1ff[] = { diff --git a/thirdparty/SDL/src/events/scancodes_ascii.h b/thirdparty/SDL/src/events/scancodes_ascii.h index 852370aeb..a4a0ecca9 100644 --- a/thirdparty/SDL/src/events/scancodes_ascii.h +++ b/thirdparty/SDL/src/events/scancodes_ascii.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/events/scancodes_darwin.h b/thirdparty/SDL/src/events/scancodes_darwin.h index ded67f656..de23de4de 100644 --- a/thirdparty/SDL/src/events/scancodes_darwin.h +++ b/thirdparty/SDL/src/events/scancodes_darwin.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/events/scancodes_linux.h b/thirdparty/SDL/src/events/scancodes_linux.h index 67737ac2e..03d84a982 100644 --- a/thirdparty/SDL/src/events/scancodes_linux.h +++ b/thirdparty/SDL/src/events/scancodes_linux.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/events/scancodes_windows.h b/thirdparty/SDL/src/events/scancodes_windows.h index 614afba5a..e902e7600 100644 --- a/thirdparty/SDL/src/events/scancodes_windows.h +++ b/thirdparty/SDL/src/events/scancodes_windows.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/events/scancodes_xfree86.h b/thirdparty/SDL/src/events/scancodes_xfree86.h index d01f3d9f7..20d02fe58 100644 --- a/thirdparty/SDL/src/events/scancodes_xfree86.h +++ b/thirdparty/SDL/src/events/scancodes_xfree86.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/file/SDL_rwops.c b/thirdparty/SDL/src/file/SDL_rwops.c index 2f66dcf41..444bf4af3 100644 --- a/thirdparty/SDL/src/file/SDL_rwops.c +++ b/thirdparty/SDL/src/file/SDL_rwops.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -36,8 +36,9 @@ #ifdef HAVE_STDIO_H #include +#include +#include #endif - #ifdef HAVE_LIMITS_H #include #endif @@ -62,7 +63,7 @@ #include "SDL_system.h" #endif -#if __NACL__ +#ifdef __NACL__ #include "nacl_io/nacl_io.h" #endif @@ -86,7 +87,7 @@ static int SDLCALL windows_file_open(SDL_RWops *context, const char *filename, c DWORD must_exist, truncate; int a_mode; - if (context == NULL) { + if (!context) { return -1; /* failed (invalid call) */ } @@ -154,7 +155,7 @@ static Sint64 SDLCALL windows_file_size(SDL_RWops *context) { LARGE_INTEGER size; - if (context == NULL || context->hidden.windowsio.h == INVALID_HANDLE_VALUE) { + if (!context || context->hidden.windowsio.h == INVALID_HANDLE_VALUE) { return SDL_SetError("windows_file_size: invalid context/file not opened"); } @@ -170,7 +171,7 @@ static Sint64 SDLCALL windows_file_seek(SDL_RWops *context, Sint64 offset, int w DWORD windowswhence; LARGE_INTEGER windowsoffset; - if (context == NULL || context->hidden.windowsio.h == INVALID_HANDLE_VALUE) { + if (!context || context->hidden.windowsio.h == INVALID_HANDLE_VALUE) { return SDL_SetError("windows_file_seek: invalid context/file not opened"); } @@ -211,7 +212,7 @@ windows_file_read(SDL_RWops *context, void *ptr, size_t size, size_t maxnum) total_need = size * maxnum; - if (context == NULL || context->hidden.windowsio.h == INVALID_HANDLE_VALUE || !total_need) { + if (!context || context->hidden.windowsio.h == INVALID_HANDLE_VALUE || !total_need) { return 0; } @@ -264,7 +265,7 @@ windows_file_write(SDL_RWops *context, const void *ptr, size_t size, total_bytes = size * num; - if (context == NULL || context->hidden.windowsio.h == INVALID_HANDLE_VALUE || !size || !total_bytes) { + if (!context || context->hidden.windowsio.h == INVALID_HANDLE_VALUE || !size || !total_bytes) { return 0; } @@ -523,10 +524,29 @@ static int SDLCALL mem_close(SDL_RWops *context) /* Functions to create SDL_RWops structures from various data sources */ +#if defined(HAVE_STDIO_H) && !(defined(__WIN32__) || defined(__GDK__)) +static SDL_bool IsRegularFileOrPipe(FILE *f) +{ + #ifdef __WINRT__ + struct __stat64 st; + if (_fstat64(_fileno(f), &st) < 0 || + !((st.st_mode & _S_IFMT) == _S_IFREG || (st.st_mode & _S_IFMT) == _S_IFIFO)) { + return SDL_FALSE; + } + #else + struct stat st; + if (fstat(fileno(f), &st) < 0 || !(S_ISREG(st.st_mode) || S_ISFIFO(st.st_mode))) { + return SDL_FALSE; + } + #endif + return SDL_TRUE; +} +#endif + SDL_RWops *SDL_RWFromFile(const char *file, const char *mode) { SDL_RWops *rwops = NULL; - if (file == NULL || !*file || mode == NULL || !*mode) { + if (!file || !*file || !mode || !*mode) { SDL_SetError("SDL_RWFromFile(): No file or no mode specified"); return NULL; } @@ -536,6 +556,11 @@ SDL_RWops *SDL_RWFromFile(const char *file, const char *mode) if (*file == '/') { FILE *fp = fopen(file, mode); if (fp) { + if (!IsRegularFileOrPipe(fp)) { + fclose(fp); + SDL_SetError("%s is not a regular file or pipe", file); + return NULL; + } return SDL_RWFromFP(fp, 1); } } else { @@ -551,6 +576,11 @@ SDL_RWops *SDL_RWFromFile(const char *file, const char *mode) fp = fopen(path, mode); SDL_stack_free(path); if (fp) { + if (!IsRegularFileOrPipe(fp)) { + fclose(fp); + SDL_SetError("%s is not a regular file or pipe", path); + return NULL; + } return SDL_RWFromFP(fp, 1); } } @@ -559,7 +589,7 @@ SDL_RWops *SDL_RWFromFile(const char *file, const char *mode) /* Try to open the file from the asset system */ rwops = SDL_AllocRW(); - if (rwops == NULL) { + if (!rwops) { return NULL; /* SDL_SetError already setup by SDL_AllocRW() */ } @@ -576,7 +606,7 @@ SDL_RWops *SDL_RWFromFile(const char *file, const char *mode) #elif defined(__WIN32__) || defined(__GDK__) rwops = SDL_AllocRW(); - if (rwops == NULL) { + if (!rwops) { return NULL; /* SDL_SetError already setup by SDL_AllocRW() */ } @@ -590,20 +620,24 @@ SDL_RWops *SDL_RWFromFile(const char *file, const char *mode) rwops->write = windows_file_write; rwops->close = windows_file_close; rwops->type = SDL_RWOPS_WINFILE; -#elif HAVE_STDIO_H +#elif defined(HAVE_STDIO_H) { -#if __APPLE__ && !SDL_FILE_DISABLED // TODO: add dummy? +#if defined(__APPLE__) && !defined(SDL_FILE_DISABLED) // TODO: add dummy? FILE *fp = SDL_OpenFPFromBundleOrFallback(file, mode); -#elif __WINRT__ +#elif defined(__WINRT__) FILE *fp = NULL; fopen_s(&fp, file, mode); -#elif __3DS__ +#elif defined(__3DS__) FILE *fp = N3DS_FileOpen(file, mode); #else FILE *fp = fopen(file, mode); #endif - if (fp == NULL) { - SDL_SetError("Couldn't open %s", file); + if (!fp) { + SDL_SetError("Couldn't open %s: %s", file, strerror(errno)); + } else if (!IsRegularFileOrPipe(fp)) { + fclose(fp); + fp = NULL; + SDL_SetError("%s is not a regular file or pipe", file); } else { rwops = SDL_RWFromFP(fp, SDL_TRUE); } @@ -621,7 +655,7 @@ SDL_RWops *SDL_RWFromFP(FILE * fp, SDL_bool autoclose) SDL_RWops *rwops = NULL; rwops = SDL_AllocRW(); - if (rwops != NULL) { + if (rwops) { rwops->size = stdio_size; rwops->seek = stdio_seek; rwops->read = stdio_read; @@ -644,7 +678,7 @@ SDL_RWops *SDL_RWFromFP(void * fp, SDL_bool autoclose) SDL_RWops *SDL_RWFromMem(void *mem, int size) { SDL_RWops *rwops = NULL; - if (mem == NULL) { + if (!mem) { SDL_InvalidParamError("mem"); return rwops; } @@ -654,7 +688,7 @@ SDL_RWops *SDL_RWFromMem(void *mem, int size) } rwops = SDL_AllocRW(); - if (rwops != NULL) { + if (rwops) { rwops->size = mem_size; rwops->seek = mem_seek; rwops->read = mem_read; @@ -671,7 +705,7 @@ SDL_RWops *SDL_RWFromMem(void *mem, int size) SDL_RWops *SDL_RWFromConstMem(const void *mem, int size) { SDL_RWops *rwops = NULL; - if (mem == NULL) { + if (!mem) { SDL_InvalidParamError("mem"); return rwops; } @@ -681,7 +715,7 @@ SDL_RWops *SDL_RWFromConstMem(const void *mem, int size) } rwops = SDL_AllocRW(); - if (rwops != NULL) { + if (rwops) { rwops->size = mem_size; rwops->seek = mem_seek; rwops->read = mem_read; @@ -700,7 +734,7 @@ SDL_RWops *SDL_AllocRW(void) SDL_RWops *area; area = (SDL_RWops *)SDL_malloc(sizeof(*area)); - if (area == NULL) { + if (!area) { SDL_OutOfMemory(); } else { area->type = SDL_RWOPS_UNKNOWN; @@ -718,12 +752,12 @@ void *SDL_LoadFile_RW(SDL_RWops *src, size_t *datasize, int freesrc) { static const Sint64 FILE_CHUNK_SIZE = 1024; Sint64 size; - size_t size_read, size_total; + size_t size_read, size_total = 0; void *data = NULL, *newdata; - if (src == NULL) { + if (!src) { SDL_InvalidParamError("src"); - return NULL; + goto done; } size = SDL_RWsize(src); @@ -731,13 +765,16 @@ void *SDL_LoadFile_RW(SDL_RWops *src, size_t *datasize, int freesrc) size = FILE_CHUNK_SIZE; } data = SDL_malloc((size_t)(size + 1)); + if (!data) { + SDL_OutOfMemory(); + goto done; + } - size_total = 0; for (;;) { if ((((Sint64)size_total) + FILE_CHUNK_SIZE) > size) { size = (size_total + FILE_CHUNK_SIZE); newdata = SDL_realloc(data, (size_t)(size + 1)); - if (newdata == NULL) { + if (!newdata) { SDL_free(data); data = NULL; SDL_OutOfMemory(); @@ -753,12 +790,12 @@ void *SDL_LoadFile_RW(SDL_RWops *src, size_t *datasize, int freesrc) size_total += size_read; } - if (datasize) { - *datasize = size_total; - } ((char *)data)[size_total] = '\0'; done: + if (datasize) { + *datasize = size_total; + } if (freesrc && src) { SDL_RWclose(src); } diff --git a/thirdparty/SDL/src/file/cocoa/SDL_rwopsbundlesupport.h b/thirdparty/SDL/src/file/cocoa/SDL_rwopsbundlesupport.h index 17bc86b4f..c57ce4529 100644 --- a/thirdparty/SDL/src/file/cocoa/SDL_rwopsbundlesupport.h +++ b/thirdparty/SDL/src/file/cocoa/SDL_rwopsbundlesupport.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/file/cocoa/SDL_rwopsbundlesupport.m b/thirdparty/SDL/src/file/cocoa/SDL_rwopsbundlesupport.m index 8d6ec7047..1fdce0601 100644 --- a/thirdparty/SDL/src/file/cocoa/SDL_rwopsbundlesupport.m +++ b/thirdparty/SDL/src/file/cocoa/SDL_rwopsbundlesupport.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/file/n3ds/SDL_rwopsromfs.c b/thirdparty/SDL/src/file/n3ds/SDL_rwopsromfs.c index 467bae3c4..9ca81a1b8 100644 --- a/thirdparty/SDL/src/file/n3ds/SDL_rwopsromfs.c +++ b/thirdparty/SDL/src/file/n3ds/SDL_rwopsromfs.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -66,7 +66,7 @@ static FILE *TryOpenFile(const char *file, const char *mode) FILE *fp = NULL; fp = TryOpenInRomfs(file, mode); - if (fp == NULL) { + if (!fp) { fp = fopen(file, mode); } diff --git a/thirdparty/SDL/src/file/n3ds/SDL_rwopsromfs.h b/thirdparty/SDL/src/file/n3ds/SDL_rwopsromfs.h index b7a80a009..1ec156737 100644 --- a/thirdparty/SDL/src/file/n3ds/SDL_rwopsromfs.h +++ b/thirdparty/SDL/src/file/n3ds/SDL_rwopsromfs.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/filesystem/android/SDL_sysfilesystem.c b/thirdparty/SDL/src/filesystem/android/SDL_sysfilesystem.c index 9df679013..5e372987b 100644 --- a/thirdparty/SDL/src/filesystem/android/SDL_sysfilesystem.c +++ b/thirdparty/SDL/src/filesystem/android/SDL_sysfilesystem.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -45,7 +45,7 @@ char *SDL_GetPrefPath(const char *org, const char *app) if (path) { size_t pathlen = SDL_strlen(path) + 2; char *fullpath = (char *)SDL_malloc(pathlen); - if (fullpath == NULL) { + if (!fullpath) { SDL_OutOfMemory(); return NULL; } diff --git a/thirdparty/SDL/src/filesystem/cocoa/SDL_sysfilesystem.m b/thirdparty/SDL/src/filesystem/cocoa/SDL_sysfilesystem.m index 94ee7830e..3d48ef6aa 100644 --- a/thirdparty/SDL/src/filesystem/cocoa/SDL_sysfilesystem.m +++ b/thirdparty/SDL/src/filesystem/cocoa/SDL_sysfilesystem.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/filesystem/dummy/SDL_sysfilesystem.c b/thirdparty/SDL/src/filesystem/dummy/SDL_sysfilesystem.c index 83819edeb..0243cce6d 100644 --- a/thirdparty/SDL/src/filesystem/dummy/SDL_sysfilesystem.c +++ b/thirdparty/SDL/src/filesystem/dummy/SDL_sysfilesystem.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/filesystem/emscripten/SDL_sysfilesystem.c b/thirdparty/SDL/src/filesystem/emscripten/SDL_sysfilesystem.c index af39e3626..316397209 100644 --- a/thirdparty/SDL/src/filesystem/emscripten/SDL_sysfilesystem.c +++ b/thirdparty/SDL/src/filesystem/emscripten/SDL_sysfilesystem.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -45,17 +45,17 @@ char *SDL_GetPrefPath(const char *org, const char *app) char *ptr = NULL; size_t len = 0; - if (app == NULL) { + if (!app) { SDL_InvalidParamError("app"); return NULL; } - if (org == NULL) { + if (!org) { org = ""; } len = SDL_strlen(append) + SDL_strlen(org) + SDL_strlen(app) + 3; retval = (char *)SDL_malloc(len); - if (retval == NULL) { + if (!retval) { SDL_OutOfMemory(); return NULL; } diff --git a/thirdparty/SDL/src/filesystem/gdk/SDL_sysfilesystem.cpp b/thirdparty/SDL/src/filesystem/gdk/SDL_sysfilesystem.cpp new file mode 100644 index 000000000..22cc9c288 --- /dev/null +++ b/thirdparty/SDL/src/filesystem/gdk/SDL_sysfilesystem.cpp @@ -0,0 +1,138 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2024 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +/* System dependent filesystem routines */ + +#include "../../core/windows/SDL_windows.h" +#include "SDL_hints.h" +#include "SDL_system.h" +#include "SDL_filesystem.h" +#include + +char * +SDL_GetBasePath(void) +{ + /* NOTE: This function is a UTF8 version of the Win32 SDL_GetBasePath()! + * The GDK actually _recommends_ the 'A' functions over the 'W' functions :o + */ + DWORD buflen = 128; + CHAR *path = NULL; + DWORD len = 0; + int i; + + while (SDL_TRUE) { + void *ptr = SDL_realloc(path, buflen * sizeof(CHAR)); + if (!ptr) { + SDL_free(path); + SDL_OutOfMemory(); + return NULL; + } + + path = (CHAR *)ptr; + + len = GetModuleFileNameA(NULL, path, buflen); + /* if it truncated, then len >= buflen - 1 */ + /* if there was enough room (or failure), len < buflen - 1 */ + if (len < buflen - 1) { + break; + } + + /* buffer too small? Try again. */ + buflen *= 2; + } + + if (len == 0) { + SDL_free(path); + WIN_SetError("Couldn't locate our .exe"); + return NULL; + } + + for (i = len - 1; i > 0; i--) { + if (path[i] == '\\') { + break; + } + } + + SDL_assert(i > 0); /* Should have been an absolute path. */ + path[i + 1] = '\0'; /* chop off filename. */ + + return path; +} + +char * +SDL_GetPrefPath(const char *org, const char *app) +{ + XUserHandle user = NULL; + XAsyncBlock block = { 0 }; + char *folderPath; + HRESULT result; + const char *csid = SDL_GetHint("SDL_GDK_SERVICE_CONFIGURATION_ID"); + + if (!app) { + SDL_InvalidParamError("app"); + return NULL; + } + + /* This should be set before calling SDL_GetPrefPath! */ + if (!csid) { + SDL_LogWarn(SDL_LOG_CATEGORY_SYSTEM, "Set SDL_GDK_SERVICE_CONFIGURATION_ID before calling SDL_GetPrefPath!"); + return SDL_strdup("T:\\"); + } + + if (SDL_GDKGetDefaultUser(&user) < 0) { + /* Error already set, just return */ + return NULL; + } + + if (FAILED(result = XGameSaveFilesGetFolderWithUiAsync(user, csid, &block))) { + WIN_SetErrorFromHRESULT("XGameSaveFilesGetFolderWithUiAsync", result); + return NULL; + } + + folderPath = (char*) SDL_malloc(MAX_PATH); + do { + result = XGameSaveFilesGetFolderWithUiResult(&block, MAX_PATH, folderPath); + } while (result == E_PENDING); + if (FAILED(result)) { + WIN_SetErrorFromHRESULT("XGameSaveFilesGetFolderWithUiResult", result); + SDL_free(folderPath); + return NULL; + } + + /* We aren't using 'app' here because the container rules are a lot more + * strict than the NTFS rules, so it will most likely be invalid :( + */ + SDL_strlcat(folderPath, "\\SDLPrefPath\\", MAX_PATH); + if (CreateDirectoryA(folderPath, NULL) == FALSE) { + if (GetLastError() != ERROR_ALREADY_EXISTS) { + WIN_SetError("CreateDirectoryA"); + SDL_free(folderPath); + return NULL; + } + } + return folderPath; +} + + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/thirdparty/SDL/src/filesystem/haiku/SDL_sysfilesystem.cc b/thirdparty/SDL/src/filesystem/haiku/SDL_sysfilesystem.cc index b6dc7d136..5585c48c6 100644 --- a/thirdparty/SDL/src/filesystem/haiku/SDL_sysfilesystem.cc +++ b/thirdparty/SDL/src/filesystem/haiku/SDL_sysfilesystem.cc @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -56,7 +56,7 @@ char *SDL_GetBasePath(void) const size_t len = SDL_strlen(str); char *retval = (char *) SDL_malloc(len + 2); - if (retval == NULL) { + if (!retval) { SDL_OutOfMemory(); return NULL; } @@ -75,11 +75,11 @@ char *SDL_GetPrefPath(const char *org, const char *app) const char *append = "/config/settings/"; size_t len = SDL_strlen(home); - if (app == NULL) { + if (!app) { SDL_InvalidParamError("app"); return NULL; } - if (org == NULL) { + if (!org) { org = ""; } @@ -88,7 +88,7 @@ char *SDL_GetPrefPath(const char *org, const char *app) } len += SDL_strlen(append) + SDL_strlen(org) + SDL_strlen(app) + 3; char *retval = (char *) SDL_malloc(len); - if (retval == NULL) { + if (!retval) { SDL_OutOfMemory(); } else { if (*org) { diff --git a/thirdparty/SDL/src/filesystem/n3ds/SDL_sysfilesystem.c b/thirdparty/SDL/src/filesystem/n3ds/SDL_sysfilesystem.c index fe2fd3ff8..fe4607621 100644 --- a/thirdparty/SDL/src/filesystem/n3ds/SDL_sysfilesystem.c +++ b/thirdparty/SDL/src/filesystem/n3ds/SDL_sysfilesystem.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -44,13 +44,13 @@ char *SDL_GetBasePath(void) char *SDL_GetPrefPath(const char *org, const char *app) { char *pref_path = NULL; - if (app == NULL) { + if (!app) { SDL_InvalidParamError("app"); return NULL; } pref_path = MakePrefPath(app); - if (pref_path == NULL) { + if (!pref_path) { return NULL; } diff --git a/thirdparty/SDL/src/filesystem/nacl/SDL_sysfilesystem.c b/thirdparty/SDL/src/filesystem/nacl/SDL_sysfilesystem.c index 91e7a9881..1ef34dd0c 100644 --- a/thirdparty/SDL/src/filesystem/nacl/SDL_sysfilesystem.c +++ b/thirdparty/SDL/src/filesystem/nacl/SDL_sysfilesystem.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/filesystem/os2/SDL_sysfilesystem.c b/thirdparty/SDL/src/filesystem/os2/SDL_sysfilesystem.c index fb7d52815..4e9597f0c 100644 --- a/thirdparty/SDL/src/filesystem/os2/SDL_sysfilesystem.c +++ b/thirdparty/SDL/src/filesystem/os2/SDL_sysfilesystem.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/filesystem/ps2/SDL_sysfilesystem.c b/thirdparty/SDL/src/filesystem/ps2/SDL_sysfilesystem.c index 86dcb14b6..6b6446656 100644 --- a/thirdparty/SDL/src/filesystem/ps2/SDL_sysfilesystem.c +++ b/thirdparty/SDL/src/filesystem/ps2/SDL_sysfilesystem.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -82,11 +82,11 @@ char *SDL_GetPrefPath(const char *org, const char *app) char *retval = NULL; size_t len; char *base = SDL_GetBasePath(); - if (app == NULL) { + if (!app) { SDL_InvalidParamError("app"); return NULL; } - if (org == NULL) { + if (!org) { org = ""; } diff --git a/thirdparty/SDL/src/filesystem/psp/SDL_sysfilesystem.c b/thirdparty/SDL/src/filesystem/psp/SDL_sysfilesystem.c index c163fa146..7ed87e0eb 100644 --- a/thirdparty/SDL/src/filesystem/psp/SDL_sysfilesystem.c +++ b/thirdparty/SDL/src/filesystem/psp/SDL_sysfilesystem.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -50,11 +50,11 @@ char *SDL_GetPrefPath(const char *org, const char *app) char *retval = NULL; size_t len; char *base = SDL_GetBasePath(); - if (app == NULL) { + if (!app) { SDL_InvalidParamError("app"); return NULL; } - if (org == NULL) { + if (!org) { org = ""; } diff --git a/thirdparty/SDL/src/filesystem/riscos/SDL_sysfilesystem.c b/thirdparty/SDL/src/filesystem/riscos/SDL_sysfilesystem.c index 253734065..461789554 100644 --- a/thirdparty/SDL/src/filesystem/riscos/SDL_sysfilesystem.c +++ b/thirdparty/SDL/src/filesystem/riscos/SDL_sysfilesystem.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -38,21 +38,21 @@ static char *SDL_unixify_std(const char *ro_path, char *buffer, size_t buf_len, { const char *const in_buf = buffer; /* = NULL if we allocate the buffer. */ - if (buffer == NULL) { + if (!buffer) { /* This matches the logic in __unixify, with an additional byte for the * extra path separator. */ buf_len = SDL_strlen(ro_path) + 14 + 1; buffer = SDL_malloc(buf_len); - if (buffer == NULL) { + if (!buffer) { SDL_OutOfMemory(); return NULL; } } if (!__unixify_std(ro_path, buffer, buf_len, filetype)) { - if (in_buf == NULL) { + if (!in_buf) { SDL_free(buffer); } @@ -92,7 +92,7 @@ static char *canonicalisePath(const char *path, const char *pathVar) regs.r[5] = 1 - regs.r[5]; buf = SDL_malloc(regs.r[5]); - if (buf == NULL) { + if (!buf) { SDL_OutOfMemory(); return NULL; } @@ -121,7 +121,7 @@ static _kernel_oserror *createDirectoryRecursive(char *path) *ptr = '\0'; error = _kernel_swi(OS_File, ®s, ®s); *ptr = '.'; - if (error != NULL) { + if (error) { return error; } } @@ -141,13 +141,13 @@ char *SDL_GetBasePath(void) } canon = canonicalisePath((const char *)regs.r[0], "Run$Path"); - if (canon == NULL) { + if (!canon) { return NULL; } /* chop off filename. */ ptr = SDL_strrchr(canon, '.'); - if (ptr != NULL) { + if (ptr) { *ptr = '\0'; } @@ -162,22 +162,22 @@ char *SDL_GetPrefPath(const char *org, const char *app) size_t len; _kernel_oserror *error; - if (app == NULL) { + if (!app) { SDL_InvalidParamError("app"); return NULL; } - if (org == NULL) { + if (!org) { org = ""; } canon = canonicalisePath("", "Run$Path"); - if (canon == NULL) { + if (!canon) { return NULL; } len = SDL_strlen(canon) + SDL_strlen(org) + SDL_strlen(app) + 4; dir = (char *)SDL_malloc(len); - if (dir == NULL) { + if (!dir) { SDL_OutOfMemory(); SDL_free(canon); return NULL; @@ -192,7 +192,7 @@ char *SDL_GetPrefPath(const char *org, const char *app) SDL_free(canon); error = createDirectoryRecursive(dir); - if (error != NULL) { + if (error) { SDL_SetError("Couldn't create directory: %s", error->errmess); SDL_free(dir); return NULL; diff --git a/thirdparty/SDL/src/filesystem/unix/SDL_sysfilesystem.c b/thirdparty/SDL/src/filesystem/unix/SDL_sysfilesystem.c index 42e6e48ae..c69a99168 100644 --- a/thirdparty/SDL/src/filesystem/unix/SDL_sysfilesystem.c +++ b/thirdparty/SDL/src/filesystem/unix/SDL_sysfilesystem.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -53,7 +53,7 @@ static char *readSymLink(const char *path) while (1) { char *ptr = (char *)SDL_realloc(retval, (size_t)len); - if (ptr == NULL) { + if (!ptr) { SDL_OutOfMemory(); break; } @@ -86,13 +86,13 @@ static char *search_path_for_binary(const char *bin) char *start = envr; char *ptr; - if (envr == NULL) { + if (!envr) { SDL_SetError("No $PATH set"); return NULL; } envr = SDL_strdup(envr); - if (envr == NULL) { + if (!envr) { SDL_OutOfMemory(); return NULL; } @@ -118,7 +118,7 @@ static char *search_path_for_binary(const char *bin) } } start = ptr + 1; /* start points to beginning of next element. */ - } while (ptr != NULL); + } while (ptr); SDL_free(envr); SDL_free(exe); @@ -138,7 +138,7 @@ char *SDL_GetBasePath(void) const int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1 }; if (sysctl(mib, SDL_arraysize(mib), fullpath, &buflen, NULL, 0) != -1) { retval = SDL_strdup(fullpath); - if (retval == NULL) { + if (!retval) { SDL_OutOfMemory(); return NULL; } @@ -152,13 +152,13 @@ char *SDL_GetBasePath(void) if (sysctl(mib, 4, NULL, &len, NULL, 0) != -1) { char *exe, *pwddst; char *realpathbuf = (char *)SDL_malloc(PATH_MAX + 1); - if (realpathbuf == NULL) { + if (!realpathbuf) { SDL_OutOfMemory(); return NULL; } cmdline = SDL_malloc(len); - if (cmdline == NULL) { + if (!cmdline) { SDL_free(realpathbuf); SDL_OutOfMemory(); return NULL; @@ -180,7 +180,7 @@ char *SDL_GetBasePath(void) } if (exe) { - if (pwddst == NULL) { + if (!pwddst) { if (realpath(exe, realpathbuf) != NULL) { retval = realpathbuf; } @@ -196,7 +196,7 @@ char *SDL_GetBasePath(void) } } - if (retval == NULL) { + if (!retval) { SDL_free(realpathbuf); } @@ -205,7 +205,7 @@ char *SDL_GetBasePath(void) #endif /* is a Linux-style /proc filesystem available? */ - if (retval == NULL && (access("/proc", F_OK) == 0)) { + if (!retval && (access("/proc", F_OK) == 0)) { /* !!! FIXME: after 2.0.6 ships, let's delete this code and just use the /proc/%llu version. There's no reason to have two copies of this plus all the #ifdefs. --ryan. */ @@ -219,7 +219,7 @@ char *SDL_GetBasePath(void) retval = SDL_LoadFile("/proc/self/exefile", NULL); #else retval = readSymLink("/proc/self/exe"); /* linux. */ - if (retval == NULL) { + if (!retval) { /* older kernels don't have /proc/self ... try PID version... */ char path[64]; const int rc = SDL_snprintf(path, sizeof(path), @@ -248,9 +248,9 @@ char *SDL_GetBasePath(void) /* If we had access to argv[0] here, we could check it for a path, or troll through $PATH looking for it, too. */ - if (retval != NULL) { /* chop off filename. */ + if (retval) { /* chop off filename. */ char *ptr = SDL_strrchr(retval, '/'); - if (ptr != NULL) { + if (ptr) { *(ptr + 1) = '\0'; } else { /* shouldn't happen, but just in case... */ SDL_free(retval); @@ -258,10 +258,10 @@ char *SDL_GetBasePath(void) } } - if (retval != NULL) { + if (retval) { /* try to shrink buffer... */ char *ptr = (char *)SDL_realloc(retval, SDL_strlen(retval) + 1); - if (ptr != NULL) { + if (ptr) { retval = ptr; /* oh well if it failed. */ } } @@ -284,18 +284,18 @@ char *SDL_GetPrefPath(const char *org, const char *app) char *ptr = NULL; size_t len = 0; - if (app == NULL) { + if (!app) { SDL_InvalidParamError("app"); return NULL; } - if (org == NULL) { + if (!org) { org = ""; } - if (envr == NULL) { + if (!envr) { /* You end up with "$HOME/.local/share/Game Name 2" */ envr = SDL_getenv("HOME"); - if (envr == NULL) { + if (!envr) { /* we could take heroic measures with /etc/passwd, but oh well. */ SDL_SetError("neither XDG_DATA_HOME nor HOME environment is set"); return NULL; @@ -312,7 +312,7 @@ char *SDL_GetPrefPath(const char *org, const char *app) len += SDL_strlen(append) + SDL_strlen(org) + SDL_strlen(app) + 3; retval = (char *)SDL_malloc(len); - if (retval == NULL) { + if (!retval) { SDL_OutOfMemory(); return NULL; } diff --git a/thirdparty/SDL/src/filesystem/vita/SDL_sysfilesystem.c b/thirdparty/SDL/src/filesystem/vita/SDL_sysfilesystem.c index bb572708a..eb7e159ef 100644 --- a/thirdparty/SDL/src/filesystem/vita/SDL_sysfilesystem.c +++ b/thirdparty/SDL/src/filesystem/vita/SDL_sysfilesystem.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -53,11 +53,11 @@ char *SDL_GetPrefPath(const char *org, const char *app) char *ptr = NULL; size_t len = 0; - if (app == NULL) { + if (!app) { SDL_InvalidParamError("app"); return NULL; } - if (org == NULL) { + if (!org) { org = ""; } @@ -65,7 +65,7 @@ char *SDL_GetPrefPath(const char *org, const char *app) len += SDL_strlen(org) + SDL_strlen(app) + 3; retval = (char *)SDL_malloc(len); - if (retval == NULL) { + if (!retval) { SDL_OutOfMemory(); return NULL; } diff --git a/thirdparty/SDL/src/filesystem/windows/SDL_sysfilesystem.c b/thirdparty/SDL/src/filesystem/windows/SDL_sysfilesystem.c index 06842706f..a65329117 100644 --- a/thirdparty/SDL/src/filesystem/windows/SDL_sysfilesystem.c +++ b/thirdparty/SDL/src/filesystem/windows/SDL_sysfilesystem.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -42,7 +42,7 @@ char *SDL_GetBasePath(void) while (SDL_TRUE) { void *ptr = SDL_realloc(path, buflen * sizeof(WCHAR)); - if (ptr == NULL) { + if (!ptr) { SDL_free(path); SDL_OutOfMemory(); return NULL; @@ -99,11 +99,11 @@ char *SDL_GetPrefPath(const char *org, const char *app) size_t new_wpath_len = 0; BOOL api_result = FALSE; - if (app == NULL) { + if (!app) { SDL_InvalidParamError("app"); return NULL; } - if (org == NULL) { + if (!org) { org = ""; } @@ -113,13 +113,13 @@ char *SDL_GetPrefPath(const char *org, const char *app) } worg = WIN_UTF8ToStringW(org); - if (worg == NULL) { + if (!worg) { SDL_OutOfMemory(); return NULL; } wapp = WIN_UTF8ToStringW(app); - if (wapp == NULL) { + if (!wapp) { SDL_free(worg); SDL_OutOfMemory(); return NULL; @@ -170,20 +170,4 @@ char *SDL_GetPrefPath(const char *org, const char *app) #endif /* SDL_FILESYSTEM_WINDOWS */ -#ifdef SDL_FILESYSTEM_XBOX -#include "SDL_filesystem.h" -#include "SDL_error.h" -char *SDL_GetBasePath(void) -{ - SDL_Unsupported(); - return NULL; -} - -char *SDL_GetPrefPath(const char *org, const char *app) -{ - SDL_Unsupported(); - return NULL; -} -#endif /* SDL_FILESYSTEM_XBOX */ - /* vi: set ts=4 sw=4 expandtab: */ diff --git a/thirdparty/SDL/src/filesystem/winrt/SDL_sysfilesystem.cpp b/thirdparty/SDL/src/filesystem/winrt/SDL_sysfilesystem.cpp index b8ba6fdec..85cfd190e 100644 --- a/thirdparty/SDL/src/filesystem/winrt/SDL_sysfilesystem.cpp +++ b/thirdparty/SDL/src/filesystem/winrt/SDL_sysfilesystem.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -71,7 +71,7 @@ SDL_WinRTGetFSPathUNICODE(SDL_WinRT_Path pathType) return path.c_str(); } -#if (WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP) || (NTDDI_VERSION > NTDDI_WIN8) +#if !SDL_WINAPI_FAMILY_PHONE || (NTDDI_VERSION > NTDDI_WIN8) case SDL_WINRT_PATH_ROAMING_FOLDER: { static wstring path; @@ -111,7 +111,7 @@ SDL_WinRTGetFSPathUTF8(SDL_WinRT_Path pathType) } const wchar_t *ucs2Path = SDL_WinRTGetFSPathUNICODE(pathType); - if (ucs2Path == NULL) { + if (!ucs2Path) { return NULL; } @@ -128,14 +128,14 @@ SDL_GetBasePath(void) size_t destPathLen; char *destPath = NULL; - if (srcPath == NULL) { + if (!srcPath) { SDL_SetError("Couldn't locate our basepath: %s", SDL_GetError()); return NULL; } destPathLen = SDL_strlen(srcPath) + 2; destPath = (char *)SDL_malloc(destPathLen); - if (destPath == NULL) { + if (!destPath) { SDL_OutOfMemory(); return NULL; } @@ -161,16 +161,16 @@ SDL_GetPrefPath(const char *org, const char *app) size_t new_wpath_len = 0; BOOL api_result = FALSE; - if (app == NULL) { + if (!app) { SDL_InvalidParamError("app"); return NULL; } - if (org == NULL) { + if (!org) { org = ""; } srcPath = SDL_WinRTGetFSPathUNICODE(SDL_WINRT_PATH_LOCAL_FOLDER); - if (srcPath == NULL) { + if (!srcPath) { SDL_SetError("Unable to find a source path"); return NULL; } @@ -182,13 +182,13 @@ SDL_GetPrefPath(const char *org, const char *app) SDL_wcslcpy(path, srcPath, SDL_arraysize(path)); worg = WIN_UTF8ToString(org); - if (worg == NULL) { + if (!worg) { SDL_OutOfMemory(); return NULL; } wapp = WIN_UTF8ToString(app); - if (wapp == NULL) { + if (!wapp) { SDL_free(worg); SDL_OutOfMemory(); return NULL; diff --git a/thirdparty/SDL/src/haptic/SDL_haptic.c b/thirdparty/SDL/src/haptic/SDL_haptic.c index ee64bcbd2..256d6677a 100644 --- a/thirdparty/SDL/src/haptic/SDL_haptic.c +++ b/thirdparty/SDL/src/haptic/SDL_haptic.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,7 +25,7 @@ #include "../joystick/SDL_joystick_c.h" /* For SDL_PrivateJoystickValid */ /* Global for SDL_windowshaptic.c */ -#if (defined(SDL_HAPTIC_DINPUT) && SDL_HAPTIC_DINPUT) || (defined(SDL_HAPTIC_XINPUT) && SDL_HAPTIC_XINPUT) +#if defined(SDL_HAPTIC_DINPUT) || defined(SDL_HAPTIC_XINPUT) SDL_Haptic *SDL_haptics = NULL; #else static SDL_Haptic *SDL_haptics = NULL; @@ -55,7 +55,7 @@ static int ValidHaptic(SDL_Haptic *haptic) SDL_Haptic *hapticlist; valid = 0; - if (haptic != NULL) { + if (haptic) { hapticlist = SDL_haptics; while (hapticlist) { if (hapticlist == haptic) { @@ -124,7 +124,7 @@ SDL_Haptic *SDL_HapticOpen(int device_index) /* Create the haptic device */ haptic = (SDL_Haptic *)SDL_malloc(sizeof(*haptic)); - if (haptic == NULL) { + if (!haptic) { SDL_OutOfMemory(); return NULL; } @@ -296,7 +296,7 @@ SDL_Haptic *SDL_HapticOpenFromJoystick(SDL_Joystick *joystick) /* Create the haptic device */ haptic = (SDL_Haptic *)SDL_malloc(sizeof(*haptic)); - if (haptic == NULL) { + if (!haptic) { SDL_OutOfMemory(); SDL_UnlockJoysticks(); return NULL; @@ -609,7 +609,7 @@ int SDL_HapticSetGain(SDL_Haptic *haptic, int gain) /* We use the envvar to get the maximum gain. */ env = SDL_getenv("SDL_HAPTIC_GAIN_MAX"); - if (env != NULL) { + if (env) { max_gain = SDL_atoi(env); /* Check for sanity. */ diff --git a/thirdparty/SDL/src/haptic/SDL_haptic_c.h b/thirdparty/SDL/src/haptic/SDL_haptic_c.h index 55e791f60..a1b1ed713 100644 --- a/thirdparty/SDL/src/haptic/SDL_haptic_c.h +++ b/thirdparty/SDL/src/haptic/SDL_haptic_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/haptic/SDL_syshaptic.h b/thirdparty/SDL/src/haptic/SDL_syshaptic.h index f81295120..31f37dde1 100644 --- a/thirdparty/SDL/src/haptic/SDL_syshaptic.h +++ b/thirdparty/SDL/src/haptic/SDL_syshaptic.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/haptic/android/SDL_syshaptic.c b/thirdparty/SDL/src/haptic/android/SDL_syshaptic.c index 111c43c0b..15fbdd280 100644 --- a/thirdparty/SDL/src/haptic/android/SDL_syshaptic.c +++ b/thirdparty/SDL/src/haptic/android/SDL_syshaptic.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -80,7 +80,7 @@ static SDL_hapticlist_item *HapticByOrder(int index) static SDL_hapticlist_item *HapticByDevId(int device_id) { SDL_hapticlist_item *item; - for (item = SDL_hapticlist; item != NULL; item = item->next) { + for (item = SDL_hapticlist; item; item = item->next) { if (device_id == item->device_id) { /*SDL_Log("=+=+=+=+=+= HapticByDevId id [%d]", device_id);*/ return item; @@ -92,7 +92,7 @@ static SDL_hapticlist_item *HapticByDevId(int device_id) const char *SDL_SYS_HapticName(int index) { SDL_hapticlist_item *item = HapticByOrder(index); - if (item == NULL) { + if (!item) { SDL_SetError("No such device"); return NULL; } @@ -101,11 +101,11 @@ const char *SDL_SYS_HapticName(int index) static SDL_hapticlist_item *OpenHaptic(SDL_Haptic *haptic, SDL_hapticlist_item *item) { - if (item == NULL) { + if (!item) { SDL_SetError("No such device"); return NULL; } - if (item->haptic != NULL) { + if (item->haptic) { SDL_SetError("Haptic already opened"); return NULL; } @@ -117,7 +117,7 @@ static SDL_hapticlist_item *OpenHaptic(SDL_Haptic *haptic, SDL_hapticlist_item * haptic->neffects = 1; haptic->nplaying = haptic->neffects; haptic->effects = (struct haptic_effect *)SDL_malloc(sizeof(struct haptic_effect) * haptic->neffects); - if (haptic->effects == NULL) { + if (!haptic->effects) { SDL_OutOfMemory(); return NULL; } @@ -149,7 +149,7 @@ int SDL_SYS_JoystickIsHaptic(SDL_Joystick *joystick) { SDL_hapticlist_item *item; item = HapticByDevId(((joystick_hwdata *)joystick->hwdata)->device_id); - return (item != NULL) ? 1 : 0; + return (item) ? 1 : 0; } int SDL_SYS_HapticOpenFromJoystick(SDL_Haptic *haptic, SDL_Joystick *joystick) @@ -257,18 +257,18 @@ int Android_AddHaptic(int device_id, const char *name) { SDL_hapticlist_item *item; item = (SDL_hapticlist_item *)SDL_calloc(1, sizeof(SDL_hapticlist_item)); - if (item == NULL) { + if (!item) { return -1; } item->device_id = device_id; item->name = SDL_strdup(name); - if (item->name == NULL) { + if (!item->name) { SDL_free(item); return -1; } - if (SDL_hapticlist_tail == NULL) { + if (!SDL_hapticlist_tail) { SDL_hapticlist = SDL_hapticlist_tail = item; } else { SDL_hapticlist_tail->next = item; @@ -284,12 +284,12 @@ int Android_RemoveHaptic(int device_id) SDL_hapticlist_item *item; SDL_hapticlist_item *prev = NULL; - for (item = SDL_hapticlist; item != NULL; item = item->next) { + for (item = SDL_hapticlist; item; item = item->next) { /* found it, remove it. */ if (device_id == item->device_id) { const int retval = item->haptic ? item->haptic->index : -1; - if (prev != NULL) { + if (prev) { prev->next = item->next; } else { SDL_assert(SDL_hapticlist == item); diff --git a/thirdparty/SDL/src/haptic/darwin/SDL_syshaptic.c b/thirdparty/SDL/src/haptic/darwin/SDL_syshaptic.c index dea1ee7c2..d33e4d6aa 100644 --- a/thirdparty/SDL/src/haptic/darwin/SDL_syshaptic.c +++ b/thirdparty/SDL/src/haptic/darwin/SDL_syshaptic.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -157,7 +157,7 @@ int SDL_SYS_HapticInit(void) /* Get HID devices. */ match = IOServiceMatching(kIOHIDDeviceKey); - if (match == NULL) { + if (!match) { return SDL_SetError("Haptic: Failed to get IOServiceMatching."); } @@ -229,7 +229,7 @@ int MacHaptic_MaybeAddDevice(io_object_t device) } item = (SDL_hapticlist_item *)SDL_calloc(1, sizeof(SDL_hapticlist_item)); - if (item == NULL) { + if (!item) { return SDL_SetError("Could not allocate haptic storage"); } @@ -265,7 +265,7 @@ int MacHaptic_MaybeAddDevice(io_object_t device) CFRelease(hidProperties); } - if (SDL_hapticlist_tail == NULL) { + if (!SDL_hapticlist_tail) { SDL_hapticlist = SDL_hapticlist_tail = item; } else { SDL_hapticlist_tail->next = item; @@ -287,12 +287,12 @@ int MacHaptic_MaybeRemoveDevice(io_object_t device) return -1; /* not initialized. ignore this. */ } - for (item = SDL_hapticlist; item != NULL; item = item->next) { + for (item = SDL_hapticlist; item; item = item->next) { /* found it, remove it. */ if (IOObjectIsEqualTo((io_object_t)item->dev, device)) { const int retval = item->haptic ? item->haptic->index : -1; - if (prev != NULL) { + if (prev) { prev->next = item->next; } else { SDL_assert(SDL_hapticlist == item); @@ -478,7 +478,7 @@ static int SDL_SYS_HapticOpenFromService(SDL_Haptic *haptic, io_service_t servic /* Allocate the hwdata */ haptic->hwdata = (struct haptic_hwdata *) SDL_malloc(sizeof(*haptic->hwdata)); - if (haptic->hwdata == NULL) { + if (!haptic->hwdata) { SDL_OutOfMemory(); goto creat_err; } @@ -516,7 +516,7 @@ static int SDL_SYS_HapticOpenFromService(SDL_Haptic *haptic, io_service_t servic /* Allocate effects memory. */ haptic->effects = (struct haptic_effect *) SDL_malloc(sizeof(struct haptic_effect) * haptic->neffects); - if (haptic->effects == NULL) { + if (!haptic->effects) { SDL_OutOfMemory(); goto open_err; } @@ -530,7 +530,7 @@ static int SDL_SYS_HapticOpenFromService(SDL_Haptic *haptic, io_service_t servic open_err: FFReleaseDevice(haptic->hwdata->device); creat_err: - if (haptic->hwdata != NULL) { + if (haptic->hwdata) { SDL_free(haptic->hwdata); haptic->hwdata = NULL; } @@ -703,7 +703,7 @@ static int SDL_SYS_SetDirection(FFEFFECT *effect, SDL_HapticDirection *dir, int /* Has axes. */ rglDir = SDL_malloc(sizeof(LONG) * naxes); - if (rglDir == NULL) { + if (!rglDir) { return SDL_OutOfMemory(); } SDL_memset(rglDir, 0, sizeof(LONG) * naxes); @@ -776,7 +776,7 @@ static int SDL_SYS_ToFFEFFECT(SDL_Haptic *haptic, FFEFFECT *dest, SDL_HapticEffe /* Envelope. */ envelope = SDL_malloc(sizeof(FFENVELOPE)); - if (envelope == NULL) { + if (!envelope) { return SDL_OutOfMemory(); } SDL_memset(envelope, 0, sizeof(FFENVELOPE)); @@ -791,7 +791,7 @@ static int SDL_SYS_ToFFEFFECT(SDL_Haptic *haptic, FFEFFECT *dest, SDL_HapticEffe } if (dest->cAxes > 0) { axes = SDL_malloc(sizeof(DWORD) * dest->cAxes); - if (axes == NULL) { + if (!axes) { return SDL_OutOfMemory(); } axes[0] = haptic->hwdata->axes[0]; /* Always at least one axis. */ @@ -809,7 +809,7 @@ static int SDL_SYS_ToFFEFFECT(SDL_Haptic *haptic, FFEFFECT *dest, SDL_HapticEffe case SDL_HAPTIC_CONSTANT: hap_constant = &src->constant; constant = SDL_malloc(sizeof(FFCONSTANTFORCE)); - if (constant == NULL) { + if (!constant) { return SDL_OutOfMemory(); } SDL_memset(constant, 0, sizeof(FFCONSTANTFORCE)); @@ -851,7 +851,7 @@ static int SDL_SYS_ToFFEFFECT(SDL_Haptic *haptic, FFEFFECT *dest, SDL_HapticEffe case SDL_HAPTIC_SAWTOOTHDOWN: hap_periodic = &src->periodic; periodic = SDL_malloc(sizeof(FFPERIODIC)); - if (periodic == NULL) { + if (!periodic) { return SDL_OutOfMemory(); } SDL_memset(periodic, 0, sizeof(FFPERIODIC)); @@ -896,7 +896,7 @@ static int SDL_SYS_ToFFEFFECT(SDL_Haptic *haptic, FFEFFECT *dest, SDL_HapticEffe hap_condition = &src->condition; if (dest->cAxes > 0) { condition = SDL_malloc(sizeof(FFCONDITION) * dest->cAxes); - if (condition == NULL) { + if (!condition) { return SDL_OutOfMemory(); } SDL_memset(condition, 0, sizeof(FFCONDITION)); @@ -939,7 +939,7 @@ static int SDL_SYS_ToFFEFFECT(SDL_Haptic *haptic, FFEFFECT *dest, SDL_HapticEffe case SDL_HAPTIC_RAMP: hap_ramp = &src->ramp; ramp = SDL_malloc(sizeof(FFRAMPFORCE)); - if (ramp == NULL) { + if (!ramp) { return SDL_OutOfMemory(); } SDL_memset(ramp, 0, sizeof(FFRAMPFORCE)); @@ -977,7 +977,7 @@ static int SDL_SYS_ToFFEFFECT(SDL_Haptic *haptic, FFEFFECT *dest, SDL_HapticEffe case SDL_HAPTIC_CUSTOM: hap_custom = &src->custom; custom = SDL_malloc(sizeof(FFCUSTOMFORCE)); - if (custom == NULL) { + if (!custom) { return SDL_OutOfMemory(); } SDL_memset(custom, 0, sizeof(FFCUSTOMFORCE)); @@ -1037,7 +1037,7 @@ static void SDL_SYS_HapticFreeFFEFFECT(FFEFFECT *effect, int type) effect->lpEnvelope = NULL; SDL_free(effect->rgdwAxes); effect->rgdwAxes = NULL; - if (effect->lpvTypeSpecificParams != NULL) { + if (effect->lpvTypeSpecificParams) { if (type == SDL_HAPTIC_CUSTOM) { /* Must free the custom data. */ custom = (FFCUSTOMFORCE *)effect->lpvTypeSpecificParams; SDL_free(custom->rglForceData); @@ -1112,14 +1112,14 @@ int SDL_SYS_HapticNewEffect(SDL_Haptic *haptic, struct haptic_effect *effect, /* Alloc the effect. */ effect->hweffect = (struct haptic_hweffect *) SDL_malloc(sizeof(struct haptic_hweffect)); - if (effect->hweffect == NULL) { + if (!effect->hweffect) { SDL_OutOfMemory(); goto err_hweffect; } /* Get the type. */ type = SDL_SYS_HapticEffectType(base->type); - if (type == NULL) { + if (!type) { goto err_hweffect; } diff --git a/thirdparty/SDL/src/haptic/darwin/SDL_syshaptic_c.h b/thirdparty/SDL/src/haptic/darwin/SDL_syshaptic_c.h index 8247fe884..49b54bb2c 100644 --- a/thirdparty/SDL/src/haptic/darwin/SDL_syshaptic_c.h +++ b/thirdparty/SDL/src/haptic/darwin/SDL_syshaptic_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/haptic/dummy/SDL_syshaptic.c b/thirdparty/SDL/src/haptic/dummy/SDL_syshaptic.c index 433093ccb..861aa6ed1 100644 --- a/thirdparty/SDL/src/haptic/dummy/SDL_syshaptic.c +++ b/thirdparty/SDL/src/haptic/dummy/SDL_syshaptic.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/haptic/linux/SDL_syshaptic.c b/thirdparty/SDL/src/haptic/linux/SDL_syshaptic.c index 55a8ca1a1..a21c11861 100644 --- a/thirdparty/SDL/src/haptic/linux/SDL_syshaptic.c +++ b/thirdparty/SDL/src/haptic/linux/SDL_syshaptic.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -46,7 +46,7 @@ #define MAX_HAPTICS 32 /* It's doubtful someone has more then 32 evdev */ static int MaybeAddDevice(const char *path); -#if SDL_USE_LIBUDEV +#ifdef SDL_USE_LIBUDEV static int MaybeRemoveDevice(const char *path); static void haptic_udev_callback(SDL_UDEV_deviceevent udev_type, int udev_class, const char *devpath); #endif /* SDL_USE_LIBUDEV */ @@ -164,7 +164,7 @@ int SDL_SYS_HapticInit(void) MaybeAddDevice(path); } -#if SDL_USE_LIBUDEV +#ifdef SDL_USE_LIBUDEV if (SDL_UDEV_Init() < 0) { return SDL_SetError("Could not initialize UDEV"); } @@ -203,10 +203,10 @@ static SDL_hapticlist_item *HapticByDevIndex(int device_index) return item; } -#if SDL_USE_LIBUDEV +#ifdef SDL_USE_LIBUDEV static void haptic_udev_callback(SDL_UDEV_deviceevent udev_type, int udev_class, const char *devpath) { - if (devpath == NULL || !(udev_class & SDL_UDEV_DEVICE_JOYSTICK)) { + if (!devpath || !(udev_class & SDL_UDEV_DEVICE_JOYSTICK)) { return; } @@ -232,7 +232,7 @@ static int MaybeAddDevice(const char *path) int success; SDL_hapticlist_item *item; - if (path == NULL) { + if (!path) { return -1; } @@ -242,7 +242,7 @@ static int MaybeAddDevice(const char *path) } /* check for duplicates */ - for (item = SDL_hapticlist; item != NULL; item = item->next) { + for (item = SDL_hapticlist; item; item = item->next) { if (item->dev_num == sb.st_rdev) { return -1; /* duplicate. */ } @@ -266,12 +266,12 @@ static int MaybeAddDevice(const char *path) } item = (SDL_hapticlist_item *)SDL_calloc(1, sizeof(SDL_hapticlist_item)); - if (item == NULL) { + if (!item) { return -1; } item->fname = SDL_strdup(path); - if (item->fname == NULL) { + if (!item->fname) { SDL_free(item); return -1; } @@ -279,7 +279,7 @@ static int MaybeAddDevice(const char *path) item->dev_num = sb.st_rdev; /* TODO: should we add instance IDs? */ - if (SDL_hapticlist_tail == NULL) { + if (!SDL_hapticlist_tail) { SDL_hapticlist = SDL_hapticlist_tail = item; } else { SDL_hapticlist_tail->next = item; @@ -293,22 +293,22 @@ static int MaybeAddDevice(const char *path) return numhaptics; } -#if SDL_USE_LIBUDEV +#ifdef SDL_USE_LIBUDEV static int MaybeRemoveDevice(const char *path) { SDL_hapticlist_item *item; SDL_hapticlist_item *prev = NULL; - if (path == NULL) { + if (!path) { return -1; } - for (item = SDL_hapticlist; item != NULL; item = item->next) { + for (item = SDL_hapticlist; item; item = item->next) { /* found it, remove it. */ if (SDL_strcmp(path, item->fname) == 0) { const int retval = item->haptic ? item->haptic->index : -1; - if (prev != NULL) { + if (prev) { prev->next = item->next; } else { SDL_assert(SDL_hapticlist == item); @@ -365,7 +365,7 @@ const char *SDL_SYS_HapticName(int index) if (fd >= 0) { name = SDL_SYS_HapticNameFromFD(fd); - if (name == NULL) { + if (!name) { /* No name found, return device character device */ name = item->fname; } @@ -383,7 +383,7 @@ static int SDL_SYS_HapticOpenFromFD(SDL_Haptic *haptic, int fd) /* Allocate the hwdata */ haptic->hwdata = (struct haptic_hwdata *) SDL_malloc(sizeof(*haptic->hwdata)); - if (haptic->hwdata == NULL) { + if (!haptic->hwdata) { SDL_OutOfMemory(); goto open_err; } @@ -403,7 +403,7 @@ static int SDL_SYS_HapticOpenFromFD(SDL_Haptic *haptic, int fd) haptic->nplaying = haptic->neffects; /* Linux makes no distinction. */ haptic->effects = (struct haptic_effect *) SDL_malloc(sizeof(struct haptic_effect) * haptic->neffects); - if (haptic->effects == NULL) { + if (!haptic->effects) { SDL_OutOfMemory(); goto open_err; } @@ -416,7 +416,7 @@ static int SDL_SYS_HapticOpenFromFD(SDL_Haptic *haptic, int fd) /* Error handling */ open_err: close(fd); - if (haptic->hwdata != NULL) { + if (haptic->hwdata) { SDL_free(haptic->hwdata); haptic->hwdata = NULL; } @@ -608,7 +608,7 @@ void SDL_SYS_HapticQuit(void) SDL_free(item); } -#if SDL_USE_LIBUDEV +#ifdef SDL_USE_LIBUDEV SDL_UDEV_DelCallback(haptic_udev_callback); SDL_UDEV_Quit(); #endif /* SDL_USE_LIBUDEV */ @@ -647,17 +647,6 @@ static int SDL_SYS_ToDirection(Uint16 *dest, SDL_HapticDirection *src) switch (src->type) { case SDL_HAPTIC_POLAR: - /* Linux directions start from south. - (and range from 0 to 0xFFFF) - Quoting include/linux/input.h, line 926: - Direction of the effect is encoded as follows: - 0 deg -> 0x0000 (down) - 90 deg -> 0x4000 (left) - 180 deg -> 0x8000 (up) - 270 deg -> 0xC000 (right) - The force pulls into the direction specified by Linux directions, - i.e. the opposite convention of SDL directions. - */ tmp = ((src->dir[0] % 36000) * 0x8000) / 18000; /* convert to range [0,0xFFFF] */ *dest = (Uint16)tmp; break; @@ -922,7 +911,7 @@ int SDL_SYS_HapticNewEffect(SDL_Haptic *haptic, struct haptic_effect *effect, /* Allocate the hardware effect */ effect->hweffect = (struct haptic_hweffect *) SDL_malloc(sizeof(struct haptic_hweffect)); - if (effect->hweffect == NULL) { + if (!effect->hweffect) { return SDL_OutOfMemory(); } diff --git a/thirdparty/SDL/src/haptic/windows/SDL_dinputhaptic.c b/thirdparty/SDL/src/haptic/windows/SDL_dinputhaptic.c index 5a096be9d..22149151f 100644 --- a/thirdparty/SDL/src/haptic/windows/SDL_dinputhaptic.c +++ b/thirdparty/SDL/src/haptic/windows/SDL_dinputhaptic.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,7 +25,7 @@ #include "SDL_haptic.h" #include "../SDL_syshaptic.h" -#if SDL_HAPTIC_DINPUT +#ifdef SDL_HAPTIC_DINPUT #include "SDL_hints.h" #include "SDL_stdinc.h" @@ -98,7 +98,7 @@ int SDL_DINPUT_HapticInit(void) /* Because we used CoCreateInstance, we need to Initialize it, first. */ instance = GetModuleHandle(NULL); - if (instance == NULL) { + if (!instance) { SDL_SYS_HapticQuit(); return SDL_SetError("GetModuleHandle() failed with error code %lu.", GetLastError()); @@ -139,7 +139,7 @@ int SDL_DINPUT_HapticMaybeAddDevice(const DIDEVICEINSTANCE *pdidInstance) DIDEVCAPS capabilities; SDL_hapticlist_item *item = NULL; - if (dinput == NULL) { + if (!dinput) { return -1; /* not initialized. We'll pick these up on enumeration if we init later. */ } @@ -172,7 +172,7 @@ int SDL_DINPUT_HapticMaybeAddDevice(const DIDEVICEINSTANCE *pdidInstance) } item = (SDL_hapticlist_item *)SDL_calloc(1, sizeof(SDL_hapticlist_item)); - if (item == NULL) { + if (!item) { return SDL_OutOfMemory(); } @@ -194,11 +194,11 @@ int SDL_DINPUT_HapticMaybeRemoveDevice(const DIDEVICEINSTANCE *pdidInstance) SDL_hapticlist_item *item; SDL_hapticlist_item *prev = NULL; - if (dinput == NULL) { + if (!dinput) { return -1; /* not initialized, ignore this. */ } - for (item = SDL_hapticlist; item != NULL; item = item->next) { + for (item = SDL_hapticlist; item; item = item->next) { if (!item->bXInputHaptic && SDL_memcmp(&item->instance, pdidInstance, sizeof(*pdidInstance)) == 0) { /* found it, remove it. */ return SDL_SYS_RemoveHapticDevice(prev, item); @@ -293,7 +293,7 @@ static int SDL_DINPUT_HapticOpenFromDevice(SDL_Haptic *haptic, LPDIRECTINPUTDEVI /* Allocate the hwdata */ haptic->hwdata = (struct haptic_hwdata *)SDL_malloc(sizeof(*haptic->hwdata)); - if (haptic->hwdata == NULL) { + if (!haptic->hwdata) { return SDL_OutOfMemory(); } SDL_memset(haptic->hwdata, 0, sizeof(*haptic->hwdata)); @@ -407,7 +407,7 @@ static int SDL_DINPUT_HapticOpenFromDevice(SDL_Haptic *haptic, LPDIRECTINPUTDEVI /* Prepare effects memory. */ haptic->effects = (struct haptic_effect *) SDL_malloc(sizeof(struct haptic_effect) * haptic->neffects); - if (haptic->effects == NULL) { + if (!haptic->effects) { SDL_OutOfMemory(); goto acquire_err; } @@ -480,7 +480,7 @@ int SDL_DINPUT_HapticOpenFromJoystick(SDL_Haptic *haptic, SDL_Joystick *joystick } /* Since it comes from a joystick we have to try to match it with a haptic device on our haptic list. */ - for (item = SDL_hapticlist; item != NULL; item = item->next) { + for (item = SDL_hapticlist; item; item = item->next) { if (!item->bXInputHaptic && WIN_IsEqualGUID(&item->instance.guidInstance, &joy_instance.guidInstance)) { haptic->index = index; return SDL_DINPUT_HapticOpenFromDevice(haptic, joystick->hwdata->InputDevice, SDL_TRUE); @@ -546,7 +546,7 @@ static int SDL_SYS_SetDirection(DIEFFECT *effect, SDL_HapticDirection *dir, int /* Has axes. */ rglDir = SDL_malloc(sizeof(LONG) * naxes); - if (rglDir == NULL) { + if (!rglDir) { return SDL_OutOfMemory(); } SDL_memset(rglDir, 0, sizeof(LONG) * naxes); @@ -620,7 +620,7 @@ static int SDL_SYS_ToDIEFFECT(SDL_Haptic *haptic, DIEFFECT *dest, /* Envelope. */ envelope = SDL_malloc(sizeof(DIENVELOPE)); - if (envelope == NULL) { + if (!envelope) { return SDL_OutOfMemory(); } SDL_memset(envelope, 0, sizeof(DIENVELOPE)); @@ -635,7 +635,7 @@ static int SDL_SYS_ToDIEFFECT(SDL_Haptic *haptic, DIEFFECT *dest, } if (dest->cAxes > 0) { axes = SDL_malloc(sizeof(DWORD) * dest->cAxes); - if (axes == NULL) { + if (!axes) { return SDL_OutOfMemory(); } axes[0] = haptic->hwdata->axes[0]; /* Always at least one axis. */ @@ -653,7 +653,7 @@ static int SDL_SYS_ToDIEFFECT(SDL_Haptic *haptic, DIEFFECT *dest, case SDL_HAPTIC_CONSTANT: hap_constant = &src->constant; constant = SDL_malloc(sizeof(DICONSTANTFORCE)); - if (constant == NULL) { + if (!constant) { return SDL_OutOfMemory(); } SDL_memset(constant, 0, sizeof(DICONSTANTFORCE)); @@ -695,7 +695,7 @@ static int SDL_SYS_ToDIEFFECT(SDL_Haptic *haptic, DIEFFECT *dest, case SDL_HAPTIC_SAWTOOTHDOWN: hap_periodic = &src->periodic; periodic = SDL_malloc(sizeof(DIPERIODIC)); - if (periodic == NULL) { + if (!periodic) { return SDL_OutOfMemory(); } SDL_memset(periodic, 0, sizeof(DIPERIODIC)); @@ -739,7 +739,7 @@ static int SDL_SYS_ToDIEFFECT(SDL_Haptic *haptic, DIEFFECT *dest, case SDL_HAPTIC_FRICTION: hap_condition = &src->condition; condition = SDL_malloc(sizeof(DICONDITION) * dest->cAxes); - if (condition == NULL) { + if (!condition) { return SDL_OutOfMemory(); } SDL_memset(condition, 0, sizeof(DICONDITION)); @@ -780,7 +780,7 @@ static int SDL_SYS_ToDIEFFECT(SDL_Haptic *haptic, DIEFFECT *dest, case SDL_HAPTIC_RAMP: hap_ramp = &src->ramp; ramp = SDL_malloc(sizeof(DIRAMPFORCE)); - if (ramp == NULL) { + if (!ramp) { return SDL_OutOfMemory(); } SDL_memset(ramp, 0, sizeof(DIRAMPFORCE)); @@ -818,7 +818,7 @@ static int SDL_SYS_ToDIEFFECT(SDL_Haptic *haptic, DIEFFECT *dest, case SDL_HAPTIC_CUSTOM: hap_custom = &src->custom; custom = SDL_malloc(sizeof(DICUSTOMFORCE)); - if (custom == NULL) { + if (!custom) { return SDL_OutOfMemory(); } SDL_memset(custom, 0, sizeof(DICUSTOMFORCE)); @@ -877,7 +877,7 @@ static void SDL_SYS_HapticFreeDIEFFECT(DIEFFECT *effect, int type) effect->lpEnvelope = NULL; SDL_free(effect->rgdwAxes); effect->rgdwAxes = NULL; - if (effect->lpvTypeSpecificParams != NULL) { + if (effect->lpvTypeSpecificParams) { if (type == SDL_HAPTIC_CUSTOM) { /* Must free the custom data. */ custom = (DICUSTOMFORCE *)effect->lpvTypeSpecificParams; SDL_free(custom->rglForceData); @@ -943,7 +943,7 @@ int SDL_DINPUT_HapticNewEffect(SDL_Haptic *haptic, struct haptic_effect *effect, HRESULT ret; REFGUID type = SDL_SYS_HapticEffectType(base); - if (type == NULL) { + if (!type) { return SDL_SetError("Haptic: Unknown effect type."); } diff --git a/thirdparty/SDL/src/haptic/windows/SDL_dinputhaptic_c.h b/thirdparty/SDL/src/haptic/windows/SDL_dinputhaptic_c.h index fa61a0d55..b84fd7191 100644 --- a/thirdparty/SDL/src/haptic/windows/SDL_dinputhaptic_c.h +++ b/thirdparty/SDL/src/haptic/windows/SDL_dinputhaptic_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/haptic/windows/SDL_windowshaptic.c b/thirdparty/SDL/src/haptic/windows/SDL_windowshaptic.c index 01a4a7ec9..1992a0630 100644 --- a/thirdparty/SDL/src/haptic/windows/SDL_windowshaptic.c +++ b/thirdparty/SDL/src/haptic/windows/SDL_windowshaptic.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_HAPTIC_DINPUT || SDL_HAPTIC_XINPUT +#if defined(SDL_HAPTIC_DINPUT) || defined(SDL_HAPTIC_XINPUT) #include "SDL_thread.h" #include "SDL_mutex.h" @@ -81,7 +81,7 @@ int SDL_SYS_HapticInit(void) int SDL_SYS_AddHapticDevice(SDL_hapticlist_item *item) { - if (SDL_hapticlist_tail == NULL) { + if (!SDL_hapticlist_tail) { SDL_hapticlist = SDL_hapticlist_tail = item; } else { SDL_hapticlist_tail->next = item; @@ -97,7 +97,7 @@ int SDL_SYS_AddHapticDevice(SDL_hapticlist_item *item) int SDL_SYS_RemoveHapticDevice(SDL_hapticlist_item *prev, SDL_hapticlist_item *item) { const int retval = item->haptic ? item->haptic->index : -1; - if (prev != NULL) { + if (prev) { prev->next = item->next; } else { SDL_assert(SDL_hapticlist == item); @@ -160,12 +160,12 @@ int SDL_SYS_HapticOpen(SDL_Haptic *haptic) */ int SDL_SYS_HapticMouse(void) { -#if SDL_HAPTIC_DINPUT +#ifdef SDL_HAPTIC_DINPUT SDL_hapticlist_item *item; int index = 0; /* Grab the first mouse haptic device we find. */ - for (item = SDL_hapticlist; item != NULL; item = item->next) { + for (item = SDL_hapticlist; item; item = item->next) { if (item->capabilities.dwDevType == DI8DEVCLASS_POINTER) { return index; } @@ -183,12 +183,12 @@ int SDL_SYS_JoystickIsHaptic(SDL_Joystick *joystick) if (joystick->driver != &SDL_WINDOWS_JoystickDriver) { return 0; } -#if SDL_HAPTIC_XINPUT +#ifdef SDL_HAPTIC_XINPUT if (joystick->hwdata->bXInputHaptic) { return 1; } #endif -#if SDL_HAPTIC_DINPUT +#ifdef SDL_HAPTIC_DINPUT if (joystick->hwdata->Capabilities.dwFlags & DIDC_FORCEFEEDBACK) { return 1; } @@ -299,7 +299,7 @@ int SDL_SYS_HapticNewEffect(SDL_Haptic *haptic, struct haptic_effect *effect, /* Alloc the effect. */ effect->hweffect = (struct haptic_hweffect *) SDL_malloc(sizeof(struct haptic_hweffect)); - if (effect->hweffect == NULL) { + if (!effect->hweffect) { SDL_OutOfMemory(); return -1; } diff --git a/thirdparty/SDL/src/haptic/windows/SDL_windowshaptic_c.h b/thirdparty/SDL/src/haptic/windows/SDL_windowshaptic_c.h index 9ed62dd42..e5d45d526 100644 --- a/thirdparty/SDL/src/haptic/windows/SDL_windowshaptic_c.h +++ b/thirdparty/SDL/src/haptic/windows/SDL_windowshaptic_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -38,7 +38,7 @@ extern "C" { */ struct haptic_hwdata { -#if SDL_HAPTIC_DINPUT +#ifdef SDL_HAPTIC_DINPUT LPDIRECTINPUTDEVICE8 device; #endif DWORD axes[3]; /* Axes to use. */ @@ -54,14 +54,14 @@ struct haptic_hwdata /* * Haptic system effect data. */ -#if SDL_HAPTIC_DINPUT || SDL_HAPTIC_XINPUT +#if defined(SDL_HAPTIC_DINPUT) || defined(SDL_HAPTIC_XINPUT) struct haptic_hweffect { -#if SDL_HAPTIC_DINPUT +#ifdef SDL_HAPTIC_DINPUT DIEFFECT effect; LPDIRECTINPUTEFFECT ref; #endif -#if SDL_HAPTIC_XINPUT +#ifdef SDL_HAPTIC_XINPUT XINPUT_VIBRATION vibration; #endif }; @@ -74,7 +74,7 @@ typedef struct SDL_hapticlist_item { char *name; SDL_Haptic *haptic; -#if SDL_HAPTIC_DINPUT +#ifdef SDL_HAPTIC_DINPUT DIDEVICEINSTANCE instance; DIDEVCAPS capabilities; #endif diff --git a/thirdparty/SDL/src/haptic/windows/SDL_xinputhaptic.c b/thirdparty/SDL/src/haptic/windows/SDL_xinputhaptic.c index 6c77163e1..0066412f4 100644 --- a/thirdparty/SDL/src/haptic/windows/SDL_xinputhaptic.c +++ b/thirdparty/SDL/src/haptic/windows/SDL_xinputhaptic.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,7 +25,7 @@ #include "SDL_haptic.h" #include "../SDL_syshaptic.h" -#if SDL_HAPTIC_XINPUT +#ifdef SDL_HAPTIC_XINPUT #include "SDL_hints.h" #include "SDL_timer.h" @@ -84,7 +84,7 @@ int SDL_XINPUT_HapticMaybeAddDevice(const DWORD dwUserid) } item = (SDL_hapticlist_item *)SDL_malloc(sizeof(SDL_hapticlist_item)); - if (item == NULL) { + if (!item) { return SDL_OutOfMemory(); } @@ -119,7 +119,7 @@ int SDL_XINPUT_HapticMaybeRemoveDevice(const DWORD dwUserid) return -1; } - for (item = SDL_hapticlist; item != NULL; item = item->next) { + for (item = SDL_hapticlist; item; item = item->next) { if (item->bXInputHaptic && item->userid == userid) { /* found it, remove it. */ return SDL_SYS_RemoveHapticDevice(prev, item); @@ -178,7 +178,7 @@ static int SDL_XINPUT_HapticOpenFromUserIndex(SDL_Haptic *haptic, const Uint8 us /* Prepare effects memory. */ haptic->effects = (struct haptic_effect *) SDL_malloc(sizeof(struct haptic_effect) * haptic->neffects); - if (haptic->effects == NULL) { + if (!haptic->effects) { return SDL_OutOfMemory(); } /* Clear the memory */ @@ -186,7 +186,7 @@ static int SDL_XINPUT_HapticOpenFromUserIndex(SDL_Haptic *haptic, const Uint8 us sizeof(struct haptic_effect) * haptic->neffects); haptic->hwdata = (struct haptic_hwdata *)SDL_malloc(sizeof(*haptic->hwdata)); - if (haptic->hwdata == NULL) { + if (!haptic->hwdata) { SDL_free(haptic->effects); haptic->effects = NULL; return SDL_OutOfMemory(); @@ -197,7 +197,7 @@ static int SDL_XINPUT_HapticOpenFromUserIndex(SDL_Haptic *haptic, const Uint8 us haptic->hwdata->userid = userid; haptic->hwdata->mutex = SDL_CreateMutex(); - if (haptic->hwdata->mutex == NULL) { + if (!haptic->hwdata->mutex) { SDL_free(haptic->effects); SDL_free(haptic->hwdata); haptic->effects = NULL; @@ -207,7 +207,7 @@ static int SDL_XINPUT_HapticOpenFromUserIndex(SDL_Haptic *haptic, const Uint8 us (void)SDL_snprintf(threadName, sizeof(threadName), "SDLXInputDev%d", userid); haptic->hwdata->thread = SDL_CreateThreadInternal(SDL_RunXInputHaptic, threadName, 64 * 1024, haptic->hwdata); - if (haptic->hwdata->thread == NULL) { + if (!haptic->hwdata->thread) { SDL_DestroyMutex(haptic->hwdata->mutex); SDL_free(haptic->effects); SDL_free(haptic->hwdata); @@ -234,7 +234,7 @@ int SDL_XINPUT_HapticOpenFromJoystick(SDL_Haptic *haptic, SDL_Joystick *joystick int index = 0; /* Since it comes from a joystick we have to try to match it with a haptic device on our haptic list. */ - for (item = SDL_hapticlist; item != NULL; item = item->next) { + for (item = SDL_hapticlist; item; item = item->next) { if (item->bXInputHaptic && item->userid == joystick->hwdata->userid) { haptic->index = index; return SDL_XINPUT_HapticOpenFromUserIndex(haptic, joystick->hwdata->userid); diff --git a/thirdparty/SDL/src/haptic/windows/SDL_xinputhaptic_c.h b/thirdparty/SDL/src/haptic/windows/SDL_xinputhaptic_c.h index 3a6fbd3a1..071d3e476 100644 --- a/thirdparty/SDL/src/haptic/windows/SDL_xinputhaptic_c.h +++ b/thirdparty/SDL/src/haptic/windows/SDL_xinputhaptic_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/hidapi/SDL_hidapi.c b/thirdparty/SDL/src/hidapi/SDL_hidapi.c index 6c3e43fb6..c8ba9a335 100644 --- a/thirdparty/SDL/src/hidapi/SDL_hidapi.c +++ b/thirdparty/SDL/src/hidapi/SDL_hidapi.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -29,25 +29,25 @@ */ #include "../SDL_internal.h" -#include "SDL_loadso.h" #include "SDL_hidapi.h" +#include "SDL_hidapi_c.h" +#include "SDL_loadso.h" #include "SDL_thread.h" #include "SDL_timer.h" -#include "SDL_hidapi_c.h" -#if !SDL_HIDAPI_DISABLED +#ifndef SDL_HIDAPI_DISABLED #if defined(__WIN32__) || defined(__WINGDK__) #include "../core/windows/SDL_windows.h" #endif #if defined(__MACOSX__) +#include #include -#include #include #include #include -#include +#include /* Things named "Master" were renamed to "Main" in macOS 12.0's SDK. */ #if MAC_OS_X_VERSION_MIN_REQUIRED < 120000 #define kIOMainPortDefault kIOMasterPortDefault @@ -56,16 +56,16 @@ #include "../core/linux/SDL_udev.h" #ifdef SDL_USE_LIBUDEV -#include #include "../core/linux/SDL_sandbox.h" +#include #endif #ifdef HAVE_INOTIFY -#include /* just in case we didn't use that SDL_USE_LIBUDEV block... */ -#include /* errno, strerror */ +#include /* errno, strerror */ #include #include /* For the definition of NAME_MAX */ #include +#include /* just in case we didn't use that SDL_USE_LIBUDEV block... */ #endif #if defined(SDL_USE_LIBUDEV) || defined(HAVE_INOTIFY) @@ -166,7 +166,6 @@ static LRESULT CALLBACK ControllerWndProc(HWND hwnd, UINT message, WPARAM wParam } #endif /* defined(__WIN32__) || defined(__WINGDK__) */ - #if defined(__MACOSX__) static void CallbackIOServiceFunc(void *context, io_iterator_t portIterator) { @@ -221,7 +220,7 @@ static int StrIsInteger(const char *string) } #endif /* HAVE_INOTIFY */ -static void HIDAPI_InitializeDiscovery() +static void HIDAPI_InitializeDiscovery(void) { SDL_HIDAPI_discovery.m_bInitialized = SDL_TRUE; SDL_HIDAPI_discovery.m_unDeviceChangeCounter = 1; @@ -360,7 +359,7 @@ static void HIDAPI_InitializeDiscovery() } } -static void HIDAPI_UpdateDiscovery() +static void HIDAPI_UpdateDiscovery(void) { if (!SDL_HIDAPI_discovery.m_bInitialized) { HIDAPI_InitializeDiscovery(); @@ -477,7 +476,7 @@ static void HIDAPI_UpdateDiscovery() } } -static void HIDAPI_ShutdownDiscovery() +static void HIDAPI_ShutdownDiscovery(void) { if (!SDL_HIDAPI_discovery.m_bInitialized) { return; @@ -557,9 +556,9 @@ static void HIDAPI_ShutdownDiscovery() #define read_thread PLATFORM_read_thread #undef HIDAPI_H__ -#if __LINUX__ +#ifdef __LINUX__ -#if SDL_USE_LIBUDEV +#ifdef SDL_USE_LIBUDEV static const SDL_UDEV_Symbols *udev_ctx = NULL; #define udev_device_get_sysattr_value udev_ctx->udev_device_get_sysattr_value @@ -579,23 +578,23 @@ static const SDL_UDEV_Symbols *udev_ctx = NULL; #define udev_enumerate_unref udev_ctx->udev_enumerate_unref #include "linux/hid.c" -#define HAVE_PLATFORM_BACKEND 1 +#define HAVE_PLATFORM_BACKEND #endif /* SDL_USE_LIBUDEV */ -#elif __MACOSX__ +#elif defined(__MACOSX__) #include "mac/hid.c" -#define HAVE_PLATFORM_BACKEND 1 +#define HAVE_PLATFORM_BACKEND #define udev_ctx 1 -#elif __WINDOWS__ || __WINGDK__ +#elif defined(__WINDOWS__) || defined(__WINGDK__) #include "windows/hid.c" -#define HAVE_PLATFORM_BACKEND 1 +#define HAVE_PLATFORM_BACKEND #define udev_ctx 1 -#elif __ANDROID__ +#elif defined(__ANDROID__) /* The implementation for Android is in a separate .cpp file */ #include "hidapi/hidapi.h" #define HAVE_PLATFORM_BACKEND 1 -#define udev_ctx 1 -#elif __IPHONEOS__ || __TVOS__ +#define udev_ctx 1 +#elif defined(__IPHONEOS__) || defined(__TVOS__) /* The implementation for iOS and tvOS is in a separate .m file */ #include "hidapi/hidapi.h" #define HAVE_PLATFORM_BACKEND 1 @@ -631,9 +630,11 @@ static const SDL_UDEV_Symbols *udev_ctx = NULL; #ifdef SDL_JOYSTICK_HIDAPI_STEAMXBOX #define HAVE_DRIVER_BACKEND 1 +#else +#define HAVE_DRIVER_BACKEND 0 #endif -#ifdef HAVE_DRIVER_BACKEND +#if HAVE_DRIVER_BACKEND /* DRIVER HIDAPI Implementation */ @@ -809,8 +810,8 @@ static struct /* this is awkwardly inlined, so we need to re-implement it here * so we can override the libusb_control_transfer call */ static int SDL_libusb_get_string_descriptor(libusb_device_handle *dev, - uint8_t descriptor_index, uint16_t lang_id, - unsigned char *data, int length) + uint8_t descriptor_index, uint16_t lang_id, + unsigned char *data, int length) { return libusb_control_transfer(dev, LIBUSB_ENDPOINT_IN | 0x0, LIBUSB_REQUEST_GET_DESCRIPTOR, (LIBUSB_DT_STRING << 8) | descriptor_index, lang_id, data, (uint16_t)length, 1000); /* Endpoint 0 IN */ @@ -876,6 +877,41 @@ static int SDL_libusb_get_string_descriptor(libusb_device_handle *dev, #undef make_path #undef read_thread +/* If the platform has any backend other than libusb, try to avoid using + * libusb as the main backend for devices, since it detaches drivers and + * therefore makes devices inaccessible to the rest of the OS. + * + * We do this by whitelisting devices we know to be accessible _exclusively_ + * via libusb; these are typically devices that look like HIDs but have a + * quirk that requires direct access to the hardware. + */ +static const struct { + Uint16 vendor; + Uint16 product; +} SDL_libusb_whitelist[] = { + { 0x057e, 0x0337 } /* Nintendo WUP-028, Wii U/Switch GameCube Adapter */ +}; + +static SDL_bool +IsInWhitelist(Uint16 vendor, Uint16 product) +{ + int i; + for (i = 0; i < SDL_arraysize(SDL_libusb_whitelist); i += 1) { + if (vendor == SDL_libusb_whitelist[i].vendor && + product == SDL_libusb_whitelist[i].product) { + return SDL_TRUE; + } + } + return SDL_FALSE; +} + +#if defined(HAVE_PLATFORM_BACKEND) || HAVE_DRIVER_BACKEND + #define use_libusb_whitelist_default SDL_TRUE +#else + #define use_libusb_whitelist_default SDL_FALSE +#endif /* HAVE_PLATFORM_BACKEND || HAVE_DRIVER_BACKEND */ +static SDL_bool use_libusb_whitelist = use_libusb_whitelist_default; + #endif /* HAVE_LIBUSB */ #endif /* !SDL_HIDAPI_DISABLED */ @@ -898,7 +934,7 @@ struct hidapi_backend const wchar_t *(*hid_error)(void *device); }; -#if HAVE_PLATFORM_BACKEND +#ifdef HAVE_PLATFORM_BACKEND static const struct hidapi_backend PLATFORM_Backend = { (void *)PLATFORM_hid_write, (void *)PLATFORM_hid_read_timeout, @@ -957,7 +993,7 @@ struct SDL_hid_device_ }; static char device_magic; -#if HAVE_PLATFORM_BACKEND || HAVE_DRIVER_BACKEND || defined(HAVE_LIBUSB) +#if defined(HAVE_PLATFORM_BACKEND) || HAVE_DRIVER_BACKEND || defined(HAVE_LIBUSB) static SDL_hid_device *CreateHIDDeviceWrapper(void *device, const struct hidapi_backend *backend) { @@ -982,8 +1018,8 @@ static void DeleteHIDDeviceWrapper(SDL_hid_device *device) return retval; \ } -#if !SDL_HIDAPI_DISABLED -#if HAVE_PLATFORM_BACKEND || HAVE_DRIVER_BACKEND || defined(HAVE_LIBUSB) +#ifndef SDL_HIDAPI_DISABLED +#if defined(HAVE_PLATFORM_BACKEND) || HAVE_DRIVER_BACKEND || defined(HAVE_LIBUSB) #define COPY_IF_EXISTS(var) \ if (pSrc->var != NULL) { \ @@ -1061,6 +1097,8 @@ int SDL_hid_init(void) #endif #ifdef HAVE_LIBUSB + use_libusb_whitelist = SDL_GetHintBoolean("SDL_HIDAPI_LIBUSB_WHITELIST", + use_libusb_whitelist_default); if (SDL_getenv("SDL_HIDAPI_DISABLE_LIBUSB") != NULL) { SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, "libusb disabled by SDL_HIDAPI_DISABLE_LIBUSB"); @@ -1130,9 +1168,9 @@ int SDL_hid_init(void) } #endif /* HAVE_LIBUSB */ -#if HAVE_PLATFORM_BACKEND +#ifdef HAVE_PLATFORM_BACKEND ++attempts; -#if __LINUX__ +#ifdef __LINUX__ udev_ctx = SDL_UDEV_GetUdevSyms(); #endif /* __LINUX __ */ if (udev_ctx && PLATFORM_hid_init() == 0) { @@ -1161,15 +1199,15 @@ int SDL_hid_exit(void) } SDL_hidapi_refcount = 0; -#if !SDL_HIDAPI_DISABLED +#ifndef SDL_HIDAPI_DISABLED HIDAPI_ShutdownDiscovery(); #endif -#if HAVE_PLATFORM_BACKEND +#ifdef HAVE_PLATFORM_BACKEND if (udev_ctx) { result |= PLATFORM_hid_exit(); } -#if __LINUX__ +#ifdef __LINUX__ SDL_UDEV_ReleaseUdevSyms(); #endif /* __LINUX __ */ #endif /* HAVE_PLATFORM_BACKEND */ @@ -1191,7 +1229,7 @@ Uint32 SDL_hid_device_change_count(void) { Uint32 counter = 0; -#if !SDL_HIDAPI_DISABLED +#ifndef SDL_HIDAPI_DISABLED if (SDL_hidapi_refcount == 0 && SDL_hid_init() != 0) { return 0; } @@ -1211,7 +1249,7 @@ Uint32 SDL_hid_device_change_count(void) struct SDL_hid_device_info *SDL_hid_enumerate(unsigned short vendor_id, unsigned short product_id) { -#if HAVE_PLATFORM_BACKEND || HAVE_DRIVER_BACKEND || defined(HAVE_LIBUSB) +#if defined(HAVE_PLATFORM_BACKEND) || HAVE_DRIVER_BACKEND || defined(HAVE_LIBUSB) #ifdef HAVE_LIBUSB struct SDL_hid_device_info *usb_devs = NULL; struct SDL_hid_device_info *usb_dev; @@ -1220,7 +1258,7 @@ struct SDL_hid_device_info *SDL_hid_enumerate(unsigned short vendor_id, unsigned struct SDL_hid_device_info *driver_devs = NULL; struct SDL_hid_device_info *driver_dev; #endif -#if HAVE_PLATFORM_BACKEND +#ifdef HAVE_PLATFORM_BACKEND struct SDL_hid_device_info *raw_devs = NULL; struct SDL_hid_device_info *raw_dev; #endif @@ -1237,6 +1275,16 @@ struct SDL_hid_device_info *SDL_hid_enumerate(unsigned short vendor_id, unsigned SDL_Log("libusb devices found:"); #endif for (usb_dev = usb_devs; usb_dev; usb_dev = usb_dev->next) { + if (use_libusb_whitelist) { + if (!IsInWhitelist(usb_dev->vendor_id, usb_dev->product_id)) { +#ifdef DEBUG_HIDAPI + SDL_Log("Device was not in libusb whitelist: %ls %ls 0x%.4hx 0x%.4hx", + usb_dev->manufacturer_string, usb_dev->product_string, + usb_dev->vendor_id, usb_dev->product_id); +#endif /* DEBUG_HIDAPI */ + continue; + } + } new_dev = (struct SDL_hid_device_info *)SDL_malloc(sizeof(struct SDL_hid_device_info)); if (new_dev == NULL) { LIBUSB_hid_free_enumeration(usb_devs); @@ -1261,7 +1309,7 @@ struct SDL_hid_device_info *SDL_hid_enumerate(unsigned short vendor_id, unsigned } #endif /* HAVE_LIBUSB */ -#ifdef HAVE_DRIVER_BACKEND +#if HAVE_DRIVER_BACKEND driver_devs = DRIVER_hid_enumerate(vendor_id, product_id); for (driver_dev = driver_devs; driver_dev; driver_dev = driver_dev->next) { new_dev = (struct SDL_hid_device_info *)SDL_malloc(sizeof(struct SDL_hid_device_info)); @@ -1276,7 +1324,7 @@ struct SDL_hid_device_info *SDL_hid_enumerate(unsigned short vendor_id, unsigned } #endif /* HAVE_DRIVER_BACKEND */ -#if HAVE_PLATFORM_BACKEND +#ifdef HAVE_PLATFORM_BACKEND if (udev_ctx) { raw_devs = PLATFORM_hid_enumerate(vendor_id, product_id); #ifdef DEBUG_HIDAPI @@ -1299,7 +1347,7 @@ struct SDL_hid_device_info *SDL_hid_enumerate(unsigned short vendor_id, unsigned } } #endif -#ifdef HAVE_DRIVER_BACKEND +#if HAVE_DRIVER_BACKEND for (driver_dev = driver_devs; driver_dev; driver_dev = driver_dev->next) { if (raw_dev->vendor_id == driver_dev->vendor_id && raw_dev->product_id == driver_dev->product_id && @@ -1364,14 +1412,14 @@ void SDL_hid_free_enumeration(struct SDL_hid_device_info *devs) SDL_hid_device *SDL_hid_open(unsigned short vendor_id, unsigned short product_id, const wchar_t *serial_number) { -#if HAVE_PLATFORM_BACKEND || HAVE_DRIVER_BACKEND || defined(HAVE_LIBUSB) +#if defined(HAVE_PLATFORM_BACKEND) || HAVE_DRIVER_BACKEND || defined(HAVE_LIBUSB) void *pDevice = NULL; if (SDL_hidapi_refcount == 0 && SDL_hid_init() != 0) { return NULL; } -#if HAVE_PLATFORM_BACKEND +#ifdef HAVE_PLATFORM_BACKEND if (udev_ctx) { pDevice = PLATFORM_hid_open(vendor_id, product_id, serial_number); if (pDevice != NULL) { @@ -1403,14 +1451,14 @@ SDL_hid_device *SDL_hid_open(unsigned short vendor_id, unsigned short product_id SDL_hid_device *SDL_hid_open_path(const char *path, int bExclusive /* = false */) { -#if HAVE_PLATFORM_BACKEND || HAVE_DRIVER_BACKEND || defined(HAVE_LIBUSB) +#if defined(HAVE_PLATFORM_BACKEND) || HAVE_DRIVER_BACKEND || defined(HAVE_LIBUSB) void *pDevice = NULL; if (SDL_hidapi_refcount == 0 && SDL_hid_init() != 0) { return NULL; } -#if HAVE_PLATFORM_BACKEND +#ifdef HAVE_PLATFORM_BACKEND if (udev_ctx) { pDevice = PLATFORM_hid_open_path(path, bExclusive); if (pDevice != NULL) { @@ -1580,7 +1628,7 @@ int SDL_hid_get_indexed_string(SDL_hid_device *device, int string_index, wchar_t void SDL_hid_ble_scan(SDL_bool active) { -#if !SDL_HIDAPI_DISABLED && (__IPHONEOS__ || __TVOS__) +#if !defined(SDL_HIDAPI_DISABLED) && (defined(__IPHONEOS__) || defined(__TVOS__)) hid_ble_scan(active); #endif } diff --git a/thirdparty/SDL/src/hidapi/SDL_hidapi_c.h b/thirdparty/SDL/src/hidapi/SDL_hidapi_c.h index 796b9ba72..51fe0135c 100644 --- a/thirdparty/SDL/src/hidapi/SDL_hidapi_c.h +++ b/thirdparty/SDL/src/hidapi/SDL_hidapi_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/hidapi/android/hid.cpp b/thirdparty/SDL/src/hidapi/android/hid.cpp index 34fda42d3..3b050a672 100644 --- a/thirdparty/SDL/src/hidapi/android/hid.cpp +++ b/thirdparty/SDL/src/hidapi/android/hid.cpp @@ -48,7 +48,7 @@ #define HID_DEVICE_MANAGER_JAVA_INTERFACE(function) CONCAT1(SDL_JAVA_PREFIX, HIDDeviceManager, function) -#if !SDL_HIDAPI_DISABLED +#ifndef SDL_HIDAPI_DISABLED #include "SDL_hints.h" #include "../../core/android/SDL_android.h" @@ -744,7 +744,7 @@ class CHIDDevice env->CallVoidMethod( g_HIDDeviceManagerCallbackHandler, g_midHIDDeviceManagerClose, m_nId ); ExceptionCheck( env, "Close" ); } - + hid_mutex_guard dataLock( &m_dataLock ); m_vecData.clear(); @@ -1139,7 +1139,7 @@ HID_API_EXPORT hid_device * HID_API_CALL hid_open_path(const char *path, int bEx hid_mutex_guard l( &g_DevicesMutex ); for ( hid_device_ref pCurr = g_Devices; pCurr; pCurr = pCurr->next ) { - if ( SDL_strcmp( pCurr->GetDeviceInfo()->path, path ) == 0 ) + if ( SDL_strcmp( pCurr->GetDeviceInfo()->path, path ) == 0 ) { hid_device *pValue = pCurr->GetDevice(); if ( pValue ) diff --git a/thirdparty/SDL/src/hidapi/hidapi/hidapi.h b/thirdparty/SDL/src/hidapi/hidapi/hidapi.h index 3fddfa885..1114aefc9 100644 --- a/thirdparty/SDL/src/hidapi/hidapi/hidapi.h +++ b/thirdparty/SDL/src/hidapi/hidapi/hidapi.h @@ -406,7 +406,7 @@ namespace NAMESPACE { */ HID_API_EXPORT const wchar_t* HID_API_CALL hid_error(hid_device *dev); -#if __IPHONEOS__ || __TVOS__ +#if defined(__IPHONEOS__) || defined(__TVOS__) HID_API_EXPORT void HID_API_CALL hid_ble_scan(int active); #endif diff --git a/thirdparty/SDL/src/hidapi/ios/hid.m b/thirdparty/SDL/src/hidapi/ios/hid.m index 8ebfdbe72..636d0f076 100644 --- a/thirdparty/SDL/src/hidapi/ios/hid.m +++ b/thirdparty/SDL/src/hidapi/ios/hid.m @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if !SDL_HIDAPI_DISABLED +#ifndef SDL_HIDAPI_DISABLED #include "SDL_hints.h" @@ -131,7 +131,7 @@ static void RingBuffer_init( RingBuffer *this ) this->_last = 0; pthread_mutex_init( &this->accessLock, 0 ); } - + static bool RingBuffer_write( RingBuffer *this, const uint8_t *src ) { pthread_mutex_lock( &this->accessLock ); @@ -290,7 +290,7 @@ - (int)updateConnectedSteamControllers:(BOOL) bForce { static uint64_t s_unLastUpdateTick = 0; static mach_timebase_info_data_t s_timebase_info; - + if ( self.centralManager == nil ) { return 0; @@ -300,11 +300,11 @@ - (int)updateConnectedSteamControllers:(BOOL) bForce { mach_timebase_info( &s_timebase_info ); } - + uint64_t ticksNow = mach_approximate_time(); if ( !bForce && ( ( (ticksNow - s_unLastUpdateTick) * s_timebase_info.numer ) / s_timebase_info.denom ) < (5ull * NSEC_PER_SEC) ) return (int)self.deviceMap.count; - + // we can see previously connected BLE peripherals but can't connect until the CBCentralManager // is fully powered up - only do work when we are in that state if ( self.centralManager.state != CBManagerStatePoweredOn ) @@ -312,7 +312,7 @@ - (int)updateConnectedSteamControllers:(BOOL) bForce // only update our last-check-time if we actually did work, otherwise there can be a long delay during initial power-up s_unLastUpdateTick = mach_approximate_time(); - + // if a pair is in-flight, the central manager may still give it back via retrieveConnected... and // cause the SDL layer to attempt to initialize it while some of its endpoints haven't yet been established if ( self.nPendingPairs > 0 ) @@ -324,7 +324,7 @@ - (int)updateConnectedSteamControllers:(BOOL) bForce // we already know this peripheral if ( [self.deviceMap objectForKey: peripheral] != nil ) continue; - + NSLog( @"connected peripheral: %@", peripheral ); if ( [peripheral.name isEqualToString:@"SteamController"] ) { @@ -392,7 +392,7 @@ - (void)centralManagerDidUpdateState:(CBCentralManager *)central case CBCentralManagerStatePoweredOn: { NSLog( @"CoreBluetooth BLE hardware is powered on and ready" ); - + // at startup, if we have no already attached peripherals, do a 20s scan for new unpaired devices, // otherwise callers should occaisionally do additional scans. we don't want to continuously be // scanning because it drains battery, causes other nearby people to have a hard time pairing their @@ -408,23 +408,23 @@ - (void)centralManagerDidUpdateState:(CBCentralManager *)central } break; } - + case CBCentralManagerStatePoweredOff: NSLog( @"CoreBluetooth BLE hardware is powered off" ); break; - + case CBCentralManagerStateUnauthorized: NSLog( @"CoreBluetooth BLE state is unauthorized" ); break; - + case CBCentralManagerStateUnknown: NSLog( @"CoreBluetooth BLE state is unknown" ); break; - + case CBCentralManagerStateUnsupported: NSLog( @"CoreBluetooth BLE hardware is unsupported on this platform" ); break; - + case CBCentralManagerStateResetting: NSLog( @"CoreBluetooth BLE manager is resetting" ); break; @@ -449,7 +449,7 @@ - (void)centralManager:(CBCentralManager *)central didDiscoverPeripheral:(CBPeri { NSString *localName = [advertisementData objectForKey:CBAdvertisementDataLocalNameKey]; NSString *log = [NSString stringWithFormat:@"Found '%@'", localName]; - + if ( [localName isEqualToString:@"SteamController"] ) { NSLog( @"%@ : %@ - %@", log, peripheral, advertisementData ); @@ -475,7 +475,7 @@ - (void)centralManager:(CBCentralManager *)central didDisconnectPeripheral:(CBPe // Core Bluetooth devices calling back on event boundaries of their run-loops. so annoying. -static void process_pending_events() +static void process_pending_events(void) { CFRunLoopRunResult res; do @@ -552,7 +552,7 @@ - (int)send_feature_report:(hidFeatureReport *)report { #if FEATURE_REPORT_LOGGING uint8_t *reportBytes = (uint8_t *)report; - + NSLog( @"HIDBLE:send_feature_report (%02zu/19) [%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x]", GetBluetoothSegmentSize( report->segment ), reportBytes[1], reportBytes[2], reportBytes[3], reportBytes[4], reportBytes[5], reportBytes[6], reportBytes[7], reportBytes[8], reportBytes[9], reportBytes[10], reportBytes[11], reportBytes[12], @@ -568,7 +568,7 @@ - (int)send_feature_report:(hidFeatureReport *)report // fire-and-forget - we are going to not wait for the response here because all Steam Controller BLE send_feature_report's are ignored, // except errors. [_bleSteamController writeValue:[NSData dataWithBytes:&report->segment length:sendSize] forCharacteristic:_bleCharacteristicReport type:CBCharacteristicWriteWithResponse]; - + // pretend we received a result anybody cares about return 19; @@ -578,18 +578,18 @@ - (int)send_feature_report:(hidFeatureReport *)report _waitStateForWriteFeatureReport = BLEDeviceWaitState_Waiting; [_bleSteamController writeValue:[NSData dataWithBytes:&report->segment length:sendSize ] forCharacteristic:_bleCharacteristicReport type:CBCharacteristicWriteWithResponse]; - + while ( _waitStateForWriteFeatureReport == BLEDeviceWaitState_Waiting ) { process_pending_events(); } - + if ( _waitStateForWriteFeatureReport == BLEDeviceWaitState_Error ) { _waitStateForWriteFeatureReport = BLEDeviceWaitState_None; return -1; } - + _waitStateForWriteFeatureReport = BLEDeviceWaitState_None; return 19; #endif @@ -599,20 +599,20 @@ - (int)get_feature_report:(uint8_t)feature into:(uint8_t *)buffer { _waitStateForReadFeatureReport = BLEDeviceWaitState_Waiting; [_bleSteamController readValueForCharacteristic:_bleCharacteristicReport]; - + while ( _waitStateForReadFeatureReport == BLEDeviceWaitState_Waiting ) process_pending_events(); - + if ( _waitStateForReadFeatureReport == BLEDeviceWaitState_Error ) { _waitStateForReadFeatureReport = BLEDeviceWaitState_None; return -1; } - + memcpy( buffer, _featureReport, sizeof(_featureReport) ); - + _waitStateForReadFeatureReport = BLEDeviceWaitState_None; - + #if FEATURE_REPORT_LOGGING NSLog( @"HIDBLE:get_feature_report (19) [%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x]", buffer[1], buffer[2], buffer[3], buffer[4], buffer[5], buffer[6], @@ -657,7 +657,7 @@ - (void)peripheral:(CBPeripheral *)peripheral didDiscoverCharacteristicsForServi for (CBCharacteristic *aChar in service.characteristics) { NSLog( @"Found Characteristic %@", aChar ); - + if ( [aChar.UUID isEqual:[CBUUID UUIDWithString:VALVE_INPUT_CHAR]] ) { self.bleCharacteristicInput = aChar; @@ -704,7 +704,7 @@ - (void)peripheral:(CBPeripheral *)peripheral didUpdateValueForCharacteristic:(C else if ( [characteristic.UUID isEqual:_bleCharacteristicReport.UUID] ) { memset( _featureReport, 0, sizeof(_featureReport) ); - + if ( error != nil ) { NSLog( @"HIDBLE: get_feature_report error: %@", error ); @@ -789,13 +789,13 @@ void HID_API_EXPORT HID_API_CALL hid_ble_scan( int bStart ) NSString *nssPath = [NSString stringWithUTF8String:path]; HIDBLEManager *bleManager = HIDBLEManager.sharedInstance; NSEnumerator *devices = [bleManager.deviceMap objectEnumerator]; - + for ( HIDBLEDevice *device in devices ) { // we have the device but it hasn't found its service or characteristics until it is connected if ( !device.ready || !device.connected || !device.bleCharacteristicInput ) continue; - + if ( [device.bleSteamController.identifier.UUIDString isEqualToString:nssPath] ) { result = (hid_device *)malloc( sizeof( hid_device ) ); @@ -829,7 +829,7 @@ int HID_API_EXPORT hid_set_nonblocking(hid_device *dev, int nonblock) { /* All Nonblocking operation is handled by the library. */ dev->blocking = !nonblock; - + return 0; } @@ -953,7 +953,7 @@ int HID_API_EXPORT hid_get_feature_report(hid_device *dev, unsigned char *data, return -1; size_t written = [device_handle get_feature_report:data[0] into:data]; - + return written == length-1 ? (int)length : (int)written; } @@ -973,7 +973,7 @@ int HID_API_EXPORT hid_read_timeout(hid_device *dev, unsigned char *data, size_t if ( !device_handle.connected ) return -1; - + if ( milliseconds != 0 ) { NSLog( @"hid_read_timeout with non-zero wait" ); diff --git a/thirdparty/SDL/src/hidapi/libusb/hid.c b/thirdparty/SDL/src/hidapi/libusb/hid.c index e5ee31b9a..2485bbf9b 100644 --- a/thirdparty/SDL/src/hidapi/libusb/hid.c +++ b/thirdparty/SDL/src/hidapi/libusb/hid.c @@ -519,7 +519,7 @@ static struct usb_string_cache_entry *usb_string_cache = NULL; static size_t usb_string_cache_size = 0; static size_t usb_string_cache_insert_pos = 0; -static int usb_string_cache_grow() +static int usb_string_cache_grow(void) { struct usb_string_cache_entry *new_cache; size_t allocSize; @@ -537,7 +537,7 @@ static int usb_string_cache_grow() return 0; } -static void usb_string_cache_destroy() +static void usb_string_cache_destroy(void) { size_t i; for (i = 0; i < usb_string_cache_insert_pos; i++) { @@ -715,6 +715,7 @@ static int is_xboxone(unsigned short vendor_id, const struct libusb_interface_de 0x044f, /* Thrustmaster */ 0x045e, /* Microsoft */ 0x0738, /* Mad Catz */ + 0x0b05, /* ASUS */ 0x0e6f, /* PDP */ 0x0f0d, /* Hori */ 0x10f5, /* Turtle Beach */ @@ -723,6 +724,7 @@ static int is_xboxone(unsigned short vendor_id, const struct libusb_interface_de 0x24c6, /* PowerA */ 0x2dc8, /* 8BitDo */ 0x2e24, /* Hyperkin */ + 0x3537, /* GameSir */ }; if (intf_desc->bInterfaceNumber == 0 && diff --git a/thirdparty/SDL/src/hidapi/mac/hid.c b/thirdparty/SDL/src/hidapi/mac/hid.c index c6541682c..0dbe4227d 100644 --- a/thirdparty/SDL/src/hidapi/mac/hid.c +++ b/thirdparty/SDL/src/hidapi/mac/hid.c @@ -504,7 +504,7 @@ int HID_API_EXPORT hid_exit(void) return 0; } -static void process_pending_events() { +static void process_pending_events(void) { SInt32 res; do { res = CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0.001, FALSE); @@ -957,7 +957,9 @@ static int return_data(hid_device *dev, unsigned char *data, size_t length) size_t len = 0; if (rpt != NULL) { len = (length < rpt->len)? length: rpt->len; - memcpy(data, rpt->data, len); + if (data != NULL) { + memcpy(data, rpt->data, len); + } dev->input_reports = rpt->next; free(rpt->data); free(rpt); diff --git a/thirdparty/SDL/src/hidapi/windows/hid.c b/thirdparty/SDL/src/hidapi/windows/hid.c index 3d8a2302e..54843d486 100644 --- a/thirdparty/SDL/src/hidapi/windows/hid.c +++ b/thirdparty/SDL/src/hidapi/windows/hid.c @@ -264,7 +264,7 @@ static void register_error(hid_device *device, const char *op) } #ifndef HIDAPI_USE_DDK -static int lookup_functions() +static int lookup_functions(void) { lib_handle = LoadLibrary(TEXT("hid.dll")); if (lib_handle) { diff --git a/thirdparty/SDL/src/joystick/SDL_gamecontroller.c b/thirdparty/SDL/src/joystick/SDL_gamecontroller.c index 035176b37..410c985d4 100644 --- a/thirdparty/SDL/src/joystick/SDL_gamecontroller.c +++ b/thirdparty/SDL/src/joystick/SDL_gamecontroller.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -27,12 +27,13 @@ #include "SDL_timer.h" #include "SDL_sysjoystick.h" #include "SDL_joystick_c.h" +#include "SDL_steam_virtual_gamepad.h" #include "SDL_gamecontrollerdb.h" #include "controller_type.h" #include "usb_ids.h" #include "hidapi/SDL_hidapi_nintendo.h" -#if !SDL_EVENTS_DISABLED +#ifndef SDL_EVENTS_DISABLED #include "../events/SDL_events_c.h" #endif @@ -45,6 +46,8 @@ #define SDL_CONTROLLER_CRC_FIELD "crc:" #define SDL_CONTROLLER_CRC_FIELD_SIZE 4 /* hard-coded for speed */ +#define SDL_CONTROLLER_TYPE_FIELD "type:" +#define SDL_CONTROLLER_TYPE_FIELD_SIZE SDL_strlen(SDL_CONTROLLER_TYPE_FIELD) #define SDL_CONTROLLER_PLATFORM_FIELD "platform:" #define SDL_CONTROLLER_PLATFORM_FIELD_SIZE SDL_strlen(SDL_CONTROLLER_PLATFORM_FIELD) #define SDL_CONTROLLER_HINT_FIELD "hint:" @@ -133,6 +136,7 @@ struct _SDL_GameController int ref_count _guarded; const char *name _guarded; + SDL_GameControllerType type _guarded; ControllerMapping_t *mapping _guarded; int num_bindings _guarded; SDL_ExtendedGameControllerBind *bindings _guarded; @@ -153,70 +157,18 @@ struct _SDL_GameController return retval; \ } -typedef struct -{ - int num_entries; - int max_entries; - Uint32 *entries; -} SDL_vidpid_list; - -static SDL_vidpid_list SDL_allowed_controllers; -static SDL_vidpid_list SDL_ignored_controllers; - -static void SDL_LoadVIDPIDListFromHint(const char *hint, SDL_vidpid_list *list) -{ - Uint32 entry; - char *spot; - char *file = NULL; - - list->num_entries = 0; - - if (hint && *hint == '@') { - spot = file = (char *)SDL_LoadFile(hint + 1, NULL); - } else { - spot = (char *)hint; - } - - if (spot == NULL) { - return; - } - - while ((spot = SDL_strstr(spot, "0x")) != NULL) { - entry = (Uint16)SDL_strtol(spot, &spot, 0); - entry <<= 16; - spot = SDL_strstr(spot, "0x"); - if (spot == NULL) { - break; - } - entry |= (Uint16)SDL_strtol(spot, &spot, 0); - - if (list->num_entries == list->max_entries) { - int max_entries = list->max_entries + 16; - Uint32 *entries = (Uint32 *)SDL_realloc(list->entries, max_entries * sizeof(*list->entries)); - if (entries == NULL) { - /* Out of memory, go with what we have already */ - break; - } - list->entries = entries; - list->max_entries = max_entries; - } - list->entries[list->num_entries++] = entry; - } - - if (file) { - SDL_free(file); - } -} - -static void SDLCALL SDL_GameControllerIgnoreDevicesChanged(void *userdata, const char *name, const char *oldValue, const char *hint) -{ - SDL_LoadVIDPIDListFromHint(hint, &SDL_ignored_controllers); -} - -static void SDLCALL SDL_GameControllerIgnoreDevicesExceptChanged(void *userdata, const char *name, const char *oldValue, const char *hint) -{ - SDL_LoadVIDPIDListFromHint(hint, &SDL_allowed_controllers); -} +static SDL_vidpid_list SDL_allowed_controllers = { + SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT, 0, 0, NULL, + NULL, 0, 0, NULL, + 0, NULL, + SDL_FALSE +}; +static SDL_vidpid_list SDL_ignored_controllers = { + SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES, 0, 0, NULL, + NULL, 0, 0, NULL, + 0, NULL, + SDL_FALSE +}; static ControllerMapping_t *SDL_PrivateAddMappingForGUID(SDL_JoystickGUID jGUID, const char *mappingString, SDL_bool *existing, SDL_ControllerMappingPriority priority); static int SDL_PrivateGameControllerAxis(SDL_GameController *gamecontroller, SDL_GameControllerAxis axis, Sint16 value); @@ -273,7 +225,7 @@ static void HandleJoystickAxis(SDL_GameController *gamecontroller, int axis, int } } - if (last_match && (match == NULL || !HasSameOutput(last_match, match))) { + if (last_match && (!match || !HasSameOutput(last_match, match))) { /* Clear the last input that this axis generated */ ResetOutput(gamecontroller, last_match); } @@ -568,9 +520,11 @@ static ControllerMapping_t *SDL_CreateMappingForHIDAPIController(SDL_JoystickGUI SDL_GetJoystickGUIDInfo(guid, &vendor, &product, NULL, NULL); if ((vendor == USB_VENDOR_NINTENDO && product == USB_PRODUCT_NINTENDO_GAMECUBE_ADAPTER) || - (vendor == USB_VENDOR_DRAGONRISE && product == USB_PRODUCT_EVORETRO_GAMECUBE_ADAPTER)) { + (vendor == USB_VENDOR_DRAGONRISE && + (product == USB_PRODUCT_EVORETRO_GAMECUBE_ADAPTER1 || + product == USB_PRODUCT_EVORETRO_GAMECUBE_ADAPTER2))) { /* GameCube driver has 12 buttons and 6 axes */ - SDL_strlcat(mapping_string, "a:b0,b:b1,dpdown:b6,dpleft:b4,dpright:b5,dpup:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b9,righttrigger:a5,rightx:a2,righty:a3,start:b8,x:b2,y:b3,", sizeof(mapping_string)); + SDL_strlcat(mapping_string, "a:b0,b:b1,dpdown:b6,dpleft:b4,dpright:b5,dpup:b7,lefttrigger:a4,leftx:a0,lefty:a1~,rightshoulder:b9,righttrigger:a5,rightx:a2,righty:a3~,start:b8,x:b2,y:b3,", sizeof(mapping_string)); } else if (vendor == USB_VENDOR_NINTENDO && (guid.data[15] == k_eSwitchDeviceInfoControllerType_HVCLeft || guid.data[15] == k_eSwitchDeviceInfoControllerType_HVCRight || @@ -601,7 +555,7 @@ static ControllerMapping_t *SDL_CreateMappingForHIDAPIController(SDL_JoystickGUI SDL_strlcat(mapping_string, "a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b5,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,righttrigger:a5,start:b6,x:b2,y:b3,misc1:b15,", sizeof(mapping_string)); break; case k_eSwitchDeviceInfoControllerType_SEGA_Genesis: - SDL_strlcat(mapping_string, "a:b0,b:b1,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b5,rightshoulder:b10,righttrigger:a5,start:b6,misc1:b15,", sizeof(mapping_string)); + SDL_strlcat(mapping_string, "a:b0,b:b1,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b5,leftshoulder:b9,rightshoulder:b10,righttrigger:a5,start:b6,x:b2,y:b3,misc1:b15,", sizeof(mapping_string)); break; case k_eWiiExtensionControllerType_None: SDL_strlcat(mapping_string, "a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b5,start:b6,x:b2,y:b3,", sizeof(mapping_string)); @@ -734,16 +688,14 @@ static ControllerMapping_t *SDL_CreateMappingForWGIController(SDL_JoystickGUID g /* * Helper function to scan the mappings database for a controller with the specified GUID */ -static ControllerMapping_t *SDL_PrivateMatchControllerMappingForGUID(SDL_JoystickGUID guid, SDL_bool match_crc, SDL_bool match_version) +static ControllerMapping_t *SDL_PrivateMatchControllerMappingForGUID(SDL_JoystickGUID guid, SDL_bool match_version) { - ControllerMapping_t *mapping; + ControllerMapping_t *mapping, *best_match = NULL; Uint16 crc = 0; SDL_AssertJoysticksLocked(); - if (match_crc) { - SDL_GetJoystickGUIDInfo(guid, NULL, NULL, NULL, &crc); - } + SDL_GetJoystickGUIDInfo(guid, NULL, NULL, NULL, &crc); /* Clear the CRC from the GUID for matching, the mappings never include it in the GUID */ SDL_SetJoystickGUIDCRC(&guid, 0); @@ -765,20 +717,26 @@ static ControllerMapping_t *SDL_PrivateMatchControllerMappingForGUID(SDL_Joystic } if (SDL_memcmp(&guid, &mapping_guid, sizeof(guid)) == 0) { - Uint16 mapping_crc = 0; + const char *crc_string = SDL_strstr(mapping->mapping, SDL_CONTROLLER_CRC_FIELD); + if (crc_string) { + Uint16 mapping_crc = (Uint16)SDL_strtol(crc_string + SDL_CONTROLLER_CRC_FIELD_SIZE, NULL, 16); - if (match_crc) { - const char *crc_string = SDL_strstr(mapping->mapping, SDL_CONTROLLER_CRC_FIELD); - if (crc_string) { - mapping_crc = (Uint16)SDL_strtol(crc_string + SDL_CONTROLLER_CRC_FIELD_SIZE, NULL, 16); + if (mapping_crc != crc) { + /* This mapping specified a CRC and they don't match */ + continue; } - } - if (crc == mapping_crc) { + + /* An exact match, including CRC */ return mapping; } + + + if (!best_match) { + best_match = mapping; + } } } - return NULL; + return best_match; } /* @@ -787,19 +745,8 @@ static ControllerMapping_t *SDL_PrivateMatchControllerMappingForGUID(SDL_Joystic static ControllerMapping_t *SDL_PrivateGetControllerMappingForGUID(SDL_JoystickGUID guid, SDL_bool adding_mapping) { ControllerMapping_t *mapping; - Uint16 vendor, product, crc; - SDL_GetJoystickGUIDInfo(guid, &vendor, &product, NULL, &crc); - if (crc) { - /* First check for exact CRC matching */ - mapping = SDL_PrivateMatchControllerMappingForGUID(guid, SDL_TRUE, SDL_TRUE); - if (mapping) { - return mapping; - } - } - - /* Now check for a mapping without CRC */ - mapping = SDL_PrivateMatchControllerMappingForGUID(guid, SDL_FALSE, SDL_TRUE); + mapping = SDL_PrivateMatchControllerMappingForGUID(guid, SDL_TRUE); if (mapping) { return mapping; } @@ -811,22 +758,15 @@ static ControllerMapping_t *SDL_PrivateGetControllerMappingForGUID(SDL_JoystickG /* Try harder to get the best match, or create a mapping */ - if (vendor && product) { + if (SDL_JoystickGUIDUsesVersion(guid)) { /* Try again, ignoring the version */ - if (crc) { - mapping = SDL_PrivateMatchControllerMappingForGUID(guid, SDL_TRUE, SDL_FALSE); - if (mapping) { - return mapping; - } - } - - mapping = SDL_PrivateMatchControllerMappingForGUID(guid, SDL_FALSE, SDL_FALSE); + mapping = SDL_PrivateMatchControllerMappingForGUID(guid, SDL_FALSE); if (mapping) { return mapping; } } -#if SDL_JOYSTICK_XINPUT +#ifdef SDL_JOYSTICK_XINPUT if (SDL_IsJoystickXInput(guid)) { /* This is an XInput device */ return s_pXInputMapping; @@ -848,6 +788,47 @@ static ControllerMapping_t *SDL_PrivateGetControllerMappingForGUID(SDL_JoystickG return mapping; } +static const char *map_StringForGameControllerType[] = { + "unknown", + "xbox360", + "xboxone", + "ps3", + "ps4", + "switchpro", + "virtual", + "ps5", + "amazonluna", + "googlestadia", + "nvidiashield", + "joyconleft", + "joyconright", + "joyconpair" +}; +SDL_COMPILE_TIME_ASSERT(map_StringForGameControllerType, SDL_arraysize(map_StringForGameControllerType) == SDL_CONTROLLER_TYPE_MAX); + +/* + * convert a string to its enum equivalent + */ +SDL_GameControllerType SDL_GetGameControllerTypeFromString(const char *str) +{ + int i; + + if (!str || str[0] == '\0') { + return SDL_CONTROLLER_TYPE_UNKNOWN; + } + + if (*str == '+' || *str == '-') { + ++str; + } + + for (i = 0; i < SDL_arraysize(map_StringForGameControllerType); ++i) { + if (SDL_strcasecmp(str, map_StringForGameControllerType[i]) == 0) { + return (SDL_GameControllerType)i; + } + } + return SDL_CONTROLLER_TYPE_UNKNOWN; +} + static const char *map_StringForControllerAxis[] = { "leftx", "lefty", @@ -1071,6 +1052,7 @@ static void SDL_PrivateGameControllerParseControllerConfigString(SDL_GameControl } else if (bGameButton) { if (i >= sizeof(szGameButton)) { + szGameButton[sizeof(szGameButton) - 1] = '\0'; SDL_SetError("Button name too large: %s", szGameButton); return; } @@ -1078,6 +1060,7 @@ static void SDL_PrivateGameControllerParseControllerConfigString(SDL_GameControl i++; } else { if (i >= sizeof(szJoystickButton)) { + szJoystickButton[sizeof(szJoystickButton) - 1] = '\0'; SDL_SetError("Joystick button name too large: %s", szJoystickButton); return; } @@ -1093,6 +1076,31 @@ static void SDL_PrivateGameControllerParseControllerConfigString(SDL_GameControl } } +static void SDL_UpdateGameControllerType(SDL_GameController *gamecontroller) +{ + char *type_string, *comma; + + SDL_AssertJoysticksLocked(); + + gamecontroller->type = SDL_CONTROLLER_TYPE_UNKNOWN; + + type_string = SDL_strstr(gamecontroller->mapping->mapping, SDL_CONTROLLER_TYPE_FIELD); + if (type_string) { + type_string += SDL_CONTROLLER_TYPE_FIELD_SIZE; + comma = SDL_strchr(type_string, ','); + if (comma) { + *comma = '\0'; + gamecontroller->type = SDL_GetGameControllerTypeFromString(type_string); + *comma = ','; + } else { + gamecontroller->type = SDL_GetGameControllerTypeFromString(type_string); + } + } + if (gamecontroller->type == SDL_CONTROLLER_TYPE_UNKNOWN) { + gamecontroller->type = SDL_GetJoystickGameControllerTypeFromGUID(SDL_JoystickGetGUID(gamecontroller->joystick), SDL_JoystickName(gamecontroller->joystick)); + } +} + /* * Make a new button mapping struct */ @@ -1105,12 +1113,14 @@ static void SDL_PrivateLoadButtonMapping(SDL_GameController *gamecontroller, Con gamecontroller->name = pControllerMapping->name; gamecontroller->num_bindings = 0; gamecontroller->mapping = pControllerMapping; - if (gamecontroller->joystick->naxes != 0 && gamecontroller->last_match_axis != NULL) { + if (gamecontroller->joystick->naxes != 0 && gamecontroller->last_match_axis) { SDL_memset(gamecontroller->last_match_axis, 0, gamecontroller->joystick->naxes * sizeof(*gamecontroller->last_match_axis)); } SDL_PrivateGameControllerParseControllerConfigString(gamecontroller, pControllerMapping->mapping); + SDL_UpdateGameControllerType(gamecontroller); + /* Set the zero point for triggers */ for (i = 0; i < gamecontroller->num_bindings; ++i) { SDL_ExtendedGameControllerBind *binding = &gamecontroller->bindings[i]; @@ -1134,7 +1144,7 @@ static char *SDL_PrivateGetControllerGUIDFromMappingString(const char *pMapping) const char *pFirstComma = SDL_strchr(pMapping, ','); if (pFirstComma) { char *pchGUID = SDL_malloc(pFirstComma - pMapping + 1); - if (pchGUID == NULL) { + if (!pchGUID) { SDL_OutOfMemory(); return NULL; } @@ -1150,7 +1160,7 @@ static char *SDL_PrivateGetControllerGUIDFromMappingString(const char *pMapping) SDL_memcpy(&pchGUID[8], &pchGUID[0], 4); SDL_memcpy(&pchGUID[0], "03000000", 8); } -#elif __MACOSX__ +#elif defined(__MACOSX__) if (SDL_strlen(pchGUID) == 32 && SDL_memcmp(&pchGUID[4], "000000000000", 12) == 0 && SDL_memcmp(&pchGUID[20], "000000000000", 12) == 0) { @@ -1173,17 +1183,17 @@ static char *SDL_PrivateGetControllerNameFromMappingString(const char *pMapping) char *pchName; pFirstComma = SDL_strchr(pMapping, ','); - if (pFirstComma == NULL) { + if (!pFirstComma) { return NULL; } pSecondComma = SDL_strchr(pFirstComma + 1, ','); - if (pSecondComma == NULL) { + if (!pSecondComma) { return NULL; } pchName = SDL_malloc(pSecondComma - pFirstComma); - if (pchName == NULL) { + if (!pchName) { SDL_OutOfMemory(); return NULL; } @@ -1200,12 +1210,12 @@ static char *SDL_PrivateGetControllerMappingFromMappingString(const char *pMappi const char *pFirstComma, *pSecondComma; pFirstComma = SDL_strchr(pMapping, ','); - if (pFirstComma == NULL) { + if (!pFirstComma) { return NULL; } pSecondComma = SDL_strchr(pFirstComma + 1, ','); - if (pSecondComma == NULL) { + if (!pSecondComma) { return NULL; } @@ -1248,13 +1258,13 @@ static ControllerMapping_t *SDL_PrivateAddMappingForGUID(SDL_JoystickGUID jGUID, SDL_AssertJoysticksLocked(); pchName = SDL_PrivateGetControllerNameFromMappingString(mappingString); - if (pchName == NULL) { + if (!pchName) { SDL_SetError("Couldn't parse name from %s", mappingString); return NULL; } pchMapping = SDL_PrivateGetControllerMappingFromMappingString(mappingString); - if (pchMapping == NULL) { + if (!pchMapping) { SDL_free(pchName); SDL_SetError("Couldn't parse %s", mappingString); return NULL; @@ -1311,7 +1321,7 @@ static ControllerMapping_t *SDL_PrivateAddMappingForGUID(SDL_JoystickGUID jGUID, *existing = SDL_TRUE; } else { pControllerMapping = SDL_malloc(sizeof(*pControllerMapping)); - if (pControllerMapping == NULL) { + if (!pControllerMapping) { SDL_free(pchName); SDL_free(pchMapping); SDL_OutOfMemory(); @@ -1356,7 +1366,7 @@ static ControllerMapping_t *SDL_PrivateGetControllerMappingForNameAndGUID(const mapping = SDL_PrivateGetControllerMappingForGUID(guid, SDL_FALSE); #ifdef __LINUX__ - if (mapping == NULL && name) { + if (!mapping && name) { if (SDL_strstr(name, "Xbox 360 Wireless Receiver")) { /* The Linux driver xpad.c maps the wireless dpad to buttons */ SDL_bool existing; @@ -1367,9 +1377,6 @@ static ControllerMapping_t *SDL_PrivateGetControllerMappingForNameAndGUID(const } #endif /* __LINUX__ */ - if (mapping == NULL) { - mapping = s_pDefaultMapping; - } return mapping; } @@ -1390,7 +1397,11 @@ static void SDL_PrivateAppendToMappingString(char *mapping_string, (void)SDL_snprintf(buffer, sizeof(buffer), "b%i", mapping->target); break; case EMappingKind_Axis: - (void)SDL_snprintf(buffer, sizeof(buffer), "a%i", mapping->target); + (void)SDL_snprintf(buffer, sizeof(buffer), "%sa%i%s", + mapping->half_axis_positive ? "+" : + mapping->half_axis_negative ? "-" : "", + mapping->target, + mapping->axis_reversed ? "~" : ""); break; case EMappingKind_Hat: (void)SDL_snprintf(buffer, sizeof(buffer), "h%i.%i", mapping->target >> 4, mapping->target & 0x0F); @@ -1448,6 +1459,7 @@ static ControllerMapping_t *SDL_PrivateGenerateAutomaticControllerMapping(const SDL_PrivateAppendToMappingString(mapping, sizeof(mapping), "righty", &raw_map->righty); SDL_PrivateAppendToMappingString(mapping, sizeof(mapping), "lefttrigger", &raw_map->lefttrigger); SDL_PrivateAppendToMappingString(mapping, sizeof(mapping), "righttrigger", &raw_map->righttrigger); + SDL_PrivateAppendToMappingString(mapping, sizeof(mapping), "touchpad", &raw_map->touchpad); return SDL_PrivateAddMappingForGUID(guid, mapping, &existing, SDL_CONTROLLER_MAPPING_PRIORITY_DEFAULT); } @@ -1468,7 +1480,7 @@ static ControllerMapping_t *SDL_PrivateGetControllerMapping(int device_index) name = SDL_JoystickNameForIndex(device_index); guid = SDL_JoystickGetDeviceGUID(device_index); mapping = SDL_PrivateGetControllerMappingForNameAndGUID(name, guid); - if (mapping == NULL) { + if (!mapping) { SDL_GamepadMapping raw_map; SDL_zero(raw_map); @@ -1477,6 +1489,9 @@ static ControllerMapping_t *SDL_PrivateGetControllerMapping(int device_index) } } + if (!mapping) { + mapping = s_pDefaultMapping; + } return mapping; } @@ -1490,13 +1505,13 @@ int SDL_GameControllerAddMappingsFromRW(SDL_RWops *rw, int freerw) char *buf, *line, *line_end, *tmp, *comma, line_platform[64]; size_t db_size, platform_len; - if (rw == NULL) { + if (!rw) { return SDL_SetError("Invalid RWops"); } db_size = (size_t)SDL_RWsize(rw); buf = (char *)SDL_malloc(db_size + 1); - if (buf == NULL) { + if (!buf) { if (freerw) { SDL_RWclose(rw); } @@ -1520,7 +1535,7 @@ int SDL_GameControllerAddMappingsFromRW(SDL_RWops *rw, int freerw) while (line < buf + db_size) { line_end = SDL_strchr(line, '\n'); - if (line_end != NULL) { + if (line_end) { *line_end = '\0'; } else { line_end = buf + db_size; @@ -1528,10 +1543,10 @@ int SDL_GameControllerAddMappingsFromRW(SDL_RWops *rw, int freerw) /* Extract and verify the platform */ tmp = SDL_strstr(line, SDL_CONTROLLER_PLATFORM_FIELD); - if (tmp != NULL) { + if (tmp) { tmp += SDL_CONTROLLER_PLATFORM_FIELD_SIZE; comma = SDL_strchr(tmp, ','); - if (comma != NULL) { + if (comma) { platform_len = comma - tmp + 1; if (platform_len + 1 < SDL_arraysize(line_platform)) { SDL_strlcpy(line_platform, tmp, platform_len); @@ -1564,7 +1579,7 @@ static int SDL_PrivateGameControllerAddMapping(const char *mappingString, SDL_Co SDL_AssertJoysticksLocked(); - if (mappingString == NULL) { + if (!mappingString) { return SDL_InvalidParamError("mappingString"); } @@ -1572,7 +1587,7 @@ static int SDL_PrivateGameControllerAddMapping(const char *mappingString, SDL_Co const char *tmp; tmp = SDL_strstr(mappingString, SDL_CONTROLLER_HINT_FIELD); - if (tmp != NULL) { + if (tmp) { SDL_bool default_value, value, negate; int len; char hint[128]; @@ -1614,14 +1629,14 @@ static int SDL_PrivateGameControllerAddMapping(const char *mappingString, SDL_Co const char *tmp; tmp = SDL_strstr(mappingString, SDL_CONTROLLER_SDKGE_FIELD); - if (tmp != NULL) { + if (tmp) { tmp += SDL_CONTROLLER_SDKGE_FIELD_SIZE; if (!(SDL_GetAndroidSDKVersion() >= SDL_atoi(tmp))) { return SDL_SetError("SDK version %d < minimum version %d", SDL_GetAndroidSDKVersion(), SDL_atoi(tmp)); } } tmp = SDL_strstr(mappingString, SDL_CONTROLLER_SDKLE_FIELD); - if (tmp != NULL) { + if (tmp) { tmp += SDL_CONTROLLER_SDKLE_FIELD_SIZE; if (!(SDL_GetAndroidSDKVersion() <= SDL_atoi(tmp))) { return SDL_SetError("SDK version %d > maximum version %d", SDL_GetAndroidSDKVersion(), SDL_atoi(tmp)); @@ -1631,7 +1646,7 @@ static int SDL_PrivateGameControllerAddMapping(const char *mappingString, SDL_Co #endif pchGUID = SDL_PrivateGetControllerGUIDFromMappingString(mappingString); - if (pchGUID == NULL) { + if (!pchGUID) { return SDL_SetError("Couldn't parse GUID from %s", mappingString); } if (!SDL_strcasecmp(pchGUID, "default")) { @@ -1643,7 +1658,7 @@ static int SDL_PrivateGameControllerAddMapping(const char *mappingString, SDL_Co SDL_free(pchGUID); pControllerMapping = SDL_PrivateAddMappingForGUID(jGUID, mappingString, &existing, priority); - if (pControllerMapping == NULL) { + if (!pControllerMapping) { return -1; } @@ -1724,7 +1739,7 @@ static char *CreateMappingString(ControllerMapping_t *mapping, SDL_JoystickGUID } pMappingString = SDL_malloc(needed); - if (pMappingString == NULL) { + if (!pMappingString) { SDL_OutOfMemory(); return NULL; } @@ -1774,7 +1789,7 @@ char *SDL_GameControllerMappingForIndex(int mapping_index) } SDL_UnlockJoysticks(); - if (retval == NULL) { + if (!retval) { SDL_SetError("Mapping not available"); } return retval; @@ -1820,7 +1835,7 @@ char *SDL_GameControllerMapping(SDL_GameController *gamecontroller) return retval; } -static void SDL_GameControllerLoadHints() +static void SDL_GameControllerLoadHints(void) { const char *hint = SDL_GetHint(SDL_HINT_GAMECONTROLLERCONFIG); if (hint && hint[0]) { @@ -1894,10 +1909,8 @@ int SDL_GameControllerInitMappings(void) /* load in any user supplied config */ SDL_GameControllerLoadHints(); - SDL_AddHintCallback(SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES, - SDL_GameControllerIgnoreDevicesChanged, NULL); - SDL_AddHintCallback(SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT, - SDL_GameControllerIgnoreDevicesExceptChanged, NULL); + SDL_LoadVIDPIDList(&SDL_allowed_controllers); + SDL_LoadVIDPIDList(&SDL_ignored_controllers); return 0; } @@ -1932,7 +1945,7 @@ const char *SDL_GameControllerNameForIndex(int joystick_index) SDL_LockJoysticks(); { ControllerMapping_t *mapping = SDL_PrivateGetControllerMapping(joystick_index); - if (mapping != NULL) { + if (mapping) { if (SDL_strcmp(mapping->name, "*") == 0) { retval = SDL_JoystickNameForIndex(joystick_index); } else { @@ -1955,7 +1968,7 @@ const char *SDL_GameControllerPathForIndex(int joystick_index) SDL_LockJoysticks(); { ControllerMapping_t *mapping = SDL_PrivateGetControllerMapping(joystick_index); - if (mapping != NULL) { + if (mapping) { retval = SDL_JoystickPathForIndex(joystick_index); } } @@ -1969,7 +1982,26 @@ const char *SDL_GameControllerPathForIndex(int joystick_index) */ SDL_GameControllerType SDL_GameControllerTypeForIndex(int joystick_index) { - return SDL_GetJoystickGameControllerTypeFromGUID(SDL_JoystickGetDeviceGUID(joystick_index), SDL_JoystickNameForIndex(joystick_index)); + SDL_JoystickGUID joystick_guid = SDL_JoystickGetDeviceGUID(joystick_index); + const char *mapping = SDL_GameControllerMappingForGUID(joystick_guid); + char *type_string, *comma; + SDL_GameControllerType type; + if (mapping) { + type_string = SDL_strstr(mapping, SDL_CONTROLLER_TYPE_FIELD); + if (type_string) { + type_string += SDL_CONTROLLER_TYPE_FIELD_SIZE; + comma = SDL_strchr(type_string, ','); + if (comma) { + *comma = '\0'; + type = SDL_GetGameControllerTypeFromString(type_string); + *comma = ','; + } else { + type = SDL_GetGameControllerTypeFromString(type_string); + } + return type; + } + } + return SDL_GetJoystickGameControllerTypeFromGUID(joystick_guid, SDL_JoystickNameForIndex(joystick_index)); } /** @@ -1984,7 +2016,7 @@ char *SDL_GameControllerMappingForDeviceIndex(int joystick_index) SDL_LockJoysticks(); { ControllerMapping_t *mapping = SDL_PrivateGetControllerMapping(joystick_index); - if (mapping != NULL) { + if (mapping) { SDL_JoystickGUID guid; char pchGUID[33]; size_t needed; @@ -1993,7 +2025,7 @@ char *SDL_GameControllerMappingForDeviceIndex(int joystick_index) /* allocate enough memory for GUID + ',' + name + ',' + mapping + \0 */ needed = SDL_strlen(pchGUID) + 1 + SDL_strlen(mapping->name) + 1 + SDL_strlen(mapping->mapping) + 1; retval = (char *)SDL_malloc(needed); - if (retval != NULL) { + if (retval) { (void)SDL_snprintf(retval, needed, "%s,%s,%s", pchGUID, mapping->name, mapping->mapping); } else { SDL_OutOfMemory(); @@ -2013,7 +2045,7 @@ SDL_bool SDL_IsGameControllerNameAndGUID(const char *name, SDL_JoystickGUID guid SDL_LockJoysticks(); { - if (SDL_PrivateGetControllerMappingForNameAndGUID(name, guid) != NULL) { + if (s_pDefaultMapping || SDL_PrivateGetControllerMappingForNameAndGUID(name, guid) != NULL) { retval = SDL_TRUE; } else { retval = SDL_FALSE; @@ -2064,11 +2096,9 @@ static SDL_bool SDL_endswith(const char *string, const char *suffix) */ SDL_bool SDL_ShouldIgnoreGameController(const char *name, SDL_JoystickGUID guid) { - int i; Uint16 vendor; Uint16 product; Uint16 version; - Uint32 vidpid; #if defined(__LINUX__) if (SDL_endswith(name, " Motion Sensors")) { @@ -2093,8 +2123,8 @@ SDL_bool SDL_ShouldIgnoreGameController(const char *name, SDL_JoystickGUID guid) return SDL_TRUE; } - if (SDL_allowed_controllers.num_entries == 0 && - SDL_ignored_controllers.num_entries == 0) { + if (SDL_allowed_controllers.num_included_entries == 0 && + SDL_ignored_controllers.num_included_entries == 0) { return SDL_FALSE; } @@ -2117,20 +2147,14 @@ SDL_bool SDL_ShouldIgnoreGameController(const char *name, SDL_JoystickGUID guid) } } - vidpid = MAKE_VIDPID(vendor, product); - - if (SDL_allowed_controllers.num_entries > 0) { - for (i = 0; i < SDL_allowed_controllers.num_entries; ++i) { - if (vidpid == SDL_allowed_controllers.entries[i]) { - return SDL_FALSE; - } + if (SDL_allowed_controllers.num_included_entries > 0) { + if (SDL_VIDPIDInList(vendor, product, &SDL_allowed_controllers)) { + return SDL_FALSE; } return SDL_TRUE; } else { - for (i = 0; i < SDL_ignored_controllers.num_entries; ++i) { - if (vidpid == SDL_ignored_controllers.entries[i]) { - return SDL_TRUE; - } + if (SDL_VIDPIDInList(vendor, product, &SDL_ignored_controllers)) { + return SDL_TRUE; } return SDL_FALSE; } @@ -2155,7 +2179,7 @@ SDL_GameController *SDL_GameControllerOpen(int joystick_index) gamecontrollerlist = SDL_gamecontrollers; /* If the controller is already open, return it */ instance_id = SDL_JoystickGetDeviceInstanceID(joystick_index); - while (gamecontrollerlist != NULL) { + while (gamecontrollerlist) { if (instance_id == gamecontrollerlist->joystick->instance_id) { gamecontroller = gamecontrollerlist; ++gamecontroller->ref_count; @@ -2167,7 +2191,7 @@ SDL_GameController *SDL_GameControllerOpen(int joystick_index) /* Find a controller mapping */ pSupportedController = SDL_PrivateGetControllerMapping(joystick_index); - if (pSupportedController == NULL) { + if (!pSupportedController) { SDL_SetError("Couldn't find mapping for device (%d)", joystick_index); SDL_UnlockJoysticks(); return NULL; @@ -2175,7 +2199,7 @@ SDL_GameController *SDL_GameControllerOpen(int joystick_index) /* Create and initialize the controller */ gamecontroller = (SDL_GameController *)SDL_calloc(1, sizeof(*gamecontroller)); - if (gamecontroller == NULL) { + if (!gamecontroller) { SDL_OutOfMemory(); SDL_UnlockJoysticks(); return NULL; @@ -2183,7 +2207,7 @@ SDL_GameController *SDL_GameControllerOpen(int joystick_index) gamecontroller->magic = &gamecontroller_magic; gamecontroller->joystick = SDL_JoystickOpen(joystick_index); - if (gamecontroller->joystick == NULL) { + if (!gamecontroller->joystick) { SDL_free(gamecontroller); SDL_UnlockJoysticks(); return NULL; @@ -2640,7 +2664,8 @@ const char *SDL_GameControllerName(SDL_GameController *gamecontroller) { CHECK_GAMECONTROLLER_MAGIC(gamecontroller, NULL); - if (SDL_strcmp(gamecontroller->name, "*") == 0) { + if (SDL_strcmp(gamecontroller->name, "*") == 0 || + gamecontroller->joystick->steam_handle != 0) { retval = SDL_JoystickName(gamecontroller->joystick); } else { retval = gamecontroller->name; @@ -2655,7 +2680,7 @@ const char *SDL_GameControllerPath(SDL_GameController *gamecontroller) { SDL_Joystick *joystick = SDL_GameControllerGetJoystick(gamecontroller); - if (joystick == NULL) { + if (!joystick) { return NULL; } return SDL_JoystickPath(joystick); @@ -2663,19 +2688,34 @@ const char *SDL_GameControllerPath(SDL_GameController *gamecontroller) SDL_GameControllerType SDL_GameControllerGetType(SDL_GameController *gamecontroller) { - SDL_Joystick *joystick = SDL_GameControllerGetJoystick(gamecontroller); + SDL_GameControllerType type = SDL_CONTROLLER_TYPE_UNKNOWN; + SDL_Joystick *joystick; + const SDL_SteamVirtualGamepadInfo *info; - if (joystick == NULL) { - return SDL_CONTROLLER_TYPE_UNKNOWN; + SDL_LockJoysticks(); + { + CHECK_GAMECONTROLLER_MAGIC(gamecontroller, SDL_CONTROLLER_TYPE_UNKNOWN); + + joystick = gamecontroller->joystick; + info = SDL_GetJoystickInstanceVirtualGamepadInfo(joystick->instance_id); + if (info) { + type = info->type; + } else if (gamecontroller->type != SDL_CONTROLLER_TYPE_UNKNOWN) { + type = gamecontroller->type; + } else { + type = SDL_GetJoystickGameControllerTypeFromGUID(SDL_JoystickGetGUID(joystick), SDL_JoystickName(joystick)); + } } - return SDL_GetJoystickGameControllerTypeFromGUID(SDL_JoystickGetGUID(joystick), SDL_JoystickName(joystick)); + SDL_UnlockJoysticks(); + + return type; } int SDL_GameControllerGetPlayerIndex(SDL_GameController *gamecontroller) { SDL_Joystick *joystick = SDL_GameControllerGetJoystick(gamecontroller); - if (joystick == NULL) { + if (!joystick) { return -1; } return SDL_JoystickGetPlayerIndex(joystick); @@ -2688,7 +2728,7 @@ void SDL_GameControllerSetPlayerIndex(SDL_GameController *gamecontroller, int pl { SDL_Joystick *joystick = SDL_GameControllerGetJoystick(gamecontroller); - if (joystick == NULL) { + if (!joystick) { return; } SDL_JoystickSetPlayerIndex(joystick, player_index); @@ -2698,7 +2738,7 @@ Uint16 SDL_GameControllerGetVendor(SDL_GameController *gamecontroller) { SDL_Joystick *joystick = SDL_GameControllerGetJoystick(gamecontroller); - if (joystick == NULL) { + if (!joystick) { return 0; } return SDL_JoystickGetVendor(joystick); @@ -2708,7 +2748,7 @@ Uint16 SDL_GameControllerGetProduct(SDL_GameController *gamecontroller) { SDL_Joystick *joystick = SDL_GameControllerGetJoystick(gamecontroller); - if (joystick == NULL) { + if (!joystick) { return 0; } return SDL_JoystickGetProduct(joystick); @@ -2718,7 +2758,7 @@ Uint16 SDL_GameControllerGetProductVersion(SDL_GameController *gamecontroller) { SDL_Joystick *joystick = SDL_GameControllerGetJoystick(gamecontroller); - if (joystick == NULL) { + if (!joystick) { return 0; } return SDL_JoystickGetProductVersion(joystick); @@ -2728,7 +2768,7 @@ Uint16 SDL_GameControllerGetFirmwareVersion(SDL_GameController *gamecontroller) { SDL_Joystick *joystick = SDL_GameControllerGetJoystick(gamecontroller); - if (joystick == NULL) { + if (!joystick) { return 0; } return SDL_JoystickGetFirmwareVersion(joystick); @@ -2738,12 +2778,27 @@ const char * SDL_GameControllerGetSerial(SDL_GameController *gamecontroller) { SDL_Joystick *joystick = SDL_GameControllerGetJoystick(gamecontroller); - if (joystick == NULL) { + if (!joystick) { return NULL; } return SDL_JoystickGetSerial(joystick); } +Uint64 SDL_GameControllerGetSteamHandle(SDL_GameController *gamecontroller) +{ + Uint64 handle = 0; + + SDL_LockJoysticks(); + { + CHECK_GAMECONTROLLER_MAGIC(gamecontroller, 0); + + handle = gamecontroller->joystick->steam_handle; + } + SDL_UnlockJoysticks(); + + return handle; +} + /* * Return if the controller in question is currently attached to the system, * \return 0 if not plugged in, 1 if still present. @@ -2752,7 +2807,7 @@ SDL_bool SDL_GameControllerGetAttached(SDL_GameController *gamecontroller) { SDL_Joystick *joystick = SDL_GameControllerGetJoystick(gamecontroller); - if (joystick == NULL) { + if (!joystick) { return SDL_FALSE; } return SDL_JoystickGetAttached(joystick); @@ -2894,7 +2949,7 @@ int SDL_GameControllerRumble(SDL_GameController *gamecontroller, Uint16 low_freq { SDL_Joystick *joystick = SDL_GameControllerGetJoystick(gamecontroller); - if (joystick == NULL) { + if (!joystick) { return -1; } return SDL_JoystickRumble(joystick, low_frequency_rumble, high_frequency_rumble, duration_ms); @@ -2904,7 +2959,7 @@ int SDL_GameControllerRumbleTriggers(SDL_GameController *gamecontroller, Uint16 { SDL_Joystick *joystick = SDL_GameControllerGetJoystick(gamecontroller); - if (joystick == NULL) { + if (!joystick) { return -1; } return SDL_JoystickRumbleTriggers(joystick, left_rumble, right_rumble, duration_ms); @@ -2914,7 +2969,7 @@ SDL_bool SDL_GameControllerHasLED(SDL_GameController *gamecontroller) { SDL_Joystick *joystick = SDL_GameControllerGetJoystick(gamecontroller); - if (joystick == NULL) { + if (!joystick) { return SDL_FALSE; } return SDL_JoystickHasLED(joystick); @@ -2924,7 +2979,7 @@ SDL_bool SDL_GameControllerHasRumble(SDL_GameController *gamecontroller) { SDL_Joystick *joystick = SDL_GameControllerGetJoystick(gamecontroller); - if (joystick == NULL) { + if (!joystick) { return SDL_FALSE; } return SDL_JoystickHasRumble(joystick); @@ -2934,7 +2989,7 @@ SDL_bool SDL_GameControllerHasRumbleTriggers(SDL_GameController *gamecontroller) { SDL_Joystick *joystick = SDL_GameControllerGetJoystick(gamecontroller); - if (joystick == NULL) { + if (!joystick) { return SDL_FALSE; } return SDL_JoystickHasRumbleTriggers(joystick); @@ -2944,7 +2999,7 @@ int SDL_GameControllerSetLED(SDL_GameController *gamecontroller, Uint8 red, Uint { SDL_Joystick *joystick = SDL_GameControllerGetJoystick(gamecontroller); - if (joystick == NULL) { + if (!joystick) { return -1; } return SDL_JoystickSetLED(joystick, red, green, blue); @@ -2954,7 +3009,7 @@ int SDL_GameControllerSendEffect(SDL_GameController *gamecontroller, const void { SDL_Joystick *joystick = SDL_GameControllerGetJoystick(gamecontroller); - if (joystick == NULL) { + if (!joystick) { return -1; } return SDL_JoystickSendEffect(joystick, data, size); @@ -2966,7 +3021,7 @@ void SDL_GameControllerClose(SDL_GameController *gamecontroller) SDL_LockJoysticks(); - if (gamecontroller == NULL || gamecontroller->magic != &gamecontroller_magic) { + if (!gamecontroller || gamecontroller->magic != &gamecontroller_magic) { SDL_UnlockJoysticks(); return; } @@ -3033,19 +3088,8 @@ void SDL_GameControllerQuitMappings(void) SDL_DelEventWatch(SDL_GameControllerEventWatcher, NULL); - SDL_DelHintCallback(SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES, - SDL_GameControllerIgnoreDevicesChanged, NULL); - SDL_DelHintCallback(SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT, - SDL_GameControllerIgnoreDevicesExceptChanged, NULL); - - if (SDL_allowed_controllers.entries) { - SDL_free(SDL_allowed_controllers.entries); - SDL_zero(SDL_allowed_controllers); - } - if (SDL_ignored_controllers.entries) { - SDL_free(SDL_ignored_controllers.entries); - SDL_zero(SDL_ignored_controllers); - } + SDL_FreeVIDPIDList(&SDL_allowed_controllers); + SDL_FreeVIDPIDList(&SDL_ignored_controllers); } /* @@ -3059,7 +3103,7 @@ static int SDL_PrivateGameControllerAxis(SDL_GameController *gamecontroller, SDL /* translate the event, if desired */ posted = 0; -#if !SDL_EVENTS_DISABLED +#ifndef SDL_EVENTS_DISABLED if (SDL_GetEventState(SDL_CONTROLLERAXISMOTION) == SDL_ENABLE) { SDL_Event event; event.type = SDL_CONTROLLERAXISMOTION; @@ -3078,7 +3122,7 @@ static int SDL_PrivateGameControllerAxis(SDL_GameController *gamecontroller, SDL static int SDL_PrivateGameControllerButton(SDL_GameController *gamecontroller, SDL_GameControllerButton button, Uint8 state) { int posted; -#if !SDL_EVENTS_DISABLED +#ifndef SDL_EVENTS_DISABLED SDL_Event event; SDL_AssertJoysticksLocked(); @@ -3120,7 +3164,7 @@ static int SDL_PrivateGameControllerButton(SDL_GameController *gamecontroller, S /* translate the event, if desired */ posted = 0; -#if !SDL_EVENTS_DISABLED +#ifndef SDL_EVENTS_DISABLED if (SDL_GetEventState(event.type) == SDL_ENABLE) { event.cbutton.which = gamecontroller->joystick->instance_id; event.cbutton.button = button; @@ -3136,7 +3180,7 @@ static int SDL_PrivateGameControllerButton(SDL_GameController *gamecontroller, S */ int SDL_GameControllerEventState(int state) { -#if SDL_EVENTS_DISABLED +#ifdef SDL_EVENTS_DISABLED return SDL_IGNORE; #else const Uint32 event_list[] = { @@ -3201,10 +3245,11 @@ const char *SDL_GameControllerGetAppleSFSymbolsNameForButton(SDL_GameController } SDL_UnlockJoysticks(); - return retval; -#else - return NULL; + if (retval && *retval) { + return retval; + } #endif + return NULL; } const char *SDL_GameControllerGetAppleSFSymbolsNameForAxis(SDL_GameController *gamecontroller, SDL_GameControllerAxis axis) @@ -3221,10 +3266,11 @@ const char *SDL_GameControllerGetAppleSFSymbolsNameForAxis(SDL_GameController *g } SDL_UnlockJoysticks(); - return retval; -#else - return NULL; + if (retval && *retval) { + return retval; + } #endif + return NULL; } /* vi: set ts=4 sw=4 expandtab: */ diff --git a/thirdparty/SDL/src/joystick/SDL_gamecontrollerdb.h b/thirdparty/SDL/src/joystick/SDL_gamecontrollerdb.h index f926c1612..e1474b321 100644 --- a/thirdparty/SDL/src/joystick/SDL_gamecontrollerdb.h +++ b/thirdparty/SDL/src/joystick/SDL_gamecontrollerdb.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -29,10 +29,10 @@ Alternatively, you can use the app located in test/controllermap */ static const char *s_ControllerMappings[] = { -#if SDL_JOYSTICK_XINPUT - "xinput,XInput 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,", +#ifdef SDL_JOYSTICK_XINPUT + "xinput,*,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,", #endif -#if SDL_JOYSTICK_WGI +#ifdef SDL_JOYSTICK_WGI "03000000491900001904000000007700,Amazon Luna Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,misc1:b9,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b7,x:b2,y:b3,", "03000000d11800000094000000007700,Google Stadia 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:a5,leftx:a0,lefty:a1,misc1:b12,rightshoulder:b5,rightstick:b10,righttrigger:a4,rightx:a2,righty:a3,start:b7,x:b2,y:b3,", "030000007e0500000920000000007701,Nintendo Switch Pro Controller,a:b1,b:b0,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,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:b2,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", @@ -42,7 +42,7 @@ static const char *s_ControllerMappings[] = { "0300000032150000000a000000007703,Razer Atrox Arcade Stick,a:b0,b:b1,dpdown:b12,dpleft:b13,dpright:b11,dpup:b10,leftshoulder:b4,lefttrigger:b8,rightshoulder:b5,righttrigger:b9,x:b2,y:b3,", "03000000de280000ff11000000007701,Steam Virtual Gamepad,a:b0,b:b1,back:b6,dpdown:b12,dpleft:b13,dpright:b11,dpup:b10,leftshoulder:b4,leftstick:b8,lefttrigger:a4,leftx:a1,lefty:a0~,rightshoulder:b5,rightstick:b9,righttrigger:a5,rightx:a3,righty:a2~,start:b7,x:b2,y:b3,", #endif -#if SDL_JOYSTICK_DINPUT +#ifdef SDL_JOYSTICK_DINPUT "03000000fa2d00000100000000000000,3DRUDDER,leftx:a0,lefty:a1,rightx:a5,righty:a2,", "03000000c82d00000090000000000000,8BitDo FC30 Pro,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", "03000000c82d00000090000000000000,8BitDo FC30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", @@ -125,6 +125,7 @@ static const char *s_ControllerMappings[] = { "03000000260900008888000000000000,Cyber Gadget GameCube Controller,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b6,righttrigger:a4,rightx:a2,righty:a3~,start:b7,x:b2,y:b3,", "03000000a306000022f6000000000000,Cyborg V.3 Rumble Pad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:+a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:-a3,rightx:a2,righty:a4,start:b9,x:b0,y:b3,", "03000000451300000830000000000000,Defender Game Racer X7,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,", + "03000000790000000600000000000000,Defender Joystick Cobra R4,crc:c77a,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,", "03000000791d00000103000000000000,Dual Box WII,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b6,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b5,rightx:a2,righty:a3,start:b9,x:b3,y:b0,", "03000000bd12000002e0000000000000,Dual USB Vibration Joystick,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b9,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b10,righttrigger:b5,rightx:a3,righty:a2,start:b11,x:b3,y:b0,", "030000006f0e00003001000000000000,EA SPORTS PS3 Controller,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:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", @@ -278,6 +279,7 @@ static const char *s_ControllerMappings[] = { "03000000050b00001c1a000000000000,ROG Chakram X,a:b1,b:b0,leftx:a0,lefty:a1,x:b2,y:b3,", "03000000050b0000e318000000000000,ROG Chakram,a:b1,b:b0,leftx:a0,lefty:a1,x:b2,y:b3,", "03000000050b0000e518000000000000,ROG Chakram,a:b1,b:b0,leftx:a0,lefty:a1,x:b2,y:b3,", + "030000000d0f0000ad00000000000000,RX Gamepad,a:b0,b:b4,back:b11,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b3,rightshoulder:b6,start:b9,x:b2,y:b1,", "03000000321500000003000000000000,Razer Hydra,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b8,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a2,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", "03000000321500000204000000000000,Razer Panthera (PS3),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:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", "03000000321500000104000000000000,Razer Panthera (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:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", @@ -302,6 +304,7 @@ static const char *s_ControllerMappings[] = { "030000006f0e00002f01000000000000,Rock Candy PS3 Controller,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:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", "03000000341a00000208000000000000,SL-6555-SBK,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b8,lefttrigger:-a4,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a4,rightx:a3,righty:a2,start:b7,x:b2,y:b3,", "03000000341a00000908000000000000,SL-6566,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,", + "03000000790000000600000000000000,SPEEDLINK STRIKE Gamepad,crc:5811,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:a4,start:b9,x:b3,y:b0,", "03000000790000001c18000000000000,STK-7024X,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,", "03000000ff1100003133000000000000,SVEN X-PAD,a:b2,b:b3,back:b4,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b9,rightx:a2,righty:a4,start:b5,x:b0,y:b1,", "03000000457500002211000000000000,SZMY-POWER PC Gamepad,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:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", @@ -316,10 +319,12 @@ static const char *s_ControllerMappings[] = { "03000000a30600002106000000000000,Saitek PS1000,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:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a4,start:b9,x:b0,y:b3,", "03000000a306000020f6000000000000,Saitek PS2700,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:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a4,start:b9,x:b0,y:b3,", "03000000300f00001101000000000000,Saitek Rumble Pad,a:b2,b:b3,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b0,y:b1,", + "03000000790000000600000000000000,Sanwa Supply JY-P76USV,crc:20f0,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,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a4,start:b9,x:b2,y:b3,", "0300000000050000289b000000000000,Saturn_Adapter_2.0,a:b1,b:b2,leftshoulder:b6,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b5,start:b9,x:b0,y:b3,", "030000009b2800000500000000000000,Saturn_Adapter_2.0,a:b1,b:b2,leftshoulder:b6,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b5,start:b9,x:b0,y:b3,", "030000008f0e00000800000000000000,SpeedLink Strike FX,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,", "03000000c01100000591000000000000,Speedlink Torid,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,", + "030000004c0500006802000000000000,SplitFish Game Controller,crc:5628,a:b0,b:b16,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,leftshoulder:b17,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b10,", "03000000de280000ff11000000000000,Steam Virtual Gamepad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b8,lefttrigger:+a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:-a2,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", "03000000110100003114000000000000,SteelSeries Stratus Duo,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b3,y:b4,", "03000000381000001814000000000000,SteelSeries Stratus XL,a:b0,b:b1,back:b18,dpdown:b13,dpleft:b14,dpright:b15,dpup:b12,guide:b19,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b2,y:b3,", @@ -593,6 +598,7 @@ static const char *s_ControllerMappings[] = { "05000000503200000110000000000000,Atari Classic Controller,a:b0,back:b2,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b4,start:b3,x:b1,", "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,", @@ -698,7 +704,6 @@ static const char *s_ControllerMappings[] = { "03000000451300000830000010010000,NYKO CORE,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:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", "03000000790000004318000010010000,Nintendo 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,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", "03000000790000004318000010010000,Nintendo GameCube Controller,a:b1,b:b0,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:b2,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", - "030000007e0500003703000000016800,Nintendo GameCube Controller,a:b0,b:b2,dpdown:b6,dpleft:b4,dpright:b5,dpup:b7,lefttrigger:a4,leftx:a0,lefty:a1~,rightshoulder:b9,righttrigger:a5,rightx:a2,righty:a3~,start:b8,x:b1,y:b3,", "050000007e0500000620000001800000,Nintendo Switch Joy-Con (L),a:b15,b:b16,guide:b4,leftshoulder:b6,leftstick:b12,leftx:a1,lefty:a0~,rightshoulder:b8,start:b9,x:b17,y:b14,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", "050000007e0500000620000001800000,Nintendo Switch Joy-Con (L),a:b16,b:b15,guide:b4,leftshoulder:b6,leftstick:b12,leftx:a1,lefty:a0~,rightshoulder:b8,start:b9,x:b14,y:b17,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", "060000007e0500000620000000000000,Nintendo Switch Joy-Con (L/R),a:b1,b:b0,back:b9,dpdown:b15,dpleft:b16,dpright:b17,dpup:b14,leftshoulder:b5,leftstick:b12,lefttrigger:b7,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b13,righttrigger:b8,rightx:a2,righty:a3,start:b10,x:b2,y:b3,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", @@ -768,6 +773,8 @@ static const char *s_ControllerMappings[] = { "03000000300f00001211000011010000,QanBa Arcade JoyStick,a:b2,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b5,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b6,start:b9,x:b1,y:b3,", "03000000222c00000225000011010000,Qanba Dragon Arcade Joystick (PS3),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:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", "03000000222c00000025000011010000,Qanba Dragon Arcade Joystick (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:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "03000000222c00001020000011010000,Qanba Drone 2 Arcade Joystick (PS5),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:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "03000000222c00001220000011010000,Qanba Drone 2 Arcade Joystick (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,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", "03000000222c00000020000011010000,Qanba Drone Arcade Joystick (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:a3,rightshoulder:b5,righttrigger:a4,start:b9,x:b0,y:b3,", "03000000222c00000223000011010000,Qanba Obsidian Arcade Joystick (PS3),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:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", "03000000222c00000023000011010000,Qanba Obsidian Arcade Joystick (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:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", @@ -817,6 +824,7 @@ static const char *s_ControllerMappings[] = { "05000000de2800000511000001000000,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,", "05000000de2800000611000001000000,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,", "03000000de2800000512000011010000,Steam Deck,a:b3,b:b4,back:b11,dpdown:b17,dpleft:b18,dpright:b19,dpup:b16,guide:b13,leftshoulder:b7,leftstick:b14,lefttrigger:a9,leftx:a0,lefty:a1,misc1:b2,paddle1:b21,paddle2:b20,paddle3:b23,paddle4:b22,rightshoulder:b8,rightstick:b15,righttrigger:a8,rightx:a2,righty:a3,start:b12,x:b5,y:b6,", + "03000000de2800000512000000016800,Steam Deck,a:b0,b:b1,x:b2,y:b3,back:b4,guide:b5,start:b6,leftstick:b7,rightstick:b8,leftshoulder:b9,rightshoulder:b10,dpup:b11,dpdown:b12,dpleft:b13,dpright:b14,misc1:b15,paddle1:b16,paddle2:b17,paddle3:b18,paddle4:b19,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:a4,righttrigger:a5,", "03000000de280000ff11000001000000,Steam Virtual 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,", "0500000011010000311400001b010000,SteelSeries Stratus Duo,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b32,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,", "05000000110100001914000009010000,SteelSeries Stratus XL,a:b0,b:b1,back:b17,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b18,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,", @@ -856,7 +864,6 @@ static const char *s_ControllerMappings[] = { "03000000120c0000100e000011010000,ZEROPLUS P4 Gamepad,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,", "03000000120c0000101e000011010000,ZEROPLUS P4 Wired Gamepad,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,", "03000000666600006706000000010000,boom PSX to PC Converter,a:b2,b:b1,back:b8,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,leftshoulder:b6,leftstick:b9,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b10,righttrigger:b5,rightx:a2,righty:a3,start:b11,x:b3,y:b0,", - "030000000d0f00000d00000000010000,hori,a:b0,b:b6,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b3,leftx:b4,lefty:b5,rightshoulder:b7,start:b9,x:b1,y:b2,", "03000000830500006020000010010000,iBuffalo SNES Controller,a:b0,b:b1,back:b6,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b5,start:b7,x:b2,y:b3,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", "03000000830500006020000010010000,iBuffalo SNES Controller,a:b1,b:b0,back:b6,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b5,start:b7,x:b3,y:b2,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", "050000006964726f69643a636f6e0000,idroid:con,a:b1,b:b2,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:b0,y:b3,", @@ -913,7 +920,6 @@ static const char *s_ControllerMappings[] = { "050000007e05000009200000ffff0f00,Nintendo Switch Pro Controller,a:b0,b:b1,back:b15,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b5,leftshoulder:b3,leftstick:b4,lefttrigger:b9,leftx:a0,lefty:a1,rightshoulder:b18,rightstick:b6,righttrigger:b10,rightx:a2,righty:a3,start:b16,x:b17,y:b2,sdk<=:28,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", /* Extremely slow in Bluetooth mode on Android */ "050000007e05000009200000ffff0f00,Nintendo Switch Pro Controller,a:b1,b:b0,back:b15,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b5,leftshoulder:b3,leftstick:b4,lefttrigger:b9,leftx:a0,lefty:a1,rightshoulder:b18,rightstick:b6,righttrigger:b10,rightx:a2,righty:a3,start:b16,x:b2,y:b17,sdk<=:28,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", /* Extremely slow in Bluetooth mode on Android */ "050000004c05000068020000dfff3f00,PS3 Controller,a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,", - "030000004c050000cc09000000006800,PS4 Controller,a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b5,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,", "050000004c050000c405000000783f00,PS4 Controller,a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b5,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,", "050000004c050000c4050000fffe3f80,PS4 Controller,a:b1,b:b17,back:b15,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b5,leftshoulder:b3,leftstick:b4,lefttrigger:+a2,leftx:a0,lefty:a1,rightshoulder:b18,rightstick:b6,righttrigger:+a3,rightx:a4,righty:a5,start:b16,x:b0,y:b2,", "050000004c050000c4050000ffff3f00,PS4 Controller,a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b5,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,", @@ -941,7 +947,7 @@ static const char *s_ControllerMappings[] = { "0500000083050000602000000ffe0000,iBuffalo SNES Controller,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,leftshoulder:b15,rightshoulder:b16,start:b10,x:b2,y:b3,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", "0500000083050000602000000ffe0000,iBuffalo SNES Controller,a:b1,b:b0,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,leftshoulder:b15,rightshoulder:b16,start:b10,x:b3,y:b2,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,", #endif -#if SDL_JOYSTICK_MFI +#ifdef SDL_JOYSTICK_MFI "05000000ac050000010000004f066d01,*,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b6,leftshoulder:b4,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a5,rightx:a3,righty:a4,x:b2,y:b3,", "05000000ac05000001000000cf076d01,*,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,x:b2,y:b3,", "05000000ac05000001000000df076d01,*,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b2,y:b3,", @@ -977,19 +983,19 @@ static const char *s_ControllerMappings[] = { "050000005e040000e0020000df070000,Xbox Wireless Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b2,y:b3,", "050000005e040000e0020000ff070000,Xbox Wireless Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b9,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b10,x:b2,y:b3,", #endif -#if SDL_JOYSTICK_EMSCRIPTEN +#ifdef SDL_JOYSTICK_EMSCRIPTEN "default,Standard Gamepad,a:b0,b:b1,back:b8,dpdown:b13,dpleft:b14,dpright:b15,dpup:b12,guide:b16,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,", #endif -#if SDL_JOYSTICK_PS2 +#ifdef SDL_JOYSTICK_PS2 "0000000050533220436f6e74726f6c00,PS2 Controller,crc:ed87,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,", #endif -#if SDL_JOYSTICK_PSP +#ifdef SDL_JOYSTICK_PSP "00000000505350206275696c74696e00,PSP builtin joypad,crc:bb86,a:b2,b:b1,back:b10,dpdown:b6,dpleft:b7,dpright:b9,dpup:b8,leftshoulder:b4,leftx:a0,lefty:a1,rightshoulder:b5,rightx:a2,righty:a3,start:b11,x:b3,y:b0,", #endif -#if SDL_JOYSTICK_VITA +#ifdef SDL_JOYSTICK_VITA "0000000050535669746120436f6e7400,PSVita Controller,crc:d598,a:b2,b:b1,back:b10,dpdown:b6,dpleft:b7,dpright:b9,dpup:b8,leftshoulder:b4,leftstick:b14,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b15,righttrigger:a5,rightx:a2,righty:a3,start:b11,x:b3,y:b0,", #endif -#if SDL_JOYSTICK_N3DS +#ifdef SDL_JOYSTICK_N3DS "000000004e696e74656e646f20334400,Nintendo 3DS,crc:3210,a:b0,b:b1,back:b2,dpdown:b7,dpleft:b5,dpright:b4,dpup:b6,leftshoulder:b9,lefttrigger:b14,leftx:a0,lefty:a1,rightshoulder:b8,righttrigger:b15,rightx:a2,righty:a3,start:b3,x:b10,y:b11,", #endif "hidapi,*,a:b0,b:b1,back:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b5,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,", diff --git a/thirdparty/SDL/src/joystick/SDL_joystick.c b/thirdparty/SDL/src/joystick/SDL_joystick.c index 834e83d99..dff447bd2 100644 --- a/thirdparty/SDL/src/joystick/SDL_joystick.c +++ b/thirdparty/SDL/src/joystick/SDL_joystick.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -28,8 +28,9 @@ #include "SDL_sysjoystick.h" #include "SDL_hints.h" #include "../SDL_hints_c.h" +#include "SDL_steam_virtual_gamepad.h" -#if !SDL_EVENTS_DISABLED +#ifndef SDL_EVENTS_DISABLED #include "../events/SDL_events_c.h" #endif #include "../video/SDL_sysvideo.h" @@ -46,7 +47,7 @@ #include #endif -#if SDL_JOYSTICK_VIRTUAL +#ifdef SDL_JOYSTICK_VIRTUAL #include "./virtual/SDL_virtualjoystick_c.h" #endif @@ -125,6 +126,300 @@ static SDL_JoystickID *SDL_joystick_players SDL_GUARDED_BY(SDL_joystick_lock) = static SDL_bool SDL_joystick_allows_background_events = SDL_FALSE; char SDL_joystick_magic; +static Uint32 initial_arcadestick_devices[] = { + MAKE_VIDPID(0x0079, 0x181a), /* Venom Arcade Stick */ + MAKE_VIDPID(0x0079, 0x181b), /* Venom Arcade Stick */ + MAKE_VIDPID(0x0c12, 0x0ef6), /* Hitbox Arcade Stick */ + MAKE_VIDPID(0x0e6f, 0x0109), /* PDP Versus Fighting Pad */ + MAKE_VIDPID(0x0f0d, 0x0016), /* Hori Real Arcade Pro.EX */ + MAKE_VIDPID(0x0f0d, 0x001b), /* Hori Real Arcade Pro VX */ + MAKE_VIDPID(0x0f0d, 0x0063), /* Hori Real Arcade Pro Hayabusa (USA) Xbox One */ + MAKE_VIDPID(0x0f0d, 0x006a), /* Real Arcade Pro 4 */ + MAKE_VIDPID(0x0f0d, 0x0078), /* Hori Real Arcade Pro V Kai Xbox One */ + MAKE_VIDPID(0x0f0d, 0x008a), /* HORI Real Arcade Pro 4 */ + MAKE_VIDPID(0x0f0d, 0x008c), /* Hori Real Arcade Pro 4 */ + MAKE_VIDPID(0x0f0d, 0x00aa), /* HORI Real Arcade Pro V Hayabusa in Switch Mode */ + MAKE_VIDPID(0x0f0d, 0x00ed), /* Hori Fighting Stick mini 4 kai */ + MAKE_VIDPID(0x0f0d, 0x011c), /* Hori Fighting Stick α in PS4 Mode */ + MAKE_VIDPID(0x0f0d, 0x011e), /* Hori Fighting Stick α in PC Mode */ + MAKE_VIDPID(0x0f0d, 0x0184), /* Hori Fighting Stick α in PS5 Mode */ + MAKE_VIDPID(0x146b, 0x0604), /* NACON Daija Arcade Stick */ + MAKE_VIDPID(0x1532, 0x0a00), /* Razer Atrox Arcade Stick */ + MAKE_VIDPID(0x1bad, 0xf03d), /* Street Fighter IV Arcade Stick TE - Chun Li */ + MAKE_VIDPID(0x1bad, 0xf502), /* Hori Real Arcade Pro.VX SA */ + MAKE_VIDPID(0x1bad, 0xf504), /* Hori Real Arcade Pro. EX */ + MAKE_VIDPID(0x1bad, 0xf506), /* Hori Real Arcade Pro.EX Premium VLX */ + MAKE_VIDPID(0x20d6, 0xa715), /* PowerA Nintendo Switch Fusion Arcade Stick */ + MAKE_VIDPID(0x24c6, 0x5000), /* Razer Atrox Arcade Stick */ + MAKE_VIDPID(0x24c6, 0x5501), /* Hori Real Arcade Pro VX-SA */ + MAKE_VIDPID(0x24c6, 0x550e), /* Hori Real Arcade Pro V Kai 360 */ + MAKE_VIDPID(0x2c22, 0x2300), /* Qanba Obsidian Arcade Joystick in PS4 Mode */ + MAKE_VIDPID(0x2c22, 0x2302), /* Qanba Obsidian Arcade Joystick in PS3 Mode */ + MAKE_VIDPID(0x2c22, 0x2303), /* Qanba Obsidian Arcade Joystick in PC Mode */ + MAKE_VIDPID(0x2c22, 0x2500), /* Qanba Dragon Arcade Joystick in PS4 Mode */ + MAKE_VIDPID(0x2c22, 0x2502), /* Qanba Dragon Arcade Joystick in PS3 Mode */ + MAKE_VIDPID(0x2c22, 0x2503), /* Qanba Dragon Arcade Joystick in PC Mode */ +}; +static SDL_vidpid_list arcadestick_devices = { + SDL_HINT_JOYSTICK_ARCADESTICK_DEVICES, 0, 0, NULL, + SDL_HINT_JOYSTICK_ARCADESTICK_DEVICES_EXCLUDED, 0, 0, NULL, + SDL_arraysize(initial_arcadestick_devices), initial_arcadestick_devices, + SDL_FALSE +}; + +/* This list is taken from: + https://raw.githubusercontent.com/denilsonsa/udev-joystick-blacklist/master/generate_rules.py + */ +static Uint32 initial_blacklist_devices[] = { + /* Microsoft Microsoft Wireless Optical Desktop 2.10 */ + /* Microsoft Wireless Desktop - Comfort Edition */ + MAKE_VIDPID(0x045e, 0x009d), + + /* Microsoft Microsoft Digital Media Pro Keyboard */ + /* Microsoft Corp. Digital Media Pro Keyboard */ + MAKE_VIDPID(0x045e, 0x00b0), + + /* Microsoft Microsoft Digital Media Keyboard */ + /* Microsoft Corp. Digital Media Keyboard 1.0A */ + MAKE_VIDPID(0x045e, 0x00b4), + + /* Microsoft Microsoft Digital Media Keyboard 3000 */ + MAKE_VIDPID(0x045e, 0x0730), + + /* Microsoft Microsoft 2.4GHz Transceiver v6.0 */ + /* Microsoft Microsoft 2.4GHz Transceiver v8.0 */ + /* Microsoft Corp. Nano Transceiver v1.0 for Bluetooth */ + /* Microsoft Wireless Mobile Mouse 1000 */ + /* Microsoft Wireless Desktop 3000 */ + MAKE_VIDPID(0x045e, 0x0745), + + /* Microsoft SideWinder(TM) 2.4GHz Transceiver */ + MAKE_VIDPID(0x045e, 0x0748), + + /* Microsoft Corp. Wired Keyboard 600 */ + MAKE_VIDPID(0x045e, 0x0750), + + /* Microsoft Corp. Sidewinder X4 keyboard */ + MAKE_VIDPID(0x045e, 0x0768), + + /* Microsoft Corp. Arc Touch Mouse Transceiver */ + MAKE_VIDPID(0x045e, 0x0773), + + /* Microsoft 2.4GHz Transceiver v9.0 */ + /* Microsoft Nano Transceiver v2.1 */ + /* Microsoft Sculpt Ergonomic Keyboard (5KV-00001) */ + MAKE_VIDPID(0x045e, 0x07a5), + + /* Microsoft Nano Transceiver v1.0 */ + /* Microsoft Wireless Keyboard 800 */ + MAKE_VIDPID(0x045e, 0x07b2), + + /* Microsoft Nano Transceiver v2.0 */ + MAKE_VIDPID(0x045e, 0x0800), + + MAKE_VIDPID(0x046d, 0xc30a), /* Logitech, Inc. iTouch Composite keboard */ + + MAKE_VIDPID(0x04d9, 0xa0df), /* Tek Syndicate Mouse (E-Signal USB Gaming Mouse) */ + + /* List of Wacom devices at: http://linuxwacom.sourceforge.net/wiki/index.php/Device_IDs */ + MAKE_VIDPID(0x056a, 0x0010), /* Wacom ET-0405 Graphire */ + MAKE_VIDPID(0x056a, 0x0011), /* Wacom ET-0405A Graphire2 (4x5) */ + MAKE_VIDPID(0x056a, 0x0012), /* Wacom ET-0507A Graphire2 (5x7) */ + MAKE_VIDPID(0x056a, 0x0013), /* Wacom CTE-430 Graphire3 (4x5) */ + MAKE_VIDPID(0x056a, 0x0014), /* Wacom CTE-630 Graphire3 (6x8) */ + MAKE_VIDPID(0x056a, 0x0015), /* Wacom CTE-440 Graphire4 (4x5) */ + MAKE_VIDPID(0x056a, 0x0016), /* Wacom CTE-640 Graphire4 (6x8) */ + MAKE_VIDPID(0x056a, 0x0017), /* Wacom CTE-450 Bamboo Fun (4x5) */ + MAKE_VIDPID(0x056a, 0x0018), /* Wacom CTE-650 Bamboo Fun 6x8 */ + MAKE_VIDPID(0x056a, 0x0019), /* Wacom CTE-631 Bamboo One */ + MAKE_VIDPID(0x056a, 0x00d1), /* Wacom Bamboo Pen and Touch CTH-460 */ + MAKE_VIDPID(0x056a, 0x030e), /* Wacom Intuos Pen (S) CTL-480 */ + + MAKE_VIDPID(0x09da, 0x054f), /* A4 Tech Co., G7 750 mouse */ + MAKE_VIDPID(0x09da, 0x1410), /* A4 Tech Co., Ltd Bloody AL9 mouse */ + MAKE_VIDPID(0x09da, 0x3043), /* A4 Tech Co., Ltd Bloody R8A Gaming Mouse */ + MAKE_VIDPID(0x09da, 0x31b5), /* A4 Tech Co., Ltd Bloody TL80 Terminator Laser Gaming Mouse */ + MAKE_VIDPID(0x09da, 0x3997), /* A4 Tech Co., Ltd Bloody RT7 Terminator Wireless */ + MAKE_VIDPID(0x09da, 0x3f8b), /* A4 Tech Co., Ltd Bloody V8 mouse */ + MAKE_VIDPID(0x09da, 0x51f4), /* Modecom MC-5006 Keyboard */ + MAKE_VIDPID(0x09da, 0x5589), /* A4 Tech Co., Ltd Terminator TL9 Laser Gaming Mouse */ + MAKE_VIDPID(0x09da, 0x7b22), /* A4 Tech Co., Ltd Bloody V5 */ + MAKE_VIDPID(0x09da, 0x7f2d), /* A4 Tech Co., Ltd Bloody R3 mouse */ + MAKE_VIDPID(0x09da, 0x8090), /* A4 Tech Co., Ltd X-718BK Oscar Optical Gaming Mouse */ + MAKE_VIDPID(0x09da, 0x9033), /* A4 Tech Co., X7 X-705K */ + MAKE_VIDPID(0x09da, 0x9066), /* A4 Tech Co., Sharkoon Fireglider Optical */ + MAKE_VIDPID(0x09da, 0x9090), /* A4 Tech Co., Ltd XL-730K / XL-750BK / XL-755BK Laser Mouse */ + MAKE_VIDPID(0x09da, 0x90c0), /* A4 Tech Co., Ltd X7 G800V keyboard */ + MAKE_VIDPID(0x09da, 0xf012), /* A4 Tech Co., Ltd Bloody V7 mouse */ + MAKE_VIDPID(0x09da, 0xf32a), /* A4 Tech Co., Ltd Bloody B540 keyboard */ + MAKE_VIDPID(0x09da, 0xf613), /* A4 Tech Co., Ltd Bloody V2 mouse */ + MAKE_VIDPID(0x09da, 0xf624), /* A4 Tech Co., Ltd Bloody B120 Keyboard */ + + MAKE_VIDPID(0x1b1c, 0x1b3c), /* Corsair Harpoon RGB gaming mouse */ + + MAKE_VIDPID(0x1d57, 0xad03), /* [T3] 2.4GHz and IR Air Mouse Remote Control */ + + MAKE_VIDPID(0x1e7d, 0x2e4a), /* Roccat Tyon Mouse */ + + MAKE_VIDPID(0x20a0, 0x422d), /* Winkeyless.kr Keyboards */ + + MAKE_VIDPID(0x2516, 0x001f), /* Cooler Master Storm Mizar Mouse */ + MAKE_VIDPID(0x2516, 0x0028), /* Cooler Master Storm Alcor Mouse */ + + /*****************************************************************/ + /* Additional entries */ + /*****************************************************************/ + + MAKE_VIDPID(0x04d9, 0x8008), /* OBINLB USB-HID Keyboard (Anne Pro II) */ + MAKE_VIDPID(0x04d9, 0x8009), /* OBINLB USB-HID Keyboard (Anne Pro II) */ + MAKE_VIDPID(0x04d9, 0xa292), /* OBINLB USB-HID Keyboard (Anne Pro II) */ + MAKE_VIDPID(0x04d9, 0xa293), /* OBINLB USB-HID Keyboard (Anne Pro II) */ + MAKE_VIDPID(0x1532, 0x0266), /* Razer Huntsman V2 Analog, non-functional DInput device */ + MAKE_VIDPID(0x1532, 0x0282), /* Razer Huntsman Mini Analog, non-functional DInput device */ + MAKE_VIDPID(0x26ce, 0x01a2), /* ASRock LED Controller */ + MAKE_VIDPID(0x20d6, 0x0002), /* PowerA Enhanced Wireless Controller for Nintendo Switch (charging port only) */ +}; +static SDL_vidpid_list blacklist_devices = { + SDL_HINT_JOYSTICK_BLACKLIST_DEVICES, 0, 0, NULL, + SDL_HINT_JOYSTICK_BLACKLIST_DEVICES_EXCLUDED, 0, 0, NULL, + SDL_arraysize(initial_blacklist_devices), initial_blacklist_devices, + SDL_FALSE +}; + +static Uint32 initial_flightstick_devices[] = { + MAKE_VIDPID(0x044f, 0x0402), /* HOTAS Warthog Joystick */ + MAKE_VIDPID(0x0738, 0x2221), /* Saitek Pro Flight X-56 Rhino Stick */ + MAKE_VIDPID(0x044f, 0xb10a), /* ThrustMaster, Inc. T.16000M Joystick */ + MAKE_VIDPID(0x046d, 0xc215), /* Logitech Extreme 3D */ + MAKE_VIDPID(0x231d, 0x0126), /* Gunfighter Mk.III ‘Space Combat Edition’ (right) */ + MAKE_VIDPID(0x231d, 0x0127), /* Gunfighter Mk.III ‘Space Combat Edition’ (left) */ + MAKE_VIDPID(0x362c, 0x0001), /* Yawman Arrow */ +}; +static SDL_vidpid_list flightstick_devices = { + SDL_HINT_JOYSTICK_FLIGHTSTICK_DEVICES, 0, 0, NULL, + SDL_HINT_JOYSTICK_FLIGHTSTICK_DEVICES_EXCLUDED, 0, 0, NULL, + SDL_arraysize(initial_flightstick_devices), initial_flightstick_devices, + SDL_FALSE +}; + +static Uint32 initial_gamecube_devices[] = { + MAKE_VIDPID(0x0e6f, 0x0185), /* PDP Wired Fight Pad Pro for Nintendo Switch */ + MAKE_VIDPID(0x20d6, 0xa711), /* PowerA Wired Controller Nintendo GameCube Style */ +}; +static SDL_vidpid_list gamecube_devices = { + SDL_HINT_JOYSTICK_GAMECUBE_DEVICES, 0, 0, NULL, + SDL_HINT_JOYSTICK_GAMECUBE_DEVICES_EXCLUDED, 0, 0, NULL, + SDL_arraysize(initial_gamecube_devices), initial_gamecube_devices, + SDL_FALSE +}; + +static Uint32 initial_rog_gamepad_mice[] = { + MAKE_VIDPID(0x0b05, 0x1906), /* ROG Pugio II */ + MAKE_VIDPID(0x0b05, 0x1958), /* ROG Chakram Core Mouse */ + MAKE_VIDPID(0x0b05, 0x18e3), /* ROG Chakram (wired) Mouse */ + MAKE_VIDPID(0x0b05, 0x18e5), /* ROG Chakram (wireless) Mouse */ + MAKE_VIDPID(0x0b05, 0x1a18), /* ROG Chakram X (wired) Mouse */ + MAKE_VIDPID(0x0b05, 0x1a1a), /* ROG Chakram X (wireless) Mouse */ + MAKE_VIDPID(0x0b05, 0x1a1c), /* ROG Chakram X (Bluetooth) Mouse */ +}; +static SDL_vidpid_list rog_gamepad_mice = { + SDL_HINT_ROG_GAMEPAD_MICE, 0, 0, NULL, + SDL_HINT_ROG_GAMEPAD_MICE_EXCLUDED, 0, 0, NULL, + SDL_arraysize(initial_rog_gamepad_mice), initial_rog_gamepad_mice, + SDL_FALSE +}; + +static Uint32 initial_throttle_devices[] = { + MAKE_VIDPID(0x044f, 0x0404), /* HOTAS Warthog Throttle */ + MAKE_VIDPID(0x0738, 0xa221), /* Saitek Pro Flight X-56 Rhino Throttle */ +}; +static SDL_vidpid_list throttle_devices = { + SDL_HINT_JOYSTICK_THROTTLE_DEVICES, 0, 0, NULL, + SDL_HINT_JOYSTICK_THROTTLE_DEVICES_EXCLUDED, 0, 0, NULL, + SDL_arraysize(initial_throttle_devices), initial_throttle_devices, + SDL_FALSE +}; + +static Uint32 initial_wheel_devices[] = { + MAKE_VIDPID(0x0079, 0x1864), /* DragonRise Inc. Wired Wheel (active mode) (also known as PXN V900 (PS3), Superdrive SV-750, or a Genesis Seaborg 400) */ + MAKE_VIDPID(0x046d, 0xc294), /* Logitech generic wheel */ + MAKE_VIDPID(0x046d, 0xc295), /* Logitech Momo Force */ + MAKE_VIDPID(0x046d, 0xc298), /* Logitech Driving Force Pro */ + MAKE_VIDPID(0x046d, 0xc299), /* Logitech G25 */ + MAKE_VIDPID(0x046d, 0xc29a), /* Logitech Driving Force GT */ + MAKE_VIDPID(0x046d, 0xc29b), /* Logitech G27 */ + MAKE_VIDPID(0x046d, 0xc24f), /* Logitech G29 (PS3) */ + MAKE_VIDPID(0x046d, 0xc260), /* Logitech G29 (PS4) */ + MAKE_VIDPID(0x046d, 0xc261), /* Logitech G920 (initial mode) */ + MAKE_VIDPID(0x046d, 0xc262), /* Logitech G920 (active mode) */ + MAKE_VIDPID(0x046d, 0xc268), /* Logitech PRO Racing Wheel (PC mode) */ + MAKE_VIDPID(0x046d, 0xc269), /* Logitech PRO Racing Wheel (PS4/PS5 mode) */ + MAKE_VIDPID(0x046d, 0xc272), /* Logitech PRO Racing Wheel for Xbox (PC mode) */ + MAKE_VIDPID(0x046d, 0xc26d), /* Logitech G923 (Xbox) */ + MAKE_VIDPID(0x046d, 0xc26e), /* Logitech G923 */ + MAKE_VIDPID(0x046d, 0xc266), /* Logitech G923 for Playstation 4 and PC (PC mode) */ + MAKE_VIDPID(0x046d, 0xc267), /* Logitech G923 for Playstation 4 and PC (PS4 mode)*/ + MAKE_VIDPID(0x046d, 0xca03), /* Logitech Momo Racing */ + MAKE_VIDPID(0x044f, 0xb65d), /* Thrustmaster Wheel FFB */ + MAKE_VIDPID(0x044f, 0xb66d), /* Thrustmaster Wheel FFB */ + MAKE_VIDPID(0x044f, 0xb677), /* Thrustmaster T150 */ + MAKE_VIDPID(0x044f, 0xb696), /* Thrustmaster T248 */ + MAKE_VIDPID(0x044f, 0xb66e), /* Thrustmaster T300RS (normal mode) */ + MAKE_VIDPID(0x044f, 0xb66f), /* Thrustmaster T300RS (advanced mode) */ + MAKE_VIDPID(0x044f, 0xb66d), /* Thrustmaster T300RS (PS4 mode) */ + MAKE_VIDPID(0x044f, 0xb65e), /* Thrustmaster T500RS */ + MAKE_VIDPID(0x044f, 0xb664), /* Thrustmaster TX (initial mode) */ + MAKE_VIDPID(0x044f, 0xb669), /* Thrustmaster TX (active mode) */ + MAKE_VIDPID(0x044f, 0xb691), /* Thrustmaster TS-XW (initial mode) */ + MAKE_VIDPID(0x044f, 0xb692), /* Thrustmaster TS-XW (active mode) */ + MAKE_VIDPID(0x0483, 0x0522), /* Simagic Wheelbase (including M10, Alpha Mini, Alpha, Alpha U) */ + MAKE_VIDPID(0x0483, 0xa355), /* VRS DirectForce Pro Wheel Base */ + MAKE_VIDPID(0x0eb7, 0x0001), /* Fanatec ClubSport Wheel Base V2 */ + MAKE_VIDPID(0x0eb7, 0x0004), /* Fanatec ClubSport Wheel Base V2.5 */ + MAKE_VIDPID(0x0eb7, 0x0005), /* Fanatec CSL Elite Wheel Base+ (PS4) */ + MAKE_VIDPID(0x0eb7, 0x0006), /* Fanatec Podium Wheel Base DD1 */ + MAKE_VIDPID(0x0eb7, 0x0007), /* Fanatec Podium Wheel Base DD2 */ + MAKE_VIDPID(0x0eb7, 0x0011), /* Fanatec Forza Motorsport (CSR Wheel / CSR Elite Wheel) */ + MAKE_VIDPID(0x0eb7, 0x0020), /* Fanatec generic wheel / CSL DD / GT DD Pro */ + MAKE_VIDPID(0x0eb7, 0x0197), /* Fanatec Porsche Wheel (Turbo / GT3 RS / Turbo S / GT3 V2 / GT2) */ + MAKE_VIDPID(0x0eb7, 0x038e), /* Fanatec ClubSport Wheel Base V1 */ + MAKE_VIDPID(0x0eb7, 0x0e03), /* Fanatec CSL Elite Wheel Base */ + MAKE_VIDPID(0x11ff, 0x0511), /* DragonRise Inc. Wired Wheel (initial mode) (also known as PXN V900 (PS3), Superdrive SV-750, or a Genesis Seaborg 400) */ + MAKE_VIDPID(0x1209, 0xffb0), /* Generic FFBoard OpenFFBoard universal forcefeedback wheel */ + MAKE_VIDPID(0x16d0, 0x0d5a), /* Simucube 1 Wheelbase */ + MAKE_VIDPID(0x16d0, 0x0d5f), /* Simucube 2 Ultimate Wheelbase */ + MAKE_VIDPID(0x16d0, 0x0d60), /* Simucube 2 Pro Wheelbase */ + MAKE_VIDPID(0x16d0, 0x0d61), /* Simucube 2 Sport Wheelbase */ + MAKE_VIDPID(0x2433, 0xf300), /* Asetek SimSports Invicta Wheelbase */ + MAKE_VIDPID(0x2433, 0xf301), /* Asetek SimSports Forte Wheelbase */ + MAKE_VIDPID(0x2433, 0xf303), /* Asetek SimSports La Prima Wheelbase */ + MAKE_VIDPID(0x2433, 0xf306), /* Asetek SimSports Tony Kannan Wheelbase */ + MAKE_VIDPID(0x3416, 0x0301), /* Cammus C5 Wheelbase */ + MAKE_VIDPID(0x3416, 0x0302), /* Cammus C12 Wheelbase */ + MAKE_VIDPID(0x346e, 0x0000), /* Moza R16/R21 Wheelbase */ + MAKE_VIDPID(0x346e, 0x0002), /* Moza R9 Wheelbase */ + MAKE_VIDPID(0x346e, 0x0004), /* Moza R5 Wheelbase */ + MAKE_VIDPID(0x346e, 0x0005), /* Moza R3 Wheelbase */ + MAKE_VIDPID(0x346e, 0x0006), /* Moza R12 Wheelbase */ +}; +static SDL_vidpid_list wheel_devices = { + SDL_HINT_JOYSTICK_WHEEL_DEVICES, 0, 0, NULL, + SDL_HINT_JOYSTICK_WHEEL_DEVICES_EXCLUDED, 0, 0, NULL, + SDL_arraysize(initial_wheel_devices), initial_wheel_devices, + SDL_FALSE +}; + +static Uint32 initial_zero_centered_devices[] = { + MAKE_VIDPID(0x0e8f, 0x3013), /* HuiJia SNES USB adapter */ + MAKE_VIDPID(0x05a0, 0x3232), /* 8Bitdo Zero Gamepad */ +}; +static SDL_vidpid_list zero_centered_devices = { + SDL_HINT_JOYSTICK_ZERO_CENTERED_DEVICES, 0, 0, NULL, + NULL, 0, 0, NULL, + SDL_arraysize(initial_zero_centered_devices), initial_zero_centered_devices, + SDL_FALSE +}; + #define CHECK_JOYSTICK_MAGIC(joystick, retval) \ if (!joystick || joystick->magic != &SDL_joystick_magic) { \ SDL_InvalidParamError("joystick"); \ @@ -213,7 +508,7 @@ static SDL_bool SDL_GetDriverAndJoystickIndex(int device_index, SDL_JoystickDriv return SDL_FALSE; } -static int SDL_FindFreePlayerIndex() +static int SDL_FindFreePlayerIndex(void) { int player_index; @@ -265,7 +560,7 @@ static SDL_bool SDL_SetJoystickIDForPlayerIndex(int player_index, SDL_JoystickID if (player_index >= SDL_joystick_player_count) { SDL_JoystickID *new_players = (SDL_JoystickID *)SDL_realloc(SDL_joystick_players, (player_index + 1) * sizeof(*SDL_joystick_players)); - if (new_players == NULL) { + if (!new_players) { SDL_OutOfMemory(); return SDL_FALSE; } @@ -319,7 +614,7 @@ int SDL_JoystickInit(void) SDL_joystick_lock = SDL_CreateMutex(); } -#if !SDL_EVENTS_DISABLED +#ifndef SDL_EVENTS_DISABLED if (SDL_InitSubSystem(SDL_INIT_EVENTS) < 0) { return -1; } @@ -331,10 +626,21 @@ int SDL_JoystickInit(void) SDL_GameControllerInitMappings(); + SDL_LoadVIDPIDList(&arcadestick_devices); + SDL_LoadVIDPIDList(&blacklist_devices); + SDL_LoadVIDPIDList(&flightstick_devices); + SDL_LoadVIDPIDList(&gamecube_devices); + SDL_LoadVIDPIDList(&rog_gamepad_mice); + SDL_LoadVIDPIDList(&throttle_devices); + SDL_LoadVIDPIDList(&wheel_devices); + SDL_LoadVIDPIDList(&zero_centered_devices); + /* See if we should allow joystick events while in the background */ SDL_AddHintCallback(SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS, SDL_JoystickAllowBackgroundEventsChanged, NULL); + SDL_InitSteamVirtualGamepadInfo(); + status = -1; for (i = 0; i < SDL_arraysize(SDL_joystick_drivers); ++i) { if (SDL_joystick_drivers[i]->Init() >= 0) { @@ -368,11 +674,24 @@ int SDL_NumJoysticks(void) * Return the next available joystick instance ID * This may be called by drivers from multiple threads, unprotected by any locks */ -SDL_JoystickID SDL_GetNextJoystickInstanceID() +SDL_JoystickID SDL_GetNextJoystickInstanceID(void) { return SDL_AtomicIncRef(&SDL_next_joystick_instance_id); } +const SDL_SteamVirtualGamepadInfo *SDL_GetJoystickInstanceVirtualGamepadInfo(SDL_JoystickID instance_id) +{ + SDL_JoystickDriver *driver; + int device_index; + const SDL_SteamVirtualGamepadInfo *info = NULL; + + if (SDL_SteamVirtualGamepadEnabled() && + SDL_GetDriverAndJoystickIndex(SDL_JoystickGetDeviceIndexFromInstanceID(instance_id), &driver, &device_index)) { + info = SDL_GetSteamVirtualGamepadInfo(driver->GetDeviceSteamVirtualGamepadSlot(device_index)); + } + return info; +} + /* * Get the implementation dependent name of a joystick */ @@ -380,9 +699,13 @@ const char *SDL_JoystickNameForIndex(int device_index) { SDL_JoystickDriver *driver; const char *name = NULL; + const SDL_SteamVirtualGamepadInfo *info; SDL_LockJoysticks(); - if (SDL_GetDriverAndJoystickIndex(device_index, &driver, &device_index)) { + info = SDL_GetJoystickInstanceVirtualGamepadInfo(SDL_JoystickGetDeviceInstanceID(device_index)); + if (info) { + name = info->name; + } else if (SDL_GetDriverAndJoystickIndex(device_index, &driver, &device_index)) { name = driver->GetDeviceName(device_index); } SDL_UnlockJoysticks(); @@ -406,7 +729,7 @@ const char *SDL_JoystickPathForIndex(int device_index) SDL_UnlockJoysticks(); /* FIXME: Really we should reference count this path so it doesn't go away after unlock */ - if (path == NULL) { + if (!path) { SDL_Unsupported(); } return path; @@ -436,35 +759,14 @@ static SDL_bool SDL_JoystickAxesCenteredAtZero(SDL_Joystick *joystick) #ifdef __WINRT__ return SDL_TRUE; #else - static Uint32 zero_centered_joysticks[] = { - MAKE_VIDPID(0x0e8f, 0x3013), /* HuiJia SNES USB adapter */ - MAKE_VIDPID(0x05a0, 0x3232), /* 8Bitdo Zero Gamepad */ - }; - - SDL_bool retval = SDL_FALSE; - int i; - Uint32 id = MAKE_VIDPID(SDL_JoystickGetVendor(joystick), - SDL_JoystickGetProduct(joystick)); - /*printf("JOYSTICK '%s' VID/PID 0x%.4x/0x%.4x AXES: %d\n", joystick->name, vendor, product, joystick->naxes);*/ - SDL_LockJoysticks(); - { - if (joystick->naxes == 2) { - /* Assume D-pad or thumbstick style axes are centered at 0 */ - retval = SDL_TRUE; - } - - for (i = 0; i < SDL_arraysize(zero_centered_joysticks); ++i) { - if (id == zero_centered_joysticks[i]) { - retval = SDL_TRUE; - break; - } - } + if (joystick->naxes == 2) { + /* Assume D-pad or thumbstick style axes are centered at 0 */ + return SDL_TRUE; } - SDL_UnlockJoysticks(); - return retval; + return SDL_VIDPIDInList(SDL_JoystickGetVendor(joystick), SDL_JoystickGetProduct(joystick), &zero_centered_devices); #endif /* __WINRT__ */ } @@ -484,6 +786,7 @@ SDL_Joystick *SDL_JoystickOpen(int device_index) const char *joystickname = NULL; const char *joystickpath = NULL; SDL_JoystickPowerLevel initial_power_level; + const SDL_SteamVirtualGamepadInfo *info; SDL_LockJoysticks(); @@ -509,7 +812,7 @@ SDL_Joystick *SDL_JoystickOpen(int device_index) /* Create and initialize the joystick */ joystick = (SDL_Joystick *)SDL_calloc(sizeof(*joystick), 1); - if (joystick == NULL) { + if (!joystick) { SDL_OutOfMemory(); SDL_UnlockJoysticks(); return NULL; @@ -573,6 +876,12 @@ SDL_Joystick *SDL_JoystickOpen(int device_index) joystick->is_game_controller = SDL_IsGameController(device_index); + /* Get the Steam Input API handle */ + info = SDL_GetJoystickInstanceVirtualGamepadInfo(instance_id); + if (info) { + joystick->steam_handle = info->handle; + } + /* Add joystick to list */ ++joystick->ref_count; /* Link the joystick in the list */ @@ -606,7 +915,7 @@ int SDL_JoystickAttachVirtual(SDL_JoystickType type, int naxes, int nbuttons, in int SDL_JoystickAttachVirtualEx(const SDL_VirtualJoystickDesc *desc) { -#if SDL_JOYSTICK_VIRTUAL +#ifdef SDL_JOYSTICK_VIRTUAL int retval; SDL_LockJoysticks(); @@ -620,7 +929,7 @@ int SDL_JoystickAttachVirtualEx(const SDL_VirtualJoystickDesc *desc) int SDL_JoystickDetachVirtual(int device_index) { -#if SDL_JOYSTICK_VIRTUAL +#ifdef SDL_JOYSTICK_VIRTUAL SDL_JoystickDriver *driver; SDL_LockJoysticks(); @@ -641,7 +950,7 @@ int SDL_JoystickDetachVirtual(int device_index) SDL_bool SDL_JoystickIsVirtual(int device_index) { -#if SDL_JOYSTICK_VIRTUAL +#ifdef SDL_JOYSTICK_VIRTUAL SDL_JoystickDriver *driver; int driver_device_index; SDL_bool is_virtual = SDL_FALSE; @@ -668,7 +977,7 @@ int SDL_JoystickSetVirtualAxis(SDL_Joystick *joystick, int axis, Sint16 value) { CHECK_JOYSTICK_MAGIC(joystick, -1); -#if SDL_JOYSTICK_VIRTUAL +#ifdef SDL_JOYSTICK_VIRTUAL retval = SDL_JoystickSetVirtualAxisInner(joystick, axis, value); #else retval = SDL_SetError("SDL not built with virtual-joystick support"); @@ -687,7 +996,7 @@ int SDL_JoystickSetVirtualButton(SDL_Joystick *joystick, int button, Uint8 value { CHECK_JOYSTICK_MAGIC(joystick, -1); -#if SDL_JOYSTICK_VIRTUAL +#ifdef SDL_JOYSTICK_VIRTUAL retval = SDL_JoystickSetVirtualButtonInner(joystick, button, value); #else retval = SDL_SetError("SDL not built with virtual-joystick support"); @@ -706,7 +1015,7 @@ int SDL_JoystickSetVirtualHat(SDL_Joystick *joystick, int hat, Uint8 value) { CHECK_JOYSTICK_MAGIC(joystick, -1); -#if SDL_JOYSTICK_VIRTUAL +#ifdef SDL_JOYSTICK_VIRTUAL retval = SDL_JoystickSetVirtualHatInner(joystick, hat, value); #else retval = SDL_SetError("SDL not built with virtual-joystick support"); @@ -1016,15 +1325,22 @@ SDL_Joystick *SDL_JoystickFromPlayerIndex(int player_index) const char *SDL_JoystickName(SDL_Joystick *joystick) { const char *retval; + const SDL_SteamVirtualGamepadInfo *info; SDL_LockJoysticks(); { CHECK_JOYSTICK_MAGIC(joystick, NULL); - retval = joystick->name; + info = SDL_GetJoystickInstanceVirtualGamepadInfo(joystick->instance_id); + if (info) { + retval = info->name; + } else { + retval = joystick->name; + } } SDL_UnlockJoysticks(); + /* FIXME: Really we should reference count this name so it doesn't go away after unlock */ return retval; } @@ -1097,9 +1413,13 @@ int SDL_JoystickRumble(SDL_Joystick *joystick, Uint16 low_frequency_rumble, Uint retval = 0; } else { retval = joystick->driver->Rumble(joystick, low_frequency_rumble, high_frequency_rumble); - joystick->rumble_resend = SDL_GetTicks() + SDL_RUMBLE_RESEND_MS; - if (!joystick->rumble_resend) { - joystick->rumble_resend = 1; + if (retval == 0) { + joystick->rumble_resend = SDL_GetTicks() + SDL_RUMBLE_RESEND_MS; + if (joystick->rumble_resend == 0) { + joystick->rumble_resend = 1; + } + } else { + joystick->rumble_resend = 0; } } @@ -1339,13 +1659,24 @@ void SDL_JoystickQuit(void) SDL_joystick_player_count = 0; } -#if !SDL_EVENTS_DISABLED +#ifndef SDL_EVENTS_DISABLED SDL_QuitSubSystem(SDL_INIT_EVENTS); #endif + SDL_QuitSteamVirtualGamepadInfo(); + SDL_DelHintCallback(SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS, SDL_JoystickAllowBackgroundEventsChanged, NULL); + SDL_FreeVIDPIDList(&arcadestick_devices); + SDL_FreeVIDPIDList(&blacklist_devices); + SDL_FreeVIDPIDList(&flightstick_devices); + SDL_FreeVIDPIDList(&gamecube_devices); + SDL_FreeVIDPIDList(&rog_gamepad_mice); + SDL_FreeVIDPIDList(&throttle_devices); + SDL_FreeVIDPIDList(&wheel_devices); + SDL_FreeVIDPIDList(&zero_centered_devices); + SDL_GameControllerQuitMappings(); SDL_joysticks_quitting = SDL_FALSE; @@ -1354,7 +1685,7 @@ void SDL_JoystickQuit(void) SDL_UnlockJoysticks(); } -static SDL_bool SDL_PrivateJoystickShouldIgnoreEvent() +static SDL_bool SDL_PrivateJoystickShouldIgnoreEvent(void) { if (SDL_joystick_allows_background_events) { return SDL_FALSE; @@ -1434,7 +1765,10 @@ void SDL_PrivateJoystickAdded(SDL_JoystickID device_instance) } if (SDL_GetDriverAndJoystickIndex(device_index, &driver, &driver_device_index)) { - player_index = driver->GetDevicePlayerIndex(driver_device_index); + player_index = driver->GetDeviceSteamVirtualGamepadSlot(driver_device_index); + if (player_index < 0) { + player_index = driver->GetDevicePlayerIndex(driver_device_index); + } } if (player_index < 0 && SDL_IsGameController(device_index)) { player_index = SDL_FindFreePlayerIndex(); @@ -1443,7 +1777,7 @@ void SDL_PrivateJoystickAdded(SDL_JoystickID device_instance) SDL_SetJoystickIDForPlayerIndex(player_index, device_instance); } -#if !SDL_EVENTS_DISABLED +#ifndef SDL_EVENTS_DISABLED { SDL_Event event; @@ -1457,6 +1791,7 @@ void SDL_PrivateJoystickAdded(SDL_JoystickID device_instance) #endif /* !SDL_EVENTS_DISABLED */ } +#ifndef SDL_EVENTS_DISABLED /* * If there is an existing add event in the queue, it needs to be modified * to have the right value for which, because the number of controllers in @@ -1474,7 +1809,7 @@ static void UpdateEventsForDeviceRemoval(int device_index, Uint32 type) } events = SDL_small_alloc(SDL_Event, num_events, &isstack); - if (events == NULL) { + if (!events) { return; } @@ -1516,6 +1851,7 @@ static void UpdateEventsForDeviceRemoval(int device_index, Uint32 type) SDL_small_free(events, isstack); } +#endif void SDL_PrivateJoystickForceRecentering(SDL_Joystick *joystick) { @@ -1552,7 +1888,7 @@ void SDL_PrivateJoystickRemoved(SDL_JoystickID device_instance) SDL_Joystick *joystick = NULL; int player_index; int device_index; -#if !SDL_EVENTS_DISABLED +#ifndef SDL_EVENTS_DISABLED SDL_Event event; #endif @@ -1570,7 +1906,7 @@ void SDL_PrivateJoystickRemoved(SDL_JoystickID device_instance) ++device_index; } -#if !SDL_EVENTS_DISABLED +#ifndef SDL_EVENTS_DISABLED SDL_zero(event); event.type = SDL_JOYDEVICEREMOVED; @@ -1642,7 +1978,7 @@ int SDL_PrivateJoystickAxis(SDL_Joystick *joystick, Uint8 axis, Sint16 value) /* Post the event, if desired */ posted = 0; -#if !SDL_EVENTS_DISABLED +#ifndef SDL_EVENTS_DISABLED if (SDL_GetEventState(SDL_JOYAXISMOTION) == SDL_ENABLE) { SDL_Event event; event.type = SDL_JOYAXISMOTION; @@ -1683,7 +2019,7 @@ int SDL_PrivateJoystickHat(SDL_Joystick *joystick, Uint8 hat, Uint8 value) /* Post the event, if desired */ posted = 0; -#if !SDL_EVENTS_DISABLED +#ifndef SDL_EVENTS_DISABLED if (SDL_GetEventState(SDL_JOYHATMOTION) == SDL_ENABLE) { SDL_Event event; event.jhat.type = SDL_JOYHATMOTION; @@ -1718,7 +2054,7 @@ int SDL_PrivateJoystickBall(SDL_Joystick *joystick, Uint8 ball, Sint16 xrel, Sin /* Post the event, if desired */ posted = 0; -#if !SDL_EVENTS_DISABLED +#ifndef SDL_EVENTS_DISABLED if (SDL_GetEventState(SDL_JOYBALLMOTION) == SDL_ENABLE) { SDL_Event event; event.jball.type = SDL_JOYBALLMOTION; @@ -1735,7 +2071,7 @@ int SDL_PrivateJoystickBall(SDL_Joystick *joystick, Uint8 ball, Sint16 xrel, Sin int SDL_PrivateJoystickButton(SDL_Joystick *joystick, Uint8 button, Uint8 state) { int posted; -#if !SDL_EVENTS_DISABLED +#ifndef SDL_EVENTS_DISABLED SDL_Event event; SDL_AssertJoysticksLocked(); @@ -1776,7 +2112,7 @@ int SDL_PrivateJoystickButton(SDL_Joystick *joystick, Uint8 button, Uint8 state) /* Post the event, if desired */ posted = 0; -#if !SDL_EVENTS_DISABLED +#ifndef SDL_EVENTS_DISABLED if (SDL_GetEventState(event.type) == SDL_ENABLE) { event.jbutton.which = joystick->instance_id; event.jbutton.button = button; @@ -1787,6 +2123,43 @@ int SDL_PrivateJoystickButton(SDL_Joystick *joystick, Uint8 button, Uint8 state) return posted; } +static void SendSteamHandleUpdateEvents(void) +{ + SDL_Joystick *joystick; + const SDL_SteamVirtualGamepadInfo *info; + + /* Check to see if any Steam handles changed */ + for (joystick = SDL_joysticks; joystick; joystick = joystick->next) { + SDL_bool changed = SDL_FALSE; + + if (!joystick->is_game_controller) { + continue; + } + + info = SDL_GetJoystickInstanceVirtualGamepadInfo(joystick->instance_id); + if (info) { + if (joystick->steam_handle != info->handle) { + joystick->steam_handle = info->handle; + changed = SDL_TRUE; + } + } else { + if (joystick->steam_handle != 0) { + joystick->steam_handle = 0; + changed = SDL_TRUE; + } + } + if (changed) { + SDL_Event event; + + SDL_zero(event); + event.type = SDL_CONTROLLERSTEAMHANDLEUPDATED; + event.common.timestamp = 0; + event.cdevice.which = joystick->instance_id; + SDL_PushEvent(&event); + } + } +} + void SDL_JoystickUpdate(void) { int i; @@ -1799,18 +2172,24 @@ void SDL_JoystickUpdate(void) SDL_LockJoysticks(); + if (SDL_UpdateSteamVirtualGamepadInfo()) { + SendSteamHandleUpdateEvents(); + } + #ifdef SDL_JOYSTICK_HIDAPI /* Special function for HIDAPI devices, as a single device can provide multiple SDL_Joysticks */ HIDAPI_UpdateDevices(); #endif /* SDL_JOYSTICK_HIDAPI */ for (joystick = SDL_joysticks; joystick; joystick = joystick->next) { - if (joystick->attached) { - joystick->driver->Update(joystick); + if (!joystick->attached) { + continue; + } - if (joystick->delayed_guide_button) { - SDL_GameControllerHandleDelayedGuideButton(joystick); - } + joystick->driver->Update(joystick); + + if (joystick->delayed_guide_button) { + SDL_GameControllerHandleDelayedGuideButton(joystick); } now = SDL_GetTicks(); @@ -1847,8 +2226,8 @@ void SDL_JoystickUpdate(void) int SDL_JoystickEventState(int state) { -#if SDL_EVENTS_DISABLED - return SDL_DISABLE; +#ifdef SDL_EVENTS_DISABLED + return SDL_IGNORE; #else const Uint32 event_list[] = { SDL_JOYAXISMOTION, SDL_JOYBALLMOTION, SDL_JOYHATMOTION, @@ -1962,11 +2341,13 @@ char *SDL_CreateJoystickName(Uint16 vendor, Uint16 product, const char *vendor_n } replacements[] = { { "ASTRO Gaming", "ASTRO" }, { "Bensussen Deutsch & Associates,Inc.(BDA)", "BDA" }, - { "NVIDIA Corporation ", "" }, - { "Performance Designed Products", "PDP" }, - { "HORI CO.,LTD.", "HORI" }, + { "Guangzhou Chicken Run Network Technology Co., Ltd.", "GameSir" }, { "HORI CO.,LTD", "HORI" }, + { "HORI CO.,LTD.", "HORI" }, { "Mad Catz Inc.", "Mad Catz" }, + { "Nintendo Co., Ltd.", "Nintendo" }, + { "NVIDIA Corporation ", "" }, + { "Performance Designed Products", "PDP" }, { "QANBA USA, LLC", "Qanba" }, { "QANBA USA,LLC", "Qanba" }, { "Unknown ", "" }, @@ -1980,10 +2361,10 @@ char *SDL_CreateJoystickName(Uint16 vendor, Uint16 product, const char *vendor_n return SDL_strdup(custom_name); } - if (vendor_name == NULL) { + if (!vendor_name) { vendor_name = ""; } - if (product_name == NULL) { + if (!product_name) { product_name = ""; } @@ -2026,7 +2407,7 @@ char *SDL_CreateJoystickName(Uint16 vendor, Uint16 product, const char *vendor_n default: len = (6 + 1 + 6 + 1); name = (char *)SDL_malloc(len); - if (name != NULL) { + if (name) { (void)SDL_snprintf(name, len, "0x%.4x/0x%.4x", vendor, product); } break; @@ -2035,7 +2416,7 @@ char *SDL_CreateJoystickName(Uint16 vendor, Uint16 product, const char *vendor_n name = SDL_strdup("Controller"); } - if (name == NULL) { + if (!name) { return NULL; } @@ -2077,7 +2458,7 @@ char *SDL_CreateJoystickName(Uint16 vendor, Uint16 product, const char *vendor_n for (i = 1; i < (len - 1); ++i) { int matchlen = PrefixMatch(name, &name[i]); while (matchlen > 0) { - if (name[matchlen] == ' ') { + if (name[matchlen] == ' ' || name[matchlen] == '-') { SDL_memmove(name, name + matchlen + 1, len - matchlen); break; } @@ -2092,21 +2473,26 @@ char *SDL_CreateJoystickName(Uint16 vendor, Uint16 product, const char *vendor_n return name; } -SDL_JoystickGUID SDL_CreateJoystickGUID(Uint16 bus, Uint16 vendor, Uint16 product, Uint16 version, const char *name, Uint8 driver_signature, Uint8 driver_data) +SDL_JoystickGUID SDL_CreateJoystickGUID(Uint16 bus, Uint16 vendor, Uint16 product, Uint16 version, const char *vendor_name, const char *product_name, Uint8 driver_signature, Uint8 driver_data) { SDL_JoystickGUID guid; Uint16 *guid16 = (Uint16 *)guid.data; + Uint16 crc = 0; SDL_zero(guid); - if (name == NULL) { - name = ""; + if (vendor_name && *vendor_name && product_name && *product_name) { + crc = SDL_crc16(crc, vendor_name, SDL_strlen(vendor_name)); + crc = SDL_crc16(crc, " ", 1); + crc = SDL_crc16(crc, product_name, SDL_strlen(product_name)); + } else if (product_name) { + crc = SDL_crc16(crc, product_name, SDL_strlen(product_name)); } /* We only need 16 bits for each of these; space them out to fill 128. */ /* Byteswap so devices get same GUID on little/big endian platforms. */ *guid16++ = SDL_SwapLE16(bus); - *guid16++ = SDL_SwapLE16(SDL_crc16(0, name, SDL_strlen(name))); + *guid16++ = SDL_SwapLE16(crc); if (vendor && product) { *guid16++ = SDL_SwapLE16(vendor); @@ -2124,14 +2510,14 @@ SDL_JoystickGUID SDL_CreateJoystickGUID(Uint16 bus, Uint16 vendor, Uint16 produc guid.data[14] = driver_signature; guid.data[15] = driver_data; } - SDL_strlcpy((char *)guid16, name, available_space); + SDL_strlcpy((char *)guid16, product_name, available_space); } return guid; } SDL_JoystickGUID SDL_CreateJoystickGUIDForName(const char *name) { - return SDL_CreateJoystickGUID(SDL_HARDWARE_BUS_UNKNOWN, 0, 0, 0, name, 0, 0); + return SDL_CreateJoystickGUID(SDL_HARDWARE_BUS_UNKNOWN, 0, 0, 0, NULL, name, 0, 0); } void SDL_SetJoystickGUIDVendor(SDL_JoystickGUID *guid, Uint16 vendor) @@ -2179,9 +2565,6 @@ SDL_GameControllerType SDL_GetJoystickGameControllerTypeFromVIDPID(Uint16 vendor } else if (vendor == 0x0001 && product == 0x0001) { type = SDL_CONTROLLER_TYPE_UNKNOWN; - } else if (vendor == USB_VENDOR_MICROSOFT && product == USB_PRODUCT_XBOX_ONE_XINPUT_CONTROLLER) { - type = SDL_CONTROLLER_TYPE_XBOXONE; - } else if ((vendor == USB_VENDOR_AMAZON && product == USB_PRODUCT_AMAZON_LUNA_CONTROLLER) || (vendor == BLUETOOTH_VENDOR_AMAZON && product == BLUETOOTH_PRODUCT_LUNA_CONTROLLER)) { type = SDL_CONTROLLER_TYPE_AMAZON_LUNA; @@ -2281,6 +2664,22 @@ SDL_GameControllerType SDL_GetJoystickGameControllerTypeFromGUID(SDL_JoystickGUI return type; } +SDL_bool SDL_JoystickGUIDUsesVersion(SDL_JoystickGUID guid) +{ + Uint16 vendor, product; + + if (SDL_IsJoystickMFI(guid)) { + /* The version bits are used as button capability mask */ + return SDL_FALSE; + } + + SDL_GetJoystickGUIDInfo(guid, &vendor, &product, NULL, NULL); + if (vendor && product) { + return SDL_TRUE; + } + return SDL_FALSE; +} + SDL_bool SDL_IsJoystickXboxOne(Uint16 vendor_id, Uint16 product_id) { EControllerType eType = GuessControllerType(vendor_id, product_id); @@ -2346,7 +2745,18 @@ SDL_bool SDL_IsJoystickXboxSeriesX(Uint16 vendor_id, Uint16 product_id) } } if (vendor_id == USB_VENDOR_8BITDO) { - if (product_id == USB_PRODUCT_8BITDO_XBOX_CONTROLLER) { + if (product_id == USB_PRODUCT_8BITDO_XBOX_CONTROLLER1 || + product_id == USB_PRODUCT_8BITDO_XBOX_CONTROLLER2) { + return SDL_TRUE; + } + } + if (vendor_id == USB_VENDOR_GAMESIR) { + if (product_id == USB_PRODUCT_GAMESIR_G7) { + return SDL_TRUE; + } + } + if (vendor_id == USB_VENDOR_ASUS) { + if (product_id == USB_PRODUCT_ROG_RAIKIRI) { return SDL_TRUE; } } @@ -2438,6 +2848,12 @@ SDL_bool SDL_IsJoystickSteamController(Uint16 vendor_id, Uint16 product_id) return eType == k_eControllerType_SteamController || eType == k_eControllerType_SteamControllerV2; } +SDL_bool SDL_IsJoystickSteamDeck(Uint16 vendor_id, Uint16 product_id) +{ + EControllerType eType = GuessControllerType(vendor_id, product_id); + return eType == k_eControllerType_SteamDeck; +} + SDL_bool SDL_IsJoystickXInput(SDL_JoystickGUID guid) { return (guid.data[14] == 'x') ? SDL_TRUE : SDL_FALSE; @@ -2453,6 +2869,11 @@ SDL_bool SDL_IsJoystickHIDAPI(SDL_JoystickGUID guid) return (guid.data[14] == 'h') ? SDL_TRUE : SDL_FALSE; } +SDL_bool SDL_IsJoystickMFI(SDL_JoystickGUID guid) +{ + return (guid.data[14] == 'm') ? SDL_TRUE : SDL_FALSE; +} + SDL_bool SDL_IsJoystickRAWINPUT(SDL_JoystickGUID guid) { return (guid.data[14] == 'r') ? SDL_TRUE : SDL_FALSE; @@ -2463,152 +2884,48 @@ SDL_bool SDL_IsJoystickVirtual(SDL_JoystickGUID guid) return (guid.data[14] == 'v') ? SDL_TRUE : SDL_FALSE; } -static SDL_bool SDL_IsJoystickProductWheel(Uint32 vidpid) -{ - static Uint32 wheel_joysticks[] = { - MAKE_VIDPID(0x0079, 0x1864), /* DragonRise Inc. Wired Wheel (active mode) (also known as PXN V900 (PS3), Superdrive SV-750, or a Genesis Seaborg 400) */ - MAKE_VIDPID(0x046d, 0xc294), /* Logitech generic wheel */ - MAKE_VIDPID(0x046d, 0xc295), /* Logitech Momo Force */ - MAKE_VIDPID(0x046d, 0xc298), /* Logitech Driving Force Pro */ - MAKE_VIDPID(0x046d, 0xc299), /* Logitech G25 */ - MAKE_VIDPID(0x046d, 0xc29a), /* Logitech Driving Force GT */ - MAKE_VIDPID(0x046d, 0xc29b), /* Logitech G27 */ - MAKE_VIDPID(0x046d, 0xc24f), /* Logitech G29 (PS3) */ - MAKE_VIDPID(0x046d, 0xc260), /* Logitech G29 (PS4) */ - MAKE_VIDPID(0x046d, 0xc261), /* Logitech G920 (initial mode) */ - MAKE_VIDPID(0x046d, 0xc262), /* Logitech G920 (active mode) */ - MAKE_VIDPID(0x046d, 0xc268), /* Logitech PRO Racing Wheel (PC mode) */ - MAKE_VIDPID(0x046d, 0xc269), /* Logitech PRO Racing Wheel (PS4/PS5 mode) */ - MAKE_VIDPID(0x046d, 0xc272), /* Logitech PRO Racing Wheel for Xbox (PC mode) */ - MAKE_VIDPID(0x046d, 0xc26d), /* Logitech G923 (Xbox) */ - MAKE_VIDPID(0x046d, 0xc26e), /* Logitech G923 */ - MAKE_VIDPID(0x046d, 0xc266), /* Logitech G923 for Playstation 4 and PC (PC mode) */ - MAKE_VIDPID(0x046d, 0xc267), /* Logitech G923 for Playstation 4 and PC (PS4 mode)*/ - MAKE_VIDPID(0x046d, 0xca03), /* Logitech Momo Racing */ - MAKE_VIDPID(0x044f, 0xb65d), /* Thrustmaster Wheel FFB */ - MAKE_VIDPID(0x044f, 0xb66d), /* Thrustmaster Wheel FFB */ - MAKE_VIDPID(0x044f, 0xb677), /* Thrustmaster T150 */ - MAKE_VIDPID(0x044f, 0xb696), /* Thrustmaster T248 */ - MAKE_VIDPID(0x044f, 0xb66e), /* Thrustmaster T300RS (normal mode) */ - MAKE_VIDPID(0x044f, 0xb66f), /* Thrustmaster T300RS (advanced mode) */ - MAKE_VIDPID(0x044f, 0xb66d), /* Thrustmaster T300RS (PS4 mode) */ - MAKE_VIDPID(0x044f, 0xb65e), /* Thrustmaster T500RS */ - MAKE_VIDPID(0x044f, 0xb664), /* Thrustmaster TX (initial mode) */ - MAKE_VIDPID(0x044f, 0xb669), /* Thrustmaster TX (active mode) */ - MAKE_VIDPID(0x0483, 0x0522), /* Simagic Wheelbase (including M10, Alpha Mini, Alpha, Alpha U) */ - MAKE_VIDPID(0x0eb7, 0x0001), /* Fanatec ClubSport Wheel Base V2 */ - MAKE_VIDPID(0x0eb7, 0x0004), /* Fanatec ClubSport Wheel Base V2.5 */ - MAKE_VIDPID(0x0eb7, 0x0005), /* Fanatec CSL Elite Wheel Base+ (PS4) */ - MAKE_VIDPID(0x0eb7, 0x0006), /* Fanatec Podium Wheel Base DD1 */ - MAKE_VIDPID(0x0eb7, 0x0007), /* Fanatec Podium Wheel Base DD2 */ - MAKE_VIDPID(0x0eb7, 0x0011), /* Fanatec Forza Motorsport (CSR Wheel / CSR Elite Wheel) */ - MAKE_VIDPID(0x0eb7, 0x0020), /* Fanatec generic wheel / CSL DD / GT DD Pro */ - MAKE_VIDPID(0x0eb7, 0x0197), /* Fanatec Porsche Wheel (Turbo / GT3 RS / Turbo S / GT3 V2 / GT2) */ - MAKE_VIDPID(0x0eb7, 0x038e), /* Fanatec ClubSport Wheel Base V1 */ - MAKE_VIDPID(0x0eb7, 0x0e03), /* Fanatec CSL Elite Wheel Base */ - MAKE_VIDPID(0x11ff, 0x0511), /* DragonRise Inc. Wired Wheel (initial mode) (also known as PXN V900 (PS3), Superdrive SV-750, or a Genesis Seaborg 400) */ - MAKE_VIDPID(0x2433, 0xf300), /* Asetek SimSports Invicta Wheelbase */ - MAKE_VIDPID(0x2433, 0xf301), /* Asetek SimSports Forte Wheelbase */ - MAKE_VIDPID(0x2433, 0xf303), /* Asetek SimSports La Prima Wheelbase */ - MAKE_VIDPID(0x2433, 0xf306), /* Asetek SimSports Tony Kannan Wheelbase */ - }; - int i; - - for (i = 0; i < SDL_arraysize(wheel_joysticks); ++i) { - if (vidpid == wheel_joysticks[i]) { - return SDL_TRUE; - } - } - return SDL_FALSE; +static SDL_bool SDL_IsJoystickWheel(Uint16 vendor_id, Uint16 product_id) +{ + return SDL_VIDPIDInList(vendor_id, product_id, &wheel_devices); } -static SDL_bool SDL_IsJoystickProductArcadeStick(Uint32 vidpid) -{ - static Uint32 arcadestick_joysticks[] = { - MAKE_VIDPID(0x0079, 0x181a), /* Venom Arcade Stick */ - MAKE_VIDPID(0x0079, 0x181b), /* Venom Arcade Stick */ - MAKE_VIDPID(0x0c12, 0x0ef6), /* Hitbox Arcade Stick */ - MAKE_VIDPID(0x0e6f, 0x0109), /* PDP Versus Fighting Pad */ - MAKE_VIDPID(0x0f0d, 0x0016), /* Hori Real Arcade Pro.EX */ - MAKE_VIDPID(0x0f0d, 0x001b), /* Hori Real Arcade Pro VX */ - MAKE_VIDPID(0x0f0d, 0x0063), /* Hori Real Arcade Pro Hayabusa (USA) Xbox One */ - MAKE_VIDPID(0x0f0d, 0x006a), /* Real Arcade Pro 4 */ - MAKE_VIDPID(0x0f0d, 0x0078), /* Hori Real Arcade Pro V Kai Xbox One */ - MAKE_VIDPID(0x0f0d, 0x008a), /* HORI Real Arcade Pro 4 */ - MAKE_VIDPID(0x0f0d, 0x008c), /* Hori Real Arcade Pro 4 */ - MAKE_VIDPID(0x0f0d, 0x00aa), /* HORI Real Arcade Pro V Hayabusa in Switch Mode */ - MAKE_VIDPID(0x0f0d, 0x00ed), /* Hori Fighting Stick mini 4 kai */ - MAKE_VIDPID(0x0f0d, 0x011c), /* Hori Fighting Stick α in PS4 Mode */ - MAKE_VIDPID(0x0f0d, 0x011e), /* Hori Fighting Stick α in PC Mode */ - MAKE_VIDPID(0x0f0d, 0x0184), /* Hori Fighting Stick α in PS5 Mode */ - MAKE_VIDPID(0x146b, 0x0604), /* NACON Daija Arcade Stick */ - MAKE_VIDPID(0x1532, 0x0a00), /* Razer Atrox Arcade Stick */ - MAKE_VIDPID(0x1bad, 0xf03d), /* Street Fighter IV Arcade Stick TE - Chun Li */ - MAKE_VIDPID(0x1bad, 0xf502), /* Hori Real Arcade Pro.VX SA */ - MAKE_VIDPID(0x1bad, 0xf504), /* Hori Real Arcade Pro. EX */ - MAKE_VIDPID(0x1bad, 0xf506), /* Hori Real Arcade Pro.EX Premium VLX */ - MAKE_VIDPID(0x20d6, 0xa715), /* PowerA Nintendo Switch Fusion Arcade Stick */ - MAKE_VIDPID(0x24c6, 0x5000), /* Razer Atrox Arcade Stick */ - MAKE_VIDPID(0x24c6, 0x5501), /* Hori Real Arcade Pro VX-SA */ - MAKE_VIDPID(0x24c6, 0x550e), /* Hori Real Arcade Pro V Kai 360 */ - MAKE_VIDPID(0x2c22, 0x2300), /* Qanba Obsidian Arcade Joystick in PS4 Mode */ - MAKE_VIDPID(0x2c22, 0x2302), /* Qanba Obsidian Arcade Joystick in PS3 Mode */ - MAKE_VIDPID(0x2c22, 0x2303), /* Qanba Obsidian Arcade Joystick in PC Mode */ - MAKE_VIDPID(0x2c22, 0x2500), /* Qanba Dragon Arcade Joystick in PS4 Mode */ - MAKE_VIDPID(0x2c22, 0x2502), /* Qanba Dragon Arcade Joystick in PS3 Mode */ - MAKE_VIDPID(0x2c22, 0x2503), /* Qanba Dragon Arcade Joystick in PC Mode */ - }; - int i; - - for (i = 0; i < SDL_arraysize(arcadestick_joysticks); ++i) { - if (vidpid == arcadestick_joysticks[i]) { - return SDL_TRUE; - } - } - return SDL_FALSE; +static SDL_bool SDL_IsJoystickArcadeStick(Uint16 vendor_id, Uint16 product_id) +{ + return SDL_VIDPIDInList(vendor_id, product_id, &arcadestick_devices); } -static SDL_bool SDL_IsJoystickProductFlightStick(Uint32 vidpid) +static SDL_bool SDL_IsJoystickFlightStick(Uint16 vendor_id, Uint16 product_id) { - static Uint32 flightstick_joysticks[] = { - MAKE_VIDPID(0x044f, 0x0402), /* HOTAS Warthog Joystick */ - MAKE_VIDPID(0x0738, 0x2221), /* Saitek Pro Flight X-56 Rhino Stick */ - MAKE_VIDPID(0x044f, 0xb10a), /* ThrustMaster, Inc. T.16000M Joystick */ - MAKE_VIDPID(0x046d, 0xc215), /* Logitech Extreme 3D */ - MAKE_VIDPID(0x231d, 0x0126), /* Gunfighter Mk.III ‘Space Combat Edition’ (right) */ - MAKE_VIDPID(0x231d, 0x0127), /* Gunfighter Mk.III ‘Space Combat Edition’ (left) */ - }; - int i; - - for (i = 0; i < SDL_arraysize(flightstick_joysticks); ++i) { - if (vidpid == flightstick_joysticks[i]) { - return SDL_TRUE; - } - } - return SDL_FALSE; + return SDL_VIDPIDInList(vendor_id, product_id, &flightstick_devices); } -static SDL_bool SDL_IsJoystickProductThrottle(Uint32 vidpid) +static SDL_bool SDL_IsJoystickThrottle(Uint16 vendor_id, Uint16 product_id) { - static Uint32 throttle_joysticks[] = { - MAKE_VIDPID(0x044f, 0x0404), /* HOTAS Warthog Throttle */ - MAKE_VIDPID(0x0738, 0xa221), /* Saitek Pro Flight X-56 Rhino Throttle */ - }; - int i; - - for (i = 0; i < SDL_arraysize(throttle_joysticks); ++i) { - if (vidpid == throttle_joysticks[i]) { - return SDL_TRUE; - } - } - return SDL_FALSE; + return SDL_VIDPIDInList(vendor_id, product_id, &throttle_devices); } static SDL_JoystickType SDL_GetJoystickGUIDType(SDL_JoystickGUID guid) { Uint16 vendor; Uint16 product; - Uint32 vidpid; + + SDL_GetJoystickGUIDInfo(guid, &vendor, &product, NULL, NULL); + + if (SDL_IsJoystickWheel(vendor, product)) { + return SDL_JOYSTICK_TYPE_WHEEL; + } + + if (SDL_IsJoystickArcadeStick(vendor, product)) { + return SDL_JOYSTICK_TYPE_ARCADE_STICK; + } + + if (SDL_IsJoystickFlightStick(vendor, product)) { + return SDL_JOYSTICK_TYPE_FLIGHT_STICK; + } + + if (SDL_IsJoystickThrottle(vendor, product)) { + return SDL_JOYSTICK_TYPE_THROTTLE; + } if (SDL_IsJoystickXInput(guid)) { /* XInput GUID, get the type based on the XInput device subtype */ @@ -2644,25 +2961,6 @@ static SDL_JoystickType SDL_GetJoystickGUIDType(SDL_JoystickGUID guid) return (SDL_JoystickType)guid.data[15]; } - SDL_GetJoystickGUIDInfo(guid, &vendor, &product, NULL, NULL); - vidpid = MAKE_VIDPID(vendor, product); - - if (SDL_IsJoystickProductWheel(vidpid)) { - return SDL_JOYSTICK_TYPE_WHEEL; - } - - if (SDL_IsJoystickProductArcadeStick(vidpid)) { - return SDL_JOYSTICK_TYPE_ARCADE_STICK; - } - - if (SDL_IsJoystickProductFlightStick(vidpid)) { - return SDL_JOYSTICK_TYPE_FLIGHT_STICK; - } - - if (SDL_IsJoystickProductThrottle(vidpid)) { - return SDL_JOYSTICK_TYPE_THROTTLE; - } - #ifdef SDL_JOYSTICK_HIDAPI if (SDL_IsJoystickHIDAPI(guid)) { return HIDAPI_GetJoystickTypeFromGUID(guid); @@ -2678,147 +2976,18 @@ static SDL_JoystickType SDL_GetJoystickGUIDType(SDL_JoystickGUID guid) SDL_bool SDL_ShouldIgnoreJoystick(const char *name, SDL_JoystickGUID guid) { - /* This list is taken from: - https://raw.githubusercontent.com/denilsonsa/udev-joystick-blacklist/master/generate_rules.py - */ - static Uint32 joystick_blacklist[] = { - /* Microsoft Microsoft Wireless Optical Desktop 2.10 */ - /* Microsoft Wireless Desktop - Comfort Edition */ - MAKE_VIDPID(0x045e, 0x009d), - - /* Microsoft Microsoft Digital Media Pro Keyboard */ - /* Microsoft Corp. Digital Media Pro Keyboard */ - MAKE_VIDPID(0x045e, 0x00b0), - - /* Microsoft Microsoft Digital Media Keyboard */ - /* Microsoft Corp. Digital Media Keyboard 1.0A */ - MAKE_VIDPID(0x045e, 0x00b4), - - /* Microsoft Microsoft Digital Media Keyboard 3000 */ - MAKE_VIDPID(0x045e, 0x0730), - - /* Microsoft Microsoft 2.4GHz Transceiver v6.0 */ - /* Microsoft Microsoft 2.4GHz Transceiver v8.0 */ - /* Microsoft Corp. Nano Transceiver v1.0 for Bluetooth */ - /* Microsoft Wireless Mobile Mouse 1000 */ - /* Microsoft Wireless Desktop 3000 */ - MAKE_VIDPID(0x045e, 0x0745), - - /* Microsoft SideWinder(TM) 2.4GHz Transceiver */ - MAKE_VIDPID(0x045e, 0x0748), - - /* Microsoft Corp. Wired Keyboard 600 */ - MAKE_VIDPID(0x045e, 0x0750), - - /* Microsoft Corp. Sidewinder X4 keyboard */ - MAKE_VIDPID(0x045e, 0x0768), - - /* Microsoft Corp. Arc Touch Mouse Transceiver */ - MAKE_VIDPID(0x045e, 0x0773), - - /* Microsoft 2.4GHz Transceiver v9.0 */ - /* Microsoft Nano Transceiver v2.1 */ - /* Microsoft Sculpt Ergonomic Keyboard (5KV-00001) */ - MAKE_VIDPID(0x045e, 0x07a5), - - /* Microsoft Nano Transceiver v1.0 */ - /* Microsoft Wireless Keyboard 800 */ - MAKE_VIDPID(0x045e, 0x07b2), - - /* Microsoft Nano Transceiver v2.0 */ - MAKE_VIDPID(0x045e, 0x0800), - - MAKE_VIDPID(0x046d, 0xc30a), /* Logitech, Inc. iTouch Composite keboard */ - - MAKE_VIDPID(0x04d9, 0xa0df), /* Tek Syndicate Mouse (E-Signal USB Gaming Mouse) */ - - /* List of Wacom devices at: http://linuxwacom.sourceforge.net/wiki/index.php/Device_IDs */ - MAKE_VIDPID(0x056a, 0x0010), /* Wacom ET-0405 Graphire */ - MAKE_VIDPID(0x056a, 0x0011), /* Wacom ET-0405A Graphire2 (4x5) */ - MAKE_VIDPID(0x056a, 0x0012), /* Wacom ET-0507A Graphire2 (5x7) */ - MAKE_VIDPID(0x056a, 0x0013), /* Wacom CTE-430 Graphire3 (4x5) */ - MAKE_VIDPID(0x056a, 0x0014), /* Wacom CTE-630 Graphire3 (6x8) */ - MAKE_VIDPID(0x056a, 0x0015), /* Wacom CTE-440 Graphire4 (4x5) */ - MAKE_VIDPID(0x056a, 0x0016), /* Wacom CTE-640 Graphire4 (6x8) */ - MAKE_VIDPID(0x056a, 0x0017), /* Wacom CTE-450 Bamboo Fun (4x5) */ - MAKE_VIDPID(0x056a, 0x0018), /* Wacom CTE-650 Bamboo Fun 6x8 */ - MAKE_VIDPID(0x056a, 0x0019), /* Wacom CTE-631 Bamboo One */ - MAKE_VIDPID(0x056a, 0x00d1), /* Wacom Bamboo Pen and Touch CTH-460 */ - MAKE_VIDPID(0x056a, 0x030e), /* Wacom Intuos Pen (S) CTL-480 */ - - MAKE_VIDPID(0x09da, 0x054f), /* A4 Tech Co., G7 750 mouse */ - MAKE_VIDPID(0x09da, 0x1410), /* A4 Tech Co., Ltd Bloody AL9 mouse */ - MAKE_VIDPID(0x09da, 0x3043), /* A4 Tech Co., Ltd Bloody R8A Gaming Mouse */ - MAKE_VIDPID(0x09da, 0x31b5), /* A4 Tech Co., Ltd Bloody TL80 Terminator Laser Gaming Mouse */ - MAKE_VIDPID(0x09da, 0x3997), /* A4 Tech Co., Ltd Bloody RT7 Terminator Wireless */ - MAKE_VIDPID(0x09da, 0x3f8b), /* A4 Tech Co., Ltd Bloody V8 mouse */ - MAKE_VIDPID(0x09da, 0x51f4), /* Modecom MC-5006 Keyboard */ - MAKE_VIDPID(0x09da, 0x5589), /* A4 Tech Co., Ltd Terminator TL9 Laser Gaming Mouse */ - MAKE_VIDPID(0x09da, 0x7b22), /* A4 Tech Co., Ltd Bloody V5 */ - MAKE_VIDPID(0x09da, 0x7f2d), /* A4 Tech Co., Ltd Bloody R3 mouse */ - MAKE_VIDPID(0x09da, 0x8090), /* A4 Tech Co., Ltd X-718BK Oscar Optical Gaming Mouse */ - MAKE_VIDPID(0x09da, 0x9033), /* A4 Tech Co., X7 X-705K */ - MAKE_VIDPID(0x09da, 0x9066), /* A4 Tech Co., Sharkoon Fireglider Optical */ - MAKE_VIDPID(0x09da, 0x9090), /* A4 Tech Co., Ltd XL-730K / XL-750BK / XL-755BK Laser Mouse */ - MAKE_VIDPID(0x09da, 0x90c0), /* A4 Tech Co., Ltd X7 G800V keyboard */ - MAKE_VIDPID(0x09da, 0xf012), /* A4 Tech Co., Ltd Bloody V7 mouse */ - MAKE_VIDPID(0x09da, 0xf32a), /* A4 Tech Co., Ltd Bloody B540 keyboard */ - MAKE_VIDPID(0x09da, 0xf613), /* A4 Tech Co., Ltd Bloody V2 mouse */ - MAKE_VIDPID(0x09da, 0xf624), /* A4 Tech Co., Ltd Bloody B120 Keyboard */ - - MAKE_VIDPID(0x1b1c, 0x1b3c), /* Corsair Harpoon RGB gaming mouse */ - - MAKE_VIDPID(0x1d57, 0xad03), /* [T3] 2.4GHz and IR Air Mouse Remote Control */ - - MAKE_VIDPID(0x1e7d, 0x2e4a), /* Roccat Tyon Mouse */ - - MAKE_VIDPID(0x20a0, 0x422d), /* Winkeyless.kr Keyboards */ - - MAKE_VIDPID(0x2516, 0x001f), /* Cooler Master Storm Mizar Mouse */ - MAKE_VIDPID(0x2516, 0x0028), /* Cooler Master Storm Alcor Mouse */ - - /*****************************************************************/ - /* Additional entries */ - /*****************************************************************/ - - MAKE_VIDPID(0x04d9, 0x8008), /* OBINLB USB-HID Keyboard (Anne Pro II) */ - MAKE_VIDPID(0x04d9, 0x8009), /* OBINLB USB-HID Keyboard (Anne Pro II) */ - MAKE_VIDPID(0x04d9, 0xa292), /* OBINLB USB-HID Keyboard (Anne Pro II) */ - MAKE_VIDPID(0x04d9, 0xa293), /* OBINLB USB-HID Keyboard (Anne Pro II) */ - MAKE_VIDPID(0x1532, 0x0266), /* Razer Huntsman V2 Analog, non-functional DInput device */ - MAKE_VIDPID(0x1532, 0x0282), /* Razer Huntsman Mini Analog, non-functional DInput device */ - MAKE_VIDPID(0x26ce, 0x01a2), /* ASRock LED Controller */ - MAKE_VIDPID(0x20d6, 0x0002), /* PowerA Enhanced Wireless Controller for Nintendo Switch (charging port only) */ - }; - - static Uint32 rog_chakram_list[] = { - MAKE_VIDPID(0x0b05, 0x1958), /* ROG Chakram Core Mouse */ - MAKE_VIDPID(0x0b05, 0x18e3), /* ROG Chakram (wired) Mouse */ - MAKE_VIDPID(0x0b05, 0x18e5), /* ROG Chakram (wireless) Mouse */ - MAKE_VIDPID(0x0b05, 0x1a18), /* ROG Chakram X (wired) Mouse */ - MAKE_VIDPID(0x0b05, 0x1a1a), /* ROG Chakram X (wireless) Mouse */ - MAKE_VIDPID(0x0b05, 0x1a1c), /* ROG Chakram X (Bluetooth) Mouse */ - }; - - unsigned int i; - Uint32 id; Uint16 vendor; Uint16 product; SDL_GetJoystickGUIDInfo(guid, &vendor, &product, NULL, NULL); /* Check the joystick blacklist */ - id = MAKE_VIDPID(vendor, product); - for (i = 0; i < SDL_arraysize(joystick_blacklist); ++i) { - if (id == joystick_blacklist[i]) { - return SDL_TRUE; - } + if (SDL_VIDPIDInList(vendor, product, &blacklist_devices)) { + return SDL_TRUE; } if (!SDL_GetHintBoolean(SDL_HINT_JOYSTICK_ROG_CHAKRAM, SDL_FALSE)) { - for (i = 0; i < SDL_arraysize(rog_chakram_list); ++i) { - if (id == rog_chakram_list[i]) { - return SDL_TRUE; - } + if (SDL_VIDPIDInList(vendor, product, &rog_gamepad_mice)) { + return SDL_TRUE; } } @@ -2849,18 +3018,38 @@ SDL_JoystickGUID SDL_JoystickGetDeviceGUID(int device_index) Uint16 SDL_JoystickGetDeviceVendor(int device_index) { Uint16 vendor; - SDL_JoystickGUID guid = SDL_JoystickGetDeviceGUID(device_index); + const SDL_SteamVirtualGamepadInfo *info; + + SDL_LockJoysticks(); + info = SDL_GetJoystickInstanceVirtualGamepadInfo(SDL_JoystickGetDeviceInstanceID(device_index)); + if (info) { + vendor = info->vendor_id; + } else { + SDL_JoystickGUID guid = SDL_JoystickGetDeviceGUID(device_index); + + SDL_GetJoystickGUIDInfo(guid, &vendor, NULL, NULL, NULL); + } + SDL_UnlockJoysticks(); - SDL_GetJoystickGUIDInfo(guid, &vendor, NULL, NULL, NULL); return vendor; } Uint16 SDL_JoystickGetDeviceProduct(int device_index) { Uint16 product; - SDL_JoystickGUID guid = SDL_JoystickGetDeviceGUID(device_index); + const SDL_SteamVirtualGamepadInfo *info; + + SDL_LockJoysticks(); + info = SDL_GetJoystickInstanceVirtualGamepadInfo(SDL_JoystickGetDeviceInstanceID(device_index)); + if (info) { + product = info->product_id; + } else { + SDL_JoystickGUID guid = SDL_JoystickGetDeviceGUID(device_index); + + SDL_GetJoystickGUIDInfo(guid, NULL, &product, NULL, NULL); + } + SDL_UnlockJoysticks(); - SDL_GetJoystickGUIDInfo(guid, NULL, &product, NULL, NULL); return product; } @@ -2938,18 +3127,46 @@ SDL_JoystickGUID SDL_JoystickGetGUID(SDL_Joystick *joystick) Uint16 SDL_JoystickGetVendor(SDL_Joystick *joystick) { Uint16 vendor; - SDL_JoystickGUID guid = SDL_JoystickGetGUID(joystick); + const SDL_SteamVirtualGamepadInfo *info; + + SDL_LockJoysticks(); + { + CHECK_JOYSTICK_MAGIC(joystick, 0); + + info = SDL_GetJoystickInstanceVirtualGamepadInfo(joystick->instance_id); + if (info) { + vendor = info->vendor_id; + } else { + SDL_JoystickGUID guid = SDL_JoystickGetGUID(joystick); + + SDL_GetJoystickGUIDInfo(guid, &vendor, NULL, NULL, NULL); + } + } + SDL_UnlockJoysticks(); - SDL_GetJoystickGUIDInfo(guid, &vendor, NULL, NULL, NULL); return vendor; } Uint16 SDL_JoystickGetProduct(SDL_Joystick *joystick) { Uint16 product; - SDL_JoystickGUID guid = SDL_JoystickGetGUID(joystick); + const SDL_SteamVirtualGamepadInfo *info; + + SDL_LockJoysticks(); + { + CHECK_JOYSTICK_MAGIC(joystick, 0); + + info = SDL_GetJoystickInstanceVirtualGamepadInfo(joystick->instance_id); + if (info) { + product = info->product_id; + } else { + SDL_JoystickGUID guid = SDL_JoystickGetGUID(joystick); + + SDL_GetJoystickGUIDInfo(guid, NULL, &product, NULL, NULL); + } + } + SDL_UnlockJoysticks(); - SDL_GetJoystickGUIDInfo(guid, NULL, &product, NULL, NULL); return product; } @@ -3031,7 +3248,7 @@ void SDL_PrivateJoystickBatteryLevel(SDL_Joystick *joystick, SDL_JoystickPowerLe SDL_assert(joystick->ref_count); /* make sure we are calling this only for update, not for initialization */ if (ePowerLevel != joystick->epowerlevel) { -#if !SDL_EVENTS_DISABLED +#ifndef SDL_EVENTS_DISABLED if (SDL_GetEventState(SDL_JOYBATTERYUPDATED) == SDL_ENABLE) { SDL_Event event; event.type = SDL_JOYBATTERYUPDATED; @@ -3134,7 +3351,7 @@ int SDL_PrivateJoystickTouchpad(SDL_Joystick *joystick, int touchpad, int finger /* Post the event, if desired */ posted = 0; -#if !SDL_EVENTS_DISABLED +#ifndef SDL_EVENTS_DISABLED if (SDL_GetEventState(event_type) == SDL_ENABLE) { SDL_Event event; event.type = event_type; @@ -3174,7 +3391,7 @@ int SDL_PrivateJoystickSensor(SDL_Joystick *joystick, SDL_SensorType type, Uint6 sensor->timestamp_us = timestamp_us; /* Post the event, if desired */ -#if !SDL_EVENTS_DISABLED +#ifndef SDL_EVENTS_DISABLED if (SDL_GetEventState(SDL_CONTROLLERSENSORUPDATE) == SDL_ENABLE) { SDL_Event event; event.type = SDL_CONTROLLERSENSORUPDATE; @@ -3194,4 +3411,174 @@ int SDL_PrivateJoystickSensor(SDL_Joystick *joystick, SDL_SensorType type, Uint6 return posted; } +static void SDL_LoadVIDPIDListFromHint(const char *hint, int *num_entries, int *max_entries, Uint32 **entries) +{ + Uint32 entry; + char *spot; + char *file = NULL; + + if (hint && *hint == '@') { + spot = file = (char *)SDL_LoadFile(hint + 1, NULL); + } else { + spot = (char *)hint; + } + + if (spot == NULL) { + return; + } + + while ((spot = SDL_strstr(spot, "0x")) != NULL) { + entry = (Uint16)SDL_strtol(spot, &spot, 0); + entry <<= 16; + spot = SDL_strstr(spot, "0x"); + if (spot == NULL) { + break; + } + entry |= (Uint16)SDL_strtol(spot, &spot, 0); + + if (*num_entries == *max_entries) { + int new_max_entries = *max_entries + 16; + Uint32 *new_entries = (Uint32 *)SDL_realloc(*entries, new_max_entries * sizeof(**entries)); + if (!new_entries) { + /* Out of memory, go with what we have already */ + break; + } + *entries = new_entries; + *max_entries = new_max_entries; + } + (*entries)[(*num_entries)++] = entry; + } + + if (file) { + SDL_free(file); + } +} + +void SDL_LoadVIDPIDListFromHints(SDL_vidpid_list *list, const char *included_list, const char *excluded_list) +{ + /* Empty the list */ + list->num_included_entries = 0; + list->num_excluded_entries = 0; + + /* Add the initial entries */ + if (list->num_initial_entries > 0) { + if (list->num_included_entries < list->num_initial_entries) { + Uint32 *entries = (Uint32 *)SDL_malloc(list->num_initial_entries * sizeof(*entries)); + if (entries) { + SDL_memcpy(entries, list->initial_entries, list->num_initial_entries * sizeof(*entries)); + list->included_entries = entries; + list->num_included_entries = list->num_initial_entries; + list->max_included_entries = list->num_initial_entries; + } + } + } + + /* Add the included entries from the hint */ + SDL_LoadVIDPIDListFromHint(included_list, &list->num_included_entries, &list->max_included_entries, &list->included_entries); + + /* Add the excluded entries from the hint */ + SDL_LoadVIDPIDListFromHint(excluded_list, &list->num_excluded_entries, &list->max_excluded_entries, &list->excluded_entries); +} + +static void SDLCALL SDL_VIDPIDIncludedHintChanged(void *userdata, const char *name, const char *oldValue, const char *hint) +{ + SDL_vidpid_list *list = (SDL_vidpid_list *)userdata; + const char *included_list = hint; + const char *excluded_list = NULL; + + if (!list->initialized) { + return; + } + + if (list->excluded_hint_name) { + excluded_list = SDL_GetHint(list->excluded_hint_name); + } + SDL_LoadVIDPIDListFromHints(list, included_list, excluded_list); +} + +static void SDLCALL SDL_VIDPIDExcludedHintChanged(void *userdata, const char *name, const char *oldValue, const char *hint) +{ + SDL_vidpid_list *list = (SDL_vidpid_list *)userdata; + const char *included_list = NULL; + const char *excluded_list = hint; + + if (!list->initialized) { + return; + } + + if (list->included_hint_name) { + included_list = SDL_GetHint(list->included_hint_name); + } + SDL_LoadVIDPIDListFromHints(list, included_list, excluded_list); +} + +void SDL_LoadVIDPIDList(SDL_vidpid_list *list) +{ + const char *included_list = NULL; + const char *excluded_list = NULL; + + if (list->included_hint_name) { + SDL_AddHintCallback(list->included_hint_name, SDL_VIDPIDIncludedHintChanged, list); + } + + if (list->excluded_hint_name) { + SDL_AddHintCallback(list->excluded_hint_name, SDL_VIDPIDExcludedHintChanged, list); + } + + list->initialized = SDL_TRUE; + + if (list->included_hint_name) { + included_list = SDL_GetHint(list->included_hint_name); + } + if (list->excluded_hint_name) { + excluded_list = SDL_GetHint(list->excluded_hint_name); + } + SDL_LoadVIDPIDListFromHints(list, included_list, excluded_list); +} + +SDL_bool SDL_VIDPIDInList(Uint16 vendor_id, Uint16 product_id, const SDL_vidpid_list *list) +{ + int i; + Uint32 vidpid = MAKE_VIDPID(vendor_id, product_id); + + for (i = 0; i < list->num_excluded_entries; ++i) { + if (vidpid == list->excluded_entries[i]) { + return SDL_FALSE; + } + } + for (i = 0; i < list->num_included_entries; ++i) { + if (vidpid == list->included_entries[i]) { + return SDL_TRUE; + } + } + return SDL_FALSE; +} + +void SDL_FreeVIDPIDList(SDL_vidpid_list *list) +{ + if (list->included_hint_name) { + SDL_DelHintCallback(list->included_hint_name, SDL_VIDPIDIncludedHintChanged, list); + } + + if (list->excluded_hint_name) { + SDL_DelHintCallback(list->excluded_hint_name, SDL_VIDPIDExcludedHintChanged, list); + } + + if (list->included_entries) { + SDL_free(list->included_entries); + list->included_entries = NULL; + list->num_included_entries = 0; + list->max_included_entries = 0; + } + + if (list->excluded_entries) { + SDL_free(list->excluded_entries); + list->excluded_entries = NULL; + list->num_excluded_entries = 0; + list->max_excluded_entries = 0; + } + + list->initialized = SDL_FALSE; +} + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/thirdparty/SDL/src/joystick/SDL_joystick_c.h b/thirdparty/SDL/src/joystick/SDL_joystick_c.h index 484746d44..44d8e8cc9 100644 --- a/thirdparty/SDL/src/joystick/SDL_joystick_c.h +++ b/thirdparty/SDL/src/joystick/SDL_joystick_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -34,6 +34,7 @@ extern "C" { #endif struct _SDL_JoystickDriver; +struct SDL_SteamVirtualGamepadInfo; extern char SDL_joystick_magic; /* Initialization and shutdown functions */ @@ -70,7 +71,7 @@ extern int SDL_JoystickGetDeviceIndexFromInstanceID(SDL_JoystickID instance_id); extern char *SDL_CreateJoystickName(Uint16 vendor, Uint16 product, const char *vendor_name, const char *product_name); /* Function to create a GUID for a joystick based on the VID/PID and name */ -extern SDL_JoystickGUID SDL_CreateJoystickGUID(Uint16 bus, Uint16 vendor, Uint16 product, Uint16 version, const char *name, Uint8 driver_signature, Uint8 driver_data); +extern SDL_JoystickGUID SDL_CreateJoystickGUID(Uint16 bus, Uint16 vendor, Uint16 product, Uint16 version, const char *vendor_name, const char *product_name, Uint8 driver_signature, Uint8 driver_data); /* Function to create a GUID for a joystick based on the name, with no VID/PID information */ extern SDL_JoystickGUID SDL_CreateJoystickGUIDForName(const char *name); @@ -91,6 +92,9 @@ extern void SDL_SetJoystickGUIDCRC(SDL_JoystickGUID *guid, Uint16 crc); extern SDL_GameControllerType SDL_GetJoystickGameControllerTypeFromVIDPID(Uint16 vendor, Uint16 product, const char *name, SDL_bool forUI); extern SDL_GameControllerType SDL_GetJoystickGameControllerTypeFromGUID(SDL_JoystickGUID guid, const char *name); +/* Function to return whether a joystick GUID uses the version field */ +extern SDL_bool SDL_JoystickGUIDUsesVersion(SDL_JoystickGUID guid); + /* Function to return whether a joystick is an Xbox One controller */ extern SDL_bool SDL_IsJoystickXboxOne(Uint16 vendor_id, Uint16 product_id); @@ -122,6 +126,9 @@ extern SDL_bool SDL_IsJoystickNintendoSwitchJoyConPair(Uint16 vendor_id, Uint16 /* Function to return whether a joystick is a Steam Controller */ extern SDL_bool SDL_IsJoystickSteamController(Uint16 vendor_id, Uint16 product_id); +/* Function to return whether a joystick is a Steam Deck */ +extern SDL_bool SDL_IsJoystickSteamDeck(Uint16 vendor_id, Uint16 product_id); + /* Function to return whether a joystick guid comes from the XInput driver */ extern SDL_bool SDL_IsJoystickXInput(SDL_JoystickGUID guid); @@ -131,6 +138,9 @@ extern SDL_bool SDL_IsJoystickWGI(SDL_JoystickGUID guid); /* Function to return whether a joystick guid comes from the HIDAPI driver */ extern SDL_bool SDL_IsJoystickHIDAPI(SDL_JoystickGUID guid); +/* Function to return whether a joystick guid comes from the MFI driver */ +extern SDL_bool SDL_IsJoystickMFI(SDL_JoystickGUID guid); + /* Function to return whether a joystick guid comes from the RAWINPUT driver */ extern SDL_bool SDL_IsJoystickRAWINPUT(SDL_JoystickGUID guid); @@ -170,21 +180,27 @@ extern int SDL_PrivateJoystickSensor(SDL_Joystick *joystick, extern void SDL_PrivateJoystickBatteryLevel(SDL_Joystick *joystick, SDL_JoystickPowerLevel ePowerLevel); +/* Function to get the Steam virtual gamepad info for a joystick */ +extern const struct SDL_SteamVirtualGamepadInfo *SDL_GetJoystickInstanceVirtualGamepadInfo(SDL_JoystickID instance_id); + /* Internal sanity checking functions */ extern SDL_bool SDL_PrivateJoystickValid(SDL_Joystick *joystick); typedef enum { - EMappingKind_None = 0, - EMappingKind_Button = 1, - EMappingKind_Axis = 2, - EMappingKind_Hat = 3 + EMappingKind_None, + EMappingKind_Button, + EMappingKind_Axis, + EMappingKind_Hat, } EMappingKind; typedef struct _SDL_InputMapping { EMappingKind kind; Uint8 target; + SDL_bool axis_reversed; + SDL_bool half_axis_positive; + SDL_bool half_axis_negative; } SDL_InputMapping; typedef struct _SDL_GamepadMapping @@ -215,12 +231,40 @@ typedef struct _SDL_GamepadMapping SDL_InputMapping righty; SDL_InputMapping lefttrigger; SDL_InputMapping righttrigger; + SDL_InputMapping touchpad; } SDL_GamepadMapping; /* Function to get autodetected gamepad controller mapping from the driver */ extern SDL_bool SDL_PrivateJoystickGetAutoGamepadMapping(int device_index, SDL_GamepadMapping *out); + +typedef struct +{ + const char *included_hint_name; + int num_included_entries; + int max_included_entries; + Uint32 *included_entries; + + const char *excluded_hint_name; + int num_excluded_entries; + int max_excluded_entries; + Uint32 *excluded_entries; + + int num_initial_entries; + Uint32 *initial_entries; + + SDL_bool initialized; +} SDL_vidpid_list; + +extern void SDL_LoadVIDPIDList(SDL_vidpid_list *list); +extern void SDL_LoadVIDPIDListFromHints(SDL_vidpid_list *list, const char *included_list, const char *excluded_list); +extern SDL_bool SDL_VIDPIDInList(Uint16 vendor_id, Uint16 product_id, const SDL_vidpid_list *list); +extern void SDL_FreeVIDPIDList(SDL_vidpid_list *list); + +/* This is in SDL_gamecontroller.c */ +extern SDL_GameControllerType SDL_GetGameControllerTypeFromString(const char *str); + /* Ends C function definitions when using C++ */ #ifdef __cplusplus } diff --git a/thirdparty/SDL/src/joystick/SDL_steam_virtual_gamepad.c b/thirdparty/SDL/src/joystick/SDL_steam_virtual_gamepad.c new file mode 100644 index 000000000..4e5255d05 --- /dev/null +++ b/thirdparty/SDL/src/joystick/SDL_steam_virtual_gamepad.c @@ -0,0 +1,251 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2024 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../SDL_internal.h" + +#include "SDL_hints.h" +#include "SDL_timer.h" +#include "SDL_joystick_c.h" +#include "SDL_steam_virtual_gamepad.h" + +#ifdef __WIN32__ +#include "../core/windows/SDL_windows.h" +#else +#include +#include +#endif + +#define SDL_HINT_STEAM_VIRTUAL_GAMEPAD_INFO_FILE "SteamVirtualGamepadInfo" + +static char *SDL_steam_virtual_gamepad_info_file SDL_GUARDED_BY(SDL_joystick_lock) = NULL; +static Uint64 SDL_steam_virtual_gamepad_info_file_mtime SDL_GUARDED_BY(SDL_joystick_lock) = 0; +static Uint32 SDL_steam_virtual_gamepad_info_check_time SDL_GUARDED_BY(SDL_joystick_lock) = 0; +static SDL_SteamVirtualGamepadInfo **SDL_steam_virtual_gamepad_info SDL_GUARDED_BY(SDL_joystick_lock) = NULL; +static int SDL_steam_virtual_gamepad_info_count SDL_GUARDED_BY(SDL_joystick_lock) = 0; + + +static Uint64 GetFileModificationTime(const char *file) +{ + Uint64 modification_time = 0; + +#ifdef __WIN32__ + WCHAR *wFile = WIN_UTF8ToStringW(file); + if (wFile) { + HANDLE hFile = CreateFileW(wFile, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL); + if (hFile != INVALID_HANDLE_VALUE) { + FILETIME last_write_time; + if (GetFileTime(hFile, NULL, NULL, &last_write_time)) { + modification_time = last_write_time.dwHighDateTime; + modification_time <<= 32; + modification_time |= last_write_time.dwLowDateTime; + } + CloseHandle(hFile); + } + SDL_free(wFile); + } +#else + struct stat sb; + + if (stat(file, &sb) == 0) { + modification_time = (Uint64)sb.st_mtime; + } +#endif + return modification_time; +} + +static void SDL_FreeSteamVirtualGamepadInfo(void) +{ + int i; + + SDL_AssertJoysticksLocked(); + + for (i = 0; i < SDL_steam_virtual_gamepad_info_count; ++i) { + SDL_SteamVirtualGamepadInfo *entry = SDL_steam_virtual_gamepad_info[i]; + if (entry) { + SDL_free(entry->name); + SDL_free(entry); + } + } + SDL_free(SDL_steam_virtual_gamepad_info); + SDL_steam_virtual_gamepad_info = NULL; + SDL_steam_virtual_gamepad_info_count = 0; +} + +static void AddVirtualGamepadInfo(int slot, SDL_SteamVirtualGamepadInfo *info) +{ + SDL_SteamVirtualGamepadInfo *new_info; + + SDL_AssertJoysticksLocked(); + + if (slot < 0) { + return; + } + + if (slot >= SDL_steam_virtual_gamepad_info_count) { + SDL_SteamVirtualGamepadInfo **slots = (SDL_SteamVirtualGamepadInfo **)SDL_realloc(SDL_steam_virtual_gamepad_info, (slot + 1)*sizeof(*SDL_steam_virtual_gamepad_info)); + if (!slots) { + return; + } + while (SDL_steam_virtual_gamepad_info_count <= slot) { + slots[SDL_steam_virtual_gamepad_info_count++] = NULL; + } + SDL_steam_virtual_gamepad_info = slots; + } + + if (SDL_steam_virtual_gamepad_info[slot]) { + /* We already have this slot info */ + return; + } + + new_info = (SDL_SteamVirtualGamepadInfo *)SDL_malloc(sizeof(*new_info)); + if (!new_info) { + return; + } + SDL_copyp(new_info, info); + SDL_steam_virtual_gamepad_info[slot] = new_info; + SDL_zerop(info); +} + +void SDL_InitSteamVirtualGamepadInfo(void) +{ + const char *file; + + SDL_AssertJoysticksLocked(); + + file = SDL_GetHint(SDL_HINT_STEAM_VIRTUAL_GAMEPAD_INFO_FILE); + if (file && *file) { + SDL_steam_virtual_gamepad_info_file = SDL_strdup(file); + } + SDL_UpdateSteamVirtualGamepadInfo(); +} + +SDL_bool SDL_SteamVirtualGamepadEnabled(void) +{ + SDL_AssertJoysticksLocked(); + + return (SDL_steam_virtual_gamepad_info != NULL); +} + +SDL_bool SDL_UpdateSteamVirtualGamepadInfo(void) +{ + const int UPDATE_CHECK_INTERVAL_MS = 3000; + Uint32 now; + Uint64 mtime; + char *data, *end, *next, *line, *value; + size_t size; + int slot, new_slot; + SDL_SteamVirtualGamepadInfo info; + + SDL_AssertJoysticksLocked(); + + if (!SDL_steam_virtual_gamepad_info_file) { + return SDL_FALSE; + } + + now = SDL_GetTicks(); + if (SDL_steam_virtual_gamepad_info_check_time && + !SDL_TICKS_PASSED(now, (SDL_steam_virtual_gamepad_info_check_time + UPDATE_CHECK_INTERVAL_MS))) { + return SDL_FALSE; + } + SDL_steam_virtual_gamepad_info_check_time = now; + + mtime = GetFileModificationTime(SDL_steam_virtual_gamepad_info_file); + if (mtime == 0 || mtime == SDL_steam_virtual_gamepad_info_file_mtime) { + return SDL_FALSE; + } + + data = (char *)SDL_LoadFile(SDL_steam_virtual_gamepad_info_file, &size); + if (!data) { + return SDL_FALSE; + } + + SDL_FreeSteamVirtualGamepadInfo(); + + slot = -1; + SDL_zero(info); + + for (next = data, end = data + size; next < end; ) { + while (next < end && (*next == '\0' || *next == '\r' || *next == '\n')) { + ++next; + } + + line = next; + + while (next < end && (*next != '\r' && *next != '\n')) { + ++next; + } + *next = '\0'; + + if (SDL_sscanf(line, "[slot %d]", &new_slot) == 1) { + if (slot >= 0) { + AddVirtualGamepadInfo(slot, &info); + } + slot = new_slot; + } else { + value = SDL_strchr(line, '='); + if (value) { + *value++ = '\0'; + + if (SDL_strcmp(line, "name") == 0) { + SDL_free(info.name); + info.name = SDL_strdup(value); + } else if (SDL_strcmp(line, "VID") == 0) { + info.vendor_id = (Uint16)SDL_strtoul(value, NULL, 0); + } else if (SDL_strcmp(line, "PID") == 0) { + info.product_id = (Uint16)SDL_strtoul(value, NULL, 0); + } else if (SDL_strcmp(line, "type") == 0) { + info.type = SDL_GetGameControllerTypeFromString(value); + } else if (SDL_strcmp(line, "handle") == 0) { + info.handle = SDL_strtoull(value, NULL, 0); + } + } + } + } + if (slot >= 0) { + AddVirtualGamepadInfo(slot, &info); + } + SDL_free(info.name); + SDL_free(data); + + SDL_steam_virtual_gamepad_info_file_mtime = mtime; + + return SDL_TRUE; +} + +const SDL_SteamVirtualGamepadInfo *SDL_GetSteamVirtualGamepadInfo(int slot) +{ + SDL_AssertJoysticksLocked(); + + if (slot < 0 || slot >= SDL_steam_virtual_gamepad_info_count) { + return NULL; + } + return SDL_steam_virtual_gamepad_info[slot]; +} + +void SDL_QuitSteamVirtualGamepadInfo(void) +{ + SDL_AssertJoysticksLocked(); + + if (SDL_steam_virtual_gamepad_info_file) { + SDL_FreeSteamVirtualGamepadInfo(); + SDL_free(SDL_steam_virtual_gamepad_info_file); + SDL_steam_virtual_gamepad_info_file = NULL; + } +} diff --git a/thirdparty/SDL/src/joystick/SDL_steam_virtual_gamepad.h b/thirdparty/SDL/src/joystick/SDL_steam_virtual_gamepad.h new file mode 100644 index 000000000..415643b67 --- /dev/null +++ b/thirdparty/SDL/src/joystick/SDL_steam_virtual_gamepad.h @@ -0,0 +1,36 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2024 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../SDL_internal.h" + +typedef struct SDL_SteamVirtualGamepadInfo +{ + Uint64 handle; + char *name; + Uint16 vendor_id; + Uint16 product_id; + SDL_GameControllerType type; +} SDL_SteamVirtualGamepadInfo; + +void SDL_InitSteamVirtualGamepadInfo(void); +SDL_bool SDL_SteamVirtualGamepadEnabled(void); +SDL_bool SDL_UpdateSteamVirtualGamepadInfo(void); +const SDL_SteamVirtualGamepadInfo *SDL_GetSteamVirtualGamepadInfo(int slot); +void SDL_QuitSteamVirtualGamepadInfo(void); diff --git a/thirdparty/SDL/src/joystick/SDL_sysjoystick.h b/thirdparty/SDL/src/joystick/SDL_sysjoystick.h index a93fa662c..173650e31 100644 --- a/thirdparty/SDL/src/joystick/SDL_sysjoystick.h +++ b/thirdparty/SDL/src/joystick/SDL_sysjoystick.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -79,6 +79,7 @@ struct _SDL_Joystick char *serial _guarded; /* Joystick serial */ SDL_JoystickGUID guid _guarded; /* Joystick guid */ Uint16 firmware_version _guarded; /* Firmware version, if available */ + Uint64 steam_handle _guarded; /* Steam controller API handle */ int naxes _guarded; /* Number of axis controls on the joystick */ SDL_JoystickAxisInfo *axes _guarded; @@ -167,6 +168,9 @@ typedef struct _SDL_JoystickDriver /* Function to get the device-dependent path of a joystick */ const char *(*GetDevicePath)(int device_index); + /* Function to get the Steam virtual gamepad slot of a joystick */ + int (*GetDeviceSteamVirtualGamepadSlot)(int device_index); + /* Function to get the player index of a joystick */ int (*GetDevicePlayerIndex)(int device_index); diff --git a/thirdparty/SDL/src/joystick/android/SDL_sysjoystick.c b/thirdparty/SDL/src/joystick/android/SDL_sysjoystick.c index 84822e4de..c29f7387b 100644 --- a/thirdparty/SDL/src/joystick/android/SDL_sysjoystick.c +++ b/thirdparty/SDL/src/joystick/android/SDL_sysjoystick.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -320,7 +320,7 @@ int Android_AddJoystick(int device_id, const char *name, const char *desc, int v } } - if (JoystickByDeviceId(device_id) != NULL || name == NULL) { + if (JoystickByDeviceId(device_id) != NULL || !name) { goto done; } @@ -344,7 +344,7 @@ int Android_AddJoystick(int device_id, const char *name, const char *desc, int v nhats = 0; } - guid = SDL_CreateJoystickGUID(SDL_HARDWARE_BUS_BLUETOOTH, vendor_id, product_id, 0, desc, 0, 0); + guid = SDL_CreateJoystickGUID(SDL_HARDWARE_BUS_BLUETOOTH, vendor_id, product_id, 0, NULL, desc, 0, 0); /* Update the GUID with capability bits */ { @@ -354,7 +354,7 @@ int Android_AddJoystick(int device_id, const char *name, const char *desc, int v } item = (SDL_joylist_item *)SDL_malloc(sizeof(SDL_joylist_item)); - if (item == NULL) { + if (!item) { goto done; } @@ -362,7 +362,7 @@ int Android_AddJoystick(int device_id, const char *name, const char *desc, int v item->guid = guid; item->device_id = device_id; item->name = SDL_CreateJoystickName(vendor_id, product_id, NULL, name); - if (item->name == NULL) { + if (!item->name) { SDL_free(item); goto done; } @@ -381,7 +381,7 @@ int Android_AddJoystick(int device_id, const char *name, const char *desc, int v item->nhats = nhats; item->nballs = nballs; item->device_instance = SDL_GetNextJoystickInstanceID(); - if (SDL_joylist_tail == NULL) { + if (!SDL_joylist_tail) { SDL_joylist = SDL_joylist_tail = item; } else { SDL_joylist_tail->next = item; @@ -414,7 +414,7 @@ int Android_RemoveJoystick(int device_id) SDL_LockJoysticks(); /* Don't call JoystickByDeviceId here or there'll be an infinite loop! */ - while (item != NULL) { + while (item) { if (item->device_id == device_id) { break; } @@ -422,7 +422,7 @@ int Android_RemoveJoystick(int device_id) item = item->next; } - if (item == NULL) { + if (!item) { goto done; } @@ -430,7 +430,7 @@ int Android_RemoveJoystick(int device_id) item->joystick->hwdata = NULL; } - if (prev != NULL) { + if (prev) { prev->next = item->next; } else { SDL_assert(SDL_joylist == item); @@ -512,7 +512,7 @@ static SDL_joylist_item *JoystickByDeviceId(int device_id) { SDL_joylist_item *item = SDL_joylist; - while (item != NULL) { + while (item) { if (item->device_id == device_id) { return item; } @@ -522,7 +522,7 @@ static SDL_joylist_item *JoystickByDeviceId(int device_id) /* Joystick not found, try adding it */ ANDROID_JoystickDetect(); - while (item != NULL) { + while (item) { if (item->device_id == device_id) { return item; } @@ -542,6 +542,11 @@ static const char *ANDROID_JoystickGetDevicePath(int device_index) return NULL; } +static int ANDROID_JoystickGetDeviceSteamVirtualGamepadSlot(int device_index) +{ + return -1; +} + static int ANDROID_JoystickGetDevicePlayerIndex(int device_index) { return -1; @@ -565,11 +570,11 @@ static int ANDROID_JoystickOpen(SDL_Joystick *joystick, int device_index) { SDL_joylist_item *item = JoystickByDevIndex(device_index); - if (item == NULL) { + if (!item) { return SDL_SetError("No such device"); } - if (item->joystick != NULL) { + if (item->joystick) { return SDL_SetError("Joystick already opened"); } @@ -618,7 +623,7 @@ static void ANDROID_JoystickUpdate(SDL_Joystick *joystick) { SDL_joylist_item *item = (SDL_joylist_item *)joystick->hwdata; - if (item == NULL) { + if (!item) { return; } @@ -682,6 +687,7 @@ SDL_JoystickDriver SDL_ANDROID_JoystickDriver = { ANDROID_JoystickDetect, ANDROID_JoystickGetDeviceName, ANDROID_JoystickGetDevicePath, + ANDROID_JoystickGetDeviceSteamVirtualGamepadSlot, ANDROID_JoystickGetDevicePlayerIndex, ANDROID_JoystickSetDevicePlayerIndex, ANDROID_JoystickGetDeviceGUID, diff --git a/thirdparty/SDL/src/joystick/android/SDL_sysjoystick_c.h b/thirdparty/SDL/src/joystick/android/SDL_sysjoystick_c.h index aa96f8736..189bcf4b3 100644 --- a/thirdparty/SDL/src/joystick/android/SDL_sysjoystick_c.h +++ b/thirdparty/SDL/src/joystick/android/SDL_sysjoystick_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/joystick/bsd/SDL_bsdjoystick.c b/thirdparty/SDL/src/joystick/bsd/SDL_bsdjoystick.c index 90a7f3959..3886fbfbb 100644 --- a/thirdparty/SDL/src/joystick/bsd/SDL_bsdjoystick.c +++ b/thirdparty/SDL/src/joystick/bsd/SDL_bsdjoystick.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -69,7 +69,7 @@ #include #endif -#if SDL_HAVE_MACHINE_JOYSTICK_H +#ifdef SDL_HAVE_MACHINE_JOYSTICK_H #include #endif @@ -298,7 +298,7 @@ CreateHwData(const char *path) hw = (struct joystick_hwdata *) SDL_calloc(1, sizeof(struct joystick_hwdata)); - if (hw == NULL) { + if (!hw) { close(fd); SDL_OutOfMemory(); return NULL; @@ -321,7 +321,7 @@ CreateHwData(const char *path) } } hw->repdesc = hid_get_report_desc(fd); - if (hw->repdesc == NULL) { + if (!hw->repdesc) { SDL_SetError("%s: USB_GET_REPORT_DESC: %s", path, strerror(errno)); goto usberr; @@ -348,7 +348,7 @@ CreateHwData(const char *path) #else hdata = hid_start_parse(hw->repdesc, 1 << hid_input); #endif - if (hdata == NULL) { + if (!hdata) { SDL_SetError("%s: Cannot start HID parser", path); goto usberr; } @@ -428,7 +428,7 @@ static int MaybeAddDevice(const char *path) SDL_joylist_item *item; struct joystick_hwdata *hw; - if (path == NULL) { + if (!path) { return -1; } @@ -437,14 +437,14 @@ static int MaybeAddDevice(const char *path) } /* Check to make sure it's not already in list. */ - for (item = SDL_joylist; item != NULL; item = item->next) { + for (item = SDL_joylist; item; item = item->next) { if (sb.st_rdev == item->devnum) { return -1; /* already have this one */ } } hw = CreateHwData(path); - if (hw == NULL) { + if (!hw) { return -1; } @@ -456,7 +456,7 @@ static int MaybeAddDevice(const char *path) struct usb_device_info di; if (ioctl(hw->fd, USB_GET_DEVICEINFO, &di) != -1) { name = SDL_CreateJoystickName(di.udi_vendorNo, di.udi_productNo, di.udi_vendor, di.udi_product); - guid = SDL_CreateJoystickGUID(SDL_HARDWARE_BUS_USB, di.udi_vendorNo, di.udi_productNo, di.udi_releaseNo, name, 0, 0); + guid = SDL_CreateJoystickGUID(SDL_HARDWARE_BUS_USB, di.udi_vendorNo, di.udi_productNo, di.udi_releaseNo, di.udi_vendor, di.udi_product, 0, 0); #ifdef SDL_JOYSTICK_HIDAPI if (HIDAPI_IsDevicePresent(di.udi_vendorNo, di.udi_productNo, di.udi_releaseNo, name)) { @@ -474,14 +474,14 @@ static int MaybeAddDevice(const char *path) } #endif /* USB_GET_DEVICEINFO */ } - if (name == NULL) { + if (!name) { name = SDL_strdup(path); guid = SDL_CreateJoystickGUIDForName(name); } FreeHwData(hw); item = (SDL_joylist_item *)SDL_calloc(1, sizeof(SDL_joylist_item)); - if (item == NULL) { + if (!item) { SDL_free(name); return -1; } @@ -491,13 +491,13 @@ static int MaybeAddDevice(const char *path) item->name = name; item->guid = guid; - if ((item->path == NULL) || (item->name == NULL)) { + if ((!item->path) || (!item->name)) { FreeJoylistItem(item); return -1; } item->device_instance = SDL_GetNextJoystickInstanceID(); - if (SDL_joylist_tail == NULL) { + if (!SDL_joylist_tail) { SDL_joylist = SDL_joylist_tail = item; } else { SDL_joylist_tail->next = item; @@ -574,6 +574,11 @@ static const char *BSD_JoystickGetDevicePath(int device_index) return JoystickByDevIndex(device_index)->path; } +static int BSD_JoystickGetDeviceSteamVirtualGamepadSlot(int device_index) +{ + return -1; +} + static int BSD_JoystickGetDevicePlayerIndex(int device_index) { return -1; @@ -613,12 +618,12 @@ static int BSD_JoystickOpen(SDL_Joystick *joy, int device_index) SDL_joylist_item *item = JoystickByDevIndex(device_index); struct joystick_hwdata *hw; - if (item == NULL) { + if (!item) { return SDL_SetError("No such device"); } hw = CreateHwData(item->path); - if (hw == NULL) { + if (!hw) { return -1; } @@ -693,7 +698,7 @@ static void BSD_JoystickUpdate(SDL_Joystick *joy) #else hdata = hid_start_parse(joy->hwdata->repdesc, 1 << hid_input); #endif - if (hdata == NULL) { + if (!hdata) { /*fprintf(stderr, "%s: Cannot start HID parser\n", joy->hwdata->path);*/ continue; } @@ -782,7 +787,7 @@ static int report_alloc(struct report *r, struct report_desc *rd, int repind) #ifdef __DragonFly__ len = hid_report_size(rd, repinfo[repind].kind, r->rid); -#elif __FREEBSD__ +#elif defined(__FREEBSD__) #if (__FreeBSD_kernel_version >= 460000) || defined(__FreeBSD_kernel__) #if (__FreeBSD_kernel_version <= 500111) len = hid_report_size(rd, r->rid, repinfo[repind].kind); @@ -812,7 +817,7 @@ static int report_alloc(struct report *r, struct report_desc *rd, int repind) r->buf = SDL_malloc(sizeof(*r->buf) - sizeof(REP_BUF_DATA(r)) + r->size); #endif - if (r->buf == NULL) { + if (!r->buf) { return SDL_OutOfMemory(); } } else { @@ -870,6 +875,7 @@ SDL_JoystickDriver SDL_BSD_JoystickDriver = { BSD_JoystickDetect, BSD_JoystickGetDeviceName, BSD_JoystickGetDevicePath, + BSD_JoystickGetDeviceSteamVirtualGamepadSlot, BSD_JoystickGetDevicePlayerIndex, BSD_JoystickSetDevicePlayerIndex, BSD_JoystickGetDeviceGUID, diff --git a/thirdparty/SDL/src/joystick/controller_list.h b/thirdparty/SDL/src/joystick/controller_list.h index a11107287..79446c5ca 100644 --- a/thirdparty/SDL/src/joystick/controller_list.h +++ b/thirdparty/SDL/src/joystick/controller_list.h @@ -24,6 +24,7 @@ static const ControllerDescription_t arrControllers[] = { { MAKE_CONTROLLER_ID( 0x0079, 0x1844 ), k_eControllerType_PS3Controller, NULL }, // From SDL { MAKE_CONTROLLER_ID( 0x044f, 0xb315 ), k_eControllerType_PS3Controller, NULL }, // Firestorm Dual Analog 3 { MAKE_CONTROLLER_ID( 0x044f, 0xd007 ), k_eControllerType_PS3Controller, NULL }, // Thrustmaster wireless 3-1 + { MAKE_CONTROLLER_ID( 0x046d, 0xcad1 ), k_eControllerType_PS3Controller, NULL }, // Logitech Chillstream //{ MAKE_CONTROLLER_ID( 0x046d, 0xc24f ), k_eControllerType_PS3Controller, NULL }, // Logitech G29 (PS3) { MAKE_CONTROLLER_ID( 0x054c, 0x0268 ), k_eControllerType_PS3Controller, NULL }, // Sony PS3 Controller { MAKE_CONTROLLER_ID( 0x056e, 0x200f ), k_eControllerType_PS3Controller, NULL }, // From SDL @@ -44,7 +45,6 @@ static const ControllerDescription_t arrControllers[] = { { MAKE_CONTROLLER_ID( 0x0e6f, 0x0109 ), k_eControllerType_PS3Controller, NULL }, // PDP Versus Fighting Pad { MAKE_CONTROLLER_ID( 0x0e6f, 0x011e ), k_eControllerType_PS3Controller, NULL }, // Rock Candy PS4 { MAKE_CONTROLLER_ID( 0x0e6f, 0x0128 ), k_eControllerType_PS3Controller, NULL }, // Rock Candy PS3 - { MAKE_CONTROLLER_ID( 0x0e6f, 0x0203 ), k_eControllerType_PS3Controller, NULL }, // Victrix Pro FS (PS4 peripheral but no trackpad/lightbar) { MAKE_CONTROLLER_ID( 0x0e6f, 0x0214 ), k_eControllerType_PS3Controller, NULL }, // afterglow ps3 { MAKE_CONTROLLER_ID( 0x0e6f, 0x1314 ), k_eControllerType_PS3Controller, NULL }, // PDP Afterglow Wireless PS3 controller { MAKE_CONTROLLER_ID( 0x0e6f, 0x6302 ), k_eControllerType_PS3Controller, NULL }, // From SDL @@ -69,7 +69,7 @@ static const ControllerDescription_t arrControllers[] = { { MAKE_CONTROLLER_ID( 0x20d6, 0x576d ), k_eControllerType_PS3Controller, NULL }, // Power A PS3 { MAKE_CONTROLLER_ID( 0x20d6, 0xca6d ), k_eControllerType_PS3Controller, NULL }, // From SDL { MAKE_CONTROLLER_ID( 0x2563, 0x0523 ), k_eControllerType_PS3Controller, NULL }, // Digiflip GP006 - { MAKE_CONTROLLER_ID( 0x2563, 0x0575 ), k_eControllerType_PS3Controller, NULL }, // From SDL + { MAKE_CONTROLLER_ID( 0x2563, 0x0575 ), k_eControllerType_PS3Controller, "Retro-bit Controller" }, // SWITCH CO., LTD. Retro-bit Controller { MAKE_CONTROLLER_ID( 0x25f0, 0x83c3 ), k_eControllerType_PS3Controller, NULL }, // gioteck vx2 { MAKE_CONTROLLER_ID( 0x25f0, 0xc121 ), k_eControllerType_PS3Controller, NULL }, // { MAKE_CONTROLLER_ID( 0x2c22, 0x2003 ), k_eControllerType_PS3Controller, NULL }, // Qanba Drone @@ -96,7 +96,9 @@ static const ControllerDescription_t arrControllers[] = { { MAKE_CONTROLLER_ID( 0x0c12, 0x0ef6 ), k_eControllerType_PS4Controller, NULL }, // Hitbox Arcade Stick { MAKE_CONTROLLER_ID( 0x0c12, 0x1cf6 ), k_eControllerType_PS4Controller, NULL }, // EMIO PS4 Elite Controller { MAKE_CONTROLLER_ID( 0x0c12, 0x1e10 ), k_eControllerType_PS4Controller, NULL }, // P4 Wired Gamepad generic knock off - lightbar but not trackpad or gyro - { MAKE_CONTROLLER_ID( 0x0e6f, 0x0207 ), k_eControllerType_PS4Controller, NULL }, // Victrix Pro Fightstick w/ Touchpad for PS4 + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0203 ), k_eControllerType_PS4Controller, NULL }, // Victrix Pro FS (PS4 peripheral but no trackpad/lightbar) + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0207 ), k_eControllerType_PS4Controller, NULL }, // Victrix Pro FS V2 w/ Touchpad for PS4 + { MAKE_CONTROLLER_ID( 0x0e6f, 0x020a ), k_eControllerType_PS4Controller, NULL }, // Victrix Pro FS PS4/PS5 (PS4 mode) { MAKE_CONTROLLER_ID( 0x0f0d, 0x0055 ), k_eControllerType_PS4Controller, NULL }, // HORIPAD 4 FPS { MAKE_CONTROLLER_ID( 0x0f0d, 0x005e ), k_eControllerType_PS4Controller, NULL }, // HORI Fighting Commander 4 PS4 { MAKE_CONTROLLER_ID( 0x0f0d, 0x0066 ), k_eControllerType_PS4Controller, NULL }, // HORIPAD 4 FPS Plus @@ -140,6 +142,8 @@ static const ControllerDescription_t arrControllers[] = { { MAKE_CONTROLLER_ID( 0x2c22, 0x2303 ), k_eControllerType_XInputPS4Controller, NULL }, // Qanba Obsidian Arcade Joystick { MAKE_CONTROLLER_ID( 0x2c22, 0x2500 ), k_eControllerType_PS4Controller, NULL }, // Qanba Dragon { MAKE_CONTROLLER_ID( 0x2c22, 0x2503 ), k_eControllerType_XInputPS4Controller, NULL }, // Qanba Dragon Arcade Joystick + { MAKE_CONTROLLER_ID( 0x3285, 0x0d16 ), k_eControllerType_PS4Controller, NULL }, // NACON Revolution 5 Pro (PS4 mode with dongle) + { MAKE_CONTROLLER_ID( 0x3285, 0x0d17 ), k_eControllerType_PS4Controller, NULL }, // NACON Revolution 5 Pro (PS4 mode wired) { MAKE_CONTROLLER_ID( 0x7545, 0x0104 ), k_eControllerType_PS4Controller, NULL }, // Armor 3 or Level Up Cobra - At least one variant has gyro { MAKE_CONTROLLER_ID (0x9886, 0x0024 ), k_eControllerType_XInputPS4Controller, NULL }, // Astro C40 in Xbox 360 mode { MAKE_CONTROLLER_ID( 0x9886, 0x0025 ), k_eControllerType_PS4Controller, NULL }, // Astro C40 @@ -148,10 +152,15 @@ static const ControllerDescription_t arrControllers[] = { { MAKE_CONTROLLER_ID( 0x054c, 0x0ce6 ), k_eControllerType_PS5Controller, NULL }, // Sony DualSense Controller { MAKE_CONTROLLER_ID( 0x054c, 0x0df2 ), k_eControllerType_PS5Controller, NULL }, // Sony DualSense Edge Controller + { MAKE_CONTROLLER_ID( 0x054c, 0x0e5f ), k_eControllerType_PS5Controller, NULL }, // Access Controller for PS5 + { MAKE_CONTROLLER_ID( 0x0e6f, 0x0209 ), k_eControllerType_PS5Controller, NULL }, // Victrix Pro FS PS4/PS5 (PS5 mode) { MAKE_CONTROLLER_ID( 0x0f0d, 0x0163 ), k_eControllerType_PS5Controller, NULL }, // HORI Fighting Commander OCTA { MAKE_CONTROLLER_ID( 0x0f0d, 0x0184 ), k_eControllerType_PS5Controller, NULL }, // Hori Fighting Stick α { MAKE_CONTROLLER_ID( 0x1532, 0x100b ), k_eControllerType_PS5Controller, NULL }, // Razer Wolverine V2 Pro (Wired) { MAKE_CONTROLLER_ID( 0x1532, 0x100c ), k_eControllerType_PS5Controller, NULL }, // Razer Wolverine V2 Pro (Wireless) + { MAKE_CONTROLLER_ID( 0x1532, 0x1012 ), k_eControllerType_PS5Controller, NULL }, // Razer Kitsune + { MAKE_CONTROLLER_ID( 0x3285, 0x0d18 ), k_eControllerType_PS5Controller, NULL }, // NACON Revolution 5 Pro (PS5 mode with dongle) + { MAKE_CONTROLLER_ID( 0x3285, 0x0d19 ), k_eControllerType_PS5Controller, NULL }, // NACON Revolution 5 Pro (PS5 mode wired) { MAKE_CONTROLLER_ID( 0x358a, 0x0104 ), k_eControllerType_PS5Controller, NULL }, // Backbone One PlayStation Edition for iOS { MAKE_CONTROLLER_ID( 0x0079, 0x0006 ), k_eControllerType_UnknownNonSteamController, NULL }, // DragonRise Generic USB PCB, sometimes configured as a PC Twin Shock Controller - looks like a DS3 but the face buttons are 1-4 instead of symbols @@ -163,7 +172,7 @@ static const ControllerDescription_t arrControllers[] = { { MAKE_CONTROLLER_ID( 0x045e, 0x028f ), k_eControllerType_XBox360Controller, "Xbox 360 Controller" }, // Microsoft X-Box 360 pad v2 { MAKE_CONTROLLER_ID( 0x045e, 0x0291 ), k_eControllerType_XBox360Controller, "Xbox 360 Wireless Controller" }, // Xbox 360 Wireless Receiver (XBOX) { MAKE_CONTROLLER_ID( 0x045e, 0x02a0 ), k_eControllerType_XBox360Controller, NULL }, // Microsoft X-Box 360 Big Button IR - { MAKE_CONTROLLER_ID( 0x045e, 0x02a1 ), k_eControllerType_XBox360Controller, NULL }, // Microsoft X-Box 360 Wireless Controller with XUSB driver on Windows + { MAKE_CONTROLLER_ID( 0x045e, 0x02a1 ), k_eControllerType_XBox360Controller, "Xbox 360 Wireless Controller" }, // Xbox 360 Wireless Controller with XUSB driver on Windows { MAKE_CONTROLLER_ID( 0x045e, 0x02a9 ), k_eControllerType_XBox360Controller, "Xbox 360 Wireless Controller" }, // Xbox 360 Wireless Receiver (third party knockoff) { MAKE_CONTROLLER_ID( 0x045e, 0x0719 ), k_eControllerType_XBox360Controller, "Xbox 360 Wireless Controller" }, // Xbox 360 Wireless Receiver { MAKE_CONTROLLER_ID( 0x046d, 0xc21d ), k_eControllerType_XBox360Controller, NULL }, // Logitech Gamepad F310 @@ -302,7 +311,7 @@ static const ControllerDescription_t arrControllers[] = { { MAKE_CONTROLLER_ID( 0x045e, 0x02e3 ), k_eControllerType_XBoxOneController, "Xbox One Elite Controller" }, // Microsoft X-Box One Elite pad { MAKE_CONTROLLER_ID( 0x045e, 0x02ea ), k_eControllerType_XBoxOneController, "Xbox One S Controller" }, // Microsoft X-Box One S pad { MAKE_CONTROLLER_ID( 0x045e, 0x02fd ), k_eControllerType_XBoxOneController, "Xbox One S Controller" }, // Microsoft X-Box One S pad (Bluetooth) - { MAKE_CONTROLLER_ID( 0x045e, 0x02ff ), k_eControllerType_XBoxOneController, NULL }, // Microsoft X-Box One controller with XBOXGIP driver on Windows + { MAKE_CONTROLLER_ID( 0x045e, 0x02ff ), k_eControllerType_XBoxOneController, "Xbox One Controller" }, // Microsoft X-Box One controller with XBOXGIP driver on Windows { MAKE_CONTROLLER_ID( 0x045e, 0x0b00 ), k_eControllerType_XBoxOneController, "Xbox One Elite 2 Controller" }, // Microsoft X-Box One Elite Series 2 pad // { MAKE_CONTROLLER_ID( 0x045e, 0x0b02 ), k_eControllerType_XBoxOneController, "Xbox One Elite 2 Controller" }, // The virtual keyboard generated by XboxGip drivers for Xbox One Controllers (see https://github.com/libsdl-org/SDL/pull/5121 for details) { MAKE_CONTROLLER_ID( 0x045e, 0x0b05 ), k_eControllerType_XBoxOneController, "Xbox One Elite 2 Controller" }, // Microsoft X-Box One Elite Series 2 pad (Bluetooth) @@ -586,7 +595,9 @@ static const ControllerDescription_t arrControllers[] = { { MAKE_CONTROLLER_ID( 0x28de, 0x1102 ), k_eControllerType_SteamController, NULL }, // Valve wired Steam Controller (D0G) { MAKE_CONTROLLER_ID( 0x28de, 0x1105 ), k_eControllerType_SteamController, NULL }, // Valve Bluetooth Steam Controller (D0G) { MAKE_CONTROLLER_ID( 0x28de, 0x1106 ), k_eControllerType_SteamController, NULL }, // Valve Bluetooth Steam Controller (D0G) + { MAKE_CONTROLLER_ID( 0x28de, 0x11ff ), k_eControllerType_UnknownNonSteamController, NULL }, // Steam Virtual Gamepad { MAKE_CONTROLLER_ID( 0x28de, 0x1142 ), k_eControllerType_SteamController, NULL }, // Valve wireless Steam Controller { MAKE_CONTROLLER_ID( 0x28de, 0x1201 ), k_eControllerType_SteamControllerV2, NULL }, // Valve wired Steam Controller (HEADCRAB) { MAKE_CONTROLLER_ID( 0x28de, 0x1202 ), k_eControllerType_SteamControllerV2, NULL }, // Valve Bluetooth Steam Controller (HEADCRAB) + { MAKE_CONTROLLER_ID( 0x28de, 0x1205 ), k_eControllerType_SteamDeck, NULL }, // Valve Steam Deck Builtin Controller }; diff --git a/thirdparty/SDL/src/joystick/controller_type.h b/thirdparty/SDL/src/joystick/controller_type.h index 9ec6c57ee..ead45f109 100644 --- a/thirdparty/SDL/src/joystick/controller_type.h +++ b/thirdparty/SDL/src/joystick/controller_type.h @@ -37,6 +37,7 @@ typedef enum k_eControllerType_UnknownSteamController = 1, k_eControllerType_SteamController = 2, k_eControllerType_SteamControllerV2 = 3, + k_eControllerType_SteamDeck = 4, // Other Controllers k_eControllerType_UnknownNonSteamController = 30, diff --git a/thirdparty/SDL/src/joystick/darwin/SDL_iokitjoystick.c b/thirdparty/SDL/src/joystick/darwin/SDL_iokitjoystick.c index 0ac9b5061..493f81640 100644 --- a/thirdparty/SDL/src/joystick/darwin/SDL_iokitjoystick.c +++ b/thirdparty/SDL/src/joystick/darwin/SDL_iokitjoystick.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -42,7 +42,7 @@ static recDevice *gpDeviceList = NULL; void FreeRumbleEffectData(FFEFFECT *effect) { - if (effect == NULL) { + if (!effect) { return; } SDL_free(effect->rgdwAxes); @@ -58,7 +58,7 @@ FFEFFECT *CreateRumbleEffectData(Sint16 magnitude) /* Create the effect */ effect = (FFEFFECT *)SDL_calloc(1, sizeof(*effect)); - if (effect == NULL) { + if (!effect) { return NULL; } effect->dwSize = sizeof(*effect); @@ -82,7 +82,7 @@ FFEFFECT *CreateRumbleEffectData(Sint16 magnitude) effect->dwFlags |= FFEFF_CARTESIAN; periodic = (FFPERIODIC *)SDL_calloc(1, sizeof(*periodic)); - if (periodic == NULL) { + if (!periodic) { FreeRumbleEffectData(effect); return NULL; } @@ -237,7 +237,7 @@ static void JoystickDeviceWasRemovedCallback(void *ctx, IOReturn result, void *s device->ffdevice = NULL; device->ff_initialized = SDL_FALSE; } -#if SDL_HAPTIC_IOKIT +#ifdef SDL_HAPTIC_IOKIT MacHaptic_MaybeRemoveDevice(device->ffservice); #endif @@ -407,6 +407,19 @@ static void AddHIDElement(const void *value, void *parameter) } } +static int GetSteamVirtualGamepadSlot(Uint16 vendor_id, Uint16 product_id, const char *product_string) +{ + int slot = -1; + + if (vendor_id == USB_VENDOR_MICROSOFT && product_id == USB_PRODUCT_XBOX360_WIRED_CONTROLLER) { + /* Gamepad name is "GamePad-N", where N is slot + 1 */ + if (SDL_sscanf(product_string, "GamePad-%d", &slot) == 1) { + slot -= 1; + } + } + return slot; +} + static SDL_bool GetDeviceInfo(IOHIDDeviceRef hidDevice, recDevice *pDevice) { Sint32 vendor = 0; @@ -486,7 +499,8 @@ static SDL_bool GetDeviceInfo(IOHIDDeviceRef hidDevice, recDevice *pDevice) } #endif - pDevice->guid = SDL_CreateJoystickGUID(SDL_HARDWARE_BUS_USB, (Uint16)vendor, (Uint16)product, (Uint16)version, pDevice->product, 0, 0); + pDevice->guid = SDL_CreateJoystickGUID(SDL_HARDWARE_BUS_USB, (Uint16)vendor, (Uint16)product, (Uint16)version, manufacturer_string, product_string, 0, 0); + pDevice->steam_virtual_gamepad_slot = GetSteamVirtualGamepadSlot((Uint16)vendor, (Uint16)product, product_string); array = IOHIDDeviceCopyMatchingElements(hidDevice, NULL, kIOHIDOptionsTypeNone); if (array) { @@ -508,7 +522,7 @@ static SDL_bool JoystickAlreadyKnown(IOHIDDeviceRef ioHIDDeviceObject) } #endif - for (i = gpDeviceList; i != NULL; i = i->pNext) { + for (i = gpDeviceList; i; i = i->pNext) { if (i->deviceRef == ioHIDDeviceObject) { return SDL_TRUE; } @@ -530,7 +544,7 @@ static void JoystickDeviceWasAddedCallback(void *ctx, IOReturn res, void *sender } device = (recDevice *)SDL_calloc(1, sizeof(recDevice)); - if (device == NULL) { + if (!device) { SDL_OutOfMemory(); return; } @@ -557,19 +571,19 @@ static void JoystickDeviceWasAddedCallback(void *ctx, IOReturn res, void *sender ioservice = IOHIDDeviceGetService(ioHIDDeviceObject); if ((ioservice) && (FFIsForceFeedback(ioservice) == FF_OK)) { device->ffservice = ioservice; -#if SDL_HAPTIC_IOKIT +#ifdef SDL_HAPTIC_IOKIT MacHaptic_MaybeAddDevice(ioservice); #endif } /* Add device to the end of the list */ - if (gpDeviceList == NULL) { + if (!gpDeviceList) { gpDeviceList = device; } else { recDevice *curdevice; curdevice = gpDeviceList; - while (curdevice->pNext != NULL) { + while (curdevice->pNext) { curdevice = curdevice->pNext; } curdevice->pNext = device; @@ -657,8 +671,8 @@ static SDL_bool CreateHIDManager(void) static int DARWIN_JoystickInit(void) { - if (gpDeviceList) { - return SDL_SetError("Joystick: Device list already inited."); + if (!SDL_GetHintBoolean(SDL_HINT_JOYSTICK_IOKIT, SDL_TRUE)) { + return 0; } if (!CreateHIDManager()) { @@ -694,10 +708,12 @@ static void DARWIN_JoystickDetect(void) } } - /* run this after the checks above so we don't set device->removed and delete the device before - DARWIN_JoystickUpdate can run to clean up the SDL_Joystick object that owns this device */ - while (CFRunLoopRunInMode(SDL_JOYSTICK_RUNLOOP_MODE, 0, TRUE) == kCFRunLoopRunHandledSource) { - /* no-op. Pending callbacks will fire in CFRunLoopRunInMode(). */ + if (hidman) { + /* run this after the checks above so we don't set device->removed and delete the device before + DARWIN_JoystickUpdate can run to clean up the SDL_Joystick object that owns this device */ + while (CFRunLoopRunInMode(SDL_JOYSTICK_RUNLOOP_MODE, 0, TRUE) == kCFRunLoopRunHandledSource) { + /* no-op. Pending callbacks will fire in CFRunLoopRunInMode(). */ + } } } @@ -712,6 +728,12 @@ const char *DARWIN_JoystickGetDevicePath(int device_index) return NULL; } +static int DARWIN_JoystickGetDeviceSteamVirtualGamepadSlot(int device_index) +{ + recDevice *device = GetDeviceForIndex(device_index); + return device ? device->steam_virtual_gamepad_slot : -1; +} + static int DARWIN_JoystickGetDevicePlayerIndex(int device_index) { return -1; @@ -854,7 +876,7 @@ static int DARWIN_JoystickRumble(SDL_Joystick *joystick, Uint16 low_frequency_ru /* Scale and average the two rumble strengths */ Sint16 magnitude = (Sint16)(((low_frequency_rumble / 2) + (high_frequency_rumble / 2)) / 2); - if (device == NULL) { + if (!device) { return SDL_SetError("Rumble failed, device disconnected"); } @@ -895,7 +917,7 @@ static Uint32 DARWIN_JoystickGetCapabilities(SDL_Joystick *joystick) recDevice *device = joystick->hwdata; Uint32 result = 0; - if (device == NULL) { + if (!device) { return 0; } @@ -928,7 +950,7 @@ static void DARWIN_JoystickUpdate(SDL_Joystick *joystick) SInt32 value, range; int i, goodRead = SDL_FALSE; - if (device == NULL) { + if (!device) { return; } @@ -1057,6 +1079,7 @@ SDL_JoystickDriver SDL_DARWIN_JoystickDriver = { DARWIN_JoystickDetect, DARWIN_JoystickGetDeviceName, DARWIN_JoystickGetDevicePath, + DARWIN_JoystickGetDeviceSteamVirtualGamepadSlot, DARWIN_JoystickGetDevicePlayerIndex, DARWIN_JoystickSetDevicePlayerIndex, DARWIN_JoystickGetDeviceGUID, diff --git a/thirdparty/SDL/src/joystick/darwin/SDL_iokitjoystick_c.h b/thirdparty/SDL/src/joystick/darwin/SDL_iokitjoystick_c.h index aec255072..095c08322 100644 --- a/thirdparty/SDL/src/joystick/darwin/SDL_iokitjoystick_c.h +++ b/thirdparty/SDL/src/joystick/darwin/SDL_iokitjoystick_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -71,6 +71,7 @@ struct joystick_hwdata int instance_id; SDL_JoystickGUID guid; + int steam_virtual_gamepad_slot; struct joystick_hwdata *pNext; /* next device */ }; diff --git a/thirdparty/SDL/src/joystick/dummy/SDL_sysjoystick.c b/thirdparty/SDL/src/joystick/dummy/SDL_sysjoystick.c index bf1284d61..1ade8e1b5 100644 --- a/thirdparty/SDL/src/joystick/dummy/SDL_sysjoystick.c +++ b/thirdparty/SDL/src/joystick/dummy/SDL_sysjoystick.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -52,6 +52,11 @@ static const char *DUMMY_JoystickGetDevicePath(int device_index) return NULL; } +static int DUMMY_JoystickGetDeviceSteamVirtualGamepadSlot(int device_index) +{ + return -1; +} + static int DUMMY_JoystickGetDevicePlayerIndex(int device_index) { return -1; @@ -131,6 +136,7 @@ SDL_JoystickDriver SDL_DUMMY_JoystickDriver = { DUMMY_JoystickDetect, DUMMY_JoystickGetDeviceName, DUMMY_JoystickGetDevicePath, + DUMMY_JoystickGetDeviceSteamVirtualGamepadSlot, DUMMY_JoystickGetDevicePlayerIndex, DUMMY_JoystickSetDevicePlayerIndex, DUMMY_JoystickGetDeviceGUID, diff --git a/thirdparty/SDL/src/joystick/emscripten/SDL_sysjoystick.c b/thirdparty/SDL/src/joystick/emscripten/SDL_sysjoystick.c index 81544fd4e..a2db803ff 100644 --- a/thirdparty/SDL/src/joystick/emscripten/SDL_sysjoystick.c +++ b/thirdparty/SDL/src/joystick/emscripten/SDL_sysjoystick.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -37,7 +37,6 @@ static SDL_joylist_item *JoystickByIndex(int index); static SDL_joylist_item *SDL_joylist = NULL; static SDL_joylist_item *SDL_joylist_tail = NULL; static int numjoysticks = 0; -static int instance_counter = 0; static EM_BOOL Emscripten_JoyStickConnected(int eventType, const EmscriptenGamepadEvent *gamepadEvent, void *userData) { @@ -50,7 +49,7 @@ static EM_BOOL Emscripten_JoyStickConnected(int eventType, const EmscriptenGamep } item = (SDL_joylist_item *)SDL_malloc(sizeof(SDL_joylist_item)); - if (item == NULL) { + if (!item) { return 1; } @@ -58,13 +57,13 @@ static EM_BOOL Emscripten_JoyStickConnected(int eventType, const EmscriptenGamep item->index = gamepadEvent->index; item->name = SDL_CreateJoystickName(0, 0, NULL, gamepadEvent->id); - if (item->name == NULL) { + if (!item->name) { SDL_free(item); return 1; } item->mapping = SDL_strdup(gamepadEvent->mapping); - if (item->mapping == NULL) { + if (!item->mapping) { SDL_free(item->name); SDL_free(item); return 1; @@ -72,7 +71,7 @@ static EM_BOOL Emscripten_JoyStickConnected(int eventType, const EmscriptenGamep item->naxes = gamepadEvent->numAxes; item->nbuttons = gamepadEvent->numButtons; - item->device_instance = instance_counter++; + item->device_instance = SDL_GetNextJoystickInstanceID(); item->timestamp = gamepadEvent->timestamp; @@ -85,7 +84,7 @@ static EM_BOOL Emscripten_JoyStickConnected(int eventType, const EmscriptenGamep item->digitalButton[i] = gamepadEvent->digitalButton[i]; } - if (SDL_joylist_tail == NULL) { + if (!SDL_joylist_tail) { SDL_joylist = SDL_joylist_tail = item; } else { SDL_joylist_tail->next = item; @@ -112,7 +111,7 @@ static EM_BOOL Emscripten_JoyStickDisconnected(int eventType, const EmscriptenGa SDL_joylist_item *item = SDL_joylist; SDL_joylist_item *prev = NULL; - while (item != NULL) { + while (item) { if (item->index == gamepadEvent->index) { break; } @@ -120,7 +119,7 @@ static EM_BOOL Emscripten_JoyStickDisconnected(int eventType, const EmscriptenGa item = item->next; } - if (item == NULL) { + if (!item) { return 1; } @@ -128,7 +127,7 @@ static EM_BOOL Emscripten_JoyStickDisconnected(int eventType, const EmscriptenGa item->joystick->hwdata = NULL; } - if (prev != NULL) { + if (prev) { prev->next = item->next; } else { SDL_assert(SDL_joylist == item); @@ -168,7 +167,6 @@ static void EMSCRIPTEN_JoystickQuit(void) SDL_joylist = SDL_joylist_tail = NULL; numjoysticks = 0; - instance_counter = 0; emscripten_set_gamepadconnected_callback(NULL, 0, NULL); emscripten_set_gamepaddisconnected_callback(NULL, 0, NULL); @@ -247,7 +245,7 @@ static SDL_joylist_item *JoystickByIndex(int index) return NULL; } - while (item != NULL) { + while (item) { if (item->index == index) { break; } @@ -276,6 +274,11 @@ static const char *EMSCRIPTEN_JoystickGetDevicePath(int device_index) return NULL; } +static int EMSCRIPTEN_JoystickGetDeviceSteamVirtualGamepadSlot(int device_index) +{ + return -1; +} + static int EMSCRIPTEN_JoystickGetDevicePlayerIndex(int device_index) { return -1; @@ -299,11 +302,11 @@ static int EMSCRIPTEN_JoystickOpen(SDL_Joystick *joystick, int device_index) { SDL_joylist_item *item = JoystickByDeviceIndex(device_index); - if (item == NULL) { + if (!item) { return SDL_SetError("No such device"); } - if (item->joystick != NULL) { + if (item->joystick) { return SDL_SetError("Joystick already opened"); } @@ -423,6 +426,7 @@ SDL_JoystickDriver SDL_EMSCRIPTEN_JoystickDriver = { EMSCRIPTEN_JoystickDetect, EMSCRIPTEN_JoystickGetDeviceName, EMSCRIPTEN_JoystickGetDevicePath, + EMSCRIPTEN_JoystickGetDeviceSteamVirtualGamepadSlot, EMSCRIPTEN_JoystickGetDevicePlayerIndex, EMSCRIPTEN_JoystickSetDevicePlayerIndex, EMSCRIPTEN_JoystickGetDeviceGUID, diff --git a/thirdparty/SDL/src/joystick/emscripten/SDL_sysjoystick_c.h b/thirdparty/SDL/src/joystick/emscripten/SDL_sysjoystick_c.h index c9a2674cd..6e9b64948 100644 --- a/thirdparty/SDL/src/joystick/emscripten/SDL_sysjoystick_c.h +++ b/thirdparty/SDL/src/joystick/emscripten/SDL_sysjoystick_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/joystick/haiku/SDL_haikujoystick.cc b/thirdparty/SDL/src/joystick/haiku/SDL_haikujoystick.cc index 37e89c334..5c313636f 100644 --- a/thirdparty/SDL/src/joystick/haiku/SDL_haikujoystick.cc +++ b/thirdparty/SDL/src/joystick/haiku/SDL_haikujoystick.cc @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -102,6 +102,11 @@ extern "C" return SDL_joyport[device_index]; } + static int HAIKU_JoystickGetDeviceSteamVirtualGamepadSlot(int device_index) + { + return -1; + } + static int HAIKU_JoystickGetDevicePlayerIndex(int device_index) { return -1; @@ -299,6 +304,7 @@ extern "C" HAIKU_JoystickDetect, HAIKU_JoystickGetDeviceName, HAIKU_JoystickGetDevicePath, + HAIKU_JoystickGetDeviceSteamVirtualGamepadSlot, HAIKU_JoystickGetDevicePlayerIndex, HAIKU_JoystickSetDevicePlayerIndex, HAIKU_JoystickGetDeviceGUID, diff --git a/thirdparty/SDL/src/joystick/hidapi/SDL_hidapi_combined.c b/thirdparty/SDL/src/joystick/hidapi/SDL_hidapi_combined.c index ccf1662a8..94ab75c1d 100644 --- a/thirdparty/SDL/src/joystick/hidapi/SDL_hidapi_combined.c +++ b/thirdparty/SDL/src/joystick/hidapi/SDL_hidapi_combined.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/joystick/hidapi/SDL_hidapi_gamecube.c b/thirdparty/SDL/src/joystick/hidapi/SDL_hidapi_gamecube.c index b4c7e694c..53d40b92b 100644 --- a/thirdparty/SDL/src/joystick/hidapi/SDL_hidapi_gamecube.c +++ b/thirdparty/SDL/src/joystick/hidapi/SDL_hidapi_gamecube.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -78,7 +78,9 @@ static SDL_bool HIDAPI_DriverGameCube_IsSupportedDevice(SDL_HIDAPI_Device *devic /* Nintendo Co., Ltd. Wii U GameCube Controller Adapter */ return SDL_TRUE; } - if (vendor_id == USB_VENDOR_DRAGONRISE && product_id == USB_PRODUCT_EVORETRO_GAMECUBE_ADAPTER) { + if (vendor_id == USB_VENDOR_DRAGONRISE && + (product_id == USB_PRODUCT_EVORETRO_GAMECUBE_ADAPTER1 || + product_id == USB_PRODUCT_EVORETRO_GAMECUBE_ADAPTER2)) { /* EVORETRO GameCube Controller Adapter */ return SDL_TRUE; } @@ -140,7 +142,7 @@ static SDL_bool HIDAPI_DriverGameCube_InitDevice(SDL_HIDAPI_Device *device) #endif ctx = (SDL_DriverGameCube_Context *)SDL_calloc(1, sizeof(*ctx)); - if (ctx == NULL) { + if (!ctx) { SDL_OutOfMemory(); return SDL_FALSE; } @@ -249,7 +251,7 @@ static void HIDAPI_DriverGameCube_HandleJoystickPacket(SDL_HIDAPI_Device *device } joystick = SDL_JoystickFromInstanceID(ctx->joysticks[i]); - if (joystick == NULL) { + if (!joystick) { /* Hasn't been opened yet, skip */ return; } @@ -288,8 +290,8 @@ static void HIDAPI_DriverGameCube_HandleJoystickPacket(SDL_HIDAPI_Device *device joystick, \ axis, axis_value); READ_AXIS(3, SDL_CONTROLLER_AXIS_LEFTX, 0) - READ_AXIS(4, SDL_CONTROLLER_AXIS_LEFTY, 0) - READ_AXIS(6, SDL_CONTROLLER_AXIS_RIGHTX, 1) + READ_AXIS(4, SDL_CONTROLLER_AXIS_LEFTY, 1) + READ_AXIS(6, SDL_CONTROLLER_AXIS_RIGHTX, 0) READ_AXIS(5, SDL_CONTROLLER_AXIS_RIGHTY, 1) READ_AXIS(7, SDL_CONTROLLER_AXIS_TRIGGERLEFT, 0) READ_AXIS(8, SDL_CONTROLLER_AXIS_TRIGGERRIGHT, 0) @@ -323,7 +325,7 @@ static void HIDAPI_DriverGameCube_HandleNintendoPacket(SDL_HIDAPI_Device *device joystick = SDL_JoystickFromInstanceID(ctx->joysticks[i]); /* Hasn't been opened yet, skip */ - if (joystick == NULL) { + if (!joystick) { continue; } } else { @@ -340,8 +342,8 @@ static void HIDAPI_DriverGameCube_HandleNintendoPacket(SDL_HIDAPI_Device *device RemapButton(ctx, button), \ (curSlot[off] & flag) ? SDL_PRESSED : SDL_RELEASED); READ_BUTTON(1, 0x01, 0) /* A */ - READ_BUTTON(1, 0x04, 1) /* B */ - READ_BUTTON(1, 0x02, 2) /* X */ + READ_BUTTON(1, 0x02, 1) /* B */ + READ_BUTTON(1, 0x04, 2) /* X */ READ_BUTTON(1, 0x08, 3) /* Y */ READ_BUTTON(1, 0x10, 4) /* DPAD_LEFT */ READ_BUTTON(1, 0x20, 5) /* DPAD_RIGHT */ @@ -385,7 +387,7 @@ static SDL_bool HIDAPI_DriverGameCube_UpdateDevice(SDL_HIDAPI_Device *device) /* Read input packet */ while ((size = SDL_hid_read_timeout(device->dev, packet, sizeof(packet), 0)) > 0) { #ifdef DEBUG_GAMECUBE_PROTOCOL - // HIDAPI_DumpPacket("Nintendo GameCube packet: size = %d", packet, size); + HIDAPI_DumpPacket("Nintendo GameCube packet: size = %d", packet, size); #endif if (ctx->pc_mode) { HIDAPI_DriverGameCube_HandleJoystickPacket(device, ctx, packet, size); diff --git a/thirdparty/SDL/src/joystick/hidapi/SDL_hidapi_luna.c b/thirdparty/SDL/src/joystick/hidapi/SDL_hidapi_luna.c index 7eb44c72a..e5557c598 100644 --- a/thirdparty/SDL/src/joystick/hidapi/SDL_hidapi_luna.c +++ b/thirdparty/SDL/src/joystick/hidapi/SDL_hidapi_luna.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -75,7 +75,7 @@ static SDL_bool HIDAPI_DriverLuna_InitDevice(SDL_HIDAPI_Device *device) SDL_DriverLuna_Context *ctx; ctx = (SDL_DriverLuna_Context *)SDL_calloc(1, sizeof(*ctx)); - if (ctx == NULL) { + if (!ctx) { SDL_OutOfMemory(); return SDL_FALSE; } @@ -393,7 +393,7 @@ static SDL_bool HIDAPI_DriverLuna_UpdateDevice(SDL_HIDAPI_Device *device) #ifdef DEBUG_LUNA_PROTOCOL HIDAPI_DumpPacket("Amazon Luna packet: size = %d", data, size); #endif - if (joystick == NULL) { + if (!joystick) { continue; } diff --git a/thirdparty/SDL/src/joystick/hidapi/SDL_hidapi_nintendo.h b/thirdparty/SDL/src/joystick/hidapi/SDL_hidapi_nintendo.h index 9b9a66716..bd8459a42 100644 --- a/thirdparty/SDL/src/joystick/hidapi/SDL_hidapi_nintendo.h +++ b/thirdparty/SDL/src/joystick/hidapi/SDL_hidapi_nintendo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/joystick/hidapi/SDL_hidapi_ps3.c b/thirdparty/SDL/src/joystick/hidapi/SDL_hidapi_ps3.c index d5e00babc..fdc21bb9e 100644 --- a/thirdparty/SDL/src/joystick/hidapi/SDL_hidapi_ps3.c +++ b/thirdparty/SDL/src/joystick/hidapi/SDL_hidapi_ps3.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -50,6 +50,7 @@ typedef struct SDL_HIDAPI_Device *device; SDL_Joystick *joystick; SDL_bool is_shanwan; + SDL_bool has_analog_buttons; SDL_bool report_sensors; SDL_bool effects_updated; int player_index; @@ -139,12 +140,13 @@ static SDL_bool HIDAPI_DriverPS3_InitDevice(SDL_HIDAPI_Device *device) } ctx = (SDL_DriverPS3_Context *)SDL_calloc(1, sizeof(*ctx)); - if (ctx == NULL) { + if (!ctx) { SDL_OutOfMemory(); return SDL_FALSE; } ctx->device = device; ctx->is_shanwan = is_shanwan; + ctx->has_analog_buttons = SDL_TRUE; device->context = ctx; @@ -220,7 +222,7 @@ static void HIDAPI_DriverPS3_SetDevicePlayerIndex(SDL_HIDAPI_Device *device, SDL { SDL_DriverPS3_Context *ctx = (SDL_DriverPS3_Context *)device->context; - if (ctx == NULL) { + if (!ctx) { return; } @@ -247,7 +249,10 @@ static SDL_bool HIDAPI_DriverPS3_OpenJoystick(SDL_HIDAPI_Device *device, SDL_Joy /* Initialize the joystick capabilities */ joystick->nbuttons = 15; - joystick->naxes = 16; + joystick->naxes = 6; + if (ctx->has_analog_buttons) { + joystick->naxes += 10; + } joystick->epowerlevel = SDL_JOYSTICK_POWER_WIRED; SDL_PrivateJoystickAddSensor(joystick, SDL_SENSOR_ACCEL, 100.0f); @@ -432,7 +437,7 @@ static void HIDAPI_DriverPS3_HandleStatePacket(SDL_Joystick *joystick, SDL_Drive SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_RIGHTY, axis); /* Buttons are mapped as axes in the order they appear in the button enumeration */ - { + if (ctx->has_analog_buttons) { static int button_axis_offsets[] = { 24, /* SDL_CONTROLLER_BUTTON_A */ 23, /* SDL_CONTROLLER_BUTTON_B */ @@ -494,7 +499,7 @@ static SDL_bool HIDAPI_DriverPS3_UpdateDevice(SDL_HIDAPI_Device *device) #ifdef DEBUG_PS3_PROTOCOL HIDAPI_DumpPacket("PS3 packet: size = %d", data, size); #endif - if (joystick == NULL) { + if (!joystick) { continue; } @@ -584,7 +589,13 @@ static SDL_bool HIDAPI_DriverPS3ThirdParty_IsSupportedDevice(SDL_HIDAPI_Device * Uint8 data[USB_PACKET_LENGTH]; int size; - if (HIDAPI_SupportsPlaystationDetection(vendor_id, product_id)) { + if (vendor_id == USB_VENDOR_LOGITECH && + product_id == USB_PRODUCT_LOGITECH_CHILLSTREAM) { + return SDL_TRUE; + } + + if ((type == SDL_CONTROLLER_TYPE_PS3 && vendor_id != USB_VENDOR_SONY) || + HIDAPI_SupportsPlaystationDetection(vendor_id, product_id)) { if (device && device->dev) { size = ReadFeatureReport(device->dev, 0x03, data, sizeof(data)); if (size == 8 && data[2] == 0x26) { @@ -606,11 +617,16 @@ static SDL_bool HIDAPI_DriverPS3ThirdParty_InitDevice(SDL_HIDAPI_Device *device) SDL_DriverPS3_Context *ctx; ctx = (SDL_DriverPS3_Context *)SDL_calloc(1, sizeof(*ctx)); - if (ctx == NULL) { + if (!ctx) { SDL_OutOfMemory(); return SDL_FALSE; } ctx->device = device; + if (device->vendor_id == USB_VENDOR_SWITCH && device->product_id == USB_PRODUCT_SWITCH_RETROBIT_CONTROLLER) { + ctx->has_analog_buttons = SDL_FALSE; + } else { + ctx->has_analog_buttons = SDL_TRUE; + } device->context = ctx; @@ -644,8 +660,17 @@ static SDL_bool HIDAPI_DriverPS3ThirdParty_OpenJoystick(SDL_HIDAPI_Device *devic /* Initialize the joystick capabilities */ joystick->nbuttons = 15; - joystick->naxes = 16; - joystick->epowerlevel = SDL_JOYSTICK_POWER_WIRED; + joystick->naxes = 6; + if (ctx->has_analog_buttons) { + joystick->naxes += 10; + } + + if (device->vendor_id == USB_VENDOR_SWITCH && device->product_id == USB_PRODUCT_SWITCH_RETROBIT_CONTROLLER) { + // This is a wireless controller using a USB dongle + joystick->epowerlevel = SDL_JOYSTICK_POWER_UNKNOWN; + } else { + joystick->epowerlevel = SDL_JOYSTICK_POWER_WIRED; + } return SDL_TRUE; } @@ -756,7 +781,7 @@ static void HIDAPI_DriverPS3ThirdParty_HandleStatePacket18(SDL_Joystick *joystic SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_RIGHTY, axis); /* Buttons are mapped as axes in the order they appear in the button enumeration */ - { + if (ctx->has_analog_buttons) { static int button_axis_offsets[] = { 12, /* SDL_GAMEPAD_BUTTON_A */ 11, /* SDL_GAMEPAD_BUTTON_B */ @@ -768,7 +793,7 @@ static void HIDAPI_DriverPS3ThirdParty_HandleStatePacket18(SDL_Joystick *joystic 0, /* SDL_GAMEPAD_BUTTON_LEFT_STICK */ 0, /* SDL_GAMEPAD_BUTTON_RIGHT_STICK */ 14, /* SDL_GAMEPAD_BUTTON_LEFT_SHOULDER */ - 16, /* SDL_GAMEPAD_BUTTON_RIGHT_SHOULDER */ + 15, /* SDL_GAMEPAD_BUTTON_RIGHT_SHOULDER */ 8, /* SDL_GAMEPAD_BUTTON_DPAD_UP */ 9, /* SDL_GAMEPAD_BUTTON_DPAD_DOWN */ 7, /* SDL_GAMEPAD_BUTTON_DPAD_LEFT */ @@ -813,53 +838,69 @@ static void HIDAPI_DriverPS3ThirdParty_HandleStatePacket19(SDL_Joystick *joystic SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_GUIDE, (data[1] & 0x10) ? SDL_PRESSED : SDL_RELEASED); } - if (ctx->last_state[2] != data[2]) { - SDL_bool dpad_up = SDL_FALSE; - SDL_bool dpad_down = SDL_FALSE; - SDL_bool dpad_left = SDL_FALSE; - SDL_bool dpad_right = SDL_FALSE; - - switch (data[2] & 0x0f) { - case 0: - dpad_up = SDL_TRUE; - break; - case 1: - dpad_up = SDL_TRUE; - dpad_right = SDL_TRUE; - break; - case 2: - dpad_right = SDL_TRUE; - break; - case 3: - dpad_right = SDL_TRUE; - dpad_down = SDL_TRUE; - break; - case 4: - dpad_down = SDL_TRUE; - break; - case 5: - dpad_left = SDL_TRUE; - dpad_down = SDL_TRUE; - break; - case 6: - dpad_left = SDL_TRUE; - break; - case 7: - dpad_up = SDL_TRUE; - dpad_left = SDL_TRUE; - break; - default: - break; + if (ctx->device->vendor_id == USB_VENDOR_SAITEK && ctx->device->product_id == USB_PRODUCT_SAITEK_CYBORG_V3) { + /* Cyborg V.3 Rumble Pad doesn't set the dpad bits as expected, so use the axes instead */ + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_DPAD_DOWN, data[10] ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_DPAD_UP, data[9] ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_DPAD_RIGHT, data[7] ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_DPAD_LEFT, data[8] ? SDL_PRESSED : SDL_RELEASED); + } else { + if (ctx->last_state[2] != data[2]) { + SDL_bool dpad_up = SDL_FALSE; + SDL_bool dpad_down = SDL_FALSE; + SDL_bool dpad_left = SDL_FALSE; + SDL_bool dpad_right = SDL_FALSE; + + switch (data[2] & 0x0f) { + case 0: + dpad_up = SDL_TRUE; + break; + case 1: + dpad_up = SDL_TRUE; + dpad_right = SDL_TRUE; + break; + case 2: + dpad_right = SDL_TRUE; + break; + case 3: + dpad_right = SDL_TRUE; + dpad_down = SDL_TRUE; + break; + case 4: + dpad_down = SDL_TRUE; + break; + case 5: + dpad_left = SDL_TRUE; + dpad_down = SDL_TRUE; + break; + case 6: + dpad_left = SDL_TRUE; + break; + case 7: + dpad_up = SDL_TRUE; + dpad_left = SDL_TRUE; + break; + default: + break; + } + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_DPAD_DOWN, dpad_down); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_DPAD_UP, dpad_up); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_DPAD_RIGHT, dpad_right); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_DPAD_LEFT, dpad_left); } - SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_DPAD_DOWN, dpad_down); - SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_DPAD_UP, dpad_up); - SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_DPAD_RIGHT, dpad_right); - SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_DPAD_LEFT, dpad_left); } - axis = ((int)data[17] * 257) - 32768; + if (data[0] & 0x40) { + axis = 32767; + } else { + axis = ((int)data[17] * 257) - 32768; + } SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_TRIGGERLEFT, axis); - axis = ((int)data[18] * 257) - 32768; + if (data[0] & 0x80) { + axis = 32767; + } else { + axis = ((int)data[18] * 257) - 32768; + } SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_TRIGGERRIGHT, axis); axis = ((int)data[3] * 257) - 32768; SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_LEFTX, axis); @@ -871,7 +912,7 @@ static void HIDAPI_DriverPS3ThirdParty_HandleStatePacket19(SDL_Joystick *joystic SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_RIGHTY, axis); /* Buttons are mapped as axes in the order they appear in the button enumeration */ - { + if (ctx->has_analog_buttons) { static int button_axis_offsets[] = { 13, /* SDL_CONTROLLER_BUTTON_A */ 12, /* SDL_CONTROLLER_BUTTON_B */ @@ -924,7 +965,7 @@ static SDL_bool HIDAPI_DriverPS3ThirdParty_UpdateDevice(SDL_HIDAPI_Device *devic #ifdef DEBUG_PS3_PROTOCOL HIDAPI_DumpPacket("PS3 packet: size = %d", data, size); #endif - if (joystick == NULL) { + if (!joystick) { continue; } diff --git a/thirdparty/SDL/src/joystick/hidapi/SDL_hidapi_ps4.c b/thirdparty/SDL/src/joystick/hidapi/SDL_hidapi_ps4.c index 68dfc0164..565431d83 100644 --- a/thirdparty/SDL/src/joystick/hidapi/SDL_hidapi_ps4.c +++ b/thirdparty/SDL/src/joystick/hidapi/SDL_hidapi_ps4.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -128,6 +128,7 @@ typedef struct SDL_HIDAPI_Device *device; SDL_Joystick *joystick; SDL_bool is_dongle; + SDL_bool is_nacon_dongle; SDL_bool official_controller; SDL_bool sensors_supported; SDL_bool lightbar_supported; @@ -243,7 +244,7 @@ static SDL_bool HIDAPI_DriverPS4_InitDevice(SDL_HIDAPI_Device *device) SDL_JoystickType joystick_type = SDL_JOYSTICK_TYPE_GAMECONTROLLER; ctx = (SDL_DriverPS4_Context *)SDL_calloc(1, sizeof(*ctx)); - if (ctx == NULL) { + if (!ctx) { SDL_OutOfMemory(); return SDL_FALSE; } @@ -401,8 +402,14 @@ static SDL_bool HIDAPI_DriverPS4_InitDevice(SDL_HIDAPI_Device *device) } ctx->effects_supported = (ctx->lightbar_supported || ctx->vibration_supported); + if (device->vendor_id == USB_VENDOR_NACON_ALT && + device->product_id == USB_PRODUCT_NACON_REVOLUTION_5_PRO_PS4_WIRELESS) { + ctx->is_nacon_dongle = SDL_TRUE; + } + if (device->vendor_id == USB_VENDOR_PDP && - device->product_id == USB_PRODUCT_VICTRIX_FS_PRO_V2) { + (device->product_id == USB_PRODUCT_VICTRIX_FS_PRO || + device->product_id == USB_PRODUCT_VICTRIX_FS_PRO_V2)) { /* The Victrix FS Pro V2 reports that it has lightbar support, * but it doesn't respond to the effects packet, and will hang * on reboot if we send it. @@ -425,7 +432,7 @@ static SDL_bool HIDAPI_DriverPS4_InitDevice(SDL_HIDAPI_Device *device) } else { HIDAPI_DisconnectBluetoothDevice(device->serial); } - if (ctx->is_dongle && serial[0] == '\0') { + if ((ctx->is_dongle || ctx->is_nacon_dongle) && serial[0] == '\0') { /* Not yet connected */ return SDL_TRUE; } @@ -677,10 +684,14 @@ static void HIDAPI_DriverPS4_TickleBluetooth(SDL_HIDAPI_Device *device) SDL_HIDAPI_SendRumbleAndUnlock(device, data, sizeof(data)); } } else { +#if 0 /* The 8BitDo Zero 2 has perfect emulation of a PS4 controllers, except it + * only sends reports when the state changes, so we can't disconnect here. + */ /* We can't even send an invalid effects packet, or it will put the controller in enhanced mode */ if (device->num_joysticks > 0) { HIDAPI_JoystickDisconnected(device, device->joysticks[0]); } +#endif } } @@ -1080,6 +1091,21 @@ static SDL_bool HIDAPI_DriverPS4_IsPacketValid(SDL_DriverPS4_Context *ctx, Uint8 return SDL_TRUE; } + if (ctx->is_nacon_dongle && size >= (1 + sizeof(PS4StatePacket_t))) { + /* The report timestamp doesn't change when the controller isn't connected */ + PS4StatePacket_t *packet = (PS4StatePacket_t *)&data[1]; + if (SDL_memcmp(packet->rgucTimestamp, ctx->last_state.rgucTimestamp, sizeof(packet->rgucTimestamp)) == 0) { + return SDL_FALSE; + } + if (ctx->last_state.rgucAccelX[0] == 0 && ctx->last_state.rgucAccelX[1] == 0 && + ctx->last_state.rgucAccelY[0] == 0 && ctx->last_state.rgucAccelY[1] == 0 && + ctx->last_state.rgucAccelZ[0] == 0 && ctx->last_state.rgucAccelZ[1] == 0) { + /* We don't have any state to compare yet, go ahead and copy it */ + SDL_memcpy(&ctx->last_state, &data[1], sizeof(PS4StatePacket_t)); + return SDL_FALSE; + } + } + /* In the case of a DS4 USB dongle, bit[2] of byte 31 indicates if a DS4 is actually connected (indicated by '0'). * For non-dongle, this bit is always 0 (connected). * This is usually the ID over USB, but the DS4v2 that started shipping with the PS4 Slim will also send this @@ -1144,7 +1170,7 @@ static SDL_bool HIDAPI_DriverPS4_UpdateDevice(SDL_HIDAPI_Device *device) ++packet_count; ctx->last_packet = now; - if (joystick == NULL) { + if (!joystick) { continue; } @@ -1192,7 +1218,7 @@ static SDL_bool HIDAPI_DriverPS4_UpdateDevice(SDL_HIDAPI_Device *device) } } - if (ctx->is_dongle) { + if (ctx->is_dongle || ctx->is_nacon_dongle) { if (packet_count == 0) { if (device->num_joysticks > 0) { /* Check to see if it looks like the device disconnected */ @@ -1214,7 +1240,7 @@ static SDL_bool HIDAPI_DriverPS4_UpdateDevice(SDL_HIDAPI_Device *device) } } - if (size < 0 && device->num_joysticks > 0) { + if (packet_count == 0 && size < 0 && device->num_joysticks > 0) { /* Read error, device is disconnected */ HIDAPI_JoystickDisconnected(device, device->joysticks[0]); } diff --git a/thirdparty/SDL/src/joystick/hidapi/SDL_hidapi_ps5.c b/thirdparty/SDL/src/joystick/hidapi/SDL_hidapi_ps5.c index 68588c287..dfdbc8120 100644 --- a/thirdparty/SDL/src/joystick/hidapi/SDL_hidapi_ps5.c +++ b/thirdparty/SDL/src/joystick/hidapi/SDL_hidapi_ps5.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -217,6 +217,7 @@ typedef struct { SDL_HIDAPI_Device *device; SDL_Joystick *joystick; + SDL_bool is_nacon_dongle; SDL_bool use_alternate_report; SDL_bool sensors_supported; SDL_bool lightbar_supported; @@ -246,6 +247,7 @@ typedef struct { PS5SimpleStatePacket_t simple; PS5StatePacketCommon_t state; + PS5StatePacketAlt_t alt_state; PS5StatePacket_t full_state; Uint8 data[64]; } last_state; @@ -333,7 +335,8 @@ static void SetLightsForPlayerIndex(DS5EffectsState_t *effects, int player_index 0x04, 0x0A, 0x15, - 0x1B + 0x1B, + 0x1F }; if (player_index >= 0) { @@ -354,7 +357,7 @@ static SDL_bool HIDAPI_DriverPS5_InitDevice(SDL_HIDAPI_Device *device) SDL_JoystickType joystick_type = SDL_JOYSTICK_TYPE_GAMECONTROLLER; ctx = (SDL_DriverPS5_Context *)SDL_calloc(1, sizeof(*ctx)); - if (ctx == NULL) { + if (!ctx) { SDL_OutOfMemory(); return SDL_FALSE; } @@ -482,17 +485,35 @@ static SDL_bool HIDAPI_DriverPS5_InitDevice(SDL_HIDAPI_Device *device) } ctx->use_alternate_report = SDL_TRUE; + + if (device->vendor_id == USB_VENDOR_NACON_ALT && + (device->product_id == USB_PRODUCT_NACON_REVOLUTION_5_PRO_PS5_WIRED || + device->product_id == USB_PRODUCT_NACON_REVOLUTION_5_PRO_PS5_WIRELESS)) { + /* This doesn't report vibration capability, but it can do rumble */ + ctx->vibration_supported = SDL_TRUE; + } } else if (device->vendor_id == USB_VENDOR_RAZER && (device->product_id == USB_PRODUCT_RAZER_WOLVERINE_V2_PRO_PS5_WIRED || device->product_id == USB_PRODUCT_RAZER_WOLVERINE_V2_PRO_PS5_WIRELESS)) { - /* The Razer Wolverine V2 Pro doesn't respond to the detection protocol, but has a touchpad and sensors, but no vibration */ + /* The Razer Wolverine V2 Pro doesn't respond to the detection protocol, but has a touchpad and sensors and no vibration */ ctx->sensors_supported = SDL_TRUE; ctx->touchpad_supported = SDL_TRUE; ctx->use_alternate_report = SDL_TRUE; + } else if (device->vendor_id == USB_VENDOR_RAZER && + device->product_id == USB_PRODUCT_RAZER_KITSUNE) { + /* The Razer Kitsune doesn't respond to the detection protocol, but has a touchpad */ + joystick_type = SDL_JOYSTICK_TYPE_ARCADE_STICK; + ctx->touchpad_supported = SDL_TRUE; + ctx->use_alternate_report = SDL_TRUE; } } ctx->effects_supported = (ctx->lightbar_supported || ctx->vibration_supported || ctx->playerled_supported); + if (device->vendor_id == USB_VENDOR_NACON_ALT && + device->product_id == USB_PRODUCT_NACON_REVOLUTION_5_PRO_PS5_WIRELESS) { + ctx->is_nacon_dongle = SDL_TRUE; + } + device->joystick_type = joystick_type; device->type = SDL_CONTROLLER_TYPE_PS5; if (device->vendor_id == USB_VENDOR_SONY) { @@ -504,6 +525,11 @@ static SDL_bool HIDAPI_DriverPS5_InitDevice(SDL_HIDAPI_Device *device) } HIDAPI_SetDeviceSerial(device, serial); + if (ctx->is_nacon_dongle) { + /* We don't know if this is connected yet, wait for reports */ + return SDL_TRUE; + } + /* Prefer the USB device over the Bluetooth device */ if (device->is_bluetooth) { if (HIDAPI_HasConnectedUSBDevice(device->serial)) { @@ -1377,6 +1403,20 @@ static SDL_bool HIDAPI_DriverPS5_IsPacketValid(SDL_DriverPS5_Context *ctx, Uint8 { switch (data[0]) { case k_EPS5ReportIdState: + if (ctx->is_nacon_dongle && size >= (1 + sizeof(PS5StatePacketAlt_t))) { + /* The report timestamp doesn't change when the controller isn't connected */ + PS5StatePacketAlt_t *packet = (PS5StatePacketAlt_t *)&data[1]; + if (SDL_memcmp(packet->rgucPacketSequence, ctx->last_state.state.rgucPacketSequence, sizeof(packet->rgucPacketSequence)) == 0) { + return SDL_FALSE; + } + if (ctx->last_state.alt_state.rgucAccelX[0] == 0 && ctx->last_state.alt_state.rgucAccelX[1] == 0 && + ctx->last_state.alt_state.rgucAccelY[0] == 0 && ctx->last_state.alt_state.rgucAccelY[1] == 0 && + ctx->last_state.alt_state.rgucAccelZ[0] == 0 && ctx->last_state.alt_state.rgucAccelZ[1] == 0) { + /* We don't have any state to compare yet, go ahead and copy it */ + SDL_memcpy(&ctx->last_state, &data[1], sizeof(PS5StatePacketAlt_t)); + return SDL_FALSE; + } + } return SDL_TRUE; case k_EPS5ReportIdBluetoothState: @@ -1414,7 +1454,7 @@ static SDL_bool HIDAPI_DriverPS5_UpdateDevice(SDL_HIDAPI_Device *device) ++packet_count; ctx->last_packet = now; - if (joystick == NULL) { + if (!joystick) { continue; } @@ -1470,7 +1510,22 @@ static SDL_bool HIDAPI_DriverPS5_UpdateDevice(SDL_HIDAPI_Device *device) } } - if (size < 0 && device->num_joysticks > 0) { + if (ctx->is_nacon_dongle) { + if (packet_count == 0) { + if (device->num_joysticks > 0) { + /* Check to see if it looks like the device disconnected */ + if (SDL_TICKS_PASSED(now, ctx->last_packet + BLUETOOTH_DISCONNECT_TIMEOUT_MS)) { + HIDAPI_JoystickDisconnected(device, device->joysticks[0]); + } + } + } else { + if (device->num_joysticks == 0) { + HIDAPI_JoystickConnected(device, NULL); + } + } + } + + if (packet_count == 0 && size < 0 && device->num_joysticks > 0) { /* Read error, device is disconnected */ HIDAPI_JoystickDisconnected(device, device->joysticks[0]); } diff --git a/thirdparty/SDL/src/joystick/hidapi/SDL_hidapi_rumble.c b/thirdparty/SDL/src/joystick/hidapi/SDL_hidapi_rumble.c index d04507949..2bb166e13 100644 --- a/thirdparty/SDL/src/joystick/hidapi/SDL_hidapi_rumble.c +++ b/thirdparty/SDL/src/joystick/hidapi/SDL_hidapi_rumble.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -216,7 +216,7 @@ int SDL_HIDAPI_SendRumbleWithCallbackAndUnlock(SDL_HIDAPI_Device *device, const } request = (SDL_HIDAPI_RumbleRequest *)SDL_calloc(1, sizeof(*request)); - if (request == NULL) { + if (!request) { SDL_HIDAPI_UnlockRumble(); return SDL_OutOfMemory(); } diff --git a/thirdparty/SDL/src/joystick/hidapi/SDL_hidapi_rumble.h b/thirdparty/SDL/src/joystick/hidapi/SDL_hidapi_rumble.h index 120d51f2d..918e08c91 100644 --- a/thirdparty/SDL/src/joystick/hidapi/SDL_hidapi_rumble.h +++ b/thirdparty/SDL/src/joystick/hidapi/SDL_hidapi_rumble.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/joystick/hidapi/SDL_hidapi_shield.c b/thirdparty/SDL/src/joystick/hidapi/SDL_hidapi_shield.c index 33a206627..63540e65e 100644 --- a/thirdparty/SDL/src/joystick/hidapi/SDL_hidapi_shield.c +++ b/thirdparty/SDL/src/joystick/hidapi/SDL_hidapi_shield.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -118,7 +118,7 @@ static SDL_bool HIDAPI_DriverShield_InitDevice(SDL_HIDAPI_Device *device) SDL_DriverShield_Context *ctx; ctx = (SDL_DriverShield_Context *)SDL_calloc(1, sizeof(*ctx)); - if (ctx == NULL) { + if (!ctx) { SDL_OutOfMemory(); return SDL_FALSE; } @@ -489,7 +489,7 @@ static SDL_bool HIDAPI_DriverShield_UpdateDevice(SDL_HIDAPI_Device *device) /* Byte 0 is HID report ID */ switch (data[0]) { case k_ShieldReportIdControllerState: - if (joystick == NULL) { + if (!joystick) { break; } if (size == 16) { @@ -499,7 +499,7 @@ static SDL_bool HIDAPI_DriverShield_UpdateDevice(SDL_HIDAPI_Device *device) } break; case k_ShieldReportIdControllerTouch: - if (joystick == NULL) { + if (!joystick) { break; } HIDAPI_DriverShield_HandleTouchPacketV103(joystick, ctx, data, size); diff --git a/thirdparty/SDL/src/joystick/hidapi/SDL_hidapi_stadia.c b/thirdparty/SDL/src/joystick/hidapi/SDL_hidapi_stadia.c index 0cdb4f41c..0fc6d1486 100644 --- a/thirdparty/SDL/src/joystick/hidapi/SDL_hidapi_stadia.c +++ b/thirdparty/SDL/src/joystick/hidapi/SDL_hidapi_stadia.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -72,7 +72,7 @@ static SDL_bool HIDAPI_DriverStadia_InitDevice(SDL_HIDAPI_Device *device) SDL_DriverStadia_Context *ctx; ctx = (SDL_DriverStadia_Context *)SDL_calloc(1, sizeof(*ctx)); - if (ctx == NULL) { + if (!ctx) { SDL_OutOfMemory(); return SDL_FALSE; } @@ -288,7 +288,7 @@ static SDL_bool HIDAPI_DriverStadia_UpdateDevice(SDL_HIDAPI_Device *device) #ifdef DEBUG_STADIA_PROTOCOL HIDAPI_DumpPacket("Google Stadia packet: size = %d", data, size); #endif - if (joystick == NULL) { + if (!joystick) { continue; } diff --git a/thirdparty/SDL/src/joystick/hidapi/SDL_hidapi_steam.c b/thirdparty/SDL/src/joystick/hidapi/SDL_hidapi_steam.c index 046c0ce81..9f9e0e342 100644 --- a/thirdparty/SDL/src/joystick/hidapi/SDL_hidapi_steam.c +++ b/thirdparty/SDL/src/joystick/hidapi/SDL_hidapi_steam.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -33,29 +33,24 @@ /*****************************************************************************************************/ -#include - #define bool SDL_bool #define true SDL_TRUE #define false SDL_FALSE -typedef uint32_t uint32; -typedef uint64_t uint64; - #include "steam/controller_constants.h" #include "steam/controller_structs.h" typedef struct SteamControllerStateInternal_t { // Controller Type for this Controller State - uint32 eControllerType; + Uint32 eControllerType; // If packet num matches that on your prior call, then the controller state hasn't been changed since // your last call and there is no need to process it - uint32 unPacketNum; + Uint32 unPacketNum; // bit flags for each of the buttons - uint64 ulButtons; + Uint64 ulButtons; // Left pad coordinates short sLeftPadX; @@ -977,7 +972,7 @@ static SDL_bool HIDAPI_DriverSteam_InitDevice(SDL_HIDAPI_Device *device) SDL_DriverSteam_Context *ctx; ctx = (SDL_DriverSteam_Context *)SDL_calloc(1, sizeof(*ctx)); - if (ctx == NULL) { + if (!ctx) { SDL_OutOfMemory(); return SDL_FALSE; } @@ -1074,9 +1069,9 @@ static int HIDAPI_DriverSteam_SetSensorsEnabled(SDL_HIDAPI_Device *device, SDL_J SDL_memset(buf, 0, 65); buf[1] = ID_SET_SETTINGS_VALUES; if (enabled) { - ADD_SETTING(SETTING_GYRO_MODE, 0x18 /* SETTING_GYRO_SEND_RAW_ACCEL | SETTING_GYRO_MODE_SEND_RAW_GYRO */); + ADD_SETTING(SETTING_IMU_MODE, SETTING_GYRO_MODE_SEND_RAW_ACCEL | SETTING_GYRO_MODE_SEND_RAW_GYRO); } else { - ADD_SETTING(SETTING_GYRO_MODE, 0x00 /* SETTING_GYRO_MODE_OFF */); + ADD_SETTING(SETTING_IMU_MODE, SETTING_GYRO_MODE_OFF); } buf[2] = nSettings * 3; if (SetFeatureReport(device->dev, buf, 3 + nSettings * 3) < 0) { @@ -1109,7 +1104,7 @@ static SDL_bool HIDAPI_DriverSteam_UpdateDevice(SDL_HIDAPI_Device *device) break; } - if (joystick == NULL) { + if (!joystick) { continue; } diff --git a/thirdparty/SDL/src/joystick/hidapi/SDL_hidapi_steamdeck.c b/thirdparty/SDL/src/joystick/hidapi/SDL_hidapi_steamdeck.c new file mode 100644 index 000000000..20554edc6 --- /dev/null +++ b/thirdparty/SDL/src/joystick/hidapi/SDL_hidapi_steamdeck.c @@ -0,0 +1,433 @@ +/* + Simple DirectMedia Layer + Copyright (C) 2023 Max Maisel + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +#ifdef SDL_JOYSTICK_HIDAPI + +#include "../SDL_sysjoystick.h" +#include "SDL_events.h" +#include "SDL_hidapijoystick_c.h" + +#ifdef SDL_JOYSTICK_HIDAPI_STEAMDECK + +/*****************************************************************************************************/ + +#include "steam/controller_constants.h" +#include "steam/controller_structs.h" + +typedef enum +{ + STEAMDECK_LBUTTON_R2 = 0x00000001, + STEAMDECK_LBUTTON_L2 = 0x00000002, + STEAMDECK_LBUTTON_R = 0x00000004, + STEAMDECK_LBUTTON_L = 0x00000008, + STEAMDECK_LBUTTON_Y = 0x00000010, + STEAMDECK_LBUTTON_B = 0x00000020, + STEAMDECK_LBUTTON_X = 0x00000040, + STEAMDECK_LBUTTON_A = 0x00000080, + STEAMDECK_LBUTTON_DPAD_UP = 0x00000100, + STEAMDECK_LBUTTON_DPAD_RIGHT = 0x00000200, + STEAMDECK_LBUTTON_DPAD_LEFT = 0x00000400, + STEAMDECK_LBUTTON_DPAD_DOWN = 0x00000800, + STEAMDECK_LBUTTON_VIEW = 0x00001000, + STEAMDECK_LBUTTON_STEAM = 0x00002000, + STEAMDECK_LBUTTON_MENU = 0x00004000, + STEAMDECK_LBUTTON_L5 = 0x00008000, + STEAMDECK_LBUTTON_R5 = 0x00010000, + STEAMDECK_LBUTTON_LEFT_PAD = 0x00020000, + STEAMDECK_LBUTTON_RIGHT_PAD = 0x00040000, + STEAMDECK_LBUTTON_L3 = 0x00400000, + STEAMDECK_LBUTTON_R3 = 0x04000000, + + STEAMDECK_HBUTTON_L4 = 0x00000200, + STEAMDECK_HBUTTON_R4 = 0x00000400, + STEAMDECK_HBUTTON_QAM = 0x00040000, +} SteamDeckButtons; + +typedef struct +{ + Uint32 update_rate_us; + Uint32 sensor_timestamp_us; + Uint64 last_button_state; + Uint8 watchdog_counter; +} SDL_DriverSteamDeck_Context; + +static SDL_bool DisableDeckLizardMode(SDL_hid_device *dev) +{ + int rc; + Uint8 buffer[HID_FEATURE_REPORT_BYTES + 1] = { 0 }; + FeatureReportMsg *msg = (FeatureReportMsg *)(buffer + 1); + + msg->header.type = ID_CLEAR_DIGITAL_MAPPINGS; + + rc = SDL_hid_send_feature_report(dev, buffer, sizeof(buffer)); + if (rc != sizeof(buffer)) + return SDL_FALSE; + + msg->header.type = ID_SET_SETTINGS_VALUES; + msg->header.length = 5 * sizeof(ControllerSetting); + msg->payload.setSettingsValues.settings[0].settingNum = SETTING_SMOOTH_ABSOLUTE_MOUSE; + msg->payload.setSettingsValues.settings[0].settingValue = 0; + msg->payload.setSettingsValues.settings[1].settingNum = SETTING_LEFT_TRACKPAD_MODE; + msg->payload.setSettingsValues.settings[1].settingValue = TRACKPAD_NONE; + msg->payload.setSettingsValues.settings[2].settingNum = SETTING_RIGHT_TRACKPAD_MODE; // disable mouse + msg->payload.setSettingsValues.settings[2].settingValue = TRACKPAD_NONE; + msg->payload.setSettingsValues.settings[3].settingNum = SETTING_LEFT_TRACKPAD_CLICK_PRESSURE; // disable clicky pad + msg->payload.setSettingsValues.settings[3].settingValue = 0xFFFF; + msg->payload.setSettingsValues.settings[4].settingNum = SETTING_RIGHT_TRACKPAD_CLICK_PRESSURE; // disable clicky pad + msg->payload.setSettingsValues.settings[4].settingValue = 0xFFFF; + + rc = SDL_hid_send_feature_report(dev, buffer, sizeof(buffer)); + if (rc != sizeof(buffer)) + return SDL_FALSE; + + // There may be a lingering report read back after changing settings. + // Discard it. + SDL_hid_get_feature_report(dev, buffer, sizeof(buffer)); + + return SDL_TRUE; +} + +static SDL_bool FeedDeckLizardWatchdog(SDL_hid_device *dev) +{ + int rc; + Uint8 buffer[HID_FEATURE_REPORT_BYTES + 1] = { 0 }; + FeatureReportMsg *msg = (FeatureReportMsg *)(buffer + 1); + + msg->header.type = ID_CLEAR_DIGITAL_MAPPINGS; + + rc = SDL_hid_send_feature_report(dev, buffer, sizeof(buffer)); + if (rc != sizeof(buffer)) + return SDL_FALSE; + + msg->header.type = ID_SET_SETTINGS_VALUES; + msg->header.length = 1 * sizeof(ControllerSetting); + msg->payload.setSettingsValues.settings[0].settingNum = SETTING_RIGHT_TRACKPAD_MODE; + msg->payload.setSettingsValues.settings[0].settingValue = TRACKPAD_NONE; + + rc = SDL_hid_send_feature_report(dev, buffer, sizeof(buffer)); + if (rc != sizeof(buffer)) + return SDL_FALSE; + + // There may be a lingering report read back after changing settings. + // Discard it. + SDL_hid_get_feature_report(dev, buffer, sizeof(buffer)); + + return SDL_TRUE; +} + +static void HIDAPI_DriverSteamDeck_HandleState(SDL_HIDAPI_Device *device, + SDL_Joystick *joystick, + ValveInReport_t *pInReport) +{ + float values[3]; + SDL_DriverSteamDeck_Context *ctx = (SDL_DriverSteamDeck_Context *)device->context; + + if (pInReport->payload.deckState.ulButtons != ctx->last_button_state) { + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_A, + (pInReport->payload.deckState.ulButtonsL & STEAMDECK_LBUTTON_A) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_B, + (pInReport->payload.deckState.ulButtonsL & STEAMDECK_LBUTTON_B) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_X, + (pInReport->payload.deckState.ulButtonsL & STEAMDECK_LBUTTON_X) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_Y, + (pInReport->payload.deckState.ulButtonsL & STEAMDECK_LBUTTON_Y) ? SDL_PRESSED : SDL_RELEASED); + + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_LEFTSHOULDER, + (pInReport->payload.deckState.ulButtonsL & STEAMDECK_LBUTTON_L) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_RIGHTSHOULDER, + (pInReport->payload.deckState.ulButtonsL & STEAMDECK_LBUTTON_R) ? SDL_PRESSED : SDL_RELEASED); + + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_BACK, + (pInReport->payload.deckState.ulButtonsL & STEAMDECK_LBUTTON_VIEW) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_START, + (pInReport->payload.deckState.ulButtonsL & STEAMDECK_LBUTTON_MENU) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_GUIDE, + (pInReport->payload.deckState.ulButtonsL & STEAMDECK_LBUTTON_STEAM) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_MISC1, + (pInReport->payload.deckState.ulButtonsH & STEAMDECK_HBUTTON_QAM) ? SDL_PRESSED : SDL_RELEASED); + + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_LEFTSTICK, + (pInReport->payload.deckState.ulButtonsL & STEAMDECK_LBUTTON_L3) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_RIGHTSTICK, + (pInReport->payload.deckState.ulButtonsL & STEAMDECK_LBUTTON_R3) ? SDL_PRESSED : SDL_RELEASED); + + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_PADDLE1, + (pInReport->payload.deckState.ulButtonsH & STEAMDECK_HBUTTON_R4) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_PADDLE2, + (pInReport->payload.deckState.ulButtonsH & STEAMDECK_HBUTTON_L4) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_PADDLE3, + (pInReport->payload.deckState.ulButtonsL & STEAMDECK_LBUTTON_R5) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_PADDLE4, + (pInReport->payload.deckState.ulButtonsL & STEAMDECK_LBUTTON_L5) ? SDL_PRESSED : SDL_RELEASED); + + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_DPAD_UP, + (pInReport->payload.deckState.ulButtonsL & STEAMDECK_LBUTTON_DPAD_UP) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_DPAD_DOWN, + (pInReport->payload.deckState.ulButtonsL & STEAMDECK_LBUTTON_DPAD_DOWN) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_DPAD_LEFT, + (pInReport->payload.deckState.ulButtonsL & STEAMDECK_LBUTTON_DPAD_LEFT) ? SDL_PRESSED : SDL_RELEASED); + SDL_PrivateJoystickButton(joystick, SDL_CONTROLLER_BUTTON_DPAD_RIGHT, + (pInReport->payload.deckState.ulButtonsL & STEAMDECK_LBUTTON_DPAD_RIGHT) ? SDL_PRESSED : SDL_RELEASED); + ctx->last_button_state = pInReport->payload.deckState.ulButtons; + } + + SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_TRIGGERLEFT, + (int)pInReport->payload.deckState.sTriggerRawL * 2 - 32768); + SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_TRIGGERRIGHT, + (int)pInReport->payload.deckState.sTriggerRawR * 2 - 32768); + + SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_LEFTX, + pInReport->payload.deckState.sLeftStickX); + SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_LEFTY, + -pInReport->payload.deckState.sLeftStickY); + SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_RIGHTX, + pInReport->payload.deckState.sRightStickX); + SDL_PrivateJoystickAxis(joystick, SDL_CONTROLLER_AXIS_RIGHTY, + -pInReport->payload.deckState.sRightStickY); + + ctx->sensor_timestamp_us += ctx->update_rate_us; + + values[0] = (pInReport->payload.deckState.sGyroX / 32768.0f) * (2000.0f * ((float)M_PI / 180.0f)); + values[1] = (pInReport->payload.deckState.sGyroZ / 32768.0f) * (2000.0f * ((float)M_PI / 180.0f)); + values[2] = (-pInReport->payload.deckState.sGyroY / 32768.0f) * (2000.0f * ((float)M_PI / 180.0f)); + SDL_PrivateJoystickSensor(joystick, SDL_SENSOR_GYRO, ctx->sensor_timestamp_us, values, 3); + + values[0] = (pInReport->payload.deckState.sAccelX / 32768.0f) * 2.0f * SDL_STANDARD_GRAVITY; + values[1] = (pInReport->payload.deckState.sAccelZ / 32768.0f) * 2.0f * SDL_STANDARD_GRAVITY; + values[2] = (-pInReport->payload.deckState.sAccelY / 32768.0f) * 2.0f * SDL_STANDARD_GRAVITY; + SDL_PrivateJoystickSensor(joystick, SDL_SENSOR_ACCEL, ctx->sensor_timestamp_us, values, 3); +} + +/*****************************************************************************************************/ + +static void HIDAPI_DriverSteamDeck_RegisterHints(SDL_HintCallback callback, void *userdata) +{ + SDL_AddHintCallback(SDL_HINT_JOYSTICK_HIDAPI_STEAMDECK, callback, userdata); +} + +static void HIDAPI_DriverSteamDeck_UnregisterHints(SDL_HintCallback callback, void *userdata) +{ + SDL_DelHintCallback(SDL_HINT_JOYSTICK_HIDAPI_STEAMDECK, callback, userdata); +} + +static SDL_bool HIDAPI_DriverSteamDeck_IsEnabled(void) +{ + return SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI_STEAMDECK, + SDL_GetHintBoolean(SDL_HINT_JOYSTICK_HIDAPI, SDL_HIDAPI_DEFAULT)); +} + +static SDL_bool HIDAPI_DriverSteamDeck_IsSupportedDevice( + SDL_HIDAPI_Device *device, + const char *name, + SDL_GameControllerType type, + Uint16 vendor_id, + Uint16 product_id, + Uint16 version, + int interface_number, + int interface_class, + int interface_subclass, + int interface_protocol) +{ + return SDL_IsJoystickSteamDeck(vendor_id, product_id); +} + +static SDL_bool HIDAPI_DriverSteamDeck_InitDevice(SDL_HIDAPI_Device *device) +{ + int size; + Uint8 data[64]; + SDL_DriverSteamDeck_Context *ctx; + + ctx = (SDL_DriverSteamDeck_Context *)SDL_calloc(1, sizeof(*ctx)); + if (ctx == NULL) { + SDL_OutOfMemory(); + return SDL_FALSE; + } + + // Always 1kHz according to USB descriptor, but actually about 4 ms. + ctx->update_rate_us = 4000; + + device->context = ctx; + + // Read a report to see if this is the correct endpoint. + // Mouse, Keyboard and Controller have the same VID/PID but + // only the controller hidraw device receives hid reports. + size = SDL_hid_read_timeout(device->dev, data, sizeof(data), 16); + if (size == 0) + return SDL_FALSE; + + if (!DisableDeckLizardMode(device->dev)) + return SDL_FALSE; + + HIDAPI_SetDeviceName(device, "Steam Deck"); + + return HIDAPI_JoystickConnected(device, NULL); +} + +static int HIDAPI_DriverSteamDeck_GetDevicePlayerIndex(SDL_HIDAPI_Device *device, SDL_JoystickID instance_id) +{ + return -1; +} + +static void HIDAPI_DriverSteamDeck_SetDevicePlayerIndex(SDL_HIDAPI_Device *device, SDL_JoystickID instance_id, int player_index) +{ +} + +static SDL_bool HIDAPI_DriverSteamDeck_UpdateDevice(SDL_HIDAPI_Device *device) +{ + SDL_DriverSteamDeck_Context *ctx = (SDL_DriverSteamDeck_Context *)device->context; + SDL_Joystick *joystick = NULL; + int r; + uint8_t data[64]; + ValveInReport_t *pInReport = (ValveInReport_t *)data; + + if (device->num_joysticks > 0) { + joystick = SDL_JoystickFromInstanceID(device->joysticks[0]); + if (joystick == NULL) { + return SDL_FALSE; + } + } else { + return SDL_FALSE; + } + + if (ctx->watchdog_counter++ > 200) { + ctx->watchdog_counter = 0; + if (!FeedDeckLizardWatchdog(device->dev)) + return SDL_FALSE; + } + + SDL_memset(data, 0, sizeof(data)); + + do { + r = SDL_hid_read(device->dev, data, sizeof(data)); + + if (r < 0) { + /* Failed to read from controller */ + HIDAPI_JoystickDisconnected(device, device->joysticks[0]); + return SDL_FALSE; + } else if (r == 64 && + pInReport->header.unReportVersion == k_ValveInReportMsgVersion && + pInReport->header.ucType == ID_CONTROLLER_DECK_STATE && + pInReport->header.ucLength == 64) { + HIDAPI_DriverSteamDeck_HandleState(device, joystick, pInReport); + } + } while (r > 0); + + return SDL_TRUE; +} + +static SDL_bool HIDAPI_DriverSteamDeck_OpenJoystick(SDL_HIDAPI_Device *device, SDL_Joystick *joystick) +{ + SDL_DriverSteamDeck_Context *ctx = (SDL_DriverSteamDeck_Context *)device->context; + float update_rate_in_hz = 1.0f / (float)(ctx->update_rate_us) * 1.0e6f; + + SDL_AssertJoysticksLocked(); + + // Initialize the joystick capabilities + joystick->nbuttons = 20; + joystick->naxes = SDL_CONTROLLER_AXIS_MAX; + + SDL_PrivateJoystickAddSensor(joystick, SDL_SENSOR_GYRO, update_rate_in_hz); + SDL_PrivateJoystickAddSensor(joystick, SDL_SENSOR_ACCEL, update_rate_in_hz); + + return SDL_TRUE; +} + +static int HIDAPI_DriverSteamDeck_RumbleJoystick(SDL_HIDAPI_Device *device, SDL_Joystick *joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble) +{ + int rc; + Uint8 buffer[HID_FEATURE_REPORT_BYTES + 1] = { 0 }; + FeatureReportMsg *msg = (FeatureReportMsg *)(buffer + 1); + + msg->header.type = ID_TRIGGER_RUMBLE_CMD; + msg->payload.simpleRumble.unRumbleType = 0; + msg->payload.simpleRumble.unIntensity = HAPTIC_INTENSITY_SYSTEM; + msg->payload.simpleRumble.unLeftMotorSpeed = low_frequency_rumble; + msg->payload.simpleRumble.unRightMotorSpeed = high_frequency_rumble; + msg->payload.simpleRumble.nLeftGain = 2; + msg->payload.simpleRumble.nRightGain = 0; + + rc = SDL_hid_send_feature_report(device->dev, buffer, sizeof(buffer)); + if (rc != sizeof(buffer)) + return -1; + return 0; +} + +static int HIDAPI_DriverSteamDeck_RumbleJoystickTriggers(SDL_HIDAPI_Device *device, SDL_Joystick *joystick, Uint16 left_rumble, Uint16 right_rumble) +{ + return SDL_Unsupported(); +} + +static Uint32 HIDAPI_DriverSteamDeck_GetJoystickCapabilities(SDL_HIDAPI_Device *device, SDL_Joystick *joystick) +{ + return SDL_JOYCAP_RUMBLE; +} + +static int HIDAPI_DriverSteamDeck_SetJoystickLED(SDL_HIDAPI_Device *device, SDL_Joystick *joystick, Uint8 red, Uint8 green, Uint8 blue) +{ + return SDL_Unsupported(); +} + +static int HIDAPI_DriverSteamDeck_SendJoystickEffect(SDL_HIDAPI_Device *device, SDL_Joystick *joystick, const void *data, int size) +{ + return SDL_Unsupported(); +} + +static int HIDAPI_DriverSteamDeck_SetSensorsEnabled(SDL_HIDAPI_Device *device, SDL_Joystick *joystick, SDL_bool enabled) +{ + // On steam deck, sensors are enabled by default. Nothing to do here. + return 0; +} + +static void HIDAPI_DriverSteamDeck_CloseJoystick(SDL_HIDAPI_Device *device, SDL_Joystick *joystick) +{ + // Lizard mode id automatically re-enabled by watchdog. Nothing to do here. +} + +static void HIDAPI_DriverSteamDeck_FreeDevice(SDL_HIDAPI_Device *device) +{ +} + +SDL_HIDAPI_DeviceDriver SDL_HIDAPI_DriverSteamDeck = { + SDL_HINT_JOYSTICK_HIDAPI_STEAMDECK, + SDL_TRUE, + HIDAPI_DriverSteamDeck_RegisterHints, + HIDAPI_DriverSteamDeck_UnregisterHints, + HIDAPI_DriverSteamDeck_IsEnabled, + HIDAPI_DriverSteamDeck_IsSupportedDevice, + HIDAPI_DriverSteamDeck_InitDevice, + HIDAPI_DriverSteamDeck_GetDevicePlayerIndex, + HIDAPI_DriverSteamDeck_SetDevicePlayerIndex, + HIDAPI_DriverSteamDeck_UpdateDevice, + HIDAPI_DriverSteamDeck_OpenJoystick, + HIDAPI_DriverSteamDeck_RumbleJoystick, + HIDAPI_DriverSteamDeck_RumbleJoystickTriggers, + HIDAPI_DriverSteamDeck_GetJoystickCapabilities, + HIDAPI_DriverSteamDeck_SetJoystickLED, + HIDAPI_DriverSteamDeck_SendJoystickEffect, + HIDAPI_DriverSteamDeck_SetSensorsEnabled, + HIDAPI_DriverSteamDeck_CloseJoystick, + HIDAPI_DriverSteamDeck_FreeDevice, +}; + +#endif /* SDL_JOYSTICK_HIDAPI_STEAMDECK */ + +#endif /* SDL_JOYSTICK_HIDAPI */ diff --git a/thirdparty/SDL/src/joystick/hidapi/SDL_hidapi_switch.c b/thirdparty/SDL/src/joystick/hidapi/SDL_hidapi_switch.c index 6a983c896..ce9b15c0a 100644 --- a/thirdparty/SDL/src/joystick/hidapi/SDL_hidapi_switch.c +++ b/thirdparty/SDL/src/joystick/hidapi/SDL_hidapi_switch.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -274,6 +274,8 @@ typedef struct SDL_bool m_bSyncWrite; int m_nMaxWriteAttempts; ESwitchDeviceInfoControllerType m_eControllerType; + Uint8 m_nInitialInputMode; + Uint8 m_nCurrentInputMode; Uint8 m_rgucMACAddress[6]; Uint8 m_nCommandNumber; SwitchCommonOutputPacket_t m_RumblePacket; @@ -330,12 +332,28 @@ typedef struct static int ReadInput(SDL_DriverSwitch_Context *ctx) { + int result; + /* Make sure we don't try to read at the same time a write is happening */ if (SDL_AtomicGet(&ctx->device->rumble_pending) > 0) { return 0; } - return SDL_hid_read_timeout(ctx->device->dev, ctx->m_rgucReadBuffer, sizeof(ctx->m_rgucReadBuffer), 0); + result = SDL_hid_read_timeout(ctx->device->dev, ctx->m_rgucReadBuffer, sizeof(ctx->m_rgucReadBuffer), 0); + + /* See if we can guess the initial input mode */ + if (result > 0 && !ctx->m_bInputOnly && !ctx->m_nInitialInputMode) { + switch (ctx->m_rgucReadBuffer[0]) { + case k_eSwitchInputReportIDs_FullControllerState: + case k_eSwitchInputReportIDs_FullControllerAndMcuState: + case k_eSwitchInputReportIDs_SimpleControllerState: + ctx->m_nInitialInputMode = ctx->m_rgucReadBuffer[0]; + break; + default: + break; + } + } + return result; } static int WriteOutput(SDL_DriverSwitch_Context *ctx, const Uint8 *data, int size) @@ -444,7 +462,7 @@ static SDL_bool WriteSubcommand(SDL_DriverSwitch_Context *ctx, ESwitchSubcommand SwitchSubcommandInputPacket_t *reply = NULL; int nTries; - for (nTries = 1; reply == NULL && nTries <= ctx->m_nMaxWriteAttempts; ++nTries) { + for (nTries = 1; !reply && nTries <= ctx->m_nMaxWriteAttempts; ++nTries) { SwitchSubcommandOutputPacket_t commandPacket; ConstructSubcommand(ctx, ucCommandID, pBuf, ucLen, &commandPacket); @@ -468,7 +486,7 @@ static SDL_bool WriteProprietary(SDL_DriverSwitch_Context *ctx, ESwitchProprieta for (nTries = 1; nTries <= ctx->m_nMaxWriteAttempts; ++nTries) { SwitchProprietaryOutputPacket_t packet; - if ((pBuf == NULL && ucLen > 0) || ucLen > sizeof(packet.rgucProprietaryData)) { + if ((!pBuf && ucLen > 0) || ucLen > sizeof(packet.rgucProprietaryData)) { return SDL_FALSE; } @@ -653,7 +671,13 @@ static SDL_bool SetVibrationEnabled(SDL_DriverSwitch_Context *ctx, Uint8 enabled } static SDL_bool SetInputMode(SDL_DriverSwitch_Context *ctx, Uint8 input_mode) { - return WriteSubcommand(ctx, k_eSwitchSubcommandIDs_SetInputReportMode, &input_mode, 1, NULL); + if (input_mode == ctx->m_nCurrentInputMode) { + return SDL_TRUE; + } else { + ctx->m_nCurrentInputMode = input_mode; + + return WriteSubcommand(ctx, k_eSwitchSubcommandIDs_SetInputReportMode, &input_mode, sizeof(input_mode), NULL); + } } static SDL_bool SetHomeLED(SDL_DriverSwitch_Context *ctx, Uint8 brightness) @@ -719,15 +743,27 @@ static void SDLCALL SDL_PlayerLEDHintChanged(void *userdata, const char *name, c } } +static void GetInitialInputMode(SDL_DriverSwitch_Context *ctx) +{ + if (!ctx->m_nInitialInputMode) { + /* This will set the initial input mode if it can */ + ReadInput(ctx); + } +} + static Uint8 GetDefaultInputMode(SDL_DriverSwitch_Context *ctx) { Uint8 input_mode; /* Determine the desired input mode */ - if (ctx->device->is_bluetooth) { - input_mode = k_eSwitchInputReportIDs_SimpleControllerState; + if (ctx->m_nInitialInputMode) { + input_mode = ctx->m_nInitialInputMode; } else { - input_mode = k_eSwitchInputReportIDs_FullControllerState; + if (ctx->device->is_bluetooth) { + input_mode = k_eSwitchInputReportIDs_SimpleControllerState; + } else { + input_mode = k_eSwitchInputReportIDs_FullControllerState; + } } /* The official Nintendo Switch Pro Controller supports FullControllerState over Bluetooth @@ -736,7 +772,32 @@ static Uint8 GetDefaultInputMode(SDL_DriverSwitch_Context *ctx) * battery level over Bluetooth anyway. */ if (ctx->device->vendor_id == USB_VENDOR_NINTENDO) { + /* However, switching to full controller state breaks DirectInput, so let's not do that */ + #if 0 + input_mode = k_eSwitchInputReportIDs_FullControllerState; + #endif + + /* However, Joy-Con controllers switch their thumbsticks into D-pad mode in simple mode, + * so let's enable full controller state for them. + */ + if (ctx->device->product_id == USB_PRODUCT_NINTENDO_SWITCH_JOYCON_LEFT || + ctx->device->product_id == USB_PRODUCT_NINTENDO_SWITCH_JOYCON_RIGHT) { + input_mode = k_eSwitchInputReportIDs_FullControllerState; + } + } + return input_mode; +} + +static Uint8 GetSensorInputMode(SDL_DriverSwitch_Context *ctx) +{ + Uint8 input_mode; + + /* Determine the desired input mode */ + if (!ctx->m_nInitialInputMode || + ctx->m_nInitialInputMode == k_eSwitchInputReportIDs_SimpleControllerState) { input_mode = k_eSwitchInputReportIDs_FullControllerState; + } else { + input_mode = ctx->m_nInitialInputMode; } return input_mode; } @@ -1256,6 +1317,27 @@ static void UpdateDeviceIdentity(SDL_HIDAPI_Device *device) break; case k_eSwitchDeviceInfoControllerType_Unknown: /* We couldn't read the device info for this controller, might not be fully compliant */ + if (device->vendor_id == USB_VENDOR_NINTENDO) { + switch (device->product_id) { + case USB_PRODUCT_NINTENDO_SWITCH_JOYCON_LEFT: + ctx->m_eControllerType = k_eSwitchDeviceInfoControllerType_JoyConLeft; + HIDAPI_SetDeviceName(device, "Nintendo Switch Joy-Con (L)"); + device->type = SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_JOYCON_LEFT; + break; + case USB_PRODUCT_NINTENDO_SWITCH_JOYCON_RIGHT: + ctx->m_eControllerType = k_eSwitchDeviceInfoControllerType_JoyConRight; + HIDAPI_SetDeviceName(device, "Nintendo Switch Joy-Con (R)"); + device->type = SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_JOYCON_RIGHT; + break; + case USB_PRODUCT_NINTENDO_SWITCH_PRO: + ctx->m_eControllerType = k_eSwitchDeviceInfoControllerType_ProController; + HIDAPI_SetDeviceName(device, "Nintendo Switch Pro Controller"); + device->type = SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_PRO; + break; + default: + break; + } + } return; default: device->type = SDL_CONTROLLER_TYPE_UNKNOWN; @@ -1278,7 +1360,7 @@ static SDL_bool HIDAPI_DriverSwitch_InitDevice(SDL_HIDAPI_Device *device) SDL_DriverSwitch_Context *ctx; ctx = (SDL_DriverSwitch_Context *)SDL_calloc(1, sizeof(*ctx)); - if (ctx == NULL) { + if (!ctx) { SDL_OutOfMemory(); return SDL_FALSE; } @@ -1344,6 +1426,9 @@ static SDL_bool HIDAPI_DriverSwitch_OpenJoystick(SDL_HIDAPI_Device *device, SDL_ ctx->m_bSyncWrite = SDL_TRUE; if (!ctx->m_bInputOnly) { + GetInitialInputMode(ctx); + ctx->m_nCurrentInputMode = ctx->m_nInitialInputMode; + /* Initialize rumble data */ SetNeutralRumble(&ctx->m_RumblePacket.rumbleData[0]); SetNeutralRumble(&ctx->m_RumblePacket.rumbleData[1]); @@ -1595,7 +1680,7 @@ static int HIDAPI_DriverSwitch_SetJoystickSensorsEnabled(SDL_HIDAPI_Device *devi Uint8 input_mode; if (enabled) { - input_mode = k_eSwitchInputReportIDs_FullControllerState; + input_mode = GetSensorInputMode(ctx); } else { input_mode = GetDefaultInputMode(ctx); } @@ -2168,13 +2253,19 @@ static SDL_bool HIDAPI_DriverSwitch_UpdateDevice(SDL_HIDAPI_Device *device) ++packet_count; ctx->m_unLastInput = now; - if (joystick == NULL) { + if (!joystick) { + continue; + } + + if (ctx->m_rgucReadBuffer[0] == k_eSwitchInputReportIDs_SubcommandReply) { continue; } if (ctx->m_bInputOnly) { HandleInputOnlyControllerState(joystick, ctx, (SwitchInputOnlyControllerStatePacket_t *)&ctx->m_rgucReadBuffer[0]); } else { + ctx->m_nCurrentInputMode = ctx->m_rgucReadBuffer[0]; + switch (ctx->m_rgucReadBuffer[0]) { case k_eSwitchInputReportIDs_SimpleControllerState: HandleSimpleControllerState(joystick, ctx, (SwitchSimpleStatePacket_t *)&ctx->m_rgucReadBuffer[1]); @@ -2241,7 +2332,10 @@ static void HIDAPI_DriverSwitch_CloseJoystick(SDL_HIDAPI_Device *device, SDL_Joy if (!ctx->m_bInputOnly) { /* Restore simple input mode for other applications */ - SetInputMode(ctx, k_eSwitchInputReportIDs_SimpleControllerState); + if (!ctx->m_nInitialInputMode || + ctx->m_nInitialInputMode == k_eSwitchInputReportIDs_SimpleControllerState) { + SetInputMode(ctx, k_eSwitchInputReportIDs_SimpleControllerState); + } } SDL_DelHintCallback(SDL_HINT_GAMECONTROLLER_USE_BUTTON_LABELS, diff --git a/thirdparty/SDL/src/joystick/hidapi/SDL_hidapi_wii.c b/thirdparty/SDL/src/joystick/hidapi/SDL_hidapi_wii.c index 3471b777a..3b3d99448 100644 --- a/thirdparty/SDL/src/joystick/hidapi/SDL_hidapi_wii.c +++ b/thirdparty/SDL/src/joystick/hidapi/SDL_hidapi_wii.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -236,7 +236,7 @@ static SDL_bool ReadInputSync(SDL_DriverWii_Context *ctx, EWiiInputReportIDs exp int nRead = 0; while ((nRead = ReadInput(ctx)) != -1) { if (nRead > 0) { - if (ctx->m_rgucReadBuffer[0] == expectedID && (isMine == NULL || isMine(ctx->m_rgucReadBuffer))) { + if (ctx->m_rgucReadBuffer[0] == expectedID && (!isMine || isMine(ctx->m_rgucReadBuffer))) { return SDL_TRUE; } } else { @@ -733,7 +733,7 @@ static SDL_bool HIDAPI_DriverWii_InitDevice(SDL_HIDAPI_Device *device) SDL_DriverWii_Context *ctx; ctx = (SDL_DriverWii_Context *)SDL_calloc(1, sizeof(*ctx)); - if (ctx == NULL) { + if (!ctx) { SDL_OutOfMemory(); return SDL_FALSE; } diff --git a/thirdparty/SDL/src/joystick/hidapi/SDL_hidapi_xbox360.c b/thirdparty/SDL/src/joystick/hidapi/SDL_hidapi_xbox360.c index 843819f37..2917fffa7 100644 --- a/thirdparty/SDL/src/joystick/hidapi/SDL_hidapi_xbox360.c +++ b/thirdparty/SDL/src/joystick/hidapi/SDL_hidapi_xbox360.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -143,7 +143,7 @@ static SDL_bool HIDAPI_DriverXbox360_InitDevice(SDL_HIDAPI_Device *device) SDL_DriverXbox360_Context *ctx; ctx = (SDL_DriverXbox360_Context *)SDL_calloc(1, sizeof(*ctx)); - if (ctx == NULL) { + if (!ctx) { SDL_OutOfMemory(); return SDL_FALSE; } @@ -332,7 +332,7 @@ static SDL_bool HIDAPI_DriverXbox360_UpdateDevice(SDL_HIDAPI_Device *device) #ifdef DEBUG_XBOX_PROTOCOL HIDAPI_DumpPacket("Xbox 360 packet: size = %d", data, size); #endif - if (joystick == NULL) { + if (!joystick) { continue; } diff --git a/thirdparty/SDL/src/joystick/hidapi/SDL_hidapi_xbox360w.c b/thirdparty/SDL/src/joystick/hidapi/SDL_hidapi_xbox360w.c index 5223d1a5b..9c44085eb 100644 --- a/thirdparty/SDL/src/joystick/hidapi/SDL_hidapi_xbox360w.c +++ b/thirdparty/SDL/src/joystick/hidapi/SDL_hidapi_xbox360w.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -135,7 +135,7 @@ static SDL_bool HIDAPI_DriverXbox360W_InitDevice(SDL_HIDAPI_Device *device) HIDAPI_SetDeviceName(device, "Xbox 360 Wireless Controller"); ctx = (SDL_DriverXbox360W_Context *)SDL_calloc(1, sizeof(*ctx)); - if (ctx == NULL) { + if (!ctx) { SDL_OutOfMemory(); return SDL_FALSE; } @@ -162,7 +162,7 @@ static void HIDAPI_DriverXbox360W_SetDevicePlayerIndex(SDL_HIDAPI_Device *device { SDL_DriverXbox360W_Context *ctx = (SDL_DriverXbox360W_Context *)device->context; - if (ctx == NULL) { + if (!ctx) { return; } diff --git a/thirdparty/SDL/src/joystick/hidapi/SDL_hidapi_xboxone.c b/thirdparty/SDL/src/joystick/hidapi/SDL_hidapi_xboxone.c index 755daa5dd..497234a91 100644 --- a/thirdparty/SDL/src/joystick/hidapi/SDL_hidapi_xboxone.c +++ b/thirdparty/SDL/src/joystick/hidapi/SDL_hidapi_xboxone.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -368,7 +368,7 @@ static SDL_bool HIDAPI_DriverXboxOne_InitDevice(SDL_HIDAPI_Device *device) SDL_DriverXboxOne_Context *ctx; ctx = (SDL_DriverXboxOne_Context *)SDL_calloc(1, sizeof(*ctx)); - if (ctx == NULL) { + if (!ctx) { SDL_OutOfMemory(); return SDL_FALSE; } @@ -1159,7 +1159,7 @@ static SDL_bool HIDAPI_DriverXboxOne_UpdateDevice(SDL_HIDAPI_Device *device) if (ctx->bluetooth) { switch (data[0]) { case 0x01: - if (joystick == NULL) { + if (!joystick) { break; } if (size >= 16) { @@ -1171,13 +1171,13 @@ static SDL_bool HIDAPI_DriverXboxOne_UpdateDevice(SDL_HIDAPI_Device *device) } break; case 0x02: - if (joystick == NULL) { + if (!joystick) { break; } HIDAPI_DriverXboxOneBluetooth_HandleGuidePacket(joystick, ctx, data, size); break; case 0x04: - if (joystick == NULL) { + if (!joystick) { break; } HIDAPI_DriverXboxOneBluetooth_HandleBatteryPacket(joystick, ctx, data, size); @@ -1225,7 +1225,7 @@ static SDL_bool HIDAPI_DriverXboxOne_UpdateDevice(SDL_HIDAPI_Device *device) break; case 0x03: /* Controller status update */ - if (joystick == NULL) { + if (!joystick) { /* We actually want to handle this packet any time it arrives */ /*break;*/ } @@ -1238,13 +1238,13 @@ static SDL_bool HIDAPI_DriverXboxOne_UpdateDevice(SDL_HIDAPI_Device *device) /* Unknown chatty controller information, sent by both sides */ break; case 0x07: - if (joystick == NULL) { + if (!joystick) { break; } HIDAPI_DriverXboxOne_HandleModePacket(joystick, ctx, data, size); break; case 0x0C: - if (joystick == NULL) { + if (!joystick) { break; } HIDAPI_DriverXboxOne_HandleUnmappedStatePacket(joystick, ctx, data, size); @@ -1259,7 +1259,7 @@ static SDL_bool HIDAPI_DriverXboxOne_UpdateDevice(SDL_HIDAPI_Device *device) The controller sends that in response to this request: 0x1E 0x30 0x07 0x01 0x04 */ - if (joystick == NULL) { + if (!joystick) { break; } #ifdef SET_SERIAL_AFTER_OPEN @@ -1278,7 +1278,7 @@ static SDL_bool HIDAPI_DriverXboxOne_UpdateDevice(SDL_HIDAPI_Device *device) #endif break; } - if (joystick == NULL) { + if (!joystick) { break; } HIDAPI_DriverXboxOne_HandleStatePacket(joystick, ctx, data, size); diff --git a/thirdparty/SDL/src/joystick/hidapi/SDL_hidapijoystick.c b/thirdparty/SDL/src/joystick/hidapi/SDL_hidapijoystick.c index 201db43e8..863785eec 100644 --- a/thirdparty/SDL/src/joystick/hidapi/SDL_hidapijoystick.c +++ b/thirdparty/SDL/src/joystick/hidapi/SDL_hidapijoystick.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -71,6 +71,9 @@ static SDL_HIDAPI_DeviceDriver *SDL_HIDAPI_drivers[] = { #ifdef SDL_JOYSTICK_HIDAPI_STEAM &SDL_HIDAPI_DriverSteam, #endif +#ifdef SDL_JOYSTICK_HIDAPI_STEAMDECK + &SDL_HIDAPI_DriverSteamDeck, +#endif #ifdef SDL_JOYSTICK_HIDAPI_SWITCH &SDL_HIDAPI_DriverNintendoClassic, &SDL_HIDAPI_DriverJoyCons, @@ -104,7 +107,7 @@ static char *HIDAPI_ConvertString(const wchar_t *wide_string) if (wide_string) { string = SDL_iconv_string("UTF-8", "WCHAR_T", (char *)wide_string, (SDL_wcslen(wide_string) + 1) * sizeof(wchar_t)); - if (string == NULL) { + if (!string) { switch (sizeof(wchar_t)) { case 2: string = SDL_iconv_string("UTF-8", "UCS-2-INTERNAL", (char *)wide_string, (SDL_wcslen(wide_string) + 1) * sizeof(wchar_t)); @@ -154,14 +157,22 @@ SDL_bool HIDAPI_SupportsPlaystationDetection(Uint16 vendor, Uint16 product) case USB_VENDOR_HORI: return SDL_TRUE; case USB_VENDOR_LOGITECH: - /* Most Logitech devices are fine with this, but the F310 will lock up */ - if (product == USB_PRODUCT_LOGITECH_F310) { + /* Most Logitech devices are not PlayStation controllers, and some of them + * lock up or reset when we send them the Sony third-party query feature + * report, so don't include that vendor here. Instead add devices as + * appropriate to controller_list.h + */ + return SDL_FALSE; + case USB_VENDOR_MADCATZ: + if (product == USB_PRODUCT_MADCATZ_SAITEK_SIDE_PANEL_CONTROL_DECK) { + /* This is not a Playstation compatible device */ return SDL_FALSE; } return SDL_TRUE; - case USB_VENDOR_MADCATZ: + case USB_VENDOR_MAYFLASH: return SDL_TRUE; case USB_VENDOR_NACON: + case USB_VENDOR_NACON_ALT: return SDL_TRUE; case USB_VENDOR_PDP: return SDL_TRUE; @@ -172,10 +183,10 @@ SDL_bool HIDAPI_SupportsPlaystationDetection(Uint16 vendor, Uint16 product) case USB_VENDOR_QANBA: return SDL_TRUE; case USB_VENDOR_RAZER: - /* Most Razer devices are not game controllers, and some of them lock up - * or reset when we send them the Sony third-party query feature report, - * so don't include that vendor here. Instead add devices as appropriate - * to controller_type.c + /* Most Razer devices are not PlayStation controllers, and some of them + * lock up or reset when we send them the Sony third-party query feature + * report, so don't include that vendor here. Instead add devices as + * appropriate to controller_list.h * * Reference: https://github.com/libsdl-org/SDL/issues/6733 * https://github.com/libsdl-org/SDL/issues/6799 @@ -269,6 +280,7 @@ static SDL_GameControllerType SDL_GetJoystickGameControllerProtocol(const char * 0x044f, /* Thrustmaster */ 0x045e, /* Microsoft */ 0x0738, /* Mad Catz */ + 0x0b05, /* ASUS */ 0x0e6f, /* PDP */ 0x0f0d, /* Hori */ 0x10f5, /* Turtle Beach */ @@ -277,6 +289,7 @@ static SDL_GameControllerType SDL_GetJoystickGameControllerProtocol(const char * 0x24c6, /* PowerA */ 0x2dc8, /* 8BitDo */ 0x2e24, /* Hyperkin */ + 0x3537, /* GameSir */ }; int i; @@ -612,7 +625,7 @@ static int HIDAPI_JoystickInit(void) static SDL_bool HIDAPI_AddJoystickInstanceToDevice(SDL_HIDAPI_Device *device, SDL_JoystickID joystickID) { SDL_JoystickID *joysticks = (SDL_JoystickID *)SDL_realloc(device->joysticks, (device->num_joysticks + 1) * sizeof(*device->joysticks)); - if (joysticks == NULL) { + if (!joysticks) { return SDL_FALSE; } @@ -661,7 +674,7 @@ void HIDAPI_SetDeviceName(SDL_HIDAPI_Device *device, const char *name) void HIDAPI_SetDeviceProduct(SDL_HIDAPI_Device *device, Uint16 vendor_id, Uint16 product_id) { /* Don't set the device product ID directly, or we'll constantly re-enumerate this device */ - device->guid = SDL_CreateJoystickGUID(device->guid.data[0], vendor_id, product_id, device->version, device->name, 'h', 0); + device->guid = SDL_CreateJoystickGUID(device->guid.data[0], vendor_id, product_id, device->version, device->manufacturer_string, device->product_string, 'h', 0); } static void HIDAPI_UpdateJoystickSerial(SDL_HIDAPI_Device *device) @@ -732,7 +745,7 @@ SDL_bool HIDAPI_HasConnectedUSBDevice(const char *serial) SDL_AssertJoysticksLocked(); - if (serial == NULL) { + if (!serial) { return SDL_FALSE; } @@ -758,7 +771,7 @@ void HIDAPI_DisconnectBluetoothDevice(const char *serial) SDL_AssertJoysticksLocked(); - if (serial == NULL) { + if (!serial) { return; } @@ -867,7 +880,7 @@ static SDL_HIDAPI_Device *HIDAPI_AddDevice(const struct SDL_hid_device_info *inf } device = (SDL_HIDAPI_Device *)SDL_calloc(1, sizeof(*device)); - if (device == NULL) { + if (!device) { return NULL; } device->magic = &SDL_HIDAPI_device_magic; @@ -890,18 +903,11 @@ static SDL_HIDAPI_Device *HIDAPI_AddDevice(const struct SDL_hid_device_info *inf /* Need the device name before getting the driver to know whether to ignore this device */ { - char *manufacturer_string = HIDAPI_ConvertString(info->manufacturer_string); - char *product_string = HIDAPI_ConvertString(info->product_string); char *serial_number = HIDAPI_ConvertString(info->serial_number); - device->name = SDL_CreateJoystickName(device->vendor_id, device->product_id, manufacturer_string, product_string); - - if (manufacturer_string) { - SDL_free(manufacturer_string); - } - if (product_string) { - SDL_free(product_string); - } + device->manufacturer_string = HIDAPI_ConvertString(info->manufacturer_string); + device->product_string = HIDAPI_ConvertString(info->product_string); + device->name = SDL_CreateJoystickName(device->vendor_id, device->product_id, device->manufacturer_string, device->product_string); if (serial_number && *serial_number) { device->serial = serial_number; @@ -910,6 +916,8 @@ static SDL_HIDAPI_Device *HIDAPI_AddDevice(const struct SDL_hid_device_info *inf } if (!device->name) { + SDL_free(device->manufacturer_string); + SDL_free(device->product_string); SDL_free(device->serial); SDL_free(device->path); SDL_free(device); @@ -918,7 +926,7 @@ static SDL_HIDAPI_Device *HIDAPI_AddDevice(const struct SDL_hid_device_info *inf } /* FIXME: Is there any way to tell whether this is a Bluetooth device? */ - device->guid = SDL_CreateJoystickGUID(SDL_HARDWARE_BUS_USB, device->vendor_id, device->product_id, device->version, device->name, 'h', 0); + device->guid = SDL_CreateJoystickGUID(SDL_HARDWARE_BUS_USB, device->vendor_id, device->product_id, device->version, device->manufacturer_string, device->product_string, 'h', 0); device->joystick_type = SDL_JOYSTICK_TYPE_GAMECONTROLLER; device->type = SDL_GetJoystickGameControllerProtocol(device->name, device->vendor_id, device->product_id, device->interface_number, device->interface_class, device->interface_subclass, device->interface_protocol); @@ -946,7 +954,9 @@ static SDL_HIDAPI_Device *HIDAPI_AddDevice(const struct SDL_hid_device_info *inf } #ifdef DEBUG_HIDAPI - SDL_Log("Added HIDAPI device '%s' VID 0x%.4x, PID 0x%.4x, version %d, serial %s, interface %d, interface_class %d, interface_subclass %d, interface_protocol %d, usage page 0x%.4x, usage 0x%.4x, path = %s, driver = %s (%s)\n", device->name, device->vendor_id, device->product_id, device->version, device->serial ? device->serial : "NONE", device->interface_number, device->interface_class, device->interface_subclass, device->interface_protocol, device->usage_page, device->usage, device->path, device->driver ? device->driver->name : "NONE", device->driver && device->driver->enabled ? "ENABLED" : "DISABLED"); + SDL_Log("Added HIDAPI device '%s' VID 0x%.4x, PID 0x%.4x, version %d, serial %s, interface %d, interface_class %d, interface_subclass %d, interface_protocol %d, usage page 0x%.4x, usage 0x%.4x, path = %s, driver = %s (%s)\n", device->name, device->vendor_id, device->product_id, device->version, + device->serial ? device->serial : "NONE", device->interface_number, device->interface_class, device->interface_subclass, device->interface_protocol, device->usage_page, device->usage, + device->path, device->driver ? device->driver->name : "NONE", device->driver && device->driver->enabled ? "ENABLED" : "DISABLED"); #endif return device; @@ -960,7 +970,9 @@ static void HIDAPI_DelDevice(SDL_HIDAPI_Device *device) SDL_AssertJoysticksLocked(); #ifdef DEBUG_HIDAPI - SDL_Log("Removing HIDAPI device '%s' VID 0x%.4x, PID 0x%.4x, version %d, serial %s, interface %d, interface_class %d, interface_subclass %d, interface_protocol %d, usage page 0x%.4x, usage 0x%.4x, path = %s, driver = %s (%s)\n", device->name, device->vendor_id, device->product_id, device->version, device->serial ? device->serial : "NONE", device->interface_number, device->interface_class, device->interface_subclass, device->interface_protocol, device->usage_page, device->usage, device->path, device->driver ? device->driver->name : "NONE", device->driver && device->driver->enabled ? "ENABLED" : "DISABLED"); + SDL_Log("Removing HIDAPI device '%s' VID 0x%.4x, PID 0x%.4x, version %d, serial %s, interface %d, interface_class %d, interface_subclass %d, interface_protocol %d, usage page 0x%.4x, usage 0x%.4x, path = %s, driver = %s (%s)\n", device->name, device->vendor_id, device->product_id, device->version, + device->serial ? device->serial : "NONE", device->interface_number, device->interface_class, device->interface_subclass, device->interface_protocol, device->usage_page, device->usage, + device->path, device->driver ? device->driver->name : "NONE", device->driver && device->driver->enabled ? "ENABLED" : "DISABLED"); #endif for (curr = SDL_HIDAPI_devices, last = NULL; curr; last = curr, curr = curr->next) { @@ -984,6 +996,8 @@ static void HIDAPI_DelDevice(SDL_HIDAPI_Device *device) device->magic = NULL; SDL_DestroyMutex(device->dev_lock); + SDL_free(device->manufacturer_string); + SDL_free(device->product_string); SDL_free(device->serial); SDL_free(device->name); SDL_free(device->path); @@ -994,7 +1008,7 @@ static void HIDAPI_DelDevice(SDL_HIDAPI_Device *device) } } -static SDL_bool HIDAPI_CreateCombinedJoyCons() +static SDL_bool HIDAPI_CreateCombinedJoyCons(void) { SDL_HIDAPI_Device *device, *combined; SDL_HIDAPI_Device *joycons[2] = { NULL, NULL }; @@ -1034,7 +1048,7 @@ static SDL_bool HIDAPI_CreateCombinedJoyCons() if (joycons[0] && joycons[1]) { SDL_hid_device_info info; SDL_HIDAPI_Device **children = (SDL_HIDAPI_Device **)SDL_malloc(2 * sizeof(SDL_HIDAPI_Device *)); - if (children == NULL) { + if (!children) { return SDL_FALSE; } children[0] = joycons[0]; @@ -1165,7 +1179,7 @@ static SDL_bool HIDAPI_IsEquivalentToDevice(Uint16 vendor_id, Uint16 product_id, } /* If we're looking for an XInput controller, match it against any other Xbox controller */ - if (product_id == USB_PRODUCT_XBOX_ONE_XINPUT_CONTROLLER) { + if (product_id == USB_PRODUCT_XBOX360_XUSB_CONTROLLER) { if (device->type == SDL_CONTROLLER_TYPE_XBOX360 || device->type == SDL_CONTROLLER_TYPE_XBOXONE) { return SDL_TRUE; } @@ -1364,6 +1378,11 @@ static const char *HIDAPI_JoystickGetDevicePath(int device_index) return path; } +static int HIDAPI_JoystickGetDeviceSteamVirtualGamepadSlot(int device_index) +{ + return -1; +} + static int HIDAPI_JoystickGetDevicePlayerIndex(int device_index) { SDL_HIDAPI_Device *device; @@ -1419,13 +1438,13 @@ static int HIDAPI_JoystickOpen(SDL_Joystick *joystick, int device_index) SDL_AssertJoysticksLocked(); - if (device == NULL || !device->driver) { + if (!device || !device->driver) { /* This should never happen - validated before being called */ return SDL_SetError("Couldn't find HIDAPI device at index %d\n", device_index); } hwdata = (struct joystick_hwdata *)SDL_calloc(1, sizeof(*hwdata)); - if (hwdata == NULL) { + if (!hwdata) { return SDL_OutOfMemory(); } hwdata->device = device; @@ -1642,6 +1661,7 @@ SDL_JoystickDriver SDL_HIDAPI_JoystickDriver = { HIDAPI_JoystickDetect, HIDAPI_JoystickGetDeviceName, HIDAPI_JoystickGetDevicePath, + HIDAPI_JoystickGetDeviceSteamVirtualGamepadSlot, HIDAPI_JoystickGetDevicePlayerIndex, HIDAPI_JoystickSetDevicePlayerIndex, HIDAPI_JoystickGetDeviceGUID, diff --git a/thirdparty/SDL/src/joystick/hidapi/SDL_hidapijoystick_c.h b/thirdparty/SDL/src/joystick/hidapi/SDL_hidapijoystick_c.h index d17203f43..738c43abe 100644 --- a/thirdparty/SDL/src/joystick/hidapi/SDL_hidapijoystick_c.h +++ b/thirdparty/SDL/src/joystick/hidapi/SDL_hidapijoystick_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -39,6 +39,7 @@ #define SDL_JOYSTICK_HIDAPI_PS5 #define SDL_JOYSTICK_HIDAPI_STADIA #define SDL_JOYSTICK_HIDAPI_STEAM /* Simple support for BLE Steam Controller, hint is disabled by default */ +#define SDL_JOYSTICK_HIDAPI_STEAMDECK #define SDL_JOYSTICK_HIDAPI_SWITCH #define SDL_JOYSTICK_HIDAPI_WII #define SDL_JOYSTICK_HIDAPI_XBOX360 @@ -46,7 +47,14 @@ #define SDL_JOYSTICK_HIDAPI_SHIELD /* Whether HIDAPI is enabled by default */ +#if defined(__ANDROID__) || \ + defined(__IPHONEOS__) || \ + defined(__TVOS__) +/* On Android, HIDAPI prompts for permissions and acquires exclusive access to the device, and on Apple mobile platforms it doesn't do anything except for handling Bluetooth Steam Controllers, so we'll leave it off by default. */ +#define SDL_HIDAPI_DEFAULT SDL_FALSE +#else #define SDL_HIDAPI_DEFAULT SDL_TRUE +#endif /* The maximum size of a USB packet for HID devices */ #define USB_PACKET_LENGTH 64 @@ -58,6 +66,8 @@ typedef struct _SDL_HIDAPI_Device { const void *magic; char *name; + char *manufacturer_string; + char *product_string; char *path; Uint16 vendor_id; Uint16 product_id; @@ -132,6 +142,7 @@ extern SDL_HIDAPI_DeviceDriver SDL_HIDAPI_DriverPS5; extern SDL_HIDAPI_DeviceDriver SDL_HIDAPI_DriverShield; extern SDL_HIDAPI_DeviceDriver SDL_HIDAPI_DriverStadia; extern SDL_HIDAPI_DeviceDriver SDL_HIDAPI_DriverSteam; +extern SDL_HIDAPI_DeviceDriver SDL_HIDAPI_DriverSteamDeck; extern SDL_HIDAPI_DeviceDriver SDL_HIDAPI_DriverSwitch; extern SDL_HIDAPI_DeviceDriver SDL_HIDAPI_DriverWii; extern SDL_HIDAPI_DeviceDriver SDL_HIDAPI_DriverXbox360; diff --git a/thirdparty/SDL/src/joystick/hidapi/steam/controller_constants.h b/thirdparty/SDL/src/joystick/hidapi/steam/controller_constants.h index d0d568851..ab4ac2ee1 100644 --- a/thirdparty/SDL/src/joystick/hidapi/steam/controller_constants.h +++ b/thirdparty/SDL/src/joystick/hidapi/steam/controller_constants.h @@ -47,6 +47,8 @@ enum ValveControllerPID D0G_BLE_PID = 0x1105, D0G_BLE2_PID = 0x1106, D0GGLE_PID = 0x1142, + + JUPITER_PID = 0x1205, }; // This enum contains all of the messages exchanged between the host and the target (only add to this enum and never change the order) @@ -68,10 +70,11 @@ enum FeatureReportMessageIDs ID_SET_CONTROLLER_MODE = 0x8D, ID_LOAD_DEFAULT_SETTINGS = 0x8E, ID_TRIGGER_HAPTIC_PULSE = 0x8F, + ID_TURN_OFF_CONTROLLER = 0x9F, ID_GET_DEVICE_INFO = 0xA1, - + ID_CALIBRATE_TRACKPADS = 0xA7, ID_RESERVED_0 = 0xA8, ID_SET_SERIAL_NUMBER = 0xA9, @@ -99,6 +102,12 @@ enum FeatureReportMessageIDs ID_CHECK_GYRO_FW_LOAD = 0xC2, ID_CALIBRATE_ANALOG = 0xC3, ID_DONGLE_GET_CONNECTED_SLOTS = 0xC4, + + ID_RESET_IMU = 0xCE, + + // Deck only + ID_TRIGGER_HAPTIC_CMD = 0xEA, + ID_TRIGGER_RUMBLE_CMD = 0xEB, }; @@ -215,6 +224,32 @@ typedef enum IO_RAW_JOYSTICK_X, IO_RAW_JOYSTICK_Y, IO_GYRO_TILT_VEC, + IO_PRESSURE_LEFT_PAD, + IO_PRESSURE_RIGHT_PAD, + IO_PRESSURE_LEFT_BUMPER, + IO_PRESSURE_RIGHT_BUMPER, + IO_PRESSURE_LEFT_GRIP, + IO_PRESSURE_RIGHT_GRIP, + IO_ANALOG_LEFT_TRIGGER_THRESHOLD, + IO_ANALOG_RIGHT_TRIGGER_THRESHOLD, + IO_PRESSURE_RIGHT_PAD_THRESHOLD, + IO_PRESSURE_LEFT_PAD_THRESHOLD, + IO_PRESSURE_RIGHT_BUMPER_THRESHOLD, + IO_PRESSURE_LEFT_BUMPER_THRESHOLD, + IO_PRESSURE_RIGHT_GRIP_THRESHOLD, + IO_PRESSURE_LEFT_GRIP_THRESHOLD, + IO_PRESSURE_RIGHT_PAD_RAW, + IO_PRESSURE_LEFT_PAD_RAW, + IO_PRESSURE_RIGHT_BUMPER_RAW, + IO_PRESSURE_LEFT_BUMPER_RAW, + IO_PRESSURE_RIGHT_GRIP_RAW, + IO_PRESSURE_LEFT_GRIP_RAW, + IO_PRESSURE_RIGHT_GRIP2_THRESHOLD, + IO_PRESSURE_LEFT_GRIP2_THRESHOLD, + IO_PRESSURE_LEFT_GRIP2, + IO_PRESSURE_RIGHT_GRIP2, + IO_PRESSURE_RIGHT_GRIP2_RAW, + IO_PRESSURE_LEFT_GRIP2_RAW, IO_ANALOG_COUNT } AnalogIO; @@ -382,13 +417,15 @@ typedef enum SETTING_MOUSE_SENSITIVITY, SETTING_MOUSE_ACCELERATION, SETTING_TRACKBALL_ROTATION_ANGLE, - SETTING_HAPTIC_INTENSITY, + SETTING_HAPTIC_INTENSITY_UNUSED, SETTING_LEFT_GAMEPAD_STICK_ENABLED, SETTING_RIGHT_GAMEPAD_STICK_ENABLED, SETTING_USB_DEBUG_MODE, SETTING_LEFT_TRACKPAD_MODE, SETTING_RIGHT_TRACKPAD_MODE, SETTING_MOUSE_POINTER_ENABLED, + + // 10 SETTING_DPAD_DEADZONE, SETTING_MINIMUM_MOMENTUM_VEL, SETTING_MOMENTUM_DECAY_AMMOUNT, @@ -399,6 +436,8 @@ typedef enum SETTING_MOMENTUM_VERTICAL_DIVISOR, SETTING_MOMENTUM_MAXIMUM_VELOCITY, SETTING_TRACKPAD_Z_ON, + + // 20 SETTING_TRACKPAD_Z_OFF, SETTING_SENSITIVY_SCALE_AMMOUNT, SETTING_LEFT_TRACKPAD_SECONDARY_MODE, @@ -409,6 +448,8 @@ typedef enum SETTING_TRACKPAD_OUTER_RADIUS, SETTING_TRACKPAD_Z_ON_LEFT, SETTING_TRACKPAD_Z_OFF_LEFT, + + // 30 SETTING_TRACKPAD_OUTER_SPIN_VEL, SETTING_TRACKPAD_OUTER_SPIN_RADIUS, SETTING_TRACKPAD_OUTER_SPIN_HORIZONTAL_ONLY, @@ -419,6 +460,8 @@ typedef enum SETTING_TRACKPAD_DOUBLE_TAP_BEEP_PERIOD, SETTING_TRACKPAD_DOUBLE_TAP_BEEP_COUNT, SETTING_TRACKPAD_OUTER_RADIUS_RELEASE_ON_TRANSITION, + + // 40 SETTING_RADIAL_MODE_ANGLE, SETTING_HAPTIC_INTENSITY_MOUSE_MODE, SETTING_LEFT_DPAD_REQUIRES_CLICK, @@ -427,9 +470,48 @@ typedef enum SETTING_LED_USER_BRIGHTNESS, SETTING_ENABLE_RAW_JOYSTICK, SETTING_ENABLE_FAST_SCAN, - SETTING_GYRO_MODE, + SETTING_IMU_MODE, SETTING_WIRELESS_PACKET_VERSION, + + // 50 SETTING_SLEEP_INACTIVITY_TIMEOUT, + SETTING_TRACKPAD_NOISE_THRESHOLD, + SETTING_LEFT_TRACKPAD_CLICK_PRESSURE, + SETTING_RIGHT_TRACKPAD_CLICK_PRESSURE, + SETTING_LEFT_BUMPER_CLICK_PRESSURE, + SETTING_RIGHT_BUMPER_CLICK_PRESSURE, + SETTING_LEFT_GRIP_CLICK_PRESSURE, + SETTING_RIGHT_GRIP_CLICK_PRESSURE, + SETTING_LEFT_GRIP2_CLICK_PRESSURE, + SETTING_RIGHT_GRIP2_CLICK_PRESSURE, + + // 60 + SETTING_PRESSURE_MODE, + SETTING_CONTROLLER_TEST_MODE, + SETTING_TRIGGER_MODE, + SETTING_TRACKPAD_Z_THRESHOLD, + SETTING_FRAME_RATE, + SETTING_TRACKPAD_FILT_CTRL, + SETTING_TRACKPAD_CLIP, + SETTING_DEBUG_OUTPUT_SELECT, + SETTING_TRIGGER_THRESHOLD_PERCENT, + SETTING_TRACKPAD_FREQUENCY_HOPPING, + + // 70 + SETTING_HAPTICS_ENABLED, + SETTING_STEAM_WATCHDOG_ENABLE, + SETTING_TIMP_TOUCH_THRESHOLD_ON, + SETTING_TIMP_TOUCH_THRESHOLD_OFF, + SETTING_FREQ_HOPPING, + SETTING_TEST_CONTROL, + SETTING_HAPTIC_MASTER_GAIN_DB, + SETTING_THUMB_TOUCH_THRESH, + SETTING_DEVICE_POWER_STATUS, + SETTING_HAPTIC_INTENSITY, + + // 80 + SETTING_STABILIZER_ENABLED, + SETTING_TIMP_MODE_MTE, SETTING_COUNT, // This is a special setting value use for callbacks and should not be set/get explicitly. @@ -461,6 +543,7 @@ typedef enum HAPTIC_PULSE_NORMAL = 0x0000, HAPTIC_PULSE_HIGH_PRIORITY = 0x0001, HAPTIC_PULSE_VERY_HIGH_PRIORITY = 0x0002, + HAPTIC_PULSE_IGNORE_USER_PREFS = 0x0003, } SettingHapticPulseFlags; typedef struct diff --git a/thirdparty/SDL/src/joystick/hidapi/steam/controller_structs.h b/thirdparty/SDL/src/joystick/hidapi/steam/controller_structs.h index c8fd61226..1659f74c9 100644 --- a/thirdparty/SDL/src/joystick/hidapi/steam/controller_structs.h +++ b/thirdparty/SDL/src/joystick/hidapi/steam/controller_structs.h @@ -32,6 +32,13 @@ typedef struct unsigned char length; } FeatureReportHeader; +// Generic controller settings structure +typedef struct +{ + unsigned char settingNum; + unsigned short settingValue; +} ControllerSetting; + // Generic controller attribute structure typedef struct { @@ -39,12 +46,89 @@ typedef struct uint32_t attributeValue; } ControllerAttribute; +// Generic controller settings structure +typedef struct +{ + ControllerSetting settings[ ( HID_FEATURE_REPORT_BYTES - sizeof( FeatureReportHeader ) ) / sizeof( ControllerSetting ) ]; +} MsgSetSettingsValues, MsgGetSettingsValues, MsgGetSettingsDefaults, MsgGetSettingsMaxs; + // Generic controller settings structure typedef struct { ControllerAttribute attributes[ ( HID_FEATURE_REPORT_BYTES - sizeof( FeatureReportHeader ) ) / sizeof( ControllerAttribute ) ]; } MsgGetAttributes; +typedef struct +{ + unsigned char attributeTag; + char attributeValue[20]; +} MsgGetStringAttribute; + +typedef struct +{ + unsigned char mode; +} MsgSetControllerMode; + +// Trigger a haptic pulse +typedef struct { + unsigned char which_pad; + unsigned short pulse_duration; + unsigned short pulse_interval; + unsigned short pulse_count; + short dBgain; + unsigned char priority; +} MsgFireHapticPulse; + +typedef struct { + uint8_t mode; +} MsgHapticSetMode; + +typedef enum { + HAPTIC_TYPE_OFF, + HAPTIC_TYPE_TICK, + HAPTIC_TYPE_CLICK, + HAPTIC_TYPE_TONE, + HAPTIC_TYPE_RUMBLE, + HAPTIC_TYPE_NOISE, + HAPTIC_TYPE_SCRIPT, + HAPTIC_TYPE_LOG_SWEEP, +} haptic_type_t; + +typedef enum { + HAPTIC_INTENSITY_SYSTEM, + HAPTIC_INTENSITY_SHORT, + HAPTIC_INTENSITY_MEDIUM, + HAPTIC_INTENSITY_LONG, + HAPTIC_INTENSITY_INSANE, +} haptic_intensity_t; + +typedef struct { + uint8_t side; // 0x01 = L, 0x02 = R, 0x03 = Both + uint8_t cmd; // 0 = Off, 1 = tick, 2 = click, 3 = tone, 4 = rumble, 5 = + // rumble_noise, 6 = script, 7 = sweep, + uint8_t ui_intensity; // 0-4 (0 = default) + int8_t dBgain; // dB Can be positive (reasonable clipping / limiting will apply) + uint16_t freq; // Frequency of tone (if applicable) + int16_t dur_ms; // Duration of tone / rumble (if applicable) (neg = infinite) + + uint16_t noise_intensity; + uint16_t lfo_freq; // Drives both tone and rumble geneators + uint8_t lfo_depth; // percentage, typically 100 + uint8_t rand_tone_gain; // Randomize each LFO cycle's gain + uint8_t script_id; // Used w/ dBgain for scripted haptics + + uint16_t lss_start_freq; // Used w/ Log Sine Sweep + uint16_t lss_end_freq; // Ditto +} MsgTriggerHaptic; + +typedef struct { + uint8_t unRumbleType; + uint16_t unIntensity; + uint16_t unLeftMotorSpeed; + uint16_t unRightMotorSpeed; + int8_t nLeftGain; + int8_t nRightGain; +} MsgSimpleRumbleCmd; // This is the only message struct that application code should use to interact with feature request messages. Any new // messages should be added to the union. The structures defined here should correspond to the ones defined in @@ -55,7 +139,17 @@ typedef struct FeatureReportHeader header; union { - MsgGetAttributes getAttributes; + MsgSetSettingsValues setSettingsValues; + MsgGetSettingsValues getSettingsValues; + MsgGetSettingsMaxs getSettingsMaxs; + MsgGetSettingsDefaults getSettingsDefaults; + MsgGetAttributes getAttributes; + MsgSetControllerMode controllerMode; + MsgFireHapticPulse fireHapticPulse; + MsgGetStringAttribute getStringAttribute; + MsgHapticSetMode hapticMode; + MsgTriggerHaptic triggerHaptic; + MsgSimpleRumbleCmd simpleRumble; } payload; } FeatureReportMsg; @@ -77,6 +171,7 @@ typedef enum ID_CONTROLLER_DEBUG2 = 5, ID_CONTROLLER_SECONDARY_STATE = 6, ID_CONTROLLER_BLE_STATE = 7, + ID_CONTROLLER_DECK_STATE = 9, ID_CONTROLLER_MSG_COUNT } ValveInReportMessageIDs; @@ -94,12 +189,12 @@ typedef struct { // If packet num matches that on your prior call, then the controller state hasn't been changed since // your last call and there is no need to process it - uint32 unPacketNum; + Uint32 unPacketNum; // Button bitmask and trigger data. union { - uint64 ulButtons; + Uint64 ulButtons; struct { unsigned char _pad0[3]; @@ -143,12 +238,12 @@ typedef struct { // If packet num matches that on your prior call, then the controller state hasn't been changed since // your last call and there is no need to process it - uint32 unPacketNum; + Uint32 unPacketNum; // Button bitmask and trigger data. union { - uint64 ulButtons; + Uint64 ulButtons; struct { unsigned char _pad0[3]; @@ -258,6 +353,66 @@ typedef struct unsigned char ucBatteryLevel; } SteamControllerStatusEvent_t; +// Deck State payload +typedef struct +{ + // If packet num matches that on your prior call, then the controller + // state hasn't been changed since your last call and there is no need to + // process it + Uint32 unPacketNum; + + // Button bitmask and trigger data. + union + { + Uint64 ulButtons; + struct + { + Uint32 ulButtonsL; + Uint32 ulButtonsH; + }; + }; + + // Left pad coordinates + short sLeftPadX; + short sLeftPadY; + + // Right pad coordinates + short sRightPadX; + short sRightPadY; + + // Accelerometer values + short sAccelX; + short sAccelY; + short sAccelZ; + + // Gyroscope values + short sGyroX; + short sGyroY; + short sGyroZ; + + // Gyro quaternions + short sGyroQuatW; + short sGyroQuatX; + short sGyroQuatY; + short sGyroQuatZ; + + // Uncalibrated trigger values + unsigned short sTriggerRawL; + unsigned short sTriggerRawR; + + // Left stick values + short sLeftStickX; + short sLeftStickY; + + // Right stick values + short sRightStickX; + short sRightStickY; + + // Touchpad pressures + unsigned short sPressurePadLeft; + unsigned short sPressurePadRight; +} SteamDeckStatePacket_t; + typedef struct { ValveInReportHeader_t header; @@ -271,6 +426,7 @@ typedef struct ValveControllerRawTrackpadImage_t rawPadImage; SteamControllerWirelessEvent_t wirelessEvent; SteamControllerStatusEvent_t statusEvent; + SteamDeckStatePacket_t deckState; } payload; } ValveInReport_t; diff --git a/thirdparty/SDL/src/joystick/iphoneos/SDL_mfijoystick.m b/thirdparty/SDL/src/joystick/iphoneos/SDL_mfijoystick.m index b9aeed703..28ddca723 100644 --- a/thirdparty/SDL/src/joystick/iphoneos/SDL_mfijoystick.m +++ b/thirdparty/SDL/src/joystick/iphoneos/SDL_mfijoystick.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -33,7 +33,7 @@ #include "SDL_mfijoystick_c.h" -#if !SDL_EVENTS_DISABLED +#ifndef SDL_EVENTS_DISABLED #include "../../events/SDL_events_c.h" #endif @@ -55,11 +55,22 @@ static id connectObserver = nil; static id disconnectObserver = nil; -static NSString *GCInputXboxShareButton = @"Button Share"; #include #include +#ifndef __IPHONE_OS_VERSION_MAX_ALLOWED +#define __IPHONE_OS_VERSION_MAX_ALLOWED 0 +#endif + +#ifndef __APPLETV_OS_VERSION_MAX_ALLOWED +#define __APPLETV_OS_VERSION_MAX_ALLOWED 0 +#endif + +#ifndef __MAC_OS_VERSION_MAX_ALLOWED +#define __MAC_OS_VERSION_MAX_ALLOWED 0 +#endif + /* remove compilation warnings for strict builds by defining these selectors, even though * they are only ever used indirectly through objc_msgSend */ @@ -224,11 +235,125 @@ static BOOL IsControllerBackboneOne(GCController *controller) } return FALSE; } +static void CheckControllerSiriRemote(GCController *controller, int *is_siri_remote) +{ + if (@available(macOS 10.15, iOS 13.0, tvOS 13.0, *)) { + if ([controller.productCategory hasPrefix:@"Siri Remote"]) { + *is_siri_remote = 1; + SDL_sscanf(controller.productCategory.UTF8String, "Siri Remote (%i%*s Generation)", is_siri_remote); + return; + } + } + *is_siri_remote = 0; +} + +#ifdef ENABLE_PHYSICAL_INPUT_PROFILE +static BOOL ElementAlreadyHandled(SDL_JoystickDeviceItem *device, NSString *element, NSDictionary *elements) +{ + if ([element isEqualToString:@"Left Thumbstick Left"] || + [element isEqualToString:@"Left Thumbstick Right"]) { + if (elements[@"Left Thumbstick X Axis"]) { + return TRUE; + } + } + if ([element isEqualToString:@"Left Thumbstick Up"] || + [element isEqualToString:@"Left Thumbstick Down"]) { + if (elements[@"Left Thumbstick Y Axis"]) { + return TRUE; + } + } + if ([element isEqualToString:@"Right Thumbstick Left"] || + [element isEqualToString:@"Right Thumbstick Right"]) { + if (elements[@"Right Thumbstick X Axis"]) { + return TRUE; + } + } + if ([element isEqualToString:@"Right Thumbstick Up"] || + [element isEqualToString:@"Right Thumbstick Down"]) { + if (elements[@"Right Thumbstick Y Axis"]) { + return TRUE; + } + } + if (device->is_siri_remote) { + if ([element isEqualToString:@"Direction Pad Left"] || + [element isEqualToString:@"Direction Pad Right"]) { + if (elements[@"Direction Pad X Axis"]) { + return TRUE; + } + } + if ([element isEqualToString:@"Direction Pad Up"] || + [element isEqualToString:@"Direction Pad Down"]) { + if (elements[@"Direction Pad Y Axis"]) { + return TRUE; + } + } + } else { + if ([element isEqualToString:@"Direction Pad X Axis"]) { + if (elements[@"Direction Pad Left"] && + elements[@"Direction Pad Right"]) { + return TRUE; + } + } + if ([element isEqualToString:@"Direction Pad Y Axis"]) { + if (elements[@"Direction Pad Up"] && + elements[@"Direction Pad Down"]) { + return TRUE; + } + } + } + if ([element isEqualToString:@"Cardinal Direction Pad X Axis"]) { + if (elements[@"Cardinal Direction Pad Left"] && + elements[@"Cardinal Direction Pad Right"]) { + return TRUE; + } + } + if ([element isEqualToString:@"Cardinal Direction Pad Y Axis"]) { + if (elements[@"Cardinal Direction Pad Up"] && + elements[@"Cardinal Direction Pad Down"]) { + return TRUE; + } + } + if ([element isEqualToString:@"Touchpad 1 X Axis"] || + [element isEqualToString:@"Touchpad 1 Y Axis"] || + [element isEqualToString:@"Touchpad 1 Left"] || + [element isEqualToString:@"Touchpad 1 Right"] || + [element isEqualToString:@"Touchpad 1 Up"] || + [element isEqualToString:@"Touchpad 1 Down"] || + [element isEqualToString:@"Touchpad 2 X Axis"] || + [element isEqualToString:@"Touchpad 2 Y Axis"] || + [element isEqualToString:@"Touchpad 2 Left"] || + [element isEqualToString:@"Touchpad 2 Right"] || + [element isEqualToString:@"Touchpad 2 Up"] || + [element isEqualToString:@"Touchpad 2 Down"]) { + /* The touchpad is handled separately */ + return TRUE; + } + if ([element isEqualToString:@"Button Home"]) { + if (device->is_switch_joycon_pair) { + /* The Nintendo Switch JoyCon home button doesn't ever show as being held down */ + return TRUE; + } +#if TARGET_OS_TV + /* The OS uses the home button, it's not available to apps */ + return TRUE; +#endif + } + if ([element isEqualToString:@"Button Share"]) { + if (device->is_backbone_one) { + /* The Backbone app uses share button */ + return TRUE; + } + } + return FALSE; +} +#endif /* ENABLE_PHYSICAL_INPUT_PROFILE */ + static BOOL IOS_AddMFIJoystickDevice(SDL_JoystickDeviceItem *device, GCController *controller) { Uint16 vendor = 0; Uint16 product = 0; Uint8 subtype = 0; + Uint16 signature = 0; const char *name = NULL; if (@available(macOS 11.3, iOS 14.5, tvOS 14.5, *)) { @@ -252,214 +377,252 @@ static BOOL IOS_AddMFIJoystickDevice(SDL_JoystickDeviceItem *device, GCControlle device->name = SDL_CreateJoystickName(0, 0, NULL, name); #ifdef DEBUG_CONTROLLER_PROFILE + NSLog(@"Product name: %@\n", controller.vendorName); + NSLog(@"Product category: %@\n", controller.productCategory); + NSLog(@"Elements available:\n"); +#ifdef ENABLE_PHYSICAL_INPUT_PROFILE if (@available(macOS 10.16, iOS 14.0, tvOS 14.0, *)) { - if (controller.physicalInputProfile) { - for (id key in controller.physicalInputProfile.buttons) { - NSLog(@"Button %@ available\n", key); - } - for (id key in controller.physicalInputProfile.axes) { - NSLog(@"Axis %@ available\n", key); - } + NSDictionary *elements = controller.physicalInputProfile.elements; + for (id key in controller.physicalInputProfile.buttons) { + NSLog(@"\tButton: %@ (%s)\n", key, elements[key].analog ? "analog" : "digital"); + } + for (id key in controller.physicalInputProfile.axes) { + NSLog(@"\tAxis: %@\n", key); + } + for (id key in controller.physicalInputProfile.dpads) { + NSLog(@"\tHat: %@\n", key); } } +#endif #endif - if (controller.extendedGamepad) { - GCExtendedGamepad *gamepad = controller.extendedGamepad; - BOOL is_xbox = IsControllerXbox(controller); - BOOL is_ps4 = IsControllerPS4(controller); - BOOL is_ps5 = IsControllerPS5(controller); - BOOL is_switch_pro = IsControllerSwitchPro(controller); - BOOL is_switch_joycon_pair = IsControllerSwitchJoyConPair(controller); - BOOL is_stadia = IsControllerStadia(controller); - BOOL is_backbone_one = IsControllerBackboneOne(controller); - int nbuttons = 0; - BOOL has_direct_menu; - + device->is_xbox = IsControllerXbox(controller); + device->is_ps4 = IsControllerPS4(controller); + device->is_ps5 = IsControllerPS5(controller); + device->is_switch_pro = IsControllerSwitchPro(controller); + device->is_switch_joycon_pair = IsControllerSwitchJoyConPair(controller); + device->is_stadia = IsControllerStadia(controller); + device->is_backbone_one = IsControllerBackboneOne(controller); + device->is_switch_joyconL = IsControllerSwitchJoyConL(controller); + device->is_switch_joyconR = IsControllerSwitchJoyConR(controller); #ifdef SDL_JOYSTICK_HIDAPI - if ((is_xbox && HIDAPI_IsDeviceTypePresent(SDL_CONTROLLER_TYPE_XBOXONE)) || - (is_ps4 && HIDAPI_IsDeviceTypePresent(SDL_CONTROLLER_TYPE_PS4)) || - (is_ps5 && HIDAPI_IsDeviceTypePresent(SDL_CONTROLLER_TYPE_PS5)) || - (is_switch_pro && HIDAPI_IsDeviceTypePresent(SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_PRO)) || - (is_switch_joycon_pair && HIDAPI_IsDevicePresent(USB_VENDOR_NINTENDO, USB_PRODUCT_NINTENDO_SWITCH_JOYCON_PAIR, 0, "")) || - (is_stadia && HIDAPI_IsDeviceTypePresent(SDL_CONTROLLER_TYPE_GOOGLE_STADIA))) { - /* The HIDAPI driver is taking care of this device */ - return FALSE; - } + if ((device->is_xbox && HIDAPI_IsDeviceTypePresent(SDL_CONTROLLER_TYPE_XBOXONE)) || + (device->is_ps4 && HIDAPI_IsDeviceTypePresent(SDL_CONTROLLER_TYPE_PS4)) || + (device->is_ps5 && HIDAPI_IsDeviceTypePresent(SDL_CONTROLLER_TYPE_PS5)) || + (device->is_switch_pro && HIDAPI_IsDeviceTypePresent(SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_PRO)) || + (device->is_switch_joycon_pair && HIDAPI_IsDevicePresent(USB_VENDOR_NINTENDO, USB_PRODUCT_NINTENDO_SWITCH_JOYCON_PAIR, 0, "")) || + (device->is_stadia && HIDAPI_IsDevicePresent(USB_VENDOR_GOOGLE, USB_PRODUCT_GOOGLE_STADIA_CONTROLLER, 0, "")) || + (device->is_switch_joyconL && HIDAPI_IsDevicePresent(USB_VENDOR_NINTENDO, USB_PRODUCT_NINTENDO_SWITCH_JOYCON_LEFT, 0, "")) || + (device->is_switch_joyconR && HIDAPI_IsDevicePresent(USB_VENDOR_NINTENDO, USB_PRODUCT_NINTENDO_SWITCH_JOYCON_RIGHT, 0, ""))) { + /* The HIDAPI driver is taking care of this device */ + return FALSE; + } #endif + CheckControllerSiriRemote(controller, &device->is_siri_remote); - /* These buttons are part of the original MFi spec */ - device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_A); - device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_B); - device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_X); - device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_Y); - device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_LEFTSHOULDER); - device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_RIGHTSHOULDER); - nbuttons += 6; + if (device->is_siri_remote && !SDL_GetHintBoolean(SDL_HINT_TV_REMOTE_AS_JOYSTICK, SDL_TRUE)) { + /* Ignore remotes, they'll be handled as keyboard input */ + return SDL_FALSE; + } - /* These buttons are available on some newer controllers */ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wunguarded-availability-new" - if ([gamepad respondsToSelector:@selector(leftThumbstickButton)] && gamepad.leftThumbstickButton) { - device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_LEFTSTICK); - ++nbuttons; - } - if ([gamepad respondsToSelector:@selector(rightThumbstickButton)] && gamepad.rightThumbstickButton) { - device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_RIGHTSTICK); - ++nbuttons; +#ifdef ENABLE_PHYSICAL_INPUT_PROFILE + if (@available(macOS 10.16, iOS 14.0, tvOS 14.0, *)) { + if (controller.physicalInputProfile.buttons[GCInputDualShockTouchpadButton] != nil) { + device->has_dualshock_touchpad = TRUE; } - if ([gamepad respondsToSelector:@selector(buttonOptions)] && gamepad.buttonOptions) { - device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_BACK); - ++nbuttons; + if (controller.physicalInputProfile.buttons[GCInputXboxPaddleOne] != nil) { + device->has_xbox_paddles = TRUE; } - /* The Nintendo Switch JoyCon home button doesn't ever show as being held down */ - if ([gamepad respondsToSelector:@selector(buttonHome)] && gamepad.buttonHome && !is_switch_joycon_pair) { - device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_GUIDE); - ++nbuttons; + if (controller.physicalInputProfile.buttons[@"Button Share"] != nil) { + device->has_xbox_share_button = TRUE; } - device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_START); - ++nbuttons; + } +#endif // ENABLE_PHYSICAL_INPUT_PROFILE - has_direct_menu = [gamepad respondsToSelector:@selector(buttonMenu)] && gamepad.buttonMenu; - if (!has_direct_menu) { - device->uses_pause_handler = SDL_TRUE; + if (device->is_backbone_one) { + vendor = USB_VENDOR_BACKBONE; + if (device->is_ps5) { + product = USB_PRODUCT_BACKBONE_ONE_IOS_PS5; + } else { + product = USB_PRODUCT_BACKBONE_ONE_IOS; + } + } else if (device->is_xbox) { + vendor = USB_VENDOR_MICROSOFT; + if (device->has_xbox_paddles) { + /* Assume Xbox One Elite Series 2 Controller unless/until GCController flows VID/PID */ + product = USB_PRODUCT_XBOX_ONE_ELITE_SERIES_2_BLUETOOTH; + } else if (device->has_xbox_share_button) { + /* Assume Xbox Series X Controller unless/until GCController flows VID/PID */ + product = USB_PRODUCT_XBOX_SERIES_X_BLE; + } else { + /* Assume Xbox One S Bluetooth Controller unless/until GCController flows VID/PID */ + product = USB_PRODUCT_XBOX_ONE_S_REV1_BLUETOOTH; + } + } else if (device->is_ps4) { + /* Assume DS4 Slim unless/until GCController flows VID/PID */ + vendor = USB_VENDOR_SONY; + product = USB_PRODUCT_SONY_DS4_SLIM; + if (device->has_dualshock_touchpad) { + subtype = 1; } + } else if (device->is_ps5) { + vendor = USB_VENDOR_SONY; + product = USB_PRODUCT_SONY_DS5; + } else if (device->is_switch_pro) { + vendor = USB_VENDOR_NINTENDO; + product = USB_PRODUCT_NINTENDO_SWITCH_PRO; + } else if (device->is_switch_joycon_pair) { + vendor = USB_VENDOR_NINTENDO; + product = USB_PRODUCT_NINTENDO_SWITCH_JOYCON_PAIR; + } else if (device->is_switch_joyconL) { + vendor = USB_VENDOR_NINTENDO; + product = USB_PRODUCT_NINTENDO_SWITCH_JOYCON_LEFT; + } else if (device->is_switch_joyconR) { + vendor = USB_VENDOR_NINTENDO; + product = USB_PRODUCT_NINTENDO_SWITCH_JOYCON_RIGHT; +#ifdef ENABLE_PHYSICAL_INPUT_PROFILE + } else if (@available(macOS 10.16, iOS 14.0, tvOS 14.0, *)) { + vendor = USB_VENDOR_APPLE; + product = 4; + subtype = 4; +#endif + } else if (controller.extendedGamepad) { + vendor = USB_VENDOR_APPLE; + product = 1; + subtype = 1; + } else if (controller.gamepad) { + vendor = USB_VENDOR_APPLE; + product = 2; + subtype = 2; #if TARGET_OS_TV - /* The single menu button isn't very reliable, at least as of tvOS 16.1 */ - if ((device->button_mask & (1 << SDL_CONTROLLER_BUTTON_BACK)) == 0) { - device->uses_pause_handler = SDL_TRUE; - } + } else if (controller.microGamepad) { + vendor = USB_VENDOR_APPLE; + product = 3; + subtype = 3; #endif + } else { + /* We don't know how to get input events from this device */ + return SDL_FALSE; + } #ifdef ENABLE_PHYSICAL_INPUT_PROFILE - if ([controller respondsToSelector:@selector(physicalInputProfile)]) { - if (controller.physicalInputProfile.buttons[GCInputDualShockTouchpadButton] != nil) { - device->has_dualshock_touchpad = SDL_TRUE; - device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_MISC1); - ++nbuttons; + if (@available(macOS 10.16, iOS 14.0, tvOS 14.0, *)) { + NSDictionary *elements = controller.physicalInputProfile.elements; + + /* Provide both axes and analog buttons as SDL axes */ + NSArray *axes = [[[elements allKeys] sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)] + filteredArrayUsingPredicate:[NSPredicate predicateWithBlock:^BOOL(id object, NSDictionary *bindings) { + GCControllerElement *element; + + if (ElementAlreadyHandled(device, (NSString *)object, elements)) { + return NO; } - if (controller.physicalInputProfile.buttons[GCInputXboxPaddleOne] != nil) { - device->has_xbox_paddles = SDL_TRUE; - device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_PADDLE1); - ++nbuttons; + + element = elements[object]; + if (element.analog) { + if ([element isKindOfClass:[GCControllerAxisInput class]] || + [element isKindOfClass:[GCControllerButtonInput class]]) { + return YES; + } } - if (controller.physicalInputProfile.buttons[GCInputXboxPaddleTwo] != nil) { - device->has_xbox_paddles = SDL_TRUE; - device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_PADDLE2); - ++nbuttons; + return NO; + }]]; + NSArray *buttons = [[[elements allKeys] sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)] + filteredArrayUsingPredicate:[NSPredicate predicateWithBlock:^BOOL(id object, NSDictionary *bindings) { + GCControllerElement *element; + + if (ElementAlreadyHandled(device, (NSString *)object, elements)) { + return NO; } - if (controller.physicalInputProfile.buttons[GCInputXboxPaddleThree] != nil) { - device->has_xbox_paddles = SDL_TRUE; - device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_PADDLE3); - ++nbuttons; + + element = elements[object]; + if ([element isKindOfClass:[GCControllerButtonInput class]]) { + return YES; } - if (controller.physicalInputProfile.buttons[GCInputXboxPaddleFour] != nil) { - device->has_xbox_paddles = SDL_TRUE; - device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_PADDLE4); + return NO; + }]]; + /* Explicitly retain the arrays because SDL_JoystickDeviceItem is a + * struct, and ARC doesn't work with structs. */ + device->naxes = (int)axes.count; + device->axes = (__bridge NSArray *)CFBridgingRetain(axes); + device->nbuttons = (int)buttons.count; + device->buttons = (__bridge NSArray *)CFBridgingRetain(buttons); + subtype = 4; + +#ifdef DEBUG_CONTROLLER_PROFILE + NSLog(@"Elements used:\n", controller.vendorName); + for (id key in device->buttons) { + NSLog(@"\tButton: %@ (%s)\n", key, elements[key].analog ? "analog" : "digital"); + } + for (id key in device->axes) { + NSLog(@"\tAxis: %@\n", key); + } +#endif /* DEBUG_CONTROLLER_PROFILE */ + +#if TARGET_OS_TV + /* tvOS turns the menu button into a system gesture, so we grab it here instead */ + if (elements[GCInputButtonMenu] && !elements[@"Button Home"]) { + device->pause_button_index = [device->buttons indexOfObject:GCInputButtonMenu]; + } +#endif + } else +#endif + if (controller.extendedGamepad) { + GCExtendedGamepad *gamepad = controller.extendedGamepad; + int nbuttons = 0; + BOOL has_direct_menu = FALSE; + + /* These buttons are part of the original MFi spec */ + device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_A); + device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_B); + device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_X); + device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_Y); + device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_LEFTSHOULDER); + device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_RIGHTSHOULDER); + nbuttons += 6; + + /* These buttons are available on some newer controllers */ + if (@available(macOS 10.14.1, iOS 12.1, tvOS 12.1, *)) { + if (gamepad.leftThumbstickButton) { + device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_LEFTSTICK); ++nbuttons; } - if (controller.physicalInputProfile.buttons[GCInputXboxShareButton] != nil) { - device->has_xbox_share_button = SDL_TRUE; - device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_MISC1); + if (gamepad.rightThumbstickButton) { + device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_RIGHTSTICK); ++nbuttons; } } -#endif -#pragma clang diagnostic pop - - if (is_backbone_one) { - vendor = USB_VENDOR_BACKBONE; - if (is_ps5) { - product = USB_PRODUCT_BACKBONE_ONE_IOS_PS5; - } else { - product = USB_PRODUCT_BACKBONE_ONE_IOS; - } - subtype = 0; - } else if (is_xbox) { - vendor = USB_VENDOR_MICROSOFT; - if (device->has_xbox_paddles) { - /* Assume Xbox One Elite Series 2 Controller unless/until GCController flows VID/PID */ - product = USB_PRODUCT_XBOX_ONE_ELITE_SERIES_2_BLUETOOTH; - subtype = 1; - } else if (device->has_xbox_share_button) { - /* Assume Xbox Series X Controller unless/until GCController flows VID/PID */ - product = USB_PRODUCT_XBOX_SERIES_X_BLE; - subtype = 1; - } else { - /* Assume Xbox One S Bluetooth Controller unless/until GCController flows VID/PID */ - product = USB_PRODUCT_XBOX_ONE_S_REV1_BLUETOOTH; - subtype = 0; - } - } else if (is_ps4) { - /* Assume DS4 Slim unless/until GCController flows VID/PID */ - vendor = USB_VENDOR_SONY; - product = USB_PRODUCT_SONY_DS4_SLIM; - if (device->has_dualshock_touchpad) { - subtype = 1; - } else { - subtype = 0; + if (@available(macOS 10.15, iOS 13.0, tvOS 13.0, *)) { + if (gamepad.buttonOptions) { + device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_BACK); + ++nbuttons; } - } else if (is_ps5) { - vendor = USB_VENDOR_SONY; - product = USB_PRODUCT_SONY_DS5; - subtype = 0; - } else if (is_switch_pro) { - vendor = USB_VENDOR_NINTENDO; - product = USB_PRODUCT_NINTENDO_SWITCH_PRO; - subtype = 0; - } else if (is_switch_joycon_pair) { - vendor = USB_VENDOR_NINTENDO; - product = USB_PRODUCT_NINTENDO_SWITCH_JOYCON_PAIR; - subtype = 0; - } else { - vendor = USB_VENDOR_APPLE; - product = 1; - subtype = 1; } + device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_START); + ++nbuttons; - if (is_backbone_one) { - /* The Backbone app uses share button */ - if ((device->button_mask & (1 << SDL_CONTROLLER_BUTTON_MISC1)) != 0) { - device->button_mask &= ~(1 << SDL_CONTROLLER_BUTTON_MISC1); - --nbuttons; - device->has_xbox_share_button = SDL_FALSE; + if (@available(macOS 10.15, iOS 13.0, tvOS 13.0, *)) { + if (gamepad.buttonMenu) { + has_direct_menu = TRUE; } } +#if TARGET_OS_TV + /* The single menu button isn't very reliable, at least as of tvOS 16.1 */ + if ((device->button_mask & (1 << SDL_CONTROLLER_BUTTON_BACK)) == 0) { + has_direct_menu = FALSE; + } +#endif + if (!has_direct_menu) { + device->pause_button_index = (nbuttons - 1); + } device->naxes = 6; /* 2 thumbsticks and 2 triggers */ device->nhats = 1; /* d-pad */ device->nbuttons = nbuttons; } else if (controller.gamepad) { - BOOL is_switch_joyconL = IsControllerSwitchJoyConL(controller); - BOOL is_switch_joyconR = IsControllerSwitchJoyConR(controller); int nbuttons = 0; -#ifdef SDL_JOYSTICK_HIDAPI - if ((is_switch_joyconL && HIDAPI_IsDevicePresent(USB_VENDOR_NINTENDO, USB_PRODUCT_NINTENDO_SWITCH_JOYCON_LEFT, 0, "")) || - (is_switch_joyconR && HIDAPI_IsDevicePresent(USB_VENDOR_NINTENDO, USB_PRODUCT_NINTENDO_SWITCH_JOYCON_RIGHT, 0, ""))) { - /* The HIDAPI driver is taking care of this device */ - return FALSE; - } -#else - (void)is_switch_joyconL; - (void)is_switch_joyconR; -#endif - - if (is_switch_joyconL) { - vendor = USB_VENDOR_NINTENDO; - product = USB_PRODUCT_NINTENDO_SWITCH_JOYCON_LEFT; - subtype = 0; - } else if (is_switch_joyconR) { - vendor = USB_VENDOR_NINTENDO; - product = USB_PRODUCT_NINTENDO_SWITCH_JOYCON_RIGHT; - subtype = 0; - } else { - vendor = USB_VENDOR_APPLE; - product = 2; - subtype = 2; - } - /* These buttons are part of the original MFi spec */ device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_A); device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_B); @@ -467,14 +630,9 @@ static BOOL IOS_AddMFIJoystickDevice(SDL_JoystickDeviceItem *device, GCControlle device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_Y); device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_LEFTSHOULDER); device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_RIGHTSHOULDER); -#if TARGET_OS_TV - /* The menu button is used by the OS and not available to applications */ - nbuttons += 6; -#else device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_START); nbuttons += 7; - device->uses_pause_handler = SDL_TRUE; -#endif + device->pause_button_index = (nbuttons - 1); device->naxes = 0; /* no traditional analog inputs */ device->nhats = 1; /* d-pad */ @@ -485,35 +643,41 @@ static BOOL IOS_AddMFIJoystickDevice(SDL_JoystickDeviceItem *device, GCControlle int nbuttons = 0; device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_A); - device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_B); /* Button X on microGamepad */ - nbuttons += 2; - - device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_START); - ++nbuttons; - device->uses_pause_handler = SDL_TRUE; + device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_X); /* Button X on microGamepad */ + device->button_mask |= (1 << SDL_CONTROLLER_BUTTON_B); + nbuttons += 3; + device->pause_button_index = (nbuttons - 1); - vendor = USB_VENDOR_APPLE; - product = 3; - subtype = 3; device->naxes = 2; /* treat the touch surface as two axes */ device->nhats = 0; /* apparently the touch surface-as-dpad is buggy */ device->nbuttons = nbuttons; controller.microGamepad.allowsRotation = SDL_GetHintBoolean(SDL_HINT_APPLE_TV_REMOTE_ALLOW_ROTATION, SDL_FALSE); } -#endif /* TARGET_OS_TV */ +#endif + else { + /* We don't know how to get input events from this device */ + return SDL_FALSE; + } - if (vendor == USB_VENDOR_APPLE) { - /* Note that this is an MFI controller and what subtype it is */ - device->guid = SDL_CreateJoystickGUID(SDL_HARDWARE_BUS_BLUETOOTH, vendor, product, 0, name, 'm', subtype); + if (@available(macOS 10.16, iOS 14.0, tvOS 14.0, *)) { + signature = 0; + signature = SDL_crc16(signature, device->name, SDL_strlen(device->name)); + for (id key in device->axes) { + const char *string = ((NSString *)key).UTF8String; + signature = SDL_crc16(signature, string, SDL_strlen(string)); + } + for (id key in device->buttons) { + const char *string = ((NSString *)key).UTF8String; + signature = SDL_crc16(signature, string, SDL_strlen(string)); + } } else { - device->guid = SDL_CreateJoystickGUID(SDL_HARDWARE_BUS_BLUETOOTH, vendor, product, 0, name, 0, subtype); + signature = device->button_mask; } + device->guid = SDL_CreateJoystickGUID(SDL_HARDWARE_BUS_BLUETOOTH, vendor, product, signature, NULL, name, 'm', subtype); - /* Update the GUID with capability bits */ - { - Uint16 *guid16 = (Uint16 *)device->guid.data; - guid16[6] = SDL_SwapLE16(device->button_mask); + if (SDL_ShouldIgnoreJoystick(name, device->guid)) { + return SDL_FALSE; } /* This will be set when the first button press of the controller is @@ -528,15 +692,6 @@ static void IOS_AddJoystickDevice(GCController *controller, SDL_bool acceleromet { SDL_JoystickDeviceItem *device = deviceList; -#if TARGET_OS_TV - if (!SDL_GetHintBoolean(SDL_HINT_TV_REMOTE_AS_JOYSTICK, SDL_TRUE)) { - /* Ignore devices that aren't actually controllers (e.g. remotes), they'll be handled as keyboard input */ - if (controller && !controller.extendedGamepad && !controller.gamepad && controller.microGamepad) { - return; - } - } -#endif - while (device != NULL) { if (device->controller == controller) { return; @@ -551,6 +706,7 @@ static void IOS_AddJoystickDevice(GCController *controller, SDL_bool acceleromet device->accelerometer = accelerometer; device->instance_id = SDL_GetNextJoystickInstanceID(); + device->pause_button_index = -1; if (accelerometer) { #ifdef SDL_JOYSTICK_iOS_ACCELEROMETER @@ -568,6 +724,7 @@ static void IOS_AddJoystickDevice(GCController *controller, SDL_bool acceleromet } else if (controller) { #ifdef SDL_JOYSTICK_MFI if (!IOS_AddMFIJoystickDevice(device, controller)) { + SDL_free(device->name); SDL_free(device); return; } @@ -626,13 +783,20 @@ static void IOS_AddJoystickDevice(GCController *controller, SDL_bool acceleromet #ifdef SDL_JOYSTICK_MFI @autoreleasepool { + /* These were explicitly retained in the struct, so they should be explicitly released before freeing the struct. */ if (device->controller) { - /* The controller was explicitly retained in the struct, so it - * should be explicitly released before freeing the struct. */ GCController *controller = CFBridgingRelease((__bridge CFTypeRef)(device->controller)); controller.controllerPausedHandler = nil; device->controller = nil; } + if (device->axes) { + CFRelease((__bridge CFTypeRef)device->axes); + device->axes = nil; + } + if (device->buttons) { + CFRelease((__bridge CFTypeRef)device->buttons); + device->buttons = nil; + } } #endif /* SDL_JOYSTICK_MFI */ @@ -663,6 +827,10 @@ static void SDLCALL SDL_AppleTVRemoteRotationHintChanged(void *udata, const char static int IOS_JoystickInit(void) { + if (!SDL_GetHintBoolean(SDL_HINT_JOYSTICK_MFI, SDL_TRUE)) { + return 0; + } + #if defined(__MACOSX__) #if _SDL_HAS_BUILTIN(__builtin_available) if (@available(macOS 10.16, *)) { @@ -757,6 +925,11 @@ static void IOS_JoystickDetect(void) return NULL; } +static int IOS_JoystickGetDeviceSteamVirtualGamepadSlot(int device_index) +{ + return -1; +} + static int IOS_JoystickGetDevicePlayerIndex(int device_index) { #ifdef SDL_JOYSTICK_MFI @@ -830,11 +1003,11 @@ static int IOS_JoystickOpen(SDL_Joystick *joystick, int device_index) #endif } else { #ifdef SDL_JOYSTICK_MFI - if (device->uses_pause_handler) { + if (device->pause_button_index >= 0) { GCController *controller = device->controller; controller.controllerPausedHandler = ^(GCController *c) { if (joystick->hwdata) { - ++joystick->hwdata->num_pause_presses; + joystick->hwdata->pause_button_pressed = SDL_GetTicks(); } }; } @@ -867,7 +1040,7 @@ static int IOS_JoystickOpen(SDL_Joystick *joystick, int device_index) #endif /* SDL_JOYSTICK_MFI */ } } - if (device->remote) { + if (device->is_siri_remote) { ++SDL_AppleTVRemoteOpenedAsJoystick; } @@ -944,14 +1117,14 @@ static Uint8 IOS_MFIJoystickHatStateForDPad(GCControllerDirectionPad *dpad) static void IOS_MFIJoystickUpdate(SDL_Joystick *joystick) { -#if SDL_JOYSTICK_MFI +#ifdef SDL_JOYSTICK_MFI @autoreleasepool { - GCController *controller = joystick->hwdata->controller; + SDL_JoystickDeviceItem *device = joystick->hwdata; + GCController *controller = device->controller; Uint8 hatstate = SDL_HAT_CENTERED; int i; - int pause_button_index = 0; -#ifdef DEBUG_CONTROLLER_STATE +#if defined(DEBUG_CONTROLLER_STATE) && defined(ENABLE_PHYSICAL_INPUT_PROFILE) if (@available(macOS 10.16, iOS 14.0, tvOS 14.0, *)) { if (controller.physicalInputProfile) { for (id key in controller.physicalInputProfile.buttons) { @@ -962,12 +1135,51 @@ static void IOS_MFIJoystickUpdate(SDL_Joystick *joystick) for (id key in controller.physicalInputProfile.axes) { GCControllerAxisInput *axis = controller.physicalInputProfile.axes[key]; if (axis.value != 0.0f) - NSLog(@"Axis %@ = %.2f\n", key, axis.value); + NSLog(@"Axis %@ = %g\n", key, axis.value); + } + for (id key in controller.physicalInputProfile.dpads) { + GCControllerDirectionPad *dpad = controller.physicalInputProfile.dpads[key]; + if (dpad.up.isPressed || dpad.down.isPressed || dpad.left.isPressed || dpad.right.isPressed) { + NSLog(@"Hat %@ =%s%s%s%s\n", key, + dpad.up.isPressed ? " UP" : "", + dpad.down.isPressed ? " DOWN" : "", + dpad.left.isPressed ? " LEFT" : "", + dpad.right.isPressed ? " RIGHT" : ""); + } } } } -#endif +#endif /* DEBUG_CONTROLLER_STATE */ + +#ifdef ENABLE_PHYSICAL_INPUT_PROFILE + if (@available(macOS 10.16, iOS 14.0, tvOS 14.0, *)) { + NSDictionary *elements = controller.physicalInputProfile.elements; + NSDictionary *buttons = controller.physicalInputProfile.buttons; + int axis = 0; + int button = 0; + + for (id key in device->axes) { + Sint16 value; + GCControllerElement *element = elements[key]; + if ([element isKindOfClass:[GCControllerAxisInput class]]) { + value = (Sint16)([(GCControllerAxisInput *)element value] * 32767); + } else { + value = (Sint16)([(GCControllerButtonInput *)element value] * 32767); + } + SDL_PrivateJoystickAxis(joystick, axis++, value); + } + for (id key in device->buttons) { + Uint8 value; + if (button == device->pause_button_index) { + value = (device->pause_button_pressed > 0); + } else { + value = buttons[key].isPressed; + } + SDL_PrivateJoystickButton(joystick, button++, value); + } + } else +#endif if (controller.extendedGamepad) { SDL_bool isstack; GCExtendedGamepad *gamepad = controller.extendedGamepad; @@ -1000,78 +1212,29 @@ static void IOS_MFIJoystickUpdate(SDL_Joystick *joystick) buttons[button_count++] = gamepad.rightShoulder.isPressed; /* These buttons are available on some newer controllers */ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wunguarded-availability-new" - if (joystick->hwdata->button_mask & (1 << SDL_CONTROLLER_BUTTON_LEFTSTICK)) { - buttons[button_count++] = gamepad.leftThumbstickButton.isPressed; - } - if (joystick->hwdata->button_mask & (1 << SDL_CONTROLLER_BUTTON_RIGHTSTICK)) { - buttons[button_count++] = gamepad.rightThumbstickButton.isPressed; - } - if (joystick->hwdata->button_mask & (1 << SDL_CONTROLLER_BUTTON_BACK)) { - buttons[button_count++] = gamepad.buttonOptions.isPressed; - } - if (joystick->hwdata->button_mask & (1 << SDL_CONTROLLER_BUTTON_GUIDE)) { - buttons[button_count++] = gamepad.buttonHome.isPressed; - } - /* This must be the last button, so we can optionally handle it with pause_button_index below */ - if (joystick->hwdata->button_mask & (1 << SDL_CONTROLLER_BUTTON_START)) { - if (joystick->hwdata->uses_pause_handler) { - pause_button_index = button_count; - buttons[button_count++] = joystick->delayed_guide_button; - } else { - buttons[button_count++] = gamepad.buttonMenu.isPressed; - } - } - -#ifdef ENABLE_PHYSICAL_INPUT_PROFILE - if (joystick->hwdata->has_dualshock_touchpad) { - GCControllerDirectionPad *dpad; - buttons[button_count++] = controller.physicalInputProfile.buttons[GCInputDualShockTouchpadButton].isPressed; - - dpad = controller.physicalInputProfile.dpads[GCInputDualShockTouchpadOne]; - if (dpad.xAxis.value || dpad.yAxis.value) { - SDL_PrivateJoystickTouchpad(joystick, 0, 0, SDL_PRESSED, (1.0f + dpad.xAxis.value) * 0.5f, 1.0f - (1.0f + dpad.yAxis.value) * 0.5f, 1.0f); - } else { - SDL_PrivateJoystickTouchpad(joystick, 0, 0, SDL_RELEASED, 0.0f, 0.0f, 1.0f); + if (@available(macOS 10.14.1, iOS 12.1, tvOS 12.1, *)) { + if (device->button_mask & (1 << SDL_CONTROLLER_BUTTON_LEFTSTICK)) { + buttons[button_count++] = gamepad.leftThumbstickButton.isPressed; } - - dpad = controller.physicalInputProfile.dpads[GCInputDualShockTouchpadTwo]; - if (dpad.xAxis.value || dpad.yAxis.value) { - SDL_PrivateJoystickTouchpad(joystick, 0, 1, SDL_PRESSED, (1.0f + dpad.xAxis.value) * 0.5f, 1.0f - (1.0f + dpad.yAxis.value) * 0.5f, 1.0f); - } else { - SDL_PrivateJoystickTouchpad(joystick, 0, 1, SDL_RELEASED, 0.0f, 0.0f, 1.0f); + if (device->button_mask & (1 << SDL_CONTROLLER_BUTTON_RIGHTSTICK)) { + buttons[button_count++] = gamepad.rightThumbstickButton.isPressed; } } - - if (joystick->hwdata->has_xbox_paddles) { - if (joystick->hwdata->button_mask & (1 << SDL_CONTROLLER_BUTTON_PADDLE1)) { - buttons[button_count++] = controller.physicalInputProfile.buttons[GCInputXboxPaddleOne].isPressed; + if (@available(macOS 10.15, iOS 13.0, tvOS 13.0, *)) { + if (device->button_mask & (1 << SDL_CONTROLLER_BUTTON_BACK)) { + buttons[button_count++] = gamepad.buttonOptions.isPressed; } - if (joystick->hwdata->button_mask & (1 << SDL_CONTROLLER_BUTTON_PADDLE2)) { - buttons[button_count++] = controller.physicalInputProfile.buttons[GCInputXboxPaddleTwo].isPressed; - } - if (joystick->hwdata->button_mask & (1 << SDL_CONTROLLER_BUTTON_PADDLE3)) { - buttons[button_count++] = controller.physicalInputProfile.buttons[GCInputXboxPaddleThree].isPressed; - } - if (joystick->hwdata->button_mask & (1 << SDL_CONTROLLER_BUTTON_PADDLE4)) { - buttons[button_count++] = controller.physicalInputProfile.buttons[GCInputXboxPaddleFour].isPressed; - } - - /* - SDL_Log("Paddles: [%d,%d,%d,%d]", - controller.physicalInputProfile.buttons[GCInputXboxPaddleOne].isPressed, - controller.physicalInputProfile.buttons[GCInputXboxPaddleTwo].isPressed, - controller.physicalInputProfile.buttons[GCInputXboxPaddleThree].isPressed, - controller.physicalInputProfile.buttons[GCInputXboxPaddleFour].isPressed); - */ } - - if (joystick->hwdata->has_xbox_share_button) { - buttons[button_count++] = controller.physicalInputProfile.buttons[GCInputXboxShareButton].isPressed; + if (device->button_mask & (1 << SDL_CONTROLLER_BUTTON_START)) { + if (device->pause_button_index >= 0) { + /* Guaranteed if buttonMenu is not supported on this OS */ + buttons[button_count++] = (device->pause_button_pressed > 0); + } else { + if (@available(macOS 10.15, iOS 13.0, tvOS 13.0, *)) { + buttons[button_count++] = gamepad.buttonMenu.isPressed; + } + } } -#endif -#pragma clang diagnostic pop hatstate = IOS_MFIJoystickHatStateForDPad(gamepad.dpad); @@ -1083,30 +1246,6 @@ static void IOS_MFIJoystickUpdate(SDL_Joystick *joystick) SDL_PrivateJoystickButton(joystick, i, buttons[i]); } -#ifdef ENABLE_MFI_SENSORS - if (@available(macOS 10.16, iOS 14.0, tvOS 14.0, *)) { - GCMotion *motion = controller.motion; - if (motion && motion.sensorsActive) { - float data[3]; - - if (motion.hasRotationRate) { - GCRotationRate rate = motion.rotationRate; - data[0] = rate.x; - data[1] = rate.z; - data[2] = -rate.y; - SDL_PrivateJoystickSensor(joystick, SDL_SENSOR_GYRO, 0, data, 3); - } - if (motion.hasGravityAndUserAcceleration) { - GCAcceleration accel = motion.acceleration; - data[0] = -accel.x * SDL_STANDARD_GRAVITY; - data[1] = -accel.y * SDL_STANDARD_GRAVITY; - data[2] = -accel.z * SDL_STANDARD_GRAVITY; - SDL_PrivateJoystickSensor(joystick, SDL_SENSOR_ACCEL, 0, data, 3); - } - } - } -#endif /* ENABLE_MFI_SENSORS */ - SDL_small_free(buttons, isstack); } else if (controller.gamepad) { SDL_bool isstack; @@ -1127,8 +1266,7 @@ static void IOS_MFIJoystickUpdate(SDL_Joystick *joystick) buttons[button_count++] = gamepad.buttonY.isPressed; buttons[button_count++] = gamepad.leftShoulder.isPressed; buttons[button_count++] = gamepad.rightShoulder.isPressed; - pause_button_index = button_count; - buttons[button_count++] = joystick->delayed_guide_button; + buttons[button_count++] = (device->pause_button_pressed > 0); hatstate = IOS_MFIJoystickHatStateForDPad(gamepad.dpad); @@ -1155,18 +1293,7 @@ static void IOS_MFIJoystickUpdate(SDL_Joystick *joystick) int button_count = 0; buttons[button_count++] = gamepad.buttonA.isPressed; buttons[button_count++] = gamepad.buttonX.isPressed; -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wunguarded-availability-new" - /* This must be the last button, so we can optionally handle it with pause_button_index below */ - if (joystick->hwdata->button_mask & (1 << SDL_CONTROLLER_BUTTON_START)) { - if (joystick->hwdata->uses_pause_handler) { - pause_button_index = button_count; - buttons[button_count++] = joystick->delayed_guide_button; - } else { - buttons[button_count++] = gamepad.buttonMenu.isPressed; - } - } -#pragma clang diagnostic pop + buttons[button_count++] = (device->pause_button_pressed > 0); for (i = 0; i < button_count; i++) { SDL_PrivateJoystickButton(joystick, i, buttons[i]); @@ -1178,14 +1305,60 @@ static void IOS_MFIJoystickUpdate(SDL_Joystick *joystick) SDL_PrivateJoystickHat(joystick, 0, hatstate); } - if (joystick->hwdata->uses_pause_handler) { - for (i = 0; i < joystick->hwdata->num_pause_presses; i++) { - SDL_PrivateJoystickButton(joystick, pause_button_index, SDL_PRESSED); - SDL_PrivateJoystickButton(joystick, pause_button_index, SDL_RELEASED); + if (device->pause_button_pressed) { + /* The pause callback is instantaneous, so we extend the duration to allow "holding down" by pressing it repeatedly */ + const int PAUSE_BUTTON_PRESS_DURATION_MS = 250; + if (SDL_TICKS_PASSED(SDL_GetTicks(), device->pause_button_pressed + PAUSE_BUTTON_PRESS_DURATION_MS)) { + device->pause_button_pressed = 0; } - joystick->hwdata->num_pause_presses = 0; } +#ifdef ENABLE_PHYSICAL_INPUT_PROFILE + if (@available(macOS 10.16, iOS 14.0, tvOS 14.0, *)) { + if (device->has_dualshock_touchpad) { + GCControllerDirectionPad *dpad; + + dpad = controller.physicalInputProfile.dpads[GCInputDualShockTouchpadOne]; + if (dpad.xAxis.value || dpad.yAxis.value) { + SDL_PrivateJoystickTouchpad(joystick, 0, 0, SDL_PRESSED, (1.0f + dpad.xAxis.value) * 0.5f, 1.0f - (1.0f + dpad.yAxis.value) * 0.5f, 1.0f); + } else { + SDL_PrivateJoystickTouchpad(joystick, 0, 0, SDL_RELEASED, 0.0f, 0.0f, 1.0f); + } + + dpad = controller.physicalInputProfile.dpads[GCInputDualShockTouchpadTwo]; + if (dpad.xAxis.value || dpad.yAxis.value) { + SDL_PrivateJoystickTouchpad(joystick, 0, 1, SDL_PRESSED, (1.0f + dpad.xAxis.value) * 0.5f, 1.0f - (1.0f + dpad.yAxis.value) * 0.5f, 1.0f); + } else { + SDL_PrivateJoystickTouchpad(joystick, 0, 1, SDL_RELEASED, 0.0f, 0.0f, 1.0f); + } + } + } +#endif /* ENABLE_PHYSICAL_INPUT_PROFILE */ + +#ifdef ENABLE_MFI_SENSORS + if (@available(macOS 10.16, iOS 14.0, tvOS 14.0, *)) { + GCMotion *motion = controller.motion; + if (motion && motion.sensorsActive) { + float data[3]; + + if (motion.hasRotationRate) { + GCRotationRate rate = motion.rotationRate; + data[0] = rate.x; + data[1] = rate.z; + data[2] = -rate.y; + SDL_PrivateJoystickSensor(joystick, SDL_SENSOR_GYRO, 0, data, 3); + } + if (motion.hasGravityAndUserAcceleration) { + GCAcceleration accel = motion.acceleration; + data[0] = -accel.x * SDL_STANDARD_GRAVITY; + data[1] = -accel.y * SDL_STANDARD_GRAVITY; + data[2] = -accel.z * SDL_STANDARD_GRAVITY; + SDL_PrivateJoystickSensor(joystick, SDL_SENSOR_ACCEL, 0, data, 3); + } + } + } +#endif /* ENABLE_MFI_SENSORS */ + #ifdef ENABLE_MFI_BATTERY if (@available(macOS 10.16, iOS 14.0, tvOS 14.0, *)) { GCDeviceBattery *battery = controller.battery; @@ -1633,7 +1806,7 @@ static void IOS_JoystickClose(SDL_Joystick *joystick) #endif /* SDL_JOYSTICK_MFI */ } } - if (device->remote) { + if (device->is_siri_remote) { --SDL_AppleTVRemoteOpenedAsJoystick; } } @@ -1674,12 +1847,144 @@ static void IOS_JoystickQuit(void) static SDL_bool IOS_JoystickGetGamepadMapping(int device_index, SDL_GamepadMapping *out) { +#ifdef ENABLE_PHYSICAL_INPUT_PROFILE + SDL_JoystickDeviceItem *device = GetDeviceForIndex(device_index); + if (device == NULL) { + return SDL_FALSE; + } + if (device->accelerometer) { + return SDL_FALSE; + } + + if (@available(macOS 10.16, iOS 14.0, tvOS 14.0, *)) { + int axis = 0; + int button = 0; + for (id key in device->axes) { + if ([(NSString *)key isEqualToString:@"Left Thumbstick X Axis"] || + [(NSString *)key isEqualToString:@"Direction Pad X Axis"]) { + out->leftx.kind = EMappingKind_Axis; + out->leftx.target = axis; + } else if ([(NSString *)key isEqualToString:@"Left Thumbstick Y Axis"] || + [(NSString *)key isEqualToString:@"Direction Pad Y Axis"]) { + out->lefty.kind = EMappingKind_Axis; + out->lefty.target = axis; + out->lefty.axis_reversed = SDL_TRUE; + } else if ([(NSString *)key isEqualToString:@"Right Thumbstick X Axis"]) { + out->rightx.kind = EMappingKind_Axis; + out->rightx.target = axis; + } else if ([(NSString *)key isEqualToString:@"Right Thumbstick Y Axis"]) { + out->righty.kind = EMappingKind_Axis; + out->righty.target = axis; + out->righty.axis_reversed = SDL_TRUE; + } else if ([(NSString *)key isEqualToString:GCInputLeftTrigger]) { + out->lefttrigger.kind = EMappingKind_Axis; + out->lefttrigger.target = axis; + out->lefttrigger.half_axis_positive = SDL_TRUE; + } else if ([(NSString *)key isEqualToString:GCInputRightTrigger]) { + out->righttrigger.kind = EMappingKind_Axis; + out->righttrigger.target = axis; + out->righttrigger.half_axis_positive = SDL_TRUE; + } + ++axis; + } + + for (id key in device->buttons) { + SDL_InputMapping *mapping = NULL; + + if ([(NSString *)key isEqualToString:GCInputButtonA]) { + if (device->is_siri_remote > 1) { + /* GCInputButtonA is triggered for any D-Pad press, ignore it in favor of "Button Center" */ + } else { + mapping = &out->a; + } + } else if ([(NSString *)key isEqualToString:GCInputButtonB]) { + if (device->is_switch_joyconL || device->is_switch_joyconR) { + mapping = &out->x; + } else { + mapping = &out->b; + } + } else if ([(NSString *)key isEqualToString:GCInputButtonX]) { + if (device->is_switch_joyconL || device->is_switch_joyconR) { + mapping = &out->b; + } else { + mapping = &out->x; + } + } else if ([(NSString *)key isEqualToString:GCInputButtonY]) { + mapping = &out->y; + } else if ([(NSString *)key isEqualToString:@"Direction Pad Left"]) { + mapping = &out->dpleft; + } else if ([(NSString *)key isEqualToString:@"Direction Pad Right"]) { + mapping = &out->dpright; + } else if ([(NSString *)key isEqualToString:@"Direction Pad Up"]) { + mapping = &out->dpup; + } else if ([(NSString *)key isEqualToString:@"Direction Pad Down"]) { + mapping = &out->dpdown; + } else if ([(NSString *)key isEqualToString:@"Cardinal Direction Pad Left"]) { + mapping = &out->dpleft; + } else if ([(NSString *)key isEqualToString:@"Cardinal Direction Pad Right"]) { + mapping = &out->dpright; + } else if ([(NSString *)key isEqualToString:@"Cardinal Direction Pad Up"]) { + mapping = &out->dpup; + } else if ([(NSString *)key isEqualToString:@"Cardinal Direction Pad Down"]) { + mapping = &out->dpdown; + } else if ([(NSString *)key isEqualToString:GCInputLeftShoulder]) { + mapping = &out->leftshoulder; + } else if ([(NSString *)key isEqualToString:GCInputRightShoulder]) { + mapping = &out->rightshoulder; + } else if ([(NSString *)key isEqualToString:GCInputLeftThumbstickButton]) { + mapping = &out->leftstick; + } else if ([(NSString *)key isEqualToString:GCInputRightThumbstickButton]) { + mapping = &out->rightstick; + } else if ([(NSString *)key isEqualToString:@"Button Home"]) { + mapping = &out->guide; + } else if ([(NSString *)key isEqualToString:GCInputButtonMenu]) { + if (device->is_siri_remote) { + mapping = &out->b; + } else { + mapping = &out->start; + } + } else if ([(NSString *)key isEqualToString:GCInputButtonOptions]) { + mapping = &out->back; + } else if ([(NSString *)key isEqualToString:@"Button Share"]) { + mapping = &out->misc1; + } else if ([(NSString *)key isEqualToString:GCInputXboxPaddleOne]) { + mapping = &out->paddle1; + } else if ([(NSString *)key isEqualToString:GCInputXboxPaddleTwo]) { + mapping = &out->paddle3; + } else if ([(NSString *)key isEqualToString:GCInputXboxPaddleThree]) { + mapping = &out->paddle2; + } else if ([(NSString *)key isEqualToString:GCInputXboxPaddleFour]) { + mapping = &out->paddle4; + } else if ([(NSString *)key isEqualToString:GCInputLeftTrigger]) { + mapping = &out->lefttrigger; + } else if ([(NSString *)key isEqualToString:GCInputRightTrigger]) { + mapping = &out->righttrigger; + } else if ([(NSString *)key isEqualToString:GCInputDualShockTouchpadButton]) { + mapping = &out->touchpad; + } else if ([(NSString *)key isEqualToString:@"Button Center"]) { + mapping = &out->a; + } + if (mapping && mapping->kind == EMappingKind_None) { + mapping->kind = EMappingKind_Button; + mapping->target = button; + } + ++button; + } + + return SDL_TRUE; + } +#endif /* ENABLE_PHYSICAL_INPUT_PROFILE */ + return SDL_FALSE; } #if defined(SDL_JOYSTICK_MFI) && defined(__MACOSX__) SDL_bool IOS_SupportedHIDDevice(IOHIDDeviceRef device) { + if (!SDL_GetHintBoolean(SDL_HINT_JOYSTICK_MFI, SDL_TRUE)) { + return SDL_FALSE; + } + if (@available(macOS 10.16, *)) { const int MAX_ATTEMPTS = 3; for (int attempt = 0; attempt < MAX_ATTEMPTS; ++attempt) { @@ -1708,6 +2013,10 @@ static void GetAppleSFSymbolsNameForElement(GCControllerElement *element, char * static GCControllerDirectionPad *GetDirectionalPadForController(GCController *controller) { + if (@available(macOS 10.16, iOS 14.0, tvOS 14.0, *)) { + return controller.physicalInputProfile.dpads[GCInputDirectionPad]; + } + if (controller.extendedGamepad) { return controller.extendedGamepad.dpad; } @@ -1885,6 +2194,7 @@ static void GetAppleSFSymbolsNameForElement(GCControllerElement *element, char * IOS_JoystickDetect, IOS_JoystickGetDeviceName, IOS_JoystickGetDevicePath, + IOS_JoystickGetDeviceSteamVirtualGamepadSlot, IOS_JoystickGetDevicePlayerIndex, IOS_JoystickSetDevicePlayerIndex, IOS_JoystickGetDeviceGUID, diff --git a/thirdparty/SDL/src/joystick/iphoneos/SDL_mfijoystick_c.h b/thirdparty/SDL/src/joystick/iphoneos/SDL_mfijoystick_c.h index bf5311c98..84a4e71a3 100644 --- a/thirdparty/SDL/src/joystick/iphoneos/SDL_mfijoystick_c.h +++ b/thirdparty/SDL/src/joystick/iphoneos/SDL_mfijoystick_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -26,18 +26,19 @@ #include "SDL_stdinc.h" #include "../SDL_sysjoystick.h" +#import +#import + @class GCController; typedef struct joystick_hwdata { SDL_bool accelerometer; - SDL_bool remote; GCController __unsafe_unretained *controller; void *rumble; - SDL_bool uses_pause_handler; - int num_pause_presses; - Uint32 pause_button_down_time; + int pause_button_index; + Uint32 pause_button_pressed; char *name; SDL_Joystick *joystick; @@ -48,6 +49,20 @@ typedef struct joystick_hwdata int nbuttons; int nhats; Uint32 button_mask; + SDL_bool is_xbox; + SDL_bool is_ps4; + SDL_bool is_ps5; + SDL_bool is_switch_pro; + SDL_bool is_switch_joycon_pair; + SDL_bool is_switch_joyconL; + SDL_bool is_switch_joyconR; + SDL_bool is_stadia; + SDL_bool is_backbone_one; + int is_siri_remote; + + NSArray __unsafe_unretained *axes; + NSArray __unsafe_unretained *buttons; + SDL_bool has_dualshock_touchpad; SDL_bool has_xbox_paddles; SDL_bool has_xbox_share_button; diff --git a/thirdparty/SDL/src/joystick/linux/SDL_sysjoystick.c b/thirdparty/SDL/src/joystick/linux/SDL_sysjoystick.c index 4ba32ef35..bb7c31ced 100644 --- a/thirdparty/SDL/src/joystick/linux/SDL_sysjoystick.c +++ b/thirdparty/SDL/src/joystick/linux/SDL_sysjoystick.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -53,6 +53,10 @@ #include "../hidapi/SDL_hidapijoystick_c.h" /* This isn't defined in older Linux kernel headers */ +#ifndef MSC_TIMESTAMP +#define MSC_TIMESTAMP 0x05 +#endif + #ifndef SYN_DROPPED #define SYN_DROPPED 3 #endif @@ -119,6 +123,7 @@ #define BTN_TRIGGER_HAPPY40 0x2e7 #endif + #include "../../core/linux/SDL_evdev_capabilities.h" #include "../../core/linux/SDL_udev.h" #include "../../core/linux/SDL_sandbox.h" @@ -141,8 +146,8 @@ typedef enum static EnumerationMethod enumeration_method = ENUMERATION_UNSET; static SDL_bool IsJoystickJSNode(const char *node); -static int MaybeAddDevice(const char *path); -static int MaybeRemoveDevice(const char *path); +static void MaybeAddDevice(const char *path); +static void MaybeRemoveDevice(const char *path); /* A linked list of available joysticks */ typedef struct SDL_joylist_item @@ -152,6 +157,7 @@ typedef struct SDL_joylist_item char *name; /* "SideWinder 3D Pro" or whatever */ SDL_JoystickGUID guid; dev_t devnum; + int steam_virtual_gamepad_slot; struct joystick_hwdata *hwdata; struct SDL_joylist_item *next; @@ -162,10 +168,20 @@ typedef struct SDL_joylist_item SDL_GamepadMapping *mapping; } SDL_joylist_item; +/* A linked list of available gamepad sensors */ +typedef struct SDL_sensorlist_item +{ + char *path; /* "/dev/input/event2" or whatever */ + dev_t devnum; + struct joystick_hwdata *hwdata; + struct SDL_sensorlist_item *next; +} SDL_sensorlist_item; + static SDL_bool SDL_classic_joysticks = SDL_FALSE; -static SDL_joylist_item *SDL_joylist = NULL; -static SDL_joylist_item *SDL_joylist_tail = NULL; -static int numjoysticks = 0; +static SDL_joylist_item *SDL_joylist SDL_GUARDED_BY(SDL_joystick_lock) = NULL; +static SDL_joylist_item *SDL_joylist_tail SDL_GUARDED_BY(SDL_joystick_lock) = NULL; +static int numjoysticks SDL_GUARDED_BY(SDL_joystick_lock) = 0; +static SDL_sensorlist_item *SDL_sensorlist SDL_GUARDED_BY(SDL_joystick_lock) = NULL; static int inotify_fd = -1; static Uint32 last_joy_detect_time; @@ -205,13 +221,29 @@ static SDL_bool IsVirtualJoystick(Uint16 vendor, Uint16 product, Uint16 version, } #endif /* SDL_JOYSTICK_HIDAPI */ -static int GuessIsJoystick(int fd) +static SDL_bool GetSteamVirtualGamepadSlot(int fd, int *slot) +{ + char name[128]; + + if (ioctl(fd, EVIOCGNAME(sizeof(name)), name) > 0) { + const char *digits = SDL_strstr(name, "pad "); + if (digits) { + digits += 4; + if (SDL_isdigit(*digits)) { + *slot = SDL_atoi(digits); + return SDL_TRUE; + } + } + } + return SDL_FALSE; +} + +static int GuessDeviceClass(int fd) { unsigned long evbit[NBITS(EV_MAX)] = { 0 }; unsigned long keybit[NBITS(KEY_MAX)] = { 0 }; unsigned long absbit[NBITS(ABS_MAX)] = { 0 }; unsigned long relbit[NBITS(REL_MAX)] = { 0 }; - int devclass; if ((ioctl(fd, EVIOCGBIT(0, sizeof(evbit)), evbit) < 0) || (ioctl(fd, EVIOCGBIT(EV_KEY, sizeof(keybit)), keybit) < 0) || @@ -220,43 +252,68 @@ static int GuessIsJoystick(int fd) return 0; } - devclass = SDL_EVDEV_GuessDeviceClass(evbit, absbit, keybit, relbit); + return SDL_EVDEV_GuessDeviceClass(evbit, absbit, keybit, relbit); +} + +static int GuessIsJoystick(int fd) +{ + if (GuessDeviceClass(fd) & SDL_UDEV_DEVICE_JOYSTICK) { + return 1; + } + + return 0; +} - if (devclass & SDL_UDEV_DEVICE_JOYSTICK) { +static int GuessIsSensor(int fd) +{ + if (GuessDeviceClass(fd) & SDL_UDEV_DEVICE_ACCELEROMETER) { return 1; } return 0; } -static int IsJoystick(const char *path, int fd, char **name_return, SDL_JoystickGUID *guid) +static int IsJoystick(const char *path, int *fd, char **name_return, Uint16 *vendor_return, Uint16 *product_return, SDL_JoystickGUID *guid) { struct input_id inpid; char *name; char product_string[128]; + int class = 0; - if (ioctl(fd, JSIOCGNAME(sizeof(product_string)), product_string) >= 0) { - SDL_zero(inpid); -#if SDL_USE_LIBUDEV - SDL_UDEV_GetProductInfo(path, &inpid.vendor, &inpid.product, &inpid.version); + SDL_zero(inpid); +#ifdef SDL_USE_LIBUDEV + /* Opening input devices can generate synchronous device I/O, so avoid it if we can */ + if (SDL_UDEV_GetProductInfo(path, &inpid.vendor, &inpid.product, &inpid.version, &class) && + !(class & SDL_UDEV_DEVICE_JOYSTICK)) { + return 0; + } #endif - } else { - /* When udev is enabled we only get joystick devices here, so there's no need to test them */ - if (enumeration_method != ENUMERATION_LIBUDEV && !GuessIsJoystick(fd)) { + + if (fd && *fd < 0) { + *fd = open(path, O_RDONLY | O_CLOEXEC, 0); + } + if (!fd || *fd < 0) { + return 0; + } + + if (ioctl(*fd, JSIOCGNAME(sizeof(product_string)), product_string) <= 0) { + /* When udev enumeration or classification, we only got joysticks here, so no need to test */ + if (enumeration_method != ENUMERATION_LIBUDEV && !class && !GuessIsJoystick(*fd)) { return 0; } - if (ioctl(fd, EVIOCGID, &inpid) < 0) { + /* Could have vendor and product already from udev, but should agree with evdev */ + if (ioctl(*fd, EVIOCGID, &inpid) < 0) { return 0; } - if (ioctl(fd, EVIOCGNAME(sizeof(product_string)), product_string) < 0) { + if (ioctl(*fd, EVIOCGNAME(sizeof(product_string)), product_string) < 0) { return 0; } } name = SDL_CreateJoystickName(inpid.vendor, inpid.product, NULL, product_string); - if (name == NULL) { + if (!name) { return 0; } @@ -269,26 +326,66 @@ static int IsJoystick(const char *path, int fd, char **name_return, SDL_Joystick } #endif - FixupDeviceInfoForMapping(fd, &inpid); + FixupDeviceInfoForMapping(*fd, &inpid); #ifdef DEBUG_JOYSTICK SDL_Log("Joystick: %s, bustype = %d, vendor = 0x%.4x, product = 0x%.4x, version = %d\n", name, inpid.bustype, inpid.vendor, inpid.product, inpid.version); #endif - *guid = SDL_CreateJoystickGUID(inpid.bustype, inpid.vendor, inpid.product, inpid.version, name, 0, 0); + *guid = SDL_CreateJoystickGUID(inpid.bustype, inpid.vendor, inpid.product, inpid.version, NULL, product_string, 0, 0); if (SDL_ShouldIgnoreJoystick(name, *guid)) { SDL_free(name); return 0; } *name_return = name; + *vendor_return = inpid.vendor; + *product_return = inpid.product; + return 1; +} + +static int IsSensor(const char *path, int *fd) +{ + struct input_id inpid; + int class = 0; + + SDL_zero(inpid); +#ifdef SDL_USE_LIBUDEV + /* Opening input devices can generate synchronous device I/O, so avoid it if we can */ + if (SDL_UDEV_GetProductInfo(path, &inpid.vendor, &inpid.product, &inpid.version, &class) && + !(class & SDL_UDEV_DEVICE_ACCELEROMETER)) { + return 0; + } +#endif + + if (fd && *fd < 0) { + *fd = open(path, O_RDONLY | O_CLOEXEC, 0); + } + if (!fd || *fd < 0) { + return 0; + } + + if (!class && !GuessIsSensor(*fd)) { + return 0; + } + + if (ioctl(*fd, EVIOCGID, &inpid) < 0) { + return 0; + } + + if (inpid.vendor == USB_VENDOR_NINTENDO && inpid.product == USB_PRODUCT_NINTENDO_WII_REMOTE) { + /* Wii extension controls */ + /* These may create 3 sensor devices but we only support reading from 1: ignore them */ + return 0; + } + return 1; } -#if SDL_USE_LIBUDEV +#ifdef SDL_USE_LIBUDEV static void joystick_udev_callback(SDL_UDEV_deviceevent udev_type, int udev_class, const char *devpath) { - if (devpath == NULL) { + if (!devpath) { return; } @@ -331,84 +428,126 @@ static void FreeJoylistItem(SDL_joylist_item *item) SDL_free(item); } -static int MaybeAddDevice(const char *path) +static void FreeSensorlistItem(SDL_sensorlist_item *item) +{ + SDL_free(item->path); + SDL_free(item); +} + +static void MaybeAddDevice(const char *path) { struct stat sb; int fd = -1; - int isstick = 0; char *name = NULL; + Uint16 vendor, product; SDL_JoystickGUID guid; SDL_joylist_item *item; + SDL_sensorlist_item *item_sensor; - if (path == NULL) { - return -1; + if (!path) { + return; } if (stat(path, &sb) == -1) { - return -1; + return; } + SDL_LockJoysticks(); + /* Check to make sure it's not already in list. */ - for (item = SDL_joylist; item != NULL; item = item->next) { + for (item = SDL_joylist; item; item = item->next) { if (sb.st_rdev == item->devnum) { - return -1; /* already have this one */ + goto done; /* already have this one */ } } - - fd = open(path, O_RDONLY | O_CLOEXEC, 0); - if (fd < 0) { - return -1; + for (item_sensor = SDL_sensorlist; item_sensor; item_sensor = item_sensor->next) { + if (sb.st_rdev == item_sensor->devnum) { + goto done; /* already have this one */ + } } #ifdef DEBUG_INPUT_EVENTS SDL_Log("Checking %s\n", path); #endif - isstick = IsJoystick(path, fd, &name, &guid); - close(fd); - if (!isstick) { - return -1; - } + if (IsJoystick(path, &fd, &name, &vendor, &product, &guid)) { +#ifdef DEBUG_INPUT_EVENTS + SDL_Log("found joystick: %s\n", path); +#endif + item = (SDL_joylist_item *)SDL_calloc(1, sizeof(SDL_joylist_item)); + if (!item) { + SDL_free(name); + goto done; + } - item = (SDL_joylist_item *)SDL_calloc(1, sizeof(SDL_joylist_item)); - if (item == NULL) { - SDL_free(name); - return -1; - } + item->devnum = sb.st_rdev; + item->steam_virtual_gamepad_slot = -1; + item->path = SDL_strdup(path); + item->name = name; + item->guid = guid; - item->devnum = sb.st_rdev; - item->path = SDL_strdup(path); - item->name = name; - item->guid = guid; + if (vendor == USB_VENDOR_VALVE && + product == USB_PRODUCT_STEAM_VIRTUAL_GAMEPAD) { + GetSteamVirtualGamepadSlot(fd, &item->steam_virtual_gamepad_slot); + } - if ((item->path == NULL) || (item->name == NULL)) { - FreeJoylistItem(item); - return -1; - } + if ((!item->path) || (!item->name)) { + FreeJoylistItem(item); + goto done; + } - item->device_instance = SDL_GetNextJoystickInstanceID(); - if (SDL_joylist_tail == NULL) { - SDL_joylist = SDL_joylist_tail = item; - } else { - SDL_joylist_tail->next = item; - SDL_joylist_tail = item; + item->device_instance = SDL_GetNextJoystickInstanceID(); + if (!SDL_joylist_tail) { + SDL_joylist = SDL_joylist_tail = item; + } else { + SDL_joylist_tail->next = item; + SDL_joylist_tail = item; + } + + /* Need to increment the joystick count before we post the event */ + ++numjoysticks; + + SDL_PrivateJoystickAdded(item->device_instance); + goto done; } - /* Need to increment the joystick count before we post the event */ - ++numjoysticks; + if (IsSensor(path, &fd)) { +#ifdef DEBUG_INPUT_EVENTS + SDL_Log("found sensor: %s\n", path); +#endif + item_sensor = (SDL_sensorlist_item *)SDL_calloc(1, sizeof(SDL_sensorlist_item)); + if (!item_sensor) { + goto done; + } + item_sensor->devnum = sb.st_rdev; + item_sensor->path = SDL_strdup(path); - SDL_PrivateJoystickAdded(item->device_instance); + if (!item_sensor->path) { + FreeSensorlistItem(item_sensor); + goto done; + } - return numjoysticks; + item_sensor->next = SDL_sensorlist; + SDL_sensorlist = item_sensor; + goto done; + } + +done: + if (fd >= 0) { + close(fd); + } + SDL_UnlockJoysticks(); } static void RemoveJoylistItem(SDL_joylist_item *item, SDL_joylist_item *prev) { + SDL_AssertJoysticksLocked(); + if (item->hwdata) { item->hwdata->item = NULL; } - if (prev != NULL) { + if (prev) { prev->next = item->next; } else { SDL_assert(SDL_joylist == item); @@ -426,38 +565,73 @@ static void RemoveJoylistItem(SDL_joylist_item *item, SDL_joylist_item *prev) FreeJoylistItem(item); } -static int MaybeRemoveDevice(const char *path) +static void RemoveSensorlistItem(SDL_sensorlist_item *item, SDL_sensorlist_item *prev) +{ + SDL_AssertJoysticksLocked(); + + if (item->hwdata) { + item->hwdata->item_sensor = NULL; + } + + if (prev) { + prev->next = item->next; + } else { + SDL_assert(SDL_sensorlist == item); + SDL_sensorlist = item->next; + } + + /* Do not call SDL_PrivateJoystickRemoved here as RemoveJoylistItem will do it, + * assuming both sensor and joy item are removed at the same time */ + FreeSensorlistItem(item); +} + +static void MaybeRemoveDevice(const char *path) { SDL_joylist_item *item; SDL_joylist_item *prev = NULL; + SDL_sensorlist_item *item_sensor; + SDL_sensorlist_item *prev_sensor = NULL; - if (path == NULL) { - return -1; + if (!path) { + return; } - for (item = SDL_joylist; item != NULL; item = item->next) { + SDL_LockJoysticks(); + for (item = SDL_joylist; item; item = item->next) { /* found it, remove it. */ if (SDL_strcmp(path, item->path) == 0) { - const int retval = item->device_instance; RemoveJoylistItem(item, prev); - return retval; + goto done; } prev = item; } - - return -1; + for (item_sensor = SDL_sensorlist; item_sensor; item_sensor = item_sensor->next) { + /* found it, remove it. */ + if (SDL_strcmp(path, item_sensor->path) == 0) { + RemoveSensorlistItem(item_sensor, prev_sensor); + goto done; + } + prev_sensor = item_sensor; + } +done: + SDL_UnlockJoysticks(); } static void HandlePendingRemovals(void) { SDL_joylist_item *prev = NULL; - SDL_joylist_item *item = SDL_joylist; + SDL_joylist_item *item = NULL; + SDL_sensorlist_item *prev_sensor = NULL; + SDL_sensorlist_item *item_sensor = NULL; + + SDL_AssertJoysticksLocked(); - while (item != NULL) { + item = SDL_joylist; + while (item) { if (item->hwdata && item->hwdata->gone) { RemoveJoylistItem(item, prev); - if (prev != NULL) { + if (prev) { item = prev->next; } else { item = SDL_joylist; @@ -467,6 +641,22 @@ static void HandlePendingRemovals(void) item = item->next; } } + + item_sensor = SDL_sensorlist; + while (item_sensor) { + if (item_sensor->hwdata && item_sensor->hwdata->sensor_gone) { + RemoveSensorlistItem(item_sensor, prev_sensor); + + if (prev_sensor) { + item_sensor = prev_sensor->next; + } else { + item_sensor = SDL_sensorlist; + } + } else { + prev_sensor = item_sensor; + item_sensor = item_sensor->next; + } + } } static SDL_bool SteamControllerConnectedCallback(const char *name, SDL_JoystickGUID guid, int *device_instance) @@ -474,7 +664,7 @@ static SDL_bool SteamControllerConnectedCallback(const char *name, SDL_JoystickG SDL_joylist_item *item; item = (SDL_joylist_item *)SDL_calloc(1, sizeof(SDL_joylist_item)); - if (item == NULL) { + if (!item) { return SDL_FALSE; } @@ -483,13 +673,14 @@ static SDL_bool SteamControllerConnectedCallback(const char *name, SDL_JoystickG item->guid = guid; item->m_bSteamController = SDL_TRUE; - if ((item->path == NULL) || (item->name == NULL)) { + if ((!item->path) || (!item->name)) { FreeJoylistItem(item); return SDL_FALSE; } *device_instance = item->device_instance = SDL_GetNextJoystickInstanceID(); - if (SDL_joylist_tail == NULL) { + SDL_LockJoysticks(); + if (!SDL_joylist_tail) { SDL_joylist = SDL_joylist_tail = item; } else { SDL_joylist_tail->next = item; @@ -500,6 +691,7 @@ static SDL_bool SteamControllerConnectedCallback(const char *name, SDL_JoystickG ++numjoysticks; SDL_PrivateJoystickAdded(item->device_instance); + SDL_UnlockJoysticks(); return SDL_TRUE; } @@ -509,14 +701,16 @@ static void SteamControllerDisconnectedCallback(int device_instance) SDL_joylist_item *item; SDL_joylist_item *prev = NULL; - for (item = SDL_joylist; item != NULL; item = item->next) { + SDL_LockJoysticks(); + for (item = SDL_joylist; item; item = item->next) { /* found it, remove it. */ if (item->device_instance == device_instance) { RemoveJoylistItem(item, prev); - return; + break; } prev = item; } + SDL_UnlockJoysticks(); } static int StrHasPrefix(const char *string, const char *prefix) @@ -690,6 +884,102 @@ static int sort_entries(const void *_a, const void *_b) return numA - numB; } +typedef struct +{ + char *path; + int slot; +} VirtualGamepadEntry; + +static int SDLCALL sort_virtual_gamepads(const void *_a, const void *_b) +{ + const VirtualGamepadEntry *a = (const VirtualGamepadEntry *)_a; + const VirtualGamepadEntry *b = (const VirtualGamepadEntry *)_b; + return a->slot - b->slot; +} + +static void LINUX_ScanSteamVirtualGamepads(void) +{ + int i, count; + int fd; + struct dirent **entries = NULL; + char path[PATH_MAX]; + struct input_id inpid; + int num_virtual_gamepads = 0; + int virtual_gamepad_slot; + VirtualGamepadEntry *virtual_gamepads = NULL; +#ifdef SDL_USE_LIBUDEV + int class; +#endif + + count = scandir("/dev/input", &entries, filter_entries, NULL); + for (i = 0; i < count; ++i) { + (void)SDL_snprintf(path, SDL_arraysize(path), "/dev/input/%s", entries[i]->d_name); + +#ifdef SDL_USE_LIBUDEV + /* Opening input devices can generate synchronous device I/O, so avoid it if we can */ + class = 0; + SDL_zero(inpid); + if (SDL_UDEV_GetProductInfo(path, &inpid.vendor, &inpid.product, &inpid.version, &class) && + (inpid.vendor != USB_VENDOR_VALVE || inpid.product != USB_PRODUCT_STEAM_VIRTUAL_GAMEPAD)) { + free(entries[i]); /* This should NOT be SDL_free() */ + continue; + } +#endif + fd = open(path, O_RDONLY | O_CLOEXEC, 0); + if (fd >= 0) { + if (ioctl(fd, EVIOCGID, &inpid) == 0 && + inpid.vendor == USB_VENDOR_VALVE && + inpid.product == USB_PRODUCT_STEAM_VIRTUAL_GAMEPAD && + GetSteamVirtualGamepadSlot(fd, &virtual_gamepad_slot)) { + VirtualGamepadEntry *new_virtual_gamepads = (VirtualGamepadEntry *)SDL_realloc(virtual_gamepads, (num_virtual_gamepads + 1) * sizeof(*virtual_gamepads)); + if (new_virtual_gamepads) { + VirtualGamepadEntry *entry = &new_virtual_gamepads[num_virtual_gamepads]; + entry->path = SDL_strdup(path); + entry->slot = virtual_gamepad_slot; + if (entry->path) { + virtual_gamepads = new_virtual_gamepads; + ++num_virtual_gamepads; + } else { + SDL_free(entry->path); + SDL_free(new_virtual_gamepads); + } + } + } + close(fd); + } + free(entries[i]); /* This should NOT be SDL_free() */ + } + free(entries); /* This should NOT be SDL_free() */ + + if (num_virtual_gamepads > 1) { + SDL_qsort(virtual_gamepads, num_virtual_gamepads, sizeof(*virtual_gamepads), sort_virtual_gamepads); + } + for (i = 0; i < num_virtual_gamepads; ++i) { + MaybeAddDevice(virtual_gamepads[i].path); + SDL_free(virtual_gamepads[i].path); + } + SDL_free(virtual_gamepads); +} + +static void LINUX_ScanInputDevices(void) +{ + int i, count; + struct dirent **entries = NULL; + char path[PATH_MAX]; + + count = scandir("/dev/input", &entries, filter_entries, NULL); + if (count > 1) { + SDL_qsort(entries, count, sizeof(*entries), sort_entries); + } + for (i = 0; i < count; ++i) { + (void)SDL_snprintf(path, SDL_arraysize(path), "/dev/input/%s", entries[i]->d_name); + MaybeAddDevice(path); + + free(entries[i]); /* This should NOT be SDL_free() */ + } + free(entries); /* This should NOT be SDL_free() */ +} + static void LINUX_FallbackJoystickDetect(void) { const Uint32 SDL_JOY_DETECT_INTERVAL_MS = 3000; /* Update every 3 seconds */ @@ -700,21 +990,10 @@ static void LINUX_FallbackJoystickDetect(void) /* Opening input devices can generate synchronous device I/O, so avoid it if we can */ if (stat("/dev/input", &sb) == 0 && sb.st_mtime != last_input_dir_mtime) { - int i, count; - struct dirent **entries = NULL; - char path[PATH_MAX]; + /* Look for Steam virtual gamepads first, and sort by Steam controller slot */ + LINUX_ScanSteamVirtualGamepads(); - count = scandir("/dev/input", &entries, filter_entries, NULL); - if (count > 1) { - qsort(entries, count, sizeof(*entries), sort_entries); - } - for (i = 0; i < count; ++i) { - (void)SDL_snprintf(path, SDL_arraysize(path), "/dev/input/%s", entries[i]->d_name); - MaybeAddDevice(path); - - free(entries[i]); /* This should NOT be SDL_free() */ - } - free(entries); /* This should NOT be SDL_free() */ + LINUX_ScanInputDevices(); last_input_dir_mtime = sb.st_mtime; } @@ -725,7 +1004,7 @@ static void LINUX_FallbackJoystickDetect(void) static void LINUX_JoystickDetect(void) { -#if SDL_USE_LIBUDEV +#ifdef SDL_USE_LIBUDEV if (enumeration_method == ENUMERATION_LIBUDEV) { SDL_UDEV_Poll(); } else @@ -747,19 +1026,22 @@ static void LINUX_JoystickDetect(void) static int LINUX_JoystickInit(void) { const char *devices = SDL_GetHint(SDL_HINT_JOYSTICK_DEVICE); +#ifdef SDL_USE_LIBUDEV + int udev_status = SDL_UDEV_Init(); +#endif SDL_classic_joysticks = SDL_GetHintBoolean(SDL_HINT_LINUX_JOYSTICK_CLASSIC, SDL_FALSE); enumeration_method = ENUMERATION_UNSET; /* First see if the user specified one or more joysticks to use */ - if (devices != NULL) { + if (devices) { char *envcopy, *envpath, *delim; envcopy = SDL_strdup(devices); envpath = envcopy; - while (envpath != NULL) { + while (envpath) { delim = SDL_strchr(envpath, ':'); - if (delim != NULL) { + if (delim) { *delim++ = '\0'; } MaybeAddDevice(envpath); @@ -778,7 +1060,7 @@ static int LINUX_JoystickInit(void) /* Manually scan first, since we sort by device number and udev doesn't */ LINUX_JoystickDetect(); -#if SDL_USE_LIBUDEV +#ifdef SDL_USE_LIBUDEV if (enumeration_method == ENUMERATION_UNSET) { if (SDL_GetHintBoolean("SDL_JOYSTICK_DISABLE_UDEV", SDL_FALSE)) { SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, @@ -797,21 +1079,24 @@ static int LINUX_JoystickInit(void) } if (enumeration_method == ENUMERATION_LIBUDEV) { - if (SDL_UDEV_Init() < 0) { - return SDL_SetError("Could not initialize UDEV"); - } + if (udev_status == 0) { + /* Set up the udev callback */ + if (SDL_UDEV_AddCallback(joystick_udev_callback) < 0) { + SDL_UDEV_Quit(); + return SDL_SetError("Could not set up joystick <-> udev callback"); + } - /* Set up the udev callback */ - if (SDL_UDEV_AddCallback(joystick_udev_callback) < 0) { - SDL_UDEV_Quit(); - return SDL_SetError("Could not set up joystick <-> udev callback"); + /* Force a scan to build the initial device list */ + SDL_UDEV_Scan(); + } else { + SDL_LogDebug(SDL_LOG_CATEGORY_INPUT, + "udev init failed, disabling udev integration"); + enumeration_method = ENUMERATION_FALLBACK; } - - /* Force a scan to build the initial device list */ - SDL_UDEV_Scan(); - } else + } #endif - { + + if (enumeration_method != ENUMERATION_LIBUDEV) { #if defined(HAVE_INOTIFY) inotify_fd = SDL_inotify_init1(); @@ -842,17 +1127,22 @@ static int LINUX_JoystickInit(void) static int LINUX_JoystickGetCount(void) { + SDL_AssertJoysticksLocked(); + return numjoysticks; } static SDL_joylist_item *JoystickByDevIndex(int device_index) { - SDL_joylist_item *item = SDL_joylist; + SDL_joylist_item *item; + + SDL_AssertJoysticksLocked(); if ((device_index < 0) || (device_index >= numjoysticks)) { return NULL; } + item = SDL_joylist; while (device_index > 0) { SDL_assert(item != NULL); device_index--; @@ -872,6 +1162,11 @@ static const char *LINUX_JoystickGetDevicePath(int device_index) return JoystickByDevIndex(device_index)->path; } +static int LINUX_JoystickGetDeviceSteamVirtualGamepadSlot(int device_index) +{ + return JoystickByDevIndex(device_index)->steam_virtual_gamepad_slot; +} + static int LINUX_JoystickGetDevicePlayerIndex(int device_index) { return -1; @@ -901,7 +1196,7 @@ static int allocate_hatdata(SDL_Joystick *joystick) joystick->hwdata->hats = (struct hwdata_hat *)SDL_malloc(joystick->nhats * sizeof(struct hwdata_hat)); - if (joystick->hwdata->hats == NULL) { + if (!joystick->hwdata->hats) { return -1; } for (i = 0; i < joystick->nhats; ++i) { @@ -920,7 +1215,7 @@ static int allocate_balldata(SDL_Joystick *joystick) joystick->hwdata->balls = (struct hwdata_ball *)SDL_malloc(joystick->nballs * sizeof(struct hwdata_ball)); - if (joystick->hwdata->balls == NULL) { + if (!joystick->hwdata->balls) { return -1; } for (i = 0; i < joystick->nballs; ++i) { @@ -939,7 +1234,7 @@ static SDL_bool GuessIfAxesAreDigitalHat(struct input_absinfo *absinfo_x, struct * other continuous analog axis, so we have to guess. */ /* If both axes are missing, they're not anything. */ - if (absinfo_x == NULL && absinfo_y == NULL) { + if (!absinfo_x && !absinfo_y) { return SDL_FALSE; } @@ -949,12 +1244,12 @@ static SDL_bool GuessIfAxesAreDigitalHat(struct input_absinfo *absinfo_x, struct } /* If both axes have ranges constrained between -1 and 1, they're definitely digital. */ - if ((absinfo_x == NULL || (absinfo_x->minimum == -1 && absinfo_x->maximum == 1)) && (absinfo_y == NULL || (absinfo_y->minimum == -1 && absinfo_y->maximum == 1))) { + if ((!absinfo_x || (absinfo_x->minimum == -1 && absinfo_x->maximum == 1)) && (!absinfo_y || (absinfo_y->minimum == -1 && absinfo_y->maximum == 1))) { return SDL_TRUE; } /* If both axes lack fuzz, flat, and resolution values, they're probably digital. */ - if ((absinfo_x == NULL || (!absinfo_x->fuzz && !absinfo_x->flat && !absinfo_x->resolution)) && (absinfo_y == NULL || (!absinfo_y->fuzz && !absinfo_y->flat && !absinfo_y->resolution))) { + if ((!absinfo_x || (!absinfo_x->fuzz && !absinfo_x->flat && !absinfo_x->resolution)) && (!absinfo_y || (!absinfo_y->fuzz && !absinfo_y->flat && !absinfo_y->resolution))) { return SDL_TRUE; } @@ -962,7 +1257,7 @@ static SDL_bool GuessIfAxesAreDigitalHat(struct input_absinfo *absinfo_x, struct return SDL_FALSE; } -static void ConfigJoystick(SDL_Joystick *joystick, int fd) +static void ConfigJoystick(SDL_Joystick *joystick, int fd, int fd_sensor) { int i, t; unsigned long keybit[NBITS(KEY_MAX)] = { 0 }; @@ -1153,6 +1448,45 @@ static void ConfigJoystick(SDL_Joystick *joystick, int fd) } } + /* Sensors are only available through the new unified event API */ + if (fd_sensor >= 0 && (ioctl(fd_sensor, EVIOCGBIT(EV_ABS, sizeof(absbit)), absbit) >= 0)) { + if (test_bit(ABS_X, absbit) && test_bit(ABS_Y, absbit) && test_bit(ABS_Z, absbit)) { + joystick->hwdata->has_accelerometer = SDL_TRUE; + for (i = 0; i < 3; ++i) { + struct input_absinfo absinfo; + if (ioctl(fd_sensor, EVIOCGABS(ABS_X + i), &absinfo) < 0) { + joystick->hwdata->has_accelerometer = SDL_FALSE; + break; /* do not report an accelerometer if we can't read all axes */ + } + joystick->hwdata->accelerometer_scale[i] = absinfo.resolution; +#ifdef DEBUG_INPUT_EVENTS + SDL_Log("Joystick has accelerometer axis: 0x%.2x\n", ABS_X + i); + SDL_Log("Values = { val:%d, min:%d, max:%d, fuzz:%d, flat:%d, res:%d }\n", + absinfo.value, absinfo.minimum, absinfo.maximum, + absinfo.fuzz, absinfo.flat, absinfo.resolution); +#endif /* DEBUG_INPUT_EVENTS */ + } + } + + if (test_bit(ABS_RX, absbit) && test_bit(ABS_RY, absbit) && test_bit(ABS_RZ, absbit)) { + joystick->hwdata->has_gyro = SDL_TRUE; + for (i = 0; i < 3; ++i) { + struct input_absinfo absinfo; + if (ioctl(fd_sensor, EVIOCGABS(ABS_RX + i), &absinfo) < 0) { + joystick->hwdata->has_gyro = SDL_FALSE; + break; /* do not report a gyro if we can't read all axes */ + } + joystick->hwdata->gyro_scale[i] = absinfo.resolution; +#ifdef DEBUG_INPUT_EVENTS + SDL_Log("Joystick has gyro axis: 0x%.2x\n", ABS_RX + i); + SDL_Log("Values = { val:%d, min:%d, max:%d, fuzz:%d, flat:%d, res:%d }\n", + absinfo.value, absinfo.minimum, absinfo.maximum, + absinfo.fuzz, absinfo.flat, absinfo.resolution); +#endif /* DEBUG_INPUT_EVENTS */ + } + } + } + /* Allocate data to keep track of these thingamajigs */ if (joystick->nhats > 0) { if (allocate_hatdata(joystick) < 0) { @@ -1180,11 +1514,12 @@ static void ConfigJoystick(SDL_Joystick *joystick, int fd) without adding an opened SDL_Joystick object to the system. This expects `joystick->hwdata` to be allocated and will not free it on error. Returns -1 on error, 0 on success. */ -static int PrepareJoystickHwdata(SDL_Joystick *joystick, SDL_joylist_item *item) +static int PrepareJoystickHwdata(SDL_Joystick *joystick, SDL_joylist_item *item, SDL_sensorlist_item *item_sensor) { SDL_AssertJoysticksLocked(); joystick->hwdata->item = item; + joystick->hwdata->item_sensor = item_sensor; joystick->hwdata->guid = item->guid; joystick->hwdata->effect.id = -1; joystick->hwdata->m_bSteamController = item->m_bSteamController; @@ -1193,12 +1528,14 @@ static int PrepareJoystickHwdata(SDL_Joystick *joystick, SDL_joylist_item *item) if (item->m_bSteamController) { joystick->hwdata->fd = -1; + joystick->hwdata->fd_sensor = -1; SDL_GetSteamControllerInputs(&joystick->nbuttons, &joystick->naxes, &joystick->nhats); } else { + int fd = -1, fd_sensor = -1; /* Try read-write first, so we can do rumble */ - int fd = open(item->path, O_RDWR | O_CLOEXEC, 0); + fd = open(item->path, O_RDWR | O_CLOEXEC, 0); if (fd < 0) { /* Try read-only again, at least we'll get events in this case */ fd = open(item->path, O_RDONLY | O_CLOEXEC, 0); @@ -1206,23 +1543,88 @@ static int PrepareJoystickHwdata(SDL_Joystick *joystick, SDL_joylist_item *item) if (fd < 0) { return SDL_SetError("Unable to open %s", item->path); } + /* If opening sensor fail, continue with buttons and axes only */ + if (item_sensor) { + fd_sensor = open(item_sensor->path, O_RDONLY | O_CLOEXEC, 0); + } joystick->hwdata->fd = fd; + joystick->hwdata->fd_sensor = fd_sensor; joystick->hwdata->fname = SDL_strdup(item->path); - if (joystick->hwdata->fname == NULL) { + if (!joystick->hwdata->fname) { close(fd); + if (fd_sensor >= 0) { + close(fd_sensor); + } return SDL_OutOfMemory(); } /* Set the joystick to non-blocking read mode */ fcntl(fd, F_SETFL, O_NONBLOCK); + if (fd_sensor >= 0) { + fcntl(fd_sensor, F_SETFL, O_NONBLOCK); + } /* Get the number of buttons and axes on the joystick */ - ConfigJoystick(joystick, fd); + ConfigJoystick(joystick, fd, fd_sensor); } return 0; } +static SDL_sensorlist_item *GetSensor(SDL_joylist_item *item) +{ + SDL_sensorlist_item *item_sensor; + char uniq_item[128]; + int fd_item = -1; + + SDL_AssertJoysticksLocked(); + + if (!item || !SDL_sensorlist) { + return NULL; + } + + SDL_memset(uniq_item, 0, sizeof(uniq_item)); + fd_item = open(item->path, O_RDONLY | O_CLOEXEC, 0); + if (fd_item < 0) { + return NULL; + } + if (ioctl(fd_item, EVIOCGUNIQ(sizeof(uniq_item) - 1), &uniq_item) < 0) { + return NULL; + } + close(fd_item); +#ifdef DEBUG_INPUT_EVENTS + SDL_Log("Joystick UNIQ: %s\n", uniq_item); +#endif /* DEBUG_INPUT_EVENTS */ + + for (item_sensor = SDL_sensorlist; item_sensor; item_sensor = item_sensor->next) { + char uniq_sensor[128]; + int fd_sensor = -1; + if (item_sensor->hwdata) { + /* already associated with another joystick */ + continue; + } + + SDL_memset(uniq_sensor, 0, sizeof(uniq_sensor)); + fd_sensor = open(item_sensor->path, O_RDONLY | O_CLOEXEC, 0); + if (fd_sensor < 0) { + continue; + } + if (ioctl(fd_sensor, EVIOCGUNIQ(sizeof(uniq_sensor) - 1), &uniq_sensor) < 0) { + close(fd_sensor); + continue; + } + close(fd_sensor); +#ifdef DEBUG_INPUT_EVENTS + SDL_Log("Sensor UNIQ: %s\n", uniq_sensor); +#endif /* DEBUG_INPUT_EVENTS */ + + if (SDL_strcmp(uniq_item, uniq_sensor) == 0) { + return item_sensor; + } + } + return NULL; +} + /* Function to open a joystick for use. The joystick to open is specified by the device index. This should fill the nbuttons and naxes fields of the joystick structure. @@ -1230,33 +1632,52 @@ static int PrepareJoystickHwdata(SDL_Joystick *joystick, SDL_joylist_item *item) */ static int LINUX_JoystickOpen(SDL_Joystick *joystick, int device_index) { - SDL_joylist_item *item = JoystickByDevIndex(device_index); + SDL_joylist_item *item; + SDL_sensorlist_item *item_sensor; SDL_AssertJoysticksLocked(); - if (item == NULL) { + item = JoystickByDevIndex(device_index); + if (!item) { return SDL_SetError("No such device"); } joystick->instance_id = item->device_instance; joystick->hwdata = (struct joystick_hwdata *) SDL_calloc(1, sizeof(*joystick->hwdata)); - if (joystick->hwdata == NULL) { + if (!joystick->hwdata) { return SDL_OutOfMemory(); } - if (PrepareJoystickHwdata(joystick, item) == -1) { + item_sensor = GetSensor(item); + if (PrepareJoystickHwdata(joystick, item, item_sensor) == -1) { SDL_free(joystick->hwdata); joystick->hwdata = NULL; return -1; /* SDL_SetError will already have been called */ } SDL_assert(item->hwdata == NULL); + SDL_assert(!item_sensor || item_sensor->hwdata == NULL); item->hwdata = joystick->hwdata; + if (item_sensor) { + item_sensor->hwdata = joystick->hwdata; + } /* mark joystick as fresh and ready */ joystick->hwdata->fresh = SDL_TRUE; + if (joystick->hwdata->has_gyro) { + SDL_PrivateJoystickAddSensor(joystick, SDL_SENSOR_GYRO, 0.0f); + } + if (joystick->hwdata->has_accelerometer) { + SDL_PrivateJoystickAddSensor(joystick, SDL_SENSOR_ACCEL, 0.0f); + } + if (joystick->hwdata->fd_sensor >= 0) { + /* Don't keep fd_sensor opened while sensor is disabled */ + close(joystick->hwdata->fd_sensor); + joystick->hwdata->fd_sensor = -1; + } + return 0; } @@ -1333,7 +1754,32 @@ static int LINUX_JoystickSendEffect(SDL_Joystick *joystick, const void *data, in static int LINUX_JoystickSetSensorsEnabled(SDL_Joystick *joystick, SDL_bool enabled) { - return SDL_Unsupported(); + SDL_AssertJoysticksLocked(); + + if (!joystick->hwdata->has_accelerometer && !joystick->hwdata->has_gyro) { + return SDL_Unsupported(); + } + if (enabled == joystick->hwdata->report_sensor) { + return 0; + } + + if (enabled) { + if (!joystick->hwdata->item_sensor) { + return SDL_SetError("Sensors unplugged."); + } + joystick->hwdata->fd_sensor = open(joystick->hwdata->item_sensor->path, O_RDONLY | O_CLOEXEC, 0); + if (joystick->hwdata->fd_sensor < 0) { + return SDL_SetError("Couldn't open sensor file %s.", joystick->hwdata->item_sensor->path); + } + fcntl(joystick->hwdata->fd_sensor, F_SETFL, O_NONBLOCK); + } else { + SDL_assert(joystick->hwdata->fd_sensor >= 0); + close(joystick->hwdata->fd_sensor); + joystick->hwdata->fd_sensor = -1; + } + + joystick->hwdata->report_sensor = enabled; + return 0; } static void HandleHat(SDL_Joystick *stick, int hatidx, int axis, int value) @@ -1486,6 +1932,41 @@ static void PollAllValues(SDL_Joystick *joystick) /* Joyballs are relative input, so there's no poll state. Events only! */ } +static void PollAllSensors(SDL_Joystick *joystick) +{ + struct input_absinfo absinfo; + int i; + + SDL_AssertJoysticksLocked(); + + SDL_assert(joystick->hwdata->fd_sensor >= 0); + + if (joystick->hwdata->has_gyro) { + float data[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 * (M_PI / 180.f) / joystick->hwdata->gyro_scale[i]; +#ifdef DEBUG_INPUT_EVENTS + SDL_Log("Joystick : Re-read Gyro (axis %d) val= %f\n", i, data[i]); +#endif + } + } + SDL_PrivateJoystickSensor(joystick, SDL_SENSOR_GYRO, joystick->hwdata->sensor_tick, data, 3); + } + if (joystick->hwdata->has_accelerometer) { + float data[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]; +#ifdef DEBUG_INPUT_EVENTS + SDL_Log("Joystick : Re-read Accelerometer (axis %d) val= %f\n", i, data[i]); +#endif + } + } + SDL_PrivateJoystickSensor(joystick, SDL_SENSOR_ACCEL, joystick->hwdata->sensor_tick, data, 3); + } +} + static void HandleInputEvents(SDL_Joystick *joystick) { struct input_event events[32]; @@ -1495,9 +1976,14 @@ static void HandleInputEvents(SDL_Joystick *joystick) if (joystick->hwdata->fresh) { PollAllValues(joystick); + if (joystick->hwdata->report_sensor) { + PollAllSensors(joystick); + } joystick->hwdata->fresh = SDL_FALSE; } + errno = 0; + while ((len = read(joystick->hwdata->fd, events, sizeof(events))) > 0) { len /= sizeof(events[0]); for (i = 0; i < len; ++i) { @@ -1577,6 +2063,96 @@ static void HandleInputEvents(SDL_Joystick *joystick) if (errno == ENODEV) { /* We have to wait until the JoystickDetect callback to remove this */ joystick->hwdata->gone = SDL_TRUE; + errno = 0; + } + + if (joystick->hwdata->report_sensor) { + SDL_assert(joystick->hwdata->fd_sensor >= 0); + + while ((len = read(joystick->hwdata->fd_sensor, events, sizeof(events))) > 0) { + len /= sizeof(events[0]); + for (i = 0; i < len; ++i) { + unsigned int j; + struct input_event *event = &events[i]; + + code = event->code; + + /* If the kernel sent a SYN_DROPPED, we are supposed to ignore the + rest of the packet (the end of it signified by a SYN_REPORT) */ + if (joystick->hwdata->recovering_from_dropped_sensor && + ((event->type != EV_SYN) || (code != SYN_REPORT))) { + continue; + } + + switch (event->type) { + case EV_KEY: + SDL_assert(0); + break; + case EV_ABS: + switch (code) { + case ABS_X: + case ABS_Y: + case ABS_Z: + j = code - ABS_X; + joystick->hwdata->accel_data[j] = event->value * SDL_STANDARD_GRAVITY + / joystick->hwdata->accelerometer_scale[j]; + break; + case ABS_RX: + case ABS_RY: + case ABS_RZ: + j = code - ABS_RX; + joystick->hwdata->gyro_data[j] = event->value * (M_PI / 180.f) + / joystick->hwdata->gyro_scale[j]; + break; + } + break; + case EV_MSC: + if (code == MSC_TIMESTAMP) { + Sint32 tick = event->value; + Sint32 delta; + if (joystick->hwdata->last_tick < tick) { + delta = (tick - joystick->hwdata->last_tick); + } else { + delta = (SDL_MAX_SINT32 - joystick->hwdata->last_tick + tick + 1); + } + joystick->hwdata->sensor_tick += delta; + joystick->hwdata->last_tick = tick; + } + break; + case EV_SYN: + switch (code) { + case SYN_DROPPED: + #ifdef DEBUG_INPUT_EVENTS + SDL_Log("Event SYN_DROPPED detected\n"); + #endif + joystick->hwdata->recovering_from_dropped_sensor = SDL_TRUE; + break; + case SYN_REPORT: + if (joystick->hwdata->recovering_from_dropped_sensor) { + joystick->hwdata->recovering_from_dropped_sensor = SDL_FALSE; + PollAllSensors(joystick); /* try to sync up to current state now */ + } else { + SDL_PrivateJoystickSensor(joystick, SDL_SENSOR_GYRO, + joystick->hwdata->sensor_tick, + joystick->hwdata->gyro_data, 3); + SDL_PrivateJoystickSensor(joystick, SDL_SENSOR_ACCEL, + joystick->hwdata->sensor_tick, + joystick->hwdata->accel_data, 3); + } + break; + default: + break; + } + default: + break; + } + } + } + } + + if (errno == ENODEV) { + /* We have to wait until the JoystickDetect callback to remove this */ + joystick->hwdata->sensor_gone = SDL_TRUE; } } @@ -1670,9 +2246,15 @@ static void LINUX_JoystickClose(SDL_Joystick *joystick) if (joystick->hwdata->fd >= 0) { close(joystick->hwdata->fd); } + if (joystick->hwdata->fd_sensor >= 0) { + close(joystick->hwdata->fd_sensor); + } if (joystick->hwdata->item) { joystick->hwdata->item->hwdata = NULL; } + if (joystick->hwdata->item_sensor) { + joystick->hwdata->item_sensor->hwdata = NULL; + } SDL_free(joystick->hwdata->key_pam); SDL_free(joystick->hwdata->abs_pam); SDL_free(joystick->hwdata->hats); @@ -1687,6 +2269,10 @@ static void LINUX_JoystickQuit(void) { SDL_joylist_item *item = NULL; SDL_joylist_item *next = NULL; + SDL_sensorlist_item *item_sensor = NULL; + SDL_sensorlist_item *next_sensor = NULL; + + SDL_AssertJoysticksLocked(); if (inotify_fd >= 0) { close(inotify_fd); @@ -1697,12 +2283,17 @@ static void LINUX_JoystickQuit(void) next = item->next; FreeJoylistItem(item); } + for (item_sensor = SDL_sensorlist; item_sensor; item_sensor = next_sensor) { + next_sensor = item_sensor->next; + FreeSensorlistItem(item_sensor); + } SDL_joylist = SDL_joylist_tail = NULL; + SDL_sensorlist = NULL; numjoysticks = 0; -#if SDL_USE_LIBUDEV +#ifdef SDL_USE_LIBUDEV if (enumeration_method == ENUMERATION_LIBUDEV) { SDL_UDEV_DelCallback(joystick_udev_callback); SDL_UDEV_Quit(); @@ -1752,7 +2343,7 @@ static SDL_bool LINUX_JoystickGetGamepadMapping(int device_index, SDL_GamepadMap /* We temporarily open the device to check how it's configured. Make a fake SDL_Joystick object to do so. */ joystick = (SDL_Joystick *)SDL_calloc(sizeof(*joystick), 1); - if (joystick == NULL) { + if (!joystick) { SDL_OutOfMemory(); return SDL_FALSE; } @@ -1761,7 +2352,7 @@ static SDL_bool LINUX_JoystickGetGamepadMapping(int device_index, SDL_GamepadMap joystick->hwdata = (struct joystick_hwdata *) SDL_calloc(1, sizeof(*joystick->hwdata)); - if (joystick->hwdata == NULL) { + if (!joystick->hwdata) { SDL_free(joystick); SDL_OutOfMemory(); return SDL_FALSE; @@ -1769,7 +2360,7 @@ static SDL_bool LINUX_JoystickGetGamepadMapping(int device_index, SDL_GamepadMap item->checked_mapping = SDL_TRUE; - if (PrepareJoystickHwdata(joystick, item) == -1) { + if (PrepareJoystickHwdata(joystick, item, NULL) == -1) { SDL_free(joystick->hwdata); SDL_free(joystick); return SDL_FALSE; /* SDL_SetError will already have been called */ @@ -2200,6 +2791,7 @@ SDL_JoystickDriver SDL_LINUX_JoystickDriver = { LINUX_JoystickDetect, LINUX_JoystickGetDeviceName, LINUX_JoystickGetDevicePath, + LINUX_JoystickGetDeviceSteamVirtualGamepadSlot, LINUX_JoystickGetDevicePlayerIndex, LINUX_JoystickSetDevicePlayerIndex, LINUX_JoystickGetDeviceGUID, diff --git a/thirdparty/SDL/src/joystick/linux/SDL_sysjoystick_c.h b/thirdparty/SDL/src/joystick/linux/SDL_sysjoystick_c.h index a567312a9..6d6ee69ab 100644 --- a/thirdparty/SDL/src/joystick/linux/SDL_sysjoystick_c.h +++ b/thirdparty/SDL/src/joystick/linux/SDL_sysjoystick_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,12 +25,16 @@ #include struct SDL_joylist_item; +struct SDL_sensorlist_item; /* The private structure used to keep track of a joystick */ struct joystick_hwdata { int fd; + /* linux driver creates a separate device for gyro/accelerometer */ + int fd_sensor; struct SDL_joylist_item *item; + struct SDL_sensorlist_item *item_sensor; SDL_JoystickGUID guid; char *fname; /* Used in haptic subsystem */ @@ -55,6 +59,8 @@ struct joystick_hwdata Uint8 abs_map[ABS_MAX]; SDL_bool has_key[KEY_MAX]; SDL_bool has_abs[ABS_MAX]; + SDL_bool has_accelerometer; + SDL_bool has_gyro; /* Support for the classic joystick interface */ SDL_bool classic; @@ -74,8 +80,20 @@ struct joystick_hwdata float scale; } abs_correct[ABS_MAX]; + float accelerometer_scale[3]; + float gyro_scale[3]; + + /* Each axis is read independently, if we don't get all axis this call to + * LINUX_JoystickUpdateupdate(), store them for the next one */ + float gyro_data[3]; + float accel_data[3]; + Uint64 sensor_tick; + Sint32 last_tick; + + SDL_bool report_sensor; SDL_bool fresh; SDL_bool recovering_from_dropped; + SDL_bool recovering_from_dropped_sensor; /* Steam Controller support */ SDL_bool m_bSteamController; @@ -92,6 +110,7 @@ struct joystick_hwdata /* Set when gamepad is pending removal due to ENODEV read error */ SDL_bool gone; + SDL_bool sensor_gone; }; #endif /* SDL_sysjoystick_c_h_ */ diff --git a/thirdparty/SDL/src/joystick/n3ds/SDL_sysjoystick.c b/thirdparty/SDL/src/joystick/n3ds/SDL_sysjoystick.c index 49b9937ae..bfb1a37f1 100644 --- a/thirdparty/SDL/src/joystick/n3ds/SDL_sysjoystick.c +++ b/thirdparty/SDL/src/joystick/n3ds/SDL_sysjoystick.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -37,13 +37,23 @@ This correction is applied to axis values so they fit better in SDL's value range. */ -#define CORRECT_AXIS_X(X) ((X * SDL_JOYSTICK_AXIS_MAX) / 160) +static inline int Correct_Axis_X(int X) { + if (X > 160) { + return SDL_JOYSTICK_AXIS_MAX; + } + else if (X < -160) { + return -SDL_JOYSTICK_AXIS_MAX; + } + return (X * SDL_JOYSTICK_AXIS_MAX) / 160; +} /* The Y axis needs to be flipped because SDL's "up" is reversed compared to libctru's "up" */ -#define CORRECT_AXIS_Y(Y) CORRECT_AXIS_X(-Y) +static inline int Correct_Axis_Y(int Y) { + return Correct_Axis_X(-Y); +} SDL_FORCE_INLINE void UpdateN3DSPressedButtons(SDL_Joystick *joystick); SDL_FORCE_INLINE void UpdateN3DSReleasedButtons(SDL_Joystick *joystick); @@ -143,12 +153,12 @@ UpdateN3DSCircle(SDL_Joystick *joystick) if (previous_state.dx != current_state.dx) { SDL_PrivateJoystickAxis(joystick, 0, - CORRECT_AXIS_X(current_state.dx)); + Correct_Axis_X(current_state.dx)); } if (previous_state.dy != current_state.dy) { SDL_PrivateJoystickAxis(joystick, 1, - CORRECT_AXIS_Y(current_state.dy)); + Correct_Axis_Y(current_state.dy)); } previous_state = current_state; } @@ -162,12 +172,12 @@ UpdateN3DSCStick(SDL_Joystick *joystick) if (previous_state.dx != current_state.dx) { SDL_PrivateJoystickAxis(joystick, 2, - CORRECT_AXIS_X(current_state.dx)); + Correct_Axis_X(current_state.dx)); } if (previous_state.dy != current_state.dy) { SDL_PrivateJoystickAxis(joystick, 3, - CORRECT_AXIS_Y(current_state.dy)); + Correct_Axis_Y(current_state.dy)); } previous_state = current_state; } @@ -224,6 +234,11 @@ static const char *N3DS_JoystickGetDevicePath(int device_index) return NULL; } +static int N3DS_JoystickGetDeviceSteamVirtualGamepadSlot(int device_index) +{ + return -1; +} + static int N3DS_JoystickGetDevicePlayerIndex(int device_index) { return -1; @@ -264,6 +279,7 @@ SDL_JoystickDriver SDL_N3DS_JoystickDriver = { .Detect = N3DS_JoystickDetect, .GetDeviceName = N3DS_JoystickGetDeviceName, .GetDevicePath = N3DS_JoystickGetDevicePath, + .GetDeviceSteamVirtualGamepadSlot = N3DS_JoystickGetDeviceSteamVirtualGamepadSlot, .GetDevicePlayerIndex = N3DS_JoystickGetDevicePlayerIndex, .SetDevicePlayerIndex = N3DS_JoystickSetDevicePlayerIndex, .GetDeviceGUID = N3DS_JoystickGetDeviceGUID, diff --git a/thirdparty/SDL/src/joystick/os2/SDL_os2joystick.c b/thirdparty/SDL/src/joystick/os2/SDL_os2joystick.c index b7e0376b3..8df26ffe8 100644 --- a/thirdparty/SDL/src/joystick/os2/SDL_os2joystick.c +++ b/thirdparty/SDL/src/joystick/os2/SDL_os2joystick.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -408,6 +408,11 @@ static const char *OS2_JoystickGetDevicePath(int device_index) return NULL; } +static int OS2_JoystickGetDeviceSteamVirtualGamepadSlot(int device_index) +{ + return -1; +} + static int OS2_JoystickGetDevicePlayerIndex(int device_index) { return -1; @@ -731,7 +736,7 @@ static int joyGetEnv(struct _joycfg * joydata) char tempnumber[5]; /* Temporary place to put numeric texts */ joyenv = SDL_getenv("SDL_OS2_JOYSTICK"); - if (joyenv == NULL) { + if (!joyenv) { return 0; } @@ -817,6 +822,7 @@ SDL_JoystickDriver SDL_OS2_JoystickDriver = { OS2_JoystickDetect, OS2_JoystickGetDeviceName, OS2_JoystickGetDevicePath, + OS2_JoystickGetDeviceSteamVirtualGamepadSlot, OS2_JoystickGetDevicePlayerIndex, OS2_JoystickSetDevicePlayerIndex, OS2_JoystickGetDeviceGUID, diff --git a/thirdparty/SDL/src/joystick/ps2/SDL_sysjoystick.c b/thirdparty/SDL/src/joystick/ps2/SDL_sysjoystick.c index 698d632bf..d67d24198 100644 --- a/thirdparty/SDL/src/joystick/ps2/SDL_sysjoystick.c +++ b/thirdparty/SDL/src/joystick/ps2/SDL_sysjoystick.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_JOYSTICK_PS2 +#ifdef SDL_JOYSTICK_PS2 /* This is the PS2 implementation of the SDL joystick API */ #include @@ -133,13 +133,13 @@ static int PS2_JoystickInit(void) } /* Function to return the number of joystick devices plugged in right now */ -static int PS2_JoystickGetCount() +static int PS2_JoystickGetCount(void) { return (int)enabled_pads; } /* Function to cause any queued joystick insertions to be processed */ -static void PS2_JoystickDetect() +static void PS2_JoystickDetect(void) { } @@ -160,6 +160,12 @@ static const char *PS2_JoystickGetDevicePath(int index) return NULL; } +/* Function to get the Steam virtual gamepad slot of a joystick */ +static int PS2_JoystickGetDeviceSteamVirtualGamepadSlot(int device_index) +{ + return -1; +} + /* Function to get the player index of a joystick */ static int PS2_JoystickGetDevicePlayerIndex(int device_index) { @@ -343,6 +349,7 @@ SDL_JoystickDriver SDL_PS2_JoystickDriver = { PS2_JoystickDetect, PS2_JoystickGetDeviceName, PS2_JoystickGetDevicePath, + PS2_JoystickGetDeviceSteamVirtualGamepadSlot, PS2_JoystickGetDevicePlayerIndex, PS2_JoystickSetDevicePlayerIndex, PS2_JoystickGetDeviceGUID, diff --git a/thirdparty/SDL/src/joystick/psp/SDL_sysjoystick.c b/thirdparty/SDL/src/joystick/psp/SDL_sysjoystick.c index 3478ca803..9b60dfede 100644 --- a/thirdparty/SDL/src/joystick/psp/SDL_sysjoystick.c +++ b/thirdparty/SDL/src/joystick/psp/SDL_sysjoystick.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_JOYSTICK_PSP +#ifdef SDL_JOYSTICK_PSP /* This is the PSP implementation of the SDL joystick API */ #include @@ -96,6 +96,9 @@ static int PSP_JoystickInit(void) analog_map[127 - i] = -1 * analog_map[i + 128]; } + /* Fire off a joystick add event */ + SDL_PrivateJoystickAdded(0); + return 1; } @@ -124,6 +127,11 @@ static const char *PSP_JoystickGetDevicePath(int index) return NULL; } +static int PSP_JoystickGetDeviceSteamVirtualGamepadSlot(int device_index) +{ + return -1; +} + static int PSP_JoystickGetDevicePlayerIndex(int device_index) { return -1; @@ -205,7 +213,9 @@ static void PSP_JoystickUpdate(SDL_Joystick *joystick) static enum PspCtrlButtons old_buttons = 0; static unsigned char old_x = 0, old_y = 0; - sceCtrlReadBufferPositive(&pad, 1); + if (sceCtrlPeekBufferPositive(&pad, 1) <= 0) { + return; + } buttons = pad.Buttons; x = pad.Lx; y = pad.Ly; @@ -255,6 +265,7 @@ SDL_JoystickDriver SDL_PSP_JoystickDriver = { PSP_JoystickDetect, PSP_JoystickGetDeviceName, PSP_JoystickGetDevicePath, + PSP_JoystickGetDeviceSteamVirtualGamepadSlot, PSP_JoystickGetDevicePlayerIndex, PSP_JoystickSetDevicePlayerIndex, PSP_JoystickGetDeviceGUID, diff --git a/thirdparty/SDL/src/joystick/sort_controllers.py b/thirdparty/SDL/src/joystick/sort_controllers.py index c354a22dc..c97559f55 100755 --- a/thirdparty/SDL/src/joystick/sort_controllers.py +++ b/thirdparty/SDL/src/joystick/sort_controllers.py @@ -35,6 +35,15 @@ def find_element(prefix, bindings): return -1 +def get_crc_from_entry(entry): + crc = "" + line = "".join(entry) + bindings = line.split(",") + pos = find_element("crc:", bindings) + if pos >= 0: + crc = bindings[pos][4:] + return crc + def save_controller(line): global controllers match = split_pattern.match(line) @@ -85,7 +94,7 @@ def save_controller(line): entry.append(match.group(5)) controllers.append(entry) - entry_id = entry[1] + entry[3] + entry_id = entry[1] + get_crc_from_entry(entry) if ',sdk' in line or ',hint:' in line: conditionals.append(entry_id) @@ -94,7 +103,7 @@ def write_controllers(): global controller_guids # Check for duplicates for entry in controllers: - entry_id = entry[1] + entry[3] + entry_id = entry[1] + get_crc_from_entry(entry) if (entry_id in controller_guids and entry_id not in conditionals): current_name = entry[2] existing_name = controller_guids[entry_id][2] diff --git a/thirdparty/SDL/src/joystick/steam/SDL_steamcontroller.c b/thirdparty/SDL/src/joystick/steam/SDL_steamcontroller.c index 256aa7dc7..04327e37e 100644 --- a/thirdparty/SDL/src/joystick/steam/SDL_steamcontroller.c +++ b/thirdparty/SDL/src/joystick/steam/SDL_steamcontroller.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/joystick/steam/SDL_steamcontroller.h b/thirdparty/SDL/src/joystick/steam/SDL_steamcontroller.h index e63e51bb7..35a72226c 100644 --- a/thirdparty/SDL/src/joystick/steam/SDL_steamcontroller.h +++ b/thirdparty/SDL/src/joystick/steam/SDL_steamcontroller.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/joystick/usb_ids.h b/thirdparty/SDL/src/joystick/usb_ids.h index bc9e319e4..8e7a4d63f 100644 --- a/thirdparty/SDL/src/joystick/usb_ids.h +++ b/thirdparty/SDL/src/joystick/usb_ids.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -28,15 +28,19 @@ #define USB_VENDOR_AMAZON 0x1949 #define USB_VENDOR_APPLE 0x05ac #define USB_VENDOR_ASTRO 0x9886 +#define USB_VENDOR_ASUS 0x0b05 #define USB_VENDOR_BACKBONE 0x358a +#define USB_VENDOR_GAMESIR 0x3537 #define USB_VENDOR_DRAGONRISE 0x0079 #define USB_VENDOR_GOOGLE 0x18d1 #define USB_VENDOR_HORI 0x0f0d #define USB_VENDOR_HYPERKIN 0x2e24 #define USB_VENDOR_LOGITECH 0x046d #define USB_VENDOR_MADCATZ 0x0738 +#define USB_VENDOR_MAYFLASH 0x33df #define USB_VENDOR_MICROSOFT 0x045e #define USB_VENDOR_NACON 0x146b +#define USB_VENDOR_NACON_ALT 0x3285 #define USB_VENDOR_NINTENDO 0x057e #define USB_VENDOR_NVIDIA 0x0955 #define USB_VENDOR_PDP 0x0e6f @@ -44,27 +48,37 @@ #define USB_VENDOR_POWERA_ALT 0x20d6 #define USB_VENDOR_QANBA 0x2c22 #define USB_VENDOR_RAZER 0x1532 +#define USB_VENDOR_SAITEK 0x06a3 #define USB_VENDOR_SHANWAN 0x2563 #define USB_VENDOR_SHANWAN_ALT 0x20bc #define USB_VENDOR_SONY 0x054c #define USB_VENDOR_THRUSTMASTER 0x044f #define USB_VENDOR_TURTLE_BEACH 0x10f5 +#define USB_VENDOR_SWITCH 0x2563 #define USB_VENDOR_VALVE 0x28de #define USB_VENDOR_ZEROPLUS 0x0c12 -#define USB_PRODUCT_8BITDO_XBOX_CONTROLLER 0x2002 +#define USB_PRODUCT_8BITDO_XBOX_CONTROLLER1 0x2002 /* Ultimate Wired Controller for Xbox */ +#define USB_PRODUCT_8BITDO_XBOX_CONTROLLER2 0x3106 /* Ultimate Wireless / Pro 2 Wired Controller */ #define USB_PRODUCT_AMAZON_LUNA_CONTROLLER 0x0419 #define USB_PRODUCT_ASTRO_C40_XBOX360 0x0024 #define USB_PRODUCT_BACKBONE_ONE_IOS 0x0103 #define USB_PRODUCT_BACKBONE_ONE_IOS_PS5 0x0104 +#define USB_PRODUCT_GAMESIR_G7 0x1001 #define USB_PRODUCT_GOOGLE_STADIA_CONTROLLER 0x9400 -#define USB_PRODUCT_EVORETRO_GAMECUBE_ADAPTER 0x1846 +#define USB_PRODUCT_EVORETRO_GAMECUBE_ADAPTER1 0x1843 +#define USB_PRODUCT_EVORETRO_GAMECUBE_ADAPTER2 0x1846 #define USB_PRODUCT_HORI_FIGHTING_COMMANDER_OCTA_SERIES_X 0x0150 #define USB_PRODUCT_HORI_HORIPAD_PRO_SERIES_X 0x014f #define USB_PRODUCT_HORI_FIGHTING_STICK_ALPHA_PS4 0x011c #define USB_PRODUCT_HORI_FIGHTING_STICK_ALPHA_PS5 0x0184 #define USB_PRODUCT_LOGITECH_F310 0xc216 #define USB_PRODUCT_LOGITECH_CHILLSTREAM 0xcad1 +#define USB_PRODUCT_MADCATZ_SAITEK_SIDE_PANEL_CONTROL_DECK 0x2218 +#define USB_PRODUCT_NACON_REVOLUTION_5_PRO_PS4_WIRELESS 0x0d16 +#define USB_PRODUCT_NACON_REVOLUTION_5_PRO_PS4_WIRED 0x0d17 +#define USB_PRODUCT_NACON_REVOLUTION_5_PRO_PS5_WIRELESS 0x0d18 +#define USB_PRODUCT_NACON_REVOLUTION_5_PRO_PS5_WIRED 0x0d19 #define USB_PRODUCT_NINTENDO_GAMECUBE_ADAPTER 0x0337 #define USB_PRODUCT_NINTENDO_N64_CONTROLLER 0x2019 #define USB_PRODUCT_NINTENDO_SEGA_GENESIS_CONTROLLER 0x201e @@ -79,6 +93,7 @@ #define USB_PRODUCT_NVIDIA_SHIELD_CONTROLLER_V103 0x7210 #define USB_PRODUCT_NVIDIA_SHIELD_CONTROLLER_V104 0x7214 #define USB_PRODUCT_RAZER_ATROX 0x0a00 +#define USB_PRODUCT_RAZER_KITSUNE 0x1012 #define USB_PRODUCT_RAZER_PANTHERA 0x0401 #define USB_PRODUCT_RAZER_PANTHERA_EVO 0x1008 #define USB_PRODUCT_RAZER_RAIJU 0x1000 @@ -92,6 +107,8 @@ #define USB_PRODUCT_RAZER_WOLVERINE_V2_PRO_PS5_WIRELESS 0x100c #define USB_PRODUCT_RAZER_WOLVERINE_V2_PRO_XBOX_WIRED 0x1010 #define USB_PRODUCT_RAZER_WOLVERINE_V2_PRO_XBOX_WIRELESS 0x1011 +#define USB_PRODUCT_ROG_RAIKIRI 0x1a38 +#define USB_PRODUCT_SAITEK_CYBORG_V3 0xf622 #define USB_PRODUCT_SHANWAN_DS3 0x0523 #define USB_PRODUCT_SONY_DS3 0x0268 #define USB_PRODUCT_SONY_DS4 0x05c4 @@ -100,9 +117,11 @@ #define USB_PRODUCT_SONY_DS4_STRIKEPAD 0x05c5 #define USB_PRODUCT_SONY_DS5 0x0ce6 #define USB_PRODUCT_SONY_DS5_EDGE 0x0df2 +#define USB_PRODUCT_SWITCH_RETROBIT_CONTROLLER 0x0575 #define USB_PRODUCT_THRUSTMASTER_ESWAPX_PRO 0xd012 #define USB_PRODUCT_TURTLE_BEACH_SERIES_X_REACT_R 0x7013 #define USB_PRODUCT_TURTLE_BEACH_SERIES_X_RECON 0x7009 +#define USB_PRODUCT_VICTRIX_FS_PRO 0x0203 #define USB_PRODUCT_VICTRIX_FS_PRO_V2 0x0207 #define USB_PRODUCT_XBOX360_XUSB_CONTROLLER 0x02a1 /* XUSB driver software PID */ #define USB_PRODUCT_XBOX360_WIRED_CONTROLLER 0x028e @@ -126,7 +145,6 @@ #define USB_PRODUCT_XBOX_SERIES_X_POWERA_FUSION_PRO2 0x4001 #define USB_PRODUCT_XBOX_SERIES_X_POWERA_SPECTRA 0x4002 #define USB_PRODUCT_XBOX_ONE_XBOXGIP_CONTROLLER 0x02ff /* XBOXGIP driver software PID */ -#define USB_PRODUCT_XBOX_ONE_XINPUT_CONTROLLER 0x02fe /* Made up product ID for XInput */ #define USB_PRODUCT_STEAM_VIRTUAL_GAMEPAD 0x11ff /* USB usage pages */ diff --git a/thirdparty/SDL/src/joystick/virtual/SDL_virtualjoystick.c b/thirdparty/SDL/src/joystick/virtual/SDL_virtualjoystick.c index 71095e81d..e5e9b38c3 100644 --- a/thirdparty/SDL/src/joystick/virtual/SDL_virtualjoystick.c +++ b/thirdparty/SDL/src/joystick/virtual/SDL_virtualjoystick.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if defined(SDL_JOYSTICK_VIRTUAL) +#ifdef SDL_JOYSTICK_VIRTUAL /* This is the virtual implementation of the SDL joystick API */ @@ -53,7 +53,7 @@ static void VIRTUAL_FreeHWData(joystick_hwdata *hwdata) SDL_AssertJoysticksLocked(); - if (hwdata == NULL) { + if (!hwdata) { return; } @@ -102,7 +102,7 @@ int SDL_JoystickAttachVirtualInner(const SDL_VirtualJoystickDesc *desc) SDL_AssertJoysticksLocked(); - if (desc == NULL) { + if (!desc) { return SDL_InvalidParamError("desc"); } if (desc->version != SDL_VIRTUAL_JOYSTICK_DESC_VERSION) { @@ -111,7 +111,7 @@ int SDL_JoystickAttachVirtualInner(const SDL_VirtualJoystickDesc *desc) } hwdata = SDL_calloc(1, sizeof(joystick_hwdata)); - if (hwdata == NULL) { + if (!hwdata) { VIRTUAL_FreeHWData(hwdata); return SDL_OutOfMemory(); } @@ -191,7 +191,7 @@ int SDL_JoystickAttachVirtualInner(const SDL_VirtualJoystickDesc *desc) } } - hwdata->guid = SDL_CreateJoystickGUID(SDL_HARDWARE_BUS_VIRTUAL, hwdata->desc.vendor_id, hwdata->desc.product_id, 0, name, 'v', (Uint8)hwdata->desc.type); + hwdata->guid = SDL_CreateJoystickGUID(SDL_HARDWARE_BUS_VIRTUAL, hwdata->desc.vendor_id, hwdata->desc.product_id, 0, NULL, name, 'v', (Uint8)hwdata->desc.type); /* Allocate fields for different control-types */ if (hwdata->desc.naxes > 0) { @@ -248,7 +248,7 @@ int SDL_JoystickDetachVirtualInner(int device_index) { SDL_JoystickID instance_id; joystick_hwdata *hwdata = VIRTUAL_HWDataForIndex(device_index); - if (hwdata == NULL) { + if (!hwdata) { return SDL_SetError("Virtual joystick data not found"); } instance_id = hwdata->instance_id; @@ -263,7 +263,7 @@ int SDL_JoystickSetVirtualAxisInner(SDL_Joystick *joystick, int axis, Sint16 val SDL_LockJoysticks(); - if (joystick == NULL || !joystick->hwdata) { + if (!joystick || !joystick->hwdata) { SDL_UnlockJoysticks(); return SDL_SetError("Invalid joystick"); } @@ -286,7 +286,7 @@ int SDL_JoystickSetVirtualButtonInner(SDL_Joystick *joystick, int button, Uint8 SDL_LockJoysticks(); - if (joystick == NULL || !joystick->hwdata) { + if (!joystick || !joystick->hwdata) { SDL_UnlockJoysticks(); return SDL_SetError("Invalid joystick"); } @@ -309,7 +309,7 @@ int SDL_JoystickSetVirtualHatInner(SDL_Joystick *joystick, int hat, Uint8 value) SDL_LockJoysticks(); - if (joystick == NULL || !joystick->hwdata) { + if (!joystick || !joystick->hwdata) { SDL_UnlockJoysticks(); return SDL_SetError("Invalid joystick"); } @@ -351,7 +351,7 @@ static void VIRTUAL_JoystickDetect(void) static const char *VIRTUAL_JoystickGetDeviceName(int device_index) { joystick_hwdata *hwdata = VIRTUAL_HWDataForIndex(device_index); - if (hwdata == NULL) { + if (!hwdata) { return NULL; } return hwdata->name; @@ -362,6 +362,11 @@ static const char *VIRTUAL_JoystickGetDevicePath(int device_index) return NULL; } +static int VIRTUAL_JoystickGetDeviceSteamVirtualGamepadSlot(int device_index) +{ + return -1; +} + static int VIRTUAL_JoystickGetDevicePlayerIndex(int device_index) { return -1; @@ -379,7 +384,7 @@ static void VIRTUAL_JoystickSetDevicePlayerIndex(int device_index, int player_in static SDL_JoystickGUID VIRTUAL_JoystickGetDeviceGUID(int device_index) { joystick_hwdata *hwdata = VIRTUAL_HWDataForIndex(device_index); - if (hwdata == NULL) { + if (!hwdata) { SDL_JoystickGUID guid; SDL_zero(guid); return guid; @@ -390,7 +395,7 @@ static SDL_JoystickGUID VIRTUAL_JoystickGetDeviceGUID(int device_index) static SDL_JoystickID VIRTUAL_JoystickGetDeviceInstanceID(int device_index) { joystick_hwdata *hwdata = VIRTUAL_HWDataForIndex(device_index); - if (hwdata == NULL) { + if (!hwdata) { return -1; } return hwdata->instance_id; @@ -403,7 +408,7 @@ static int VIRTUAL_JoystickOpen(SDL_Joystick *joystick, int device_index) SDL_AssertJoysticksLocked(); hwdata = VIRTUAL_HWDataForIndex(device_index); - if (hwdata == NULL) { + if (!hwdata) { return SDL_SetError("No such device"); } joystick->instance_id = hwdata->instance_id; @@ -529,7 +534,7 @@ static void VIRTUAL_JoystickUpdate(SDL_Joystick *joystick) SDL_AssertJoysticksLocked(); - if (joystick == NULL) { + if (!joystick) { return; } if (!joystick->hwdata) { @@ -722,6 +727,7 @@ SDL_JoystickDriver SDL_VIRTUAL_JoystickDriver = { VIRTUAL_JoystickDetect, VIRTUAL_JoystickGetDeviceName, VIRTUAL_JoystickGetDevicePath, + VIRTUAL_JoystickGetDeviceSteamVirtualGamepadSlot, VIRTUAL_JoystickGetDevicePlayerIndex, VIRTUAL_JoystickSetDevicePlayerIndex, VIRTUAL_JoystickGetDeviceGUID, diff --git a/thirdparty/SDL/src/joystick/virtual/SDL_virtualjoystick_c.h b/thirdparty/SDL/src/joystick/virtual/SDL_virtualjoystick_c.h index 9fa0594d6..10c5cff45 100644 --- a/thirdparty/SDL/src/joystick/virtual/SDL_virtualjoystick_c.h +++ b/thirdparty/SDL/src/joystick/virtual/SDL_virtualjoystick_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -23,7 +23,7 @@ #ifndef SDL_VIRTUALJOYSTICK_C_H #define SDL_VIRTUALJOYSTICK_C_H -#if SDL_JOYSTICK_VIRTUAL +#ifdef SDL_JOYSTICK_VIRTUAL #include "SDL_joystick.h" diff --git a/thirdparty/SDL/src/joystick/vita/SDL_sysjoystick.c b/thirdparty/SDL/src/joystick/vita/SDL_sysjoystick.c index ce66c7cbc..7f12392f0 100644 --- a/thirdparty/SDL/src/joystick/vita/SDL_sysjoystick.c +++ b/thirdparty/SDL/src/joystick/vita/SDL_sysjoystick.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_JOYSTICK_VITA +#ifdef SDL_JOYSTICK_VITA /* This is the PSVita implementation of the SDL joystick API */ #include @@ -145,12 +145,12 @@ int VITA_JoystickInit(void) return SDL_numjoysticks; } -int VITA_JoystickGetCount() +int VITA_JoystickGetCount(void) { return SDL_numjoysticks; } -void VITA_JoystickDetect() +void VITA_JoystickDetect(void) { } @@ -187,6 +187,11 @@ const char *VITA_JoystickGetDevicePath(int index) return NULL; } +static int VITA_JoystickGetDeviceSteamVirtualGamepadSlot(int device_index) +{ + return -1; +} + static int VITA_JoystickGetDevicePlayerIndex(int device_index) { return -1; @@ -377,6 +382,7 @@ SDL_JoystickDriver SDL_VITA_JoystickDriver = { VITA_JoystickDetect, VITA_JoystickGetDeviceName, VITA_JoystickGetDevicePath, + VITA_JoystickGetDeviceSteamVirtualGamepadSlot, VITA_JoystickGetDevicePlayerIndex, VITA_JoystickSetDevicePlayerIndex, VITA_JoystickGetDeviceGUID, diff --git a/thirdparty/SDL/src/joystick/windows/SDL_dinputjoystick.c b/thirdparty/SDL/src/joystick/windows/SDL_dinputjoystick.c index 92996192f..fb46445e1 100644 --- a/thirdparty/SDL/src/joystick/windows/SDL_dinputjoystick.c +++ b/thirdparty/SDL/src/joystick/windows/SDL_dinputjoystick.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -22,7 +22,7 @@ #include "../SDL_sysjoystick.h" -#if SDL_JOYSTICK_DINPUT +#ifdef SDL_JOYSTICK_DINPUT #include "SDL_hints.h" #include "SDL_timer.h" @@ -273,7 +273,7 @@ static SDL_bool QueryDeviceName(LPDIRECTINPUTDEVICE8 device, char **device_name) { DIPROPSTRING dipstr; - if (!device || device_name == NULL) { + if (!device || !device_name) { return SDL_FALSE; } @@ -295,7 +295,7 @@ static SDL_bool QueryDevicePath(LPDIRECTINPUTDEVICE8 device, char **device_path) { DIPROPGUIDANDPATH dippath; - if (!device || device_path == NULL) { + if (!device || !device_path) { return SDL_FALSE; } @@ -320,7 +320,7 @@ static SDL_bool QueryDeviceInfo(LPDIRECTINPUTDEVICE8 device, Uint16 *vendor_id, { DIPROPDWORD dipdw; - if (!device || vendor_id == NULL || product_id == NULL) { + if (!device || !vendor_id || !product_id) { return SDL_FALSE; } @@ -342,7 +342,7 @@ static SDL_bool QueryDeviceInfo(LPDIRECTINPUTDEVICE8 device, Uint16 *vendor_id, void FreeRumbleEffectData(DIEFFECT *effect) { - if (effect == NULL) { + if (!effect) { return; } SDL_free(effect->rgdwAxes); @@ -358,7 +358,7 @@ DIEFFECT *CreateRumbleEffectData(Sint16 magnitude) /* Create the effect */ effect = (DIEFFECT *)SDL_calloc(1, sizeof(*effect)); - if (effect == NULL) { + if (!effect) { return NULL; } effect->dwSize = sizeof(*effect); @@ -382,7 +382,7 @@ DIEFFECT *CreateRumbleEffectData(Sint16 magnitude) effect->dwFlags |= DIEFF_CARTESIAN; periodic = (DIPERIODIC *)SDL_calloc(1, sizeof(*periodic)); - if (periodic == NULL) { + if (!periodic) { FreeRumbleEffectData(effect); return NULL; } @@ -422,7 +422,7 @@ int SDL_DINPUT_JoystickInit(void) /* Because we used CoCreateInstance, we need to Initialize it, first. */ instance = GetModuleHandle(NULL); - if (instance == NULL) { + if (!instance) { IDirectInput8_Release(dinput); dinput = NULL; return SDL_SetError("GetModuleHandle() failed with error code %lu.", GetLastError()); @@ -437,6 +437,17 @@ int SDL_DINPUT_JoystickInit(void) return 0; } +static int GetSteamVirtualGamepadSlot(Uint16 vendor_id, Uint16 product_id, const char *device_path) +{ + int slot = -1; + + if (vendor_id == USB_VENDOR_VALVE && + product_id == USB_PRODUCT_STEAM_VIRTUAL_GAMEPAD) { + (void)SDL_sscanf(device_path, "\\\\?\\HID#VID_28DE&PID_11FF&IG_0%d", &slot); + } + return slot; +} + /* helper function for direct input, gets called for each connected joystick */ static BOOL CALLBACK EnumJoystickDetectCallback(LPCDIDEVICEINSTANCE pDeviceInstance, LPVOID pContext) { @@ -453,7 +464,6 @@ static BOOL CALLBACK EnumJoystickDetectCallback(LPCDIDEVICEINSTANCE pDeviceInsta char *hidPath = NULL; char *name = NULL; LPDIRECTINPUTDEVICE8 device = NULL; - DIDEVCAPS caps; /* We are only supporting HID devices. */ CHECK(pDeviceInstance->dwDevType & DIDEVTYPE_HID); @@ -463,13 +473,6 @@ static BOOL CALLBACK EnumJoystickDetectCallback(LPCDIDEVICEINSTANCE pDeviceInsta CHECK(QueryDevicePath(device, &hidPath)); CHECK(QueryDeviceInfo(device, &vendor, &product)); - /* Check to make sure the device has buttons and axes. - * This fixes incorrectly detecting the ROG CHAKRAM X mouse as a game controller on Windows 10 - */ - caps.dwSize = sizeof(caps); - CHECK(SUCCEEDED(IDirectInputDevice8_GetCapabilities(device, &caps))); - CHECK(caps.dwAxes > 0 && caps.dwButtons > 0); - CHECK(!SDL_IsXInputDevice(vendor, product, hidPath)); pNewJoystick = *(JoyStick_DeviceData **)pContext; @@ -497,10 +500,10 @@ static BOOL CALLBACK EnumJoystickDetectCallback(LPCDIDEVICEINSTANCE pDeviceInsta pNewJoystick = pNewJoystick->pNext; } - pNewJoystick = (JoyStick_DeviceData *)SDL_malloc(sizeof(JoyStick_DeviceData)); + pNewJoystick = (JoyStick_DeviceData *)SDL_calloc(1, sizeof(JoyStick_DeviceData)); CHECK(pNewJoystick); - SDL_zerop(pNewJoystick); + pNewJoystick->steam_virtual_gamepad_slot = GetSteamVirtualGamepadSlot(vendor, product, hidPath); SDL_strlcpy(pNewJoystick->path, hidPath, SDL_arraysize(pNewJoystick->path)); SDL_memcpy(&pNewJoystick->dxdevice, pDeviceInstance, sizeof(DIDEVICEINSTANCE)); @@ -508,9 +511,9 @@ static BOOL CALLBACK EnumJoystickDetectCallback(LPCDIDEVICEINSTANCE pDeviceInsta CHECK(pNewJoystick->joystickname); if (vendor && product) { - pNewJoystick->guid = SDL_CreateJoystickGUID(SDL_HARDWARE_BUS_USB, vendor, product, version, pNewJoystick->joystickname, 0, 0); + pNewJoystick->guid = SDL_CreateJoystickGUID(SDL_HARDWARE_BUS_USB, vendor, product, version, NULL, name, 0, 0); } else { - pNewJoystick->guid = SDL_CreateJoystickGUID(SDL_HARDWARE_BUS_BLUETOOTH, vendor, product, version, pNewJoystick->joystickname, 0, 0); + pNewJoystick->guid = SDL_CreateJoystickGUID(SDL_HARDWARE_BUS_BLUETOOTH, vendor, product, version, NULL, name, 0, 0); } CHECK(!SDL_ShouldIgnoreJoystick(pNewJoystick->joystickname, pNewJoystick->guid)); @@ -545,7 +548,7 @@ static BOOL CALLBACK EnumJoystickDetectCallback(LPCDIDEVICEINSTANCE pDeviceInsta void SDL_DINPUT_JoystickDetect(JoyStick_DeviceData **pContext) { - if (dinput == NULL) { + if (!dinput) { return; } @@ -597,7 +600,7 @@ SDL_bool SDL_DINPUT_JoystickPresent(Uint16 vendor_id, Uint16 product_id, Uint16 { Joystick_PresentData data; - if (dinput == NULL) { + if (!dinput) { return SDL_FALSE; } @@ -852,6 +855,7 @@ int SDL_DINPUT_JoystickOpen(SDL_Joystick *joystick, JoyStick_DeviceData *joystic } else if (FAILED(result)) { return SetDIerror("IDirectInputDevice8::SetProperty", result); } + joystick->hwdata->first_update = SDL_TRUE; /* Poll and wait for initial device state to be populated */ result = IDirectInputDevice8_Poll(joystick->hwdata->InputDevice); @@ -1127,7 +1131,14 @@ void SDL_DINPUT_JoystickUpdate(SDL_Joystick *joystick) IDirectInputDevice8_Poll(joystick->hwdata->InputDevice); } - if (joystick->hwdata->buffered) { + if (joystick->hwdata->first_update) { + /* Poll to get the initial state of the joystick */ + UpdateDINPUTJoystickState_Polled(joystick); + joystick->hwdata->first_update = SDL_FALSE; + return; + } + + if (joystick->hwdata->buffered ) { UpdateDINPUTJoystickState_Buffered(joystick); } else { UpdateDINPUTJoystickState_Polled(joystick); diff --git a/thirdparty/SDL/src/joystick/windows/SDL_dinputjoystick_c.h b/thirdparty/SDL/src/joystick/windows/SDL_dinputjoystick_c.h index 59ead46be..8e6d233df 100644 --- a/thirdparty/SDL/src/joystick/windows/SDL_dinputjoystick_c.h +++ b/thirdparty/SDL/src/joystick/windows/SDL_dinputjoystick_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/joystick/windows/SDL_rawinputjoystick.c b/thirdparty/SDL/src/joystick/windows/SDL_rawinputjoystick.c index 167a1c536..68627326f 100644 --- a/thirdparty/SDL/src/joystick/windows/SDL_rawinputjoystick.c +++ b/thirdparty/SDL/src/joystick/windows/SDL_rawinputjoystick.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 2023 Sam Lantinga + Copyright (C) 2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -31,7 +31,7 @@ */ #include "../../SDL_internal.h" -#if SDL_JOYSTICK_RAWINPUT +#ifdef SDL_JOYSTICK_RAWINPUT #include "SDL_atomic.h" #include "SDL_endian.h" @@ -119,6 +119,7 @@ typedef struct _SDL_RAWINPUT_Device SDL_JoystickGUID guid; SDL_bool is_xinput; SDL_bool is_xboxone; + int steam_virtual_gamepad_slot; PHIDP_PREPARSED_DATA preparsed_data; HANDLE hDevice; @@ -321,7 +322,7 @@ static void RAWINPUT_FillMatchState(WindowsMatchState *state, Uint64 match_state static struct { - XINPUT_STATE_EX state; + XINPUT_STATE state; XINPUT_BATTERY_INFORMATION_EX battery; SDL_bool connected; /* Currently has an active XInput device */ SDL_bool used; /* Is currently mapped to an SDL device */ @@ -330,7 +331,7 @@ static struct static SDL_bool xinput_device_change = SDL_TRUE; static SDL_bool xinput_state_dirty = SDL_TRUE; -static void RAWINPUT_UpdateXInput() +static void RAWINPUT_UpdateXInput(void) { DWORD user_index; if (xinput_device_change) { @@ -370,7 +371,7 @@ static void RAWINPUT_MarkXInputSlotFree(Uint8 xinput_slot) xinput_state[xinput_slot].used = SDL_FALSE; } } -static SDL_bool RAWINPUT_MissingXInputSlot() +static SDL_bool RAWINPUT_MissingXInputSlot(void) { int ii; for (ii = 0; ii < SDL_arraysize(xinput_state); ii++) { @@ -477,7 +478,7 @@ static const IID IID_IEventHandler_Gamepad = { 0x8a7639ee, 0x624a, 0x501a, { 0xb static HRESULT STDMETHODCALLTYPE IEventHandler_CGamepadVtbl_QueryInterface(__FIEventHandler_1_Windows__CGaming__CInput__CGamepad *This, REFIID riid, void **ppvObject) { - if (ppvObject == NULL) { + if (!ppvObject) { return E_INVALIDARG; } @@ -555,7 +556,7 @@ static void RAWINPUT_MarkWindowsGamingInputSlotFree(WindowsGamingInputGamepadSta wgi_slot->correlated_context = NULL; } -static SDL_bool RAWINPUT_MissingWindowsGamingInputSlot() +static SDL_bool RAWINPUT_MissingWindowsGamingInputSlot(void) { int ii; for (ii = 0; ii < wgi_state.per_gamepad_count; ii++) { @@ -566,7 +567,7 @@ static SDL_bool RAWINPUT_MissingWindowsGamingInputSlot() return SDL_FALSE; } -static void RAWINPUT_UpdateWindowsGamingInput() +static void RAWINPUT_UpdateWindowsGamingInput(void) { int ii; if (!wgi_state.gamepad_statics) { @@ -619,7 +620,7 @@ static void RAWINPUT_UpdateWindowsGamingInput() return; } gamepad_state = SDL_calloc(1, sizeof(*gamepad_state)); - if (gamepad_state == NULL) { + if (!gamepad_state) { SDL_OutOfMemory(); return; } @@ -836,6 +837,19 @@ static SDL_RAWINPUT_Device *RAWINPUT_DeviceFromHandle(HANDLE hDevice) return NULL; } +static int GetSteamVirtualGamepadSlot(Uint16 vendor_id, Uint16 product_id, const char *device_path) +{ + int slot = -1; + + // The format for the raw input device path is documented here: + // https://partner.steamgames.com/doc/features/steam_controller/steam_input_gamepad_emulation_bestpractices + if (vendor_id == USB_VENDOR_VALVE && + product_id == USB_PRODUCT_STEAM_VIRTUAL_GAMEPAD) { + (void)SDL_sscanf(device_path, "\\\\.\\pipe\\HID#VID_045E&PID_028E&IG_00#%*X&%*X&%*X#%d#%*u", &slot); + } + return slot; +} + static void RAWINPUT_AddDevice(HANDLE hDevice) { #define CHECK(expression) \ @@ -877,6 +891,7 @@ static void RAWINPUT_AddDevice(HANDLE hDevice) device->version = (Uint16)rdi.hid.dwVersionNumber; device->is_xinput = SDL_TRUE; device->is_xboxone = SDL_IsJoystickXboxOne(device->vendor_id, device->product_id); + device->steam_virtual_gamepad_slot = GetSteamVirtualGamepadSlot(device->vendor_id, device->product_id, dev_name); /* Get HID Top-Level Collection Preparsed Data */ size = 0; @@ -901,6 +916,7 @@ static void RAWINPUT_AddDevice(HANDLE hDevice) } device->name = SDL_CreateJoystickName(device->vendor_id, device->product_id, manufacturer_string, product_string); + device->guid = SDL_CreateJoystickGUID(SDL_HARDWARE_BUS_USB, device->vendor_id, device->product_id, device->version, manufacturer_string, product_string, 'r', 0); if (manufacturer_string) { SDL_free(manufacturer_string); @@ -910,8 +926,6 @@ static void RAWINPUT_AddDevice(HANDLE hDevice) } } - device->guid = SDL_CreateJoystickGUID(SDL_HARDWARE_BUS_USB, device->vendor_id, device->product_id, device->version, device->name, 'r', 0); - device->path = SDL_strdup(dev_name); CloseHandle(hFile); @@ -988,7 +1002,8 @@ static void RAWINPUT_DetectDevices(void) devices = (PRAWINPUTDEVICELIST)SDL_malloc(sizeof(RAWINPUTDEVICELIST) * device_count); if (devices) { - if (GetRawInputDeviceList(devices, &device_count, sizeof(RAWINPUTDEVICELIST)) != -1) { + device_count = GetRawInputDeviceList(devices, &device_count, sizeof(RAWINPUTDEVICELIST)); + if (device_count != (UINT)-1) { for (i = 0; i < device_count; ++i) { RAWINPUT_AddDevice(devices[i].hDevice); } @@ -1035,7 +1050,7 @@ static int RAWINPUT_JoystickGetCount(void) return SDL_RAWINPUT_numjoysticks; } -SDL_bool RAWINPUT_IsEnabled() +SDL_bool RAWINPUT_IsEnabled(void) { return SDL_RAWINPUT_inited && !SDL_RAWINPUT_remote_desktop; } @@ -1182,6 +1197,11 @@ static const char *RAWINPUT_JoystickGetDevicePath(int device_index) return RAWINPUT_GetDeviceByIndex(device_index)->path; } +static int RAWINPUT_JoystickGetDeviceSteamVirtualGamepadSlot(int device_index) +{ + return RAWINPUT_GetDeviceByIndex(device_index)->steam_virtual_gamepad_slot; +} + static int RAWINPUT_JoystickGetDevicePlayerIndex(int device_index) { return -1; @@ -1220,7 +1240,7 @@ static int RAWINPUT_JoystickOpen(SDL_Joystick *joystick, int device_index) ULONG i; ctx = (RAWINPUT_DeviceContext *)SDL_calloc(1, sizeof(RAWINPUT_DeviceContext)); - if (ctx == NULL) { + if (!ctx) { return SDL_OutOfMemory(); } joystick->hwdata = ctx; @@ -1233,7 +1253,7 @@ static int RAWINPUT_JoystickOpen(SDL_Joystick *joystick, int device_index) #ifdef SDL_JOYSTICK_RAWINPUT_XINPUT xinput_device_change = SDL_TRUE; ctx->xinput_enabled = SDL_GetHintBoolean(SDL_HINT_JOYSTICK_RAWINPUT_CORRELATE_XINPUT, SDL_TRUE); - if (ctx->xinput_enabled && (WIN_LoadXInputDLL() < 0 || XINPUTGETSTATE == NULL)) { + if (ctx->xinput_enabled && (WIN_LoadXInputDLL() < 0 || !XINPUTGETSTATE)) { ctx->xinput_enabled = SDL_FALSE; } ctx->xinput_slot = XUSER_INDEX_ANY; @@ -1270,6 +1290,7 @@ static int RAWINPUT_JoystickOpen(SDL_Joystick *joystick, int device_index) value_caps = SDL_stack_alloc(HIDP_VALUE_CAPS, caps.NumberInputValueCaps); if (SDL_HidP_GetValueCaps(HidP_Input, value_caps, &caps.NumberInputValueCaps, ctx->preparsed_data) != HIDP_STATUS_SUCCESS) { RAWINPUT_JoystickClose(joystick); + SDL_stack_free(button_caps); return SDL_SetError("Couldn't get device value capabilities"); } @@ -1298,6 +1319,8 @@ static int RAWINPUT_JoystickOpen(SDL_Joystick *joystick, int device_index) ctx->button_indices = (USHORT *)SDL_malloc(joystick->nbuttons * sizeof(*ctx->button_indices)); if (!ctx->button_indices) { RAWINPUT_JoystickClose(joystick); + SDL_stack_free(value_caps); + SDL_stack_free(button_caps); return SDL_OutOfMemory(); } @@ -1322,6 +1345,8 @@ static int RAWINPUT_JoystickOpen(SDL_Joystick *joystick, int device_index) joystick->nbuttons += 1; } + SDL_stack_free(button_caps); + for (i = 0; i < caps.NumberInputValueCaps; ++i) { HIDP_VALUE_CAPS *cap = &value_caps[i]; @@ -1351,6 +1376,7 @@ static int RAWINPUT_JoystickOpen(SDL_Joystick *joystick, int device_index) ctx->axis_indices = (USHORT *)SDL_malloc(joystick->naxes * sizeof(*ctx->axis_indices)); if (!ctx->axis_indices) { RAWINPUT_JoystickClose(joystick); + SDL_stack_free(value_caps); return SDL_OutOfMemory(); } @@ -1384,6 +1410,7 @@ static int RAWINPUT_JoystickOpen(SDL_Joystick *joystick, int device_index) ctx->hat_indices = (USHORT *)SDL_malloc(joystick->nhats * sizeof(*ctx->hat_indices)); if (!ctx->hat_indices) { RAWINPUT_JoystickClose(joystick); + SDL_stack_free(value_caps); return SDL_OutOfMemory(); } @@ -1402,6 +1429,8 @@ static int RAWINPUT_JoystickOpen(SDL_Joystick *joystick, int device_index) } } + SDL_stack_free(value_caps); + joystick->epowerlevel = SDL_JOYSTICK_POWER_UNKNOWN; return 0; @@ -1419,7 +1448,7 @@ static int RAWINPUT_JoystickRumble(SDL_Joystick *joystick, Uint16 low_frequency_ if (!rumbled && ctx->xinput_correlated) { XINPUT_VIBRATION XVibration; - if (XINPUTSETSTATE == NULL) { + if (!XINPUTSETSTATE) { return SDL_Unsupported(); } @@ -2067,7 +2096,7 @@ int RAWINPUT_RegisterNotifications(HWND hWnd) return 0; } -int RAWINPUT_UnregisterNotifications() +int RAWINPUT_UnregisterNotifications(void) { int i; RAWINPUTDEVICE rid[SDL_arraysize(subscribed_devices)]; @@ -2174,6 +2203,7 @@ SDL_JoystickDriver SDL_RAWINPUT_JoystickDriver = { RAWINPUT_JoystickDetect, RAWINPUT_JoystickGetDeviceName, RAWINPUT_JoystickGetDevicePath, + RAWINPUT_JoystickGetDeviceSteamVirtualGamepadSlot, RAWINPUT_JoystickGetDevicePlayerIndex, RAWINPUT_JoystickSetDevicePlayerIndex, RAWINPUT_JoystickGetDeviceGUID, diff --git a/thirdparty/SDL/src/joystick/windows/SDL_rawinputjoystick_c.h b/thirdparty/SDL/src/joystick/windows/SDL_rawinputjoystick_c.h index be08c33ae..598a22d72 100644 --- a/thirdparty/SDL/src/joystick/windows/SDL_rawinputjoystick_c.h +++ b/thirdparty/SDL/src/joystick/windows/SDL_rawinputjoystick_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/joystick/windows/SDL_windows_gaming_input.c b/thirdparty/SDL/src/joystick/windows/SDL_windows_gaming_input.c index 6f01b4e1b..86c708ac9 100644 --- a/thirdparty/SDL/src/joystick/windows/SDL_windows_gaming_input.c +++ b/thirdparty/SDL/src/joystick/windows/SDL_windows_gaming_input.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -64,6 +64,7 @@ typedef struct WindowsGamingInputControllerState int naxes; int nhats; int nbuttons; + int steam_virtual_gamepad_slot; } WindowsGamingInputControllerState; static struct @@ -131,12 +132,13 @@ static SDL_bool SDL_IsXInputDevice(Uint16 vendor, Uint16 product) } raw_devices = (PRAWINPUTDEVICELIST)SDL_malloc(sizeof(RAWINPUTDEVICELIST) * raw_device_count); - if (raw_devices == NULL) { + if (!raw_devices) { SDL_OutOfMemory(); return SDL_FALSE; } - if (GetRawInputDeviceList(raw_devices, &raw_device_count, sizeof(RAWINPUTDEVICELIST)) == -1) { + raw_device_count = GetRawInputDeviceList(raw_devices, &raw_device_count, sizeof(RAWINPUTDEVICELIST)); + if (raw_device_count == (UINT)-1) { SDL_free(raw_devices); raw_devices = NULL; return SDL_FALSE; /* oh well. */ @@ -214,7 +216,7 @@ static SDL_bool SDL_IsXInputDevice(Uint16 vendor, Uint16 product) return SDL_FALSE; } -static void WGI_LoadRawGameControllerStatics() +static void WGI_LoadRawGameControllerStatics(void) { WindowsCreateStringReference_t WindowsCreateStringReferenceFunc = NULL; RoGetActivationFactory_t RoGetActivationFactoryFunc = NULL; @@ -245,7 +247,7 @@ static void WGI_LoadRawGameControllerStatics() } } -static void WGI_LoadOtherControllerStatics() +static void WGI_LoadOtherControllerStatics(void) { WindowsCreateStringReference_t WindowsCreateStringReferenceFunc = NULL; RoGetActivationFactory_t RoGetActivationFactoryFunc = NULL; @@ -352,7 +354,7 @@ typedef struct RawGameControllerDelegate static HRESULT STDMETHODCALLTYPE IEventHandler_CRawGameControllerVtbl_QueryInterface(__FIEventHandler_1_Windows__CGaming__CInput__CRawGameController *This, REFIID riid, void **ppvObject) { - if (ppvObject == NULL) { + if (!ppvObject) { return E_INVALIDARG; } @@ -384,6 +386,50 @@ static ULONG STDMETHODCALLTYPE IEventHandler_CRawGameControllerVtbl_Release(__FI return rc; } +static int GetSteamVirtualGamepadSlot(__x_ABI_CWindows_CGaming_CInput_CIRawGameController *controller, Uint16 vendor_id, Uint16 product_id) +{ + int slot = -1; + + if (vendor_id == USB_VENDOR_VALVE && + product_id == USB_PRODUCT_STEAM_VIRTUAL_GAMEPAD) { + __x_ABI_CWindows_CGaming_CInput_CIRawGameController2 *controller2 = NULL; + HRESULT hr = __x_ABI_CWindows_CGaming_CInput_CIRawGameController_QueryInterface(controller, &IID_IRawGameController2, (void **)&controller2); + if (SUCCEEDED(hr)) { + HSTRING hString; + hr = __x_ABI_CWindows_CGaming_CInput_CIRawGameController2_get_NonRoamableId(controller2, &hString); + if (SUCCEEDED(hr)) { + typedef PCWSTR(WINAPI * WindowsGetStringRawBuffer_t)(HSTRING string, UINT32 * length); + typedef HRESULT(WINAPI * WindowsDeleteString_t)(HSTRING string); + + WindowsGetStringRawBuffer_t WindowsGetStringRawBufferFunc = NULL; + WindowsDeleteString_t WindowsDeleteStringFunc = NULL; +#ifdef __WINRT__ + WindowsGetStringRawBufferFunc = WindowsGetStringRawBuffer; + WindowsDeleteStringFunc = WindowsDeleteString; +#else + { + WindowsGetStringRawBufferFunc = (WindowsGetStringRawBuffer_t)WIN_LoadComBaseFunction("WindowsGetStringRawBuffer"); + WindowsDeleteStringFunc = (WindowsDeleteString_t)WIN_LoadComBaseFunction("WindowsDeleteString"); + } +#endif /* __WINRT__ */ + if (WindowsGetStringRawBufferFunc && WindowsDeleteStringFunc) { + PCWSTR string = WindowsGetStringRawBufferFunc(hString, NULL); + if (string) { + char *id = WIN_StringToUTF8W(string); + if (id) { + (void)SDL_sscanf(id, "{wgi/nrid/:steam-%*X&%*X&%*X#%d#%*u}", &slot); + SDL_free(id); + } + } + WindowsDeleteStringFunc(hString); + } + } + __x_ABI_CWindows_CGaming_CInput_CIRawGameController2_Release(controller2); + } + } + return slot; +} + static HRESULT STDMETHODCALLTYPE IEventHandler_CRawGameControllerVtbl_InvokeAdded(__FIEventHandler_1_Windows__CGaming__CInput__CRawGameController *This, IInspectable *sender, __x_ABI_CWindows_CGaming_CInput_CIRawGameController *e) { HRESULT hr; @@ -442,7 +488,7 @@ static HRESULT STDMETHODCALLTYPE IEventHandler_CRawGameControllerVtbl_InvokeAdde } __x_ABI_CWindows_CGaming_CInput_CIRawGameController2_Release(controller2); } - if (name == NULL) { + if (!name) { name = SDL_strdup(""); } @@ -481,7 +527,7 @@ static HRESULT STDMETHODCALLTYPE IEventHandler_CRawGameControllerVtbl_InvokeAdde __x_ABI_CWindows_CGaming_CInput_CIGameController_Release(gamecontroller); } - guid = SDL_CreateJoystickGUID(bus, vendor, product, version, name, 'w', (Uint8)type); + guid = SDL_CreateJoystickGUID(bus, vendor, product, version, NULL, name, 'w', (Uint8)type); if (SDL_ShouldIgnoreJoystick(name, guid)) { ignore_joystick = SDL_TRUE; @@ -501,6 +547,7 @@ static HRESULT STDMETHODCALLTYPE IEventHandler_CRawGameControllerVtbl_InvokeAdde state->name = name; state->guid = guid; state->type = type; + state->steam_virtual_gamepad_slot = GetSteamVirtualGamepadSlot(controller, vendor, product); __x_ABI_CWindows_CGaming_CInput_CIRawGameController_get_ButtonCount(controller, &state->nbuttons); __x_ABI_CWindows_CGaming_CInput_CIRawGameController_get_AxisCount(controller, &state->naxes); @@ -687,6 +734,11 @@ static const char *WGI_JoystickGetDevicePath(int device_index) return NULL; } +static int WGI_JoystickGetDeviceSteamVirtualGamepadSlot(int device_index) +{ + return wgi.controllers[device_index].steam_virtual_gamepad_slot; +} + static int WGI_JoystickGetDevicePlayerIndex(int device_index) { return -1; @@ -713,7 +765,7 @@ static int WGI_JoystickOpen(SDL_Joystick *joystick, int device_index) boolean wireless = SDL_FALSE; hwdata = (struct joystick_hwdata *)SDL_calloc(1, sizeof(*hwdata)); - if (hwdata == NULL) { + if (!hwdata) { return SDL_OutOfMemory(); } joystick->hwdata = hwdata; @@ -1003,6 +1055,7 @@ SDL_JoystickDriver SDL_WGI_JoystickDriver = { WGI_JoystickDetect, WGI_JoystickGetDeviceName, WGI_JoystickGetDevicePath, + WGI_JoystickGetDeviceSteamVirtualGamepadSlot, WGI_JoystickGetDevicePlayerIndex, WGI_JoystickSetDevicePlayerIndex, WGI_JoystickGetDeviceGUID, diff --git a/thirdparty/SDL/src/joystick/windows/SDL_windowsjoystick.c b/thirdparty/SDL/src/joystick/windows/SDL_windowsjoystick.c index d94b314cd..49e4c5975 100644 --- a/thirdparty/SDL/src/joystick/windows/SDL_windowsjoystick.c +++ b/thirdparty/SDL/src/joystick/windows/SDL_windowsjoystick.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_JOYSTICK_DINPUT || SDL_JOYSTICK_XINPUT +#if defined(SDL_JOYSTICK_DINPUT) || defined(SDL_JOYSTICK_XINPUT) /* DirectInput joystick driver; written by Glenn Maynard, based on Andrei de * A. Formiga's WINMM driver. @@ -182,7 +182,7 @@ static DWORD CALLBACK SDL_DeviceNotificationFunc(HCMNOTIFICATION hNotify, PVOID static void SDL_CleanupDeviceNotificationFunc(void) { if (cfgmgr32_lib_handle) { - if (s_DeviceNotificationFuncHandle != NULL && CM_Unregister_Notification != NULL) { + if (s_DeviceNotificationFuncHandle != NULL && CM_Unregister_Notification) { CM_Unregister_Notification(s_DeviceNotificationFuncHandle); s_DeviceNotificationFuncHandle = NULL; } @@ -252,7 +252,7 @@ static LRESULT CALLBACK SDL_PrivateJoystickDetectProc(HWND hwnd, UINT msg, WPARA break; } -#if SDL_JOYSTICK_RAWINPUT +#ifdef SDL_JOYSTICK_RAWINPUT return CallWindowProc(RAWINPUT_WindowProc, hwnd, msg, wParam, lParam); #else return CallWindowProc(DefWindowProc, hwnd, msg, wParam, lParam); @@ -261,7 +261,7 @@ static LRESULT CALLBACK SDL_PrivateJoystickDetectProc(HWND hwnd, UINT msg, WPARA static void SDL_CleanupDeviceNotification(SDL_DeviceNotificationData *data) { -#if SDL_JOYSTICK_RAWINPUT +#ifdef SDL_JOYSTICK_RAWINPUT RAWINPUT_UnregisterNotifications(); #endif @@ -300,7 +300,7 @@ static int SDL_CreateDeviceNotification(SDL_DeviceNotificationData *data) } data->messageWindow = CreateWindowEx(0, TEXT("Message"), NULL, 0, 0, 0, 0, 0, HWND_MESSAGE, NULL, NULL, NULL); - if (data->messageWindow == NULL) { + if (!data->messageWindow) { WIN_SetError("Failed to create message window for joystick autodetect"); SDL_CleanupDeviceNotification(data); return -1; @@ -318,7 +318,7 @@ static int SDL_CreateDeviceNotification(SDL_DeviceNotificationData *data) return -1; } -#if SDL_JOYSTICK_RAWINPUT +#ifdef SDL_JOYSTICK_RAWINPUT RAWINPUT_RegisterNotifications(data->messageWindow); #endif return 0; @@ -356,7 +356,7 @@ static SDL_DeviceNotificationData s_notification_data; /* Function/thread to scan the system for joysticks. */ static int SDLCALL SDL_JoystickThread(void *_data) { -#if SDL_JOYSTICK_XINPUT +#ifdef SDL_JOYSTICK_XINPUT SDL_bool bOpenedXInputDevices[XUSER_MAX_COUNT]; SDL_zeroa(bOpenedXInputDevices); #endif @@ -374,7 +374,7 @@ static int SDLCALL SDL_JoystickThread(void *_data) #else { #endif -#if SDL_JOYSTICK_XINPUT +#ifdef SDL_JOYSTICK_XINPUT /* WM_DEVICECHANGE not working, poll for new XINPUT controllers */ SDL_CondWaitTimeout(s_condJoystickThread, s_mutexJoyStickEnum, 1000); if (SDL_XINPUT_Enabled() && XINPUTGETCAPABILITIES) { @@ -410,18 +410,18 @@ static int SDLCALL SDL_JoystickThread(void *_data) static int SDL_StartJoystickThread(void) { s_mutexJoyStickEnum = SDL_CreateMutex(); - if (s_mutexJoyStickEnum == NULL) { + if (!s_mutexJoyStickEnum) { return -1; } s_condJoystickThread = SDL_CreateCond(); - if (s_condJoystickThread == NULL) { + if (!s_condJoystickThread) { return -1; } s_bJoystickThreadQuit = SDL_FALSE; s_joystickThread = SDL_CreateThreadInternal(SDL_JoystickThread, "SDL_joystick", 64 * 1024, NULL); - if (s_joystickThread == NULL) { + if (!s_joystickThread) { return -1; } return 0; @@ -429,7 +429,7 @@ static int SDL_StartJoystickThread(void) static void SDL_StopJoystickThread(void) { - if (s_joystickThread == NULL) { + if (!s_joystickThread) { return; } @@ -558,11 +558,11 @@ void WINDOWS_JoystickDetect(void) JoyStick_DeviceData *pListNext = NULL; if (pCurList->bXInputDevice) { -#if SDL_HAPTIC_XINPUT +#ifdef SDL_HAPTIC_XINPUT SDL_XINPUT_HapticMaybeRemoveDevice(pCurList->XInputUserId); #endif } else { -#if SDL_HAPTIC_DINPUT +#ifdef SDL_HAPTIC_DINPUT SDL_DINPUT_HapticMaybeRemoveDevice(&pCurList->dxdevice); #endif } @@ -578,11 +578,11 @@ void WINDOWS_JoystickDetect(void) for (pCurList = SYS_Joystick; pCurList; pCurList = pCurList->pNext) { if (pCurList->send_add_event) { if (pCurList->bXInputDevice) { -#if SDL_HAPTIC_XINPUT +#ifdef SDL_HAPTIC_XINPUT SDL_XINPUT_HapticMaybeAddDevice(pCurList->XInputUserId); #endif } else { -#if SDL_HAPTIC_DINPUT +#ifdef SDL_HAPTIC_DINPUT SDL_DINPUT_HapticMaybeAddDevice(&pCurList->dxdevice); #endif } @@ -618,6 +618,23 @@ static const char *WINDOWS_JoystickGetDevicePath(int device_index) return device->path; } +static int WINDOWS_JoystickGetDeviceSteamVirtualGamepadSlot(int device_index) +{ + JoyStick_DeviceData *device = SYS_Joystick; + int index; + + for (index = device_index; index > 0; index--) { + device = device->pNext; + } + + if (device->bXInputDevice) { + /* The slot for XInput devices can change as controllers are seated */ + return SDL_XINPUT_GetSteamVirtualGamepadSlot(device->XInputUserId); + } else { + return device->steam_virtual_gamepad_slot; + } +} + static int WINDOWS_JoystickGetDevicePlayerIndex(int device_index) { JoyStick_DeviceData *device = SYS_Joystick; @@ -676,12 +693,10 @@ static int WINDOWS_JoystickOpen(SDL_Joystick *joystick, int device_index) /* allocate memory for system specific hardware data */ joystick->instance_id = device->nInstanceID; - joystick->hwdata = - (struct joystick_hwdata *)SDL_malloc(sizeof(struct joystick_hwdata)); - if (joystick->hwdata == NULL) { + joystick->hwdata = (struct joystick_hwdata *)SDL_calloc(1, sizeof(struct joystick_hwdata)); + if (!joystick->hwdata) { return SDL_OutOfMemory(); } - SDL_zerop(joystick->hwdata); joystick->hwdata->guid = device->guid; if (device->bXInputDevice) { @@ -800,6 +815,7 @@ SDL_JoystickDriver SDL_WINDOWS_JoystickDriver = { WINDOWS_JoystickDetect, WINDOWS_JoystickGetDeviceName, WINDOWS_JoystickGetDevicePath, + WINDOWS_JoystickGetDeviceSteamVirtualGamepadSlot, WINDOWS_JoystickGetDevicePlayerIndex, WINDOWS_JoystickSetDevicePlayerIndex, WINDOWS_JoystickGetDeviceGUID, @@ -824,9 +840,9 @@ SDL_JoystickDriver SDL_WINDOWS_JoystickDriver = { #else -#if SDL_JOYSTICK_RAWINPUT +#ifdef SDL_JOYSTICK_RAWINPUT /* The RAWINPUT driver needs the device notification setup above */ -#error SDL_JOYSTICK_RAWINPUT requires SDL_JOYSTICK_DINPUT || SDL_JOYSTICK_XINPUT +#error SDL_JOYSTICK_RAWINPUT requires SDL_JOYSTICK_DINPUT || defined(SDL_JOYSTICK_XINPUT) #endif #endif /* SDL_JOYSTICK_DINPUT || SDL_JOYSTICK_XINPUT */ diff --git a/thirdparty/SDL/src/joystick/windows/SDL_windowsjoystick_c.h b/thirdparty/SDL/src/joystick/windows/SDL_windowsjoystick_c.h index 8c601a421..18c39e803 100644 --- a/thirdparty/SDL/src/joystick/windows/SDL_windowsjoystick_c.h +++ b/thirdparty/SDL/src/joystick/windows/SDL_windowsjoystick_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -43,6 +43,7 @@ typedef struct JoyStick_DeviceData Uint8 XInputUserId; DIDEVICEINSTANCE dxdevice; char path[MAX_PATH]; + int steam_virtual_gamepad_slot; struct JoyStick_DeviceData *pNext; } JoyStick_DeviceData; @@ -72,10 +73,11 @@ struct joystick_hwdata { SDL_JoystickGUID guid; -#if SDL_JOYSTICK_DINPUT +#ifdef SDL_JOYSTICK_DINPUT LPDIRECTINPUTDEVICE8 InputDevice; DIDEVCAPS Capabilities; SDL_bool buffered; + SDL_bool first_update; input_t Inputs[MAX_INPUTS]; int NumInputs; int NumSliders; @@ -90,7 +92,7 @@ struct joystick_hwdata DWORD dwPacketNumber; }; -#if SDL_JOYSTICK_DINPUT +#ifdef SDL_JOYSTICK_DINPUT extern const DIDATAFORMAT SDL_c_dfDIJoystick2; #endif diff --git a/thirdparty/SDL/src/joystick/windows/SDL_xinputjoystick.c b/thirdparty/SDL/src/joystick/windows/SDL_xinputjoystick.c index 8d1a87ffc..ca6585312 100644 --- a/thirdparty/SDL/src/joystick/windows/SDL_xinputjoystick.c +++ b/thirdparty/SDL/src/joystick/windows/SDL_xinputjoystick.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -22,7 +22,7 @@ #include "../SDL_sysjoystick.h" -#if SDL_JOYSTICK_XINPUT +#ifdef SDL_JOYSTICK_XINPUT #include "SDL_hints.h" #include "SDL_timer.h" @@ -40,9 +40,8 @@ extern "C" { * Internal stuff. */ static SDL_bool s_bXInputEnabled = SDL_TRUE; -static char *s_arrXInputDevicePath[XUSER_MAX_COUNT]; -static SDL_bool SDL_XInputUseOldJoystickMapping() +static SDL_bool SDL_XInputUseOldJoystickMapping(void) { #ifdef __WINRT__ /* TODO: remove this __WINRT__ block, but only after integrating with UWP/WinRT's HID API */ @@ -116,119 +115,48 @@ static const char *GetXInputName(const Uint8 userid, BYTE SubType) return name; } -/* We can't really tell what device is being used for XInput, but we can guess - and we'll be correct for the case where only one device is connected. - */ -static void GuessXInputDevice(Uint8 userid, Uint16 *pVID, Uint16 *pPID, Uint16 *pVersion) +static SDL_bool GetXInputDeviceInfo(Uint8 userid, Uint16 *pVID, Uint16 *pPID, Uint16 *pVersion) { -#if !defined(__WINRT__) && !defined(__XBOXONE__) && !defined(__XBOXSERIES__) /* TODO: remove this ifndef __WINRT__ block, but only after integrating with UWP/WinRT's HID API */ - PRAWINPUTDEVICELIST devices = NULL; - UINT i, j, device_count = 0; + SDL_XINPUT_CAPABILITIES_EX capabilities; - if ((GetRawInputDeviceList(NULL, &device_count, sizeof(RAWINPUTDEVICELIST)) == -1) || (!device_count)) { - return; /* oh well. */ + if (!XINPUTGETCAPABILITIESEX || XINPUTGETCAPABILITIESEX(1, userid, 0, &capabilities) != ERROR_SUCCESS) { + return SDL_FALSE; } - devices = (PRAWINPUTDEVICELIST)SDL_malloc(sizeof(RAWINPUTDEVICELIST) * device_count); - if (devices == NULL) { - return; + /* Fixup for Wireless Xbox 360 Controller */ + if (capabilities.ProductId == 0 && capabilities.Capabilities.Flags & XINPUT_CAPS_WIRELESS) { + capabilities.VendorId = USB_VENDOR_MICROSOFT; + capabilities.ProductId = USB_PRODUCT_XBOX360_XUSB_CONTROLLER; } - if (GetRawInputDeviceList(devices, &device_count, sizeof(RAWINPUTDEVICELIST)) == -1) { - SDL_free(devices); - return; /* oh well. */ - } - - /* First see if we have a cached entry for this index */ - if (s_arrXInputDevicePath[userid]) { - for (i = 0; i < device_count; i++) { - RID_DEVICE_INFO rdi; - char devName[128]; - UINT rdiSize = sizeof(rdi); - UINT nameSize = SDL_arraysize(devName); - - rdi.cbSize = sizeof(rdi); - if (devices[i].dwType == RIM_TYPEHID && - GetRawInputDeviceInfoA(devices[i].hDevice, RIDI_DEVICEINFO, &rdi, &rdiSize) != (UINT)-1 && - GetRawInputDeviceInfoA(devices[i].hDevice, RIDI_DEVICENAME, devName, &nameSize) != (UINT)-1) { - if (SDL_strcmp(devName, s_arrXInputDevicePath[userid]) == 0) { - *pVID = (Uint16)rdi.hid.dwVendorId; - *pPID = (Uint16)rdi.hid.dwProductId; - *pVersion = (Uint16)rdi.hid.dwVersionNumber; - SDL_free(devices); - return; - } - } - } + if (pVID) { + *pVID = capabilities.VendorId; + } + if (pPID) { + *pPID = capabilities.ProductId; } + if (pVersion) { + *pVersion = capabilities.ProductVersion; + } + return SDL_TRUE; +} - for (i = 0; i < device_count; i++) { - RID_DEVICE_INFO rdi; - char devName[MAX_PATH]; - UINT rdiSize = sizeof(rdi); - UINT nameSize = SDL_arraysize(devName); +int SDL_XINPUT_GetSteamVirtualGamepadSlot(Uint8 userid) +{ + SDL_XINPUT_CAPABILITIES_EX capabilities; - rdi.cbSize = sizeof(rdi); - if (devices[i].dwType == RIM_TYPEHID && - GetRawInputDeviceInfoA(devices[i].hDevice, RIDI_DEVICEINFO, &rdi, &rdiSize) != (UINT)-1 && - GetRawInputDeviceInfoA(devices[i].hDevice, RIDI_DEVICENAME, devName, &nameSize) != (UINT)-1) { -#ifdef DEBUG_JOYSTICK - SDL_Log("Raw input device: VID = 0x%x, PID = 0x%x, %s\n", rdi.hid.dwVendorId, rdi.hid.dwProductId, devName); -#endif - if (SDL_strstr(devName, "IG_") != NULL) { - SDL_bool found = SDL_FALSE; - for (j = 0; j < SDL_arraysize(s_arrXInputDevicePath); ++j) { - if (!s_arrXInputDevicePath[j]) { - continue; - } - if (SDL_strcmp(devName, s_arrXInputDevicePath[j]) == 0) { - found = SDL_TRUE; - break; - } - } - if (found) { - /* We already have this device in our XInput device list */ - continue; - } - - /* We don't actually know if this is the right device for this - * userid, but we'll record it so we'll at least be consistent - * when the raw device list changes. - */ - if (rdi.hid.dwVendorId == USB_VENDOR_VALVE && - rdi.hid.dwProductId == USB_PRODUCT_STEAM_VIRTUAL_GAMEPAD) { - /* Steam encodes the real device in the path */ - int realVID = rdi.hid.dwVendorId; - int realPID = rdi.hid.dwProductId; - (void)SDL_sscanf(devName, "\\\\.\\pipe\\HID#VID_045E&PID_028E&IG_00#%x&%x&", &realVID, &realPID); - *pVID = (Uint16)realVID; - *pPID = (Uint16)realPID; - *pVersion = 0; - } else { - *pVID = (Uint16)rdi.hid.dwVendorId; - *pPID = (Uint16)rdi.hid.dwProductId; - *pVersion = (Uint16)rdi.hid.dwVersionNumber; - } - if (s_arrXInputDevicePath[userid]) { - SDL_free(s_arrXInputDevicePath[userid]); - } - s_arrXInputDevicePath[userid] = SDL_strdup(devName); - SDL_free(devices); - return; - } - } + if (XINPUTGETCAPABILITIESEX && + XINPUTGETCAPABILITIESEX(1, userid, 0, &capabilities) == ERROR_SUCCESS && + capabilities.VendorId == USB_VENDOR_VALVE && + capabilities.ProductId == USB_PRODUCT_STEAM_VIRTUAL_GAMEPAD) { + return (int)capabilities.unk2; } - SDL_free(devices); -#endif /* !__WINRT__ */ - - /* The device wasn't in the raw HID device list, it's probably Bluetooth */ - *pVID = 0x045e; /* Microsoft */ - *pPID = 0x02fd; /* XBox One S Bluetooth */ - *pVersion = 0; + return -1; } static void AddXInputDevice(Uint8 userid, BYTE SubType, JoyStick_DeviceData **pContext) { + const char *name = NULL; Uint16 vendor = 0; Uint16 product = 0; Uint16 version = 0; @@ -276,21 +204,21 @@ static void AddXInputDevice(Uint8 userid, BYTE SubType, JoyStick_DeviceData **pC } pNewJoystick = (JoyStick_DeviceData *)SDL_calloc(1, sizeof(JoyStick_DeviceData)); - if (pNewJoystick == NULL) { + if (!pNewJoystick) { return; /* better luck next time? */ } + name = GetXInputName(userid, SubType); + GetXInputDeviceInfo(userid, &vendor, &product, &version); pNewJoystick->bXInputDevice = SDL_TRUE; - pNewJoystick->joystickname = SDL_CreateJoystickName(vendor, product, NULL, GetXInputName(userid, SubType)); + pNewJoystick->joystickname = SDL_CreateJoystickName(vendor, product, NULL, name); if (!pNewJoystick->joystickname) { SDL_free(pNewJoystick); return; /* better luck next time? */ } (void)SDL_snprintf(pNewJoystick->path, sizeof(pNewJoystick->path), "XInput#%d", userid); if (!SDL_XInputUseOldJoystickMapping()) { - GuessXInputDevice(userid, &vendor, &product, &version); - - pNewJoystick->guid = SDL_CreateJoystickGUID(SDL_HARDWARE_BUS_USB, vendor, product, version, pNewJoystick->joystickname, 'x', SubType); + pNewJoystick->guid = SDL_CreateJoystickGUID(SDL_HARDWARE_BUS_USB, vendor, product, version, NULL, name, 'x', SubType); } pNewJoystick->SubType = SubType; pNewJoystick->XInputUserId = userid; @@ -302,7 +230,7 @@ static void AddXInputDevice(Uint8 userid, BYTE SubType, JoyStick_DeviceData **pC #ifdef SDL_JOYSTICK_HIDAPI /* Since we're guessing about the VID/PID, use a hard-coded VID/PID to represent XInput */ - if (HIDAPI_IsDevicePresent(USB_VENDOR_MICROSOFT, USB_PRODUCT_XBOX_ONE_XINPUT_CONTROLLER, version, pNewJoystick->joystickname)) { + if (HIDAPI_IsDevicePresent(USB_VENDOR_MICROSOFT, USB_PRODUCT_XBOX360_XUSB_CONTROLLER, version, pNewJoystick->joystickname)) { /* The HIDAPI driver is taking care of this device */ SDL_free(pNewJoystick); return; @@ -320,14 +248,6 @@ static void AddXInputDevice(Uint8 userid, BYTE SubType, JoyStick_DeviceData **pC WINDOWS_AddJoystickDevice(pNewJoystick); } -static void DelXInputDevice(Uint8 userid) -{ - if (s_arrXInputDevicePath[userid]) { - SDL_free(s_arrXInputDevicePath[userid]); - s_arrXInputDevicePath[userid] = NULL; - } -} - void SDL_XINPUT_JoystickDetect(JoyStick_DeviceData **pContext) { int iuserid; @@ -341,21 +261,7 @@ void SDL_XINPUT_JoystickDetect(JoyStick_DeviceData **pContext) const Uint8 userid = (Uint8)iuserid; XINPUT_CAPABILITIES capabilities; if (XINPUTGETCAPABILITIES(userid, XINPUT_FLAG_GAMEPAD, &capabilities) == ERROR_SUCCESS) { - /* Adding a new device, must handle all removes first, or GuessXInputDevice goes terribly wrong (returns - a product/vendor ID that is not even attached to the system) when we get a remove and add on the same tick - (e.g. when disconnecting a device and the OS reassigns which userid an already-attached controller is) - */ - int iuserid2; - for (iuserid2 = iuserid - 1; iuserid2 >= 0; iuserid2--) { - const Uint8 userid2 = (Uint8)iuserid2; - XINPUT_CAPABILITIES capabilities2; - if (XINPUTGETCAPABILITIES(userid2, XINPUT_FLAG_GAMEPAD, &capabilities2) != ERROR_SUCCESS) { - DelXInputDevice(userid2); - } - } AddXInputDevice(userid, capabilities.SubType, pContext); - } else { - DelXInputDevice(userid); } } } @@ -422,7 +328,7 @@ static void UpdateXInputJoystickBatteryInformation(SDL_Joystick *joystick, XINPU } } -static void UpdateXInputJoystickState_OLD(SDL_Joystick *joystick, XINPUT_STATE_EX *pXInputState, XINPUT_BATTERY_INFORMATION_EX *pBatteryInformation) +static void UpdateXInputJoystickState_OLD(SDL_Joystick *joystick, XINPUT_STATE *pXInputState, XINPUT_BATTERY_INFORMATION_EX *pBatteryInformation) { static WORD s_XInputButtons[] = { XINPUT_GAMEPAD_DPAD_UP, XINPUT_GAMEPAD_DPAD_DOWN, XINPUT_GAMEPAD_DPAD_LEFT, XINPUT_GAMEPAD_DPAD_RIGHT, @@ -448,7 +354,7 @@ static void UpdateXInputJoystickState_OLD(SDL_Joystick *joystick, XINPUT_STATE_E UpdateXInputJoystickBatteryInformation(joystick, pBatteryInformation); } -static void UpdateXInputJoystickState(SDL_Joystick *joystick, XINPUT_STATE_EX *pXInputState, XINPUT_BATTERY_INFORMATION_EX *pBatteryInformation) +static void UpdateXInputJoystickState(SDL_Joystick *joystick, XINPUT_STATE *pXInputState, XINPUT_BATTERY_INFORMATION_EX *pBatteryInformation) { static WORD s_XInputButtons[] = { XINPUT_GAMEPAD_A, XINPUT_GAMEPAD_B, XINPUT_GAMEPAD_X, XINPUT_GAMEPAD_Y, @@ -512,7 +418,7 @@ Uint32 SDL_XINPUT_JoystickGetCapabilities(SDL_Joystick *joystick) void SDL_XINPUT_JoystickUpdate(SDL_Joystick *joystick) { HRESULT result; - XINPUT_STATE_EX XInputState; + XINPUT_STATE XInputState; XINPUT_BATTERY_INFORMATION_EX XBatteryInformation; if (!XINPUTGETSTATE) { @@ -552,6 +458,7 @@ void SDL_XINPUT_JoystickClose(SDL_Joystick *joystick) void SDL_XINPUT_JoystickQuit(void) { if (s_bXInputEnabled) { + s_bXInputEnabled = SDL_FALSE; WIN_UnloadXInputDLL(); } } diff --git a/thirdparty/SDL/src/joystick/windows/SDL_xinputjoystick_c.h b/thirdparty/SDL/src/joystick/windows/SDL_xinputjoystick_c.h index 05950fd4c..8eaa849a7 100644 --- a/thirdparty/SDL/src/joystick/windows/SDL_xinputjoystick_c.h +++ b/thirdparty/SDL/src/joystick/windows/SDL_xinputjoystick_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -36,6 +36,7 @@ extern Uint32 SDL_XINPUT_JoystickGetCapabilities(SDL_Joystick *joystick); extern void SDL_XINPUT_JoystickUpdate(SDL_Joystick *joystick); extern void SDL_XINPUT_JoystickClose(SDL_Joystick *joystick); extern void SDL_XINPUT_JoystickQuit(void); +extern int SDL_XINPUT_GetSteamVirtualGamepadSlot(Uint8 userid); /* Ends C function definitions when using C++ */ #ifdef __cplusplus diff --git a/thirdparty/SDL/src/libm/math_libm.h b/thirdparty/SDL/src/libm/math_libm.h index e1ac4ac97..831a18476 100644 --- a/thirdparty/SDL/src/libm/math_libm.h +++ b/thirdparty/SDL/src/libm/math_libm.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/loadso/dlopen/SDL_sysloadso.c b/thirdparty/SDL/src/loadso/dlopen/SDL_sysloadso.c index 7e80cbfbe..f08209c1d 100644 --- a/thirdparty/SDL/src/loadso/dlopen/SDL_sysloadso.c +++ b/thirdparty/SDL/src/loadso/dlopen/SDL_sysloadso.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -30,7 +30,7 @@ #include "SDL_loadso.h" -#if SDL_VIDEO_DRIVER_UIKIT +#ifdef SDL_VIDEO_DRIVER_UIKIT #include "../../video/uikit/SDL_uikitvideo.h" #endif @@ -39,7 +39,7 @@ void *SDL_LoadObject(const char *sofile) void *handle; const char *loaderror; -#if SDL_VIDEO_DRIVER_UIKIT +#ifdef SDL_VIDEO_DRIVER_UIKIT if (!UIKit_IsSystemVersionAtLeast(8.0)) { SDL_SetError("SDL_LoadObject requires iOS 8+"); return NULL; @@ -48,7 +48,7 @@ void *SDL_LoadObject(const char *sofile) handle = dlopen(sofile, RTLD_NOW | RTLD_LOCAL); loaderror = dlerror(); - if (handle == NULL) { + if (!handle) { SDL_SetError("Failed loading %s: %s", sofile, loaderror); } return handle; @@ -57,7 +57,7 @@ void *SDL_LoadObject(const char *sofile) void *SDL_LoadFunction(void *handle, const char *name) { void *symbol = dlsym(handle, name); - if (symbol == NULL) { + if (!symbol) { /* prepend an underscore for platforms that need that. */ SDL_bool isstack; size_t len = SDL_strlen(name) + 1; @@ -66,7 +66,7 @@ void *SDL_LoadFunction(void *handle, const char *name) SDL_memcpy(&_name[1], name, len); symbol = dlsym(handle, _name); SDL_small_free(_name, isstack); - if (symbol == NULL) { + if (!symbol) { SDL_SetError("Failed loading %s: %s", name, (const char *)dlerror()); } @@ -76,7 +76,7 @@ void *SDL_LoadFunction(void *handle, const char *name) void SDL_UnloadObject(void *handle) { - if (handle != NULL) { + if (handle) { dlclose(handle); } } diff --git a/thirdparty/SDL/src/loadso/dummy/SDL_sysloadso.c b/thirdparty/SDL/src/loadso/dummy/SDL_sysloadso.c index e9c2e28a5..b03703b16 100644 --- a/thirdparty/SDL/src/loadso/dummy/SDL_sysloadso.c +++ b/thirdparty/SDL/src/loadso/dummy/SDL_sysloadso.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/loadso/os2/SDL_sysloadso.c b/thirdparty/SDL/src/loadso/os2/SDL_sysloadso.c index c5c8b3b32..a48db99d5 100644 --- a/thirdparty/SDL/src/loadso/os2/SDL_sysloadso.c +++ b/thirdparty/SDL/src/loadso/os2/SDL_sysloadso.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -90,7 +90,7 @@ void *SDL_LoadFunction(void *handle, const char *name) void SDL_UnloadObject(void *handle) { - if (handle != NULL) { + if (handle) { DosFreeModule((HMODULE)handle); } } diff --git a/thirdparty/SDL/src/loadso/windows/SDL_sysloadso.c b/thirdparty/SDL/src/loadso/windows/SDL_sysloadso.c index ca43370c8..1fcee3d42 100644 --- a/thirdparty/SDL/src/loadso/windows/SDL_sysloadso.c +++ b/thirdparty/SDL/src/loadso/windows/SDL_sysloadso.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -34,7 +34,7 @@ void *SDL_LoadObject(const char *sofile) void *handle; LPTSTR tstr; - if (sofile == NULL) { + if (!sofile) { SDL_InvalidParamError("sofile"); return NULL; } @@ -51,7 +51,7 @@ void *SDL_LoadObject(const char *sofile) SDL_free(tstr); /* Generate an error message if all loads failed */ - if (handle == NULL) { + if (!handle) { char errbuf[512]; SDL_strlcpy(errbuf, "Failed loading ", SDL_arraysize(errbuf)); SDL_strlcat(errbuf, sofile, SDL_arraysize(errbuf)); @@ -63,7 +63,7 @@ void *SDL_LoadObject(const char *sofile) void *SDL_LoadFunction(void *handle, const char *name) { void *symbol = (void *)GetProcAddress((HMODULE)handle, name); - if (symbol == NULL) { + if (!symbol) { char errbuf[512]; SDL_strlcpy(errbuf, "Failed loading ", SDL_arraysize(errbuf)); SDL_strlcat(errbuf, name, SDL_arraysize(errbuf)); @@ -74,7 +74,7 @@ void *SDL_LoadFunction(void *handle, const char *name) void SDL_UnloadObject(void *handle) { - if (handle != NULL) { + if (handle) { FreeLibrary((HMODULE)handle); } } diff --git a/thirdparty/SDL/src/locale/SDL_locale.c b/thirdparty/SDL/src/locale/SDL_locale.c index 0c8f611ac..ea3e858a1 100644 --- a/thirdparty/SDL/src/locale/SDL_locale.c +++ b/thirdparty/SDL/src/locale/SDL_locale.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -32,7 +32,7 @@ static SDL_Locale *build_locales_from_csv_string(char *csv) SDL_Locale *loc; SDL_Locale *retval; - if (csv == NULL || !csv[0]) { + if (!csv || !csv[0]) { return NULL; /* nothing to report */ } @@ -48,7 +48,7 @@ static SDL_Locale *build_locales_from_csv_string(char *csv) alloclen = slen + (num_locales * sizeof(SDL_Locale)); loc = retval = (SDL_Locale *)SDL_calloc(1, alloclen); - if (retval == NULL) { + if (!retval) { SDL_OutOfMemory(); return NULL; /* oh well */ } diff --git a/thirdparty/SDL/src/locale/SDL_syslocale.h b/thirdparty/SDL/src/locale/SDL_syslocale.h index 6072036ad..32171604c 100644 --- a/thirdparty/SDL/src/locale/SDL_syslocale.h +++ b/thirdparty/SDL/src/locale/SDL_syslocale.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/locale/android/SDL_syslocale.c b/thirdparty/SDL/src/locale/android/SDL_syslocale.c index d8c6ebfb2..9a447d078 100644 --- a/thirdparty/SDL/src/locale/android/SDL_syslocale.c +++ b/thirdparty/SDL/src/locale/android/SDL_syslocale.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/locale/dummy/SDL_syslocale.c b/thirdparty/SDL/src/locale/dummy/SDL_syslocale.c index f5cf9dace..89a7b1de8 100644 --- a/thirdparty/SDL/src/locale/dummy/SDL_syslocale.c +++ b/thirdparty/SDL/src/locale/dummy/SDL_syslocale.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/locale/emscripten/SDL_syslocale.c b/thirdparty/SDL/src/locale/emscripten/SDL_syslocale.c index dee403c30..3b148acbf 100644 --- a/thirdparty/SDL/src/locale/emscripten/SDL_syslocale.c +++ b/thirdparty/SDL/src/locale/emscripten/SDL_syslocale.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/locale/haiku/SDL_syslocale.cc b/thirdparty/SDL/src/locale/haiku/SDL_syslocale.cc index 70af4df7b..016a17c6b 100644 --- a/thirdparty/SDL/src/locale/haiku/SDL_syslocale.cc +++ b/thirdparty/SDL/src/locale/haiku/SDL_syslocale.cc @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/locale/macosx/SDL_syslocale.m b/thirdparty/SDL/src/locale/macosx/SDL_syslocale.m index 3a0e5db9e..57f40fef9 100644 --- a/thirdparty/SDL/src/locale/macosx/SDL_syslocale.m +++ b/thirdparty/SDL/src/locale/macosx/SDL_syslocale.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/locale/n3ds/SDL_syslocale.c b/thirdparty/SDL/src/locale/n3ds/SDL_syslocale.c index fcc01fd0e..1573f28bc 100644 --- a/thirdparty/SDL/src/locale/n3ds/SDL_syslocale.c +++ b/thirdparty/SDL/src/locale/n3ds/SDL_syslocale.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -33,7 +33,7 @@ void SDL_SYS_GetPreferredLocales(char *buf, size_t buflen) { /* The 3DS only supports these 12 languages, only one can be active at a time */ static const char AVAILABLE_LOCALES[][6] = { "ja_JP", "en_US", "fr_FR", "de_DE", - "it_IT", "es_ES", "zn_CN", "ko_KR", + "it_IT", "es_ES", "zh_CN", "ko_KR", "nl_NL", "pt_PT", "ru_RU", "zh_TW" }; u8 current_locale = GetLocaleIndex(); if (current_locale != BAD_LOCALE) { @@ -45,14 +45,13 @@ SDL_FORCE_INLINE u8 GetLocaleIndex(void) { u8 current_locale; + Result result; if (R_FAILED(cfguInit())) { return BAD_LOCALE; } - if (R_FAILED(CFGU_GetSystemLanguage(¤t_locale))) { - return BAD_LOCALE; - } + result = CFGU_GetSystemLanguage(¤t_locale); cfguExit(); - return current_locale; + return R_SUCCEEDED(result) ? current_locale : BAD_LOCALE; } /* vi: set sts=4 ts=4 sw=4 expandtab: */ diff --git a/thirdparty/SDL/src/locale/unix/SDL_syslocale.c b/thirdparty/SDL/src/locale/unix/SDL_syslocale.c index 2b9f877fc..f1e59cc96 100644 --- a/thirdparty/SDL/src/locale/unix/SDL_syslocale.c +++ b/thirdparty/SDL/src/locale/unix/SDL_syslocale.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -27,12 +27,12 @@ static void normalize_locale_str(char *dst, char *str, size_t buflen) char *ptr; ptr = SDL_strchr(str, '.'); /* chop off encoding if specified. */ - if (ptr != NULL) { + if (ptr) { *ptr = '\0'; } ptr = SDL_strchr(str, '@'); /* chop off extra bits if specified. */ - if (ptr != NULL) { + if (ptr) { *ptr = '\0'; } @@ -71,7 +71,7 @@ void SDL_SYS_GetPreferredLocales(char *buf, size_t buflen) SDL_assert(buflen > 0); tmp = SDL_small_alloc(char, buflen, &isstack); - if (tmp == NULL) { + if (!tmp) { SDL_OutOfMemory(); return; } diff --git a/thirdparty/SDL/src/locale/vita/SDL_syslocale.c b/thirdparty/SDL/src/locale/vita/SDL_syslocale.c index d0d91e0b6..780b9ad9a 100644 --- a/thirdparty/SDL/src/locale/vita/SDL_syslocale.c +++ b/thirdparty/SDL/src/locale/vita/SDL_syslocale.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/locale/windows/SDL_syslocale.c b/thirdparty/SDL/src/locale/windows/SDL_syslocale.c index 169df915a..2449b1568 100644 --- a/thirdparty/SDL/src/locale/windows/SDL_syslocale.c +++ b/thirdparty/SDL/src/locale/windows/SDL_syslocale.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -65,7 +65,7 @@ static void SDL_SYS_GetPreferredLocales_vista(char *buf, size_t buflen) pGetUserPreferredUILanguages(MUI_LANGUAGE_NAME, &numlangs, NULL, &wbuflen); wbuf = SDL_small_alloc(WCHAR, wbuflen, &isstack); - if (wbuf == NULL) { + if (!wbuf) { SDL_OutOfMemory(); return; } @@ -102,7 +102,7 @@ void SDL_SYS_GetPreferredLocales(char *buf, size_t buflen) } } - if (pGetUserPreferredUILanguages == NULL) { + if (!pGetUserPreferredUILanguages) { SDL_SYS_GetPreferredLocales_winxp(buf, buflen); /* this is always available */ } else { SDL_SYS_GetPreferredLocales_vista(buf, buflen); /* available on Vista and later. */ diff --git a/thirdparty/SDL/src/locale/winrt/SDL_syslocale.c b/thirdparty/SDL/src/locale/winrt/SDL_syslocale.c index 3995f9a2b..8fdeec703 100644 --- a/thirdparty/SDL/src/locale/winrt/SDL_syslocale.c +++ b/thirdparty/SDL/src/locale/winrt/SDL_syslocale.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -33,7 +33,7 @@ void SDL_SYS_GetPreferredLocales(char *buf, size_t buflen) int ret = 0; /* !!! FIXME: do we not have GetUserPreferredUILanguages on WinPhone or UWP? */ -#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP +#if SDL_WINAPI_FAMILY_PHONE ret = GetLocaleInfoEx(LOCALE_NAME_SYSTEM_DEFAULT, LOCALE_SNAME, wbuffer, SDL_arraysize(wbuffer)); #else ret = GetSystemDefaultLocaleName(wbuffer, SDL_arraysize(wbuffer)); diff --git a/thirdparty/SDL/src/main/gdk/SDL_gdk_main.c b/thirdparty/SDL/src/main/gdk/SDL_gdk_main.c index a38afa44a..7bfd9cc95 100644 --- a/thirdparty/SDL/src/main/gdk/SDL_gdk_main.c +++ b/thirdparty/SDL/src/main/gdk/SDL_gdk_main.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/main/haiku/SDL_BApp.h b/thirdparty/SDL/src/main/haiku/SDL_BApp.h index 036808167..284445d98 100644 --- a/thirdparty/SDL/src/main/haiku/SDL_BApp.h +++ b/thirdparty/SDL/src/main/haiku/SDL_BApp.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -24,7 +24,7 @@ #include #include #include -#if SDL_VIDEO_OPENGL +#ifdef SDL_VIDEO_OPENGL #include #endif @@ -85,7 +85,7 @@ class SDL_BLooper : public BLooper public: SDL_BLooper(const char* name) : BLooper(name) { -#if SDL_VIDEO_OPENGL +#ifdef SDL_VIDEO_OPENGL _current_context = NULL; #endif } @@ -199,7 +199,7 @@ class SDL_BLooper : public BLooper return _window_map[winID]; } -#if SDL_VIDEO_OPENGL +#ifdef SDL_VIDEO_OPENGL BGLView *GetCurrentContext() { return _current_context; @@ -419,7 +419,7 @@ class SDL_BLooper : public BLooper /* Members */ std::vector _window_map; /* Keeps track of SDL_Windows by index-id */ -#if SDL_VIDEO_OPENGL +#ifdef SDL_VIDEO_OPENGL BGLView *_current_context; #endif }; diff --git a/thirdparty/SDL/src/main/haiku/SDL_BeApp.cc b/thirdparty/SDL/src/main/haiku/SDL_BeApp.cc index 63af36bdb..a736a9f09 100644 --- a/thirdparty/SDL/src/main/haiku/SDL_BeApp.cc +++ b/thirdparty/SDL/src/main/haiku/SDL_BeApp.cc @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -109,13 +109,13 @@ static int StartBeLooper() { if (!be_app) { SDL_AppThread = SDL_CreateThreadInternal(StartBeApp, "SDLApplication", 0, NULL); - if (SDL_AppThread == NULL) { + if (!SDL_AppThread) { return SDL_SetError("Couldn't create BApplication thread"); } do { SDL_Delay(10); - } while ((be_app == NULL) || be_app->IsLaunching()); + } while ((!be_app) || be_app->IsLaunching()); } /* Change working directory to that of executable */ @@ -168,7 +168,7 @@ void SDL_QuitBeApp(void) SDL_Looper->Lock(); SDL_Looper->Quit(); SDL_Looper = NULL; - if (SDL_AppThread != NULL) { + if (SDL_AppThread) { if (be_app != NULL) { /* Not tested */ be_app->PostMessage(B_QUIT_REQUESTED); } diff --git a/thirdparty/SDL/src/main/haiku/SDL_BeApp.h b/thirdparty/SDL/src/main/haiku/SDL_BeApp.h index 9a5adb8ef..8b8cc0f15 100644 --- a/thirdparty/SDL/src/main/haiku/SDL_BeApp.h +++ b/thirdparty/SDL/src/main/haiku/SDL_BeApp.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/main/n3ds/SDL_n3ds_main.c b/thirdparty/SDL/src/main/n3ds/SDL_n3ds_main.c index db8177c84..844416ff9 100644 --- a/thirdparty/SDL/src/main/n3ds/SDL_n3ds_main.c +++ b/thirdparty/SDL/src/main/n3ds/SDL_n3ds_main.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/main/nacl/SDL_nacl_main.c b/thirdparty/SDL/src/main/nacl/SDL_nacl_main.c index 10d94e227..174b85b0a 100644 --- a/thirdparty/SDL/src/main/nacl/SDL_nacl_main.c +++ b/thirdparty/SDL/src/main/nacl/SDL_nacl_main.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_NACL +#ifdef SDL_VIDEO_DRIVER_NACL /* Include the SDL main definition header */ #include "SDL_main.h" diff --git a/thirdparty/SDL/src/main/ngage/SDL_ngage_main.cpp b/thirdparty/SDL/src/main/ngage/SDL_ngage_main.cpp index 10d848870..7439a2fd1 100644 --- a/thirdparty/SDL/src/main/ngage/SDL_ngage_main.cpp +++ b/thirdparty/SDL/src/main/ngage/SDL_ngage_main.cpp @@ -58,7 +58,7 @@ TInt E32Main() newHeap = User::ChunkHeap(NULL, heapSize, heapSize, KMinHeapGrowBy); - if (newHeap == NULL) { + if (!newHeap) { ret = 3; goto cleanup; } else { diff --git a/thirdparty/SDL/src/main/ps2/SDL_ps2_main.c b/thirdparty/SDL/src/main/ps2/SDL_ps2_main.c index b237eea8c..14fb0d704 100644 --- a/thirdparty/SDL/src/main/ps2/SDL_ps2_main.c +++ b/thirdparty/SDL/src/main/ps2/SDL_ps2_main.c @@ -23,7 +23,7 @@ #undef main #endif -__attribute__((weak)) void reset_IOP() +__attribute__((weak)) void reset_IOP(void) { SifInitRpc(0); while (!SifIopReset(NULL, 0)) { @@ -32,7 +32,7 @@ __attribute__((weak)) void reset_IOP() } } -static void prepare_IOP() +static void prepare_IOP(void) { reset_IOP(); SifInitRpc(0); @@ -41,12 +41,12 @@ static void prepare_IOP() sbv_patch_fileio(); } -static void init_drivers() +static void init_drivers(void) { init_ps2_filesystem_driver(); } -static void deinit_drivers() +static void deinit_drivers(void) { deinit_ps2_filesystem_driver(); } diff --git a/thirdparty/SDL/src/main/windows/SDL_windows_main.c b/thirdparty/SDL/src/main/windows/SDL_windows_main.c index 189b95420..bad49b0ca 100644 --- a/thirdparty/SDL/src/main/windows/SDL_windows_main.c +++ b/thirdparty/SDL/src/main/windows/SDL_windows_main.c @@ -43,7 +43,7 @@ static int main_getcmdline(void) int i, argc, result; argvw = CommandLineToArgvW(GetCommandLineW(), &argc); - if (argvw == NULL) { + if (!argvw) { return OutOfMemory(); } @@ -54,13 +54,13 @@ static int main_getcmdline(void) /* Parse it into argv and argc */ argv = (char **)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, (argc + 1) * sizeof(*argv)); - if (argv == NULL) { + if (!argv) { return OutOfMemory(); } for (i = 0; i < argc; ++i) { DWORD len; char *arg = WIN_StringToUTF8W(argvw[i]); - if (arg == NULL) { + if (!arg) { return OutOfMemory(); } len = (DWORD)SDL_strlen(arg); diff --git a/thirdparty/SDL/src/main/windows/version.rc b/thirdparty/SDL/src/main/windows/version.rc index f69c755b4..455c254f6 100644 --- a/thirdparty/SDL/src/main/windows/version.rc +++ b/thirdparty/SDL/src/main/windows/version.rc @@ -9,8 +9,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US // VS_VERSION_INFO VERSIONINFO - FILEVERSION 2,28,5,0 - PRODUCTVERSION 2,28,5,0 + FILEVERSION 2,30,7,0 + PRODUCTVERSION 2,30,7,0 FILEFLAGSMASK 0x3fL FILEFLAGS 0x0L FILEOS 0x40004L @@ -23,12 +23,12 @@ BEGIN BEGIN VALUE "CompanyName", "\0" VALUE "FileDescription", "SDL\0" - VALUE "FileVersion", "2, 28, 5, 0\0" + VALUE "FileVersion", "2, 30, 7, 0\0" VALUE "InternalName", "SDL\0" - VALUE "LegalCopyright", "Copyright (C) 2023 Sam Lantinga\0" + VALUE "LegalCopyright", "Copyright (C) 2024 Sam Lantinga\0" VALUE "OriginalFilename", "SDL2.dll\0" VALUE "ProductName", "Simple DirectMedia Layer\0" - VALUE "ProductVersion", "2, 28, 5, 0\0" + VALUE "ProductVersion", "2, 30, 7, 0\0" END END BLOCK "VarFileInfo" diff --git a/thirdparty/SDL/src/misc/SDL_sysurl.h b/thirdparty/SDL/src/misc/SDL_sysurl.h index ae769320a..f2a4f9b92 100644 --- a/thirdparty/SDL/src/misc/SDL_sysurl.h +++ b/thirdparty/SDL/src/misc/SDL_sysurl.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/misc/SDL_url.c b/thirdparty/SDL/src/misc/SDL_url.c index 22faa8417..9876bf21a 100644 --- a/thirdparty/SDL/src/misc/SDL_url.c +++ b/thirdparty/SDL/src/misc/SDL_url.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -23,7 +23,7 @@ int SDL_OpenURL(const char *url) { - if (url == NULL) { + if (!url) { return SDL_InvalidParamError("url"); } return SDL_SYS_OpenURL(url); diff --git a/thirdparty/SDL/src/misc/android/SDL_sysurl.c b/thirdparty/SDL/src/misc/android/SDL_sysurl.c index 577e0c388..e7e21d272 100644 --- a/thirdparty/SDL/src/misc/android/SDL_sysurl.c +++ b/thirdparty/SDL/src/misc/android/SDL_sysurl.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/misc/dummy/SDL_sysurl.c b/thirdparty/SDL/src/misc/dummy/SDL_sysurl.c index 3f43628eb..a5fa7cbab 100644 --- a/thirdparty/SDL/src/misc/dummy/SDL_sysurl.c +++ b/thirdparty/SDL/src/misc/dummy/SDL_sysurl.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/misc/emscripten/SDL_sysurl.c b/thirdparty/SDL/src/misc/emscripten/SDL_sysurl.c index 1d707fc1a..87c1a0ca3 100644 --- a/thirdparty/SDL/src/misc/emscripten/SDL_sysurl.c +++ b/thirdparty/SDL/src/misc/emscripten/SDL_sysurl.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/misc/haiku/SDL_sysurl.cc b/thirdparty/SDL/src/misc/haiku/SDL_sysurl.cc index 68b031021..85fd622a0 100644 --- a/thirdparty/SDL/src/misc/haiku/SDL_sysurl.cc +++ b/thirdparty/SDL/src/misc/haiku/SDL_sysurl.cc @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/misc/ios/SDL_sysurl.m b/thirdparty/SDL/src/misc/ios/SDL_sysurl.m index 61c931ead..76363b50d 100644 --- a/thirdparty/SDL/src/misc/ios/SDL_sysurl.m +++ b/thirdparty/SDL/src/misc/ios/SDL_sysurl.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/misc/macosx/SDL_sysurl.m b/thirdparty/SDL/src/misc/macosx/SDL_sysurl.m index 657c8f520..d6088d133 100644 --- a/thirdparty/SDL/src/misc/macosx/SDL_sysurl.m +++ b/thirdparty/SDL/src/misc/macosx/SDL_sysurl.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/misc/riscos/SDL_sysurl.c b/thirdparty/SDL/src/misc/riscos/SDL_sysurl.c index f4d588ee0..bbb78c9ce 100644 --- a/thirdparty/SDL/src/misc/riscos/SDL_sysurl.c +++ b/thirdparty/SDL/src/misc/riscos/SDL_sysurl.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/misc/unix/SDL_sysurl.c b/thirdparty/SDL/src/misc/unix/SDL_sysurl.c index 582158242..050446df5 100644 --- a/thirdparty/SDL/src/misc/unix/SDL_sysurl.c +++ b/thirdparty/SDL/src/misc/unix/SDL_sysurl.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/misc/vita/SDL_sysurl.c b/thirdparty/SDL/src/misc/vita/SDL_sysurl.c index e96c18e5a..fca6b2f32 100644 --- a/thirdparty/SDL/src/misc/vita/SDL_sysurl.c +++ b/thirdparty/SDL/src/misc/vita/SDL_sysurl.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/misc/windows/SDL_sysurl.c b/thirdparty/SDL/src/misc/windows/SDL_sysurl.c index 6f9c46d4f..8462babe5 100644 --- a/thirdparty/SDL/src/misc/windows/SDL_sysurl.c +++ b/thirdparty/SDL/src/misc/windows/SDL_sysurl.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -44,7 +44,7 @@ int SDL_SYS_OpenURL(const char *url) } wurl = WIN_UTF8ToStringW(url); - if (wurl == NULL) { + if (!wurl) { WIN_CoUninitialize(); return SDL_OutOfMemory(); } diff --git a/thirdparty/SDL/src/misc/winrt/SDL_sysurl.cpp b/thirdparty/SDL/src/misc/winrt/SDL_sysurl.cpp index 93fd7b0e7..f435ab97d 100644 --- a/thirdparty/SDL/src/misc/winrt/SDL_sysurl.cpp +++ b/thirdparty/SDL/src/misc/winrt/SDL_sysurl.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/power/SDL_power.c b/thirdparty/SDL/src/power/SDL_power.c index 63ba38221..a64cace49 100644 --- a/thirdparty/SDL/src/power/SDL_power.c +++ b/thirdparty/SDL/src/power/SDL_power.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -95,10 +95,10 @@ SDL_PowerState SDL_GetPowerInfo(int *seconds, int *percent) int _seconds, _percent; /* Make these never NULL for platform-specific implementations. */ - if (seconds == NULL) { + if (!seconds) { seconds = &_seconds; } - if (percent == NULL) { + if (!percent) { percent = &_percent; } diff --git a/thirdparty/SDL/src/power/SDL_syspower.h b/thirdparty/SDL/src/power/SDL_syspower.h index 5401a0ee3..25b22fc1c 100644 --- a/thirdparty/SDL/src/power/SDL_syspower.h +++ b/thirdparty/SDL/src/power/SDL_syspower.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/power/android/SDL_syspower.c b/thirdparty/SDL/src/power/android/SDL_syspower.c index 3dccdecda..3da49e5d8 100644 --- a/thirdparty/SDL/src/power/android/SDL_syspower.c +++ b/thirdparty/SDL/src/power/android/SDL_syspower.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,7 +21,7 @@ #include "../../SDL_internal.h" #ifndef SDL_POWER_DISABLED -#if SDL_POWER_ANDROID +#ifdef SDL_POWER_ANDROID #include "SDL_power.h" #include "../SDL_syspower.h" diff --git a/thirdparty/SDL/src/power/emscripten/SDL_syspower.c b/thirdparty/SDL/src/power/emscripten/SDL_syspower.c index 6a1f3176c..aed93b0c4 100644 --- a/thirdparty/SDL/src/power/emscripten/SDL_syspower.c +++ b/thirdparty/SDL/src/power/emscripten/SDL_syspower.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,7 +21,7 @@ #include "../../SDL_internal.h" #ifndef SDL_POWER_DISABLED -#if SDL_POWER_EMSCRIPTEN +#ifdef SDL_POWER_EMSCRIPTEN #include diff --git a/thirdparty/SDL/src/power/haiku/SDL_syspower.c b/thirdparty/SDL/src/power/haiku/SDL_syspower.c index 6e7dd928e..ec3d4b9f5 100644 --- a/thirdparty/SDL/src/power/haiku/SDL_syspower.c +++ b/thirdparty/SDL/src/power/haiku/SDL_syspower.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -24,7 +24,7 @@ /* !!! FIXME: does this thing even work on Haiku? */ #ifndef SDL_POWER_DISABLED -#if SDL_POWER_HAIKU +#ifdef SDL_POWER_HAIKU #include #include diff --git a/thirdparty/SDL/src/power/linux/SDL_syspower.c b/thirdparty/SDL/src/power/linux/SDL_syspower.c index 84100e856..7899e3d19 100644 --- a/thirdparty/SDL/src/power/linux/SDL_syspower.c +++ b/thirdparty/SDL/src/power/linux/SDL_syspower.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,7 +21,7 @@ #include "../../SDL_internal.h" #ifndef SDL_POWER_DISABLED -#if SDL_POWER_LINUX +#ifdef SDL_POWER_LINUX #include #include @@ -46,7 +46,7 @@ static int open_power_file(const char *base, const char *node, const char *key) int fd; const size_t pathlen = SDL_strlen(base) + SDL_strlen(node) + SDL_strlen(key) + 3; char *path = SDL_stack_alloc(char, pathlen); - if (path == NULL) { + if (!path) { return -1; /* oh well. */ } @@ -242,7 +242,7 @@ SDL_bool SDL_GetPowerInfo_Linux_proc_acpi(SDL_PowerState *state, int *seconds, i *state = SDL_POWERSTATE_UNKNOWN; dirp = opendir(proc_acpi_battery_path); - if (dirp == NULL) { + if (!dirp) { return SDL_FALSE; /* can't use this interface. */ } else { while ((dent = readdir(dirp)) != NULL) { @@ -254,7 +254,7 @@ SDL_bool SDL_GetPowerInfo_Linux_proc_acpi(SDL_PowerState *state, int *seconds, i } dirp = opendir(proc_acpi_ac_adapter_path); - if (dirp == NULL) { + if (!dirp) { return SDL_FALSE; /* can't use this interface. */ } else { while ((dent = readdir(dirp)) != NULL) { @@ -425,7 +425,7 @@ SDL_bool SDL_GetPowerInfo_Linux_sys_class_power_supply(SDL_PowerState *state, in DIR *dirp; dirp = opendir(base); - if (dirp == NULL) { + if (!dirp) { return SDL_FALSE; } @@ -521,7 +521,7 @@ SDL_bool SDL_GetPowerInfo_Linux_sys_class_power_supply(SDL_PowerState *state, in } /* d-bus queries to org.freedesktop.UPower. */ -#if SDL_USE_LIBDBUS +#ifdef SDL_USE_LIBDBUS #define UPOWER_DBUS_NODE "org.freedesktop.UPower" #define UPOWER_DBUS_PATH "/org/freedesktop/UPower" #define UPOWER_DBUS_INTERFACE "org.freedesktop.UPower" @@ -562,9 +562,17 @@ static void check_upower_device(DBusConnection *conn, const char *path, SDL_Powe st = SDL_POWERSTATE_UNKNOWN; /* uh oh */ } else if (ui32 == 1) { /* 1 == charging */ st = SDL_POWERSTATE_CHARGING; - } else if ((ui32 == 2) || (ui32 == 3)) { /* 2 == discharging, 3 == empty. */ + } else if ((ui32 == 2) || (ui32 == 3) || (ui32 == 6)) { + /* 2 == discharging; + * 3 == empty; + * 6 == "pending discharge" which GNOME interprets as equivalent + * to discharging */ st = SDL_POWERSTATE_ON_BATTERY; - } else if (ui32 == 4) { /* 4 == full */ + } else if ((ui32 == 4) || (ui32 == 5)) { + /* 4 == full; + * 5 == "pending charge" which GNOME shows as "Not charging", + * used when a battery is configured to stop charging at a + * lower than 100% threshold */ st = SDL_POWERSTATE_CHARGED; } else { st = SDL_POWERSTATE_UNKNOWN; /* uh oh */ @@ -611,12 +619,12 @@ SDL_bool SDL_GetPowerInfo_Linux_org_freedesktop_upower(SDL_PowerState *state, in { SDL_bool retval = SDL_FALSE; -#if SDL_USE_LIBDBUS +#ifdef SDL_USE_LIBDBUS SDL_DBusContext *dbus = SDL_DBus_GetContext(); char **paths = NULL; int i, numpaths = 0; - if (dbus == NULL || !SDL_DBus_CallMethodOnConnection(dbus->system_conn, UPOWER_DBUS_NODE, UPOWER_DBUS_PATH, UPOWER_DBUS_INTERFACE, "EnumerateDevices", + if (!dbus || !SDL_DBus_CallMethodOnConnection(dbus->system_conn, UPOWER_DBUS_NODE, UPOWER_DBUS_PATH, UPOWER_DBUS_INTERFACE, "EnumerateDevices", DBUS_TYPE_INVALID, DBUS_TYPE_ARRAY, DBUS_TYPE_OBJECT_PATH, &paths, &numpaths, DBUS_TYPE_INVALID)) { return SDL_FALSE; /* try a different approach than UPower. */ diff --git a/thirdparty/SDL/src/power/macosx/SDL_syspower.c b/thirdparty/SDL/src/power/macosx/SDL_syspower.c index b6af7682b..a3881f374 100644 --- a/thirdparty/SDL/src/power/macosx/SDL_syspower.c +++ b/thirdparty/SDL/src/power/macosx/SDL_syspower.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,7 +21,7 @@ #include "../../SDL_internal.h" #ifndef SDL_POWER_DISABLED -#if SDL_POWER_MACOSX +#ifdef SDL_POWER_MACOSX #include #include diff --git a/thirdparty/SDL/src/power/n3ds/SDL_syspower.c b/thirdparty/SDL/src/power/n3ds/SDL_syspower.c index b565643e9..9b5555ee1 100644 --- a/thirdparty/SDL/src/power/n3ds/SDL_syspower.c +++ b/thirdparty/SDL/src/power/n3ds/SDL_syspower.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/power/psp/SDL_syspower.c b/thirdparty/SDL/src/power/psp/SDL_syspower.c index 281197858..4b9d14531 100644 --- a/thirdparty/SDL/src/power/psp/SDL_syspower.c +++ b/thirdparty/SDL/src/power/psp/SDL_syspower.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -22,7 +22,7 @@ #include "../../SDL_internal.h" #ifndef SDL_POWER_DISABLED -#if SDL_POWER_PSP +#ifdef SDL_POWER_PSP #include "SDL_power.h" #include diff --git a/thirdparty/SDL/src/power/uikit/SDL_syspower.h b/thirdparty/SDL/src/power/uikit/SDL_syspower.h index 73149c8a3..9d5c6a88b 100644 --- a/thirdparty/SDL/src/power/uikit/SDL_syspower.h +++ b/thirdparty/SDL/src/power/uikit/SDL_syspower.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_POWER_UIKIT +#ifdef SDL_POWER_UIKIT #include "SDL_power.h" diff --git a/thirdparty/SDL/src/power/uikit/SDL_syspower.m b/thirdparty/SDL/src/power/uikit/SDL_syspower.m index 5b9076b57..d366d6548 100644 --- a/thirdparty/SDL/src/power/uikit/SDL_syspower.m +++ b/thirdparty/SDL/src/power/uikit/SDL_syspower.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,7 +21,7 @@ #include "../../SDL_internal.h" #ifndef SDL_POWER_DISABLED -#if SDL_POWER_UIKIT +#ifdef SDL_POWER_UIKIT #import diff --git a/thirdparty/SDL/src/power/vita/SDL_syspower.c b/thirdparty/SDL/src/power/vita/SDL_syspower.c index 6c28e9223..644b72a42 100644 --- a/thirdparty/SDL/src/power/vita/SDL_syspower.c +++ b/thirdparty/SDL/src/power/vita/SDL_syspower.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -22,7 +22,7 @@ #include "../../SDL_internal.h" #ifndef SDL_POWER_DISABLED -#if SDL_POWER_VITA +#ifdef SDL_POWER_VITA #include "SDL_power.h" #include diff --git a/thirdparty/SDL/src/power/windows/SDL_syspower.c b/thirdparty/SDL/src/power/windows/SDL_syspower.c index f1d7d8897..58fa9a8ea 100644 --- a/thirdparty/SDL/src/power/windows/SDL_syspower.c +++ b/thirdparty/SDL/src/power/windows/SDL_syspower.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,7 +21,7 @@ #include "../../SDL_internal.h" #ifndef SDL_POWER_DISABLED -#if SDL_POWER_WINDOWS +#ifdef SDL_POWER_WINDOWS #include "../../core/windows/SDL_windows.h" diff --git a/thirdparty/SDL/src/power/winrt/SDL_syspower.cpp b/thirdparty/SDL/src/power/winrt/SDL_syspower.cpp index 2a46de7c9..1fc971fac 100644 --- a/thirdparty/SDL/src/power/winrt/SDL_syspower.cpp +++ b/thirdparty/SDL/src/power/winrt/SDL_syspower.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/render/SDL_d3dmath.c b/thirdparty/SDL/src/render/SDL_d3dmath.c index d1cac1388..021b8c2ee 100644 --- a/thirdparty/SDL/src/render/SDL_d3dmath.c +++ b/thirdparty/SDL/src/render/SDL_d3dmath.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../SDL_internal.h" -#if (SDL_VIDEO_RENDER_D3D || SDL_VIDEO_RENDER_D3D11 || SDL_VIDEO_RENDER_D3D12) && !SDL_RENDER_DISABLED +#if (SDL_VIDEO_RENDER_D3D || SDL_VIDEO_RENDER_D3D11 || SDL_VIDEO_RENDER_D3D12) #include "SDL_stdinc.h" #include "SDL_d3dmath.h" @@ -130,6 +130,6 @@ Float4X4 MatrixRotationZ(float r) return m; } -#endif /* (SDL_VIDEO_RENDER_D3D || SDL_VIDEO_RENDER_D3D11 || SDL_VIDEO_RENDER_D3D12) && !SDL_RENDER_DISABLED */ +#endif /* (SDL_VIDEO_RENDER_D3D || SDL_VIDEO_RENDER_D3D11 || SDL_VIDEO_RENDER_D3D12) */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/thirdparty/SDL/src/render/SDL_d3dmath.h b/thirdparty/SDL/src/render/SDL_d3dmath.h index 7383873c1..9ef2f53ed 100644 --- a/thirdparty/SDL/src/render/SDL_d3dmath.h +++ b/thirdparty/SDL/src/render/SDL_d3dmath.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../SDL_internal.h" -#if (SDL_VIDEO_RENDER_D3D || SDL_VIDEO_RENDER_D3D11 || SDL_VIDEO_RENDER_D3D12) && !SDL_RENDER_DISABLED +#if (SDL_VIDEO_RENDER_D3D || SDL_VIDEO_RENDER_D3D11 || SDL_VIDEO_RENDER_D3D12) /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus @@ -78,6 +78,6 @@ Float4X4 MatrixRotationZ(float r); } #endif -#endif /* (SDL_VIDEO_RENDER_D3D || SDL_VIDEO_RENDER_D3D11 || SDL_VIDEO_RENDER_D3D12) && !SDL_RENDER_DISABLED */ +#endif /* (SDL_VIDEO_RENDER_D3D || SDL_VIDEO_RENDER_D3D11 || SDL_VIDEO_RENDER_D3D12) */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/thirdparty/SDL/src/render/SDL_render.c b/thirdparty/SDL/src/render/SDL_render.c index b650c6ac4..f7fcc52c9 100644 --- a/thirdparty/SDL/src/render/SDL_render.c +++ b/thirdparty/SDL/src/render/SDL_render.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -89,7 +89,7 @@ this should probably be removed at some point in the future. --ryan. */ SDL_COMPOSE_BLENDMODE(SDL_BLENDFACTOR_DST_COLOR, SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA, SDL_BLENDOPERATION_ADD, \ SDL_BLENDFACTOR_ZERO, SDL_BLENDFACTOR_ONE, SDL_BLENDOPERATION_ADD) -#if !SDL_RENDER_DISABLED +#ifndef SDL_RENDER_DISABLED static const SDL_RenderDriver *render_drivers[] = { #if SDL_VIDEO_RENDER_D3D &D3D_RenderDriver, @@ -239,7 +239,7 @@ static int FlushRenderCommands(SDL_Renderer *renderer) SDL_assert((renderer->render_commands == NULL) == (renderer->render_commands_tail == NULL)); - if (renderer->render_commands == NULL) { /* nothing to do! */ + if (!renderer->render_commands) { /* nothing to do! */ SDL_assert(renderer->vertex_data_used == 0); return 0; } @@ -249,7 +249,7 @@ static int FlushRenderCommands(SDL_Renderer *renderer) retval = renderer->RunCommandQueue(renderer, renderer->render_commands, renderer->vertex_data, renderer->vertex_data_used); /* Move the whole render command queue to the unused pool so we can reuse them next time. */ - if (renderer->render_commands_tail != NULL) { + if (renderer->render_commands_tail) { renderer->render_commands_tail->next = renderer->render_commands_pool; renderer->render_commands_pool = renderer->render_commands; renderer->render_commands_tail = NULL; @@ -301,7 +301,7 @@ void *SDL_AllocateRenderVertices(SDL_Renderer *renderer, const size_t numbytes, ptr = SDL_realloc(renderer->vertex_data, newsize); - if (ptr == NULL) { + if (!ptr) { SDL_OutOfMemory(); return NULL; } @@ -324,19 +324,19 @@ static SDL_RenderCommand *AllocateRenderCommand(SDL_Renderer *renderer) /* !!! FIXME: are there threading limitations in SDL's render API? If not, we need to mutex this. */ retval = renderer->render_commands_pool; - if (retval != NULL) { + if (retval) { renderer->render_commands_pool = retval->next; retval->next = NULL; } else { retval = SDL_calloc(1, sizeof(*retval)); - if (retval == NULL) { + if (!retval) { SDL_OutOfMemory(); return NULL; } } SDL_assert((renderer->render_commands == NULL) == (renderer->render_commands_tail == NULL)); - if (renderer->render_commands_tail != NULL) { + if (renderer->render_commands_tail) { renderer->render_commands_tail->next = retval; } else { renderer->render_commands = retval; @@ -352,7 +352,7 @@ static int QueueCmdSetViewport(SDL_Renderer *renderer) if (!renderer->viewport_queued || (SDL_memcmp(&renderer->viewport, &renderer->last_queued_viewport, sizeof(SDL_DRect)) != 0)) { SDL_RenderCommand *cmd = AllocateRenderCommand(renderer); retval = -1; - if (cmd != NULL) { + if (cmd) { cmd->command = SDL_RENDERCMD_SETVIEWPORT; cmd->data.viewport.first = 0; /* render backend will fill this in. */ /* Convert SDL_DRect to SDL_Rect */ @@ -379,7 +379,7 @@ static int QueueCmdSetClipRect(SDL_Renderer *renderer) (renderer->clipping_enabled != renderer->last_queued_cliprect_enabled) || (SDL_memcmp(&renderer->clip_rect, &renderer->last_queued_cliprect, sizeof(SDL_DRect)) != 0)) { SDL_RenderCommand *cmd = AllocateRenderCommand(renderer); - if (cmd == NULL) { + if (!cmd) { retval = -1; } else { cmd->command = SDL_RENDERCMD_SETCLIPRECT; @@ -406,7 +406,7 @@ static int QueueCmdSetDrawColor(SDL_Renderer *renderer, SDL_Color *col) SDL_RenderCommand *cmd = AllocateRenderCommand(renderer); retval = -1; - if (cmd != NULL) { + if (cmd) { cmd->command = SDL_RENDERCMD_SETDRAWCOLOR; cmd->data.color.first = 0; /* render backend will fill this in. */ cmd->data.color.r = col->r; @@ -428,7 +428,7 @@ static int QueueCmdSetDrawColor(SDL_Renderer *renderer, SDL_Color *col) static int QueueCmdClear(SDL_Renderer *renderer) { SDL_RenderCommand *cmd = AllocateRenderCommand(renderer); - if (cmd == NULL) { + if (!cmd) { return -1; } @@ -472,7 +472,7 @@ static SDL_RenderCommand *PrepQueueCmdDraw(SDL_Renderer *renderer, const SDL_Ren if (retval == 0) { cmd = AllocateRenderCommand(renderer); - if (cmd != NULL) { + if (cmd) { cmd->command = cmdtype; cmd->data.draw.first = 0; /* render backend will fill this in. */ cmd->data.draw.count = 0; /* render backend will fill this in. */ @@ -491,7 +491,7 @@ static int QueueCmdDrawPoints(SDL_Renderer *renderer, const SDL_FPoint *points, { SDL_RenderCommand *cmd = PrepQueueCmdDraw(renderer, SDL_RENDERCMD_DRAW_POINTS, NULL); int retval = -1; - if (cmd != NULL) { + if (cmd) { retval = renderer->QueueDrawPoints(renderer, cmd, points, count); if (retval < 0) { cmd->command = SDL_RENDERCMD_NO_OP; @@ -504,7 +504,7 @@ static int QueueCmdDrawLines(SDL_Renderer *renderer, const SDL_FPoint *points, c { SDL_RenderCommand *cmd = PrepQueueCmdDraw(renderer, SDL_RENDERCMD_DRAW_LINES, NULL); int retval = -1; - if (cmd != NULL) { + if (cmd) { retval = renderer->QueueDrawLines(renderer, cmd, points, count); if (retval < 0) { cmd->command = SDL_RENDERCMD_NO_OP; @@ -517,11 +517,11 @@ static int QueueCmdFillRects(SDL_Renderer *renderer, const SDL_FRect *rects, con { SDL_RenderCommand *cmd; int retval = -1; - const int use_rendergeometry = (renderer->QueueFillRects == NULL); + const int use_rendergeometry = (!renderer->QueueFillRects); cmd = PrepQueueCmdDraw(renderer, (use_rendergeometry ? SDL_RENDERCMD_GEOMETRY : SDL_RENDERCMD_FILL_RECTS), NULL); - if (cmd != NULL) { + if (cmd) { if (use_rendergeometry) { SDL_bool isstack1; SDL_bool isstack2; @@ -591,7 +591,7 @@ static int QueueCmdCopy(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_ { SDL_RenderCommand *cmd = PrepQueueCmdDraw(renderer, SDL_RENDERCMD_COPY, texture); int retval = -1; - if (cmd != NULL) { + if (cmd) { retval = renderer->QueueCopy(renderer, cmd, texture, srcrect, dstrect); if (retval < 0) { cmd->command = SDL_RENDERCMD_NO_OP; @@ -606,7 +606,7 @@ static int QueueCmdCopyEx(SDL_Renderer *renderer, SDL_Texture *texture, { SDL_RenderCommand *cmd = PrepQueueCmdDraw(renderer, SDL_RENDERCMD_COPY_EX, texture); int retval = -1; - if (cmd != NULL) { + if (cmd) { retval = renderer->QueueCopyEx(renderer, cmd, texture, srcquad, dstrect, angle, center, flip, scale_x, scale_y); if (retval < 0) { cmd->command = SDL_RENDERCMD_NO_OP; @@ -626,7 +626,7 @@ static int QueueCmdGeometry(SDL_Renderer *renderer, SDL_Texture *texture, SDL_RenderCommand *cmd; int retval = -1; cmd = PrepQueueCmdDraw(renderer, SDL_RENDERCMD_GEOMETRY, texture); - if (cmd != NULL) { + if (cmd) { retval = renderer->QueueGeometry(renderer, cmd, texture, xy, xy_stride, color, color_stride, uv, uv_stride, @@ -643,7 +643,7 @@ static int UpdateLogicalSize(SDL_Renderer *renderer, SDL_bool flush_viewport_cmd int SDL_GetNumRenderDrivers(void) { -#if !SDL_RENDER_DISABLED +#ifndef SDL_RENDER_DISABLED return SDL_arraysize(render_drivers); #else return 0; @@ -652,7 +652,7 @@ int SDL_GetNumRenderDrivers(void) int SDL_GetRenderDriverInfo(int index, SDL_RendererInfo *info) { -#if !SDL_RENDER_DISABLED +#ifndef SDL_RENDER_DISABLED if (index < 0 || index >= SDL_GetNumRenderDrivers()) { return SDL_SetError("index must be in the range of 0 - %d", SDL_GetNumRenderDrivers() - 1); @@ -799,6 +799,20 @@ static int SDLCALL SDL_RendererEventWatch(void *userdata, SDL_Event *event) event->button.y = (int)(event->button.y / (scale.y * renderer->dpi_scale.y)); } } + } else if (event->type == SDL_MOUSEWHEEL) { + SDL_Window *window = SDL_GetWindowFromID(event->wheel.windowID); + if (window == renderer->window) { + int logical_w, logical_h; + SDL_DRect viewport; + SDL_FPoint scale; + GetWindowViewportValues(renderer, &logical_w, &logical_h, &viewport, &scale); + if (logical_w) { + event->wheel.mouseX -= (int)(viewport.x * renderer->dpi_scale.x); + event->wheel.mouseY -= (int)(viewport.y * renderer->dpi_scale.y); + event->wheel.mouseX = (int)(event->wheel.mouseX / (scale.x * renderer->dpi_scale.x)); + event->wheel.mouseY = (int)(event->wheel.mouseY / (scale.y * renderer->dpi_scale.y)); + } + } } else if (event->type == SDL_FINGERDOWN || event->type == SDL_FINGERUP || event->type == SDL_FINGERMOTION) { @@ -878,7 +892,7 @@ int SDL_CreateWindowAndRenderer(int width, int height, Uint32 window_flags, return 0; } -#if !SDL_RENDER_DISABLED +#ifndef SDL_RENDER_DISABLED static SDL_INLINE void VerifyDrawQueueFunctions(const SDL_Renderer *renderer) { /* all of these functions are required to be implemented, even as no-ops, so we don't @@ -892,7 +906,7 @@ static SDL_INLINE void VerifyDrawQueueFunctions(const SDL_Renderer *renderer) SDL_assert(renderer->RunCommandQueue != NULL); } -static SDL_RenderLineMethod SDL_GetRenderLineMethod() +static SDL_RenderLineMethod SDL_GetRenderLineMethod(void) { const char *hint = SDL_GetHint(SDL_HINT_RENDER_LINE_METHOD); @@ -935,7 +949,7 @@ static void SDL_CalculateSimulatedVSyncInterval(SDL_Renderer *renderer, SDL_Wind SDL_Renderer *SDL_CreateRenderer(SDL_Window *window, int index, Uint32 flags) { -#if !SDL_RENDER_DISABLED +#ifndef SDL_RENDER_DISABLED SDL_Renderer *renderer = NULL; int n = SDL_GetNumRenderDrivers(); SDL_bool batching = SDL_TRUE; @@ -945,7 +959,7 @@ SDL_Renderer *SDL_CreateRenderer(SDL_Window *window, int index, Uint32 flags) Android_ActivityMutex_Lock_Running(); #endif - if (window == NULL) { + if (!window) { SDL_InvalidParamError("window"); goto error; } @@ -986,7 +1000,7 @@ SDL_Renderer *SDL_CreateRenderer(SDL_Window *window, int index, Uint32 flags) } } - if (renderer == NULL) { + if (!renderer) { for (index = 0; index < n; ++index) { const SDL_RenderDriver *driver = render_drivers[index]; @@ -1000,7 +1014,7 @@ SDL_Renderer *SDL_CreateRenderer(SDL_Window *window, int index, Uint32 flags) } } } - if (renderer == NULL) { + if (!renderer) { SDL_SetError("Couldn't find matching render driver"); goto error; } @@ -1013,7 +1027,7 @@ SDL_Renderer *SDL_CreateRenderer(SDL_Window *window, int index, Uint32 flags) /* Create a new renderer instance */ renderer = render_drivers[index]->CreateRenderer(window, flags); batching = SDL_FALSE; - if (renderer == NULL) { + if (!renderer) { goto error; } } @@ -1108,7 +1122,7 @@ SDL_Renderer *SDL_CreateRenderer(SDL_Window *window, int index, Uint32 flags) SDL_Renderer *SDL_CreateSoftwareRenderer(SDL_Surface *surface) { -#if !SDL_RENDER_DISABLED && SDL_VIDEO_RENDER_SW +#if SDL_VIDEO_RENDER_SW SDL_Renderer *renderer; renderer = SW_CreateRendererForSurface(surface); @@ -1228,7 +1242,7 @@ static SDL_ScaleMode SDL_GetScaleMode(void) { const char *hint = SDL_GetHint(SDL_HINT_RENDER_SCALE_QUALITY); - if (hint == NULL || SDL_strcasecmp(hint, "nearest") == 0) { + if (!hint || SDL_strcasecmp(hint, "nearest") == 0) { return SDL_ScaleModeNearest; } else if (SDL_strcasecmp(hint, "linear") == 0) { return SDL_ScaleModeLinear; @@ -1269,7 +1283,7 @@ SDL_Texture *SDL_CreateTexture(SDL_Renderer *renderer, Uint32 format, int access return NULL; } texture = (SDL_Texture *)SDL_calloc(1, sizeof(*texture)); - if (texture == NULL) { + if (!texture) { SDL_OutOfMemory(); return NULL; } @@ -1360,7 +1374,7 @@ SDL_Texture *SDL_CreateTextureFromSurface(SDL_Renderer *renderer, SDL_Surface *s CHECK_RENDERER_MAGIC(renderer, NULL); - if (surface == NULL) { + if (!surface) { SDL_InvalidParamError("SDL_CreateTextureFromSurface(): surface"); return NULL; } @@ -1424,7 +1438,7 @@ SDL_Texture *SDL_CreateTextureFromSurface(SDL_Renderer *renderer, SDL_Surface *s texture = SDL_CreateTexture(renderer, format, SDL_TEXTUREACCESS_STATIC, surface->w, surface->h); - if (texture == NULL) { + if (!texture) { return NULL; } @@ -1468,7 +1482,7 @@ SDL_Texture *SDL_CreateTextureFromSurface(SDL_Renderer *renderer, SDL_Surface *s /* Set up a destination surface for the texture update */ dst_fmt = SDL_AllocFormat(format); - if (dst_fmt == NULL) { + if (!dst_fmt) { SDL_DestroyTexture(texture); return NULL; } @@ -1687,7 +1701,7 @@ static int SDL_UpdateTextureYUV(SDL_Texture *texture, const SDL_Rect *rect, const size_t alloclen = (size_t)rect->h * temp_pitch; if (alloclen > 0) { void *temp_pixels = SDL_malloc(alloclen); - if (temp_pixels == NULL) { + if (!temp_pixels) { return SDL_OutOfMemory(); } SDL_SW_CopyYUVToRGB(texture->yuv, rect, native->format, @@ -1727,7 +1741,7 @@ static int SDL_UpdateTextureNative(SDL_Texture *texture, const SDL_Rect *rect, const size_t alloclen = (size_t)rect->h * temp_pitch; if (alloclen > 0) { void *temp_pixels = SDL_malloc(alloclen); - if (temp_pixels == NULL) { + if (!temp_pixels) { return SDL_OutOfMemory(); } SDL_ConvertPixels(rect->w, rect->h, @@ -1747,7 +1761,7 @@ int SDL_UpdateTexture(SDL_Texture *texture, const SDL_Rect *rect, CHECK_TEXTURE_MAGIC(texture, -1); - if (pixels == NULL) { + if (!pixels) { return SDL_InvalidParamError("pixels"); } if (!pitch) { @@ -1821,7 +1835,7 @@ static int SDL_UpdateTextureYUVPlanar(SDL_Texture *texture, const SDL_Rect *rect const size_t alloclen = (size_t)rect->h * temp_pitch; if (alloclen > 0) { void *temp_pixels = SDL_malloc(alloclen); - if (temp_pixels == NULL) { + if (!temp_pixels) { return SDL_OutOfMemory(); } SDL_SW_CopyYUVToRGB(texture->yuv, rect, native->format, @@ -1871,7 +1885,7 @@ static int SDL_UpdateTextureNVPlanar(SDL_Texture *texture, const SDL_Rect *rect, const size_t alloclen = (size_t)rect->h * temp_pitch; if (alloclen > 0) { void *temp_pixels = SDL_malloc(alloclen); - if (temp_pixels == NULL) { + if (!temp_pixels) { return SDL_OutOfMemory(); } SDL_SW_CopyYUVToRGB(texture->yuv, rect, native->format, @@ -1896,19 +1910,19 @@ int SDL_UpdateYUVTexture(SDL_Texture *texture, const SDL_Rect *rect, CHECK_TEXTURE_MAGIC(texture, -1); - if (Yplane == NULL) { + if (!Yplane) { return SDL_InvalidParamError("Yplane"); } if (!Ypitch) { return SDL_InvalidParamError("Ypitch"); } - if (Uplane == NULL) { + if (!Uplane) { return SDL_InvalidParamError("Uplane"); } if (!Upitch) { return SDL_InvalidParamError("Upitch"); } - if (Vplane == NULL) { + if (!Vplane) { return SDL_InvalidParamError("Vplane"); } if (!Vpitch) { @@ -1962,13 +1976,13 @@ int SDL_UpdateNVTexture(SDL_Texture *texture, const SDL_Rect *rect, CHECK_TEXTURE_MAGIC(texture, -1); - if (Yplane == NULL) { + if (!Yplane) { return SDL_InvalidParamError("Yplane"); } if (!Ypitch) { return SDL_InvalidParamError("Ypitch"); } - if (UVplane == NULL) { + if (!UVplane) { return SDL_InvalidParamError("UVplane"); } if (!UVpitch) { @@ -2042,7 +2056,7 @@ int SDL_LockTexture(SDL_Texture *texture, const SDL_Rect *rect, return SDL_SetError("SDL_LockTexture(): texture must be streaming"); } - if (rect == NULL) { + if (!rect) { full_rect.x = 0; full_rect.y = 0; full_rect.w = texture->w; @@ -2078,7 +2092,7 @@ int SDL_LockTextureToSurface(SDL_Texture *texture, const SDL_Rect *rect, int pitch = 0; /* fix static analysis */ int ret; - if (texture == NULL || surface == NULL) { + if (!texture || !surface) { return -1; } @@ -2096,7 +2110,7 @@ int SDL_LockTextureToSurface(SDL_Texture *texture, const SDL_Rect *rect, } texture->locked_surface = SDL_CreateRGBSurfaceWithFormatFrom(pixels, real_rect.w, real_rect.h, 0, pitch, texture->format); - if (texture->locked_surface == NULL) { + if (!texture->locked_surface) { SDL_UnlockTexture(texture); return -1; } @@ -2172,7 +2186,7 @@ void SDL_UnlockTexture(SDL_Texture *texture) SDL_bool SDL_RenderTargetSupported(SDL_Renderer *renderer) { - if (renderer == NULL || !renderer->SetRenderTarget) { + if (!renderer || !renderer->SetRenderTarget) { return SDL_FALSE; } return (renderer->info.flags & SDL_RENDERER_TARGETTEXTURE) != 0; @@ -2660,7 +2674,7 @@ static int RenderDrawPointsWithRects(SDL_Renderer *renderer, } frects = SDL_small_alloc(SDL_FRect, count, &isstack); - if (frects == NULL) { + if (!frects) { return SDL_OutOfMemory(); } @@ -2688,7 +2702,7 @@ int SDL_RenderDrawPoints(SDL_Renderer *renderer, CHECK_RENDERER_MAGIC(renderer, -1); - if (points == NULL) { + if (!points) { return SDL_InvalidParamError("SDL_RenderDrawPoints(): points"); } if (count < 1) { @@ -2706,7 +2720,7 @@ int SDL_RenderDrawPoints(SDL_Renderer *renderer, retval = RenderDrawPointsWithRects(renderer, points, count); } else { fpoints = SDL_small_alloc(SDL_FPoint, count, &isstack); - if (fpoints == NULL) { + if (!fpoints) { return SDL_OutOfMemory(); } for (i = 0; i < count; ++i) { @@ -2734,7 +2748,7 @@ static int RenderDrawPointsWithRectsF(SDL_Renderer *renderer, } frects = SDL_small_alloc(SDL_FRect, count, &isstack); - if (frects == NULL) { + if (!frects) { return SDL_OutOfMemory(); } @@ -2759,7 +2773,7 @@ int SDL_RenderDrawPointsF(SDL_Renderer *renderer, CHECK_RENDERER_MAGIC(renderer, -1); - if (points == NULL) { + if (!points) { return SDL_InvalidParamError("SDL_RenderDrawPointsF(): points"); } if (count < 1) { @@ -2810,6 +2824,18 @@ static int RenderDrawLineBresenham(SDL_Renderer *renderer, int x1, int y1, int x int retval; SDL_bool isstack; SDL_FPoint *points; + SDL_Rect clip_rect; + + /* the backend might clip this further to the clipping rect, but we + just want a basic safety against generating millions of points for + massive lines. */ + clip_rect.x = 0; + clip_rect.y = 0; + clip_rect.w = (int) renderer->viewport.w; + clip_rect.h = (int) renderer->viewport.h; + if (!SDL_IntersectRectAndLine(&clip_rect, &x1, &y1, &x2, &y2)) { + return 0; + } deltax = SDL_abs(x2 - x1); deltay = SDL_abs(y2 - y1); @@ -2851,7 +2877,7 @@ static int RenderDrawLineBresenham(SDL_Renderer *renderer, int x1, int y1, int x } points = SDL_small_alloc(SDL_FPoint, numpixels, &isstack); - if (points == NULL) { + if (!points) { return SDL_OutOfMemory(); } for (i = 0; i < numpixels; ++i) { @@ -2894,7 +2920,7 @@ static int RenderDrawLinesWithRectsF(SDL_Renderer *renderer, SDL_bool draw_last = SDL_FALSE; frects = SDL_small_alloc(SDL_FRect, count - 1, &isstack); - if (frects == NULL) { + if (!frects) { return SDL_OutOfMemory(); } @@ -2964,7 +2990,7 @@ int SDL_RenderDrawLines(SDL_Renderer *renderer, CHECK_RENDERER_MAGIC(renderer, -1); - if (points == NULL) { + if (!points) { return SDL_InvalidParamError("SDL_RenderDrawLines(): points"); } if (count < 2) { @@ -2979,7 +3005,7 @@ int SDL_RenderDrawLines(SDL_Renderer *renderer, #endif fpoints = SDL_small_alloc(SDL_FPoint, count, &isstack); - if (fpoints == NULL) { + if (!fpoints) { return SDL_OutOfMemory(); } @@ -3002,7 +3028,7 @@ int SDL_RenderDrawLinesF(SDL_Renderer *renderer, CHECK_RENDERER_MAGIC(renderer, -1); - if (points == NULL) { + if (!points) { return SDL_InvalidParamError("SDL_RenderDrawLinesF(): points"); } if (count < 2) { @@ -3171,7 +3197,7 @@ int SDL_RenderDrawRectF(SDL_Renderer *renderer, const SDL_FRect *rect) CHECK_RENDERER_MAGIC(renderer, -1); /* If 'rect' == NULL, then outline the whole surface */ - if (rect == NULL) { + if (!rect) { RenderGetViewportSize(renderer, &frect); rect = &frect; } @@ -3196,7 +3222,7 @@ int SDL_RenderDrawRects(SDL_Renderer *renderer, CHECK_RENDERER_MAGIC(renderer, -1); - if (rects == NULL) { + if (!rects) { return SDL_InvalidParamError("SDL_RenderDrawRects(): rects"); } if (count < 1) { @@ -3225,7 +3251,7 @@ int SDL_RenderDrawRectsF(SDL_Renderer *renderer, CHECK_RENDERER_MAGIC(renderer, -1); - if (rects == NULL) { + if (!rects) { return SDL_InvalidParamError("SDL_RenderDrawRectsF(): rects"); } if (count < 1) { @@ -3272,7 +3298,7 @@ int SDL_RenderFillRectF(SDL_Renderer *renderer, const SDL_FRect *rect) CHECK_RENDERER_MAGIC(renderer, -1); /* If 'rect' == NULL, then outline the whole surface */ - if (rect == NULL) { + if (!rect) { RenderGetViewportSize(renderer, &frect); rect = &frect; } @@ -3289,7 +3315,7 @@ int SDL_RenderFillRects(SDL_Renderer *renderer, CHECK_RENDERER_MAGIC(renderer, -1); - if (rects == NULL) { + if (!rects) { return SDL_InvalidParamError("SDL_RenderFillRects(): rects"); } if (count < 1) { @@ -3304,7 +3330,7 @@ int SDL_RenderFillRects(SDL_Renderer *renderer, #endif frects = SDL_small_alloc(SDL_FRect, count, &isstack); - if (frects == NULL) { + if (!frects) { return SDL_OutOfMemory(); } for (i = 0; i < count; ++i) { @@ -3331,7 +3357,7 @@ int SDL_RenderFillRectsF(SDL_Renderer *renderer, CHECK_RENDERER_MAGIC(renderer, -1); - if (rects == NULL) { + if (!rects) { return SDL_InvalidParamError("SDL_RenderFillRectsF(): rects"); } if (count < 1) { @@ -3346,7 +3372,7 @@ int SDL_RenderFillRectsF(SDL_Renderer *renderer, #endif frects = SDL_small_alloc(SDL_FRect, count, &isstack); - if (frects == NULL) { + if (!frects) { return SDL_OutOfMemory(); } for (i = 0; i < count; ++i) { @@ -3400,7 +3426,7 @@ int SDL_RenderCopyF(SDL_Renderer *renderer, SDL_Texture *texture, } #endif - use_rendergeometry = (renderer->QueueCopy == NULL); + use_rendergeometry = (!renderer->QueueCopy); real_srcrect.x = 0; real_srcrect.y = 0; @@ -3540,7 +3566,7 @@ int SDL_RenderCopyExF(SDL_Renderer *renderer, SDL_Texture *texture, } #endif - use_rendergeometry = (renderer->QueueCopyEx == NULL); + use_rendergeometry = (!renderer->QueueCopyEx); real_srcrect.x = 0; real_srcrect.y = 0; @@ -4071,15 +4097,15 @@ int SDL_RenderGeometryRaw(SDL_Renderer *renderer, } } - if (xy == NULL) { + if (!xy) { return SDL_InvalidParamError("xy"); } - if (color == NULL) { + if (!color) { return SDL_InvalidParamError("color"); } - if (texture && uv == NULL) { + if (texture && !uv) { return SDL_InvalidParamError("uv"); } @@ -4171,7 +4197,7 @@ int SDL_RenderReadPixels(SDL_Renderer *renderer, const SDL_Rect *rect, FlushRenderCommands(renderer); /* we need to render before we read the results. */ if (!format) { - if (renderer->target == NULL) { + if (!renderer->target) { format = SDL_GetWindowPixelFormat(renderer->window); } else { format = renderer->target->format; @@ -4300,7 +4326,7 @@ void SDL_DestroyRenderer(SDL_Renderer *renderer) SDL_DelEventWatch(SDL_RendererEventWatch, renderer); - if (renderer->render_commands_tail != NULL) { + if (renderer->render_commands_tail) { renderer->render_commands_tail->next = renderer->render_commands_pool; cmd = renderer->render_commands; } else { @@ -4311,7 +4337,7 @@ void SDL_DestroyRenderer(SDL_Renderer *renderer) renderer->render_commands_tail = NULL; renderer->render_commands = NULL; - while (cmd != NULL) { + while (cmd) { SDL_RenderCommand *next = cmd->next; SDL_free(cmd); cmd = next; diff --git a/thirdparty/SDL/src/render/SDL_sysrender.h b/thirdparty/SDL/src/render/SDL_sysrender.h index 36e9555bb..a4eef4d7d 100644 --- a/thirdparty/SDL/src/render/SDL_sysrender.h +++ b/thirdparty/SDL/src/render/SDL_sysrender.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/render/SDL_yuv_sw.c b/thirdparty/SDL/src/render/SDL_yuv_sw.c index c4385e288..903279b3d 100644 --- a/thirdparty/SDL/src/render/SDL_yuv_sw.c +++ b/thirdparty/SDL/src/render/SDL_yuv_sw.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -47,7 +47,7 @@ SDL_SW_YUVTexture *SDL_SW_CreateYUVTexture(Uint32 format, int w, int h) } swdata = (SDL_SW_YUVTexture *)SDL_calloc(1, sizeof(*swdata)); - if (swdata == NULL) { + if (!swdata) { SDL_OutOfMemory(); return NULL; } diff --git a/thirdparty/SDL/src/render/SDL_yuv_sw_c.h b/thirdparty/SDL/src/render/SDL_yuv_sw_c.h index 8b7b0ba00..c123c5169 100644 --- a/thirdparty/SDL/src/render/SDL_yuv_sw_c.h +++ b/thirdparty/SDL/src/render/SDL_yuv_sw_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/render/direct3d/SDL_render_d3d.c b/thirdparty/SDL/src/render/direct3d/SDL_render_d3d.c index 5470a7d40..2a54c6147 100644 --- a/thirdparty/SDL/src/render/direct3d/SDL_render_d3d.c +++ b/thirdparty/SDL/src/render/direct3d/SDL_render_d3d.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -23,7 +23,7 @@ #include "SDL_render.h" #include "SDL_system.h" -#if SDL_VIDEO_RENDER_D3D && !SDL_RENDER_DISABLED +#if SDL_VIDEO_RENDER_D3D #include "../../core/windows/SDL_windows.h" @@ -443,7 +443,7 @@ static int D3D_CreateStagingTexture(IDirect3DDevice9 *device, D3D_TextureRep *te { HRESULT result; - if (texture->staging == NULL) { + if (!texture->staging) { result = IDirect3DDevice9_CreateTexture(device, texture->w, texture->h, 1, 0, texture->d3dfmt, D3DPOOL_SYSTEMMEM, &texture->staging, NULL); if (FAILED(result)) { @@ -535,7 +535,7 @@ static int D3D_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture) DWORD usage; texturedata = (D3D_TextureData *)SDL_calloc(1, sizeof(*texturedata)); - if (texturedata == NULL) { + if (!texturedata) { return SDL_OutOfMemory(); } texturedata->scaleMode = (texture->scaleMode == SDL_ScaleModeNearest) ? D3DTEXF_POINT : D3DTEXF_LINEAR; @@ -573,7 +573,7 @@ static int D3D_RecreateTexture(SDL_Renderer *renderer, SDL_Texture *texture) D3D_RenderData *data = (D3D_RenderData *)renderer->driverdata; D3D_TextureData *texturedata = (D3D_TextureData *)texture->driverdata; - if (texturedata == NULL) { + if (!texturedata) { return 0; } @@ -600,7 +600,7 @@ static int D3D_UpdateTexture(SDL_Renderer *renderer, SDL_Texture *texture, D3D_RenderData *data = (D3D_RenderData *)renderer->driverdata; D3D_TextureData *texturedata = (D3D_TextureData *)texture->driverdata; - if (texturedata == NULL) { + if (!texturedata) { return SDL_SetError("Texture is not currently available"); } @@ -636,7 +636,7 @@ static int D3D_UpdateTextureYUV(SDL_Renderer *renderer, SDL_Texture *texture, D3D_RenderData *data = (D3D_RenderData *)renderer->driverdata; D3D_TextureData *texturedata = (D3D_TextureData *)texture->driverdata; - if (texturedata == NULL) { + if (!texturedata) { return SDL_SetError("Texture is not currently available"); } @@ -660,7 +660,7 @@ static int D3D_LockTexture(SDL_Renderer *renderer, SDL_Texture *texture, D3D_TextureData *texturedata = (D3D_TextureData *)texture->driverdata; IDirect3DDevice9 *device = data->device; - if (texturedata == NULL) { + if (!texturedata) { return SDL_SetError("Texture is not currently available"); } #if SDL_HAVE_YUV @@ -710,7 +710,7 @@ static void D3D_UnlockTexture(SDL_Renderer *renderer, SDL_Texture *texture) D3D_RenderData *data = (D3D_RenderData *)renderer->driverdata; D3D_TextureData *texturedata = (D3D_TextureData *)texture->driverdata; - if (texturedata == NULL) { + if (!texturedata) { return; } #if SDL_HAVE_YUV @@ -738,7 +738,7 @@ static void D3D_SetTextureScaleMode(SDL_Renderer *renderer, SDL_Texture *texture { D3D_TextureData *texturedata = (D3D_TextureData *)texture->driverdata; - if (texturedata == NULL) { + if (!texturedata) { return; } @@ -754,18 +754,18 @@ static int D3D_SetRenderTargetInternal(SDL_Renderer *renderer, SDL_Texture *text IDirect3DDevice9 *device = data->device; /* Release the previous render target if it wasn't the default one */ - if (data->currentRenderTarget != NULL) { + if (data->currentRenderTarget) { IDirect3DSurface9_Release(data->currentRenderTarget); data->currentRenderTarget = NULL; } - if (texture == NULL) { + if (!texture) { IDirect3DDevice9_SetRenderTarget(data->device, 0, data->defaultRenderTarget); return 0; } texturedata = (D3D_TextureData *)texture->driverdata; - if (texturedata == NULL) { + if (!texturedata) { return SDL_SetError("Texture is not currently available"); } @@ -820,7 +820,7 @@ static int D3D_QueueDrawPoints(SDL_Renderer *renderer, SDL_RenderCommand *cmd, c Vertex *verts = (Vertex *)SDL_AllocateRenderVertices(renderer, vertslen, 0, &cmd->data.draw.first); int i; - if (verts == NULL) { + if (!verts) { return -1; } @@ -845,7 +845,7 @@ static int D3D_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL int count = indices ? num_indices : num_vertices; Vertex *verts = (Vertex *)SDL_AllocateRenderVertices(renderer, count * sizeof(Vertex), 0, &cmd->data.draw.first); - if (verts == NULL) { + if (!verts) { return -1; } @@ -941,7 +941,7 @@ static int SetupTextureState(D3D_RenderData *data, SDL_Texture *texture, LPDIREC SDL_assert(*shader == NULL); - if (texturedata == NULL) { + if (!texturedata) { return SDL_SetError("Texture is not currently available"); } @@ -993,11 +993,11 @@ static int SetDrawState(D3D_RenderData *data, const SDL_RenderCommand *cmd) LPDIRECT3DPIXELSHADER9 shader = NULL; /* disable any enabled textures we aren't going to use, let SetupTextureState() do the rest. */ - if (texture == NULL) { + if (!texture) { IDirect3DDevice9_SetTexture(data->device, 0, NULL); } #if SDL_HAVE_YUV - if ((newtexturedata == NULL || !newtexturedata->yuv) && (oldtexturedata && oldtexturedata->yuv)) { + if ((!newtexturedata || !newtexturedata->yuv) && (oldtexturedata && oldtexturedata->yuv)) { IDirect3DDevice9_SetTexture(data->device, 1, NULL); IDirect3DDevice9_SetTexture(data->device, 2, NULL); } @@ -1170,6 +1170,7 @@ static int D3D_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd, v if (SDL_memcmp(viewport, &cmd->data.viewport.rect, sizeof(cmd->data.viewport.rect)) != 0) { SDL_copyp(viewport, &cmd->data.viewport.rect); data->drawstate.viewport_dirty = SDL_TRUE; + data->drawstate.cliprect_dirty = SDL_TRUE; } break; } @@ -1391,7 +1392,7 @@ static void D3D_DestroyTexture(SDL_Renderer *renderer, SDL_Texture *texture) #endif } - if (data == NULL) { + if (!data) { return; } @@ -1417,7 +1418,7 @@ static void D3D_DestroyRenderer(SDL_Renderer *renderer) IDirect3DSurface9_Release(data->defaultRenderTarget); data->defaultRenderTarget = NULL; } - if (data->currentRenderTarget != NULL) { + if (data->currentRenderTarget) { IDirect3DSurface9_Release(data->currentRenderTarget); data->currentRenderTarget = NULL; } @@ -1468,7 +1469,7 @@ static int D3D_Reset(SDL_Renderer *renderer) IDirect3DSurface9_Release(data->defaultRenderTarget); data->defaultRenderTarget = NULL; } - if (data->currentRenderTarget != NULL) { + if (data->currentRenderTarget) { IDirect3DSurface9_Release(data->currentRenderTarget); data->currentRenderTarget = NULL; } @@ -1562,13 +1563,13 @@ SDL_Renderer *D3D_CreateRenderer(SDL_Window *window, Uint32 flags) int displayIndex; renderer = (SDL_Renderer *) SDL_calloc(1, sizeof(*renderer)); - if (renderer == NULL) { + if (!renderer) { SDL_OutOfMemory(); return NULL; } data = (D3D_RenderData *)SDL_calloc(1, sizeof(*data)); - if (data == NULL) { + if (!data) { SDL_free(renderer); SDL_OutOfMemory(); return NULL; @@ -1609,7 +1610,12 @@ SDL_Renderer *D3D_CreateRenderer(SDL_Window *window, Uint32 flags) renderer->driverdata = data; SDL_VERSION(&windowinfo.version); - SDL_GetWindowWMInfo(window, &windowinfo); + if (!SDL_GetWindowWMInfo(window, &windowinfo) || + windowinfo.subsystem != SDL_SYSWM_WINDOWS) { + SDL_free(data); + SDL_SetError("Couldn't get window handle"); + return NULL; + } window_flags = SDL_GetWindowFlags(window); SDL_GetWindowSizeInPixels(window, &w, &h); @@ -1731,7 +1737,7 @@ SDL_RenderDriver D3D_RenderDriver = { 0, 0 } }; -#endif /* SDL_VIDEO_RENDER_D3D && !SDL_RENDER_DISABLED */ +#endif /* SDL_VIDEO_RENDER_D3D */ #if defined(__WIN32__) || defined(__WINGDK__) /* This function needs to always exist on Windows, for the Dynamic API. */ @@ -1739,7 +1745,7 @@ IDirect3DDevice9 *SDL_RenderGetD3D9Device(SDL_Renderer *renderer) { IDirect3DDevice9 *device = NULL; -#if SDL_VIDEO_RENDER_D3D && !SDL_RENDER_DISABLED +#if SDL_VIDEO_RENDER_D3D D3D_RenderData *data = (D3D_RenderData *)renderer->driverdata; /* Make sure that this is a D3D renderer */ @@ -1752,7 +1758,7 @@ IDirect3DDevice9 *SDL_RenderGetD3D9Device(SDL_Renderer *renderer) if (device) { IDirect3DDevice9_AddRef(device); } -#endif /* SDL_VIDEO_RENDER_D3D && !SDL_RENDER_DISABLED */ +#endif /* SDL_VIDEO_RENDER_D3D */ return device; } diff --git a/thirdparty/SDL/src/render/direct3d/SDL_shaders_d3d.c b/thirdparty/SDL/src/render/direct3d/SDL_shaders_d3d.c index e8fd6ae73..2f55d80ca 100644 --- a/thirdparty/SDL/src/render/direct3d/SDL_shaders_d3d.c +++ b/thirdparty/SDL/src/render/direct3d/SDL_shaders_d3d.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -23,7 +23,7 @@ #include "SDL_render.h" #include "SDL_system.h" -#if SDL_VIDEO_RENDER_D3D && !SDL_RENDER_DISABLED +#if SDL_VIDEO_RENDER_D3D #include "../../core/windows/SDL_windows.h" @@ -268,6 +268,6 @@ HRESULT D3D9_CreatePixelShader(IDirect3DDevice9 *d3dDevice, D3D9_Shader shader, return IDirect3DDevice9_CreatePixelShader(d3dDevice, D3D9_shaders[shader], pixelShader); } -#endif /* SDL_VIDEO_RENDER_D3D && !SDL_RENDER_DISABLED */ +#endif /* SDL_VIDEO_RENDER_D3D */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/thirdparty/SDL/src/render/direct3d/SDL_shaders_d3d.h b/thirdparty/SDL/src/render/direct3d/SDL_shaders_d3d.h index 03b5634f6..89cd1ea60 100644 --- a/thirdparty/SDL/src/render/direct3d/SDL_shaders_d3d.h +++ b/thirdparty/SDL/src/render/direct3d/SDL_shaders_d3d.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/render/direct3d11/SDL_render_d3d11.c b/thirdparty/SDL/src/render/direct3d11/SDL_render_d3d11.c index 2d8ee3c0a..72b713d01 100644 --- a/thirdparty/SDL/src/render/direct3d11/SDL_render_d3d11.c +++ b/thirdparty/SDL/src/render/direct3d11/SDL_render_d3d11.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -23,7 +23,7 @@ #include "SDL_render.h" #include "SDL_system.h" -#if SDL_VIDEO_RENDER_D3D11 && !SDL_RENDER_DISABLED +#if SDL_VIDEO_RENDER_D3D11 #define COBJMACROS #include "../../core/windows/SDL_windows.h" @@ -385,7 +385,7 @@ static ID3D11BlendState *D3D11_CreateBlendState(SDL_Renderer *renderer, SDL_Blen } blendModes = (D3D11_BlendMode *)SDL_realloc(data->blendModes, (data->blendModesCount + 1) * sizeof(*blendModes)); - if (blendModes == NULL) { + if (!blendModes) { SAFE_RELEASE(blendState); SDL_OutOfMemory(); return NULL; @@ -442,7 +442,7 @@ static HRESULT D3D11_CreateDeviceResources(SDL_Renderer *renderer) } CreateDXGIFactoryFunc = (PFN_CREATE_DXGI_FACTORY)SDL_LoadFunction(data->hDXGIMod, "CreateDXGIFactory"); - if (CreateDXGIFactoryFunc == NULL) { + if (!CreateDXGIFactoryFunc) { result = E_FAIL; goto done; } @@ -740,7 +740,7 @@ static HRESULT D3D11_CreateSwapChain(SDL_Renderer *renderer, int w, int h) D3D11_RenderData *data = (D3D11_RenderData *)renderer->driverdata; #ifdef __WINRT__ IUnknown *coreWindow = D3D11_GetCoreWindowFromSDLRenderer(renderer); - const BOOL usingXAML = (coreWindow == NULL); + const BOOL usingXAML = (!coreWindow); #else IUnknown *coreWindow = NULL; const BOOL usingXAML = FALSE; @@ -758,7 +758,7 @@ static HRESULT D3D11_CreateSwapChain(SDL_Renderer *renderer, int w, int h) swapChainDesc.SampleDesc.Quality = 0; swapChainDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; swapChainDesc.BufferCount = 2; /* Use double-buffering to minimize latency. */ -#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP +#if SDL_WINAPI_FAMILY_PHONE swapChainDesc.Scaling = DXGI_SCALING_STRETCH; /* On phone, only stretch and aspect-ratio stretch scaling are allowed. */ swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD; /* On phone, no swap effects are supported. */ /* TODO, WinRT: see if Win 8.x DXGI_SWAP_CHAIN_DESC1 settings are available on Windows Phone 8.1, and if there's any advantage to having them on */ @@ -813,7 +813,12 @@ static HRESULT D3D11_CreateSwapChain(SDL_Renderer *renderer, int w, int h) #if defined(__WIN32__) || defined(__WINGDK__) SDL_SysWMinfo windowinfo; SDL_VERSION(&windowinfo.version); - SDL_GetWindowWMInfo(renderer->window, &windowinfo); + if (!SDL_GetWindowWMInfo(renderer->window, &windowinfo) || + windowinfo.subsystem != SDL_SYSWM_WINDOWS) { + SDL_SetError("Couldn't get window handle"); + result = E_FAIL; + goto done; + } result = IDXGIFactory2_CreateSwapChainForHwnd(data->dxgiFactory, (IUnknown *)data->d3dDevice, @@ -907,7 +912,7 @@ static HRESULT D3D11_CreateWindowSizeDependentResources(SDL_Renderer *renderer) if (data->swapChain) { /* IDXGISwapChain::ResizeBuffers is not available on Windows Phone 8. */ -#if !defined(__WINRT__) || (WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP) +#if !defined(__WINRT__) || !SDL_WINAPI_FAMILY_PHONE /* If the swap chain already exists, resize it. */ result = IDXGISwapChain_ResizeBuffers(data->swapChain, 0, @@ -929,12 +934,12 @@ static HRESULT D3D11_CreateWindowSizeDependentResources(SDL_Renderer *renderer) #endif } else { result = D3D11_CreateSwapChain(renderer, w, h); - if (FAILED(result) || data->swapChain == NULL) { + if (FAILED(result) || !data->swapChain) { goto done; } } -#if WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP +#if !SDL_WINAPI_FAMILY_PHONE /* Set the proper rotation for the swap chain. * * To note, the call for this, IDXGISwapChain1::SetRotation, is not necessary @@ -1071,7 +1076,7 @@ static int D3D11_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture) } textureData = (D3D11_TextureData *)SDL_calloc(1, sizeof(*textureData)); - if (textureData == NULL) { + if (!textureData) { SDL_OutOfMemory(); return -1; } @@ -1232,7 +1237,7 @@ static void D3D11_DestroyTexture(SDL_Renderer *renderer, { D3D11_TextureData *data = (D3D11_TextureData *)texture->driverdata; - if (data == NULL) { + if (!data) { return; } @@ -1339,7 +1344,7 @@ static int D3D11_UpdateTexture(SDL_Renderer *renderer, SDL_Texture *texture, D3D11_RenderData *rendererData = (D3D11_RenderData *)renderer->driverdata; D3D11_TextureData *textureData = (D3D11_TextureData *)texture->driverdata; - if (textureData == NULL) { + if (!textureData) { return SDL_SetError("Texture is not currently available"); } @@ -1384,7 +1389,7 @@ static int D3D11_UpdateTextureYUV(SDL_Renderer *renderer, SDL_Texture *texture, D3D11_RenderData *rendererData = (D3D11_RenderData *)renderer->driverdata; D3D11_TextureData *textureData = (D3D11_TextureData *)texture->driverdata; - if (textureData == NULL) { + if (!textureData) { return SDL_SetError("Texture is not currently available"); } @@ -1408,7 +1413,7 @@ static int D3D11_UpdateTextureNV(SDL_Renderer *renderer, SDL_Texture *texture, D3D11_RenderData *rendererData = (D3D11_RenderData *)renderer->driverdata; D3D11_TextureData *textureData = (D3D11_TextureData *)texture->driverdata; - if (textureData == NULL) { + if (!textureData) { return SDL_SetError("Texture is not currently available"); } @@ -1432,7 +1437,7 @@ static int D3D11_LockTexture(SDL_Renderer *renderer, SDL_Texture *texture, D3D11_TEXTURE2D_DESC stagingTextureDesc; D3D11_MAPPED_SUBRESOURCE textureMemory; - if (textureData == NULL) { + if (!textureData) { return SDL_SetError("Texture is not currently available"); } #if SDL_HAVE_YUV @@ -1511,7 +1516,7 @@ static void D3D11_UnlockTexture(SDL_Renderer *renderer, SDL_Texture *texture) D3D11_RenderData *rendererData = (D3D11_RenderData *)renderer->driverdata; D3D11_TextureData *textureData = (D3D11_TextureData *)texture->driverdata; - if (textureData == NULL) { + if (!textureData) { return; } #if SDL_HAVE_YUV @@ -1547,7 +1552,7 @@ static void D3D11_SetTextureScaleMode(SDL_Renderer *renderer, SDL_Texture *textu { D3D11_TextureData *textureData = (D3D11_TextureData *)texture->driverdata; - if (textureData == NULL) { + if (!textureData) { return; } @@ -1559,7 +1564,7 @@ static int D3D11_SetRenderTarget(SDL_Renderer *renderer, SDL_Texture *texture) D3D11_RenderData *rendererData = (D3D11_RenderData *)renderer->driverdata; D3D11_TextureData *textureData = NULL; - if (texture == NULL) { + if (!texture) { rendererData->currentOffscreenRenderTargetView = NULL; return 0; } @@ -1590,7 +1595,7 @@ static int D3D11_QueueDrawPoints(SDL_Renderer *renderer, SDL_RenderCommand *cmd, color.b = cmd->data.draw.b; color.a = cmd->data.draw.a; - if (verts == NULL) { + if (!verts) { return -1; } @@ -1617,7 +1622,7 @@ static int D3D11_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, S int count = indices ? num_indices : num_vertices; VertexPositionColor *verts = (VertexPositionColor *)SDL_AllocateRenderVertices(renderer, count * sizeof(VertexPositionColor), 0, &cmd->data.draw.first); - if (verts == NULL) { + if (!verts) { return -1; } @@ -1842,6 +1847,19 @@ static int D3D11_SetDrawState(SDL_Renderer *renderer, const SDL_RenderCommand *c ID3D11BlendState *blendState = NULL; SDL_bool updateSubresource = SDL_FALSE; + if (numShaderResources > 0) { + shaderResource = shaderResources[0]; + } else { + shaderResource = NULL; + } + + /* Make sure the render target isn't bound to a shader */ + if (shaderResource != rendererData->currentShaderResource) { + ID3D11ShaderResourceView *pNullResource = NULL; + ID3D11DeviceContext_PSSetShaderResources(rendererData->d3dContext, 0, 1, &pNullResource); + rendererData->currentShaderResource = NULL; + } + if (renderTargetView != rendererData->currentRenderTargetView) { ID3D11DeviceContext_OMSetRenderTargets(rendererData->d3dContext, 1, @@ -1889,9 +1907,9 @@ static int D3D11_SetDrawState(SDL_Renderer *renderer, const SDL_RenderCommand *c break; } } - if (blendState == NULL) { + if (!blendState) { blendState = D3D11_CreateBlendState(renderer, blendMode); - if (blendState == NULL) { + if (!blendState) { return -1; } } @@ -1905,11 +1923,6 @@ static int D3D11_SetDrawState(SDL_Renderer *renderer, const SDL_RenderCommand *c ID3D11DeviceContext_PSSetShader(rendererData->d3dContext, shader, NULL, 0); rendererData->currentShader = shader; } - if (numShaderResources > 0) { - shaderResource = shaderResources[0]; - } else { - shaderResource = NULL; - } if (shaderResource != rendererData->currentShaderResource) { ID3D11DeviceContext_PSSetShaderResources(rendererData->d3dContext, 0, numShaderResources, shaderResources); rendererData->currentShaderResource = shaderResource; @@ -2039,6 +2052,7 @@ static int D3D11_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd, if (SDL_memcmp(viewport, &cmd->data.viewport.rect, sizeof(cmd->data.viewport.rect)) != 0) { SDL_copyp(viewport, &cmd->data.viewport.rect); rendererData->viewportDirty = SDL_TRUE; + rendererData->cliprectDirty = SDL_TRUE; } break; } @@ -2144,13 +2158,13 @@ static int D3D11_RenderReadPixels(SDL_Renderer *renderer, const SDL_Rect *rect, D3D11_MAPPED_SUBRESOURCE textureMemory; renderTargetView = D3D11_GetCurrentRenderTargetView(renderer); - if (renderTargetView == NULL) { + if (!renderTargetView) { SDL_SetError("%s, ID3D11DeviceContext::OMGetRenderTargets failed", __FUNCTION__); goto done; } ID3D11View_GetResource(renderTargetView, (ID3D11Resource **)&backBuffer); - if (backBuffer == NULL) { + if (!backBuffer) { SDL_SetError("%s, ID3D11View::GetResource failed", __FUNCTION__); goto done; } @@ -2237,7 +2251,7 @@ static int D3D11_RenderPresent(SDL_Renderer *renderer) SDL_zero(parameters); -#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP +#if SDL_WINAPI_FAMILY_PHONE syncInterval = 1; presentFlags = 0; result = IDXGISwapChain_Present(data->swapChain, syncInterval, presentFlags); @@ -2285,7 +2299,7 @@ static int D3D11_RenderPresent(SDL_Renderer *renderer) return 0; } -#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP +#if SDL_WINAPI_FAMILY_PHONE /* no-op. */ #else static int D3D11_SetVSync(SDL_Renderer *renderer, const int vsync) @@ -2305,13 +2319,13 @@ SDL_Renderer *D3D11_CreateRenderer(SDL_Window *window, Uint32 flags) D3D11_RenderData *data; renderer = (SDL_Renderer *)SDL_calloc(1, sizeof(*renderer)); - if (renderer == NULL) { + if (!renderer) { SDL_OutOfMemory(); return NULL; } data = (D3D11_RenderData *)SDL_calloc(1, sizeof(*data)); - if (data == NULL) { + if (!data) { SDL_free(renderer); SDL_OutOfMemory(); return NULL; @@ -2348,7 +2362,7 @@ SDL_Renderer *D3D11_CreateRenderer(SDL_Window *window, Uint32 flags) renderer->info.flags = (SDL_RENDERER_ACCELERATED | SDL_RENDERER_TARGETTEXTURE); renderer->driverdata = data; -#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP +#if SDL_WINAPI_FAMILY_PHONE /* VSync is required in Windows Phone, at least for Win Phone 8.0 and 8.1. * Failure to use it seems to either result in: * @@ -2407,7 +2421,7 @@ SDL_RenderDriver D3D11_RenderDriver = { } }; -#endif /* SDL_VIDEO_RENDER_D3D11 && !SDL_RENDER_DISABLED */ +#endif /* SDL_VIDEO_RENDER_D3D11 */ #if defined(__WIN32__) || defined(__WINGDK__) /* This function needs to always exist on Windows, for the Dynamic API. */ @@ -2415,7 +2429,7 @@ ID3D11Device *SDL_RenderGetD3D11Device(SDL_Renderer *renderer) { ID3D11Device *device = NULL; -#if SDL_VIDEO_RENDER_D3D11 && !SDL_RENDER_DISABLED +#if SDL_VIDEO_RENDER_D3D11 D3D11_RenderData *data = (D3D11_RenderData *)renderer->driverdata; /* Make sure that this is a D3D renderer */ @@ -2428,7 +2442,7 @@ ID3D11Device *SDL_RenderGetD3D11Device(SDL_Renderer *renderer) if (device) { ID3D11Device_AddRef(device); } -#endif /* SDL_VIDEO_RENDER_D3D11 && !SDL_RENDER_DISABLED */ +#endif /* SDL_VIDEO_RENDER_D3D11 */ return device; } diff --git a/thirdparty/SDL/src/render/direct3d11/SDL_render_winrt.cpp b/thirdparty/SDL/src/render/direct3d11/SDL_render_winrt.cpp index 3f24d0f21..0ed7addbd 100644 --- a/thirdparty/SDL/src/render/direct3d11/SDL_render_winrt.cpp +++ b/thirdparty/SDL/src/render/direct3d11/SDL_render_winrt.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_RENDER_D3D11 && !SDL_RENDER_DISABLED +#if SDL_VIDEO_RENDER_D3D11 #include "SDL_syswm.h" #include "../../video/winrt/SDL_winrtvideo_cpp.h" @@ -46,7 +46,7 @@ extern "C" void * D3D11_GetCoreWindowFromSDLRenderer(SDL_Renderer *renderer) { SDL_Window *sdlWindow = renderer->window; - if (renderer->window == NULL) { + if (!renderer->window) { return NULL; } @@ -83,7 +83,7 @@ D3D11_GetCurrentRotation() switch (currentOrientation) { -#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP +#if SDL_WINAPI_FAMILY_PHONE /* Windows Phone rotations */ case DisplayOrientations::Landscape: return DXGI_MODE_ROTATION_ROTATE90; @@ -103,12 +103,12 @@ D3D11_GetCurrentRotation() return DXGI_MODE_ROTATION_ROTATE180; case DisplayOrientations::PortraitFlipped: return DXGI_MODE_ROTATION_ROTATE90; -#endif /* WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP */ +#endif /* SDL_WINAPI_FAMILY_PHONE */ } return DXGI_MODE_ROTATION_IDENTITY; } -#endif /* SDL_VIDEO_RENDER_D3D11 && !SDL_RENDER_DISABLED */ +#endif /* SDL_VIDEO_RENDER_D3D11 */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/thirdparty/SDL/src/render/direct3d11/SDL_render_winrt.h b/thirdparty/SDL/src/render/direct3d11/SDL_render_winrt.h index efc8c90ae..dd9a17631 100644 --- a/thirdparty/SDL/src/render/direct3d11/SDL_render_winrt.h +++ b/thirdparty/SDL/src/render/direct3d11/SDL_render_winrt.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_RENDER_D3D11 && !SDL_RENDER_DISABLED +#if SDL_VIDEO_RENDER_D3D11 #include "SDL_render.h" @@ -35,6 +35,6 @@ DXGI_MODE_ROTATION D3D11_GetCurrentRotation(); } #endif -#endif /* SDL_VIDEO_RENDER_D3D11 && !SDL_RENDER_DISABLED */ +#endif /* SDL_VIDEO_RENDER_D3D11 */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/thirdparty/SDL/src/render/direct3d11/SDL_shaders_d3d11.c b/thirdparty/SDL/src/render/direct3d11/SDL_shaders_d3d11.c index e8c0a48d0..5f3a9a41f 100644 --- a/thirdparty/SDL/src/render/direct3d11/SDL_shaders_d3d11.c +++ b/thirdparty/SDL/src/render/direct3d11/SDL_shaders_d3d11.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_RENDER_D3D11 && !SDL_RENDER_DISABLED +#if SDL_VIDEO_RENDER_D3D11 #include "SDL_stdinc.h" @@ -58,7 +58,7 @@ hexdump -v -e '6/4 "0x%08.8x, " "\n"' */ -#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP +#if SDL_WINAPI_FAMILY_PHONE #define D3D11_USE_SHADER_MODEL_4_0_level_9_3 #else #define D3D11_USE_SHADER_MODEL_4_0_level_9_1 @@ -1949,6 +1949,6 @@ int D3D11_CreatePixelShader(ID3D11Device1 *d3dDevice, D3D11_Shader shader, ID3D1 return 0; } -#endif /* SDL_VIDEO_RENDER_D3D11 && !SDL_RENDER_DISABLED */ +#endif /* SDL_VIDEO_RENDER_D3D11 */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/thirdparty/SDL/src/render/direct3d11/SDL_shaders_d3d11.h b/thirdparty/SDL/src/render/direct3d11/SDL_shaders_d3d11.h index 9c35bad6e..010cd93b3 100644 --- a/thirdparty/SDL/src/render/direct3d11/SDL_shaders_d3d11.h +++ b/thirdparty/SDL/src/render/direct3d11/SDL_shaders_d3d11.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/render/direct3d12/SDL_render_d3d12.c b/thirdparty/SDL/src/render/direct3d12/SDL_render_d3d12.c index 5ad8e26f2..8a607bfbe 100644 --- a/thirdparty/SDL/src/render/direct3d12/SDL_render_d3d12.c +++ b/thirdparty/SDL/src/render/direct3d12/SDL_render_d3d12.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -23,7 +23,7 @@ #include "SDL_render.h" #include "SDL_system.h" -#if SDL_VIDEO_RENDER_D3D12 && !SDL_RENDER_DISABLED +#if SDL_VIDEO_RENDER_D3D12 #define SDL_D3D12_NUM_BUFFERS 2 #define SDL_D3D12_NUM_VERTEX_BUFFERS 256 @@ -48,6 +48,7 @@ #include #include #include +#include #endif #include "SDL_shaders_d3d12.h" @@ -58,6 +59,11 @@ #define SDL_COMPOSE_ERROR(str) SDL_STRINGIFY_ARG(__FUNCTION__) ", " str #endif +/* DXGI_PRESENT flags are removed on Xbox */ +#if defined(__XBOXONE__) || defined(__XBOXSERIES__) +#define DXGI_PRESENT_ALLOW_TEARING 0 +#endif + #ifdef __cplusplus #define SAFE_RELEASE(X) \ if (X) { \ @@ -78,6 +84,54 @@ #define D3D_GUID(X) &(X) #endif +/* + * Older MS Windows SDK headers declare some d3d12 functions with the wrong function prototype. + * - ID3D12Heap::GetDesc + * - ID3D12Resource::GetDesc + * - ID3D12DescriptorHeap::GetDesc + * (and 9 more)+ + * This is fixed in SDKs since WDK_NTDDI_VERSION >= NTDDI_WIN10_FE (0x0A00000A) + */ + +#if !(defined(__MINGW32__) || defined(__XBOXONE__) || defined(__XBOXSERIES__)) \ + && (WDK_NTDDI_VERSION < 0x0A00000A) + +#define D3D_CALL_RET_ID3D12DescriptorHeap_GetCPUDescriptorHandleForHeapStart(THIS, ...) do { \ + void (STDMETHODCALLTYPE * func)(ID3D12DescriptorHeap * This, D3D12_CPU_DESCRIPTOR_HANDLE * Handle) = \ + (void*)(THIS)->lpVtbl->GetCPUDescriptorHandleForHeapStart; \ + func((THIS), ##__VA_ARGS__); \ + } while (0) + +#define D3D_CALL_RET_ID3D12DescriptorHeap_GetGPUDescriptorHandleForHeapStart(THIS, ...) do { \ + void (STDMETHODCALLTYPE * func)(ID3D12DescriptorHeap * This, D3D12_GPU_DESCRIPTOR_HANDLE * Handle) = \ + (void*)(THIS)->lpVtbl->GetGPUDescriptorHandleForHeapStart; \ + func((THIS), ##__VA_ARGS__); \ + } while (0) + +#define D3D_CALL_RET_ID3D12Resource_GetDesc(THIS, ...) do { \ + void (STDMETHODCALLTYPE * func)(ID3D12Resource * This, D3D12_RESOURCE_DESC * Desc) = \ + (void*)(THIS)->lpVtbl->GetDesc; \ + func((THIS), ##__VA_ARGS__); \ + } while (0) + +#else + +/* + * MinGW has correct function prototypes in the vtables, but defines wrong functions + * Xbox just needs these macros defined as used below (because CINTERFACE doesn't exist) + */ + +#define D3D_CALL_RET_ID3D12DescriptorHeap_GetCPUDescriptorHandleForHeapStart(THIS, ...) \ + D3D_CALL_RET(THIS, GetCPUDescriptorHandleForHeapStart, ##__VA_ARGS__); + +#define D3D_CALL_RET_ID3D12DescriptorHeap_GetGPUDescriptorHandleForHeapStart(THIS, ...) \ + D3D_CALL_RET(THIS, GetGPUDescriptorHandleForHeapStart, ##__VA_ARGS__); + +#define D3D_CALL_RET_ID3D12Resource_GetDesc(THIS, ...) \ + D3D_CALL_RET(THIS, GetDesc, ##__VA_ARGS__); + +#endif + /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus extern "C" { @@ -393,10 +447,10 @@ static D3D12_GPU_DESCRIPTOR_HANDLE D3D12_CPUtoGPUHandle(ID3D12DescriptorHeap *he SIZE_T offset; /* Calculate the correct offset into the heap */ - D3D_CALL_RET(heap, GetCPUDescriptorHandleForHeapStart, &CPUHeapStart); + D3D_CALL_RET_ID3D12DescriptorHeap_GetCPUDescriptorHandleForHeapStart(heap, &CPUHeapStart); offset = CPUHandle.ptr - CPUHeapStart.ptr; - D3D_CALL_RET(heap, GetGPUDescriptorHandleForHeapStart, &GPUHandle); + D3D_CALL_RET_ID3D12DescriptorHeap_GetGPUDescriptorHandleForHeapStart(heap, &GPUHandle); GPUHandle.ptr += offset; return GPUHandle; @@ -427,7 +481,7 @@ static D3D12_CPU_DESCRIPTOR_HANDLE D3D12_GetCurrentRenderTargetView(SDL_Renderer } SDL_zero(rtvDescriptor); - D3D_CALL_RET(data->rtvDescriptorHeap, GetCPUDescriptorHandleForHeapStart, &rtvDescriptor); + D3D_CALL_RET_ID3D12DescriptorHeap_GetCPUDescriptorHandleForHeapStart(data->rtvDescriptorHeap, &rtvDescriptor); rtvDescriptor.ptr += data->currentBackBufferIndex * data->rtvDescriptorSize; return rtvDescriptor; } @@ -633,7 +687,7 @@ static D3D12_PipelineState *D3D12_CreatePipelineState(SDL_Renderer *renderer, } pipelineStates = (D3D12_PipelineState *)SDL_realloc(data->pipelineStates, (data->pipelineStateCount + 1) * sizeof(*pipelineStates)); - if (pipelineStates == NULL) { + if (!pipelineStates) { SAFE_RELEASE(pipelineState); SDL_OutOfMemory(); return NULL; @@ -748,7 +802,7 @@ static HRESULT D3D12_CreateDeviceResources(SDL_Renderer *renderer) } } #endif - if (CreateEventExFunc == NULL) { + if (!CreateEventExFunc) { result = E_FAIL; goto done; } @@ -761,7 +815,7 @@ static HRESULT D3D12_CreateDeviceResources(SDL_Renderer *renderer) } CreateDXGIFactoryFunc = (PFN_CREATE_DXGI_FACTORY)SDL_LoadFunction(data->hDXGIMod, "CreateDXGIFactory2"); - if (CreateDXGIFactoryFunc == NULL) { + if (!CreateDXGIFactoryFunc) { result = E_FAIL; goto done; } @@ -805,7 +859,7 @@ static HRESULT D3D12_CreateDeviceResources(SDL_Renderer *renderer) /* If the debug hint is set, also create the DXGI factory in debug mode */ DXGIGetDebugInterfaceFunc = (PFN_CREATE_DXGI_FACTORY)SDL_LoadFunction(data->hDXGIMod, "DXGIGetDebugInterface1"); - if (DXGIGetDebugInterfaceFunc == NULL) { + if (!DXGIGetDebugInterfaceFunc) { result = E_FAIL; goto done; } @@ -1047,7 +1101,7 @@ static HRESULT D3D12_CreateDeviceResources(SDL_Renderer *renderer) samplerDesc.ComparisonFunc = D3D12_COMPARISON_FUNC_ALWAYS; samplerDesc.MinLOD = 0.0f; samplerDesc.MaxLOD = D3D12_FLOAT32_MAX; - D3D_CALL_RET(data->samplerDescriptorHeap, GetCPUDescriptorHandleForHeapStart, &data->nearestPixelSampler); + D3D_CALL_RET_ID3D12DescriptorHeap_GetCPUDescriptorHandleForHeapStart(data->samplerDescriptorHeap, &data->nearestPixelSampler); D3D_CALL(data->d3dDevice, CreateSampler, &samplerDesc, data->nearestPixelSampler); samplerDesc.Filter = D3D12_FILTER_MIN_MAG_MIP_LINEAR; @@ -1141,7 +1195,7 @@ static int D3D12_GetViewportAlignedD3DRect(SDL_Renderer *renderer, const SDL_Rec static HRESULT D3D12_CreateSwapChain(SDL_Renderer *renderer, int w, int h) { D3D12_RenderData *data = (D3D12_RenderData *)renderer->driverdata; - IDXGISwapChain1* swapChain; + IDXGISwapChain1* swapChain = NULL; HRESULT result = S_OK; SDL_SysWMinfo windowinfo; @@ -1166,7 +1220,13 @@ static HRESULT D3D12_CreateSwapChain(SDL_Renderer *renderer, int w, int h) DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING; /* To support presenting with allow tearing on */ SDL_VERSION(&windowinfo.version); - SDL_GetWindowWMInfo(renderer->window, &windowinfo); + if (!SDL_GetWindowWMInfo(renderer->window, &windowinfo) || + windowinfo.subsystem != SDL_SYSWM_WINDOWS) + { + SDL_SetError("Couldn't get window handle"); + result = E_FAIL; + goto done; + } result = D3D_CALL(data->dxgiFactory, CreateSwapChainForHwnd, (IUnknown *)data->commandQueue, @@ -1330,7 +1390,7 @@ static HRESULT D3D12_CreateWindowSizeDependentResources(SDL_Renderer *renderer) rtvDesc.ViewDimension = D3D12_RTV_DIMENSION_TEXTURE2D; SDL_zero(rtvDescriptor); - D3D_CALL_RET(data->rtvDescriptorHeap, GetCPUDescriptorHandleForHeapStart, &rtvDescriptor); + D3D_CALL_RET_ID3D12DescriptorHeap_GetCPUDescriptorHandleForHeapStart(data->rtvDescriptorHeap, &rtvDescriptor); rtvDescriptor.ptr += i * data->rtvDescriptorSize; D3D_CALL(data->d3dDevice, CreateRenderTargetView, data->renderTargets[i], &rtvDesc, rtvDescriptor); } @@ -1432,7 +1492,7 @@ static int D3D12_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture) } textureData = (D3D12_TextureData *)SDL_calloc(1, sizeof(*textureData)); - if (textureData == NULL) { + if (!textureData) { SDL_OutOfMemory(); return -1; } @@ -1544,7 +1604,7 @@ static int D3D12_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture) resourceViewDesc.Texture2D.MipLevels = textureDesc.MipLevels; textureData->mainSRVIndex = D3D12_GetAvailableSRVIndex(renderer); - D3D_CALL_RET(rendererData->srvDescriptorHeap, GetCPUDescriptorHandleForHeapStart, &textureData->mainTextureResourceView); + D3D_CALL_RET_ID3D12DescriptorHeap_GetCPUDescriptorHandleForHeapStart(rendererData->srvDescriptorHeap, &textureData->mainTextureResourceView); textureData->mainTextureResourceView.ptr += textureData->mainSRVIndex * rendererData->srvDescriptorSize; D3D_CALL(rendererData->d3dDevice, CreateShaderResourceView, @@ -1553,7 +1613,7 @@ static int D3D12_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture) textureData->mainTextureResourceView); #if SDL_HAVE_YUV if (textureData->yuv) { - D3D_CALL_RET(rendererData->srvDescriptorHeap, GetCPUDescriptorHandleForHeapStart, &textureData->mainTextureResourceViewU); + D3D_CALL_RET_ID3D12DescriptorHeap_GetCPUDescriptorHandleForHeapStart(rendererData->srvDescriptorHeap, &textureData->mainTextureResourceViewU); textureData->mainSRVIndexU = D3D12_GetAvailableSRVIndex(renderer); textureData->mainTextureResourceViewU.ptr += textureData->mainSRVIndexU * rendererData->srvDescriptorSize; D3D_CALL(rendererData->d3dDevice, CreateShaderResourceView, @@ -1561,7 +1621,7 @@ static int D3D12_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture) &resourceViewDesc, textureData->mainTextureResourceViewU); - D3D_CALL_RET(rendererData->srvDescriptorHeap, GetCPUDescriptorHandleForHeapStart, &textureData->mainTextureResourceViewV); + D3D_CALL_RET_ID3D12DescriptorHeap_GetCPUDescriptorHandleForHeapStart(rendererData->srvDescriptorHeap, &textureData->mainTextureResourceViewV); textureData->mainSRVIndexV = D3D12_GetAvailableSRVIndex(renderer); textureData->mainTextureResourceViewV.ptr += textureData->mainSRVIndexV * rendererData->srvDescriptorSize; D3D_CALL(rendererData->d3dDevice, CreateShaderResourceView, @@ -1575,7 +1635,7 @@ static int D3D12_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture) nvResourceViewDesc.Format = DXGI_FORMAT_R8G8_UNORM; - D3D_CALL_RET(rendererData->srvDescriptorHeap, GetCPUDescriptorHandleForHeapStart, &textureData->mainTextureResourceViewNV); + D3D_CALL_RET_ID3D12DescriptorHeap_GetCPUDescriptorHandleForHeapStart(rendererData->srvDescriptorHeap, &textureData->mainTextureResourceViewNV); textureData->mainSRVIndexNV = D3D12_GetAvailableSRVIndex(renderer); textureData->mainTextureResourceViewNV.ptr += textureData->mainSRVIndexNV * rendererData->srvDescriptorSize; D3D_CALL(rendererData->d3dDevice, CreateShaderResourceView, @@ -1592,7 +1652,7 @@ static int D3D12_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture) renderTargetViewDesc.ViewDimension = D3D12_RTV_DIMENSION_TEXTURE2D; renderTargetViewDesc.Texture2D.MipSlice = 0; - D3D_CALL_RET(rendererData->textureRTVDescriptorHeap, GetCPUDescriptorHandleForHeapStart, &textureData->mainTextureRenderTargetView); + D3D_CALL_RET_ID3D12DescriptorHeap_GetCPUDescriptorHandleForHeapStart(rendererData->textureRTVDescriptorHeap, &textureData->mainTextureRenderTargetView); textureData->mainTextureRenderTargetView.ptr += textureData->mainSRVIndex * rendererData->rtvDescriptorSize; D3D_CALL(rendererData->d3dDevice, CreateRenderTargetView, @@ -1610,7 +1670,7 @@ static void D3D12_DestroyTexture(SDL_Renderer *renderer, D3D12_RenderData *rendererData = (D3D12_RenderData *)renderer->driverdata; D3D12_TextureData *textureData = (D3D12_TextureData *)texture->driverdata; - if (textureData == NULL) { + if (!textureData) { return; } @@ -1657,7 +1717,7 @@ static int D3D12_UpdateTextureInternal(D3D12_RenderData *rendererData, ID3D12Res /* Create an upload buffer, which will be used to write to the main texture. */ SDL_zero(textureDesc); - D3D_CALL_RET(texture, GetDesc, &textureDesc); + D3D_CALL_RET_ID3D12Resource_GetDesc(texture, &textureDesc); textureDesc.Width = w; textureDesc.Height = h; @@ -1788,7 +1848,7 @@ static int D3D12_UpdateTexture(SDL_Renderer *renderer, SDL_Texture *texture, D3D12_RenderData *rendererData = (D3D12_RenderData *)renderer->driverdata; D3D12_TextureData *textureData = (D3D12_TextureData *)texture->driverdata; - if (textureData == NULL) { + if (!textureData) { return SDL_SetError("Texture is not currently available"); } @@ -1833,7 +1893,7 @@ static int D3D12_UpdateTextureYUV(SDL_Renderer *renderer, SDL_Texture *texture, D3D12_RenderData *rendererData = (D3D12_RenderData *)renderer->driverdata; D3D12_TextureData *textureData = (D3D12_TextureData *)texture->driverdata; - if (textureData == NULL) { + if (!textureData) { return SDL_SetError("Texture is not currently available"); } @@ -1857,7 +1917,7 @@ static int D3D12_UpdateTextureNV(SDL_Renderer *renderer, SDL_Texture *texture, D3D12_RenderData *rendererData = (D3D12_RenderData *)renderer->driverdata; D3D12_TextureData *textureData = (D3D12_TextureData *)texture->driverdata; - if (textureData == NULL) { + if (!textureData) { return SDL_SetError("Texture is not currently available"); } @@ -1886,7 +1946,7 @@ static int D3D12_LockTexture(SDL_Renderer *renderer, SDL_Texture *texture, BYTE *textureMemory; int bpp; - if (textureData == NULL) { + if (!textureData) { return SDL_SetError("Texture is not currently available"); } #if SDL_HAVE_YUV @@ -1913,7 +1973,7 @@ static int D3D12_LockTexture(SDL_Renderer *renderer, SDL_Texture *texture, /* Create an upload buffer, which will be used to write to the main texture. */ SDL_zero(textureDesc); - D3D_CALL_RET(textureData->mainTexture, GetDesc, &textureDesc); + D3D_CALL_RET_ID3D12Resource_GetDesc(textureData->mainTexture, &textureDesc); textureDesc.Width = rect->w; textureDesc.Height = rect->h; @@ -2005,7 +2065,7 @@ static void D3D12_UnlockTexture(SDL_Renderer *renderer, SDL_Texture *texture) D3D12_TEXTURE_COPY_LOCATION dstLocation; int bpp; - if (textureData == NULL) { + if (!textureData) { return; } #if SDL_HAVE_YUV @@ -2022,7 +2082,7 @@ static void D3D12_UnlockTexture(SDL_Renderer *renderer, SDL_Texture *texture) D3D_CALL(textureData->stagingBuffer, Unmap, 0, NULL); SDL_zero(textureDesc); - D3D_CALL_RET(textureData->mainTexture, GetDesc, &textureDesc); + D3D_CALL_RET_ID3D12Resource_GetDesc(textureData->mainTexture, &textureDesc); textureDesc.Width = textureData->lockedRect.w; textureDesc.Height = textureData->lockedRect.h; @@ -2076,7 +2136,7 @@ static void D3D12_SetTextureScaleMode(SDL_Renderer *renderer, SDL_Texture *textu { D3D12_TextureData *textureData = (D3D12_TextureData *)texture->driverdata; - if (textureData == NULL) { + if (!textureData) { return; } @@ -2088,7 +2148,7 @@ static int D3D12_SetRenderTarget(SDL_Renderer *renderer, SDL_Texture *texture) D3D12_RenderData *rendererData = (D3D12_RenderData *)renderer->driverdata; D3D12_TextureData *textureData = NULL; - if (texture == NULL) { + if (!texture) { if (rendererData->textureRenderTarget) { D3D12_TransitionResource(rendererData, rendererData->textureRenderTarget->mainTexture, @@ -2131,7 +2191,7 @@ static int D3D12_QueueDrawPoints(SDL_Renderer *renderer, SDL_RenderCommand *cmd, color.b = cmd->data.draw.b; color.a = cmd->data.draw.a; - if (verts == NULL) { + if (!verts) { return -1; } @@ -2158,7 +2218,7 @@ static int D3D12_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, S int count = indices ? num_indices : num_vertices; VertexPositionColor *verts = (VertexPositionColor *)SDL_AllocateRenderVertices(renderer, count * sizeof(VertexPositionColor), 0, &cmd->data.draw.first); - if (verts == NULL) { + if (!verts) { return -1; } @@ -2602,6 +2662,7 @@ static int D3D12_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd, if (SDL_memcmp(viewport, &cmd->data.viewport.rect, sizeof(cmd->data.viewport.rect)) != 0) { SDL_copyp(viewport, &cmd->data.viewport.rect); rendererData->viewportDirty = SDL_TRUE; + rendererData->cliprectDirty = SDL_TRUE; } break; } @@ -2732,7 +2793,7 @@ static int D3D12_RenderReadPixels(SDL_Renderer *renderer, const SDL_Rect *rect, /* Create a staging texture to copy the screen's data to: */ SDL_zero(textureDesc); - D3D_CALL_RET(backBuffer, GetDesc, &textureDesc); + D3D_CALL_RET_ID3D12Resource_GetDesc(backBuffer, &textureDesc); textureDesc.Width = rect->w; textureDesc.Height = rect->h; @@ -2837,8 +2898,8 @@ static int D3D12_RenderReadPixels(SDL_Renderer *renderer, const SDL_Rect *rect, NULL, (void **)&textureMemory); if (FAILED(result)) { - SAFE_RELEASE(readbackBuffer); - return WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D12Resource::Map [map staging texture]"), result); + WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D12Resource::Map [map staging texture]"), result); + goto done; } /* Copy the data into the desired buffer, converting pixels to the @@ -2959,13 +3020,13 @@ SDL_Renderer *D3D12_CreateRenderer(SDL_Window *window, Uint32 flags) D3D12_RenderData *data; renderer = (SDL_Renderer *)SDL_calloc(1, sizeof(*renderer)); - if (renderer == NULL) { + if (!renderer) { SDL_OutOfMemory(); return NULL; } data = (D3D12_RenderData *)SDL_calloc(1, sizeof(*data)); - if (data == NULL) { + if (!data) { SDL_free(renderer); SDL_OutOfMemory(); return NULL; @@ -3049,7 +3110,7 @@ SDL_RenderDriver D3D12_RenderDriver = { } #endif -#endif /* SDL_VIDEO_RENDER_D3D12 && !SDL_RENDER_DISABLED */ +#endif /* SDL_VIDEO_RENDER_D3D12 */ #if defined(__WIN32__) || defined(__GDK__) #ifdef __cplusplus @@ -3061,7 +3122,7 @@ extern "C" { ID3D12Device *device = NULL; -#if SDL_VIDEO_RENDER_D3D12 && !SDL_RENDER_DISABLED +#if SDL_VIDEO_RENDER_D3D12 D3D12_RenderData *data = (D3D12_RenderData *)renderer->driverdata; /* Make sure that this is a D3D renderer */ @@ -3074,7 +3135,7 @@ extern "C" if (device) { D3D_CALL(device, AddRef); } -#endif /* SDL_VIDEO_RENDER_D3D12 && !SDL_RENDER_DISABLED */ +#endif /* SDL_VIDEO_RENDER_D3D12 */ return device; } diff --git a/thirdparty/SDL/src/render/direct3d12/SDL_render_d3d12_xbox.cpp b/thirdparty/SDL/src/render/direct3d12/SDL_render_d3d12_xbox.cpp index 3775c9448..7b598c016 100644 --- a/thirdparty/SDL/src/render/direct3d12/SDL_render_d3d12_xbox.cpp +++ b/thirdparty/SDL/src/render/direct3d12/SDL_render_d3d12_xbox.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,155 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_RENDER_D3D12 && !SDL_RENDER_DISABLED && (defined(__XBOXONE__) || defined(__XBOXSERIES__)) +#if SDL_VIDEO_RENDER_D3D12 && (defined(__XBOXONE__) || defined(__XBOXSERIES__)) #include "SDL_render_d3d12_xbox.h" +#include "../../core/windows/SDL_windows.h" +#include + +#if defined(_MSC_VER) && !defined(__clang__) +#define SDL_COMPOSE_ERROR(str) __FUNCTION__ ", " str +#else +#define SDL_COMPOSE_ERROR(str) SDL_STRINGIFY_ARG(__FUNCTION__) ", " str +#endif + +static const GUID SDL_IID_ID3D12Device1 = { 0x77acce80, 0x638e, 0x4e65, { 0x88, 0x95, 0xc1, 0xf2, 0x33, 0x86, 0x86, 0x3e } }; +static const GUID SDL_IID_ID3D12Resource = { 0x696442be, 0xa72e, 0x4059, { 0xbc, 0x79, 0x5b, 0x5c, 0x98, 0x04, 0x0f, 0xad } }; +static const GUID SDL_IID_IDXGIDevice1 = { 0x77db970f, 0x6276, 0x48ba, { 0xba, 0x28, 0x07, 0x01, 0x43, 0xb4, 0x39, 0x2c } }; + +extern "C" HRESULT +D3D12_XBOX_CreateDevice(ID3D12Device **device, SDL_bool createDebug) +{ + HRESULT result; + D3D12XBOX_CREATE_DEVICE_PARAMETERS params; + IDXGIDevice1 *dxgiDevice; + IDXGIAdapter *dxgiAdapter; + IDXGIOutput *dxgiOutput; + SDL_zero(params); + + params.Version = D3D12_SDK_VERSION; + params.ProcessDebugFlags = createDebug ? D3D12_PROCESS_DEBUG_FLAG_DEBUG_LAYER_ENABLED : D3D12XBOX_PROCESS_DEBUG_FLAG_NONE; + params.GraphicsCommandQueueRingSizeBytes = D3D12XBOX_DEFAULT_SIZE_BYTES; + params.GraphicsScratchMemorySizeBytes = D3D12XBOX_DEFAULT_SIZE_BYTES; + params.ComputeScratchMemorySizeBytes = D3D12XBOX_DEFAULT_SIZE_BYTES; + + result = D3D12XboxCreateDevice(NULL, ¶ms, SDL_IID_ID3D12Device1, (void **) device); + if (FAILED(result)) { + WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("[xbox] D3D12XboxCreateDevice"), result); + goto done; + } + + result = (*device)->QueryInterface(SDL_IID_IDXGIDevice1, (void **) &dxgiDevice); + if (FAILED(result)) { + WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("[xbox] ID3D12Device to IDXGIDevice1"), result); + goto done; + } + + result = dxgiDevice->GetAdapter(&dxgiAdapter); + if (FAILED(result)) { + WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("[xbox] dxgiDevice->GetAdapter"), result); + goto done; + } + + result = dxgiAdapter->EnumOutputs(0, &dxgiOutput); + if (FAILED(result)) { + WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("[xbox] dxgiAdapter->EnumOutputs"), result); + goto done; + } + + /* Set frame interval */ + result = (*device)->SetFrameIntervalX(dxgiOutput, D3D12XBOX_FRAME_INTERVAL_60_HZ, 1, D3D12XBOX_FRAME_INTERVAL_FLAG_NONE); + if (FAILED(result)) { + WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("[xbox] SetFrameIntervalX"), result); + goto done; + } + + result = (*device)->ScheduleFrameEventX(D3D12XBOX_FRAME_EVENT_ORIGIN, 0, NULL, D3D12XBOX_SCHEDULE_FRAME_EVENT_FLAG_NONE); + if (FAILED(result)) { + WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("[xbox] ScheduleFrameEventX"), result); + goto done; + } + +done: + return result; +} + +extern "C" HRESULT +D3D12_XBOX_CreateBackBufferTarget(ID3D12Device1 *device, int width, int height, void **resource) +{ + + D3D12_HEAP_PROPERTIES heapProps; + D3D12_RESOURCE_DESC resourceDesc; + + SDL_zero(heapProps); + heapProps.Type = D3D12_HEAP_TYPE_DEFAULT; + heapProps.CPUPageProperty = D3D12_CPU_PAGE_PROPERTY_UNKNOWN; + heapProps.MemoryPoolPreference = D3D12_MEMORY_POOL_UNKNOWN; + heapProps.CreationNodeMask = 1; + heapProps.VisibleNodeMask = 1; + + SDL_zero(resourceDesc); + resourceDesc.Dimension = D3D12_RESOURCE_DIMENSION_TEXTURE2D; + resourceDesc.Alignment = 0; + resourceDesc.Width = width; + resourceDesc.Height = height; + resourceDesc.DepthOrArraySize = 1; + resourceDesc.MipLevels = 1; + resourceDesc.Format = DXGI_FORMAT_B8G8R8A8_UNORM; + resourceDesc.SampleDesc.Count = 1; + resourceDesc.SampleDesc.Quality = 0; + resourceDesc.Layout = D3D12_TEXTURE_LAYOUT_UNKNOWN; + resourceDesc.Flags = D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET; + + return device->CreateCommittedResource(&heapProps, + D3D12_HEAP_FLAG_ALLOW_DISPLAY, + &resourceDesc, + D3D12_RESOURCE_STATE_PRESENT, + NULL, + SDL_IID_ID3D12Resource, + resource + ); +} + +extern "C" HRESULT +D3D12_XBOX_StartFrame(ID3D12Device1 *device, UINT64 *outToken) +{ + *outToken = D3D12XBOX_FRAME_PIPELINE_TOKEN_NULL; + return device->WaitFrameEventX(D3D12XBOX_FRAME_EVENT_ORIGIN, INFINITE, NULL, D3D12XBOX_WAIT_FRAME_EVENT_FLAG_NONE, outToken); +} + +extern "C" HRESULT +D3D12_XBOX_PresentFrame(ID3D12CommandQueue *commandQueue, UINT64 token, ID3D12Resource *renderTarget) +{ + D3D12XBOX_PRESENT_PLANE_PARAMETERS planeParameters; + SDL_zero(planeParameters); + planeParameters.Token = token; + planeParameters.ResourceCount = 1; + planeParameters.ppResources = &renderTarget; + return commandQueue->PresentX(1, &planeParameters, NULL); +} + +extern "C" void +D3D12_XBOX_GetResolution(Uint32 *width, Uint32 *height) +{ + switch (XSystemGetDeviceType()) { + case XSystemDeviceType::XboxScarlettLockhart: + *width = 2560; + *height = 1440; + break; + + case XSystemDeviceType::XboxOneX: + case XSystemDeviceType::XboxScarlettAnaconda: + case XSystemDeviceType::XboxOneXDevkit: + case XSystemDeviceType::XboxScarlettDevkit: + *width = 3840; + *height = 2160; + break; + + default: + *width = 1920; + *height = 1080; + break; + } +} -#error "This is a placeholder Xbox file, as the real one is under NDA. See README-gdk.md for more info." #endif diff --git a/thirdparty/SDL/src/render/direct3d12/SDL_render_d3d12_xbox.h b/thirdparty/SDL/src/render/direct3d12/SDL_render_d3d12_xbox.h index fd725d9f4..6db955a42 100644 --- a/thirdparty/SDL/src/render/direct3d12/SDL_render_d3d12_xbox.h +++ b/thirdparty/SDL/src/render/direct3d12/SDL_render_d3d12_xbox.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,4 +19,31 @@ 3. This notice may not be removed or altered from any source distribution. */ -#error "This is a placeholder Xbox file, as the real one is under NDA. See README-gdk.md for more info." +#ifndef SDL_render_d3d12_xbox_h_ +#define SDL_render_d3d12_xbox_h_ + +#include "../../SDL_internal.h" + +#if defined(__XBOXONE__) +#include +#else /* __XBOXSERIES__ */ +#include +#endif + +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +extern HRESULT D3D12_XBOX_CreateDevice(ID3D12Device **device, SDL_bool createDebug); +extern HRESULT D3D12_XBOX_CreateBackBufferTarget(ID3D12Device1 *device, int width, int height, void **resource); +extern HRESULT D3D12_XBOX_StartFrame(ID3D12Device1 *device, UINT64 *outToken); +extern HRESULT D3D12_XBOX_PresentFrame(ID3D12CommandQueue *commandQueue, UINT64 token, ID3D12Resource *renderTarget); +extern void D3D12_XBOX_GetResolution(Uint32 *width, Uint32 *height); + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif + +#endif diff --git a/thirdparty/SDL/src/render/direct3d12/SDL_shaders_d3d12.c b/thirdparty/SDL/src/render/direct3d12/SDL_shaders_d3d12.c index 3b1327291..29862d464 100644 --- a/thirdparty/SDL/src/render/direct3d12/SDL_shaders_d3d12.c +++ b/thirdparty/SDL/src/render/direct3d12/SDL_shaders_d3d12.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_RENDER_D3D12 && !SDL_RENDER_DISABLED && !defined(__XBOXONE__) && !defined(__XBOXSERIES__) +#if SDL_VIDEO_RENDER_D3D12 && !defined(__XBOXONE__) && !defined(__XBOXSERIES__) #include "SDL_stdinc.h" @@ -6934,6 +6934,6 @@ void D3D12_GetRootSignatureData(D3D12_RootSignature rootSig, D3D12_SHADER_BYTECO outBytecode->BytecodeLength = D3D12_rootsigs[rootSig].rs_shader_size; } -#endif /* SDL_VIDEO_RENDER_D3D12 && !SDL_RENDER_DISABLED && !defined(__XBOXONE__) && !defined(__XBOXSERIES__) */ +#endif /* SDL_VIDEO_RENDER_D3D12 && !defined(__XBOXONE__) && !defined(__XBOXSERIES__) */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/thirdparty/SDL/src/render/direct3d12/SDL_shaders_d3d12.h b/thirdparty/SDL/src/render/direct3d12/SDL_shaders_d3d12.h index f91179f69..f0c528daf 100644 --- a/thirdparty/SDL/src/render/direct3d12/SDL_shaders_d3d12.h +++ b/thirdparty/SDL/src/render/direct3d12/SDL_shaders_d3d12.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/render/direct3d12/SDL_shaders_d3d12_xboxone.cpp b/thirdparty/SDL/src/render/direct3d12/SDL_shaders_d3d12_xboxone.cpp index 6a86b2c29..cc5c84f2f 100644 --- a/thirdparty/SDL/src/render/direct3d12/SDL_shaders_d3d12_xboxone.cpp +++ b/thirdparty/SDL/src/render/direct3d12/SDL_shaders_d3d12_xboxone.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,10 +20,125 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_RENDER_D3D12 && !SDL_RENDER_DISABLED && defined(__XBOXONE__) +#if SDL_VIDEO_RENDER_D3D12 && defined(__XBOXONE__) -#error "This is a placeholder Xbox file, as the real one is under NDA. See README-gdk.md for more info." +#include -#endif /* SDL_VIDEO_RENDER_D3D12 && !SDL_RENDER_DISABLED && defined(__XBOXONE__) */ +#include "../../core/windows/SDL_windows.h" +#include + +#include "SDL_shaders_d3d12.h" + +#define SDL_COMPOSE_ERROR(str) SDL_STRINGIFY_ARG(__FUNCTION__) ", " str + +/* Shader blob headers are generated with a pre-build step using buildshaders.bat */ +#include "../VisualC-GDK/shaders/D3D12_PixelShader_Colors_One.h" +#include "../VisualC-GDK/shaders/D3D12_PixelShader_NV12_BT601_One.h" +#include "../VisualC-GDK/shaders/D3D12_PixelShader_NV12_BT709_One.h" +#include "../VisualC-GDK/shaders/D3D12_PixelShader_NV12_JPEG_One.h" +#include "../VisualC-GDK/shaders/D3D12_PixelShader_NV21_BT601_One.h" +#include "../VisualC-GDK/shaders/D3D12_PixelShader_NV21_BT709_One.h" +#include "../VisualC-GDK/shaders/D3D12_PixelShader_NV21_JPEG_One.h" +#include "../VisualC-GDK/shaders/D3D12_PixelShader_Textures_One.h" +#include "../VisualC-GDK/shaders/D3D12_PixelShader_YUV_BT601_One.h" +#include "../VisualC-GDK/shaders/D3D12_PixelShader_YUV_BT709_One.h" +#include "../VisualC-GDK/shaders/D3D12_PixelShader_YUV_JPEG_One.h" + +#include "../VisualC-GDK/shaders/D3D12_VertexShader_Color_One.h" +#include "../VisualC-GDK/shaders/D3D12_VertexShader_NV_One.h" +#include "../VisualC-GDK/shaders/D3D12_VertexShader_Texture_One.h" +#include "../VisualC-GDK/shaders/D3D12_VertexShader_YUV_One.h" + +#include "../VisualC-GDK/shaders/D3D12_RootSig_Color_One.h" +#include "../VisualC-GDK/shaders/D3D12_RootSig_NV_One.h" +#include "../VisualC-GDK/shaders/D3D12_RootSig_Texture_One.h" +#include "../VisualC-GDK/shaders/D3D12_RootSig_YUV_One.h" + +static struct +{ + const void *ps_shader_data; + SIZE_T ps_shader_size; + const void *vs_shader_data; + SIZE_T vs_shader_size; + D3D12_RootSignature root_sig; +} D3D12_shaders[NUM_SHADERS] = { + { D3D12_PixelShader_Colors, sizeof(D3D12_PixelShader_Colors), + D3D12_VertexShader_Color, sizeof(D3D12_VertexShader_Color), + ROOTSIG_COLOR }, + { D3D12_PixelShader_Textures, sizeof(D3D12_PixelShader_Textures), + D3D12_VertexShader_Texture, sizeof(D3D12_VertexShader_Texture), + ROOTSIG_TEXTURE }, +#if SDL_HAVE_YUV + { D3D12_PixelShader_YUV_JPEG, sizeof(D3D12_PixelShader_YUV_JPEG), + D3D12_VertexShader_YUV, sizeof(D3D12_VertexShader_YUV), + ROOTSIG_YUV }, + { D3D12_PixelShader_YUV_BT601, sizeof(D3D12_PixelShader_YUV_BT601), + D3D12_VertexShader_YUV, sizeof(D3D12_VertexShader_YUV), + ROOTSIG_YUV }, + { D3D12_PixelShader_YUV_BT709, sizeof(D3D12_PixelShader_YUV_BT709), + D3D12_VertexShader_YUV, sizeof(D3D12_VertexShader_YUV), + ROOTSIG_YUV }, + { D3D12_PixelShader_NV12_JPEG, sizeof(D3D12_PixelShader_NV12_JPEG), + D3D12_VertexShader_NV, sizeof(D3D12_VertexShader_NV), + ROOTSIG_NV }, + { D3D12_PixelShader_NV12_BT601, sizeof(D3D12_PixelShader_NV12_BT601), + D3D12_VertexShader_NV, sizeof(D3D12_VertexShader_NV), + ROOTSIG_NV }, + { D3D12_PixelShader_NV12_BT709, sizeof(D3D12_PixelShader_NV12_BT709), + D3D12_VertexShader_NV, sizeof(D3D12_VertexShader_NV), + ROOTSIG_NV }, + { D3D12_PixelShader_NV21_JPEG, sizeof(D3D12_PixelShader_NV21_JPEG), + D3D12_VertexShader_NV, sizeof(D3D12_VertexShader_NV), + ROOTSIG_NV }, + { D3D12_PixelShader_NV21_BT601, sizeof(D3D12_PixelShader_NV21_BT601), + D3D12_VertexShader_NV, sizeof(D3D12_VertexShader_NV), + ROOTSIG_NV }, + { D3D12_PixelShader_NV21_BT709, sizeof(D3D12_PixelShader_NV21_BT709), + D3D12_VertexShader_NV, sizeof(D3D12_VertexShader_NV), + ROOTSIG_NV }, +#endif +}; + +static struct +{ + const void *rs_shader_data; + SIZE_T rs_shader_size; +} D3D12_rootsigs[NUM_ROOTSIGS] = { + { D3D12_RootSig_Color, sizeof(D3D12_RootSig_Color) }, + { D3D12_RootSig_Texture, sizeof(D3D12_RootSig_Texture) }, +#if SDL_HAVE_YUV + { D3D12_RootSig_YUV, sizeof(D3D12_RootSig_YUV) }, + { D3D12_RootSig_NV, sizeof(D3D12_RootSig_NV) }, +#endif +}; + +extern "C" void +D3D12_GetVertexShader(D3D12_Shader shader, D3D12_SHADER_BYTECODE *outBytecode) +{ + outBytecode->pShaderBytecode = D3D12_shaders[shader].vs_shader_data; + outBytecode->BytecodeLength = D3D12_shaders[shader].vs_shader_size; +} + +extern "C" void +D3D12_GetPixelShader(D3D12_Shader shader, D3D12_SHADER_BYTECODE *outBytecode) +{ + outBytecode->pShaderBytecode = D3D12_shaders[shader].ps_shader_data; + outBytecode->BytecodeLength = D3D12_shaders[shader].ps_shader_size; +} + +extern "C" D3D12_RootSignature +D3D12_GetRootSignatureType(D3D12_Shader shader) +{ + return D3D12_shaders[shader].root_sig; +} + +extern "C" void +D3D12_GetRootSignatureData(D3D12_RootSignature rootSig, D3D12_SHADER_BYTECODE *outBytecode) +{ + outBytecode->pShaderBytecode = D3D12_rootsigs[rootSig].rs_shader_data; + outBytecode->BytecodeLength = D3D12_rootsigs[rootSig].rs_shader_size; +} + +#endif /* SDL_VIDEO_RENDER_D3D12 && defined(__XBOXONE__) */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/thirdparty/SDL/src/render/direct3d12/SDL_shaders_d3d12_xboxseries.cpp b/thirdparty/SDL/src/render/direct3d12/SDL_shaders_d3d12_xboxseries.cpp index 28651173f..f1e406317 100644 --- a/thirdparty/SDL/src/render/direct3d12/SDL_shaders_d3d12_xboxseries.cpp +++ b/thirdparty/SDL/src/render/direct3d12/SDL_shaders_d3d12_xboxseries.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,10 +20,125 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_RENDER_D3D12 && !SDL_RENDER_DISABLED && defined(__XBOXSERIES__) +#if SDL_VIDEO_RENDER_D3D12 && defined(__XBOXSERIES__) -#error "This is a placeholder Xbox file, as the real one is under NDA. See README-gdk.md for more info." +#include -#endif /* SDL_VIDEO_RENDER_D3D12 && !SDL_RENDER_DISABLED && defined(__XBOXSERIES__) */ +#include "../../core/windows/SDL_windows.h" +#include + +#include "SDL_shaders_d3d12.h" + +#define SDL_COMPOSE_ERROR(str) SDL_STRINGIFY_ARG(__FUNCTION__) ", " str + +/* Shader blob headers are generated with a pre-build step using buildshaders.bat */ +#include "../VisualC-GDK/shaders/D3D12_PixelShader_Colors_Series.h" +#include "../VisualC-GDK/shaders/D3D12_PixelShader_Textures_Series.h" +#include "../VisualC-GDK/shaders/D3D12_PixelShader_NV12_BT601_Series.h" +#include "../VisualC-GDK/shaders/D3D12_PixelShader_NV12_BT709_Series.h" +#include "../VisualC-GDK/shaders/D3D12_PixelShader_NV12_JPEG_Series.h" +#include "../VisualC-GDK/shaders/D3D12_PixelShader_NV21_BT601_Series.h" +#include "../VisualC-GDK/shaders/D3D12_PixelShader_NV21_BT709_Series.h" +#include "../VisualC-GDK/shaders/D3D12_PixelShader_NV21_JPEG_Series.h" +#include "../VisualC-GDK/shaders/D3D12_PixelShader_YUV_BT601_Series.h" +#include "../VisualC-GDK/shaders/D3D12_PixelShader_YUV_BT709_Series.h" +#include "../VisualC-GDK/shaders/D3D12_PixelShader_YUV_JPEG_Series.h" + +#include "../VisualC-GDK/shaders/D3D12_VertexShader_Color_Series.h" +#include "../VisualC-GDK/shaders/D3D12_VertexShader_Texture_Series.h" +#include "../VisualC-GDK/shaders/D3D12_VertexShader_NV_Series.h" +#include "../VisualC-GDK/shaders/D3D12_VertexShader_YUV_Series.h" + +#include "../VisualC-GDK/shaders/D3D12_RootSig_Color_Series.h" +#include "../VisualC-GDK/shaders/D3D12_RootSig_Texture_Series.h" +#include "../VisualC-GDK/shaders/D3D12_RootSig_YUV_Series.h" +#include "../VisualC-GDK/shaders/D3D12_RootSig_NV_Series.h" + +static struct +{ + const void *ps_shader_data; + SIZE_T ps_shader_size; + const void *vs_shader_data; + SIZE_T vs_shader_size; + D3D12_RootSignature root_sig; +} D3D12_shaders[NUM_SHADERS] = { + { D3D12_PixelShader_Colors, sizeof(D3D12_PixelShader_Colors), + D3D12_VertexShader_Color, sizeof(D3D12_VertexShader_Color), + ROOTSIG_COLOR }, + { D3D12_PixelShader_Textures, sizeof(D3D12_PixelShader_Textures), + D3D12_VertexShader_Texture, sizeof(D3D12_VertexShader_Texture), + ROOTSIG_TEXTURE }, +#if SDL_HAVE_YUV + { D3D12_PixelShader_YUV_JPEG, sizeof(D3D12_PixelShader_YUV_JPEG), + D3D12_VertexShader_YUV, sizeof(D3D12_VertexShader_YUV), + ROOTSIG_YUV }, + { D3D12_PixelShader_YUV_BT601, sizeof(D3D12_PixelShader_YUV_BT601), + D3D12_VertexShader_YUV, sizeof(D3D12_VertexShader_YUV), + ROOTSIG_YUV }, + { D3D12_PixelShader_YUV_BT709, sizeof(D3D12_PixelShader_YUV_BT709), + D3D12_VertexShader_YUV, sizeof(D3D12_VertexShader_YUV), + ROOTSIG_YUV }, + { D3D12_PixelShader_NV12_JPEG, sizeof(D3D12_PixelShader_NV12_JPEG), + D3D12_VertexShader_NV, sizeof(D3D12_VertexShader_NV), + ROOTSIG_NV }, + { D3D12_PixelShader_NV12_BT601, sizeof(D3D12_PixelShader_NV12_BT601), + D3D12_VertexShader_NV, sizeof(D3D12_VertexShader_NV), + ROOTSIG_NV }, + { D3D12_PixelShader_NV12_BT709, sizeof(D3D12_PixelShader_NV12_BT709), + D3D12_VertexShader_NV, sizeof(D3D12_VertexShader_NV), + ROOTSIG_NV }, + { D3D12_PixelShader_NV21_JPEG, sizeof(D3D12_PixelShader_NV21_JPEG), + D3D12_VertexShader_NV, sizeof(D3D12_VertexShader_NV), + ROOTSIG_NV }, + { D3D12_PixelShader_NV21_BT601, sizeof(D3D12_PixelShader_NV21_BT601), + D3D12_VertexShader_NV, sizeof(D3D12_VertexShader_NV), + ROOTSIG_NV }, + { D3D12_PixelShader_NV21_BT709, sizeof(D3D12_PixelShader_NV21_BT709), + D3D12_VertexShader_NV, sizeof(D3D12_VertexShader_NV), + ROOTSIG_NV }, +#endif +}; + +static struct +{ + const void *rs_shader_data; + SIZE_T rs_shader_size; +} D3D12_rootsigs[NUM_ROOTSIGS] = { + { D3D12_RootSig_Color, sizeof(D3D12_RootSig_Color) }, + { D3D12_RootSig_Texture, sizeof(D3D12_RootSig_Texture) }, +#if SDL_HAVE_YUV + { D3D12_RootSig_YUV, sizeof(D3D12_RootSig_YUV) }, + { D3D12_RootSig_NV, sizeof(D3D12_RootSig_NV) }, +#endif +}; + +extern "C" void +D3D12_GetVertexShader(D3D12_Shader shader, D3D12_SHADER_BYTECODE *outBytecode) +{ + outBytecode->pShaderBytecode = D3D12_shaders[shader].vs_shader_data; + outBytecode->BytecodeLength = D3D12_shaders[shader].vs_shader_size; +} + +extern "C" void +D3D12_GetPixelShader(D3D12_Shader shader, D3D12_SHADER_BYTECODE *outBytecode) +{ + outBytecode->pShaderBytecode = D3D12_shaders[shader].ps_shader_data; + outBytecode->BytecodeLength = D3D12_shaders[shader].ps_shader_size; +} + +extern "C" D3D12_RootSignature +D3D12_GetRootSignatureType(D3D12_Shader shader) +{ + return D3D12_shaders[shader].root_sig; +} + +extern "C" void +D3D12_GetRootSignatureData(D3D12_RootSignature rootSig, D3D12_SHADER_BYTECODE *outBytecode) +{ + outBytecode->pShaderBytecode = D3D12_rootsigs[rootSig].rs_shader_data; + outBytecode->BytecodeLength = D3D12_rootsigs[rootSig].rs_shader_size; +} + +#endif /* SDL_VIDEO_RENDER_D3D12 && defined(__XBOXSERIES__) */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/thirdparty/SDL/src/render/metal/SDL_render_metal.m b/thirdparty/SDL/src/render/metal/SDL_render_metal.m index 76d1d834e..ee6b88209 100644 --- a/thirdparty/SDL/src/render/metal/SDL_render_metal.m +++ b/thirdparty/SDL/src/render/metal/SDL_render_metal.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_RENDER_METAL && !SDL_RENDER_DISABLED +#if SDL_VIDEO_RENDER_METAL #include "SDL_hints.h" #include "SDL_syswm.h" @@ -1896,6 +1896,6 @@ in case we want to use it later (recreating the renderer) } }; -#endif /* SDL_VIDEO_RENDER_METAL && !SDL_RENDER_DISABLED */ +#endif /* SDL_VIDEO_RENDER_METAL */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/thirdparty/SDL/src/render/opengl/SDL_glfuncs.h b/thirdparty/SDL/src/render/opengl/SDL_glfuncs.h index 42f9ef182..860b9c07a 100644 --- a/thirdparty/SDL/src/render/opengl/SDL_glfuncs.h +++ b/thirdparty/SDL/src/render/opengl/SDL_glfuncs.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/render/opengl/SDL_render_gl.c b/thirdparty/SDL/src/render/opengl/SDL_render_gl.c index 291afba5d..9c266191a 100644 --- a/thirdparty/SDL/src/render/opengl/SDL_render_gl.c +++ b/thirdparty/SDL/src/render/opengl/SDL_render_gl.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_RENDER_OGL && !SDL_RENDER_DISABLED +#if SDL_VIDEO_RENDER_OGL #include "SDL_hints.h" #include "../../video/SDL_sysvideo.h" /* For SDL_GL_SwapWindowWithResult */ #include "SDL_opengl.h" @@ -186,7 +186,7 @@ GL_ClearErrors(SDL_Renderer *renderer) data->errors = 0; data->error_messages = NULL; } - } else if (data->glGetError != NULL) { + } else if (data->glGetError) { while (data->glGetError() != GL_NO_ERROR) { /* continue; */ } @@ -306,7 +306,7 @@ static GL_FBOList *GL_GetFBO(GL_RenderData *data, Uint32 w, Uint32 h) result = result->next; } - if (result == NULL) { + if (!result) { result = SDL_malloc(sizeof(GL_FBOList)); if (result) { result->w = w; @@ -458,6 +458,7 @@ static int GL_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture) GL_ActivateRenderer(renderer); renderdata->drawstate.texture = NULL; /* we trash this state. */ + renderdata->drawstate.texturing = SDL_FALSE; /* we trash this state. */ if (texture->access == SDL_TEXTUREACCESS_TARGET && !renderdata->GL_EXT_framebuffer_object_supported) { @@ -471,7 +472,7 @@ static int GL_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture) } data = (GL_TextureData *)SDL_calloc(1, sizeof(*data)); - if (data == NULL) { + if (!data) { return SDL_OutOfMemory(); } @@ -888,7 +889,7 @@ static int GL_SetRenderTarget(SDL_Renderer *renderer, SDL_Texture *texture) data->drawstate.viewport_dirty = SDL_TRUE; - if (texture == NULL) { + if (!texture) { data->glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); return 0; } @@ -918,7 +919,7 @@ static int GL_QueueDrawPoints(SDL_Renderer *renderer, SDL_RenderCommand *cmd, co GLfloat *verts = (GLfloat *)SDL_AllocateRenderVertices(renderer, count * 2 * sizeof(GLfloat), 0, &cmd->data.draw.first); int i; - if (verts == NULL) { + if (!verts) { return -1; } @@ -938,7 +939,7 @@ static int GL_QueueDrawLines(SDL_Renderer *renderer, SDL_RenderCommand *cmd, con const size_t vertlen = (sizeof(GLfloat) * 2) * count; GLfloat *verts = (GLfloat *)SDL_AllocateRenderVertices(renderer, vertlen, 0, &cmd->data.draw.first); - if (verts == NULL) { + if (!verts) { return -1; } cmd->data.draw.count = count; @@ -983,7 +984,7 @@ static int GL_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_ size_t sz = 2 * sizeof(GLfloat) + 4 * sizeof(Uint8) + (texture ? 2 : 0) * sizeof(GLfloat); verts = (GLfloat *)SDL_AllocateRenderVertices(renderer, count * sz, 0, &cmd->data.draw.first); - if (verts == NULL) { + if (!verts) { return -1; } @@ -1089,7 +1090,7 @@ static int SetDrawState(GL_RenderData *data, const SDL_RenderCommand *cmd, const } if ((cmd->data.draw.texture != NULL) != data->drawstate.texturing) { - if (cmd->data.draw.texture == NULL) { + if (!cmd->data.draw.texture) { data->glDisable(data->textype); data->drawstate.texturing = SDL_FALSE; } else { @@ -1223,6 +1224,7 @@ static int GL_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd, vo if (SDL_memcmp(viewport, &cmd->data.viewport.rect, sizeof(cmd->data.viewport.rect)) != 0) { SDL_copyp(viewport, &cmd->data.viewport.rect); data->drawstate.viewport_dirty = SDL_TRUE; + data->drawstate.cliprect_dirty = SDL_TRUE; } break; } @@ -1294,7 +1296,7 @@ static int GL_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd, vo SDL_RenderCommand *nextcmd = cmd->next; SDL_BlendMode thisblend = cmd->data.draw.blend; - while (nextcmd != NULL) { + while (nextcmd) { const SDL_RenderCommandType nextcmdtype = nextcmd->command; if (nextcmdtype != SDL_RENDERCMD_DRAW_LINES) { break; /* can't go any further on this draw call, different render command up next. */ @@ -1328,7 +1330,7 @@ static int GL_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd, vo SDL_RenderCommand *nextcmd = cmd->next; size_t count = cmd->data.draw.count; int ret; - while (nextcmd != NULL) { + while (nextcmd) { const SDL_RenderCommandType nextcmdtype = nextcmd->command; if (nextcmdtype != thiscmdtype) { break; /* can't go any further on this draw call, different render command up next. */ @@ -1437,7 +1439,7 @@ static int GL_RenderReadPixels(SDL_Renderer *renderer, const SDL_Rect *rect, temp_pitch = rect->w * SDL_BYTESPERPIXEL(temp_format); temp_pixels = SDL_malloc((size_t)rect->h * temp_pitch); - if (temp_pixels == NULL) { + if (!temp_pixels) { return SDL_OutOfMemory(); } @@ -1502,7 +1504,7 @@ static void GL_DestroyTexture(SDL_Renderer *renderer, SDL_Texture *texture) renderdata->drawstate.target = NULL; } - if (data == NULL) { + if (!data) { return; } if (data->texture) { @@ -1524,7 +1526,7 @@ static void GL_DestroyRenderer(SDL_Renderer *renderer) GL_RenderData *data = (GL_RenderData *)renderer->driverdata; if (data) { - if (data->context != NULL) { + if (data->context) { /* make sure we delete the right resources! */ GL_ActivateRenderer(renderer); } @@ -1664,7 +1666,7 @@ static int GL_SetVSync(SDL_Renderer *renderer, const int vsync) if (retval != 0) { return retval; } - if (SDL_GL_GetSwapInterval() > 0) { + if (SDL_GL_GetSwapInterval() != 0) { renderer->info.flags |= SDL_RENDERER_PRESENTVSYNC; } else { renderer->info.flags &= ~SDL_RENDERER_PRESENTVSYNC; @@ -1730,13 +1732,13 @@ static SDL_Renderer *GL_CreateRenderer(SDL_Window *window, Uint32 flags) #endif renderer = (SDL_Renderer *)SDL_calloc(1, sizeof(*renderer)); - if (renderer == NULL) { + if (!renderer) { SDL_OutOfMemory(); goto error; } data = (GL_RenderData *)SDL_calloc(1, sizeof(*data)); - if (data == NULL) { + if (!data) { SDL_free(renderer); SDL_OutOfMemory(); goto error; @@ -1809,7 +1811,7 @@ static SDL_Renderer *GL_CreateRenderer(SDL_Window *window, Uint32 flags) } else { SDL_GL_SetSwapInterval(0); } - if (SDL_GL_GetSwapInterval() > 0) { + if (SDL_GL_GetSwapInterval() != 0) { renderer->info.flags |= SDL_RENDERER_PRESENTVSYNC; } @@ -1831,7 +1833,7 @@ static SDL_Renderer *GL_CreateRenderer(SDL_Window *window, Uint32 flags) } hint = SDL_getenv("GL_ARB_texture_non_power_of_two"); - if (hint == NULL || *hint != '0') { + if (!hint || *hint != '0') { SDL_bool isGL2 = SDL_FALSE; const char *verstr = (const char *)data->glGetString(GL_VERSION); if (verstr) { @@ -1968,6 +1970,6 @@ SDL_RenderDriver GL_RenderDriver = { 0 } }; -#endif /* SDL_VIDEO_RENDER_OGL && !SDL_RENDER_DISABLED */ +#endif /* SDL_VIDEO_RENDER_OGL */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/thirdparty/SDL/src/render/opengl/SDL_shaders_gl.c b/thirdparty/SDL/src/render/opengl/SDL_shaders_gl.c index 82b04cea8..e24a36af9 100644 --- a/thirdparty/SDL/src/render/opengl/SDL_shaders_gl.c +++ b/thirdparty/SDL/src/render/opengl/SDL_shaders_gl.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_RENDER_OGL && !SDL_RENDER_DISABLED +#if SDL_VIDEO_RENDER_OGL #include "SDL_stdinc.h" #include "SDL_opengl.h" @@ -497,7 +497,7 @@ GL_ShaderContext *GL_CreateShaderContext(void) int i; ctx = (GL_ShaderContext *)SDL_calloc(1, sizeof(*ctx)); - if (ctx == NULL) { + if (!ctx) { return NULL; } @@ -577,6 +577,6 @@ void GL_DestroyShaderContext(GL_ShaderContext *ctx) SDL_free(ctx); } -#endif /* SDL_VIDEO_RENDER_OGL && !SDL_RENDER_DISABLED */ +#endif /* SDL_VIDEO_RENDER_OGL */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/thirdparty/SDL/src/render/opengl/SDL_shaders_gl.h b/thirdparty/SDL/src/render/opengl/SDL_shaders_gl.h index abc34b3ce..d237b3ec2 100644 --- a/thirdparty/SDL/src/render/opengl/SDL_shaders_gl.h +++ b/thirdparty/SDL/src/render/opengl/SDL_shaders_gl.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/render/opengles/SDL_glesfuncs.h b/thirdparty/SDL/src/render/opengles/SDL_glesfuncs.h index 2b81b85dd..971b44554 100644 --- a/thirdparty/SDL/src/render/opengles/SDL_glesfuncs.h +++ b/thirdparty/SDL/src/render/opengles/SDL_glesfuncs.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/render/opengles/SDL_render_gles.c b/thirdparty/SDL/src/render/opengles/SDL_render_gles.c index 962acba52..9906b46d8 100644 --- a/thirdparty/SDL/src/render/opengles/SDL_render_gles.c +++ b/thirdparty/SDL/src/render/opengles/SDL_render_gles.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_RENDER_OGL_ES && !SDL_RENDER_DISABLED +#if SDL_VIDEO_RENDER_OGL_ES #include "SDL_hints.h" #include "../../video/SDL_sysvideo.h" /* For SDL_GL_SwapWindowWithResult */ @@ -150,11 +150,11 @@ static int GLES_SetError(const char *prefix, GLenum result) static int GLES_LoadFunctions(GLES_RenderData *data) { -#if SDL_VIDEO_DRIVER_UIKIT +#ifdef SDL_VIDEO_DRIVER_UIKIT #define __SDL_NOGETPROCADDR__ -#elif SDL_VIDEO_DRIVER_ANDROID +#elif defined(SDL_VIDEO_DRIVER_ANDROID) #define __SDL_NOGETPROCADDR__ -#elif SDL_VIDEO_DRIVER_PANDORA +#elif defined(SDL_VIDEO_DRIVER_PANDORA) #define __SDL_NOGETPROCADDR__ #endif @@ -187,7 +187,7 @@ static GLES_FBOList *GLES_GetFBO(GLES_RenderData *data, Uint32 w, Uint32 h) while ((result) && ((result->w != w) || (result->h != h))) { result = result->next; } - if (result == NULL) { + if (!result) { result = SDL_malloc(sizeof(GLES_FBOList)); result->w = w; result->h = h; @@ -322,7 +322,7 @@ static int GLES_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture) GLES_ActivateRenderer(renderer); switch (texture->format) { - case SDL_PIXELFORMAT_ABGR8888: + case SDL_PIXELFORMAT_RGBA32: internalFormat = GL_RGBA; format = GL_RGBA; type = GL_UNSIGNED_BYTE; @@ -332,7 +332,7 @@ static int GLES_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture) } data = (GLES_TextureData *)SDL_calloc(1, sizeof(*data)); - if (data == NULL) { + if (!data) { return SDL_OutOfMemory(); } @@ -424,7 +424,7 @@ static int GLES_UpdateTexture(SDL_Renderer *renderer, SDL_Texture *texture, src = (Uint8 *)pixels; if (pitch != srcPitch) { blob = (Uint8 *)SDL_malloc(srcPitch * rect->h); - if (blob == NULL) { + if (!blob) { return SDL_OutOfMemory(); } src = blob; @@ -510,7 +510,7 @@ static int GLES_SetRenderTarget(SDL_Renderer *renderer, SDL_Texture *texture) data->drawstate.viewport_dirty = SDL_TRUE; - if (texture == NULL) { + if (!texture) { data->glBindFramebufferOES(GL_FRAMEBUFFER_OES, data->window_framebuffer); return 0; } @@ -537,7 +537,7 @@ static int GLES_QueueDrawPoints(SDL_Renderer *renderer, SDL_RenderCommand *cmd, GLfloat *verts = (GLfloat *)SDL_AllocateRenderVertices(renderer, count * 2 * sizeof(GLfloat), 0, &cmd->data.draw.first); int i; - if (verts == NULL) { + if (!verts) { return -1; } @@ -557,7 +557,7 @@ static int GLES_QueueDrawLines(SDL_Renderer *renderer, SDL_RenderCommand *cmd, c const size_t vertlen = (sizeof(GLfloat) * 2) * count; GLfloat *verts = (GLfloat *)SDL_AllocateRenderVertices(renderer, vertlen, 0, &cmd->data.draw.first); - if (verts == NULL) { + if (!verts) { return -1; } cmd->data.draw.count = count; @@ -602,7 +602,7 @@ static int GLES_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SD int sz = 2 + 4 + (texture ? 2 : 0); verts = (GLfloat *)SDL_AllocateRenderVertices(renderer, count * sz * sizeof(GLfloat), 0, &cmd->data.draw.first); - if (verts == NULL) { + if (!verts) { return -1; } @@ -900,7 +900,7 @@ static int GLES_RenderReadPixels(SDL_Renderer *renderer, const SDL_Rect *rect, Uint32 pixel_format, void *pixels, int pitch) { GLES_RenderData *data = (GLES_RenderData *)renderer->driverdata; - Uint32 temp_format = renderer->target ? renderer->target->format : SDL_PIXELFORMAT_ABGR8888; + Uint32 temp_format = renderer->target ? renderer->target->format : SDL_PIXELFORMAT_RGBA32; void *temp_pixels; int temp_pitch; Uint8 *src, *dst, *tmp; @@ -911,7 +911,7 @@ static int GLES_RenderReadPixels(SDL_Renderer *renderer, const SDL_Rect *rect, temp_pitch = rect->w * SDL_BYTESPERPIXEL(temp_format); temp_pixels = SDL_malloc(rect->h * temp_pitch); - if (temp_pixels == NULL) { + if (!temp_pixels) { return SDL_OutOfMemory(); } @@ -970,7 +970,7 @@ static void GLES_DestroyTexture(SDL_Renderer *renderer, SDL_Texture *texture) renderdata->drawstate.target = NULL; } - if (data == NULL) { + if (!data) { return; } if (data->texture) { @@ -1046,7 +1046,7 @@ static int GLES_SetVSync(SDL_Renderer *renderer, const int vsync) if (retval != 0) { return retval; } - if (SDL_GL_GetSwapInterval() > 0) { + if (SDL_GL_GetSwapInterval() != 0) { renderer->info.flags |= SDL_RENDERER_PRESENTVSYNC; } else { renderer->info.flags &= ~SDL_RENDERER_PRESENTVSYNC; @@ -1082,13 +1082,13 @@ static SDL_Renderer *GLES_CreateRenderer(SDL_Window *window, Uint32 flags) } renderer = (SDL_Renderer *)SDL_calloc(1, sizeof(*renderer)); - if (renderer == NULL) { + if (!renderer) { SDL_OutOfMemory(); goto error; } data = (GLES_RenderData *)SDL_calloc(1, sizeof(*data)); - if (data == NULL) { + if (!data) { GLES_DestroyRenderer(renderer); SDL_OutOfMemory(); goto error; @@ -1141,7 +1141,7 @@ static SDL_Renderer *GLES_CreateRenderer(SDL_Window *window, Uint32 flags) } else { SDL_GL_SetSwapInterval(0); } - if (SDL_GL_GetSwapInterval() > 0) { + if (SDL_GL_GetSwapInterval() != 0) { renderer->info.flags |= SDL_RENDERER_PRESENTVSYNC; } @@ -1210,11 +1210,11 @@ SDL_RenderDriver GLES_RenderDriver = { { "opengles", (SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC), 1, - { SDL_PIXELFORMAT_ABGR8888 }, + { SDL_PIXELFORMAT_RGBA32 }, 0, 0 } }; -#endif /* SDL_VIDEO_RENDER_OGL_ES && !SDL_RENDER_DISABLED */ +#endif /* SDL_VIDEO_RENDER_OGL_ES */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/thirdparty/SDL/src/render/opengles2/SDL_gles2funcs.h b/thirdparty/SDL/src/render/opengles2/SDL_gles2funcs.h index 4a90bced9..b808b767c 100644 --- a/thirdparty/SDL/src/render/opengles2/SDL_gles2funcs.h +++ b/thirdparty/SDL/src/render/opengles2/SDL_gles2funcs.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -53,7 +53,7 @@ SDL_PROC(void, glPixelStorei, (GLenum, GLint)) SDL_PROC(void, glReadPixels, (GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, GLvoid *)) SDL_PROC(void, glScissor, (GLint, GLint, GLsizei, GLsizei)) SDL_PROC(void, glShaderBinary, (GLsizei, const GLuint *, GLenum, const void *, GLsizei)) -#if __NACL__ +#ifdef __NACL__ SDL_PROC(void, glShaderSource, (GLuint, GLsizei, const GLchar **, const GLint *)) #else SDL_PROC(void, glShaderSource, (GLuint, GLsizei, const GLchar* const*, const GLint *)) diff --git a/thirdparty/SDL/src/render/opengles2/SDL_render_gles2.c b/thirdparty/SDL/src/render/opengles2/SDL_render_gles2.c index c5f53af2d..43aebda0f 100644 --- a/thirdparty/SDL/src/render/opengles2/SDL_render_gles2.c +++ b/thirdparty/SDL/src/render/opengles2/SDL_render_gles2.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_RENDER_OGL_ES2 && !SDL_RENDER_DISABLED +#if SDL_VIDEO_RENDER_OGL_ES2 #include "SDL_hints.h" #include "../../video/SDL_sysvideo.h" /* For SDL_GL_SwapWindowWithResult */ @@ -220,7 +220,7 @@ GL_CheckAllErrors(const char *prefix, SDL_Renderer *renderer, const char *file, for (;;) { GLenum error = data->glGetError(); if (error != GL_NO_ERROR) { - if (prefix == NULL || prefix[0] == '\0') { + if (!prefix || prefix[0] == '\0') { prefix = "generic"; } SDL_SetError("%s: %s (%d): %s %s (0x%X)", prefix, file, line, function, GL_TranslateError(error), error); @@ -244,11 +244,11 @@ GL_CheckAllErrors(const char *prefix, SDL_Renderer *renderer, const char *file, static int GLES2_LoadFunctions(GLES2_RenderData *data) { -#if SDL_VIDEO_DRIVER_UIKIT +#ifdef SDL_VIDEO_DRIVER_UIKIT #define __SDL_NOGETPROCADDR__ -#elif SDL_VIDEO_DRIVER_ANDROID +#elif defined(SDL_VIDEO_DRIVER_ANDROID) #define __SDL_NOGETPROCADDR__ -#elif SDL_VIDEO_DRIVER_PANDORA +#elif defined(SDL_VIDEO_DRIVER_PANDORA) #define __SDL_NOGETPROCADDR__ #endif @@ -275,7 +275,7 @@ static GLES2_FBOList *GLES2_GetFBO(GLES2_RenderData *data, Uint32 w, Uint32 h) while ((result) && ((result->w != w) || (result->h != h))) { result = result->next; } - if (result == NULL) { + if (!result) { result = SDL_malloc(sizeof(GLES2_FBOList)); result->w = w; result->h = h; @@ -427,7 +427,7 @@ static GLES2_ProgramCacheEntry *GLES2_CacheProgram(GLES2_RenderData *data, GLuin /* Create a program cache entry */ entry = (GLES2_ProgramCacheEntry *)SDL_calloc(1, sizeof(GLES2_ProgramCacheEntry)); - if (entry == NULL) { + if (!entry) { SDL_OutOfMemory(); return NULL; } @@ -488,7 +488,7 @@ static GLES2_ProgramCacheEntry *GLES2_CacheProgram(GLES2_RenderData *data, GLuin if (data->program_cache.count > GLES2_MAX_CACHED_PROGRAMS) { data->glDeleteProgram(data->program_cache.tail->id); data->program_cache.tail = data->program_cache.tail->prev; - if (data->program_cache.tail != NULL) { + if (data->program_cache.tail) { SDL_free(data->program_cache.tail->next); data->program_cache.tail->next = NULL; } @@ -505,7 +505,7 @@ static GLuint GLES2_CacheShader(GLES2_RenderData *data, GLES2_ShaderType type, G const GLchar *shader_src_list[3]; const GLchar *shader_body = GLES2_GetShader(type); - if (shader_body == NULL) { + if (!shader_body) { SDL_SetError("No shader body src"); return 0; } @@ -715,7 +715,7 @@ static int GLES2_SelectProgram(GLES2_RenderData *data, GLES2_ImageSource source, /* Generate a matching program */ program = GLES2_CacheProgram(data, vertex, fragment); - if (program == NULL) { + if (!program) { goto fault; } @@ -739,7 +739,7 @@ static int GLES2_QueueSetViewport(SDL_Renderer *renderer, SDL_RenderCommand *cmd static int GLES2_QueueDrawPoints(SDL_Renderer *renderer, SDL_RenderCommand *cmd, const SDL_FPoint *points, int count) { - const SDL_bool colorswap = (renderer->target && (renderer->target->format == SDL_PIXELFORMAT_ARGB8888 || renderer->target->format == SDL_PIXELFORMAT_RGB888)); + const SDL_bool colorswap = (renderer->target && (renderer->target->format == SDL_PIXELFORMAT_BGRA32 || renderer->target->format == SDL_PIXELFORMAT_BGRX32)); SDL_VertexSolid *verts = (SDL_VertexSolid *)SDL_AllocateRenderVertices(renderer, count * sizeof(*verts), 0, &cmd->data.draw.first); int i; SDL_Color color; @@ -748,7 +748,7 @@ static int GLES2_QueueDrawPoints(SDL_Renderer *renderer, SDL_RenderCommand *cmd, color.b = cmd->data.draw.b; color.a = cmd->data.draw.a; - if (verts == NULL) { + if (!verts) { return -1; } @@ -771,7 +771,7 @@ static int GLES2_QueueDrawPoints(SDL_Renderer *renderer, SDL_RenderCommand *cmd, static int GLES2_QueueDrawLines(SDL_Renderer *renderer, SDL_RenderCommand *cmd, const SDL_FPoint *points, int count) { - const SDL_bool colorswap = (renderer->target && (renderer->target->format == SDL_PIXELFORMAT_ARGB8888 || renderer->target->format == SDL_PIXELFORMAT_RGB888)); + const SDL_bool colorswap = (renderer->target && (renderer->target->format == SDL_PIXELFORMAT_BGRA32 || renderer->target->format == SDL_PIXELFORMAT_BGRX32)); int i; GLfloat prevx, prevy; SDL_VertexSolid *verts = (SDL_VertexSolid *)SDL_AllocateRenderVertices(renderer, count * sizeof(*verts), 0, &cmd->data.draw.first); @@ -781,7 +781,7 @@ static int GLES2_QueueDrawLines(SDL_Renderer *renderer, SDL_RenderCommand *cmd, color.b = cmd->data.draw.b; color.a = cmd->data.draw.a; - if (verts == NULL) { + if (!verts) { return -1; } @@ -831,7 +831,7 @@ static int GLES2_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, S float scale_x, float scale_y) { int i; - const SDL_bool colorswap = (renderer->target && (renderer->target->format == SDL_PIXELFORMAT_ARGB8888 || renderer->target->format == SDL_PIXELFORMAT_RGB888)); + const SDL_bool colorswap = (renderer->target && (renderer->target->format == SDL_PIXELFORMAT_BGRA32 || renderer->target->format == SDL_PIXELFORMAT_BGRX32)); int count = indices ? num_indices : num_vertices; cmd->data.draw.count = count; @@ -839,7 +839,7 @@ static int GLES2_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, S if (texture) { SDL_Vertex *verts = (SDL_Vertex *)SDL_AllocateRenderVertices(renderer, count * sizeof(*verts), 0, &cmd->data.draw.first); - if (verts == NULL) { + if (!verts) { return -1; } @@ -879,7 +879,7 @@ static int GLES2_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, S } else { SDL_VertexSolid *verts = (SDL_VertexSolid *)SDL_AllocateRenderVertices(renderer, count * sizeof(*verts), 0, &cmd->data.draw.first); - if (verts == NULL) { + if (!verts) { return -1; } @@ -959,7 +959,7 @@ static int SetDrawState(GLES2_RenderData *data, const SDL_RenderCommand *cmd, co } if ((texture != NULL) != data->drawstate.texturing) { - if (texture == NULL) { + if (!texture) { data->glDisableVertexAttribArray((GLenum)GLES2_ATTRIBUTE_TEXCOORD); data->drawstate.texturing = SDL_FALSE; } else { @@ -1029,50 +1029,50 @@ static int SetCopyState(SDL_Renderer *renderer, const SDL_RenderCommand *cmd, vo /* Check if we need to do color mapping between the source and render target textures */ if (renderer->target->format != texture->format) { switch (texture->format) { - case SDL_PIXELFORMAT_ARGB8888: + case SDL_PIXELFORMAT_BGRA32: switch (renderer->target->format) { - case SDL_PIXELFORMAT_ABGR8888: - case SDL_PIXELFORMAT_BGR888: + case SDL_PIXELFORMAT_RGBA32: + case SDL_PIXELFORMAT_RGBX32: sourceType = GLES2_IMAGESOURCE_TEXTURE_ARGB; break; - case SDL_PIXELFORMAT_RGB888: + case SDL_PIXELFORMAT_BGRX32: sourceType = GLES2_IMAGESOURCE_TEXTURE_ABGR; break; } break; - case SDL_PIXELFORMAT_ABGR8888: + case SDL_PIXELFORMAT_RGBA32: switch (renderer->target->format) { - case SDL_PIXELFORMAT_ARGB8888: - case SDL_PIXELFORMAT_RGB888: + case SDL_PIXELFORMAT_BGRA32: + case SDL_PIXELFORMAT_BGRX32: sourceType = GLES2_IMAGESOURCE_TEXTURE_ARGB; break; - case SDL_PIXELFORMAT_BGR888: + case SDL_PIXELFORMAT_RGBX32: sourceType = GLES2_IMAGESOURCE_TEXTURE_ABGR; break; } break; - case SDL_PIXELFORMAT_RGB888: + case SDL_PIXELFORMAT_BGRX32: switch (renderer->target->format) { - case SDL_PIXELFORMAT_ABGR8888: + case SDL_PIXELFORMAT_RGBA32: sourceType = GLES2_IMAGESOURCE_TEXTURE_ARGB; break; - case SDL_PIXELFORMAT_ARGB8888: + case SDL_PIXELFORMAT_BGRA32: sourceType = GLES2_IMAGESOURCE_TEXTURE_BGR; break; - case SDL_PIXELFORMAT_BGR888: + case SDL_PIXELFORMAT_RGBX32: sourceType = GLES2_IMAGESOURCE_TEXTURE_ARGB; break; } break; - case SDL_PIXELFORMAT_BGR888: + case SDL_PIXELFORMAT_RGBX32: switch (renderer->target->format) { - case SDL_PIXELFORMAT_ABGR8888: + case SDL_PIXELFORMAT_RGBA32: sourceType = GLES2_IMAGESOURCE_TEXTURE_BGR; break; - case SDL_PIXELFORMAT_ARGB8888: + case SDL_PIXELFORMAT_BGRA32: sourceType = GLES2_IMAGESOURCE_TEXTURE_RGB; break; - case SDL_PIXELFORMAT_RGB888: + case SDL_PIXELFORMAT_BGRX32: sourceType = GLES2_IMAGESOURCE_TEXTURE_ARGB; break; } @@ -1100,16 +1100,16 @@ static int SetCopyState(SDL_Renderer *renderer, const SDL_RenderCommand *cmd, vo } } else { switch (texture->format) { - case SDL_PIXELFORMAT_ARGB8888: + case SDL_PIXELFORMAT_BGRA32: sourceType = GLES2_IMAGESOURCE_TEXTURE_ARGB; break; - case SDL_PIXELFORMAT_ABGR8888: + case SDL_PIXELFORMAT_RGBA32: sourceType = GLES2_IMAGESOURCE_TEXTURE_ABGR; break; - case SDL_PIXELFORMAT_RGB888: + case SDL_PIXELFORMAT_BGRX32: sourceType = GLES2_IMAGESOURCE_TEXTURE_RGB; break; - case SDL_PIXELFORMAT_BGR888: + case SDL_PIXELFORMAT_RGBX32: sourceType = GLES2_IMAGESOURCE_TEXTURE_BGR; break; #if SDL_HAVE_YUV @@ -1162,7 +1162,7 @@ static int SetCopyState(SDL_Renderer *renderer, const SDL_RenderCommand *cmd, vo static int GLES2_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd, void *vertices, size_t vertsize) { GLES2_RenderData *data = (GLES2_RenderData *)renderer->driverdata; - const SDL_bool colorswap = (renderer->target && (renderer->target->format == SDL_PIXELFORMAT_ARGB8888 || renderer->target->format == SDL_PIXELFORMAT_RGB888)); + const SDL_bool colorswap = (renderer->target && (renderer->target->format == SDL_PIXELFORMAT_BGRA32 || renderer->target->format == SDL_PIXELFORMAT_BGRX32)); #if USE_VERTEX_BUFFER_OBJECTS const int vboidx = data->current_vertex_buffer; @@ -1216,6 +1216,7 @@ static int GLES2_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd, if (SDL_memcmp(viewport, &cmd->data.viewport.rect, sizeof(cmd->data.viewport.rect)) != 0) { SDL_copyp(viewport, &cmd->data.viewport.rect); data->drawstate.viewport_dirty = SDL_TRUE; + data->drawstate.cliprect_dirty = SDL_TRUE; } break; } @@ -1282,7 +1283,7 @@ static int GLES2_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_RenderCommand *nextcmd = cmd->next; SDL_BlendMode thisblend = cmd->data.draw.blend; - while (nextcmd != NULL) { + while (nextcmd) { const SDL_RenderCommandType nextcmdtype = nextcmd->command; if (nextcmdtype != SDL_RENDERCMD_DRAW_LINES) { break; /* can't go any further on this draw call, different render command up next. */ @@ -1316,7 +1317,7 @@ static int GLES2_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_RenderCommand *nextcmd = cmd->next; size_t count = cmd->data.draw.count; int ret; - while (nextcmd != NULL) { + while (nextcmd) { const SDL_RenderCommandType nextcmdtype = nextcmd->command; if (nextcmdtype != thiscmdtype) { break; /* can't go any further on this draw call, different render command up next. */ @@ -1422,10 +1423,10 @@ static int GLES2_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture) /* Determine the corresponding GLES texture format params */ switch (texture->format) { - case SDL_PIXELFORMAT_ARGB8888: - case SDL_PIXELFORMAT_ABGR8888: - case SDL_PIXELFORMAT_RGB888: - case SDL_PIXELFORMAT_BGR888: + case SDL_PIXELFORMAT_BGRA32: + case SDL_PIXELFORMAT_RGBA32: + case SDL_PIXELFORMAT_BGRX32: + case SDL_PIXELFORMAT_RGBX32: format = GL_RGBA; type = GL_UNSIGNED_BYTE; break; @@ -1455,7 +1456,7 @@ static int GLES2_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture) /* Allocate a texture struct */ data = (GLES2_TextureData *)SDL_calloc(1, sizeof(GLES2_TextureData)); - if (data == NULL) { + if (!data) { return SDL_OutOfMemory(); } data->texture = 0; @@ -1574,9 +1575,6 @@ static int GLES2_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture) static int GLES2_TexSubImage2D(GLES2_RenderData *data, GLenum target, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels, GLint pitch, GLint bpp) { Uint8 *blob = NULL; -#if SDL_BYTEORDER == SDL_BIG_ENDIAN - Uint32 *blob2 = NULL; -#endif Uint8 *src; size_t src_pitch; int y; @@ -1590,7 +1588,7 @@ static int GLES2_TexSubImage2D(GLES2_RenderData *data, GLenum target, GLint xoff src = (Uint8 *)pixels; if (pitch != src_pitch) { blob = (Uint8 *)SDL_malloc(src_pitch * height); - if (blob == NULL) { + if (!blob) { return SDL_OutOfMemory(); } src = blob; @@ -1602,33 +1600,10 @@ static int GLES2_TexSubImage2D(GLES2_RenderData *data, GLenum target, GLint xoff src = blob; } -#if SDL_BYTEORDER == SDL_BIG_ENDIAN - if (format == GL_RGBA) { - int i; - Uint32 *src32 = (Uint32 *)src; - blob2 = (Uint32 *)SDL_malloc(src_pitch * height); - if (blob2 == NULL) { - if (blob) { - SDL_free(blob); - } - return SDL_OutOfMemory(); - } - for (i = 0; i < (src_pitch * height) / 4; i++) { - blob2[i] = SDL_Swap32(src32[i]); - } - src = (Uint8 *)blob2; - } -#endif - data->glTexSubImage2D(target, 0, xoffset, yoffset, width, height, format, type, src); if (blob) { SDL_free(blob); } -#if SDL_BYTEORDER == SDL_BIG_ENDIAN - if (blob2) { - SDL_free(blob2); - } -#endif return 0; } @@ -1868,7 +1843,7 @@ static int GLES2_SetRenderTarget(SDL_Renderer *renderer, SDL_Texture *texture) data->drawstate.viewport_dirty = SDL_TRUE; - if (texture == NULL) { + if (!texture) { data->glBindFramebuffer(GL_FRAMEBUFFER, data->window_framebuffer); } else { texturedata = (GLES2_TextureData *)texture->driverdata; @@ -1919,7 +1894,7 @@ static int GLES2_RenderReadPixels(SDL_Renderer *renderer, const SDL_Rect *rect, Uint32 pixel_format, void *pixels, int pitch) { GLES2_RenderData *data = (GLES2_RenderData *)renderer->driverdata; - Uint32 temp_format = renderer->target ? renderer->target->format : SDL_PIXELFORMAT_ABGR8888; + Uint32 temp_format = renderer->target ? renderer->target->format : SDL_PIXELFORMAT_RGBA32; size_t buflen; void *temp_pixels; int temp_pitch; @@ -1934,7 +1909,7 @@ static int GLES2_RenderReadPixels(SDL_Renderer *renderer, const SDL_Rect *rect, } temp_pixels = SDL_malloc(buflen); - if (temp_pixels == NULL) { + if (!temp_pixels) { return SDL_OutOfMemory(); } @@ -1989,7 +1964,7 @@ static int GLES2_SetVSync(SDL_Renderer *renderer, const int vsync) if (retval != 0) { return retval; } - if (SDL_GL_GetSwapInterval() > 0) { + if (SDL_GL_GetSwapInterval() != 0) { renderer->info.flags |= SDL_RENDERER_PRESENTVSYNC; } else { renderer->info.flags &= ~SDL_RENDERER_PRESENTVSYNC; @@ -2093,13 +2068,13 @@ static SDL_Renderer *GLES2_CreateRenderer(SDL_Window *window, Uint32 flags) /* Create the renderer struct */ renderer = (SDL_Renderer *)SDL_calloc(1, sizeof(SDL_Renderer)); - if (renderer == NULL) { + if (!renderer) { SDL_OutOfMemory(); goto error; } data = (GLES2_RenderData *)SDL_calloc(1, sizeof(GLES2_RenderData)); - if (data == NULL) { + if (!data) { SDL_free(renderer); SDL_OutOfMemory(); goto error; @@ -2137,7 +2112,7 @@ static SDL_Renderer *GLES2_CreateRenderer(SDL_Window *window, Uint32 flags) goto error; } -#if __WINRT__ +#ifdef __WINRT__ /* DLudwig, 2013-11-29: ANGLE for WinRT doesn't seem to work unless VSync * is turned on. Not doing so will freeze the screen's contents to that * of the first drawn frame. @@ -2150,7 +2125,7 @@ static SDL_Renderer *GLES2_CreateRenderer(SDL_Window *window, Uint32 flags) } else { SDL_GL_SetSwapInterval(0); } - if (SDL_GL_GetSwapInterval() > 0) { + if (SDL_GL_GetSwapInterval() != 0) { renderer->info.flags |= SDL_RENDERER_PRESENTVSYNC; } @@ -2262,14 +2237,14 @@ SDL_RenderDriver GLES2_RenderDriver = { { "opengles2", (SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_TARGETTEXTURE), 4, - { SDL_PIXELFORMAT_ARGB8888, - SDL_PIXELFORMAT_ABGR8888, - SDL_PIXELFORMAT_RGB888, - SDL_PIXELFORMAT_BGR888 }, + { SDL_PIXELFORMAT_RGBA32, + SDL_PIXELFORMAT_BGRA32, + SDL_PIXELFORMAT_BGRX32, + SDL_PIXELFORMAT_RGBX32 }, 0, 0 } }; -#endif /* SDL_VIDEO_RENDER_OGL_ES2 && !SDL_RENDER_DISABLED */ +#endif /* SDL_VIDEO_RENDER_OGL_ES2 */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/thirdparty/SDL/src/render/opengles2/SDL_shaders_gles2.c b/thirdparty/SDL/src/render/opengles2/SDL_shaders_gles2.c index 50c86d6ea..9a434f40b 100644 --- a/thirdparty/SDL/src/render/opengles2/SDL_shaders_gles2.c +++ b/thirdparty/SDL/src/render/opengles2/SDL_shaders_gles2.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_RENDER_OGL_ES2 && !SDL_RENDER_DISABLED +#if SDL_VIDEO_RENDER_OGL_ES2 #include "SDL_hints.h" #include "SDL_video.h" @@ -380,7 +380,7 @@ const char *GLES2_GetShaderInclude(GLES2_ShaderIncludeType type) } } -GLES2_ShaderIncludeType GLES2_GetTexCoordPrecisionEnumFromHint() +GLES2_ShaderIncludeType GLES2_GetTexCoordPrecisionEnumFromHint(void) { const char *texcoord_hint = SDL_GetHint("SDL_RENDER_OPENGLES2_TEXCOORD_PRECISION"); GLES2_ShaderIncludeType value = GLES2_SHADER_FRAGMENT_INCLUDE_BEST_TEXCOORD_PRECISION; @@ -444,6 +444,6 @@ const char *GLES2_GetShader(GLES2_ShaderType type) } } -#endif /* SDL_VIDEO_RENDER_OGL_ES2 && !SDL_RENDER_DISABLED */ +#endif /* SDL_VIDEO_RENDER_OGL_ES2 */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/thirdparty/SDL/src/render/opengles2/SDL_shaders_gles2.h b/thirdparty/SDL/src/render/opengles2/SDL_shaders_gles2.h index b358f38f2..0be234f3c 100644 --- a/thirdparty/SDL/src/render/opengles2/SDL_shaders_gles2.h +++ b/thirdparty/SDL/src/render/opengles2/SDL_shaders_gles2.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/render/ps2/SDL_render_ps2.c b/thirdparty/SDL/src/render/ps2/SDL_render_ps2.c index dc4bafaab..2d3dfa199 100644 --- a/thirdparty/SDL/src/render/ps2/SDL_render_ps2.c +++ b/thirdparty/SDL/src/render/ps2/SDL_render_ps2.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -47,6 +47,7 @@ typedef struct { GSGLOBAL *gsGlobal; uint64_t drawColor; + SDL_Rect *viewport; int32_t vsync_callback_id; uint8_t vsync; /* 0 (Disabled), 1 (Enabled), 2 (Dynamic) */ } PS2_RenderData; @@ -54,7 +55,7 @@ typedef struct static int vsync_sema_id = 0; /* PRIVATE METHODS */ -static int vsync_handler() +static int vsync_handler(void) { iSignalSema(vsync_sema_id); @@ -105,7 +106,7 @@ static int PS2_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture) { GSTEXTURE *ps2_tex = (GSTEXTURE *)SDL_calloc(1, sizeof(GSTEXTURE)); - if (ps2_tex == NULL) { + if (!ps2_tex) { return SDL_OutOfMemory(); } @@ -190,6 +191,19 @@ static int PS2_SetRenderTarget(SDL_Renderer *renderer, SDL_Texture *texture) } static int PS2_QueueSetViewport(SDL_Renderer *renderer, SDL_RenderCommand *cmd) +{ + PS2_RenderData *data = (PS2_RenderData *)renderer->driverdata; + const SDL_Rect *viewport = &cmd->data.viewport.rect; + data->viewport = (SDL_Rect *)viewport; + + data->gsGlobal->OffsetX = (int)((2048.0f + (float)viewport->x) * 16.0f); + data->gsGlobal->OffsetY = (int)((2048.0f + (float)viewport->y) * 16.0f); + gsKit_set_scissor(data->gsGlobal, GS_SETREG_SCISSOR(viewport->x, viewport->x + viewport->w, viewport->y, viewport->y + viewport->h)); + + return 0; +} + +static int PS2_QueueSetDrawColor(SDL_Renderer *renderer, SDL_RenderCommand *cmd) { return 0; /* nothing to do in this backend. */ } @@ -202,16 +216,16 @@ static int PS2_QueueDrawPoints(SDL_Renderer *renderer, SDL_RenderCommand *cmd, c gs_rgbaq rgbaq; int i; - if (vertices == NULL) { + if (!vertices) { return -1; } cmd->data.draw.count = count; - colorR = cmd->data.draw.r >> 1; - colorG = cmd->data.draw.g >> 1; - colorB = cmd->data.draw.b >> 1; - colorA = cmd->data.draw.a >> 1; + colorR = cmd->data.draw.r; + colorG = cmd->data.draw.g; + colorB = cmd->data.draw.b; + colorA = cmd->data.draw.a; rgbaq = color_to_RGBAQ(colorR, colorG, colorB, colorA, 0.0f); for (i = 0; i < count; i++, vertices++, points++) { @@ -237,7 +251,7 @@ static int PS2_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL GSPRIMUVPOINT *vertices = (GSPRIMUVPOINT *) SDL_AllocateRenderVertices(renderer, count * sizeof(GSPRIMUVPOINT), 4, &cmd->data.draw.first); GSTEXTURE *ps2_tex = (GSTEXTURE *) texture->driverdata; - if (vertices == NULL) { + if (!vertices) { return -1; } @@ -261,7 +275,7 @@ static int PS2_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL uv_ = (float *)((char *)uv + j * uv_stride); vertices->xyz2 = vertex_to_XYZ2(data->gsGlobal, xy_[0] * scale_x, xy_[1] * scale_y, 0); - vertices->rgbaq = color_to_RGBAQ(col_.r >> 1, col_.g >> 1, col_.b >> 1, col_.a >> 1, 0); + vertices->rgbaq = color_to_RGBAQ(col_.r, col_.g, col_.b, col_.a, 0); vertices->uv = vertex_to_UV(ps2_tex, uv_[0] * ps2_tex->Width, uv_[1] * ps2_tex->Height); vertices++; @@ -270,7 +284,7 @@ static int PS2_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL } else { GSPRIMPOINT *vertices = (GSPRIMPOINT *)SDL_AllocateRenderVertices(renderer, count * sizeof(GSPRIMPOINT), 4, &cmd->data.draw.first); - if (vertices == NULL) { + if (!vertices) { return -1; } @@ -292,7 +306,7 @@ static int PS2_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL col_ = *(SDL_Color *)((char *)color + j * color_stride); vertices->xyz2 = vertex_to_XYZ2(data->gsGlobal, xy_[0] * scale_x, xy_[1] * scale_y, 0); - vertices->rgbaq = color_to_RGBAQ(col_.r >> 1, col_.g >> 1, col_.b >> 1, col_.a >> 1, 0.0f); + vertices->rgbaq = color_to_RGBAQ(col_.r, col_.g, col_.b, col_.a, 0.0f); vertices++; } @@ -303,26 +317,24 @@ static int PS2_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL static int PS2_RenderSetViewPort(SDL_Renderer *renderer, SDL_RenderCommand *cmd) { - PS2_RenderData *data = (PS2_RenderData *)renderer->driverdata; - const SDL_Rect *viewport = &cmd->data.viewport.rect; - - gsKit_set_display_offset(data->gsGlobal, viewport->x, viewport->y); - gsKit_set_scissor(data->gsGlobal, GS_SETREG_SCISSOR(viewport->x, viewport->y, viewport->w, viewport->h)); - - return 0; + return 0; /* nothing to do in this backend. */ } static int PS2_RenderSetClipRect(SDL_Renderer *renderer, SDL_RenderCommand *cmd) { PS2_RenderData *data = (PS2_RenderData *)renderer->driverdata; + SDL_Rect *viewport = data->viewport; const SDL_Rect *rect = &cmd->data.cliprect.rect; if (cmd->data.cliprect.enabled) { - gsKit_set_scissor(data->gsGlobal, GS_SETREG_SCISSOR(rect->x, rect->y, rect->w, rect->h)); - } else { - gsKit_set_scissor(data->gsGlobal, GS_SCISSOR_RESET); + /* We need to do it relative to saved viewport */ + viewport->x += rect->x; + viewport->y += rect->y; + viewport->w = SDL_min(viewport->w, rect->w); + viewport->h = SDL_min(viewport->h, rect->h); } + gsKit_set_scissor(data->gsGlobal, GS_SETREG_SCISSOR(viewport->x, viewport->x + viewport->w, viewport->y, viewport->y + viewport->h)); return 0; } @@ -333,26 +345,43 @@ static int PS2_RenderSetDrawColor(SDL_Renderer *renderer, SDL_RenderCommand *cmd PS2_RenderData *data = (PS2_RenderData *)renderer->driverdata; - colorR = (cmd->data.color.r) >> 1; - colorG = (cmd->data.color.g) >> 1; - colorB = (cmd->data.color.b) >> 1; - colorA = (cmd->data.color.a) >> 1; + colorR = (cmd->data.color.r); + colorG = (cmd->data.color.g); + colorB = (cmd->data.color.b); + colorA = (cmd->data.color.a); data->drawColor = GS_SETREG_RGBAQ(colorR, colorG, colorB, colorA, 0x00); return 0; } static int PS2_RenderClear(SDL_Renderer *renderer, SDL_RenderCommand *cmd) { - int colorR, colorG, colorB, colorA; + int colorR, colorG, colorB, colorA, offsetX, offsetY; + SDL_Rect *viewport; PS2_RenderData *data = (PS2_RenderData *)renderer->driverdata; - colorR = (cmd->data.color.r) >> 1; - colorG = (cmd->data.color.g) >> 1; - colorB = (cmd->data.color.b) >> 1; - colorA = (cmd->data.color.a) >> 1; + colorR = (cmd->data.color.r); + colorG = (cmd->data.color.g); + colorB = (cmd->data.color.b); + colorA = (cmd->data.color.a); + + /* Clear the screen, so let's put default viewport */ + gsKit_set_scissor(data->gsGlobal, GS_SCISSOR_RESET); + /* Put back original offset */ + offsetX = data->gsGlobal->OffsetX; + offsetY = data->gsGlobal->OffsetY; + data->gsGlobal->OffsetX = (int)(2048.0f * 16.0f); + data->gsGlobal->OffsetY = (int)(2048.0f * 16.0f); gsKit_clear(data->gsGlobal, GS_SETREG_RGBAQ(colorR, colorG, colorB, colorA, 0x00)); + /* Put back original offset */ + data->gsGlobal->OffsetX = offsetX; + data->gsGlobal->OffsetY = offsetY; + + // /* Put back view port */ + viewport = data->viewport; + gsKit_set_scissor(data->gsGlobal, GS_SETREG_SCISSOR(viewport->x, viewport->x + viewport->w, viewport->y, viewport->y + viewport->h)); + return 0; } @@ -448,6 +477,7 @@ static int PS2_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd, v case SDL_RENDERCMD_SETVIEWPORT: { PS2_RenderSetViewPort(renderer, cmd); + /* FIXME: We need to update the clip rect too, see https://github.com/libsdl-org/SDL/issues/9094 */ break; } case SDL_RENDERCMD_SETCLIPRECT: @@ -531,11 +561,11 @@ static void PS2_DestroyTexture(SDL_Renderer *renderer, SDL_Texture *texture) GSTEXTURE *ps2_texture = (GSTEXTURE *)texture->driverdata; PS2_RenderData *data = (PS2_RenderData *)renderer->driverdata; - if (data == NULL) { + if (!data) { return; } - if (ps2_texture == NULL) { + if (!ps2_texture) { return; } @@ -584,13 +614,13 @@ static SDL_Renderer *PS2_CreateRenderer(SDL_Window *window, Uint32 flags) SDL_bool dynamicVsync; renderer = (SDL_Renderer *)SDL_calloc(1, sizeof(*renderer)); - if (renderer == NULL) { + if (!renderer) { SDL_OutOfMemory(); return NULL; } data = (PS2_RenderData *)SDL_calloc(1, sizeof(*data)); - if (data == NULL) { + if (!data) { PS2_DestroyRenderer(renderer); SDL_OutOfMemory(); return NULL; @@ -645,7 +675,7 @@ static SDL_Renderer *PS2_CreateRenderer(SDL_Window *window, Uint32 flags) renderer->SetTextureScaleMode = PS2_SetTextureScaleMode; renderer->SetRenderTarget = PS2_SetRenderTarget; renderer->QueueSetViewport = PS2_QueueSetViewport; - renderer->QueueSetDrawColor = PS2_QueueSetViewport; + renderer->QueueSetDrawColor = PS2_QueueSetDrawColor; renderer->QueueDrawPoints = PS2_QueueDrawPoints; renderer->QueueDrawLines = PS2_QueueDrawPoints; renderer->QueueGeometry = PS2_QueueGeometry; diff --git a/thirdparty/SDL/src/render/psp/SDL_render_psp.c b/thirdparty/SDL/src/render/psp/SDL_render_psp.c index 95a48d9ff..47fab82c1 100644 --- a/thirdparty/SDL/src/render/psp/SDL_render_psp.c +++ b/thirdparty/SDL/src/render/psp/SDL_render_psp.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -282,11 +282,11 @@ static int TextureSwizzle(PSP_TextureData *psp_texture, void *dst) src = (unsigned int *)psp_texture->data; data = dst; - if (data == NULL) { + if (!data) { data = SDL_malloc(psp_texture->size); } - if (data == NULL) { + if (!data) { return SDL_OutOfMemory(); } @@ -344,11 +344,11 @@ static int TextureUnswizzle(PSP_TextureData *psp_texture, void *dst) data = dst; - if (data == NULL) { + if (!data) { data = SDL_malloc(psp_texture->size); } - if (data == NULL) { + if (!data) { return SDL_OutOfMemory(); } @@ -392,7 +392,7 @@ static int TextureSpillToSram(PSP_RenderData *data, PSP_TextureData *psp_texture if (psp_texture->swizzled) { // Texture was swizzled in vram, just copy to system memory void *sdata = SDL_malloc(psp_texture->size); - if (sdata == NULL) { + if (!sdata) { return SDL_OutOfMemory(); } @@ -484,7 +484,7 @@ static int PSP_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture) PSP_RenderData *data = renderer->driverdata; PSP_TextureData *psp_texture = (PSP_TextureData *)SDL_calloc(1, sizeof(*psp_texture)); - if (psp_texture == NULL) { + if (!psp_texture) { return SDL_OutOfMemory(); } @@ -630,7 +630,7 @@ static int PSP_QueueDrawPoints(SDL_Renderer *renderer, SDL_RenderCommand *cmd, c VertV *verts = (VertV *)SDL_AllocateRenderVertices(renderer, count * sizeof(VertV), 4, &cmd->data.draw.first); int i; - if (verts == NULL) { + if (!verts) { return -1; } @@ -656,10 +656,10 @@ static int PSP_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL cmd->data.draw.count = count; size_indices = indices ? size_indices : 0; - if (texture == NULL) { + if (!texture) { VertCV *verts; verts = (VertCV *)SDL_AllocateRenderVertices(renderer, count * sizeof(VertCV), 4, &cmd->data.draw.first); - if (verts == NULL) { + if (!verts) { return -1; } @@ -692,7 +692,7 @@ static int PSP_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL PSP_TextureData *psp_texture = (PSP_TextureData *)texture->driverdata; VertTCV *verts; verts = (VertTCV *)SDL_AllocateRenderVertices(renderer, count * sizeof(VertTCV), 4, &cmd->data.draw.first); - if (verts == NULL) { + if (!verts) { return -1; } @@ -737,7 +737,7 @@ static int PSP_QueueFillRects(SDL_Renderer *renderer, SDL_RenderCommand *cmd, co VertV *verts = (VertV *)SDL_AllocateRenderVertices(renderer, count * 2 * sizeof(VertV), 4, &cmd->data.draw.first); int i; - if (verts == NULL) { + if (!verts) { return -1; } @@ -773,7 +773,7 @@ static int PSP_QueueCopy(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Tex if ((MathAbs(u1) - MathAbs(u0)) < 64.0f) { verts = (VertTV *)SDL_AllocateRenderVertices(renderer, 2 * sizeof(VertTV), 4, &cmd->data.draw.first); - if (verts == NULL) { + if (!verts) { return -1; } @@ -809,7 +809,7 @@ static int PSP_QueueCopy(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Tex cmd->data.draw.count = count; verts = (VertTV *)SDL_AllocateRenderVertices(renderer, count * 2 * sizeof(VertTV), 4, &cmd->data.draw.first); - if (verts == NULL) { + if (!verts) { return -1; } @@ -860,7 +860,7 @@ static int PSP_QueueCopyEx(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_T float u1 = srcrect->x + srcrect->w; float v1 = srcrect->y + srcrect->h; - if (verts == NULL) { + if (!verts) { return -1; } @@ -1011,7 +1011,7 @@ static void PSP_SetBlendState(PSP_RenderData *data, PSP_BlendState *state) } if (state->texture != current->texture) { - if (state->texture != NULL) { + if (state->texture) { TextureActivate(state->texture); sceGuEnable(GU_TEXTURE_2D); } else { @@ -1035,7 +1035,7 @@ static int PSP_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd, v rendering backends report a reasonable maximum, so the higher level can flush if we appear to be exceeding that. */ gpumem = (Uint8 *)sceGuGetMemory(vertsize); - if (gpumem == NULL) { + if (!gpumem) { return SDL_SetError("Couldn't obtain a %d-byte vertex buffer!", (int)vertsize); } SDL_memcpy(gpumem, vertices, vertsize); @@ -1053,6 +1053,7 @@ static int PSP_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd, v sceGuOffset(2048 - (viewport->w >> 1), 2048 - (viewport->h >> 1)); sceGuViewport(2048, 2048, viewport->w, viewport->h); sceGuScissor(viewport->x, viewport->y, viewport->w, viewport->h); + /* FIXME: We need to update the clip rect too, see https://github.com/libsdl-org/SDL/issues/9094 */ break; } @@ -1177,7 +1178,7 @@ static int PSP_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd, v case SDL_RENDERCMD_GEOMETRY: { const size_t count = cmd->data.draw.count; - if (cmd->data.draw.texture == NULL) { + if (!cmd->data.draw.texture) { const VertCV *verts = (VertCV *)(gpumem + cmd->data.draw.first); sceGuDisable(GU_TEXTURE_2D); /* In GU_SMOOTH mode */ @@ -1245,11 +1246,11 @@ static void PSP_DestroyTexture(SDL_Renderer *renderer, SDL_Texture *texture) PSP_RenderData *renderdata = (PSP_RenderData *)renderer->driverdata; PSP_TextureData *psp_texture = (PSP_TextureData *)texture->driverdata; - if (renderdata == NULL) { + if (!renderdata) { return; } - if (psp_texture == NULL) { + if (!psp_texture) { return; } @@ -1300,13 +1301,13 @@ SDL_Renderer *PSP_CreateRenderer(SDL_Window *window, Uint32 flags) void *doublebuffer = NULL; renderer = (SDL_Renderer *)SDL_calloc(1, sizeof(*renderer)); - if (renderer == NULL) { + if (!renderer) { SDL_OutOfMemory(); return NULL; } data = (PSP_RenderData *)SDL_calloc(1, sizeof(*data)); - if (data == NULL) { + if (!data) { PSP_DestroyRenderer(renderer); SDL_OutOfMemory(); return NULL; diff --git a/thirdparty/SDL/src/render/software/SDL_blendfillrect.c b/thirdparty/SDL/src/render/software/SDL_blendfillrect.c index 2489eb11a..2026cb885 100644 --- a/thirdparty/SDL/src/render/software/SDL_blendfillrect.c +++ b/thirdparty/SDL/src/render/software/SDL_blendfillrect.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_RENDER_SW && !SDL_RENDER_DISABLED +#if SDL_VIDEO_RENDER_SW #include "SDL_draw.h" #include "SDL_blendfillrect.h" @@ -211,7 +211,7 @@ int SDL_BlendFillRect(SDL_Surface *dst, const SDL_Rect *rect, { SDL_Rect clipped; - if (dst == NULL) { + if (!dst) { return SDL_InvalidParamError("SDL_BlendFillRect(): dst"); } @@ -281,7 +281,7 @@ int SDL_BlendFillRects(SDL_Surface *dst, const SDL_Rect *rects, int count, SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a) = NULL; int status = 0; - if (dst == NULL) { + if (!dst) { return SDL_InvalidParamError("SDL_BlendFillRects(): dst"); } @@ -325,7 +325,7 @@ int SDL_BlendFillRects(SDL_Surface *dst, const SDL_Rect *rects, int count, break; } - if (func == NULL) { + if (!func) { if (!dst->format->Amask) { func = SDL_BlendFillRect_RGB; } else { @@ -343,6 +343,6 @@ int SDL_BlendFillRects(SDL_Surface *dst, const SDL_Rect *rects, int count, return status; } -#endif /* SDL_VIDEO_RENDER_SW && !SDL_RENDER_DISABLED */ +#endif /* SDL_VIDEO_RENDER_SW */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/thirdparty/SDL/src/render/software/SDL_blendfillrect.h b/thirdparty/SDL/src/render/software/SDL_blendfillrect.h index 4379a8eb2..eb9ba7d26 100644 --- a/thirdparty/SDL/src/render/software/SDL_blendfillrect.h +++ b/thirdparty/SDL/src/render/software/SDL_blendfillrect.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/render/software/SDL_blendline.c b/thirdparty/SDL/src/render/software/SDL_blendline.c index 0d6365619..19e2cdb0d 100644 --- a/thirdparty/SDL/src/render/software/SDL_blendline.c +++ b/thirdparty/SDL/src/render/software/SDL_blendline.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_RENDER_SW && !SDL_RENDER_DISABLED +#if SDL_VIDEO_RENDER_SW #include "SDL_draw.h" #include "SDL_blendline.h" @@ -798,12 +798,12 @@ int SDL_BlendLine(SDL_Surface *dst, int x1, int y1, int x2, int y2, { BlendLineFunc func; - if (dst == NULL) { + if (!dst) { return SDL_InvalidParamError("SDL_BlendLine(): dst"); } func = SDL_CalculateBlendLineFunc(dst->format); - if (func == NULL) { + if (!func) { return SDL_SetError("SDL_BlendLine(): Unsupported surface format"); } @@ -826,12 +826,12 @@ int SDL_BlendLines(SDL_Surface *dst, const SDL_Point *points, int count, SDL_bool draw_end; BlendLineFunc func; - if (dst == NULL) { + if (!dst) { return SDL_SetError("SDL_BlendLines(): Passed NULL destination surface"); } func = SDL_CalculateBlendLineFunc(dst->format); - if (func == NULL) { + if (!func) { return SDL_SetError("SDL_BlendLines(): Unsupported surface format"); } @@ -859,6 +859,6 @@ int SDL_BlendLines(SDL_Surface *dst, const SDL_Point *points, int count, return 0; } -#endif /* SDL_VIDEO_RENDER_SW && !SDL_RENDER_DISABLED */ +#endif /* SDL_VIDEO_RENDER_SW */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/thirdparty/SDL/src/render/software/SDL_blendline.h b/thirdparty/SDL/src/render/software/SDL_blendline.h index 4abcbb5b1..993dd4733 100644 --- a/thirdparty/SDL/src/render/software/SDL_blendline.h +++ b/thirdparty/SDL/src/render/software/SDL_blendline.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/render/software/SDL_blendpoint.c b/thirdparty/SDL/src/render/software/SDL_blendpoint.c index 3fc68f45e..c38037110 100644 --- a/thirdparty/SDL/src/render/software/SDL_blendpoint.c +++ b/thirdparty/SDL/src/render/software/SDL_blendpoint.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_RENDER_SW && !SDL_RENDER_DISABLED +#if SDL_VIDEO_RENDER_SW #include "SDL_draw.h" #include "SDL_blendpoint.h" @@ -209,7 +209,7 @@ static int SDL_BlendPoint_RGBA(SDL_Surface *dst, int x, int y, SDL_BlendMode ble int SDL_BlendPoint(SDL_Surface *dst, int x, int y, SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a) { - if (dst == NULL) { + if (!dst) { return SDL_InvalidParamError("SDL_BlendPoint(): dst"); } @@ -277,7 +277,7 @@ int SDL_BlendPoints(SDL_Surface *dst, const SDL_Point *points, int count, SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a) = NULL; int status = 0; - if (dst == NULL) { + if (!dst) { return SDL_InvalidParamError("SDL_BlendPoints(): dst"); } @@ -323,7 +323,7 @@ int SDL_BlendPoints(SDL_Surface *dst, const SDL_Point *points, int count, break; } - if (func == NULL) { + if (!func) { if (!dst->format->Amask) { func = SDL_BlendPoint_RGB; } else { @@ -348,6 +348,6 @@ int SDL_BlendPoints(SDL_Surface *dst, const SDL_Point *points, int count, return status; } -#endif /* SDL_VIDEO_RENDER_SW && !SDL_RENDER_DISABLED */ +#endif /* SDL_VIDEO_RENDER_SW */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/thirdparty/SDL/src/render/software/SDL_blendpoint.h b/thirdparty/SDL/src/render/software/SDL_blendpoint.h index 74ed96456..86ee766ea 100644 --- a/thirdparty/SDL/src/render/software/SDL_blendpoint.h +++ b/thirdparty/SDL/src/render/software/SDL_blendpoint.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/render/software/SDL_draw.h b/thirdparty/SDL/src/render/software/SDL_draw.h index db593f4d3..ab80b87f8 100644 --- a/thirdparty/SDL/src/render/software/SDL_draw.h +++ b/thirdparty/SDL/src/render/software/SDL_draw.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/render/software/SDL_drawline.c b/thirdparty/SDL/src/render/software/SDL_drawline.c index 8acf5ee89..e164a8f08 100644 --- a/thirdparty/SDL/src/render/software/SDL_drawline.c +++ b/thirdparty/SDL/src/render/software/SDL_drawline.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_RENDER_SW && !SDL_RENDER_DISABLED +#if SDL_VIDEO_RENDER_SW #include "SDL_draw.h" #include "SDL_drawline.h" @@ -137,12 +137,12 @@ int SDL_DrawLine(SDL_Surface *dst, int x1, int y1, int x2, int y2, Uint32 color) { DrawLineFunc func; - if (dst == NULL) { + if (!dst) { return SDL_InvalidParamError("SDL_DrawLine(): dst"); } func = SDL_CalculateDrawLineFunc(dst->format); - if (func == NULL) { + if (!func) { return SDL_SetError("SDL_DrawLine(): Unsupported surface format"); } @@ -165,12 +165,12 @@ int SDL_DrawLines(SDL_Surface *dst, const SDL_Point *points, int count, SDL_bool draw_end; DrawLineFunc func; - if (dst == NULL) { + if (!dst) { return SDL_InvalidParamError("SDL_DrawLines(): dst"); } func = SDL_CalculateDrawLineFunc(dst->format); - if (func == NULL) { + if (!func) { return SDL_SetError("SDL_DrawLines(): Unsupported surface format"); } @@ -197,6 +197,6 @@ int SDL_DrawLines(SDL_Surface *dst, const SDL_Point *points, int count, return 0; } -#endif /* SDL_VIDEO_RENDER_SW && !SDL_RENDER_DISABLED */ +#endif /* SDL_VIDEO_RENDER_SW */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/thirdparty/SDL/src/render/software/SDL_drawline.h b/thirdparty/SDL/src/render/software/SDL_drawline.h index 5ef98ad6d..0d406c858 100644 --- a/thirdparty/SDL/src/render/software/SDL_drawline.h +++ b/thirdparty/SDL/src/render/software/SDL_drawline.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/render/software/SDL_drawpoint.c b/thirdparty/SDL/src/render/software/SDL_drawpoint.c index 77404421a..16bb9fac2 100644 --- a/thirdparty/SDL/src/render/software/SDL_drawpoint.c +++ b/thirdparty/SDL/src/render/software/SDL_drawpoint.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,14 +20,14 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_RENDER_SW && !SDL_RENDER_DISABLED +#if SDL_VIDEO_RENDER_SW #include "SDL_draw.h" #include "SDL_drawpoint.h" int SDL_DrawPoint(SDL_Surface *dst, int x, int y, Uint32 color) { - if (dst == NULL) { + if (!dst) { return SDL_InvalidParamError("SDL_DrawPoint(): dst"); } @@ -67,7 +67,7 @@ int SDL_DrawPoints(SDL_Surface *dst, const SDL_Point *points, int count, int i; int x, y; - if (dst == NULL) { + if (!dst) { return SDL_InvalidParamError("SDL_DrawPoints(): dst"); } @@ -106,6 +106,6 @@ int SDL_DrawPoints(SDL_Surface *dst, const SDL_Point *points, int count, return 0; } -#endif /* SDL_VIDEO_RENDER_SW && !SDL_RENDER_DISABLED */ +#endif /* SDL_VIDEO_RENDER_SW */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/thirdparty/SDL/src/render/software/SDL_drawpoint.h b/thirdparty/SDL/src/render/software/SDL_drawpoint.h index 1a1c8d6ba..1e74d5973 100644 --- a/thirdparty/SDL/src/render/software/SDL_drawpoint.h +++ b/thirdparty/SDL/src/render/software/SDL_drawpoint.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/render/software/SDL_render_sw.c b/thirdparty/SDL/src/render/software/SDL_render_sw.c index edf492327..b7843340f 100644 --- a/thirdparty/SDL/src/render/software/SDL_render_sw.c +++ b/thirdparty/SDL/src/render/software/SDL_render_sw.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_RENDER_SW && !SDL_RENDER_DISABLED +#if SDL_VIDEO_RENDER_SW #include "../SDL_sysrender.h" #include "SDL_render_sw_c.h" @@ -196,7 +196,7 @@ static int SW_QueueDrawPoints(SDL_Renderer *renderer, SDL_RenderCommand *cmd, co SDL_Point *verts = (SDL_Point *)SDL_AllocateRenderVertices(renderer, count * sizeof(SDL_Point), 0, &cmd->data.draw.first); int i; - if (verts == NULL) { + if (!verts) { return -1; } @@ -215,7 +215,7 @@ static int SW_QueueFillRects(SDL_Renderer *renderer, SDL_RenderCommand *cmd, con SDL_Rect *verts = (SDL_Rect *)SDL_AllocateRenderVertices(renderer, count * sizeof(SDL_Rect), 0, &cmd->data.draw.first); int i; - if (verts == NULL) { + if (!verts) { return -1; } @@ -236,7 +236,7 @@ static int SW_QueueCopy(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Text { SDL_Rect *verts = (SDL_Rect *)SDL_AllocateRenderVertices(renderer, 2 * sizeof(SDL_Rect), 0, &cmd->data.draw.first); - if (verts == NULL) { + if (!verts) { return -1; } @@ -270,7 +270,7 @@ static int SW_QueueCopyEx(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Te { CopyExData *verts = (CopyExData *)SDL_AllocateRenderVertices(renderer, sizeof(CopyExData), 0, &cmd->data.draw.first); - if (verts == NULL) { + if (!verts) { return -1; } @@ -324,7 +324,7 @@ static int SW_RenderCopyEx(SDL_Renderer *renderer, SDL_Surface *surface, SDL_Tex int blitRequired = SDL_FALSE; int isOpaque = SDL_FALSE; - if (surface == NULL) { + if (!surface) { return -1; } @@ -346,7 +346,7 @@ static int SW_RenderCopyEx(SDL_Renderer *renderer, SDL_Surface *surface, SDL_Tex src_clone = SDL_CreateRGBSurfaceFrom(src->pixels, src->w, src->h, src->format->BitsPerPixel, src->pitch, src->format->Rmask, src->format->Gmask, src->format->Bmask, src->format->Amask); - if (src_clone == NULL) { + if (!src_clone) { if (SDL_MUSTLOCK(src)) { SDL_UnlockSurface(src); } @@ -390,7 +390,7 @@ static int SW_RenderCopyEx(SDL_Renderer *renderer, SDL_Surface *surface, SDL_Tex if (blendmode == SDL_BLENDMODE_NONE && !isOpaque) { mask = SDL_CreateRGBSurface(0, final_rect->w, final_rect->h, 32, 0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000); - if (mask == NULL) { + if (!mask) { retval = -1; } else { SDL_SetSurfaceBlendMode(mask, SDL_BLENDMODE_MOD); @@ -404,7 +404,7 @@ static int SW_RenderCopyEx(SDL_Renderer *renderer, SDL_Surface *surface, SDL_Tex SDL_Rect scale_rect = tmp_rect; src_scaled = SDL_CreateRGBSurface(0, final_rect->w, final_rect->h, 32, 0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000); - if (src_scaled == NULL) { + if (!src_scaled) { retval = -1; } else { SDL_SetSurfaceBlendMode(src_clone, SDL_BLENDMODE_NONE); @@ -427,15 +427,15 @@ static int SW_RenderCopyEx(SDL_Renderer *renderer, SDL_Surface *surface, SDL_Tex src_rotated = SDLgfx_rotateSurface(src_clone, angle, (texture->scaleMode == SDL_ScaleModeNearest) ? 0 : 1, flip & SDL_FLIP_HORIZONTAL, flip & SDL_FLIP_VERTICAL, &rect_dest, cangle, sangle, center); - if (src_rotated == NULL) { + if (!src_rotated) { retval = -1; } - if (!retval && mask != NULL) { + if (!retval && mask) { /* The mask needed for the NONE blend mode gets rotated with the same parameters. */ mask_rotated = SDLgfx_rotateSurface(mask, angle, SDL_FALSE, 0, 0, &rect_dest, cangle, sangle, center); - if (mask_rotated == NULL) { + if (!mask_rotated) { retval = -1; } } @@ -487,7 +487,7 @@ static int SW_RenderCopyEx(SDL_Renderer *renderer, SDL_Surface *surface, SDL_Tex src_rotated->format->BitsPerPixel, src_rotated->pitch, src_rotated->format->Rmask, src_rotated->format->Gmask, src_rotated->format->Bmask, 0); - if (src_rotated_rgb == NULL) { + if (!src_rotated_rgb) { retval = -1; } else { SDL_SetSurfaceBlendMode(src_rotated_rgb, SDL_BLENDMODE_ADD); @@ -499,7 +499,7 @@ static int SW_RenderCopyEx(SDL_Renderer *renderer, SDL_Surface *surface, SDL_Tex } SDL_FreeSurface(mask_rotated); } - if (src_rotated != NULL) { + if (src_rotated) { SDL_FreeSurface(src_rotated); } } @@ -508,10 +508,10 @@ static int SW_RenderCopyEx(SDL_Renderer *renderer, SDL_Surface *surface, SDL_Tex if (SDL_MUSTLOCK(src)) { SDL_UnlockSurface(src); } - if (mask != NULL) { + if (mask) { SDL_FreeSurface(mask); } - if (src_clone != NULL) { + if (src_clone) { SDL_FreeSurface(src_clone); } return retval; @@ -538,10 +538,10 @@ static int SW_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_ int i; int count = indices ? num_indices : num_vertices; void *verts; - size_t sz = texture != NULL ? sizeof(GeometryCopyData) : sizeof(GeometryFillData); + size_t sz = texture ? sizeof(GeometryCopyData) : sizeof(GeometryFillData); verts = SDL_AllocateRenderVertices(renderer, count * sz, 0, &cmd->data.draw.first); - if (verts == NULL) { + if (!verts) { return -1; } @@ -643,7 +643,7 @@ static void SetDrawState(SDL_Surface *surface, SW_DrawStateCache *drawstate) const SDL_Rect *cliprect = drawstate->cliprect; SDL_assert_release(viewport != NULL); /* the higher level should have forced a SDL_RENDERCMD_SETVIEWPORT */ - if (cliprect != NULL) { + if (cliprect) { SDL_Rect clip_rect; clip_rect.x = cliprect->x + viewport->x; clip_rect.y = cliprect->y + viewport->y; @@ -663,7 +663,7 @@ static int SW_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd, vo SDL_Surface *surface = SW_ActivateRenderer(renderer); SW_DrawStateCache drawstate; - if (surface == NULL) { + if (!surface) { return -1; } @@ -712,7 +712,7 @@ static int SW_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd, vo SetDrawState(surface, &drawstate); /* Apply viewport */ - if (drawstate.viewport != NULL && (drawstate.viewport->x || drawstate.viewport->y)) { + if (drawstate.viewport && (drawstate.viewport->x || drawstate.viewport->y)) { int i; for (i = 0; i < count; i++) { verts[i].x += drawstate.viewport->x; @@ -739,7 +739,7 @@ static int SW_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd, vo SetDrawState(surface, &drawstate); /* Apply viewport */ - if (drawstate.viewport != NULL && (drawstate.viewport->x || drawstate.viewport->y)) { + if (drawstate.viewport && (drawstate.viewport->x || drawstate.viewport->y)) { int i; for (i = 0; i < count; i++) { verts[i].x += drawstate.viewport->x; @@ -766,7 +766,7 @@ static int SW_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd, vo SetDrawState(surface, &drawstate); /* Apply viewport */ - if (drawstate.viewport != NULL && (drawstate.viewport->x || drawstate.viewport->y)) { + if (drawstate.viewport && (drawstate.viewport->x || drawstate.viewport->y)) { int i; for (i = 0; i < count; i++) { verts[i].x += drawstate.viewport->x; @@ -794,7 +794,7 @@ static int SW_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd, vo PrepTextureForCopy(cmd); /* Apply viewport */ - if (drawstate.viewport != NULL && (drawstate.viewport->x || drawstate.viewport->y)) { + if (drawstate.viewport && (drawstate.viewport->x || drawstate.viewport->y)) { dstrect->x += drawstate.viewport->x; dstrect->y += drawstate.viewport->y; } @@ -852,7 +852,7 @@ static int SW_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd, vo PrepTextureForCopy(cmd); /* Apply viewport */ - if (drawstate.viewport != NULL && (drawstate.viewport->x || drawstate.viewport->y)) { + if (drawstate.viewport && (drawstate.viewport->x || drawstate.viewport->y)) { copydata->dstrect.x += drawstate.viewport->x; copydata->dstrect.y += drawstate.viewport->y; } @@ -880,7 +880,7 @@ static int SW_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd, vo PrepTextureForCopy(cmd); /* Apply viewport */ - if (drawstate.viewport != NULL && (drawstate.viewport->x || drawstate.viewport->y)) { + if (drawstate.viewport && (drawstate.viewport->x || drawstate.viewport->y)) { SDL_Point vp; vp.x = drawstate.viewport->x; vp.y = drawstate.viewport->y; @@ -903,7 +903,7 @@ static int SW_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd, vo GeometryFillData *ptr = (GeometryFillData *) verts; /* Apply viewport */ - if (drawstate.viewport != NULL && (drawstate.viewport->x || drawstate.viewport->y)) { + if (drawstate.viewport && (drawstate.viewport->x || drawstate.viewport->y)) { SDL_Point vp; vp.x = drawstate.viewport->x; vp.y = drawstate.viewport->y; @@ -938,7 +938,7 @@ static int SW_RenderReadPixels(SDL_Renderer *renderer, const SDL_Rect *rect, Uint32 src_format; void *src_pixels; - if (surface == NULL) { + if (!surface) { return -1; } @@ -965,7 +965,7 @@ static int SW_RenderPresent(SDL_Renderer *renderer) { SDL_Window *window = renderer->window; - if (window == NULL) { + if (!window) { return -1; } return SDL_UpdateWindowSurface(window); @@ -980,8 +980,12 @@ static void SW_DestroyTexture(SDL_Renderer *renderer, SDL_Texture *texture) static void SW_DestroyRenderer(SDL_Renderer *renderer) { + SDL_Window *window = renderer->window; SW_RenderData *data = (SW_RenderData *)renderer->driverdata; + if (window) { + SDL_DestroyWindowSurface(window); + } SDL_free(data); SDL_free(renderer); } @@ -991,19 +995,19 @@ SDL_Renderer *SW_CreateRendererForSurface(SDL_Surface *surface) SDL_Renderer *renderer; SW_RenderData *data; - if (surface == NULL) { + if (!surface) { SDL_InvalidParamError("surface"); return NULL; } renderer = (SDL_Renderer *)SDL_calloc(1, sizeof(*renderer)); - if (renderer == NULL) { + if (!renderer) { SDL_OutOfMemory(); return NULL; } data = (SW_RenderData *)SDL_calloc(1, sizeof(*data)); - if (data == NULL) { + if (!data) { SW_DestroyRenderer(renderer); SDL_OutOfMemory(); return NULL; @@ -1035,8 +1039,6 @@ SDL_Renderer *SW_CreateRendererForSurface(SDL_Surface *surface) renderer->info = SW_RenderDriver.info; renderer->driverdata = data; - SW_ActivateRenderer(renderer); - return renderer; } @@ -1048,7 +1050,7 @@ static SDL_Renderer *SW_CreateRenderer(SDL_Window *window, Uint32 flags) /* Set the vsync hint based on our flags, if it's not already set */ hint = SDL_GetHint(SDL_HINT_RENDER_VSYNC); - if (hint == NULL || !*hint) { + if (!hint || !*hint) { no_hint_set = SDL_TRUE; } else { no_hint_set = SDL_FALSE; @@ -1065,7 +1067,7 @@ static SDL_Renderer *SW_CreateRenderer(SDL_Window *window, Uint32 flags) SDL_SetHint(SDL_HINT_RENDER_VSYNC, ""); } - if (surface == NULL) { + if (!surface) { return NULL; } return SW_CreateRendererForSurface(surface); @@ -1091,6 +1093,6 @@ SDL_RenderDriver SW_RenderDriver = { 0} }; -#endif /* SDL_VIDEO_RENDER_SW && !SDL_RENDER_DISABLED */ +#endif /* SDL_VIDEO_RENDER_SW */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/thirdparty/SDL/src/render/software/SDL_render_sw_c.h b/thirdparty/SDL/src/render/software/SDL_render_sw_c.h index f6c54c02f..1d7901fc8 100644 --- a/thirdparty/SDL/src/render/software/SDL_render_sw_c.h +++ b/thirdparty/SDL/src/render/software/SDL_render_sw_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/render/software/SDL_rotate.c b/thirdparty/SDL/src/render/software/SDL_rotate.c index d51df2f1f..d29b92d68 100644 --- a/thirdparty/SDL/src/render/software/SDL_rotate.c +++ b/thirdparty/SDL/src/render/software/SDL_rotate.c @@ -30,7 +30,7 @@ Andreas Schiffler -- aschiffler at ferzkopp dot net */ #include "../../SDL_internal.h" -#if SDL_VIDEO_RENDER_SW && !SDL_RENDER_DISABLED +#if SDL_VIDEO_RENDER_SW #if defined(__WIN32__) || defined(__GDK__) #include "../../core/windows/SDL_windows.h" @@ -500,7 +500,7 @@ SDL_Surface *SDLgfx_rotateSurface(SDL_Surface *src, double angle, int smooth, in double sangleinv, cangleinv; /* Sanity check */ - if (src == NULL) { + if (!src) { return NULL; } @@ -524,7 +524,7 @@ SDL_Surface *SDLgfx_rotateSurface(SDL_Surface *src, double angle, int smooth, in if (is8bit) { /* Target surface is 8 bit */ rz_dst = SDL_CreateRGBSurfaceWithFormat(0, rect_dest->w, rect_dest->h + GUARD_ROWS, 8, src->format->format); - if (rz_dst != NULL) { + if (rz_dst) { if (src->format->palette) { for (i = 0; i < src->format->palette->ncolors; i++) { rz_dst->format->palette->colors[i] = src->format->palette->colors[i]; @@ -540,7 +540,7 @@ SDL_Surface *SDLgfx_rotateSurface(SDL_Surface *src, double angle, int smooth, in } /* Check target */ - if (rz_dst == NULL) { + if (!rz_dst) { return NULL; } @@ -617,4 +617,4 @@ SDL_Surface *SDLgfx_rotateSurface(SDL_Surface *src, double angle, int smooth, in return rz_dst; } -#endif /* SDL_VIDEO_RENDER_SW && !SDL_RENDER_DISABLED */ +#endif /* SDL_VIDEO_RENDER_SW */ diff --git a/thirdparty/SDL/src/render/software/SDL_rotate.h b/thirdparty/SDL/src/render/software/SDL_rotate.h index 43e90e8af..9e08e53ab 100644 --- a/thirdparty/SDL/src/render/software/SDL_rotate.h +++ b/thirdparty/SDL/src/render/software/SDL_rotate.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/render/software/SDL_triangle.c b/thirdparty/SDL/src/render/software/SDL_triangle.c index a4c04b2dd..f6af3dcab 100644 --- a/thirdparty/SDL/src/render/software/SDL_triangle.c +++ b/thirdparty/SDL/src/render/software/SDL_triangle.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,9 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_RENDER_SW && !SDL_RENDER_DISABLED +#if SDL_VIDEO_RENDER_SW + +#include #include "SDL_surface.h" #include "SDL_triangle.h" @@ -87,9 +89,9 @@ int SDL_FillTriangle(SDL_Surface *dst, const SDL_Point points[3], Uint32 color) #endif /* cross product AB x AC */ -static int cross_product(const SDL_Point *a, const SDL_Point *b, int c_x, int c_y) +static Sint64 cross_product(const SDL_Point *a, const SDL_Point *b, int c_x, int c_y) { - return (b->x - a->x) * (c_y - a->y) - (b->y - a->y) * (c_x - a->x); + return ((Sint64)(b->x - a->x)) * ((Sint64)(c_y - a->y)) - ((Sint64)(b->y - a->y)) * ((Sint64)(c_x - a->x)); } /* check for top left rules */ @@ -113,10 +115,23 @@ static int is_top_left(const SDL_Point *a, const SDL_Point *b, int is_clockwise) return 0; } +/* x = (y << FP_BITS) */ +/* prevent runtime error: left shift of negative value */ +#define PRECOMP(x, y) \ + val = y; \ + if (val >= 0) { \ + x = val << FP_BITS; \ + } else { \ + val *= -1; \ + x = val << FP_BITS; \ + x *= -1; \ + } + void trianglepoint_2_fixedpoint(SDL_Point *a) { - a->x <<= FP_BITS; - a->y <<= FP_BITS; + int val; + PRECOMP(a->x, a->x); + PRECOMP(a->y, a->y); } /* bounding rect of three points (in fixed point) */ @@ -158,9 +173,9 @@ static void bounding_rect(const SDL_Point *a, const SDL_Point *b, const SDL_Poin int x, y; \ for (y = 0; y < dstrect.h; y++) { \ /* y start */ \ - int w0 = w0_row; \ - int w1 = w1_row; \ - int w2 = w2_row; \ + Sint64 w0 = w0_row; \ + Sint64 w1 = w1_row; \ + Sint64 w2 = w2_row; \ for (x = 0; x < dstrect.w; x++) { \ /* In triangle */ \ if (w0 + bias_w0 >= 0 && w1 + bias_w1 >= 0 && w2 + bias_w2 >= 0) { \ @@ -210,17 +225,18 @@ int SDL_SW_FillTriangle(SDL_Surface *dst, SDL_Point *d0, SDL_Point *d1, SDL_Poin Uint8 *dst_ptr; int dst_pitch; - int area, is_clockwise; + Sint64 area; + int is_clockwise; int d2d1_y, d1d2_x, d0d2_y, d2d0_x, d1d0_y, d0d1_x; - int w0_row, w1_row, w2_row; + Sint64 w0_row, w1_row, w2_row; int bias_w0, bias_w1, bias_w2; int is_uniform; SDL_Surface *tmp = NULL; - if (dst == NULL) { + if (!dst) { return -1; } @@ -272,7 +288,7 @@ int SDL_SW_FillTriangle(SDL_Surface *dst, SDL_Point *d0, SDL_Point *d1, SDL_Poin /* Use an intermediate surface */ tmp = SDL_CreateRGBSurfaceWithFormat(0, dstrect.w, dstrect.h, 0, format); - if (tmp == NULL) { + if (!tmp) { ret = -1; goto end; } @@ -296,14 +312,19 @@ int SDL_SW_FillTriangle(SDL_Surface *dst, SDL_Point *d0, SDL_Point *d1, SDL_Poin } is_clockwise = area > 0; - area = SDL_abs(area); + if (area < 0) { + area = -area; + } - d2d1_y = (d1->y - d2->y) << FP_BITS; - d0d2_y = (d2->y - d0->y) << FP_BITS; - d1d0_y = (d0->y - d1->y) << FP_BITS; - d1d2_x = (d2->x - d1->x) << FP_BITS; - d2d0_x = (d0->x - d2->x) << FP_BITS; - d0d1_x = (d1->x - d0->x) << FP_BITS; + { + int val; + PRECOMP(d2d1_y, d1->y - d2->y) + PRECOMP(d0d2_y, d2->y - d0->y) + PRECOMP(d1d0_y, d0->y - d1->y) + PRECOMP(d1d2_x, d2->x - d1->x) + PRECOMP(d2d0_x, d0->x - d2->x) + PRECOMP(d0d1_x, d1->x - d0->x) + } /* Starting point for rendering, at the middle of a pixel */ { @@ -339,12 +360,7 @@ int SDL_SW_FillTriangle(SDL_Surface *dst, SDL_Point *d0, SDL_Point *d1, SDL_Poin if (is_uniform) { Uint32 color; if (tmp) { - if (dst->format->Amask) { - color = SDL_MapRGBA(tmp->format, c0.r, c0.g, c0.b, c0.a); - } else { - // color = SDL_MapRGB(tmp->format, c0.r, c0.g, c0.b); - color = SDL_MapRGBA(tmp->format, c0.r, c0.g, c0.b, c0.a); - } + color = SDL_MapRGBA(tmp->format, c0.r, c0.g, c0.b, c0.a); } else { color = SDL_MapRGBA(dst->format, c0.r, c0.g, c0.b, c0.a); } @@ -453,20 +469,24 @@ int SDL_SW_BlitTriangle( int *src_ptr; int src_pitch; - int area, is_clockwise; + Sint64 area, tmp64; + int is_clockwise; int d2d1_y, d1d2_x, d0d2_y, d2d0_x, d1d0_y, d0d1_x; int s2s0_x, s2s1_x, s2s0_y, s2s1_y; - int w0_row, w1_row, w2_row; + Sint64 w0_row, w1_row, w2_row; int bias_w0, bias_w1, bias_w2; int is_uniform; int has_modulation; - if (src == NULL || dst == NULL) { - return -1; + if (!src) { + return SDL_InvalidParamError("src"); + } + if (!src) { + return SDL_InvalidParamError("dst"); } area = cross_product(d0, d1, d2->x, d2->y); @@ -568,15 +588,19 @@ int SDL_SW_BlitTriangle( src_pitch = src->pitch; is_clockwise = area > 0; - area = SDL_abs(area); - - d2d1_y = (d1->y - d2->y) << FP_BITS; - d0d2_y = (d2->y - d0->y) << FP_BITS; - d1d0_y = (d0->y - d1->y) << FP_BITS; + if (area < 0) { + area = -area; + } - d1d2_x = (d2->x - d1->x) << FP_BITS; - d2d0_x = (d0->x - d2->x) << FP_BITS; - d0d1_x = (d1->x - d0->x) << FP_BITS; + { + int val; + PRECOMP(d2d1_y, d1->y - d2->y) + PRECOMP(d0d2_y, d2->y - d0->y) + PRECOMP(d1d0_y, d0->y - d1->y) + PRECOMP(d1d2_x, d2->x - d1->x) + PRECOMP(d2d0_x, d0->x - d2->x) + PRECOMP(d0d1_x, d1->x - d0->x) + } s2s0_x = s0->x - s2->x; s2s1_x = s1->x - s2->x; @@ -615,8 +639,20 @@ int SDL_SW_BlitTriangle( bias_w2 = (is_top_left(d0, d1, is_clockwise) ? 0 : -1); /* precompute constant 's2->x * area' used in TRIANGLE_GET_TEXTCOORD */ - s2_x_area.x = s2->x * area; - s2_x_area.y = s2->y * area; + tmp64 = s2->x * area; + if (tmp64 >= INT_MIN && tmp64 <= INT_MAX) { + s2_x_area.x = (int)tmp64; + } else { + ret = SDL_SetError("triangle area overflow"); + goto end; + } + tmp64 = s2->y * area; + if (tmp64 >= INT_MIN && tmp64 <= INT_MAX) { + s2_x_area.y = (int)tmp64; + } else { + ret = SDL_SetError("triangle area overflow"); + goto end; + } if (blend != SDL_BLENDMODE_NONE || src->format->format != dst->format->format || has_modulation || !is_uniform) { /* Use SDL_BlitTriangle_Slow */ @@ -662,9 +698,18 @@ int SDL_SW_BlitTriangle( tmp_info.dst = dst_ptr; tmp_info.dst_pitch = dst_pitch; - SDL_BlitTriangle_Slow(&tmp_info, s2_x_area, dstrect, area, bias_w0, bias_w1, bias_w2, +#define CHECK_INT_RANGE(X) \ + if ((X) < INT_MIN || (X) > INT_MAX) { \ + ret = SDL_SetError("integer overflow (%s = %" SDL_PRIs64 ")", #X, X); \ + goto end; \ + } + CHECK_INT_RANGE(area); + CHECK_INT_RANGE(w0_row); + CHECK_INT_RANGE(w1_row); + CHECK_INT_RANGE(w2_row); + SDL_BlitTriangle_Slow(&tmp_info, s2_x_area, dstrect, (int)area, bias_w0, bias_w1, bias_w2, d2d1_y, d1d2_x, d0d2_y, d2d0_x, d1d0_y, d0d1_x, - s2s0_x, s2s1_x, s2s0_y, s2s1_y, w0_row, w1_row, w2_row, + s2s0_x, s2s1_x, s2s0_y, s2s1_y, (int)w0_row, (int)w1_row, (int)w2_row, c0, c1, c2, is_uniform); goto end; @@ -890,6 +935,6 @@ static void SDL_BlitTriangle_Slow(SDL_BlitInfo *info, TRIANGLE_END_LOOP } -#endif /* SDL_VIDEO_RENDER_SW && !SDL_RENDER_DISABLED */ +#endif /* SDL_VIDEO_RENDER_SW */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/thirdparty/SDL/src/render/software/SDL_triangle.h b/thirdparty/SDL/src/render/software/SDL_triangle.h index f72fda588..463cab60d 100644 --- a/thirdparty/SDL/src/render/software/SDL_triangle.h +++ b/thirdparty/SDL/src/render/software/SDL_triangle.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/render/vitagxm/SDL_render_vita_gxm.c b/thirdparty/SDL/src/render/vitagxm/SDL_render_vita_gxm.c index 434a7e425..7d8085902 100644 --- a/thirdparty/SDL/src/render/vitagxm/SDL_render_vita_gxm.c +++ b/thirdparty/SDL/src/render/vitagxm/SDL_render_vita_gxm.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -40,7 +40,7 @@ /* #define DEBUG_RAZOR */ -#if DEBUG_RAZOR +#ifdef DEBUG_RAZOR #include #endif @@ -169,7 +169,7 @@ void StartDrawing(SDL_Renderer *renderer) // data->colorFragmentProgram = in->color; // data->textureFragmentProgram = in->texture; - if (renderer->target == NULL) { + if (!renderer->target) { sceGxmBeginScene( data->gxm_context, 0, @@ -217,13 +217,13 @@ SDL_Renderer *VITA_GXM_CreateRenderer(SDL_Window *window, Uint32 flags) VITA_GXM_RenderData *data; renderer = (SDL_Renderer *)SDL_calloc(1, sizeof(*renderer)); - if (renderer == NULL) { + if (!renderer) { SDL_OutOfMemory(); return NULL; } data = (VITA_GXM_RenderData *)SDL_calloc(1, sizeof(VITA_GXM_RenderData)); - if (data == NULL) { + if (!data) { SDL_free(renderer); SDL_OutOfMemory(); return NULL; @@ -266,7 +266,7 @@ SDL_Renderer *VITA_GXM_CreateRenderer(SDL_Window *window, Uint32 flags) data->displayData.wait_vblank = SDL_FALSE; } -#if DEBUG_RAZOR +#ifdef DEBUG_RAZOR sceSysmoduleLoadModule(SCE_SYSMODULE_RAZOR_HUD); sceSysmoduleLoadModule(SCE_SYSMODULE_RAZOR_CAPTURE); #endif @@ -295,7 +295,7 @@ static int VITA_GXM_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture) VITA_GXM_RenderData *data = (VITA_GXM_RenderData *)renderer->driverdata; VITA_GXM_TextureData *vita_texture = (VITA_GXM_TextureData *)SDL_calloc(1, sizeof(VITA_GXM_TextureData)); - if (vita_texture == NULL) { + if (!vita_texture) { return SDL_OutOfMemory(); } @@ -583,7 +583,7 @@ static int VITA_GXM_LockTexture(SDL_Renderer *renderer, SDL_Texture *texture, *pitch = vita_texture->pitch; // make sure that rendering is finished on render target textures - if (vita_texture->tex->gxm_rendertarget != NULL) { + if (vita_texture->tex->gxm_rendertarget) { sceGxmFinish(data->gxm_context); } @@ -733,7 +733,7 @@ static int VITA_GXM_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd data, count * sizeof(texture_vertex)); - if (vertices == NULL) { + if (!vertices) { return -1; } @@ -772,7 +772,7 @@ static int VITA_GXM_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd data, count * sizeof(color_vertex)); - if (vertices == NULL) { + if (!vertices) { return -1; } @@ -956,6 +956,7 @@ static int VITA_GXM_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *c if (SDL_memcmp(viewport, &cmd->data.viewport.rect, sizeof(cmd->data.viewport.rect)) != 0) { SDL_copyp(viewport, &cmd->data.viewport.rect); data->drawstate.viewport_dirty = SDL_TRUE; + data->drawstate.cliprect_dirty = SDL_TRUE; } break; } @@ -1006,7 +1007,7 @@ static int VITA_GXM_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *c SDL_RenderCommand *nextcmd = cmd->next; size_t count = cmd->data.draw.count; int ret; - while (nextcmd != NULL) { + while (nextcmd) { const SDL_RenderCommandType nextcmdtype = nextcmd->command; if (nextcmdtype != thiscmdtype) { break; /* can't go any further on this draw call, different render command up next. */ @@ -1103,7 +1104,7 @@ static int VITA_GXM_RenderReadPixels(SDL_Renderer *renderer, const SDL_Rect *rec } temp_pixels = SDL_malloc(buflen); - if (temp_pixels == NULL) { + if (!temp_pixels) { return SDL_OutOfMemory(); } @@ -1161,7 +1162,7 @@ static int VITA_GXM_RenderPresent(SDL_Renderer *renderer) sceCommonDialogUpdate(&updateParam); -#if DEBUG_RAZOR +#ifdef DEBUG_RAZOR sceGxmPadHeartbeat( (const SceGxmColorSurface *)&data->displaySurface[data->backBufferIndex], (SceGxmSyncObject *)data->displayBufferSync[data->backBufferIndex]); @@ -1186,15 +1187,15 @@ static void VITA_GXM_DestroyTexture(SDL_Renderer *renderer, SDL_Texture *texture VITA_GXM_RenderData *data = (VITA_GXM_RenderData *)renderer->driverdata; VITA_GXM_TextureData *vita_texture = (VITA_GXM_TextureData *)texture->driverdata; - if (data == NULL) { + if (!data) { return; } - if (vita_texture == NULL) { + if (!vita_texture) { return; } - if (vita_texture->tex == NULL) { + if (!vita_texture->tex) { return; } diff --git a/thirdparty/SDL/src/render/vitagxm/SDL_render_vita_gxm_memory.c b/thirdparty/SDL/src/render/vitagxm/SDL_render_vita_gxm_memory.c index a5a4aacfe..86e33115f 100644 --- a/thirdparty/SDL/src/render/vitagxm/SDL_render_vita_gxm_memory.c +++ b/thirdparty/SDL/src/render/vitagxm/SDL_render_vita_gxm_memory.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -66,7 +66,7 @@ void *vita_gpu_mem_alloc(VITA_GXM_RenderData *data, unsigned int size) { void *mem; - if (data->texturePool == NULL) { + if (!data->texturePool) { int poolsize; int ret; SceKernelFreeMemorySizeInfo info; @@ -88,7 +88,7 @@ void *vita_gpu_mem_alloc(VITA_GXM_RenderData *data, unsigned int size) } data->texturePool = sceClibMspaceCreate(mem, poolsize); - if (data->texturePool == NULL) { + if (!data->texturePool) { return NULL; } ret = sceGxmMapMemory(mem, poolsize, SCE_GXM_MEMORY_ATTRIB_READ | SCE_GXM_MEMORY_ATTRIB_WRITE); @@ -101,7 +101,7 @@ void *vita_gpu_mem_alloc(VITA_GXM_RenderData *data, unsigned int size) void vita_gpu_mem_free(VITA_GXM_RenderData *data, void *ptr) { - if (data->texturePool != NULL) { + if (data->texturePool) { sceClibMspaceFree(data->texturePool, ptr); } } @@ -109,7 +109,7 @@ void vita_gpu_mem_free(VITA_GXM_RenderData *data, void *ptr) void vita_gpu_mem_destroy(VITA_GXM_RenderData *data) { void *mem = NULL; - if (data->texturePool != NULL) { + if (data->texturePool) { sceClibMspaceDestroy(data->texturePool); data->texturePool = NULL; if (sceKernelGetMemBlockBase(data->texturePoolUID, &mem) < 0) { diff --git a/thirdparty/SDL/src/render/vitagxm/SDL_render_vita_gxm_memory.h b/thirdparty/SDL/src/render/vitagxm/SDL_render_vita_gxm_memory.h index dc3d99fec..1f3832ee0 100644 --- a/thirdparty/SDL/src/render/vitagxm/SDL_render_vita_gxm_memory.h +++ b/thirdparty/SDL/src/render/vitagxm/SDL_render_vita_gxm_memory.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/render/vitagxm/SDL_render_vita_gxm_shaders.h b/thirdparty/SDL/src/render/vitagxm/SDL_render_vita_gxm_shaders.h index 1710ca66d..d383fd8ef 100644 --- a/thirdparty/SDL/src/render/vitagxm/SDL_render_vita_gxm_shaders.h +++ b/thirdparty/SDL/src/render/vitagxm/SDL_render_vita_gxm_shaders.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/render/vitagxm/SDL_render_vita_gxm_tools.c b/thirdparty/SDL/src/render/vitagxm/SDL_render_vita_gxm_tools.c index 772a703f3..2c38441d1 100644 --- a/thirdparty/SDL/src/render/vitagxm/SDL_render_vita_gxm_tools.c +++ b/thirdparty/SDL/src/render/vitagxm/SDL_render_vita_gxm_tools.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -1003,7 +1003,7 @@ gxm_texture *create_gxm_texture(VITA_GXM_RenderData *data, unsigned int w, unsig tex_size += (((aligned_w + 1) / 2) * ((h + 1) / 2)) * 2; } - if (texture == NULL) { + if (!texture) { return NULL; } @@ -1017,7 +1017,7 @@ gxm_texture *create_gxm_texture(VITA_GXM_RenderData *data, unsigned int w, unsig tex_size); /* Try SCE_KERNEL_MEMBLOCK_TYPE_USER_RW_UNCACHE in case we're out of VRAM */ - if (texture_data == NULL) { + if (!texture_data) { SDL_LogWarn(SDL_LOG_CATEGORY_RENDER, "CDRAM texture allocation failed\n"); texture_data = vita_mem_alloc( SCE_KERNEL_MEMBLOCK_TYPE_USER_RW_UNCACHE, @@ -1030,7 +1030,7 @@ gxm_texture *create_gxm_texture(VITA_GXM_RenderData *data, unsigned int w, unsig texture->cdram = 1; } - if (texture_data == NULL) { + if (!texture_data) { SDL_free(texture); return NULL; } diff --git a/thirdparty/SDL/src/render/vitagxm/SDL_render_vita_gxm_tools.h b/thirdparty/SDL/src/render/vitagxm/SDL_render_vita_gxm_tools.h index 789061182..ca50e3f3c 100644 --- a/thirdparty/SDL/src/render/vitagxm/SDL_render_vita_gxm_tools.h +++ b/thirdparty/SDL/src/render/vitagxm/SDL_render_vita_gxm_tools.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/render/vitagxm/SDL_render_vita_gxm_types.h b/thirdparty/SDL/src/render/vitagxm/SDL_render_vita_gxm_types.h index 63d4bd211..4255247d6 100644 --- a/thirdparty/SDL/src/render/vitagxm/SDL_render_vita_gxm_types.h +++ b/thirdparty/SDL/src/render/vitagxm/SDL_render_vita_gxm_types.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/sensor/SDL_sensor.c b/thirdparty/SDL/src/sensor/SDL_sensor.c index 6e978ac9e..3179f7302 100644 --- a/thirdparty/SDL/src/sensor/SDL_sensor.c +++ b/thirdparty/SDL/src/sensor/SDL_sensor.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -27,7 +27,7 @@ #include "SDL_events.h" #include "SDL_syssensor.h" -#if !SDL_EVENTS_DISABLED +#ifndef SDL_EVENTS_DISABLED #include "../events/SDL_events_c.h" #endif @@ -75,7 +75,7 @@ int SDL_SensorInit(void) SDL_sensor_lock = SDL_CreateMutex(); } -#if !SDL_EVENTS_DISABLED +#ifndef SDL_EVENTS_DISABLED if (SDL_InitSubSystem(SDL_INIT_EVENTS) < 0) { return -1; } @@ -108,7 +108,7 @@ int SDL_NumSensors(void) * Return the next available sensor instance ID * This may be called by drivers from multiple threads, unprotected by any locks */ -SDL_SensorID SDL_GetNextSensorInstanceID() +SDL_SensorID SDL_GetNextSensorInstanceID(void) { return SDL_AtomicIncRef(&SDL_next_sensor_instance_id); } @@ -237,7 +237,7 @@ SDL_Sensor *SDL_SensorOpen(int device_index) /* Create and initialize the sensor */ sensor = (SDL_Sensor *)SDL_calloc(sizeof(*sensor), 1); - if (sensor == NULL) { + if (!sensor) { SDL_OutOfMemory(); SDL_UnlockSensors(); return NULL; @@ -297,7 +297,7 @@ static int SDL_PrivateSensorValid(SDL_Sensor *sensor) { int valid; - if (sensor == NULL) { + if (!sensor) { SDL_SetError("Sensor hasn't been opened yet"); valid = 0; } else { @@ -454,7 +454,7 @@ void SDL_SensorQuit(void) SDL_UnlockSensors(); -#if !SDL_EVENTS_DISABLED +#ifndef SDL_EVENTS_DISABLED SDL_QuitSubSystem(SDL_INIT_EVENTS); #endif @@ -479,7 +479,7 @@ int SDL_PrivateSensorUpdate(SDL_Sensor *sensor, Uint64 timestamp_us, float *data /* Post the event, if desired */ posted = 0; -#if !SDL_EVENTS_DISABLED +#ifndef SDL_EVENTS_DISABLED if (SDL_GetEventState(SDL_SENSORUPDATE) == SDL_ENABLE) { SDL_Event event; event.type = SDL_SENSORUPDATE; diff --git a/thirdparty/SDL/src/sensor/SDL_sensor_c.h b/thirdparty/SDL/src/sensor/SDL_sensor_c.h index 0c9067b60..0d2a48319 100644 --- a/thirdparty/SDL/src/sensor/SDL_sensor_c.h +++ b/thirdparty/SDL/src/sensor/SDL_sensor_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/sensor/SDL_syssensor.h b/thirdparty/SDL/src/sensor/SDL_syssensor.h index 46ed1ce9a..8f8196f53 100644 --- a/thirdparty/SDL/src/sensor/SDL_syssensor.h +++ b/thirdparty/SDL/src/sensor/SDL_syssensor.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/sensor/android/SDL_androidsensor.c b/thirdparty/SDL/src/sensor/android/SDL_androidsensor.c index 1b1979184..c06faf2ee 100644 --- a/thirdparty/SDL/src/sensor/android/SDL_androidsensor.c +++ b/thirdparty/SDL/src/sensor/android/SDL_androidsensor.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -54,14 +54,14 @@ static int SDL_ANDROID_SensorInit(void) ASensorList sensors; SDL_sensor_manager = ASensorManager_getInstance(); - if (SDL_sensor_manager == NULL) { + if (!SDL_sensor_manager) { return SDL_SetError("Couldn't create sensor manager"); } SDL_sensor_looper = ALooper_forThread(); - if (SDL_sensor_looper == NULL) { + if (!SDL_sensor_looper) { SDL_sensor_looper = ALooper_prepare(ALOOPER_PREPARE_ALLOW_NON_CALLBACKS); - if (SDL_sensor_looper == NULL) { + if (!SDL_sensor_looper) { return SDL_SetError("Couldn't create sensor event loop"); } } @@ -70,7 +70,7 @@ static int SDL_ANDROID_SensorInit(void) sensors_count = ASensorManager_getSensorList(SDL_sensor_manager, &sensors); if (sensors_count > 0) { SDL_sensors = (SDL_AndroidSensor *)SDL_calloc(sensors_count, sizeof(*SDL_sensors)); - if (SDL_sensors == NULL) { + if (!SDL_sensors) { return SDL_OutOfMemory(); } @@ -125,7 +125,7 @@ static int SDL_ANDROID_SensorOpen(SDL_Sensor *sensor, int device_index) int delay_us, min_delay_us; hwdata = (struct sensor_hwdata *)SDL_calloc(1, sizeof(*hwdata)); - if (hwdata == NULL) { + if (!hwdata) { return SDL_OutOfMemory(); } @@ -161,7 +161,7 @@ static void SDL_ANDROID_SensorUpdate(SDL_Sensor *sensor) ASensorEvent event; struct android_poll_source *source; - if (ALooper_pollAll(0, NULL, &events, (void **)&source) == LOOPER_ID_USER) { + if (ALooper_pollOnce(0, NULL, &events, (void **)&source) == LOOPER_ID_USER) { SDL_zero(event); while (ASensorEventQueue_getEvents(sensor->hwdata->eventqueue, &event, 1) > 0) { SDL_PrivateSensorUpdate(sensor, 0, event.data, SDL_arraysize(event.data)); diff --git a/thirdparty/SDL/src/sensor/android/SDL_androidsensor.h b/thirdparty/SDL/src/sensor/android/SDL_androidsensor.h index 64a497b46..5a119dbf5 100644 --- a/thirdparty/SDL/src/sensor/android/SDL_androidsensor.h +++ b/thirdparty/SDL/src/sensor/android/SDL_androidsensor.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/sensor/coremotion/SDL_coremotionsensor.h b/thirdparty/SDL/src/sensor/coremotion/SDL_coremotionsensor.h index befacdd9d..ae48163eb 100644 --- a/thirdparty/SDL/src/sensor/coremotion/SDL_coremotionsensor.h +++ b/thirdparty/SDL/src/sensor/coremotion/SDL_coremotionsensor.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/sensor/coremotion/SDL_coremotionsensor.m b/thirdparty/SDL/src/sensor/coremotion/SDL_coremotionsensor.m index a8bfe3a6b..c653c9bb9 100644 --- a/thirdparty/SDL/src/sensor/coremotion/SDL_coremotionsensor.m +++ b/thirdparty/SDL/src/sensor/coremotion/SDL_coremotionsensor.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/sensor/dummy/SDL_dummysensor.c b/thirdparty/SDL/src/sensor/dummy/SDL_dummysensor.c index a3983e4e1..b8840d874 100644 --- a/thirdparty/SDL/src/sensor/dummy/SDL_dummysensor.c +++ b/thirdparty/SDL/src/sensor/dummy/SDL_dummysensor.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/sensor/dummy/SDL_dummysensor.h b/thirdparty/SDL/src/sensor/dummy/SDL_dummysensor.h index bdde5f23b..e8bf8ef24 100644 --- a/thirdparty/SDL/src/sensor/dummy/SDL_dummysensor.h +++ b/thirdparty/SDL/src/sensor/dummy/SDL_dummysensor.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/sensor/n3ds/SDL_n3dssensor.c b/thirdparty/SDL/src/sensor/n3ds/SDL_n3dssensor.c index 26647582e..236b64803 100644 --- a/thirdparty/SDL/src/sensor/n3ds/SDL_n3dssensor.c +++ b/thirdparty/SDL/src/sensor/n3ds/SDL_n3dssensor.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/sensor/vita/SDL_vitasensor.c b/thirdparty/SDL/src/sensor/vita/SDL_vitasensor.c index 6513f9e08..8ff68ddf3 100644 --- a/thirdparty/SDL/src/sensor/vita/SDL_vitasensor.c +++ b/thirdparty/SDL/src/sensor/vita/SDL_vitasensor.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -54,7 +54,7 @@ static int SDL_VITA_SensorInit(void) SDL_sensors_count = 2; SDL_sensors = (SDL_VitaSensor *)SDL_calloc(SDL_sensors_count, sizeof(*SDL_sensors)); - if (SDL_sensors == NULL) { + if (!SDL_sensors) { return SDL_OutOfMemory(); } @@ -121,7 +121,7 @@ static int SDL_VITA_SensorOpen(SDL_Sensor *sensor, int device_index) struct sensor_hwdata *hwdata; hwdata = (struct sensor_hwdata *)SDL_calloc(1, sizeof(*hwdata)); - if (hwdata == NULL) { + if (!hwdata) { return SDL_OutOfMemory(); } sensor->hwdata = hwdata; diff --git a/thirdparty/SDL/src/sensor/vita/SDL_vitasensor.h b/thirdparty/SDL/src/sensor/vita/SDL_vitasensor.h index a0f655513..183c35a8b 100644 --- a/thirdparty/SDL/src/sensor/vita/SDL_vitasensor.h +++ b/thirdparty/SDL/src/sensor/vita/SDL_vitasensor.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/sensor/windows/SDL_windowssensor.c b/thirdparty/SDL/src/sensor/windows/SDL_windowssensor.c index 29195a03a..cba5b1769 100644 --- a/thirdparty/SDL/src/sensor/windows/SDL_windowssensor.c +++ b/thirdparty/SDL/src/sensor/windows/SDL_windowssensor.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -67,7 +67,7 @@ static int DisconnectSensor(ISensor *sensor); static HRESULT STDMETHODCALLTYPE ISensorManagerEventsVtbl_QueryInterface(ISensorManagerEvents *This, REFIID riid, void **ppvObject) { - if (ppvObject == NULL) { + if (!ppvObject) { return E_INVALIDARG; } @@ -107,7 +107,7 @@ static ISensorManagerEvents sensor_manager_events = { static HRESULT STDMETHODCALLTYPE ISensorEventsVtbl_QueryInterface(ISensorEvents *This, REFIID riid, void **ppvObject) { - if (ppvObject == NULL) { + if (!ppvObject) { return E_INVALIDARG; } @@ -286,13 +286,13 @@ static int ConnectSensor(ISensor *sensor) if (bstr_name != NULL) { SysFreeString(bstr_name); } - if (name == NULL) { + if (!name) { return SDL_OutOfMemory(); } SDL_LockSensors(); new_sensors = (SDL_Windows_Sensor *)SDL_realloc(SDL_sensors, (SDL_num_sensors + 1) * sizeof(SDL_Windows_Sensor)); - if (new_sensors == NULL) { + if (!new_sensors) { SDL_UnlockSensors(); SDL_free(name); return SDL_OutOfMemory(); diff --git a/thirdparty/SDL/src/sensor/windows/SDL_windowssensor.h b/thirdparty/SDL/src/sensor/windows/SDL_windowssensor.h index bdde5f23b..e8bf8ef24 100644 --- a/thirdparty/SDL/src/sensor/windows/SDL_windowssensor.h +++ b/thirdparty/SDL/src/sensor/windows/SDL_windowssensor.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/stdlib/SDL_crc16.c b/thirdparty/SDL/src/stdlib/SDL_crc16.c index f37c2d1c6..d1270f1f1 100644 --- a/thirdparty/SDL/src/stdlib/SDL_crc16.c +++ b/thirdparty/SDL/src/stdlib/SDL_crc16.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/stdlib/SDL_crc32.c b/thirdparty/SDL/src/stdlib/SDL_crc32.c index f28b863ac..ad6eed326 100644 --- a/thirdparty/SDL/src/stdlib/SDL_crc32.c +++ b/thirdparty/SDL/src/stdlib/SDL_crc32.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/stdlib/SDL_getenv.c b/thirdparty/SDL/src/stdlib/SDL_getenv.c index 466867ac8..13cf5a39f 100644 --- a/thirdparty/SDL/src/stdlib/SDL_getenv.c +++ b/thirdparty/SDL/src/stdlib/SDL_getenv.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -47,7 +47,7 @@ static size_t SDL_envmemlen = 0; int SDL_setenv(const char *name, const char *value, int overwrite) { /* Input validation */ - if (name == NULL || *name == '\0' || SDL_strchr(name, '=') != NULL || value == NULL) { + if (!name || *name == '\0' || SDL_strchr(name, '=') != NULL || !value) { return -1; } @@ -57,7 +57,7 @@ int SDL_setenv(const char *name, const char *value, int overwrite) int SDL_setenv(const char *name, const char *value, int overwrite) { /* Input validation */ - if (name == NULL || *name == '\0' || SDL_strchr(name, '=') != NULL || value == NULL) { + if (!name || *name == '\0' || SDL_strchr(name, '=') != NULL || !value) { return -1; } @@ -79,7 +79,7 @@ int SDL_setenv(const char *name, const char *value, int overwrite) char *new_variable; /* Input validation */ - if (name == NULL || *name == '\0' || SDL_strchr(name, '=') != NULL || value == NULL) { + if (!name || *name == '\0' || SDL_strchr(name, '=') != NULL || !value) { return -1; } @@ -94,7 +94,7 @@ int SDL_setenv(const char *name, const char *value, int overwrite) /* This leaks. Sorry. Get a better OS so we don't have to do this. */ len = SDL_strlen(name) + SDL_strlen(value) + 2; new_variable = (char *)SDL_malloc(len); - if (new_variable == NULL) { + if (!new_variable) { return -1; } @@ -111,7 +111,7 @@ int SDL_setenv(const char *name, const char *value, int overwrite) char *new_variable; /* Input validation */ - if (name == NULL || *name == '\0' || SDL_strchr(name, '=') != NULL || value == NULL) { + if (!name || *name == '\0' || SDL_strchr(name, '=') != NULL || !value) { return -1; } @@ -123,7 +123,7 @@ int SDL_setenv(const char *name, const char *value, int overwrite) /* Allocate memory for the variable */ len = SDL_strlen(name) + SDL_strlen(value) + 2; new_variable = (char *)SDL_malloc(len); - if (new_variable == NULL) { + if (!new_variable) { return -1; } @@ -176,7 +176,7 @@ char *SDL_getenv(const char *name) #endif /* Input validation */ - if (name == NULL || *name == '\0') { + if (!name || *name == '\0') { return NULL; } @@ -188,7 +188,7 @@ char *SDL_getenv(const char *name) size_t bufferlen; /* Input validation */ - if (name == NULL || *name == '\0') { + if (!name || *name == '\0') { return NULL; } @@ -199,7 +199,7 @@ char *SDL_getenv(const char *name) } if (bufferlen > SDL_envmemlen) { char *newmem = (char *)SDL_realloc(SDL_envmem, bufferlen); - if (newmem == NULL) { + if (!newmem) { return NULL; } SDL_envmem = newmem; @@ -215,14 +215,14 @@ char *SDL_getenv(const char *name) char *value; /* Input validation */ - if (name == NULL || *name == '\0') { + if (!name || *name == '\0') { return NULL; } value = (char *)0; if (SDL_env) { len = SDL_strlen(name); - for (i = 0; SDL_env[i] && value == NULL; ++i) { + for (i = 0; SDL_env[i] && !value; ++i) { if ((SDL_strncmp(SDL_env[i], name, len) == 0) && (SDL_env[i][len] == '=')) { value = &SDL_env[i][len + 1]; diff --git a/thirdparty/SDL/src/stdlib/SDL_iconv.c b/thirdparty/SDL/src/stdlib/SDL_iconv.c index e0bfb4cfb..416e199b7 100644 --- a/thirdparty/SDL/src/stdlib/SDL_iconv.c +++ b/thirdparty/SDL/src/stdlib/SDL_iconv.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -31,7 +31,7 @@ #include "SDL_endian.h" #if defined(HAVE_ICONV) && defined(HAVE_ICONV_H) -#ifdef __FreeBSD__ +#ifndef SDL_USE_LIBICONV /* Define LIBICONV_PLUG to use iconv from the base instead of ports and avoid linker errors. */ #define LIBICONV_PLUG 1 #endif @@ -166,28 +166,28 @@ static const char *getlocale(char *buffer, size_t bufsize) char *ptr; lang = SDL_getenv("LC_ALL"); - if (lang == NULL) { + if (!lang) { lang = SDL_getenv("LC_CTYPE"); } - if (lang == NULL) { + if (!lang) { lang = SDL_getenv("LC_MESSAGES"); } - if (lang == NULL) { + if (!lang) { lang = SDL_getenv("LANG"); } - if (lang == NULL || !*lang || SDL_strcmp(lang, "C") == 0) { + if (!lang || !*lang || SDL_strcmp(lang, "C") == 0) { lang = "ASCII"; } /* We need to trim down strings like "en_US.UTF-8@blah" to "UTF-8" */ ptr = SDL_strchr(lang, '.'); - if (ptr != NULL) { + if (ptr) { lang = ptr + 1; } SDL_strlcpy(buffer, lang, bufsize); ptr = SDL_strchr(buffer, '@'); - if (ptr != NULL) { + if (ptr) { *ptr = '\0'; /* chop end of string. */ } @@ -202,10 +202,10 @@ SDL_iconv_t SDL_iconv_open(const char *tocode, const char *fromcode) char fromcode_buffer[64]; char tocode_buffer[64]; - if (fromcode == NULL || !*fromcode) { + if (!fromcode || !*fromcode) { fromcode = getlocale(fromcode_buffer, sizeof(fromcode_buffer)); } - if (tocode == NULL || !*tocode) { + if (!tocode || !*tocode) { tocode = getlocale(tocode_buffer, sizeof(tocode_buffer)); } for (i = 0; i < SDL_arraysize(encodings); ++i) { @@ -245,11 +245,11 @@ SDL_iconv(SDL_iconv_t cd, Uint32 ch = 0; size_t total; - if (inbuf == NULL || !*inbuf) { + if (!inbuf || !*inbuf) { /* Reset the context */ return 0; } - if (outbuf == NULL || !*outbuf || outbytesleft == NULL || !*outbytesleft) { + if (!outbuf || !*outbuf || !outbytesleft || !*outbytesleft) { return SDL_ICONV_E2BIG; } src = *inbuf; @@ -795,10 +795,10 @@ char *SDL_iconv_string(const char *tocode, const char *fromcode, const char *inb size_t outbytesleft; size_t retCode = 0; - if (tocode == NULL || !*tocode) { + if (!tocode || !*tocode) { tocode = "UTF-8"; } - if (fromcode == NULL || !*fromcode) { + if (!fromcode || !*fromcode) { fromcode = "UTF-8"; } cd = SDL_iconv_open(tocode, fromcode); @@ -806,15 +806,15 @@ char *SDL_iconv_string(const char *tocode, const char *fromcode, const char *inb return NULL; } - stringsize = inbytesleft > 4 ? inbytesleft : 4; - string = (char *)SDL_malloc(stringsize + 1); - if (string == NULL) { + stringsize = inbytesleft; + string = (char *)SDL_malloc(stringsize + sizeof(Uint32)); + if (!string) { SDL_iconv_close(cd); return NULL; } outbuf = string; outbytesleft = stringsize; - SDL_memset(outbuf, 0, 4); + SDL_memset(outbuf, 0, sizeof(Uint32)); while (inbytesleft > 0) { const size_t oldinbytesleft = inbytesleft; @@ -822,17 +822,18 @@ char *SDL_iconv_string(const char *tocode, const char *fromcode, const char *inb switch (retCode) { case SDL_ICONV_E2BIG: { + const ptrdiff_t diff = (ptrdiff_t) (outbuf - string); char *oldstring = string; stringsize *= 2; - string = (char *)SDL_realloc(string, stringsize + 1); - if (string == NULL) { + string = (char *)SDL_realloc(string, stringsize + sizeof(Uint32)); + if (!string) { SDL_free(oldstring); SDL_iconv_close(cd); return NULL; } - outbuf = string + (outbuf - oldstring); - outbytesleft = stringsize - (outbuf - string); - SDL_memset(outbuf, 0, 4); + outbuf = string + diff; + outbytesleft = stringsize - diff; + SDL_memset(outbuf, 0, sizeof(Uint32)); continue; } case SDL_ICONV_EILSEQ: @@ -851,7 +852,7 @@ char *SDL_iconv_string(const char *tocode, const char *fromcode, const char *inb break; } } - *outbuf = '\0'; + SDL_memset(outbuf, 0, sizeof(Uint32)); SDL_iconv_close(cd); return string; diff --git a/thirdparty/SDL/src/stdlib/SDL_malloc.c b/thirdparty/SDL/src/stdlib/SDL_malloc.c index c1aa44414..6edd912b6 100644 --- a/thirdparty/SDL/src/stdlib/SDL_malloc.c +++ b/thirdparty/SDL/src/stdlib/SDL_malloc.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -405,9 +405,9 @@ MALLINFO_FIELD_TYPE default: size_t size_t. The value is used only if HAVE_USR_INCLUDE_MALLOC_H is not set REALLOC_ZERO_BYTES_FREES default: not defined - This should be set if a call to realloc with zero bytes should - be the same as a call to free. Some people think it should. Otherwise, - since this malloc returns a unique pointer for malloc(0), so does + This should be set if a call to realloc with zero bytes should + be the same as a call to free. Some people think it should. Otherwise, + since this malloc returns a unique pointer for malloc(0), so does realloc(p, 0). LACKS_UNISTD_H, LACKS_FCNTL_H, LACKS_SYS_PARAM_H, LACKS_SYS_MMAN_H @@ -2263,7 +2263,7 @@ static void reset_on_error(mstate m); /* -------------------------- Debugging setup ---------------------------- */ -#if ! DEBUG +#ifndef DEBUG #define check_free_chunk(M,P) #define check_inuse_chunk(M,P) @@ -2627,7 +2627,7 @@ static int change_mparam(int param_number, int value) { } } -#if DEBUG +#ifdef DEBUG /* ------------------------- Debugging Support --------------------------- */ /* Check properties of any chunk, whether free, inuse, mmapped etc */ @@ -3583,7 +3583,7 @@ static void* sys_alloc(mstate m, size_t nb) { m->seg.sflags = mmap_flag; m->magic = mparams.magic; init_bins(m); - if (is_global(m)) + if (is_global(m)) init_top(m, (mchunkptr)tbase, tsize - TOP_FOOT_SIZE); else { /* Offset top by embedded malloc_state */ @@ -3734,7 +3734,7 @@ static int sys_trim(mstate m, size_t pad) { } /* Unmap any unused mmapped segments */ - if (HAVE_MMAP) + if (HAVE_MMAP) released += release_unused_segments(m); /* On failure, disable autotrim to avoid repeated failed future calls */ @@ -3942,7 +3942,7 @@ static void* internal_memalign(mstate m, size_t alignment, size_t bytes) { while (a < alignment) a <<= 1; alignment = a; } - + if (bytes >= MAX_REQUEST - alignment) { if (m != 0) { /* Test isn't needed but avoids compiler warning */ MALLOC_FAILURE_ACTION; @@ -4125,7 +4125,7 @@ static void** ialloc(mstate m, } } -#if DEBUG +#ifdef DEBUG if (marray != chunks) { /* final element must have exactly exhausted chunk */ if (element_size != 0) { @@ -4472,7 +4472,7 @@ struct mallinfo dlmallinfo(void) { } #endif /* NO_MALLINFO */ -void dlmalloc_stats() { +void dlmalloc_stats(void) { internal_malloc_stats(gm); } @@ -5187,7 +5187,7 @@ int mspace_mallopt(int param_number, int value) { Trial version Fri Aug 28 13:14:29 1992 Doug Lea (dl at g.oswego.edu) * Based loosely on libg++-1.2X malloc. (It retains some of the overall structure of old version, but most details differ.) - + */ #endif /* !HAVE_MALLOC */ diff --git a/thirdparty/SDL/src/stdlib/SDL_mslibc.c b/thirdparty/SDL/src/stdlib/SDL_mslibc.c index 677f40111..3b3e7e276 100644 --- a/thirdparty/SDL/src/stdlib/SDL_mslibc.c +++ b/thirdparty/SDL/src/stdlib/SDL_mslibc.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/stdlib/SDL_qsort.c b/thirdparty/SDL/src/stdlib/SDL_qsort.c index 5d1c7ef94..91fb1d234 100644 --- a/thirdparty/SDL/src/stdlib/SDL_qsort.c +++ b/thirdparty/SDL/src/stdlib/SDL_qsort.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -28,8 +28,11 @@ #include "SDL_stdinc.h" #if defined(HAVE_QSORT) -void SDL_qsort(void *base, size_t nmemb, size_t size, int (*compare) (const void *, const void *)) +void SDL_qsort(void *base, size_t nmemb, size_t size, int (SDLCALL *compare) (const void *, const void *)) { + if (!base) { + return; + } qsort(base, nmemb, size, compare); } @@ -62,7 +65,7 @@ void SDL_qsort(void *base, size_t nmemb, size_t size, int (*compare) (const void /* This code came from Gareth McCaughan, under the zlib license. -Specifically this: https://www.mccaughan.org.uk/software/qsort.c-1.15 +Specifically this: https://www.mccaughan.org.uk/software/qsort.c-1.16 Everything below this comment until the HAVE_QSORT #endif was from Gareth (any minor changes will be noted inline). @@ -109,7 +112,7 @@ benefit! * Gareth McCaughan */ -/* Copyright (c) 1998-2016 Gareth McCaughan +/* Copyright (c) 1998-2021 Gareth McCaughan * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any @@ -145,17 +148,23 @@ benefit! * (pre-insertion-sort messed up). * Disable DEBUG_QSORT by default. * Tweak comments very slightly. + * 2021-02-20 v1.16 Fix bug kindly reported by Ray Gardner + * (error in recursion leading to possible + * stack overflow). + * When checking alignment, avoid casting + * pointer to possibly-smaller integer. */ /* BEGIN SDL CHANGE ... commented this out with an #if 0 block. --ryan. */ #if 0 #include +#include #include #include #undef DEBUG_QSORT -static char _ID[]=""; +static char _ID[]=""; #endif /* END SDL CHANGE ... commented this out with an #if 0 block. --ryan. */ @@ -165,7 +174,8 @@ static char _ID[]=""; #define WORD_BYTES sizeof(int) /* How big does our stack need to be? Answer: one entry per - * bit in a |size_t|. + * bit in a |size_t|. (Actually, a bit less because we don't + * recurse all the way down to size-1 subarrays.) */ #define STACK_SIZE (8*sizeof(size_t)) @@ -204,11 +214,12 @@ typedef struct { char * first; char * last; } stack_entry; * on large datasets for locality-of-reference reasons, * but it makes the code much nastier and increases * bookkeeping overhead. - * 2. We always save the shorter and get to work on the - * longer. This guarantees that every time we push - * an item onto the stack its size is <= 1/2 of that - * of its parent; so the stack can't need more than - * log_2(max-array-size) entries. + * 2. We always save the longer and get to work on the + * shorter. This guarantees that whenever we push + * a k'th entry onto the stack we are about to get + * working on something of size <= N/2^k where N is + * the original array size; so the stack can't need + * more than log_2(max-array-size) entries. * 3. We choose a pivot by looking at the first, last * and middle elements. We arrange them into order * because it's easy to do that in conjunction with @@ -270,8 +281,8 @@ typedef struct { char * first; char * last; } stack_entry; if (r>=Trunc) doRight \ else pop \ } \ - else if (l<=r) { pushLeft; doRight } \ - else if (r>=Trunc) { pushRight; doLeft }\ + else if (l<=r) { pushRight; doLeft } \ + else if (r>=Trunc) { pushLeft; doRight }\ else doLeft \ } @@ -365,7 +376,7 @@ typedef struct { char * first; char * last; } stack_entry; /* ---------------------------------------------------------------------- */ static char * pivot_big(char *first, char *mid, char *last, size_t size, - int compare(const void *, const void *)) { + int (SDLCALL * compare)(const void *, const void *)) { size_t d=(((last-first)/size)>>3)*size; #ifdef DEBUG_QSORT fprintf(stderr, "pivot_big: first=%p last=%p size=%lu n=%lu\n", first, (unsigned long)last, size, (unsigned long)((last-first+1)/size)); @@ -406,7 +417,7 @@ fprintf(stderr,"-> %d %d %d @ %p %p %p\n",*(int*)m1,*(int*)m2,*(int*)m3, m1,m2,m /* ---------------------------------------------------------------------- */ static void qsort_nonaligned(void *base, size_t nmemb, size_t size, - int (*compare)(const void *, const void *)) { + int (SDLCALL * compare)(const void *, const void *)) { stack_entry stack[STACK_SIZE]; int stacktop=0; @@ -437,7 +448,7 @@ static void qsort_nonaligned(void *base, size_t nmemb, size_t size, } static void qsort_aligned(void *base, size_t nmemb, size_t size, - int (*compare)(const void *, const void *)) { + int (SDLCALL * compare)(const void *, const void *)) { stack_entry stack[STACK_SIZE]; int stacktop=0; @@ -468,7 +479,7 @@ static void qsort_aligned(void *base, size_t nmemb, size_t size, } static void qsort_words(void *base, size_t nmemb, - int (*compare)(const void *, const void *)) { + int (SDLCALL * compare)(const void *, const void *)) { stack_entry stack[STACK_SIZE]; int stacktop=0; @@ -520,10 +531,10 @@ fprintf(stderr, "after partitioning first=#%lu last=#%lu\n", (first-(char*)base) /* ---------------------------------------------------------------------- */ extern void qsortG(void *base, size_t nmemb, size_t size, - int (*compare)(const void *, const void *)) { + int (SDLCALL * compare)(const void *, const void *)) { if (nmemb<=1) return; - if (((size_t)base|size)&(WORD_BYTES-1)) + if (((uintptr_t)base|size)&(WORD_BYTES-1)) qsort_nonaligned(base,nmemb,size,compare); else if (size!=WORD_BYTES) qsort_aligned(base,nmemb,size,compare); @@ -533,7 +544,7 @@ extern void qsortG(void *base, size_t nmemb, size_t size, #endif /* HAVE_QSORT */ -void *SDL_bsearch(const void *key, const void *base, size_t nmemb, size_t size, int (*compare)(const void *, const void *)) +void *SDL_bsearch(const void *key, const void *base, size_t nmemb, size_t size, int (SDLCALL * compare)(const void *, const void *)) { #if defined(HAVE_BSEARCH) return bsearch(key, base, nmemb, size, compare); @@ -566,4 +577,3 @@ void *SDL_bsearch(const void *key, const void *base, size_t nmemb, size_t size, } /* vi: set ts=4 sw=4 expandtab: */ - diff --git a/thirdparty/SDL/src/stdlib/SDL_stdlib.c b/thirdparty/SDL/src/stdlib/SDL_stdlib.c index 8c9d196ac..a90f09f7c 100644 --- a/thirdparty/SDL/src/stdlib/SDL_stdlib.c +++ b/thirdparty/SDL/src/stdlib/SDL_stdlib.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/stdlib/SDL_string.c b/thirdparty/SDL/src/stdlib/SDL_string.c index 7353d4591..3f26e8d90 100644 --- a/thirdparty/SDL/src/stdlib/SDL_string.c +++ b/thirdparty/SDL/src/stdlib/SDL_string.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -1152,7 +1152,7 @@ int SDL_vsscanf(const char *text, const char *fmt, va_list ap) { int retval = 0; - if (text == NULL || !*text) { + if (!text || !*text) { return -1; } @@ -1529,7 +1529,7 @@ typedef enum typedef struct { - SDL_bool left_justify; /* for now: ignored. */ + SDL_bool left_justify; SDL_bool force_sign; SDL_bool force_type; /* for now: used only by float printer, ignored otherwise. */ SDL_bool pad_zeroes; @@ -1541,33 +1541,41 @@ typedef struct static size_t SDL_PrintString(char *text, size_t maxlen, SDL_FormatInfo *info, const char *string) { + const char fill = (info && info->pad_zeroes) ? '0' : ' '; + size_t width = 0; + size_t filllen = 0; size_t length = 0; size_t slen, sz; - if (string == NULL) { + if (!string) { string = "(null)"; } sz = SDL_strlen(string); if (info && info->width > 0 && (size_t)info->width > sz) { - const char fill = info->pad_zeroes ? '0' : ' '; - size_t width = info->width - sz; - size_t filllen; - + width = info->width - sz; if (info->precision >= 0 && (size_t)info->precision < sz) { width += sz - (size_t)info->precision; } filllen = SDL_min(width, maxlen); - SDL_memset(text, fill, filllen); - text += filllen; - maxlen -= filllen; - length += width; + if (!info->left_justify) { + SDL_memset(text, fill, filllen); + text += filllen; + maxlen -= filllen; + length += width; + filllen = 0; + } } SDL_strlcpy(text, string, maxlen); length += sz; + if (filllen > 0) { + SDL_memset(text + sz, fill, filllen); + length += width; + } + if (info) { if (info->precision >= 0 && (size_t)info->precision < sz) { slen = (size_t)info->precision; @@ -1604,7 +1612,7 @@ static void SDL_IntPrecisionAdjust(char *num, size_t maxlen, SDL_FormatInfo *inf { /* left-pad num with zeroes. */ size_t sz, pad, have_sign; - if (info == NULL) { + if (!info) { return; } @@ -1735,6 +1743,20 @@ static size_t SDL_PrintFloat(char *text, size_t maxlen, SDL_FormatInfo *info, do return length; } +static size_t SDL_PrintPointer(char *text, size_t maxlen, SDL_FormatInfo *info, const void *value) +{ + char num[130]; + size_t length; + + if (!value) { + return SDL_PrintString(text, maxlen, info, NULL); + } + + SDL_ulltoa((unsigned long long)(uintptr_t)value, num, 16); + length = SDL_PrintString(text, maxlen, info, "0x"); + return length + SDL_PrintString(TEXT_AND_LEN_ARGS, info, num); +} + /* NOLINTNEXTLINE(readability-non-const-parameter) */ int SDL_vsnprintf(SDL_OUT_Z_CAP(maxlen) char *text, size_t maxlen, const char *fmt, va_list ap) { @@ -1867,6 +1889,10 @@ int SDL_vsnprintf(SDL_OUT_Z_CAP(maxlen) char *text, size_t maxlen, const char *f done = SDL_TRUE; break; case 'p': + info.force_case = SDL_CASE_LOWER; + length += SDL_PrintPointer(TEXT_AND_LEN_ARGS, &info, va_arg(ap, void *)); + done = SDL_TRUE; + break; case 'x': info.force_case = SDL_CASE_LOWER; SDL_FALLTHROUGH; @@ -1877,9 +1903,6 @@ int SDL_vsnprintf(SDL_OUT_Z_CAP(maxlen) char *text, size_t maxlen, const char *f if (info.radix == 10) { info.radix = 16; } - if (*fmt == 'p') { - inttype = DO_LONG; - } SDL_FALLTHROUGH; case 'o': if (info.radix == 10) { @@ -1977,7 +2000,7 @@ int SDL_vasprintf(char **strp, const char *fmt, va_list ap) *strp = NULL; p = (char *)SDL_malloc(size); - if (p == NULL) { + if (!p) { return -1; } @@ -1989,6 +2012,7 @@ int SDL_vasprintf(char **strp, const char *fmt, va_list ap) /* Check error code */ if (retval < 0) { + SDL_free(p); return retval; } @@ -2002,7 +2026,7 @@ int SDL_vasprintf(char **strp, const char *fmt, va_list ap) size = retval + 1; /* Precisely what is needed */ np = (char *)SDL_realloc(p, size); - if (np == NULL) { + if (!np) { SDL_free(p); return -1; } else { @@ -2010,5 +2034,3 @@ int SDL_vasprintf(char **strp, const char *fmt, va_list ap) } } } - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/thirdparty/SDL/src/stdlib/SDL_strtokr.c b/thirdparty/SDL/src/stdlib/SDL_strtokr.c index edd6005f5..38dc83029 100644 --- a/thirdparty/SDL/src/stdlib/SDL_strtokr.c +++ b/thirdparty/SDL/src/stdlib/SDL_strtokr.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/stdlib/SDL_vacopy.h b/thirdparty/SDL/src/stdlib/SDL_vacopy.h index dd08a3fb4..ee45bf631 100644 --- a/thirdparty/SDL/src/stdlib/SDL_vacopy.h +++ b/thirdparty/SDL/src/stdlib/SDL_vacopy.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/test/SDL_test_assert.c b/thirdparty/SDL/src/test/SDL_test_assert.c index dc1eb6421..1932f69de 100644 --- a/thirdparty/SDL/src/test/SDL_test_assert.c +++ b/thirdparty/SDL/src/test/SDL_test_assert.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -107,7 +107,7 @@ void SDLTest_AssertPass(SDL_PRINTF_FORMAT_STRING const char *assertDescription, /* * Resets the assert summary counters to zero. */ -void SDLTest_ResetAssertSummary() +void SDLTest_ResetAssertSummary(void) { SDLTest_AssertsPassed = 0; SDLTest_AssertsFailed = 0; @@ -117,7 +117,7 @@ void SDLTest_ResetAssertSummary() * Logs summary of all assertions (total, pass, fail) since last reset * as INFO (failed==0) or ERROR (failed > 0). */ -void SDLTest_LogAssertSummary() +void SDLTest_LogAssertSummary(void) { int totalAsserts = SDLTest_AssertsPassed + SDLTest_AssertsFailed; if (SDLTest_AssertsFailed == 0) { @@ -130,7 +130,7 @@ void SDLTest_LogAssertSummary() /* * Converts the current assert state into a test result */ -int SDLTest_AssertSummaryToTestResult() +int SDLTest_AssertSummaryToTestResult(void) { if (SDLTest_AssertsFailed > 0) { return TEST_RESULT_FAILED; diff --git a/thirdparty/SDL/src/test/SDL_test_common.c b/thirdparty/SDL/src/test/SDL_test_common.c index 8781cc574..04ad51f2a 100644 --- a/thirdparty/SDL/src/test/SDL_test_common.c +++ b/thirdparty/SDL/src/test/SDL_test_common.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -72,7 +72,7 @@ SDLTest_CommonState *SDLTest_CommonCreateState(char **argv, Uint32 flags) } state = (SDLTest_CommonState *)SDL_calloc(1, sizeof(*state)); - if (state == NULL) { + if (!state) { SDL_OutOfMemory(); return NULL; } @@ -134,6 +134,7 @@ int SDLTest_CommonArg(SDLTest_CommonState *state, int index) return -1; } state->videodriver = argv[index]; + SDL_SetHint(SDL_HINT_VIDEODRIVER, state->videodriver); return 2; } if (SDL_strcasecmp(argv[index], "--renderer") == 0) { @@ -591,7 +592,7 @@ void SDLTest_CommonLogUsage(SDLTest_CommonState *state, const char *argv0, const static const char *BuildCommonUsageString(char **pstr, const char **strlist, const int numitems, const char **strlist2, const int numitems2) { char *str = *pstr; - if (str == NULL) { + if (!str) { size_t len = SDL_strlen("[--trackmem]") + 2; int i; for (i = 0; i < numitems; i++) { @@ -603,7 +604,7 @@ static const char *BuildCommonUsageString(char **pstr, const char **strlist, con } } str = (char *)SDL_calloc(1, len); - if (str == NULL) { + if (!str) { return ""; /* oh well. */ } SDL_strlcat(str, "[--trackmem] ", len); @@ -802,6 +803,82 @@ static void SDLTest_PrintWindowFlags(char *text, size_t maxlen, Uint32 flags) } } +static void SDLTest_PrintModStateFlag(char *text, size_t maxlen, SDL_Keymod flag) +{ + switch (flag) { + case KMOD_LSHIFT: + SDL_snprintfcat(text, maxlen, "LSHIFT"); + break; + case KMOD_RSHIFT: + SDL_snprintfcat(text, maxlen, "RSHIFT"); + break; + case KMOD_LCTRL: + SDL_snprintfcat(text, maxlen, "LCTRL"); + break; + case KMOD_RCTRL: + SDL_snprintfcat(text, maxlen, "RCTRL"); + break; + case KMOD_LALT: + SDL_snprintfcat(text, maxlen, "LALT"); + break; + case KMOD_RALT: + SDL_snprintfcat(text, maxlen, "RALT"); + break; + case KMOD_LGUI: + SDL_snprintfcat(text, maxlen, "LGUI"); + break; + case KMOD_RGUI: + SDL_snprintfcat(text, maxlen, "RGUI"); + break; + case KMOD_NUM: + SDL_snprintfcat(text, maxlen, "NUM"); + break; + case KMOD_CAPS: + SDL_snprintfcat(text, maxlen, "CAPS"); + break; + case KMOD_MODE: + SDL_snprintfcat(text, maxlen, "MODE"); + break; + case KMOD_SCROLL: + SDL_snprintfcat(text, maxlen, "SCROLL"); + break; + default: + SDL_snprintfcat(text, maxlen, "0x%8.8x", (unsigned int) flag); + break; + } +} + +static void SDLTest_PrintModState(char *text, size_t maxlen, SDL_Keymod keymod) +{ + const SDL_Keymod kmod_flags[] = { + KMOD_LSHIFT, + KMOD_RSHIFT, + KMOD_LCTRL, + KMOD_RCTRL, + KMOD_LALT, + KMOD_RALT, + KMOD_LGUI, + KMOD_RGUI, + KMOD_NUM, + KMOD_CAPS, + KMOD_MODE, + KMOD_SCROLL + }; + + int i; + int count = 0; + for (i = 0; i < SDL_arraysize(kmod_flags); ++i) { + const SDL_Keymod flag = kmod_flags[i]; + if ((keymod & flag) == flag) { + if (count > 0) { + SDL_snprintfcat(text, maxlen, " | "); + } + SDLTest_PrintModStateFlag(text, maxlen, flag); + ++count; + } + } +} + static void SDLTest_PrintButtonMask(char *text, size_t maxlen, Uint32 flags) { int i; @@ -851,6 +928,12 @@ static void SDLTest_PrintPixelFormat(char *text, size_t maxlen, Uint32 format) case SDL_PIXELFORMAT_INDEX1MSB: SDL_snprintfcat(text, maxlen, "Index1MSB"); break; + case SDL_PIXELFORMAT_INDEX2LSB: + SDL_snprintfcat(text, maxlen, "Index2LSB"); + break; + case SDL_PIXELFORMAT_INDEX2MSB: + SDL_snprintfcat(text, maxlen, "Index2MSB"); + break; case SDL_PIXELFORMAT_INDEX4LSB: SDL_snprintfcat(text, maxlen, "Index4LSB"); break; @@ -991,7 +1074,7 @@ static SDL_Surface *SDLTest_LoadIcon(const char *file) /* Load the icon surface */ icon = SDL_LoadBMP(file); - if (icon == NULL) { + if (!icon) { SDL_Log("Couldn't load %s: %s\n", file, SDL_GetError()); return NULL; } @@ -1120,7 +1203,7 @@ SDL_bool SDLTest_CommonInit(SDLTest_CommonState *state) SDL_DisplayMode mode; int bpp; Uint32 Rmask, Gmask, Bmask, Amask; -#if SDL_VIDEO_DRIVER_WINDOWS +#ifdef SDL_VIDEO_DRIVER_WINDOWS int adapterIndex = 0; int outputIndex = 0; #endif @@ -1183,7 +1266,7 @@ SDL_bool SDLTest_CommonInit(SDLTest_CommonState *state) } } -#if SDL_VIDEO_DRIVER_WINDOWS && !defined(__XBOXONE__) && !defined(__XBOXSERIES__) +#if defined(SDL_VIDEO_DRIVER_WINDOWS) && !defined(__XBOXONE__) && !defined(__XBOXSERIES__) /* Print the D3D9 adapter index */ adapterIndex = SDL_Direct3D9GetAdapterIndex(i); SDL_Log("D3D9 Adapter Index: %d", adapterIndex); @@ -1511,11 +1594,10 @@ static void SDLTest_PrintEvent(SDL_Event *event) SDL_Log("SDL EVENT: Window %" SDL_PRIu32 " restored", event->window.windowID); break; case SDL_WINDOWEVENT_ENTER: - SDL_Log("SDL EVENT: Mouse entered window %" SDL_PRIu32 "", - event->window.windowID); + SDL_Log("SDL EVENT: Mouse entered window %" SDL_PRIu32, event->window.windowID); break; case SDL_WINDOWEVENT_LEAVE: - SDL_Log("SDL EVENT: Mouse left window %" SDL_PRIu32 "", event->window.windowID); + SDL_Log("SDL EVENT: Mouse left window %" SDL_PRIu32, event->window.windowID); break; case SDL_WINDOWEVENT_FOCUS_GAINED: SDL_Log("SDL EVENT: Window %" SDL_PRIu32 " gained keyboard focus", @@ -1538,7 +1620,7 @@ static void SDLTest_PrintEvent(SDL_Event *event) SDL_Log("SDL EVENT: Window %" SDL_PRIu32 " ICC profile changed", event->window.windowID); break; case SDL_WINDOWEVENT_DISPLAY_CHANGED: - SDL_Log("SDL EVENT: Window %" SDL_PRIu32 " display changed to %" SDL_PRIs32 "", event->window.windowID, event->window.data1); + SDL_Log("SDL EVENT: Window %" SDL_PRIu32 " display changed to %" SDL_PRIs32, event->window.windowID, event->window.data1); break; default: SDL_Log("SDL EVENT: Window %" SDL_PRIu32 " got unknown event 0x%4.4x", @@ -1547,19 +1629,23 @@ static void SDLTest_PrintEvent(SDL_Event *event) } break; case SDL_KEYDOWN: - SDL_Log("SDL EVENT: Keyboard: key pressed in window %" SDL_PRIu32 ": scancode 0x%08X = %s, keycode 0x%08" SDL_PRIX32 " = %s", - event->key.windowID, - event->key.keysym.scancode, - SDL_GetScancodeName(event->key.keysym.scancode), - event->key.keysym.sym, SDL_GetKeyName(event->key.keysym.sym)); - break; - case SDL_KEYUP: - SDL_Log("SDL EVENT: Keyboard: key released in window %" SDL_PRIu32 ": scancode 0x%08X = %s, keycode 0x%08" SDL_PRIX32 " = %s", + case SDL_KEYUP: { + char modstr[64]; + if (event->key.keysym.mod) { + modstr[0] = '\0'; + SDLTest_PrintModState(modstr, sizeof (modstr), event->key.keysym.mod); + } else { + SDL_strlcpy(modstr, "NONE", sizeof (modstr)); + } + SDL_Log("SDL EVENT: Keyboard: key %s in window %" SDL_PRIu32 ": scancode 0x%08X = %s, keycode 0x%08" SDL_PRIX32 " = %s, mods = %s", + (event->type == SDL_KEYDOWN) ? "pressed" : "released", event->key.windowID, event->key.keysym.scancode, SDL_GetScancodeName(event->key.keysym.scancode), - event->key.keysym.sym, SDL_GetKeyName(event->key.keysym.sym)); + event->key.keysym.sym, SDL_GetKeyName(event->key.keysym.sym), + modstr); break; + } case SDL_TEXTEDITING: SDL_Log("SDL EVENT: Keyboard: text editing \"%s\" in window %" SDL_PRIu32, event->edit.text, event->edit.windowID); @@ -1756,7 +1842,7 @@ static void SDLTest_ScreenShot(SDL_Renderer *renderer) SDL_Rect viewport; SDL_Surface *surface; - if (renderer == NULL) { + if (!renderer) { return; } @@ -1768,7 +1854,7 @@ static void SDLTest_ScreenShot(SDL_Renderer *renderer) 0x000000FF, 0x0000FF00, 0x00FF0000, #endif 0x00000000); - if (surface == NULL) { + if (!surface) { SDL_Log("Couldn't create surface: %s\n", SDL_GetError()); return; } @@ -1792,7 +1878,7 @@ static void FullscreenTo(int index, int windowId) Uint32 flags; struct SDL_Rect rect = { 0, 0, 0, 0 }; SDL_Window *window = SDL_GetWindowFromID(windowId); - if (window == NULL) { + if (!window) { return; } @@ -2394,6 +2480,19 @@ void SDLTest_CommonDrawWindowInfo(SDL_Renderer *renderer, SDL_Window *window, in SDLTest_DrawString(renderer, 0, textY, text); textY += lineHeight; + /* Keyboard */ + + SDL_SetRenderDrawColor(renderer, 255, 255, 255, 255); + SDLTest_DrawString(renderer, 0, textY, "-- Keyboard --"); + textY += lineHeight; + + SDL_SetRenderDrawColor(renderer, 170, 170, 170, 255); + + (void)SDL_snprintf(text, sizeof(text), "SDL_GetModState: "); + SDLTest_PrintModState(text, sizeof(text), SDL_GetModState()); + SDLTest_DrawString(renderer, 0, textY, text); + textY += lineHeight; + if (usedHeight) { *usedHeight = textY; } diff --git a/thirdparty/SDL/src/test/SDL_test_compare.c b/thirdparty/SDL/src/test/SDL_test_compare.c index b84088026..ba532c7f3 100644 --- a/thirdparty/SDL/src/test/SDL_test_compare.c +++ b/thirdparty/SDL/src/test/SDL_test_compare.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -70,7 +70,7 @@ int SDLTest_CompareSurfaces(SDL_Surface *surface, SDL_Surface *referenceSurface, char referenceFilename[FILENAME_SIZE]; /* Validate input surfaces */ - if (surface == NULL || referenceSurface == NULL) { + if (!surface || !referenceSurface) { return -1; } diff --git a/thirdparty/SDL/src/test/SDL_test_crc32.c b/thirdparty/SDL/src/test/SDL_test_crc32.c index 453124b07..b13839b58 100644 --- a/thirdparty/SDL/src/test/SDL_test_crc32.c +++ b/thirdparty/SDL/src/test/SDL_test_crc32.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -36,7 +36,7 @@ int SDLTest_Crc32Init(SDLTest_Crc32Context *crcContext) CrcUint32 c; /* Sanity check context pointer */ - if (crcContext == NULL) { + if (!crcContext) { return -1; } @@ -90,7 +90,7 @@ int SDLTest_Crc32Calc(SDLTest_Crc32Context *crcContext, CrcUint8 *inBuf, CrcUint int SDLTest_Crc32CalcStart(SDLTest_Crc32Context *crcContext, CrcUint32 *crc32) { /* Sanity check pointers */ - if (crcContext == NULL) { + if (!crcContext) { *crc32 = 0; return -1; } @@ -108,7 +108,7 @@ int SDLTest_Crc32CalcStart(SDLTest_Crc32Context *crcContext, CrcUint32 *crc32) int SDLTest_Crc32CalcEnd(SDLTest_Crc32Context *crcContext, CrcUint32 *crc32) { /* Sanity check pointers */ - if (crcContext == NULL) { + if (!crcContext) { *crc32 = 0; return -1; } @@ -128,12 +128,12 @@ int SDLTest_Crc32CalcBuffer(SDLTest_Crc32Context *crcContext, CrcUint8 *inBuf, C CrcUint8 *p; register CrcUint32 crc; - if (crcContext == NULL) { + if (!crcContext) { *crc32 = 0; return -1; } - if (inBuf == NULL) { + if (!inBuf) { return -1; } @@ -155,7 +155,7 @@ int SDLTest_Crc32CalcBuffer(SDLTest_Crc32Context *crcContext, CrcUint8 *inBuf, C int SDLTest_Crc32Done(SDLTest_Crc32Context *crcContext) { - if (crcContext == NULL) { + if (!crcContext) { return -1; } diff --git a/thirdparty/SDL/src/test/SDL_test_font.c b/thirdparty/SDL/src/test/SDL_test_font.c index d3bdad6dd..ffa3dde82 100644 --- a/thirdparty/SDL/src/test/SDL_test_font.c +++ b/thirdparty/SDL/src/test/SDL_test_font.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -3166,14 +3166,14 @@ int SDLTest_DrawCharacter(SDL_Renderer *renderer, int x, int y, Uint32 c) ci = c; /* Search for this renderer's cache */ - for (cache = SDLTest_CharTextureCacheList; cache != NULL; cache = cache->next) { + for (cache = SDLTest_CharTextureCacheList; cache; cache = cache->next) { if (cache->renderer == renderer) { break; } } /* Allocate a new cache for this renderer if needed */ - if (cache == NULL) { + if (!cache) { cache = (struct SDLTest_CharTextureCache *)SDL_calloc(1, sizeof(struct SDLTest_CharTextureCache)); cache->renderer = renderer; cache->next = SDLTest_CharTextureCacheList; @@ -3190,7 +3190,7 @@ int SDLTest_DrawCharacter(SDL_Renderer *renderer, int x, int y, Uint32 c) character = SDL_CreateRGBSurface(SDL_SWSURFACE, charWidth, charHeight, 32, 0xFF000000, 0x00FF0000, 0x0000FF00, 0x000000FF); - if (character == NULL) { + if (!character) { return -1; } @@ -3358,7 +3358,7 @@ SDLTest_TextWindow *SDLTest_TextWindowCreate(int x, int y, int w, int h) { SDLTest_TextWindow *textwin = (SDLTest_TextWindow *)SDL_malloc(sizeof(*textwin)); - if (textwin == NULL) { + if (!textwin) { return NULL; } diff --git a/thirdparty/SDL/src/test/SDL_test_fuzzer.c b/thirdparty/SDL/src/test/SDL_test_fuzzer.c index 9e2e757e4..784eee2bf 100644 --- a/thirdparty/SDL/src/test/SDL_test_fuzzer.c +++ b/thirdparty/SDL/src/test/SDL_test_fuzzer.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -68,54 +68,54 @@ void SDLTest_FuzzerInit(Uint64 execKey) fuzzerInvocationCounter = 0; } -int SDLTest_GetFuzzerInvocationCount() +int SDLTest_GetFuzzerInvocationCount(void) { return fuzzerInvocationCounter; } -Uint8 SDLTest_RandomUint8() +Uint8 SDLTest_RandomUint8(void) { fuzzerInvocationCounter++; return (Uint8)SDLTest_RandomInt(&rndContext) & 0x000000FF; } -Sint8 SDLTest_RandomSint8() +Sint8 SDLTest_RandomSint8(void) { fuzzerInvocationCounter++; return (Sint8)SDLTest_RandomInt(&rndContext) & 0x000000FF; } -Uint16 SDLTest_RandomUint16() +Uint16 SDLTest_RandomUint16(void) { fuzzerInvocationCounter++; return (Uint16)SDLTest_RandomInt(&rndContext) & 0x0000FFFF; } -Sint16 SDLTest_RandomSint16() +Sint16 SDLTest_RandomSint16(void) { fuzzerInvocationCounter++; return (Sint16)SDLTest_RandomInt(&rndContext) & 0x0000FFFF; } -Sint32 SDLTest_RandomSint32() +Sint32 SDLTest_RandomSint32(void) { fuzzerInvocationCounter++; return (Sint32)SDLTest_RandomInt(&rndContext); } -Uint32 SDLTest_RandomUint32() +Uint32 SDLTest_RandomUint32(void) { fuzzerInvocationCounter++; return (Uint32)SDLTest_RandomInt(&rndContext); } -Uint64 SDLTest_RandomUint64() +Uint64 SDLTest_RandomUint64(void) { union { @@ -132,7 +132,7 @@ Uint64 SDLTest_RandomUint64() return value.v64; } -Sint64 SDLTest_RandomSint64() +Sint64 SDLTest_RandomSint64(void) { union { @@ -425,24 +425,24 @@ Sint64 SDLTest_RandomSint64BoundaryValue(Sint64 boundary1, Sint64 boundary2, SDL validDomain); } -float SDLTest_RandomUnitFloat() +float SDLTest_RandomUnitFloat(void) { return SDLTest_RandomUint32() / (float)UINT_MAX; } -float SDLTest_RandomFloat() +float SDLTest_RandomFloat(void) { return (float)(SDLTest_RandomUnitDouble() * 2.0 * (double)FLT_MAX - (double)(FLT_MAX)); } double -SDLTest_RandomUnitDouble() +SDLTest_RandomUnitDouble(void) { return (double)(SDLTest_RandomUint64() >> 11) * (1.0 / 9007199254740992.0); } double -SDLTest_RandomDouble() +SDLTest_RandomDouble(void) { double r = 0.0; double s = 1.0; @@ -456,7 +456,7 @@ SDLTest_RandomDouble() return r; } -char *SDLTest_RandomAsciiString() +char *SDLTest_RandomAsciiString(void) { return SDLTest_RandomAsciiStringWithMaximumLength(255); } @@ -488,7 +488,7 @@ char *SDLTest_RandomAsciiStringOfSize(int size) } string = (char *)SDL_malloc((size + 1) * sizeof(char)); - if (string == NULL) { + if (!string) { return NULL; } diff --git a/thirdparty/SDL/src/test/SDL_test_harness.c b/thirdparty/SDL/src/test/SDL_test_harness.c index 614151302..ac1cb09c5 100644 --- a/thirdparty/SDL/src/test/SDL_test_harness.c +++ b/thirdparty/SDL/src/test/SDL_test_harness.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -64,7 +64,7 @@ char *SDLTest_GenerateRunSeed(const int length) /* Allocate output buffer */ seed = (char *)SDL_malloc((length + 1) * sizeof(char)); - if (seed == NULL) { + if (!seed) { SDLTest_LogError("SDL_malloc for run seed output buffer failed."); SDL_Error(SDL_ENOMEM); return NULL; @@ -108,17 +108,17 @@ static Uint64 SDLTest_GenerateExecKey(const char *runSeed, const char *suiteName size_t entireStringLength; char *buffer; - if (runSeed == NULL || runSeed[0] == '\0') { + if (!runSeed || runSeed[0] == '\0') { SDLTest_LogError("Invalid runSeed string."); return -1; } - if (suiteName == NULL || suiteName[0] == '\0') { + if (!suiteName || suiteName[0] == '\0') { SDLTest_LogError("Invalid suiteName string."); return -1; } - if (testName == NULL || testName[0] == '\0') { + if (!testName || testName[0] == '\0') { SDLTest_LogError("Invalid testName string."); return -1; } @@ -139,7 +139,7 @@ static Uint64 SDLTest_GenerateExecKey(const char *runSeed, const char *suiteName iterationStringLength = SDL_strlen(iterationString); entireStringLength = runSeedLength + suiteNameLength + testNameLength + iterationStringLength + 1; buffer = (char *)SDL_malloc(entireStringLength); - if (buffer == NULL) { + if (!buffer) { SDLTest_LogError("Failed to allocate buffer for execKey generation."); SDL_Error(SDL_ENOMEM); return 0; @@ -171,7 +171,7 @@ static SDL_TimerID SDLTest_SetTestTimeout(int timeout, void(SDLCALL *callback)(v Uint32 timeoutInMilliseconds; SDL_TimerID timerID; - if (callback == NULL) { + if (!callback) { SDLTest_LogError("Timeout callback can't be NULL"); return -1; } @@ -229,7 +229,7 @@ static int SDLTest_RunTest(SDLTest_TestSuiteReference *testSuite, const SDLTest_ int testResult = 0; int fuzzerCount; - if (testSuite == NULL || testCase == NULL || testSuite->name == NULL || testCase->name == NULL) { + if (!testSuite || !testCase || !testSuite->name || !testCase->name) { SDLTest_LogError("Setup failure: testSuite or testCase references NULL"); return TEST_RESULT_SETUP_FAILURE; } @@ -339,7 +339,7 @@ static void SDLTest_LogTestSuiteSummary(SDLTest_TestSuiteReference *testSuites) #endif /* Gets a timer value in seconds */ -static float GetClock() +static float GetClock(void) { float currentClock = SDL_GetPerformanceCounter() / (float)SDL_GetPerformanceFrequency(); return currentClock; @@ -402,9 +402,9 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user } /* Generate run see if we don't have one already */ - if (userRunSeed == NULL || userRunSeed[0] == '\0') { + if (!userRunSeed || userRunSeed[0] == '\0') { char *tmp = SDLTest_GenerateRunSeed(16); - if (tmp == NULL) { + if (!tmp) { SDLTest_LogError("Generating a random seed failed"); return 2; } @@ -445,20 +445,20 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user /* Pre-allocate an array for tracking failed tests (potentially all test cases) */ failedTests = (const SDLTest_TestCaseReference **)SDL_malloc(totalNumberOfTests * sizeof(SDLTest_TestCaseReference *)); - if (failedTests == NULL) { + if (!failedTests) { SDLTest_LogError("Unable to allocate cache for failed tests"); SDL_Error(SDL_ENOMEM); return -1; } /* Initialize filtering */ - if (filter != NULL && filter[0] != '\0') { + if (filter && filter[0] != '\0') { /* Loop over all suites to check if we have a filter match */ suiteCounter = 0; while (testSuites[suiteCounter] && suiteFilter == 0) { testSuite = testSuites[suiteCounter]; suiteCounter++; - if (testSuite->name != NULL && SDL_strcasecmp(filter, testSuite->name) == 0) { + if (testSuite->name && SDL_strcasecmp(filter, testSuite->name) == 0) { /* Matched a suite name */ suiteFilter = 1; suiteFilterName = testSuite->name; @@ -471,7 +471,7 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user while (testSuite->testCases[testCounter] && testFilter == 0) { testCase = testSuite->testCases[testCounter]; testCounter++; - if (testCase->name != NULL && SDL_strcasecmp(filter, testCase->name) == 0) { + if (testCase->name && SDL_strcasecmp(filter, testCase->name) == 0) { /* Matched a test name */ suiteFilter = 1; suiteFilterName = testSuite->name; @@ -487,14 +487,14 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user SDLTest_LogError("Filter '%s' did not match any test suite/case.", filter); for (suiteCounter = 0; testSuites[suiteCounter]; ++suiteCounter) { testSuite = testSuites[suiteCounter]; - if (testSuite->name != NULL) { + if (testSuite->name) { SDLTest_Log("Test suite: %s", testSuite->name); } /* Within each suite, loop over all test cases to check if we have a filter match */ for (testCounter = 0; testSuite->testCases[testCounter]; ++testCounter) { testCase = testSuite->testCases[testCounter]; - SDLTest_Log(" test: %s", testCase->name); + SDLTest_Log(" test: %s%s", testCase->name, testCase->enabled ? "" : " (disabled)"); } } SDLTest_Log("Exit code: 2"); @@ -511,7 +511,7 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user suiteCounter++; /* Filter suite if flag set and we have a name */ - if (suiteFilter == 1 && suiteFilterName != NULL && testSuite->name != NULL && + if (suiteFilter == 1 && suiteFilterName && testSuite->name && SDL_strcasecmp(suiteFilterName, testSuite->name) != 0) { /* Skip suite */ SDLTest_Log("===== Test Suite %i: '%s' skipped\n", @@ -540,7 +540,7 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user testCounter++; /* Filter tests if flag set and we have a name */ - if (testFilter == 1 && testFilterName != NULL && testCase->name != NULL && + if (testFilter == 1 && testFilterName && testCase->name && SDL_strcasecmp(testFilterName, testCase->name) != 0) { /* Skip test */ SDLTest_Log("===== Test Case %i.%i: '%s' skipped\n", @@ -562,7 +562,7 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user suiteCounter, testCounter, currentTestName); - if (testCase->description != NULL && testCase->description[0] != '\0') { + if (testCase->description && testCase->description[0] != '\0') { SDLTest_Log("Test Description: '%s'", (testCase->description) ? testCase->description : SDLTEST_INVALID_NAME_FORMAT); } diff --git a/thirdparty/SDL/src/test/SDL_test_imageBlit.c b/thirdparty/SDL/src/test/SDL_test_imageBlit.c index 0a086708c..82cfb029e 100644 --- a/thirdparty/SDL/src/test/SDL_test_imageBlit.c +++ b/thirdparty/SDL/src/test/SDL_test_imageBlit.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -540,26 +540,15 @@ static const SDLTest_SurfaceImage_t SDLTest_imageBlit = { /** * \brief Returns the Blit test image as SDL_Surface. */ -SDL_Surface *SDLTest_ImageBlit() +SDL_Surface *SDLTest_ImageBlit(void) { - SDL_Surface *surface = SDL_CreateRGBSurfaceFrom( + SDL_Surface *surface = SDL_CreateRGBSurfaceWithFormatFrom( (void *)SDLTest_imageBlit.pixel_data, SDLTest_imageBlit.width, SDLTest_imageBlit.height, SDLTest_imageBlit.bytes_per_pixel * 8, SDLTest_imageBlit.width * SDLTest_imageBlit.bytes_per_pixel, -#if (SDL_BYTEORDER == SDL_BIG_ENDIAN) - 0xff000000, /* Red bit mask. */ - 0x00ff0000, /* Green bit mask. */ - 0x0000ff00, /* Blue bit mask. */ - 0x000000ff /* Alpha bit mask. */ -#else - 0x000000ff, /* Red bit mask. */ - 0x0000ff00, /* Green bit mask. */ - 0x00ff0000, /* Blue bit mask. */ - 0xff000000 /* Alpha bit mask. */ -#endif - ); + SDL_PIXELFORMAT_RGB24); return surface; } @@ -1025,26 +1014,15 @@ static const SDLTest_SurfaceImage_t SDLTest_imageBlitColor = { /** * \brief Returns the BlitColor test image as SDL_Surface. */ -SDL_Surface *SDLTest_ImageBlitColor() +SDL_Surface *SDLTest_ImageBlitColor(void) { - SDL_Surface *surface = SDL_CreateRGBSurfaceFrom( + SDL_Surface *surface = SDL_CreateRGBSurfaceWithFormatFrom( (void *)SDLTest_imageBlitColor.pixel_data, SDLTest_imageBlitColor.width, SDLTest_imageBlitColor.height, SDLTest_imageBlitColor.bytes_per_pixel * 8, SDLTest_imageBlitColor.width * SDLTest_imageBlitColor.bytes_per_pixel, -#if (SDL_BYTEORDER == SDL_BIG_ENDIAN) - 0xff000000, /* Red bit mask. */ - 0x00ff0000, /* Green bit mask. */ - 0x0000ff00, /* Blue bit mask. */ - 0x000000ff /* Alpha bit mask. */ -#else - 0x000000ff, /* Red bit mask. */ - 0x0000ff00, /* Green bit mask. */ - 0x00ff0000, /* Blue bit mask. */ - 0xff000000 /* Alpha bit mask. */ -#endif - ); + SDL_PIXELFORMAT_RGB24); return surface; } @@ -1673,26 +1651,15 @@ static const SDLTest_SurfaceImage_t SDLTest_imageBlitAlpha = { /** * \brief Returns the BlitAlpha test image as SDL_Surface. */ -SDL_Surface *SDLTest_ImageBlitAlpha() +SDL_Surface *SDLTest_ImageBlitAlpha(void) { - SDL_Surface *surface = SDL_CreateRGBSurfaceFrom( + SDL_Surface *surface = SDL_CreateRGBSurfaceWithFormatFrom( (void *)SDLTest_imageBlitAlpha.pixel_data, SDLTest_imageBlitAlpha.width, SDLTest_imageBlitAlpha.height, SDLTest_imageBlitAlpha.bytes_per_pixel * 8, SDLTest_imageBlitAlpha.width * SDLTest_imageBlitAlpha.bytes_per_pixel, -#if (SDL_BYTEORDER == SDL_BIG_ENDIAN) - 0xff000000, /* Red bit mask. */ - 0x00ff0000, /* Green bit mask. */ - 0x0000ff00, /* Blue bit mask. */ - 0x000000ff /* Alpha bit mask. */ -#else - 0x000000ff, /* Red bit mask. */ - 0x0000ff00, /* Green bit mask. */ - 0x00ff0000, /* Blue bit mask. */ - 0xff000000 /* Alpha bit mask. */ -#endif - ); + SDL_PIXELFORMAT_RGB24); return surface; } diff --git a/thirdparty/SDL/src/test/SDL_test_imageBlitBlend.c b/thirdparty/SDL/src/test/SDL_test_imageBlitBlend.c index b0e7e4ae0..4fa09deb1 100644 --- a/thirdparty/SDL/src/test/SDL_test_imageBlitBlend.c +++ b/thirdparty/SDL/src/test/SDL_test_imageBlitBlend.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -580,26 +580,15 @@ static const SDLTest_SurfaceImage_t SDLTest_imageBlitBlendAdd = { /** * \brief Returns the BlitBlendAdd test image as SDL_Surface. */ -SDL_Surface *SDLTest_ImageBlitBlendAdd() +SDL_Surface *SDLTest_ImageBlitBlendAdd(void) { - SDL_Surface *surface = SDL_CreateRGBSurfaceFrom( + SDL_Surface *surface = SDL_CreateRGBSurfaceWithFormatFrom( (void *)SDLTest_imageBlitBlendAdd.pixel_data, SDLTest_imageBlitBlendAdd.width, SDLTest_imageBlitBlendAdd.height, SDLTest_imageBlitBlendAdd.bytes_per_pixel * 8, SDLTest_imageBlitBlendAdd.width * SDLTest_imageBlitBlendAdd.bytes_per_pixel, -#if (SDL_BYTEORDER == SDL_BIG_ENDIAN) - 0xff000000, /* Red bit mask. */ - 0x00ff0000, /* Green bit mask. */ - 0x0000ff00, /* Blue bit mask. */ - 0x000000ff /* Alpha bit mask. */ -#else - 0x000000ff, /* Red bit mask. */ - 0x0000ff00, /* Green bit mask. */ - 0x00ff0000, /* Blue bit mask. */ - 0xff000000 /* Alpha bit mask. */ -#endif - ); + SDL_PIXELFORMAT_RGB24); return surface; } @@ -1182,26 +1171,15 @@ static const SDLTest_SurfaceImage_t SDLTest_imageBlitBlend = { /** * \brief Returns the BlitBlend test image as SDL_Surface. */ -SDL_Surface *SDLTest_ImageBlitBlend() +SDL_Surface *SDLTest_ImageBlitBlend(void) { - SDL_Surface *surface = SDL_CreateRGBSurfaceFrom( + SDL_Surface *surface = SDL_CreateRGBSurfaceWithFormatFrom( (void *)SDLTest_imageBlitBlend.pixel_data, SDLTest_imageBlitBlend.width, SDLTest_imageBlitBlend.height, SDLTest_imageBlitBlend.bytes_per_pixel * 8, SDLTest_imageBlitBlend.width * SDLTest_imageBlitBlend.bytes_per_pixel, -#if (SDL_BYTEORDER == SDL_BIG_ENDIAN) - 0xff000000, /* Red bit mask. */ - 0x00ff0000, /* Green bit mask. */ - 0x0000ff00, /* Blue bit mask. */ - 0x000000ff /* Alpha bit mask. */ -#else - 0x000000ff, /* Red bit mask. */ - 0x0000ff00, /* Green bit mask. */ - 0x00ff0000, /* Blue bit mask. */ - 0xff000000 /* Alpha bit mask. */ -#endif - ); + SDL_PIXELFORMAT_RGB24); return surface; } @@ -1614,26 +1592,15 @@ static const SDLTest_SurfaceImage_t SDLTest_imageBlitBlendMod = { /** * \brief Returns the BlitBlendMod test image as SDL_Surface. */ -SDL_Surface *SDLTest_ImageBlitBlendMod() +SDL_Surface *SDLTest_ImageBlitBlendMod(void) { - SDL_Surface *surface = SDL_CreateRGBSurfaceFrom( + SDL_Surface *surface = SDL_CreateRGBSurfaceWithFormatFrom( (void *)SDLTest_imageBlitBlendMod.pixel_data, SDLTest_imageBlitBlendMod.width, SDLTest_imageBlitBlendMod.height, SDLTest_imageBlitBlendMod.bytes_per_pixel * 8, SDLTest_imageBlitBlendMod.width * SDLTest_imageBlitBlendMod.bytes_per_pixel, -#if (SDL_BYTEORDER == SDL_BIG_ENDIAN) - 0xff000000, /* Red bit mask. */ - 0x00ff0000, /* Green bit mask. */ - 0x0000ff00, /* Blue bit mask. */ - 0x000000ff /* Alpha bit mask. */ -#else - 0x000000ff, /* Red bit mask. */ - 0x0000ff00, /* Green bit mask. */ - 0x00ff0000, /* Blue bit mask. */ - 0xff000000 /* Alpha bit mask. */ -#endif - ); + SDL_PIXELFORMAT_RGB24); return surface; } @@ -2429,26 +2396,15 @@ static const SDLTest_SurfaceImage_t SDLTest_imageBlitBlendNone = { /** * \brief Returns the BlitBlendNone test image as SDL_Surface. */ -SDL_Surface *SDLTest_ImageBlitBlendNone() +SDL_Surface *SDLTest_ImageBlitBlendNone(void) { - SDL_Surface *surface = SDL_CreateRGBSurfaceFrom( + SDL_Surface *surface = SDL_CreateRGBSurfaceWithFormatFrom( (void *)SDLTest_imageBlitBlendNone.pixel_data, SDLTest_imageBlitBlendNone.width, SDLTest_imageBlitBlendNone.height, SDLTest_imageBlitBlendNone.bytes_per_pixel * 8, SDLTest_imageBlitBlendNone.width * SDLTest_imageBlitBlendNone.bytes_per_pixel, -#if (SDL_BYTEORDER == SDL_BIG_ENDIAN) - 0xff000000, /* Red bit mask. */ - 0x00ff0000, /* Green bit mask. */ - 0x0000ff00, /* Blue bit mask. */ - 0x000000ff /* Alpha bit mask. */ -#else - 0x000000ff, /* Red bit mask. */ - 0x0000ff00, /* Green bit mask. */ - 0x00ff0000, /* Blue bit mask. */ - 0xff000000 /* Alpha bit mask. */ -#endif - ); + SDL_PIXELFORMAT_RGB24); return surface; } @@ -2976,26 +2932,15 @@ static const SDLTest_SurfaceImage_t SDLTest_imageBlitBlendAll = { /** * \brief Returns the BlitBlendAll test image as SDL_Surface. */ -SDL_Surface *SDLTest_ImageBlitBlendAll() +SDL_Surface *SDLTest_ImageBlitBlendAll(void) { - SDL_Surface *surface = SDL_CreateRGBSurfaceFrom( + SDL_Surface *surface = SDL_CreateRGBSurfaceWithFormatFrom( (void *)SDLTest_imageBlitBlendAll.pixel_data, SDLTest_imageBlitBlendAll.width, SDLTest_imageBlitBlendAll.height, SDLTest_imageBlitBlendAll.bytes_per_pixel * 8, SDLTest_imageBlitBlendAll.width * SDLTest_imageBlitBlendAll.bytes_per_pixel, -#if (SDL_BYTEORDER == SDL_BIG_ENDIAN) - 0xff000000, /* Red bit mask. */ - 0x00ff0000, /* Green bit mask. */ - 0x0000ff00, /* Blue bit mask. */ - 0x000000ff /* Alpha bit mask. */ -#else - 0x000000ff, /* Red bit mask. */ - 0x0000ff00, /* Green bit mask. */ - 0x00ff0000, /* Blue bit mask. */ - 0xff000000 /* Alpha bit mask. */ -#endif - ); + SDL_PIXELFORMAT_RGB24); return surface; } diff --git a/thirdparty/SDL/src/test/SDL_test_imageFace.c b/thirdparty/SDL/src/test/SDL_test_imageFace.c index 0a95e7c87..b9c6bfa16 100644 --- a/thirdparty/SDL/src/test/SDL_test_imageFace.c +++ b/thirdparty/SDL/src/test/SDL_test_imageFace.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -223,26 +223,15 @@ static const SDLTest_SurfaceImage_t SDLTest_imageFace = { /** * \brief Returns the Face test image as SDL_Surface. */ -SDL_Surface *SDLTest_ImageFace() +SDL_Surface *SDLTest_ImageFace(void) { - SDL_Surface *surface = SDL_CreateRGBSurfaceFrom( + SDL_Surface *surface = SDL_CreateRGBSurfaceWithFormatFrom( (void *)SDLTest_imageFace.pixel_data, SDLTest_imageFace.width, SDLTest_imageFace.height, SDLTest_imageFace.bytes_per_pixel * 8, SDLTest_imageFace.width * SDLTest_imageFace.bytes_per_pixel, -#if (SDL_BYTEORDER == SDL_BIG_ENDIAN) - 0xff000000, /* Red bit mask. */ - 0x00ff0000, /* Green bit mask. */ - 0x0000ff00, /* Blue bit mask. */ - 0x000000ff /* Alpha bit mask. */ -#else - 0x000000ff, /* Red bit mask. */ - 0x0000ff00, /* Green bit mask. */ - 0x00ff0000, /* Blue bit mask. */ - 0xff000000 /* Alpha bit mask. */ -#endif - ); + SDL_PIXELFORMAT_RGBA32); return surface; } diff --git a/thirdparty/SDL/src/test/SDL_test_imagePrimitives.c b/thirdparty/SDL/src/test/SDL_test_imagePrimitives.c index 416eb998b..6d26ff71f 100644 --- a/thirdparty/SDL/src/test/SDL_test_imagePrimitives.c +++ b/thirdparty/SDL/src/test/SDL_test_imagePrimitives.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -504,26 +504,15 @@ static const SDLTest_SurfaceImage_t SDLTest_imagePrimitives = { /** * \brief Returns the Primitives test image as SDL_Surface. */ -SDL_Surface *SDLTest_ImagePrimitives() +SDL_Surface *SDLTest_ImagePrimitives(void) { - SDL_Surface *surface = SDL_CreateRGBSurfaceFrom( + SDL_Surface *surface = SDL_CreateRGBSurfaceWithFormatFrom( (void *)SDLTest_imagePrimitives.pixel_data, SDLTest_imagePrimitives.width, SDLTest_imagePrimitives.height, SDLTest_imagePrimitives.bytes_per_pixel * 8, SDLTest_imagePrimitives.width * SDLTest_imagePrimitives.bytes_per_pixel, -#if (SDL_BYTEORDER == SDL_BIG_ENDIAN) - 0xff000000, /* Red bit mask. */ - 0x00ff0000, /* Green bit mask. */ - 0x0000ff00, /* Blue bit mask. */ - 0x000000ff /* Alpha bit mask. */ -#else - 0x000000ff, /* Red bit mask. */ - 0x0000ff00, /* Green bit mask. */ - 0x00ff0000, /* Blue bit mask. */ - 0xff000000 /* Alpha bit mask. */ -#endif - ); + SDL_PIXELFORMAT_RGB24); return surface; } diff --git a/thirdparty/SDL/src/test/SDL_test_imagePrimitivesBlend.c b/thirdparty/SDL/src/test/SDL_test_imagePrimitivesBlend.c index fe65bdc54..659ae2574 100644 --- a/thirdparty/SDL/src/test/SDL_test_imagePrimitivesBlend.c +++ b/thirdparty/SDL/src/test/SDL_test_imagePrimitivesBlend.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -677,26 +677,15 @@ static const SDLTest_SurfaceImage_t SDLTest_imagePrimitivesBlend = { /** * \brief Returns the PrimitivesBlend test image as SDL_Surface. */ -SDL_Surface *SDLTest_ImagePrimitivesBlend() +SDL_Surface *SDLTest_ImagePrimitivesBlend(void) { - SDL_Surface *surface = SDL_CreateRGBSurfaceFrom( + SDL_Surface *surface = SDL_CreateRGBSurfaceWithFormatFrom( (void *)SDLTest_imagePrimitivesBlend.pixel_data, SDLTest_imagePrimitivesBlend.width, SDLTest_imagePrimitivesBlend.height, SDLTest_imagePrimitivesBlend.bytes_per_pixel * 8, SDLTest_imagePrimitivesBlend.width * SDLTest_imagePrimitivesBlend.bytes_per_pixel, -#if (SDL_BYTEORDER == SDL_BIG_ENDIAN) - 0xff000000, /* Red bit mask. */ - 0x00ff0000, /* Green bit mask. */ - 0x0000ff00, /* Blue bit mask. */ - 0x000000ff /* Alpha bit mask. */ -#else - 0x000000ff, /* Red bit mask. */ - 0x0000ff00, /* Green bit mask. */ - 0x00ff0000, /* Blue bit mask. */ - 0xff000000 /* Alpha bit mask. */ -#endif - ); + SDL_PIXELFORMAT_RGB24); return surface; } diff --git a/thirdparty/SDL/src/test/SDL_test_log.c b/thirdparty/SDL/src/test/SDL_test_log.c index d69e3da2c..714d307a7 100644 --- a/thirdparty/SDL/src/test/SDL_test_log.c +++ b/thirdparty/SDL/src/test/SDL_test_log.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/test/SDL_test_md5.c b/thirdparty/SDL/src/test/SDL_test_md5.c index 8e8cd490c..83f6f9ce9 100644 --- a/thirdparty/SDL/src/test/SDL_test_md5.c +++ b/thirdparty/SDL/src/test/SDL_test_md5.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -113,7 +113,7 @@ static unsigned char MD5PADDING[64] = { void SDLTest_Md5Init(SDLTest_Md5Context *mdContext) { - if (mdContext == NULL) { + if (!mdContext) { return; } @@ -141,10 +141,10 @@ void SDLTest_Md5Update(SDLTest_Md5Context *mdContext, unsigned char *inBuf, int mdi; unsigned int i, ii; - if (mdContext == NULL) { + if (!mdContext) { return; } - if (inBuf == NULL || inLen < 1) { + if (!inBuf || inLen < 1) { return; } @@ -193,7 +193,7 @@ void SDLTest_Md5Final(SDLTest_Md5Context *mdContext) unsigned int i, ii; unsigned int padLen; - if (mdContext == NULL) { + if (!mdContext) { return; } diff --git a/thirdparty/SDL/src/test/SDL_test_memory.c b/thirdparty/SDL/src/test/SDL_test_memory.c index bb773a6bc..e998094a7 100644 --- a/thirdparty/SDL/src/test/SDL_test_memory.c +++ b/thirdparty/SDL/src/test/SDL_test_memory.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -84,7 +84,7 @@ static void SDL_TrackAllocation(void *mem, size_t size) return; } entry = (SDL_tracked_allocation *)SDL_malloc_orig(sizeof(*entry)); - if (entry == NULL) { + if (!entry) { return; } entry->mem = mem; @@ -184,7 +184,7 @@ static void *SDLCALL SDLTest_TrackedRealloc(void *ptr, size_t size) static void SDLCALL SDLTest_TrackedFree(void *ptr) { - if (ptr == NULL) { + if (!ptr) { return; } @@ -195,7 +195,7 @@ static void SDLCALL SDLTest_TrackedFree(void *ptr) SDL_free_orig(ptr); } -int SDLTest_TrackAllocations() +int SDLTest_TrackAllocations(void) { if (SDL_malloc_orig) { return 0; @@ -220,7 +220,7 @@ int SDLTest_TrackAllocations() return 0; } -void SDLTest_LogAllocations() +void SDLTest_LogAllocations(void) { char *message = NULL; size_t message_size = 0; diff --git a/thirdparty/SDL/src/test/SDL_test_random.c b/thirdparty/SDL/src/test/SDL_test_random.c index ab3fec54c..0d7ef4ed3 100644 --- a/thirdparty/SDL/src/test/SDL_test_random.c +++ b/thirdparty/SDL/src/test/SDL_test_random.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -40,7 +40,7 @@ void SDLTest_RandomInit(SDLTest_RandomContext *rndContext, unsigned int xi, unsigned int ci) { - if (rndContext == NULL) { + if (!rndContext) { return; } @@ -68,7 +68,7 @@ void SDLTest_RandomInitTime(SDLTest_RandomContext *rndContext) { int a, b; - if (rndContext == NULL) { + if (!rndContext) { return; } @@ -85,7 +85,7 @@ unsigned int SDLTest_Random(SDLTest_RandomContext *rndContext) { unsigned int xh, xl; - if (rndContext == NULL) { + if (!rndContext) { return -1; } diff --git a/thirdparty/SDL/src/thread/SDL_systhread.h b/thirdparty/SDL/src/thread/SDL_systhread.h index bee256763..28c9d407d 100644 --- a/thirdparty/SDL/src/thread/SDL_systhread.h +++ b/thirdparty/SDL/src/thread/SDL_systhread.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -59,12 +59,18 @@ extern void SDL_SYS_WaitThread(SDL_Thread *thread); /* Mark thread as cleaned up as soon as it exits, without joining. */ extern void SDL_SYS_DetachThread(SDL_Thread *thread); +/* Initialize the global TLS data */ +extern void SDL_SYS_InitTLSData(void); + /* Get the thread local storage for this thread */ extern SDL_TLSData *SDL_SYS_GetTLSData(void); /* Set the thread local storage for this thread */ extern int SDL_SYS_SetTLSData(SDL_TLSData *data); +/* Quit the global TLS data */ +extern void SDL_SYS_QuitTLSData(void); + /* This is for internal SDL use, so we don't need #ifdefs everywhere. */ extern SDL_Thread * SDL_CreateThreadInternal(int(SDLCALL *fn)(void *), const char *name, diff --git a/thirdparty/SDL/src/thread/SDL_thread.c b/thirdparty/SDL/src/thread/SDL_thread.c index aa8e2b188..c1f4f2fc4 100644 --- a/thirdparty/SDL/src/thread/SDL_thread.c +++ b/thirdparty/SDL/src/thread/SDL_thread.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -28,7 +28,16 @@ #include "SDL_hints.h" #include "../SDL_error_c.h" -SDL_TLSID SDL_TLSCreate() +/* The storage is local to the thread, but the IDs are global for the process */ + +static SDL_atomic_t SDL_tls_allocated; + +void SDL_InitTLSData(void) +{ + SDL_SYS_InitTLSData(); +} + +SDL_TLSID SDL_TLSCreate(void) { static SDL_atomic_t SDL_tls_id; return SDL_AtomicIncRef(&SDL_tls_id) + 1; @@ -39,7 +48,7 @@ void *SDL_TLSGet(SDL_TLSID id) SDL_TLSData *storage; storage = SDL_SYS_GetTLSData(); - if (storage == NULL || id == 0 || id > storage->limit) { + if (!storage || id == 0 || id > storage->limit) { return NULL; } return storage->array[id - 1].data; @@ -53,14 +62,21 @@ int SDL_TLSSet(SDL_TLSID id, const void *value, void(SDLCALL *destructor)(void * return SDL_InvalidParamError("id"); } + /* Make sure TLS is initialized. + * There's a race condition here if you are calling this from non-SDL threads + * and haven't called SDL_Init() on your main thread, but such is life. + */ + SDL_InitTLSData(); + + /* Get the storage for the current thread */ storage = SDL_SYS_GetTLSData(); - if (storage == NULL || (id > storage->limit)) { + if (!storage || (id > storage->limit)) { unsigned int i, oldlimit, newlimit; oldlimit = storage ? storage->limit : 0; newlimit = (id + TLS_ALLOC_CHUNKSIZE); storage = (SDL_TLSData *)SDL_realloc(storage, sizeof(*storage) + (newlimit - 1) * sizeof(storage->array[0])); - if (storage == NULL) { + if (!storage) { return SDL_OutOfMemory(); } storage->limit = newlimit; @@ -69,8 +85,10 @@ int SDL_TLSSet(SDL_TLSID id, const void *value, void(SDLCALL *destructor)(void * storage->array[i].destructor = NULL; } if (SDL_SYS_SetTLSData(storage) != 0) { + SDL_free(storage); return -1; } + SDL_AtomicIncRef(&SDL_tls_allocated); } storage->array[id - 1].data = SDL_const_cast(void *, value); @@ -78,10 +96,11 @@ int SDL_TLSSet(SDL_TLSID id, const void *value, void(SDLCALL *destructor)(void * return 0; } -void SDL_TLSCleanup() +void SDL_TLSCleanup(void) { SDL_TLSData *storage; + /* Cleanup the storage for the current thread */ storage = SDL_SYS_GetTLSData(); if (storage) { unsigned int i; @@ -92,6 +111,18 @@ void SDL_TLSCleanup() } SDL_SYS_SetTLSData(NULL); SDL_free(storage); + (void)SDL_AtomicDecRef(&SDL_tls_allocated); + } +} + +void SDL_QuitTLSData(void) +{ + SDL_TLSCleanup(); + + if (SDL_AtomicGet(&SDL_tls_allocated) == 0) { + SDL_SYS_QuitTLSData(); + } else { + /* Some thread hasn't called SDL_CleanupTLS() */ } } @@ -113,40 +144,27 @@ typedef struct SDL_TLSEntry static SDL_mutex *SDL_generic_TLS_mutex; static SDL_TLSEntry *SDL_generic_TLS; +void SDL_Generic_InitTLSData(void) +{ + if (!SDL_generic_TLS_mutex) { + SDL_generic_TLS_mutex = SDL_CreateMutex(); + } +} + SDL_TLSData *SDL_Generic_GetTLSData(void) { SDL_threadID thread = SDL_ThreadID(); SDL_TLSEntry *entry; SDL_TLSData *storage = NULL; -#if !SDL_THREADS_DISABLED - if (SDL_generic_TLS_mutex == NULL) { - static SDL_SpinLock tls_lock; - SDL_AtomicLock(&tls_lock); - if (SDL_generic_TLS_mutex == NULL) { - SDL_mutex *mutex = SDL_CreateMutex(); - SDL_MemoryBarrierRelease(); - SDL_generic_TLS_mutex = mutex; - if (SDL_generic_TLS_mutex == NULL) { - SDL_AtomicUnlock(&tls_lock); - return NULL; - } - } - SDL_AtomicUnlock(&tls_lock); - } - SDL_MemoryBarrierAcquire(); SDL_LockMutex(SDL_generic_TLS_mutex); -#endif /* SDL_THREADS_DISABLED */ - for (entry = SDL_generic_TLS; entry; entry = entry->next) { if (entry->thread == thread) { storage = entry->storage; break; } } -#if !SDL_THREADS_DISABLED SDL_UnlockMutex(SDL_generic_TLS_mutex); -#endif return storage; } @@ -155,16 +173,16 @@ int SDL_Generic_SetTLSData(SDL_TLSData *data) { SDL_threadID thread = SDL_ThreadID(); SDL_TLSEntry *prev, *entry; + int retval = 0; - /* SDL_Generic_GetTLSData() is always called first, so we can assume SDL_generic_TLS_mutex */ SDL_LockMutex(SDL_generic_TLS_mutex); prev = NULL; for (entry = SDL_generic_TLS; entry; entry = entry->next) { if (entry->thread == thread) { - if (data != NULL) { + if (data) { entry->storage = data; } else { - if (prev != NULL) { + if (prev) { prev->next = entry->next; } else { SDL_generic_TLS = entry->next; @@ -175,25 +193,48 @@ int SDL_Generic_SetTLSData(SDL_TLSData *data) } prev = entry; } - if (entry == NULL) { + if (!entry && data) { entry = (SDL_TLSEntry *)SDL_malloc(sizeof(*entry)); if (entry) { entry->thread = thread; entry->storage = data; entry->next = SDL_generic_TLS; SDL_generic_TLS = entry; + } else { + retval = SDL_OutOfMemory(); } } SDL_UnlockMutex(SDL_generic_TLS_mutex); - if (entry == NULL) { - return SDL_OutOfMemory(); + return retval; +} + +void SDL_Generic_QuitTLSData(void) +{ + SDL_TLSEntry *entry; + + /* This should have been cleaned up by the time we get here */ + SDL_assert(!SDL_generic_TLS); + if (SDL_generic_TLS) { + SDL_LockMutex(SDL_generic_TLS_mutex); + for (entry = SDL_generic_TLS; entry; ) { + SDL_TLSEntry *next = entry->next; + SDL_free(entry->storage); + SDL_free(entry); + entry = next; + } + SDL_generic_TLS = NULL; + SDL_UnlockMutex(SDL_generic_TLS_mutex); + } + + if (SDL_generic_TLS_mutex) { + SDL_DestroyMutex(SDL_generic_TLS_mutex); + SDL_generic_TLS_mutex = NULL; } - return 0; } /* Non-thread-safe global error variable */ -static SDL_error *SDL_GetStaticErrBuf() +static SDL_error *SDL_GetStaticErrBuf(void) { static SDL_error SDL_global_error; static char SDL_global_error_str[128]; @@ -202,7 +243,7 @@ static SDL_error *SDL_GetStaticErrBuf() return &SDL_global_error; } -#if !SDL_THREADS_DISABLED +#ifndef SDL_THREADS_DISABLED static void SDLCALL SDL_FreeErrBuf(void *data) { SDL_error *errbuf = (SDL_error *)data; @@ -217,7 +258,7 @@ static void SDLCALL SDL_FreeErrBuf(void *data) /* Routine to get the thread-specific error variable */ SDL_error *SDL_GetErrBuf(void) { -#if SDL_THREADS_DISABLED +#ifdef SDL_THREADS_DISABLED return SDL_GetStaticErrBuf(); #else static SDL_SpinLock tls_lock; @@ -251,7 +292,7 @@ SDL_error *SDL_GetErrBuf(void) if (errbuf == ALLOCATION_IN_PROGRESS) { return SDL_GetStaticErrBuf(); } - if (errbuf == NULL) { + if (!errbuf) { /* Get the original memory functions for this allocation because the lifetime * of the error buffer may span calls to SDL_SetMemoryFunctions() by the app */ @@ -262,7 +303,7 @@ SDL_error *SDL_GetErrBuf(void) /* Mark that we're in the middle of allocating our buffer */ SDL_TLSSet(tls_errbuf, ALLOCATION_IN_PROGRESS, NULL); errbuf = (SDL_error *)realloc_func(NULL, sizeof(*errbuf)); - if (errbuf == NULL) { + if (!errbuf) { SDL_TLSSet(tls_errbuf, NULL, NULL); return SDL_GetStaticErrBuf(); } @@ -328,9 +369,11 @@ SDL_Thread *SDL_CreateThreadWithStackSize(int(SDLCALL *fn)(void *), SDL_Thread *thread; int ret; + SDL_InitMainThread(); + /* Allocate memory for the thread info structure */ thread = (SDL_Thread *)SDL_calloc(1, sizeof(*thread)); - if (thread == NULL) { + if (!thread) { SDL_OutOfMemory(); return NULL; } @@ -338,9 +381,9 @@ SDL_Thread *SDL_CreateThreadWithStackSize(int(SDLCALL *fn)(void *), SDL_AtomicSet(&thread->state, SDL_THREAD_STATE_ALIVE); /* Set up the arguments for the thread */ - if (name != NULL) { + if (name) { thread->name = SDL_strdup(name); - if (thread->name == NULL) { + if (!thread->name) { SDL_OutOfMemory(); SDL_free(thread); return NULL; @@ -383,7 +426,7 @@ DECLSPEC SDL_Thread *SDLCALL SDL_CreateThread(int(SDLCALL *fn)(void *), size_t stacksize = 0; /* If the SDL_HINT_THREAD_STACK_SIZE exists, use it */ - if (stackhint != NULL) { + if (stackhint) { char *endp = NULL; const Sint64 hintval = SDL_strtoll(stackhint, &endp, 10); if ((*stackhint != '\0') && (*endp == '\0')) { /* a valid number? */ @@ -452,7 +495,7 @@ void SDL_WaitThread(SDL_Thread *thread, int *status) void SDL_DetachThread(SDL_Thread *thread) { - if (thread == NULL) { + if (!thread) { return; } diff --git a/thirdparty/SDL/src/thread/SDL_thread_c.h b/thirdparty/SDL/src/thread/SDL_thread_c.h index 278a68026..619edd981 100644 --- a/thirdparty/SDL/src/thread/SDL_thread_c.h +++ b/thirdparty/SDL/src/thread/SDL_thread_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -26,25 +26,25 @@ #include "SDL_thread.h" /* Need the definitions of SYS_ThreadHandle */ -#if SDL_THREADS_DISABLED +#ifdef SDL_THREADS_DISABLED #include "generic/SDL_systhread_c.h" -#elif SDL_THREAD_PTHREAD +#elif defined(SDL_THREAD_PTHREAD) #include "pthread/SDL_systhread_c.h" -#elif SDL_THREAD_WINDOWS +#elif defined(SDL_THREAD_WINDOWS) #include "windows/SDL_systhread_c.h" -#elif SDL_THREAD_PS2 +#elif defined(SDL_THREAD_PS2) #include "ps2/SDL_systhread_c.h" -#elif SDL_THREAD_PSP +#elif defined(SDL_THREAD_PSP) #include "psp/SDL_systhread_c.h" -#elif SDL_THREAD_VITA +#elif defined(SDL_THREAD_VITA) #include "vita/SDL_systhread_c.h" -#elif SDL_THREAD_N3DS +#elif defined(SDL_THREAD_N3DS) #include "n3ds/SDL_systhread_c.h" -#elif SDL_THREAD_STDCPP +#elif defined(SDL_THREAD_STDCPP) #include "stdcpp/SDL_systhread_c.h" -#elif SDL_THREAD_OS2 +#elif defined(SDL_THREAD_OS2) #include "os2/SDL_systhread_c.h" -#elif SDL_THREAD_NGAGE +#elif defined(SDL_THREAD_NGAGE) #include "ngage/SDL_systhread_c.h" #else #error Need thread implementation for this platform @@ -93,17 +93,17 @@ typedef struct /* This is how many TLS entries we allocate at once */ #define TLS_ALLOC_CHUNKSIZE 4 -/* Get cross-platform, slow, thread local storage for this thread. - This is only intended as a fallback if getting real thread-local - storage fails or isn't supported on this platform. - */ -extern SDL_TLSData *SDL_Generic_GetTLSData(void); +extern void SDL_InitTLSData(void); +extern void SDL_QuitTLSData(void); -/* Set cross-platform, slow, thread local storage for this thread. +/* Generic TLS support. This is only intended as a fallback if getting real thread-local storage fails or isn't supported on this platform. */ +extern void SDL_Generic_InitTLSData(void); +extern SDL_TLSData *SDL_Generic_GetTLSData(void); extern int SDL_Generic_SetTLSData(SDL_TLSData *data); +extern void SDL_Generic_QuitTLSData(void); #endif /* SDL_thread_c_h_ */ diff --git a/thirdparty/SDL/src/thread/generic/SDL_syscond.c b/thirdparty/SDL/src/thread/generic/SDL_syscond.c index a19292970..ebd041231 100644 --- a/thirdparty/SDL/src/thread/generic/SDL_syscond.c +++ b/thirdparty/SDL/src/thread/generic/SDL_syscond.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -34,7 +34,7 @@ * will be chosen at runtime), the function names need to be * suffixed */ -#if !SDL_THREAD_GENERIC_COND_SUFFIX +#ifndef SDL_THREAD_GENERIC_COND_SUFFIX #define SDL_CreateCond_generic SDL_CreateCond #define SDL_DestroyCond_generic SDL_DestroyCond #define SDL_CondSignal_generic SDL_CondSignal @@ -95,7 +95,7 @@ void SDL_DestroyCond_generic(SDL_cond *_cond) int SDL_CondSignal_generic(SDL_cond *_cond) { SDL_cond_generic *cond = (SDL_cond_generic *)_cond; - if (cond == NULL) { + if (!cond) { return SDL_InvalidParamError("cond"); } @@ -119,7 +119,7 @@ int SDL_CondSignal_generic(SDL_cond *_cond) int SDL_CondBroadcast_generic(SDL_cond *_cond) { SDL_cond_generic *cond = (SDL_cond_generic *)_cond; - if (cond == NULL) { + if (!cond) { return SDL_InvalidParamError("cond"); } @@ -175,7 +175,7 @@ int SDL_CondWaitTimeout_generic(SDL_cond *_cond, SDL_mutex *mutex, Uint32 ms) SDL_cond_generic *cond = (SDL_cond_generic *)_cond; int retval; - if (cond == NULL) { + if (!cond) { return SDL_InvalidParamError("cond"); } diff --git a/thirdparty/SDL/src/thread/generic/SDL_syscond_c.h b/thirdparty/SDL/src/thread/generic/SDL_syscond_c.h index 953f9bcfe..64aaf4184 100644 --- a/thirdparty/SDL/src/thread/generic/SDL_syscond_c.h +++ b/thirdparty/SDL/src/thread/generic/SDL_syscond_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,7 +25,7 @@ #ifndef SDL_syscond_generic_h_ #define SDL_syscond_generic_h_ -#if SDL_THREAD_GENERIC_COND_SUFFIX +#ifdef SDL_THREAD_GENERIC_COND_SUFFIX SDL_cond *SDL_CreateCond_generic(void); void SDL_DestroyCond_generic(SDL_cond *cond); diff --git a/thirdparty/SDL/src/thread/generic/SDL_sysmutex.c b/thirdparty/SDL/src/thread/generic/SDL_sysmutex.c index daafbb607..f9fc4e4a8 100644 --- a/thirdparty/SDL/src/thread/generic/SDL_sysmutex.c +++ b/thirdparty/SDL/src/thread/generic/SDL_sysmutex.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -40,7 +40,7 @@ SDL_mutex *SDL_CreateMutex(void) /* Allocate mutex memory */ mutex = (SDL_mutex *)SDL_calloc(1, sizeof(*mutex)); -#if !SDL_THREADS_DISABLED +#ifndef SDL_THREADS_DISABLED if (mutex) { /* Create the mutex semaphore, with initial value 1 */ mutex->sem = SDL_CreateSemaphore(1); @@ -72,7 +72,7 @@ void SDL_DestroyMutex(SDL_mutex *mutex) /* Lock the mutex */ int SDL_LockMutex(SDL_mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn't know about NULL mutexes */ { -#if SDL_THREADS_DISABLED +#ifdef SDL_THREADS_DISABLED return 0; #else SDL_threadID this_thread; @@ -101,13 +101,13 @@ int SDL_LockMutex(SDL_mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn /* try Lock the mutex */ int SDL_TryLockMutex(SDL_mutex *mutex) { -#if SDL_THREADS_DISABLED +#ifdef SDL_THREADS_DISABLED return 0; #else int retval = 0; SDL_threadID this_thread; - if (mutex == NULL) { + if (!mutex) { return 0; } @@ -133,7 +133,7 @@ int SDL_TryLockMutex(SDL_mutex *mutex) /* Unlock the mutex */ int SDL_UnlockMutex(SDL_mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn't know about NULL mutexes */ { -#if SDL_THREADS_DISABLED +#ifdef SDL_THREADS_DISABLED return 0; #else if (mutex == NULL) { diff --git a/thirdparty/SDL/src/thread/generic/SDL_sysmutex_c.h b/thirdparty/SDL/src/thread/generic/SDL_sysmutex_c.h index 0f15ae7bc..886ce23bf 100644 --- a/thirdparty/SDL/src/thread/generic/SDL_sysmutex_c.h +++ b/thirdparty/SDL/src/thread/generic/SDL_sysmutex_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/thread/generic/SDL_syssem.c b/thirdparty/SDL/src/thread/generic/SDL_syssem.c index fc9794ed4..8b835b074 100644 --- a/thirdparty/SDL/src/thread/generic/SDL_syssem.c +++ b/thirdparty/SDL/src/thread/generic/SDL_syssem.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -26,7 +26,7 @@ #include "SDL_thread.h" #include "SDL_systhread_c.h" -#if SDL_THREADS_DISABLED +#ifdef SDL_THREADS_DISABLED SDL_sem *SDL_CreateSemaphore(Uint32 initial_value) { @@ -78,7 +78,7 @@ SDL_sem *SDL_CreateSemaphore(Uint32 initial_value) SDL_sem *sem; sem = (SDL_sem *)SDL_malloc(sizeof(*sem)); - if (sem == NULL) { + if (!sem) { SDL_OutOfMemory(); return NULL; } @@ -120,7 +120,7 @@ int SDL_SemTryWait(SDL_sem *sem) { int retval; - if (sem == NULL) { + if (!sem) { return SDL_InvalidParamError("sem"); } @@ -139,7 +139,7 @@ int SDL_SemWaitTimeout(SDL_sem *sem, Uint32 timeout) { int retval; - if (sem == NULL) { + if (!sem) { return SDL_InvalidParamError("sem"); } @@ -184,7 +184,7 @@ Uint32 SDL_SemValue(SDL_sem *sem) int SDL_SemPost(SDL_sem *sem) { - if (sem == NULL) { + if (!sem) { return SDL_InvalidParamError("sem"); } diff --git a/thirdparty/SDL/src/thread/generic/SDL_systhread.c b/thirdparty/SDL/src/thread/generic/SDL_systhread.c index 98c5d65cb..b3a33f7be 100644 --- a/thirdparty/SDL/src/thread/generic/SDL_systhread.c +++ b/thirdparty/SDL/src/thread/generic/SDL_systhread.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/thread/generic/SDL_systhread_c.h b/thirdparty/SDL/src/thread/generic/SDL_systhread_c.h index 2283e61d3..800b333a5 100644 --- a/thirdparty/SDL/src/thread/generic/SDL_systhread_c.h +++ b/thirdparty/SDL/src/thread/generic/SDL_systhread_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/thread/generic/SDL_systls.c b/thirdparty/SDL/src/thread/generic/SDL_systls.c index 612ad378c..cc0aadfe7 100644 --- a/thirdparty/SDL/src/thread/generic/SDL_systls.c +++ b/thirdparty/SDL/src/thread/generic/SDL_systls.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -22,6 +22,11 @@ #include "../../SDL_internal.h" #include "../SDL_thread_c.h" +void SDL_SYS_InitTLSData(void) +{ + SDL_Generic_InitTLSData(); +} + SDL_TLSData *SDL_SYS_GetTLSData(void) { return SDL_Generic_GetTLSData(); @@ -32,4 +37,9 @@ int SDL_SYS_SetTLSData(SDL_TLSData *data) return SDL_Generic_SetTLSData(data); } +void SDL_SYS_QuitTLSData(void) +{ + SDL_Generic_QuitTLSData(); +} + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/thirdparty/SDL/src/thread/n3ds/SDL_syscond.c b/thirdparty/SDL/src/thread/n3ds/SDL_syscond.c index 05e0462af..c5eae40b5 100644 --- a/thirdparty/SDL/src/thread/n3ds/SDL_syscond.c +++ b/thirdparty/SDL/src/thread/n3ds/SDL_syscond.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -54,7 +54,7 @@ void SDL_DestroyCond(SDL_cond *cond) /* Restart one of the threads that are waiting on the condition variable */ int SDL_CondSignal(SDL_cond *cond) { - if (cond == NULL) { + if (!cond) { return SDL_InvalidParamError("cond"); } @@ -65,7 +65,7 @@ int SDL_CondSignal(SDL_cond *cond) /* Restart all threads that are waiting on the condition variable */ int SDL_CondBroadcast(SDL_cond *cond) { - if (cond == NULL) { + if (!cond) { return SDL_InvalidParamError("cond"); } @@ -98,10 +98,10 @@ int SDL_CondWaitTimeout(SDL_cond *cond, SDL_mutex *mutex, Uint32 ms) { Result res; - if (cond == NULL) { + if (!cond) { return SDL_InvalidParamError("cond"); } - if (mutex == NULL) { + if (!mutex) { return SDL_InvalidParamError("mutex"); } diff --git a/thirdparty/SDL/src/thread/n3ds/SDL_sysmutex.c b/thirdparty/SDL/src/thread/n3ds/SDL_sysmutex.c index 09e0e0ae3..71056c23c 100644 --- a/thirdparty/SDL/src/thread/n3ds/SDL_sysmutex.c +++ b/thirdparty/SDL/src/thread/n3ds/SDL_sysmutex.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -64,7 +64,7 @@ int SDL_LockMutex(SDL_mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn /* try Lock the mutex */ int SDL_TryLockMutex(SDL_mutex *mutex) { - if (mutex == NULL) { + if (!mutex) { return 0; } diff --git a/thirdparty/SDL/src/thread/n3ds/SDL_sysmutex_c.h b/thirdparty/SDL/src/thread/n3ds/SDL_sysmutex_c.h index e72a60e66..4a3e7e9f8 100644 --- a/thirdparty/SDL/src/thread/n3ds/SDL_sysmutex_c.h +++ b/thirdparty/SDL/src/thread/n3ds/SDL_sysmutex_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/thread/n3ds/SDL_syssem.c b/thirdparty/SDL/src/thread/n3ds/SDL_syssem.c index e7615e4d9..45e53055b 100644 --- a/thirdparty/SDL/src/thread/n3ds/SDL_syssem.c +++ b/thirdparty/SDL/src/thread/n3ds/SDL_syssem.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -46,7 +46,7 @@ SDL_sem *SDL_CreateSemaphore(Uint32 initial_value) } sem = (SDL_sem *)SDL_malloc(sizeof(*sem)); - if (sem == NULL) { + if (!sem) { SDL_OutOfMemory(); return NULL; } @@ -66,7 +66,7 @@ void SDL_DestroySemaphore(SDL_sem *sem) int SDL_SemTryWait(SDL_sem *sem) { - if (sem == NULL) { + if (!sem) { return SDL_InvalidParamError("sem"); } @@ -81,7 +81,7 @@ int SDL_SemTryWait(SDL_sem *sem) int SDL_SemWaitTimeout(SDL_sem *sem, Uint32 timeout) { - if (sem == NULL) { + if (!sem) { return SDL_InvalidParamError("sem"); } @@ -122,7 +122,7 @@ int SDL_SemWait(SDL_sem *sem) Uint32 SDL_SemValue(SDL_sem *sem) { - if (sem == NULL) { + if (!sem) { SDL_InvalidParamError("sem"); return 0; } @@ -131,7 +131,7 @@ Uint32 SDL_SemValue(SDL_sem *sem) int SDL_SemPost(SDL_sem *sem) { - if (sem == NULL) { + if (!sem) { return SDL_InvalidParamError("sem"); } LightSemaphore_Release(&sem->semaphore, 1); diff --git a/thirdparty/SDL/src/thread/n3ds/SDL_systhread.c b/thirdparty/SDL/src/thread/n3ds/SDL_systhread.c index 4dfb8fc49..c15c281be 100644 --- a/thirdparty/SDL/src/thread/n3ds/SDL_systhread.c +++ b/thirdparty/SDL/src/thread/n3ds/SDL_systhread.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -26,9 +26,8 @@ #include "../SDL_systhread.h" -/* N3DS has very limited RAM (128MB), so we put a limit on thread stack size. */ -#define N3DS_THREAD_STACK_SIZE_MAX (16 * 1024) -#define N3DS_THREAD_STACK_SIZE_DEFAULT (4 * 1024) +/* N3DS has very limited RAM (128MB), so we set a low default thread stack size. */ +#define N3DS_THREAD_STACK_SIZE_DEFAULT (80 * 1024) #define N3DS_THREAD_PRIORITY_LOW 0x3F /**< Minimum priority */ #define N3DS_THREAD_PRIORITY_MEDIUM 0x2F /**< Slightly higher than main thread (0x30) */ @@ -49,18 +48,25 @@ static void ThreadEntry(void *arg) int SDL_SYS_CreateThread(SDL_Thread *thread) { - s32 priority; + s32 priority = 0x30; + int cpu = -1; size_t stack_size = GetStackSize(thread->stacksize); + svcGetThreadPriority(&priority, CUR_THREAD_HANDLE); + /* prefer putting audio thread on system core */ + if (thread->name && (SDL_strncmp(thread->name, "SDLAudioP", 9) == 0) && R_SUCCEEDED(APT_SetAppCpuTimeLimit(30))) { + cpu = 1; + } + thread->handle = threadCreate(ThreadEntry, thread, stack_size, priority, - -1, + cpu, false); - if (thread->handle == NULL) { + if (!thread->handle) { return SDL_SetError("Couldn't create thread"); } @@ -73,14 +79,6 @@ static size_t GetStackSize(size_t requested_size) return N3DS_THREAD_STACK_SIZE_DEFAULT; } - if (requested_size > N3DS_THREAD_STACK_SIZE_MAX) { - SDL_LogWarn(SDL_LOG_CATEGORY_SYSTEM, - "Requested a thread size of %zu," - " falling back to the maximum supported of %zu\n", - requested_size, - N3DS_THREAD_STACK_SIZE_MAX); - requested_size = N3DS_THREAD_STACK_SIZE_MAX; - } return requested_size; } diff --git a/thirdparty/SDL/src/thread/n3ds/SDL_systhread_c.h b/thirdparty/SDL/src/thread/n3ds/SDL_systhread_c.h index f22f222f2..ee8bf94ed 100644 --- a/thirdparty/SDL/src/thread/n3ds/SDL_systhread_c.h +++ b/thirdparty/SDL/src/thread/n3ds/SDL_systhread_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/thread/ngage/SDL_sysmutex.cpp b/thirdparty/SDL/src/thread/ngage/SDL_sysmutex.cpp index 72617045f..4aa2625aa 100644 --- a/thirdparty/SDL/src/thread/ngage/SDL_sysmutex.cpp +++ b/thirdparty/SDL/src/thread/ngage/SDL_sysmutex.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/thread/ngage/SDL_syssem.cpp b/thirdparty/SDL/src/thread/ngage/SDL_syssem.cpp index 20133c671..f8e1198cc 100644 --- a/thirdparty/SDL/src/thread/ngage/SDL_syssem.cpp +++ b/thirdparty/SDL/src/thread/ngage/SDL_syssem.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -92,7 +92,7 @@ SDL_sem *SDL_CreateSemaphore(Uint32 initial_value) void SDL_DestroySemaphore(SDL_sem *sem) { - if (sem != NULL) { + if (sem) { RSemaphore sema; sema.SetHandle(sem->handle); sema.Signal(sema.Count()); @@ -104,7 +104,7 @@ void SDL_DestroySemaphore(SDL_sem *sem) int SDL_SemWaitTimeout(SDL_sem *sem, Uint32 timeout) { - if (sem == NULL) { + if (!sem) { return SDL_InvalidParamError("sem"); } @@ -134,7 +134,7 @@ int SDL_SemWaitTimeout(SDL_sem *sem, Uint32 timeout) int SDL_SemTryWait(SDL_sem *sem) { - if (sem == NULL) { + if (!sem) { return SDL_InvalidParamError("sem"); } @@ -151,7 +151,7 @@ int SDL_SemWait(SDL_sem *sem) Uint32 SDL_SemValue(SDL_sem *sem) { - if (sem == NULL) { + if (!sem) { SDL_InvalidParamError("sem"); return 0; } @@ -160,7 +160,7 @@ Uint32 SDL_SemValue(SDL_sem *sem) int SDL_SemPost(SDL_sem *sem) { - if (sem == NULL) { + if (!sem) { return SDL_InvalidParamError("sem"); } sem->count++; diff --git a/thirdparty/SDL/src/thread/ngage/SDL_systhread.cpp b/thirdparty/SDL/src/thread/ngage/SDL_systhread.cpp index fb2958da8..8eb50b23b 100644 --- a/thirdparty/SDL/src/thread/ngage/SDL_systhread.cpp +++ b/thirdparty/SDL/src/thread/ngage/SDL_systhread.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_THREAD_NGAGE +#ifdef SDL_THREAD_NGAGE /* N-Gage thread management routines for SDL */ diff --git a/thirdparty/SDL/src/thread/ngage/SDL_systhread_c.h b/thirdparty/SDL/src/thread/ngage/SDL_systhread_c.h index 8627eff42..ed6ce3660 100644 --- a/thirdparty/SDL/src/thread/ngage/SDL_systhread_c.h +++ b/thirdparty/SDL/src/thread/ngage/SDL_systhread_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/thread/os2/SDL_sysmutex.c b/thirdparty/SDL/src/thread/os2/SDL_sysmutex.c index 4a7f6e86e..e3a32e261 100644 --- a/thirdparty/SDL/src/thread/os2/SDL_sysmutex.c +++ b/thirdparty/SDL/src/thread/os2/SDL_sysmutex.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_THREAD_OS2 +#ifdef SDL_THREAD_OS2 /* An implementation of mutexes for OS/2 */ diff --git a/thirdparty/SDL/src/thread/os2/SDL_syssem.c b/thirdparty/SDL/src/thread/os2/SDL_syssem.c index 407867d67..44d6e91a5 100644 --- a/thirdparty/SDL/src/thread/os2/SDL_syssem.c +++ b/thirdparty/SDL/src/thread/os2/SDL_syssem.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_THREAD_OS2 +#ifdef SDL_THREAD_OS2 /* An implementation of semaphores for OS/2 */ @@ -44,7 +44,7 @@ SDL_sem *SDL_CreateSemaphore(Uint32 initial_value) ULONG ulRC; SDL_sem *pSDLSem = SDL_malloc(sizeof(SDL_sem)); - if (pSDLSem == NULL) { + if (!pSDLSem) { SDL_OutOfMemory(); return NULL; } @@ -85,7 +85,7 @@ int SDL_SemWaitTimeout(SDL_sem * sem, Uint32 timeout) ULONG ulTimeout; ULONG cPost; - if (sem == NULL) + if (!sem) return SDL_InvalidParamError("sem"); if (timeout != SEM_INDEFINITE_WAIT) @@ -140,7 +140,7 @@ Uint32 SDL_SemValue(SDL_sem * sem) { ULONG ulRC; - if (sem == NULL) { + if (!sem) { SDL_InvalidParamError("sem"); return 0; } @@ -159,7 +159,7 @@ int SDL_SemPost(SDL_sem * sem) { ULONG ulRC; - if (sem == NULL) + if (!sem) return SDL_InvalidParamError("sem"); ulRC = DosRequestMutexSem(sem->hMtx, SEM_INDEFINITE_WAIT); diff --git a/thirdparty/SDL/src/thread/os2/SDL_systhread.c b/thirdparty/SDL/src/thread/os2/SDL_systhread.c index b2555892c..f150de70e 100644 --- a/thirdparty/SDL/src/thread/os2/SDL_systhread.c +++ b/thirdparty/SDL/src/thread/os2/SDL_systhread.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_THREAD_OS2 +#ifdef SDL_THREAD_OS2 /* Thread management routines for SDL */ @@ -45,7 +45,7 @@ static void RunThread(void *data) SDL_Thread *thread = (SDL_Thread *) data; pfnSDL_CurrentEndThread pfnEndThread = (pfnSDL_CurrentEndThread) thread->endfunc; - if (ppSDLTLSData != NULL) + if (ppSDLTLSData) *ppSDLTLSData = NULL; SDL_RunThread(thread); diff --git a/thirdparty/SDL/src/thread/os2/SDL_systhread_c.h b/thirdparty/SDL/src/thread/os2/SDL_systhread_c.h index 8627eff42..ed6ce3660 100644 --- a/thirdparty/SDL/src/thread/os2/SDL_systhread_c.h +++ b/thirdparty/SDL/src/thread/os2/SDL_systhread_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/thread/os2/SDL_systls.c b/thirdparty/SDL/src/thread/os2/SDL_systls.c index 563ab74b8..75ed562de 100644 --- a/thirdparty/SDL/src/thread/os2/SDL_systls.c +++ b/thirdparty/SDL/src/thread/os2/SDL_systls.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,7 +21,7 @@ #include "../../SDL_internal.h" -#if SDL_THREAD_OS2 +#ifdef SDL_THREAD_OS2 #include "../../core/os2/SDL_os2.h" @@ -34,45 +34,22 @@ SDL_TLSData **ppSDLTLSData = NULL; -static ULONG cTLSAlloc = 0; - -/* SDL_OS2TLSAlloc() called from SDL_InitSubSystem() */ -void SDL_OS2TLSAlloc(void) +void SDL_SYS_InitTLSData(void) { ULONG ulRC; - if (cTLSAlloc == 0 || ppSDLTLSData == NULL) { - /* First call - allocate the thread local memory (1 DWORD) */ + if (!ppSDLTLSData) { + /* Allocate the thread local memory (1 DWORD) */ ulRC = DosAllocThreadLocalMemory(1, (PULONG *)&ppSDLTLSData); if (ulRC != NO_ERROR) { debug_os2("DosAllocThreadLocalMemory() failed, rc = %u", ulRC); } } - cTLSAlloc++; -} - -/* SDL_OS2TLSFree() called from SDL_QuitSubSystem() */ -void SDL_OS2TLSFree(void) -{ - ULONG ulRC; - - if (cTLSAlloc != 0) - cTLSAlloc--; - - if (cTLSAlloc == 0 && ppSDLTLSData != NULL) { - /* Last call - free the thread local memory */ - ulRC = DosFreeThreadLocalMemory((PULONG)ppSDLTLSData); - if (ulRC != NO_ERROR) { - debug_os2("DosFreeThreadLocalMemory() failed, rc = %u", ulRC); - } else { - ppSDLTLSData = NULL; - } - } } SDL_TLSData *SDL_SYS_GetTLSData(void) { - return (ppSDLTLSData == NULL)? NULL : *ppSDLTLSData; + return ppSDLTLSData ? *ppSDLTLSData : NULL; } int SDL_SYS_SetTLSData(SDL_TLSData *data) @@ -84,6 +61,21 @@ int SDL_SYS_SetTLSData(SDL_TLSData *data) return 0; } +void SDL_SYS_QuitTLSData(void) +{ + ULONG ulRC; + + if (ppSDLTLSData) { + /* Free the thread local memory */ + ulRC = DosFreeThreadLocalMemory((PULONG)ppSDLTLSData); + if (ulRC != NO_ERROR) { + debug_os2("DosFreeThreadLocalMemory() failed, rc = %u", ulRC); + } else { + ppSDLTLSData = NULL; + } + } +} + #endif /* SDL_THREAD_OS2 */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/thirdparty/SDL/src/thread/os2/SDL_systls_c.h b/thirdparty/SDL/src/thread/os2/SDL_systls_c.h index d79253538..ad4fcefad 100644 --- a/thirdparty/SDL/src/thread/os2/SDL_systls_c.h +++ b/thirdparty/SDL/src/thread/os2/SDL_systls_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,18 +21,10 @@ #include "../../SDL_internal.h" -#if SDL_THREAD_OS2 +#ifdef SDL_THREAD_OS2 #include "../SDL_thread_c.h" extern SDL_TLSData **ppSDLTLSData; -/* SDL_OS2TLSAlloc() called from SDL_InitSubSystem() */ -void SDL_OS2TLSAlloc(void); - -/* SDL_OS2TLSFree() called from SDL_QuitSubSystem() */ -void SDL_OS2TLSFree(void); - #endif /* SDL_THREAD_OS2 */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/thirdparty/SDL/src/thread/ps2/SDL_syssem.c b/thirdparty/SDL/src/thread/ps2/SDL_syssem.c index bba13a5e1..c5f2cae11 100644 --- a/thirdparty/SDL/src/thread/ps2/SDL_syssem.c +++ b/thirdparty/SDL/src/thread/ps2/SDL_syssem.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,13 +20,13 @@ */ #include "../../SDL_internal.h" -#if SDL_THREAD_PS2 +#ifdef SDL_THREAD_PS2 /* Semaphore functions for the PS2. */ #include #include -#include +#include #include "SDL_error.h" #include "SDL_thread.h" @@ -38,11 +38,6 @@ struct SDL_semaphore s32 semid; }; -static void usercb(struct timer_alarm_t *alarm, void *arg) -{ - iReleaseWaitThread((int)arg); -} - /* Create a semaphore */ SDL_sem *SDL_CreateSemaphore(Uint32 initial_value) { @@ -50,7 +45,7 @@ SDL_sem *SDL_CreateSemaphore(Uint32 initial_value) ee_sema_t sema; sem = (SDL_sem *)SDL_malloc(sizeof(*sem)); - if (sem != NULL) { + if (sem) { /* TODO: Figure out the limit on the maximum value. */ sema.init_count = initial_value; sema.max_count = 255; @@ -72,7 +67,7 @@ SDL_sem *SDL_CreateSemaphore(Uint32 initial_value) /* Free the semaphore */ void SDL_DestroySemaphore(SDL_sem *sem) { - if (sem != NULL) { + if (sem) { if (sem->semid > 0) { DeleteSema(sem->semid); sem->semid = 0; @@ -85,10 +80,10 @@ void SDL_DestroySemaphore(SDL_sem *sem) int SDL_SemWaitTimeout(SDL_sem *sem, Uint32 timeout) { int ret; - struct timer_alarm_t alarm; - InitializeTimerAlarm(&alarm); + u64 timeout_usec; + u64 *timeout_ptr; - if (sem == NULL) { + if (!sem) { return SDL_InvalidParamError("sem"); } @@ -99,12 +94,14 @@ int SDL_SemWaitTimeout(SDL_sem *sem, Uint32 timeout) return 0; } + timeout_ptr = NULL; + if (timeout != SDL_MUTEX_MAXWAIT) { - SetTimerAlarm(&alarm, MSec2TimerBusClock(timeout), &usercb, (void *)GetThreadId()); + timeout_usec = timeout * 1000; + timeout_ptr = &timeout_usec; } - ret = WaitSema(sem->semid); - StopTimerAlarm(&alarm); + ret = WaitSemaEx(sem->semid, 1, timeout_ptr); if (ret < 0) { return SDL_MUTEX_TIMEDOUT; @@ -127,7 +124,7 @@ Uint32 SDL_SemValue(SDL_sem *sem) { ee_sema_t info; - if (sem == NULL) { + if (!sem) { SDL_InvalidParamError("sem"); return 0; } @@ -143,7 +140,7 @@ int SDL_SemPost(SDL_sem *sem) { int res; - if (sem == NULL) { + if (!sem) { return SDL_InvalidParamError("sem"); } diff --git a/thirdparty/SDL/src/thread/ps2/SDL_systhread.c b/thirdparty/SDL/src/thread/ps2/SDL_systhread.c index 3d2f68520..15dcf0d96 100644 --- a/thirdparty/SDL/src/thread/ps2/SDL_systhread.c +++ b/thirdparty/SDL/src/thread/ps2/SDL_systhread.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_THREAD_PS2 +#ifdef SDL_THREAD_PS2 /* PS2 thread management routines for SDL */ diff --git a/thirdparty/SDL/src/thread/ps2/SDL_systhread_c.h b/thirdparty/SDL/src/thread/ps2/SDL_systhread_c.h index b97570453..afab3838f 100644 --- a/thirdparty/SDL/src/thread/ps2/SDL_systhread_c.h +++ b/thirdparty/SDL/src/thread/ps2/SDL_systhread_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/thread/psp/SDL_syscond.c b/thirdparty/SDL/src/thread/psp/SDL_syscond.c deleted file mode 100644 index a16187c18..000000000 --- a/thirdparty/SDL/src/thread/psp/SDL_syscond.c +++ /dev/null @@ -1,218 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "../../SDL_internal.h" - -#if SDL_THREAD_PSP - -/* An implementation of condition variables using semaphores and mutexes */ -/* - This implementation borrows heavily from the BeOS condition variable - implementation, written by Christopher Tate and Owen Smith. Thanks! - */ - -#include "SDL_thread.h" - -struct SDL_cond -{ - SDL_mutex *lock; - int waiting; - int signals; - SDL_sem *wait_sem; - SDL_sem *wait_done; -}; - -/* Create a condition variable */ -SDL_cond *SDL_CreateCond(void) -{ - SDL_cond *cond; - - cond = (SDL_cond *)SDL_malloc(sizeof(SDL_cond)); - if (cond) { - cond->lock = SDL_CreateMutex(); - cond->wait_sem = SDL_CreateSemaphore(0); - cond->wait_done = SDL_CreateSemaphore(0); - cond->waiting = cond->signals = 0; - if (!cond->lock || !cond->wait_sem || !cond->wait_done) { - SDL_DestroyCond(cond); - cond = NULL; - } - } else { - SDL_OutOfMemory(); - } - return cond; -} - -/* Destroy a condition variable */ -void SDL_DestroyCond(SDL_cond *cond) -{ - if (cond) { - if (cond->wait_sem) { - SDL_DestroySemaphore(cond->wait_sem); - } - if (cond->wait_done) { - SDL_DestroySemaphore(cond->wait_done); - } - if (cond->lock) { - SDL_DestroyMutex(cond->lock); - } - SDL_free(cond); - } -} - -/* Restart one of the threads that are waiting on the condition variable */ -int SDL_CondSignal(SDL_cond *cond) -{ - if (cond == NULL) { - return SDL_InvalidParamError("cond"); - } - - /* If there are waiting threads not already signalled, then - signal the condition and wait for the thread to respond. - */ - SDL_LockMutex(cond->lock); - if (cond->waiting > cond->signals) { - ++cond->signals; - SDL_SemPost(cond->wait_sem); - SDL_UnlockMutex(cond->lock); - SDL_SemWait(cond->wait_done); - } else { - SDL_UnlockMutex(cond->lock); - } - - return 0; -} - -/* Restart all threads that are waiting on the condition variable */ -int SDL_CondBroadcast(SDL_cond *cond) -{ - if (cond == NULL) { - return SDL_InvalidParamError("cond"); - } - - /* If there are waiting threads not already signalled, then - signal the condition and wait for the thread to respond. - */ - SDL_LockMutex(cond->lock); - if (cond->waiting > cond->signals) { - int i, num_waiting; - - num_waiting = (cond->waiting - cond->signals); - cond->signals = cond->waiting; - for (i = 0; i < num_waiting; ++i) { - SDL_SemPost(cond->wait_sem); - } - /* Now all released threads are blocked here, waiting for us. - Collect them all (and win fabulous prizes!) :-) - */ - SDL_UnlockMutex(cond->lock); - for (i = 0; i < num_waiting; ++i) { - SDL_SemWait(cond->wait_done); - } - } else { - SDL_UnlockMutex(cond->lock); - } - - return 0; -} - -/* Wait on the condition variable for at most 'ms' milliseconds. - The mutex must be locked before entering this function! - The mutex is unlocked during the wait, and locked again after the wait. - -Typical use: - -Thread A: - SDL_LockMutex(lock); - while ( ! condition ) { - SDL_CondWait(cond, lock); - } - SDL_UnlockMutex(lock); - -Thread B: - SDL_LockMutex(lock); - ... - condition = true; - ... - SDL_CondSignal(cond); - SDL_UnlockMutex(lock); - */ -int SDL_CondWaitTimeout(SDL_cond *cond, SDL_mutex *mutex, Uint32 ms) -{ - int retval; - - if (cond == NULL) { - return SDL_InvalidParamError("cond"); - } - - /* Obtain the protection mutex, and increment the number of waiters. - This allows the signal mechanism to only perform a signal if there - are waiting threads. - */ - SDL_LockMutex(cond->lock); - ++cond->waiting; - SDL_UnlockMutex(cond->lock); - - /* Unlock the mutex, as is required by condition variable semantics */ - SDL_UnlockMutex(mutex); - - /* Wait for a signal */ - if (ms == SDL_MUTEX_MAXWAIT) { - retval = SDL_SemWait(cond->wait_sem); - } else { - retval = SDL_SemWaitTimeout(cond->wait_sem, ms); - } - - /* Let the signaler know we have completed the wait, otherwise - the signaler can race ahead and get the condition semaphore - if we are stopped between the mutex unlock and semaphore wait, - giving a deadlock. See the following URL for details: - http://www-classic.be.com/aboutbe/benewsletter/volume_III/Issue40.html - */ - SDL_LockMutex(cond->lock); - if (cond->signals > 0) { - /* If we timed out, we need to eat a condition signal */ - if (retval > 0) { - SDL_SemWait(cond->wait_sem); - } - /* We always notify the signal thread that we are done */ - SDL_SemPost(cond->wait_done); - - /* Signal handshake complete */ - --cond->signals; - } - --cond->waiting; - SDL_UnlockMutex(cond->lock); - - /* Lock the mutex, as is required by condition variable semantics */ - SDL_LockMutex(mutex); - - return retval; -} - -/* Wait on the condition variable forever */ -int SDL_CondWait(SDL_cond *cond, SDL_mutex *mutex) -{ - return SDL_CondWaitTimeout(cond, mutex, SDL_MUTEX_MAXWAIT); -} - -#endif /* SDL_THREAD_PSP */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/thirdparty/SDL/src/thread/psp/SDL_sysmutex.c b/thirdparty/SDL/src/thread/psp/SDL_sysmutex.c index 3b3cf3786..eafca9f36 100644 --- a/thirdparty/SDL/src/thread/psp/SDL_sysmutex.c +++ b/thirdparty/SDL/src/thread/psp/SDL_sysmutex.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_THREAD_PSP +#ifdef SDL_THREAD_PSP /* An implementation of mutexes using semaphores */ @@ -75,7 +75,7 @@ void SDL_DestroyMutex(SDL_mutex *mutex) /* Lock the mutex */ int SDL_LockMutex(SDL_mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn't know about NULL mutexes */ { -#if SDL_THREADS_DISABLED +#ifdef SDL_THREADS_DISABLED return 0; #else SceInt32 res = 0; @@ -96,12 +96,12 @@ int SDL_LockMutex(SDL_mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn /* Try to lock the mutex */ int SDL_TryLockMutex(SDL_mutex *mutex) { -#if SDL_THREADS_DISABLED +#ifdef SDL_THREADS_DISABLED return 0; #else SceInt32 res = 0; - if (mutex == NULL) { + if (!mutex) { return 0; } @@ -125,7 +125,7 @@ int SDL_TryLockMutex(SDL_mutex *mutex) /* Unlock the mutex */ int SDL_UnlockMutex(SDL_mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn't know about NULL mutexes */ { -#if SDL_THREADS_DISABLED +#ifdef SDL_THREADS_DISABLED return 0; #else SceInt32 res = 0; diff --git a/thirdparty/SDL/src/thread/psp/SDL_sysmutex_c.h b/thirdparty/SDL/src/thread/psp/SDL_sysmutex_c.h index 0f15ae7bc..886ce23bf 100644 --- a/thirdparty/SDL/src/thread/psp/SDL_sysmutex_c.h +++ b/thirdparty/SDL/src/thread/psp/SDL_sysmutex_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/thread/psp/SDL_syssem.c b/thirdparty/SDL/src/thread/psp/SDL_syssem.c index 131f6b73b..9b8e7d13b 100644 --- a/thirdparty/SDL/src/thread/psp/SDL_syssem.c +++ b/thirdparty/SDL/src/thread/psp/SDL_syssem.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_THREAD_PSP +#ifdef SDL_THREAD_PSP /* Semaphore functions for the PSP. */ @@ -44,7 +44,7 @@ SDL_sem *SDL_CreateSemaphore(Uint32 initial_value) SDL_sem *sem; sem = (SDL_sem *)SDL_malloc(sizeof(*sem)); - if (sem != NULL) { + if (sem) { /* TODO: Figure out the limit on the maximum value. */ sem->semid = sceKernelCreateSema("SDL sema", 0, initial_value, 255, NULL); if (sem->semid < 0) { @@ -62,7 +62,7 @@ SDL_sem *SDL_CreateSemaphore(Uint32 initial_value) /* Free the semaphore */ void SDL_DestroySemaphore(SDL_sem *sem) { - if (sem != NULL) { + if (sem) { if (sem->semid > 0) { sceKernelDeleteSema(sem->semid); sem->semid = 0; @@ -81,7 +81,7 @@ int SDL_SemWaitTimeout(SDL_sem *sem, Uint32 timeout) Uint32 *pTimeout; int res; - if (sem == NULL) { + if (!sem) { return SDL_InvalidParamError("sem"); } @@ -126,7 +126,7 @@ Uint32 SDL_SemValue(SDL_sem *sem) { SceKernelSemaInfo info; - if (sem == NULL) { + if (!sem) { SDL_InvalidParamError("sem"); return 0; } @@ -142,7 +142,7 @@ int SDL_SemPost(SDL_sem *sem) { int res; - if (sem == NULL) { + if (!sem) { return SDL_InvalidParamError("sem"); } diff --git a/thirdparty/SDL/src/thread/psp/SDL_systhread.c b/thirdparty/SDL/src/thread/psp/SDL_systhread.c index f29efff35..c137799ff 100644 --- a/thirdparty/SDL/src/thread/psp/SDL_systhread.c +++ b/thirdparty/SDL/src/thread/psp/SDL_systhread.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_THREAD_PSP +#ifdef SDL_THREAD_PSP /* PSP thread management routines for SDL */ diff --git a/thirdparty/SDL/src/thread/psp/SDL_systhread_c.h b/thirdparty/SDL/src/thread/psp/SDL_systhread_c.h index ef3fbccf5..ffa844924 100644 --- a/thirdparty/SDL/src/thread/psp/SDL_systhread_c.h +++ b/thirdparty/SDL/src/thread/psp/SDL_systhread_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/thread/pthread/SDL_syscond.c b/thirdparty/SDL/src/thread/pthread/SDL_syscond.c index 5b8aeb4ad..c7583dcfe 100644 --- a/thirdparty/SDL/src/thread/pthread/SDL_syscond.c +++ b/thirdparty/SDL/src/thread/pthread/SDL_syscond.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -64,7 +64,7 @@ int SDL_CondSignal(SDL_cond *cond) { int retval; - if (cond == NULL) { + if (!cond) { return SDL_InvalidParamError("cond"); } @@ -80,7 +80,7 @@ int SDL_CondBroadcast(SDL_cond *cond) { int retval; - if (cond == NULL) { + if (!cond) { return SDL_InvalidParamError("cond"); } @@ -99,7 +99,7 @@ int SDL_CondWaitTimeout(SDL_cond *cond, SDL_mutex *mutex, Uint32 ms) #endif struct timespec abstime; - if (cond == NULL) { + if (!cond) { return SDL_InvalidParamError("cond"); } @@ -114,7 +114,7 @@ int SDL_CondWaitTimeout(SDL_cond *cond, SDL_mutex *mutex, Uint32 ms) abstime.tv_sec = delta.tv_sec + (ms / 1000); abstime.tv_nsec = (long)(delta.tv_usec + (ms % 1000) * 1000) * 1000; #endif - if (abstime.tv_nsec > 1000000000) { + if (abstime.tv_nsec >= 1000000000) { abstime.tv_sec += 1; abstime.tv_nsec -= 1000000000; } @@ -141,7 +141,7 @@ int SDL_CondWaitTimeout(SDL_cond *cond, SDL_mutex *mutex, Uint32 ms) */ int SDL_CondWait(SDL_cond *cond, SDL_mutex *mutex) { - if (cond == NULL) { + if (!cond) { return SDL_InvalidParamError("cond"); } else if (pthread_cond_wait(&cond->cond, &mutex->id) != 0) { return SDL_SetError("pthread_cond_wait() failed"); diff --git a/thirdparty/SDL/src/thread/pthread/SDL_sysmutex.c b/thirdparty/SDL/src/thread/pthread/SDL_sysmutex.c index 9b24e1605..c66b5cc9c 100644 --- a/thirdparty/SDL/src/thread/pthread/SDL_sysmutex.c +++ b/thirdparty/SDL/src/thread/pthread/SDL_sysmutex.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,15 +25,15 @@ #include "SDL_thread.h" -#if !SDL_THREAD_PTHREAD_RECURSIVE_MUTEX && \ - !SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP -#define FAKE_RECURSIVE_MUTEX 1 +#if !(defined(SDL_THREAD_PTHREAD_RECURSIVE_MUTEX) || \ + defined(SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP)) +#define FAKE_RECURSIVE_MUTEX #endif struct SDL_mutex { pthread_mutex_t id; -#if FAKE_RECURSIVE_MUTEX +#ifdef FAKE_RECURSIVE_MUTEX int recursive; pthread_t owner; #endif @@ -48,9 +48,9 @@ SDL_mutex *SDL_CreateMutex(void) mutex = (SDL_mutex *)SDL_calloc(1, sizeof(*mutex)); if (mutex) { pthread_mutexattr_init(&attr); -#if SDL_THREAD_PTHREAD_RECURSIVE_MUTEX +#ifdef SDL_THREAD_PTHREAD_RECURSIVE_MUTEX pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE); -#elif SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP +#elif defined(SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP) pthread_mutexattr_setkind_np(&attr, PTHREAD_MUTEX_RECURSIVE_NP); #else /* No extra attributes necessary */ @@ -77,7 +77,7 @@ void SDL_DestroyMutex(SDL_mutex *mutex) /* Lock the mutex */ int SDL_LockMutex(SDL_mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn't know about NULL mutexes */ { -#if FAKE_RECURSIVE_MUTEX +#ifdef FAKE_RECURSIVE_MUTEX pthread_t this_thread; #endif @@ -85,7 +85,7 @@ int SDL_LockMutex(SDL_mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn return 0; } -#if FAKE_RECURSIVE_MUTEX +#ifdef FAKE_RECURSIVE_MUTEX this_thread = pthread_self(); if (mutex->owner == this_thread) { ++mutex->recursive; @@ -113,16 +113,16 @@ int SDL_TryLockMutex(SDL_mutex *mutex) { int retval; int result; -#if FAKE_RECURSIVE_MUTEX +#ifdef FAKE_RECURSIVE_MUTEX pthread_t this_thread; #endif - if (mutex == NULL) { + if (!mutex) { return 0; } retval = 0; -#if FAKE_RECURSIVE_MUTEX +#ifdef FAKE_RECURSIVE_MUTEX this_thread = pthread_self(); if (mutex->owner == this_thread) { ++mutex->recursive; @@ -160,7 +160,7 @@ int SDL_UnlockMutex(SDL_mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doe return 0; } -#if FAKE_RECURSIVE_MUTEX +#ifdef FAKE_RECURSIVE_MUTEX /* We can only unlock the mutex if we own it */ if (pthread_self() == mutex->owner) { if (mutex->recursive) { diff --git a/thirdparty/SDL/src/thread/pthread/SDL_sysmutex_c.h b/thirdparty/SDL/src/thread/pthread/SDL_sysmutex_c.h index 94667f310..0435a38d4 100644 --- a/thirdparty/SDL/src/thread/pthread/SDL_sysmutex_c.h +++ b/thirdparty/SDL/src/thread/pthread/SDL_sysmutex_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/thread/pthread/SDL_syssem.c b/thirdparty/SDL/src/thread/pthread/SDL_syssem.c index fee50bb86..9894bab4d 100644 --- a/thirdparty/SDL/src/thread/pthread/SDL_syssem.c +++ b/thirdparty/SDL/src/thread/pthread/SDL_syssem.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -45,7 +45,7 @@ struct SDL_semaphore SDL_sem *SDL_CreateSemaphore(Uint32 initial_value) { SDL_sem *sem = (SDL_sem *)SDL_malloc(sizeof(SDL_sem)); - if (sem != NULL) { + if (sem) { if (sem_init(&sem->sem, 0, initial_value) < 0) { SDL_SetError("sem_init() failed"); SDL_free(sem); @@ -59,7 +59,7 @@ SDL_sem *SDL_CreateSemaphore(Uint32 initial_value) void SDL_DestroySemaphore(SDL_sem *sem) { - if (sem != NULL) { + if (sem) { sem_destroy(&sem->sem); SDL_free(sem); } @@ -69,7 +69,7 @@ int SDL_SemTryWait(SDL_sem *sem) { int retval; - if (sem == NULL) { + if (!sem) { return SDL_InvalidParamError("sem"); } retval = SDL_MUTEX_TIMEDOUT; @@ -83,7 +83,7 @@ int SDL_SemWait(SDL_sem *sem) { int retval; - if (sem == NULL) { + if (!sem) { return SDL_InvalidParamError("sem"); } @@ -109,7 +109,7 @@ int SDL_SemWaitTimeout(SDL_sem *sem, Uint32 timeout) Uint32 end; #endif - if (sem == NULL) { + if (!sem) { return SDL_InvalidParamError("sem"); } @@ -141,7 +141,7 @@ int SDL_SemWaitTimeout(SDL_sem *sem, Uint32 timeout) #endif /* Wrap the second if needed */ - if (ts_timeout.tv_nsec > 1000000000) { + if (ts_timeout.tv_nsec >= 1000000000) { ts_timeout.tv_sec += 1; ts_timeout.tv_nsec -= 1000000000; } @@ -175,7 +175,7 @@ Uint32 SDL_SemValue(SDL_sem *sem) { int ret = 0; - if (sem == NULL) { + if (!sem) { SDL_InvalidParamError("sem"); return 0; } @@ -191,7 +191,7 @@ int SDL_SemPost(SDL_sem *sem) { int retval; - if (sem == NULL) { + if (!sem) { return SDL_InvalidParamError("sem"); } diff --git a/thirdparty/SDL/src/thread/pthread/SDL_systhread.c b/thirdparty/SDL/src/thread/pthread/SDL_systhread.c index 531680705..ccc09875f 100644 --- a/thirdparty/SDL/src/thread/pthread/SDL_systhread.c +++ b/thirdparty/SDL/src/thread/pthread/SDL_systhread.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,7 +25,7 @@ #include -#if HAVE_PTHREAD_NP_H +#ifdef HAVE_PTHREAD_NP_H #include #endif @@ -127,10 +127,10 @@ void SDL_SYS_SetupThread(const char *name) sigset_t mask; #endif /* !__NACL__ */ - if (name != NULL) { + if (name) { #if (defined(__MACOSX__) || defined(__IPHONEOS__) || defined(__LINUX__)) && defined(HAVE_DLOPEN) SDL_assert(checked_setname); - if (ppthread_setname_np != NULL) { + if (ppthread_setname_np) { #if defined(__MACOSX__) || defined(__IPHONEOS__) ppthread_setname_np(name); #elif defined(__LINUX__) @@ -141,7 +141,7 @@ void SDL_SYS_SetupThread(const char *name) } #endif } -#elif HAVE_PTHREAD_SETNAME_NP +#elif defined(HAVE_PTHREAD_SETNAME_NP) #if defined(__NETBSD__) pthread_setname_np(pthread_self(), "%s", name); #else @@ -151,7 +151,7 @@ void SDL_SYS_SetupThread(const char *name) pthread_setname_np(pthread_self(), namebuf); } #endif -#elif HAVE_PTHREAD_SET_NAME_NP +#elif defined(HAVE_PTHREAD_SET_NAME_NP) pthread_set_name_np(pthread_self(), name); #elif defined(__HAIKU__) /* The docs say the thread name can't be longer than B_OS_NAME_LENGTH. */ @@ -188,7 +188,7 @@ SDL_threadID SDL_ThreadID(void) int SDL_SYS_SetThreadPriority(SDL_ThreadPriority priority) { -#if __NACL__ || __RISCOS__ || __OS2__ +#if defined(__NACL__) || defined(__RISCOS__) || defined(__OS2__) /* FIXME: Setting thread priority does not seem to be supported in NACL */ return 0; #else @@ -246,7 +246,7 @@ int SDL_SYS_SetThreadPriority(SDL_ThreadPriority priority) policy = pri_policy; } -#if __LINUX__ +#ifdef __LINUX__ { pid_t linuxTid = syscall(SYS_gettid); return SDL_LinuxSetThreadPriorityAndPolicy(linuxTid, priority, policy); diff --git a/thirdparty/SDL/src/thread/pthread/SDL_systhread_c.h b/thirdparty/SDL/src/thread/pthread/SDL_systhread_c.h index bb842ad37..04dbb22bc 100644 --- a/thirdparty/SDL/src/thread/pthread/SDL_systhread_c.h +++ b/thirdparty/SDL/src/thread/pthread/SDL_systhread_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/thread/pthread/SDL_systls.c b/thirdparty/SDL/src/thread/pthread/SDL_systls.c index f0be2f840..6f9ad8c50 100644 --- a/thirdparty/SDL/src/thread/pthread/SDL_systls.c +++ b/thirdparty/SDL/src/thread/pthread/SDL_systls.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -30,27 +30,27 @@ static pthread_key_t thread_local_storage = INVALID_PTHREAD_KEY; static SDL_bool generic_local_storage = SDL_FALSE; -SDL_TLSData *SDL_SYS_GetTLSData(void) +void SDL_SYS_InitTLSData(void) { if (thread_local_storage == INVALID_PTHREAD_KEY && !generic_local_storage) { - static SDL_SpinLock lock; - SDL_AtomicLock(&lock); - if (thread_local_storage == INVALID_PTHREAD_KEY && !generic_local_storage) { - pthread_key_t storage; - if (pthread_key_create(&storage, NULL) == 0) { - SDL_MemoryBarrierRelease(); - thread_local_storage = storage; - } else { - generic_local_storage = SDL_TRUE; - } + if (pthread_key_create(&thread_local_storage, NULL) != 0) { + thread_local_storage = INVALID_PTHREAD_KEY; + SDL_Generic_InitTLSData(); + generic_local_storage = SDL_TRUE; } - SDL_AtomicUnlock(&lock); } +} + +SDL_TLSData *SDL_SYS_GetTLSData(void) +{ if (generic_local_storage) { return SDL_Generic_GetTLSData(); } - SDL_MemoryBarrierAcquire(); - return (SDL_TLSData *)pthread_getspecific(thread_local_storage); + + if (thread_local_storage != INVALID_PTHREAD_KEY) { + return (SDL_TLSData *)pthread_getspecific(thread_local_storage); + } + return NULL; } int SDL_SYS_SetTLSData(SDL_TLSData *data) @@ -58,10 +58,24 @@ int SDL_SYS_SetTLSData(SDL_TLSData *data) if (generic_local_storage) { return SDL_Generic_SetTLSData(data); } + if (pthread_setspecific(thread_local_storage, data) != 0) { return SDL_SetError("pthread_setspecific() failed"); } return 0; } +void SDL_SYS_QuitTLSData(void) +{ + if (generic_local_storage) { + SDL_Generic_QuitTLSData(); + generic_local_storage = SDL_FALSE; + } else { + if (thread_local_storage != INVALID_PTHREAD_KEY) { + pthread_key_delete(thread_local_storage); + thread_local_storage = INVALID_PTHREAD_KEY; + } + } +} + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/thirdparty/SDL/src/thread/stdcpp/SDL_syscond.cpp b/thirdparty/SDL/src/thread/stdcpp/SDL_syscond.cpp index ebd03cf4f..561d774ac 100644 --- a/thirdparty/SDL/src/thread/stdcpp/SDL_syscond.cpp +++ b/thirdparty/SDL/src/thread/stdcpp/SDL_syscond.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -57,7 +57,7 @@ SDL_CreateCond(void) extern "C" void SDL_DestroyCond(SDL_cond *cond) { - if (cond != NULL) { + if (cond) { delete cond; } } @@ -66,7 +66,7 @@ SDL_DestroyCond(SDL_cond *cond) extern "C" int SDL_CondSignal(SDL_cond *cond) { - if (cond == NULL) { + if (!cond) { return SDL_InvalidParamError("cond"); } @@ -78,7 +78,7 @@ SDL_CondSignal(SDL_cond *cond) extern "C" int SDL_CondBroadcast(SDL_cond *cond) { - if (cond == NULL) { + if (!cond) { return SDL_InvalidParamError("cond"); } diff --git a/thirdparty/SDL/src/thread/stdcpp/SDL_sysmutex.cpp b/thirdparty/SDL/src/thread/stdcpp/SDL_sysmutex.cpp index e74627b1a..bc04bed8d 100644 --- a/thirdparty/SDL/src/thread/stdcpp/SDL_sysmutex.cpp +++ b/thirdparty/SDL/src/thread/stdcpp/SDL_sysmutex.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -51,7 +51,7 @@ SDL_CreateMutex(void) extern "C" void SDL_DestroyMutex(SDL_mutex *mutex) { - if (mutex != NULL) { + if (mutex) { delete mutex; } } @@ -77,7 +77,7 @@ int SDL_TryLockMutex(SDL_mutex *mutex) { int retval = 0; - if (mutex == NULL) { + if (!mutex) { return 0; } diff --git a/thirdparty/SDL/src/thread/stdcpp/SDL_sysmutex_c.h b/thirdparty/SDL/src/thread/stdcpp/SDL_sysmutex_c.h index 9a117176f..dd53ee8a9 100644 --- a/thirdparty/SDL/src/thread/stdcpp/SDL_sysmutex_c.h +++ b/thirdparty/SDL/src/thread/stdcpp/SDL_sysmutex_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/thread/stdcpp/SDL_systhread.cpp b/thirdparty/SDL/src/thread/stdcpp/SDL_systhread.cpp index 49b91d264..502fabc45 100644 --- a/thirdparty/SDL/src/thread/stdcpp/SDL_systhread.cpp +++ b/thirdparty/SDL/src/thread/stdcpp/SDL_systhread.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -120,8 +120,12 @@ SDL_SYS_WaitThread(SDL_Thread *thread) try { std::thread *cpp_thread = (std::thread *)thread->handle; - if (cpp_thread->joinable()) { - cpp_thread->join(); + if (cpp_thread) { + if (cpp_thread->joinable()) { + cpp_thread->join(); + } + delete cpp_thread; + thread->handle = nullptr; } } catch (std::system_error &) { // An error occurred when joining the thread. SDL_WaitThread does not, @@ -139,8 +143,12 @@ SDL_SYS_DetachThread(SDL_Thread *thread) try { std::thread *cpp_thread = (std::thread *)thread->handle; - if (cpp_thread->joinable()) { - cpp_thread->detach(); + if (cpp_thread) { + if (cpp_thread->joinable()) { + cpp_thread->detach(); + } + delete cpp_thread; + thread->handle = nullptr; } } catch (std::system_error &) { // An error occurred when detaching the thread. SDL_DetachThread does not, @@ -149,16 +157,29 @@ SDL_SYS_DetachThread(SDL_Thread *thread) } } -extern "C" SDL_TLSData * -SDL_SYS_GetTLSData(void) +static thread_local SDL_TLSData *thread_local_storage; + +extern "C" +void SDL_SYS_InitTLSData(void) { - return SDL_Generic_GetTLSData(); } -extern "C" int -SDL_SYS_SetTLSData(SDL_TLSData *data) +extern "C" +SDL_TLSData * SDL_SYS_GetTLSData(void) +{ + return thread_local_storage; +} + +extern "C" +int SDL_SYS_SetTLSData(SDL_TLSData *data) +{ + thread_local_storage = data; + return 0; +} + +extern "C" +void SDL_SYS_QuitTLSData(void) { - return SDL_Generic_SetTLSData(data); } /* vi: set ts=4 sw=4 expandtab: */ diff --git a/thirdparty/SDL/src/thread/stdcpp/SDL_systhread_c.h b/thirdparty/SDL/src/thread/stdcpp/SDL_systhread_c.h index 14e0c74ed..5cf9d1186 100644 --- a/thirdparty/SDL/src/thread/stdcpp/SDL_systhread_c.h +++ b/thirdparty/SDL/src/thread/stdcpp/SDL_systhread_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/thread/vita/SDL_syscond.c b/thirdparty/SDL/src/thread/vita/SDL_syscond.c deleted file mode 100644 index 632756506..000000000 --- a/thirdparty/SDL/src/thread/vita/SDL_syscond.c +++ /dev/null @@ -1,218 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "../../SDL_internal.h" - -#if SDL_THREAD_VITA - -/* An implementation of condition variables using semaphores and mutexes */ -/* - This implementation borrows heavily from the BeOS condition variable - implementation, written by Christopher Tate and Owen Smith. Thanks! - */ - -#include "SDL_thread.h" - -struct SDL_cond -{ - SDL_mutex *lock; - int waiting; - int signals; - SDL_sem *wait_sem; - SDL_sem *wait_done; -}; - -/* Create a condition variable */ -SDL_cond *SDL_CreateCond(void) -{ - SDL_cond *cond; - - cond = (SDL_cond *)SDL_malloc(sizeof(SDL_cond)); - if (cond != NULL) { - cond->lock = SDL_CreateMutex(); - cond->wait_sem = SDL_CreateSemaphore(0); - cond->wait_done = SDL_CreateSemaphore(0); - cond->waiting = cond->signals = 0; - if (!cond->lock || !cond->wait_sem || !cond->wait_done) { - SDL_DestroyCond(cond); - cond = NULL; - } - } else { - SDL_OutOfMemory(); - } - return cond; -} - -/* Destroy a condition variable */ -void SDL_DestroyCond(SDL_cond *cond) -{ - if (cond != NULL) { - if (cond->wait_sem) { - SDL_DestroySemaphore(cond->wait_sem); - } - if (cond->wait_done) { - SDL_DestroySemaphore(cond->wait_done); - } - if (cond->lock) { - SDL_DestroyMutex(cond->lock); - } - SDL_free(cond); - } -} - -/* Restart one of the threads that are waiting on the condition variable */ -int SDL_CondSignal(SDL_cond *cond) -{ - if (cond == NULL) { - return SDL_InvalidParamError("cond"); - } - - /* If there are waiting threads not already signalled, then - signal the condition and wait for the thread to respond. - */ - SDL_LockMutex(cond->lock); - if (cond->waiting > cond->signals) { - ++cond->signals; - SDL_SemPost(cond->wait_sem); - SDL_UnlockMutex(cond->lock); - SDL_SemWait(cond->wait_done); - } else { - SDL_UnlockMutex(cond->lock); - } - - return 0; -} - -/* Restart all threads that are waiting on the condition variable */ -int SDL_CondBroadcast(SDL_cond *cond) -{ - if (cond == NULL) { - return SDL_InvalidParamError("cond"); - } - - /* If there are waiting threads not already signalled, then - signal the condition and wait for the thread to respond. - */ - SDL_LockMutex(cond->lock); - if (cond->waiting > cond->signals) { - int i, num_waiting; - - num_waiting = (cond->waiting - cond->signals); - cond->signals = cond->waiting; - for (i = 0; i < num_waiting; ++i) { - SDL_SemPost(cond->wait_sem); - } - /* Now all released threads are blocked here, waiting for us. - Collect them all (and win fabulous prizes!) :-) - */ - SDL_UnlockMutex(cond->lock); - for (i = 0; i < num_waiting; ++i) { - SDL_SemWait(cond->wait_done); - } - } else { - SDL_UnlockMutex(cond->lock); - } - - return 0; -} - -/* Wait on the condition variable for at most 'ms' milliseconds. - The mutex must be locked before entering this function! - The mutex is unlocked during the wait, and locked again after the wait. - -Typical use: - -Thread A: - SDL_LockMutex(lock); - while ( ! condition ) { - SDL_CondWait(cond, lock); - } - SDL_UnlockMutex(lock); - -Thread B: - SDL_LockMutex(lock); - ... - condition = true; - ... - SDL_CondSignal(cond); - SDL_UnlockMutex(lock); - */ -int SDL_CondWaitTimeout(SDL_cond *cond, SDL_mutex *mutex, Uint32 ms) -{ - int retval; - - if (cond == NULL) { - return SDL_InvalidParamError("cond"); - } - - /* Obtain the protection mutex, and increment the number of waiters. - This allows the signal mechanism to only perform a signal if there - are waiting threads. - */ - SDL_LockMutex(cond->lock); - ++cond->waiting; - SDL_UnlockMutex(cond->lock); - - /* Unlock the mutex, as is required by condition variable semantics */ - SDL_UnlockMutex(mutex); - - /* Wait for a signal */ - if (ms == SDL_MUTEX_MAXWAIT) { - retval = SDL_SemWait(cond->wait_sem); - } else { - retval = SDL_SemWaitTimeout(cond->wait_sem, ms); - } - - /* Let the signaler know we have completed the wait, otherwise - the signaler can race ahead and get the condition semaphore - if we are stopped between the mutex unlock and semaphore wait, - giving a deadlock. See the following URL for details: - http://www-classic.be.com/aboutbe/benewsletter/volume_III/Issue40.html - */ - SDL_LockMutex(cond->lock); - if (cond->signals > 0) { - /* If we timed out, we need to eat a condition signal */ - if (retval > 0) { - SDL_SemWait(cond->wait_sem); - } - /* We always notify the signal thread that we are done */ - SDL_SemPost(cond->wait_done); - - /* Signal handshake complete */ - --cond->signals; - } - --cond->waiting; - SDL_UnlockMutex(cond->lock); - - /* Lock the mutex, as is required by condition variable semantics */ - SDL_LockMutex(mutex); - - return retval; -} - -/* Wait on the condition variable forever */ -int SDL_CondWait(SDL_cond *cond, SDL_mutex *mutex) -{ - return SDL_CondWaitTimeout(cond, mutex, SDL_MUTEX_MAXWAIT); -} - -#endif /* SDL_THREAD_VITA */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/thirdparty/SDL/src/thread/vita/SDL_sysmutex.c b/thirdparty/SDL/src/thread/vita/SDL_sysmutex.c index 232ae0479..b0301453a 100644 --- a/thirdparty/SDL/src/thread/vita/SDL_sysmutex.c +++ b/thirdparty/SDL/src/thread/vita/SDL_sysmutex.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_THREAD_VITA +#ifdef SDL_THREAD_VITA #include "SDL_thread.h" #include "SDL_systhread_c.h" @@ -41,7 +41,7 @@ SDL_mutex *SDL_CreateMutex(void) /* Allocate mutex memory */ mutex = (SDL_mutex *)SDL_malloc(sizeof(*mutex)); - if (mutex != NULL) { + if (mutex) { res = sceKernelCreateLwMutex( &mutex->lock, @@ -62,7 +62,7 @@ SDL_mutex *SDL_CreateMutex(void) /* Free the mutex */ void SDL_DestroyMutex(SDL_mutex *mutex) { - if (mutex != NULL) { + if (mutex) { sceKernelDeleteLwMutex(&mutex->lock); SDL_free(mutex); } @@ -71,12 +71,12 @@ void SDL_DestroyMutex(SDL_mutex *mutex) /* Lock the mutex */ int SDL_LockMutex(SDL_mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn't know about NULL mutexes */ { -#if SDL_THREADS_DISABLED +#ifdef SDL_THREADS_DISABLED return 0; #else SceInt32 res = 0; - if (mutex == NULL) { + if (!mutex) { return 0; } @@ -92,12 +92,12 @@ int SDL_LockMutex(SDL_mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn /* Try to lock the mutex */ int SDL_TryLockMutex(SDL_mutex *mutex) { -#if SDL_THREADS_DISABLED +#ifdef SDL_THREADS_DISABLED return 0; #else SceInt32 res = 0; - if (mutex == NULL) { + if (!mutex) { return 0; } @@ -121,7 +121,7 @@ int SDL_TryLockMutex(SDL_mutex *mutex) /* Unlock the mutex */ int SDL_UnlockMutex(SDL_mutex *mutex) SDL_NO_THREAD_SAFETY_ANALYSIS /* clang doesn't know about NULL mutexes */ { -#if SDL_THREADS_DISABLED +#ifdef SDL_THREADS_DISABLED return 0; #else SceInt32 res = 0; diff --git a/thirdparty/SDL/src/thread/vita/SDL_sysmutex_c.h b/thirdparty/SDL/src/thread/vita/SDL_sysmutex_c.h index aa0fe19e1..46b7996b7 100644 --- a/thirdparty/SDL/src/thread/vita/SDL_sysmutex_c.h +++ b/thirdparty/SDL/src/thread/vita/SDL_sysmutex_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/thread/vita/SDL_syssem.c b/thirdparty/SDL/src/thread/vita/SDL_syssem.c index 453afa924..0149ec39d 100644 --- a/thirdparty/SDL/src/thread/vita/SDL_syssem.c +++ b/thirdparty/SDL/src/thread/vita/SDL_syssem.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_THREAD_VITA +#ifdef SDL_THREAD_VITA /* Semaphore functions for the VITA. */ @@ -45,7 +45,7 @@ SDL_sem *SDL_CreateSemaphore(Uint32 initial_value) SDL_sem *sem; sem = (SDL_sem *)SDL_malloc(sizeof(*sem)); - if (sem != NULL) { + if (sem) { /* TODO: Figure out the limit on the maximum value. */ sem->semid = sceKernelCreateSema("SDL sema", 0, initial_value, 255, NULL); if (sem->semid < 0) { @@ -63,7 +63,7 @@ SDL_sem *SDL_CreateSemaphore(Uint32 initial_value) /* Free the semaphore */ void SDL_DestroySemaphore(SDL_sem *sem) { - if (sem != NULL) { + if (sem) { if (sem->semid > 0) { sceKernelDeleteSema(sem->semid); sem->semid = 0; @@ -82,7 +82,7 @@ int SDL_SemWaitTimeout(SDL_sem *sem, Uint32 timeout) Uint32 *pTimeout; int res; - if (sem == NULL) { + if (!sem) { return SDL_InvalidParamError("sem"); } @@ -128,7 +128,7 @@ Uint32 SDL_SemValue(SDL_sem *sem) SceKernelSemaInfo info; info.size = sizeof(info); - if (sem == NULL) { + if (!sem) { SDL_InvalidParamError("sem"); return 0; } @@ -144,7 +144,7 @@ int SDL_SemPost(SDL_sem *sem) { int res; - if (sem == NULL) { + if (!sem) { return SDL_InvalidParamError("sem"); } diff --git a/thirdparty/SDL/src/thread/vita/SDL_systhread.c b/thirdparty/SDL/src/thread/vita/SDL_systhread.c index 31f7ab0a8..5e531b6b5 100644 --- a/thirdparty/SDL/src/thread/vita/SDL_systhread.c +++ b/thirdparty/SDL/src/thread/vita/SDL_systhread.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_THREAD_VITA +#ifdef SDL_THREAD_VITA /* VITA thread management routines for SDL */ diff --git a/thirdparty/SDL/src/thread/vita/SDL_systhread_c.h b/thirdparty/SDL/src/thread/vita/SDL_systhread_c.h index 8b84e5fb5..7419b1e0c 100644 --- a/thirdparty/SDL/src/thread/vita/SDL_systhread_c.h +++ b/thirdparty/SDL/src/thread/vita/SDL_systhread_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/thread/windows/SDL_syscond_cv.c b/thirdparty/SDL/src/thread/windows/SDL_syscond_cv.c index 905d416b8..b532231a5 100644 --- a/thirdparty/SDL/src/thread/windows/SDL_syscond_cv.c +++ b/thirdparty/SDL/src/thread/windows/SDL_syscond_cv.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -61,7 +61,7 @@ typedef struct CONDITION_VARIABLE } CONDITION_VARIABLE, *PCONDITION_VARIABLE; #endif -#if __WINRT__ +#ifdef __WINRT__ #define pWakeConditionVariable WakeConditionVariable #define pWakeAllConditionVariable WakeAllConditionVariable #define pSleepConditionVariableSRW SleepConditionVariableSRW @@ -89,7 +89,7 @@ static SDL_cond *SDL_CreateCond_cv(void) /* Relies on CONDITION_VARIABLE_INIT == 0. */ cond = (SDL_cond_cv *)SDL_calloc(1, sizeof(*cond)); - if (cond == NULL) { + if (!cond) { SDL_OutOfMemory(); } @@ -98,7 +98,7 @@ static SDL_cond *SDL_CreateCond_cv(void) static void SDL_DestroyCond_cv(SDL_cond *cond) { - if (cond != NULL) { + if (cond) { /* There are no kernel allocated resources */ SDL_free(cond); } @@ -107,7 +107,7 @@ static void SDL_DestroyCond_cv(SDL_cond *cond) static int SDL_CondSignal_cv(SDL_cond *_cond) { SDL_cond_cv *cond = (SDL_cond_cv *)_cond; - if (cond == NULL) { + if (!cond) { return SDL_InvalidParamError("cond"); } @@ -119,7 +119,7 @@ static int SDL_CondSignal_cv(SDL_cond *_cond) static int SDL_CondBroadcast_cv(SDL_cond *_cond) { SDL_cond_cv *cond = (SDL_cond_cv *)_cond; - if (cond == NULL) { + if (!cond) { return SDL_InvalidParamError("cond"); } @@ -134,10 +134,10 @@ static int SDL_CondWaitTimeout_cv(SDL_cond *_cond, SDL_mutex *_mutex, Uint32 ms) DWORD timeout; int ret; - if (cond == NULL) { + if (!cond) { return SDL_InvalidParamError("cond"); } - if (_mutex == NULL) { + if (!_mutex) { return SDL_InvalidParamError("mutex"); } @@ -220,14 +220,14 @@ static const SDL_cond_impl_t SDL_cond_impl_generic = { SDL_cond *SDL_CreateCond(void) { - if (SDL_cond_impl_active.Create == NULL) { + if (!SDL_cond_impl_active.Create) { /* Default to generic implementation, works with all mutex implementations */ const SDL_cond_impl_t *impl = &SDL_cond_impl_generic; if (SDL_mutex_impl_active.Type == SDL_MUTEX_INVALID) { /* The mutex implementation isn't decided yet, trigger it */ SDL_mutex *mutex = SDL_CreateMutex(); - if (mutex == NULL) { + if (!mutex) { return NULL; } SDL_DestroyMutex(mutex); @@ -235,7 +235,7 @@ SDL_cond *SDL_CreateCond(void) SDL_assert(SDL_mutex_impl_active.Type != SDL_MUTEX_INVALID); } -#if __WINRT__ +#ifdef __WINRT__ /* Link statically on this platform */ impl = &SDL_cond_impl_cv; #else diff --git a/thirdparty/SDL/src/thread/windows/SDL_sysmutex.c b/thirdparty/SDL/src/thread/windows/SDL_sysmutex.c index 6091819f8..71cdac94c 100644 --- a/thirdparty/SDL/src/thread/windows/SDL_sysmutex.c +++ b/thirdparty/SDL/src/thread/windows/SDL_sysmutex.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_THREAD_WINDOWS +#ifdef SDL_THREAD_WINDOWS /** * Mutex functions using the Win32 API @@ -42,7 +42,7 @@ SDL_mutex_impl_t SDL_mutex_impl_active = { 0 }; * Implementation based on Slim Reader/Writer (SRW) Locks for Win 7 and newer. */ -#if __WINRT__ +#ifdef __WINRT__ /* Functions are guaranteed to be available */ #define pReleaseSRWLockExclusive ReleaseSRWLockExclusive #define pAcquireSRWLockExclusive AcquireSRWLockExclusive @@ -62,7 +62,7 @@ static SDL_mutex *SDL_CreateMutex_srw(void) /* Relies on SRWLOCK_INIT == 0. */ mutex = (SDL_mutex_srw *)SDL_calloc(1, sizeof(*mutex)); - if (mutex == NULL) { + if (!mutex) { SDL_OutOfMemory(); } @@ -153,10 +153,10 @@ static SDL_mutex *SDL_CreateMutex_cs(void) /* Allocate mutex memory */ mutex = (SDL_mutex_cs *)SDL_malloc(sizeof(*mutex)); - if (mutex != NULL) { + if (mutex) { /* Initialize */ /* On SMP systems, a non-zero spin count generally helps performance */ -#if __WINRT__ +#ifdef __WINRT__ InitializeCriticalSectionEx(&mutex->cs, 2000, 0); #else InitializeCriticalSectionAndSpinCount(&mutex->cs, 2000); @@ -221,12 +221,12 @@ static const SDL_mutex_impl_t SDL_mutex_impl_cs = { SDL_mutex *SDL_CreateMutex(void) { - if (SDL_mutex_impl_active.Create == NULL) { + if (!SDL_mutex_impl_active.Create) { /* Default to fallback implementation */ const SDL_mutex_impl_t *impl = &SDL_mutex_impl_cs; if (!SDL_GetHintBoolean(SDL_HINT_WINDOWS_FORCE_MUTEX_CRITICAL_SECTIONS, SDL_FALSE)) { -#if __WINRT__ +#ifdef __WINRT__ /* Link statically on this platform */ impl = &SDL_mutex_impl_srw; #else @@ -260,7 +260,7 @@ void SDL_DestroyMutex(SDL_mutex *mutex) int SDL_LockMutex(SDL_mutex *mutex) { - if (mutex == NULL) { + if (!mutex) { return 0; } @@ -269,7 +269,7 @@ int SDL_LockMutex(SDL_mutex *mutex) int SDL_TryLockMutex(SDL_mutex *mutex) { - if (mutex == NULL) { + if (!mutex) { return 0; } @@ -278,7 +278,7 @@ int SDL_TryLockMutex(SDL_mutex *mutex) int SDL_UnlockMutex(SDL_mutex *mutex) { - if (mutex == NULL) { + if (!mutex) { return 0; } diff --git a/thirdparty/SDL/src/thread/windows/SDL_sysmutex_c.h b/thirdparty/SDL/src/thread/windows/SDL_sysmutex_c.h index c5f28d07e..6a0f45fa1 100644 --- a/thirdparty/SDL/src/thread/windows/SDL_sysmutex_c.h +++ b/thirdparty/SDL/src/thread/windows/SDL_sysmutex_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/thread/windows/SDL_syssem.c b/thirdparty/SDL/src/thread/windows/SDL_syssem.c index 6853549b6..4c59fc1dc 100644 --- a/thirdparty/SDL/src/thread/windows/SDL_syssem.c +++ b/thirdparty/SDL/src/thread/windows/SDL_syssem.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_THREAD_WINDOWS +#ifdef SDL_THREAD_WINDOWS /** * Semaphore functions using the Win32 API @@ -68,14 +68,8 @@ static SDL_sem_impl_t SDL_sem_impl_active = { 0 }; /* APIs not available on WinPhone 8.1 */ /* https://www.microsoft.com/en-us/download/details.aspx?id=47328 */ -#if (HAVE_WINAPIFAMILY_H) && defined(WINAPI_FAMILY_PHONE_APP) -#define SDL_WINAPI_FAMILY_PHONE (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) -#else -#define SDL_WINAPI_FAMILY_PHONE 0 -#endif - #if !SDL_WINAPI_FAMILY_PHONE -#if __WINRT__ +#ifdef __WINRT__ /* Functions are guaranteed to be available */ #define pWaitOnAddress WaitOnAddress #define pWakeByAddressSingle WakeByAddressSingle @@ -97,7 +91,7 @@ static SDL_sem *SDL_CreateSemaphore_atom(Uint32 initial_value) SDL_sem_atom *sem; sem = (SDL_sem_atom *)SDL_malloc(sizeof(*sem)); - if (sem != NULL) { + if (sem) { sem->count = initial_value; } else { SDL_OutOfMemory(); @@ -107,7 +101,7 @@ static SDL_sem *SDL_CreateSemaphore_atom(Uint32 initial_value) static void SDL_DestroySemaphore_atom(SDL_sem *sem) { - if (sem != NULL) { + if (sem) { SDL_free(sem); } } @@ -117,7 +111,7 @@ static int SDL_SemTryWait_atom(SDL_sem *_sem) SDL_sem_atom *sem = (SDL_sem_atom *)_sem; LONG count; - if (sem == NULL) { + if (!sem) { return SDL_InvalidParamError("sem"); } @@ -138,7 +132,7 @@ static int SDL_SemWait_atom(SDL_sem *_sem) SDL_sem_atom *sem = (SDL_sem_atom *)_sem; LONG count; - if (sem == NULL) { + if (!sem) { return SDL_InvalidParamError("sem"); } @@ -169,7 +163,7 @@ static int SDL_SemWaitTimeout_atom(SDL_sem *_sem, Uint32 timeout) return SDL_SemWait_atom(_sem); } - if (sem == NULL) { + if (!sem) { return SDL_InvalidParamError("sem"); } @@ -211,7 +205,7 @@ static Uint32 SDL_SemValue_atom(SDL_sem *_sem) { SDL_sem_atom *sem = (SDL_sem_atom *)_sem; - if (sem == NULL) { + if (!sem) { SDL_InvalidParamError("sem"); return 0; } @@ -223,7 +217,7 @@ static int SDL_SemPost_atom(SDL_sem *_sem) { SDL_sem_atom *sem = (SDL_sem_atom *)_sem; - if (sem == NULL) { + if (!sem) { return SDL_InvalidParamError("sem"); } @@ -261,9 +255,9 @@ static SDL_sem *SDL_CreateSemaphore_kern(Uint32 initial_value) /* Allocate sem memory */ sem = (SDL_sem_kern *)SDL_malloc(sizeof(*sem)); - if (sem != NULL) { + if (sem) { /* Create the semaphore, with max value 32K */ -#if __WINRT__ +#ifdef __WINRT__ sem->id = CreateSemaphoreEx(NULL, initial_value, 32 * 1024, NULL, 0, SEMAPHORE_ALL_ACCESS); #else sem->id = CreateSemaphore(NULL, initial_value, 32 * 1024, NULL); @@ -284,7 +278,7 @@ static SDL_sem *SDL_CreateSemaphore_kern(Uint32 initial_value) static void SDL_DestroySemaphore_kern(SDL_sem *_sem) { SDL_sem_kern *sem = (SDL_sem_kern *)_sem; - if (sem != NULL) { + if (sem) { if (sem->id) { CloseHandle(sem->id); sem->id = 0; @@ -299,7 +293,7 @@ static int SDL_SemWaitTimeout_kern(SDL_sem *_sem, Uint32 timeout) int retval; DWORD dwMilliseconds; - if (sem == NULL) { + if (!sem) { return SDL_InvalidParamError("sem"); } @@ -337,7 +331,7 @@ static int SDL_SemWait_kern(SDL_sem *sem) static Uint32 SDL_SemValue_kern(SDL_sem *_sem) { SDL_sem_kern *sem = (SDL_sem_kern *)_sem; - if (sem == NULL) { + if (!sem) { SDL_InvalidParamError("sem"); return 0; } @@ -347,7 +341,7 @@ static Uint32 SDL_SemValue_kern(SDL_sem *_sem) static int SDL_SemPost_kern(SDL_sem *_sem) { SDL_sem_kern *sem = (SDL_sem_kern *)_sem; - if (sem == NULL) { + if (!sem) { return SDL_InvalidParamError("sem"); } /* Increase the counter in the first place, because @@ -379,13 +373,13 @@ static const SDL_sem_impl_t SDL_sem_impl_kern = { SDL_sem *SDL_CreateSemaphore(Uint32 initial_value) { - if (SDL_sem_impl_active.Create == NULL) { + if (!SDL_sem_impl_active.Create) { /* Default to fallback implementation */ const SDL_sem_impl_t *impl = &SDL_sem_impl_kern; #if !SDL_WINAPI_FAMILY_PHONE if (!SDL_GetHintBoolean(SDL_HINT_WINDOWS_FORCE_SEMAPHORE_KERNEL, SDL_FALSE)) { -#if __WINRT__ +#ifdef __WINRT__ /* Link statically on this platform */ impl = &SDL_sem_impl_atom; #else diff --git a/thirdparty/SDL/src/thread/windows/SDL_systhread.c b/thirdparty/SDL/src/thread/windows/SDL_systhread.c index b55eb1326..974759b7c 100644 --- a/thirdparty/SDL/src/thread/windows/SDL_systhread.c +++ b/thirdparty/SDL/src/thread/windows/SDL_systhread.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_THREAD_WINDOWS +#ifdef SDL_THREAD_WINDOWS /* Win32 thread management routines for SDL */ @@ -49,7 +49,7 @@ static DWORD RunThread(void *data) SDL_Thread *thread = (SDL_Thread *)data; pfnSDL_CurrentEndThread pfnEndThread = (pfnSDL_CurrentEndThread)thread->endfunc; SDL_RunThread(thread); - if (pfnEndThread != NULL) { + if (pfnEndThread) { pfnEndThread(0); } return 0; @@ -98,7 +98,7 @@ int SDL_SYS_CreateThread(SDL_Thread *thread) RunThreadViaCreateThread, thread, flags, &threadid); } - if (thread->handle == NULL) { + if (!thread->handle) { return SDL_SetError("Not enough resources to create thread"); } return 0; @@ -118,7 +118,7 @@ typedef HRESULT(WINAPI *pfnSetThreadDescription)(HANDLE, PCWSTR); void SDL_SYS_SetupThread(const char *name) { - if (name != NULL) { + if (name) { #ifndef __WINRT__ /* !!! FIXME: There's no LoadLibrary() in WinRT; don't know if SetThreadDescription is available there at all at the moment. */ static pfnSetThreadDescription pSetThreadDescription = NULL; static HMODULE kernel32 = NULL; @@ -130,7 +130,7 @@ void SDL_SYS_SetupThread(const char *name) } } - if (pSetThreadDescription != NULL) { + if (pSetThreadDescription) { WCHAR *strw = WIN_UTF8ToStringW(name); if (strw) { pSetThreadDescription(GetCurrentThread(), strw); diff --git a/thirdparty/SDL/src/thread/windows/SDL_systhread_c.h b/thirdparty/SDL/src/thread/windows/SDL_systhread_c.h index f69d2dec7..ae6978b1c 100644 --- a/thirdparty/SDL/src/thread/windows/SDL_systhread_c.h +++ b/thirdparty/SDL/src/thread/windows/SDL_systhread_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/thread/windows/SDL_systls.c b/thirdparty/SDL/src/thread/windows/SDL_systls.c index b4be434fd..08a9cfbe9 100644 --- a/thirdparty/SDL/src/thread/windows/SDL_systls.c +++ b/thirdparty/SDL/src/thread/windows/SDL_systls.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,7 +21,7 @@ #include "../../SDL_internal.h" -#if SDL_THREAD_WINDOWS +#ifdef SDL_THREAD_WINDOWS #include "../../core/windows/SDL_windows.h" @@ -43,27 +43,27 @@ static DWORD thread_local_storage = TLS_OUT_OF_INDEXES; static SDL_bool generic_local_storage = SDL_FALSE; -SDL_TLSData *SDL_SYS_GetTLSData(void) +void SDL_SYS_InitTLSData(void) { if (thread_local_storage == TLS_OUT_OF_INDEXES && !generic_local_storage) { - static SDL_SpinLock lock; - SDL_AtomicLock(&lock); - if (thread_local_storage == TLS_OUT_OF_INDEXES && !generic_local_storage) { - DWORD storage = TlsAlloc(); - if (storage != TLS_OUT_OF_INDEXES) { - SDL_MemoryBarrierRelease(); - thread_local_storage = storage; - } else { - generic_local_storage = SDL_TRUE; - } + thread_local_storage = TlsAlloc(); + if (thread_local_storage == TLS_OUT_OF_INDEXES) { + SDL_Generic_InitTLSData(); + generic_local_storage = SDL_TRUE; } - SDL_AtomicUnlock(&lock); } +} + +SDL_TLSData *SDL_SYS_GetTLSData(void) +{ if (generic_local_storage) { return SDL_Generic_GetTLSData(); } - SDL_MemoryBarrierAcquire(); - return (SDL_TLSData *)TlsGetValue(thread_local_storage); + + if (thread_local_storage != TLS_OUT_OF_INDEXES) { + return (SDL_TLSData *)TlsGetValue(thread_local_storage); + } + return NULL; } int SDL_SYS_SetTLSData(SDL_TLSData *data) @@ -71,12 +71,26 @@ int SDL_SYS_SetTLSData(SDL_TLSData *data) if (generic_local_storage) { return SDL_Generic_SetTLSData(data); } + if (!TlsSetValue(thread_local_storage, data)) { - return SDL_SetError("TlsSetValue() failed"); + return WIN_SetError("TlsSetValue()"); } return 0; } +void SDL_SYS_QuitTLSData(void) +{ + if (generic_local_storage) { + SDL_Generic_QuitTLSData(); + generic_local_storage = SDL_FALSE; + } else { + if (thread_local_storage != TLS_OUT_OF_INDEXES) { + TlsFree(thread_local_storage); + thread_local_storage = TLS_OUT_OF_INDEXES; + } + } +} + #endif /* SDL_THREAD_WINDOWS */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/thirdparty/SDL/src/timer/SDL_timer.c b/thirdparty/SDL/src/timer/SDL_timer.c index 874f15462..8cba8087f 100644 --- a/thirdparty/SDL/src/timer/SDL_timer.c +++ b/thirdparty/SDL/src/timer/SDL_timer.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -28,7 +28,7 @@ /* #define DEBUG_TIMERS */ -#if !defined(__EMSCRIPTEN__) || !SDL_THREADS_DISABLED +#if !defined(__EMSCRIPTEN__) || !defined(SDL_THREADS_DISABLED) typedef struct _SDL_Timer { @@ -173,7 +173,7 @@ static int SDLCALL SDL_TimerThread(void *_data) current->scheduled = tick + interval; SDL_AddTimerInternal(data, current); } else { - if (freelist_head == NULL) { + if (!freelist_head) { freelist_head = current; } if (freelist_tail) { @@ -298,7 +298,7 @@ SDL_TimerID SDL_AddTimer(Uint32 interval, SDL_TimerCallback callback, void *para SDL_RemoveTimer(timer->timerID); } else { timer = (SDL_Timer *)SDL_malloc(sizeof(*timer)); - if (timer == NULL) { + if (!timer) { SDL_OutOfMemory(); return 0; } @@ -311,7 +311,7 @@ SDL_TimerID SDL_AddTimer(Uint32 interval, SDL_TimerCallback callback, void *para SDL_AtomicSet(&timer->canceled, 0); entry = (SDL_TimerMap *)SDL_malloc(sizeof(*entry)); - if (entry == NULL) { + if (!entry) { SDL_free(timer); SDL_OutOfMemory(); return 0; @@ -424,7 +424,7 @@ SDL_TimerID SDL_AddTimer(Uint32 interval, SDL_TimerCallback callback, void *para SDL_TimerMap *entry; entry = (SDL_TimerMap *)SDL_malloc(sizeof(*entry)); - if (entry == NULL) { + if (!entry) { SDL_OutOfMemory(); return 0; } diff --git a/thirdparty/SDL/src/timer/SDL_timer_c.h b/thirdparty/SDL/src/timer/SDL_timer_c.h index c6de56843..f5c1e43ad 100644 --- a/thirdparty/SDL/src/timer/SDL_timer_c.h +++ b/thirdparty/SDL/src/timer/SDL_timer_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/timer/dummy/SDL_systimer.c b/thirdparty/SDL/src/timer/dummy/SDL_systimer.c index 8b3235792..ecc31ad69 100644 --- a/thirdparty/SDL/src/timer/dummy/SDL_systimer.c +++ b/thirdparty/SDL/src/timer/dummy/SDL_systimer.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/timer/haiku/SDL_systimer.c b/thirdparty/SDL/src/timer/haiku/SDL_systimer.c index 1c2970bb4..8b038b565 100644 --- a/thirdparty/SDL/src/timer/haiku/SDL_systimer.c +++ b/thirdparty/SDL/src/timer/haiku/SDL_systimer.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/timer/n3ds/SDL_systimer.c b/thirdparty/SDL/src/timer/n3ds/SDL_systimer.c index 2a9c38b8c..047b004de 100644 --- a/thirdparty/SDL/src/timer/n3ds/SDL_systimer.c +++ b/thirdparty/SDL/src/timer/n3ds/SDL_systimer.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/timer/ngage/SDL_systimer.cpp b/thirdparty/SDL/src/timer/ngage/SDL_systimer.cpp index e2a45ce50..4ddf76f0a 100644 --- a/thirdparty/SDL/src/timer/ngage/SDL_systimer.cpp +++ b/thirdparty/SDL/src/timer/ngage/SDL_systimer.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/timer/os2/SDL_systimer.c b/thirdparty/SDL/src/timer/os2/SDL_systimer.c index 0828300ab..f558855bd 100644 --- a/thirdparty/SDL/src/timer/os2/SDL_systimer.c +++ b/thirdparty/SDL/src/timer/os2/SDL_systimer.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_TIMER_OS2 +#ifdef SDL_TIMER_OS2 #include "SDL_timer.h" #include "../../core/os2/SDL_os2.h" diff --git a/thirdparty/SDL/src/timer/ps2/SDL_systimer.c b/thirdparty/SDL/src/timer/ps2/SDL_systimer.c index 910f7a675..720f696d9 100644 --- a/thirdparty/SDL/src/timer/ps2/SDL_systimer.c +++ b/thirdparty/SDL/src/timer/ps2/SDL_systimer.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/timer/psp/SDL_systimer.c b/thirdparty/SDL/src/timer/psp/SDL_systimer.c index 5337c771f..c69598e44 100644 --- a/thirdparty/SDL/src/timer/psp/SDL_systimer.c +++ b/thirdparty/SDL/src/timer/psp/SDL_systimer.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/timer/unix/SDL_systimer.c b/thirdparty/SDL/src/timer/unix/SDL_systimer.c index 5fe367e13..a697b7117 100644 --- a/thirdparty/SDL/src/timer/unix/SDL_systimer.c +++ b/thirdparty/SDL/src/timer/unix/SDL_systimer.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -46,7 +46,7 @@ Also added OS X Monotonic clock support Based on work in https://github.com/ThomasHabets/monotonic_clock */ -#if HAVE_NANOSLEEP || HAVE_CLOCK_GETTIME +#if defined(HAVE_NANOSLEEP) || defined(HAVE_CLOCK_GETTIME) #include #endif #ifdef __APPLE__ @@ -54,7 +54,7 @@ #endif /* Use CLOCK_MONOTONIC_RAW, if available, which is not subject to adjustment by NTP */ -#if HAVE_CLOCK_GETTIME +#ifdef HAVE_CLOCK_GETTIME #ifdef CLOCK_MONOTONIC_RAW #define SDL_MONOTONIC_CLOCK CLOCK_MONOTONIC_RAW #else @@ -63,7 +63,7 @@ #endif /* The first ticks value of the application */ -#if HAVE_CLOCK_GETTIME +#ifdef HAVE_CLOCK_GETTIME static struct timespec start_ts; #elif defined(__APPLE__) static uint64_t start_mach; @@ -81,7 +81,7 @@ void SDL_TicksInit(void) ticks_started = SDL_TRUE; /* Set first ticks value */ -#if HAVE_CLOCK_GETTIME +#ifdef HAVE_CLOCK_GETTIME if (clock_gettime(SDL_MONOTONIC_CLOCK, &start_ts) == 0) { has_monotonic_time = SDL_TRUE; } else @@ -108,7 +108,7 @@ Uint64 SDL_GetTicks64(void) } if (has_monotonic_time) { -#if HAVE_CLOCK_GETTIME +#ifdef HAVE_CLOCK_GETTIME struct timespec now; clock_gettime(SDL_MONOTONIC_CLOCK, &now); return (Uint64)(((Sint64)(now.tv_sec - start_ts.tv_sec) * 1000) + ((now.tv_nsec - start_ts.tv_nsec) / 1000000)); @@ -134,7 +134,7 @@ Uint64 SDL_GetPerformanceCounter(void) } if (has_monotonic_time) { -#if HAVE_CLOCK_GETTIME +#ifdef HAVE_CLOCK_GETTIME struct timespec now; clock_gettime(SDL_MONOTONIC_CLOCK, &now); @@ -165,7 +165,7 @@ Uint64 SDL_GetPerformanceFrequency(void) } if (has_monotonic_time) { -#if HAVE_CLOCK_GETTIME +#ifdef HAVE_CLOCK_GETTIME return 1000000000; #elif defined(__APPLE__) Uint64 freq = mach_base_info.denom; @@ -182,7 +182,7 @@ void SDL_Delay(Uint32 ms) { int was_error; -#if HAVE_NANOSLEEP +#ifdef HAVE_NANOSLEEP struct timespec elapsed, tv; #else struct timeval tv; @@ -198,7 +198,7 @@ void SDL_Delay(Uint32 ms) #endif /* Set the timeout interval */ -#if HAVE_NANOSLEEP +#ifdef HAVE_NANOSLEEP elapsed.tv_sec = ms / 1000; elapsed.tv_nsec = (ms % 1000) * 1000000; #else @@ -207,7 +207,7 @@ void SDL_Delay(Uint32 ms) do { errno = 0; -#if HAVE_NANOSLEEP +#ifdef HAVE_NANOSLEEP tv.tv_sec = elapsed.tv_sec; tv.tv_nsec = elapsed.tv_nsec; was_error = nanosleep(&tv, &elapsed); diff --git a/thirdparty/SDL/src/timer/vita/SDL_systimer.c b/thirdparty/SDL/src/timer/vita/SDL_systimer.c index f954bb747..d5ccabcab 100644 --- a/thirdparty/SDL/src/timer/vita/SDL_systimer.c +++ b/thirdparty/SDL/src/timer/vita/SDL_systimer.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/timer/windows/SDL_systimer.c b/thirdparty/SDL/src/timer/windows/SDL_systimer.c index e51c891d7..e7c2c78fe 100644 --- a/thirdparty/SDL/src/timer/windows/SDL_systimer.c +++ b/thirdparty/SDL/src/timer/windows/SDL_systimer.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/SDL_RLEaccel.c b/thirdparty/SDL/src/video/SDL_RLEaccel.c index 9f861ebac..a007984fc 100644 --- a/thirdparty/SDL/src/video/SDL_RLEaccel.c +++ b/thirdparty/SDL/src/video/SDL_RLEaccel.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -1024,7 +1024,7 @@ static int RLEAlphaSurface(SDL_Surface *surface) SDL_PixelFormat *, SDL_PixelFormat *); dest = surface->map->dst; - if (dest == NULL) { + if (!dest) { return -1; } df = dest->format; @@ -1081,7 +1081,7 @@ static int RLEAlphaSurface(SDL_Surface *surface) maxsize += sizeof(RLEDestFormat); rlebuf = (Uint8 *)SDL_malloc(maxsize); - if (rlebuf == NULL) { + if (!rlebuf) { return SDL_OutOfMemory(); } { @@ -1227,7 +1227,7 @@ static int RLEAlphaSurface(SDL_Surface *surface) /* reallocate the buffer to release unused memory */ { Uint8 *p = SDL_realloc(rlebuf, dst - rlebuf); - if (p == NULL) { + if (!p) { p = rlebuf; } surface->map->data = p; @@ -1300,7 +1300,7 @@ static int RLEColorkeySurface(SDL_Surface *surface) } rlebuf = (Uint8 *)SDL_malloc(maxsize); - if (rlebuf == NULL) { + if (!rlebuf) { return SDL_OutOfMemory(); } @@ -1395,7 +1395,7 @@ static int RLEColorkeySurface(SDL_Surface *surface) { /* If SDL_realloc returns NULL, the original block is left intact */ Uint8 *p = SDL_realloc(rlebuf, dst - rlebuf); - if (p == NULL) { + if (!p) { p = rlebuf; } surface->map->data = p; @@ -1492,7 +1492,7 @@ static SDL_bool UnRLEAlpha(SDL_Surface *surface) } surface->pixels = SDL_SIMDAlloc((size_t)surface->h * surface->pitch); - if (surface->pixels == NULL) { + if (!surface->pixels) { return SDL_FALSE; } surface->flags |= SDL_SIMD_ALIGNED; @@ -1558,7 +1558,7 @@ void SDL_UnRLESurface(SDL_Surface *surface, int recode) /* re-create the original surface */ surface->pixels = SDL_SIMDAlloc((size_t)surface->h * surface->pitch); - if (surface->pixels == NULL) { + if (!surface->pixels) { /* Oh crap... */ surface->flags |= SDL_RLEACCEL; return; diff --git a/thirdparty/SDL/src/video/SDL_RLEaccel_c.h b/thirdparty/SDL/src/video/SDL_RLEaccel_c.h index eaaeed2fa..596808109 100644 --- a/thirdparty/SDL/src/video/SDL_RLEaccel_c.h +++ b/thirdparty/SDL/src/video/SDL_RLEaccel_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/SDL_blit.c b/thirdparty/SDL/src/video/SDL_blit.c index 88b7f7330..b54d04cf2 100644 --- a/thirdparty/SDL/src/video/SDL_blit.c +++ b/thirdparty/SDL/src/video/SDL_blit.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -103,7 +103,7 @@ static int SDLCALL SDL_SoftBlit(SDL_Surface *src, SDL_Rect *srcrect, #ifdef __MACOSX__ #include -static SDL_bool SDL_UseAltivecPrefetch() +static SDL_bool SDL_UseAltivecPrefetch(void) { const char key[] = "hw.l3cachesize"; u_int64_t result = 0; @@ -116,7 +116,7 @@ static SDL_bool SDL_UseAltivecPrefetch() } } #else -static SDL_bool SDL_UseAltivecPrefetch() +static SDL_bool SDL_UseAltivecPrefetch(void) { /* Just guess G4 */ return SDL_TRUE; @@ -251,7 +251,7 @@ int SDL_CalculateBlit(SDL_Surface *surface) } #endif #if SDL_HAVE_BLIT_AUTO - if (blit == NULL) { + if (!blit) { Uint32 src_format = surface->format->format; Uint32 dst_format = dst->format->format; @@ -262,7 +262,7 @@ int SDL_CalculateBlit(SDL_Surface *surface) #endif #ifndef TEST_SLOW_BLIT - if (blit == NULL) + if (!blit) #endif { Uint32 src_format = surface->format->format; @@ -278,7 +278,7 @@ int SDL_CalculateBlit(SDL_Surface *surface) map->data = blit; /* Make sure we have a blit function */ - if (blit == NULL) { + if (!blit) { SDL_InvalidateMap(map); return SDL_SetError("Blit combination not supported"); } diff --git a/thirdparty/SDL/src/video/SDL_blit.h b/thirdparty/SDL/src/video/SDL_blit.h index fb4bb6730..731ea6375 100644 --- a/thirdparty/SDL/src/video/SDL_blit.h +++ b/thirdparty/SDL/src/video/SDL_blit.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/SDL_blit_0.c b/thirdparty/SDL/src/video/SDL_blit_0.c index 8be309140..e7750ddb3 100644 --- a/thirdparty/SDL/src/video/SDL_blit_0.c +++ b/thirdparty/SDL/src/video/SDL_blit_0.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -27,8 +27,11 @@ /* Functions to blit from bitmaps to other surfaces */ -static void BlitBto1(SDL_BlitInfo *info) +SDL_FORCE_INLINE void BlitBto1(SDL_BlitInfo *info, const Uint32 srcbpp) { + const Uint32 mask = (1 << srcbpp) - 1; + const Uint32 align = (8 / srcbpp) - 1; + int c; int width, height; Uint8 *src, *map, *dst; @@ -42,22 +45,28 @@ static void BlitBto1(SDL_BlitInfo *info) dst = info->dst; dstskip = info->dst_skip; map = info->table; - srcskip += width - (width + 7) / 8; + + if (srcbpp == 4) + srcskip += width - (width + 1) / 2; + else if (srcbpp == 2) + srcskip += width - (width + 3) / 4; + else if (srcbpp == 1) + srcskip += width - (width + 7) / 8; if (map) { - if (info->src_fmt->format == SDL_PIXELFORMAT_INDEX1LSB) { + if (SDL_PIXELORDER(info->src_fmt->format) == SDL_BITMAPORDER_4321) { while (height--) { Uint8 byte = 0, bit; for (c = 0; c < width; ++c) { - if (!(c & 7)) { + if (!(c & align)) { byte = *src++; } - bit = (byte & 0x01); + bit = (byte & mask); if (1) { *dst = map[bit]; } dst++; - byte >>= 1; + byte >>= srcbpp; } src += srcskip; dst += dstskip; @@ -66,34 +75,34 @@ static void BlitBto1(SDL_BlitInfo *info) while (height--) { Uint8 byte = 0, bit; for (c = 0; c < width; ++c) { - if (!(c & 7)) { + if (!(c & align)) { byte = *src++; } - bit = (byte & 0x80) >> 7; + bit = (byte >> (8 - srcbpp)) & mask; if (1) { *dst = map[bit]; } dst++; - byte <<= 1; + byte <<= srcbpp; } src += srcskip; dst += dstskip; } } } else { - if (info->src_fmt->format == SDL_PIXELFORMAT_INDEX1LSB) { + if (SDL_PIXELORDER(info->src_fmt->format) == SDL_BITMAPORDER_4321) { while (height--) { Uint8 byte = 0, bit; for (c = 0; c < width; ++c) { - if (!(c & 7)) { + if (!(c & align)) { byte = *src++; } - bit = (byte & 0x01); + bit = (byte & mask); if (1) { *dst = bit; } dst++; - byte >>= 1; + byte >>= srcbpp; } src += srcskip; dst += dstskip; @@ -102,15 +111,15 @@ static void BlitBto1(SDL_BlitInfo *info) while (height--) { Uint8 byte = 0, bit; for (c = 0; c < width; ++c) { - if (!(c & 7)) { + if (!(c & align)) { byte = *src++; } - bit = (byte & 0x80) >> 7; + bit = (byte >> (8 - srcbpp)) & mask; if (1) { *dst = bit; } dst++; - byte <<= 1; + byte <<= srcbpp; } src += srcskip; dst += dstskip; @@ -119,8 +128,11 @@ static void BlitBto1(SDL_BlitInfo *info) } } -static void BlitBto2(SDL_BlitInfo *info) +SDL_FORCE_INLINE void BlitBto2(SDL_BlitInfo *info, const Uint32 srcbpp) { + const Uint32 mask = (1 << srcbpp) - 1; + const Uint32 align = (8 / srcbpp) - 1; + int c; int width, height; Uint8 *src; @@ -135,20 +147,26 @@ static void BlitBto2(SDL_BlitInfo *info) dst = (Uint16 *)info->dst; dstskip = info->dst_skip / 2; map = (Uint16 *)info->table; - srcskip += width - (width + 7) / 8; - if (info->src_fmt->format == SDL_PIXELFORMAT_INDEX1LSB) { + if (srcbpp == 4) + srcskip += width - (width + 1) / 2; + else if (srcbpp == 2) + srcskip += width - (width + 3) / 4; + else if (srcbpp == 1) + srcskip += width - (width + 7) / 8; + + if (SDL_PIXELORDER(info->src_fmt->format) == SDL_BITMAPORDER_4321) { while (height--) { Uint8 byte = 0, bit; for (c = 0; c < width; ++c) { - if (!(c & 7)) { + if (!(c & align)) { byte = *src++; } - bit = (byte & 0x01); + bit = (byte & mask); if (1) { *dst = map[bit]; } - byte >>= 1; + byte >>= srcbpp; dst++; } src += srcskip; @@ -158,14 +176,14 @@ static void BlitBto2(SDL_BlitInfo *info) while (height--) { Uint8 byte = 0, bit; for (c = 0; c < width; ++c) { - if (!(c & 7)) { + if (!(c & align)) { byte = *src++; } - bit = (byte & 0x80) >> 7; + bit = (byte >> (8 - srcbpp)) & mask; if (1) { *dst = map[bit]; } - byte <<= 1; + byte <<= srcbpp; dst++; } src += srcskip; @@ -174,8 +192,11 @@ static void BlitBto2(SDL_BlitInfo *info) } } -static void BlitBto3(SDL_BlitInfo *info) +SDL_FORCE_INLINE void BlitBto3(SDL_BlitInfo *info, const Uint32 srcbpp) { + const Uint32 mask = (1 << srcbpp) - 1; + const Uint32 align = (8 / srcbpp) - 1; + int c, o; int width, height; Uint8 *src, *map, *dst; @@ -189,23 +210,29 @@ static void BlitBto3(SDL_BlitInfo *info) dst = info->dst; dstskip = info->dst_skip; map = info->table; - srcskip += width - (width + 7) / 8; - if (info->src_fmt->format == SDL_PIXELFORMAT_INDEX1LSB) { + if (srcbpp == 4) + srcskip += width - (width + 1) / 2; + else if (srcbpp == 2) + srcskip += width - (width + 3) / 4; + else if (srcbpp == 1) + srcskip += width - (width + 7) / 8; + + if (SDL_PIXELORDER(info->src_fmt->format) == SDL_BITMAPORDER_4321) { while (height--) { Uint8 byte = 0, bit; for (c = 0; c < width; ++c) { - if (!(c & 7)) { + if (!(c & align)) { byte = *src++; } - bit = (byte & 0x01); + bit = (byte & mask); if (1) { o = bit * 4; dst[0] = map[o++]; dst[1] = map[o++]; dst[2] = map[o++]; } - byte >>= 1; + byte >>= srcbpp; dst += 3; } src += srcskip; @@ -215,17 +242,17 @@ static void BlitBto3(SDL_BlitInfo *info) while (height--) { Uint8 byte = 0, bit; for (c = 0; c < width; ++c) { - if (!(c & 7)) { + if (!(c & align)) { byte = *src++; } - bit = (byte & 0x80) >> 7; + bit = (byte >> (8 - srcbpp)) & mask; if (1) { o = bit * 4; dst[0] = map[o++]; dst[1] = map[o++]; dst[2] = map[o++]; } - byte <<= 1; + byte <<= srcbpp; dst += 3; } src += srcskip; @@ -234,8 +261,11 @@ static void BlitBto3(SDL_BlitInfo *info) } } -static void BlitBto4(SDL_BlitInfo *info) +SDL_FORCE_INLINE void BlitBto4(SDL_BlitInfo *info, const Uint32 srcbpp) { + const Uint32 mask = (1 << srcbpp) - 1; + const Uint32 align = (8 / srcbpp) - 1; + int width, height; Uint8 *src; Uint32 *map, *dst; @@ -250,20 +280,26 @@ static void BlitBto4(SDL_BlitInfo *info) dst = (Uint32 *)info->dst; dstskip = info->dst_skip / 4; map = (Uint32 *)info->table; - srcskip += width - (width + 7) / 8; - if (info->src_fmt->format == SDL_PIXELFORMAT_INDEX1LSB) { + if (srcbpp == 4) + srcskip += width - (width + 1) / 2; + else if (srcbpp == 2) + srcskip += width - (width + 3) / 4; + else if (srcbpp == 1) + srcskip += width - (width + 7) / 8; + + if (SDL_PIXELORDER(info->src_fmt->format) == SDL_BITMAPORDER_4321) { while (height--) { Uint8 byte = 0, bit; for (c = 0; c < width; ++c) { - if (!(c & 7)) { + if (!(c & align)) { byte = *src++; } - bit = (byte & 0x01); + bit = (byte & mask); if (1) { *dst = map[bit]; } - byte >>= 1; + byte >>= srcbpp; dst++; } src += srcskip; @@ -273,14 +309,14 @@ static void BlitBto4(SDL_BlitInfo *info) while (height--) { Uint8 byte = 0, bit; for (c = 0; c < width; ++c) { - if (!(c & 7)) { + if (!(c & align)) { byte = *src++; } - bit = (byte & 0x80) >> 7; + bit = (byte >> (8 - srcbpp)) & mask; if (1) { *dst = map[bit]; } - byte <<= 1; + byte <<= srcbpp; dst++; } src += srcskip; @@ -289,8 +325,11 @@ static void BlitBto4(SDL_BlitInfo *info) } } -static void BlitBto1Key(SDL_BlitInfo *info) +SDL_FORCE_INLINE void BlitBto1Key(SDL_BlitInfo *info, const Uint32 srcbpp) { + const Uint32 mask = (1 << srcbpp) - 1; + const Uint32 align = (8 / srcbpp) - 1; + int width = info->dst_w; int height = info->dst_h; Uint8 *src = info->src; @@ -302,22 +341,27 @@ static void BlitBto1Key(SDL_BlitInfo *info) int c; /* Set up some basic variables */ - srcskip += width - (width + 7) / 8; + if (srcbpp == 4) + srcskip += width - (width + 1) / 2; + else if (srcbpp == 2) + srcskip += width - (width + 3) / 4; + else if (srcbpp == 1) + srcskip += width - (width + 7) / 8; if (palmap) { - if (info->src_fmt->format == SDL_PIXELFORMAT_INDEX1LSB) { + if (SDL_PIXELORDER(info->src_fmt->format) == SDL_BITMAPORDER_4321) { while (height--) { Uint8 byte = 0, bit; for (c = 0; c < width; ++c) { - if (!(c & 7)) { + if (!(c & align)) { byte = *src++; } - bit = (byte & 0x01); + bit = (byte & mask); if (bit != ckey) { *dst = palmap[bit]; } dst++; - byte >>= 1; + byte >>= srcbpp; } src += srcskip; dst += dstskip; @@ -326,34 +370,34 @@ static void BlitBto1Key(SDL_BlitInfo *info) while (height--) { Uint8 byte = 0, bit; for (c = 0; c < width; ++c) { - if (!(c & 7)) { + if (!(c & align)) { byte = *src++; } - bit = (byte & 0x80) >> 7; + bit = (byte >> (8 - srcbpp)) & mask; if (bit != ckey) { *dst = palmap[bit]; } dst++; - byte <<= 1; + byte <<= srcbpp; } src += srcskip; dst += dstskip; } } } else { - if (info->src_fmt->format == SDL_PIXELFORMAT_INDEX1LSB) { + if (SDL_PIXELORDER(info->src_fmt->format) == SDL_BITMAPORDER_4321) { while (height--) { Uint8 byte = 0, bit; for (c = 0; c < width; ++c) { - if (!(c & 7)) { + if (!(c & align)) { byte = *src++; } - bit = (byte & 0x01); + bit = (byte & mask); if (bit != ckey) { *dst = bit; } dst++; - byte >>= 1; + byte >>= srcbpp; } src += srcskip; dst += dstskip; @@ -362,15 +406,15 @@ static void BlitBto1Key(SDL_BlitInfo *info) while (height--) { Uint8 byte = 0, bit; for (c = 0; c < width; ++c) { - if (!(c & 7)) { + if (!(c & align)) { byte = *src++; } - bit = (byte & 0x80) >> 7; + bit = (byte >> (8 - srcbpp)) & mask; if (bit != ckey) { *dst = bit; } dst++; - byte <<= 1; + byte <<= srcbpp; } src += srcskip; dst += dstskip; @@ -379,8 +423,11 @@ static void BlitBto1Key(SDL_BlitInfo *info) } } -static void BlitBto2Key(SDL_BlitInfo *info) +SDL_FORCE_INLINE void BlitBto2Key(SDL_BlitInfo *info, const Uint32 srcbpp) { + const Uint32 mask = (1 << srcbpp) - 1; + const Uint32 align = (8 / srcbpp) - 1; + int width = info->dst_w; int height = info->dst_h; Uint8 *src = info->src; @@ -392,21 +439,26 @@ static void BlitBto2Key(SDL_BlitInfo *info) int c; /* Set up some basic variables */ - srcskip += width - (width + 7) / 8; + if (srcbpp == 4) + srcskip += width - (width + 1) / 2; + else if (srcbpp == 2) + srcskip += width - (width + 3) / 4; + else if (srcbpp == 1) + srcskip += width - (width + 7) / 8; dstskip /= 2; - if (info->src_fmt->format == SDL_PIXELFORMAT_INDEX1LSB) { + if (SDL_PIXELORDER(info->src_fmt->format) == SDL_BITMAPORDER_4321) { while (height--) { Uint8 byte = 0, bit; for (c = 0; c < width; ++c) { - if (!(c & 7)) { + if (!(c & align)) { byte = *src++; } - bit = (byte & 0x01); + bit = (byte & mask); if (bit != ckey) { *dstp = ((Uint16 *)palmap)[bit]; } - byte >>= 1; + byte >>= srcbpp; dstp++; } src += srcskip; @@ -416,14 +468,14 @@ static void BlitBto2Key(SDL_BlitInfo *info) while (height--) { Uint8 byte = 0, bit; for (c = 0; c < width; ++c) { - if (!(c & 7)) { + if (!(c & align)) { byte = *src++; } - bit = (byte & 0x80) >> 7; + bit = (byte >> (8 - srcbpp)) & mask; if (bit != ckey) { *dstp = ((Uint16 *)palmap)[bit]; } - byte <<= 1; + byte <<= srcbpp; dstp++; } src += srcskip; @@ -432,8 +484,11 @@ static void BlitBto2Key(SDL_BlitInfo *info) } } -static void BlitBto3Key(SDL_BlitInfo *info) +SDL_FORCE_INLINE void BlitBto3Key(SDL_BlitInfo *info, const Uint32 srcbpp) { + const Uint32 mask = (1 << srcbpp) - 1; + const Uint32 align = (8 / srcbpp) - 1; + int width = info->dst_w; int height = info->dst_h; Uint8 *src = info->src; @@ -445,20 +500,25 @@ static void BlitBto3Key(SDL_BlitInfo *info) int c; /* Set up some basic variables */ - srcskip += width - (width + 7) / 8; - - if (info->src_fmt->format == SDL_PIXELFORMAT_INDEX1LSB) { + if (srcbpp == 4) + srcskip += width - (width + 1) / 2; + else if (srcbpp == 2) + srcskip += width - (width + 3) / 4; + else if (srcbpp == 1) + srcskip += width - (width + 7) / 8; + + if (SDL_PIXELORDER(info->src_fmt->format) == SDL_BITMAPORDER_4321) { while (height--) { Uint8 byte = 0, bit; for (c = 0; c < width; ++c) { - if (!(c & 7)) { + if (!(c & align)) { byte = *src++; } - bit = (byte & 0x01); + bit = (byte & mask); if (bit != ckey) { SDL_memcpy(dst, &palmap[bit * 4], 3); } - byte >>= 1; + byte >>= srcbpp; dst += 3; } src += srcskip; @@ -468,14 +528,14 @@ static void BlitBto3Key(SDL_BlitInfo *info) while (height--) { Uint8 byte = 0, bit; for (c = 0; c < width; ++c) { - if (!(c & 7)) { + if (!(c & align)) { byte = *src++; } - bit = (byte & 0x80) >> 7; + bit = (byte >> (8 - srcbpp)) & mask; if (bit != ckey) { SDL_memcpy(dst, &palmap[bit * 4], 3); } - byte <<= 1; + byte <<= srcbpp; dst += 3; } src += srcskip; @@ -484,8 +544,11 @@ static void BlitBto3Key(SDL_BlitInfo *info) } } -static void BlitBto4Key(SDL_BlitInfo *info) +SDL_FORCE_INLINE void BlitBto4Key(SDL_BlitInfo *info, const Uint32 srcbpp) { + const Uint32 mask = (1 << srcbpp) - 1; + const Uint32 align = (8 / srcbpp) - 1; + int width = info->dst_w; int height = info->dst_h; Uint8 *src = info->src; @@ -497,21 +560,26 @@ static void BlitBto4Key(SDL_BlitInfo *info) int c; /* Set up some basic variables */ - srcskip += width - (width + 7) / 8; + if (srcbpp == 4) + srcskip += width - (width + 1) / 2; + else if (srcbpp == 2) + srcskip += width - (width + 3) / 4; + else if (srcbpp == 1) + srcskip += width - (width + 7) / 8; dstskip /= 4; - if (info->src_fmt->format == SDL_PIXELFORMAT_INDEX1LSB) { + if (SDL_PIXELORDER(info->src_fmt->format) == SDL_BITMAPORDER_4321) { while (height--) { Uint8 byte = 0, bit; for (c = 0; c < width; ++c) { - if (!(c & 7)) { + if (!(c & align)) { byte = *src++; } - bit = (byte & 0x01); + bit = (byte & mask); if (bit != ckey) { *dstp = ((Uint32 *)palmap)[bit]; } - byte >>= 1; + byte >>= srcbpp; dstp++; } src += srcskip; @@ -521,14 +589,14 @@ static void BlitBto4Key(SDL_BlitInfo *info) while (height--) { Uint8 byte = 0, bit; for (c = 0; c < width; ++c) { - if (!(c & 7)) { + if (!(c & align)) { byte = *src++; } - bit = (byte & 0x80) >> 7; + bit = (byte >> (8 - srcbpp)) & mask; if (bit != ckey) { *dstp = ((Uint32 *)palmap)[bit]; } - byte <<= 1; + byte <<= srcbpp; dstp++; } src += srcskip; @@ -537,8 +605,11 @@ static void BlitBto4Key(SDL_BlitInfo *info) } } -static void BlitBtoNAlpha(SDL_BlitInfo *info) +SDL_FORCE_INLINE void BlitBtoNAlpha(SDL_BlitInfo *info, const Uint32 srcbpp) { + const Uint32 mask = (1 << srcbpp) - 1; + const Uint32 align = (8 / srcbpp) - 1; + int width = info->dst_w; int height = info->dst_h; Uint8 *src = info->src; @@ -556,16 +627,21 @@ static void BlitBtoNAlpha(SDL_BlitInfo *info) /* Set up some basic variables */ dstbpp = dstfmt->BytesPerPixel; - srcskip += width - (width + 7) / 8; - - if (info->src_fmt->format == SDL_PIXELFORMAT_INDEX1LSB) { + if (srcbpp == 4) + srcskip += width - (width + 1) / 2; + else if (srcbpp == 2) + srcskip += width - (width + 3) / 4; + else if (srcbpp == 1) + srcskip += width - (width + 7) / 8; + + if (SDL_PIXELORDER(info->src_fmt->format) == SDL_BITMAPORDER_4321) { while (height--) { Uint8 byte = 0, bit; for (c = 0; c < width; ++c) { - if (!(c & 7)) { + if (!(c & align)) { byte = *src++; } - bit = (byte & 0x01); + bit = (byte & mask); if (1) { sR = srcpal[bit].r; sG = srcpal[bit].g; @@ -574,7 +650,7 @@ static void BlitBtoNAlpha(SDL_BlitInfo *info) ALPHA_BLEND_RGBA(sR, sG, sB, A, dR, dG, dB, dA); ASSEMBLE_RGBA(dst, dstbpp, dstfmt, dR, dG, dB, dA); } - byte >>= 1; + byte >>= srcbpp; dst += dstbpp; } src += srcskip; @@ -584,10 +660,10 @@ static void BlitBtoNAlpha(SDL_BlitInfo *info) while (height--) { Uint8 byte = 0, bit; for (c = 0; c < width; ++c) { - if (!(c & 7)) { + if (!(c & align)) { byte = *src++; } - bit = (byte & 0x80) >> 7; + bit = (byte >> (8 - srcbpp)) & mask; if (1) { sR = srcpal[bit].r; sG = srcpal[bit].g; @@ -596,7 +672,7 @@ static void BlitBtoNAlpha(SDL_BlitInfo *info) ALPHA_BLEND_RGBA(sR, sG, sB, A, dR, dG, dB, dA); ASSEMBLE_RGBA(dst, dstbpp, dstfmt, dR, dG, dB, dA); } - byte <<= 1; + byte <<= srcbpp; dst += dstbpp; } src += srcskip; @@ -605,8 +681,11 @@ static void BlitBtoNAlpha(SDL_BlitInfo *info) } } -static void BlitBtoNAlphaKey(SDL_BlitInfo *info) +SDL_FORCE_INLINE void BlitBtoNAlphaKey(SDL_BlitInfo *info, const Uint32 srcbpp) { + const Uint32 mask = (1 << srcbpp) - 1; + const Uint32 align = (8 / srcbpp) - 1; + int width = info->dst_w; int height = info->dst_h; Uint8 *src = info->src; @@ -626,16 +705,21 @@ static void BlitBtoNAlphaKey(SDL_BlitInfo *info) /* Set up some basic variables */ dstbpp = dstfmt->BytesPerPixel; - srcskip += width - (width + 7) / 8; - - if (info->src_fmt->format == SDL_PIXELFORMAT_INDEX1LSB) { + if (srcbpp == 4) + srcskip += width - (width + 1) / 2; + else if (srcbpp == 2) + srcskip += width - (width + 3) / 4; + else if (srcbpp == 1) + srcskip += width - (width + 7) / 8; + + if (SDL_PIXELORDER(info->src_fmt->format) == SDL_BITMAPORDER_4321) { while (height--) { Uint8 byte = 0, bit; for (c = 0; c < width; ++c) { - if (!(c & 7)) { + if (!(c & align)) { byte = *src++; } - bit = (byte & 0x01); + bit = (byte & mask); if (bit != ckey) { sR = srcpal[bit].r; sG = srcpal[bit].g; @@ -644,7 +728,7 @@ static void BlitBtoNAlphaKey(SDL_BlitInfo *info) ALPHA_BLEND_RGBA(sR, sG, sB, A, dR, dG, dB, dA); ASSEMBLE_RGBA(dst, dstbpp, dstfmt, dR, dG, dB, dA); } - byte >>= 1; + byte >>= srcbpp; dst += dstbpp; } src += srcskip; @@ -654,10 +738,10 @@ static void BlitBtoNAlphaKey(SDL_BlitInfo *info) while (height--) { Uint8 byte = 0, bit; for (c = 0; c < width; ++c) { - if (!(c & 7)) { + if (!(c & align)) { byte = *src++; } - bit = (byte & 0x80) >> 7; + bit = (byte >> (8 - srcbpp)) & mask; if (bit != ckey) { sR = srcpal[bit].r; sG = srcpal[bit].g; @@ -666,7 +750,7 @@ static void BlitBtoNAlphaKey(SDL_BlitInfo *info) ALPHA_BLEND_RGBA(sR, sG, sB, A, dR, dG, dB, dA); ASSEMBLE_RGBA(dst, dstbpp, dstfmt, dR, dG, dB, dA); } - byte <<= 1; + byte <<= srcbpp; dst += dstbpp; } src += srcskip; @@ -675,121 +759,226 @@ static void BlitBtoNAlphaKey(SDL_BlitInfo *info) } } -static const SDL_BlitFunc bitmap_blit[] = { - (SDL_BlitFunc)NULL, BlitBto1, BlitBto2, BlitBto3, BlitBto4 + + +static void Blit1bto1(SDL_BlitInfo *info) { + BlitBto1(info, 1); +} + +static void Blit1bto2(SDL_BlitInfo *info) { + BlitBto2(info, 1); +} + +static void Blit1bto3(SDL_BlitInfo *info) { + BlitBto3(info, 1); +} + +static void Blit1bto4(SDL_BlitInfo *info) { + BlitBto4(info, 1); +} + +static const SDL_BlitFunc bitmap_blit_1b[] = { + (SDL_BlitFunc)NULL, Blit1bto1, Blit1bto2, Blit1bto3, Blit1bto4 }; -static const SDL_BlitFunc colorkey_blit[] = { - (SDL_BlitFunc)NULL, BlitBto1Key, BlitBto2Key, BlitBto3Key, BlitBto4Key +static void Blit1bto1Key(SDL_BlitInfo *info) { + BlitBto1Key(info, 1); +} + +static void Blit1bto2Key(SDL_BlitInfo *info) { + BlitBto2Key(info, 1); +} + +static void Blit1bto3Key(SDL_BlitInfo *info) { + BlitBto3Key(info, 1); +} + +static void Blit1bto4Key(SDL_BlitInfo *info) { + BlitBto4Key(info, 1); +} + +static const SDL_BlitFunc colorkey_blit_1b[] = { + (SDL_BlitFunc)NULL, Blit1bto1Key, Blit1bto2Key, Blit1bto3Key, Blit1bto4Key }; -static void Blit4bto4(SDL_BlitInfo *info) +static void Blit1btoNAlpha(SDL_BlitInfo *info) { - int width = info->dst_w; - int height = info->dst_h; - Uint8 *src = info->src; - Uint32 *dst = (Uint32 *)info->dst; - int srcskip = info->src_skip; - int dstskip = info->dst_skip; - Uint32 *map = (Uint32 *)info->table; - int c; + BlitBtoNAlpha(info, 1); +} - /* Set up some basic variables */ - srcskip += width - (width + 1) / 2; +static void Blit1btoNAlphaKey(SDL_BlitInfo *info) +{ + BlitBtoNAlphaKey(info, 1); +} - while (height--) { - Uint8 byte = 0, bit; - for (c = 0; c < width; ++c) { - if (!(c & 0x1)) { - byte = *src++; - } - bit = (byte & 0xF0) >> 4; - if (1) { - *dst = map[bit]; - } - byte <<= 4; - dst++; - } - src += srcskip; - dst = (Uint32 *)((Uint8 *)dst + dstskip); - } + + +static void Blit2bto1(SDL_BlitInfo *info) { + BlitBto1(info, 2); } -static void Blit4bto4Key(SDL_BlitInfo *info) +static void Blit2bto2(SDL_BlitInfo *info) { + BlitBto2(info, 2); +} + +static void Blit2bto3(SDL_BlitInfo *info) { + BlitBto3(info, 2); +} + +static void Blit2bto4(SDL_BlitInfo *info) { + BlitBto4(info, 2); +} + +static const SDL_BlitFunc bitmap_blit_2b[] = { + (SDL_BlitFunc)NULL, Blit2bto1, Blit2bto2, Blit2bto3, Blit2bto4 +}; + +static void Blit2bto1Key(SDL_BlitInfo *info) { + BlitBto1Key(info, 2); +} + +static void Blit2bto2Key(SDL_BlitInfo *info) { + BlitBto2Key(info, 2); +} + +static void Blit2bto3Key(SDL_BlitInfo *info) { + BlitBto3Key(info, 2); +} + +static void Blit2bto4Key(SDL_BlitInfo *info) { + BlitBto4Key(info, 2); +} + +static const SDL_BlitFunc colorkey_blit_2b[] = { + (SDL_BlitFunc)NULL, Blit2bto1Key, Blit2bto2Key, Blit2bto3Key, Blit2bto4Key +}; + +static void Blit2btoNAlpha(SDL_BlitInfo *info) { - int width = info->dst_w; - int height = info->dst_h; - Uint8 *src = info->src; - Uint32 *dst = (Uint32 *)info->dst; - int srcskip = info->src_skip; - int dstskip = info->dst_skip; - Uint32 ckey = info->colorkey; - Uint32 *map = (Uint32 *)info->table; - int c; + BlitBtoNAlpha(info, 2); +} - /* Set up some basic variables */ - srcskip += width - (width + 1) / 2; +static void Blit2btoNAlphaKey(SDL_BlitInfo *info) +{ + BlitBtoNAlphaKey(info, 2); +} - while (height--) { - Uint8 byte = 0, bit; - for (c = 0; c < width; ++c) { - if (!(c & 0x1)) { - byte = *src++; - } - bit = (byte & 0xF0) >> 4; - if (bit != ckey) { - *dst = map[bit]; - } - byte <<= 4; - dst++; - } - src += srcskip; - dst = (Uint32 *)((Uint8 *)dst + dstskip); - } + + +static void Blit4bto1(SDL_BlitInfo *info) { + BlitBto1(info, 4); +} + +static void Blit4bto2(SDL_BlitInfo *info) { + BlitBto2(info, 4); +} + +static void Blit4bto3(SDL_BlitInfo *info) { + BlitBto3(info, 4); +} + +static void Blit4bto4(SDL_BlitInfo *info) { + BlitBto4(info, 4); +} + +static const SDL_BlitFunc bitmap_blit_4b[] = { + (SDL_BlitFunc)NULL, Blit4bto1, Blit4bto2, Blit4bto3, Blit4bto4 +}; + +static void Blit4bto1Key(SDL_BlitInfo *info) { + BlitBto1Key(info, 4); +} + +static void Blit4bto2Key(SDL_BlitInfo *info) { + BlitBto2Key(info, 4); +} + +static void Blit4bto3Key(SDL_BlitInfo *info) { + BlitBto3Key(info, 4); +} + +static void Blit4bto4Key(SDL_BlitInfo *info) { + BlitBto4Key(info, 4); } +static const SDL_BlitFunc colorkey_blit_4b[] = { + (SDL_BlitFunc)NULL, Blit4bto1Key, Blit4bto2Key, Blit4bto3Key, Blit4bto4Key +}; + +static void Blit4btoNAlpha(SDL_BlitInfo *info) +{ + BlitBtoNAlpha(info, 4); +} + +static void Blit4btoNAlphaKey(SDL_BlitInfo *info) +{ + BlitBtoNAlphaKey(info, 4); +} + + + SDL_BlitFunc SDL_CalculateBlit0(SDL_Surface *surface) { int which; - /* 4bits to 32bits */ - if (surface->format->BitsPerPixel == 4) { - if (surface->map->dst->format->BytesPerPixel == 4) { - switch (surface->map->info.flags & ~SDL_COPY_RLE_MASK) { - case 0: - return Blit4bto4; + if (surface->map->dst->format->BitsPerPixel < 8) { + which = 0; + } else { + which = surface->map->dst->format->BytesPerPixel; + } + + if (SDL_PIXELTYPE(surface->format->format) == SDL_PIXELTYPE_INDEX1) { + switch (surface->map->info.flags & ~SDL_COPY_RLE_MASK) { + case 0: + return bitmap_blit_1b[which]; - case SDL_COPY_COLORKEY: - return Blit4bto4Key; - } + case SDL_COPY_COLORKEY: + return colorkey_blit_1b[which]; + + case SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND: + return which >= 2 ? Blit1btoNAlpha : (SDL_BlitFunc)NULL; + + case SDL_COPY_COLORKEY | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND: + return which >= 2 ? Blit1btoNAlphaKey : (SDL_BlitFunc)NULL; } - /* We don't fully support 4-bit packed pixel modes */ return NULL; } - if (surface->format->BitsPerPixel != 1) { - /* We don't support sub 8-bit packed pixel modes */ - return (SDL_BlitFunc) NULL; - } - if (surface->map->dst->format->BitsPerPixel < 8) { - which = 0; - } else { - which = surface->map->dst->format->BytesPerPixel; + if (SDL_PIXELTYPE(surface->format->format) == SDL_PIXELTYPE_INDEX2) { + switch (surface->map->info.flags & ~SDL_COPY_RLE_MASK) { + case 0: + return bitmap_blit_2b[which]; + + case SDL_COPY_COLORKEY: + return colorkey_blit_2b[which]; + + case SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND: + return which >= 2 ? Blit2btoNAlpha : (SDL_BlitFunc)NULL; + + case SDL_COPY_COLORKEY | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND: + return which >= 2 ? Blit2btoNAlphaKey : (SDL_BlitFunc)NULL; + } + return NULL; } - switch (surface->map->info.flags & ~SDL_COPY_RLE_MASK) { - case 0: - return bitmap_blit[which]; - case SDL_COPY_COLORKEY: - return colorkey_blit[which]; + if (SDL_PIXELTYPE(surface->format->format) == SDL_PIXELTYPE_INDEX4) { + switch (surface->map->info.flags & ~SDL_COPY_RLE_MASK) { + case 0: + return bitmap_blit_4b[which]; - case SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND: - return which >= 2 ? BlitBtoNAlpha : (SDL_BlitFunc) NULL; + case SDL_COPY_COLORKEY: + return colorkey_blit_4b[which]; - case SDL_COPY_COLORKEY | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND: - return which >= 2 ? BlitBtoNAlphaKey : (SDL_BlitFunc) NULL; + case SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND: + return which >= 2 ? Blit4btoNAlpha : (SDL_BlitFunc)NULL; + + case SDL_COPY_COLORKEY | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND: + return which >= 2 ? Blit4btoNAlphaKey : (SDL_BlitFunc)NULL; + } + return NULL; } - return (SDL_BlitFunc) NULL; + + return NULL; } #endif /* SDL_HAVE_BLIT_0 */ diff --git a/thirdparty/SDL/src/video/SDL_blit_1.c b/thirdparty/SDL/src/video/SDL_blit_1.c index a616067e3..93fdb3ec1 100644 --- a/thirdparty/SDL/src/video/SDL_blit_1.c +++ b/thirdparty/SDL/src/video/SDL_blit_1.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/SDL_blit_A.c b/thirdparty/SDL/src/video/SDL_blit_A.c index 316f3f369..2cf00e0a2 100644 --- a/thirdparty/SDL/src/video/SDL_blit_A.c +++ b/thirdparty/SDL/src/video/SDL_blit_A.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -412,7 +412,7 @@ static void BlitRGBtoRGBPixelAlphaMMX(SDL_BlitInfo *info) #endif /* __MMX__ */ -#if SDL_ARM_SIMD_BLITTERS +#ifdef SDL_ARM_SIMD_BLITTERS void BlitARGBto565PixelAlphaARMSIMDAsm(int32_t w, int32_t h, uint16_t *dst, int32_t dst_stride, uint32_t *src, int32_t src_stride); static void BlitARGBto565PixelAlphaARMSIMD(SDL_BlitInfo *info) @@ -442,7 +442,7 @@ static void BlitRGBtoRGBPixelAlphaARMSIMD(SDL_BlitInfo *info) } #endif -#if SDL_ARM_NEON_BLITTERS +#ifdef SDL_ARM_NEON_BLITTERS void BlitARGBto565PixelAlphaARMNEONAsm(int32_t w, int32_t h, uint16_t *dst, int32_t dst_stride, uint32_t *src, int32_t src_stride); static void BlitARGBto565PixelAlphaARMNEON(SDL_BlitInfo *info) @@ -1427,7 +1427,7 @@ SDL_BlitFunc SDL_CalculateBlitA(SDL_Surface *surface) /* Per-pixel alpha blits */ switch (df->BytesPerPixel) { case 1: - if (df->palette != NULL) { + if (df->palette) { return BlitNto1PixelAlpha; } else { /* RGB332 has no palette ! */ @@ -1435,14 +1435,14 @@ SDL_BlitFunc SDL_CalculateBlitA(SDL_Surface *surface) } case 2: -#if SDL_ARM_NEON_BLITTERS || SDL_ARM_SIMD_BLITTERS +#if defined(SDL_ARM_NEON_BLITTERS) || defined(SDL_ARM_SIMD_BLITTERS) if (sf->BytesPerPixel == 4 && sf->Amask == 0xff000000 && sf->Gmask == 0xff00 && df->Gmask == 0x7e0 && ((sf->Rmask == 0xff && df->Rmask == 0x1f) || (sf->Bmask == 0xff && df->Bmask == 0x1f))) { -#if SDL_ARM_NEON_BLITTERS +#ifdef SDL_ARM_NEON_BLITTERS if (SDL_HasNEON()) { return BlitARGBto565PixelAlphaARMNEON; } #endif -#if SDL_ARM_SIMD_BLITTERS +#ifdef SDL_ARM_SIMD_BLITTERS if (SDL_HasARMSIMD()) { return BlitARGBto565PixelAlphaARMSIMD; } @@ -1475,12 +1475,12 @@ SDL_BlitFunc SDL_CalculateBlitA(SDL_Surface *surface) } #endif /* __MMX__ || __3dNOW__ */ if (sf->Amask == 0xff000000) { -#if SDL_ARM_NEON_BLITTERS +#ifdef SDL_ARM_NEON_BLITTERS if (SDL_HasNEON()) { return BlitRGBtoRGBPixelAlphaARMNEON; } #endif -#if SDL_ARM_SIMD_BLITTERS +#ifdef SDL_ARM_SIMD_BLITTERS if (SDL_HasARMSIMD()) { return BlitRGBtoRGBPixelAlphaARMSIMD; } @@ -1505,7 +1505,7 @@ SDL_BlitFunc SDL_CalculateBlitA(SDL_Surface *surface) /* Per-surface alpha blits */ switch (df->BytesPerPixel) { case 1: - if (df->palette != NULL) { + if (df->palette) { return BlitNto1SurfaceAlpha; } else { /* RGB332 has no palette ! */ @@ -1560,7 +1560,7 @@ SDL_BlitFunc SDL_CalculateBlitA(SDL_Surface *surface) if (sf->Amask == 0) { if (df->BytesPerPixel == 1) { - if (df->palette != NULL) { + if (df->palette) { return BlitNto1SurfaceAlphaKey; } else { /* RGB332 has no palette ! */ diff --git a/thirdparty/SDL/src/video/SDL_blit_N.c b/thirdparty/SDL/src/video/SDL_blit_N.c index 7c0b0106d..123d0aad0 100644 --- a/thirdparty/SDL/src/video/SDL_blit_N.c +++ b/thirdparty/SDL/src/video/SDL_blit_N.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -48,7 +48,7 @@ enum blit_features BLIT_FEATURE_HAS_ARM_SIMD = 8 }; -#if SDL_ALTIVEC_BLITTERS +#ifdef SDL_ALTIVEC_BLITTERS #ifdef HAVE_ALTIVEC_H #include #endif @@ -903,7 +903,7 @@ static enum blit_features GetBlitFeatures(void) return features; } -#if __MWERKS__ +#ifdef __MWERKS__ #pragma altivec_model off #endif #else @@ -911,7 +911,7 @@ static enum blit_features GetBlitFeatures(void) #define GetBlitFeatures() ((SDL_HasMMX() ? BLIT_FEATURE_HAS_MMX : 0) | (SDL_HasARMSIMD() ? BLIT_FEATURE_HAS_ARM_SIMD : 0)) #endif -#if SDL_ARM_SIMD_BLITTERS +#ifdef SDL_ARM_SIMD_BLITTERS void Blit_BGR888_RGB888ARMSIMDAsm(int32_t w, int32_t h, uint32_t *dst, int32_t dst_stride, uint32_t *src, int32_t src_stride); static void Blit_BGR888_RGB888ARMSIMD(SDL_BlitInfo *info) @@ -977,7 +977,7 @@ static void Blit_RGB888_index8(SDL_BlitInfo *info) dstskip = info->dst_skip; map = info->table; - if (map == NULL) { + if (!map) { while (height--) { #ifdef USE_DUFFS_LOOP /* *INDENT-OFF* */ /* clang-format off */ @@ -1091,7 +1091,7 @@ static void Blit_RGB101010_index8(SDL_BlitInfo *info) dstskip = info->dst_skip; map = info->table; - if (map == NULL) { + if (!map) { while (height--) { #ifdef USE_DUFFS_LOOP /* *INDENT-OFF* */ /* clang-format off */ @@ -2115,7 +2115,7 @@ static void BlitNto1(SDL_BlitInfo *info) srcfmt = info->src_fmt; srcbpp = srcfmt->BytesPerPixel; - if (map == NULL) { + if (!map) { while (height--) { #ifdef USE_DUFFS_LOOP /* *INDENT-OFF* */ /* clang-format off */ @@ -2513,7 +2513,7 @@ static void BlitNto1Key(SDL_BlitInfo *info) srcbpp = srcfmt->BytesPerPixel; ckey &= rgbmask; - if (palmap == NULL) { + if (!palmap) { while (height--) { /* *INDENT-OFF* */ /* clang-format off */ DUFFS_LOOP( @@ -3221,14 +3221,14 @@ static const struct blit_table normal_blit_1[] = { }; static const struct blit_table normal_blit_2[] = { -#if SDL_ALTIVEC_BLITTERS +#ifdef SDL_ALTIVEC_BLITTERS /* has-altivec */ { 0x0000F800, 0x000007E0, 0x0000001F, 4, 0x00000000, 0x00000000, 0x00000000, BLIT_FEATURE_HAS_ALTIVEC, Blit_RGB565_32Altivec, NO_ALPHA | COPY_ALPHA | SET_ALPHA }, { 0x00007C00, 0x000003E0, 0x0000001F, 4, 0x00000000, 0x00000000, 0x00000000, BLIT_FEATURE_HAS_ALTIVEC, Blit_RGB555_32Altivec, NO_ALPHA | COPY_ALPHA | SET_ALPHA }, #endif -#if SDL_ARM_SIMD_BLITTERS +#ifdef SDL_ARM_SIMD_BLITTERS { 0x00000F00, 0x000000F0, 0x0000000F, 4, 0x00FF0000, 0x0000FF00, 0x000000FF, BLIT_FEATURE_HAS_ARM_SIMD, Blit_RGB444_RGB888ARMSIMD, NO_ALPHA | COPY_ALPHA }, #endif @@ -3288,7 +3288,7 @@ static const struct blit_table normal_blit_3[] = { }; static const struct blit_table normal_blit_4[] = { -#if SDL_ALTIVEC_BLITTERS +#ifdef SDL_ALTIVEC_BLITTERS /* has-altivec | dont-use-prefetch */ { 0x00000000, 0x00000000, 0x00000000, 4, 0x00000000, 0x00000000, 0x00000000, BLIT_FEATURE_HAS_ALTIVEC | BLIT_FEATURE_ALTIVEC_DONT_USE_PREFETCH, ConvertAltivec32to32_noprefetch, NO_ALPHA | COPY_ALPHA | SET_ALPHA }, @@ -3299,7 +3299,7 @@ static const struct blit_table normal_blit_4[] = { { 0x00000000, 0x00000000, 0x00000000, 2, 0x0000F800, 0x000007E0, 0x0000001F, BLIT_FEATURE_HAS_ALTIVEC, Blit_RGB888_RGB565Altivec, NO_ALPHA }, #endif -#if SDL_ARM_SIMD_BLITTERS +#ifdef SDL_ARM_SIMD_BLITTERS { 0x000000FF, 0x0000FF00, 0x00FF0000, 4, 0x00FF0000, 0x0000FF00, 0x000000FF, BLIT_FEATURE_HAS_ARM_SIMD, Blit_BGR888_RGB888ARMSIMD, NO_ALPHA | COPY_ALPHA }, #endif @@ -3437,7 +3437,7 @@ SDL_BlitFunc SDL_CalculateBlitN(SDL_Surface *surface) } else if (dstfmt->BytesPerPixel == 1) { return BlitNto1Key; } else { -#if SDL_ALTIVEC_BLITTERS +#ifdef SDL_ALTIVEC_BLITTERS if ((srcfmt->BytesPerPixel == 4) && (dstfmt->BytesPerPixel == 4) && SDL_HasAltiVec()) { return Blit32to32KeyAltivec; } else diff --git a/thirdparty/SDL/src/video/SDL_blit_auto.c b/thirdparty/SDL/src/video/SDL_blit_auto.c index 1561d1069..b05dc4a02 100644 --- a/thirdparty/SDL/src/video/SDL_blit_auto.c +++ b/thirdparty/SDL/src/video/SDL_blit_auto.c @@ -1,7 +1,7 @@ /* DO NOT EDIT! This file is generated by sdlgenblit.pl */ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -31,12 +31,12 @@ static void SDL_Blit_RGB888_RGB888_Scale(SDL_BlitInfo *info) { - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -114,12 +114,12 @@ static void SDL_Blit_RGB888_RGB888_Blend_Scale(SDL_BlitInfo *info) Uint32 srcR, srcG, srcB; Uint32 dstpixel; Uint32 dstR, dstG, dstB; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -207,12 +207,12 @@ static void SDL_Blit_RGB888_RGB888_Modulate_Scale(SDL_BlitInfo *info) const Uint32 modulateB = info->b; Uint32 pixel; Uint32 R, G, B; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -321,12 +321,12 @@ static void SDL_Blit_RGB888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info) Uint32 srcR, srcG, srcB; Uint32 dstpixel; Uint32 dstR, dstG, dstB; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -392,12 +392,12 @@ static void SDL_Blit_RGB888_BGR888_Scale(SDL_BlitInfo *info) { Uint32 pixel; Uint32 R, G, B; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -478,12 +478,12 @@ static void SDL_Blit_RGB888_BGR888_Blend_Scale(SDL_BlitInfo *info) Uint32 srcR, srcG, srcB; Uint32 dstpixel; Uint32 dstR, dstG, dstB; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -571,12 +571,12 @@ static void SDL_Blit_RGB888_BGR888_Modulate_Scale(SDL_BlitInfo *info) const Uint32 modulateB = info->b; Uint32 pixel; Uint32 R, G, B; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -685,12 +685,12 @@ static void SDL_Blit_RGB888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info) Uint32 srcR, srcG, srcB; Uint32 dstpixel; Uint32 dstR, dstG, dstB; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -756,12 +756,12 @@ static void SDL_Blit_RGB888_ARGB8888_Scale(SDL_BlitInfo *info) { Uint32 pixel; const Uint32 A = 0xFF; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -842,12 +842,12 @@ static void SDL_Blit_RGB888_ARGB8888_Blend_Scale(SDL_BlitInfo *info) Uint32 srcR, srcG, srcB; Uint32 dstpixel; Uint32 dstR, dstG, dstB, dstA; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -940,12 +940,12 @@ static void SDL_Blit_RGB888_ARGB8888_Modulate_Scale(SDL_BlitInfo *info) Uint32 pixel; const Uint32 A = (flags & SDL_COPY_MODULATE_ALPHA) ? modulateA : 0xFF; Uint32 R, G, B; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -1055,12 +1055,12 @@ static void SDL_Blit_RGB888_ARGB8888_Modulate_Blend_Scale(SDL_BlitInfo *info) Uint32 srcR, srcG, srcB; Uint32 dstpixel; Uint32 dstR, dstG, dstB, dstA; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -1127,12 +1127,12 @@ static void SDL_Blit_BGR888_RGB888_Scale(SDL_BlitInfo *info) { Uint32 pixel; Uint32 R, G, B; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -1213,12 +1213,12 @@ static void SDL_Blit_BGR888_RGB888_Blend_Scale(SDL_BlitInfo *info) Uint32 srcR, srcG, srcB; Uint32 dstpixel; Uint32 dstR, dstG, dstB; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -1306,12 +1306,12 @@ static void SDL_Blit_BGR888_RGB888_Modulate_Scale(SDL_BlitInfo *info) const Uint32 modulateB = info->b; Uint32 pixel; Uint32 R, G, B; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -1420,12 +1420,12 @@ static void SDL_Blit_BGR888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info) Uint32 srcR, srcG, srcB; Uint32 dstpixel; Uint32 dstR, dstG, dstB; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -1489,12 +1489,12 @@ static void SDL_Blit_BGR888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info) static void SDL_Blit_BGR888_BGR888_Scale(SDL_BlitInfo *info) { - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -1572,12 +1572,12 @@ static void SDL_Blit_BGR888_BGR888_Blend_Scale(SDL_BlitInfo *info) Uint32 srcR, srcG, srcB; Uint32 dstpixel; Uint32 dstR, dstG, dstB; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -1665,12 +1665,12 @@ static void SDL_Blit_BGR888_BGR888_Modulate_Scale(SDL_BlitInfo *info) const Uint32 modulateB = info->b; Uint32 pixel; Uint32 R, G, B; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -1779,12 +1779,12 @@ static void SDL_Blit_BGR888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info) Uint32 srcR, srcG, srcB; Uint32 dstpixel; Uint32 dstR, dstG, dstB; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -1851,12 +1851,12 @@ static void SDL_Blit_BGR888_ARGB8888_Scale(SDL_BlitInfo *info) Uint32 pixel; const Uint32 A = 0xFF; Uint32 R, G, B; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -1938,12 +1938,12 @@ static void SDL_Blit_BGR888_ARGB8888_Blend_Scale(SDL_BlitInfo *info) Uint32 srcR, srcG, srcB; Uint32 dstpixel; Uint32 dstR, dstG, dstB, dstA; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -2036,12 +2036,12 @@ static void SDL_Blit_BGR888_ARGB8888_Modulate_Scale(SDL_BlitInfo *info) Uint32 pixel; const Uint32 A = (flags & SDL_COPY_MODULATE_ALPHA) ? modulateA : 0xFF; Uint32 R, G, B; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -2151,12 +2151,12 @@ static void SDL_Blit_BGR888_ARGB8888_Modulate_Blend_Scale(SDL_BlitInfo *info) Uint32 srcR, srcG, srcB; Uint32 dstpixel; Uint32 dstR, dstG, dstB, dstA; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -2222,12 +2222,12 @@ static void SDL_Blit_BGR888_ARGB8888_Modulate_Blend_Scale(SDL_BlitInfo *info) static void SDL_Blit_ARGB8888_RGB888_Scale(SDL_BlitInfo *info) { Uint32 pixel; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -2315,12 +2315,12 @@ static void SDL_Blit_ARGB8888_RGB888_Blend_Scale(SDL_BlitInfo *info) Uint32 srcR, srcG, srcB, srcA; Uint32 dstpixel; Uint32 dstR, dstG, dstB; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -2416,12 +2416,12 @@ static void SDL_Blit_ARGB8888_RGB888_Modulate_Scale(SDL_BlitInfo *info) const Uint32 modulateB = info->b; Uint32 pixel; Uint32 R, G, B; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -2531,12 +2531,12 @@ static void SDL_Blit_ARGB8888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info) Uint32 srcR, srcG, srcB, srcA; Uint32 dstpixel; Uint32 dstR, dstG, dstB; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -2605,12 +2605,12 @@ static void SDL_Blit_ARGB8888_BGR888_Scale(SDL_BlitInfo *info) { Uint32 pixel; Uint32 R, G, B; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -2699,12 +2699,12 @@ static void SDL_Blit_ARGB8888_BGR888_Blend_Scale(SDL_BlitInfo *info) Uint32 srcR, srcG, srcB, srcA; Uint32 dstpixel; Uint32 dstR, dstG, dstB; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -2800,12 +2800,12 @@ static void SDL_Blit_ARGB8888_BGR888_Modulate_Scale(SDL_BlitInfo *info) const Uint32 modulateB = info->b; Uint32 pixel; Uint32 R, G, B; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -2915,12 +2915,12 @@ static void SDL_Blit_ARGB8888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info) Uint32 srcR, srcG, srcB, srcA; Uint32 dstpixel; Uint32 dstR, dstG, dstB; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -2987,12 +2987,12 @@ static void SDL_Blit_ARGB8888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info) static void SDL_Blit_ARGB8888_ARGB8888_Scale(SDL_BlitInfo *info) { - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -3079,12 +3079,12 @@ static void SDL_Blit_ARGB8888_ARGB8888_Blend_Scale(SDL_BlitInfo *info) Uint32 srcR, srcG, srcB, srcA; Uint32 dstpixel; Uint32 dstR, dstG, dstB, dstA; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -3186,12 +3186,12 @@ static void SDL_Blit_ARGB8888_ARGB8888_Modulate_Scale(SDL_BlitInfo *info) const Uint32 modulateA = info->a; Uint32 pixel; Uint32 R, G, B, A; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -3305,12 +3305,12 @@ static void SDL_Blit_ARGB8888_ARGB8888_Modulate_Blend_Scale(SDL_BlitInfo *info) Uint32 srcR, srcG, srcB, srcA; Uint32 dstpixel; Uint32 dstR, dstG, dstB, dstA; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -3379,12 +3379,12 @@ static void SDL_Blit_ARGB8888_ARGB8888_Modulate_Blend_Scale(SDL_BlitInfo *info) static void SDL_Blit_RGBA8888_RGB888_Scale(SDL_BlitInfo *info) { Uint32 pixel; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -3472,12 +3472,12 @@ static void SDL_Blit_RGBA8888_RGB888_Blend_Scale(SDL_BlitInfo *info) Uint32 srcR, srcG, srcB, srcA; Uint32 dstpixel; Uint32 dstR, dstG, dstB; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -3573,12 +3573,12 @@ static void SDL_Blit_RGBA8888_RGB888_Modulate_Scale(SDL_BlitInfo *info) const Uint32 modulateB = info->b; Uint32 pixel; Uint32 R, G, B; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -3688,12 +3688,12 @@ static void SDL_Blit_RGBA8888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info) Uint32 srcR, srcG, srcB, srcA; Uint32 dstpixel; Uint32 dstR, dstG, dstB; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -3762,12 +3762,12 @@ static void SDL_Blit_RGBA8888_BGR888_Scale(SDL_BlitInfo *info) { Uint32 pixel; Uint32 R, G, B; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -3856,12 +3856,12 @@ static void SDL_Blit_RGBA8888_BGR888_Blend_Scale(SDL_BlitInfo *info) Uint32 srcR, srcG, srcB, srcA; Uint32 dstpixel; Uint32 dstR, dstG, dstB; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -3957,12 +3957,12 @@ static void SDL_Blit_RGBA8888_BGR888_Modulate_Scale(SDL_BlitInfo *info) const Uint32 modulateB = info->b; Uint32 pixel; Uint32 R, G, B; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -4072,12 +4072,12 @@ static void SDL_Blit_RGBA8888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info) Uint32 srcR, srcG, srcB, srcA; Uint32 dstpixel; Uint32 dstR, dstG, dstB; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -4145,12 +4145,12 @@ static void SDL_Blit_RGBA8888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info) static void SDL_Blit_RGBA8888_ARGB8888_Scale(SDL_BlitInfo *info) { Uint32 pixel; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -4239,12 +4239,12 @@ static void SDL_Blit_RGBA8888_ARGB8888_Blend_Scale(SDL_BlitInfo *info) Uint32 srcR, srcG, srcB, srcA; Uint32 dstpixel; Uint32 dstR, dstG, dstB, dstA; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -4346,12 +4346,12 @@ static void SDL_Blit_RGBA8888_ARGB8888_Modulate_Scale(SDL_BlitInfo *info) const Uint32 modulateA = info->a; Uint32 pixel; Uint32 R, G, B, A; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -4465,12 +4465,12 @@ static void SDL_Blit_RGBA8888_ARGB8888_Modulate_Blend_Scale(SDL_BlitInfo *info) Uint32 srcR, srcG, srcB, srcA; Uint32 dstpixel; Uint32 dstR, dstG, dstB, dstA; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -4540,12 +4540,12 @@ static void SDL_Blit_ABGR8888_RGB888_Scale(SDL_BlitInfo *info) { Uint32 pixel; Uint32 R, G, B; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -4634,12 +4634,12 @@ static void SDL_Blit_ABGR8888_RGB888_Blend_Scale(SDL_BlitInfo *info) Uint32 srcR, srcG, srcB, srcA; Uint32 dstpixel; Uint32 dstR, dstG, dstB; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -4735,12 +4735,12 @@ static void SDL_Blit_ABGR8888_RGB888_Modulate_Scale(SDL_BlitInfo *info) const Uint32 modulateB = info->b; Uint32 pixel; Uint32 R, G, B; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -4850,12 +4850,12 @@ static void SDL_Blit_ABGR8888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info) Uint32 srcR, srcG, srcB, srcA; Uint32 dstpixel; Uint32 dstR, dstG, dstB; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -4923,12 +4923,12 @@ static void SDL_Blit_ABGR8888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info) static void SDL_Blit_ABGR8888_BGR888_Scale(SDL_BlitInfo *info) { Uint32 pixel; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -5016,12 +5016,12 @@ static void SDL_Blit_ABGR8888_BGR888_Blend_Scale(SDL_BlitInfo *info) Uint32 srcR, srcG, srcB, srcA; Uint32 dstpixel; Uint32 dstR, dstG, dstB; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -5117,12 +5117,12 @@ static void SDL_Blit_ABGR8888_BGR888_Modulate_Scale(SDL_BlitInfo *info) const Uint32 modulateB = info->b; Uint32 pixel; Uint32 R, G, B; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -5232,12 +5232,12 @@ static void SDL_Blit_ABGR8888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info) Uint32 srcR, srcG, srcB, srcA; Uint32 dstpixel; Uint32 dstR, dstG, dstB; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -5306,12 +5306,12 @@ static void SDL_Blit_ABGR8888_ARGB8888_Scale(SDL_BlitInfo *info) { Uint32 pixel; Uint32 R, G, B, A; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -5401,12 +5401,12 @@ static void SDL_Blit_ABGR8888_ARGB8888_Blend_Scale(SDL_BlitInfo *info) Uint32 srcR, srcG, srcB, srcA; Uint32 dstpixel; Uint32 dstR, dstG, dstB, dstA; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -5508,12 +5508,12 @@ static void SDL_Blit_ABGR8888_ARGB8888_Modulate_Scale(SDL_BlitInfo *info) const Uint32 modulateA = info->a; Uint32 pixel; Uint32 R, G, B, A; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -5627,12 +5627,12 @@ static void SDL_Blit_ABGR8888_ARGB8888_Modulate_Blend_Scale(SDL_BlitInfo *info) Uint32 srcR, srcG, srcB, srcA; Uint32 dstpixel; Uint32 dstR, dstG, dstB, dstA; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -5702,12 +5702,12 @@ static void SDL_Blit_BGRA8888_RGB888_Scale(SDL_BlitInfo *info) { Uint32 pixel; Uint32 R, G, B; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -5796,12 +5796,12 @@ static void SDL_Blit_BGRA8888_RGB888_Blend_Scale(SDL_BlitInfo *info) Uint32 srcR, srcG, srcB, srcA; Uint32 dstpixel; Uint32 dstR, dstG, dstB; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -5897,12 +5897,12 @@ static void SDL_Blit_BGRA8888_RGB888_Modulate_Scale(SDL_BlitInfo *info) const Uint32 modulateB = info->b; Uint32 pixel; Uint32 R, G, B; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -6012,12 +6012,12 @@ static void SDL_Blit_BGRA8888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info) Uint32 srcR, srcG, srcB, srcA; Uint32 dstpixel; Uint32 dstR, dstG, dstB; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -6085,12 +6085,12 @@ static void SDL_Blit_BGRA8888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info) static void SDL_Blit_BGRA8888_BGR888_Scale(SDL_BlitInfo *info) { Uint32 pixel; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -6178,12 +6178,12 @@ static void SDL_Blit_BGRA8888_BGR888_Blend_Scale(SDL_BlitInfo *info) Uint32 srcR, srcG, srcB, srcA; Uint32 dstpixel; Uint32 dstR, dstG, dstB; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -6279,12 +6279,12 @@ static void SDL_Blit_BGRA8888_BGR888_Modulate_Scale(SDL_BlitInfo *info) const Uint32 modulateB = info->b; Uint32 pixel; Uint32 R, G, B; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -6394,12 +6394,12 @@ static void SDL_Blit_BGRA8888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info) Uint32 srcR, srcG, srcB, srcA; Uint32 dstpixel; Uint32 dstR, dstG, dstB; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -6468,12 +6468,12 @@ static void SDL_Blit_BGRA8888_ARGB8888_Scale(SDL_BlitInfo *info) { Uint32 pixel; Uint32 R, G, B, A; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -6563,12 +6563,12 @@ static void SDL_Blit_BGRA8888_ARGB8888_Blend_Scale(SDL_BlitInfo *info) Uint32 srcR, srcG, srcB, srcA; Uint32 dstpixel; Uint32 dstR, dstG, dstB, dstA; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -6670,12 +6670,12 @@ static void SDL_Blit_BGRA8888_ARGB8888_Modulate_Scale(SDL_BlitInfo *info) const Uint32 modulateA = info->a; Uint32 pixel; Uint32 R, G, B, A; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -6789,12 +6789,12 @@ static void SDL_Blit_BGRA8888_ARGB8888_Modulate_Blend_Scale(SDL_BlitInfo *info) Uint32 srcR, srcG, srcB, srcA; Uint32 dstpixel; Uint32 dstR, dstG, dstB, dstA; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { diff --git a/thirdparty/SDL/src/video/SDL_blit_auto.h b/thirdparty/SDL/src/video/SDL_blit_auto.h index f7f89c7c0..1b7f227d7 100644 --- a/thirdparty/SDL/src/video/SDL_blit_auto.h +++ b/thirdparty/SDL/src/video/SDL_blit_auto.h @@ -1,7 +1,7 @@ /* DO NOT EDIT! This file is generated by sdlgenblit.pl */ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/SDL_blit_copy.c b/thirdparty/SDL/src/video/SDL_blit_copy.c index b772a5540..47dafb59e 100644 --- a/thirdparty/SDL/src/video/SDL_blit_copy.c +++ b/thirdparty/SDL/src/video/SDL_blit_copy.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/SDL_blit_copy.h b/thirdparty/SDL/src/video/SDL_blit_copy.h index a245db8e8..0979a87da 100644 --- a/thirdparty/SDL/src/video/SDL_blit_copy.h +++ b/thirdparty/SDL/src/video/SDL_blit_copy.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/SDL_blit_slow.c b/thirdparty/SDL/src/video/SDL_blit_slow.c index fb8516bd8..7696dcf92 100644 --- a/thirdparty/SDL/src/video/SDL_blit_slow.c +++ b/thirdparty/SDL/src/video/SDL_blit_slow.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -54,9 +54,9 @@ void SDL_Blit_Slow(SDL_BlitInfo *info) Uint32 srcR, srcG, srcB, srcA; Uint32 dstpixel; Uint32 dstR, dstG, dstB, dstA; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; SDL_PixelFormat *src_fmt = info->src_fmt; SDL_PixelFormat *dst_fmt = info->dst_fmt; int srcbpp = src_fmt->BytesPerPixel; @@ -69,8 +69,8 @@ void SDL_Blit_Slow(SDL_BlitInfo *info) srcfmt_val = detect_format(src_fmt); dstfmt_val = detect_format(dst_fmt); - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; /* start at the middle of pixel */ while (info->dst_h--) { diff --git a/thirdparty/SDL/src/video/SDL_blit_slow.h b/thirdparty/SDL/src/video/SDL_blit_slow.h index 37bc7ca64..05b1dca22 100644 --- a/thirdparty/SDL/src/video/SDL_blit_slow.h +++ b/thirdparty/SDL/src/video/SDL_blit_slow.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/SDL_bmp.c b/thirdparty/SDL/src/video/SDL_bmp.c index 82147a583..10e99fb04 100644 --- a/thirdparty/SDL/src/video/SDL_bmp.c +++ b/thirdparty/SDL/src/video/SDL_bmp.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -238,7 +238,7 @@ SDL_Surface *SDL_LoadBMP_RW(SDL_RWops *src, int freesrc) /* Make sure we are passed a valid data source */ surface = NULL; was_error = SDL_FALSE; - if (src == NULL) { + if (!src) { SDL_InvalidParamError("src"); was_error = SDL_TRUE; goto done; @@ -424,7 +424,7 @@ SDL_Surface *SDL_LoadBMP_RW(SDL_RWops *src, int freesrc) surface = SDL_CreateRGBSurface(0, biWidth, biHeight, biBitCount, Rmask, Gmask, Bmask, Amask); - if (surface == NULL) { + if (!surface) { was_error = SDL_TRUE; goto done; } @@ -667,7 +667,7 @@ int SDL_SaveBMP_RW(SDL_Surface *surface, SDL_RWops *dst, int freedst) } #endif /* SAVE_32BIT_BMP */ - if (surface->format->palette != NULL && !save32bit) { + if (surface->format->palette && !save32bit) { if (surface->format->BitsPerPixel == 8) { intermediate_surface = surface; } else { @@ -697,7 +697,7 @@ int SDL_SaveBMP_RW(SDL_Surface *surface, SDL_RWops *dst, int freedst) SDL_InitFormat(&format, SDL_PIXELFORMAT_BGR24); } intermediate_surface = SDL_ConvertSurface(surface, &format, 0); - if (intermediate_surface == NULL) { + if (!intermediate_surface) { SDL_SetError("Couldn't convert image to %d bpp", format.BitsPerPixel); } diff --git a/thirdparty/SDL/src/video/SDL_clipboard.c b/thirdparty/SDL/src/video/SDL_clipboard.c index e18668cea..3111a63b6 100644 --- a/thirdparty/SDL/src/video/SDL_clipboard.c +++ b/thirdparty/SDL/src/video/SDL_clipboard.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -27,11 +27,11 @@ int SDL_SetClipboardText(const char *text) { SDL_VideoDevice *_this = SDL_GetVideoDevice(); - if (_this == NULL) { + if (!_this) { return SDL_SetError("Video subsystem must be initialized to set clipboard text"); } - if (text == NULL) { + if (!text) { text = ""; } if (_this->SetClipboardText) { @@ -47,11 +47,11 @@ int SDL_SetPrimarySelectionText(const char *text) { SDL_VideoDevice *_this = SDL_GetVideoDevice(); - if (_this == NULL) { + if (!_this) { return SDL_SetError("Video subsystem must be initialized to set primary selection text"); } - if (text == NULL) { + if (!text) { text = ""; } if (_this->SetPrimarySelectionText) { @@ -67,7 +67,7 @@ char *SDL_GetClipboardText(void) { SDL_VideoDevice *_this = SDL_GetVideoDevice(); - if (_this == NULL) { + if (!_this) { SDL_SetError("Video subsystem must be initialized to get clipboard text"); return SDL_strdup(""); } @@ -76,7 +76,7 @@ char *SDL_GetClipboardText(void) return _this->GetClipboardText(_this); } else { const char *text = _this->clipboard_text; - if (text == NULL) { + if (!text) { text = ""; } return SDL_strdup(text); @@ -87,7 +87,7 @@ char *SDL_GetPrimarySelectionText(void) { SDL_VideoDevice *_this = SDL_GetVideoDevice(); - if (_this == NULL) { + if (!_this) { SDL_SetError("Video subsystem must be initialized to get primary selection text"); return SDL_strdup(""); } @@ -96,7 +96,7 @@ char *SDL_GetPrimarySelectionText(void) return _this->GetPrimarySelectionText(_this); } else { const char *text = _this->primary_selection_text; - if (text == NULL) { + if (!text) { text = ""; } return SDL_strdup(text); @@ -107,7 +107,7 @@ SDL_bool SDL_HasClipboardText(void) { SDL_VideoDevice *_this = SDL_GetVideoDevice(); - if (_this == NULL) { + if (!_this) { SDL_SetError("Video subsystem must be initialized to check clipboard text"); return SDL_FALSE; } @@ -127,7 +127,7 @@ SDL_bool SDL_HasPrimarySelectionText(void) { SDL_VideoDevice *_this = SDL_GetVideoDevice(); - if (_this == NULL) { + if (!_this) { SDL_SetError("Video subsystem must be initialized to check primary selection text"); return SDL_FALSE; } diff --git a/thirdparty/SDL/src/video/SDL_egl.c b/thirdparty/SDL/src/video/SDL_egl.c index 8e5f165b5..a89c0e812 100644 --- a/thirdparty/SDL/src/video/SDL_egl.c +++ b/thirdparty/SDL/src/video/SDL_egl.c @@ -1,6 +1,6 @@ /* * Simple DirectMedia Layer - * Copyright (C) 1997-2023 Sam Lantinga + * Copyright (C) 1997-2024 Sam Lantinga * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages @@ -20,16 +20,16 @@ */ #include "../SDL_internal.h" -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL -#if SDL_VIDEO_DRIVER_WINDOWS || SDL_VIDEO_DRIVER_WINRT +#if defined(SDL_VIDEO_DRIVER_WINDOWS) || defined(SDL_VIDEO_DRIVER_WINRT) #include "../core/windows/SDL_windows.h" #endif -#if SDL_VIDEO_DRIVER_ANDROID +#ifdef SDL_VIDEO_DRIVER_ANDROID #include #include "../video/android/SDL_androidvideo.h" #endif -#if SDL_VIDEO_DRIVER_RPI +#ifdef SDL_VIDEO_DRIVER_RPI #include #endif @@ -57,7 +57,7 @@ #define EGL_PRESENT_OPAQUE_EXT 0x31DF #endif /* EGL_EXT_present_opaque */ -#if SDL_VIDEO_DRIVER_RPI +#ifdef SDL_VIDEO_DRIVER_RPI /* Raspbian places the OpenGL ES/EGL binaries in a non standard path */ #define DEFAULT_EGL (vc4 ? "libEGL.so.1" : "libbrcmEGL.so") #define DEFAULT_OGL_ES2 (vc4 ? "libGLESv2.so.2" : "libbrcmGLESv2.so") @@ -66,21 +66,21 @@ #define DEFAULT_OGL_ES_PVR (vc4 ? "libGLES_CM.so.1" : "libbrcmGLESv2.so") #define DEFAULT_OGL_ES (vc4 ? "libGLESv1_CM.so.1" : "libbrcmGLESv2.so") -#elif SDL_VIDEO_DRIVER_ANDROID || SDL_VIDEO_DRIVER_VIVANTE +#elif defined(SDL_VIDEO_DRIVER_ANDROID) || defined(SDL_VIDEO_DRIVER_VIVANTE) /* Android */ #define DEFAULT_EGL "libEGL.so" #define DEFAULT_OGL_ES2 "libGLESv2.so" #define DEFAULT_OGL_ES_PVR "libGLES_CM.so" #define DEFAULT_OGL_ES "libGLESv1_CM.so" -#elif SDL_VIDEO_DRIVER_WINDOWS || SDL_VIDEO_DRIVER_WINRT +#elif defined(SDL_VIDEO_DRIVER_WINDOWS) || defined(SDL_VIDEO_DRIVER_WINRT) /* EGL AND OpenGL ES support via ANGLE */ #define DEFAULT_EGL "libEGL.dll" #define DEFAULT_OGL_ES2 "libGLESv2.dll" #define DEFAULT_OGL_ES_PVR "libGLES_CM.dll" #define DEFAULT_OGL_ES "libGLESv1_CM.dll" -#elif SDL_VIDEO_DRIVER_COCOA +#elif defined(SDL_VIDEO_DRIVER_COCOA) /* EGL AND OpenGL ES support via ANGLE */ #define DEFAULT_EGL "libEGL.dylib" #define DEFAULT_OGL_ES2 "libGLESv2.dylib" @@ -105,7 +105,7 @@ #define DEFAULT_OGL_ES "libGLESv1_CM.so.1" #endif /* SDL_VIDEO_DRIVER_RPI */ -#if SDL_VIDEO_OPENGL && !SDL_VIDEO_VITA_PVR_OGL +#if defined(SDL_VIDEO_OPENGL) && !defined(SDL_VIDEO_VITA_PVR_OGL) #include "SDL_opengl.h" #endif @@ -178,7 +178,7 @@ SDL_bool SDL_EGL_HasExtension(_THIS, SDL_EGL_ExtensionType type, const char *ext const char *ext_start; /* Invalid extensions can be rejected early */ - if (ext == NULL || *ext == 0 || SDL_strchr(ext, ' ') != NULL) { + if (!ext || *ext == 0 || SDL_strchr(ext, ' ') != NULL) { /* SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "SDL_EGL_HasExtension: Invalid EGL extension"); */ return SDL_FALSE; } @@ -191,7 +191,7 @@ SDL_bool SDL_EGL_HasExtension(_THIS, SDL_EGL_ExtensionType type, const char *ext * 1 If set, the client extension is masked and not present to SDL. */ ext_override = SDL_getenv(ext); - if (ext_override != NULL) { + if (ext_override) { int disable_ext = SDL_atoi(ext_override); if (disable_ext & 0x01 && type == SDL_EGL_DISPLAY_EXTENSION) { return SDL_FALSE; @@ -217,12 +217,12 @@ SDL_bool SDL_EGL_HasExtension(_THIS, SDL_EGL_ExtensionType type, const char *ext return SDL_FALSE; } - if (egl_extstr != NULL) { + if (egl_extstr) { ext_start = egl_extstr; while (*ext_start) { ext_start = SDL_strstr(ext_start, ext); - if (ext_start == NULL) { + if (!ext_start) { return SDL_FALSE; } /* Check if the match is not just a substring of one of the extensions */ @@ -245,24 +245,24 @@ SDL_bool SDL_EGL_HasExtension(_THIS, SDL_EGL_ExtensionType type, const char *ext void *SDL_EGL_GetProcAddress(_THIS, const char *proc) { void *retval = NULL; - if (_this->egl_data != NULL) { + if (_this->egl_data) { const Uint32 eglver = (((Uint32)_this->egl_data->egl_version_major) << 16) | ((Uint32)_this->egl_data->egl_version_minor); const SDL_bool is_egl_15_or_later = eglver >= ((((Uint32)1) << 16) | 5); /* EGL 1.5 can use eglGetProcAddress() for any symbol. 1.4 and earlier can't use it for core entry points. */ - if (retval == NULL && is_egl_15_or_later && _this->egl_data->eglGetProcAddress) { + if (!retval && is_egl_15_or_later && _this->egl_data->eglGetProcAddress) { retval = _this->egl_data->eglGetProcAddress(proc); } #if !defined(__EMSCRIPTEN__) && !defined(SDL_VIDEO_DRIVER_VITA) /* LoadFunction isn't needed on Emscripten and will call dlsym(), causing other problems. */ /* Try SDL_LoadFunction() first for EGL <= 1.4, or as a fallback for >= 1.5. */ - if (retval == NULL) { + if (!retval) { retval = SDL_LoadFunction(_this->egl_data->opengl_dll_handle, proc); } #endif /* Try eglGetProcAddress if we're on <= 1.4 and still searching... */ - if (retval == NULL && !is_egl_15_or_later && _this->egl_data->eglGetProcAddress) { + if (!retval && !is_egl_15_or_later && _this->egl_data->eglGetProcAddress) { retval = _this->egl_data->eglGetProcAddress(proc); } } @@ -295,14 +295,14 @@ static int SDL_EGL_LoadLibraryInternal(_THIS, const char *egl_path) { void *egl_dll_handle = NULL, *opengl_dll_handle = NULL; const char *path = NULL; -#if SDL_VIDEO_DRIVER_WINDOWS || SDL_VIDEO_DRIVER_WINRT +#if defined(SDL_VIDEO_DRIVER_WINDOWS) || defined(SDL_VIDEO_DRIVER_WINRT) const char *d3dcompiler; #endif -#if SDL_VIDEO_DRIVER_RPI +#ifdef SDL_VIDEO_DRIVER_RPI SDL_bool vc4 = (0 == access("/sys/module/vc4/", F_OK)); #endif -#if SDL_VIDEO_DRIVER_WINDOWS || SDL_VIDEO_DRIVER_WINRT +#if defined(SDL_VIDEO_DRIVER_WINDOWS) || defined(SDL_VIDEO_DRIVER_WINRT) d3dcompiler = SDL_GetHint(SDL_HINT_VIDEO_WIN_D3DCOMPILER); if (d3dcompiler) { if (SDL_strcasecmp(d3dcompiler, "none") != 0) { @@ -336,17 +336,17 @@ static int SDL_EGL_LoadLibraryInternal(_THIS, const char *egl_path) #if !defined(SDL_VIDEO_STATIC_ANGLE) && !defined(SDL_VIDEO_DRIVER_VITA) /* A funny thing, loading EGL.so first does not work on the Raspberry, so we load libGL* first */ path = SDL_getenv("SDL_VIDEO_GL_DRIVER"); - if (path != NULL) { + if (path) { opengl_dll_handle = SDL_LoadObject(path); } - if (opengl_dll_handle == NULL) { + if (!opengl_dll_handle) { if (_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES) { if (_this->gl_config.major_version > 1) { path = DEFAULT_OGL_ES2; opengl_dll_handle = SDL_LoadObject(path); #ifdef ALT_OGL_ES2 - if (opengl_dll_handle == NULL && !vc4) { + if (!opengl_dll_handle && !vc4) { path = ALT_OGL_ES2; opengl_dll_handle = SDL_LoadObject(path); } @@ -355,12 +355,12 @@ static int SDL_EGL_LoadLibraryInternal(_THIS, const char *egl_path) } else { path = DEFAULT_OGL_ES; opengl_dll_handle = SDL_LoadObject(path); - if (opengl_dll_handle == NULL) { + if (!opengl_dll_handle) { path = DEFAULT_OGL_ES_PVR; opengl_dll_handle = SDL_LoadObject(path); } #ifdef ALT_OGL_ES2 - if (opengl_dll_handle == NULL && !vc4) { + if (!opengl_dll_handle && !vc4) { path = ALT_OGL_ES2; opengl_dll_handle = SDL_LoadObject(path); } @@ -372,7 +372,7 @@ static int SDL_EGL_LoadLibraryInternal(_THIS, const char *egl_path) path = DEFAULT_OGL; opengl_dll_handle = SDL_LoadObject(path); #ifdef ALT_OGL - if (opengl_dll_handle == NULL) { + if (!opengl_dll_handle) { path = ALT_OGL; opengl_dll_handle = SDL_LoadObject(path); } @@ -382,34 +382,34 @@ static int SDL_EGL_LoadLibraryInternal(_THIS, const char *egl_path) } _this->egl_data->opengl_dll_handle = opengl_dll_handle; - if (opengl_dll_handle == NULL) { + if (!opengl_dll_handle) { return SDL_SetError("Could not initialize OpenGL / GLES library"); } /* Loading libGL* in the previous step took care of loading libEGL.so, but we future proof by double checking */ - if (egl_path != NULL) { + if (egl_path) { egl_dll_handle = SDL_LoadObject(egl_path); } /* Try loading a EGL symbol, if it does not work try the default library paths */ - if (egl_dll_handle == NULL || SDL_LoadFunction(egl_dll_handle, "eglChooseConfig") == NULL) { - if (egl_dll_handle != NULL) { + if (!egl_dll_handle || SDL_LoadFunction(egl_dll_handle, "eglChooseConfig") == NULL) { + if (egl_dll_handle) { SDL_UnloadObject(egl_dll_handle); } path = SDL_getenv("SDL_VIDEO_EGL_DRIVER"); - if (path == NULL) { + if (!path) { path = DEFAULT_EGL; } egl_dll_handle = SDL_LoadObject(path); #ifdef ALT_EGL - if (egl_dll_handle == NULL && !vc4) { + if (!egl_dll_handle && !vc4) { path = ALT_EGL; egl_dll_handle = SDL_LoadObject(path); } #endif - if (egl_dll_handle == NULL || SDL_LoadFunction(egl_dll_handle, "eglChooseConfig") == NULL) { - if (egl_dll_handle != NULL) { + if (!egl_dll_handle || SDL_LoadFunction(egl_dll_handle, "eglChooseConfig") == NULL) { + if (egl_dll_handle) { SDL_UnloadObject(egl_dll_handle); } return SDL_SetError("Could not load EGL library"); @@ -419,7 +419,7 @@ static int SDL_EGL_LoadLibraryInternal(_THIS, const char *egl_path) #endif _this->egl_data->egl_dll_handle = egl_dll_handle; -#if SDL_VIDEO_DRIVER_VITA +#ifdef SDL_VIDEO_DRIVER_VITA _this->egl_data->opengl_dll_handle = opengl_dll_handle; #endif @@ -535,7 +535,7 @@ int SDL_EGL_LoadLibrary(_THIS, const char *egl_path, NativeDisplayType native_di } #endif /* Try the implementation-specific eglGetDisplay even if eglGetPlatformDisplay fails */ - if ((_this->egl_data->egl_display == EGL_NO_DISPLAY) && (_this->egl_data->eglGetDisplay != NULL)) { + if ((_this->egl_data->egl_display == EGL_NO_DISPLAY) && (_this->egl_data->eglGetDisplay)) { _this->egl_data->egl_display = _this->egl_data->eglGetDisplay(native_display); } if (_this->egl_data->egl_display == EGL_NO_DISPLAY) { @@ -578,11 +578,11 @@ int SDL_EGL_InitializeOffscreen(_THIS, int device) } /* Check for all extensions that are optional until used and fail if any is missing */ - if (_this->egl_data->eglQueryDevicesEXT == NULL) { + if (!_this->egl_data->eglQueryDevicesEXT) { return SDL_SetError("eglQueryDevicesEXT is missing (EXT_device_enumeration not supported by the drivers?)"); } - if (_this->egl_data->eglGetPlatformDisplayEXT == NULL) { + if (!_this->egl_data->eglGetPlatformDisplayEXT) { return SDL_SetError("eglGetPlatformDisplayEXT is missing (EXT_platform_base not supported by the drivers?)"); } @@ -954,7 +954,7 @@ SDL_GLContext SDL_EGL_CreateContext(_THIS, EGLSurface egl_surface) share_context = (EGLContext)SDL_GL_GetCurrentContext(); } -#if SDL_VIDEO_DRIVER_ANDROID +#ifdef SDL_VIDEO_DRIVER_ANDROID if (_this->gl_config.flags & SDL_GL_CONTEXT_DEBUG_FLAG) { /* If SDL_GL_CONTEXT_DEBUG_FLAG is set but EGL_KHR_debug unsupported, unset. * This is required because some Android devices like to complain about it @@ -1065,7 +1065,7 @@ SDL_GLContext SDL_EGL_CreateContext(_THIS, EGLSurface egl_surface) if (SDL_GL_ExtensionSupported("GL_OES_surfaceless_context")) { _this->gl_allow_no_surface = SDL_TRUE; } -#if SDL_VIDEO_OPENGL && !defined(SDL_VIDEO_DRIVER_VITA) +#if defined(SDL_VIDEO_OPENGL) && !defined(SDL_VIDEO_DRIVER_VITA) } else { /* Desktop OpenGL supports it by default from version 3.0 on. */ void(APIENTRY * glGetIntegervFunc)(GLenum pname, GLint * params); @@ -1179,7 +1179,7 @@ void SDL_EGL_DeleteContext(_THIS, SDL_GLContext context) EGLSurface *SDL_EGL_CreateSurface(_THIS, NativeWindowType nw) { -#if SDL_VIDEO_DRIVER_ANDROID +#ifdef SDL_VIDEO_DRIVER_ANDROID EGLint format_wanted; EGLint format_got; #endif @@ -1193,7 +1193,7 @@ EGLSurface *SDL_EGL_CreateSurface(_THIS, NativeWindowType nw) return EGL_NO_SURFACE; } -#if SDL_VIDEO_DRIVER_ANDROID +#ifdef SDL_VIDEO_DRIVER_ANDROID /* On Android, EGL_NATIVE_VISUAL_ID is an attribute of the EGLConfig that is * guaranteed to be accepted by ANativeWindow_setBuffersGeometry(). */ _this->egl_data->eglGetConfigAttrib(_this->egl_data->egl_display, @@ -1235,7 +1235,7 @@ EGLSurface *SDL_EGL_CreateSurface(_THIS, NativeWindowType nw) SDL_EGL_SetError("unable to create an EGL window surface", "eglCreateWindowSurface"); } -#if SDL_VIDEO_DRIVER_ANDROID +#ifdef SDL_VIDEO_DRIVER_ANDROID format_got = ANativeWindow_getFormat(nw); Android_SetFormat(format_wanted, format_got); #endif diff --git a/thirdparty/SDL/src/video/SDL_egl_c.h b/thirdparty/SDL/src/video/SDL_egl_c.h index feb889a1c..3fc297766 100644 --- a/thirdparty/SDL/src/video/SDL_egl_c.h +++ b/thirdparty/SDL/src/video/SDL_egl_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -23,7 +23,7 @@ #ifndef SDL_egl_h_ #define SDL_egl_h_ -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL #include "SDL_egl.h" @@ -42,7 +42,7 @@ typedef struct SDL_EGL_VideoData EGLint egl_required_visual_id; SDL_bool is_offscreen; /* whether EGL display was offscreen */ EGLenum apitype; /* EGL_OPENGL_ES_API, EGL_OPENGL_API, etc */ - + EGLDisplay(EGLAPIENTRY *eglGetDisplay) (NativeDisplayType display); EGLDisplay(EGLAPIENTRY *eglGetPlatformDisplay) (EGLenum platform, void *native_display, @@ -53,21 +53,21 @@ typedef struct SDL_EGL_VideoData EGLBoolean(EGLAPIENTRY *eglInitialize) (EGLDisplay dpy, EGLint * major, EGLint * minor); EGLBoolean(EGLAPIENTRY *eglTerminate) (EGLDisplay dpy); - + void *(EGLAPIENTRY *eglGetProcAddress) (const char * procName); - + EGLBoolean(EGLAPIENTRY *eglChooseConfig) (EGLDisplay dpy, const EGLint * attrib_list, EGLConfig * configs, EGLint config_size, EGLint * num_config); - + EGLContext(EGLAPIENTRY *eglCreateContext) (EGLDisplay dpy, EGLConfig config, EGLContext share_list, const EGLint * attrib_list); - + EGLBoolean(EGLAPIENTRY *eglDestroyContext) (EGLDisplay dpy, EGLContext ctx); - + EGLSurface(EGLAPIENTRY *eglCreatePbufferSurface)(EGLDisplay dpy, EGLConfig config, EGLint const* attrib_list); @@ -76,25 +76,25 @@ typedef struct SDL_EGL_VideoData NativeWindowType window, const EGLint * attrib_list); EGLBoolean(EGLAPIENTRY *eglDestroySurface) (EGLDisplay dpy, EGLSurface surface); - + EGLBoolean(EGLAPIENTRY *eglMakeCurrent) (EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx); - + EGLBoolean(EGLAPIENTRY *eglSwapBuffers) (EGLDisplay dpy, EGLSurface draw); - + EGLBoolean(EGLAPIENTRY *eglSwapInterval) (EGLDisplay dpy, EGLint interval); - + const char *(EGLAPIENTRY *eglQueryString) (EGLDisplay dpy, EGLint name); EGLenum(EGLAPIENTRY *eglQueryAPI)(void); - + EGLBoolean(EGLAPIENTRY *eglGetConfigAttrib) (EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint * value); - + EGLBoolean(EGLAPIENTRY *eglWaitNative) (EGLint engine); EGLBoolean(EGLAPIENTRY *eglWaitGL)(void); - + EGLBoolean(EGLAPIENTRY *eglBindAPI)(EGLenum); EGLint(EGLAPIENTRY *eglGetError)(void); @@ -109,7 +109,7 @@ typedef struct SDL_EGL_VideoData EGLBoolean(EGLAPIENTRY *eglDestroySyncKHR)(EGLDisplay dpy, EGLSyncKHR sync); - EGLint(EGLAPIENTRY *eglDupNativeFenceFDANDROID)(EGLDisplay dpy, EGLSyncKHR sync); + EGLint(EGLAPIENTRY *eglDupNativeFenceFDANDROID)(EGLDisplay dpy, EGLSyncKHR sync); EGLint(EGLAPIENTRY *eglWaitSyncKHR)(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags); diff --git a/thirdparty/SDL/src/video/SDL_fillrect.c b/thirdparty/SDL/src/video/SDL_fillrect.c index 5687fb951..d7d112fd1 100644 --- a/thirdparty/SDL/src/video/SDL_fillrect.c +++ b/thirdparty/SDL/src/video/SDL_fillrect.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -233,12 +233,12 @@ static void SDL_FillRect4(Uint8 *pixels, int pitch, Uint32 color, int w, int h) */ int SDL_FillRect(SDL_Surface *dst, const SDL_Rect *rect, Uint32 color) { - if (dst == NULL) { + if (!dst) { return SDL_InvalidParamError("SDL_FillRect(): dst"); } /* If 'rect' == NULL, then fill the whole surface */ - if (rect == NULL) { + if (!rect) { rect = &dst->clip_rect; /* Don't attempt to fill if the surface's clip_rect is empty */ if (SDL_RectEmpty(rect)) { @@ -249,7 +249,7 @@ int SDL_FillRect(SDL_Surface *dst, const SDL_Rect *rect, Uint32 color) return SDL_FillRects(dst, rect, 1, color); } -#if SDL_ARM_NEON_BLITTERS +#ifdef SDL_ARM_NEON_BLITTERS void FillRect8ARMNEONAsm(int32_t w, int32_t h, uint8_t *dst, int32_t dst_stride, uint8_t src); void FillRect16ARMNEONAsm(int32_t w, int32_t h, uint16_t *dst, int32_t dst_stride, uint16_t src); void FillRect32ARMNEONAsm(int32_t w, int32_t h, uint32_t *dst, int32_t dst_stride, uint32_t src); @@ -273,7 +273,7 @@ static void fill_32_neon(Uint8 *pixels, int pitch, Uint32 color, int w, int h) } #endif -#if SDL_ARM_SIMD_BLITTERS +#ifdef SDL_ARM_SIMD_BLITTERS void FillRect8ARMSIMDAsm(int32_t w, int32_t h, uint8_t *dst, int32_t dst_stride, uint8_t src); void FillRect16ARMSIMDAsm(int32_t w, int32_t h, uint16_t *dst, int32_t dst_stride, uint16_t src); void FillRect32ARMSIMDAsm(int32_t w, int32_t h, uint32_t *dst, int32_t dst_stride, uint32_t src); @@ -306,7 +306,7 @@ int SDL_FillRects(SDL_Surface *dst, const SDL_Rect *rects, int count, void (*fill_function)(Uint8 * pixels, int pitch, Uint32 color, int w, int h) = NULL; int i; - if (dst == NULL) { + if (!dst) { return SDL_InvalidParamError("SDL_FillRects(): dst"); } @@ -320,7 +320,7 @@ int SDL_FillRects(SDL_Surface *dst, const SDL_Rect *rects, int count, return SDL_SetError("SDL_FillRects(): You must lock the surface"); } - if (rects == NULL) { + if (!rects) { return SDL_InvalidParamError("SDL_FillRects(): rects"); } @@ -341,8 +341,8 @@ int SDL_FillRects(SDL_Surface *dst, const SDL_Rect *rects, int count, return SDL_SetError("SDL_FillRects(): Unsupported surface format"); } -#if SDL_ARM_NEON_BLITTERS - if (SDL_HasNEON() && dst->format->BytesPerPixel != 3 && fill_function == NULL) { +#ifdef SDL_ARM_NEON_BLITTERS + if (SDL_HasNEON() && dst->format->BytesPerPixel != 3 && !fill_function) { switch (dst->format->BytesPerPixel) { case 1: fill_function = fill_8_neon; @@ -356,8 +356,8 @@ int SDL_FillRects(SDL_Surface *dst, const SDL_Rect *rects, int count, } } #endif -#if SDL_ARM_SIMD_BLITTERS - if (SDL_HasARMSIMD() && dst->format->BytesPerPixel != 3 && fill_function == NULL) { +#ifdef SDL_ARM_SIMD_BLITTERS + if (SDL_HasARMSIMD() && dst->format->BytesPerPixel != 3 && !fill_function) { switch (dst->format->BytesPerPixel) { case 1: fill_function = fill_8_simd; @@ -372,7 +372,7 @@ int SDL_FillRects(SDL_Surface *dst, const SDL_Rect *rects, int count, } #endif - if (fill_function == NULL) { + if (!fill_function) { switch (dst->format->BytesPerPixel) { case 1: { diff --git a/thirdparty/SDL/src/video/SDL_pixels.c b/thirdparty/SDL/src/video/SDL_pixels.c index 65e33ab86..a6821784d 100644 --- a/thirdparty/SDL/src/video/SDL_pixels.c +++ b/thirdparty/SDL/src/video/SDL_pixels.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -91,6 +91,8 @@ const char *SDL_GetPixelFormatName(Uint32 format) CASE(SDL_PIXELFORMAT_INDEX1LSB) CASE(SDL_PIXELFORMAT_INDEX1MSB) + CASE(SDL_PIXELFORMAT_INDEX2LSB) + CASE(SDL_PIXELFORMAT_INDEX2MSB) CASE(SDL_PIXELFORMAT_INDEX4LSB) CASE(SDL_PIXELFORMAT_INDEX4MSB) CASE(SDL_PIXELFORMAT_INDEX8) @@ -299,6 +301,9 @@ Uint32 SDL_MasksToPixelFormatEnum(int bpp, Uint32 Rmask, Uint32 Gmask, Uint32 Bm case 1: /* SDL defaults to MSB ordering */ return SDL_PIXELFORMAT_INDEX1MSB; + case 2: + /* SDL defaults to MSB ordering */ + return SDL_PIXELFORMAT_INDEX2MSB; case 4: /* SDL defaults to MSB ordering */ return SDL_PIXELFORMAT_INDEX4MSB; @@ -518,7 +523,7 @@ SDL_PixelFormat *SDL_AllocFormat(Uint32 pixel_format) /* Allocate an empty pixel format structure, and initialize it */ format = SDL_malloc(sizeof(*format)); - if (format == NULL) { + if (!format) { SDL_AtomicUnlock(&formats_lock); SDL_OutOfMemory(); return NULL; @@ -616,7 +621,7 @@ void SDL_FreeFormat(SDL_PixelFormat *format) { SDL_PixelFormat *prev; - if (format == NULL) { + if (!format) { SDL_InvalidParamError("format"); return; } @@ -659,7 +664,7 @@ SDL_Palette *SDL_AllocPalette(int ncolors) } palette = (SDL_Palette *)SDL_malloc(sizeof(*palette)); - if (palette == NULL) { + if (!palette) { SDL_OutOfMemory(); return NULL; } @@ -681,7 +686,7 @@ SDL_Palette *SDL_AllocPalette(int ncolors) int SDL_SetPixelFormatPalette(SDL_PixelFormat *format, SDL_Palette *palette) { - if (format == NULL) { + if (!format) { return SDL_InvalidParamError("SDL_SetPixelFormatPalette(): format"); } @@ -712,7 +717,7 @@ int SDL_SetPaletteColors(SDL_Palette *palette, const SDL_Color *colors, int status = 0; /* Verify the parameters */ - if (palette == NULL) { + if (!palette) { return -1; } if (ncolors > (palette->ncolors - firstcolor)) { @@ -734,7 +739,7 @@ int SDL_SetPaletteColors(SDL_Palette *palette, const SDL_Color *colors, void SDL_FreePalette(SDL_Palette *palette) { - if (palette == NULL) { + if (!palette) { SDL_InvalidParamError("palette"); return; } @@ -856,7 +861,7 @@ Uint32 SDL_MapRGB(const SDL_PixelFormat *format, Uint8 r, Uint8 g, Uint8 b) SDL_InvalidParamError("format"); return 0; } - if (format->palette == NULL) { + if (!format->palette) { return (r >> format->Rloss) << format->Rshift | (g >> format->Gloss) << format->Gshift | (b >> format->Bloss) << format->Bshift | format->Amask; } else { return SDL_FindColor(format->palette, r, g, b, SDL_ALPHA_OPAQUE); @@ -870,7 +875,7 @@ Uint32 SDL_MapRGBA(const SDL_PixelFormat *format, Uint8 r, Uint8 g, Uint8 b, Uin SDL_InvalidParamError("format"); return 0; } - if (format->palette == NULL) { + if (!format->palette) { return (r >> format->Rloss) << format->Rshift | (g >> format->Gloss) << format->Gshift | (b >> format->Bloss) << format->Bshift | ((Uint32)(a >> format->Aloss) << format->Ashift & format->Amask); } else { return SDL_FindColor(format->palette, r, g, b, a); @@ -880,7 +885,7 @@ Uint32 SDL_MapRGBA(const SDL_PixelFormat *format, Uint8 r, Uint8 g, Uint8 b, Uin void SDL_GetRGB(Uint32 pixel, const SDL_PixelFormat *format, Uint8 *r, Uint8 *g, Uint8 *b) { - if (format->palette == NULL) { + if (!format->palette) { unsigned v; v = (pixel & format->Rmask) >> format->Rshift; *r = SDL_expand_byte[format->Rloss][v]; @@ -902,7 +907,7 @@ void SDL_GetRGB(Uint32 pixel, const SDL_PixelFormat *format, Uint8 *r, Uint8 *g, void SDL_GetRGBA(Uint32 pixel, const SDL_PixelFormat *format, Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a) { - if (format->palette == NULL) { + if (!format->palette) { unsigned v; v = (pixel & format->Rmask) >> format->Rshift; *r = SDL_expand_byte[format->Rloss][v]; @@ -943,7 +948,7 @@ static Uint8 *Map1to1(SDL_Palette *src, SDL_Palette *dst, int *identical) *identical = 0; } map = (Uint8 *)SDL_calloc(256, sizeof(Uint8)); - if (map == NULL) { + if (!map) { SDL_OutOfMemory(); return NULL; } @@ -966,7 +971,7 @@ static Uint8 *Map1toN(SDL_PixelFormat *src, Uint8 Rmod, Uint8 Gmod, Uint8 Bmod, bpp = ((dst->BytesPerPixel == 3) ? 4 : dst->BytesPerPixel); map = (Uint8 *)SDL_calloc(256, bpp); - if (map == NULL) { + if (!map) { SDL_OutOfMemory(); return NULL; } @@ -1002,7 +1007,7 @@ SDL_BlitMap *SDL_AllocBlitMap(void) /* Allocate the empty map */ map = (SDL_BlitMap *)SDL_calloc(1, sizeof(*map)); - if (map == NULL) { + if (!map) { SDL_OutOfMemory(); return NULL; } @@ -1031,7 +1036,7 @@ void SDL_InvalidateAllBlitMap(SDL_Surface *surface) void SDL_InvalidateMap(SDL_BlitMap *map) { - if (map == NULL) { + if (!map) { return; } if (map->dst) { @@ -1070,7 +1075,7 @@ int SDL_MapSurface(SDL_Surface *src, SDL_Surface *dst) map->info.table = Map1to1(srcfmt->palette, dstfmt->palette, &map->identity); if (!map->identity) { - if (map->info.table == NULL) { + if (!map->info.table) { return -1; } } @@ -1082,7 +1087,7 @@ int SDL_MapSurface(SDL_Surface *src, SDL_Surface *dst) map->info.table = Map1toN(srcfmt, src->map->info.r, src->map->info.g, src->map->info.b, src->map->info.a, dstfmt); - if (map->info.table == NULL) { + if (!map->info.table) { return -1; } } @@ -1091,7 +1096,7 @@ int SDL_MapSurface(SDL_Surface *src, SDL_Surface *dst) /* BitField --> Palette */ map->info.table = MapNto1(srcfmt, dstfmt, &map->identity); if (!map->identity) { - if (map->info.table == NULL) { + if (!map->info.table) { return -1; } } @@ -1144,7 +1149,7 @@ void SDL_CalculateGammaRamp(float gamma, Uint16 * ramp) SDL_InvalidParamError("gamma"); return; } - if (ramp == NULL) { + if (!ramp) { SDL_InvalidParamError("ramp"); return; } diff --git a/thirdparty/SDL/src/video/SDL_pixels_c.h b/thirdparty/SDL/src/video/SDL_pixels_c.h index 1a6f6243a..7b5eff3aa 100644 --- a/thirdparty/SDL/src/video/SDL_pixels_c.h +++ b/thirdparty/SDL/src/video/SDL_pixels_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/SDL_rect.c b/thirdparty/SDL/src/video/SDL_rect.c index 1b461d230..7af1125d3 100644 --- a/thirdparty/SDL/src/video/SDL_rect.c +++ b/thirdparty/SDL/src/video/SDL_rect.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -38,10 +38,10 @@ SDL_bool SDL_GetSpanEnclosingRect(int width, int height, } else if (height < 1) { SDL_InvalidParamError("height"); return SDL_FALSE; - } else if (rects == NULL) { + } else if (!rects) { SDL_InvalidParamError("rects"); return SDL_FALSE; - } else if (span == NULL) { + } else if (!span) { SDL_InvalidParamError("span"); return SDL_FALSE; } else if (numrects < 1) { @@ -89,6 +89,7 @@ SDL_bool SDL_GetSpanEnclosingRect(int width, int height, #define RECTTYPE SDL_Rect #define POINTTYPE SDL_Point #define SCALARTYPE int +#define BIGSCALARTYPE Sint64 #define COMPUTEOUTCODE ComputeOutCode #define SDL_HASINTERSECTION SDL_HasIntersection #define SDL_INTERSECTRECT SDL_IntersectRect @@ -101,6 +102,7 @@ SDL_bool SDL_GetSpanEnclosingRect(int width, int height, #define RECTTYPE SDL_FRect #define POINTTYPE SDL_FPoint #define SCALARTYPE float +#define BIGSCALARTYPE double #define COMPUTEOUTCODE ComputeOutCodeF #define SDL_HASINTERSECTION SDL_HasIntersectionF #define SDL_INTERSECTRECT SDL_IntersectFRect diff --git a/thirdparty/SDL/src/video/SDL_rect_c.h b/thirdparty/SDL/src/video/SDL_rect_c.h index 639bef844..b7d6e7ffe 100644 --- a/thirdparty/SDL/src/video/SDL_rect_c.h +++ b/thirdparty/SDL/src/video/SDL_rect_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/SDL_rect_impl.h b/thirdparty/SDL/src/video/SDL_rect_impl.h index b0e3901b1..288a72776 100644 --- a/thirdparty/SDL/src/video/SDL_rect_impl.h +++ b/thirdparty/SDL/src/video/SDL_rect_impl.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,10 +25,10 @@ SDL_bool SDL_HASINTERSECTION(const RECTTYPE *A, const RECTTYPE *B) { SCALARTYPE Amin, Amax, Bmin, Bmax; - if (A == NULL) { + if (!A) { SDL_InvalidParamError("A"); return SDL_FALSE; - } else if (B == NULL) { + } else if (!B) { SDL_InvalidParamError("B"); return SDL_FALSE; } else if (SDL_RECTEMPTY(A) || SDL_RECTEMPTY(B)) { @@ -70,13 +70,13 @@ SDL_bool SDL_INTERSECTRECT(const RECTTYPE *A, const RECTTYPE *B, RECTTYPE *resul { SCALARTYPE Amin, Amax, Bmin, Bmax; - if (A == NULL) { + if (!A) { SDL_InvalidParamError("A"); return SDL_FALSE; - } else if (B == NULL) { + } else if (!B) { SDL_InvalidParamError("B"); return SDL_FALSE; - } else if (result == NULL) { + } else if (!result) { SDL_InvalidParamError("result"); return SDL_FALSE; } else if (SDL_RECTEMPTY(A) || SDL_RECTEMPTY(B)) { /* Special cases for empty rects */ @@ -120,13 +120,13 @@ void SDL_UNIONRECT(const RECTTYPE *A, const RECTTYPE *B, RECTTYPE *result) { SCALARTYPE Amin, Amax, Bmin, Bmax; - if (A == NULL) { + if (!A) { SDL_InvalidParamError("A"); return; - } else if (B == NULL) { + } else if (!B) { SDL_InvalidParamError("B"); return; - } else if (result == NULL) { + } else if (!result) { SDL_InvalidParamError("result"); return; } else if (SDL_RECTEMPTY(A)) { /* Special cases for empty Rects */ @@ -180,7 +180,7 @@ SDL_bool SDL_ENCLOSEPOINTS(const POINTTYPE *points, int count, const RECTTYPE *c SCALARTYPE x, y; int i; - if (points == NULL) { + if (!points) { SDL_InvalidParamError("points"); return SDL_FALSE; } else if (count < 1) { @@ -210,7 +210,7 @@ SDL_bool SDL_ENCLOSEPOINTS(const POINTTYPE *points, int count, const RECTTYPE *c } if (!added) { /* Special case: if no result was requested, we are done */ - if (result == NULL) { + if (!result) { return SDL_TRUE; } @@ -236,7 +236,7 @@ SDL_bool SDL_ENCLOSEPOINTS(const POINTTYPE *points, int count, const RECTTYPE *c } } else { /* Special case: if no result was requested, we are done */ - if (result == NULL) { + if (!result) { return SDL_TRUE; } @@ -299,19 +299,19 @@ SDL_bool SDL_INTERSECTRECTANDLINE(const RECTTYPE *rect, SCALARTYPE *X1, SCALARTY SCALARTYPE recty2; int outcode1, outcode2; - if (rect == NULL) { + if (!rect) { SDL_InvalidParamError("rect"); return SDL_FALSE; - } else if (X1 == NULL) { + } else if (!X1) { SDL_InvalidParamError("X1"); return SDL_FALSE; - } else if (Y1 == NULL) { + } else if (!Y1) { SDL_InvalidParamError("Y1"); return SDL_FALSE; - } else if (X2 == NULL) { + } else if (!X2) { SDL_InvalidParamError("X2"); return SDL_FALSE; - } else if (Y2 == NULL) { + } else if (!Y2) { SDL_InvalidParamError("Y2"); return SDL_FALSE; } else if (SDL_RECTEMPTY(rect)) { @@ -378,16 +378,16 @@ SDL_bool SDL_INTERSECTRECTANDLINE(const RECTTYPE *rect, SCALARTYPE *X1, SCALARTY if (outcode1) { if (outcode1 & CODE_TOP) { y = recty1; - x = x1 + ((x2 - x1) * (y - y1)) / (y2 - y1); + x = (SCALARTYPE) (x1 + ((BIGSCALARTYPE)(x2 - x1) * (y - y1)) / (y2 - y1)); } else if (outcode1 & CODE_BOTTOM) { y = recty2; - x = x1 + ((x2 - x1) * (y - y1)) / (y2 - y1); + x = (SCALARTYPE) (x1 + ((BIGSCALARTYPE)(x2 - x1) * (y - y1)) / (y2 - y1)); } else if (outcode1 & CODE_LEFT) { x = rectx1; - y = y1 + ((y2 - y1) * (x - x1)) / (x2 - x1); + y = (SCALARTYPE) (y1 + ((BIGSCALARTYPE)(y2 - y1) * (x - x1)) / (x2 - x1)); } else if (outcode1 & CODE_RIGHT) { x = rectx2; - y = y1 + ((y2 - y1) * (x - x1)) / (x2 - x1); + y = (SCALARTYPE) (y1 + ((BIGSCALARTYPE)(y2 - y1) * (x - x1)) / (x2 - x1)); } x1 = x; y1 = y; @@ -396,23 +396,23 @@ SDL_bool SDL_INTERSECTRECTANDLINE(const RECTTYPE *rect, SCALARTYPE *X1, SCALARTY if (outcode2 & CODE_TOP) { SDL_assert(y2 != y1); /* if equal: division by zero. */ y = recty1; - x = x1 + ((x2 - x1) * (y - y1)) / (y2 - y1); + x = (SCALARTYPE) (x1 + ((BIGSCALARTYPE)(x2 - x1) * (y - y1)) / (y2 - y1)); } else if (outcode2 & CODE_BOTTOM) { SDL_assert(y2 != y1); /* if equal: division by zero. */ y = recty2; - x = x1 + ((x2 - x1) * (y - y1)) / (y2 - y1); + x = (SCALARTYPE) (x1 + ((BIGSCALARTYPE)(x2 - x1) * (y - y1)) / (y2 - y1)); } else if (outcode2 & CODE_LEFT) { /* If this assertion ever fires, here's the static analysis that warned about it: http://buildbot.libsdl.org/sdl-static-analysis/sdl-macosx-static-analysis/sdl-macosx-static-analysis-1101/report-b0d01a.html#EndPath */ SDL_assert(x2 != x1); /* if equal: division by zero. */ x = rectx1; - y = y1 + ((y2 - y1) * (x - x1)) / (x2 - x1); + y = (SCALARTYPE) (y1 + ((BIGSCALARTYPE)(y2 - y1) * (x - x1)) / (x2 - x1)); } else if (outcode2 & CODE_RIGHT) { /* If this assertion ever fires, here's the static analysis that warned about it: http://buildbot.libsdl.org/sdl-static-analysis/sdl-macosx-static-analysis/sdl-macosx-static-analysis-1101/report-39b114.html#EndPath */ SDL_assert(x2 != x1); /* if equal: division by zero. */ x = rectx2; - y = y1 + ((y2 - y1) * (x - x1)) / (x2 - x1); + y = (SCALARTYPE) (y1 + ((BIGSCALARTYPE)(y2 - y1) * (x - x1)) / (x2 - x1)); } x2 = x; y2 = y; @@ -429,6 +429,7 @@ SDL_bool SDL_INTERSECTRECTANDLINE(const RECTTYPE *rect, SCALARTYPE *X1, SCALARTY #undef RECTTYPE #undef POINTTYPE #undef SCALARTYPE +#undef BIGSCALARTYPE #undef COMPUTEOUTCODE #undef SDL_HASINTERSECTION #undef SDL_INTERSECTRECT diff --git a/thirdparty/SDL/src/video/SDL_shape.c b/thirdparty/SDL/src/video/SDL_shape.c index a0b977b6e..77cc8dcad 100644 --- a/thirdparty/SDL/src/video/SDL_shape.c +++ b/thirdparty/SDL/src/video/SDL_shape.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -32,13 +32,13 @@ SDL_Window *SDL_CreateShapedWindow(const char *title, unsigned int x, unsigned i { SDL_Window *result = NULL; result = SDL_CreateWindow(title, -1000, -1000, w, h, (flags | SDL_WINDOW_BORDERLESS) & (~SDL_WINDOW_FULLSCREEN) & (~SDL_WINDOW_RESIZABLE) /* & (~SDL_WINDOW_SHOWN) */); - if (result != NULL) { + if (result) { if (SDL_GetVideoDevice()->shape_driver.CreateShaper == NULL) { SDL_DestroyWindow(result); return NULL; } result->shaper = SDL_GetVideoDevice()->shape_driver.CreateShaper(result); - if (result->shaper != NULL) { + if (result->shaper) { result->shaper->userx = x; result->shaper->usery = y; result->shaper->mode.mode = ShapeModeDefault; @@ -136,7 +136,7 @@ static SDL_ShapeTree *RecursivelyCalculateShapeTree(SDL_WindowShapeMode mode, SD SDL_ShapeTree *result = (SDL_ShapeTree *)SDL_malloc(sizeof(SDL_ShapeTree)); SDL_Rect next = { 0, 0, 0, 0 }; - if (result == NULL) { + if (!result) { SDL_OutOfMemory(); return NULL; } @@ -265,16 +265,16 @@ int SDL_SetWindowShape(SDL_Window *window, SDL_Surface *shape, SDL_WindowShapeMo SDL_VideoDevice *_this = SDL_GetVideoDevice(); int result; - if (window == NULL || !SDL_IsShapedWindow(window)) { + if (!window || !SDL_IsShapedWindow(window)) { /* The window given was not a shapeable window. */ return SDL_NONSHAPEABLE_WINDOW; } - if (shape == NULL) { + if (!shape) { /* Invalid shape argument. */ return SDL_INVALID_SHAPE_ARGUMENT; } - if (shape_mode != NULL) { + if (shape_mode) { window->shaper->mode = *shape_mode; } result = _this->shape_driver.SetWindowShape(window->shaper, shape, shape_mode); @@ -317,7 +317,7 @@ int SDL_SetWindowShape(SDL_Window *window, SDL_Surface *shape, SDL_WindowShapeMo static SDL_bool SDL_WindowHasAShape(SDL_Window *window) { - if (window == NULL || !SDL_IsShapedWindow(window)) { + if (!window || !SDL_IsShapedWindow(window)) { return SDL_FALSE; } return window->shaper->hasshape; @@ -325,8 +325,8 @@ static SDL_bool SDL_WindowHasAShape(SDL_Window *window) int SDL_GetShapedWindowMode(SDL_Window *window, SDL_WindowShapeMode *shape_mode) { - if (window != NULL && SDL_IsShapedWindow(window)) { - if (shape_mode == NULL) { + if (window && SDL_IsShapedWindow(window)) { + if (!shape_mode) { if (SDL_WindowHasAShape(window)) { return 0; /* The window given has a shape. */ } else { diff --git a/thirdparty/SDL/src/video/SDL_shape_internals.h b/thirdparty/SDL/src/video/SDL_shape_internals.h index 7681a045a..ed0b0d0ed 100644 --- a/thirdparty/SDL/src/video/SDL_shape_internals.h +++ b/thirdparty/SDL/src/video/SDL_shape_internals.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/SDL_stretch.c b/thirdparty/SDL/src/video/SDL_stretch.c index ec2bed5cc..dbeabc464 100644 --- a/thirdparty/SDL/src/video/SDL_stretch.c +++ b/thirdparty/SDL/src/video/SDL_stretch.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -149,9 +149,12 @@ static int SDL_UpperSoftStretch(SDL_Surface *src, const SDL_Rect *srcrect, #define BILINEAR___START \ int i; \ - int fp_sum_h, fp_step_h, left_pad_h, right_pad_h; \ - int fp_sum_w, fp_step_w, left_pad_w, right_pad_w; \ - int fp_sum_w_init, left_pad_w_init, right_pad_w_init, dst_gap, middle_init; \ + Sint64 fp_sum_h; \ + int fp_step_h, left_pad_h, right_pad_h; \ + Sint64 fp_sum_w; \ + int fp_step_w, left_pad_w, right_pad_w; \ + Sint64 fp_sum_w_init; \ + int left_pad_w_init, right_pad_w_init, dst_gap, middle_init; \ get_scaler_datas(src_h, dst_h, &fp_sum_h, &fp_step_h, &left_pad_h, &right_pad_h); \ get_scaler_datas(src_w, dst_w, &fp_sum_w, &fp_step_w, &left_pad_w, &right_pad_w); \ fp_sum_w_init = fp_sum_w + left_pad_w * fp_step_w; \ @@ -163,7 +166,8 @@ static int SDL_UpperSoftStretch(SDL_Surface *src, const SDL_Rect *srcrect, #define BILINEAR___HEIGHT \ int index_h, frac_h0, frac_h1, middle; \ const Uint32 *src_h0, *src_h1; \ - int no_padding, incr_h0, incr_h1; \ + int no_padding; \ + Uint64 incr_h0, incr_h1; \ \ no_padding = !(i < left_pad_h || i > dst_h - 1 - right_pad_h); \ index_h = SRC_INDEX(fp_sum_h); \ @@ -172,7 +176,7 @@ static int SDL_UpperSoftStretch(SDL_Surface *src, const SDL_Rect *srcrect, index_h = no_padding ? index_h : (i < left_pad_h ? 0 : src_h - 1); \ frac_h0 = no_padding ? frac_h0 : 0; \ incr_h1 = no_padding ? src_pitch : 0; \ - incr_h0 = index_h * src_pitch; \ + incr_h0 = (Uint64)index_h * src_pitch; \ \ src_h0 = (const Uint32 *)((const Uint8 *)src + incr_h0); \ src_h1 = (const Uint32 *)((const Uint8 *)src_h0 + incr_h1); \ @@ -193,12 +197,12 @@ static int SDL_UpperSoftStretch(SDL_Surface *src, const SDL_Rect *srcrect, // OK with clang 12.0.0 / Xcode __attribute__((noinline)) #endif -static void get_scaler_datas(int src_nb, int dst_nb, int *fp_start, int *fp_step, int *left_pad, int *right_pad) +static void get_scaler_datas(int src_nb, int dst_nb, Sint64 *fp_start, int *fp_step, int *left_pad, int *right_pad) { int step = FIXED_POINT(src_nb) / (dst_nb); /* source step in fixed point */ int x0 = FP_ONE / 2; /* dst first pixel center at 0.5 in fixed point */ - int fp_sum; + Sint64 fp_sum; int i; #if 0 /* scale to source coordinates */ @@ -334,7 +338,7 @@ static int scale_mat(const Uint32 *src, int src_w, int src_h, int src_pitch, } #if defined(__SSE2__) -#define HAVE_SSE2_INTRINSICS 1 +#define HAVE_SSE2_INTRINSICS #endif #if defined(__ARM_NEON) @@ -363,7 +367,7 @@ static void printf_128(const char *str, __m128i var) } #endif -static SDL_INLINE int hasSSE2() +static SDL_INLINE int hasSSE2(void) { static int val = -1; if (val != -1) { @@ -532,7 +536,7 @@ static int scale_mat_SSE(const Uint32 *src, int src_w, int src_h, int src_pitch, #if defined(HAVE_NEON_INTRINSICS) -static SDL_INLINE int hasNEON() +static SDL_INLINE int hasNEON(void) { static int val = -1; if (val != -1) { @@ -824,16 +828,16 @@ int SDL_LowerSoftStretchLinear(SDL_Surface *s, const SDL_Rect *srcrect, return ret; } -#define SDL_SCALE_NEAREST__START \ - int i; \ - Uint32 posy, incy; \ - Uint32 posx, incx; \ - int dst_gap; \ - int srcy, n; \ - const Uint32 *src_h0; \ - incy = (src_h << 16) / dst_h; \ - incx = (src_w << 16) / dst_w; \ - dst_gap = dst_pitch - bpp * dst_w; \ +#define SDL_SCALE_NEAREST__START \ + int i; \ + Uint64 posy, incy; \ + Uint64 posx, incx; \ + Uint64 srcy, srcx; \ + int dst_gap, n; \ + const Uint32 *src_h0; \ + incy = ((Uint64)src_h << 16) / dst_h; \ + incx = ((Uint64)src_w << 16) / dst_w; \ + dst_gap = dst_pitch - bpp * dst_w; \ posy = incy / 2; #define SDL_SCALE_NEAREST__HEIGHT \ @@ -852,7 +856,7 @@ static int scale_mat_nearest_1(const Uint32 *src_ptr, int src_w, int src_h, int SDL_SCALE_NEAREST__HEIGHT while (n--) { const Uint8 *src; - int srcx = bpp * (posx >> 16); + srcx = bpp * (posx >> 16); posx += incx; src = (const Uint8 *)src_h0 + srcx; *(Uint8 *)dst = *src; @@ -872,7 +876,7 @@ static int scale_mat_nearest_2(const Uint32 *src_ptr, int src_w, int src_h, int SDL_SCALE_NEAREST__HEIGHT while (n--) { const Uint16 *src; - int srcx = bpp * (posx >> 16); + srcx = bpp * (posx >> 16); posx += incx; src = (const Uint16 *)((const Uint8 *)src_h0 + srcx); *(Uint16 *)dst = *src; @@ -892,7 +896,7 @@ static int scale_mat_nearest_3(const Uint32 *src_ptr, int src_w, int src_h, int SDL_SCALE_NEAREST__HEIGHT while (n--) { const Uint8 *src; - int srcx = bpp * (posx >> 16); + srcx = bpp * (posx >> 16); posx += incx; src = (const Uint8 *)src_h0 + srcx; ((Uint8 *)dst)[0] = src[0]; @@ -914,7 +918,7 @@ static int scale_mat_nearest_4(const Uint32 *src_ptr, int src_w, int src_h, int SDL_SCALE_NEAREST__HEIGHT while (n--) { const Uint32 *src; - int srcx = bpp * (posx >> 16); + srcx = bpp * (posx >> 16); posx += incx; src = (const Uint32 *)((const Uint8 *)src_h0 + srcx); *dst = *src; diff --git a/thirdparty/SDL/src/video/SDL_surface.c b/thirdparty/SDL/src/video/SDL_surface.c index a81ff7bd5..9db0c5039 100644 --- a/thirdparty/SDL/src/video/SDL_surface.c +++ b/thirdparty/SDL/src/video/SDL_surface.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -107,7 +107,7 @@ SDL_Surface *SDL_CreateRGBSurfaceWithFormat(Uint32 flags, int width, int height, /* Allocate the surface */ surface = (SDL_Surface *)SDL_calloc(1, sizeof(*surface)); - if (surface == NULL) { + if (!surface) { SDL_OutOfMemory(); return NULL; } @@ -125,7 +125,7 @@ SDL_Surface *SDL_CreateRGBSurfaceWithFormat(Uint32 flags, int width, int height, if (SDL_ISPIXELFORMAT_INDEXED(surface->format->format)) { SDL_Palette *palette = SDL_AllocPalette((1 << surface->format->BitsPerPixel)); - if (palette == NULL) { + if (!palette) { SDL_FreeSurface(surface); return NULL; } @@ -238,7 +238,7 @@ SDL_Surface *SDL_CreateRGBSurfaceFrom(void *pixels, } surface = SDL_CreateRGBSurfaceWithFormat(0, 0, 0, depth, format); - if (surface != NULL) { + if (surface) { surface->flags |= SDL_PREALLOC; surface->pixels = pixels; surface->w = width; @@ -284,7 +284,7 @@ SDL_Surface *SDL_CreateRGBSurfaceWithFormatFrom(void *pixels, } surface = SDL_CreateRGBSurfaceWithFormat(0, 0, 0, depth, format); - if (surface != NULL) { + if (surface) { surface->flags |= SDL_PREALLOC; surface->pixels = pixels; surface->w = width; @@ -297,7 +297,7 @@ SDL_Surface *SDL_CreateRGBSurfaceWithFormatFrom(void *pixels, int SDL_SetSurfacePalette(SDL_Surface *surface, SDL_Palette *palette) { - if (surface == NULL) { + if (!surface) { return SDL_InvalidParamError("SDL_SetSurfacePalette(): surface"); } if (SDL_SetPixelFormatPalette(surface->format, palette) < 0) { @@ -312,8 +312,8 @@ int SDL_SetSurfaceRLE(SDL_Surface *surface, int flag) { int flags; - if (surface == NULL) { - return -1; + if (!surface) { + return SDL_InvalidParamError("surface"); } flags = surface->map->info.flags; @@ -330,7 +330,7 @@ int SDL_SetSurfaceRLE(SDL_Surface *surface, int flag) SDL_bool SDL_HasSurfaceRLE(SDL_Surface *surface) { - if (surface == NULL) { + if (!surface) { return SDL_FALSE; } @@ -345,7 +345,7 @@ int SDL_SetColorKey(SDL_Surface *surface, int flag, Uint32 key) { int flags; - if (surface == NULL) { + if (!surface) { return SDL_InvalidParamError("surface"); } @@ -373,7 +373,7 @@ int SDL_SetColorKey(SDL_Surface *surface, int flag, Uint32 key) SDL_bool SDL_HasColorKey(SDL_Surface *surface) { - if (surface == NULL) { + if (!surface) { return SDL_FALSE; } @@ -386,7 +386,7 @@ SDL_bool SDL_HasColorKey(SDL_Surface *surface) int SDL_GetColorKey(SDL_Surface *surface, Uint32 *key) { - if (surface == NULL) { + if (!surface) { return SDL_InvalidParamError("surface"); } @@ -406,7 +406,7 @@ static void SDL_ConvertColorkeyToAlpha(SDL_Surface *surface, SDL_bool ignore_alp { int x, y, bpp; - if (surface == NULL) { + if (!surface) { return; } @@ -495,8 +495,8 @@ int SDL_SetSurfaceColorMod(SDL_Surface *surface, Uint8 r, Uint8 g, Uint8 b) { int flags; - if (surface == NULL) { - return -1; + if (!surface) { + return SDL_InvalidParamError("surface"); } surface->map->info.r = r; @@ -517,8 +517,8 @@ int SDL_SetSurfaceColorMod(SDL_Surface *surface, Uint8 r, Uint8 g, Uint8 b) int SDL_GetSurfaceColorMod(SDL_Surface *surface, Uint8 *r, Uint8 *g, Uint8 *b) { - if (surface == NULL) { - return -1; + if (!surface) { + return SDL_InvalidParamError("surface"); } if (r) { @@ -537,8 +537,8 @@ int SDL_SetSurfaceAlphaMod(SDL_Surface *surface, Uint8 alpha) { int flags; - if (surface == NULL) { - return -1; + if (!surface) { + return SDL_InvalidParamError("surface"); } surface->map->info.a = alpha; @@ -557,8 +557,8 @@ int SDL_SetSurfaceAlphaMod(SDL_Surface *surface, Uint8 alpha) int SDL_GetSurfaceAlphaMod(SDL_Surface *surface, Uint8 *alpha) { - if (surface == NULL) { - return -1; + if (!surface) { + return SDL_InvalidParamError("surface"); } if (alpha) { @@ -571,8 +571,8 @@ int SDL_SetSurfaceBlendMode(SDL_Surface *surface, SDL_BlendMode blendMode) { int flags, status; - if (surface == NULL) { - return -1; + if (!surface) { + return SDL_InvalidParamError("surface"); } status = 0; @@ -608,11 +608,11 @@ int SDL_SetSurfaceBlendMode(SDL_Surface *surface, SDL_BlendMode blendMode) int SDL_GetSurfaceBlendMode(SDL_Surface *surface, SDL_BlendMode *blendMode) { - if (surface == NULL) { - return -1; + if (!surface) { + return SDL_InvalidParamError("surface"); } - if (blendMode == NULL) { + if (!blendMode) { return 0; } @@ -641,7 +641,7 @@ SDL_bool SDL_SetClipRect(SDL_Surface *surface, const SDL_Rect *rect) SDL_Rect full_rect; /* Don't do anything if there's no surface to act on */ - if (surface == NULL) { + if (!surface) { return SDL_FALSE; } @@ -652,7 +652,7 @@ SDL_bool SDL_SetClipRect(SDL_Surface *surface, const SDL_Rect *rect) full_rect.h = surface->h; /* Set the clipping rectangle */ - if (rect == NULL) { + if (!rect) { surface->clip_rect = full_rect; return SDL_TRUE; } @@ -701,85 +701,65 @@ int SDL_LowerBlit(SDL_Surface *src, SDL_Rect *srcrect, int SDL_UpperBlit(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, SDL_Rect *dstrect) { - SDL_Rect fulldst; - int srcx, srcy, w, h; + SDL_Rect r_src, r_dst; /* Make sure the surfaces aren't locked */ - if (src == NULL || dst == NULL) { - return SDL_InvalidParamError("SDL_UpperBlit(): src/dst"); - } - if (src->locked || dst->locked) { + if (!src) { + return SDL_InvalidParamError("src"); + } else if (!dst) { + return SDL_InvalidParamError("dst"); + } else if (src->locked || dst->locked) { return SDL_SetError("Surfaces must not be locked during blit"); } - /* If the destination rectangle is NULL, use the entire dest surface */ - if (dstrect == NULL) { - fulldst.x = fulldst.y = 0; - fulldst.w = dst->w; - fulldst.h = dst->h; - dstrect = &fulldst; + /* Full src surface */ + r_src.x = 0; + r_src.y = 0; + r_src.w = src->w; + r_src.h = src->h; + + if (dstrect) { + r_dst.x = dstrect->x; + r_dst.y = dstrect->y; + } else { + r_dst.x = 0; + r_dst.y = 0; } /* clip the source rectangle to the source surface */ if (srcrect) { - int maxw, maxh; - - srcx = srcrect->x; - w = srcrect->w; - if (srcx < 0) { - w += srcx; - dstrect->x -= srcx; - srcx = 0; - } - maxw = src->w - srcx; - if (maxw < w) { - w = maxw; + SDL_Rect tmp; + if (SDL_IntersectRect(srcrect, &r_src, &tmp) == SDL_FALSE) { + goto end; } - srcy = srcrect->y; - h = srcrect->h; - if (srcy < 0) { - h += srcy; - dstrect->y -= srcy; - srcy = 0; - } - maxh = src->h - srcy; - if (maxh < h) { - h = maxh; - } + /* Shift dstrect, if srcrect origin has changed */ + r_dst.x += tmp.x - srcrect->x; + r_dst.y += tmp.y - srcrect->y; - } else { - srcx = srcy = 0; - w = src->w; - h = src->h; + /* Update srcrect */ + r_src = tmp; } + /* There're no dstrect.w/h parameters. It's the same as srcrect */ + r_dst.w = r_src.w; + r_dst.h = r_src.h; + /* clip the destination rectangle against the clip rectangle */ { - SDL_Rect *clip = &dst->clip_rect; - int dx, dy; - - dx = clip->x - dstrect->x; - if (dx > 0) { - w -= dx; - dstrect->x += dx; - srcx += dx; - } - dx = dstrect->x + w - clip->x - clip->w; - if (dx > 0) { - w -= dx; + SDL_Rect tmp; + if (SDL_IntersectRect(&r_dst, &dst->clip_rect, &tmp) == SDL_FALSE) { + goto end; } - dy = clip->y - dstrect->y; - if (dy > 0) { - h -= dy; - dstrect->y += dy; - srcy += dy; - } - dy = dstrect->y + h - clip->y - clip->h; - if (dy > 0) { - h -= dy; - } + /* Shift srcrect, if dstrect has changed */ + r_src.x += tmp.x - r_dst.x; + r_src.y += tmp.y - r_dst.y; + r_src.w = tmp.w; + r_src.h = tmp.h; + + /* Update dstrect */ + r_dst = tmp; } /* Switch back to a fast blit if we were previously stretching */ @@ -788,15 +768,17 @@ int SDL_UpperBlit(SDL_Surface *src, const SDL_Rect *srcrect, SDL_InvalidateMap(src->map); } - if (w > 0 && h > 0) { - SDL_Rect sr; - sr.x = srcx; - sr.y = srcy; - sr.w = dstrect->w = w; - sr.h = dstrect->h = h; - return SDL_LowerBlit(src, &sr, dst, dstrect); + if (r_dst.w > 0 && r_dst.h > 0) { + if (dstrect) { /* update output parameter */ + *dstrect = r_dst; + } + return SDL_LowerBlit(src, &r_src, dst, &r_dst); + } + +end: + if (dstrect) { /* update output parameter */ + dstrect->w = dstrect->h = 0; } - dstrect->w = dstrect->h = 0; return 0; } @@ -817,14 +799,14 @@ int SDL_PrivateUpperBlitScaled(SDL_Surface *src, const SDL_Rect *srcrect, int dst_w, dst_h; /* Make sure the surfaces aren't locked */ - if (src == NULL || dst == NULL) { + if (!src || !dst) { return SDL_InvalidParamError("SDL_UpperBlitScaled(): src/dst"); } if (src->locked || dst->locked) { return SDL_SetError("Surfaces must not be locked during blit"); } - if (srcrect == NULL) { + if (!srcrect) { src_w = src->w; src_h = src->h; } else { @@ -832,7 +814,7 @@ int SDL_PrivateUpperBlitScaled(SDL_Surface *src, const SDL_Rect *srcrect, src_h = srcrect->h; } - if (dstrect == NULL) { + if (!dstrect) { dst_w = dst->w; dst_h = dst->h; } else { @@ -848,7 +830,7 @@ int SDL_PrivateUpperBlitScaled(SDL_Surface *src, const SDL_Rect *srcrect, scaling_w = (double)dst_w / src_w; scaling_h = (double)dst_h / src_h; - if (dstrect == NULL) { + if (!dstrect) { dst_x0 = 0; dst_y0 = 0; dst_x1 = dst_w; @@ -860,7 +842,7 @@ int SDL_PrivateUpperBlitScaled(SDL_Surface *src, const SDL_Rect *srcrect, dst_y1 = dst_y0 + dst_h; } - if (srcrect == NULL) { + if (!srcrect) { src_x0 = 0; src_y0 = 0; src_x1 = src_w; @@ -1146,17 +1128,17 @@ SDL_Surface *SDL_ConvertSurface(SDL_Surface * surface, const SDL_PixelFormat * f Uint8 *palette_saved_alpha = NULL; int palette_saved_alpha_ncolors = 0; - if (surface == NULL) { + if (!surface) { SDL_InvalidParamError("surface"); return NULL; } - if (format == NULL) { + if (!format) { SDL_InvalidParamError("format"); return NULL; } /* Check for empty destination palette! (results in empty image) */ - if (format->palette != NULL) { + if (format->palette) { int i; for (i = 0; i < format->palette->ncolors; ++i) { if ((format->palette->colors[i].r != 0xFF) || (format->palette->colors[i].g != 0xFF) || (format->palette->colors[i].b != 0xFF)) { @@ -1174,7 +1156,7 @@ SDL_Surface *SDL_ConvertSurface(SDL_Surface * surface, const SDL_PixelFormat * f format->BitsPerPixel, format->Rmask, format->Gmask, format->Bmask, format->Amask); - if (convert == NULL) { + if (!convert) { return NULL; } @@ -1429,13 +1411,13 @@ int SDL_ConvertPixels(int width, int height, void *nonconst_src = (void *)src; int ret; - if (src == NULL) { + if (!src) { return SDL_InvalidParamError("src"); } if (!src_pitch) { return SDL_InvalidParamError("src_pitch"); } - if (dst == NULL) { + if (!dst) { return SDL_InvalidParamError("dst"); } if (!dst_pitch) { @@ -1511,13 +1493,13 @@ int SDL_PremultiplyAlpha(int width, int height, Uint32 dstpixel; Uint32 dstR, dstG, dstB, dstA; - if (src == NULL) { + if (!src) { return SDL_InvalidParamError("src"); } if (!src_pitch) { return SDL_InvalidParamError("src_pitch"); } - if (dst == NULL) { + if (!dst) { return SDL_InvalidParamError("dst"); } if (!dst_pitch) { @@ -1559,7 +1541,7 @@ int SDL_PremultiplyAlpha(int width, int height, */ void SDL_FreeSurface(SDL_Surface *surface) { - if (surface == NULL) { + if (!surface) { return; } if (surface->flags & SDL_DONTFREE) { diff --git a/thirdparty/SDL/src/video/SDL_sysvideo.h b/thirdparty/SDL/src/video/SDL_sysvideo.h index d7a42cc64..344efec48 100644 --- a/thirdparty/SDL/src/video/SDL_sysvideo.h +++ b/thirdparty/SDL/src/video/SDL_sysvideo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -24,6 +24,7 @@ #define SDL_sysvideo_h_ #include "SDL_messagebox.h" +#include "SDL_mouse.h" #include "SDL_shape.h" #include "SDL_thread.h" #include "SDL_metal.h" @@ -433,11 +434,11 @@ struct SDL_VideoDevice void *driverdata; struct SDL_GLDriverData *gl_data; -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL struct SDL_EGL_VideoData *egl_data; #endif -#if SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2 +#if defined(SDL_VIDEO_OPENGL_ES) || defined(SDL_VIDEO_OPENGL_ES2) struct SDL_PrivateGLESData *gles_data; #endif @@ -451,6 +452,7 @@ typedef struct VideoBootStrap const char *name; const char *desc; SDL_VideoDevice *(*create)(void); + int (*ShowMessageBox)(const SDL_MessageBoxData *messageboxdata, int *buttonid); /* can be done without initializing backend! */ } VideoBootStrap; /* Not all of these are available in a given build. Use #ifdefs, etc. */ @@ -528,6 +530,10 @@ extern int SDL_GetPointDisplayIndex(const SDL_Point *point); extern int SDL_GL_SwapWindowWithResult(SDL_Window *window); +#if defined(SDL_VIDEO_DRIVER_X11) || defined(SDL_VIDEO_DRIVER_WAYLAND) || defined(SDL_VIDEO_DRIVER_EMSCRIPTEN) +const char *SDL_GetCSSCursorName(SDL_SystemCursor id, const char **fallback_name); +#endif + #endif /* SDL_sysvideo_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/thirdparty/SDL/src/video/SDL_video.c b/thirdparty/SDL/src/video/SDL_video.c index 8065a0b8c..04a1fdf65 100644 --- a/thirdparty/SDL/src/video/SDL_video.c +++ b/thirdparty/SDL/src/video/SDL_video.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -34,20 +34,20 @@ #include "SDL_syswm.h" -#if SDL_VIDEO_OPENGL +#ifdef SDL_VIDEO_OPENGL #include "SDL_opengl.h" #endif /* SDL_VIDEO_OPENGL */ -#if SDL_VIDEO_OPENGL_ES && !SDL_VIDEO_OPENGL +#if defined(SDL_VIDEO_OPENGL_ES) && !defined(SDL_VIDEO_OPENGL) #include "SDL_opengles.h" #endif /* SDL_VIDEO_OPENGL_ES && !SDL_VIDEO_OPENGL */ /* GL and GLES2 headers conflict on Linux 32 bits */ -#if SDL_VIDEO_OPENGL_ES2 && !SDL_VIDEO_OPENGL +#if defined(SDL_VIDEO_OPENGL_ES2) && !defined(SDL_VIDEO_OPENGL) #include "SDL_opengles2.h" #endif /* SDL_VIDEO_OPENGL_ES2 && !SDL_VIDEO_OPENGL */ -#if !SDL_VIDEO_OPENGL +#ifndef SDL_VIDEO_OPENGL #ifndef GL_CONTEXT_RELEASE_BEHAVIOR_KHR #define GL_CONTEXT_RELEASE_BEHAVIOR_KHR 0x82FB #endif @@ -61,86 +61,87 @@ #include #include #include +#include #endif /* Available video drivers */ static VideoBootStrap *bootstrap[] = { -#if SDL_VIDEO_DRIVER_COCOA +#ifdef SDL_VIDEO_DRIVER_COCOA &COCOA_bootstrap, #endif -#if SDL_VIDEO_DRIVER_X11 +#ifdef SDL_VIDEO_DRIVER_X11 &X11_bootstrap, #endif -#if SDL_VIDEO_DRIVER_WAYLAND +#ifdef SDL_VIDEO_DRIVER_WAYLAND &Wayland_bootstrap, #endif -#if SDL_VIDEO_DRIVER_VIVANTE +#ifdef SDL_VIDEO_DRIVER_VIVANTE &VIVANTE_bootstrap, #endif -#if SDL_VIDEO_DRIVER_DIRECTFB +#ifdef SDL_VIDEO_DRIVER_DIRECTFB &DirectFB_bootstrap, #endif -#if SDL_VIDEO_DRIVER_WINDOWS +#ifdef SDL_VIDEO_DRIVER_WINDOWS &WINDOWS_bootstrap, #endif -#if SDL_VIDEO_DRIVER_WINRT +#ifdef SDL_VIDEO_DRIVER_WINRT &WINRT_bootstrap, #endif -#if SDL_VIDEO_DRIVER_HAIKU +#ifdef SDL_VIDEO_DRIVER_HAIKU &HAIKU_bootstrap, #endif -#if SDL_VIDEO_DRIVER_PANDORA +#ifdef SDL_VIDEO_DRIVER_PANDORA &PND_bootstrap, #endif -#if SDL_VIDEO_DRIVER_UIKIT +#ifdef SDL_VIDEO_DRIVER_UIKIT &UIKIT_bootstrap, #endif -#if SDL_VIDEO_DRIVER_ANDROID +#ifdef SDL_VIDEO_DRIVER_ANDROID &Android_bootstrap, #endif -#if SDL_VIDEO_DRIVER_PS2 +#ifdef SDL_VIDEO_DRIVER_PS2 &PS2_bootstrap, #endif -#if SDL_VIDEO_DRIVER_PSP +#ifdef SDL_VIDEO_DRIVER_PSP &PSP_bootstrap, #endif -#if SDL_VIDEO_DRIVER_VITA +#ifdef SDL_VIDEO_DRIVER_VITA &VITA_bootstrap, #endif -#if SDL_VIDEO_DRIVER_N3DS +#ifdef SDL_VIDEO_DRIVER_N3DS &N3DS_bootstrap, #endif -#if SDL_VIDEO_DRIVER_KMSDRM +#ifdef SDL_VIDEO_DRIVER_KMSDRM &KMSDRM_bootstrap, #endif -#if SDL_VIDEO_DRIVER_RISCOS +#ifdef SDL_VIDEO_DRIVER_RISCOS &RISCOS_bootstrap, #endif -#if SDL_VIDEO_DRIVER_RPI +#ifdef SDL_VIDEO_DRIVER_RPI &RPI_bootstrap, #endif -#if SDL_VIDEO_DRIVER_NACL +#ifdef SDL_VIDEO_DRIVER_NACL &NACL_bootstrap, #endif -#if SDL_VIDEO_DRIVER_EMSCRIPTEN +#ifdef SDL_VIDEO_DRIVER_EMSCRIPTEN &Emscripten_bootstrap, #endif -#if SDL_VIDEO_DRIVER_QNX +#ifdef SDL_VIDEO_DRIVER_QNX &QNX_bootstrap, #endif -#if SDL_VIDEO_DRIVER_OS2 +#ifdef SDL_VIDEO_DRIVER_OS2 &OS2DIVE_bootstrap, &OS2VMAN_bootstrap, #endif -#if SDL_VIDEO_DRIVER_NGAGE +#ifdef SDL_VIDEO_DRIVER_NGAGE &NGAGE_bootstrap, #endif -#if SDL_VIDEO_DRIVER_OFFSCREEN +#ifdef SDL_VIDEO_DRIVER_OFFSCREEN &OFFSCREEN_bootstrap, #endif -#if SDL_VIDEO_DRIVER_DUMMY +#ifdef SDL_VIDEO_DRIVER_DUMMY &DUMMY_bootstrap, -#if SDL_INPUT_LINUXEV +#ifdef SDL_INPUT_LINUXEV &DUMMY_evdev_bootstrap, #endif #endif @@ -202,13 +203,13 @@ typedef struct static Uint32 SDL_DefaultGraphicsBackends(SDL_VideoDevice *_this) { -#if (SDL_VIDEO_OPENGL && __MACOSX__) || (__IPHONEOS__ && !TARGET_OS_MACCATALYST) || __ANDROID__ || __NACL__ - if (_this->GL_CreateContext != NULL) { +#if (defined(SDL_VIDEO_OPENGL) && defined(__MACOSX__)) || (defined(__IPHONEOS__) && !TARGET_OS_MACCATALYST) || defined(__ANDROID__) || defined(__NACL__) + if (_this->GL_CreateContext) { return SDL_WINDOW_OPENGL; } #endif -#if SDL_VIDEO_METAL && (TARGET_OS_MACCATALYST || __MACOSX__ || __IPHONEOS__) - if (_this->Metal_CreateView != NULL) { +#if defined(SDL_VIDEO_METAL) && (TARGET_OS_MACCATALYST || defined(__MACOSX__) || defined(__IPHONEOS__)) + if (_this->Metal_CreateView) { return SDL_WINDOW_METAL; } #endif @@ -224,28 +225,39 @@ static int SDL_CreateWindowTexture(SDL_VideoDevice *_this, SDL_Window *window, U SDL_GetWindowSizeInPixels(window, &w, &h); - if (data == NULL) { + if (!data) { SDL_Renderer *renderer = NULL; - const char *hint = SDL_GetHint(SDL_HINT_FRAMEBUFFER_ACCELERATION); - const SDL_bool specific_accelerated_renderer = (hint && *hint != '0' && *hint != '1' && - SDL_strcasecmp(hint, "true") != 0 && - SDL_strcasecmp(hint, "false") != 0 && - SDL_strcasecmp(hint, "software") != 0); + const char *render_driver = NULL; + const char *hint; + + /* See if there's a render driver being requested */ + hint = SDL_GetHint(SDL_HINT_FRAMEBUFFER_ACCELERATION); + if (hint && *hint != '0' && *hint != '1' && + SDL_strcasecmp(hint, "true") != 0 && + SDL_strcasecmp(hint, "false") != 0 && + SDL_strcasecmp(hint, "software") != 0) { + render_driver = hint; + } + + if (!render_driver) { + hint = SDL_GetHint(SDL_HINT_RENDER_DRIVER); + if (hint && *hint && SDL_strcasecmp(hint, "software") != 0) { + render_driver = hint; + } + } /* Check to see if there's a specific driver requested */ - if (specific_accelerated_renderer) { + if (render_driver) { for (i = 0; i < SDL_GetNumRenderDrivers(); ++i) { SDL_GetRenderDriverInfo(i, &info); - if (SDL_strcasecmp(info.name, hint) == 0) { + if (SDL_strcasecmp(info.name, render_driver) == 0) { renderer = SDL_CreateRenderer(window, i, 0); break; } } - if (renderer == NULL || (SDL_GetRendererInfo(renderer, &info) == -1)) { - if (renderer) { - SDL_DestroyRenderer(renderer); - } - return SDL_SetError("Requested renderer for " SDL_HINT_FRAMEBUFFER_ACCELERATION " is not available"); + if (!renderer) { + /* The error for this specific renderer has already been set */ + return -1; } /* if it was specifically requested, even if SDL_RENDERER_ACCELERATED isn't set, we'll accept this renderer. */ } else { @@ -262,7 +274,7 @@ static int SDL_CreateWindowTexture(SDL_VideoDevice *_this, SDL_Window *window, U } } } - if (renderer == NULL) { + if (!renderer) { return SDL_SetError("No hardware accelerated renderers available"); } } @@ -271,7 +283,7 @@ static int SDL_CreateWindowTexture(SDL_VideoDevice *_this, SDL_Window *window, U /* Create the data after we successfully create the renderer (bug #1116) */ data = (SDL_WindowTextureData *)SDL_calloc(1, sizeof(*data)); - if (data == NULL) { + if (!data) { SDL_DestroyRenderer(renderer); return SDL_OutOfMemory(); } @@ -346,7 +358,7 @@ static int SDL_UpdateWindowTexture(SDL_VideoDevice *unused, SDL_Window *window, SDL_GetWindowSizeInPixels(window, &w, &h); data = SDL_GetWindowData(window, SDL_WINDOWTEXTUREDATA); - if (data == NULL || !data->texture) { + if (!data || !data->texture) { return SDL_SetError("No window texture data"); } @@ -373,7 +385,7 @@ static void SDL_DestroyWindowTexture(SDL_VideoDevice *unused, SDL_Window *window SDL_WindowTextureData *data; data = SDL_SetWindowData(window, SDL_WINDOWTEXTUREDATA, NULL); - if (data == NULL) { + if (!data) { return; } if (data->texture) { @@ -406,7 +418,7 @@ static int SDLCALL cmpmodes(const void *A, const void *B) return 0; } -static int SDL_UninitializedVideo() +static int SDL_UninitializedVideo(void) { return SDL_SetError("Video subsystem has not been initialized"); } @@ -437,11 +449,11 @@ int SDL_VideoInit(const char *driver_name) int i = 0; /* Check to make sure we don't overwrite '_this' */ - if (_this != NULL) { + if (_this) { SDL_VideoQuit(); } -#if !SDL_TIMERS_DISABLED +#ifndef SDL_TIMERS_DISABLED SDL_TicksInit(); #endif @@ -454,7 +466,7 @@ int SDL_VideoInit(const char *driver_name) goto pre_driver_error; } init_keyboard = SDL_TRUE; - if (SDL_MouseInit() < 0) { + if (SDL_MousePreInit() < 0) { goto pre_driver_error; } init_mouse = SDL_TRUE; @@ -465,14 +477,36 @@ int SDL_VideoInit(const char *driver_name) /* Select the proper video driver */ video = NULL; - if (driver_name == NULL) { + if (!driver_name) { driver_name = SDL_GetHint(SDL_HINT_VIDEODRIVER); } - if (driver_name != NULL && *driver_name != 0) { +#if defined(__LINUX__) && defined(SDL_VIDEO_DRIVER_X11) + if (!driver_name) { + /* See if it looks like we need X11 */ + SDL_bool force_x11 = SDL_FALSE; + void *global_symbols = dlopen(NULL, RTLD_LOCAL|RTLD_NOW); + + /* Use linked libraries to detect what quirks we are likely to need */ + if (global_symbols != NULL) { + if (dlsym(global_symbols, "glxewInit") != NULL) { /* GLEW (e.g. Frogatto, SLUDGE) */ + force_x11 = SDL_TRUE; + } else if (dlsym(global_symbols, "cgGLEnableProgramProfiles") != NULL) { /* NVIDIA Cg (e.g. Awesomenauts, Braid) */ + force_x11 = SDL_TRUE; + } else if (dlsym(global_symbols, "_Z7ssgInitv") != NULL) { /* ::ssgInit(void) in plib (e.g. crrcsim) */ + force_x11 = SDL_TRUE; + } + dlclose(global_symbols); + } + if (force_x11) { + driver_name = "x11"; + } + } +#endif + if (driver_name && *driver_name != 0) { const char *driver_attempt = driver_name; - while (driver_attempt != NULL && *driver_attempt != 0 && video == NULL) { + while (driver_attempt && *driver_attempt != 0 && !video) { const char *driver_attempt_end = SDL_strchr(driver_attempt, ','); - size_t driver_attempt_len = (driver_attempt_end != NULL) ? (driver_attempt_end - driver_attempt) + size_t driver_attempt_len = (driver_attempt_end) ? (driver_attempt_end - driver_attempt) : SDL_strlen(driver_attempt); for (i = 0; bootstrap[i]; ++i) { @@ -483,17 +517,17 @@ int SDL_VideoInit(const char *driver_name) } } - driver_attempt = (driver_attempt_end != NULL) ? (driver_attempt_end + 1) : NULL; + driver_attempt = (driver_attempt_end) ? (driver_attempt_end + 1) : NULL; } } else { for (i = 0; bootstrap[i]; ++i) { video = bootstrap[i]->create(); - if (video != NULL) { + if (video) { break; } } } - if (video == NULL) { + if (!video) { if (driver_name) { SDL_SetError("%s not available", driver_name); goto pre_driver_error; @@ -539,16 +573,23 @@ int SDL_VideoInit(const char *driver_name) SDL_DisableScreenSaver(); } - /* If we don't use a screen keyboard, turn on text input by default, - otherwise programs that expect to get text events without enabling - UNICODE input won't get any events. - - Actually, come to think of it, you needed to call SDL_EnableUNICODE(1) - in SDL 1.2 before you got text input events. Hmm... +#if !defined(SDL_VIDEO_DRIVER_N3DS) + /* In the initial state we don't want to pop up an on-screen keyboard, + * but we do want to allow text input from other mechanisms. */ - if (!SDL_HasScreenKeyboardSupport()) { + { + const char *hint = SDL_GetHint(SDL_HINT_ENABLE_SCREEN_KEYBOARD); + if (!hint) { + SDL_SetHint(SDL_HINT_ENABLE_SCREEN_KEYBOARD, "0"); + } SDL_StartTextInput(); + if (!hint) { + SDL_SetHint(SDL_HINT_ENABLE_SCREEN_KEYBOARD, NULL); + } } +#endif /* !SDL_VIDEO_DRIVER_N3DS */ + + SDL_MousePostInit(); /* We're ready to go! */ return 0; @@ -570,9 +611,9 @@ int SDL_VideoInit(const char *driver_name) return -1; } -const char *SDL_GetCurrentVideoDriver() +const char *SDL_GetCurrentVideoDriver(void) { - if (_this == NULL) { + if (!_this) { SDL_UninitializedVideo(); return NULL; } @@ -584,7 +625,7 @@ SDL_VideoDevice *SDL_GetVideoDevice(void) return _this; } -SDL_bool SDL_OnVideoThread() +SDL_bool SDL_OnVideoThread(void) { return (_this && SDL_ThreadID() == _this->thread) ? SDL_TRUE : SDL_FALSE; } @@ -642,8 +683,9 @@ void SDL_DelVideoDisplay(int index) SDL_SendDisplayEvent(&_this->displays[index], SDL_DISPLAYEVENT_DISCONNECTED, 0); + SDL_free(_this->displays[index].driverdata); + SDL_free(_this->displays[index].name); if (index < (_this->num_displays - 1)) { - SDL_free(_this->displays[index].driverdata); SDL_memmove(&_this->displays[index], &_this->displays[index + 1], (_this->num_displays - index - 1) * sizeof(_this->displays[index])); } --_this->num_displays; @@ -651,7 +693,7 @@ void SDL_DelVideoDisplay(int index) int SDL_GetNumVideoDisplays(void) { - if (_this == NULL) { + if (!_this) { SDL_UninitializedVideo(); return 0; } @@ -697,7 +739,7 @@ int SDL_GetDisplayBounds(int displayIndex, SDL_Rect *rect) CHECK_DISPLAY_INDEX(displayIndex, -1); - if (rect == NULL) { + if (!rect) { return SDL_InvalidParamError("rect"); } @@ -734,7 +776,7 @@ int SDL_GetDisplayUsableBounds(int displayIndex, SDL_Rect *rect) CHECK_DISPLAY_INDEX(displayIndex, -1); - if (rect == NULL) { + if (!rect) { return SDL_InvalidParamError("rect"); } @@ -802,7 +844,7 @@ SDL_bool SDL_AddDisplayMode(SDL_VideoDisplay *display, const SDL_DisplayMode *mo modes = SDL_realloc(modes, (display->max_display_modes + 32) * sizeof(*modes)); - if (modes == NULL) { + if (!modes) { return SDL_FALSE; } display->display_modes = modes; @@ -825,6 +867,9 @@ void SDL_SetCurrentDisplayMode(SDL_VideoDisplay *display, const SDL_DisplayMode void SDL_SetDesktopDisplayMode(SDL_VideoDisplay *display, const SDL_DisplayMode *mode) { + if (display->desktop_mode.driverdata) { + SDL_free(display->desktop_mode.driverdata); + } SDL_memcpy(&display->desktop_mode, mode, sizeof(*mode)); } @@ -914,7 +959,7 @@ static SDL_DisplayMode *SDL_GetClosestDisplayModeForDisplay(SDL_VideoDisplay *di int i; SDL_DisplayMode *current, *match; - if (mode == NULL || closest == NULL) { + if (!mode || !closest) { SDL_InvalidParamError("mode/closest"); return NULL; } @@ -951,7 +996,7 @@ static SDL_DisplayMode *SDL_GetClosestDisplayModeForDisplay(SDL_VideoDisplay *di modes may still follow. */ continue; } - if (match == NULL || current->w < match->w || current->h < match->h) { + if (!match || current->w < match->w || current->h < match->h) { match = current; continue; } @@ -1208,7 +1253,7 @@ int SDL_GetWindowDisplayIndex(SDL_Window *window) SDL_VideoDisplay *new_display = &_this->displays[displayIndex]; /* The window was moved to a different display */ - if (new_display->fullscreen_window != NULL) { + if (new_display->fullscreen_window) { /* Uh oh, there's already a fullscreen window here */ } else { new_display->fullscreen_window = window; @@ -1268,7 +1313,7 @@ int SDL_GetWindowDisplayMode(SDL_Window *window, SDL_DisplayMode *mode) CHECK_WINDOW_MAGIC(window, -1); - if (mode == NULL) { + if (!mode) { return SDL_InvalidParamError("mode"); } @@ -1326,7 +1371,7 @@ static void SDL_RestoreMousePosition(SDL_Window *window) } } -#if __WINRT__ +#ifdef __WINRT__ extern Uint32 WINRT_DetectWindowFlags(SDL_Window *window); #endif @@ -1334,6 +1379,7 @@ static int SDL_UpdateFullscreenMode(SDL_Window *window, SDL_bool fullscreen) { SDL_VideoDisplay *display; SDL_Window *other; + SDL_bool resized = SDL_FALSE; CHECK_WINDOW_MAGIC(window, -1); @@ -1372,7 +1418,7 @@ static int SDL_UpdateFullscreenMode(SDL_Window *window, SDL_bool fullscreen) return 0; } } -#elif __WINRT__ && (NTDDI_VERSION < NTDDI_WIN10) +#elif defined(__WINRT__) && (NTDDI_VERSION < NTDDI_WIN10) /* HACK: WinRT 8.x apps can't choose whether or not they are fullscreen or not. The user can choose this, via OS-provided UI, but this can't be set programmatically. @@ -1399,7 +1445,7 @@ static int SDL_UpdateFullscreenMode(SDL_Window *window, SDL_bool fullscreen) #endif display = SDL_GetDisplayForWindow(window); - if (display == NULL) { /* No display connected, nothing to do. */ + if (!display) { /* No display connected, nothing to do. */ return 0; } @@ -1442,7 +1488,7 @@ static int SDL_UpdateFullscreenMode(SDL_Window *window, SDL_bool fullscreen) SDL_zero(fullscreen_mode); if (SDL_GetWindowDisplayMode(other, &fullscreen_mode) == 0) { - SDL_bool resized = SDL_TRUE; + resized = SDL_TRUE; if (other->w == fullscreen_mode.w && other->h == fullscreen_mode.h) { resized = SDL_FALSE; @@ -1466,20 +1512,21 @@ static int SDL_UpdateFullscreenMode(SDL_Window *window, SDL_bool fullscreen) /* Generate a mode change event here */ if (resized) { -#if !defined(__ANDROID__) && !defined(__WIN32__) - /* Android may not resize the window to exactly what our fullscreen mode is, especially on - * windowed Android environments like the Chromebook or Samsung DeX. Given this, we shouldn't - * use fullscreen_mode.w and fullscreen_mode.h, but rather get our current native size. As such, - * Android's SetWindowFullscreen will generate the window event for us with the proper final size. - */ - - /* This is also unnecessary on Win32 (WIN_SetWindowFullscreen calls SetWindowPos, - * WM_WINDOWPOSCHANGED will send SDL_WINDOWEVENT_RESIZED). Also, on Windows with DPI scaling enabled, - * we're keeping modes in pixels, but window sizes in dpi-scaled points, so this would be a unit mismatch. - */ - SDL_SendWindowEvent(other, SDL_WINDOWEVENT_RESIZED, - fullscreen_mode.w, fullscreen_mode.h); -#endif + if (SDL_strcmp(_this->name, "Android") != 0 && SDL_strcmp(_this->name, "windows") != 0) { + /* Android may not resize the window to exactly what our fullscreen mode is, especially on + * windowed Android environments like the Chromebook or Samsung DeX. Given this, we shouldn't + * use fullscreen_mode.w and fullscreen_mode.h, but rather get our current native size. As such, + * Android's SetWindowFullscreen will generate the window event for us with the proper final size. + */ + + /* This is also unnecessary on Win32 (WIN_SetWindowFullscreen calls SetWindowPos, + * WM_WINDOWPOSCHANGED will send SDL_WINDOWEVENT_RESIZED). Also, on Windows with DPI scaling enabled, + * we're keeping modes in pixels, but window sizes in dpi-scaled points, so this would be a unit mismatch. + */ + SDL_SendWindowEvent(other, SDL_WINDOWEVENT_RESIZED, + fullscreen_mode.w, fullscreen_mode.h); + } + } else { SDL_OnWindowResized(other); } @@ -1497,11 +1544,18 @@ static int SDL_UpdateFullscreenMode(SDL_Window *window, SDL_bool fullscreen) if (_this->SetWindowFullscreen) { _this->SetWindowFullscreen(_this, window, display, SDL_FALSE); + } else { + resized = SDL_TRUE; } display->fullscreen_window = NULL; - /* Generate a mode change event here */ - SDL_OnWindowResized(window); + if (!resized) { + /* Generate a mode change event here */ + SDL_OnWindowResized(window); + } else { + SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESIZED, + window->windowed.w, window->windowed.h); + } /* Restore the cursor position */ SDL_RestoreMousePosition(window); @@ -1590,14 +1644,14 @@ SDL_Window *SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint SDL_Window *window; Uint32 type_flags, graphics_flags; - if (_this == NULL) { + if (!_this) { /* Initialize the video system if needed */ if (SDL_Init(SDL_INIT_VIDEO) < 0) { return NULL; } /* Make clang-tidy happy */ - if (_this == NULL) { + if (!_this) { return NULL; } } @@ -1623,9 +1677,11 @@ SDL_Window *SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint } /* Some platforms blow up if the windows are too large. Raise it later? */ - if ((w > 16384) || (h > 16384)) { - SDL_SetError("Window is too large."); - return NULL; + if (w > 16384) { + w = 16384; + } + if (h > 16384) { + h = 16384; } /* ensure no more than one of these flags is set */ @@ -1677,7 +1733,7 @@ SDL_Window *SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint } window = (SDL_Window *)SDL_calloc(1, sizeof(*window)); - if (window == NULL) { + if (!window) { SDL_OutOfMemory(); return NULL; } @@ -1763,7 +1819,7 @@ SDL_Window *SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint } #endif -#if __WINRT__ && (NTDDI_VERSION < NTDDI_WIN10) +#if defined(__WINRT__) && (NTDDI_VERSION < NTDDI_WIN10) /* HACK: WinRT 8.x apps can't choose whether or not they are fullscreen or not. The user can choose this, via OS-provided UI, but this can't be set programmatically. @@ -1791,7 +1847,7 @@ SDL_Window *SDL_CreateWindowFrom(const void *data) SDL_Window *window; Uint32 flags = SDL_WINDOW_FOREIGN; - if (_this == NULL) { + if (!_this) { SDL_UninitializedVideo(); return NULL; } @@ -1827,7 +1883,7 @@ SDL_Window *SDL_CreateWindowFrom(const void *data) } window = (SDL_Window *)SDL_calloc(1, sizeof(*window)); - if (window == NULL) { + if (!window) { SDL_OutOfMemory(); return NULL; } @@ -1896,12 +1952,6 @@ int SDL_RecreateWindow(SDL_Window *window, Uint32 flags) /* Tear down the old native window */ SDL_DestroyWindowSurface(window); - if (_this->checked_texture_framebuffer) { /* never checked? No framebuffer to destroy. Don't risk calling the wrong implementation. */ - if (_this->DestroyWindowFramebuffer) { - _this->DestroyWindowFramebuffer(_this, window); - } - } - if (_this->DestroyWindow && !(flags & SDL_WINDOW_FOREIGN)) { _this->DestroyWindow(_this, window); } @@ -1980,6 +2030,14 @@ int SDL_RecreateWindow(SDL_Window *window, Uint32 flags) _this->SetWindowIcon(_this, window, window->icon); } + if (_this->SetWindowMinimumSize && (window->min_w || window->min_h)) { + _this->SetWindowMinimumSize(_this, window); + } + + if (_this->SetWindowMaximumSize && (window->max_w || window->max_h)) { + _this->SetWindowMaximumSize(_this, window); + } + if (window->hit_test) { _this->SetWindowHitTest(window, SDL_TRUE); } @@ -1991,7 +2049,7 @@ int SDL_RecreateWindow(SDL_Window *window, Uint32 flags) SDL_bool SDL_HasWindows(void) { - return _this && _this->windows != NULL; + return _this && _this->windows; } Uint32 SDL_GetWindowID(SDL_Window *window) @@ -2005,7 +2063,7 @@ SDL_Window *SDL_GetWindowFromID(Uint32 id) { SDL_Window *window; - if (_this == NULL) { + if (!_this) { return NULL; } for (window = _this->windows; window; window = window->next) { @@ -2050,7 +2108,7 @@ void SDL_SetWindowIcon(SDL_Window *window, SDL_Surface *icon) { CHECK_WINDOW_MAGIC(window, ); - if (icon == NULL) { + if (!icon) { return; } @@ -2333,16 +2391,16 @@ int SDL_GetWindowBordersSize(SDL_Window *window, int *top, int *left, int *botto { int dummy = 0; - if (top == NULL) { + if (!top) { top = &dummy; } - if (left == NULL) { + if (!left) { left = &dummy; } - if (right == NULL) { + if (!right) { right = &dummy; } - if (bottom == NULL) { + if (!bottom) { bottom = &dummy; } @@ -2364,11 +2422,11 @@ void SDL_GetWindowSizeInPixels(SDL_Window *window, int *w, int *h) CHECK_WINDOW_MAGIC(window, ); - if (w == NULL) { + if (!w) { w = &filter; } - if (h == NULL) { + if (!h) { h = &filter; } @@ -2470,6 +2528,9 @@ void SDL_ShowWindow(SDL_Window *window) if (_this->ShowWindow) { _this->ShowWindow(_this, window); + } else { + SDL_SetMouseFocus(window); + SDL_SetKeyboardFocus(window); } SDL_SendWindowEvent(window, SDL_WINDOWEVENT_SHOWN, 0, 0); } @@ -2487,6 +2548,9 @@ void SDL_HideWindow(SDL_Window *window) if (_this->HideWindow) { _this->HideWindow(_this, window); + } else { + SDL_SetMouseFocus(NULL); + SDL_SetKeyboardFocus(NULL); } window->is_hiding = SDL_FALSE; SDL_SendWindowEvent(window, SDL_WINDOWEVENT_HIDDEN, 0, 0); @@ -2586,39 +2650,29 @@ int SDL_SetWindowFullscreen(SDL_Window *window, Uint32 flags) return -1; } -static SDL_Surface *SDL_CreateWindowFramebuffer(SDL_Window *window) +static SDL_bool ShouldAttemptTextureFramebuffer(void) { - Uint32 format = 0; - void *pixels = NULL; - int pitch = 0; - int bpp; - Uint32 Rmask, Gmask, Bmask, Amask; - SDL_bool created_framebuffer = SDL_FALSE; - int w, h; - - SDL_GetWindowSizeInPixels(window, &w, &h); - - /* This will switch the video backend from using a software surface to - using a GPU texture through the 2D render API, if we think this would - be more efficient. This only checks once, on demand. */ - if (!_this->checked_texture_framebuffer) { - SDL_bool attempt_texture_framebuffer = SDL_TRUE; + const char *hint; + SDL_bool attempt_texture_framebuffer = SDL_TRUE; - /* See if the user or application wants to specifically disable the framebuffer */ - const char *hint = SDL_GetHint(SDL_HINT_FRAMEBUFFER_ACCELERATION); - if (hint) { - if ((*hint == '0') || (SDL_strcasecmp(hint, "false") == 0) || (SDL_strcasecmp(hint, "software") == 0)) { - attempt_texture_framebuffer = SDL_FALSE; - } - } + /* The dummy driver never has GPU support, of course. */ + if (_this->is_dummy) { + return SDL_FALSE; + } - if (_this->is_dummy) { /* dummy driver never has GPU support, of course. */ + /* See if there's a hint override */ + hint = SDL_GetHint(SDL_HINT_FRAMEBUFFER_ACCELERATION); + if (hint && *hint) { + if (*hint == '0' || SDL_strcasecmp(hint, "false") == 0 || SDL_strcasecmp(hint, "software") == 0) { attempt_texture_framebuffer = SDL_FALSE; + } else { + attempt_texture_framebuffer = SDL_TRUE; } - + } else { + /* Check for platform specific defaults */ #if defined(__LINUX__) /* On WSL, direct X11 is faster than using OpenGL for window framebuffers, so try to detect WSL and avoid texture framebuffer. */ - else if ((_this->CreateWindowFramebuffer != NULL) && (SDL_strcmp(_this->name, "x11") == 0)) { + if ((_this->CreateWindowFramebuffer) && (SDL_strcmp(_this->name, "x11") == 0)) { struct stat sb; if ((stat("/proc/sys/fs/binfmt_misc/WSLInterop", &sb) == 0) || (stat("/run/WSL", &sb) == 0)) { /* if either of these exist, we're on WSL. */ attempt_texture_framebuffer = SDL_FALSE; @@ -2626,18 +2680,35 @@ static SDL_Surface *SDL_CreateWindowFramebuffer(SDL_Window *window) } #endif #if defined(__WIN32__) || defined(__WINGDK__) /* GDI BitBlt() is way faster than Direct3D dynamic textures right now. (!!! FIXME: is this still true?) */ - else if ((_this->CreateWindowFramebuffer != NULL) && (SDL_strcmp(_this->name, "windows") == 0)) { + if (_this->CreateWindowFramebuffer && (SDL_strcmp(_this->name, "windows") == 0)) { attempt_texture_framebuffer = SDL_FALSE; } #endif #if defined(__EMSCRIPTEN__) - else { - attempt_texture_framebuffer = SDL_FALSE; - } + attempt_texture_framebuffer = SDL_FALSE; #endif + } + return attempt_texture_framebuffer; +} + +static SDL_Surface *SDL_CreateWindowFramebuffer(SDL_Window *window) +{ + Uint32 format = 0; + void *pixels = NULL; + int pitch = 0; + int bpp; + Uint32 Rmask, Gmask, Bmask, Amask; + SDL_bool created_framebuffer = SDL_FALSE; + int w, h; + + SDL_GetWindowSizeInPixels(window, &w, &h); - if (attempt_texture_framebuffer) { - if (SDL_CreateWindowTexture(_this, window, &format, &pixels, &pitch) == -1) { + /* This will switch the video backend from using a software surface to + using a GPU texture through the 2D render API, if we think this would + be more efficient. This only checks once, on demand. */ + if (!_this->checked_texture_framebuffer) { + if (ShouldAttemptTextureFramebuffer()) { + if (SDL_CreateWindowTexture(_this, window, &format, &pixels, &pitch) < 0) { /* !!! FIXME: if this failed halfway (made renderer, failed to make texture, etc), !!! FIXME: we probably need to clean this up so it doesn't interfere with !!! FIXME: a software fallback at the system level (can we blit to an @@ -2659,6 +2730,7 @@ static SDL_Surface *SDL_CreateWindowFramebuffer(SDL_Window *window) if (!created_framebuffer) { if (!_this->CreateWindowFramebuffer || !_this->UpdateWindowFramebuffer) { + SDL_SetError("Window framebuffer support not available"); return NULL; } @@ -2668,6 +2740,7 @@ static SDL_Surface *SDL_CreateWindowFramebuffer(SDL_Window *window) } if (window->surface) { + /* We may have gone recursive and already created the surface */ return window->surface; } @@ -2690,7 +2763,12 @@ SDL_Surface *SDL_GetWindowSurface(SDL_Window *window) CHECK_WINDOW_MAGIC(window, NULL); if (!window->surface_valid) { - SDL_DestroyWindowSurface(window); + if (window->surface) { + window->surface->flags &= ~SDL_DONTFREE; + SDL_FreeSurface(window->surface); + window->surface = NULL; + } + window->surface = SDL_CreateWindowFramebuffer(window); if (window->surface) { window->surface_valid = SDL_TRUE; @@ -2727,6 +2805,25 @@ int SDL_UpdateWindowSurfaceRects(SDL_Window *window, const SDL_Rect *rects, return _this->UpdateWindowFramebuffer(_this, window, rects, numrects); } +int SDL_DestroyWindowSurface(SDL_Window *window) +{ + CHECK_WINDOW_MAGIC(window, -1); + + if (window->surface) { + window->surface->flags &= ~SDL_DONTFREE; + SDL_FreeSurface(window->surface); + window->surface = NULL; + window->surface_valid = SDL_FALSE; + } + + if (_this->checked_texture_framebuffer) { /* never checked? No framebuffer to destroy. Don't risk calling the wrong implementation. */ + if (_this->DestroyWindowFramebuffer) { + _this->DestroyWindowFramebuffer(_this, window); + } + } + return 0; +} + int SDL_SetWindowBrightness(SDL_Window * window, float brightness) { Uint16 ramp[256]; @@ -2772,19 +2869,6 @@ int SDL_SetWindowOpacity(SDL_Window * window, float opacity) return retval; } -int SDL_DestroyWindowSurface(SDL_Window *window) -{ - CHECK_WINDOW_MAGIC(window, -1); - - if (window->surface) { - window->surface->flags &= ~SDL_DONTFREE; - SDL_FreeSurface(window->surface); - window->surface = NULL; - window->surface_valid = SDL_FALSE; - } - return 0; -} - int SDL_GetWindowOpacity(SDL_Window *window, float *out_opacity) { CHECK_WINDOW_MAGIC(window, -1); @@ -3161,7 +3245,7 @@ static SDL_bool ShouldMinimizeOnFocusLoss(SDL_Window *window) /* Real fullscreen windows should minimize on focus loss so the desktop video mode is restored */ hint = SDL_GetHint(SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS); - if (hint == NULL || !*hint || SDL_strcasecmp(hint, "auto") == 0) { + if (!hint || !*hint || SDL_strcasecmp(hint, "auto") == 0) { if ((window->flags & SDL_WINDOW_FULLSCREEN_DESKTOP) == SDL_WINDOW_FULLSCREEN_DESKTOP || DisableDisplayModeSwitching(_this) == SDL_TRUE) { return SDL_FALSE; @@ -3191,7 +3275,7 @@ SDL_Window *SDL_GetFocusWindow(void) { SDL_Window *window; - if (_this == NULL) { + if (!_this) { return NULL; } for (window = _this->windows; window; window = window->next) { @@ -3219,23 +3303,22 @@ void SDL_DestroyWindow(SDL_Window *window) if (SDL_GetKeyboardFocus() == window) { SDL_SetKeyboardFocus(NULL); } + if ((window->flags & SDL_WINDOW_MOUSE_CAPTURE)) { + SDL_UpdateMouseCapture(SDL_TRUE); + } if (SDL_GetMouseFocus() == window) { SDL_SetMouseFocus(NULL); } - /* make no context current if this is the current context window. */ + SDL_DestroyWindowSurface(window); + + /* Make no context current if this is the current context window */ if (window->flags & SDL_WINDOW_OPENGL) { if (_this->current_glwin == window) { SDL_GL_MakeCurrent(window, NULL); } } - SDL_DestroyWindowSurface(window); - if (_this->checked_texture_framebuffer) { /* never checked? No framebuffer to destroy. Don't risk calling the wrong implementation. */ - if (_this->DestroyWindowFramebuffer) { - _this->DestroyWindowFramebuffer(_this, window); - } - } if (_this->DestroyWindow) { _this->DestroyWindow(_this, window); } @@ -3291,17 +3374,17 @@ void SDL_DestroyWindow(SDL_Window *window) SDL_free(window); } -SDL_bool SDL_IsScreenSaverEnabled() +SDL_bool SDL_IsScreenSaverEnabled(void) { - if (_this == NULL) { + if (!_this) { return SDL_TRUE; } return _this->suspend_screensaver ? SDL_FALSE : SDL_TRUE; } -void SDL_EnableScreenSaver() +void SDL_EnableScreenSaver(void) { - if (_this == NULL) { + if (!_this) { return; } if (!_this->suspend_screensaver) { @@ -3313,9 +3396,9 @@ void SDL_EnableScreenSaver() } } -void SDL_DisableScreenSaver() +void SDL_DisableScreenSaver(void) { - if (_this == NULL) { + if (!_this) { return; } if (_this->suspend_screensaver) { @@ -3331,7 +3414,7 @@ void SDL_VideoQuit(void) { int i; - if (_this == NULL) { + if (!_this) { return; } @@ -3353,18 +3436,14 @@ void SDL_VideoQuit(void) SDL_VideoDisplay *display = &_this->displays[i]; SDL_ResetDisplayModes(i); SDL_free(display->desktop_mode.driverdata); - display->desktop_mode.driverdata = NULL; SDL_free(display->driverdata); - display->driverdata = NULL; - } - if (_this->displays) { - for (i = 0; i < _this->num_displays; ++i) { - SDL_free(_this->displays[i].name); - } - SDL_free(_this->displays); - _this->displays = NULL; - _this->num_displays = 0; + SDL_free(display->name); } + + SDL_free(_this->displays); + _this->displays = NULL; + _this->num_displays = 0; + SDL_free(_this->clipboard_text); _this->clipboard_text = NULL; _this->free(_this); @@ -3375,7 +3454,7 @@ int SDL_GL_LoadLibrary(const char *path) { int retval; - if (_this == NULL) { + if (!_this) { return SDL_UninitializedVideo(); } if (_this->gl_config.driver_loaded) { @@ -3403,7 +3482,7 @@ void *SDL_GL_GetProcAddress(const char *proc) { void *func; - if (_this == NULL) { + if (!_this) { SDL_UninitializedVideo(); return NULL; } @@ -3422,7 +3501,7 @@ void *SDL_GL_GetProcAddress(const char *proc) void SDL_GL_UnloadLibrary(void) { - if (_this == NULL) { + if (!_this) { SDL_UninitializedVideo(); return; } @@ -3436,7 +3515,7 @@ void SDL_GL_UnloadLibrary(void) } } -#if SDL_VIDEO_OPENGL || SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2 +#if defined(SDL_VIDEO_OPENGL) || defined(SDL_VIDEO_OPENGL_ES) || defined(SDL_VIDEO_OPENGL_ES2) static SDL_INLINE SDL_bool isAtLeastGL3(const char *verstr) { return verstr && (SDL_atoi(verstr) >= 3); @@ -3445,7 +3524,7 @@ static SDL_INLINE SDL_bool isAtLeastGL3(const char *verstr) SDL_bool SDL_GL_ExtensionSupported(const char *extension) { -#if SDL_VIDEO_OPENGL || SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2 +#if defined(SDL_VIDEO_OPENGL) || defined(SDL_VIDEO_OPENGL_ES) || defined(SDL_VIDEO_OPENGL_ES2) const GLubyte *(APIENTRY * glGetStringFunc)(GLenum); const char *extensions; const char *start; @@ -3465,7 +3544,7 @@ SDL_bool SDL_GL_ExtensionSupported(const char *extension) /* Lookup the available extensions */ glGetStringFunc = SDL_GL_GetProcAddress("glGetString"); - if (glGetStringFunc == NULL) { + if (!glGetStringFunc) { return SDL_FALSE; } @@ -3477,7 +3556,7 @@ SDL_bool SDL_GL_ExtensionSupported(const char *extension) glGetStringiFunc = SDL_GL_GetProcAddress("glGetStringi"); glGetIntegervFunc = SDL_GL_GetProcAddress("glGetIntegerv"); - if ((glGetStringiFunc == NULL) || (glGetIntegervFunc == NULL)) { + if ((!glGetStringiFunc) || (!glGetIntegervFunc)) { return SDL_FALSE; } @@ -3498,7 +3577,7 @@ SDL_bool SDL_GL_ExtensionSupported(const char *extension) /* Try the old way with glGetString(GL_EXTENSIONS) ... */ extensions = (const char *)glGetStringFunc(GL_EXTENSIONS); - if (extensions == NULL) { + if (!extensions) { return SDL_FALSE; } /* @@ -3510,7 +3589,7 @@ SDL_bool SDL_GL_ExtensionSupported(const char *extension) for (;;) { where = SDL_strstr(start, extension); - if (where == NULL) { + if (!where) { break; } @@ -3539,7 +3618,7 @@ void SDL_GL_DeduceMaxSupportedESProfile(int *major, int *minor) { /* THIS REQUIRES AN EXISTING GL CONTEXT THAT HAS BEEN MADE CURRENT. */ /* Please refer to https://bugzilla.libsdl.org/show_bug.cgi?id=3725 for discussion. */ -#if SDL_VIDEO_OPENGL || SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2 +#if defined(SDL_VIDEO_OPENGL) || defined(SDL_VIDEO_OPENGL_ES) || defined(SDL_VIDEO_OPENGL_ES2) /* XXX This is fragile; it will break in the event of release of * new versions of OpenGL ES. */ @@ -3559,9 +3638,9 @@ void SDL_GL_DeduceMaxSupportedESProfile(int *major, int *minor) #endif } -void SDL_GL_ResetAttributes() +void SDL_GL_ResetAttributes(void) { - if (_this == NULL) { + if (!_this) { return; } @@ -3584,15 +3663,15 @@ void SDL_GL_ResetAttributes() _this->gl_config.retained_backing = 1; _this->gl_config.accelerated = -1; /* accelerated or not, both are fine */ -#if SDL_VIDEO_OPENGL +#ifdef SDL_VIDEO_OPENGL _this->gl_config.major_version = 2; _this->gl_config.minor_version = 1; _this->gl_config.profile_mask = 0; -#elif SDL_VIDEO_OPENGL_ES2 +#elif defined(SDL_VIDEO_OPENGL_ES2) _this->gl_config.major_version = 2; _this->gl_config.minor_version = 0; _this->gl_config.profile_mask = SDL_GL_CONTEXT_PROFILE_ES; -#elif SDL_VIDEO_OPENGL_ES +#elif defined(SDL_VIDEO_OPENGL_ES) _this->gl_config.major_version = 1; _this->gl_config.minor_version = 1; _this->gl_config.profile_mask = SDL_GL_CONTEXT_PROFILE_ES; @@ -3615,10 +3694,10 @@ void SDL_GL_ResetAttributes() int SDL_GL_SetAttribute(SDL_GLattr attr, int value) { -#if SDL_VIDEO_OPENGL || SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2 +#if defined(SDL_VIDEO_OPENGL) || defined(SDL_VIDEO_OPENGL_ES) || defined(SDL_VIDEO_OPENGL_ES2) int retval; - if (_this == NULL) { + if (!_this) { return SDL_UninitializedVideo(); } retval = 0; @@ -3738,7 +3817,7 @@ int SDL_GL_SetAttribute(SDL_GLattr attr, int value) int SDL_GL_GetAttribute(SDL_GLattr attr, int *value) { -#if SDL_VIDEO_OPENGL || SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2 +#if defined(SDL_VIDEO_OPENGL) || defined(SDL_VIDEO_OPENGL_ES) || defined(SDL_VIDEO_OPENGL_ES2) GLenum(APIENTRY * glGetErrorFunc)(void); GLenum attrib = 0; GLenum error = 0; @@ -3749,51 +3828,51 @@ int SDL_GL_GetAttribute(SDL_GLattr attr, int *value) * the enums we use for the former function don't exist in OpenGL ES 2, and * the function itself doesn't exist prior to OpenGL 3 and OpenGL ES 2. */ -#if SDL_VIDEO_OPENGL +#ifdef SDL_VIDEO_OPENGL const GLubyte *(APIENTRY * glGetStringFunc)(GLenum name); void(APIENTRY * glGetFramebufferAttachmentParameterivFunc)(GLenum target, GLenum attachment, GLenum pname, GLint * params); GLenum attachment = GL_BACK_LEFT; GLenum attachmentattrib = 0; #endif - if (value == NULL) { + if (!value) { return SDL_InvalidParamError("value"); } /* Clear value in any case */ *value = 0; - if (_this == NULL) { + if (!_this) { return SDL_UninitializedVideo(); } switch (attr) { case SDL_GL_RED_SIZE: -#if SDL_VIDEO_OPENGL +#ifdef SDL_VIDEO_OPENGL attachmentattrib = GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE; #endif attrib = GL_RED_BITS; break; case SDL_GL_BLUE_SIZE: -#if SDL_VIDEO_OPENGL +#ifdef SDL_VIDEO_OPENGL attachmentattrib = GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE; #endif attrib = GL_BLUE_BITS; break; case SDL_GL_GREEN_SIZE: -#if SDL_VIDEO_OPENGL +#ifdef SDL_VIDEO_OPENGL attachmentattrib = GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE; #endif attrib = GL_GREEN_BITS; break; case SDL_GL_ALPHA_SIZE: -#if SDL_VIDEO_OPENGL +#ifdef SDL_VIDEO_OPENGL attachmentattrib = GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE; #endif attrib = GL_ALPHA_BITS; break; case SDL_GL_DOUBLEBUFFER: -#if SDL_VIDEO_OPENGL +#ifdef SDL_VIDEO_OPENGL attrib = GL_DOUBLEBUFFER; break; #else @@ -3804,20 +3883,20 @@ int SDL_GL_GetAttribute(SDL_GLattr attr, int *value) return 0; #endif case SDL_GL_DEPTH_SIZE: -#if SDL_VIDEO_OPENGL +#ifdef SDL_VIDEO_OPENGL attachment = GL_DEPTH; attachmentattrib = GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE; #endif attrib = GL_DEPTH_BITS; break; case SDL_GL_STENCIL_SIZE: -#if SDL_VIDEO_OPENGL +#ifdef SDL_VIDEO_OPENGL attachment = GL_STENCIL; attachmentattrib = GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE; #endif attrib = GL_STENCIL_BITS; break; -#if SDL_VIDEO_OPENGL +#ifdef SDL_VIDEO_OPENGL case SDL_GL_ACCUM_RED_SIZE: attrib = GL_ACCUM_RED_BITS; break; @@ -3850,7 +3929,7 @@ int SDL_GL_GetAttribute(SDL_GLattr attr, int *value) attrib = GL_SAMPLES; break; case SDL_GL_CONTEXT_RELEASE_BEHAVIOR: -#if SDL_VIDEO_OPENGL +#ifdef SDL_VIDEO_OPENGL attrib = GL_CONTEXT_RELEASE_BEHAVIOR; #else attrib = GL_CONTEXT_RELEASE_BEHAVIOR_KHR; @@ -3937,9 +4016,9 @@ int SDL_GL_GetAttribute(SDL_GLattr attr, int *value) return SDL_SetError("Unknown OpenGL attribute"); } -#if SDL_VIDEO_OPENGL +#ifdef SDL_VIDEO_OPENGL glGetStringFunc = SDL_GL_GetProcAddress("glGetString"); - if (glGetStringFunc == NULL) { + if (!glGetStringFunc) { return -1; } @@ -3977,7 +4056,7 @@ int SDL_GL_GetAttribute(SDL_GLattr attr, int *value) } glGetErrorFunc = SDL_GL_GetProcAddress("glGetError"); - if (glGetErrorFunc == NULL) { + if (!glGetErrorFunc) { return -1; } @@ -4024,7 +4103,7 @@ int SDL_GL_MakeCurrent(SDL_Window *window, SDL_GLContext context) { int retval; - if (_this == NULL) { + if (!_this) { return SDL_UninitializedVideo(); } @@ -4058,7 +4137,7 @@ int SDL_GL_MakeCurrent(SDL_Window *window, SDL_GLContext context) SDL_Window *SDL_GL_GetCurrentWindow(void) { - if (_this == NULL) { + if (!_this) { SDL_UninitializedVideo(); return NULL; } @@ -4067,7 +4146,7 @@ SDL_Window *SDL_GL_GetCurrentWindow(void) SDL_GLContext SDL_GL_GetCurrentContext(void) { - if (_this == NULL) { + if (!_this) { SDL_UninitializedVideo(); return NULL; } @@ -4087,7 +4166,7 @@ void SDL_GL_GetDrawableSize(SDL_Window * window, int *w, int *h) int SDL_GL_SetSwapInterval(int interval) { - if (_this == NULL) { + if (!_this) { return SDL_UninitializedVideo(); } else if (SDL_GL_GetCurrentContext() == NULL) { return SDL_SetError("No OpenGL context has been made current"); @@ -4100,7 +4179,7 @@ int SDL_GL_SetSwapInterval(int interval) int SDL_GL_GetSwapInterval(void) { - if (_this == NULL) { + if (!_this) { return 0; } else if (SDL_GL_GetCurrentContext() == NULL) { return 0; @@ -4133,7 +4212,7 @@ void SDL_GL_SwapWindow(SDL_Window *window) void SDL_GL_DeleteContext(SDL_GLContext context) { - if (_this == NULL || !context) { + if (!_this || !context) { return; } @@ -4351,59 +4430,6 @@ int SDL_GetMessageBoxCount(void) return SDL_AtomicGet(&SDL_messagebox_count); } -#if SDL_VIDEO_DRIVER_ANDROID -#include "android/SDL_androidmessagebox.h" -#endif -#if SDL_VIDEO_DRIVER_WINDOWS -#include "windows/SDL_windowsmessagebox.h" -#endif -#if SDL_VIDEO_DRIVER_WINRT -#include "winrt/SDL_winrtmessagebox.h" -#endif -#if SDL_VIDEO_DRIVER_COCOA -#include "cocoa/SDL_cocoamessagebox.h" -#endif -#if SDL_VIDEO_DRIVER_UIKIT -#include "uikit/SDL_uikitmessagebox.h" -#endif -#if SDL_VIDEO_DRIVER_X11 -#include "x11/SDL_x11messagebox.h" -#endif -#if SDL_VIDEO_DRIVER_WAYLAND -#include "wayland/SDL_waylandmessagebox.h" -#endif -#if SDL_VIDEO_DRIVER_HAIKU -#include "haiku/SDL_bmessagebox.h" -#endif -#if SDL_VIDEO_DRIVER_OS2 -#include "os2/SDL_os2messagebox.h" -#endif -#if SDL_VIDEO_DRIVER_RISCOS -#include "riscos/SDL_riscosmessagebox.h" -#endif -#if SDL_VIDEO_DRIVER_VITA -#include "vita/SDL_vitamessagebox.h" -#endif - -#if SDL_VIDEO_DRIVER_WINDOWS || SDL_VIDEO_DRIVER_WINRT || SDL_VIDEO_DRIVER_COCOA || SDL_VIDEO_DRIVER_UIKIT || SDL_VIDEO_DRIVER_X11 || SDL_VIDEO_DRIVER_WAYLAND || SDL_VIDEO_DRIVER_HAIKU || SDL_VIDEO_DRIVER_OS2 || SDL_VIDEO_DRIVER_RISCOS -static SDL_bool SDL_MessageboxValidForDriver(const SDL_MessageBoxData *messageboxdata, SDL_SYSWM_TYPE drivertype) -{ - SDL_SysWMinfo info; - SDL_Window *window = messageboxdata->window; - - if (!window) { - return SDL_TRUE; - } - - SDL_VERSION(&info.version); - if (!SDL_GetWindowWMInfo(window, &info)) { - return SDL_TRUE; - } else { - return (info.subsystem == drivertype); - } -} -#endif - int SDL_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid) { int dummybutton; @@ -4413,7 +4439,7 @@ int SDL_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid) SDL_Window *current_window; SDL_MessageBoxData mbdata; - if (messageboxdata == NULL) { + if (!messageboxdata) { return SDL_InvalidParamError("messageboxdata"); } else if (messageboxdata->numbuttons < 0) { return SDL_SetError("Invalid number of buttons"); @@ -4428,7 +4454,7 @@ int SDL_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid) show_cursor_prev = SDL_ShowCursor(1); SDL_ResetKeyboard(); - if (buttonid == NULL) { + if (!buttonid) { buttonid = &dummybutton; } @@ -4445,84 +4471,38 @@ int SDL_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid) if (_this && _this->ShowMessageBox) { retval = _this->ShowMessageBox(_this, messageboxdata, buttonid); - } + } else { + /* It's completely fine to call this function before video is initialized */ + const char *driver_name = SDL_GetHint(SDL_HINT_VIDEODRIVER); + int i; + if (driver_name && *driver_name != 0) { + const char *driver_attempt = driver_name; + while (driver_attempt && (*driver_attempt != 0) && (retval == -1)) { + const char *driver_attempt_end = SDL_strchr(driver_attempt, ','); + size_t driver_attempt_len = (driver_attempt_end) ? (driver_attempt_end - driver_attempt) + : SDL_strlen(driver_attempt); + for (i = 0; bootstrap[i]; ++i) { + if (bootstrap[i]->ShowMessageBox && (driver_attempt_len == SDL_strlen(bootstrap[i]->name)) && + (SDL_strncasecmp(bootstrap[i]->name, driver_attempt, driver_attempt_len) == 0)) { + if (bootstrap[i]->ShowMessageBox(messageboxdata, buttonid) == 0) { + retval = 0; + } + break; + } + } - /* It's completely fine to call this function before video is initialized */ -#if SDL_VIDEO_DRIVER_ANDROID - if (retval == -1 && - Android_ShowMessageBox(messageboxdata, buttonid) == 0) { - retval = 0; - } -#endif -#if SDL_VIDEO_DRIVER_WINDOWS && !defined(__XBOXONE__) && !defined(__XBOXSERIES__) - if (retval == -1 && - SDL_MessageboxValidForDriver(messageboxdata, SDL_SYSWM_WINDOWS) && - WIN_ShowMessageBox(messageboxdata, buttonid) == 0) { - retval = 0; - } -#endif -#if SDL_VIDEO_DRIVER_WINRT - if (retval == -1 && - SDL_MessageboxValidForDriver(messageboxdata, SDL_SYSWM_WINRT) && - WINRT_ShowMessageBox(messageboxdata, buttonid) == 0) { - retval = 0; - } -#endif -#if SDL_VIDEO_DRIVER_COCOA - if (retval == -1 && - SDL_MessageboxValidForDriver(messageboxdata, SDL_SYSWM_COCOA) && - Cocoa_ShowMessageBox(messageboxdata, buttonid) == 0) { - retval = 0; - } -#endif -#if SDL_VIDEO_DRIVER_UIKIT - if (retval == -1 && - SDL_MessageboxValidForDriver(messageboxdata, SDL_SYSWM_UIKIT) && - UIKit_ShowMessageBox(messageboxdata, buttonid) == 0) { - retval = 0; - } -#endif -#if SDL_VIDEO_DRIVER_X11 - if (retval == -1 && - SDL_MessageboxValidForDriver(messageboxdata, SDL_SYSWM_X11) && - X11_ShowMessageBox(messageboxdata, buttonid) == 0) { - retval = 0; - } -#endif -#if SDL_VIDEO_DRIVER_WAYLAND - if (retval == -1 && - SDL_MessageboxValidForDriver(messageboxdata, SDL_SYSWM_WAYLAND) && - Wayland_ShowMessageBox(messageboxdata, buttonid) == 0) { - retval = 0; - } -#endif -#if SDL_VIDEO_DRIVER_HAIKU - if (retval == -1 && - SDL_MessageboxValidForDriver(messageboxdata, SDL_SYSWM_HAIKU) && - HAIKU_ShowMessageBox(messageboxdata, buttonid) == 0) { - retval = 0; - } -#endif -#if SDL_VIDEO_DRIVER_OS2 - if (retval == -1 && - SDL_MessageboxValidForDriver(messageboxdata, SDL_SYSWM_OS2) && - OS2_ShowMessageBox(messageboxdata, buttonid) == 0) { - retval = 0; - } -#endif -#if SDL_VIDEO_DRIVER_RISCOS - if (retval == -1 && - SDL_MessageboxValidForDriver(messageboxdata, SDL_SYSWM_RISCOS) && - RISCOS_ShowMessageBox(messageboxdata, buttonid) == 0) { - retval = 0; - } -#endif -#if SDL_VIDEO_DRIVER_VITA - if (retval == -1 && - VITA_ShowMessageBox(messageboxdata, buttonid) == 0) { - retval = 0; + driver_attempt = (driver_attempt_end) ? (driver_attempt_end + 1) : NULL; + } + } else { + for (i = 0; bootstrap[i]; ++i) { + if (bootstrap[i]->ShowMessageBox && bootstrap[i]->ShowMessageBox(messageboxdata, buttonid) == 0) { + retval = 0; + break; + } + } + } } -#endif + if (retval == -1) { const char *error = SDL_GetError(); @@ -4551,10 +4531,10 @@ int SDL_ShowSimpleMessageBox(Uint32 flags, const char *title, const char *messag /* Web browsers don't (currently) have an API for a custom message box that can block, but for the most common case (SDL_ShowSimpleMessageBox), we can use the standard Javascript alert() function. */ - if (title == NULL) { + if (!title) { title = ""; } - if (message == NULL) { + if (!message) { message = ""; } EM_ASM({ @@ -4631,7 +4611,7 @@ void SDL_OnApplicationWillResignActive(void) { if (_this) { SDL_Window *window; - for (window = _this->windows; window != NULL; window = window->next) { + for (window = _this->windows; window; window = window->next) { SDL_SendWindowEvent(window, SDL_WINDOWEVENT_FOCUS_LOST, 0, 0); SDL_SendWindowEvent(window, SDL_WINDOWEVENT_MINIMIZED, 0, 0); } @@ -4655,7 +4635,7 @@ void SDL_OnApplicationDidBecomeActive(void) if (_this) { SDL_Window *window; - for (window = _this->windows; window != NULL; window = window->next) { + for (window = _this->windows; window; window = window->next) { SDL_SendWindowEvent(window, SDL_WINDOWEVENT_FOCUS_GAINED, 0, 0); SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESTORED, 0, 0); } @@ -4667,7 +4647,7 @@ void SDL_OnApplicationDidBecomeActive(void) int SDL_Vulkan_LoadLibrary(const char *path) { int retval; - if (_this == NULL) { + if (!_this) { SDL_UninitializedVideo(); return -1; } @@ -4690,7 +4670,7 @@ int SDL_Vulkan_LoadLibrary(const char *path) void *SDL_Vulkan_GetVkGetInstanceProcAddr(void) { - if (_this == NULL) { + if (!_this) { SDL_UninitializedVideo(); return NULL; } @@ -4703,7 +4683,7 @@ void *SDL_Vulkan_GetVkGetInstanceProcAddr(void) void SDL_Vulkan_UnloadLibrary(void) { - if (_this == NULL) { + if (!_this) { SDL_UninitializedVideo(); return; } @@ -4728,7 +4708,7 @@ SDL_bool SDL_Vulkan_GetInstanceExtensions(SDL_Window *window, unsigned *count, c } } - if (count == NULL) { + if (!count) { SDL_InvalidParamError("count"); return SDL_FALSE; } @@ -4752,7 +4732,7 @@ SDL_bool SDL_Vulkan_CreateSurface(SDL_Window *window, return SDL_FALSE; } - if (surface == NULL) { + if (!surface) { SDL_InvalidParamError("surface"); return SDL_FALSE; } @@ -4824,4 +4804,93 @@ void SDL_Metal_GetDrawableSize(SDL_Window *window, int *w, int *h) } } +#if defined(SDL_VIDEO_DRIVER_X11) || defined(SDL_VIDEO_DRIVER_WAYLAND) || defined(SDL_VIDEO_DRIVER_EMSCRIPTEN) +const char *SDL_GetCSSCursorName(SDL_SystemCursor id, const char **fallback_name) +{ + /* Reference: https://www.w3.org/TR/css-ui-4/#cursor */ + /* Also in: https://www.freedesktop.org/wiki/Specifications/cursor-spec/ */ + switch (id) { + case SDL_SYSTEM_CURSOR_ARROW: + return "default"; + + case SDL_SYSTEM_CURSOR_IBEAM: + return "text"; + + case SDL_SYSTEM_CURSOR_WAIT: + return "wait"; + + case SDL_SYSTEM_CURSOR_CROSSHAIR: + return "crosshair"; + + case SDL_SYSTEM_CURSOR_WAITARROW: + return "progress"; + + case SDL_SYSTEM_CURSOR_SIZENWSE: + if (fallback_name) { + /* only a single arrow */ + *fallback_name = "nw-resize"; + } + return "nwse-resize"; + + case SDL_SYSTEM_CURSOR_SIZENESW: + if (fallback_name) { + /* only a single arrow */ + *fallback_name = "ne-resize"; + } + return "nesw-resize"; + + case SDL_SYSTEM_CURSOR_SIZEWE: + if (fallback_name) { + *fallback_name = "col-resize"; + } + return "ew-resize"; + + case SDL_SYSTEM_CURSOR_SIZENS: + if (fallback_name) { + *fallback_name = "row-resize"; + } + return "ns-resize"; + + case SDL_SYSTEM_CURSOR_SIZEALL: + return "all-scroll"; + + case SDL_SYSTEM_CURSOR_NO: + return "not-allowed"; + + case SDL_SYSTEM_CURSOR_HAND: + return "pointer"; + +#if 0 + case SDL_SYSTEM_CURSOR_WINDOW_TOPLEFT: + return "nw-resize"; + + case SDL_SYSTEM_CURSOR_WINDOW_TOP: + return "n-resize"; + + case SDL_SYSTEM_CURSOR_WINDOW_TOPRIGHT: + return "ne-resize"; + + case SDL_SYSTEM_CURSOR_WINDOW_RIGHT: + return "e-resize"; + + case SDL_SYSTEM_CURSOR_WINDOW_BOTTOMRIGHT: + return "se-resize"; + + case SDL_SYSTEM_CURSOR_WINDOW_BOTTOM: + return "s-resize"; + + case SDL_SYSTEM_CURSOR_WINDOW_BOTTOMLEFT: + return "sw-resize"; + + case SDL_SYSTEM_CURSOR_WINDOW_LEFT: + return "w-resize"; +#endif + + default: + SDL_assert(0); + return "default"; + } +} +#endif + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/thirdparty/SDL/src/video/SDL_vulkan_internal.h b/thirdparty/SDL/src/video/SDL_vulkan_internal.h index ff731c344..28728fadc 100644 --- a/thirdparty/SDL/src/video/SDL_vulkan_internal.h +++ b/thirdparty/SDL/src/video/SDL_vulkan_internal.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,34 +25,34 @@ #include "SDL_stdinc.h" -#if SDL_VIDEO_VULKAN -#if SDL_LOADSO_DISABLED || SDL_LOADSO_DUMMY +#ifdef SDL_VIDEO_VULKAN +#if defined(SDL_LOADSO_DISABLED) || defined(SDL_LOADSO_DUMMY) #error You should not be here. #endif -#if SDL_VIDEO_DRIVER_ANDROID +#ifdef SDL_VIDEO_DRIVER_ANDROID #define VK_USE_PLATFORM_ANDROID_KHR #endif -#if SDL_VIDEO_DRIVER_COCOA +#ifdef SDL_VIDEO_DRIVER_COCOA #define VK_USE_PLATFORM_METAL_EXT #define VK_USE_PLATFORM_MACOS_MVK #endif -#if SDL_VIDEO_DRIVER_DIRECTFB +#ifdef SDL_VIDEO_DRIVER_DIRECTFB #define VK_USE_PLATFORM_DIRECTFB_EXT #endif -#if SDL_VIDEO_DRIVER_UIKIT +#ifdef SDL_VIDEO_DRIVER_UIKIT #define VK_USE_PLATFORM_METAL_EXT #define VK_USE_PLATFORM_IOS_MVK #endif -#if SDL_VIDEO_DRIVER_WAYLAND +#ifdef SDL_VIDEO_DRIVER_WAYLAND #define VK_USE_PLATFORM_WAYLAND_KHR #include "wayland/SDL_waylanddyn.h" #endif -#if SDL_VIDEO_DRIVER_WINDOWS +#ifdef SDL_VIDEO_DRIVER_WINDOWS #define VK_USE_PLATFORM_WIN32_KHR #include "../core/windows/SDL_windows.h" #endif -#if SDL_VIDEO_DRIVER_X11 +#ifdef SDL_VIDEO_DRIVER_X11 #define VK_USE_PLATFORM_XLIB_KHR #define VK_USE_PLATFORM_XCB_KHR #endif diff --git a/thirdparty/SDL/src/video/SDL_vulkan_utils.c b/thirdparty/SDL/src/video/SDL_vulkan_utils.c index 3d5827f69..7a1579d75 100644 --- a/thirdparty/SDL/src/video/SDL_vulkan_utils.c +++ b/thirdparty/SDL/src/video/SDL_vulkan_utils.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -23,7 +23,7 @@ #include "SDL_vulkan_internal.h" #include "SDL_error.h" -#if SDL_VIDEO_VULKAN +#ifdef SDL_VIDEO_VULKAN const char *SDL_Vulkan_GetResultString(VkResult result) { @@ -149,7 +149,7 @@ VkExtensionProperties *SDL_Vulkan_CreateInstanceExtensionsList( retval = SDL_calloc(count, sizeof(VkExtensionProperties)); } - if (retval == NULL) { + if (!retval) { SDL_OutOfMemory(); return NULL; } @@ -232,7 +232,7 @@ SDL_bool SDL_Vulkan_Display_CreateSurface(void *vkGetInstanceProcAddr_, goto error; } chosenDisplayId = SDL_getenv("SDL_VULKAN_DISPLAY"); - if (chosenDisplayId != NULL) { + if (chosenDisplayId) { displayId = SDL_atoi(chosenDisplayId); } @@ -249,7 +249,7 @@ SDL_bool SDL_Vulkan_Display_CreateSurface(void *vkGetInstanceProcAddr_, } physicalDevices = SDL_malloc(sizeof(VkPhysicalDevice) * physicalDeviceCount); - if (physicalDevices == NULL) { + if (!physicalDevices) { SDL_OutOfMemory(); goto error; } @@ -292,7 +292,7 @@ SDL_bool SDL_Vulkan_Display_CreateSurface(void *vkGetInstanceProcAddr_, } displayProperties = SDL_malloc(sizeof(VkDisplayPropertiesKHR) * displayPropertiesCount); - if (displayProperties == NULL) { + if (!displayProperties) { SDL_OutOfMemory(); goto error; } @@ -321,7 +321,7 @@ SDL_bool SDL_Vulkan_Display_CreateSurface(void *vkGetInstanceProcAddr_, SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "vulkandisplay: Number of display modes: %u", displayModePropertiesCount); displayModeProperties = SDL_malloc(sizeof(VkDisplayModePropertiesKHR) * displayModePropertiesCount); - if (displayModeProperties == NULL) { + if (!displayModeProperties) { SDL_OutOfMemory(); goto error; } @@ -368,7 +368,7 @@ SDL_bool SDL_Vulkan_Display_CreateSurface(void *vkGetInstanceProcAddr_, SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "vulkandisplay: Number of display planes: %u", displayPlanePropertiesCount); displayPlaneProperties = SDL_malloc(sizeof(VkDisplayPlanePropertiesKHR) * displayPlanePropertiesCount); - if (displayPlaneProperties == NULL) { + if (!displayPlaneProperties) { SDL_OutOfMemory(); goto error; } @@ -399,7 +399,7 @@ SDL_bool SDL_Vulkan_Display_CreateSurface(void *vkGetInstanceProcAddr_, SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "vulkandisplay: Number of supported displays for plane %u: %u", i, planeSupportedDisplaysCount); planeSupportedDisplays = SDL_malloc(sizeof(VkDisplayKHR) * planeSupportedDisplaysCount); - if (planeSupportedDisplays == NULL) { + if (!planeSupportedDisplays) { SDL_free(displayPlaneProperties); SDL_OutOfMemory(); goto error; diff --git a/thirdparty/SDL/src/video/SDL_yuv.c b/thirdparty/SDL/src/video/SDL_yuv.c index dd79d79cf..14f57468d 100644 --- a/thirdparty/SDL/src/video/SDL_yuv.c +++ b/thirdparty/SDL/src/video/SDL_yuv.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -40,7 +40,7 @@ void SDL_SetYUVConversionMode(SDL_YUV_CONVERSION_MODE mode) SDL_YUV_ConversionMode = mode; } -SDL_YUV_CONVERSION_MODE SDL_GetYUVConversionMode() +SDL_YUV_CONVERSION_MODE SDL_GetYUVConversionMode(void) { return SDL_YUV_ConversionMode; } @@ -597,7 +597,7 @@ int SDL_ConvertPixels_YUV_to_RGB(int width, int height, int tmp_pitch = (width * sizeof(Uint32)); tmp = SDL_malloc((size_t)tmp_pitch * height); - if (tmp == NULL) { + if (!tmp) { return SDL_OutOfMemory(); } @@ -978,7 +978,7 @@ int SDL_ConvertPixels_RGB_to_YUV(int width, int height, int tmp_pitch = (width * sizeof(Uint32)); tmp = SDL_malloc((size_t)tmp_pitch * height); - if (tmp == NULL) { + if (!tmp) { return SDL_OutOfMemory(); } @@ -1067,7 +1067,7 @@ static int SDL_ConvertPixels_SwapUVPlanes(int width, int height, const void *src /* Allocate a temporary row for the swap */ tmp = (Uint8 *)SDL_malloc(UVwidth); - if (tmp == NULL) { + if (!tmp) { return SDL_OutOfMemory(); } for (y = 0; y < UVheight; ++y) { @@ -1127,7 +1127,7 @@ static int SDL_ConvertPixels_PackUVPlanes_to_NV(int width, int height, const voi if (src == dst) { /* Need to make a copy of the buffer so we don't clobber it while converting */ tmp = (Uint8 *)SDL_malloc((size_t)2 * UVheight * srcUVPitch); - if (tmp == NULL) { + if (!tmp) { return SDL_OutOfMemory(); } SDL_memcpy(tmp, src, (size_t)2 * UVheight * srcUVPitch); @@ -1200,7 +1200,7 @@ static int SDL_ConvertPixels_SplitNV_to_UVPlanes(int width, int height, const vo if (src == dst) { /* Need to make a copy of the buffer so we don't clobber it while converting */ tmp = (Uint8 *)SDL_malloc((size_t)UVheight * srcUVPitch); - if (tmp == NULL) { + if (!tmp) { return SDL_OutOfMemory(); } SDL_memcpy(tmp, src, (size_t)UVheight * srcUVPitch); diff --git a/thirdparty/SDL/src/video/SDL_yuv_c.h b/thirdparty/SDL/src/video/SDL_yuv_c.h index 59ee9b6be..3fda84b7f 100644 --- a/thirdparty/SDL/src/video/SDL_yuv_c.h +++ b/thirdparty/SDL/src/video/SDL_yuv_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/android/SDL_androidclipboard.c b/thirdparty/SDL/src/video/android/SDL_androidclipboard.c index bd80a0100..afd729eca 100644 --- a/thirdparty/SDL/src/video/android/SDL_androidclipboard.c +++ b/thirdparty/SDL/src/video/android/SDL_androidclipboard.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_ANDROID +#ifdef SDL_VIDEO_DRIVER_ANDROID #include "SDL_androidvideo.h" #include "SDL_androidclipboard.h" diff --git a/thirdparty/SDL/src/video/android/SDL_androidclipboard.h b/thirdparty/SDL/src/video/android/SDL_androidclipboard.h index 627492ada..8097d7199 100644 --- a/thirdparty/SDL/src/video/android/SDL_androidclipboard.h +++ b/thirdparty/SDL/src/video/android/SDL_androidclipboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/android/SDL_androidevents.c b/thirdparty/SDL/src/video/android/SDL_androidevents.c index b15239828..d125c92bd 100644 --- a/thirdparty/SDL/src/video/android/SDL_androidevents.c +++ b/thirdparty/SDL/src/video/android/SDL_androidevents.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,10 +20,11 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_ANDROID +#ifdef SDL_VIDEO_DRIVER_ANDROID #include "SDL_androidevents.h" #include "SDL_events.h" +#include "SDL_hints.h" #include "SDL_androidkeyboard.h" #include "SDL_androidwindow.h" #include "../SDL_sysvideo.h" @@ -32,7 +33,7 @@ /* Can't include sysaudio "../../audio/android/SDL_androidaudio.h" * because of THIS redefinition */ -#if !SDL_AUDIO_DISABLED && SDL_AUDIO_DRIVER_ANDROID +#if !defined(SDL_AUDIO_DISABLED) && defined(SDL_AUDIO_DRIVER_ANDROID) extern void ANDROIDAUDIO_ResumeDevices(void); extern void ANDROIDAUDIO_PauseDevices(void); #else @@ -40,7 +41,7 @@ static void ANDROIDAUDIO_ResumeDevices(void) {} static void ANDROIDAUDIO_PauseDevices(void) {} #endif -#if !SDL_AUDIO_DISABLED && SDL_AUDIO_DRIVER_OPENSLES +#if !defined(SDL_AUDIO_DISABLED) && defined(SDL_AUDIO_DRIVER_OPENSLES) extern void openslES_ResumeDevices(void); extern void openslES_PauseDevices(void); #else @@ -50,7 +51,7 @@ static void openslES_ResumeDevices(void) static void openslES_PauseDevices(void) {} #endif -#if !SDL_AUDIO_DISABLED && SDL_AUDIO_DRIVER_AAUDIO +#if !defined(SDL_AUDIO_DISABLED) && defined(SDL_AUDIO_DRIVER_AAUDIO) extern void aaudio_ResumeDevices(void); extern void aaudio_PauseDevices(void); SDL_bool aaudio_DetectBrokenPlayState(void); @@ -68,7 +69,7 @@ static int SDL_NumberOfEvents(Uint32 type) return SDL_PeepEvents(NULL, 0, SDL_PEEKEVENT, type, type); } -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL static void android_egl_context_restore(SDL_Window *window) { if (window) { @@ -113,7 +114,7 @@ void Android_PumpEvents_Blocking(_THIS) if (videodata->isPaused) { SDL_bool isContextExternal = SDL_IsVideoContextExternal(); -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL /* Make sure this is the last thing we do before pausing */ if (!isContextExternal) { SDL_LockMutex(Android_ActivityMutex); @@ -140,7 +141,7 @@ void Android_PumpEvents_Blocking(_THIS) aaudio_ResumeDevices(); /* Restore the GL Context from here, as this operation is thread dependent */ -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL if (!isContextExternal && !SDL_HasEvent(SDL_QUIT)) { SDL_LockMutex(Android_ActivityMutex); android_egl_context_restore(Android_Window); @@ -149,9 +150,7 @@ void Android_PumpEvents_Blocking(_THIS) #endif /* Make sure SW Keyboard is restored when an app becomes foreground */ - if (SDL_IsTextInputActive()) { - Android_StartTextInput(_this); /* Only showTextInput */ - } + Android_RestoreScreenKeyboardOnResume(_this, Android_Window); } } else { if (videodata->isPausing || SDL_SemTryWait(Android_PauseSem) == 0) { @@ -191,7 +190,7 @@ void Android_PumpEvents_NonBlocking(_THIS) SDL_bool isContextExternal = SDL_IsVideoContextExternal(); if (backup_context) { -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL if (!isContextExternal) { SDL_LockMutex(Android_ActivityMutex); android_egl_context_backup(Android_Window); @@ -223,7 +222,7 @@ void Android_PumpEvents_NonBlocking(_THIS) aaudio_ResumeDevices(); } -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL /* Restore the GL Context from here, as this operation is thread dependent */ if (!isContextExternal && !SDL_HasEvent(SDL_QUIT)) { SDL_LockMutex(Android_ActivityMutex); @@ -233,9 +232,7 @@ void Android_PumpEvents_NonBlocking(_THIS) #endif /* Make sure SW Keyboard is restored when an app becomes foreground */ - if (SDL_IsTextInputActive()) { - Android_StartTextInput(_this); /* Only showTextInput */ - } + Android_RestoreScreenKeyboardOnResume(_this, Android_Window); } } else { if (videodata->isPausing || SDL_SemTryWait(Android_PauseSem) == 0) { diff --git a/thirdparty/SDL/src/video/android/SDL_androidevents.h b/thirdparty/SDL/src/video/android/SDL_androidevents.h index 103d166c9..921daa6cf 100644 --- a/thirdparty/SDL/src/video/android/SDL_androidevents.h +++ b/thirdparty/SDL/src/video/android/SDL_androidevents.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/android/SDL_androidgl.c b/thirdparty/SDL/src/video/android/SDL_androidgl.c index e54dbbed1..5e5ef603e 100644 --- a/thirdparty/SDL/src/video/android/SDL_androidgl.c +++ b/thirdparty/SDL/src/video/android/SDL_androidgl.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_ANDROID && SDL_VIDEO_OPENGL_EGL +#if defined(SDL_VIDEO_DRIVER_ANDROID) && defined(SDL_VIDEO_OPENGL_EGL) /* Android SDL video driver implementation */ diff --git a/thirdparty/SDL/src/video/android/SDL_androidgl.h b/thirdparty/SDL/src/video/android/SDL_androidgl.h index 34bd22984..4fb505c1f 100644 --- a/thirdparty/SDL/src/video/android/SDL_androidgl.h +++ b/thirdparty/SDL/src/video/android/SDL_androidgl.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/android/SDL_androidkeyboard.c b/thirdparty/SDL/src/video/android/SDL_androidkeyboard.c index ba652019a..b55de0297 100644 --- a/thirdparty/SDL/src/video/android/SDL_androidkeyboard.c +++ b/thirdparty/SDL/src/video/android/SDL_androidkeyboard.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_ANDROID +#ifdef SDL_VIDEO_DRIVER_ANDROID #include @@ -313,6 +313,8 @@ static SDL_Scancode Android_Keycodes[] = { SDL_SCANCODE_PASTE, /* AKEYCODE_PASTE */ }; +static SDL_bool SDL_screen_keyboard_shown; + static SDL_Scancode TranslateKeycode(int keycode) { SDL_Scancode scancode = SDL_SCANCODE_UNKNOWN; @@ -341,27 +343,36 @@ SDL_bool Android_HasScreenKeyboardSupport(_THIS) return SDL_TRUE; } -SDL_bool Android_IsScreenKeyboardShown(_THIS, SDL_Window *window) +void Android_ShowScreenKeyboard(_THIS, SDL_Window *window) { - return Android_JNI_IsScreenKeyboardShown(); + SDL_VideoData *videodata = _this->driverdata; + Android_JNI_ShowScreenKeyboard(&videodata->textRect); + SDL_screen_keyboard_shown = SDL_TRUE; } -void Android_StartTextInput(_THIS) +void Android_HideScreenKeyboard(_THIS, SDL_Window *window) { - SDL_VideoData *videodata = (SDL_VideoData *)_this->driverdata; - Android_JNI_ShowTextInput(&videodata->textRect); + Android_JNI_HideScreenKeyboard(); + SDL_screen_keyboard_shown = SDL_FALSE; +} + +void Android_RestoreScreenKeyboardOnResume(_THIS, SDL_Window *window) +{ + if (SDL_screen_keyboard_shown) { + Android_ShowScreenKeyboard(_this, window); + } } -void Android_StopTextInput(_THIS) +SDL_bool Android_IsScreenKeyboardShown(_THIS, SDL_Window *window) { - Android_JNI_HideTextInput(); + return Android_JNI_IsScreenKeyboardShown(); } void Android_SetTextInputRect(_THIS, const SDL_Rect *rect) { SDL_VideoData *videodata = (SDL_VideoData *)_this->driverdata; - if (rect == NULL) { + if (!rect) { SDL_InvalidParamError("rect"); return; } diff --git a/thirdparty/SDL/src/video/android/SDL_androidkeyboard.h b/thirdparty/SDL/src/video/android/SDL_androidkeyboard.h index 81b593fb1..4081ac674 100644 --- a/thirdparty/SDL/src/video/android/SDL_androidkeyboard.h +++ b/thirdparty/SDL/src/video/android/SDL_androidkeyboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -26,10 +26,10 @@ extern int Android_OnKeyDown(int keycode); extern int Android_OnKeyUp(int keycode); extern SDL_bool Android_HasScreenKeyboardSupport(_THIS); +extern void Android_ShowScreenKeyboard(_THIS, SDL_Window *window); +extern void Android_HideScreenKeyboard(_THIS, SDL_Window *window); +extern void Android_RestoreScreenKeyboardOnResume(_THIS, SDL_Window *window); extern SDL_bool Android_IsScreenKeyboardShown(_THIS, SDL_Window *window); - -extern void Android_StartTextInput(_THIS); -extern void Android_StopTextInput(_THIS); extern void Android_SetTextInputRect(_THIS, const SDL_Rect *rect); /* vi: set ts=4 sw=4 expandtab: */ diff --git a/thirdparty/SDL/src/video/android/SDL_androidmessagebox.c b/thirdparty/SDL/src/video/android/SDL_androidmessagebox.c index 81f6f38a6..cb2ad2807 100644 --- a/thirdparty/SDL/src/video/android/SDL_androidmessagebox.c +++ b/thirdparty/SDL/src/video/android/SDL_androidmessagebox.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_ANDROID +#ifdef SDL_VIDEO_DRIVER_ANDROID #include "SDL_messagebox.h" #include "SDL_androidmessagebox.h" diff --git a/thirdparty/SDL/src/video/android/SDL_androidmessagebox.h b/thirdparty/SDL/src/video/android/SDL_androidmessagebox.h index 9dabc9e4d..7c93c0eff 100644 --- a/thirdparty/SDL/src/video/android/SDL_androidmessagebox.h +++ b/thirdparty/SDL/src/video/android/SDL_androidmessagebox.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_ANDROID +#ifdef SDL_VIDEO_DRIVER_ANDROID extern int Android_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid); diff --git a/thirdparty/SDL/src/video/android/SDL_androidmouse.c b/thirdparty/SDL/src/video/android/SDL_androidmouse.c index 7d9ab0928..19a70044c 100644 --- a/thirdparty/SDL/src/video/android/SDL_androidmouse.c +++ b/thirdparty/SDL/src/video/android/SDL_androidmouse.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,7 +21,7 @@ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_ANDROID +#ifdef SDL_VIDEO_DRIVER_ANDROID #include "SDL_androidmouse.h" @@ -78,7 +78,7 @@ static SDL_Cursor *Android_WrapCursor(int custom_cursor, int system_cursor) return cursor; } -static SDL_Cursor *Android_CreateDefaultCursor() +static SDL_Cursor *Android_CreateDefaultCursor(void) { return Android_WrapCursor(0, SDL_SYSTEM_CURSOR_ARROW); } @@ -89,7 +89,7 @@ static SDL_Cursor *Android_CreateCursor(SDL_Surface *surface, int hot_x, int hot SDL_Surface *converted; converted = SDL_ConvertSurfaceFormat(surface, SDL_PIXELFORMAT_ARGB8888, 0); - if (converted == NULL) { + if (!converted) { return NULL; } custom_cursor = Android_JNI_CreateCustomCursor(converted, hot_x, hot_y); @@ -116,9 +116,9 @@ static void Android_FreeCursor(SDL_Cursor *cursor) SDL_free(cursor); } -static SDL_Cursor *Android_CreateEmptyCursor() +static SDL_Cursor *Android_CreateEmptyCursor(void) { - if (empty_cursor == NULL) { + if (!empty_cursor) { SDL_Surface *empty_surface = SDL_CreateRGBSurfaceWithFormat(0, 1, 1, 32, SDL_PIXELFORMAT_ARGB8888); if (empty_surface) { SDL_memset(empty_surface->pixels, 0, (size_t)empty_surface->h * empty_surface->pitch); @@ -129,7 +129,7 @@ static SDL_Cursor *Android_CreateEmptyCursor() return empty_cursor; } -static void Android_DestroyEmptyCursor() +static void Android_DestroyEmptyCursor(void) { if (empty_cursor) { Android_FreeCursor(empty_cursor); @@ -139,7 +139,7 @@ static void Android_DestroyEmptyCursor() static int Android_ShowCursor(SDL_Cursor *cursor) { - if (cursor == NULL) { + if (!cursor) { cursor = Android_CreateEmptyCursor(); } if (cursor) { @@ -216,7 +216,7 @@ void Android_OnMouse(SDL_Window *window, int state, int action, float x, float y int changes; Uint8 button; - if (window == NULL) { + if (!window) { return; } diff --git a/thirdparty/SDL/src/video/android/SDL_androidmouse.h b/thirdparty/SDL/src/video/android/SDL_androidmouse.h index 11c5ede20..6ff724986 100644 --- a/thirdparty/SDL/src/video/android/SDL_androidmouse.h +++ b/thirdparty/SDL/src/video/android/SDL_androidmouse.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/android/SDL_androidtouch.c b/thirdparty/SDL/src/video/android/SDL_androidtouch.c index a62ae9eb8..c44f2b0de 100644 --- a/thirdparty/SDL/src/video/android/SDL_androidtouch.c +++ b/thirdparty/SDL/src/video/android/SDL_androidtouch.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_ANDROID +#ifdef SDL_VIDEO_DRIVER_ANDROID #include @@ -54,7 +54,7 @@ void Android_OnTouch(SDL_Window *window, int touch_device_id_in, int pointer_fin SDL_TouchID touchDeviceId = 0; SDL_FingerID fingerId = 0; - if (window == NULL) { + if (!window) { return; } diff --git a/thirdparty/SDL/src/video/android/SDL_androidtouch.h b/thirdparty/SDL/src/video/android/SDL_androidtouch.h index 1e8739158..067842a60 100644 --- a/thirdparty/SDL/src/video/android/SDL_androidtouch.h +++ b/thirdparty/SDL/src/video/android/SDL_androidtouch.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/android/SDL_androidvideo.c b/thirdparty/SDL/src/video/android/SDL_androidvideo.c index 714fa45a5..f54b4c3cd 100644 --- a/thirdparty/SDL/src/video/android/SDL_androidvideo.c +++ b/thirdparty/SDL/src/video/android/SDL_androidvideo.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_ANDROID +#ifdef SDL_VIDEO_DRIVER_ANDROID /* Android SDL video driver implementation */ @@ -41,6 +41,7 @@ #include "SDL_androidtouch.h" #include "SDL_androidwindow.h" #include "SDL_androidvulkan.h" +#include "SDL_androidmessagebox.h" #define ANDROID_VID_DRIVER_NAME "Android" @@ -88,13 +89,13 @@ static SDL_VideoDevice *Android_CreateDevice(void) /* Initialize all variables that we clean on shutdown */ device = (SDL_VideoDevice *)SDL_calloc(1, sizeof(SDL_VideoDevice)); - if (device == NULL) { + if (!device) { SDL_OutOfMemory(); return NULL; } data = (SDL_VideoData *)SDL_calloc(1, sizeof(SDL_VideoData)); - if (data == NULL) { + if (!data) { SDL_OutOfMemory(); SDL_free(device); return NULL; @@ -125,7 +126,7 @@ static SDL_VideoDevice *Android_CreateDevice(void) device->free = Android_DeleteDevice; /* GL pointers */ -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL device->GL_LoadLibrary = Android_GLES_LoadLibrary; device->GL_GetProcAddress = Android_GLES_GetProcAddress; device->GL_UnloadLibrary = Android_GLES_UnloadLibrary; @@ -137,7 +138,7 @@ static SDL_VideoDevice *Android_CreateDevice(void) device->GL_DeleteContext = Android_GLES_DeleteContext; #endif -#if SDL_VIDEO_VULKAN +#ifdef SDL_VIDEO_VULKAN device->Vulkan_LoadLibrary = Android_Vulkan_LoadLibrary; device->Vulkan_UnloadLibrary = Android_Vulkan_UnloadLibrary; device->Vulkan_GetInstanceExtensions = Android_Vulkan_GetInstanceExtensions; @@ -148,12 +149,12 @@ static SDL_VideoDevice *Android_CreateDevice(void) device->SuspendScreenSaver = Android_SuspendScreenSaver; /* Text input */ - device->StartTextInput = Android_StartTextInput; - device->StopTextInput = Android_StopTextInput; device->SetTextInputRect = Android_SetTextInputRect; /* Screen keyboard */ device->HasScreenKeyboardSupport = Android_HasScreenKeyboardSupport; + device->ShowScreenKeyboard = Android_ShowScreenKeyboard; + device->HideScreenKeyboard = Android_HideScreenKeyboard; device->IsScreenKeyboardShown = Android_IsScreenKeyboardShown; /* Clipboard */ @@ -166,7 +167,8 @@ static SDL_VideoDevice *Android_CreateDevice(void) VideoBootStrap Android_bootstrap = { ANDROID_VID_DRIVER_NAME, "SDL Android video driver", - Android_CreateDevice + Android_CreateDevice, + Android_ShowMessageBox }; int Android_VideoInit(_THIS) diff --git a/thirdparty/SDL/src/video/android/SDL_androidvideo.h b/thirdparty/SDL/src/video/android/SDL_androidvideo.h index 41194b404..7eb4f9ac5 100644 --- a/thirdparty/SDL/src/video/android/SDL_androidvideo.h +++ b/thirdparty/SDL/src/video/android/SDL_androidvideo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/android/SDL_androidvulkan.c b/thirdparty/SDL/src/video/android/SDL_androidvulkan.c index 088d85e78..6ade57ed8 100644 --- a/thirdparty/SDL/src/video/android/SDL_androidvulkan.c +++ b/thirdparty/SDL/src/video/android/SDL_androidvulkan.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -26,7 +26,7 @@ #include "../../SDL_internal.h" -#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_ANDROID +#if defined(SDL_VIDEO_VULKAN) && defined(SDL_VIDEO_DRIVER_ANDROID) #include "SDL_androidvideo.h" #include "SDL_androidwindow.h" @@ -47,10 +47,10 @@ int Android_Vulkan_LoadLibrary(_THIS, const char *path) } /* Load the Vulkan loader library */ - if (path == NULL) { + if (!path) { path = SDL_getenv("SDL_VULKAN_LIBRARY"); } - if (path == NULL) { + if (!path) { path = "libvulkan.so"; } _this->vulkan_config.loader_handle = SDL_LoadObject(path); @@ -75,7 +75,7 @@ int Android_Vulkan_LoadLibrary(_THIS, const char *path) (PFN_vkEnumerateInstanceExtensionProperties) _this->vulkan_config.vkEnumerateInstanceExtensionProperties, &extensionCount); - if (extensions == NULL) { + if (!extensions) { goto fail; } for (i = 0; i < extensionCount; i++) { diff --git a/thirdparty/SDL/src/video/android/SDL_androidvulkan.h b/thirdparty/SDL/src/video/android/SDL_androidvulkan.h index 5e39d93a9..caee0a672 100644 --- a/thirdparty/SDL/src/video/android/SDL_androidvulkan.h +++ b/thirdparty/SDL/src/video/android/SDL_androidvulkan.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -32,7 +32,7 @@ #include "../SDL_vulkan_internal.h" #include "../SDL_sysvideo.h" -#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_ANDROID +#if defined(SDL_VIDEO_VULKAN) && defined(SDL_VIDEO_DRIVER_ANDROID) int Android_Vulkan_LoadLibrary(_THIS, const char *path); void Android_Vulkan_UnloadLibrary(_THIS); diff --git a/thirdparty/SDL/src/video/android/SDL_androidwindow.c b/thirdparty/SDL/src/video/android/SDL_androidwindow.c index 9b3573973..2624331e0 100644 --- a/thirdparty/SDL/src/video/android/SDL_androidwindow.c +++ b/thirdparty/SDL/src/video/android/SDL_androidwindow.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_ANDROID +#ifdef SDL_VIDEO_DRIVER_ANDROID #include "SDL_syswm.h" #include "../SDL_sysvideo.h" @@ -65,7 +65,7 @@ int Android_CreateWindow(_THIS, SDL_Window *window) SDL_SetKeyboardFocus(window); data = (SDL_WindowData *)SDL_calloc(1, sizeof(*data)); - if (data == NULL) { + if (!data) { retval = SDL_OutOfMemory(); goto endfunction; } @@ -80,7 +80,7 @@ int Android_CreateWindow(_THIS, SDL_Window *window) /* Do not create EGLSurface for Vulkan window since it will then make the window incompatible with vkCreateAndroidSurfaceKHR */ -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL if (window->flags & SDL_WINDOW_OPENGL) { data->egl_surface = SDL_EGL_CreateSurface(_this, (NativeWindowType)data->native_window); @@ -132,7 +132,7 @@ void Android_SetWindowFullscreen(_THIS, SDL_Window *window, SDL_VideoDisplay *di } data = (SDL_WindowData *)window->driverdata; - if (data == NULL || !data->native_window) { + if (!data || !data->native_window) { if (data && !data->native_window) { SDL_SetError("Missing native window"); } @@ -180,7 +180,7 @@ void Android_DestroyWindow(_THIS, SDL_Window *window) if (window->driverdata) { SDL_WindowData *data = (SDL_WindowData *)window->driverdata; -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL if (data->egl_surface != EGL_NO_SURFACE) { SDL_EGL_DestroySurface(_this, data->egl_surface); } @@ -205,7 +205,7 @@ SDL_bool Android_GetWindowWMInfo(_THIS, SDL_Window *window, SDL_SysWMinfo *info) info->subsystem = SDL_SYSWM_ANDROID; info->info.android.window = data->native_window; -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL info->info.android.surface = data->egl_surface; #endif diff --git a/thirdparty/SDL/src/video/android/SDL_androidwindow.h b/thirdparty/SDL/src/video/android/SDL_androidwindow.h index 1d529365c..240c77ce3 100644 --- a/thirdparty/SDL/src/video/android/SDL_androidwindow.h +++ b/thirdparty/SDL/src/video/android/SDL_androidwindow.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -38,7 +38,7 @@ extern SDL_Window *Android_Window; typedef struct { -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL EGLSurface egl_surface; EGLContext egl_context; /* We use this to preserve the context when losing focus */ #endif diff --git a/thirdparty/SDL/src/video/cocoa/SDL_cocoaclipboard.h b/thirdparty/SDL/src/video/cocoa/SDL_cocoaclipboard.h index b6ec8e79c..a7b7a548e 100644 --- a/thirdparty/SDL/src/video/cocoa/SDL_cocoaclipboard.h +++ b/thirdparty/SDL/src/video/cocoa/SDL_cocoaclipboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/cocoa/SDL_cocoaclipboard.m b/thirdparty/SDL/src/video/cocoa/SDL_cocoaclipboard.m index c64f2e476..136dba44e 100644 --- a/thirdparty/SDL/src/video/cocoa/SDL_cocoaclipboard.m +++ b/thirdparty/SDL/src/video/cocoa/SDL_cocoaclipboard.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_COCOA +#ifdef SDL_VIDEO_DRIVER_COCOA #include "SDL_cocoavideo.h" #include "../../events/SDL_clipboardevents_c.h" diff --git a/thirdparty/SDL/src/video/cocoa/SDL_cocoaevents.h b/thirdparty/SDL/src/video/cocoa/SDL_cocoaevents.h index 1f8f84d79..421df3aa1 100644 --- a/thirdparty/SDL/src/video/cocoa/SDL_cocoaevents.h +++ b/thirdparty/SDL/src/video/cocoa/SDL_cocoaevents.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/cocoa/SDL_cocoaevents.m b/thirdparty/SDL/src/video/cocoa/SDL_cocoaevents.m index 99db10c69..441985da2 100644 --- a/thirdparty/SDL/src/video/cocoa/SDL_cocoaevents.m +++ b/thirdparty/SDL/src/video/cocoa/SDL_cocoaevents.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_COCOA +#ifdef SDL_VIDEO_DRIVER_COCOA #include "SDL_timer.h" @@ -138,6 +138,7 @@ @interface SDLAppDelegate : NSObject { - (id)init; - (void)localeDidChange:(NSNotification *)notification; +- (BOOL)applicationSupportsSecureRestorableState:(NSApplication *)app; @end @implementation SDLAppDelegate : NSObject @@ -310,6 +311,22 @@ - (void)handleURLEvent:(NSAppleEventDescriptor *)event withReplyEvent:(NSAppleEv SDL_SendDropComplete(NULL); } +- (BOOL)applicationSupportsSecureRestorableState:(NSApplication *)app +{ + // This just tells Cocoa that we didn't do any custom save state magic for the app, + // so the system is safe to use NSSecureCoding internally, instead of using unencrypted + // save states for backwards compatibility. If we don't return YES here, we'll get a + // warning on the console at startup: + // + // ``` + // WARNING: Secure coding is not enabled for restorable state! Enable secure coding by implementing NSApplicationDelegate.applicationSupportsSecureRestorableState: and returning YES. + // ``` + // + // More-detailed explanation: + // https://stackoverflow.com/questions/77283578/sonoma-and-nsapplicationdelegate-applicationsupportssecurerestorablestate/77320845#77320845 + return YES; +} + @end static SDLAppDelegate *appDelegate = nil; diff --git a/thirdparty/SDL/src/video/cocoa/SDL_cocoakeyboard.h b/thirdparty/SDL/src/video/cocoa/SDL_cocoakeyboard.h index 8b8df4112..d08066403 100644 --- a/thirdparty/SDL/src/video/cocoa/SDL_cocoakeyboard.h +++ b/thirdparty/SDL/src/video/cocoa/SDL_cocoakeyboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/cocoa/SDL_cocoakeyboard.m b/thirdparty/SDL/src/video/cocoa/SDL_cocoakeyboard.m index 08ee18d50..605a4d4fc 100644 --- a/thirdparty/SDL/src/video/cocoa/SDL_cocoakeyboard.m +++ b/thirdparty/SDL/src/video/cocoa/SDL_cocoakeyboard.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_COCOA +#ifdef SDL_VIDEO_DRIVER_COCOA #include "SDL_cocoavideo.h" @@ -437,9 +437,19 @@ void Cocoa_HandleKeyEvent(_THIS, NSEvent *event) case NSEventTypeKeyUp: SDL_SendKeyboardKey(SDL_RELEASED, code); break; - case NSEventTypeFlagsChanged: - HandleModifiers(_this, code, (unsigned int)[event modifierFlags]); + case NSEventTypeFlagsChanged: { + // see if the new modifierFlags mean any existing keys should be pressed/released... + const unsigned int modflags = (unsigned int)[event modifierFlags]; + HandleModifiers(_this, SDL_SCANCODE_LSHIFT, modflags); + HandleModifiers(_this, SDL_SCANCODE_LCTRL, modflags); + HandleModifiers(_this, SDL_SCANCODE_LALT, modflags); + HandleModifiers(_this, SDL_SCANCODE_LGUI, modflags); + HandleModifiers(_this, SDL_SCANCODE_RSHIFT, modflags); + HandleModifiers(_this, SDL_SCANCODE_RCTRL, modflags); + HandleModifiers(_this, SDL_SCANCODE_RALT, modflags); + HandleModifiers(_this, SDL_SCANCODE_RGUI, modflags); break; + } default: /* just to avoid compiler warnings */ break; } @@ -460,7 +470,7 @@ void Cocoa_QuitKeyboard(_THIS) void Cocoa_SetWindowKeyboardGrab(_THIS, SDL_Window * window, SDL_bool grabbed) { -#if SDL_MAC_NO_SANDBOX +#ifdef SDL_MAC_NO_SANDBOX CGSSetGlobalHotKeyOperatingMode(_CGSDefaultConnection(), grabbed ? CGSGlobalHotKeyDisable : CGSGlobalHotKeyEnable); #endif } diff --git a/thirdparty/SDL/src/video/cocoa/SDL_cocoamessagebox.h b/thirdparty/SDL/src/video/cocoa/SDL_cocoamessagebox.h index 2893cd2dc..765ffe717 100644 --- a/thirdparty/SDL/src/video/cocoa/SDL_cocoamessagebox.h +++ b/thirdparty/SDL/src/video/cocoa/SDL_cocoamessagebox.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_COCOA +#ifdef SDL_VIDEO_DRIVER_COCOA extern int Cocoa_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid); diff --git a/thirdparty/SDL/src/video/cocoa/SDL_cocoamessagebox.m b/thirdparty/SDL/src/video/cocoa/SDL_cocoamessagebox.m index a8f29a9b8..4e342c1d5 100644 --- a/thirdparty/SDL/src/video/cocoa/SDL_cocoamessagebox.m +++ b/thirdparty/SDL/src/video/cocoa/SDL_cocoamessagebox.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_COCOA +#ifdef SDL_VIDEO_DRIVER_COCOA #include "SDL_events.h" #include "SDL_timer.h" diff --git a/thirdparty/SDL/src/video/cocoa/SDL_cocoametalview.h b/thirdparty/SDL/src/video/cocoa/SDL_cocoametalview.h index 22571eb91..d4a537400 100644 --- a/thirdparty/SDL/src/video/cocoa/SDL_cocoametalview.h +++ b/thirdparty/SDL/src/video/cocoa/SDL_cocoametalview.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -29,7 +29,7 @@ #ifndef SDL_cocoametalview_h_ #define SDL_cocoametalview_h_ -#if SDL_VIDEO_DRIVER_COCOA && (SDL_VIDEO_VULKAN || SDL_VIDEO_METAL) +#if defined(SDL_VIDEO_DRIVER_COCOA) && (defined(SDL_VIDEO_VULKAN) || defined(SDL_VIDEO_METAL)) #import "../SDL_sysvideo.h" diff --git a/thirdparty/SDL/src/video/cocoa/SDL_cocoametalview.m b/thirdparty/SDL/src/video/cocoa/SDL_cocoametalview.m index fab4652e7..d71f6511d 100644 --- a/thirdparty/SDL/src/video/cocoa/SDL_cocoametalview.m +++ b/thirdparty/SDL/src/video/cocoa/SDL_cocoametalview.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -28,7 +28,7 @@ #import "SDL_cocoametalview.h" -#if SDL_VIDEO_DRIVER_COCOA && (SDL_VIDEO_VULKAN || SDL_VIDEO_METAL) +#if defined(SDL_VIDEO_DRIVER_COCOA) && (defined(SDL_VIDEO_VULKAN) || defined(SDL_VIDEO_METAL)) #include "SDL_events.h" #include "SDL_syswm.h" diff --git a/thirdparty/SDL/src/video/cocoa/SDL_cocoamodes.h b/thirdparty/SDL/src/video/cocoa/SDL_cocoamodes.h index 02b636357..426036e8c 100644 --- a/thirdparty/SDL/src/video/cocoa/SDL_cocoamodes.h +++ b/thirdparty/SDL/src/video/cocoa/SDL_cocoamodes.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/cocoa/SDL_cocoamodes.m b/thirdparty/SDL/src/video/cocoa/SDL_cocoamodes.m index 0517302af..d1ef99e9c 100644 --- a/thirdparty/SDL/src/video/cocoa/SDL_cocoamodes.m +++ b/thirdparty/SDL/src/video/cocoa/SDL_cocoamodes.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_COCOA +#ifdef SDL_VIDEO_DRIVER_COCOA #include "SDL_cocoavideo.h" diff --git a/thirdparty/SDL/src/video/cocoa/SDL_cocoamouse.h b/thirdparty/SDL/src/video/cocoa/SDL_cocoamouse.h index b85ce1cdd..0d5f5db2a 100644 --- a/thirdparty/SDL/src/video/cocoa/SDL_cocoamouse.h +++ b/thirdparty/SDL/src/video/cocoa/SDL_cocoamouse.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/cocoa/SDL_cocoamouse.m b/thirdparty/SDL/src/video/cocoa/SDL_cocoamouse.m index e85e16c9f..c14f9abdc 100644 --- a/thirdparty/SDL/src/video/cocoa/SDL_cocoamouse.m +++ b/thirdparty/SDL/src/video/cocoa/SDL_cocoamouse.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_COCOA +#ifdef SDL_VIDEO_DRIVER_COCOA #include "SDL_events.h" #include "SDL_cocoamouse.h" diff --git a/thirdparty/SDL/src/video/cocoa/SDL_cocoaopengl.h b/thirdparty/SDL/src/video/cocoa/SDL_cocoaopengl.h index 0bd549fc9..26462bb76 100644 --- a/thirdparty/SDL/src/video/cocoa/SDL_cocoaopengl.h +++ b/thirdparty/SDL/src/video/cocoa/SDL_cocoaopengl.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -23,7 +23,7 @@ #ifndef SDL_cocoaopengl_h_ #define SDL_cocoaopengl_h_ -#if SDL_VIDEO_OPENGL_CGL +#ifdef SDL_VIDEO_OPENGL_CGL #include "SDL_atomic.h" #import diff --git a/thirdparty/SDL/src/video/cocoa/SDL_cocoaopengl.m b/thirdparty/SDL/src/video/cocoa/SDL_cocoaopengl.m index 0ac8e3e24..bda93159d 100644 --- a/thirdparty/SDL/src/video/cocoa/SDL_cocoaopengl.m +++ b/thirdparty/SDL/src/video/cocoa/SDL_cocoaopengl.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -22,7 +22,7 @@ /* NSOpenGL implementation of SDL OpenGL support */ -#if SDL_VIDEO_OPENGL_CGL +#ifdef SDL_VIDEO_OPENGL_CGL #include "SDL_cocoavideo.h" #include "SDL_cocoaopengl.h" #include "SDL_cocoaopengles.h" @@ -270,7 +270,7 @@ SDL_GLContext Cocoa_GL_CreateContext(_THIS, SDL_Window * window) int interval; if (_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES) { -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL /* Switch to EGL based functions */ Cocoa_GL_UnloadLibrary(_this); _this->GL_LoadLibrary = Cocoa_GLES_LoadLibrary; diff --git a/thirdparty/SDL/src/video/cocoa/SDL_cocoaopengles.h b/thirdparty/SDL/src/video/cocoa/SDL_cocoaopengles.h index 123076215..0729b6be0 100644 --- a/thirdparty/SDL/src/video/cocoa/SDL_cocoaopengles.h +++ b/thirdparty/SDL/src/video/cocoa/SDL_cocoaopengles.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -23,7 +23,7 @@ #ifndef SDL_cocoaopengles_h_ #define SDL_cocoaopengles_h_ -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL #include "../SDL_sysvideo.h" #include "../SDL_egl_c.h" diff --git a/thirdparty/SDL/src/video/cocoa/SDL_cocoaopengles.m b/thirdparty/SDL/src/video/cocoa/SDL_cocoaopengles.m index 17f0b4cb7..abb2014c9 100644 --- a/thirdparty/SDL/src/video/cocoa/SDL_cocoaopengles.m +++ b/thirdparty/SDL/src/video/cocoa/SDL_cocoaopengles.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_COCOA && SDL_VIDEO_OPENGL_EGL +#if defined(SDL_VIDEO_DRIVER_COCOA) && defined(SDL_VIDEO_OPENGL_EGL) #include "SDL_cocoavideo.h" #include "SDL_cocoaopengles.h" @@ -32,7 +32,7 @@ int Cocoa_GLES_LoadLibrary(_THIS, const char *path) { /* If the profile requested is not GL ES, switch over to WIN_GL functions */ if (_this->gl_config.profile_mask != SDL_GL_CONTEXT_PROFILE_ES) { -#if SDL_VIDEO_OPENGL_CGL +#ifdef SDL_VIDEO_OPENGL_CGL Cocoa_GLES_UnloadLibrary(_this); _this->GL_LoadLibrary = Cocoa_GL_LoadLibrary; _this->GL_GetProcAddress = Cocoa_GL_GetProcAddress; @@ -62,7 +62,7 @@ SDL_GLContext Cocoa_GLES_CreateContext(_THIS, SDL_Window * window) SDL_GLContext context; SDL_WindowData *data = (__bridge SDL_WindowData *)window->driverdata; -#if SDL_VIDEO_OPENGL_CGL +#ifdef SDL_VIDEO_OPENGL_CGL if (_this->gl_config.profile_mask != SDL_GL_CONTEXT_PROFILE_ES) { /* Switch to CGL based functions */ Cocoa_GLES_UnloadLibrary(_this); diff --git a/thirdparty/SDL/src/video/cocoa/SDL_cocoashape.h b/thirdparty/SDL/src/video/cocoa/SDL_cocoashape.h index 9f29ff973..f37c2d4e1 100644 --- a/thirdparty/SDL/src/video/cocoa/SDL_cocoashape.h +++ b/thirdparty/SDL/src/video/cocoa/SDL_cocoashape.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/cocoa/SDL_cocoashape.m b/thirdparty/SDL/src/video/cocoa/SDL_cocoashape.m index 2fd9f5946..11642ded0 100644 --- a/thirdparty/SDL/src/video/cocoa/SDL_cocoashape.m +++ b/thirdparty/SDL/src/video/cocoa/SDL_cocoashape.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_COCOA +#ifdef SDL_VIDEO_DRIVER_COCOA #include "SDL_cocoavideo.h" #include "SDL_shape.h" diff --git a/thirdparty/SDL/src/video/cocoa/SDL_cocoavideo.h b/thirdparty/SDL/src/video/cocoa/SDL_cocoavideo.h index 246ad045f..0082171d9 100644 --- a/thirdparty/SDL/src/video/cocoa/SDL_cocoavideo.h +++ b/thirdparty/SDL/src/video/cocoa/SDL_cocoavideo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/cocoa/SDL_cocoavideo.m b/thirdparty/SDL/src/video/cocoa/SDL_cocoavideo.m index a626b1b40..156af8915 100644 --- a/thirdparty/SDL/src/video/cocoa/SDL_cocoavideo.m +++ b/thirdparty/SDL/src/video/cocoa/SDL_cocoavideo.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_COCOA +#ifdef SDL_VIDEO_DRIVER_COCOA #if !__has_feature(objc_arc) #error SDL must be built with Objective-C ARC (automatic reference counting) enabled @@ -33,6 +33,7 @@ #include "SDL_cocoavulkan.h" #include "SDL_cocoametalview.h" #include "SDL_cocoaopengles.h" +#include "SDL_cocoamessagebox.h" @implementation SDL_VideoData @@ -127,7 +128,7 @@ static void Cocoa_DeleteDevice(SDL_VideoDevice * device) device->shape_driver.SetWindowShape = Cocoa_SetWindowShape; device->shape_driver.ResizeWindowShape = Cocoa_ResizeWindowShape; -#if SDL_VIDEO_OPENGL_CGL +#ifdef SDL_VIDEO_OPENGL_CGL device->GL_LoadLibrary = Cocoa_GL_LoadLibrary; device->GL_GetProcAddress = Cocoa_GL_GetProcAddress; device->GL_UnloadLibrary = Cocoa_GL_UnloadLibrary; @@ -137,7 +138,7 @@ static void Cocoa_DeleteDevice(SDL_VideoDevice * device) device->GL_GetSwapInterval = Cocoa_GL_GetSwapInterval; device->GL_SwapWindow = Cocoa_GL_SwapWindow; device->GL_DeleteContext = Cocoa_GL_DeleteContext; -#elif SDL_VIDEO_OPENGL_EGL +#elif defined(SDL_VIDEO_OPENGL_EGL) device->GL_LoadLibrary = Cocoa_GLES_LoadLibrary; device->GL_GetProcAddress = Cocoa_GLES_GetProcAddress; device->GL_UnloadLibrary = Cocoa_GLES_UnloadLibrary; @@ -149,7 +150,7 @@ static void Cocoa_DeleteDevice(SDL_VideoDevice * device) device->GL_DeleteContext = Cocoa_GLES_DeleteContext; #endif -#if SDL_VIDEO_VULKAN +#ifdef SDL_VIDEO_VULKAN device->Vulkan_LoadLibrary = Cocoa_Vulkan_LoadLibrary; device->Vulkan_UnloadLibrary = Cocoa_Vulkan_UnloadLibrary; device->Vulkan_GetInstanceExtensions = Cocoa_Vulkan_GetInstanceExtensions; @@ -157,7 +158,7 @@ static void Cocoa_DeleteDevice(SDL_VideoDevice * device) device->Vulkan_GetDrawableSize = Cocoa_Vulkan_GetDrawableSize; #endif -#if SDL_VIDEO_METAL +#ifdef SDL_VIDEO_METAL device->Metal_CreateView = Cocoa_Metal_CreateView; device->Metal_DestroyView = Cocoa_Metal_DestroyView; device->Metal_GetLayer = Cocoa_Metal_GetLayer; @@ -179,7 +180,8 @@ static void Cocoa_DeleteDevice(SDL_VideoDevice * device) VideoBootStrap COCOA_bootstrap = { "cocoa", "SDL Cocoa video driver", - Cocoa_CreateDevice + Cocoa_CreateDevice, + Cocoa_ShowMessageBox }; diff --git a/thirdparty/SDL/src/video/cocoa/SDL_cocoavulkan.h b/thirdparty/SDL/src/video/cocoa/SDL_cocoavulkan.h index 85fc1f3c5..fc90ee168 100644 --- a/thirdparty/SDL/src/video/cocoa/SDL_cocoavulkan.h +++ b/thirdparty/SDL/src/video/cocoa/SDL_cocoavulkan.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -33,7 +33,7 @@ #include "../SDL_vulkan_internal.h" #include "../SDL_sysvideo.h" -#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_COCOA +#if defined(SDL_VIDEO_VULKAN) && defined(SDL_VIDEO_DRIVER_COCOA) int Cocoa_Vulkan_LoadLibrary(_THIS, const char *path); void Cocoa_Vulkan_UnloadLibrary(_THIS); diff --git a/thirdparty/SDL/src/video/cocoa/SDL_cocoavulkan.m b/thirdparty/SDL/src/video/cocoa/SDL_cocoavulkan.m index 7481326f0..d1ea16fef 100644 --- a/thirdparty/SDL/src/video/cocoa/SDL_cocoavulkan.m +++ b/thirdparty/SDL/src/video/cocoa/SDL_cocoavulkan.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,7 +25,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_COCOA +#if defined(SDL_VIDEO_VULKAN) && defined(SDL_VIDEO_DRIVER_COCOA) #include "SDL_cocoavideo.h" #include "SDL_cocoawindow.h" diff --git a/thirdparty/SDL/src/video/cocoa/SDL_cocoawindow.h b/thirdparty/SDL/src/video/cocoa/SDL_cocoawindow.h index 7ed00fe63..0cf9e9a6e 100644 --- a/thirdparty/SDL/src/video/cocoa/SDL_cocoawindow.h +++ b/thirdparty/SDL/src/video/cocoa/SDL_cocoawindow.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,7 +25,7 @@ #import -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL #include "../SDL_egl_c.h" #endif @@ -132,7 +132,7 @@ typedef enum @property (nonatomic) NSInteger flash_request; @property (nonatomic) Cocoa_WindowListener *listener; @property (nonatomic) SDL_VideoData *videodata; -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL @property (nonatomic) EGLSurface egl_surface; #endif @end diff --git a/thirdparty/SDL/src/video/cocoa/SDL_cocoawindow.m b/thirdparty/SDL/src/video/cocoa/SDL_cocoawindow.m index f586bdb61..8e22a0c17 100644 --- a/thirdparty/SDL/src/video/cocoa/SDL_cocoawindow.m +++ b/thirdparty/SDL/src/video/cocoa/SDL_cocoawindow.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_COCOA +#ifdef SDL_VIDEO_DRIVER_COCOA #if MAC_OS_X_VERSION_MAX_ALLOWED < 1070 # error SDL for Mac OS X must be built with a 10.7 SDK or above. @@ -260,7 +260,7 @@ static void ConvertNSRect(NSScreen *screen, BOOL fullscreen, NSRect *r) static void ScheduleContextUpdates(SDL_WindowData *data) { /* We still support OpenGL as long as Apple offers it, deprecated or not, so disable deprecation warnings about it. */ - #if SDL_VIDEO_OPENGL + #ifdef SDL_VIDEO_OPENGL #ifdef __clang__ #pragma clang diagnostic push @@ -460,6 +460,17 @@ static void Cocoa_UpdateClipCursor(SDL_Window * window) } } +static NSCursor *Cocoa_GetDesiredCursor(void) +{ + SDL_Mouse *mouse = SDL_GetMouse(); + + if (mouse->cursor_shown && mouse->cur_cursor && !mouse->relative_mode) { + return (__bridge NSCursor *)mouse->cur_cursor->driverdata; + } + + return [NSCursor invisibleCursor]; +} + @implementation Cocoa_WindowListener @@ -922,11 +933,13 @@ - (void)windowDidChangeScreenProfile:(NSNotification *)aNotification - (void)windowDidChangeScreen:(NSNotification *)aNotification { /*printf("WINDOWDIDCHANGESCREEN\n");*/ +#ifdef SDL_VIDEO_OPENGL if (_data && _data.nscontexts) { for (SDLOpenGLContext *context in _data.nscontexts) { [context movedToNewScreen]; } } +#endif /* SDL_VIDEO_OPENGL */ } - (void)windowWillEnterFullScreen:(NSNotification *)aNotification @@ -1323,6 +1336,7 @@ - (void)mouseMoved:(NSEvent *)theEvent NSPoint point; int x, y; SDL_Window *window; + NSView *contentView; if (!mouse) { return; @@ -1330,6 +1344,17 @@ - (void)mouseMoved:(NSEvent *)theEvent mouseID = mouse->mouseID; window = _data.window; + contentView = _data.sdlContentView; + point = [theEvent locationInWindow]; + + if ([contentView mouse:[contentView convertPoint:point fromView:nil] inRect:[contentView bounds]] && + [NSCursor currentCursor] != Cocoa_GetDesiredCursor()) { + // The wrong cursor is on screen, fix it. This fixes an macOS bug that is only known to + // occur in fullscreen windows on the built-in displays of newer MacBooks with camera + // notches. When the mouse is moved near the top of such a window (within about 44 units) + // and then moved back down, the cursor rects aren't respected. + [_data.nswindow invalidateCursorRectsForView:contentView]; + } if ([self processHitTest:theEvent]) { SDL_SendWindowEvent(window, SDL_WINDOWEVENT_HIT_TEST, 0, 0); @@ -1340,7 +1365,6 @@ - (void)mouseMoved:(NSEvent *)theEvent return; } - point = [theEvent locationInWindow]; x = (int)point.x; y = (int)(window->h - point.y); @@ -1590,17 +1614,9 @@ - (BOOL)mouseDownCanMoveWindow - (void)resetCursorRects { - SDL_Mouse *mouse; [super resetCursorRects]; - mouse = SDL_GetMouse(); - - if (mouse->cursor_shown && mouse->cur_cursor && !mouse->relative_mode) { - [self addCursorRect:[self bounds] - cursor:(__bridge NSCursor *)mouse->cur_cursor->driverdata]; - } else { - [self addCursorRect:[self bounds] - cursor:[NSCursor invisibleCursor]]; - } + [self addCursorRect:[self bounds] + cursor:Cocoa_GetDesiredCursor()]; } - (BOOL)acceptsFirstMouse:(NSEvent *)theEvent @@ -1788,8 +1804,8 @@ int Cocoa_CreateWindow(_THIS, SDL_Window * window) #pragma clang diagnostic pop #endif -#if SDL_VIDEO_OPENGL_ES2 -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_ES2 +#ifdef SDL_VIDEO_OPENGL_EGL if ((window->flags & SDL_WINDOW_OPENGL) && _this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES) { [contentView setWantsLayer:TRUE]; @@ -1807,9 +1823,9 @@ int Cocoa_CreateWindow(_THIS, SDL_Window * window) } /* The rest of this macro mess is for OpenGL or OpenGL ES windows */ -#if SDL_VIDEO_OPENGL_ES2 +#ifdef SDL_VIDEO_OPENGL_ES2 if (_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES) { -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL if (Cocoa_GLES_SetupWindow(_this, window) < 0) { Cocoa_DestroyWindow(_this, window); return -1; @@ -2332,7 +2348,10 @@ void Cocoa_DestroyWindow(_THIS, SDL_Window * window) SDL_WindowData *data = (SDL_WindowData *) CFBridgingRelease(window->driverdata); if (data) { +#ifdef SDL_VIDEO_OPENGL NSArray *contexts; +#endif + if ([data.listener isInFullscreenSpace]) { [NSMenu setMenuBarVisible:YES]; } @@ -2344,15 +2363,13 @@ void Cocoa_DestroyWindow(_THIS, SDL_Window * window) [data.nswindow close]; } - #if SDL_VIDEO_OPENGL - +#ifdef SDL_VIDEO_OPENGL contexts = [data.nscontexts copy]; for (SDLOpenGLContext *context in contexts) { /* Calling setWindow:NULL causes the context to remove itself from the context list. */ [context setWindow:NULL]; } - - #endif /* SDL_VIDEO_OPENGL */ +#endif /* SDL_VIDEO_OPENGL */ if (window->shaper) { CFBridgingRelease(window->shaper->driverdata); diff --git a/thirdparty/SDL/src/video/directfb/SDL_DirectFB_WM.c b/thirdparty/SDL/src/video/directfb/SDL_DirectFB_WM.c index f185cac33..d32ab5db8 100644 --- a/thirdparty/SDL/src/video/directfb/SDL_DirectFB_WM.c +++ b/thirdparty/SDL/src/video/directfb/SDL_DirectFB_WM.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_DIRECTFB +#ifdef SDL_VIDEO_DRIVER_DIRECTFB #include "SDL_DirectFB_video.h" #include "SDL_DirectFB_window.h" @@ -79,13 +79,13 @@ static void LoadFont(_THIS, SDL_Window * window) SDL_DFB_DEVICEDATA(_this); SDL_DFB_WINDOWDATA(window); - if (windata->font != NULL) { + if (windata->font) { SDL_DFB_RELEASE(windata->font); windata->font = NULL; SDL_DFB_CHECK(windata->window_surface->SetFont(windata->window_surface, windata->font)); } - if (windata->theme.font != NULL) + if (windata->theme.font) { DFBFontDescription fdesc; @@ -317,7 +317,7 @@ int DirectFB_WM_ProcessEvent(_THIS, SDL_Window * window, DFBWindowEvent * evt) SDL_FALLTHROUGH; default: windata->wm_grab = pos; - if (grabbed_window != NULL) + if (grabbed_window) DirectFB_SetWindowMouseGrab(_this, grabbed_window, SDL_FALSE); DirectFB_SetWindowMouseGrab(_this, window, SDL_TRUE); windata->wm_lastx = evt->cx; @@ -350,7 +350,7 @@ int DirectFB_WM_ProcessEvent(_THIS, SDL_Window * window, DFBWindowEvent * evt) } } DirectFB_SetWindowMouseGrab(_this, window, SDL_FALSE); - if (grabbed_window != NULL) + if (grabbed_window) DirectFB_SetWindowMouseGrab(_this, grabbed_window, SDL_TRUE); windata->wm_grab = WM_POS_NONE; return 1; diff --git a/thirdparty/SDL/src/video/directfb/SDL_DirectFB_WM.h b/thirdparty/SDL/src/video/directfb/SDL_DirectFB_WM.h index f8201ba2f..d373ee6a0 100644 --- a/thirdparty/SDL/src/video/directfb/SDL_DirectFB_WM.h +++ b/thirdparty/SDL/src/video/directfb/SDL_DirectFB_WM.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/directfb/SDL_DirectFB_dyn.c b/thirdparty/SDL/src/video/directfb/SDL_DirectFB_dyn.c index 02ed371a9..b4c734aaa 100644 --- a/thirdparty/SDL/src/video/directfb/SDL_DirectFB_dyn.c +++ b/thirdparty/SDL/src/video/directfb/SDL_DirectFB_dyn.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_DIRECTFB +#ifdef SDL_VIDEO_DRIVER_DIRECTFB #include "SDL_DirectFB_video.h" #include "SDL_DirectFB_dyn.h" @@ -93,7 +93,7 @@ int SDL_DirectFB_LoadLibrary(void) void SDL_DirectFB_UnLoadLibrary(void) { - if (handle != NULL) { + if (handle) { SDL_UnloadObject(handle); handle = NULL; } diff --git a/thirdparty/SDL/src/video/directfb/SDL_DirectFB_dyn.h b/thirdparty/SDL/src/video/directfb/SDL_DirectFB_dyn.h index 5b676b60e..dc08d9875 100644 --- a/thirdparty/SDL/src/video/directfb/SDL_DirectFB_dyn.h +++ b/thirdparty/SDL/src/video/directfb/SDL_DirectFB_dyn.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/directfb/SDL_DirectFB_events.c b/thirdparty/SDL/src/video/directfb/SDL_DirectFB_events.c index 47a8e6206..1b2d654cb 100644 --- a/thirdparty/SDL/src/video/directfb/SDL_DirectFB_events.c +++ b/thirdparty/SDL/src/video/directfb/SDL_DirectFB_events.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_DIRECTFB +#ifdef SDL_VIDEO_DRIVER_DIRECTFB /* Handle the event stream, converting DirectFB input events into SDL events */ @@ -308,7 +308,7 @@ static void ProcessInputEvent(_THIS, DFBInputEvent * ievt) if (!devdata->use_linux_input) { if (ievt->type == DIET_AXISMOTION) { - if ((grabbed_window != NULL) && (ievt->flags & DIEF_AXISREL)) { + if ((grabbed_window) && (ievt->flags & DIEF_AXISREL)) { if (ievt->axis == DIAI_X) SDL_SendMouseMotion_ex(grabbed_window, ievt->device_id, 1, ievt->axisrel, 0, 0); @@ -405,7 +405,7 @@ void DirectFB_PumpEventsWindow(_THIS) DFBInputEvent ievt; SDL_Window *w; - for (w = devdata->firstwin; w != NULL; w = w->next) { + for (w = devdata->firstwin; w; w = w->next) { SDL_DFB_WINDOWDATA(w); DFBWindowEvent evt; diff --git a/thirdparty/SDL/src/video/directfb/SDL_DirectFB_events.h b/thirdparty/SDL/src/video/directfb/SDL_DirectFB_events.h index 232757fd3..65ee229fd 100644 --- a/thirdparty/SDL/src/video/directfb/SDL_DirectFB_events.h +++ b/thirdparty/SDL/src/video/directfb/SDL_DirectFB_events.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/directfb/SDL_DirectFB_modes.c b/thirdparty/SDL/src/video/directfb/SDL_DirectFB_modes.c index 135b0843a..3c69a82f0 100644 --- a/thirdparty/SDL/src/video/directfb/SDL_DirectFB_modes.c +++ b/thirdparty/SDL/src/video/directfb/SDL_DirectFB_modes.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_DIRECTFB +#ifdef SDL_VIDEO_DRIVER_DIRECTFB #include "SDL_DirectFB_video.h" #include "SDL_DirectFB_modes.h" diff --git a/thirdparty/SDL/src/video/directfb/SDL_DirectFB_modes.h b/thirdparty/SDL/src/video/directfb/SDL_DirectFB_modes.h index 4a7114d58..236ea8b23 100644 --- a/thirdparty/SDL/src/video/directfb/SDL_DirectFB_modes.h +++ b/thirdparty/SDL/src/video/directfb/SDL_DirectFB_modes.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/directfb/SDL_DirectFB_mouse.c b/thirdparty/SDL/src/video/directfb/SDL_DirectFB_mouse.c index d0e1f291c..363509e87 100644 --- a/thirdparty/SDL/src/video/directfb/SDL_DirectFB_mouse.c +++ b/thirdparty/SDL/src/video/directfb/SDL_DirectFB_mouse.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_DIRECTFB +#ifdef SDL_VIDEO_DRIVER_DIRECTFB #include "SDL_DirectFB_video.h" diff --git a/thirdparty/SDL/src/video/directfb/SDL_DirectFB_mouse.h b/thirdparty/SDL/src/video/directfb/SDL_DirectFB_mouse.h index 446634dce..6d90970bd 100644 --- a/thirdparty/SDL/src/video/directfb/SDL_DirectFB_mouse.h +++ b/thirdparty/SDL/src/video/directfb/SDL_DirectFB_mouse.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/directfb/SDL_DirectFB_opengl.c b/thirdparty/SDL/src/video/directfb/SDL_DirectFB_opengl.c index 1c146a0e1..338d53a87 100644 --- a/thirdparty/SDL/src/video/directfb/SDL_DirectFB_opengl.c +++ b/thirdparty/SDL/src/video/directfb/SDL_DirectFB_opengl.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,11 +20,11 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_DIRECTFB +#ifdef SDL_VIDEO_DRIVER_DIRECTFB #include "SDL_DirectFB_video.h" -#if SDL_DIRECTFB_OPENGL +#ifdef SDL_DIRECTFB_OPENGL #include "SDL_DirectFB_opengl.h" #include "SDL_DirectFB_window.h" @@ -33,7 +33,7 @@ #include "SDL_loadso.h" #endif -#if SDL_DIRECTFB_OPENGL +#ifdef SDL_DIRECTFB_OPENGL struct SDL_GLDriverData { @@ -113,15 +113,15 @@ int DirectFB_GL_LoadLibrary(_THIS, const char *path) } - if (path == NULL) { + if (!path) { path = SDL_getenv("SDL_OPENGL_LIBRARY"); - if (path == NULL) { + if (!path) { path = "libGL.so.1"; } } handle = GL_LoadObject(path); - if (handle == NULL) { + if (!handle) { SDL_DFB_ERR("Library not found: %s\n", path); /* SDL_LoadObject() will call SDL_SetError() for us. */ return -1; @@ -210,7 +210,7 @@ int DirectFB_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context) } - if (ctx != NULL) { + if (ctx) { SDL_DFB_CHECKERR(ctx->context->Lock(ctx->context)); ctx->is_locked = 1; } @@ -242,7 +242,7 @@ int DirectFB_GL_SwapWindow(_THIS, SDL_Window * window) devdata->glFlush(); #endif - for (p = _this->gl_data->firstgl; p != NULL; p = p->next) + for (p = _this->gl_data->firstgl; p; p = p->next) if (p->sdl_window == window && p->is_locked) { SDL_DFB_CHECKERR(p->context->Unlock(p->context)); @@ -278,7 +278,7 @@ void DirectFB_GL_FreeWindowContexts(_THIS, SDL_Window * window) { DirectFB_GLContext *p; - for (p = _this->gl_data->firstgl; p != NULL; p = p->next) + for (p = _this->gl_data->firstgl; p; p = p->next) if (p->sdl_window == window) { if (p->is_locked) @@ -291,7 +291,7 @@ void DirectFB_GL_ReAllocWindowContexts(_THIS, SDL_Window * window) { DirectFB_GLContext *p; - for (p = _this->gl_data->firstgl; p != NULL; p = p->next) + for (p = _this->gl_data->firstgl; p; p = p->next) if (p->sdl_window == window) { SDL_DFB_WINDOWDATA(window); @@ -306,7 +306,7 @@ void DirectFB_GL_DestroyWindowContexts(_THIS, SDL_Window * window) { DirectFB_GLContext *p; - for (p = _this->gl_data->firstgl; p != NULL; p = p->next) + for (p = _this->gl_data->firstgl; p; p = p->next) if (p->sdl_window == window) DirectFB_GL_DeleteContext(_this, p); } diff --git a/thirdparty/SDL/src/video/directfb/SDL_DirectFB_opengl.h b/thirdparty/SDL/src/video/directfb/SDL_DirectFB_opengl.h index 2436bf419..3700da767 100644 --- a/thirdparty/SDL/src/video/directfb/SDL_DirectFB_opengl.h +++ b/thirdparty/SDL/src/video/directfb/SDL_DirectFB_opengl.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,7 +25,7 @@ #include "SDL_DirectFB_video.h" -#if SDL_DIRECTFB_OPENGL +#ifdef SDL_DIRECTFB_OPENGL #include "SDL_opengl.h" diff --git a/thirdparty/SDL/src/video/directfb/SDL_DirectFB_render.c b/thirdparty/SDL/src/video/directfb/SDL_DirectFB_render.c index 40f0e1a0c..7fe4b81af 100644 --- a/thirdparty/SDL/src/video/directfb/SDL_DirectFB_render.c +++ b/thirdparty/SDL/src/video/directfb/SDL_DirectFB_render.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_DIRECTFB +#ifdef SDL_VIDEO_DRIVER_DIRECTFB #include "SDL_DirectFB_window.h" #include "SDL_DirectFB_modes.h" @@ -561,7 +561,7 @@ static void DirectFB_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * textur } } -static void DirectFB_SetTextureScaleMode() +static void DirectFB_SetTextureScaleMode(void) { } diff --git a/thirdparty/SDL/src/video/directfb/SDL_DirectFB_render.h b/thirdparty/SDL/src/video/directfb/SDL_DirectFB_render.h index 25a65c751..76370396f 100644 --- a/thirdparty/SDL/src/video/directfb/SDL_DirectFB_render.h +++ b/thirdparty/SDL/src/video/directfb/SDL_DirectFB_render.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/directfb/SDL_DirectFB_shape.c b/thirdparty/SDL/src/video/directfb/SDL_DirectFB_shape.c index a6c9aa092..f73860573 100644 --- a/thirdparty/SDL/src/video/directfb/SDL_DirectFB_shape.c +++ b/thirdparty/SDL/src/video/directfb/SDL_DirectFB_shape.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_DIRECTFB +#ifdef SDL_VIDEO_DRIVER_DIRECTFB #include "SDL_DirectFB_video.h" #include "SDL_DirectFB_shape.h" @@ -76,7 +76,7 @@ int DirectFB_ResizeWindowShape(SDL_Window* window) int DirectFB_SetWindowShape(SDL_WindowShaper *shaper,SDL_Surface *shape,SDL_WindowShapeMode *shape_mode) { - if(shaper == NULL || shape == NULL || shaper->driverdata == NULL) + if(!shaper || !shape || !shaper->driverdata) return -1; if(shape->format->Amask == 0 && SDL_SHAPEMODEALPHA(shape_mode->mode)) return -2; diff --git a/thirdparty/SDL/src/video/directfb/SDL_DirectFB_shape.h b/thirdparty/SDL/src/video/directfb/SDL_DirectFB_shape.h index d8a579f4a..a34b57192 100644 --- a/thirdparty/SDL/src/video/directfb/SDL_DirectFB_shape.h +++ b/thirdparty/SDL/src/video/directfb/SDL_DirectFB_shape.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/directfb/SDL_DirectFB_video.c b/thirdparty/SDL/src/video/directfb/SDL_DirectFB_video.c index 529273248..931a70541 100644 --- a/thirdparty/SDL/src/video/directfb/SDL_DirectFB_video.c +++ b/thirdparty/SDL/src/video/directfb/SDL_DirectFB_video.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_DIRECTFB +#ifdef SDL_VIDEO_DRIVER_DIRECTFB /* * #include "SDL_DirectFB_keyboard.h" @@ -65,7 +65,8 @@ static SDL_VideoDevice *DirectFB_CreateDevice(void); VideoBootStrap DirectFB_bootstrap = { "directfb", "DirectFB", - DirectFB_CreateDevice + DirectFB_CreateDevice, + NULL /* no ShowMessageBox implementation */ }; static const DirectFBSurfaceDrawingFlagsNames(drawing_flags); @@ -118,7 +119,7 @@ static SDL_VideoDevice *DirectFB_CreateDevice(void) /* !!! FIXME: implement SetWindowBordered */ -#if SDL_DIRECTFB_OPENGL +#ifdef SDL_DIRECTFB_OPENGL device->GL_LoadLibrary = DirectFB_GL_LoadLibrary; device->GL_GetProcAddress = DirectFB_GL_GetProcAddress; device->GL_MakeCurrent = DirectFB_GL_MakeCurrent; @@ -136,7 +137,7 @@ static SDL_VideoDevice *DirectFB_CreateDevice(void) device->shape_driver.SetWindowShape = DirectFB_SetWindowShape; device->shape_driver.ResizeWindowShape = DirectFB_ResizeWindowShape; -#if SDL_VIDEO_VULKAN +#ifdef SDL_VIDEO_VULKAN device->Vulkan_LoadLibrary = DirectFB_Vulkan_LoadLibrary; device->Vulkan_UnloadLibrary = DirectFB_Vulkan_UnloadLibrary; device->Vulkan_GetInstanceExtensions = DirectFB_Vulkan_GetInstanceExtensions; @@ -262,7 +263,7 @@ static int DirectFB_VideoInit(_THIS) DirectFB_InitModes(_this); -#if SDL_DIRECTFB_OPENGL +#ifdef SDL_DIRECTFB_OPENGL DirectFB_GL_Initialize(_this); #endif @@ -290,7 +291,7 @@ static void DirectFB_VideoQuit(_THIS) SDL_DFB_RELEASE(devdata->events); SDL_DFB_RELEASE(devdata->dfb); -#if SDL_DIRECTFB_OPENGL +#ifdef SDL_DIRECTFB_OPENGL DirectFB_GL_Shutdown(_this); #endif diff --git a/thirdparty/SDL/src/video/directfb/SDL_DirectFB_video.h b/thirdparty/SDL/src/video/directfb/SDL_DirectFB_video.h index 8cd2a5926..958caefe6 100644 --- a/thirdparty/SDL/src/video/directfb/SDL_DirectFB_video.h +++ b/thirdparty/SDL/src/video/directfb/SDL_DirectFB_video.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/directfb/SDL_DirectFB_vulkan.c b/thirdparty/SDL/src/video/directfb/SDL_DirectFB_vulkan.c index c29ec8be9..5dcd0219c 100644 --- a/thirdparty/SDL/src/video/directfb/SDL_DirectFB_vulkan.c +++ b/thirdparty/SDL/src/video/directfb/SDL_DirectFB_vulkan.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,7 +21,7 @@ #include "../../SDL_internal.h" -#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_DIRECTFB +#if defined(SDL_VIDEO_VULKAN) && defined(SDL_VIDEO_DRIVER_DIRECTFB) #include "SDL_DirectFB_window.h" diff --git a/thirdparty/SDL/src/video/directfb/SDL_DirectFB_vulkan.h b/thirdparty/SDL/src/video/directfb/SDL_DirectFB_vulkan.h index 4612c0d07..de042130b 100644 --- a/thirdparty/SDL/src/video/directfb/SDL_DirectFB_vulkan.h +++ b/thirdparty/SDL/src/video/directfb/SDL_DirectFB_vulkan.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -27,7 +27,7 @@ #include "../SDL_vulkan_internal.h" #include "../SDL_sysvideo.h" -#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_DIRECTFB +#if defined(SDL_VIDEO_VULKAN) && defined(SDL_VIDEO_DRIVER_DIRECTFB) int DirectFB_Vulkan_LoadLibrary(_THIS, const char *path); void DirectFB_Vulkan_UnloadLibrary(_THIS); diff --git a/thirdparty/SDL/src/video/directfb/SDL_DirectFB_window.c b/thirdparty/SDL/src/video/directfb/SDL_DirectFB_window.c index 91be03b23..fb9ce7b0b 100644 --- a/thirdparty/SDL/src/video/directfb/SDL_DirectFB_window.c +++ b/thirdparty/SDL/src/video/directfb/SDL_DirectFB_window.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,14 +20,14 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_DIRECTFB +#ifdef SDL_VIDEO_DRIVER_DIRECTFB #include "SDL_DirectFB_video.h" #include "SDL_DirectFB_modes.h" #include "SDL_DirectFB_window.h" #include "SDL_DirectFB_shape.h" -#if SDL_DIRECTFB_OPENGL +#ifdef SDL_DIRECTFB_OPENGL #include "SDL_DirectFB_opengl.h" #endif @@ -402,7 +402,7 @@ void DirectFB_DestroyWindow(_THIS, SDL_Window * window) SDL_DFB_CHECK(windata->dfbwin->UngrabPointer(windata->dfbwin)); SDL_DFB_CHECK(windata->dfbwin->UngrabKeyboard(windata->dfbwin)); -#if SDL_DIRECTFB_OPENGL +#ifdef SDL_DIRECTFB_OPENGL DirectFB_GL_DestroyWindowContexts(_this, window); #endif @@ -495,7 +495,7 @@ void DirectFB_AdjustWindowSurface(SDL_Window * window) } if (adjust) { -#if SDL_DIRECTFB_OPENGL +#ifdef SDL_DIRECTFB_OPENGL DirectFB_GL_FreeWindowContexts(SDL_GetVideoDevice(), window); #endif @@ -524,7 +524,7 @@ void DirectFB_AdjustWindowSurface(SDL_Window * window) #endif DirectFB_WM_RedrawLayout(SDL_GetVideoDevice(), window); -#if SDL_DIRECTFB_OPENGL +#ifdef SDL_DIRECTFB_OPENGL DirectFB_GL_ReAllocWindowContexts(SDL_GetVideoDevice(), window); #endif } diff --git a/thirdparty/SDL/src/video/directfb/SDL_DirectFB_window.h b/thirdparty/SDL/src/video/directfb/SDL_DirectFB_window.h index 5d862faba..f736e1e30 100644 --- a/thirdparty/SDL/src/video/directfb/SDL_DirectFB_window.h +++ b/thirdparty/SDL/src/video/directfb/SDL_DirectFB_window.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/dummy/SDL_nullevents.c b/thirdparty/SDL/src/video/dummy/SDL_nullevents.c index 10712a81a..bbe02e0cb 100644 --- a/thirdparty/SDL/src/video/dummy/SDL_nullevents.c +++ b/thirdparty/SDL/src/video/dummy/SDL_nullevents.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_DUMMY +#ifdef SDL_VIDEO_DRIVER_DUMMY /* Being a null driver, there's no event stream. We just define stubs for most of the API. */ diff --git a/thirdparty/SDL/src/video/dummy/SDL_nullevents_c.h b/thirdparty/SDL/src/video/dummy/SDL_nullevents_c.h index d6a11a595..14021c50f 100644 --- a/thirdparty/SDL/src/video/dummy/SDL_nullevents_c.h +++ b/thirdparty/SDL/src/video/dummy/SDL_nullevents_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/dummy/SDL_nullframebuffer.c b/thirdparty/SDL/src/video/dummy/SDL_nullframebuffer.c index be10dd15c..22a9d278a 100644 --- a/thirdparty/SDL/src/video/dummy/SDL_nullframebuffer.c +++ b/thirdparty/SDL/src/video/dummy/SDL_nullframebuffer.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_DUMMY +#ifdef SDL_VIDEO_DRIVER_DUMMY #include "../SDL_sysvideo.h" #include "SDL_nullframebuffer_c.h" @@ -39,7 +39,7 @@ int SDL_DUMMY_CreateWindowFramebuffer(_THIS, SDL_Window *window, Uint32 *format, /* Create a new one */ SDL_GetWindowSizeInPixels(window, &w, &h); surface = SDL_CreateRGBSurfaceWithFormat(0, w, h, 0, surface_format); - if (surface == NULL) { + if (!surface) { return -1; } @@ -57,7 +57,7 @@ int SDL_DUMMY_UpdateWindowFramebuffer(_THIS, SDL_Window *window, const SDL_Rect SDL_Surface *surface; surface = (SDL_Surface *)SDL_GetWindowData(window, DUMMY_SURFACE); - if (surface == NULL) { + if (!surface) { return SDL_SetError("Couldn't find dummy surface for window"); } diff --git a/thirdparty/SDL/src/video/dummy/SDL_nullframebuffer_c.h b/thirdparty/SDL/src/video/dummy/SDL_nullframebuffer_c.h index 31a9432b0..dea414e07 100644 --- a/thirdparty/SDL/src/video/dummy/SDL_nullframebuffer_c.h +++ b/thirdparty/SDL/src/video/dummy/SDL_nullframebuffer_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/dummy/SDL_nullvideo.c b/thirdparty/SDL/src/video/dummy/SDL_nullvideo.c index 109066d35..6387379eb 100644 --- a/thirdparty/SDL/src/video/dummy/SDL_nullvideo.c +++ b/thirdparty/SDL/src/video/dummy/SDL_nullvideo.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_DUMMY +#ifdef SDL_VIDEO_DRIVER_DUMMY /* Dummy SDL video driver implementation; this is just enough to make an * SDL-based application THINK it's got a working video driver, for @@ -53,10 +53,9 @@ /* Initialization/Query functions */ static int DUMMY_VideoInit(_THIS); -static int DUMMY_SetDisplayMode(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode); static void DUMMY_VideoQuit(_THIS); -#if SDL_INPUT_LINUXEV +#ifdef SDL_INPUT_LINUXEV static int evdev = 0; static void DUMMY_EVDEV_Poll(_THIS); #endif @@ -70,7 +69,7 @@ static int DUMMY_Available(void) if (SDL_strcmp(envr, DUMMYVID_DRIVER_NAME) == 0) { return 1; } -#if SDL_INPUT_LINUXEV +#ifdef SDL_INPUT_LINUXEV if (SDL_strcmp(envr, DUMMYVID_DRIVER_EVDEV_NAME) == 0) { evdev = 1; return 1; @@ -95,7 +94,7 @@ static SDL_VideoDevice *DUMMY_CreateDevice(void) /* Initialize all variables that we clean on shutdown */ device = (SDL_VideoDevice *)SDL_calloc(1, sizeof(SDL_VideoDevice)); - if (device == NULL) { + if (!device) { SDL_OutOfMemory(); return 0; } @@ -104,9 +103,8 @@ static SDL_VideoDevice *DUMMY_CreateDevice(void) /* Set the function pointers */ device->VideoInit = DUMMY_VideoInit; device->VideoQuit = DUMMY_VideoQuit; - device->SetDisplayMode = DUMMY_SetDisplayMode; device->PumpEvents = DUMMY_PumpEvents; -#if SDL_INPUT_LINUXEV +#ifdef SDL_INPUT_LINUXEV if (evdev) { device->PumpEvents = DUMMY_EVDEV_Poll; } @@ -122,16 +120,18 @@ static SDL_VideoDevice *DUMMY_CreateDevice(void) VideoBootStrap DUMMY_bootstrap = { DUMMYVID_DRIVER_NAME, "SDL dummy video driver", - DUMMY_CreateDevice + DUMMY_CreateDevice, + NULL /* no ShowMessageBox implementation */ }; -#if SDL_INPUT_LINUXEV +#ifdef SDL_INPUT_LINUXEV VideoBootStrap DUMMY_evdev_bootstrap = { DUMMYVID_DRIVER_EVDEV_NAME, "SDL dummy video driver with evdev", - DUMMY_CreateDevice + DUMMY_CreateDevice, + NULL /* no ShowMessageBox implementation */ }; void SDL_EVDEV_Init(void); -void SDL_EVDEV_Poll(); +void SDL_EVDEV_Poll(void); void SDL_EVDEV_Quit(void); static void DUMMY_EVDEV_Poll(_THIS) { @@ -149,7 +149,7 @@ int DUMMY_VideoInit(_THIS) mode.format = SDL_PIXELFORMAT_RGB888; mode.w = 1024; mode.h = 768; - mode.refresh_rate = 0; + mode.refresh_rate = 60; mode.driverdata = NULL; if (SDL_AddBasicVideoDisplay(&mode) < 0) { return -1; @@ -157,7 +157,7 @@ int DUMMY_VideoInit(_THIS) SDL_AddDisplayMode(&_this->displays[0], &mode); -#if SDL_INPUT_LINUXEV +#ifdef SDL_INPUT_LINUXEV SDL_EVDEV_Init(); #endif @@ -165,14 +165,9 @@ int DUMMY_VideoInit(_THIS) return 0; } -static int DUMMY_SetDisplayMode(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode) -{ - return 0; -} - void DUMMY_VideoQuit(_THIS) { -#if SDL_INPUT_LINUXEV +#ifdef SDL_INPUT_LINUXEV SDL_EVDEV_Quit(); #endif } diff --git a/thirdparty/SDL/src/video/dummy/SDL_nullvideo.h b/thirdparty/SDL/src/video/dummy/SDL_nullvideo.h index 0b52f9da9..84a18a9b2 100644 --- a/thirdparty/SDL/src/video/dummy/SDL_nullvideo.h +++ b/thirdparty/SDL/src/video/dummy/SDL_nullvideo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/emscripten/SDL_emscriptenevents.c b/thirdparty/SDL/src/video/emscripten/SDL_emscriptenevents.c index e08d06b80..2017a6aee 100644 --- a/thirdparty/SDL/src/video/emscripten/SDL_emscriptenevents.c +++ b/thirdparty/SDL/src/video/emscripten/SDL_emscriptenevents.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -22,7 +22,7 @@ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_EMSCRIPTEN +#ifdef SDL_VIDEO_DRIVER_EMSCRIPTEN #include #include @@ -964,7 +964,7 @@ void Emscripten_RegisterEventHandlers(SDL_WindowData *data) /* Keyboard events are awkward */ keyElement = SDL_GetHint(SDL_HINT_EMSCRIPTEN_KEYBOARD_ELEMENT); - if (keyElement == NULL) { + if (!keyElement) { keyElement = EMSCRIPTEN_EVENT_TARGET_WINDOW; } @@ -1007,7 +1007,7 @@ void Emscripten_UnregisterEventHandlers(SDL_WindowData *data) emscripten_set_pointerlockchange_callback(EMSCRIPTEN_EVENT_TARGET_DOCUMENT, NULL, 0, NULL); target = SDL_GetHint(SDL_HINT_EMSCRIPTEN_KEYBOARD_ELEMENT); - if (target == NULL) { + if (!target) { target = EMSCRIPTEN_EVENT_TARGET_WINDOW; } diff --git a/thirdparty/SDL/src/video/emscripten/SDL_emscriptenevents.h b/thirdparty/SDL/src/video/emscripten/SDL_emscriptenevents.h index b6c4da009..502236ade 100644 --- a/thirdparty/SDL/src/video/emscripten/SDL_emscriptenevents.h +++ b/thirdparty/SDL/src/video/emscripten/SDL_emscriptenevents.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/emscripten/SDL_emscriptenframebuffer.c b/thirdparty/SDL/src/video/emscripten/SDL_emscriptenframebuffer.c index 622619860..6a0e78fd4 100644 --- a/thirdparty/SDL/src/video/emscripten/SDL_emscriptenframebuffer.c +++ b/thirdparty/SDL/src/video/emscripten/SDL_emscriptenframebuffer.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_EMSCRIPTEN +#ifdef SDL_VIDEO_DRIVER_EMSCRIPTEN #include "SDL_emscriptenvideo.h" #include "SDL_emscriptenframebuffer.h" @@ -46,7 +46,7 @@ int Emscripten_CreateWindowFramebuffer(_THIS, SDL_Window *window, Uint32 *format SDL_GetWindowSizeInPixels(window, &w, &h); surface = SDL_CreateRGBSurface(0, w, h, bpp, Rmask, Gmask, Bmask, Amask); - if (surface == NULL) { + if (!surface) { return -1; } @@ -64,7 +64,7 @@ int Emscripten_UpdateWindowFramebuffer(_THIS, SDL_Window *window, const SDL_Rect SDL_WindowData *data = (SDL_WindowData *)window->driverdata; surface = data->surface; - if (surface == NULL) { + if (!surface) { return SDL_SetError("Couldn't find framebuffer surface for window"); } diff --git a/thirdparty/SDL/src/video/emscripten/SDL_emscriptenframebuffer.h b/thirdparty/SDL/src/video/emscripten/SDL_emscriptenframebuffer.h index f23e3acd8..fdf1c35ec 100644 --- a/thirdparty/SDL/src/video/emscripten/SDL_emscriptenframebuffer.h +++ b/thirdparty/SDL/src/video/emscripten/SDL_emscriptenframebuffer.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/emscripten/SDL_emscriptenmouse.c b/thirdparty/SDL/src/video/emscripten/SDL_emscriptenmouse.c index 51829d487..7d4601f42 100644 --- a/thirdparty/SDL/src/video/emscripten/SDL_emscriptenmouse.c +++ b/thirdparty/SDL/src/video/emscripten/SDL_emscriptenmouse.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_EMSCRIPTEN +#ifdef SDL_VIDEO_DRIVER_EMSCRIPTEN #include #include @@ -48,7 +48,7 @@ static SDL_Cursor *Emscripten_CreateCursorFromString(const char *cursor_str, SDL cursor = SDL_calloc(1, sizeof(SDL_Cursor)); if (cursor) { curdata = (Emscripten_CursorData *)SDL_calloc(1, sizeof(*curdata)); - if (curdata == NULL) { + if (!curdata) { SDL_OutOfMemory(); SDL_free(cursor); return NULL; @@ -78,7 +78,7 @@ static SDL_Cursor *Emscripten_CreateCursor(SDL_Surface *surface, int hot_x, int conv_surf = SDL_ConvertSurfaceFormat(surface, SDL_PIXELFORMAT_ABGR8888, 0); - if (conv_surf == NULL) { + if (!conv_surf) { return NULL; } @@ -141,49 +141,7 @@ static SDL_Cursor *Emscripten_CreateCursor(SDL_Surface *surface, int hot_x, int static SDL_Cursor *Emscripten_CreateSystemCursor(SDL_SystemCursor id) { - const char *cursor_name = NULL; - - switch (id) { - case SDL_SYSTEM_CURSOR_ARROW: - cursor_name = "default"; - break; - case SDL_SYSTEM_CURSOR_IBEAM: - cursor_name = "text"; - break; - case SDL_SYSTEM_CURSOR_WAIT: - cursor_name = "wait"; - break; - case SDL_SYSTEM_CURSOR_CROSSHAIR: - cursor_name = "crosshair"; - break; - case SDL_SYSTEM_CURSOR_WAITARROW: - cursor_name = "progress"; - break; - case SDL_SYSTEM_CURSOR_SIZENWSE: - cursor_name = "nwse-resize"; - break; - case SDL_SYSTEM_CURSOR_SIZENESW: - cursor_name = "nesw-resize"; - break; - case SDL_SYSTEM_CURSOR_SIZEWE: - cursor_name = "ew-resize"; - break; - case SDL_SYSTEM_CURSOR_SIZENS: - cursor_name = "ns-resize"; - break; - case SDL_SYSTEM_CURSOR_SIZEALL: - cursor_name = "move"; - break; - case SDL_SYSTEM_CURSOR_NO: - cursor_name = "not-allowed"; - break; - case SDL_SYSTEM_CURSOR_HAND: - cursor_name = "pointer"; - break; - default: - SDL_assert(0); - return NULL; - } + const char *cursor_name = SDL_GetCSSCursorName(id, NULL); return Emscripten_CreateCursorFromString(cursor_name, SDL_FALSE); } @@ -194,7 +152,7 @@ static void Emscripten_FreeCursor(SDL_Cursor *cursor) if (cursor) { curdata = (Emscripten_CursorData *)cursor->driverdata; - if (curdata != NULL) { + if (curdata) { if (curdata->is_custom) { SDL_free((char *)curdata->system_cursor); } @@ -247,7 +205,7 @@ static int Emscripten_SetRelativeMouseMode(SDL_bool enabled) /* TODO: pointer lock isn't actually enabled yet */ if (enabled) { window = SDL_GetMouseFocus(); - if (window == NULL) { + if (!window) { return -1; } @@ -264,7 +222,7 @@ static int Emscripten_SetRelativeMouseMode(SDL_bool enabled) return -1; } -void Emscripten_InitMouse() +void Emscripten_InitMouse(void) { SDL_Mouse *mouse = SDL_GetMouse(); @@ -278,7 +236,7 @@ void Emscripten_InitMouse() SDL_SetDefaultCursor(Emscripten_CreateDefaultCursor()); } -void Emscripten_FiniMouse() +void Emscripten_FiniMouse(void) { } diff --git a/thirdparty/SDL/src/video/emscripten/SDL_emscriptenmouse.h b/thirdparty/SDL/src/video/emscripten/SDL_emscriptenmouse.h index 8b0f65695..10cd24e3b 100644 --- a/thirdparty/SDL/src/video/emscripten/SDL_emscriptenmouse.h +++ b/thirdparty/SDL/src/video/emscripten/SDL_emscriptenmouse.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/emscripten/SDL_emscriptenopengles.c b/thirdparty/SDL/src/video/emscripten/SDL_emscriptenopengles.c index aea127f02..baf9eb7ea 100644 --- a/thirdparty/SDL/src/video/emscripten/SDL_emscriptenopengles.c +++ b/thirdparty/SDL/src/video/emscripten/SDL_emscriptenopengles.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_EMSCRIPTEN && SDL_VIDEO_OPENGL_EGL +#if defined(SDL_VIDEO_DRIVER_EMSCRIPTEN) && defined(SDL_VIDEO_OPENGL_EGL) #include #include diff --git a/thirdparty/SDL/src/video/emscripten/SDL_emscriptenopengles.h b/thirdparty/SDL/src/video/emscripten/SDL_emscriptenopengles.h index 869982df1..184d0f2a4 100644 --- a/thirdparty/SDL/src/video/emscripten/SDL_emscriptenopengles.h +++ b/thirdparty/SDL/src/video/emscripten/SDL_emscriptenopengles.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -23,7 +23,7 @@ #ifndef SDL_emscriptenopengles_h_ #define SDL_emscriptenopengles_h_ -#if SDL_VIDEO_DRIVER_EMSCRIPTEN && SDL_VIDEO_OPENGL_EGL +#if defined(SDL_VIDEO_DRIVER_EMSCRIPTEN) && defined(SDL_VIDEO_OPENGL_EGL) #include "../SDL_sysvideo.h" #include "../SDL_egl_c.h" diff --git a/thirdparty/SDL/src/video/emscripten/SDL_emscriptenvideo.c b/thirdparty/SDL/src/video/emscripten/SDL_emscriptenvideo.c index 8ddf91010..6319f9271 100644 --- a/thirdparty/SDL/src/video/emscripten/SDL_emscriptenvideo.c +++ b/thirdparty/SDL/src/video/emscripten/SDL_emscriptenvideo.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_EMSCRIPTEN +#ifdef SDL_VIDEO_DRIVER_EMSCRIPTEN #include "SDL_video.h" #include "SDL_mouse.h" @@ -66,7 +66,7 @@ static SDL_VideoDevice *Emscripten_CreateDevice(void) /* Initialize all variables that we clean on shutdown */ device = (SDL_VideoDevice *)SDL_calloc(1, sizeof(SDL_VideoDevice)); - if (device == NULL) { + if (!device) { SDL_OutOfMemory(); return 0; } @@ -106,7 +106,7 @@ static SDL_VideoDevice *Emscripten_CreateDevice(void) device->UpdateWindowFramebuffer = Emscripten_UpdateWindowFramebuffer; device->DestroyWindowFramebuffer = Emscripten_DestroyWindowFramebuffer; -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL device->GL_LoadLibrary = Emscripten_GLES_LoadLibrary; device->GL_GetProcAddress = Emscripten_GLES_GetProcAddress; device->GL_UnloadLibrary = Emscripten_GLES_UnloadLibrary; @@ -125,7 +125,8 @@ static SDL_VideoDevice *Emscripten_CreateDevice(void) VideoBootStrap Emscripten_bootstrap = { EMSCRIPTENVID_DRIVER_NAME, "SDL emscripten video driver", - Emscripten_CreateDevice + Emscripten_CreateDevice, + NULL /* no ShowMessageBox implementation */ }; int Emscripten_VideoInit(_THIS) @@ -209,7 +210,7 @@ static int Emscripten_CreateWindow(_THIS, SDL_Window *window) /* Allocate window internal data */ wdata = (SDL_WindowData *)SDL_calloc(1, sizeof(SDL_WindowData)); - if (wdata == NULL) { + if (!wdata) { return SDL_OutOfMemory(); } @@ -247,7 +248,7 @@ static int Emscripten_CreateWindow(_THIS, SDL_Window *window) } } -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL if (window->flags & SDL_WINDOW_OPENGL) { if (!_this->egl_data) { if (SDL_GL_LoadLibrary(NULL) < 0) { @@ -314,7 +315,7 @@ static void Emscripten_DestroyWindow(_THIS, SDL_Window *window) data = (SDL_WindowData *)window->driverdata; Emscripten_UnregisterEventHandlers(data); -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL if (data->egl_surface != EGL_NO_SURFACE) { SDL_EGL_DestroySurface(_this, data->egl_surface); data->egl_surface = EGL_NO_SURFACE; @@ -341,6 +342,7 @@ static void Emscripten_SetWindowFullscreen(_THIS, SDL_Window *window, SDL_VideoD SDL_bool is_desktop_fullscreen = (window->flags & SDL_WINDOW_FULLSCREEN_DESKTOP) == SDL_WINDOW_FULLSCREEN_DESKTOP; int res; + SDL_zero(strategy); strategy.scaleMode = is_desktop_fullscreen ? EMSCRIPTEN_FULLSCREEN_SCALE_STRETCH : EMSCRIPTEN_FULLSCREEN_SCALE_ASPECT; if (!is_desktop_fullscreen) { diff --git a/thirdparty/SDL/src/video/emscripten/SDL_emscriptenvideo.h b/thirdparty/SDL/src/video/emscripten/SDL_emscriptenvideo.h index dd97dcfbb..2cbb6716c 100644 --- a/thirdparty/SDL/src/video/emscripten/SDL_emscriptenvideo.h +++ b/thirdparty/SDL/src/video/emscripten/SDL_emscriptenvideo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -28,13 +28,13 @@ #include #include -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL #include #endif typedef struct SDL_WindowData { -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL EGLSurface egl_surface; #endif SDL_Window *window; diff --git a/thirdparty/SDL/src/video/haiku/SDL_BApp.h b/thirdparty/SDL/src/video/haiku/SDL_BApp.h index 036808167..284445d98 100644 --- a/thirdparty/SDL/src/video/haiku/SDL_BApp.h +++ b/thirdparty/SDL/src/video/haiku/SDL_BApp.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -24,7 +24,7 @@ #include #include #include -#if SDL_VIDEO_OPENGL +#ifdef SDL_VIDEO_OPENGL #include #endif @@ -85,7 +85,7 @@ class SDL_BLooper : public BLooper public: SDL_BLooper(const char* name) : BLooper(name) { -#if SDL_VIDEO_OPENGL +#ifdef SDL_VIDEO_OPENGL _current_context = NULL; #endif } @@ -199,7 +199,7 @@ class SDL_BLooper : public BLooper return _window_map[winID]; } -#if SDL_VIDEO_OPENGL +#ifdef SDL_VIDEO_OPENGL BGLView *GetCurrentContext() { return _current_context; @@ -419,7 +419,7 @@ class SDL_BLooper : public BLooper /* Members */ std::vector _window_map; /* Keeps track of SDL_Windows by index-id */ -#if SDL_VIDEO_OPENGL +#ifdef SDL_VIDEO_OPENGL BGLView *_current_context; #endif }; diff --git a/thirdparty/SDL/src/video/haiku/SDL_BWin.h b/thirdparty/SDL/src/video/haiku/SDL_BWin.h index ed1b96147..f1ad1ea2f 100644 --- a/thirdparty/SDL/src/video/haiku/SDL_BWin.h +++ b/thirdparty/SDL/src/video/haiku/SDL_BWin.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -39,7 +39,7 @@ extern "C" { #include #include #include -#if SDL_VIDEO_OPENGL +#ifdef SDL_VIDEO_OPENGL #include #endif #include "SDL_events.h" @@ -99,7 +99,7 @@ class SDL_BWin : public BWindow _cur_view = NULL; _SDL_View = NULL; -#if SDL_VIDEO_OPENGL +#ifdef SDL_VIDEO_OPENGL _SDL_GLView = NULL; _gl_type = 0; #endif @@ -123,7 +123,7 @@ class SDL_BWin : public BWindow _SDL_View = NULL; } -#if SDL_VIDEO_OPENGL +#ifdef SDL_VIDEO_OPENGL if (_SDL_GLView) { if (SDL_Looper->GetCurrentContext() == _SDL_GLView) SDL_Looper->SetCurrentContext(NULL); @@ -189,7 +189,7 @@ class SDL_BWin : public BWindow } /* * * * * OpenGL functionality * * * * */ -#if SDL_VIDEO_OPENGL +#ifdef SDL_VIDEO_OPENGL BGLView *CreateGLView(Uint32 gl_flags) { Lock(); @@ -476,7 +476,7 @@ class SDL_BWin : public BWindow BBitmap *GetBitmap() { return _bitmap; } BView *GetCurView() { return _cur_view; } SDL_BView *GetView() { return _SDL_View; } -#if SDL_VIDEO_OPENGL +#ifdef SDL_VIDEO_OPENGL BGLView *GetGLView() { return _SDL_GLView; @@ -712,7 +712,7 @@ class SDL_BWin : public BWindow BView *_cur_view; SDL_BView *_SDL_View; -#if SDL_VIDEO_OPENGL +#ifdef SDL_VIDEO_OPENGL BGLView *_SDL_GLView; Uint32 _gl_type; #endif diff --git a/thirdparty/SDL/src/video/haiku/SDL_bclipboard.cc b/thirdparty/SDL/src/video/haiku/SDL_bclipboard.cc index 0fd375321..11e79f336 100644 --- a/thirdparty/SDL/src/video/haiku/SDL_bclipboard.cc +++ b/thirdparty/SDL/src/video/haiku/SDL_bclipboard.cc @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_HAIKU +#ifdef SDL_VIDEO_DRIVER_HAIKU /* BWindow based clipboard implementation */ @@ -65,7 +65,7 @@ char *HAIKU_GetClipboardText(_THIS) { be_clipboard->Unlock(); } - if (text == NULL) { + if (!text) { result = SDL_strdup(""); } else { /* Copy the data and pass on to SDL */ diff --git a/thirdparty/SDL/src/video/haiku/SDL_bclipboard.h b/thirdparty/SDL/src/video/haiku/SDL_bclipboard.h index 5f34f9f4a..89e9e9065 100644 --- a/thirdparty/SDL/src/video/haiku/SDL_bclipboard.h +++ b/thirdparty/SDL/src/video/haiku/SDL_bclipboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/haiku/SDL_bevents.cc b/thirdparty/SDL/src/video/haiku/SDL_bevents.cc index f0b7e2d28..45727a66a 100644 --- a/thirdparty/SDL/src/video/haiku/SDL_bevents.cc +++ b/thirdparty/SDL/src/video/haiku/SDL_bevents.cc @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_HAIKU +#ifdef SDL_VIDEO_DRIVER_HAIKU #include "SDL_bevents.h" diff --git a/thirdparty/SDL/src/video/haiku/SDL_bevents.h b/thirdparty/SDL/src/video/haiku/SDL_bevents.h index 847bc4a86..1afd33ad0 100644 --- a/thirdparty/SDL/src/video/haiku/SDL_bevents.h +++ b/thirdparty/SDL/src/video/haiku/SDL_bevents.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/haiku/SDL_bframebuffer.cc b/thirdparty/SDL/src/video/haiku/SDL_bframebuffer.cc index 2cb4f6497..1961cea3b 100644 --- a/thirdparty/SDL/src/video/haiku/SDL_bframebuffer.cc +++ b/thirdparty/SDL/src/video/haiku/SDL_bframebuffer.cc @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_HAIKU +#ifdef SDL_VIDEO_DRIVER_HAIKU #include "SDL_bframebuffer.h" @@ -94,7 +94,7 @@ int HAIKU_CreateWindowFramebuffer(_THIS, SDL_Window * window, int HAIKU_UpdateWindowFramebuffer(_THIS, SDL_Window * window, const SDL_Rect * rects, int numrects) { - if (window == NULL) { + if (!window) { return 0; } diff --git a/thirdparty/SDL/src/video/haiku/SDL_bframebuffer.h b/thirdparty/SDL/src/video/haiku/SDL_bframebuffer.h index 72d3aab58..ce3649c16 100644 --- a/thirdparty/SDL/src/video/haiku/SDL_bframebuffer.h +++ b/thirdparty/SDL/src/video/haiku/SDL_bframebuffer.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/haiku/SDL_bkeyboard.cc b/thirdparty/SDL/src/video/haiku/SDL_bkeyboard.cc index 84ac3c7d1..b9499edb7 100644 --- a/thirdparty/SDL/src/video/haiku/SDL_bkeyboard.cc +++ b/thirdparty/SDL/src/video/haiku/SDL_bkeyboard.cc @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_HAIKU +#ifdef SDL_VIDEO_DRIVER_HAIKU #include #include diff --git a/thirdparty/SDL/src/video/haiku/SDL_bkeyboard.h b/thirdparty/SDL/src/video/haiku/SDL_bkeyboard.h index f15611e03..46fd9d6b3 100644 --- a/thirdparty/SDL/src/video/haiku/SDL_bkeyboard.h +++ b/thirdparty/SDL/src/video/haiku/SDL_bkeyboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/haiku/SDL_bmessagebox.cc b/thirdparty/SDL/src/video/haiku/SDL_bmessagebox.cc index 60fce0078..d0c43e282 100644 --- a/thirdparty/SDL/src/video/haiku/SDL_bmessagebox.cc +++ b/thirdparty/SDL/src/video/haiku/SDL_bmessagebox.cc @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga Copyright (C) 2018-2019 EXL This software is provided 'as-is', without any express or implied @@ -22,7 +22,7 @@ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_HAIKU +#ifdef SDL_VIDEO_DRIVER_HAIKU #include "SDL_messagebox.h" @@ -356,15 +356,15 @@ int HAIKU_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid // "You need a valid BApplication object before interacting with the app_server." // "2 BApplication objects were created. Only one is allowed." BApplication *application = NULL; - if (be_app == NULL) { + if (!be_app) { application = new(std::nothrow) BApplication(SDL_signature); - if (application == NULL) { + if (!application) { return SDL_SetError("Cannot create the BApplication object. Lack of memory?"); } } HAIKU_SDL_MessageBox *SDL_MessageBox = new(std::nothrow) HAIKU_SDL_MessageBox(messageboxdata); - if (SDL_MessageBox == NULL) { + if (!SDL_MessageBox) { return SDL_SetError("Cannot create the HAIKU_SDL_MessageBox (BAlert inheritor) object. Lack of memory?"); } const int closeButton = SDL_MessageBox->GetCloseButtonId(); @@ -381,7 +381,7 @@ int HAIKU_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid delete messageBox; } */ - if (application != NULL) { + if (application) { delete application; } diff --git a/thirdparty/SDL/src/video/haiku/SDL_bmessagebox.h b/thirdparty/SDL/src/video/haiku/SDL_bmessagebox.h index 9c4243f42..822d7c230 100644 --- a/thirdparty/SDL/src/video/haiku/SDL_bmessagebox.h +++ b/thirdparty/SDL/src/video/haiku/SDL_bmessagebox.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga Copyright (C) 2018-2019 EXL This software is provided 'as-is', without any express or implied @@ -25,7 +25,7 @@ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_HAIKU +#ifdef SDL_VIDEO_DRIVER_HAIKU #ifdef __cplusplus extern "C" { diff --git a/thirdparty/SDL/src/video/haiku/SDL_bmodes.cc b/thirdparty/SDL/src/video/haiku/SDL_bmodes.cc index eb8f15312..6a162f614 100644 --- a/thirdparty/SDL/src/video/haiku/SDL_bmodes.cc +++ b/thirdparty/SDL/src/video/haiku/SDL_bmodes.cc @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,14 +20,14 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_HAIKU +#ifdef SDL_VIDEO_DRIVER_HAIKU #include #include #include "SDL_bmodes.h" #include "SDL_BWin.h" -#if SDL_VIDEO_OPENGL +#ifdef SDL_VIDEO_OPENGL #include "SDL_bopengl.h" #endif @@ -288,7 +288,7 @@ int HAIKU_SetDisplayMode(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode free(bmode_list); /* This should not be SDL_free() */ -#if SDL_VIDEO_OPENGL +#ifdef SDL_VIDEO_OPENGL /* FIXME: Is there some way to reboot the OpenGL context? This doesn't help */ // HAIKU_GL_RebootContexts(_this); diff --git a/thirdparty/SDL/src/video/haiku/SDL_bmodes.h b/thirdparty/SDL/src/video/haiku/SDL_bmodes.h index 6b5f58144..e0d6f04c5 100644 --- a/thirdparty/SDL/src/video/haiku/SDL_bmodes.h +++ b/thirdparty/SDL/src/video/haiku/SDL_bmodes.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/haiku/SDL_bopengl.cc b/thirdparty/SDL/src/video/haiku/SDL_bopengl.cc index 7e12ad6a6..d34d5923b 100644 --- a/thirdparty/SDL/src/video/haiku/SDL_bopengl.cc +++ b/thirdparty/SDL/src/video/haiku/SDL_bopengl.cc @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_HAIKU && SDL_VIDEO_OPENGL +#if defined(SDL_VIDEO_DRIVER_HAIKU) && defined(SDL_VIDEO_OPENGL) #include "SDL_bopengl.h" @@ -65,7 +65,7 @@ int HAIKU_GL_LoadLibrary(_THIS, const char *path) void *HAIKU_GL_GetProcAddress(_THIS, const char *proc) { - if (_this->gl_config.dll_handle != NULL) { + if (_this->gl_config.dll_handle) { void *location = NULL; status_t err; if ((err = @@ -92,8 +92,8 @@ int HAIKU_GL_SwapWindow(_THIS, SDL_Window * window) { int HAIKU_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context) { BGLView* glView = (BGLView*)context; // printf("HAIKU_GL_MakeCurrent(%llx), win = %llx, thread = %d\n", (uint64)context, (uint64)window, find_thread(NULL)); - if (glView != NULL) { - if ((glView->Window() == NULL) || (window == NULL) || (_ToBeWin(window)->GetGLView() != glView)) { + if (glView) { + if ((glView->Window() == NULL) || (!window) || (_ToBeWin(window)->GetGLView() != glView)) { return SDL_SetError("MakeCurrent failed"); } } @@ -146,7 +146,7 @@ void HAIKU_GL_DeleteContext(_THIS, SDL_GLContext context) { // printf("HAIKU_GL_DeleteContext(%llx), thread = %d\n", (uint64)context, find_thread(NULL)); BGLView* glView = (BGLView*)context; SDL_BWin *bwin = (SDL_BWin*)glView->Window(); - if (bwin == NULL) { + if (!bwin) { delete glView; } else { bwin->RemoveGLView(); diff --git a/thirdparty/SDL/src/video/haiku/SDL_bopengl.h b/thirdparty/SDL/src/video/haiku/SDL_bopengl.h index 0085a1e5b..0905b7c96 100644 --- a/thirdparty/SDL/src/video/haiku/SDL_bopengl.h +++ b/thirdparty/SDL/src/video/haiku/SDL_bopengl.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -22,7 +22,7 @@ #ifndef SDL_BOPENGL_H #define SDL_BOPENGL_H -#if SDL_VIDEO_DRIVER_HAIKU && SDL_VIDEO_OPENGL +#if defined(SDL_VIDEO_DRIVER_HAIKU) && defined(SDL_VIDEO_OPENGL) #ifdef __cplusplus extern "C" { diff --git a/thirdparty/SDL/src/video/haiku/SDL_bvideo.cc b/thirdparty/SDL/src/video/haiku/SDL_bvideo.cc index 0f23c4d7b..aac091afc 100644 --- a/thirdparty/SDL/src/video/haiku/SDL_bvideo.cc +++ b/thirdparty/SDL/src/video/haiku/SDL_bvideo.cc @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -22,7 +22,7 @@ #include "../../SDL_internal.h" #include "../../main/haiku/SDL_BApp.h" -#if SDL_VIDEO_DRIVER_HAIKU +#ifdef SDL_VIDEO_DRIVER_HAIKU #include "SDL_BWin.h" #include @@ -39,6 +39,7 @@ extern "C" { #include "SDL_bmodes.h" #include "SDL_bframebuffer.h" #include "SDL_bevents.h" +#include "SDL_bmessagebox.h" static SDL_INLINE SDL_BWin *_ToBeWin(SDL_Window *window) { return (SDL_BWin *)(window->driverdata); @@ -104,7 +105,7 @@ static SDL_VideoDevice * HAIKU_CreateDevice(void) device->shape_driver.SetWindowShape = NULL; device->shape_driver.ResizeWindowShape = NULL; -#if SDL_VIDEO_OPENGL +#ifdef SDL_VIDEO_OPENGL device->GL_LoadLibrary = HAIKU_GL_LoadLibrary; device->GL_GetProcAddress = HAIKU_GL_GetProcAddress; device->GL_UnloadLibrary = HAIKU_GL_UnloadLibrary; @@ -131,7 +132,8 @@ static SDL_VideoDevice * HAIKU_CreateDevice(void) VideoBootStrap HAIKU_bootstrap = { "haiku", "Haiku graphics", - HAIKU_CreateDevice + HAIKU_CreateDevice, + HAIKU_ShowMessageBox }; void HAIKU_DeleteDevice(SDL_VideoDevice * device) @@ -193,7 +195,7 @@ static SDL_Cursor * HAIKU_CreateCursor(SDL_Surface * surface, int hot_x, int hot SDL_Surface *converted; converted = SDL_ConvertSurfaceFormat(surface, SDL_PIXELFORMAT_ARGB8888, 0); - if (converted == NULL) { + if (!converted) { return NULL; } @@ -215,7 +217,7 @@ static int HAIKU_ShowCursor(SDL_Cursor *cursor) { SDL_Mouse *mouse = SDL_GetMouse(); - if (mouse == NULL) { + if (!mouse) { return 0; } @@ -234,7 +236,7 @@ static int HAIKU_ShowCursor(SDL_Cursor *cursor) static int HAIKU_SetRelativeMouseMode(SDL_bool enabled) { SDL_Window *window = SDL_GetMouseFocus(); - if (window == NULL) { + if (!window) { return 0; } @@ -254,7 +256,7 @@ static int HAIKU_SetRelativeMouseMode(SDL_bool enabled) static void HAIKU_MouseInit(_THIS) { SDL_Mouse *mouse = SDL_GetMouse(); - if (mouse == NULL) { + if (!mouse) { return; } mouse->CreateCursor = HAIKU_CreateCursor; @@ -281,7 +283,7 @@ int HAIKU_VideoInit(_THIS) HAIKU_MouseInit(_this); -#if SDL_VIDEO_OPENGL +#ifdef SDL_VIDEO_OPENGL /* testgl application doesn't load library, just tries to load symbols */ /* is it correct? if so we have to load library here */ HAIKU_GL_LoadLibrary(_this, NULL); diff --git a/thirdparty/SDL/src/video/haiku/SDL_bvideo.h b/thirdparty/SDL/src/video/haiku/SDL_bvideo.h index 0c5288f1b..6c420480c 100644 --- a/thirdparty/SDL/src/video/haiku/SDL_bvideo.h +++ b/thirdparty/SDL/src/video/haiku/SDL_bvideo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/haiku/SDL_bwindow.cc b/thirdparty/SDL/src/video/haiku/SDL_bwindow.cc index 18e03d4ae..38863abfc 100644 --- a/thirdparty/SDL/src/video/haiku/SDL_bwindow.cc +++ b/thirdparty/SDL/src/video/haiku/SDL_bwindow.cc @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_HAIKU +#ifdef SDL_VIDEO_DRIVER_HAIKU #include "../SDL_sysvideo.h" #include "SDL_BWin.h" @@ -67,7 +67,7 @@ static int _InitWindow(_THIS, SDL_Window *window) { } SDL_BWin *bwin = new(std::nothrow) SDL_BWin(bounds, look, flags); - if (bwin == NULL) { + if (!bwin) { return -1; } diff --git a/thirdparty/SDL/src/video/haiku/SDL_bwindow.h b/thirdparty/SDL/src/video/haiku/SDL_bwindow.h index 1f82266c7..cf0bdfda1 100644 --- a/thirdparty/SDL/src/video/haiku/SDL_bwindow.h +++ b/thirdparty/SDL/src/video/haiku/SDL_bwindow.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/khronos/EGL/egl.h b/thirdparty/SDL/src/video/khronos/EGL/egl.h index 97d0878cc..c58f552bf 100644 --- a/thirdparty/SDL/src/video/khronos/EGL/egl.h +++ b/thirdparty/SDL/src/video/khronos/EGL/egl.h @@ -14,7 +14,7 @@ extern "C" { ** used to make the header, and the header can be found at ** http://www.khronos.org/registry/egl ** -** Khronos $Git commit SHA1: 6fb1daea15 $ on $Git commit date: 2022-05-25 09:41:13 -0600 $ +** Khronos $Git commit SHA1: f4cc936b88 $ on $Git commit date: 2023-12-16 01:21:49 -0500 $ */ #include @@ -23,7 +23,7 @@ extern "C" { #define EGL_EGL_PROTOTYPES 1 #endif -/* Generated on date 20220525 */ +/* Generated on date 20231215 */ /* Generated C header for: * API: egl diff --git a/thirdparty/SDL/src/video/khronos/EGL/eglext.h b/thirdparty/SDL/src/video/khronos/EGL/eglext.h index d58da70e6..9932ebeec 100644 --- a/thirdparty/SDL/src/video/khronos/EGL/eglext.h +++ b/thirdparty/SDL/src/video/khronos/EGL/eglext.h @@ -14,12 +14,12 @@ extern "C" { ** used to make the header, and the header can be found at ** http://www.khronos.org/registry/egl ** -** Khronos $Git commit SHA1: 6fb1daea15 $ on $Git commit date: 2022-05-25 09:41:13 -0600 $ +** Khronos $Git commit SHA1: f4cc936b88 $ on $Git commit date: 2023-12-16 01:21:49 -0500 $ */ #include -#define EGL_EGLEXT_VERSION 20220525 +#define EGL_EGLEXT_VERSION 20231215 /* Generated C header for: * API: egl @@ -727,6 +727,11 @@ EGLAPI EGLBoolean EGLAPIENTRY eglQueryDeviceBinaryEXT (EGLDeviceEXT device, EGLi #define EGL_EXT_explicit_device 1 #endif /* EGL_EXT_explicit_device */ +#ifndef EGL_EXT_gl_colorspace_bt2020_hlg +#define EGL_EXT_gl_colorspace_bt2020_hlg 1 +#define EGL_GL_COLORSPACE_BT2020_HLG_EXT 0x3540 +#endif /* EGL_EXT_gl_colorspace_bt2020_hlg */ + #ifndef EGL_EXT_gl_colorspace_bt2020_linear #define EGL_EXT_gl_colorspace_bt2020_linear 1 #define EGL_GL_COLORSPACE_BT2020_LINEAR_EXT 0x333F @@ -923,6 +928,10 @@ EGLAPI EGLSurface EGLAPIENTRY eglCreatePlatformPixmapSurfaceEXT (EGLDisplay dpy, #define EGL_EXT_protected_surface 1 #endif /* EGL_EXT_protected_surface */ +#ifndef EGL_EXT_query_reset_notification_strategy +#define EGL_EXT_query_reset_notification_strategy 1 +#endif /* EGL_EXT_query_reset_notification_strategy */ + #ifndef EGL_EXT_stream_consumer_egloutput #define EGL_EXT_stream_consumer_egloutput 1 typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMEROUTPUTEXTPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLOutputLayerEXT layer); @@ -1223,6 +1232,11 @@ EGLAPI EGLBoolean EGLAPIENTRY eglStreamReleaseImageNV (EGLDisplay dpy, EGLStream #endif #endif /* EGL_NV_stream_consumer_eglimage */ +#ifndef EGL_NV_stream_consumer_eglimage_use_scanout_attrib +#define EGL_NV_stream_consumer_eglimage_use_scanout_attrib 1 +#define EGL_STREAM_CONSUMER_IMAGE_USE_SCANOUT_NV 0x3378 +#endif /* EGL_NV_stream_consumer_eglimage_use_scanout_attrib */ + #ifndef EGL_NV_stream_consumer_gltexture_yuv #define EGL_NV_stream_consumer_gltexture_yuv 1 #define EGL_YUV_PLANE0_TEXTURE_UNIT_NV 0x332C @@ -1432,6 +1446,16 @@ EGLAPI EGLuint64NV EGLAPIENTRY eglGetSystemTimeNV (void); #define EGL_TRIPLE_BUFFER_NV 0x3230 #endif /* EGL_NV_triple_buffer */ +#ifndef EGL_QNX_image_native_buffer +#define EGL_QNX_image_native_buffer 1 +#define EGL_NATIVE_BUFFER_QNX 0x3551 +#endif /* EGL_QNX_image_native_buffer */ + +#ifndef EGL_QNX_platform_screen +#define EGL_QNX_platform_screen 1 +#define EGL_PLATFORM_SCREEN_QNX 0x3550 +#endif /* EGL_QNX_platform_screen */ + #ifndef EGL_TIZEN_image_native_buffer #define EGL_TIZEN_image_native_buffer 1 #define EGL_NATIVE_BUFFER_TIZEN 0x32A0 diff --git a/thirdparty/SDL/src/video/khronos/EGL/eglplatform.h b/thirdparty/SDL/src/video/khronos/EGL/eglplatform.h index 99362a23d..6786afd90 100644 --- a/thirdparty/SDL/src/video/khronos/EGL/eglplatform.h +++ b/thirdparty/SDL/src/video/khronos/EGL/eglplatform.h @@ -64,6 +64,12 @@ typedef HDC EGLNativeDisplayType; typedef HBITMAP EGLNativePixmapType; typedef HWND EGLNativeWindowType; +#elif defined(__QNX__) + +typedef khronos_uintptr_t EGLNativeDisplayType; +typedef struct _screen_pixmap* EGLNativePixmapType; /* screen_pixmap_t */ +typedef struct _screen_window* EGLNativeWindowType; /* screen_window_t */ + #elif defined(__EMSCRIPTEN__) typedef int EGLNativeDisplayType; diff --git a/thirdparty/SDL/src/video/khronos/GLES2/gl2.h b/thirdparty/SDL/src/video/khronos/GLES2/gl2.h index af244a70c..6be4e3637 100644 --- a/thirdparty/SDL/src/video/khronos/GLES2/gl2.h +++ b/thirdparty/SDL/src/video/khronos/GLES2/gl2.h @@ -25,7 +25,7 @@ extern "C" { #define GL_GLES_PROTOTYPES 1 #endif -/* Generated on date 20220530 */ +/* Generated on date 20231129 */ /* Generated C header for: * API: gles2 diff --git a/thirdparty/SDL/src/video/khronos/GLES2/gl2ext.h b/thirdparty/SDL/src/video/khronos/GLES2/gl2ext.h index 9448ce09f..63b530b4b 100644 --- a/thirdparty/SDL/src/video/khronos/GLES2/gl2ext.h +++ b/thirdparty/SDL/src/video/khronos/GLES2/gl2ext.h @@ -19,7 +19,7 @@ extern "C" { #define GL_APIENTRYP GL_APIENTRY* #endif -/* Generated on date 20220530 */ +/* Generated on date 20231129 */ /* Generated C header for: * API: gles2 @@ -1052,6 +1052,21 @@ GL_APICALL void GL_APIENTRY glGetSyncivAPPLE (GLsync sync, GLenum pname, GLsizei #define GL_ARM_rgba8 1 #endif /* GL_ARM_rgba8 */ +#ifndef GL_ARM_shader_core_properties +#define GL_ARM_shader_core_properties 1 +#define GL_SHADER_CORE_COUNT_ARM 0x96F0 +#define GL_SHADER_CORE_ACTIVE_COUNT_ARM 0x96F1 +#define GL_SHADER_CORE_PRESENT_MASK_ARM 0x96F2 +#define GL_SHADER_CORE_MAX_WARP_COUNT_ARM 0x96F3 +#define GL_SHADER_CORE_PIXEL_RATE_ARM 0x96F4 +#define GL_SHADER_CORE_TEXEL_RATE_ARM 0x96F5 +#define GL_SHADER_CORE_FMA_RATE_ARM 0x96F6 +typedef void (GL_APIENTRYP PFNGLMAXACTIVESHADERCORESARMPROC) (GLuint count); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glMaxActiveShaderCoresARM (GLuint count); +#endif +#endif /* GL_ARM_shader_core_properties */ + #ifndef GL_ARM_shader_framebuffer_fetch #define GL_ARM_shader_framebuffer_fetch 1 #define GL_FETCH_PER_SAMPLE_ARM 0x8F65 @@ -1459,6 +1474,16 @@ GL_APICALL void GL_APIENTRY glFramebufferShadingRateEXT (GLenum target, GLenum a #endif #endif /* GL_EXT_fragment_shading_rate */ +#ifndef GL_EXT_framebuffer_blit_layers +#define GL_EXT_framebuffer_blit_layers 1 +typedef void (GL_APIENTRYP PFNGLBLITFRAMEBUFFERLAYERSEXTPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); +typedef void (GL_APIENTRYP PFNGLBLITFRAMEBUFFERLAYEREXTPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint srcLayer, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLint dstLayer, GLbitfield mask, GLenum filter); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glBlitFramebufferLayersEXT (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); +GL_APICALL void GL_APIENTRY glBlitFramebufferLayerEXT (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint srcLayer, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLint dstLayer, GLbitfield mask, GLenum filter); +#endif +#endif /* GL_EXT_framebuffer_blit_layers */ + #ifndef GL_EXT_geometry_point_size #define GL_EXT_geometry_point_size 1 #endif /* GL_EXT_geometry_point_size */ @@ -1856,7 +1881,7 @@ GL_APICALL void GL_APIENTRY glImportSemaphoreWin32NameEXT (GLuint semaphore, GLe #define GL_PROGRAM_PIPELINE_BINDING_EXT 0x825A typedef void (GL_APIENTRYP PFNGLACTIVESHADERPROGRAMEXTPROC) (GLuint pipeline, GLuint program); typedef void (GL_APIENTRYP PFNGLBINDPROGRAMPIPELINEEXTPROC) (GLuint pipeline); -typedef GLuint (GL_APIENTRYP PFNGLCREATESHADERPROGRAMVEXTPROC) (GLenum type, GLsizei count, const GLchar **strings); +typedef GLuint (GL_APIENTRYP PFNGLCREATESHADERPROGRAMVEXTPROC) (GLenum type, GLsizei count, const GLchar *const*strings); typedef void (GL_APIENTRYP PFNGLDELETEPROGRAMPIPELINESEXTPROC) (GLsizei n, const GLuint *pipelines); typedef void (GL_APIENTRYP PFNGLGENPROGRAMPIPELINESEXTPROC) (GLsizei n, GLuint *pipelines); typedef void (GL_APIENTRYP PFNGLGETPROGRAMPIPELINEINFOLOGEXTPROC) (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog); @@ -1901,7 +1926,7 @@ typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X3FVEXTPROC) (GLuint progra #ifdef GL_GLEXT_PROTOTYPES GL_APICALL void GL_APIENTRY glActiveShaderProgramEXT (GLuint pipeline, GLuint program); GL_APICALL void GL_APIENTRY glBindProgramPipelineEXT (GLuint pipeline); -GL_APICALL GLuint GL_APIENTRY glCreateShaderProgramvEXT (GLenum type, GLsizei count, const GLchar **strings); +GL_APICALL GLuint GL_APIENTRY glCreateShaderProgramvEXT (GLenum type, GLsizei count, const GLchar *const*strings); GL_APICALL void GL_APIENTRY glDeleteProgramPipelinesEXT (GLsizei n, const GLuint *pipelines); GL_APICALL void GL_APIENTRY glGenProgramPipelinesEXT (GLsizei n, GLuint *pipelines); GL_APICALL void GL_APIENTRY glGetProgramPipelineInfoLogEXT (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog); @@ -2553,6 +2578,33 @@ GL_APICALL void GL_APIENTRY glGetFramebufferParameterivMESA (GLenum target, GLen #define GL_PROGRAM_BINARY_FORMAT_MESA 0x875F #endif /* GL_MESA_program_binary_formats */ +#ifndef GL_MESA_sampler_objects +#define GL_MESA_sampler_objects 1 +#define GL_SAMPLER_BINDING 0x8919 +typedef void (GL_APIENTRYP PFNGLGENSAMPLERSPROC) (GLsizei count, GLuint *samplers); +typedef void (GL_APIENTRYP PFNGLDELETESAMPLERSPROC) (GLsizei count, const GLuint *samplers); +typedef GLboolean (GL_APIENTRYP PFNGLISSAMPLERPROC) (GLuint sampler); +typedef void (GL_APIENTRYP PFNGLBINDSAMPLERPROC) (GLuint unit, GLuint sampler); +typedef void (GL_APIENTRYP PFNGLSAMPLERPARAMETERIPROC) (GLuint sampler, GLenum pname, GLint param); +typedef void (GL_APIENTRYP PFNGLSAMPLERPARAMETERIVPROC) (GLuint sampler, GLenum pname, const GLint *param); +typedef void (GL_APIENTRYP PFNGLSAMPLERPARAMETERFPROC) (GLuint sampler, GLenum pname, GLfloat param); +typedef void (GL_APIENTRYP PFNGLSAMPLERPARAMETERFVPROC) (GLuint sampler, GLenum pname, const GLfloat *param); +typedef void (GL_APIENTRYP PFNGLGETSAMPLERPARAMETERIVPROC) (GLuint sampler, GLenum pname, GLint *params); +typedef void (GL_APIENTRYP PFNGLGETSAMPLERPARAMETERFVPROC) (GLuint sampler, GLenum pname, GLfloat *params); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glGenSamplers (GLsizei count, GLuint *samplers); +GL_APICALL void GL_APIENTRY glDeleteSamplers (GLsizei count, const GLuint *samplers); +GL_APICALL GLboolean GL_APIENTRY glIsSampler (GLuint sampler); +GL_APICALL void GL_APIENTRY glBindSampler (GLuint unit, GLuint sampler); +GL_APICALL void GL_APIENTRY glSamplerParameteri (GLuint sampler, GLenum pname, GLint param); +GL_APICALL void GL_APIENTRY glSamplerParameteriv (GLuint sampler, GLenum pname, const GLint *param); +GL_APICALL void GL_APIENTRY glSamplerParameterf (GLuint sampler, GLenum pname, GLfloat param); +GL_APICALL void GL_APIENTRY glSamplerParameterfv (GLuint sampler, GLenum pname, const GLfloat *param); +GL_APICALL void GL_APIENTRY glGetSamplerParameteriv (GLuint sampler, GLenum pname, GLint *params); +GL_APICALL void GL_APIENTRY glGetSamplerParameterfv (GLuint sampler, GLenum pname, GLfloat *params); +#endif +#endif /* GL_MESA_sampler_objects */ + #ifndef GL_MESA_shader_integer_functions #define GL_MESA_shader_integer_functions 1 #endif /* GL_MESA_shader_integer_functions */ @@ -3186,6 +3238,13 @@ GL_APICALL void GL_APIENTRY glUniformMatrix4x3fvNV (GLint location, GLsizei coun #endif #endif /* GL_NV_non_square_matrices */ +#ifndef GL_NV_pack_subimage +#define GL_NV_pack_subimage 1 +#define GL_PACK_ROW_LENGTH_NV 0x0D02 +#define GL_PACK_SKIP_ROWS_NV 0x0D03 +#define GL_PACK_SKIP_PIXELS_NV 0x0D04 +#endif /* GL_NV_pack_subimage */ + #ifndef GL_NV_path_rendering #define GL_NV_path_rendering 1 typedef double GLdouble; @@ -3917,6 +3976,10 @@ GL_APICALL void GL_APIENTRY glTexEstimateMotionRegionsQCOM (GLuint ref, GLuint t #define GL_PERFMON_GLOBAL_MODE_QCOM 0x8FA0 #endif /* GL_QCOM_perfmon_global_mode */ +#ifndef GL_QCOM_render_sRGB_R8_RG8 +#define GL_QCOM_render_sRGB_R8_RG8 1 +#endif /* GL_QCOM_render_sRGB_R8_RG8 */ + #ifndef GL_QCOM_render_shared_exponent #define GL_QCOM_render_shared_exponent 1 #endif /* GL_QCOM_render_shared_exponent */ @@ -3974,6 +4037,11 @@ GL_APICALL void GL_APIENTRY glTextureFoveationParametersQCOM (GLuint texture, GL #define GL_MAX_SHADER_SUBSAMPLED_IMAGE_UNITS_QCOM 0x8FA1 #endif /* GL_QCOM_texture_foveated_subsampled_layout */ +#ifndef GL_QCOM_texture_lod_bias +#define GL_QCOM_texture_lod_bias 1 +#define GL_TEXTURE_LOD_BIAS_QCOM 0x8C96 +#endif /* GL_QCOM_texture_lod_bias */ + #ifndef GL_QCOM_tiled_rendering #define GL_QCOM_tiled_rendering 1 #define GL_COLOR_BUFFER_BIT0_QCOM 0x00000001 diff --git a/thirdparty/SDL/src/video/khronos/vk_video/vulkan_video_codec_h264std.h b/thirdparty/SDL/src/video/khronos/vk_video/vulkan_video_codec_h264std.h new file mode 100644 index 000000000..6d27af37b --- /dev/null +++ b/thirdparty/SDL/src/video/khronos/vk_video/vulkan_video_codec_h264std.h @@ -0,0 +1,312 @@ +#ifndef VULKAN_VIDEO_CODEC_H264STD_H_ +#define VULKAN_VIDEO_CODEC_H264STD_H_ 1 + +/* +** Copyright 2015-2024 The Khronos Group Inc. +** +** SPDX-License-Identifier: Apache-2.0 +*/ + +/* +** This header is generated from the Khronos Vulkan XML API Registry. +** +*/ + + +#ifdef __cplusplus +extern "C" { +#endif + + + +// vulkan_video_codec_h264std is a preprocessor guard. Do not pass it to API calls. +#define vulkan_video_codec_h264std 1 +#include "vulkan_video_codecs_common.h" +#define STD_VIDEO_H264_CPB_CNT_LIST_SIZE 32 +#define STD_VIDEO_H264_SCALING_LIST_4X4_NUM_LISTS 6 +#define STD_VIDEO_H264_SCALING_LIST_4X4_NUM_ELEMENTS 16 +#define STD_VIDEO_H264_SCALING_LIST_8X8_NUM_LISTS 6 +#define STD_VIDEO_H264_SCALING_LIST_8X8_NUM_ELEMENTS 64 +#define STD_VIDEO_H264_MAX_NUM_LIST_REF 32 +#define STD_VIDEO_H264_MAX_CHROMA_PLANES 2 +#define STD_VIDEO_H264_NO_REFERENCE_PICTURE 0xFF + +typedef enum StdVideoH264ChromaFormatIdc { + STD_VIDEO_H264_CHROMA_FORMAT_IDC_MONOCHROME = 0, + STD_VIDEO_H264_CHROMA_FORMAT_IDC_420 = 1, + STD_VIDEO_H264_CHROMA_FORMAT_IDC_422 = 2, + STD_VIDEO_H264_CHROMA_FORMAT_IDC_444 = 3, + STD_VIDEO_H264_CHROMA_FORMAT_IDC_INVALID = 0x7FFFFFFF, + STD_VIDEO_H264_CHROMA_FORMAT_IDC_MAX_ENUM = 0x7FFFFFFF +} StdVideoH264ChromaFormatIdc; + +typedef enum StdVideoH264ProfileIdc { + STD_VIDEO_H264_PROFILE_IDC_BASELINE = 66, + STD_VIDEO_H264_PROFILE_IDC_MAIN = 77, + STD_VIDEO_H264_PROFILE_IDC_HIGH = 100, + STD_VIDEO_H264_PROFILE_IDC_HIGH_444_PREDICTIVE = 244, + STD_VIDEO_H264_PROFILE_IDC_INVALID = 0x7FFFFFFF, + STD_VIDEO_H264_PROFILE_IDC_MAX_ENUM = 0x7FFFFFFF +} StdVideoH264ProfileIdc; + +typedef enum StdVideoH264LevelIdc { + STD_VIDEO_H264_LEVEL_IDC_1_0 = 0, + STD_VIDEO_H264_LEVEL_IDC_1_1 = 1, + STD_VIDEO_H264_LEVEL_IDC_1_2 = 2, + STD_VIDEO_H264_LEVEL_IDC_1_3 = 3, + STD_VIDEO_H264_LEVEL_IDC_2_0 = 4, + STD_VIDEO_H264_LEVEL_IDC_2_1 = 5, + STD_VIDEO_H264_LEVEL_IDC_2_2 = 6, + STD_VIDEO_H264_LEVEL_IDC_3_0 = 7, + STD_VIDEO_H264_LEVEL_IDC_3_1 = 8, + STD_VIDEO_H264_LEVEL_IDC_3_2 = 9, + STD_VIDEO_H264_LEVEL_IDC_4_0 = 10, + STD_VIDEO_H264_LEVEL_IDC_4_1 = 11, + STD_VIDEO_H264_LEVEL_IDC_4_2 = 12, + STD_VIDEO_H264_LEVEL_IDC_5_0 = 13, + STD_VIDEO_H264_LEVEL_IDC_5_1 = 14, + STD_VIDEO_H264_LEVEL_IDC_5_2 = 15, + STD_VIDEO_H264_LEVEL_IDC_6_0 = 16, + STD_VIDEO_H264_LEVEL_IDC_6_1 = 17, + STD_VIDEO_H264_LEVEL_IDC_6_2 = 18, + STD_VIDEO_H264_LEVEL_IDC_INVALID = 0x7FFFFFFF, + STD_VIDEO_H264_LEVEL_IDC_MAX_ENUM = 0x7FFFFFFF +} StdVideoH264LevelIdc; + +typedef enum StdVideoH264PocType { + STD_VIDEO_H264_POC_TYPE_0 = 0, + STD_VIDEO_H264_POC_TYPE_1 = 1, + STD_VIDEO_H264_POC_TYPE_2 = 2, + STD_VIDEO_H264_POC_TYPE_INVALID = 0x7FFFFFFF, + STD_VIDEO_H264_POC_TYPE_MAX_ENUM = 0x7FFFFFFF +} StdVideoH264PocType; + +typedef enum StdVideoH264AspectRatioIdc { + STD_VIDEO_H264_ASPECT_RATIO_IDC_UNSPECIFIED = 0, + STD_VIDEO_H264_ASPECT_RATIO_IDC_SQUARE = 1, + STD_VIDEO_H264_ASPECT_RATIO_IDC_12_11 = 2, + STD_VIDEO_H264_ASPECT_RATIO_IDC_10_11 = 3, + STD_VIDEO_H264_ASPECT_RATIO_IDC_16_11 = 4, + STD_VIDEO_H264_ASPECT_RATIO_IDC_40_33 = 5, + STD_VIDEO_H264_ASPECT_RATIO_IDC_24_11 = 6, + STD_VIDEO_H264_ASPECT_RATIO_IDC_20_11 = 7, + STD_VIDEO_H264_ASPECT_RATIO_IDC_32_11 = 8, + STD_VIDEO_H264_ASPECT_RATIO_IDC_80_33 = 9, + STD_VIDEO_H264_ASPECT_RATIO_IDC_18_11 = 10, + STD_VIDEO_H264_ASPECT_RATIO_IDC_15_11 = 11, + STD_VIDEO_H264_ASPECT_RATIO_IDC_64_33 = 12, + STD_VIDEO_H264_ASPECT_RATIO_IDC_160_99 = 13, + STD_VIDEO_H264_ASPECT_RATIO_IDC_4_3 = 14, + STD_VIDEO_H264_ASPECT_RATIO_IDC_3_2 = 15, + STD_VIDEO_H264_ASPECT_RATIO_IDC_2_1 = 16, + STD_VIDEO_H264_ASPECT_RATIO_IDC_EXTENDED_SAR = 255, + STD_VIDEO_H264_ASPECT_RATIO_IDC_INVALID = 0x7FFFFFFF, + STD_VIDEO_H264_ASPECT_RATIO_IDC_MAX_ENUM = 0x7FFFFFFF +} StdVideoH264AspectRatioIdc; + +typedef enum StdVideoH264WeightedBipredIdc { + STD_VIDEO_H264_WEIGHTED_BIPRED_IDC_DEFAULT = 0, + STD_VIDEO_H264_WEIGHTED_BIPRED_IDC_EXPLICIT = 1, + STD_VIDEO_H264_WEIGHTED_BIPRED_IDC_IMPLICIT = 2, + STD_VIDEO_H264_WEIGHTED_BIPRED_IDC_INVALID = 0x7FFFFFFF, + STD_VIDEO_H264_WEIGHTED_BIPRED_IDC_MAX_ENUM = 0x7FFFFFFF +} StdVideoH264WeightedBipredIdc; + +typedef enum StdVideoH264ModificationOfPicNumsIdc { + STD_VIDEO_H264_MODIFICATION_OF_PIC_NUMS_IDC_SHORT_TERM_SUBTRACT = 0, + STD_VIDEO_H264_MODIFICATION_OF_PIC_NUMS_IDC_SHORT_TERM_ADD = 1, + STD_VIDEO_H264_MODIFICATION_OF_PIC_NUMS_IDC_LONG_TERM = 2, + STD_VIDEO_H264_MODIFICATION_OF_PIC_NUMS_IDC_END = 3, + STD_VIDEO_H264_MODIFICATION_OF_PIC_NUMS_IDC_INVALID = 0x7FFFFFFF, + STD_VIDEO_H264_MODIFICATION_OF_PIC_NUMS_IDC_MAX_ENUM = 0x7FFFFFFF +} StdVideoH264ModificationOfPicNumsIdc; + +typedef enum StdVideoH264MemMgmtControlOp { + STD_VIDEO_H264_MEM_MGMT_CONTROL_OP_END = 0, + STD_VIDEO_H264_MEM_MGMT_CONTROL_OP_UNMARK_SHORT_TERM = 1, + STD_VIDEO_H264_MEM_MGMT_CONTROL_OP_UNMARK_LONG_TERM = 2, + STD_VIDEO_H264_MEM_MGMT_CONTROL_OP_MARK_LONG_TERM = 3, + STD_VIDEO_H264_MEM_MGMT_CONTROL_OP_SET_MAX_LONG_TERM_INDEX = 4, + STD_VIDEO_H264_MEM_MGMT_CONTROL_OP_UNMARK_ALL = 5, + STD_VIDEO_H264_MEM_MGMT_CONTROL_OP_MARK_CURRENT_AS_LONG_TERM = 6, + STD_VIDEO_H264_MEM_MGMT_CONTROL_OP_INVALID = 0x7FFFFFFF, + STD_VIDEO_H264_MEM_MGMT_CONTROL_OP_MAX_ENUM = 0x7FFFFFFF +} StdVideoH264MemMgmtControlOp; + +typedef enum StdVideoH264CabacInitIdc { + STD_VIDEO_H264_CABAC_INIT_IDC_0 = 0, + STD_VIDEO_H264_CABAC_INIT_IDC_1 = 1, + STD_VIDEO_H264_CABAC_INIT_IDC_2 = 2, + STD_VIDEO_H264_CABAC_INIT_IDC_INVALID = 0x7FFFFFFF, + STD_VIDEO_H264_CABAC_INIT_IDC_MAX_ENUM = 0x7FFFFFFF +} StdVideoH264CabacInitIdc; + +typedef enum StdVideoH264DisableDeblockingFilterIdc { + STD_VIDEO_H264_DISABLE_DEBLOCKING_FILTER_IDC_DISABLED = 0, + STD_VIDEO_H264_DISABLE_DEBLOCKING_FILTER_IDC_ENABLED = 1, + STD_VIDEO_H264_DISABLE_DEBLOCKING_FILTER_IDC_PARTIAL = 2, + STD_VIDEO_H264_DISABLE_DEBLOCKING_FILTER_IDC_INVALID = 0x7FFFFFFF, + STD_VIDEO_H264_DISABLE_DEBLOCKING_FILTER_IDC_MAX_ENUM = 0x7FFFFFFF +} StdVideoH264DisableDeblockingFilterIdc; + +typedef enum StdVideoH264SliceType { + STD_VIDEO_H264_SLICE_TYPE_P = 0, + STD_VIDEO_H264_SLICE_TYPE_B = 1, + STD_VIDEO_H264_SLICE_TYPE_I = 2, + STD_VIDEO_H264_SLICE_TYPE_INVALID = 0x7FFFFFFF, + STD_VIDEO_H264_SLICE_TYPE_MAX_ENUM = 0x7FFFFFFF +} StdVideoH264SliceType; + +typedef enum StdVideoH264PictureType { + STD_VIDEO_H264_PICTURE_TYPE_P = 0, + STD_VIDEO_H264_PICTURE_TYPE_B = 1, + STD_VIDEO_H264_PICTURE_TYPE_I = 2, + STD_VIDEO_H264_PICTURE_TYPE_IDR = 5, + STD_VIDEO_H264_PICTURE_TYPE_INVALID = 0x7FFFFFFF, + STD_VIDEO_H264_PICTURE_TYPE_MAX_ENUM = 0x7FFFFFFF +} StdVideoH264PictureType; + +typedef enum StdVideoH264NonVclNaluType { + STD_VIDEO_H264_NON_VCL_NALU_TYPE_SPS = 0, + STD_VIDEO_H264_NON_VCL_NALU_TYPE_PPS = 1, + STD_VIDEO_H264_NON_VCL_NALU_TYPE_AUD = 2, + STD_VIDEO_H264_NON_VCL_NALU_TYPE_PREFIX = 3, + STD_VIDEO_H264_NON_VCL_NALU_TYPE_END_OF_SEQUENCE = 4, + STD_VIDEO_H264_NON_VCL_NALU_TYPE_END_OF_STREAM = 5, + STD_VIDEO_H264_NON_VCL_NALU_TYPE_PRECODED = 6, + STD_VIDEO_H264_NON_VCL_NALU_TYPE_INVALID = 0x7FFFFFFF, + STD_VIDEO_H264_NON_VCL_NALU_TYPE_MAX_ENUM = 0x7FFFFFFF +} StdVideoH264NonVclNaluType; +typedef struct StdVideoH264SpsVuiFlags { + uint32_t aspect_ratio_info_present_flag : 1; + uint32_t overscan_info_present_flag : 1; + uint32_t overscan_appropriate_flag : 1; + uint32_t video_signal_type_present_flag : 1; + uint32_t video_full_range_flag : 1; + uint32_t color_description_present_flag : 1; + uint32_t chroma_loc_info_present_flag : 1; + uint32_t timing_info_present_flag : 1; + uint32_t fixed_frame_rate_flag : 1; + uint32_t bitstream_restriction_flag : 1; + uint32_t nal_hrd_parameters_present_flag : 1; + uint32_t vcl_hrd_parameters_present_flag : 1; +} StdVideoH264SpsVuiFlags; + +typedef struct StdVideoH264HrdParameters { + uint8_t cpb_cnt_minus1; + uint8_t bit_rate_scale; + uint8_t cpb_size_scale; + uint8_t reserved1; + uint32_t bit_rate_value_minus1[STD_VIDEO_H264_CPB_CNT_LIST_SIZE]; + uint32_t cpb_size_value_minus1[STD_VIDEO_H264_CPB_CNT_LIST_SIZE]; + uint8_t cbr_flag[STD_VIDEO_H264_CPB_CNT_LIST_SIZE]; + uint32_t initial_cpb_removal_delay_length_minus1; + uint32_t cpb_removal_delay_length_minus1; + uint32_t dpb_output_delay_length_minus1; + uint32_t time_offset_length; +} StdVideoH264HrdParameters; + +typedef struct StdVideoH264SequenceParameterSetVui { + StdVideoH264SpsVuiFlags flags; + StdVideoH264AspectRatioIdc aspect_ratio_idc; + uint16_t sar_width; + uint16_t sar_height; + uint8_t video_format; + uint8_t colour_primaries; + uint8_t transfer_characteristics; + uint8_t matrix_coefficients; + uint32_t num_units_in_tick; + uint32_t time_scale; + uint8_t max_num_reorder_frames; + uint8_t max_dec_frame_buffering; + uint8_t chroma_sample_loc_type_top_field; + uint8_t chroma_sample_loc_type_bottom_field; + uint32_t reserved1; + const StdVideoH264HrdParameters* pHrdParameters; +} StdVideoH264SequenceParameterSetVui; + +typedef struct StdVideoH264SpsFlags { + uint32_t constraint_set0_flag : 1; + uint32_t constraint_set1_flag : 1; + uint32_t constraint_set2_flag : 1; + uint32_t constraint_set3_flag : 1; + uint32_t constraint_set4_flag : 1; + uint32_t constraint_set5_flag : 1; + uint32_t direct_8x8_inference_flag : 1; + uint32_t mb_adaptive_frame_field_flag : 1; + uint32_t frame_mbs_only_flag : 1; + uint32_t delta_pic_order_always_zero_flag : 1; + uint32_t separate_colour_plane_flag : 1; + uint32_t gaps_in_frame_num_value_allowed_flag : 1; + uint32_t qpprime_y_zero_transform_bypass_flag : 1; + uint32_t frame_cropping_flag : 1; + uint32_t seq_scaling_matrix_present_flag : 1; + uint32_t vui_parameters_present_flag : 1; +} StdVideoH264SpsFlags; + +typedef struct StdVideoH264ScalingLists { + uint16_t scaling_list_present_mask; + uint16_t use_default_scaling_matrix_mask; + uint8_t ScalingList4x4[STD_VIDEO_H264_SCALING_LIST_4X4_NUM_LISTS][STD_VIDEO_H264_SCALING_LIST_4X4_NUM_ELEMENTS]; + uint8_t ScalingList8x8[STD_VIDEO_H264_SCALING_LIST_8X8_NUM_LISTS][STD_VIDEO_H264_SCALING_LIST_8X8_NUM_ELEMENTS]; +} StdVideoH264ScalingLists; + +typedef struct StdVideoH264SequenceParameterSet { + StdVideoH264SpsFlags flags; + StdVideoH264ProfileIdc profile_idc; + StdVideoH264LevelIdc level_idc; + StdVideoH264ChromaFormatIdc chroma_format_idc; + uint8_t seq_parameter_set_id; + uint8_t bit_depth_luma_minus8; + uint8_t bit_depth_chroma_minus8; + uint8_t log2_max_frame_num_minus4; + StdVideoH264PocType pic_order_cnt_type; + int32_t offset_for_non_ref_pic; + int32_t offset_for_top_to_bottom_field; + uint8_t log2_max_pic_order_cnt_lsb_minus4; + uint8_t num_ref_frames_in_pic_order_cnt_cycle; + uint8_t max_num_ref_frames; + uint8_t reserved1; + uint32_t pic_width_in_mbs_minus1; + uint32_t pic_height_in_map_units_minus1; + uint32_t frame_crop_left_offset; + uint32_t frame_crop_right_offset; + uint32_t frame_crop_top_offset; + uint32_t frame_crop_bottom_offset; + uint32_t reserved2; + const int32_t* pOffsetForRefFrame; + const StdVideoH264ScalingLists* pScalingLists; + const StdVideoH264SequenceParameterSetVui* pSequenceParameterSetVui; +} StdVideoH264SequenceParameterSet; + +typedef struct StdVideoH264PpsFlags { + uint32_t transform_8x8_mode_flag : 1; + uint32_t redundant_pic_cnt_present_flag : 1; + uint32_t constrained_intra_pred_flag : 1; + uint32_t deblocking_filter_control_present_flag : 1; + uint32_t weighted_pred_flag : 1; + uint32_t bottom_field_pic_order_in_frame_present_flag : 1; + uint32_t entropy_coding_mode_flag : 1; + uint32_t pic_scaling_matrix_present_flag : 1; +} StdVideoH264PpsFlags; + +typedef struct StdVideoH264PictureParameterSet { + StdVideoH264PpsFlags flags; + uint8_t seq_parameter_set_id; + uint8_t pic_parameter_set_id; + uint8_t num_ref_idx_l0_default_active_minus1; + uint8_t num_ref_idx_l1_default_active_minus1; + StdVideoH264WeightedBipredIdc weighted_bipred_idc; + int8_t pic_init_qp_minus26; + int8_t pic_init_qs_minus26; + int8_t chroma_qp_index_offset; + int8_t second_chroma_qp_index_offset; + const StdVideoH264ScalingLists* pScalingLists; +} StdVideoH264PictureParameterSet; + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/thirdparty/SDL/src/video/khronos/vk_video/vulkan_video_codec_h264std_decode.h b/thirdparty/SDL/src/video/khronos/vk_video/vulkan_video_codec_h264std_decode.h new file mode 100644 index 000000000..439cb885e --- /dev/null +++ b/thirdparty/SDL/src/video/khronos/vk_video/vulkan_video_codec_h264std_decode.h @@ -0,0 +1,77 @@ +#ifndef VULKAN_VIDEO_CODEC_H264STD_DECODE_H_ +#define VULKAN_VIDEO_CODEC_H264STD_DECODE_H_ 1 + +/* +** Copyright 2015-2024 The Khronos Group Inc. +** +** SPDX-License-Identifier: Apache-2.0 +*/ + +/* +** This header is generated from the Khronos Vulkan XML API Registry. +** +*/ + + +#ifdef __cplusplus +extern "C" { +#endif + + + +// vulkan_video_codec_h264std_decode is a preprocessor guard. Do not pass it to API calls. +#define vulkan_video_codec_h264std_decode 1 +#include "vulkan_video_codec_h264std.h" + +#define VK_STD_VULKAN_VIDEO_CODEC_H264_DECODE_API_VERSION_1_0_0 VK_MAKE_VIDEO_STD_VERSION(1, 0, 0) + +#define VK_STD_VULKAN_VIDEO_CODEC_H264_DECODE_SPEC_VERSION VK_STD_VULKAN_VIDEO_CODEC_H264_DECODE_API_VERSION_1_0_0 +#define VK_STD_VULKAN_VIDEO_CODEC_H264_DECODE_EXTENSION_NAME "VK_STD_vulkan_video_codec_h264_decode" +#define STD_VIDEO_DECODE_H264_FIELD_ORDER_COUNT_LIST_SIZE 2 + +typedef enum StdVideoDecodeH264FieldOrderCount { + STD_VIDEO_DECODE_H264_FIELD_ORDER_COUNT_TOP = 0, + STD_VIDEO_DECODE_H264_FIELD_ORDER_COUNT_BOTTOM = 1, + STD_VIDEO_DECODE_H264_FIELD_ORDER_COUNT_INVALID = 0x7FFFFFFF, + STD_VIDEO_DECODE_H264_FIELD_ORDER_COUNT_MAX_ENUM = 0x7FFFFFFF +} StdVideoDecodeH264FieldOrderCount; +typedef struct StdVideoDecodeH264PictureInfoFlags { + uint32_t field_pic_flag : 1; + uint32_t is_intra : 1; + uint32_t IdrPicFlag : 1; + uint32_t bottom_field_flag : 1; + uint32_t is_reference : 1; + uint32_t complementary_field_pair : 1; +} StdVideoDecodeH264PictureInfoFlags; + +typedef struct StdVideoDecodeH264PictureInfo { + StdVideoDecodeH264PictureInfoFlags flags; + uint8_t seq_parameter_set_id; + uint8_t pic_parameter_set_id; + uint8_t reserved1; + uint8_t reserved2; + uint16_t frame_num; + uint16_t idr_pic_id; + int32_t PicOrderCnt[STD_VIDEO_DECODE_H264_FIELD_ORDER_COUNT_LIST_SIZE]; +} StdVideoDecodeH264PictureInfo; + +typedef struct StdVideoDecodeH264ReferenceInfoFlags { + uint32_t top_field_flag : 1; + uint32_t bottom_field_flag : 1; + uint32_t used_for_long_term_reference : 1; + uint32_t is_non_existing : 1; +} StdVideoDecodeH264ReferenceInfoFlags; + +typedef struct StdVideoDecodeH264ReferenceInfo { + StdVideoDecodeH264ReferenceInfoFlags flags; + uint16_t FrameNum; + uint16_t reserved; + int32_t PicOrderCnt[STD_VIDEO_DECODE_H264_FIELD_ORDER_COUNT_LIST_SIZE]; +} StdVideoDecodeH264ReferenceInfo; + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/thirdparty/SDL/src/video/khronos/vk_video/vulkan_video_codec_h264std_encode.h b/thirdparty/SDL/src/video/khronos/vk_video/vulkan_video_codec_h264std_encode.h new file mode 100644 index 000000000..9e24aa5d9 --- /dev/null +++ b/thirdparty/SDL/src/video/khronos/vk_video/vulkan_video_codec_h264std_encode.h @@ -0,0 +1,147 @@ +#ifndef VULKAN_VIDEO_CODEC_H264STD_ENCODE_H_ +#define VULKAN_VIDEO_CODEC_H264STD_ENCODE_H_ 1 + +/* +** Copyright 2015-2024 The Khronos Group Inc. +** +** SPDX-License-Identifier: Apache-2.0 +*/ + +/* +** This header is generated from the Khronos Vulkan XML API Registry. +** +*/ + + +#ifdef __cplusplus +extern "C" { +#endif + + + +// vulkan_video_codec_h264std_encode is a preprocessor guard. Do not pass it to API calls. +#define vulkan_video_codec_h264std_encode 1 +#include "vulkan_video_codec_h264std.h" + +#define VK_STD_VULKAN_VIDEO_CODEC_H264_ENCODE_API_VERSION_1_0_0 VK_MAKE_VIDEO_STD_VERSION(1, 0, 0) + +#define VK_STD_VULKAN_VIDEO_CODEC_H264_ENCODE_SPEC_VERSION VK_STD_VULKAN_VIDEO_CODEC_H264_ENCODE_API_VERSION_1_0_0 +#define VK_STD_VULKAN_VIDEO_CODEC_H264_ENCODE_EXTENSION_NAME "VK_STD_vulkan_video_codec_h264_encode" +typedef struct StdVideoEncodeH264WeightTableFlags { + uint32_t luma_weight_l0_flag; + uint32_t chroma_weight_l0_flag; + uint32_t luma_weight_l1_flag; + uint32_t chroma_weight_l1_flag; +} StdVideoEncodeH264WeightTableFlags; + +typedef struct StdVideoEncodeH264WeightTable { + StdVideoEncodeH264WeightTableFlags flags; + uint8_t luma_log2_weight_denom; + uint8_t chroma_log2_weight_denom; + int8_t luma_weight_l0[STD_VIDEO_H264_MAX_NUM_LIST_REF]; + int8_t luma_offset_l0[STD_VIDEO_H264_MAX_NUM_LIST_REF]; + int8_t chroma_weight_l0[STD_VIDEO_H264_MAX_NUM_LIST_REF][STD_VIDEO_H264_MAX_CHROMA_PLANES]; + int8_t chroma_offset_l0[STD_VIDEO_H264_MAX_NUM_LIST_REF][STD_VIDEO_H264_MAX_CHROMA_PLANES]; + int8_t luma_weight_l1[STD_VIDEO_H264_MAX_NUM_LIST_REF]; + int8_t luma_offset_l1[STD_VIDEO_H264_MAX_NUM_LIST_REF]; + int8_t chroma_weight_l1[STD_VIDEO_H264_MAX_NUM_LIST_REF][STD_VIDEO_H264_MAX_CHROMA_PLANES]; + int8_t chroma_offset_l1[STD_VIDEO_H264_MAX_NUM_LIST_REF][STD_VIDEO_H264_MAX_CHROMA_PLANES]; +} StdVideoEncodeH264WeightTable; + +typedef struct StdVideoEncodeH264SliceHeaderFlags { + uint32_t direct_spatial_mv_pred_flag : 1; + uint32_t num_ref_idx_active_override_flag : 1; + uint32_t reserved : 30; +} StdVideoEncodeH264SliceHeaderFlags; + +typedef struct StdVideoEncodeH264PictureInfoFlags { + uint32_t IdrPicFlag : 1; + uint32_t is_reference : 1; + uint32_t no_output_of_prior_pics_flag : 1; + uint32_t long_term_reference_flag : 1; + uint32_t adaptive_ref_pic_marking_mode_flag : 1; + uint32_t reserved : 27; +} StdVideoEncodeH264PictureInfoFlags; + +typedef struct StdVideoEncodeH264ReferenceInfoFlags { + uint32_t used_for_long_term_reference : 1; + uint32_t reserved : 31; +} StdVideoEncodeH264ReferenceInfoFlags; + +typedef struct StdVideoEncodeH264ReferenceListsInfoFlags { + uint32_t ref_pic_list_modification_flag_l0 : 1; + uint32_t ref_pic_list_modification_flag_l1 : 1; + uint32_t reserved : 30; +} StdVideoEncodeH264ReferenceListsInfoFlags; + +typedef struct StdVideoEncodeH264RefListModEntry { + StdVideoH264ModificationOfPicNumsIdc modification_of_pic_nums_idc; + uint16_t abs_diff_pic_num_minus1; + uint16_t long_term_pic_num; +} StdVideoEncodeH264RefListModEntry; + +typedef struct StdVideoEncodeH264RefPicMarkingEntry { + StdVideoH264MemMgmtControlOp memory_management_control_operation; + uint16_t difference_of_pic_nums_minus1; + uint16_t long_term_pic_num; + uint16_t long_term_frame_idx; + uint16_t max_long_term_frame_idx_plus1; +} StdVideoEncodeH264RefPicMarkingEntry; + +typedef struct StdVideoEncodeH264ReferenceListsInfo { + StdVideoEncodeH264ReferenceListsInfoFlags flags; + uint8_t num_ref_idx_l0_active_minus1; + uint8_t num_ref_idx_l1_active_minus1; + uint8_t RefPicList0[STD_VIDEO_H264_MAX_NUM_LIST_REF]; + uint8_t RefPicList1[STD_VIDEO_H264_MAX_NUM_LIST_REF]; + uint8_t refList0ModOpCount; + uint8_t refList1ModOpCount; + uint8_t refPicMarkingOpCount; + uint8_t reserved1[7]; + const StdVideoEncodeH264RefListModEntry* pRefList0ModOperations; + const StdVideoEncodeH264RefListModEntry* pRefList1ModOperations; + const StdVideoEncodeH264RefPicMarkingEntry* pRefPicMarkingOperations; +} StdVideoEncodeH264ReferenceListsInfo; + +typedef struct StdVideoEncodeH264PictureInfo { + StdVideoEncodeH264PictureInfoFlags flags; + uint8_t seq_parameter_set_id; + uint8_t pic_parameter_set_id; + uint16_t idr_pic_id; + StdVideoH264PictureType primary_pic_type; + uint32_t frame_num; + int32_t PicOrderCnt; + uint8_t temporal_id; + uint8_t reserved1[3]; + const StdVideoEncodeH264ReferenceListsInfo* pRefLists; +} StdVideoEncodeH264PictureInfo; + +typedef struct StdVideoEncodeH264ReferenceInfo { + StdVideoEncodeH264ReferenceInfoFlags flags; + StdVideoH264PictureType primary_pic_type; + uint32_t FrameNum; + int32_t PicOrderCnt; + uint16_t long_term_pic_num; + uint16_t long_term_frame_idx; + uint8_t temporal_id; +} StdVideoEncodeH264ReferenceInfo; + +typedef struct StdVideoEncodeH264SliceHeader { + StdVideoEncodeH264SliceHeaderFlags flags; + uint32_t first_mb_in_slice; + StdVideoH264SliceType slice_type; + int8_t slice_alpha_c0_offset_div2; + int8_t slice_beta_offset_div2; + int8_t slice_qp_delta; + uint8_t reserved1; + StdVideoH264CabacInitIdc cabac_init_idc; + StdVideoH264DisableDeblockingFilterIdc disable_deblocking_filter_idc; + const StdVideoEncodeH264WeightTable* pWeightTable; +} StdVideoEncodeH264SliceHeader; + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/thirdparty/SDL/src/video/khronos/vk_video/vulkan_video_codec_h265std.h b/thirdparty/SDL/src/video/khronos/vk_video/vulkan_video_codec_h265std.h new file mode 100644 index 000000000..d0a1bacbe --- /dev/null +++ b/thirdparty/SDL/src/video/khronos/vk_video/vulkan_video_codec_h265std.h @@ -0,0 +1,446 @@ +#ifndef VULKAN_VIDEO_CODEC_H265STD_H_ +#define VULKAN_VIDEO_CODEC_H265STD_H_ 1 + +/* +** Copyright 2015-2024 The Khronos Group Inc. +** +** SPDX-License-Identifier: Apache-2.0 +*/ + +/* +** This header is generated from the Khronos Vulkan XML API Registry. +** +*/ + + +#ifdef __cplusplus +extern "C" { +#endif + + + +// vulkan_video_codec_h265std is a preprocessor guard. Do not pass it to API calls. +#define vulkan_video_codec_h265std 1 +#include "vulkan_video_codecs_common.h" +#define STD_VIDEO_H265_CPB_CNT_LIST_SIZE 32 +#define STD_VIDEO_H265_SUBLAYERS_LIST_SIZE 7 +#define STD_VIDEO_H265_SCALING_LIST_4X4_NUM_LISTS 6 +#define STD_VIDEO_H265_SCALING_LIST_4X4_NUM_ELEMENTS 16 +#define STD_VIDEO_H265_SCALING_LIST_8X8_NUM_LISTS 6 +#define STD_VIDEO_H265_SCALING_LIST_8X8_NUM_ELEMENTS 64 +#define STD_VIDEO_H265_SCALING_LIST_16X16_NUM_LISTS 6 +#define STD_VIDEO_H265_SCALING_LIST_16X16_NUM_ELEMENTS 64 +#define STD_VIDEO_H265_SCALING_LIST_32X32_NUM_LISTS 2 +#define STD_VIDEO_H265_SCALING_LIST_32X32_NUM_ELEMENTS 64 +#define STD_VIDEO_H265_CHROMA_QP_OFFSET_LIST_SIZE 6 +#define STD_VIDEO_H265_CHROMA_QP_OFFSET_TILE_COLS_LIST_SIZE 19 +#define STD_VIDEO_H265_CHROMA_QP_OFFSET_TILE_ROWS_LIST_SIZE 21 +#define STD_VIDEO_H265_PREDICTOR_PALETTE_COMPONENTS_LIST_SIZE 3 +#define STD_VIDEO_H265_PREDICTOR_PALETTE_COMP_ENTRIES_LIST_SIZE 128 +#define STD_VIDEO_H265_MAX_NUM_LIST_REF 15 +#define STD_VIDEO_H265_MAX_CHROMA_PLANES 2 +#define STD_VIDEO_H265_MAX_SHORT_TERM_REF_PIC_SETS 64 +#define STD_VIDEO_H265_MAX_DPB_SIZE 16 +#define STD_VIDEO_H265_MAX_LONG_TERM_REF_PICS_SPS 32 +#define STD_VIDEO_H265_MAX_LONG_TERM_PICS 16 +#define STD_VIDEO_H265_MAX_DELTA_POC 48 +#define STD_VIDEO_H265_NO_REFERENCE_PICTURE 0xFF + +typedef enum StdVideoH265ChromaFormatIdc { + STD_VIDEO_H265_CHROMA_FORMAT_IDC_MONOCHROME = 0, + STD_VIDEO_H265_CHROMA_FORMAT_IDC_420 = 1, + STD_VIDEO_H265_CHROMA_FORMAT_IDC_422 = 2, + STD_VIDEO_H265_CHROMA_FORMAT_IDC_444 = 3, + STD_VIDEO_H265_CHROMA_FORMAT_IDC_INVALID = 0x7FFFFFFF, + STD_VIDEO_H265_CHROMA_FORMAT_IDC_MAX_ENUM = 0x7FFFFFFF +} StdVideoH265ChromaFormatIdc; + +typedef enum StdVideoH265ProfileIdc { + STD_VIDEO_H265_PROFILE_IDC_MAIN = 1, + STD_VIDEO_H265_PROFILE_IDC_MAIN_10 = 2, + STD_VIDEO_H265_PROFILE_IDC_MAIN_STILL_PICTURE = 3, + STD_VIDEO_H265_PROFILE_IDC_FORMAT_RANGE_EXTENSIONS = 4, + STD_VIDEO_H265_PROFILE_IDC_SCC_EXTENSIONS = 9, + STD_VIDEO_H265_PROFILE_IDC_INVALID = 0x7FFFFFFF, + STD_VIDEO_H265_PROFILE_IDC_MAX_ENUM = 0x7FFFFFFF +} StdVideoH265ProfileIdc; + +typedef enum StdVideoH265LevelIdc { + STD_VIDEO_H265_LEVEL_IDC_1_0 = 0, + STD_VIDEO_H265_LEVEL_IDC_2_0 = 1, + STD_VIDEO_H265_LEVEL_IDC_2_1 = 2, + STD_VIDEO_H265_LEVEL_IDC_3_0 = 3, + STD_VIDEO_H265_LEVEL_IDC_3_1 = 4, + STD_VIDEO_H265_LEVEL_IDC_4_0 = 5, + STD_VIDEO_H265_LEVEL_IDC_4_1 = 6, + STD_VIDEO_H265_LEVEL_IDC_5_0 = 7, + STD_VIDEO_H265_LEVEL_IDC_5_1 = 8, + STD_VIDEO_H265_LEVEL_IDC_5_2 = 9, + STD_VIDEO_H265_LEVEL_IDC_6_0 = 10, + STD_VIDEO_H265_LEVEL_IDC_6_1 = 11, + STD_VIDEO_H265_LEVEL_IDC_6_2 = 12, + STD_VIDEO_H265_LEVEL_IDC_INVALID = 0x7FFFFFFF, + STD_VIDEO_H265_LEVEL_IDC_MAX_ENUM = 0x7FFFFFFF +} StdVideoH265LevelIdc; + +typedef enum StdVideoH265SliceType { + STD_VIDEO_H265_SLICE_TYPE_B = 0, + STD_VIDEO_H265_SLICE_TYPE_P = 1, + STD_VIDEO_H265_SLICE_TYPE_I = 2, + STD_VIDEO_H265_SLICE_TYPE_INVALID = 0x7FFFFFFF, + STD_VIDEO_H265_SLICE_TYPE_MAX_ENUM = 0x7FFFFFFF +} StdVideoH265SliceType; + +typedef enum StdVideoH265PictureType { + STD_VIDEO_H265_PICTURE_TYPE_P = 0, + STD_VIDEO_H265_PICTURE_TYPE_B = 1, + STD_VIDEO_H265_PICTURE_TYPE_I = 2, + STD_VIDEO_H265_PICTURE_TYPE_IDR = 3, + STD_VIDEO_H265_PICTURE_TYPE_INVALID = 0x7FFFFFFF, + STD_VIDEO_H265_PICTURE_TYPE_MAX_ENUM = 0x7FFFFFFF +} StdVideoH265PictureType; + +typedef enum StdVideoH265AspectRatioIdc { + STD_VIDEO_H265_ASPECT_RATIO_IDC_UNSPECIFIED = 0, + STD_VIDEO_H265_ASPECT_RATIO_IDC_SQUARE = 1, + STD_VIDEO_H265_ASPECT_RATIO_IDC_12_11 = 2, + STD_VIDEO_H265_ASPECT_RATIO_IDC_10_11 = 3, + STD_VIDEO_H265_ASPECT_RATIO_IDC_16_11 = 4, + STD_VIDEO_H265_ASPECT_RATIO_IDC_40_33 = 5, + STD_VIDEO_H265_ASPECT_RATIO_IDC_24_11 = 6, + STD_VIDEO_H265_ASPECT_RATIO_IDC_20_11 = 7, + STD_VIDEO_H265_ASPECT_RATIO_IDC_32_11 = 8, + STD_VIDEO_H265_ASPECT_RATIO_IDC_80_33 = 9, + STD_VIDEO_H265_ASPECT_RATIO_IDC_18_11 = 10, + STD_VIDEO_H265_ASPECT_RATIO_IDC_15_11 = 11, + STD_VIDEO_H265_ASPECT_RATIO_IDC_64_33 = 12, + STD_VIDEO_H265_ASPECT_RATIO_IDC_160_99 = 13, + STD_VIDEO_H265_ASPECT_RATIO_IDC_4_3 = 14, + STD_VIDEO_H265_ASPECT_RATIO_IDC_3_2 = 15, + STD_VIDEO_H265_ASPECT_RATIO_IDC_2_1 = 16, + STD_VIDEO_H265_ASPECT_RATIO_IDC_EXTENDED_SAR = 255, + STD_VIDEO_H265_ASPECT_RATIO_IDC_INVALID = 0x7FFFFFFF, + STD_VIDEO_H265_ASPECT_RATIO_IDC_MAX_ENUM = 0x7FFFFFFF +} StdVideoH265AspectRatioIdc; +typedef struct StdVideoH265DecPicBufMgr { + uint32_t max_latency_increase_plus1[STD_VIDEO_H265_SUBLAYERS_LIST_SIZE]; + uint8_t max_dec_pic_buffering_minus1[STD_VIDEO_H265_SUBLAYERS_LIST_SIZE]; + uint8_t max_num_reorder_pics[STD_VIDEO_H265_SUBLAYERS_LIST_SIZE]; +} StdVideoH265DecPicBufMgr; + +typedef struct StdVideoH265SubLayerHrdParameters { + uint32_t bit_rate_value_minus1[STD_VIDEO_H265_CPB_CNT_LIST_SIZE]; + uint32_t cpb_size_value_minus1[STD_VIDEO_H265_CPB_CNT_LIST_SIZE]; + uint32_t cpb_size_du_value_minus1[STD_VIDEO_H265_CPB_CNT_LIST_SIZE]; + uint32_t bit_rate_du_value_minus1[STD_VIDEO_H265_CPB_CNT_LIST_SIZE]; + uint32_t cbr_flag; +} StdVideoH265SubLayerHrdParameters; + +typedef struct StdVideoH265HrdFlags { + uint32_t nal_hrd_parameters_present_flag : 1; + uint32_t vcl_hrd_parameters_present_flag : 1; + uint32_t sub_pic_hrd_params_present_flag : 1; + uint32_t sub_pic_cpb_params_in_pic_timing_sei_flag : 1; + uint32_t fixed_pic_rate_general_flag : 8; + uint32_t fixed_pic_rate_within_cvs_flag : 8; + uint32_t low_delay_hrd_flag : 8; +} StdVideoH265HrdFlags; + +typedef struct StdVideoH265HrdParameters { + StdVideoH265HrdFlags flags; + uint8_t tick_divisor_minus2; + uint8_t du_cpb_removal_delay_increment_length_minus1; + uint8_t dpb_output_delay_du_length_minus1; + uint8_t bit_rate_scale; + uint8_t cpb_size_scale; + uint8_t cpb_size_du_scale; + uint8_t initial_cpb_removal_delay_length_minus1; + uint8_t au_cpb_removal_delay_length_minus1; + uint8_t dpb_output_delay_length_minus1; + uint8_t cpb_cnt_minus1[STD_VIDEO_H265_SUBLAYERS_LIST_SIZE]; + uint16_t elemental_duration_in_tc_minus1[STD_VIDEO_H265_SUBLAYERS_LIST_SIZE]; + uint16_t reserved[3]; + const StdVideoH265SubLayerHrdParameters* pSubLayerHrdParametersNal; + const StdVideoH265SubLayerHrdParameters* pSubLayerHrdParametersVcl; +} StdVideoH265HrdParameters; + +typedef struct StdVideoH265VpsFlags { + uint32_t vps_temporal_id_nesting_flag : 1; + uint32_t vps_sub_layer_ordering_info_present_flag : 1; + uint32_t vps_timing_info_present_flag : 1; + uint32_t vps_poc_proportional_to_timing_flag : 1; +} StdVideoH265VpsFlags; + +typedef struct StdVideoH265ProfileTierLevelFlags { + uint32_t general_tier_flag : 1; + uint32_t general_progressive_source_flag : 1; + uint32_t general_interlaced_source_flag : 1; + uint32_t general_non_packed_constraint_flag : 1; + uint32_t general_frame_only_constraint_flag : 1; +} StdVideoH265ProfileTierLevelFlags; + +typedef struct StdVideoH265ProfileTierLevel { + StdVideoH265ProfileTierLevelFlags flags; + StdVideoH265ProfileIdc general_profile_idc; + StdVideoH265LevelIdc general_level_idc; +} StdVideoH265ProfileTierLevel; + +typedef struct StdVideoH265VideoParameterSet { + StdVideoH265VpsFlags flags; + uint8_t vps_video_parameter_set_id; + uint8_t vps_max_sub_layers_minus1; + uint8_t reserved1; + uint8_t reserved2; + uint32_t vps_num_units_in_tick; + uint32_t vps_time_scale; + uint32_t vps_num_ticks_poc_diff_one_minus1; + uint32_t reserved3; + const StdVideoH265DecPicBufMgr* pDecPicBufMgr; + const StdVideoH265HrdParameters* pHrdParameters; + const StdVideoH265ProfileTierLevel* pProfileTierLevel; +} StdVideoH265VideoParameterSet; + +typedef struct StdVideoH265ScalingLists { + uint8_t ScalingList4x4[STD_VIDEO_H265_SCALING_LIST_4X4_NUM_LISTS][STD_VIDEO_H265_SCALING_LIST_4X4_NUM_ELEMENTS]; + uint8_t ScalingList8x8[STD_VIDEO_H265_SCALING_LIST_8X8_NUM_LISTS][STD_VIDEO_H265_SCALING_LIST_8X8_NUM_ELEMENTS]; + uint8_t ScalingList16x16[STD_VIDEO_H265_SCALING_LIST_16X16_NUM_LISTS][STD_VIDEO_H265_SCALING_LIST_16X16_NUM_ELEMENTS]; + uint8_t ScalingList32x32[STD_VIDEO_H265_SCALING_LIST_32X32_NUM_LISTS][STD_VIDEO_H265_SCALING_LIST_32X32_NUM_ELEMENTS]; + uint8_t ScalingListDCCoef16x16[STD_VIDEO_H265_SCALING_LIST_16X16_NUM_LISTS]; + uint8_t ScalingListDCCoef32x32[STD_VIDEO_H265_SCALING_LIST_32X32_NUM_LISTS]; +} StdVideoH265ScalingLists; + +typedef struct StdVideoH265SpsVuiFlags { + uint32_t aspect_ratio_info_present_flag : 1; + uint32_t overscan_info_present_flag : 1; + uint32_t overscan_appropriate_flag : 1; + uint32_t video_signal_type_present_flag : 1; + uint32_t video_full_range_flag : 1; + uint32_t colour_description_present_flag : 1; + uint32_t chroma_loc_info_present_flag : 1; + uint32_t neutral_chroma_indication_flag : 1; + uint32_t field_seq_flag : 1; + uint32_t frame_field_info_present_flag : 1; + uint32_t default_display_window_flag : 1; + uint32_t vui_timing_info_present_flag : 1; + uint32_t vui_poc_proportional_to_timing_flag : 1; + uint32_t vui_hrd_parameters_present_flag : 1; + uint32_t bitstream_restriction_flag : 1; + uint32_t tiles_fixed_structure_flag : 1; + uint32_t motion_vectors_over_pic_boundaries_flag : 1; + uint32_t restricted_ref_pic_lists_flag : 1; +} StdVideoH265SpsVuiFlags; + +typedef struct StdVideoH265SequenceParameterSetVui { + StdVideoH265SpsVuiFlags flags; + StdVideoH265AspectRatioIdc aspect_ratio_idc; + uint16_t sar_width; + uint16_t sar_height; + uint8_t video_format; + uint8_t colour_primaries; + uint8_t transfer_characteristics; + uint8_t matrix_coeffs; + uint8_t chroma_sample_loc_type_top_field; + uint8_t chroma_sample_loc_type_bottom_field; + uint8_t reserved1; + uint8_t reserved2; + uint16_t def_disp_win_left_offset; + uint16_t def_disp_win_right_offset; + uint16_t def_disp_win_top_offset; + uint16_t def_disp_win_bottom_offset; + uint32_t vui_num_units_in_tick; + uint32_t vui_time_scale; + uint32_t vui_num_ticks_poc_diff_one_minus1; + uint16_t min_spatial_segmentation_idc; + uint16_t reserved3; + uint8_t max_bytes_per_pic_denom; + uint8_t max_bits_per_min_cu_denom; + uint8_t log2_max_mv_length_horizontal; + uint8_t log2_max_mv_length_vertical; + const StdVideoH265HrdParameters* pHrdParameters; +} StdVideoH265SequenceParameterSetVui; + +typedef struct StdVideoH265PredictorPaletteEntries { + uint16_t PredictorPaletteEntries[STD_VIDEO_H265_PREDICTOR_PALETTE_COMPONENTS_LIST_SIZE][STD_VIDEO_H265_PREDICTOR_PALETTE_COMP_ENTRIES_LIST_SIZE]; +} StdVideoH265PredictorPaletteEntries; + +typedef struct StdVideoH265SpsFlags { + uint32_t sps_temporal_id_nesting_flag : 1; + uint32_t separate_colour_plane_flag : 1; + uint32_t conformance_window_flag : 1; + uint32_t sps_sub_layer_ordering_info_present_flag : 1; + uint32_t scaling_list_enabled_flag : 1; + uint32_t sps_scaling_list_data_present_flag : 1; + uint32_t amp_enabled_flag : 1; + uint32_t sample_adaptive_offset_enabled_flag : 1; + uint32_t pcm_enabled_flag : 1; + uint32_t pcm_loop_filter_disabled_flag : 1; + uint32_t long_term_ref_pics_present_flag : 1; + uint32_t sps_temporal_mvp_enabled_flag : 1; + uint32_t strong_intra_smoothing_enabled_flag : 1; + uint32_t vui_parameters_present_flag : 1; + uint32_t sps_extension_present_flag : 1; + uint32_t sps_range_extension_flag : 1; + uint32_t transform_skip_rotation_enabled_flag : 1; + uint32_t transform_skip_context_enabled_flag : 1; + uint32_t implicit_rdpcm_enabled_flag : 1; + uint32_t explicit_rdpcm_enabled_flag : 1; + uint32_t extended_precision_processing_flag : 1; + uint32_t intra_smoothing_disabled_flag : 1; + uint32_t high_precision_offsets_enabled_flag : 1; + uint32_t persistent_rice_adaptation_enabled_flag : 1; + uint32_t cabac_bypass_alignment_enabled_flag : 1; + uint32_t sps_scc_extension_flag : 1; + uint32_t sps_curr_pic_ref_enabled_flag : 1; + uint32_t palette_mode_enabled_flag : 1; + uint32_t sps_palette_predictor_initializers_present_flag : 1; + uint32_t intra_boundary_filtering_disabled_flag : 1; +} StdVideoH265SpsFlags; + +typedef struct StdVideoH265ShortTermRefPicSetFlags { + uint32_t inter_ref_pic_set_prediction_flag : 1; + uint32_t delta_rps_sign : 1; +} StdVideoH265ShortTermRefPicSetFlags; + +typedef struct StdVideoH265ShortTermRefPicSet { + StdVideoH265ShortTermRefPicSetFlags flags; + uint32_t delta_idx_minus1; + uint16_t use_delta_flag; + uint16_t abs_delta_rps_minus1; + uint16_t used_by_curr_pic_flag; + uint16_t used_by_curr_pic_s0_flag; + uint16_t used_by_curr_pic_s1_flag; + uint16_t reserved1; + uint8_t reserved2; + uint8_t reserved3; + uint8_t num_negative_pics; + uint8_t num_positive_pics; + uint16_t delta_poc_s0_minus1[STD_VIDEO_H265_MAX_DPB_SIZE]; + uint16_t delta_poc_s1_minus1[STD_VIDEO_H265_MAX_DPB_SIZE]; +} StdVideoH265ShortTermRefPicSet; + +typedef struct StdVideoH265LongTermRefPicsSps { + uint32_t used_by_curr_pic_lt_sps_flag; + uint32_t lt_ref_pic_poc_lsb_sps[STD_VIDEO_H265_MAX_LONG_TERM_REF_PICS_SPS]; +} StdVideoH265LongTermRefPicsSps; + +typedef struct StdVideoH265SequenceParameterSet { + StdVideoH265SpsFlags flags; + StdVideoH265ChromaFormatIdc chroma_format_idc; + uint32_t pic_width_in_luma_samples; + uint32_t pic_height_in_luma_samples; + uint8_t sps_video_parameter_set_id; + uint8_t sps_max_sub_layers_minus1; + uint8_t sps_seq_parameter_set_id; + uint8_t bit_depth_luma_minus8; + uint8_t bit_depth_chroma_minus8; + uint8_t log2_max_pic_order_cnt_lsb_minus4; + uint8_t log2_min_luma_coding_block_size_minus3; + uint8_t log2_diff_max_min_luma_coding_block_size; + uint8_t log2_min_luma_transform_block_size_minus2; + uint8_t log2_diff_max_min_luma_transform_block_size; + uint8_t max_transform_hierarchy_depth_inter; + uint8_t max_transform_hierarchy_depth_intra; + uint8_t num_short_term_ref_pic_sets; + uint8_t num_long_term_ref_pics_sps; + uint8_t pcm_sample_bit_depth_luma_minus1; + uint8_t pcm_sample_bit_depth_chroma_minus1; + uint8_t log2_min_pcm_luma_coding_block_size_minus3; + uint8_t log2_diff_max_min_pcm_luma_coding_block_size; + uint8_t reserved1; + uint8_t reserved2; + uint8_t palette_max_size; + uint8_t delta_palette_max_predictor_size; + uint8_t motion_vector_resolution_control_idc; + uint8_t sps_num_palette_predictor_initializers_minus1; + uint32_t conf_win_left_offset; + uint32_t conf_win_right_offset; + uint32_t conf_win_top_offset; + uint32_t conf_win_bottom_offset; + const StdVideoH265ProfileTierLevel* pProfileTierLevel; + const StdVideoH265DecPicBufMgr* pDecPicBufMgr; + const StdVideoH265ScalingLists* pScalingLists; + const StdVideoH265ShortTermRefPicSet* pShortTermRefPicSet; + const StdVideoH265LongTermRefPicsSps* pLongTermRefPicsSps; + const StdVideoH265SequenceParameterSetVui* pSequenceParameterSetVui; + const StdVideoH265PredictorPaletteEntries* pPredictorPaletteEntries; +} StdVideoH265SequenceParameterSet; + +typedef struct StdVideoH265PpsFlags { + uint32_t dependent_slice_segments_enabled_flag : 1; + uint32_t output_flag_present_flag : 1; + uint32_t sign_data_hiding_enabled_flag : 1; + uint32_t cabac_init_present_flag : 1; + uint32_t constrained_intra_pred_flag : 1; + uint32_t transform_skip_enabled_flag : 1; + uint32_t cu_qp_delta_enabled_flag : 1; + uint32_t pps_slice_chroma_qp_offsets_present_flag : 1; + uint32_t weighted_pred_flag : 1; + uint32_t weighted_bipred_flag : 1; + uint32_t transquant_bypass_enabled_flag : 1; + uint32_t tiles_enabled_flag : 1; + uint32_t entropy_coding_sync_enabled_flag : 1; + uint32_t uniform_spacing_flag : 1; + uint32_t loop_filter_across_tiles_enabled_flag : 1; + uint32_t pps_loop_filter_across_slices_enabled_flag : 1; + uint32_t deblocking_filter_control_present_flag : 1; + uint32_t deblocking_filter_override_enabled_flag : 1; + uint32_t pps_deblocking_filter_disabled_flag : 1; + uint32_t pps_scaling_list_data_present_flag : 1; + uint32_t lists_modification_present_flag : 1; + uint32_t slice_segment_header_extension_present_flag : 1; + uint32_t pps_extension_present_flag : 1; + uint32_t cross_component_prediction_enabled_flag : 1; + uint32_t chroma_qp_offset_list_enabled_flag : 1; + uint32_t pps_curr_pic_ref_enabled_flag : 1; + uint32_t residual_adaptive_colour_transform_enabled_flag : 1; + uint32_t pps_slice_act_qp_offsets_present_flag : 1; + uint32_t pps_palette_predictor_initializers_present_flag : 1; + uint32_t monochrome_palette_flag : 1; + uint32_t pps_range_extension_flag : 1; +} StdVideoH265PpsFlags; + +typedef struct StdVideoH265PictureParameterSet { + StdVideoH265PpsFlags flags; + uint8_t pps_pic_parameter_set_id; + uint8_t pps_seq_parameter_set_id; + uint8_t sps_video_parameter_set_id; + uint8_t num_extra_slice_header_bits; + uint8_t num_ref_idx_l0_default_active_minus1; + uint8_t num_ref_idx_l1_default_active_minus1; + int8_t init_qp_minus26; + uint8_t diff_cu_qp_delta_depth; + int8_t pps_cb_qp_offset; + int8_t pps_cr_qp_offset; + int8_t pps_beta_offset_div2; + int8_t pps_tc_offset_div2; + uint8_t log2_parallel_merge_level_minus2; + uint8_t log2_max_transform_skip_block_size_minus2; + uint8_t diff_cu_chroma_qp_offset_depth; + uint8_t chroma_qp_offset_list_len_minus1; + int8_t cb_qp_offset_list[STD_VIDEO_H265_CHROMA_QP_OFFSET_LIST_SIZE]; + int8_t cr_qp_offset_list[STD_VIDEO_H265_CHROMA_QP_OFFSET_LIST_SIZE]; + uint8_t log2_sao_offset_scale_luma; + uint8_t log2_sao_offset_scale_chroma; + int8_t pps_act_y_qp_offset_plus5; + int8_t pps_act_cb_qp_offset_plus5; + int8_t pps_act_cr_qp_offset_plus3; + uint8_t pps_num_palette_predictor_initializers; + uint8_t luma_bit_depth_entry_minus8; + uint8_t chroma_bit_depth_entry_minus8; + uint8_t num_tile_columns_minus1; + uint8_t num_tile_rows_minus1; + uint8_t reserved1; + uint8_t reserved2; + uint16_t column_width_minus1[STD_VIDEO_H265_CHROMA_QP_OFFSET_TILE_COLS_LIST_SIZE]; + uint16_t row_height_minus1[STD_VIDEO_H265_CHROMA_QP_OFFSET_TILE_ROWS_LIST_SIZE]; + uint32_t reserved3; + const StdVideoH265ScalingLists* pScalingLists; + const StdVideoH265PredictorPaletteEntries* pPredictorPaletteEntries; +} StdVideoH265PictureParameterSet; + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/thirdparty/SDL/src/video/khronos/vk_video/vulkan_video_codec_h265std_decode.h b/thirdparty/SDL/src/video/khronos/vk_video/vulkan_video_codec_h265std_decode.h new file mode 100644 index 000000000..0178793e5 --- /dev/null +++ b/thirdparty/SDL/src/video/khronos/vk_video/vulkan_video_codec_h265std_decode.h @@ -0,0 +1,67 @@ +#ifndef VULKAN_VIDEO_CODEC_H265STD_DECODE_H_ +#define VULKAN_VIDEO_CODEC_H265STD_DECODE_H_ 1 + +/* +** Copyright 2015-2024 The Khronos Group Inc. +** +** SPDX-License-Identifier: Apache-2.0 +*/ + +/* +** This header is generated from the Khronos Vulkan XML API Registry. +** +*/ + + +#ifdef __cplusplus +extern "C" { +#endif + + + +// vulkan_video_codec_h265std_decode is a preprocessor guard. Do not pass it to API calls. +#define vulkan_video_codec_h265std_decode 1 +#include "vulkan_video_codec_h265std.h" + +#define VK_STD_VULKAN_VIDEO_CODEC_H265_DECODE_API_VERSION_1_0_0 VK_MAKE_VIDEO_STD_VERSION(1, 0, 0) + +#define VK_STD_VULKAN_VIDEO_CODEC_H265_DECODE_SPEC_VERSION VK_STD_VULKAN_VIDEO_CODEC_H265_DECODE_API_VERSION_1_0_0 +#define VK_STD_VULKAN_VIDEO_CODEC_H265_DECODE_EXTENSION_NAME "VK_STD_vulkan_video_codec_h265_decode" +#define STD_VIDEO_DECODE_H265_REF_PIC_SET_LIST_SIZE 8 +typedef struct StdVideoDecodeH265PictureInfoFlags { + uint32_t IrapPicFlag : 1; + uint32_t IdrPicFlag : 1; + uint32_t IsReference : 1; + uint32_t short_term_ref_pic_set_sps_flag : 1; +} StdVideoDecodeH265PictureInfoFlags; + +typedef struct StdVideoDecodeH265PictureInfo { + StdVideoDecodeH265PictureInfoFlags flags; + uint8_t sps_video_parameter_set_id; + uint8_t pps_seq_parameter_set_id; + uint8_t pps_pic_parameter_set_id; + uint8_t NumDeltaPocsOfRefRpsIdx; + int32_t PicOrderCntVal; + uint16_t NumBitsForSTRefPicSetInSlice; + uint16_t reserved; + uint8_t RefPicSetStCurrBefore[STD_VIDEO_DECODE_H265_REF_PIC_SET_LIST_SIZE]; + uint8_t RefPicSetStCurrAfter[STD_VIDEO_DECODE_H265_REF_PIC_SET_LIST_SIZE]; + uint8_t RefPicSetLtCurr[STD_VIDEO_DECODE_H265_REF_PIC_SET_LIST_SIZE]; +} StdVideoDecodeH265PictureInfo; + +typedef struct StdVideoDecodeH265ReferenceInfoFlags { + uint32_t used_for_long_term_reference : 1; + uint32_t unused_for_reference : 1; +} StdVideoDecodeH265ReferenceInfoFlags; + +typedef struct StdVideoDecodeH265ReferenceInfo { + StdVideoDecodeH265ReferenceInfoFlags flags; + int32_t PicOrderCntVal; +} StdVideoDecodeH265ReferenceInfo; + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/thirdparty/SDL/src/video/khronos/vk_video/vulkan_video_codec_h265std_encode.h b/thirdparty/SDL/src/video/khronos/vk_video/vulkan_video_codec_h265std_encode.h new file mode 100644 index 000000000..ee34491f4 --- /dev/null +++ b/thirdparty/SDL/src/video/khronos/vk_video/vulkan_video_codec_h265std_encode.h @@ -0,0 +1,157 @@ +#ifndef VULKAN_VIDEO_CODEC_H265STD_ENCODE_H_ +#define VULKAN_VIDEO_CODEC_H265STD_ENCODE_H_ 1 + +/* +** Copyright 2015-2024 The Khronos Group Inc. +** +** SPDX-License-Identifier: Apache-2.0 +*/ + +/* +** This header is generated from the Khronos Vulkan XML API Registry. +** +*/ + + +#ifdef __cplusplus +extern "C" { +#endif + + + +// vulkan_video_codec_h265std_encode is a preprocessor guard. Do not pass it to API calls. +#define vulkan_video_codec_h265std_encode 1 +#include "vulkan_video_codec_h265std.h" + +#define VK_STD_VULKAN_VIDEO_CODEC_H265_ENCODE_API_VERSION_1_0_0 VK_MAKE_VIDEO_STD_VERSION(1, 0, 0) + +#define VK_STD_VULKAN_VIDEO_CODEC_H265_ENCODE_SPEC_VERSION VK_STD_VULKAN_VIDEO_CODEC_H265_ENCODE_API_VERSION_1_0_0 +#define VK_STD_VULKAN_VIDEO_CODEC_H265_ENCODE_EXTENSION_NAME "VK_STD_vulkan_video_codec_h265_encode" +typedef struct StdVideoEncodeH265WeightTableFlags { + uint16_t luma_weight_l0_flag; + uint16_t chroma_weight_l0_flag; + uint16_t luma_weight_l1_flag; + uint16_t chroma_weight_l1_flag; +} StdVideoEncodeH265WeightTableFlags; + +typedef struct StdVideoEncodeH265WeightTable { + StdVideoEncodeH265WeightTableFlags flags; + uint8_t luma_log2_weight_denom; + int8_t delta_chroma_log2_weight_denom; + int8_t delta_luma_weight_l0[STD_VIDEO_H265_MAX_NUM_LIST_REF]; + int8_t luma_offset_l0[STD_VIDEO_H265_MAX_NUM_LIST_REF]; + int8_t delta_chroma_weight_l0[STD_VIDEO_H265_MAX_NUM_LIST_REF][STD_VIDEO_H265_MAX_CHROMA_PLANES]; + int8_t delta_chroma_offset_l0[STD_VIDEO_H265_MAX_NUM_LIST_REF][STD_VIDEO_H265_MAX_CHROMA_PLANES]; + int8_t delta_luma_weight_l1[STD_VIDEO_H265_MAX_NUM_LIST_REF]; + int8_t luma_offset_l1[STD_VIDEO_H265_MAX_NUM_LIST_REF]; + int8_t delta_chroma_weight_l1[STD_VIDEO_H265_MAX_NUM_LIST_REF][STD_VIDEO_H265_MAX_CHROMA_PLANES]; + int8_t delta_chroma_offset_l1[STD_VIDEO_H265_MAX_NUM_LIST_REF][STD_VIDEO_H265_MAX_CHROMA_PLANES]; +} StdVideoEncodeH265WeightTable; + +typedef struct StdVideoEncodeH265SliceSegmentHeaderFlags { + uint32_t first_slice_segment_in_pic_flag : 1; + uint32_t dependent_slice_segment_flag : 1; + uint32_t slice_sao_luma_flag : 1; + uint32_t slice_sao_chroma_flag : 1; + uint32_t num_ref_idx_active_override_flag : 1; + uint32_t mvd_l1_zero_flag : 1; + uint32_t cabac_init_flag : 1; + uint32_t cu_chroma_qp_offset_enabled_flag : 1; + uint32_t deblocking_filter_override_flag : 1; + uint32_t slice_deblocking_filter_disabled_flag : 1; + uint32_t collocated_from_l0_flag : 1; + uint32_t slice_loop_filter_across_slices_enabled_flag : 1; + uint32_t reserved : 20; +} StdVideoEncodeH265SliceSegmentHeaderFlags; + +typedef struct StdVideoEncodeH265SliceSegmentHeader { + StdVideoEncodeH265SliceSegmentHeaderFlags flags; + StdVideoH265SliceType slice_type; + uint32_t slice_segment_address; + uint8_t collocated_ref_idx; + uint8_t MaxNumMergeCand; + int8_t slice_cb_qp_offset; + int8_t slice_cr_qp_offset; + int8_t slice_beta_offset_div2; + int8_t slice_tc_offset_div2; + int8_t slice_act_y_qp_offset; + int8_t slice_act_cb_qp_offset; + int8_t slice_act_cr_qp_offset; + int8_t slice_qp_delta; + uint16_t reserved1; + const StdVideoEncodeH265WeightTable* pWeightTable; +} StdVideoEncodeH265SliceSegmentHeader; + +typedef struct StdVideoEncodeH265ReferenceListsInfoFlags { + uint32_t ref_pic_list_modification_flag_l0 : 1; + uint32_t ref_pic_list_modification_flag_l1 : 1; + uint32_t reserved : 30; +} StdVideoEncodeH265ReferenceListsInfoFlags; + +typedef struct StdVideoEncodeH265ReferenceListsInfo { + StdVideoEncodeH265ReferenceListsInfoFlags flags; + uint8_t num_ref_idx_l0_active_minus1; + uint8_t num_ref_idx_l1_active_minus1; + uint8_t RefPicList0[STD_VIDEO_H265_MAX_NUM_LIST_REF]; + uint8_t RefPicList1[STD_VIDEO_H265_MAX_NUM_LIST_REF]; + uint8_t list_entry_l0[STD_VIDEO_H265_MAX_NUM_LIST_REF]; + uint8_t list_entry_l1[STD_VIDEO_H265_MAX_NUM_LIST_REF]; +} StdVideoEncodeH265ReferenceListsInfo; + +typedef struct StdVideoEncodeH265PictureInfoFlags { + uint32_t is_reference : 1; + uint32_t IrapPicFlag : 1; + uint32_t used_for_long_term_reference : 1; + uint32_t discardable_flag : 1; + uint32_t cross_layer_bla_flag : 1; + uint32_t pic_output_flag : 1; + uint32_t no_output_of_prior_pics_flag : 1; + uint32_t short_term_ref_pic_set_sps_flag : 1; + uint32_t slice_temporal_mvp_enabled_flag : 1; + uint32_t reserved : 23; +} StdVideoEncodeH265PictureInfoFlags; + +typedef struct StdVideoEncodeH265LongTermRefPics { + uint8_t num_long_term_sps; + uint8_t num_long_term_pics; + uint8_t lt_idx_sps[STD_VIDEO_H265_MAX_LONG_TERM_REF_PICS_SPS]; + uint8_t poc_lsb_lt[STD_VIDEO_H265_MAX_LONG_TERM_PICS]; + uint16_t used_by_curr_pic_lt_flag; + uint8_t delta_poc_msb_present_flag[STD_VIDEO_H265_MAX_DELTA_POC]; + uint8_t delta_poc_msb_cycle_lt[STD_VIDEO_H265_MAX_DELTA_POC]; +} StdVideoEncodeH265LongTermRefPics; + +typedef struct StdVideoEncodeH265PictureInfo { + StdVideoEncodeH265PictureInfoFlags flags; + StdVideoH265PictureType pic_type; + uint8_t sps_video_parameter_set_id; + uint8_t pps_seq_parameter_set_id; + uint8_t pps_pic_parameter_set_id; + uint8_t short_term_ref_pic_set_idx; + int32_t PicOrderCntVal; + uint8_t TemporalId; + uint8_t reserved1[7]; + const StdVideoEncodeH265ReferenceListsInfo* pRefLists; + const StdVideoH265ShortTermRefPicSet* pShortTermRefPicSet; + const StdVideoEncodeH265LongTermRefPics* pLongTermRefPics; +} StdVideoEncodeH265PictureInfo; + +typedef struct StdVideoEncodeH265ReferenceInfoFlags { + uint32_t used_for_long_term_reference : 1; + uint32_t unused_for_reference : 1; + uint32_t reserved : 30; +} StdVideoEncodeH265ReferenceInfoFlags; + +typedef struct StdVideoEncodeH265ReferenceInfo { + StdVideoEncodeH265ReferenceInfoFlags flags; + StdVideoH265PictureType pic_type; + int32_t PicOrderCntVal; + uint8_t TemporalId; +} StdVideoEncodeH265ReferenceInfo; + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/thirdparty/SDL/src/video/khronos/vk_video/vulkan_video_codecs_common.h b/thirdparty/SDL/src/video/khronos/vk_video/vulkan_video_codecs_common.h new file mode 100644 index 000000000..5e6ef1db4 --- /dev/null +++ b/thirdparty/SDL/src/video/khronos/vk_video/vulkan_video_codecs_common.h @@ -0,0 +1,36 @@ +#ifndef VULKAN_VIDEO_CODECS_COMMON_H_ +#define VULKAN_VIDEO_CODECS_COMMON_H_ 1 + +/* +** Copyright 2015-2024 The Khronos Group Inc. +** +** SPDX-License-Identifier: Apache-2.0 +*/ + +/* +** This header is generated from the Khronos Vulkan XML API Registry. +** +*/ + + +#ifdef __cplusplus +extern "C" { +#endif + + + +// vulkan_video_codecs_common is a preprocessor guard. Do not pass it to API calls. +#define vulkan_video_codecs_common 1 +#if !defined(VK_NO_STDINT_H) + #include +#endif + +#define VK_MAKE_VIDEO_STD_VERSION(major, minor, patch) \ + ((((uint32_t)(major)) << 22) | (((uint32_t)(minor)) << 12) | ((uint32_t)(patch))) + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/thirdparty/SDL/src/video/khronos/vulkan/vk_icd.h b/thirdparty/SDL/src/video/khronos/vulkan/vk_icd.h index 41989ee35..59204a341 100644 --- a/thirdparty/SDL/src/video/khronos/vulkan/vk_icd.h +++ b/thirdparty/SDL/src/video/khronos/vulkan/vk_icd.h @@ -1,27 +1,11 @@ -// -// File: vk_icd.h -// /* - * Copyright (c) 2015-2016 The Khronos Group Inc. - * Copyright (c) 2015-2016 Valve Corporation - * Copyright (c) 2015-2016 LunarG, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Copyright 2015-2023 The Khronos Group Inc. + * Copyright 2015-2023 Valve Corporation + * Copyright 2015-2023 LunarG, Inc. * + * SPDX-License-Identifier: Apache-2.0 */ - -#ifndef VKICD_H -#define VKICD_H +#pragma once #include "vulkan.h" #include @@ -42,7 +26,17 @@ // call for any API version > 1.0. Otherwise, the loader will // manually determine if it can support the expected version. // Version 6 - Add support for vk_icdEnumerateAdapterPhysicalDevices. -#define CURRENT_LOADER_ICD_INTERFACE_VERSION 6 +// Version 7 - If an ICD supports any of the following functions, they must be +// queryable with vk_icdGetInstanceProcAddr: +// vk_icdNegotiateLoaderICDInterfaceVersion +// vk_icdGetPhysicalDeviceProcAddr +// vk_icdEnumerateAdapterPhysicalDevices (Windows only) +// In addition, these functions no longer need to be exported directly. +// This version allows drivers provided through the extension +// VK_LUNARG_direct_driver_loading be able to support the entire +// Driver-Loader interface. + +#define CURRENT_LOADER_ICD_INTERFACE_VERSION 7 #define MIN_SUPPORTED_LOADER_ICD_INTERFACE_VERSION 0 #define MIN_PHYS_DEV_EXTENSION_ICD_INTERFACE_VERSION 4 @@ -70,7 +64,7 @@ extern "C" { #endif VKAPI_ATTR VkResult VKAPI_CALL vk_icdNegotiateLoaderICDInterfaceVersion(uint32_t* pVersion); VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vk_icdGetInstanceProcAddr(VkInstance instance, const char* pName); - VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vk_icdGetPhysicalDeviceProcAddr(VkInstance isntance, const char* pName); + VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vk_icdGetPhysicalDeviceProcAddr(VkInstance instance, const char* pName); #if defined(VK_USE_PLATFORM_WIN32_KHR) VKAPI_ATTR VkResult VKAPI_CALL vk_icdEnumerateAdapterPhysicalDevices(VkInstance instance, LUID adapterLUID, uint32_t* pPhysicalDeviceCount, VkPhysicalDevice* pPhysicalDevices); @@ -123,6 +117,7 @@ typedef enum { VK_ICD_WSI_PLATFORM_VI, VK_ICD_WSI_PLATFORM_GGP, VK_ICD_WSI_PLATFORM_SCREEN, + VK_ICD_WSI_PLATFORM_FUCHSIA, } VkIcdWsiPlatform; typedef struct { @@ -242,4 +237,8 @@ typedef struct { } VkIcdSurfaceScreen; #endif // VK_USE_PLATFORM_SCREEN_QNX -#endif // VKICD_H +#ifdef VK_USE_PLATFORM_FUCHSIA +typedef struct { + VkIcdSurfaceBase base; +} VkIcdSurfaceImagePipe; +#endif // VK_USE_PLATFORM_FUCHSIA diff --git a/thirdparty/SDL/src/video/khronos/vulkan/vk_layer.h b/thirdparty/SDL/src/video/khronos/vulkan/vk_layer.h index 0651870c7..19d88fce4 100644 --- a/thirdparty/SDL/src/video/khronos/vulkan/vk_layer.h +++ b/thirdparty/SDL/src/video/khronos/vulkan/vk_layer.h @@ -1,39 +1,18 @@ -// -// File: vk_layer.h -// /* - * Copyright (c) 2015-2017 The Khronos Group Inc. - * Copyright (c) 2015-2017 Valve Corporation - * Copyright (c) 2015-2017 LunarG, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Copyright 2015-2023 The Khronos Group Inc. + * Copyright 2015-2023 Valve Corporation + * Copyright 2015-2023 LunarG, Inc. * + * SPDX-License-Identifier: Apache-2.0 */ +#pragma once /* Need to define dispatch table * Core struct can then have ptr to dispatch table at the top * Along with object ptrs for current and next OBJ */ -#pragma once -#include "vulkan.h" -#if defined(__GNUC__) && __GNUC__ >= 4 -#define VK_LAYER_EXPORT __attribute__((visibility("default"))) -#elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590) -#define VK_LAYER_EXPORT __attribute__((visibility("default"))) -#else -#define VK_LAYER_EXPORT -#endif +#include "vulkan_core.h" #define MAX_NUM_UNKNOWN_EXTS 250 diff --git a/thirdparty/SDL/src/video/khronos/vulkan/vk_platform.h b/thirdparty/SDL/src/video/khronos/vulkan/vk_platform.h index 3ff8c5d14..0ecd4f647 100644 --- a/thirdparty/SDL/src/video/khronos/vulkan/vk_platform.h +++ b/thirdparty/SDL/src/video/khronos/vulkan/vk_platform.h @@ -2,7 +2,7 @@ // File: vk_platform.h // /* -** Copyright 2014-2022 The Khronos Group Inc. +** Copyright 2014-2024 The Khronos Group Inc. ** ** SPDX-License-Identifier: Apache-2.0 */ diff --git a/thirdparty/SDL/src/video/khronos/vulkan/vulkan.h b/thirdparty/SDL/src/video/khronos/vulkan/vulkan.h index 004fa7095..ef94006bb 100644 --- a/thirdparty/SDL/src/video/khronos/vulkan/vulkan.h +++ b/thirdparty/SDL/src/video/khronos/vulkan/vulkan.h @@ -2,7 +2,7 @@ #define VULKAN_H_ 1 /* -** Copyright 2015-2022 The Khronos Group Inc. +** Copyright 2015-2024 The Khronos Group Inc. ** ** SPDX-License-Identifier: Apache-2.0 */ @@ -38,7 +38,6 @@ #ifdef VK_USE_PLATFORM_WAYLAND_KHR -#include #include "vulkan_wayland.h" #endif @@ -85,6 +84,14 @@ #include "vulkan_screen.h" #endif + +#ifdef VK_USE_PLATFORM_SCI +#include +#include +#include "vulkan_sci.h" +#endif + + #ifdef VK_ENABLE_BETA_EXTENSIONS #include "vulkan_beta.h" #endif diff --git a/thirdparty/SDL/src/video/khronos/vulkan/vulkan_android.h b/thirdparty/SDL/src/video/khronos/vulkan/vulkan_android.h index 11f539796..61ff40ba8 100644 --- a/thirdparty/SDL/src/video/khronos/vulkan/vulkan_android.h +++ b/thirdparty/SDL/src/video/khronos/vulkan/vulkan_android.h @@ -2,7 +2,7 @@ #define VULKAN_ANDROID_H_ 1 /* -** Copyright 2015-2022 The Khronos Group Inc. +** Copyright 2015-2024 The Khronos Group Inc. ** ** SPDX-License-Identifier: Apache-2.0 */ @@ -19,6 +19,7 @@ extern "C" { +// VK_KHR_android_surface is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_android_surface 1 struct ANativeWindow; #define VK_KHR_ANDROID_SURFACE_SPEC_VERSION 6 @@ -42,6 +43,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkCreateAndroidSurfaceKHR( #endif +// VK_ANDROID_external_memory_android_hardware_buffer is a preprocessor guard. Do not pass it to API calls. #define VK_ANDROID_external_memory_android_hardware_buffer 1 struct AHardwareBuffer; #define VK_ANDROID_EXTERNAL_MEMORY_ANDROID_HARDWARE_BUFFER_SPEC_VERSION 5 @@ -118,6 +120,32 @@ VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryAndroidHardwareBufferANDROID( struct AHardwareBuffer** pBuffer); #endif + +// VK_ANDROID_external_format_resolve is a preprocessor guard. Do not pass it to API calls. +#define VK_ANDROID_external_format_resolve 1 +#define VK_ANDROID_EXTERNAL_FORMAT_RESOLVE_SPEC_VERSION 1 +#define VK_ANDROID_EXTERNAL_FORMAT_RESOLVE_EXTENSION_NAME "VK_ANDROID_external_format_resolve" +typedef struct VkPhysicalDeviceExternalFormatResolveFeaturesANDROID { + VkStructureType sType; + void* pNext; + VkBool32 externalFormatResolve; +} VkPhysicalDeviceExternalFormatResolveFeaturesANDROID; + +typedef struct VkPhysicalDeviceExternalFormatResolvePropertiesANDROID { + VkStructureType sType; + void* pNext; + VkBool32 nullColorAttachmentWithExternalFormatResolve; + VkChromaLocation externalFormatResolveChromaOffsetX; + VkChromaLocation externalFormatResolveChromaOffsetY; +} VkPhysicalDeviceExternalFormatResolvePropertiesANDROID; + +typedef struct VkAndroidHardwareBufferFormatResolvePropertiesANDROID { + VkStructureType sType; + void* pNext; + VkFormat colorAttachmentFormat; +} VkAndroidHardwareBufferFormatResolvePropertiesANDROID; + + #ifdef __cplusplus } #endif diff --git a/thirdparty/SDL/src/video/khronos/vulkan/vulkan_beta.h b/thirdparty/SDL/src/video/khronos/vulkan/vulkan_beta.h index db03af41b..df18b4042 100644 --- a/thirdparty/SDL/src/video/khronos/vulkan/vulkan_beta.h +++ b/thirdparty/SDL/src/video/khronos/vulkan/vulkan_beta.h @@ -2,7 +2,7 @@ #define VULKAN_BETA_H_ 1 /* -** Copyright 2015-2022 The Khronos Group Inc. +** Copyright 2015-2024 The Khronos Group Inc. ** ** SPDX-License-Identifier: Apache-2.0 */ @@ -19,356 +19,7 @@ extern "C" { -#define VK_KHR_video_queue 1 -VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkVideoSessionKHR) -VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkVideoSessionParametersKHR) -#define VK_KHR_VIDEO_QUEUE_SPEC_VERSION 5 -#define VK_KHR_VIDEO_QUEUE_EXTENSION_NAME "VK_KHR_video_queue" - -typedef enum VkQueryResultStatusKHR { - VK_QUERY_RESULT_STATUS_ERROR_KHR = -1, - VK_QUERY_RESULT_STATUS_NOT_READY_KHR = 0, - VK_QUERY_RESULT_STATUS_COMPLETE_KHR = 1, - VK_QUERY_RESULT_STATUS_MAX_ENUM_KHR = 0x7FFFFFFF -} VkQueryResultStatusKHR; - -typedef enum VkVideoCodecOperationFlagBitsKHR { - VK_VIDEO_CODEC_OPERATION_NONE_KHR = 0, -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_VIDEO_CODEC_OPERATION_ENCODE_H264_BIT_EXT = 0x00010000, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_VIDEO_CODEC_OPERATION_ENCODE_H265_BIT_EXT = 0x00020000, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_EXT = 0x00000001, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_VIDEO_CODEC_OPERATION_DECODE_H265_BIT_EXT = 0x00000002, -#endif - VK_VIDEO_CODEC_OPERATION_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF -} VkVideoCodecOperationFlagBitsKHR; -typedef VkFlags VkVideoCodecOperationFlagsKHR; - -typedef enum VkVideoChromaSubsamplingFlagBitsKHR { - VK_VIDEO_CHROMA_SUBSAMPLING_INVALID_KHR = 0, - VK_VIDEO_CHROMA_SUBSAMPLING_MONOCHROME_BIT_KHR = 0x00000001, - VK_VIDEO_CHROMA_SUBSAMPLING_420_BIT_KHR = 0x00000002, - VK_VIDEO_CHROMA_SUBSAMPLING_422_BIT_KHR = 0x00000004, - VK_VIDEO_CHROMA_SUBSAMPLING_444_BIT_KHR = 0x00000008, - VK_VIDEO_CHROMA_SUBSAMPLING_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF -} VkVideoChromaSubsamplingFlagBitsKHR; -typedef VkFlags VkVideoChromaSubsamplingFlagsKHR; - -typedef enum VkVideoComponentBitDepthFlagBitsKHR { - VK_VIDEO_COMPONENT_BIT_DEPTH_INVALID_KHR = 0, - VK_VIDEO_COMPONENT_BIT_DEPTH_8_BIT_KHR = 0x00000001, - VK_VIDEO_COMPONENT_BIT_DEPTH_10_BIT_KHR = 0x00000004, - VK_VIDEO_COMPONENT_BIT_DEPTH_12_BIT_KHR = 0x00000010, - VK_VIDEO_COMPONENT_BIT_DEPTH_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF -} VkVideoComponentBitDepthFlagBitsKHR; -typedef VkFlags VkVideoComponentBitDepthFlagsKHR; - -typedef enum VkVideoCapabilityFlagBitsKHR { - VK_VIDEO_CAPABILITY_PROTECTED_CONTENT_BIT_KHR = 0x00000001, - VK_VIDEO_CAPABILITY_SEPARATE_REFERENCE_IMAGES_BIT_KHR = 0x00000002, - VK_VIDEO_CAPABILITY_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF -} VkVideoCapabilityFlagBitsKHR; -typedef VkFlags VkVideoCapabilityFlagsKHR; - -typedef enum VkVideoSessionCreateFlagBitsKHR { - VK_VIDEO_SESSION_CREATE_PROTECTED_CONTENT_BIT_KHR = 0x00000001, - VK_VIDEO_SESSION_CREATE_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF -} VkVideoSessionCreateFlagBitsKHR; -typedef VkFlags VkVideoSessionCreateFlagsKHR; -typedef VkFlags VkVideoSessionParametersCreateFlagsKHR; -typedef VkFlags VkVideoBeginCodingFlagsKHR; -typedef VkFlags VkVideoEndCodingFlagsKHR; - -typedef enum VkVideoCodingControlFlagBitsKHR { - VK_VIDEO_CODING_CONTROL_RESET_BIT_KHR = 0x00000001, -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_VIDEO_CODING_CONTROL_ENCODE_RATE_CONTROL_BIT_KHR = 0x00000002, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_VIDEO_CODING_CONTROL_ENCODE_RATE_CONTROL_LAYER_BIT_KHR = 0x00000004, -#endif - VK_VIDEO_CODING_CONTROL_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF -} VkVideoCodingControlFlagBitsKHR; -typedef VkFlags VkVideoCodingControlFlagsKHR; -typedef struct VkQueueFamilyQueryResultStatusPropertiesKHR { - VkStructureType sType; - void* pNext; - VkBool32 queryResultStatusSupport; -} VkQueueFamilyQueryResultStatusPropertiesKHR; - -typedef struct VkQueueFamilyVideoPropertiesKHR { - VkStructureType sType; - void* pNext; - VkVideoCodecOperationFlagsKHR videoCodecOperations; -} VkQueueFamilyVideoPropertiesKHR; - -typedef struct VkVideoProfileInfoKHR { - VkStructureType sType; - const void* pNext; - VkVideoCodecOperationFlagBitsKHR videoCodecOperation; - VkVideoChromaSubsamplingFlagsKHR chromaSubsampling; - VkVideoComponentBitDepthFlagsKHR lumaBitDepth; - VkVideoComponentBitDepthFlagsKHR chromaBitDepth; -} VkVideoProfileInfoKHR; - -typedef struct VkVideoProfileListInfoKHR { - VkStructureType sType; - const void* pNext; - uint32_t profileCount; - const VkVideoProfileInfoKHR* pProfiles; -} VkVideoProfileListInfoKHR; - -typedef struct VkVideoCapabilitiesKHR { - VkStructureType sType; - void* pNext; - VkVideoCapabilityFlagsKHR capabilityFlags; - VkDeviceSize minBitstreamBufferOffsetAlignment; - VkDeviceSize minBitstreamBufferSizeAlignment; - VkExtent2D videoPictureExtentGranularity; - VkExtent2D minExtent; - VkExtent2D maxExtent; - uint32_t maxReferencePicturesSlotsCount; - uint32_t maxReferencePicturesActiveCount; - VkExtensionProperties stdHeaderVersion; -} VkVideoCapabilitiesKHR; - -typedef struct VkPhysicalDeviceVideoFormatInfoKHR { - VkStructureType sType; - const void* pNext; - VkImageUsageFlags imageUsage; -} VkPhysicalDeviceVideoFormatInfoKHR; - -typedef struct VkVideoFormatPropertiesKHR { - VkStructureType sType; - void* pNext; - VkFormat format; - VkComponentMapping componentMapping; - VkImageCreateFlags imageCreateFlags; - VkImageType imageType; - VkImageTiling imageTiling; - VkImageUsageFlags imageUsageFlags; -} VkVideoFormatPropertiesKHR; - -typedef struct VkVideoPictureResourceInfoKHR { - VkStructureType sType; - const void* pNext; - VkOffset2D codedOffset; - VkExtent2D codedExtent; - uint32_t baseArrayLayer; - VkImageView imageViewBinding; -} VkVideoPictureResourceInfoKHR; - -typedef struct VkVideoReferenceSlotInfoKHR { - VkStructureType sType; - const void* pNext; - int8_t slotIndex; - const VkVideoPictureResourceInfoKHR* pPictureResource; -} VkVideoReferenceSlotInfoKHR; - -typedef struct VkVideoSessionMemoryRequirementsKHR { - VkStructureType sType; - void* pNext; - uint32_t memoryBindIndex; - VkMemoryRequirements memoryRequirements; -} VkVideoSessionMemoryRequirementsKHR; - -typedef struct VkBindVideoSessionMemoryInfoKHR { - VkStructureType sType; - const void* pNext; - uint32_t memoryBindIndex; - VkDeviceMemory memory; - VkDeviceSize memoryOffset; - VkDeviceSize memorySize; -} VkBindVideoSessionMemoryInfoKHR; - -typedef struct VkVideoSessionCreateInfoKHR { - VkStructureType sType; - const void* pNext; - uint32_t queueFamilyIndex; - VkVideoSessionCreateFlagsKHR flags; - const VkVideoProfileInfoKHR* pVideoProfile; - VkFormat pictureFormat; - VkExtent2D maxCodedExtent; - VkFormat referencePicturesFormat; - uint32_t maxReferencePicturesSlotsCount; - uint32_t maxReferencePicturesActiveCount; - const VkExtensionProperties* pStdHeaderVersion; -} VkVideoSessionCreateInfoKHR; - -typedef struct VkVideoSessionParametersCreateInfoKHR { - VkStructureType sType; - const void* pNext; - VkVideoSessionParametersCreateFlagsKHR flags; - VkVideoSessionParametersKHR videoSessionParametersTemplate; - VkVideoSessionKHR videoSession; -} VkVideoSessionParametersCreateInfoKHR; - -typedef struct VkVideoSessionParametersUpdateInfoKHR { - VkStructureType sType; - const void* pNext; - uint32_t updateSequenceCount; -} VkVideoSessionParametersUpdateInfoKHR; - -typedef struct VkVideoBeginCodingInfoKHR { - VkStructureType sType; - const void* pNext; - VkVideoBeginCodingFlagsKHR flags; - VkVideoSessionKHR videoSession; - VkVideoSessionParametersKHR videoSessionParameters; - uint32_t referenceSlotCount; - const VkVideoReferenceSlotInfoKHR* pReferenceSlots; -} VkVideoBeginCodingInfoKHR; - -typedef struct VkVideoEndCodingInfoKHR { - VkStructureType sType; - const void* pNext; - VkVideoEndCodingFlagsKHR flags; -} VkVideoEndCodingInfoKHR; - -typedef struct VkVideoCodingControlInfoKHR { - VkStructureType sType; - const void* pNext; - VkVideoCodingControlFlagsKHR flags; -} VkVideoCodingControlInfoKHR; - -typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceVideoCapabilitiesKHR)(VkPhysicalDevice physicalDevice, const VkVideoProfileInfoKHR* pVideoProfile, VkVideoCapabilitiesKHR* pCapabilities); -typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceVideoFormatPropertiesKHR)(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceVideoFormatInfoKHR* pVideoFormatInfo, uint32_t* pVideoFormatPropertyCount, VkVideoFormatPropertiesKHR* pVideoFormatProperties); -typedef VkResult (VKAPI_PTR *PFN_vkCreateVideoSessionKHR)(VkDevice device, const VkVideoSessionCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkVideoSessionKHR* pVideoSession); -typedef void (VKAPI_PTR *PFN_vkDestroyVideoSessionKHR)(VkDevice device, VkVideoSessionKHR videoSession, const VkAllocationCallbacks* pAllocator); -typedef VkResult (VKAPI_PTR *PFN_vkGetVideoSessionMemoryRequirementsKHR)(VkDevice device, VkVideoSessionKHR videoSession, uint32_t* pMemoryRequirementsCount, VkVideoSessionMemoryRequirementsKHR* pMemoryRequirements); -typedef VkResult (VKAPI_PTR *PFN_vkBindVideoSessionMemoryKHR)(VkDevice device, VkVideoSessionKHR videoSession, uint32_t bindSessionMemoryInfoCount, const VkBindVideoSessionMemoryInfoKHR* pBindSessionMemoryInfos); -typedef VkResult (VKAPI_PTR *PFN_vkCreateVideoSessionParametersKHR)(VkDevice device, const VkVideoSessionParametersCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkVideoSessionParametersKHR* pVideoSessionParameters); -typedef VkResult (VKAPI_PTR *PFN_vkUpdateVideoSessionParametersKHR)(VkDevice device, VkVideoSessionParametersKHR videoSessionParameters, const VkVideoSessionParametersUpdateInfoKHR* pUpdateInfo); -typedef void (VKAPI_PTR *PFN_vkDestroyVideoSessionParametersKHR)(VkDevice device, VkVideoSessionParametersKHR videoSessionParameters, const VkAllocationCallbacks* pAllocator); -typedef void (VKAPI_PTR *PFN_vkCmdBeginVideoCodingKHR)(VkCommandBuffer commandBuffer, const VkVideoBeginCodingInfoKHR* pBeginInfo); -typedef void (VKAPI_PTR *PFN_vkCmdEndVideoCodingKHR)(VkCommandBuffer commandBuffer, const VkVideoEndCodingInfoKHR* pEndCodingInfo); -typedef void (VKAPI_PTR *PFN_vkCmdControlVideoCodingKHR)(VkCommandBuffer commandBuffer, const VkVideoCodingControlInfoKHR* pCodingControlInfo); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceVideoCapabilitiesKHR( - VkPhysicalDevice physicalDevice, - const VkVideoProfileInfoKHR* pVideoProfile, - VkVideoCapabilitiesKHR* pCapabilities); - -VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceVideoFormatPropertiesKHR( - VkPhysicalDevice physicalDevice, - const VkPhysicalDeviceVideoFormatInfoKHR* pVideoFormatInfo, - uint32_t* pVideoFormatPropertyCount, - VkVideoFormatPropertiesKHR* pVideoFormatProperties); - -VKAPI_ATTR VkResult VKAPI_CALL vkCreateVideoSessionKHR( - VkDevice device, - const VkVideoSessionCreateInfoKHR* pCreateInfo, - const VkAllocationCallbacks* pAllocator, - VkVideoSessionKHR* pVideoSession); - -VKAPI_ATTR void VKAPI_CALL vkDestroyVideoSessionKHR( - VkDevice device, - VkVideoSessionKHR videoSession, - const VkAllocationCallbacks* pAllocator); - -VKAPI_ATTR VkResult VKAPI_CALL vkGetVideoSessionMemoryRequirementsKHR( - VkDevice device, - VkVideoSessionKHR videoSession, - uint32_t* pMemoryRequirementsCount, - VkVideoSessionMemoryRequirementsKHR* pMemoryRequirements); - -VKAPI_ATTR VkResult VKAPI_CALL vkBindVideoSessionMemoryKHR( - VkDevice device, - VkVideoSessionKHR videoSession, - uint32_t bindSessionMemoryInfoCount, - const VkBindVideoSessionMemoryInfoKHR* pBindSessionMemoryInfos); - -VKAPI_ATTR VkResult VKAPI_CALL vkCreateVideoSessionParametersKHR( - VkDevice device, - const VkVideoSessionParametersCreateInfoKHR* pCreateInfo, - const VkAllocationCallbacks* pAllocator, - VkVideoSessionParametersKHR* pVideoSessionParameters); - -VKAPI_ATTR VkResult VKAPI_CALL vkUpdateVideoSessionParametersKHR( - VkDevice device, - VkVideoSessionParametersKHR videoSessionParameters, - const VkVideoSessionParametersUpdateInfoKHR* pUpdateInfo); - -VKAPI_ATTR void VKAPI_CALL vkDestroyVideoSessionParametersKHR( - VkDevice device, - VkVideoSessionParametersKHR videoSessionParameters, - const VkAllocationCallbacks* pAllocator); - -VKAPI_ATTR void VKAPI_CALL vkCmdBeginVideoCodingKHR( - VkCommandBuffer commandBuffer, - const VkVideoBeginCodingInfoKHR* pBeginInfo); - -VKAPI_ATTR void VKAPI_CALL vkCmdEndVideoCodingKHR( - VkCommandBuffer commandBuffer, - const VkVideoEndCodingInfoKHR* pEndCodingInfo); - -VKAPI_ATTR void VKAPI_CALL vkCmdControlVideoCodingKHR( - VkCommandBuffer commandBuffer, - const VkVideoCodingControlInfoKHR* pCodingControlInfo); -#endif - - -#define VK_KHR_video_decode_queue 1 -#define VK_KHR_VIDEO_DECODE_QUEUE_SPEC_VERSION 6 -#define VK_KHR_VIDEO_DECODE_QUEUE_EXTENSION_NAME "VK_KHR_video_decode_queue" - -typedef enum VkVideoDecodeCapabilityFlagBitsKHR { - VK_VIDEO_DECODE_CAPABILITY_DPB_AND_OUTPUT_COINCIDE_BIT_KHR = 0x00000001, - VK_VIDEO_DECODE_CAPABILITY_DPB_AND_OUTPUT_DISTINCT_BIT_KHR = 0x00000002, - VK_VIDEO_DECODE_CAPABILITY_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF -} VkVideoDecodeCapabilityFlagBitsKHR; -typedef VkFlags VkVideoDecodeCapabilityFlagsKHR; - -typedef enum VkVideoDecodeUsageFlagBitsKHR { - VK_VIDEO_DECODE_USAGE_DEFAULT_KHR = 0, - VK_VIDEO_DECODE_USAGE_TRANSCODING_BIT_KHR = 0x00000001, - VK_VIDEO_DECODE_USAGE_OFFLINE_BIT_KHR = 0x00000002, - VK_VIDEO_DECODE_USAGE_STREAMING_BIT_KHR = 0x00000004, - VK_VIDEO_DECODE_USAGE_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF -} VkVideoDecodeUsageFlagBitsKHR; -typedef VkFlags VkVideoDecodeUsageFlagsKHR; -typedef VkFlags VkVideoDecodeFlagsKHR; -typedef struct VkVideoDecodeCapabilitiesKHR { - VkStructureType sType; - void* pNext; - VkVideoDecodeCapabilityFlagsKHR flags; -} VkVideoDecodeCapabilitiesKHR; - -typedef struct VkVideoDecodeUsageInfoKHR { - VkStructureType sType; - const void* pNext; - VkVideoDecodeUsageFlagsKHR videoUsageHints; -} VkVideoDecodeUsageInfoKHR; - -typedef struct VkVideoDecodeInfoKHR { - VkStructureType sType; - const void* pNext; - VkVideoDecodeFlagsKHR flags; - VkBuffer srcBuffer; - VkDeviceSize srcBufferOffset; - VkDeviceSize srcBufferRange; - VkVideoPictureResourceInfoKHR dstPictureResource; - const VkVideoReferenceSlotInfoKHR* pSetupReferenceSlot; - uint32_t referenceSlotCount; - const VkVideoReferenceSlotInfoKHR* pReferenceSlots; -} VkVideoDecodeInfoKHR; - -typedef void (VKAPI_PTR *PFN_vkCmdDecodeVideoKHR)(VkCommandBuffer commandBuffer, const VkVideoDecodeInfoKHR* pFrameInfo); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR void VKAPI_CALL vkCmdDecodeVideoKHR( - VkCommandBuffer commandBuffer, - const VkVideoDecodeInfoKHR* pFrameInfo); -#endif - - +// VK_KHR_portability_subset is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_portability_subset 1 #define VK_KHR_PORTABILITY_SUBSET_SPEC_VERSION 1 #define VK_KHR_PORTABILITY_SUBSET_EXTENSION_NAME "VK_KHR_portability_subset" @@ -400,617 +51,162 @@ typedef struct VkPhysicalDevicePortabilitySubsetPropertiesKHR { -#define VK_KHR_video_encode_queue 1 -#define VK_KHR_VIDEO_ENCODE_QUEUE_SPEC_VERSION 7 -#define VK_KHR_VIDEO_ENCODE_QUEUE_EXTENSION_NAME "VK_KHR_video_encode_queue" - -typedef enum VkVideoEncodeTuningModeKHR { - VK_VIDEO_ENCODE_TUNING_MODE_DEFAULT_KHR = 0, - VK_VIDEO_ENCODE_TUNING_MODE_HIGH_QUALITY_KHR = 1, - VK_VIDEO_ENCODE_TUNING_MODE_LOW_LATENCY_KHR = 2, - VK_VIDEO_ENCODE_TUNING_MODE_ULTRA_LOW_LATENCY_KHR = 3, - VK_VIDEO_ENCODE_TUNING_MODE_LOSSLESS_KHR = 4, - VK_VIDEO_ENCODE_TUNING_MODE_MAX_ENUM_KHR = 0x7FFFFFFF -} VkVideoEncodeTuningModeKHR; -typedef VkFlags VkVideoEncodeFlagsKHR; - -typedef enum VkVideoEncodeCapabilityFlagBitsKHR { - VK_VIDEO_ENCODE_CAPABILITY_PRECEDING_EXTERNALLY_ENCODED_BYTES_BIT_KHR = 0x00000001, - VK_VIDEO_ENCODE_CAPABILITY_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF -} VkVideoEncodeCapabilityFlagBitsKHR; -typedef VkFlags VkVideoEncodeCapabilityFlagsKHR; - -typedef enum VkVideoEncodeRateControlModeFlagBitsKHR { - VK_VIDEO_ENCODE_RATE_CONTROL_MODE_NONE_BIT_KHR = 0, - VK_VIDEO_ENCODE_RATE_CONTROL_MODE_CBR_BIT_KHR = 1, - VK_VIDEO_ENCODE_RATE_CONTROL_MODE_VBR_BIT_KHR = 2, - VK_VIDEO_ENCODE_RATE_CONTROL_MODE_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF -} VkVideoEncodeRateControlModeFlagBitsKHR; -typedef VkFlags VkVideoEncodeRateControlModeFlagsKHR; - -typedef enum VkVideoEncodeUsageFlagBitsKHR { - VK_VIDEO_ENCODE_USAGE_DEFAULT_KHR = 0, - VK_VIDEO_ENCODE_USAGE_TRANSCODING_BIT_KHR = 0x00000001, - VK_VIDEO_ENCODE_USAGE_STREAMING_BIT_KHR = 0x00000002, - VK_VIDEO_ENCODE_USAGE_RECORDING_BIT_KHR = 0x00000004, - VK_VIDEO_ENCODE_USAGE_CONFERENCING_BIT_KHR = 0x00000008, - VK_VIDEO_ENCODE_USAGE_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF -} VkVideoEncodeUsageFlagBitsKHR; -typedef VkFlags VkVideoEncodeUsageFlagsKHR; - -typedef enum VkVideoEncodeContentFlagBitsKHR { - VK_VIDEO_ENCODE_CONTENT_DEFAULT_KHR = 0, - VK_VIDEO_ENCODE_CONTENT_CAMERA_BIT_KHR = 0x00000001, - VK_VIDEO_ENCODE_CONTENT_DESKTOP_BIT_KHR = 0x00000002, - VK_VIDEO_ENCODE_CONTENT_RENDERED_BIT_KHR = 0x00000004, - VK_VIDEO_ENCODE_CONTENT_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF -} VkVideoEncodeContentFlagBitsKHR; -typedef VkFlags VkVideoEncodeContentFlagsKHR; -typedef VkFlags VkVideoEncodeRateControlFlagsKHR; -typedef struct VkVideoEncodeInfoKHR { - VkStructureType sType; - const void* pNext; - VkVideoEncodeFlagsKHR flags; - uint32_t qualityLevel; - VkBuffer dstBitstreamBuffer; - VkDeviceSize dstBitstreamBufferOffset; - VkDeviceSize dstBitstreamBufferMaxRange; - VkVideoPictureResourceInfoKHR srcPictureResource; - const VkVideoReferenceSlotInfoKHR* pSetupReferenceSlot; - uint32_t referenceSlotCount; - const VkVideoReferenceSlotInfoKHR* pReferenceSlots; - uint32_t precedingExternallyEncodedBytes; -} VkVideoEncodeInfoKHR; - -typedef struct VkVideoEncodeCapabilitiesKHR { - VkStructureType sType; - void* pNext; - VkVideoEncodeCapabilityFlagsKHR flags; - VkVideoEncodeRateControlModeFlagsKHR rateControlModes; - uint8_t rateControlLayerCount; - uint8_t qualityLevelCount; - VkExtent2D inputImageDataFillAlignment; -} VkVideoEncodeCapabilitiesKHR; - -typedef struct VkVideoEncodeUsageInfoKHR { - VkStructureType sType; - const void* pNext; - VkVideoEncodeUsageFlagsKHR videoUsageHints; - VkVideoEncodeContentFlagsKHR videoContentHints; - VkVideoEncodeTuningModeKHR tuningMode; -} VkVideoEncodeUsageInfoKHR; - -typedef struct VkVideoEncodeRateControlLayerInfoKHR { +// VK_AMDX_shader_enqueue is a preprocessor guard. Do not pass it to API calls. +#define VK_AMDX_shader_enqueue 1 +#define VK_AMDX_SHADER_ENQUEUE_SPEC_VERSION 1 +#define VK_AMDX_SHADER_ENQUEUE_EXTENSION_NAME "VK_AMDX_shader_enqueue" +#define VK_SHADER_INDEX_UNUSED_AMDX (~0U) +typedef struct VkPhysicalDeviceShaderEnqueueFeaturesAMDX { VkStructureType sType; - const void* pNext; - uint32_t averageBitrate; - uint32_t maxBitrate; - uint32_t frameRateNumerator; - uint32_t frameRateDenominator; - uint32_t virtualBufferSizeInMs; - uint32_t initialVirtualBufferSizeInMs; -} VkVideoEncodeRateControlLayerInfoKHR; - -typedef struct VkVideoEncodeRateControlInfoKHR { - VkStructureType sType; - const void* pNext; - VkVideoEncodeRateControlFlagsKHR flags; - VkVideoEncodeRateControlModeFlagBitsKHR rateControlMode; - uint8_t layerCount; - const VkVideoEncodeRateControlLayerInfoKHR* pLayerConfigs; -} VkVideoEncodeRateControlInfoKHR; - -typedef void (VKAPI_PTR *PFN_vkCmdEncodeVideoKHR)(VkCommandBuffer commandBuffer, const VkVideoEncodeInfoKHR* pEncodeInfo); + void* pNext; + VkBool32 shaderEnqueue; +} VkPhysicalDeviceShaderEnqueueFeaturesAMDX; + +typedef struct VkPhysicalDeviceShaderEnqueuePropertiesAMDX { + VkStructureType sType; + void* pNext; + uint32_t maxExecutionGraphDepth; + uint32_t maxExecutionGraphShaderOutputNodes; + uint32_t maxExecutionGraphShaderPayloadSize; + uint32_t maxExecutionGraphShaderPayloadCount; + uint32_t executionGraphDispatchAddressAlignment; +} VkPhysicalDeviceShaderEnqueuePropertiesAMDX; + +typedef struct VkExecutionGraphPipelineScratchSizeAMDX { + VkStructureType sType; + void* pNext; + VkDeviceSize size; +} VkExecutionGraphPipelineScratchSizeAMDX; + +typedef struct VkExecutionGraphPipelineCreateInfoAMDX { + VkStructureType sType; + const void* pNext; + VkPipelineCreateFlags flags; + uint32_t stageCount; + const VkPipelineShaderStageCreateInfo* pStages; + const VkPipelineLibraryCreateInfoKHR* pLibraryInfo; + VkPipelineLayout layout; + VkPipeline basePipelineHandle; + int32_t basePipelineIndex; +} VkExecutionGraphPipelineCreateInfoAMDX; + +typedef union VkDeviceOrHostAddressConstAMDX { + VkDeviceAddress deviceAddress; + const void* hostAddress; +} VkDeviceOrHostAddressConstAMDX; + +typedef struct VkDispatchGraphInfoAMDX { + uint32_t nodeIndex; + uint32_t payloadCount; + VkDeviceOrHostAddressConstAMDX payloads; + uint64_t payloadStride; +} VkDispatchGraphInfoAMDX; + +typedef struct VkDispatchGraphCountInfoAMDX { + uint32_t count; + VkDeviceOrHostAddressConstAMDX infos; + uint64_t stride; +} VkDispatchGraphCountInfoAMDX; + +typedef struct VkPipelineShaderStageNodeCreateInfoAMDX { + VkStructureType sType; + const void* pNext; + const char* pName; + uint32_t index; +} VkPipelineShaderStageNodeCreateInfoAMDX; + +typedef VkResult (VKAPI_PTR *PFN_vkCreateExecutionGraphPipelinesAMDX)(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount, const VkExecutionGraphPipelineCreateInfoAMDX* pCreateInfos, const VkAllocationCallbacks* pAllocator, VkPipeline* pPipelines); +typedef VkResult (VKAPI_PTR *PFN_vkGetExecutionGraphPipelineScratchSizeAMDX)(VkDevice device, VkPipeline executionGraph, VkExecutionGraphPipelineScratchSizeAMDX* pSizeInfo); +typedef VkResult (VKAPI_PTR *PFN_vkGetExecutionGraphPipelineNodeIndexAMDX)(VkDevice device, VkPipeline executionGraph, const VkPipelineShaderStageNodeCreateInfoAMDX* pNodeInfo, uint32_t* pNodeIndex); +typedef void (VKAPI_PTR *PFN_vkCmdInitializeGraphScratchMemoryAMDX)(VkCommandBuffer commandBuffer, VkDeviceAddress scratch); +typedef void (VKAPI_PTR *PFN_vkCmdDispatchGraphAMDX)(VkCommandBuffer commandBuffer, VkDeviceAddress scratch, const VkDispatchGraphCountInfoAMDX* pCountInfo); +typedef void (VKAPI_PTR *PFN_vkCmdDispatchGraphIndirectAMDX)(VkCommandBuffer commandBuffer, VkDeviceAddress scratch, const VkDispatchGraphCountInfoAMDX* pCountInfo); +typedef void (VKAPI_PTR *PFN_vkCmdDispatchGraphIndirectCountAMDX)(VkCommandBuffer commandBuffer, VkDeviceAddress scratch, VkDeviceAddress countInfo); #ifndef VK_NO_PROTOTYPES -VKAPI_ATTR void VKAPI_CALL vkCmdEncodeVideoKHR( +VKAPI_ATTR VkResult VKAPI_CALL vkCreateExecutionGraphPipelinesAMDX( + VkDevice device, + VkPipelineCache pipelineCache, + uint32_t createInfoCount, + const VkExecutionGraphPipelineCreateInfoAMDX* pCreateInfos, + const VkAllocationCallbacks* pAllocator, + VkPipeline* pPipelines); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetExecutionGraphPipelineScratchSizeAMDX( + VkDevice device, + VkPipeline executionGraph, + VkExecutionGraphPipelineScratchSizeAMDX* pSizeInfo); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetExecutionGraphPipelineNodeIndexAMDX( + VkDevice device, + VkPipeline executionGraph, + const VkPipelineShaderStageNodeCreateInfoAMDX* pNodeInfo, + uint32_t* pNodeIndex); + +VKAPI_ATTR void VKAPI_CALL vkCmdInitializeGraphScratchMemoryAMDX( VkCommandBuffer commandBuffer, - const VkVideoEncodeInfoKHR* pEncodeInfo); + VkDeviceAddress scratch); + +VKAPI_ATTR void VKAPI_CALL vkCmdDispatchGraphAMDX( + VkCommandBuffer commandBuffer, + VkDeviceAddress scratch, + const VkDispatchGraphCountInfoAMDX* pCountInfo); + +VKAPI_ATTR void VKAPI_CALL vkCmdDispatchGraphIndirectAMDX( + VkCommandBuffer commandBuffer, + VkDeviceAddress scratch, + const VkDispatchGraphCountInfoAMDX* pCountInfo); + +VKAPI_ATTR void VKAPI_CALL vkCmdDispatchGraphIndirectCountAMDX( + VkCommandBuffer commandBuffer, + VkDeviceAddress scratch, + VkDeviceAddress countInfo); #endif -#define VK_EXT_video_encode_h264 1 -#include "vk_video/vulkan_video_codec_h264std.h" -#include "vk_video/vulkan_video_codec_h264std_encode.h" -#define VK_EXT_VIDEO_ENCODE_H264_SPEC_VERSION 8 -#define VK_EXT_VIDEO_ENCODE_H264_EXTENSION_NAME "VK_EXT_video_encode_h264" - -typedef enum VkVideoEncodeH264RateControlStructureEXT { - VK_VIDEO_ENCODE_H264_RATE_CONTROL_STRUCTURE_UNKNOWN_EXT = 0, - VK_VIDEO_ENCODE_H264_RATE_CONTROL_STRUCTURE_FLAT_EXT = 1, - VK_VIDEO_ENCODE_H264_RATE_CONTROL_STRUCTURE_DYADIC_EXT = 2, - VK_VIDEO_ENCODE_H264_RATE_CONTROL_STRUCTURE_MAX_ENUM_EXT = 0x7FFFFFFF -} VkVideoEncodeH264RateControlStructureEXT; - -typedef enum VkVideoEncodeH264CapabilityFlagBitsEXT { - VK_VIDEO_ENCODE_H264_CAPABILITY_DIRECT_8X8_INFERENCE_ENABLED_BIT_EXT = 0x00000001, - VK_VIDEO_ENCODE_H264_CAPABILITY_DIRECT_8X8_INFERENCE_DISABLED_BIT_EXT = 0x00000002, - VK_VIDEO_ENCODE_H264_CAPABILITY_SEPARATE_COLOUR_PLANE_BIT_EXT = 0x00000004, - VK_VIDEO_ENCODE_H264_CAPABILITY_QPPRIME_Y_ZERO_TRANSFORM_BYPASS_BIT_EXT = 0x00000008, - VK_VIDEO_ENCODE_H264_CAPABILITY_SCALING_LISTS_BIT_EXT = 0x00000010, - VK_VIDEO_ENCODE_H264_CAPABILITY_HRD_COMPLIANCE_BIT_EXT = 0x00000020, - VK_VIDEO_ENCODE_H264_CAPABILITY_CHROMA_QP_OFFSET_BIT_EXT = 0x00000040, - VK_VIDEO_ENCODE_H264_CAPABILITY_SECOND_CHROMA_QP_OFFSET_BIT_EXT = 0x00000080, - VK_VIDEO_ENCODE_H264_CAPABILITY_PIC_INIT_QP_MINUS26_BIT_EXT = 0x00000100, - VK_VIDEO_ENCODE_H264_CAPABILITY_WEIGHTED_PRED_BIT_EXT = 0x00000200, - VK_VIDEO_ENCODE_H264_CAPABILITY_WEIGHTED_BIPRED_EXPLICIT_BIT_EXT = 0x00000400, - VK_VIDEO_ENCODE_H264_CAPABILITY_WEIGHTED_BIPRED_IMPLICIT_BIT_EXT = 0x00000800, - VK_VIDEO_ENCODE_H264_CAPABILITY_WEIGHTED_PRED_NO_TABLE_BIT_EXT = 0x00001000, - VK_VIDEO_ENCODE_H264_CAPABILITY_TRANSFORM_8X8_BIT_EXT = 0x00002000, - VK_VIDEO_ENCODE_H264_CAPABILITY_CABAC_BIT_EXT = 0x00004000, - VK_VIDEO_ENCODE_H264_CAPABILITY_CAVLC_BIT_EXT = 0x00008000, - VK_VIDEO_ENCODE_H264_CAPABILITY_DEBLOCKING_FILTER_DISABLED_BIT_EXT = 0x00010000, - VK_VIDEO_ENCODE_H264_CAPABILITY_DEBLOCKING_FILTER_ENABLED_BIT_EXT = 0x00020000, - VK_VIDEO_ENCODE_H264_CAPABILITY_DEBLOCKING_FILTER_PARTIAL_BIT_EXT = 0x00040000, - VK_VIDEO_ENCODE_H264_CAPABILITY_DISABLE_DIRECT_SPATIAL_MV_PRED_BIT_EXT = 0x00080000, - VK_VIDEO_ENCODE_H264_CAPABILITY_MULTIPLE_SLICE_PER_FRAME_BIT_EXT = 0x00100000, - VK_VIDEO_ENCODE_H264_CAPABILITY_SLICE_MB_COUNT_BIT_EXT = 0x00200000, - VK_VIDEO_ENCODE_H264_CAPABILITY_ROW_UNALIGNED_SLICE_BIT_EXT = 0x00400000, - VK_VIDEO_ENCODE_H264_CAPABILITY_DIFFERENT_SLICE_TYPE_BIT_EXT = 0x00800000, - VK_VIDEO_ENCODE_H264_CAPABILITY_B_FRAME_IN_L1_LIST_BIT_EXT = 0x01000000, - VK_VIDEO_ENCODE_H264_CAPABILITY_FLAG_BITS_MAX_ENUM_EXT = 0x7FFFFFFF -} VkVideoEncodeH264CapabilityFlagBitsEXT; -typedef VkFlags VkVideoEncodeH264CapabilityFlagsEXT; - -typedef enum VkVideoEncodeH264InputModeFlagBitsEXT { - VK_VIDEO_ENCODE_H264_INPUT_MODE_FRAME_BIT_EXT = 0x00000001, - VK_VIDEO_ENCODE_H264_INPUT_MODE_SLICE_BIT_EXT = 0x00000002, - VK_VIDEO_ENCODE_H264_INPUT_MODE_NON_VCL_BIT_EXT = 0x00000004, - VK_VIDEO_ENCODE_H264_INPUT_MODE_FLAG_BITS_MAX_ENUM_EXT = 0x7FFFFFFF -} VkVideoEncodeH264InputModeFlagBitsEXT; -typedef VkFlags VkVideoEncodeH264InputModeFlagsEXT; - -typedef enum VkVideoEncodeH264OutputModeFlagBitsEXT { - VK_VIDEO_ENCODE_H264_OUTPUT_MODE_FRAME_BIT_EXT = 0x00000001, - VK_VIDEO_ENCODE_H264_OUTPUT_MODE_SLICE_BIT_EXT = 0x00000002, - VK_VIDEO_ENCODE_H264_OUTPUT_MODE_NON_VCL_BIT_EXT = 0x00000004, - VK_VIDEO_ENCODE_H264_OUTPUT_MODE_FLAG_BITS_MAX_ENUM_EXT = 0x7FFFFFFF -} VkVideoEncodeH264OutputModeFlagBitsEXT; -typedef VkFlags VkVideoEncodeH264OutputModeFlagsEXT; -typedef struct VkVideoEncodeH264CapabilitiesEXT { - VkStructureType sType; - void* pNext; - VkVideoEncodeH264CapabilityFlagsEXT flags; - VkVideoEncodeH264InputModeFlagsEXT inputModeFlags; - VkVideoEncodeH264OutputModeFlagsEXT outputModeFlags; - uint8_t maxPPictureL0ReferenceCount; - uint8_t maxBPictureL0ReferenceCount; - uint8_t maxL1ReferenceCount; - VkBool32 motionVectorsOverPicBoundariesFlag; - uint32_t maxBytesPerPicDenom; - uint32_t maxBitsPerMbDenom; - uint32_t log2MaxMvLengthHorizontal; - uint32_t log2MaxMvLengthVertical; -} VkVideoEncodeH264CapabilitiesEXT; - -typedef struct VkVideoEncodeH264SessionParametersAddInfoEXT { - VkStructureType sType; - const void* pNext; - uint32_t spsStdCount; - const StdVideoH264SequenceParameterSet* pSpsStd; - uint32_t ppsStdCount; - const StdVideoH264PictureParameterSet* pPpsStd; -} VkVideoEncodeH264SessionParametersAddInfoEXT; - -typedef struct VkVideoEncodeH264SessionParametersCreateInfoEXT { - VkStructureType sType; - const void* pNext; - uint32_t maxSpsStdCount; - uint32_t maxPpsStdCount; - const VkVideoEncodeH264SessionParametersAddInfoEXT* pParametersAddInfo; -} VkVideoEncodeH264SessionParametersCreateInfoEXT; - -typedef struct VkVideoEncodeH264DpbSlotInfoEXT { - VkStructureType sType; - const void* pNext; - int8_t slotIndex; - const StdVideoEncodeH264ReferenceInfo* pStdReferenceInfo; -} VkVideoEncodeH264DpbSlotInfoEXT; - -typedef struct VkVideoEncodeH264ReferenceListsInfoEXT { - VkStructureType sType; - const void* pNext; - uint8_t referenceList0EntryCount; - const VkVideoEncodeH264DpbSlotInfoEXT* pReferenceList0Entries; - uint8_t referenceList1EntryCount; - const VkVideoEncodeH264DpbSlotInfoEXT* pReferenceList1Entries; - const StdVideoEncodeH264RefMemMgmtCtrlOperations* pMemMgmtCtrlOperations; -} VkVideoEncodeH264ReferenceListsInfoEXT; - -typedef struct VkVideoEncodeH264NaluSliceInfoEXT { - VkStructureType sType; - const void* pNext; - uint32_t mbCount; - const VkVideoEncodeH264ReferenceListsInfoEXT* pReferenceFinalLists; - const StdVideoEncodeH264SliceHeader* pSliceHeaderStd; -} VkVideoEncodeH264NaluSliceInfoEXT; - -typedef struct VkVideoEncodeH264VclFrameInfoEXT { - VkStructureType sType; - const void* pNext; - const VkVideoEncodeH264ReferenceListsInfoEXT* pReferenceFinalLists; - uint32_t naluSliceEntryCount; - const VkVideoEncodeH264NaluSliceInfoEXT* pNaluSliceEntries; - const StdVideoEncodeH264PictureInfo* pCurrentPictureInfo; -} VkVideoEncodeH264VclFrameInfoEXT; - -typedef struct VkVideoEncodeH264EmitPictureParametersInfoEXT { +// VK_NV_displacement_micromap is a preprocessor guard. Do not pass it to API calls. +#define VK_NV_displacement_micromap 1 +#define VK_NV_DISPLACEMENT_MICROMAP_SPEC_VERSION 2 +#define VK_NV_DISPLACEMENT_MICROMAP_EXTENSION_NAME "VK_NV_displacement_micromap" + +typedef enum VkDisplacementMicromapFormatNV { + VK_DISPLACEMENT_MICROMAP_FORMAT_64_TRIANGLES_64_BYTES_NV = 1, + VK_DISPLACEMENT_MICROMAP_FORMAT_256_TRIANGLES_128_BYTES_NV = 2, + VK_DISPLACEMENT_MICROMAP_FORMAT_1024_TRIANGLES_128_BYTES_NV = 3, + VK_DISPLACEMENT_MICROMAP_FORMAT_MAX_ENUM_NV = 0x7FFFFFFF +} VkDisplacementMicromapFormatNV; +typedef struct VkPhysicalDeviceDisplacementMicromapFeaturesNV { VkStructureType sType; - const void* pNext; - uint8_t spsId; - VkBool32 emitSpsEnable; - uint32_t ppsIdEntryCount; - const uint8_t* ppsIdEntries; -} VkVideoEncodeH264EmitPictureParametersInfoEXT; - -typedef struct VkVideoEncodeH264ProfileInfoEXT { - VkStructureType sType; - const void* pNext; - StdVideoH264ProfileIdc stdProfileIdc; -} VkVideoEncodeH264ProfileInfoEXT; - -typedef struct VkVideoEncodeH264RateControlInfoEXT { - VkStructureType sType; - const void* pNext; - uint32_t gopFrameCount; - uint32_t idrPeriod; - uint32_t consecutiveBFrameCount; - VkVideoEncodeH264RateControlStructureEXT rateControlStructure; - uint8_t temporalLayerCount; -} VkVideoEncodeH264RateControlInfoEXT; - -typedef struct VkVideoEncodeH264QpEXT { - int32_t qpI; - int32_t qpP; - int32_t qpB; -} VkVideoEncodeH264QpEXT; - -typedef struct VkVideoEncodeH264FrameSizeEXT { - uint32_t frameISize; - uint32_t framePSize; - uint32_t frameBSize; -} VkVideoEncodeH264FrameSizeEXT; - -typedef struct VkVideoEncodeH264RateControlLayerInfoEXT { - VkStructureType sType; - const void* pNext; - uint8_t temporalLayerId; - VkBool32 useInitialRcQp; - VkVideoEncodeH264QpEXT initialRcQp; - VkBool32 useMinQp; - VkVideoEncodeH264QpEXT minQp; - VkBool32 useMaxQp; - VkVideoEncodeH264QpEXT maxQp; - VkBool32 useMaxFrameSize; - VkVideoEncodeH264FrameSizeEXT maxFrameSize; -} VkVideoEncodeH264RateControlLayerInfoEXT; - - - -#define VK_EXT_video_encode_h265 1 -#include "vk_video/vulkan_video_codec_h265std.h" -#include "vk_video/vulkan_video_codec_h265std_encode.h" -#define VK_EXT_VIDEO_ENCODE_H265_SPEC_VERSION 8 -#define VK_EXT_VIDEO_ENCODE_H265_EXTENSION_NAME "VK_EXT_video_encode_h265" - -typedef enum VkVideoEncodeH265RateControlStructureEXT { - VK_VIDEO_ENCODE_H265_RATE_CONTROL_STRUCTURE_UNKNOWN_EXT = 0, - VK_VIDEO_ENCODE_H265_RATE_CONTROL_STRUCTURE_FLAT_EXT = 1, - VK_VIDEO_ENCODE_H265_RATE_CONTROL_STRUCTURE_DYADIC_EXT = 2, - VK_VIDEO_ENCODE_H265_RATE_CONTROL_STRUCTURE_MAX_ENUM_EXT = 0x7FFFFFFF -} VkVideoEncodeH265RateControlStructureEXT; - -typedef enum VkVideoEncodeH265CapabilityFlagBitsEXT { - VK_VIDEO_ENCODE_H265_CAPABILITY_SEPARATE_COLOUR_PLANE_BIT_EXT = 0x00000001, - VK_VIDEO_ENCODE_H265_CAPABILITY_SCALING_LISTS_BIT_EXT = 0x00000002, - VK_VIDEO_ENCODE_H265_CAPABILITY_SAMPLE_ADAPTIVE_OFFSET_ENABLED_BIT_EXT = 0x00000004, - VK_VIDEO_ENCODE_H265_CAPABILITY_PCM_ENABLE_BIT_EXT = 0x00000008, - VK_VIDEO_ENCODE_H265_CAPABILITY_SPS_TEMPORAL_MVP_ENABLED_BIT_EXT = 0x00000010, - VK_VIDEO_ENCODE_H265_CAPABILITY_HRD_COMPLIANCE_BIT_EXT = 0x00000020, - VK_VIDEO_ENCODE_H265_CAPABILITY_INIT_QP_MINUS26_BIT_EXT = 0x00000040, - VK_VIDEO_ENCODE_H265_CAPABILITY_LOG2_PARALLEL_MERGE_LEVEL_MINUS2_BIT_EXT = 0x00000080, - VK_VIDEO_ENCODE_H265_CAPABILITY_SIGN_DATA_HIDING_ENABLED_BIT_EXT = 0x00000100, - VK_VIDEO_ENCODE_H265_CAPABILITY_TRANSFORM_SKIP_ENABLED_BIT_EXT = 0x00000200, - VK_VIDEO_ENCODE_H265_CAPABILITY_TRANSFORM_SKIP_DISABLED_BIT_EXT = 0x00000400, - VK_VIDEO_ENCODE_H265_CAPABILITY_PPS_SLICE_CHROMA_QP_OFFSETS_PRESENT_BIT_EXT = 0x00000800, - VK_VIDEO_ENCODE_H265_CAPABILITY_WEIGHTED_PRED_BIT_EXT = 0x00001000, - VK_VIDEO_ENCODE_H265_CAPABILITY_WEIGHTED_BIPRED_BIT_EXT = 0x00002000, - VK_VIDEO_ENCODE_H265_CAPABILITY_WEIGHTED_PRED_NO_TABLE_BIT_EXT = 0x00004000, - VK_VIDEO_ENCODE_H265_CAPABILITY_TRANSQUANT_BYPASS_ENABLED_BIT_EXT = 0x00008000, - VK_VIDEO_ENCODE_H265_CAPABILITY_ENTROPY_CODING_SYNC_ENABLED_BIT_EXT = 0x00010000, - VK_VIDEO_ENCODE_H265_CAPABILITY_DEBLOCKING_FILTER_OVERRIDE_ENABLED_BIT_EXT = 0x00020000, - VK_VIDEO_ENCODE_H265_CAPABILITY_MULTIPLE_TILE_PER_FRAME_BIT_EXT = 0x00040000, - VK_VIDEO_ENCODE_H265_CAPABILITY_MULTIPLE_SLICE_PER_TILE_BIT_EXT = 0x00080000, - VK_VIDEO_ENCODE_H265_CAPABILITY_MULTIPLE_TILE_PER_SLICE_BIT_EXT = 0x00100000, - VK_VIDEO_ENCODE_H265_CAPABILITY_SLICE_SEGMENT_CTB_COUNT_BIT_EXT = 0x00200000, - VK_VIDEO_ENCODE_H265_CAPABILITY_ROW_UNALIGNED_SLICE_SEGMENT_BIT_EXT = 0x00400000, - VK_VIDEO_ENCODE_H265_CAPABILITY_DEPENDENT_SLICE_SEGMENT_BIT_EXT = 0x00800000, - VK_VIDEO_ENCODE_H265_CAPABILITY_DIFFERENT_SLICE_TYPE_BIT_EXT = 0x01000000, - VK_VIDEO_ENCODE_H265_CAPABILITY_B_FRAME_IN_L1_LIST_BIT_EXT = 0x02000000, - VK_VIDEO_ENCODE_H265_CAPABILITY_FLAG_BITS_MAX_ENUM_EXT = 0x7FFFFFFF -} VkVideoEncodeH265CapabilityFlagBitsEXT; -typedef VkFlags VkVideoEncodeH265CapabilityFlagsEXT; - -typedef enum VkVideoEncodeH265InputModeFlagBitsEXT { - VK_VIDEO_ENCODE_H265_INPUT_MODE_FRAME_BIT_EXT = 0x00000001, - VK_VIDEO_ENCODE_H265_INPUT_MODE_SLICE_SEGMENT_BIT_EXT = 0x00000002, - VK_VIDEO_ENCODE_H265_INPUT_MODE_NON_VCL_BIT_EXT = 0x00000004, - VK_VIDEO_ENCODE_H265_INPUT_MODE_FLAG_BITS_MAX_ENUM_EXT = 0x7FFFFFFF -} VkVideoEncodeH265InputModeFlagBitsEXT; -typedef VkFlags VkVideoEncodeH265InputModeFlagsEXT; - -typedef enum VkVideoEncodeH265OutputModeFlagBitsEXT { - VK_VIDEO_ENCODE_H265_OUTPUT_MODE_FRAME_BIT_EXT = 0x00000001, - VK_VIDEO_ENCODE_H265_OUTPUT_MODE_SLICE_SEGMENT_BIT_EXT = 0x00000002, - VK_VIDEO_ENCODE_H265_OUTPUT_MODE_NON_VCL_BIT_EXT = 0x00000004, - VK_VIDEO_ENCODE_H265_OUTPUT_MODE_FLAG_BITS_MAX_ENUM_EXT = 0x7FFFFFFF -} VkVideoEncodeH265OutputModeFlagBitsEXT; -typedef VkFlags VkVideoEncodeH265OutputModeFlagsEXT; - -typedef enum VkVideoEncodeH265CtbSizeFlagBitsEXT { - VK_VIDEO_ENCODE_H265_CTB_SIZE_16_BIT_EXT = 0x00000001, - VK_VIDEO_ENCODE_H265_CTB_SIZE_32_BIT_EXT = 0x00000002, - VK_VIDEO_ENCODE_H265_CTB_SIZE_64_BIT_EXT = 0x00000004, - VK_VIDEO_ENCODE_H265_CTB_SIZE_FLAG_BITS_MAX_ENUM_EXT = 0x7FFFFFFF -} VkVideoEncodeH265CtbSizeFlagBitsEXT; -typedef VkFlags VkVideoEncodeH265CtbSizeFlagsEXT; - -typedef enum VkVideoEncodeH265TransformBlockSizeFlagBitsEXT { - VK_VIDEO_ENCODE_H265_TRANSFORM_BLOCK_SIZE_4_BIT_EXT = 0x00000001, - VK_VIDEO_ENCODE_H265_TRANSFORM_BLOCK_SIZE_8_BIT_EXT = 0x00000002, - VK_VIDEO_ENCODE_H265_TRANSFORM_BLOCK_SIZE_16_BIT_EXT = 0x00000004, - VK_VIDEO_ENCODE_H265_TRANSFORM_BLOCK_SIZE_32_BIT_EXT = 0x00000008, - VK_VIDEO_ENCODE_H265_TRANSFORM_BLOCK_SIZE_FLAG_BITS_MAX_ENUM_EXT = 0x7FFFFFFF -} VkVideoEncodeH265TransformBlockSizeFlagBitsEXT; -typedef VkFlags VkVideoEncodeH265TransformBlockSizeFlagsEXT; -typedef struct VkVideoEncodeH265CapabilitiesEXT { - VkStructureType sType; - void* pNext; - VkVideoEncodeH265CapabilityFlagsEXT flags; - VkVideoEncodeH265InputModeFlagsEXT inputModeFlags; - VkVideoEncodeH265OutputModeFlagsEXT outputModeFlags; - VkVideoEncodeH265CtbSizeFlagsEXT ctbSizes; - VkVideoEncodeH265TransformBlockSizeFlagsEXT transformBlockSizes; - uint8_t maxPPictureL0ReferenceCount; - uint8_t maxBPictureL0ReferenceCount; - uint8_t maxL1ReferenceCount; - uint8_t maxSubLayersCount; - uint8_t minLog2MinLumaCodingBlockSizeMinus3; - uint8_t maxLog2MinLumaCodingBlockSizeMinus3; - uint8_t minLog2MinLumaTransformBlockSizeMinus2; - uint8_t maxLog2MinLumaTransformBlockSizeMinus2; - uint8_t minMaxTransformHierarchyDepthInter; - uint8_t maxMaxTransformHierarchyDepthInter; - uint8_t minMaxTransformHierarchyDepthIntra; - uint8_t maxMaxTransformHierarchyDepthIntra; - uint8_t maxDiffCuQpDeltaDepth; - uint8_t minMaxNumMergeCand; - uint8_t maxMaxNumMergeCand; -} VkVideoEncodeH265CapabilitiesEXT; - -typedef struct VkVideoEncodeH265SessionParametersAddInfoEXT { - VkStructureType sType; - const void* pNext; - uint32_t vpsStdCount; - const StdVideoH265VideoParameterSet* pVpsStd; - uint32_t spsStdCount; - const StdVideoH265SequenceParameterSet* pSpsStd; - uint32_t ppsStdCount; - const StdVideoH265PictureParameterSet* pPpsStd; -} VkVideoEncodeH265SessionParametersAddInfoEXT; - -typedef struct VkVideoEncodeH265SessionParametersCreateInfoEXT { - VkStructureType sType; - const void* pNext; - uint32_t maxVpsStdCount; - uint32_t maxSpsStdCount; - uint32_t maxPpsStdCount; - const VkVideoEncodeH265SessionParametersAddInfoEXT* pParametersAddInfo; -} VkVideoEncodeH265SessionParametersCreateInfoEXT; - -typedef struct VkVideoEncodeH265DpbSlotInfoEXT { - VkStructureType sType; - const void* pNext; - int8_t slotIndex; - const StdVideoEncodeH265ReferenceInfo* pStdReferenceInfo; -} VkVideoEncodeH265DpbSlotInfoEXT; - -typedef struct VkVideoEncodeH265ReferenceListsInfoEXT { - VkStructureType sType; - const void* pNext; - uint8_t referenceList0EntryCount; - const VkVideoEncodeH265DpbSlotInfoEXT* pReferenceList0Entries; - uint8_t referenceList1EntryCount; - const VkVideoEncodeH265DpbSlotInfoEXT* pReferenceList1Entries; - const StdVideoEncodeH265ReferenceModifications* pReferenceModifications; -} VkVideoEncodeH265ReferenceListsInfoEXT; - -typedef struct VkVideoEncodeH265NaluSliceSegmentInfoEXT { - VkStructureType sType; - const void* pNext; - uint32_t ctbCount; - const VkVideoEncodeH265ReferenceListsInfoEXT* pReferenceFinalLists; - const StdVideoEncodeH265SliceSegmentHeader* pSliceSegmentHeaderStd; -} VkVideoEncodeH265NaluSliceSegmentInfoEXT; - -typedef struct VkVideoEncodeH265VclFrameInfoEXT { - VkStructureType sType; - const void* pNext; - const VkVideoEncodeH265ReferenceListsInfoEXT* pReferenceFinalLists; - uint32_t naluSliceSegmentEntryCount; - const VkVideoEncodeH265NaluSliceSegmentInfoEXT* pNaluSliceSegmentEntries; - const StdVideoEncodeH265PictureInfo* pCurrentPictureInfo; -} VkVideoEncodeH265VclFrameInfoEXT; - -typedef struct VkVideoEncodeH265EmitPictureParametersInfoEXT { + void* pNext; + VkBool32 displacementMicromap; +} VkPhysicalDeviceDisplacementMicromapFeaturesNV; + +typedef struct VkPhysicalDeviceDisplacementMicromapPropertiesNV { VkStructureType sType; - const void* pNext; - uint8_t vpsId; - uint8_t spsId; - VkBool32 emitVpsEnable; - VkBool32 emitSpsEnable; - uint32_t ppsIdEntryCount; - const uint8_t* ppsIdEntries; -} VkVideoEncodeH265EmitPictureParametersInfoEXT; - -typedef struct VkVideoEncodeH265ProfileInfoEXT { - VkStructureType sType; - const void* pNext; - StdVideoH265ProfileIdc stdProfileIdc; -} VkVideoEncodeH265ProfileInfoEXT; - -typedef struct VkVideoEncodeH265RateControlInfoEXT { - VkStructureType sType; - const void* pNext; - uint32_t gopFrameCount; - uint32_t idrPeriod; - uint32_t consecutiveBFrameCount; - VkVideoEncodeH265RateControlStructureEXT rateControlStructure; - uint8_t subLayerCount; -} VkVideoEncodeH265RateControlInfoEXT; - -typedef struct VkVideoEncodeH265QpEXT { - int32_t qpI; - int32_t qpP; - int32_t qpB; -} VkVideoEncodeH265QpEXT; - -typedef struct VkVideoEncodeH265FrameSizeEXT { - uint32_t frameISize; - uint32_t framePSize; - uint32_t frameBSize; -} VkVideoEncodeH265FrameSizeEXT; - -typedef struct VkVideoEncodeH265RateControlLayerInfoEXT { - VkStructureType sType; - const void* pNext; - uint8_t temporalId; - VkBool32 useInitialRcQp; - VkVideoEncodeH265QpEXT initialRcQp; - VkBool32 useMinQp; - VkVideoEncodeH265QpEXT minQp; - VkBool32 useMaxQp; - VkVideoEncodeH265QpEXT maxQp; - VkBool32 useMaxFrameSize; - VkVideoEncodeH265FrameSizeEXT maxFrameSize; -} VkVideoEncodeH265RateControlLayerInfoEXT; - - - -#define VK_EXT_video_decode_h264 1 -#include "vk_video/vulkan_video_codec_h264std_decode.h" -#define VK_EXT_VIDEO_DECODE_H264_SPEC_VERSION 6 -#define VK_EXT_VIDEO_DECODE_H264_EXTENSION_NAME "VK_EXT_video_decode_h264" - -typedef enum VkVideoDecodeH264PictureLayoutFlagBitsEXT { - VK_VIDEO_DECODE_H264_PICTURE_LAYOUT_PROGRESSIVE_EXT = 0, - VK_VIDEO_DECODE_H264_PICTURE_LAYOUT_INTERLACED_INTERLEAVED_LINES_BIT_EXT = 0x00000001, - VK_VIDEO_DECODE_H264_PICTURE_LAYOUT_INTERLACED_SEPARATE_PLANES_BIT_EXT = 0x00000002, - VK_VIDEO_DECODE_H264_PICTURE_LAYOUT_FLAG_BITS_MAX_ENUM_EXT = 0x7FFFFFFF -} VkVideoDecodeH264PictureLayoutFlagBitsEXT; -typedef VkFlags VkVideoDecodeH264PictureLayoutFlagsEXT; -typedef struct VkVideoDecodeH264ProfileInfoEXT { - VkStructureType sType; - const void* pNext; - StdVideoH264ProfileIdc stdProfileIdc; - VkVideoDecodeH264PictureLayoutFlagsEXT pictureLayout; -} VkVideoDecodeH264ProfileInfoEXT; - -typedef struct VkVideoDecodeH264CapabilitiesEXT { - VkStructureType sType; - void* pNext; - StdVideoH264Level maxLevel; - VkOffset2D fieldOffsetGranularity; -} VkVideoDecodeH264CapabilitiesEXT; - -typedef struct VkVideoDecodeH264SessionParametersAddInfoEXT { - VkStructureType sType; - const void* pNext; - uint32_t spsStdCount; - const StdVideoH264SequenceParameterSet* pSpsStd; - uint32_t ppsStdCount; - const StdVideoH264PictureParameterSet* pPpsStd; -} VkVideoDecodeH264SessionParametersAddInfoEXT; - -typedef struct VkVideoDecodeH264SessionParametersCreateInfoEXT { - VkStructureType sType; - const void* pNext; - uint32_t maxSpsStdCount; - uint32_t maxPpsStdCount; - const VkVideoDecodeH264SessionParametersAddInfoEXT* pParametersAddInfo; -} VkVideoDecodeH264SessionParametersCreateInfoEXT; - -typedef struct VkVideoDecodeH264PictureInfoEXT { - VkStructureType sType; - const void* pNext; - const StdVideoDecodeH264PictureInfo* pStdPictureInfo; - uint32_t slicesCount; - const uint32_t* pSlicesDataOffsets; -} VkVideoDecodeH264PictureInfoEXT; - -typedef struct VkVideoDecodeH264MvcInfoEXT { - VkStructureType sType; - const void* pNext; - const StdVideoDecodeH264Mvc* pStdMvc; -} VkVideoDecodeH264MvcInfoEXT; - -typedef struct VkVideoDecodeH264DpbSlotInfoEXT { - VkStructureType sType; - const void* pNext; - const StdVideoDecodeH264ReferenceInfo* pStdReferenceInfo; -} VkVideoDecodeH264DpbSlotInfoEXT; - - - -#define VK_EXT_video_decode_h265 1 -#include "vk_video/vulkan_video_codec_h265std_decode.h" -#define VK_EXT_VIDEO_DECODE_H265_SPEC_VERSION 4 -#define VK_EXT_VIDEO_DECODE_H265_EXTENSION_NAME "VK_EXT_video_decode_h265" -typedef struct VkVideoDecodeH265ProfileInfoEXT { - VkStructureType sType; - const void* pNext; - StdVideoH265ProfileIdc stdProfileIdc; -} VkVideoDecodeH265ProfileInfoEXT; - -typedef struct VkVideoDecodeH265CapabilitiesEXT { - VkStructureType sType; - void* pNext; - StdVideoH265Level maxLevel; -} VkVideoDecodeH265CapabilitiesEXT; - -typedef struct VkVideoDecodeH265SessionParametersAddInfoEXT { - VkStructureType sType; - const void* pNext; - uint32_t vpsStdCount; - const StdVideoH265VideoParameterSet* pVpsStd; - uint32_t spsStdCount; - const StdVideoH265SequenceParameterSet* pSpsStd; - uint32_t ppsStdCount; - const StdVideoH265PictureParameterSet* pPpsStd; -} VkVideoDecodeH265SessionParametersAddInfoEXT; - -typedef struct VkVideoDecodeH265SessionParametersCreateInfoEXT { - VkStructureType sType; - const void* pNext; - uint32_t maxVpsStdCount; - uint32_t maxSpsStdCount; - uint32_t maxPpsStdCount; - const VkVideoDecodeH265SessionParametersAddInfoEXT* pParametersAddInfo; -} VkVideoDecodeH265SessionParametersCreateInfoEXT; - -typedef struct VkVideoDecodeH265PictureInfoEXT { - VkStructureType sType; - const void* pNext; - StdVideoDecodeH265PictureInfo* pStdPictureInfo; - uint32_t slicesCount; - const uint32_t* pSlicesDataOffsets; -} VkVideoDecodeH265PictureInfoEXT; - -typedef struct VkVideoDecodeH265DpbSlotInfoEXT { - VkStructureType sType; - const void* pNext; - const StdVideoDecodeH265ReferenceInfo* pStdReferenceInfo; -} VkVideoDecodeH265DpbSlotInfoEXT; + void* pNext; + uint32_t maxDisplacementMicromapSubdivisionLevel; +} VkPhysicalDeviceDisplacementMicromapPropertiesNV; + +typedef struct VkAccelerationStructureTrianglesDisplacementMicromapNV { + VkStructureType sType; + void* pNext; + VkFormat displacementBiasAndScaleFormat; + VkFormat displacementVectorFormat; + VkDeviceOrHostAddressConstKHR displacementBiasAndScaleBuffer; + VkDeviceSize displacementBiasAndScaleStride; + VkDeviceOrHostAddressConstKHR displacementVectorBuffer; + VkDeviceSize displacementVectorStride; + VkDeviceOrHostAddressConstKHR displacedMicromapPrimitiveFlags; + VkDeviceSize displacedMicromapPrimitiveFlagsStride; + VkIndexType indexType; + VkDeviceOrHostAddressConstKHR indexBuffer; + VkDeviceSize indexStride; + uint32_t baseTriangle; + uint32_t usageCountsCount; + const VkMicromapUsageEXT* pUsageCounts; + const VkMicromapUsageEXT* const* ppUsageCounts; + VkMicromapEXT micromap; +} VkAccelerationStructureTrianglesDisplacementMicromapNV; #ifdef __cplusplus diff --git a/thirdparty/SDL/src/video/khronos/vulkan/vulkan_core.h b/thirdparty/SDL/src/video/khronos/vulkan/vulkan_core.h index 00f32b335..5354f61dc 100644 --- a/thirdparty/SDL/src/video/khronos/vulkan/vulkan_core.h +++ b/thirdparty/SDL/src/video/khronos/vulkan/vulkan_core.h @@ -2,7 +2,7 @@ #define VULKAN_CORE_H_ 1 /* -** Copyright 2015-2022 The Khronos Group Inc. +** Copyright 2015-2024 The Khronos Group Inc. ** ** SPDX-License-Identifier: Apache-2.0 */ @@ -19,6 +19,7 @@ extern "C" { +// VK_VERSION_1_0 is a preprocessor guard. Do not pass it to API calls. #define VK_VERSION_1_0 1 #include "vk_platform.h" @@ -26,7 +27,7 @@ extern "C" { #ifndef VK_USE_64_BIT_PTR_DEFINES - #if defined(__LP64__) || defined(_WIN64) || (defined(__x86_64__) && !defined(__ILP32__) ) || defined(_M_X64) || defined(__ia64) || defined (_M_IA64) || defined(__aarch64__) || defined(__powerpc64__) + #if defined(__LP64__) || defined(_WIN64) || (defined(__x86_64__) && !defined(__ILP32__) ) || defined(_M_X64) || defined(__ia64) || defined (_M_IA64) || defined(__aarch64__) || defined(__powerpc64__) || (defined(__riscv) && __riscv_xlen == 64) #define VK_USE_64_BIT_PTR_DEFINES 1 #else #define VK_USE_64_BIT_PTR_DEFINES 0 @@ -58,37 +59,37 @@ extern "C" { #endif #endif -// DEPRECATED: This define is deprecated. VK_MAKE_API_VERSION should be used instead. -#define VK_MAKE_VERSION(major, minor, patch) \ - ((((uint32_t)(major)) << 22) | (((uint32_t)(minor)) << 12) | ((uint32_t)(patch))) +#define VK_MAKE_API_VERSION(variant, major, minor, patch) \ + ((((uint32_t)(variant)) << 29U) | (((uint32_t)(major)) << 22U) | (((uint32_t)(minor)) << 12U) | ((uint32_t)(patch))) // DEPRECATED: This define has been removed. Specific version defines (e.g. VK_API_VERSION_1_0), or the VK_MAKE_VERSION macro, should be used instead. -//#define VK_API_VERSION VK_MAKE_VERSION(1, 0, 0) // Patch version should always be set to 0 - -#define VK_MAKE_API_VERSION(variant, major, minor, patch) \ - ((((uint32_t)(variant)) << 29) | (((uint32_t)(major)) << 22) | (((uint32_t)(minor)) << 12) | ((uint32_t)(patch))) +//#define VK_API_VERSION VK_MAKE_API_VERSION(0, 1, 0, 0) // Patch version should always be set to 0 // Vulkan 1.0 version number #define VK_API_VERSION_1_0 VK_MAKE_API_VERSION(0, 1, 0, 0)// Patch version should always be set to 0 // Version of this file -#define VK_HEADER_VERSION 227 +#define VK_HEADER_VERSION 275 // Complete version of this file #define VK_HEADER_VERSION_COMPLETE VK_MAKE_API_VERSION(0, 1, 3, VK_HEADER_VERSION) +// DEPRECATED: This define is deprecated. VK_MAKE_API_VERSION should be used instead. +#define VK_MAKE_VERSION(major, minor, patch) \ + ((((uint32_t)(major)) << 22U) | (((uint32_t)(minor)) << 12U) | ((uint32_t)(patch))) + // DEPRECATED: This define is deprecated. VK_API_VERSION_MAJOR should be used instead. -#define VK_VERSION_MAJOR(version) ((uint32_t)(version) >> 22) +#define VK_VERSION_MAJOR(version) ((uint32_t)(version) >> 22U) // DEPRECATED: This define is deprecated. VK_API_VERSION_MINOR should be used instead. -#define VK_VERSION_MINOR(version) (((uint32_t)(version) >> 12) & 0x3FFU) +#define VK_VERSION_MINOR(version) (((uint32_t)(version) >> 12U) & 0x3FFU) // DEPRECATED: This define is deprecated. VK_API_VERSION_PATCH should be used instead. #define VK_VERSION_PATCH(version) ((uint32_t)(version) & 0xFFFU) -#define VK_API_VERSION_VARIANT(version) ((uint32_t)(version) >> 29) -#define VK_API_VERSION_MAJOR(version) (((uint32_t)(version) >> 22) & 0x7FU) -#define VK_API_VERSION_MINOR(version) (((uint32_t)(version) >> 12) & 0x3FFU) +#define VK_API_VERSION_VARIANT(version) ((uint32_t)(version) >> 29U) +#define VK_API_VERSION_MAJOR(version) (((uint32_t)(version) >> 22U) & 0x7FU) +#define VK_API_VERSION_MINOR(version) (((uint32_t)(version) >> 12U) & 0x3FFU) #define VK_API_VERSION_PATCH(version) ((uint32_t)(version) & 0xFFFU) typedef uint32_t VkBool32; typedef uint64_t VkDeviceAddress; @@ -168,24 +169,12 @@ typedef enum VkResult { VK_ERROR_INCOMPATIBLE_DISPLAY_KHR = -1000003001, VK_ERROR_VALIDATION_FAILED_EXT = -1000011001, VK_ERROR_INVALID_SHADER_NV = -1000012000, -#ifdef VK_ENABLE_BETA_EXTENSIONS VK_ERROR_IMAGE_USAGE_NOT_SUPPORTED_KHR = -1000023000, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS VK_ERROR_VIDEO_PICTURE_LAYOUT_NOT_SUPPORTED_KHR = -1000023001, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS VK_ERROR_VIDEO_PROFILE_OPERATION_NOT_SUPPORTED_KHR = -1000023002, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS VK_ERROR_VIDEO_PROFILE_FORMAT_NOT_SUPPORTED_KHR = -1000023003, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS VK_ERROR_VIDEO_PROFILE_CODEC_NOT_SUPPORTED_KHR = -1000023004, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS VK_ERROR_VIDEO_STD_VERSION_NOT_SUPPORTED_KHR = -1000023005, -#endif VK_ERROR_INVALID_DRM_FORMAT_MODIFIER_PLANE_LAYOUT_EXT = -1000158000, VK_ERROR_NOT_PERMITTED_KHR = -1000174001, VK_ERROR_FULL_SCREEN_EXCLUSIVE_MODE_LOST_EXT = -1000255000, @@ -193,7 +182,9 @@ typedef enum VkResult { VK_THREAD_DONE_KHR = 1000268001, VK_OPERATION_DEFERRED_KHR = 1000268002, VK_OPERATION_NOT_DEFERRED_KHR = 1000268003, + VK_ERROR_INVALID_VIDEO_STD_PARAMETERS_KHR = -1000299000, VK_ERROR_COMPRESSION_EXHAUSTED_EXT = -1000338000, + VK_ERROR_INCOMPATIBLE_SHADER_BINARY_EXT = 1000482000, VK_ERROR_OUT_OF_POOL_MEMORY_KHR = VK_ERROR_OUT_OF_POOL_MEMORY, VK_ERROR_INVALID_EXTERNAL_HANDLE_KHR = VK_ERROR_INVALID_EXTERNAL_HANDLE, VK_ERROR_FRAGMENTATION_EXT = VK_ERROR_FRAGMENTATION, @@ -443,66 +434,26 @@ typedef enum VkStructureType { VK_STRUCTURE_TYPE_DEBUG_MARKER_OBJECT_NAME_INFO_EXT = 1000022000, VK_STRUCTURE_TYPE_DEBUG_MARKER_OBJECT_TAG_INFO_EXT = 1000022001, VK_STRUCTURE_TYPE_DEBUG_MARKER_MARKER_INFO_EXT = 1000022002, -#ifdef VK_ENABLE_BETA_EXTENSIONS VK_STRUCTURE_TYPE_VIDEO_PROFILE_INFO_KHR = 1000023000, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS VK_STRUCTURE_TYPE_VIDEO_CAPABILITIES_KHR = 1000023001, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS VK_STRUCTURE_TYPE_VIDEO_PICTURE_RESOURCE_INFO_KHR = 1000023002, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS VK_STRUCTURE_TYPE_VIDEO_SESSION_MEMORY_REQUIREMENTS_KHR = 1000023003, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS VK_STRUCTURE_TYPE_BIND_VIDEO_SESSION_MEMORY_INFO_KHR = 1000023004, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS VK_STRUCTURE_TYPE_VIDEO_SESSION_CREATE_INFO_KHR = 1000023005, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS VK_STRUCTURE_TYPE_VIDEO_SESSION_PARAMETERS_CREATE_INFO_KHR = 1000023006, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS VK_STRUCTURE_TYPE_VIDEO_SESSION_PARAMETERS_UPDATE_INFO_KHR = 1000023007, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS VK_STRUCTURE_TYPE_VIDEO_BEGIN_CODING_INFO_KHR = 1000023008, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS VK_STRUCTURE_TYPE_VIDEO_END_CODING_INFO_KHR = 1000023009, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS VK_STRUCTURE_TYPE_VIDEO_CODING_CONTROL_INFO_KHR = 1000023010, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS VK_STRUCTURE_TYPE_VIDEO_REFERENCE_SLOT_INFO_KHR = 1000023011, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS VK_STRUCTURE_TYPE_QUEUE_FAMILY_VIDEO_PROPERTIES_KHR = 1000023012, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS VK_STRUCTURE_TYPE_VIDEO_PROFILE_LIST_INFO_KHR = 1000023013, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VIDEO_FORMAT_INFO_KHR = 1000023014, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS VK_STRUCTURE_TYPE_VIDEO_FORMAT_PROPERTIES_KHR = 1000023015, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS VK_STRUCTURE_TYPE_QUEUE_FAMILY_QUERY_RESULT_STATUS_PROPERTIES_KHR = 1000023016, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS VK_STRUCTURE_TYPE_VIDEO_DECODE_INFO_KHR = 1000024000, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS VK_STRUCTURE_TYPE_VIDEO_DECODE_CAPABILITIES_KHR = 1000024001, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS VK_STRUCTURE_TYPE_VIDEO_DECODE_USAGE_INFO_KHR = 1000024002, -#endif VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_IMAGE_CREATE_INFO_NV = 1000026000, VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_BUFFER_CREATE_INFO_NV = 1000026001, VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_MEMORY_ALLOCATE_INFO_NV = 1000026002, @@ -514,93 +465,40 @@ typedef enum VkStructureType { VK_STRUCTURE_TYPE_CU_LAUNCH_INFO_NVX = 1000029002, VK_STRUCTURE_TYPE_IMAGE_VIEW_HANDLE_INFO_NVX = 1000030000, VK_STRUCTURE_TYPE_IMAGE_VIEW_ADDRESS_PROPERTIES_NVX = 1000030001, -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_STRUCTURE_TYPE_VIDEO_ENCODE_H264_CAPABILITIES_EXT = 1000038000, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_STRUCTURE_TYPE_VIDEO_ENCODE_H264_SESSION_PARAMETERS_CREATE_INFO_EXT = 1000038001, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_STRUCTURE_TYPE_VIDEO_ENCODE_H264_SESSION_PARAMETERS_ADD_INFO_EXT = 1000038002, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_STRUCTURE_TYPE_VIDEO_ENCODE_H264_VCL_FRAME_INFO_EXT = 1000038003, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_STRUCTURE_TYPE_VIDEO_ENCODE_H264_DPB_SLOT_INFO_EXT = 1000038004, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_STRUCTURE_TYPE_VIDEO_ENCODE_H264_NALU_SLICE_INFO_EXT = 1000038005, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_STRUCTURE_TYPE_VIDEO_ENCODE_H264_EMIT_PICTURE_PARAMETERS_INFO_EXT = 1000038006, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_STRUCTURE_TYPE_VIDEO_ENCODE_H264_PROFILE_INFO_EXT = 1000038007, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_STRUCTURE_TYPE_VIDEO_ENCODE_H264_RATE_CONTROL_INFO_EXT = 1000038008, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_STRUCTURE_TYPE_VIDEO_ENCODE_H264_RATE_CONTROL_LAYER_INFO_EXT = 1000038009, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_STRUCTURE_TYPE_VIDEO_ENCODE_H264_REFERENCE_LISTS_INFO_EXT = 1000038010, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_STRUCTURE_TYPE_VIDEO_ENCODE_H265_CAPABILITIES_EXT = 1000039000, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_STRUCTURE_TYPE_VIDEO_ENCODE_H265_SESSION_PARAMETERS_CREATE_INFO_EXT = 1000039001, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_STRUCTURE_TYPE_VIDEO_ENCODE_H265_SESSION_PARAMETERS_ADD_INFO_EXT = 1000039002, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_STRUCTURE_TYPE_VIDEO_ENCODE_H265_VCL_FRAME_INFO_EXT = 1000039003, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_STRUCTURE_TYPE_VIDEO_ENCODE_H265_DPB_SLOT_INFO_EXT = 1000039004, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_STRUCTURE_TYPE_VIDEO_ENCODE_H265_NALU_SLICE_SEGMENT_INFO_EXT = 1000039005, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_STRUCTURE_TYPE_VIDEO_ENCODE_H265_EMIT_PICTURE_PARAMETERS_INFO_EXT = 1000039006, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_STRUCTURE_TYPE_VIDEO_ENCODE_H265_PROFILE_INFO_EXT = 1000039007, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_STRUCTURE_TYPE_VIDEO_ENCODE_H265_REFERENCE_LISTS_INFO_EXT = 1000039008, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_STRUCTURE_TYPE_VIDEO_ENCODE_H265_RATE_CONTROL_INFO_EXT = 1000039009, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_STRUCTURE_TYPE_VIDEO_ENCODE_H265_RATE_CONTROL_LAYER_INFO_EXT = 1000039010, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_STRUCTURE_TYPE_VIDEO_DECODE_H264_CAPABILITIES_EXT = 1000040000, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_STRUCTURE_TYPE_VIDEO_DECODE_H264_PICTURE_INFO_EXT = 1000040001, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_STRUCTURE_TYPE_VIDEO_DECODE_H264_MVC_INFO_EXT = 1000040002, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_STRUCTURE_TYPE_VIDEO_DECODE_H264_PROFILE_INFO_EXT = 1000040003, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_STRUCTURE_TYPE_VIDEO_DECODE_H264_SESSION_PARAMETERS_CREATE_INFO_EXT = 1000040004, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_STRUCTURE_TYPE_VIDEO_DECODE_H264_SESSION_PARAMETERS_ADD_INFO_EXT = 1000040005, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_STRUCTURE_TYPE_VIDEO_DECODE_H264_DPB_SLOT_INFO_EXT = 1000040006, -#endif + VK_STRUCTURE_TYPE_VIDEO_ENCODE_H264_CAPABILITIES_KHR = 1000038000, + VK_STRUCTURE_TYPE_VIDEO_ENCODE_H264_SESSION_PARAMETERS_CREATE_INFO_KHR = 1000038001, + VK_STRUCTURE_TYPE_VIDEO_ENCODE_H264_SESSION_PARAMETERS_ADD_INFO_KHR = 1000038002, + VK_STRUCTURE_TYPE_VIDEO_ENCODE_H264_PICTURE_INFO_KHR = 1000038003, + VK_STRUCTURE_TYPE_VIDEO_ENCODE_H264_DPB_SLOT_INFO_KHR = 1000038004, + VK_STRUCTURE_TYPE_VIDEO_ENCODE_H264_NALU_SLICE_INFO_KHR = 1000038005, + VK_STRUCTURE_TYPE_VIDEO_ENCODE_H264_GOP_REMAINING_FRAME_INFO_KHR = 1000038006, + VK_STRUCTURE_TYPE_VIDEO_ENCODE_H264_PROFILE_INFO_KHR = 1000038007, + VK_STRUCTURE_TYPE_VIDEO_ENCODE_H264_RATE_CONTROL_INFO_KHR = 1000038008, + VK_STRUCTURE_TYPE_VIDEO_ENCODE_H264_RATE_CONTROL_LAYER_INFO_KHR = 1000038009, + VK_STRUCTURE_TYPE_VIDEO_ENCODE_H264_SESSION_CREATE_INFO_KHR = 1000038010, + VK_STRUCTURE_TYPE_VIDEO_ENCODE_H264_QUALITY_LEVEL_PROPERTIES_KHR = 1000038011, + VK_STRUCTURE_TYPE_VIDEO_ENCODE_H264_SESSION_PARAMETERS_GET_INFO_KHR = 1000038012, + VK_STRUCTURE_TYPE_VIDEO_ENCODE_H264_SESSION_PARAMETERS_FEEDBACK_INFO_KHR = 1000038013, + VK_STRUCTURE_TYPE_VIDEO_ENCODE_H265_CAPABILITIES_KHR = 1000039000, + VK_STRUCTURE_TYPE_VIDEO_ENCODE_H265_SESSION_PARAMETERS_CREATE_INFO_KHR = 1000039001, + VK_STRUCTURE_TYPE_VIDEO_ENCODE_H265_SESSION_PARAMETERS_ADD_INFO_KHR = 1000039002, + VK_STRUCTURE_TYPE_VIDEO_ENCODE_H265_PICTURE_INFO_KHR = 1000039003, + VK_STRUCTURE_TYPE_VIDEO_ENCODE_H265_DPB_SLOT_INFO_KHR = 1000039004, + VK_STRUCTURE_TYPE_VIDEO_ENCODE_H265_NALU_SLICE_SEGMENT_INFO_KHR = 1000039005, + VK_STRUCTURE_TYPE_VIDEO_ENCODE_H265_GOP_REMAINING_FRAME_INFO_KHR = 1000039006, + VK_STRUCTURE_TYPE_VIDEO_ENCODE_H265_PROFILE_INFO_KHR = 1000039007, + VK_STRUCTURE_TYPE_VIDEO_ENCODE_H265_RATE_CONTROL_INFO_KHR = 1000039009, + VK_STRUCTURE_TYPE_VIDEO_ENCODE_H265_RATE_CONTROL_LAYER_INFO_KHR = 1000039010, + VK_STRUCTURE_TYPE_VIDEO_ENCODE_H265_SESSION_CREATE_INFO_KHR = 1000039011, + VK_STRUCTURE_TYPE_VIDEO_ENCODE_H265_QUALITY_LEVEL_PROPERTIES_KHR = 1000039012, + VK_STRUCTURE_TYPE_VIDEO_ENCODE_H265_SESSION_PARAMETERS_GET_INFO_KHR = 1000039013, + VK_STRUCTURE_TYPE_VIDEO_ENCODE_H265_SESSION_PARAMETERS_FEEDBACK_INFO_KHR = 1000039014, + VK_STRUCTURE_TYPE_VIDEO_DECODE_H264_CAPABILITIES_KHR = 1000040000, + VK_STRUCTURE_TYPE_VIDEO_DECODE_H264_PICTURE_INFO_KHR = 1000040001, + VK_STRUCTURE_TYPE_VIDEO_DECODE_H264_PROFILE_INFO_KHR = 1000040003, + VK_STRUCTURE_TYPE_VIDEO_DECODE_H264_SESSION_PARAMETERS_CREATE_INFO_KHR = 1000040004, + VK_STRUCTURE_TYPE_VIDEO_DECODE_H264_SESSION_PARAMETERS_ADD_INFO_KHR = 1000040005, + VK_STRUCTURE_TYPE_VIDEO_DECODE_H264_DPB_SLOT_INFO_KHR = 1000040006, VK_STRUCTURE_TYPE_TEXTURE_LOD_GATHER_FORMAT_PROPERTIES_AMD = 1000041000, VK_STRUCTURE_TYPE_RENDERING_FRAGMENT_SHADING_RATE_ATTACHMENT_INFO_KHR = 1000044006, VK_STRUCTURE_TYPE_RENDERING_FRAGMENT_DENSITY_MAP_ATTACHMENT_INFO_EXT = 1000044007, @@ -655,6 +553,7 @@ typedef enum VkStructureType { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_CLIP_ENABLE_FEATURES_EXT = 1000102000, VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_DEPTH_CLIP_STATE_CREATE_INFO_EXT = 1000102001, VK_STRUCTURE_TYPE_HDR_METADATA_EXT = 1000105000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RELAXED_LINE_RASTERIZATION_FEATURES_IMG = 1000110000, VK_STRUCTURE_TYPE_SHARED_PRESENT_SURFACE_CAPABILITIES_KHR = 1000111000, VK_STRUCTURE_TYPE_IMPORT_FENCE_WIN32_HANDLE_INFO_KHR = 1000114000, VK_STRUCTURE_TYPE_EXPORT_FENCE_WIN32_HANDLE_INFO_KHR = 1000114001, @@ -690,6 +589,21 @@ typedef enum VkStructureType { VK_STRUCTURE_TYPE_MEMORY_GET_ANDROID_HARDWARE_BUFFER_INFO_ANDROID = 1000129004, VK_STRUCTURE_TYPE_EXTERNAL_FORMAT_ANDROID = 1000129005, VK_STRUCTURE_TYPE_ANDROID_HARDWARE_BUFFER_FORMAT_PROPERTIES_2_ANDROID = 1000129006, +#ifdef VK_ENABLE_BETA_EXTENSIONS + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_ENQUEUE_FEATURES_AMDX = 1000134000, +#endif +#ifdef VK_ENABLE_BETA_EXTENSIONS + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_ENQUEUE_PROPERTIES_AMDX = 1000134001, +#endif +#ifdef VK_ENABLE_BETA_EXTENSIONS + VK_STRUCTURE_TYPE_EXECUTION_GRAPH_PIPELINE_SCRATCH_SIZE_AMDX = 1000134002, +#endif +#ifdef VK_ENABLE_BETA_EXTENSIONS + VK_STRUCTURE_TYPE_EXECUTION_GRAPH_PIPELINE_CREATE_INFO_AMDX = 1000134003, +#endif +#ifdef VK_ENABLE_BETA_EXTENSIONS + VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_NODE_CREATE_INFO_AMDX = 1000134004, +#endif VK_STRUCTURE_TYPE_SAMPLE_LOCATIONS_INFO_EXT = 1000143000, VK_STRUCTURE_TYPE_RENDER_PASS_SAMPLE_LOCATIONS_BEGIN_INFO_EXT = 1000143001, VK_STRUCTURE_TYPE_PIPELINE_SAMPLE_LOCATIONS_STATE_CREATE_INFO_EXT = 1000143002, @@ -761,33 +675,18 @@ typedef enum VkStructureType { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_MEMORY_HOST_PROPERTIES_EXT = 1000178002, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_CLOCK_FEATURES_KHR = 1000181000, VK_STRUCTURE_TYPE_PIPELINE_COMPILER_CONTROL_CREATE_INFO_AMD = 1000183000, - VK_STRUCTURE_TYPE_CALIBRATED_TIMESTAMP_INFO_EXT = 1000184000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_CORE_PROPERTIES_AMD = 1000185000, -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_STRUCTURE_TYPE_VIDEO_DECODE_H265_CAPABILITIES_EXT = 1000187000, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_STRUCTURE_TYPE_VIDEO_DECODE_H265_SESSION_PARAMETERS_CREATE_INFO_EXT = 1000187001, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_STRUCTURE_TYPE_VIDEO_DECODE_H265_SESSION_PARAMETERS_ADD_INFO_EXT = 1000187002, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_STRUCTURE_TYPE_VIDEO_DECODE_H265_PROFILE_INFO_EXT = 1000187003, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_STRUCTURE_TYPE_VIDEO_DECODE_H265_PICTURE_INFO_EXT = 1000187004, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_STRUCTURE_TYPE_VIDEO_DECODE_H265_DPB_SLOT_INFO_EXT = 1000187005, -#endif + VK_STRUCTURE_TYPE_VIDEO_DECODE_H265_CAPABILITIES_KHR = 1000187000, + VK_STRUCTURE_TYPE_VIDEO_DECODE_H265_SESSION_PARAMETERS_CREATE_INFO_KHR = 1000187001, + VK_STRUCTURE_TYPE_VIDEO_DECODE_H265_SESSION_PARAMETERS_ADD_INFO_KHR = 1000187002, + VK_STRUCTURE_TYPE_VIDEO_DECODE_H265_PROFILE_INFO_KHR = 1000187003, + VK_STRUCTURE_TYPE_VIDEO_DECODE_H265_PICTURE_INFO_KHR = 1000187004, + VK_STRUCTURE_TYPE_VIDEO_DECODE_H265_DPB_SLOT_INFO_KHR = 1000187005, VK_STRUCTURE_TYPE_DEVICE_QUEUE_GLOBAL_PRIORITY_CREATE_INFO_KHR = 1000174000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GLOBAL_PRIORITY_QUERY_FEATURES_KHR = 1000388000, VK_STRUCTURE_TYPE_QUEUE_FAMILY_GLOBAL_PRIORITY_PROPERTIES_KHR = 1000388001, VK_STRUCTURE_TYPE_DEVICE_MEMORY_OVERALLOCATION_CREATE_INFO_AMD = 1000189000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VERTEX_ATTRIBUTE_DIVISOR_PROPERTIES_EXT = 1000190000, - VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_DIVISOR_STATE_CREATE_INFO_EXT = 1000190001, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VERTEX_ATTRIBUTE_DIVISOR_FEATURES_EXT = 1000190002, VK_STRUCTURE_TYPE_PRESENT_FRAME_TOKEN_GGP = 1000191000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COMPUTE_SHADER_DERIVATIVES_FEATURES_NV = 1000201000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MESH_SHADER_FEATURES_NV = 1000202000, @@ -856,7 +755,28 @@ typedef enum VkStructureType { VK_STRUCTURE_TYPE_PIPELINE_EXECUTABLE_INFO_KHR = 1000269003, VK_STRUCTURE_TYPE_PIPELINE_EXECUTABLE_STATISTIC_KHR = 1000269004, VK_STRUCTURE_TYPE_PIPELINE_EXECUTABLE_INTERNAL_REPRESENTATION_KHR = 1000269005, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_HOST_IMAGE_COPY_FEATURES_EXT = 1000270000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_HOST_IMAGE_COPY_PROPERTIES_EXT = 1000270001, + VK_STRUCTURE_TYPE_MEMORY_TO_IMAGE_COPY_EXT = 1000270002, + VK_STRUCTURE_TYPE_IMAGE_TO_MEMORY_COPY_EXT = 1000270003, + VK_STRUCTURE_TYPE_COPY_IMAGE_TO_MEMORY_INFO_EXT = 1000270004, + VK_STRUCTURE_TYPE_COPY_MEMORY_TO_IMAGE_INFO_EXT = 1000270005, + VK_STRUCTURE_TYPE_HOST_IMAGE_LAYOUT_TRANSITION_INFO_EXT = 1000270006, + VK_STRUCTURE_TYPE_COPY_IMAGE_TO_IMAGE_INFO_EXT = 1000270007, + VK_STRUCTURE_TYPE_SUBRESOURCE_HOST_MEMCPY_SIZE_EXT = 1000270008, + VK_STRUCTURE_TYPE_HOST_IMAGE_COPY_DEVICE_PERFORMANCE_QUERY_EXT = 1000270009, + VK_STRUCTURE_TYPE_MEMORY_MAP_INFO_KHR = 1000271000, + VK_STRUCTURE_TYPE_MEMORY_UNMAP_INFO_KHR = 1000271001, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_ATOMIC_FLOAT_2_FEATURES_EXT = 1000273000, + VK_STRUCTURE_TYPE_SURFACE_PRESENT_MODE_EXT = 1000274000, + VK_STRUCTURE_TYPE_SURFACE_PRESENT_SCALING_CAPABILITIES_EXT = 1000274001, + VK_STRUCTURE_TYPE_SURFACE_PRESENT_MODE_COMPATIBILITY_EXT = 1000274002, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SWAPCHAIN_MAINTENANCE_1_FEATURES_EXT = 1000275000, + VK_STRUCTURE_TYPE_SWAPCHAIN_PRESENT_FENCE_INFO_EXT = 1000275001, + VK_STRUCTURE_TYPE_SWAPCHAIN_PRESENT_MODES_CREATE_INFO_EXT = 1000275002, + VK_STRUCTURE_TYPE_SWAPCHAIN_PRESENT_MODE_INFO_EXT = 1000275003, + VK_STRUCTURE_TYPE_SWAPCHAIN_PRESENT_SCALING_CREATE_INFO_EXT = 1000275004, + VK_STRUCTURE_TYPE_RELEASE_SWAPCHAIN_IMAGES_INFO_EXT = 1000275005, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEVICE_GENERATED_COMMANDS_PROPERTIES_NV = 1000277000, VK_STRUCTURE_TYPE_GRAPHICS_SHADER_GROUP_CREATE_INFO_NV = 1000277001, VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_SHADER_GROUPS_CREATE_INFO_NV = 1000277002, @@ -870,6 +790,9 @@ typedef enum VkStructureType { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TEXEL_BUFFER_ALIGNMENT_FEATURES_EXT = 1000281000, VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_RENDER_PASS_TRANSFORM_INFO_QCOM = 1000282000, VK_STRUCTURE_TYPE_RENDER_PASS_TRANSFORM_BEGIN_INFO_QCOM = 1000282001, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_BIAS_CONTROL_FEATURES_EXT = 1000283000, + VK_STRUCTURE_TYPE_DEPTH_BIAS_INFO_EXT = 1000283001, + VK_STRUCTURE_TYPE_DEPTH_BIAS_REPRESENTATION_INFO_EXT = 1000283002, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEVICE_MEMORY_REPORT_FEATURES_EXT = 1000284000, VK_STRUCTURE_TYPE_DEVICE_DEVICE_MEMORY_REPORT_CREATE_INFO_EXT = 1000284001, VK_STRUCTURE_TYPE_DEVICE_MEMORY_REPORT_CALLBACK_DATA_EXT = 1000284002, @@ -879,25 +802,30 @@ typedef enum VkStructureType { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CUSTOM_BORDER_COLOR_PROPERTIES_EXT = 1000287001, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CUSTOM_BORDER_COLOR_FEATURES_EXT = 1000287002, VK_STRUCTURE_TYPE_PIPELINE_LIBRARY_CREATE_INFO_KHR = 1000290000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRESENT_BARRIER_FEATURES_NV = 1000292000, + VK_STRUCTURE_TYPE_SURFACE_CAPABILITIES_PRESENT_BARRIER_NV = 1000292001, + VK_STRUCTURE_TYPE_SWAPCHAIN_PRESENT_BARRIER_CREATE_INFO_NV = 1000292002, VK_STRUCTURE_TYPE_PRESENT_ID_KHR = 1000294000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRESENT_ID_FEATURES_KHR = 1000294001, -#ifdef VK_ENABLE_BETA_EXTENSIONS VK_STRUCTURE_TYPE_VIDEO_ENCODE_INFO_KHR = 1000299000, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS VK_STRUCTURE_TYPE_VIDEO_ENCODE_RATE_CONTROL_INFO_KHR = 1000299001, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS VK_STRUCTURE_TYPE_VIDEO_ENCODE_RATE_CONTROL_LAYER_INFO_KHR = 1000299002, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS VK_STRUCTURE_TYPE_VIDEO_ENCODE_CAPABILITIES_KHR = 1000299003, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS VK_STRUCTURE_TYPE_VIDEO_ENCODE_USAGE_INFO_KHR = 1000299004, -#endif + VK_STRUCTURE_TYPE_QUERY_POOL_VIDEO_ENCODE_FEEDBACK_CREATE_INFO_KHR = 1000299005, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VIDEO_ENCODE_QUALITY_LEVEL_INFO_KHR = 1000299006, + VK_STRUCTURE_TYPE_VIDEO_ENCODE_QUALITY_LEVEL_PROPERTIES_KHR = 1000299007, + VK_STRUCTURE_TYPE_VIDEO_ENCODE_QUALITY_LEVEL_INFO_KHR = 1000299008, + VK_STRUCTURE_TYPE_VIDEO_ENCODE_SESSION_PARAMETERS_GET_INFO_KHR = 1000299009, + VK_STRUCTURE_TYPE_VIDEO_ENCODE_SESSION_PARAMETERS_FEEDBACK_INFO_KHR = 1000299010, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DIAGNOSTICS_CONFIG_FEATURES_NV = 1000300000, VK_STRUCTURE_TYPE_DEVICE_DIAGNOSTICS_CONFIG_CREATE_INFO_NV = 1000300001, + VK_STRUCTURE_TYPE_CUDA_MODULE_CREATE_INFO_NV = 1000307000, + VK_STRUCTURE_TYPE_CUDA_FUNCTION_CREATE_INFO_NV = 1000307001, + VK_STRUCTURE_TYPE_CUDA_LAUNCH_INFO_NV = 1000307002, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CUDA_KERNEL_LAUNCH_FEATURES_NV = 1000307003, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CUDA_KERNEL_LAUNCH_PROPERTIES_NV = 1000307004, + VK_STRUCTURE_TYPE_QUERY_LOW_LATENCY_SUPPORT_NV = 1000310000, VK_STRUCTURE_TYPE_EXPORT_METAL_OBJECT_CREATE_INFO_EXT = 1000311000, VK_STRUCTURE_TYPE_EXPORT_METAL_OBJECTS_INFO_EXT = 1000311001, VK_STRUCTURE_TYPE_EXPORT_METAL_DEVICE_INFO_EXT = 1000311002, @@ -912,6 +840,19 @@ typedef enum VkStructureType { VK_STRUCTURE_TYPE_IMPORT_METAL_SHARED_EVENT_INFO_EXT = 1000311011, VK_STRUCTURE_TYPE_QUEUE_FAMILY_CHECKPOINT_PROPERTIES_2_NV = 1000314008, VK_STRUCTURE_TYPE_CHECKPOINT_DATA_2_NV = 1000314009, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_BUFFER_PROPERTIES_EXT = 1000316000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_BUFFER_DENSITY_MAP_PROPERTIES_EXT = 1000316001, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_BUFFER_FEATURES_EXT = 1000316002, + VK_STRUCTURE_TYPE_DESCRIPTOR_ADDRESS_INFO_EXT = 1000316003, + VK_STRUCTURE_TYPE_DESCRIPTOR_GET_INFO_EXT = 1000316004, + VK_STRUCTURE_TYPE_BUFFER_CAPTURE_DESCRIPTOR_DATA_INFO_EXT = 1000316005, + VK_STRUCTURE_TYPE_IMAGE_CAPTURE_DESCRIPTOR_DATA_INFO_EXT = 1000316006, + VK_STRUCTURE_TYPE_IMAGE_VIEW_CAPTURE_DESCRIPTOR_DATA_INFO_EXT = 1000316007, + VK_STRUCTURE_TYPE_SAMPLER_CAPTURE_DESCRIPTOR_DATA_INFO_EXT = 1000316008, + VK_STRUCTURE_TYPE_OPAQUE_CAPTURE_DESCRIPTOR_DATA_CREATE_INFO_EXT = 1000316010, + VK_STRUCTURE_TYPE_DESCRIPTOR_BUFFER_BINDING_INFO_EXT = 1000316011, + VK_STRUCTURE_TYPE_DESCRIPTOR_BUFFER_BINDING_PUSH_DESCRIPTOR_BUFFER_HANDLE_EXT = 1000316012, + VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_CAPTURE_DESCRIPTOR_DATA_INFO_EXT = 1000316009, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GRAPHICS_PIPELINE_LIBRARY_FEATURES_EXT = 1000320000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GRAPHICS_PIPELINE_LIBRARY_PROPERTIES_EXT = 1000320001, VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_LIBRARY_CREATE_INFO_EXT = 1000320002, @@ -934,19 +875,20 @@ typedef enum VkStructureType { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_WORKGROUP_MEMORY_EXPLICIT_LAYOUT_FEATURES_KHR = 1000336000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_COMPRESSION_CONTROL_FEATURES_EXT = 1000338000, VK_STRUCTURE_TYPE_IMAGE_COMPRESSION_CONTROL_EXT = 1000338001, - VK_STRUCTURE_TYPE_SUBRESOURCE_LAYOUT_2_EXT = 1000338002, - VK_STRUCTURE_TYPE_IMAGE_SUBRESOURCE_2_EXT = 1000338003, VK_STRUCTURE_TYPE_IMAGE_COMPRESSION_PROPERTIES_EXT = 1000338004, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ATTACHMENT_FEEDBACK_LOOP_LAYOUT_FEATURES_EXT = 1000339000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_4444_FORMATS_FEATURES_EXT = 1000340000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FAULT_FEATURES_EXT = 1000341000, + VK_STRUCTURE_TYPE_DEVICE_FAULT_COUNTS_EXT = 1000341001, + VK_STRUCTURE_TYPE_DEVICE_FAULT_INFO_EXT = 1000341002, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RGBA10X6_FORMATS_FEATURES_EXT = 1000344000, VK_STRUCTURE_TYPE_DIRECTFB_SURFACE_CREATE_INFO_EXT = 1000346000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MUTABLE_DESCRIPTOR_TYPE_FEATURES_VALVE = 1000351000, - VK_STRUCTURE_TYPE_MUTABLE_DESCRIPTOR_TYPE_CREATE_INFO_VALVE = 1000351002, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VERTEX_INPUT_DYNAMIC_STATE_FEATURES_EXT = 1000352000, VK_STRUCTURE_TYPE_VERTEX_INPUT_BINDING_DESCRIPTION_2_EXT = 1000352001, VK_STRUCTURE_TYPE_VERTEX_INPUT_ATTRIBUTE_DESCRIPTION_2_EXT = 1000352002, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DRM_PROPERTIES_EXT = 1000353000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ADDRESS_BINDING_REPORT_FEATURES_EXT = 1000354000, + VK_STRUCTURE_TYPE_DEVICE_ADDRESS_BINDING_CALLBACK_DATA_EXT = 1000354001, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_CLIP_CONTROL_FEATURES_EXT = 1000355000, VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_DEPTH_CLIP_CONTROL_CREATE_INFO_EXT = 1000355001, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRIMITIVE_TOPOLOGY_LIST_RESTART_FEATURES_EXT = 1000356000, @@ -973,6 +915,8 @@ typedef enum VkStructureType { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_MEMORY_RDMA_FEATURES_NV = 1000371001, VK_STRUCTURE_TYPE_PIPELINE_PROPERTIES_IDENTIFIER_EXT = 1000372000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PIPELINE_PROPERTIES_FEATURES_EXT = 1000372001, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAME_BOUNDARY_FEATURES_EXT = 1000375000, + VK_STRUCTURE_TYPE_FRAME_BOUNDARY_EXT = 1000375001, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTISAMPLED_RENDER_TO_SINGLE_SAMPLED_FEATURES_EXT = 1000376000, VK_STRUCTURE_TYPE_SUBPASS_RESOLVE_PERFORMANCE_QUERY_EXT = 1000376001, VK_STRUCTURE_TYPE_MULTISAMPLED_RENDER_TO_SINGLE_SAMPLED_INFO_EXT = 1000376002, @@ -987,36 +931,167 @@ typedef enum VkStructureType { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTI_DRAW_FEATURES_EXT = 1000392000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTI_DRAW_PROPERTIES_EXT = 1000392001, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_2D_VIEW_OF_3D_FEATURES_EXT = 1000393000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_TILE_IMAGE_FEATURES_EXT = 1000395000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_TILE_IMAGE_PROPERTIES_EXT = 1000395001, + VK_STRUCTURE_TYPE_MICROMAP_BUILD_INFO_EXT = 1000396000, + VK_STRUCTURE_TYPE_MICROMAP_VERSION_INFO_EXT = 1000396001, + VK_STRUCTURE_TYPE_COPY_MICROMAP_INFO_EXT = 1000396002, + VK_STRUCTURE_TYPE_COPY_MICROMAP_TO_MEMORY_INFO_EXT = 1000396003, + VK_STRUCTURE_TYPE_COPY_MEMORY_TO_MICROMAP_INFO_EXT = 1000396004, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_OPACITY_MICROMAP_FEATURES_EXT = 1000396005, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_OPACITY_MICROMAP_PROPERTIES_EXT = 1000396006, + VK_STRUCTURE_TYPE_MICROMAP_CREATE_INFO_EXT = 1000396007, + VK_STRUCTURE_TYPE_MICROMAP_BUILD_SIZES_INFO_EXT = 1000396008, + VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_TRIANGLES_OPACITY_MICROMAP_EXT = 1000396009, +#ifdef VK_ENABLE_BETA_EXTENSIONS + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DISPLACEMENT_MICROMAP_FEATURES_NV = 1000397000, +#endif +#ifdef VK_ENABLE_BETA_EXTENSIONS + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DISPLACEMENT_MICROMAP_PROPERTIES_NV = 1000397001, +#endif +#ifdef VK_ENABLE_BETA_EXTENSIONS + VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_TRIANGLES_DISPLACEMENT_MICROMAP_NV = 1000397002, +#endif + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CLUSTER_CULLING_SHADER_FEATURES_HUAWEI = 1000404000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CLUSTER_CULLING_SHADER_PROPERTIES_HUAWEI = 1000404001, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CLUSTER_CULLING_SHADER_VRS_FEATURES_HUAWEI = 1000404002, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BORDER_COLOR_SWIZZLE_FEATURES_EXT = 1000411000, VK_STRUCTURE_TYPE_SAMPLER_BORDER_COLOR_COMPONENT_MAPPING_CREATE_INFO_EXT = 1000411001, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PAGEABLE_DEVICE_LOCAL_MEMORY_FEATURES_EXT = 1000412000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_CORE_PROPERTIES_ARM = 1000415000, + VK_STRUCTURE_TYPE_DEVICE_QUEUE_SHADER_CORE_CONTROL_CREATE_INFO_ARM = 1000417000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SCHEDULING_CONTROLS_FEATURES_ARM = 1000417001, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SCHEDULING_CONTROLS_PROPERTIES_ARM = 1000417002, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_SLICED_VIEW_OF_3D_FEATURES_EXT = 1000418000, + VK_STRUCTURE_TYPE_IMAGE_VIEW_SLICED_CREATE_INFO_EXT = 1000418001, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_SET_HOST_MAPPING_FEATURES_VALVE = 1000420000, VK_STRUCTURE_TYPE_DESCRIPTOR_SET_BINDING_REFERENCE_VALVE = 1000420001, VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_HOST_MAPPING_INFO_VALVE = 1000420002, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_CLAMP_ZERO_ONE_FEATURES_EXT = 1000421000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_NON_SEAMLESS_CUBE_MAP_FEATURES_EXT = 1000422000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RENDER_PASS_STRIPED_FEATURES_ARM = 1000424000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RENDER_PASS_STRIPED_PROPERTIES_ARM = 1000424001, + VK_STRUCTURE_TYPE_RENDER_PASS_STRIPE_BEGIN_INFO_ARM = 1000424002, + VK_STRUCTURE_TYPE_RENDER_PASS_STRIPE_INFO_ARM = 1000424003, + VK_STRUCTURE_TYPE_RENDER_PASS_STRIPE_SUBMIT_INFO_ARM = 1000424004, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_DENSITY_MAP_OFFSET_FEATURES_QCOM = 1000425000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_DENSITY_MAP_OFFSET_PROPERTIES_QCOM = 1000425001, VK_STRUCTURE_TYPE_SUBPASS_FRAGMENT_DENSITY_MAP_OFFSET_END_INFO_QCOM = 1000425002, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COPY_MEMORY_INDIRECT_FEATURES_NV = 1000426000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COPY_MEMORY_INDIRECT_PROPERTIES_NV = 1000426001, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_DECOMPRESSION_FEATURES_NV = 1000427000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_DECOMPRESSION_PROPERTIES_NV = 1000427001, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEVICE_GENERATED_COMMANDS_COMPUTE_FEATURES_NV = 1000428000, + VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_INDIRECT_BUFFER_INFO_NV = 1000428001, + VK_STRUCTURE_TYPE_PIPELINE_INDIRECT_DEVICE_ADDRESS_INFO_NV = 1000428002, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_LINEAR_COLOR_ATTACHMENT_FEATURES_NV = 1000430000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_COMPRESSION_CONTROL_SWAPCHAIN_FEATURES_EXT = 1000437000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_PROCESSING_FEATURES_QCOM = 1000440000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_PROCESSING_PROPERTIES_QCOM = 1000440001, VK_STRUCTURE_TYPE_IMAGE_VIEW_SAMPLE_WEIGHT_CREATE_INFO_QCOM = 1000440002, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_NESTED_COMMAND_BUFFER_FEATURES_EXT = 1000451000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_NESTED_COMMAND_BUFFER_PROPERTIES_EXT = 1000451001, + VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_ACQUIRE_UNMODIFIED_EXT = 1000453000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_DYNAMIC_STATE_3_FEATURES_EXT = 1000455000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_DYNAMIC_STATE_3_PROPERTIES_EXT = 1000455001, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBPASS_MERGE_FEEDBACK_FEATURES_EXT = 1000458000, VK_STRUCTURE_TYPE_RENDER_PASS_CREATION_CONTROL_EXT = 1000458001, VK_STRUCTURE_TYPE_RENDER_PASS_CREATION_FEEDBACK_CREATE_INFO_EXT = 1000458002, VK_STRUCTURE_TYPE_RENDER_PASS_SUBPASS_FEEDBACK_CREATE_INFO_EXT = 1000458003, + VK_STRUCTURE_TYPE_DIRECT_DRIVER_LOADING_INFO_LUNARG = 1000459000, + VK_STRUCTURE_TYPE_DIRECT_DRIVER_LOADING_LIST_LUNARG = 1000459001, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_MODULE_IDENTIFIER_FEATURES_EXT = 1000462000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_MODULE_IDENTIFIER_PROPERTIES_EXT = 1000462001, VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_MODULE_IDENTIFIER_CREATE_INFO_EXT = 1000462002, VK_STRUCTURE_TYPE_SHADER_MODULE_IDENTIFIER_EXT = 1000462003, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RASTERIZATION_ORDER_ATTACHMENT_ACCESS_FEATURES_EXT = 1000342000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_OPTICAL_FLOW_FEATURES_NV = 1000464000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_OPTICAL_FLOW_PROPERTIES_NV = 1000464001, + VK_STRUCTURE_TYPE_OPTICAL_FLOW_IMAGE_FORMAT_INFO_NV = 1000464002, + VK_STRUCTURE_TYPE_OPTICAL_FLOW_IMAGE_FORMAT_PROPERTIES_NV = 1000464003, + VK_STRUCTURE_TYPE_OPTICAL_FLOW_SESSION_CREATE_INFO_NV = 1000464004, + VK_STRUCTURE_TYPE_OPTICAL_FLOW_EXECUTE_INFO_NV = 1000464005, + VK_STRUCTURE_TYPE_OPTICAL_FLOW_SESSION_CREATE_PRIVATE_DATA_INFO_NV = 1000464010, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_LEGACY_DITHERING_FEATURES_EXT = 1000465000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PIPELINE_PROTECTED_ACCESS_FEATURES_EXT = 1000466000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_FORMAT_RESOLVE_FEATURES_ANDROID = 1000468000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_FORMAT_RESOLVE_PROPERTIES_ANDROID = 1000468001, + VK_STRUCTURE_TYPE_ANDROID_HARDWARE_BUFFER_FORMAT_RESOLVE_PROPERTIES_ANDROID = 1000468002, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_5_FEATURES_KHR = 1000470000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_5_PROPERTIES_KHR = 1000470001, + VK_STRUCTURE_TYPE_RENDERING_AREA_INFO_KHR = 1000470003, + VK_STRUCTURE_TYPE_DEVICE_IMAGE_SUBRESOURCE_INFO_KHR = 1000470004, + VK_STRUCTURE_TYPE_SUBRESOURCE_LAYOUT_2_KHR = 1000338002, + VK_STRUCTURE_TYPE_IMAGE_SUBRESOURCE_2_KHR = 1000338003, + VK_STRUCTURE_TYPE_PIPELINE_CREATE_FLAGS_2_CREATE_INFO_KHR = 1000470005, + VK_STRUCTURE_TYPE_BUFFER_USAGE_FLAGS_2_CREATE_INFO_KHR = 1000470006, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_POSITION_FETCH_FEATURES_KHR = 1000481000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_OBJECT_FEATURES_EXT = 1000482000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_OBJECT_PROPERTIES_EXT = 1000482001, + VK_STRUCTURE_TYPE_SHADER_CREATE_INFO_EXT = 1000482002, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TILE_PROPERTIES_FEATURES_QCOM = 1000484000, VK_STRUCTURE_TYPE_TILE_PROPERTIES_QCOM = 1000484001, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_AMIGO_PROFILING_FEATURES_SEC = 1000485000, VK_STRUCTURE_TYPE_AMIGO_PROFILING_SUBMIT_INFO_SEC = 1000485001, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_PER_VIEW_VIEWPORTS_FEATURES_QCOM = 1000488000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_INVOCATION_REORDER_FEATURES_NV = 1000490000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_INVOCATION_REORDER_PROPERTIES_NV = 1000490001, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_SPARSE_ADDRESS_SPACE_FEATURES_NV = 1000492000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_SPARSE_ADDRESS_SPACE_PROPERTIES_NV = 1000492001, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MUTABLE_DESCRIPTOR_TYPE_FEATURES_EXT = 1000351000, + VK_STRUCTURE_TYPE_MUTABLE_DESCRIPTOR_TYPE_CREATE_INFO_EXT = 1000351002, + VK_STRUCTURE_TYPE_LAYER_SETTINGS_CREATE_INFO_EXT = 1000496000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_CORE_BUILTINS_FEATURES_ARM = 1000497000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_CORE_BUILTINS_PROPERTIES_ARM = 1000497001, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PIPELINE_LIBRARY_GROUP_HANDLES_FEATURES_EXT = 1000498000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DYNAMIC_RENDERING_UNUSED_ATTACHMENTS_FEATURES_EXT = 1000499000, + VK_STRUCTURE_TYPE_LATENCY_SLEEP_MODE_INFO_NV = 1000505000, + VK_STRUCTURE_TYPE_LATENCY_SLEEP_INFO_NV = 1000505001, + VK_STRUCTURE_TYPE_SET_LATENCY_MARKER_INFO_NV = 1000505002, + VK_STRUCTURE_TYPE_GET_LATENCY_MARKER_INFO_NV = 1000505003, + VK_STRUCTURE_TYPE_LATENCY_TIMINGS_FRAME_REPORT_NV = 1000505004, + VK_STRUCTURE_TYPE_LATENCY_SUBMISSION_PRESENT_ID_NV = 1000505005, + VK_STRUCTURE_TYPE_OUT_OF_BAND_QUEUE_TYPE_INFO_NV = 1000505006, + VK_STRUCTURE_TYPE_SWAPCHAIN_LATENCY_CREATE_INFO_NV = 1000505007, + VK_STRUCTURE_TYPE_LATENCY_SURFACE_CAPABILITIES_NV = 1000505008, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COOPERATIVE_MATRIX_FEATURES_KHR = 1000506000, + VK_STRUCTURE_TYPE_COOPERATIVE_MATRIX_PROPERTIES_KHR = 1000506001, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COOPERATIVE_MATRIX_PROPERTIES_KHR = 1000506002, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_PER_VIEW_RENDER_AREAS_FEATURES_QCOM = 1000510000, + VK_STRUCTURE_TYPE_MULTIVIEW_PER_VIEW_RENDER_AREAS_RENDER_PASS_BEGIN_INFO_QCOM = 1000510001, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VIDEO_MAINTENANCE_1_FEATURES_KHR = 1000515000, + VK_STRUCTURE_TYPE_VIDEO_INLINE_QUERY_INFO_KHR = 1000515001, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PER_STAGE_DESCRIPTOR_SET_FEATURES_NV = 1000516000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_PROCESSING_2_FEATURES_QCOM = 1000518000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_PROCESSING_2_PROPERTIES_QCOM = 1000518001, + VK_STRUCTURE_TYPE_SAMPLER_BLOCK_MATCH_WINDOW_CREATE_INFO_QCOM = 1000518002, + VK_STRUCTURE_TYPE_SAMPLER_CUBIC_WEIGHTS_CREATE_INFO_QCOM = 1000519000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CUBIC_WEIGHTS_FEATURES_QCOM = 1000519001, + VK_STRUCTURE_TYPE_BLIT_IMAGE_CUBIC_WEIGHTS_INFO_QCOM = 1000519002, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_YCBCR_DEGAMMA_FEATURES_QCOM = 1000520000, + VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_YCBCR_DEGAMMA_CREATE_INFO_QCOM = 1000520001, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CUBIC_CLAMP_FEATURES_QCOM = 1000521000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ATTACHMENT_FEEDBACK_LOOP_DYNAMIC_STATE_FEATURES_EXT = 1000524000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VERTEX_ATTRIBUTE_DIVISOR_PROPERTIES_KHR = 1000525000, + VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_DIVISOR_STATE_CREATE_INFO_KHR = 1000190001, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VERTEX_ATTRIBUTE_DIVISOR_FEATURES_KHR = 1000190002, + VK_STRUCTURE_TYPE_SCREEN_BUFFER_PROPERTIES_QNX = 1000529000, + VK_STRUCTURE_TYPE_SCREEN_BUFFER_FORMAT_PROPERTIES_QNX = 1000529001, + VK_STRUCTURE_TYPE_IMPORT_SCREEN_BUFFER_INFO_QNX = 1000529002, + VK_STRUCTURE_TYPE_EXTERNAL_FORMAT_QNX = 1000529003, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_MEMORY_SCREEN_BUFFER_FEATURES_QNX = 1000529004, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_LAYERED_DRIVER_PROPERTIES_MSFT = 1000530000, + VK_STRUCTURE_TYPE_CALIBRATED_TIMESTAMP_INFO_KHR = 1000184000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_6_FEATURES_KHR = 1000545000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_6_PROPERTIES_KHR = 1000545001, + VK_STRUCTURE_TYPE_BIND_MEMORY_STATUS_KHR = 1000545002, + VK_STRUCTURE_TYPE_BIND_DESCRIPTOR_SETS_INFO_KHR = 1000545003, + VK_STRUCTURE_TYPE_PUSH_CONSTANTS_INFO_KHR = 1000545004, + VK_STRUCTURE_TYPE_PUSH_DESCRIPTOR_SET_INFO_KHR = 1000545005, + VK_STRUCTURE_TYPE_PUSH_DESCRIPTOR_SET_WITH_TEMPLATE_INFO_KHR = 1000545006, + VK_STRUCTURE_TYPE_SET_DESCRIPTOR_BUFFER_OFFSETS_INFO_EXT = 1000545007, + VK_STRUCTURE_TYPE_BIND_DESCRIPTOR_BUFFER_EMBEDDED_SAMPLERS_INFO_EXT = 1000545008, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_POOL_OVERALLOCATION_FEATURES_NV = 1000546000, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTER_FEATURES = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTERS_FEATURES, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_DRAW_PARAMETER_FEATURES = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_DRAW_PARAMETERS_FEATURES, VK_STRUCTURE_TYPE_DEBUG_REPORT_CREATE_INFO_EXT = VK_STRUCTURE_TYPE_DEBUG_REPORT_CALLBACK_CREATE_INFO_EXT, @@ -1117,6 +1192,9 @@ typedef enum VkStructureType { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_SUBGROUP_EXTENDED_TYPES_FEATURES_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_SUBGROUP_EXTENDED_TYPES_FEATURES, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_8BIT_STORAGE_FEATURES_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_8BIT_STORAGE_FEATURES, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_ATOMIC_INT64_FEATURES_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_ATOMIC_INT64_FEATURES, + VK_STRUCTURE_TYPE_CALIBRATED_TIMESTAMP_INFO_EXT = VK_STRUCTURE_TYPE_CALIBRATED_TIMESTAMP_INFO_KHR, + VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_DIVISOR_STATE_CREATE_INFO_EXT = VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_DIVISOR_STATE_CREATE_INFO_KHR, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VERTEX_ATTRIBUTE_DIVISOR_FEATURES_EXT = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VERTEX_ATTRIBUTE_DIVISOR_FEATURES_KHR, VK_STRUCTURE_TYPE_PIPELINE_CREATION_FEEDBACK_CREATE_INFO_EXT = VK_STRUCTURE_TYPE_PIPELINE_CREATION_FEEDBACK_CREATE_INFO, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DRIVER_PROPERTIES_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DRIVER_PROPERTIES, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FLOAT_CONTROLS_PROPERTIES_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FLOAT_CONTROLS_PROPERTIES, @@ -1179,7 +1257,11 @@ typedef enum VkStructureType { VK_STRUCTURE_TYPE_IMAGE_BLIT_2_KHR = VK_STRUCTURE_TYPE_IMAGE_BLIT_2, VK_STRUCTURE_TYPE_BUFFER_IMAGE_COPY_2_KHR = VK_STRUCTURE_TYPE_BUFFER_IMAGE_COPY_2, VK_STRUCTURE_TYPE_IMAGE_RESOLVE_2_KHR = VK_STRUCTURE_TYPE_IMAGE_RESOLVE_2, + VK_STRUCTURE_TYPE_SUBRESOURCE_LAYOUT_2_EXT = VK_STRUCTURE_TYPE_SUBRESOURCE_LAYOUT_2_KHR, + VK_STRUCTURE_TYPE_IMAGE_SUBRESOURCE_2_EXT = VK_STRUCTURE_TYPE_IMAGE_SUBRESOURCE_2_KHR, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RASTERIZATION_ORDER_ATTACHMENT_ACCESS_FEATURES_ARM = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RASTERIZATION_ORDER_ATTACHMENT_ACCESS_FEATURES_EXT, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MUTABLE_DESCRIPTOR_TYPE_FEATURES_VALVE = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MUTABLE_DESCRIPTOR_TYPE_FEATURES_EXT, + VK_STRUCTURE_TYPE_MUTABLE_DESCRIPTOR_TYPE_CREATE_INFO_VALVE = VK_STRUCTURE_TYPE_MUTABLE_DESCRIPTOR_TYPE_CREATE_INFO_EXT, VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_3_KHR = VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_3, VK_STRUCTURE_TYPE_PIPELINE_INFO_EXT = VK_STRUCTURE_TYPE_PIPELINE_INFO_KHR, VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GLOBAL_PRIORITY_QUERY_FEATURES_EXT = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GLOBAL_PRIORITY_QUERY_FEATURES_KHR, @@ -1188,6 +1270,7 @@ typedef enum VkStructureType { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_4_PROPERTIES_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_4_PROPERTIES, VK_STRUCTURE_TYPE_DEVICE_BUFFER_MEMORY_REQUIREMENTS_KHR = VK_STRUCTURE_TYPE_DEVICE_BUFFER_MEMORY_REQUIREMENTS, VK_STRUCTURE_TYPE_DEVICE_IMAGE_MEMORY_REQUIREMENTS_KHR = VK_STRUCTURE_TYPE_DEVICE_IMAGE_MEMORY_REQUIREMENTS, + VK_STRUCTURE_TYPE_SHADER_REQUIRED_SUBGROUP_SIZE_CREATE_INFO_EXT = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_REQUIRED_SUBGROUP_SIZE_CREATE_INFO, VK_STRUCTURE_TYPE_MAX_ENUM = 0x7FFFFFFF } VkStructureType; @@ -1215,27 +1298,15 @@ typedef enum VkImageLayout { VK_IMAGE_LAYOUT_READ_ONLY_OPTIMAL = 1000314000, VK_IMAGE_LAYOUT_ATTACHMENT_OPTIMAL = 1000314001, VK_IMAGE_LAYOUT_PRESENT_SRC_KHR = 1000001002, -#ifdef VK_ENABLE_BETA_EXTENSIONS VK_IMAGE_LAYOUT_VIDEO_DECODE_DST_KHR = 1000024000, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS VK_IMAGE_LAYOUT_VIDEO_DECODE_SRC_KHR = 1000024001, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS VK_IMAGE_LAYOUT_VIDEO_DECODE_DPB_KHR = 1000024002, -#endif VK_IMAGE_LAYOUT_SHARED_PRESENT_KHR = 1000111000, VK_IMAGE_LAYOUT_FRAGMENT_DENSITY_MAP_OPTIMAL_EXT = 1000218000, VK_IMAGE_LAYOUT_FRAGMENT_SHADING_RATE_ATTACHMENT_OPTIMAL_KHR = 1000164003, -#ifdef VK_ENABLE_BETA_EXTENSIONS VK_IMAGE_LAYOUT_VIDEO_ENCODE_DST_KHR = 1000299000, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS VK_IMAGE_LAYOUT_VIDEO_ENCODE_SRC_KHR = 1000299001, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS VK_IMAGE_LAYOUT_VIDEO_ENCODE_DPB_KHR = 1000299002, -#endif VK_IMAGE_LAYOUT_ATTACHMENT_FEEDBACK_LOOP_OPTIMAL_EXT = 1000339000, VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL_KHR = VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL, VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL_KHR = VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL, @@ -1284,12 +1355,8 @@ typedef enum VkObjectType { VK_OBJECT_TYPE_DISPLAY_KHR = 1000002000, VK_OBJECT_TYPE_DISPLAY_MODE_KHR = 1000002001, VK_OBJECT_TYPE_DEBUG_REPORT_CALLBACK_EXT = 1000011000, -#ifdef VK_ENABLE_BETA_EXTENSIONS VK_OBJECT_TYPE_VIDEO_SESSION_KHR = 1000023000, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS VK_OBJECT_TYPE_VIDEO_SESSION_PARAMETERS_KHR = 1000023001, -#endif VK_OBJECT_TYPE_CU_MODULE_NVX = 1000029000, VK_OBJECT_TYPE_CU_FUNCTION_NVX = 1000029001, VK_OBJECT_TYPE_DEBUG_UTILS_MESSENGER_EXT = 1000128000, @@ -1299,7 +1366,12 @@ typedef enum VkObjectType { VK_OBJECT_TYPE_PERFORMANCE_CONFIGURATION_INTEL = 1000210000, VK_OBJECT_TYPE_DEFERRED_OPERATION_KHR = 1000268000, VK_OBJECT_TYPE_INDIRECT_COMMANDS_LAYOUT_NV = 1000277000, + VK_OBJECT_TYPE_CUDA_MODULE_NV = 1000307000, + VK_OBJECT_TYPE_CUDA_FUNCTION_NV = 1000307001, VK_OBJECT_TYPE_BUFFER_COLLECTION_FUCHSIA = 1000366000, + VK_OBJECT_TYPE_MICROMAP_EXT = 1000396000, + VK_OBJECT_TYPE_OPTICAL_FLOW_SESSION_NV = 1000464000, + VK_OBJECT_TYPE_SHADER_EXT = 1000482000, VK_OBJECT_TYPE_DESCRIPTOR_UPDATE_TEMPLATE_KHR = VK_OBJECT_TYPE_DESCRIPTOR_UPDATE_TEMPLATE, VK_OBJECT_TYPE_SAMPLER_YCBCR_CONVERSION_KHR = VK_OBJECT_TYPE_SAMPLER_YCBCR_CONVERSION, VK_OBJECT_TYPE_PRIVATE_DATA_SLOT_EXT = VK_OBJECT_TYPE_PRIVATE_DATA_SLOT, @@ -1313,6 +1385,7 @@ typedef enum VkVendorId { VK_VENDOR_ID_CODEPLAY = 0x10004, VK_VENDOR_ID_MESA = 0x10005, VK_VENDOR_ID_POCL = 0x10006, + VK_VENDOR_ID_MOBILEYE = 0x10007, VK_VENDOR_ID_MAX_ENUM = 0x7FFFFFFF } VkVendorId; @@ -1578,6 +1651,9 @@ typedef enum VkFormat { VK_FORMAT_PVRTC1_4BPP_SRGB_BLOCK_IMG = 1000054005, VK_FORMAT_PVRTC2_2BPP_SRGB_BLOCK_IMG = 1000054006, VK_FORMAT_PVRTC2_4BPP_SRGB_BLOCK_IMG = 1000054007, + VK_FORMAT_R16G16_S10_5_NV = 1000464000, + VK_FORMAT_A1B5G5R5_UNORM_PACK16_KHR = 1000470000, + VK_FORMAT_A8_UNORM_KHR = 1000470001, VK_FORMAT_ASTC_4x4_SFLOAT_BLOCK_EXT = VK_FORMAT_ASTC_4x4_SFLOAT_BLOCK, VK_FORMAT_ASTC_5x4_SFLOAT_BLOCK_EXT = VK_FORMAT_ASTC_5x4_SFLOAT_BLOCK, VK_FORMAT_ASTC_5x5_SFLOAT_BLOCK_EXT = VK_FORMAT_ASTC_5x5_SFLOAT_BLOCK, @@ -1662,22 +1738,20 @@ typedef enum VkQueryType { VK_QUERY_TYPE_OCCLUSION = 0, VK_QUERY_TYPE_PIPELINE_STATISTICS = 1, VK_QUERY_TYPE_TIMESTAMP = 2, -#ifdef VK_ENABLE_BETA_EXTENSIONS VK_QUERY_TYPE_RESULT_STATUS_ONLY_KHR = 1000023000, -#endif VK_QUERY_TYPE_TRANSFORM_FEEDBACK_STREAM_EXT = 1000028004, VK_QUERY_TYPE_PERFORMANCE_QUERY_KHR = 1000116000, VK_QUERY_TYPE_ACCELERATION_STRUCTURE_COMPACTED_SIZE_KHR = 1000150000, VK_QUERY_TYPE_ACCELERATION_STRUCTURE_SERIALIZATION_SIZE_KHR = 1000150001, VK_QUERY_TYPE_ACCELERATION_STRUCTURE_COMPACTED_SIZE_NV = 1000165000, VK_QUERY_TYPE_PERFORMANCE_QUERY_INTEL = 1000210000, -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_QUERY_TYPE_VIDEO_ENCODE_BITSTREAM_BUFFER_RANGE_KHR = 1000299000, -#endif + VK_QUERY_TYPE_VIDEO_ENCODE_FEEDBACK_KHR = 1000299000, VK_QUERY_TYPE_MESH_PRIMITIVES_GENERATED_EXT = 1000328000, VK_QUERY_TYPE_PRIMITIVES_GENERATED_EXT = 1000382000, VK_QUERY_TYPE_ACCELERATION_STRUCTURE_SERIALIZATION_BOTTOM_LEVEL_POINTERS_KHR = 1000386000, VK_QUERY_TYPE_ACCELERATION_STRUCTURE_SIZE_KHR = 1000386001, + VK_QUERY_TYPE_MICROMAP_SERIALIZATION_SIZE_EXT = 1000396000, + VK_QUERY_TYPE_MICROMAP_COMPACTED_SIZE_EXT = 1000396001, VK_QUERY_TYPE_MAX_ENUM = 0x7FFFFFFF } VkQueryType; @@ -1826,10 +1900,13 @@ typedef enum VkDynamicState { VK_DYNAMIC_STATE_PRIMITIVE_RESTART_ENABLE = 1000377004, VK_DYNAMIC_STATE_VIEWPORT_W_SCALING_NV = 1000087000, VK_DYNAMIC_STATE_DISCARD_RECTANGLE_EXT = 1000099000, + VK_DYNAMIC_STATE_DISCARD_RECTANGLE_ENABLE_EXT = 1000099001, + VK_DYNAMIC_STATE_DISCARD_RECTANGLE_MODE_EXT = 1000099002, VK_DYNAMIC_STATE_SAMPLE_LOCATIONS_EXT = 1000143000, VK_DYNAMIC_STATE_RAY_TRACING_PIPELINE_STACK_SIZE_KHR = 1000347000, VK_DYNAMIC_STATE_VIEWPORT_SHADING_RATE_PALETTE_NV = 1000164004, VK_DYNAMIC_STATE_VIEWPORT_COARSE_SAMPLE_ORDER_NV = 1000164006, + VK_DYNAMIC_STATE_EXCLUSIVE_SCISSOR_ENABLE_NV = 1000205000, VK_DYNAMIC_STATE_EXCLUSIVE_SCISSOR_NV = 1000205001, VK_DYNAMIC_STATE_FRAGMENT_SHADING_RATE_KHR = 1000226000, VK_DYNAMIC_STATE_LINE_STIPPLE_EXT = 1000259000, @@ -1837,6 +1914,38 @@ typedef enum VkDynamicState { VK_DYNAMIC_STATE_PATCH_CONTROL_POINTS_EXT = 1000377000, VK_DYNAMIC_STATE_LOGIC_OP_EXT = 1000377003, VK_DYNAMIC_STATE_COLOR_WRITE_ENABLE_EXT = 1000381000, + VK_DYNAMIC_STATE_TESSELLATION_DOMAIN_ORIGIN_EXT = 1000455002, + VK_DYNAMIC_STATE_DEPTH_CLAMP_ENABLE_EXT = 1000455003, + VK_DYNAMIC_STATE_POLYGON_MODE_EXT = 1000455004, + VK_DYNAMIC_STATE_RASTERIZATION_SAMPLES_EXT = 1000455005, + VK_DYNAMIC_STATE_SAMPLE_MASK_EXT = 1000455006, + VK_DYNAMIC_STATE_ALPHA_TO_COVERAGE_ENABLE_EXT = 1000455007, + VK_DYNAMIC_STATE_ALPHA_TO_ONE_ENABLE_EXT = 1000455008, + VK_DYNAMIC_STATE_LOGIC_OP_ENABLE_EXT = 1000455009, + VK_DYNAMIC_STATE_COLOR_BLEND_ENABLE_EXT = 1000455010, + VK_DYNAMIC_STATE_COLOR_BLEND_EQUATION_EXT = 1000455011, + VK_DYNAMIC_STATE_COLOR_WRITE_MASK_EXT = 1000455012, + VK_DYNAMIC_STATE_RASTERIZATION_STREAM_EXT = 1000455013, + VK_DYNAMIC_STATE_CONSERVATIVE_RASTERIZATION_MODE_EXT = 1000455014, + VK_DYNAMIC_STATE_EXTRA_PRIMITIVE_OVERESTIMATION_SIZE_EXT = 1000455015, + VK_DYNAMIC_STATE_DEPTH_CLIP_ENABLE_EXT = 1000455016, + VK_DYNAMIC_STATE_SAMPLE_LOCATIONS_ENABLE_EXT = 1000455017, + VK_DYNAMIC_STATE_COLOR_BLEND_ADVANCED_EXT = 1000455018, + VK_DYNAMIC_STATE_PROVOKING_VERTEX_MODE_EXT = 1000455019, + VK_DYNAMIC_STATE_LINE_RASTERIZATION_MODE_EXT = 1000455020, + VK_DYNAMIC_STATE_LINE_STIPPLE_ENABLE_EXT = 1000455021, + VK_DYNAMIC_STATE_DEPTH_CLIP_NEGATIVE_ONE_TO_ONE_EXT = 1000455022, + VK_DYNAMIC_STATE_VIEWPORT_W_SCALING_ENABLE_NV = 1000455023, + VK_DYNAMIC_STATE_VIEWPORT_SWIZZLE_NV = 1000455024, + VK_DYNAMIC_STATE_COVERAGE_TO_COLOR_ENABLE_NV = 1000455025, + VK_DYNAMIC_STATE_COVERAGE_TO_COLOR_LOCATION_NV = 1000455026, + VK_DYNAMIC_STATE_COVERAGE_MODULATION_MODE_NV = 1000455027, + VK_DYNAMIC_STATE_COVERAGE_MODULATION_TABLE_ENABLE_NV = 1000455028, + VK_DYNAMIC_STATE_COVERAGE_MODULATION_TABLE_NV = 1000455029, + VK_DYNAMIC_STATE_SHADING_RATE_IMAGE_ENABLE_NV = 1000455030, + VK_DYNAMIC_STATE_REPRESENTATIVE_FRAGMENT_TEST_ENABLE_NV = 1000455031, + VK_DYNAMIC_STATE_COVERAGE_REDUCTION_MODE_NV = 1000455032, + VK_DYNAMIC_STATE_ATTACHMENT_FEEDBACK_LOOP_ENABLE_EXT = 1000524000, VK_DYNAMIC_STATE_CULL_MODE_EXT = VK_DYNAMIC_STATE_CULL_MODE, VK_DYNAMIC_STATE_FRONT_FACE_EXT = VK_DYNAMIC_STATE_FRONT_FACE, VK_DYNAMIC_STATE_PRIMITIVE_TOPOLOGY_EXT = VK_DYNAMIC_STATE_PRIMITIVE_TOPOLOGY, @@ -1973,10 +2082,11 @@ typedef enum VkDescriptorType { VK_DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK = 1000138000, VK_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_KHR = 1000150000, VK_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_NV = 1000165000, - VK_DESCRIPTOR_TYPE_MUTABLE_VALVE = 1000351000, VK_DESCRIPTOR_TYPE_SAMPLE_WEIGHT_IMAGE_QCOM = 1000440000, VK_DESCRIPTOR_TYPE_BLOCK_MATCH_IMAGE_QCOM = 1000440001, + VK_DESCRIPTOR_TYPE_MUTABLE_EXT = 1000351000, VK_DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK_EXT = VK_DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK, + VK_DESCRIPTOR_TYPE_MUTABLE_VALVE = VK_DESCRIPTOR_TYPE_MUTABLE_EXT, VK_DESCRIPTOR_TYPE_MAX_ENUM = 0x7FFFFFFF } VkDescriptorType; @@ -2001,6 +2111,9 @@ typedef enum VkAttachmentStoreOp { typedef enum VkPipelineBindPoint { VK_PIPELINE_BIND_POINT_GRAPHICS = 0, VK_PIPELINE_BIND_POINT_COMPUTE = 1, +#ifdef VK_ENABLE_BETA_EXTENSIONS + VK_PIPELINE_BIND_POINT_EXECUTION_GRAPH_AMDX = 1000134000, +#endif VK_PIPELINE_BIND_POINT_RAY_TRACING_KHR = 1000165000, VK_PIPELINE_BIND_POINT_SUBPASS_SHADING_HUAWEI = 1000369003, VK_PIPELINE_BIND_POINT_RAY_TRACING_NV = VK_PIPELINE_BIND_POINT_RAY_TRACING_KHR, @@ -2025,6 +2138,7 @@ typedef enum VkIndexType { typedef enum VkSubpassContents { VK_SUBPASS_CONTENTS_INLINE = 0, VK_SUBPASS_CONTENTS_SECONDARY_COMMAND_BUFFERS = 1, + VK_SUBPASS_CONTENTS_INLINE_AND_SECONDARY_COMMAND_BUFFERS_EXT = 1000451000, VK_SUBPASS_CONTENTS_MAX_ENUM = 0x7FFFFFFF } VkSubpassContents; @@ -2111,22 +2225,14 @@ typedef enum VkFormatFeatureFlagBits { VK_FORMAT_FEATURE_DISJOINT_BIT = 0x00400000, VK_FORMAT_FEATURE_COSITED_CHROMA_SAMPLES_BIT = 0x00800000, VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_MINMAX_BIT = 0x00010000, -#ifdef VK_ENABLE_BETA_EXTENSIONS VK_FORMAT_FEATURE_VIDEO_DECODE_OUTPUT_BIT_KHR = 0x02000000, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS VK_FORMAT_FEATURE_VIDEO_DECODE_DPB_BIT_KHR = 0x04000000, -#endif VK_FORMAT_FEATURE_ACCELERATION_STRUCTURE_VERTEX_BUFFER_BIT_KHR = 0x20000000, VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_CUBIC_BIT_EXT = 0x00002000, VK_FORMAT_FEATURE_FRAGMENT_DENSITY_MAP_BIT_EXT = 0x01000000, VK_FORMAT_FEATURE_FRAGMENT_SHADING_RATE_ATTACHMENT_BIT_KHR = 0x40000000, -#ifdef VK_ENABLE_BETA_EXTENSIONS VK_FORMAT_FEATURE_VIDEO_ENCODE_INPUT_BIT_KHR = 0x08000000, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS VK_FORMAT_FEATURE_VIDEO_ENCODE_DPB_BIT_KHR = 0x10000000, -#endif VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_CUBIC_BIT_IMG = VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_CUBIC_BIT_EXT, VK_FORMAT_FEATURE_TRANSFER_SRC_BIT_KHR = VK_FORMAT_FEATURE_TRANSFER_SRC_BIT, VK_FORMAT_FEATURE_TRANSFER_DST_BIT_KHR = VK_FORMAT_FEATURE_TRANSFER_DST_BIT, @@ -2158,9 +2264,11 @@ typedef enum VkImageCreateFlagBits { VK_IMAGE_CREATE_CORNER_SAMPLED_BIT_NV = 0x00002000, VK_IMAGE_CREATE_SAMPLE_LOCATIONS_COMPATIBLE_DEPTH_BIT_EXT = 0x00001000, VK_IMAGE_CREATE_SUBSAMPLED_BIT_EXT = 0x00004000, + VK_IMAGE_CREATE_DESCRIPTOR_BUFFER_CAPTURE_REPLAY_BIT_EXT = 0x00010000, VK_IMAGE_CREATE_MULTISAMPLED_RENDER_TO_SINGLE_SAMPLED_BIT_EXT = 0x00040000, VK_IMAGE_CREATE_2D_VIEW_COMPATIBLE_BIT_EXT = 0x00020000, VK_IMAGE_CREATE_FRAGMENT_DENSITY_MAP_OFFSET_BIT_QCOM = 0x00008000, + VK_IMAGE_CREATE_VIDEO_PROFILE_INDEPENDENT_BIT_KHR = 0x00100000, VK_IMAGE_CREATE_SPLIT_INSTANCE_BIND_REGIONS_BIT_KHR = VK_IMAGE_CREATE_SPLIT_INSTANCE_BIND_REGIONS_BIT, VK_IMAGE_CREATE_2D_ARRAY_COMPATIBLE_BIT_KHR = VK_IMAGE_CREATE_2D_ARRAY_COMPATIBLE_BIT, VK_IMAGE_CREATE_BLOCK_TEXEL_VIEW_COMPATIBLE_BIT_KHR = VK_IMAGE_CREATE_BLOCK_TEXEL_VIEW_COMPATIBLE_BIT, @@ -2192,26 +2300,15 @@ typedef enum VkImageUsageFlagBits { VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT = 0x00000020, VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT = 0x00000040, VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT = 0x00000080, -#ifdef VK_ENABLE_BETA_EXTENSIONS VK_IMAGE_USAGE_VIDEO_DECODE_DST_BIT_KHR = 0x00000400, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS VK_IMAGE_USAGE_VIDEO_DECODE_SRC_BIT_KHR = 0x00000800, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS VK_IMAGE_USAGE_VIDEO_DECODE_DPB_BIT_KHR = 0x00001000, -#endif VK_IMAGE_USAGE_FRAGMENT_DENSITY_MAP_BIT_EXT = 0x00000200, VK_IMAGE_USAGE_FRAGMENT_SHADING_RATE_ATTACHMENT_BIT_KHR = 0x00000100, -#ifdef VK_ENABLE_BETA_EXTENSIONS + VK_IMAGE_USAGE_HOST_TRANSFER_BIT_EXT = 0x00400000, VK_IMAGE_USAGE_VIDEO_ENCODE_DST_BIT_KHR = 0x00002000, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS VK_IMAGE_USAGE_VIDEO_ENCODE_SRC_BIT_KHR = 0x00004000, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS VK_IMAGE_USAGE_VIDEO_ENCODE_DPB_BIT_KHR = 0x00008000, -#endif VK_IMAGE_USAGE_ATTACHMENT_FEEDBACK_LOOP_BIT_EXT = 0x00080000, VK_IMAGE_USAGE_INVOCATION_MASK_BIT_HUAWEI = 0x00040000, VK_IMAGE_USAGE_SAMPLE_WEIGHT_BIT_QCOM = 0x00100000, @@ -2255,12 +2352,9 @@ typedef enum VkQueueFlagBits { VK_QUEUE_TRANSFER_BIT = 0x00000004, VK_QUEUE_SPARSE_BINDING_BIT = 0x00000008, VK_QUEUE_PROTECTED_BIT = 0x00000010, -#ifdef VK_ENABLE_BETA_EXTENSIONS VK_QUEUE_VIDEO_DECODE_BIT_KHR = 0x00000020, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS VK_QUEUE_VIDEO_ENCODE_BIT_KHR = 0x00000040, -#endif + VK_QUEUE_OPTICAL_FLOW_BIT_NV = 0x00000100, VK_QUEUE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF } VkQueueFlagBits; typedef VkFlags VkQueueFlags; @@ -2353,6 +2447,7 @@ typedef enum VkQueryPipelineStatisticFlagBits { VK_QUERY_PIPELINE_STATISTIC_COMPUTE_SHADER_INVOCATIONS_BIT = 0x00000400, VK_QUERY_PIPELINE_STATISTIC_TASK_SHADER_INVOCATIONS_BIT_EXT = 0x00000800, VK_QUERY_PIPELINE_STATISTIC_MESH_SHADER_INVOCATIONS_BIT_EXT = 0x00001000, + VK_QUERY_PIPELINE_STATISTIC_CLUSTER_CULLING_SHADER_INVOCATIONS_BIT_HUAWEI = 0x00002000, VK_QUERY_PIPELINE_STATISTIC_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF } VkQueryPipelineStatisticFlagBits; typedef VkFlags VkQueryPipelineStatisticFlags; @@ -2363,9 +2458,7 @@ typedef enum VkQueryResultFlagBits { VK_QUERY_RESULT_WAIT_BIT = 0x00000002, VK_QUERY_RESULT_WITH_AVAILABILITY_BIT = 0x00000004, VK_QUERY_RESULT_PARTIAL_BIT = 0x00000008, -#ifdef VK_ENABLE_BETA_EXTENSIONS VK_QUERY_RESULT_WITH_STATUS_BIT_KHR = 0x00000010, -#endif VK_QUERY_RESULT_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF } VkQueryResultFlagBits; typedef VkFlags VkQueryResultFlags; @@ -2376,6 +2469,8 @@ typedef enum VkBufferCreateFlagBits { VK_BUFFER_CREATE_SPARSE_ALIASED_BIT = 0x00000004, VK_BUFFER_CREATE_PROTECTED_BIT = 0x00000008, VK_BUFFER_CREATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT = 0x00000010, + VK_BUFFER_CREATE_DESCRIPTOR_BUFFER_CAPTURE_REPLAY_BIT_EXT = 0x00000020, + VK_BUFFER_CREATE_VIDEO_PROFILE_INDEPENDENT_BIT_KHR = 0x00000040, VK_BUFFER_CREATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT_EXT = VK_BUFFER_CREATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT, VK_BUFFER_CREATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT_KHR = VK_BUFFER_CREATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT, VK_BUFFER_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF @@ -2393,24 +2488,24 @@ typedef enum VkBufferUsageFlagBits { VK_BUFFER_USAGE_VERTEX_BUFFER_BIT = 0x00000080, VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT = 0x00000100, VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT = 0x00020000, -#ifdef VK_ENABLE_BETA_EXTENSIONS VK_BUFFER_USAGE_VIDEO_DECODE_SRC_BIT_KHR = 0x00002000, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS VK_BUFFER_USAGE_VIDEO_DECODE_DST_BIT_KHR = 0x00004000, -#endif VK_BUFFER_USAGE_TRANSFORM_FEEDBACK_BUFFER_BIT_EXT = 0x00000800, VK_BUFFER_USAGE_TRANSFORM_FEEDBACK_COUNTER_BUFFER_BIT_EXT = 0x00001000, VK_BUFFER_USAGE_CONDITIONAL_RENDERING_BIT_EXT = 0x00000200, +#ifdef VK_ENABLE_BETA_EXTENSIONS + VK_BUFFER_USAGE_EXECUTION_GRAPH_SCRATCH_BIT_AMDX = 0x02000000, +#endif VK_BUFFER_USAGE_ACCELERATION_STRUCTURE_BUILD_INPUT_READ_ONLY_BIT_KHR = 0x00080000, VK_BUFFER_USAGE_ACCELERATION_STRUCTURE_STORAGE_BIT_KHR = 0x00100000, VK_BUFFER_USAGE_SHADER_BINDING_TABLE_BIT_KHR = 0x00000400, -#ifdef VK_ENABLE_BETA_EXTENSIONS VK_BUFFER_USAGE_VIDEO_ENCODE_DST_BIT_KHR = 0x00008000, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS VK_BUFFER_USAGE_VIDEO_ENCODE_SRC_BIT_KHR = 0x00010000, -#endif + VK_BUFFER_USAGE_SAMPLER_DESCRIPTOR_BUFFER_BIT_EXT = 0x00200000, + VK_BUFFER_USAGE_RESOURCE_DESCRIPTOR_BUFFER_BIT_EXT = 0x00400000, + VK_BUFFER_USAGE_PUSH_DESCRIPTORS_DESCRIPTOR_BUFFER_BIT_EXT = 0x04000000, + VK_BUFFER_USAGE_MICROMAP_BUILD_INPUT_READ_ONLY_BIT_EXT = 0x00800000, + VK_BUFFER_USAGE_MICROMAP_STORAGE_BIT_EXT = 0x01000000, VK_BUFFER_USAGE_RAY_TRACING_BIT_NV = VK_BUFFER_USAGE_SHADER_BINDING_TABLE_BIT_KHR, VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT_EXT = VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT, VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT_KHR = VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT, @@ -2421,6 +2516,7 @@ typedef VkFlags VkBufferViewCreateFlags; typedef enum VkImageViewCreateFlagBits { VK_IMAGE_VIEW_CREATE_FRAGMENT_DENSITY_MAP_DYNAMIC_BIT_EXT = 0x00000001, + VK_IMAGE_VIEW_CREATE_DESCRIPTOR_BUFFER_CAPTURE_REPLAY_BIT_EXT = 0x00000004, VK_IMAGE_VIEW_CREATE_FRAGMENT_DENSITY_MAP_DEFERRED_BIT_EXT = 0x00000002, VK_IMAGE_VIEW_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF } VkImageViewCreateFlagBits; @@ -2465,11 +2561,18 @@ typedef enum VkPipelineCreateFlagBits { VK_PIPELINE_CREATE_CAPTURE_INTERNAL_REPRESENTATIONS_BIT_KHR = 0x00000080, VK_PIPELINE_CREATE_INDIRECT_BINDABLE_BIT_NV = 0x00040000, VK_PIPELINE_CREATE_LIBRARY_BIT_KHR = 0x00000800, + VK_PIPELINE_CREATE_DESCRIPTOR_BUFFER_BIT_EXT = 0x20000000, VK_PIPELINE_CREATE_RETAIN_LINK_TIME_OPTIMIZATION_INFO_BIT_EXT = 0x00800000, VK_PIPELINE_CREATE_LINK_TIME_OPTIMIZATION_BIT_EXT = 0x00000400, VK_PIPELINE_CREATE_RAY_TRACING_ALLOW_MOTION_BIT_NV = 0x00100000, VK_PIPELINE_CREATE_COLOR_ATTACHMENT_FEEDBACK_LOOP_BIT_EXT = 0x02000000, VK_PIPELINE_CREATE_DEPTH_STENCIL_ATTACHMENT_FEEDBACK_LOOP_BIT_EXT = 0x04000000, + VK_PIPELINE_CREATE_RAY_TRACING_OPACITY_MICROMAP_BIT_EXT = 0x01000000, +#ifdef VK_ENABLE_BETA_EXTENSIONS + VK_PIPELINE_CREATE_RAY_TRACING_DISPLACEMENT_MICROMAP_BIT_NV = 0x10000000, +#endif + VK_PIPELINE_CREATE_NO_PROTECTED_ACCESS_BIT_EXT = 0x08000000, + VK_PIPELINE_CREATE_PROTECTED_ACCESS_ONLY_BIT_EXT = 0x40000000, VK_PIPELINE_CREATE_DISPATCH_BASE = VK_PIPELINE_CREATE_DISPATCH_BASE_BIT, VK_PIPELINE_RASTERIZATION_STATE_CREATE_FRAGMENT_SHADING_RATE_ATTACHMENT_BIT_KHR = VK_PIPELINE_CREATE_RENDERING_FRAGMENT_SHADING_RATE_ATTACHMENT_BIT_KHR, VK_PIPELINE_RASTERIZATION_STATE_CREATE_FRAGMENT_DENSITY_MAP_ATTACHMENT_BIT_EXT = VK_PIPELINE_CREATE_RENDERING_FRAGMENT_DENSITY_MAP_ATTACHMENT_BIT_EXT, @@ -2508,6 +2611,7 @@ typedef enum VkShaderStageFlagBits { VK_SHADER_STAGE_TASK_BIT_EXT = 0x00000040, VK_SHADER_STAGE_MESH_BIT_EXT = 0x00000080, VK_SHADER_STAGE_SUBPASS_SHADING_BIT_HUAWEI = 0x00004000, + VK_SHADER_STAGE_CLUSTER_CULLING_BIT_HUAWEI = 0x00080000, VK_SHADER_STAGE_RAYGEN_BIT_NV = VK_SHADER_STAGE_RAYGEN_BIT_KHR, VK_SHADER_STAGE_ANY_HIT_BIT_NV = VK_SHADER_STAGE_ANY_HIT_BIT_KHR, VK_SHADER_STAGE_CLOSEST_HIT_BIT_NV = VK_SHADER_STAGE_CLOSEST_HIT_BIT_KHR, @@ -2561,6 +2665,7 @@ typedef VkFlags VkShaderStageFlags; typedef enum VkSamplerCreateFlagBits { VK_SAMPLER_CREATE_SUBSAMPLED_BIT_EXT = 0x00000001, VK_SAMPLER_CREATE_SUBSAMPLED_COARSE_RECONSTRUCTION_BIT_EXT = 0x00000002, + VK_SAMPLER_CREATE_DESCRIPTOR_BUFFER_CAPTURE_REPLAY_BIT_EXT = 0x00000008, VK_SAMPLER_CREATE_NON_SEAMLESS_CUBE_MAP_BIT_EXT = 0x00000004, VK_SAMPLER_CREATE_IMAGE_PROCESSING_BIT_QCOM = 0x00000010, VK_SAMPLER_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF @@ -2570,8 +2675,11 @@ typedef VkFlags VkSamplerCreateFlags; typedef enum VkDescriptorPoolCreateFlagBits { VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT = 0x00000001, VK_DESCRIPTOR_POOL_CREATE_UPDATE_AFTER_BIND_BIT = 0x00000002, - VK_DESCRIPTOR_POOL_CREATE_HOST_ONLY_BIT_VALVE = 0x00000004, + VK_DESCRIPTOR_POOL_CREATE_HOST_ONLY_BIT_EXT = 0x00000004, + VK_DESCRIPTOR_POOL_CREATE_ALLOW_OVERALLOCATION_SETS_BIT_NV = 0x00000008, + VK_DESCRIPTOR_POOL_CREATE_ALLOW_OVERALLOCATION_POOLS_BIT_NV = 0x00000010, VK_DESCRIPTOR_POOL_CREATE_UPDATE_AFTER_BIND_BIT_EXT = VK_DESCRIPTOR_POOL_CREATE_UPDATE_AFTER_BIND_BIT, + VK_DESCRIPTOR_POOL_CREATE_HOST_ONLY_BIT_VALVE = VK_DESCRIPTOR_POOL_CREATE_HOST_ONLY_BIT_EXT, VK_DESCRIPTOR_POOL_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF } VkDescriptorPoolCreateFlagBits; typedef VkFlags VkDescriptorPoolCreateFlags; @@ -2580,8 +2688,13 @@ typedef VkFlags VkDescriptorPoolResetFlags; typedef enum VkDescriptorSetLayoutCreateFlagBits { VK_DESCRIPTOR_SET_LAYOUT_CREATE_UPDATE_AFTER_BIND_POOL_BIT = 0x00000002, VK_DESCRIPTOR_SET_LAYOUT_CREATE_PUSH_DESCRIPTOR_BIT_KHR = 0x00000001, - VK_DESCRIPTOR_SET_LAYOUT_CREATE_HOST_ONLY_POOL_BIT_VALVE = 0x00000004, + VK_DESCRIPTOR_SET_LAYOUT_CREATE_DESCRIPTOR_BUFFER_BIT_EXT = 0x00000010, + VK_DESCRIPTOR_SET_LAYOUT_CREATE_EMBEDDED_IMMUTABLE_SAMPLERS_BIT_EXT = 0x00000020, + VK_DESCRIPTOR_SET_LAYOUT_CREATE_INDIRECT_BINDABLE_BIT_NV = 0x00000080, + VK_DESCRIPTOR_SET_LAYOUT_CREATE_HOST_ONLY_POOL_BIT_EXT = 0x00000004, + VK_DESCRIPTOR_SET_LAYOUT_CREATE_PER_STAGE_BIT_NV = 0x00000040, VK_DESCRIPTOR_SET_LAYOUT_CREATE_UPDATE_AFTER_BIND_POOL_BIT_EXT = VK_DESCRIPTOR_SET_LAYOUT_CREATE_UPDATE_AFTER_BIND_POOL_BIT, + VK_DESCRIPTOR_SET_LAYOUT_CREATE_HOST_ONLY_POOL_BIT_VALVE = VK_DESCRIPTOR_SET_LAYOUT_CREATE_HOST_ONLY_POOL_BIT_EXT, VK_DESCRIPTOR_SET_LAYOUT_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF } VkDescriptorSetLayoutCreateFlagBits; typedef VkFlags VkDescriptorSetLayoutCreateFlags; @@ -4735,6 +4848,7 @@ VKAPI_ATTR void VKAPI_CALL vkCmdExecuteCommands( #endif +// VK_VERSION_1_1 is a preprocessor guard. Do not pass it to API calls. #define VK_VERSION_1_1 1 // Vulkan 1.1 version number #define VK_API_VERSION_1_1 VK_MAKE_API_VERSION(0, 1, 1, 0)// Patch version should always be set to 0 @@ -4852,6 +4966,7 @@ typedef enum VkExternalMemoryHandleTypeFlagBits { VK_EXTERNAL_MEMORY_HANDLE_TYPE_HOST_MAPPED_FOREIGN_MEMORY_BIT_EXT = 0x00000100, VK_EXTERNAL_MEMORY_HANDLE_TYPE_ZIRCON_VMO_BIT_FUCHSIA = 0x00000800, VK_EXTERNAL_MEMORY_HANDLE_TYPE_RDMA_ADDRESS_BIT_NV = 0x00001000, + VK_EXTERNAL_MEMORY_HANDLE_TYPE_SCREEN_BUFFER_BIT_QNX = 0x00004000, VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT_KHR = VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT, VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_BIT_KHR = VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_BIT, VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT_KHR = VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT, @@ -5600,6 +5715,7 @@ VKAPI_ATTR void VKAPI_CALL vkGetDescriptorSetLayoutSupport( #endif +// VK_VERSION_1_2 is a preprocessor guard. Do not pass it to API calls. #define VK_VERSION_1_2 1 // Vulkan 1.2 version number #define VK_API_VERSION_1_2 VK_MAKE_API_VERSION(0, 1, 2, 0)// Patch version should always be set to 0 @@ -5631,6 +5747,9 @@ typedef enum VkDriverId { VK_DRIVER_ID_SAMSUNG_PROPRIETARY = 21, VK_DRIVER_ID_MESA_VENUS = 22, VK_DRIVER_ID_MESA_DOZEN = 23, + VK_DRIVER_ID_MESA_NVK = 24, + VK_DRIVER_ID_IMAGINATION_OPEN_SOURCE_MESA = 25, + VK_DRIVER_ID_MESA_AGXV = 26, VK_DRIVER_ID_AMD_PROPRIETARY_KHR = VK_DRIVER_ID_AMD_PROPRIETARY, VK_DRIVER_ID_AMD_OPEN_SOURCE_KHR = VK_DRIVER_ID_AMD_OPEN_SOURCE, VK_DRIVER_ID_MESA_RADV_KHR = VK_DRIVER_ID_MESA_RADV, @@ -5660,6 +5779,7 @@ typedef enum VkSamplerReductionMode { VK_SAMPLER_REDUCTION_MODE_WEIGHTED_AVERAGE = 0, VK_SAMPLER_REDUCTION_MODE_MIN = 1, VK_SAMPLER_REDUCTION_MODE_MAX = 2, + VK_SAMPLER_REDUCTION_MODE_WEIGHTED_AVERAGE_RANGECLAMP_QCOM = 1000521000, VK_SAMPLER_REDUCTION_MODE_WEIGHTED_AVERAGE_EXT = VK_SAMPLER_REDUCTION_MODE_WEIGHTED_AVERAGE, VK_SAMPLER_REDUCTION_MODE_MIN_EXT = VK_SAMPLER_REDUCTION_MODE_MIN, VK_SAMPLER_REDUCTION_MODE_MAX_EXT = VK_SAMPLER_REDUCTION_MODE_MAX, @@ -5680,6 +5800,7 @@ typedef enum VkResolveModeFlagBits { VK_RESOLVE_MODE_AVERAGE_BIT = 0x00000002, VK_RESOLVE_MODE_MIN_BIT = 0x00000004, VK_RESOLVE_MODE_MAX_BIT = 0x00000008, + VK_RESOLVE_MODE_EXTERNAL_FORMAT_DOWNSAMPLE_ANDROID = 0x00000010, VK_RESOLVE_MODE_NONE_KHR = VK_RESOLVE_MODE_NONE, VK_RESOLVE_MODE_SAMPLE_ZERO_BIT_KHR = VK_RESOLVE_MODE_SAMPLE_ZERO_BIT, VK_RESOLVE_MODE_AVERAGE_BIT_KHR = VK_RESOLVE_MODE_AVERAGE_BIT, @@ -6352,6 +6473,7 @@ VKAPI_ATTR uint64_t VKAPI_CALL vkGetDeviceMemoryOpaqueCaptureAddress( #endif +// VK_VERSION_1_3 is a preprocessor guard. Do not pass it to API calls. #define VK_VERSION_1_3 1 // Vulkan 1.3 version number #define VK_API_VERSION_1_3 VK_MAKE_API_VERSION(0, 1, 3, 0)// Patch version should always be set to 0 @@ -6443,12 +6565,8 @@ static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_VERTEX_ATTRIBUTE_INPUT static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_VERTEX_ATTRIBUTE_INPUT_BIT_KHR = 0x2000000000ULL; static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_PRE_RASTERIZATION_SHADERS_BIT = 0x4000000000ULL; static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_PRE_RASTERIZATION_SHADERS_BIT_KHR = 0x4000000000ULL; -#ifdef VK_ENABLE_BETA_EXTENSIONS static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_VIDEO_DECODE_BIT_KHR = 0x04000000ULL; -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_VIDEO_ENCODE_BIT_KHR = 0x08000000ULL; -#endif static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_TRANSFORM_FEEDBACK_BIT_EXT = 0x01000000ULL; static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_CONDITIONAL_RENDERING_BIT_EXT = 0x00040000ULL; static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_COMMAND_PREPROCESS_BIT_NV = 0x00020000ULL; @@ -6463,9 +6581,13 @@ static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_TASK_SHADER_BIT_NV = 0 static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_MESH_SHADER_BIT_NV = 0x00100000ULL; static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_TASK_SHADER_BIT_EXT = 0x00080000ULL; static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_MESH_SHADER_BIT_EXT = 0x00100000ULL; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_SUBPASS_SHADER_BIT_HUAWEI = 0x8000000000ULL; static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_SUBPASS_SHADING_BIT_HUAWEI = 0x8000000000ULL; static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_INVOCATION_MASK_BIT_HUAWEI = 0x10000000000ULL; static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_ACCELERATION_STRUCTURE_COPY_BIT_KHR = 0x10000000ULL; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_MICROMAP_BUILD_BIT_EXT = 0x40000000ULL; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_CLUSTER_CULLING_SHADER_BIT_HUAWEI = 0x20000000000ULL; +static const VkPipelineStageFlagBits2 VK_PIPELINE_STAGE_2_OPTICAL_FLOW_BIT_NV = 0x20000000ULL; typedef VkFlags64 VkAccessFlags2; @@ -6513,18 +6635,10 @@ static const VkAccessFlagBits2 VK_ACCESS_2_SHADER_STORAGE_READ_BIT = 0x200000000 static const VkAccessFlagBits2 VK_ACCESS_2_SHADER_STORAGE_READ_BIT_KHR = 0x200000000ULL; static const VkAccessFlagBits2 VK_ACCESS_2_SHADER_STORAGE_WRITE_BIT = 0x400000000ULL; static const VkAccessFlagBits2 VK_ACCESS_2_SHADER_STORAGE_WRITE_BIT_KHR = 0x400000000ULL; -#ifdef VK_ENABLE_BETA_EXTENSIONS static const VkAccessFlagBits2 VK_ACCESS_2_VIDEO_DECODE_READ_BIT_KHR = 0x800000000ULL; -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS static const VkAccessFlagBits2 VK_ACCESS_2_VIDEO_DECODE_WRITE_BIT_KHR = 0x1000000000ULL; -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS static const VkAccessFlagBits2 VK_ACCESS_2_VIDEO_ENCODE_READ_BIT_KHR = 0x2000000000ULL; -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS static const VkAccessFlagBits2 VK_ACCESS_2_VIDEO_ENCODE_WRITE_BIT_KHR = 0x4000000000ULL; -#endif static const VkAccessFlagBits2 VK_ACCESS_2_TRANSFORM_FEEDBACK_WRITE_BIT_EXT = 0x02000000ULL; static const VkAccessFlagBits2 VK_ACCESS_2_TRANSFORM_FEEDBACK_COUNTER_READ_BIT_EXT = 0x04000000ULL; static const VkAccessFlagBits2 VK_ACCESS_2_TRANSFORM_FEEDBACK_COUNTER_WRITE_BIT_EXT = 0x08000000ULL; @@ -6539,8 +6653,13 @@ static const VkAccessFlagBits2 VK_ACCESS_2_ACCELERATION_STRUCTURE_READ_BIT_NV = static const VkAccessFlagBits2 VK_ACCESS_2_ACCELERATION_STRUCTURE_WRITE_BIT_NV = 0x00400000ULL; static const VkAccessFlagBits2 VK_ACCESS_2_FRAGMENT_DENSITY_MAP_READ_BIT_EXT = 0x01000000ULL; static const VkAccessFlagBits2 VK_ACCESS_2_COLOR_ATTACHMENT_READ_NONCOHERENT_BIT_EXT = 0x00080000ULL; +static const VkAccessFlagBits2 VK_ACCESS_2_DESCRIPTOR_BUFFER_READ_BIT_EXT = 0x20000000000ULL; static const VkAccessFlagBits2 VK_ACCESS_2_INVOCATION_MASK_READ_BIT_HUAWEI = 0x8000000000ULL; static const VkAccessFlagBits2 VK_ACCESS_2_SHADER_BINDING_TABLE_READ_BIT_KHR = 0x10000000000ULL; +static const VkAccessFlagBits2 VK_ACCESS_2_MICROMAP_READ_BIT_EXT = 0x100000000000ULL; +static const VkAccessFlagBits2 VK_ACCESS_2_MICROMAP_WRITE_BIT_EXT = 0x200000000000ULL; +static const VkAccessFlagBits2 VK_ACCESS_2_OPTICAL_FLOW_READ_BIT_NV = 0x40000000000ULL; +static const VkAccessFlagBits2 VK_ACCESS_2_OPTICAL_FLOW_WRITE_BIT_NV = 0x80000000000ULL; typedef enum VkSubmitFlagBits { @@ -6554,6 +6673,7 @@ typedef enum VkRenderingFlagBits { VK_RENDERING_CONTENTS_SECONDARY_COMMAND_BUFFERS_BIT = 0x00000001, VK_RENDERING_SUSPENDING_BIT = 0x00000002, VK_RENDERING_RESUMING_BIT = 0x00000004, + VK_RENDERING_CONTENTS_INLINE_BIT_EXT = 0x00000010, VK_RENDERING_ENABLE_LEGACY_DITHERING_BIT_EXT = 0x00000008, VK_RENDERING_CONTENTS_SECONDARY_COMMAND_BUFFERS_BIT_KHR = VK_RENDERING_CONTENTS_SECONDARY_COMMAND_BUFFERS_BIT, VK_RENDERING_SUSPENDING_BIT_KHR = VK_RENDERING_SUSPENDING_BIT, @@ -6619,26 +6739,22 @@ static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_STORAGE_WRITE_WITHOUT_ static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_STORAGE_WRITE_WITHOUT_FORMAT_BIT_KHR = 0x100000000ULL; static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_DEPTH_COMPARISON_BIT = 0x200000000ULL; static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_SAMPLED_IMAGE_DEPTH_COMPARISON_BIT_KHR = 0x200000000ULL; -#ifdef VK_ENABLE_BETA_EXTENSIONS static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_VIDEO_DECODE_OUTPUT_BIT_KHR = 0x02000000ULL; -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_VIDEO_DECODE_DPB_BIT_KHR = 0x04000000ULL; -#endif static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_ACCELERATION_STRUCTURE_VERTEX_BUFFER_BIT_KHR = 0x20000000ULL; static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_FRAGMENT_DENSITY_MAP_BIT_EXT = 0x01000000ULL; static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_FRAGMENT_SHADING_RATE_ATTACHMENT_BIT_KHR = 0x40000000ULL; -#ifdef VK_ENABLE_BETA_EXTENSIONS +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_HOST_IMAGE_TRANSFER_BIT_EXT = 0x400000000000ULL; static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_VIDEO_ENCODE_INPUT_BIT_KHR = 0x08000000ULL; -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_VIDEO_ENCODE_DPB_BIT_KHR = 0x10000000ULL; -#endif static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_LINEAR_COLOR_ATTACHMENT_BIT_NV = 0x4000000000ULL; static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_WEIGHT_IMAGE_BIT_QCOM = 0x400000000ULL; static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_WEIGHT_SAMPLED_IMAGE_BIT_QCOM = 0x800000000ULL; static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_BLOCK_MATCHING_BIT_QCOM = 0x1000000000ULL; static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_BOX_FILTER_SAMPLED_BIT_QCOM = 0x2000000000ULL; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_OPTICAL_FLOW_IMAGE_BIT_NV = 0x10000000000ULL; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_OPTICAL_FLOW_VECTOR_BIT_NV = 0x20000000000ULL; +static const VkFormatFeatureFlagBits2 VK_FORMAT_FEATURE_2_OPTICAL_FLOW_COST_BIT_NV = 0x40000000000ULL; typedef struct VkPhysicalDeviceVulkan13Features { VkStructureType sType; @@ -7392,6 +7508,7 @@ VKAPI_ATTR void VKAPI_CALL vkGetDeviceImageSparseMemoryRequirements( #endif +// VK_KHR_surface is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_surface 1 VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkSurfaceKHR) #define VK_KHR_SURFACE_SPEC_VERSION 25 @@ -7506,6 +7623,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfacePresentModesKHR( #endif +// VK_KHR_swapchain is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_swapchain 1 VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkSwapchainKHR) #define VK_KHR_SWAPCHAIN_SPEC_VERSION 70 @@ -7515,6 +7633,7 @@ typedef enum VkSwapchainCreateFlagBitsKHR { VK_SWAPCHAIN_CREATE_SPLIT_INSTANCE_BIND_REGIONS_BIT_KHR = 0x00000001, VK_SWAPCHAIN_CREATE_PROTECTED_BIT_KHR = 0x00000002, VK_SWAPCHAIN_CREATE_MUTABLE_FORMAT_BIT_KHR = 0x00000004, + VK_SWAPCHAIN_CREATE_DEFERRED_MEMORY_ALLOCATION_BIT_EXT = 0x00000008, VK_SWAPCHAIN_CREATE_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF } VkSwapchainCreateFlagBitsKHR; typedef VkFlags VkSwapchainCreateFlagsKHR; @@ -7665,6 +7784,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkAcquireNextImage2KHR( #endif +// VK_KHR_display is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_display 1 VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDisplayKHR) VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDisplayModeKHR) @@ -7790,6 +7910,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkCreateDisplayPlaneSurfaceKHR( #endif +// VK_KHR_display_swapchain is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_display_swapchain 1 #define VK_KHR_DISPLAY_SWAPCHAIN_SPEC_VERSION 10 #define VK_KHR_DISPLAY_SWAPCHAIN_EXTENSION_NAME "VK_KHR_display_swapchain" @@ -7813,23 +7934,852 @@ VKAPI_ATTR VkResult VKAPI_CALL vkCreateSharedSwapchainsKHR( #endif +// VK_KHR_sampler_mirror_clamp_to_edge is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_sampler_mirror_clamp_to_edge 1 #define VK_KHR_SAMPLER_MIRROR_CLAMP_TO_EDGE_SPEC_VERSION 3 #define VK_KHR_SAMPLER_MIRROR_CLAMP_TO_EDGE_EXTENSION_NAME "VK_KHR_sampler_mirror_clamp_to_edge" -#define VK_KHR_dynamic_rendering 1 -#define VK_KHR_DYNAMIC_RENDERING_SPEC_VERSION 1 -#define VK_KHR_DYNAMIC_RENDERING_EXTENSION_NAME "VK_KHR_dynamic_rendering" -typedef VkRenderingFlags VkRenderingFlagsKHR; +// VK_KHR_video_queue is a preprocessor guard. Do not pass it to API calls. +#define VK_KHR_video_queue 1 +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkVideoSessionKHR) +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkVideoSessionParametersKHR) +#define VK_KHR_VIDEO_QUEUE_SPEC_VERSION 8 +#define VK_KHR_VIDEO_QUEUE_EXTENSION_NAME "VK_KHR_video_queue" + +typedef enum VkQueryResultStatusKHR { + VK_QUERY_RESULT_STATUS_ERROR_KHR = -1, + VK_QUERY_RESULT_STATUS_NOT_READY_KHR = 0, + VK_QUERY_RESULT_STATUS_COMPLETE_KHR = 1, + VK_QUERY_RESULT_STATUS_INSUFFICIENT_BITSTREAM_BUFFER_RANGE_KHR = -1000299000, + VK_QUERY_RESULT_STATUS_MAX_ENUM_KHR = 0x7FFFFFFF +} VkQueryResultStatusKHR; + +typedef enum VkVideoCodecOperationFlagBitsKHR { + VK_VIDEO_CODEC_OPERATION_NONE_KHR = 0, + VK_VIDEO_CODEC_OPERATION_ENCODE_H264_BIT_KHR = 0x00010000, + VK_VIDEO_CODEC_OPERATION_ENCODE_H265_BIT_KHR = 0x00020000, + VK_VIDEO_CODEC_OPERATION_DECODE_H264_BIT_KHR = 0x00000001, + VK_VIDEO_CODEC_OPERATION_DECODE_H265_BIT_KHR = 0x00000002, + VK_VIDEO_CODEC_OPERATION_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF +} VkVideoCodecOperationFlagBitsKHR; +typedef VkFlags VkVideoCodecOperationFlagsKHR; + +typedef enum VkVideoChromaSubsamplingFlagBitsKHR { + VK_VIDEO_CHROMA_SUBSAMPLING_INVALID_KHR = 0, + VK_VIDEO_CHROMA_SUBSAMPLING_MONOCHROME_BIT_KHR = 0x00000001, + VK_VIDEO_CHROMA_SUBSAMPLING_420_BIT_KHR = 0x00000002, + VK_VIDEO_CHROMA_SUBSAMPLING_422_BIT_KHR = 0x00000004, + VK_VIDEO_CHROMA_SUBSAMPLING_444_BIT_KHR = 0x00000008, + VK_VIDEO_CHROMA_SUBSAMPLING_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF +} VkVideoChromaSubsamplingFlagBitsKHR; +typedef VkFlags VkVideoChromaSubsamplingFlagsKHR; + +typedef enum VkVideoComponentBitDepthFlagBitsKHR { + VK_VIDEO_COMPONENT_BIT_DEPTH_INVALID_KHR = 0, + VK_VIDEO_COMPONENT_BIT_DEPTH_8_BIT_KHR = 0x00000001, + VK_VIDEO_COMPONENT_BIT_DEPTH_10_BIT_KHR = 0x00000004, + VK_VIDEO_COMPONENT_BIT_DEPTH_12_BIT_KHR = 0x00000010, + VK_VIDEO_COMPONENT_BIT_DEPTH_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF +} VkVideoComponentBitDepthFlagBitsKHR; +typedef VkFlags VkVideoComponentBitDepthFlagsKHR; + +typedef enum VkVideoCapabilityFlagBitsKHR { + VK_VIDEO_CAPABILITY_PROTECTED_CONTENT_BIT_KHR = 0x00000001, + VK_VIDEO_CAPABILITY_SEPARATE_REFERENCE_IMAGES_BIT_KHR = 0x00000002, + VK_VIDEO_CAPABILITY_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF +} VkVideoCapabilityFlagBitsKHR; +typedef VkFlags VkVideoCapabilityFlagsKHR; + +typedef enum VkVideoSessionCreateFlagBitsKHR { + VK_VIDEO_SESSION_CREATE_PROTECTED_CONTENT_BIT_KHR = 0x00000001, + VK_VIDEO_SESSION_CREATE_ALLOW_ENCODE_PARAMETER_OPTIMIZATIONS_BIT_KHR = 0x00000002, + VK_VIDEO_SESSION_CREATE_INLINE_QUERIES_BIT_KHR = 0x00000004, + VK_VIDEO_SESSION_CREATE_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF +} VkVideoSessionCreateFlagBitsKHR; +typedef VkFlags VkVideoSessionCreateFlagsKHR; +typedef VkFlags VkVideoSessionParametersCreateFlagsKHR; +typedef VkFlags VkVideoBeginCodingFlagsKHR; +typedef VkFlags VkVideoEndCodingFlagsKHR; + +typedef enum VkVideoCodingControlFlagBitsKHR { + VK_VIDEO_CODING_CONTROL_RESET_BIT_KHR = 0x00000001, + VK_VIDEO_CODING_CONTROL_ENCODE_RATE_CONTROL_BIT_KHR = 0x00000002, + VK_VIDEO_CODING_CONTROL_ENCODE_QUALITY_LEVEL_BIT_KHR = 0x00000004, + VK_VIDEO_CODING_CONTROL_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF +} VkVideoCodingControlFlagBitsKHR; +typedef VkFlags VkVideoCodingControlFlagsKHR; +typedef struct VkQueueFamilyQueryResultStatusPropertiesKHR { + VkStructureType sType; + void* pNext; + VkBool32 queryResultStatusSupport; +} VkQueueFamilyQueryResultStatusPropertiesKHR; -typedef VkRenderingFlagBits VkRenderingFlagBitsKHR; +typedef struct VkQueueFamilyVideoPropertiesKHR { + VkStructureType sType; + void* pNext; + VkVideoCodecOperationFlagsKHR videoCodecOperations; +} VkQueueFamilyVideoPropertiesKHR; -typedef VkRenderingInfo VkRenderingInfoKHR; +typedef struct VkVideoProfileInfoKHR { + VkStructureType sType; + const void* pNext; + VkVideoCodecOperationFlagBitsKHR videoCodecOperation; + VkVideoChromaSubsamplingFlagsKHR chromaSubsampling; + VkVideoComponentBitDepthFlagsKHR lumaBitDepth; + VkVideoComponentBitDepthFlagsKHR chromaBitDepth; +} VkVideoProfileInfoKHR; -typedef VkRenderingAttachmentInfo VkRenderingAttachmentInfoKHR; +typedef struct VkVideoProfileListInfoKHR { + VkStructureType sType; + const void* pNext; + uint32_t profileCount; + const VkVideoProfileInfoKHR* pProfiles; +} VkVideoProfileListInfoKHR; -typedef VkPipelineRenderingCreateInfo VkPipelineRenderingCreateInfoKHR; +typedef struct VkVideoCapabilitiesKHR { + VkStructureType sType; + void* pNext; + VkVideoCapabilityFlagsKHR flags; + VkDeviceSize minBitstreamBufferOffsetAlignment; + VkDeviceSize minBitstreamBufferSizeAlignment; + VkExtent2D pictureAccessGranularity; + VkExtent2D minCodedExtent; + VkExtent2D maxCodedExtent; + uint32_t maxDpbSlots; + uint32_t maxActiveReferencePictures; + VkExtensionProperties stdHeaderVersion; +} VkVideoCapabilitiesKHR; + +typedef struct VkPhysicalDeviceVideoFormatInfoKHR { + VkStructureType sType; + const void* pNext; + VkImageUsageFlags imageUsage; +} VkPhysicalDeviceVideoFormatInfoKHR; + +typedef struct VkVideoFormatPropertiesKHR { + VkStructureType sType; + void* pNext; + VkFormat format; + VkComponentMapping componentMapping; + VkImageCreateFlags imageCreateFlags; + VkImageType imageType; + VkImageTiling imageTiling; + VkImageUsageFlags imageUsageFlags; +} VkVideoFormatPropertiesKHR; + +typedef struct VkVideoPictureResourceInfoKHR { + VkStructureType sType; + const void* pNext; + VkOffset2D codedOffset; + VkExtent2D codedExtent; + uint32_t baseArrayLayer; + VkImageView imageViewBinding; +} VkVideoPictureResourceInfoKHR; + +typedef struct VkVideoReferenceSlotInfoKHR { + VkStructureType sType; + const void* pNext; + int32_t slotIndex; + const VkVideoPictureResourceInfoKHR* pPictureResource; +} VkVideoReferenceSlotInfoKHR; + +typedef struct VkVideoSessionMemoryRequirementsKHR { + VkStructureType sType; + void* pNext; + uint32_t memoryBindIndex; + VkMemoryRequirements memoryRequirements; +} VkVideoSessionMemoryRequirementsKHR; + +typedef struct VkBindVideoSessionMemoryInfoKHR { + VkStructureType sType; + const void* pNext; + uint32_t memoryBindIndex; + VkDeviceMemory memory; + VkDeviceSize memoryOffset; + VkDeviceSize memorySize; +} VkBindVideoSessionMemoryInfoKHR; + +typedef struct VkVideoSessionCreateInfoKHR { + VkStructureType sType; + const void* pNext; + uint32_t queueFamilyIndex; + VkVideoSessionCreateFlagsKHR flags; + const VkVideoProfileInfoKHR* pVideoProfile; + VkFormat pictureFormat; + VkExtent2D maxCodedExtent; + VkFormat referencePictureFormat; + uint32_t maxDpbSlots; + uint32_t maxActiveReferencePictures; + const VkExtensionProperties* pStdHeaderVersion; +} VkVideoSessionCreateInfoKHR; + +typedef struct VkVideoSessionParametersCreateInfoKHR { + VkStructureType sType; + const void* pNext; + VkVideoSessionParametersCreateFlagsKHR flags; + VkVideoSessionParametersKHR videoSessionParametersTemplate; + VkVideoSessionKHR videoSession; +} VkVideoSessionParametersCreateInfoKHR; + +typedef struct VkVideoSessionParametersUpdateInfoKHR { + VkStructureType sType; + const void* pNext; + uint32_t updateSequenceCount; +} VkVideoSessionParametersUpdateInfoKHR; + +typedef struct VkVideoBeginCodingInfoKHR { + VkStructureType sType; + const void* pNext; + VkVideoBeginCodingFlagsKHR flags; + VkVideoSessionKHR videoSession; + VkVideoSessionParametersKHR videoSessionParameters; + uint32_t referenceSlotCount; + const VkVideoReferenceSlotInfoKHR* pReferenceSlots; +} VkVideoBeginCodingInfoKHR; + +typedef struct VkVideoEndCodingInfoKHR { + VkStructureType sType; + const void* pNext; + VkVideoEndCodingFlagsKHR flags; +} VkVideoEndCodingInfoKHR; + +typedef struct VkVideoCodingControlInfoKHR { + VkStructureType sType; + const void* pNext; + VkVideoCodingControlFlagsKHR flags; +} VkVideoCodingControlInfoKHR; + +typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceVideoCapabilitiesKHR)(VkPhysicalDevice physicalDevice, const VkVideoProfileInfoKHR* pVideoProfile, VkVideoCapabilitiesKHR* pCapabilities); +typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceVideoFormatPropertiesKHR)(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceVideoFormatInfoKHR* pVideoFormatInfo, uint32_t* pVideoFormatPropertyCount, VkVideoFormatPropertiesKHR* pVideoFormatProperties); +typedef VkResult (VKAPI_PTR *PFN_vkCreateVideoSessionKHR)(VkDevice device, const VkVideoSessionCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkVideoSessionKHR* pVideoSession); +typedef void (VKAPI_PTR *PFN_vkDestroyVideoSessionKHR)(VkDevice device, VkVideoSessionKHR videoSession, const VkAllocationCallbacks* pAllocator); +typedef VkResult (VKAPI_PTR *PFN_vkGetVideoSessionMemoryRequirementsKHR)(VkDevice device, VkVideoSessionKHR videoSession, uint32_t* pMemoryRequirementsCount, VkVideoSessionMemoryRequirementsKHR* pMemoryRequirements); +typedef VkResult (VKAPI_PTR *PFN_vkBindVideoSessionMemoryKHR)(VkDevice device, VkVideoSessionKHR videoSession, uint32_t bindSessionMemoryInfoCount, const VkBindVideoSessionMemoryInfoKHR* pBindSessionMemoryInfos); +typedef VkResult (VKAPI_PTR *PFN_vkCreateVideoSessionParametersKHR)(VkDevice device, const VkVideoSessionParametersCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkVideoSessionParametersKHR* pVideoSessionParameters); +typedef VkResult (VKAPI_PTR *PFN_vkUpdateVideoSessionParametersKHR)(VkDevice device, VkVideoSessionParametersKHR videoSessionParameters, const VkVideoSessionParametersUpdateInfoKHR* pUpdateInfo); +typedef void (VKAPI_PTR *PFN_vkDestroyVideoSessionParametersKHR)(VkDevice device, VkVideoSessionParametersKHR videoSessionParameters, const VkAllocationCallbacks* pAllocator); +typedef void (VKAPI_PTR *PFN_vkCmdBeginVideoCodingKHR)(VkCommandBuffer commandBuffer, const VkVideoBeginCodingInfoKHR* pBeginInfo); +typedef void (VKAPI_PTR *PFN_vkCmdEndVideoCodingKHR)(VkCommandBuffer commandBuffer, const VkVideoEndCodingInfoKHR* pEndCodingInfo); +typedef void (VKAPI_PTR *PFN_vkCmdControlVideoCodingKHR)(VkCommandBuffer commandBuffer, const VkVideoCodingControlInfoKHR* pCodingControlInfo); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceVideoCapabilitiesKHR( + VkPhysicalDevice physicalDevice, + const VkVideoProfileInfoKHR* pVideoProfile, + VkVideoCapabilitiesKHR* pCapabilities); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceVideoFormatPropertiesKHR( + VkPhysicalDevice physicalDevice, + const VkPhysicalDeviceVideoFormatInfoKHR* pVideoFormatInfo, + uint32_t* pVideoFormatPropertyCount, + VkVideoFormatPropertiesKHR* pVideoFormatProperties); + +VKAPI_ATTR VkResult VKAPI_CALL vkCreateVideoSessionKHR( + VkDevice device, + const VkVideoSessionCreateInfoKHR* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkVideoSessionKHR* pVideoSession); + +VKAPI_ATTR void VKAPI_CALL vkDestroyVideoSessionKHR( + VkDevice device, + VkVideoSessionKHR videoSession, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetVideoSessionMemoryRequirementsKHR( + VkDevice device, + VkVideoSessionKHR videoSession, + uint32_t* pMemoryRequirementsCount, + VkVideoSessionMemoryRequirementsKHR* pMemoryRequirements); + +VKAPI_ATTR VkResult VKAPI_CALL vkBindVideoSessionMemoryKHR( + VkDevice device, + VkVideoSessionKHR videoSession, + uint32_t bindSessionMemoryInfoCount, + const VkBindVideoSessionMemoryInfoKHR* pBindSessionMemoryInfos); + +VKAPI_ATTR VkResult VKAPI_CALL vkCreateVideoSessionParametersKHR( + VkDevice device, + const VkVideoSessionParametersCreateInfoKHR* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkVideoSessionParametersKHR* pVideoSessionParameters); + +VKAPI_ATTR VkResult VKAPI_CALL vkUpdateVideoSessionParametersKHR( + VkDevice device, + VkVideoSessionParametersKHR videoSessionParameters, + const VkVideoSessionParametersUpdateInfoKHR* pUpdateInfo); + +VKAPI_ATTR void VKAPI_CALL vkDestroyVideoSessionParametersKHR( + VkDevice device, + VkVideoSessionParametersKHR videoSessionParameters, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR void VKAPI_CALL vkCmdBeginVideoCodingKHR( + VkCommandBuffer commandBuffer, + const VkVideoBeginCodingInfoKHR* pBeginInfo); + +VKAPI_ATTR void VKAPI_CALL vkCmdEndVideoCodingKHR( + VkCommandBuffer commandBuffer, + const VkVideoEndCodingInfoKHR* pEndCodingInfo); + +VKAPI_ATTR void VKAPI_CALL vkCmdControlVideoCodingKHR( + VkCommandBuffer commandBuffer, + const VkVideoCodingControlInfoKHR* pCodingControlInfo); +#endif + + +// VK_KHR_video_decode_queue is a preprocessor guard. Do not pass it to API calls. +#define VK_KHR_video_decode_queue 1 +#define VK_KHR_VIDEO_DECODE_QUEUE_SPEC_VERSION 8 +#define VK_KHR_VIDEO_DECODE_QUEUE_EXTENSION_NAME "VK_KHR_video_decode_queue" + +typedef enum VkVideoDecodeCapabilityFlagBitsKHR { + VK_VIDEO_DECODE_CAPABILITY_DPB_AND_OUTPUT_COINCIDE_BIT_KHR = 0x00000001, + VK_VIDEO_DECODE_CAPABILITY_DPB_AND_OUTPUT_DISTINCT_BIT_KHR = 0x00000002, + VK_VIDEO_DECODE_CAPABILITY_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF +} VkVideoDecodeCapabilityFlagBitsKHR; +typedef VkFlags VkVideoDecodeCapabilityFlagsKHR; + +typedef enum VkVideoDecodeUsageFlagBitsKHR { + VK_VIDEO_DECODE_USAGE_DEFAULT_KHR = 0, + VK_VIDEO_DECODE_USAGE_TRANSCODING_BIT_KHR = 0x00000001, + VK_VIDEO_DECODE_USAGE_OFFLINE_BIT_KHR = 0x00000002, + VK_VIDEO_DECODE_USAGE_STREAMING_BIT_KHR = 0x00000004, + VK_VIDEO_DECODE_USAGE_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF +} VkVideoDecodeUsageFlagBitsKHR; +typedef VkFlags VkVideoDecodeUsageFlagsKHR; +typedef VkFlags VkVideoDecodeFlagsKHR; +typedef struct VkVideoDecodeCapabilitiesKHR { + VkStructureType sType; + void* pNext; + VkVideoDecodeCapabilityFlagsKHR flags; +} VkVideoDecodeCapabilitiesKHR; + +typedef struct VkVideoDecodeUsageInfoKHR { + VkStructureType sType; + const void* pNext; + VkVideoDecodeUsageFlagsKHR videoUsageHints; +} VkVideoDecodeUsageInfoKHR; + +typedef struct VkVideoDecodeInfoKHR { + VkStructureType sType; + const void* pNext; + VkVideoDecodeFlagsKHR flags; + VkBuffer srcBuffer; + VkDeviceSize srcBufferOffset; + VkDeviceSize srcBufferRange; + VkVideoPictureResourceInfoKHR dstPictureResource; + const VkVideoReferenceSlotInfoKHR* pSetupReferenceSlot; + uint32_t referenceSlotCount; + const VkVideoReferenceSlotInfoKHR* pReferenceSlots; +} VkVideoDecodeInfoKHR; + +typedef void (VKAPI_PTR *PFN_vkCmdDecodeVideoKHR)(VkCommandBuffer commandBuffer, const VkVideoDecodeInfoKHR* pDecodeInfo); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR void VKAPI_CALL vkCmdDecodeVideoKHR( + VkCommandBuffer commandBuffer, + const VkVideoDecodeInfoKHR* pDecodeInfo); +#endif + + +// VK_KHR_video_encode_h264 is a preprocessor guard. Do not pass it to API calls. +#define VK_KHR_video_encode_h264 1 +#include "../vk_video/vulkan_video_codec_h264std.h" +#include "../vk_video/vulkan_video_codec_h264std_encode.h" +#define VK_KHR_VIDEO_ENCODE_H264_SPEC_VERSION 14 +#define VK_KHR_VIDEO_ENCODE_H264_EXTENSION_NAME "VK_KHR_video_encode_h264" + +typedef enum VkVideoEncodeH264CapabilityFlagBitsKHR { + VK_VIDEO_ENCODE_H264_CAPABILITY_HRD_COMPLIANCE_BIT_KHR = 0x00000001, + VK_VIDEO_ENCODE_H264_CAPABILITY_PREDICTION_WEIGHT_TABLE_GENERATED_BIT_KHR = 0x00000002, + VK_VIDEO_ENCODE_H264_CAPABILITY_ROW_UNALIGNED_SLICE_BIT_KHR = 0x00000004, + VK_VIDEO_ENCODE_H264_CAPABILITY_DIFFERENT_SLICE_TYPE_BIT_KHR = 0x00000008, + VK_VIDEO_ENCODE_H264_CAPABILITY_B_FRAME_IN_L0_LIST_BIT_KHR = 0x00000010, + VK_VIDEO_ENCODE_H264_CAPABILITY_B_FRAME_IN_L1_LIST_BIT_KHR = 0x00000020, + VK_VIDEO_ENCODE_H264_CAPABILITY_PER_PICTURE_TYPE_MIN_MAX_QP_BIT_KHR = 0x00000040, + VK_VIDEO_ENCODE_H264_CAPABILITY_PER_SLICE_CONSTANT_QP_BIT_KHR = 0x00000080, + VK_VIDEO_ENCODE_H264_CAPABILITY_GENERATE_PREFIX_NALU_BIT_KHR = 0x00000100, + VK_VIDEO_ENCODE_H264_CAPABILITY_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF +} VkVideoEncodeH264CapabilityFlagBitsKHR; +typedef VkFlags VkVideoEncodeH264CapabilityFlagsKHR; + +typedef enum VkVideoEncodeH264StdFlagBitsKHR { + VK_VIDEO_ENCODE_H264_STD_SEPARATE_COLOR_PLANE_FLAG_SET_BIT_KHR = 0x00000001, + VK_VIDEO_ENCODE_H264_STD_QPPRIME_Y_ZERO_TRANSFORM_BYPASS_FLAG_SET_BIT_KHR = 0x00000002, + VK_VIDEO_ENCODE_H264_STD_SCALING_MATRIX_PRESENT_FLAG_SET_BIT_KHR = 0x00000004, + VK_VIDEO_ENCODE_H264_STD_CHROMA_QP_INDEX_OFFSET_BIT_KHR = 0x00000008, + VK_VIDEO_ENCODE_H264_STD_SECOND_CHROMA_QP_INDEX_OFFSET_BIT_KHR = 0x00000010, + VK_VIDEO_ENCODE_H264_STD_PIC_INIT_QP_MINUS26_BIT_KHR = 0x00000020, + VK_VIDEO_ENCODE_H264_STD_WEIGHTED_PRED_FLAG_SET_BIT_KHR = 0x00000040, + VK_VIDEO_ENCODE_H264_STD_WEIGHTED_BIPRED_IDC_EXPLICIT_BIT_KHR = 0x00000080, + VK_VIDEO_ENCODE_H264_STD_WEIGHTED_BIPRED_IDC_IMPLICIT_BIT_KHR = 0x00000100, + VK_VIDEO_ENCODE_H264_STD_TRANSFORM_8X8_MODE_FLAG_SET_BIT_KHR = 0x00000200, + VK_VIDEO_ENCODE_H264_STD_DIRECT_SPATIAL_MV_PRED_FLAG_UNSET_BIT_KHR = 0x00000400, + VK_VIDEO_ENCODE_H264_STD_ENTROPY_CODING_MODE_FLAG_UNSET_BIT_KHR = 0x00000800, + VK_VIDEO_ENCODE_H264_STD_ENTROPY_CODING_MODE_FLAG_SET_BIT_KHR = 0x00001000, + VK_VIDEO_ENCODE_H264_STD_DIRECT_8X8_INFERENCE_FLAG_UNSET_BIT_KHR = 0x00002000, + VK_VIDEO_ENCODE_H264_STD_CONSTRAINED_INTRA_PRED_FLAG_SET_BIT_KHR = 0x00004000, + VK_VIDEO_ENCODE_H264_STD_DEBLOCKING_FILTER_DISABLED_BIT_KHR = 0x00008000, + VK_VIDEO_ENCODE_H264_STD_DEBLOCKING_FILTER_ENABLED_BIT_KHR = 0x00010000, + VK_VIDEO_ENCODE_H264_STD_DEBLOCKING_FILTER_PARTIAL_BIT_KHR = 0x00020000, + VK_VIDEO_ENCODE_H264_STD_SLICE_QP_DELTA_BIT_KHR = 0x00080000, + VK_VIDEO_ENCODE_H264_STD_DIFFERENT_SLICE_QP_DELTA_BIT_KHR = 0x00100000, + VK_VIDEO_ENCODE_H264_STD_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF +} VkVideoEncodeH264StdFlagBitsKHR; +typedef VkFlags VkVideoEncodeH264StdFlagsKHR; + +typedef enum VkVideoEncodeH264RateControlFlagBitsKHR { + VK_VIDEO_ENCODE_H264_RATE_CONTROL_ATTEMPT_HRD_COMPLIANCE_BIT_KHR = 0x00000001, + VK_VIDEO_ENCODE_H264_RATE_CONTROL_REGULAR_GOP_BIT_KHR = 0x00000002, + VK_VIDEO_ENCODE_H264_RATE_CONTROL_REFERENCE_PATTERN_FLAT_BIT_KHR = 0x00000004, + VK_VIDEO_ENCODE_H264_RATE_CONTROL_REFERENCE_PATTERN_DYADIC_BIT_KHR = 0x00000008, + VK_VIDEO_ENCODE_H264_RATE_CONTROL_TEMPORAL_LAYER_PATTERN_DYADIC_BIT_KHR = 0x00000010, + VK_VIDEO_ENCODE_H264_RATE_CONTROL_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF +} VkVideoEncodeH264RateControlFlagBitsKHR; +typedef VkFlags VkVideoEncodeH264RateControlFlagsKHR; +typedef struct VkVideoEncodeH264CapabilitiesKHR { + VkStructureType sType; + void* pNext; + VkVideoEncodeH264CapabilityFlagsKHR flags; + StdVideoH264LevelIdc maxLevelIdc; + uint32_t maxSliceCount; + uint32_t maxPPictureL0ReferenceCount; + uint32_t maxBPictureL0ReferenceCount; + uint32_t maxL1ReferenceCount; + uint32_t maxTemporalLayerCount; + VkBool32 expectDyadicTemporalLayerPattern; + int32_t minQp; + int32_t maxQp; + VkBool32 prefersGopRemainingFrames; + VkBool32 requiresGopRemainingFrames; + VkVideoEncodeH264StdFlagsKHR stdSyntaxFlags; +} VkVideoEncodeH264CapabilitiesKHR; + +typedef struct VkVideoEncodeH264QpKHR { + int32_t qpI; + int32_t qpP; + int32_t qpB; +} VkVideoEncodeH264QpKHR; + +typedef struct VkVideoEncodeH264QualityLevelPropertiesKHR { + VkStructureType sType; + void* pNext; + VkVideoEncodeH264RateControlFlagsKHR preferredRateControlFlags; + uint32_t preferredGopFrameCount; + uint32_t preferredIdrPeriod; + uint32_t preferredConsecutiveBFrameCount; + uint32_t preferredTemporalLayerCount; + VkVideoEncodeH264QpKHR preferredConstantQp; + uint32_t preferredMaxL0ReferenceCount; + uint32_t preferredMaxL1ReferenceCount; + VkBool32 preferredStdEntropyCodingModeFlag; +} VkVideoEncodeH264QualityLevelPropertiesKHR; + +typedef struct VkVideoEncodeH264SessionCreateInfoKHR { + VkStructureType sType; + const void* pNext; + VkBool32 useMaxLevelIdc; + StdVideoH264LevelIdc maxLevelIdc; +} VkVideoEncodeH264SessionCreateInfoKHR; + +typedef struct VkVideoEncodeH264SessionParametersAddInfoKHR { + VkStructureType sType; + const void* pNext; + uint32_t stdSPSCount; + const StdVideoH264SequenceParameterSet* pStdSPSs; + uint32_t stdPPSCount; + const StdVideoH264PictureParameterSet* pStdPPSs; +} VkVideoEncodeH264SessionParametersAddInfoKHR; + +typedef struct VkVideoEncodeH264SessionParametersCreateInfoKHR { + VkStructureType sType; + const void* pNext; + uint32_t maxStdSPSCount; + uint32_t maxStdPPSCount; + const VkVideoEncodeH264SessionParametersAddInfoKHR* pParametersAddInfo; +} VkVideoEncodeH264SessionParametersCreateInfoKHR; + +typedef struct VkVideoEncodeH264SessionParametersGetInfoKHR { + VkStructureType sType; + const void* pNext; + VkBool32 writeStdSPS; + VkBool32 writeStdPPS; + uint32_t stdSPSId; + uint32_t stdPPSId; +} VkVideoEncodeH264SessionParametersGetInfoKHR; + +typedef struct VkVideoEncodeH264SessionParametersFeedbackInfoKHR { + VkStructureType sType; + void* pNext; + VkBool32 hasStdSPSOverrides; + VkBool32 hasStdPPSOverrides; +} VkVideoEncodeH264SessionParametersFeedbackInfoKHR; + +typedef struct VkVideoEncodeH264NaluSliceInfoKHR { + VkStructureType sType; + const void* pNext; + int32_t constantQp; + const StdVideoEncodeH264SliceHeader* pStdSliceHeader; +} VkVideoEncodeH264NaluSliceInfoKHR; + +typedef struct VkVideoEncodeH264PictureInfoKHR { + VkStructureType sType; + const void* pNext; + uint32_t naluSliceEntryCount; + const VkVideoEncodeH264NaluSliceInfoKHR* pNaluSliceEntries; + const StdVideoEncodeH264PictureInfo* pStdPictureInfo; + VkBool32 generatePrefixNalu; +} VkVideoEncodeH264PictureInfoKHR; + +typedef struct VkVideoEncodeH264DpbSlotInfoKHR { + VkStructureType sType; + const void* pNext; + const StdVideoEncodeH264ReferenceInfo* pStdReferenceInfo; +} VkVideoEncodeH264DpbSlotInfoKHR; + +typedef struct VkVideoEncodeH264ProfileInfoKHR { + VkStructureType sType; + const void* pNext; + StdVideoH264ProfileIdc stdProfileIdc; +} VkVideoEncodeH264ProfileInfoKHR; + +typedef struct VkVideoEncodeH264RateControlInfoKHR { + VkStructureType sType; + const void* pNext; + VkVideoEncodeH264RateControlFlagsKHR flags; + uint32_t gopFrameCount; + uint32_t idrPeriod; + uint32_t consecutiveBFrameCount; + uint32_t temporalLayerCount; +} VkVideoEncodeH264RateControlInfoKHR; + +typedef struct VkVideoEncodeH264FrameSizeKHR { + uint32_t frameISize; + uint32_t framePSize; + uint32_t frameBSize; +} VkVideoEncodeH264FrameSizeKHR; + +typedef struct VkVideoEncodeH264RateControlLayerInfoKHR { + VkStructureType sType; + const void* pNext; + VkBool32 useMinQp; + VkVideoEncodeH264QpKHR minQp; + VkBool32 useMaxQp; + VkVideoEncodeH264QpKHR maxQp; + VkBool32 useMaxFrameSize; + VkVideoEncodeH264FrameSizeKHR maxFrameSize; +} VkVideoEncodeH264RateControlLayerInfoKHR; + +typedef struct VkVideoEncodeH264GopRemainingFrameInfoKHR { + VkStructureType sType; + const void* pNext; + VkBool32 useGopRemainingFrames; + uint32_t gopRemainingI; + uint32_t gopRemainingP; + uint32_t gopRemainingB; +} VkVideoEncodeH264GopRemainingFrameInfoKHR; + + + +// VK_KHR_video_encode_h265 is a preprocessor guard. Do not pass it to API calls. +#define VK_KHR_video_encode_h265 1 +#include "../vk_video/vulkan_video_codec_h265std.h" +#include "../vk_video/vulkan_video_codec_h265std_encode.h" +#define VK_KHR_VIDEO_ENCODE_H265_SPEC_VERSION 14 +#define VK_KHR_VIDEO_ENCODE_H265_EXTENSION_NAME "VK_KHR_video_encode_h265" + +typedef enum VkVideoEncodeH265CapabilityFlagBitsKHR { + VK_VIDEO_ENCODE_H265_CAPABILITY_HRD_COMPLIANCE_BIT_KHR = 0x00000001, + VK_VIDEO_ENCODE_H265_CAPABILITY_PREDICTION_WEIGHT_TABLE_GENERATED_BIT_KHR = 0x00000002, + VK_VIDEO_ENCODE_H265_CAPABILITY_ROW_UNALIGNED_SLICE_SEGMENT_BIT_KHR = 0x00000004, + VK_VIDEO_ENCODE_H265_CAPABILITY_DIFFERENT_SLICE_SEGMENT_TYPE_BIT_KHR = 0x00000008, + VK_VIDEO_ENCODE_H265_CAPABILITY_B_FRAME_IN_L0_LIST_BIT_KHR = 0x00000010, + VK_VIDEO_ENCODE_H265_CAPABILITY_B_FRAME_IN_L1_LIST_BIT_KHR = 0x00000020, + VK_VIDEO_ENCODE_H265_CAPABILITY_PER_PICTURE_TYPE_MIN_MAX_QP_BIT_KHR = 0x00000040, + VK_VIDEO_ENCODE_H265_CAPABILITY_PER_SLICE_SEGMENT_CONSTANT_QP_BIT_KHR = 0x00000080, + VK_VIDEO_ENCODE_H265_CAPABILITY_MULTIPLE_TILES_PER_SLICE_SEGMENT_BIT_KHR = 0x00000100, + VK_VIDEO_ENCODE_H265_CAPABILITY_MULTIPLE_SLICE_SEGMENTS_PER_TILE_BIT_KHR = 0x00000200, + VK_VIDEO_ENCODE_H265_CAPABILITY_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF +} VkVideoEncodeH265CapabilityFlagBitsKHR; +typedef VkFlags VkVideoEncodeH265CapabilityFlagsKHR; + +typedef enum VkVideoEncodeH265StdFlagBitsKHR { + VK_VIDEO_ENCODE_H265_STD_SEPARATE_COLOR_PLANE_FLAG_SET_BIT_KHR = 0x00000001, + VK_VIDEO_ENCODE_H265_STD_SAMPLE_ADAPTIVE_OFFSET_ENABLED_FLAG_SET_BIT_KHR = 0x00000002, + VK_VIDEO_ENCODE_H265_STD_SCALING_LIST_DATA_PRESENT_FLAG_SET_BIT_KHR = 0x00000004, + VK_VIDEO_ENCODE_H265_STD_PCM_ENABLED_FLAG_SET_BIT_KHR = 0x00000008, + VK_VIDEO_ENCODE_H265_STD_SPS_TEMPORAL_MVP_ENABLED_FLAG_SET_BIT_KHR = 0x00000010, + VK_VIDEO_ENCODE_H265_STD_INIT_QP_MINUS26_BIT_KHR = 0x00000020, + VK_VIDEO_ENCODE_H265_STD_WEIGHTED_PRED_FLAG_SET_BIT_KHR = 0x00000040, + VK_VIDEO_ENCODE_H265_STD_WEIGHTED_BIPRED_FLAG_SET_BIT_KHR = 0x00000080, + VK_VIDEO_ENCODE_H265_STD_LOG2_PARALLEL_MERGE_LEVEL_MINUS2_BIT_KHR = 0x00000100, + VK_VIDEO_ENCODE_H265_STD_SIGN_DATA_HIDING_ENABLED_FLAG_SET_BIT_KHR = 0x00000200, + VK_VIDEO_ENCODE_H265_STD_TRANSFORM_SKIP_ENABLED_FLAG_SET_BIT_KHR = 0x00000400, + VK_VIDEO_ENCODE_H265_STD_TRANSFORM_SKIP_ENABLED_FLAG_UNSET_BIT_KHR = 0x00000800, + VK_VIDEO_ENCODE_H265_STD_PPS_SLICE_CHROMA_QP_OFFSETS_PRESENT_FLAG_SET_BIT_KHR = 0x00001000, + VK_VIDEO_ENCODE_H265_STD_TRANSQUANT_BYPASS_ENABLED_FLAG_SET_BIT_KHR = 0x00002000, + VK_VIDEO_ENCODE_H265_STD_CONSTRAINED_INTRA_PRED_FLAG_SET_BIT_KHR = 0x00004000, + VK_VIDEO_ENCODE_H265_STD_ENTROPY_CODING_SYNC_ENABLED_FLAG_SET_BIT_KHR = 0x00008000, + VK_VIDEO_ENCODE_H265_STD_DEBLOCKING_FILTER_OVERRIDE_ENABLED_FLAG_SET_BIT_KHR = 0x00010000, + VK_VIDEO_ENCODE_H265_STD_DEPENDENT_SLICE_SEGMENTS_ENABLED_FLAG_SET_BIT_KHR = 0x00020000, + VK_VIDEO_ENCODE_H265_STD_DEPENDENT_SLICE_SEGMENT_FLAG_SET_BIT_KHR = 0x00040000, + VK_VIDEO_ENCODE_H265_STD_SLICE_QP_DELTA_BIT_KHR = 0x00080000, + VK_VIDEO_ENCODE_H265_STD_DIFFERENT_SLICE_QP_DELTA_BIT_KHR = 0x00100000, + VK_VIDEO_ENCODE_H265_STD_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF +} VkVideoEncodeH265StdFlagBitsKHR; +typedef VkFlags VkVideoEncodeH265StdFlagsKHR; + +typedef enum VkVideoEncodeH265CtbSizeFlagBitsKHR { + VK_VIDEO_ENCODE_H265_CTB_SIZE_16_BIT_KHR = 0x00000001, + VK_VIDEO_ENCODE_H265_CTB_SIZE_32_BIT_KHR = 0x00000002, + VK_VIDEO_ENCODE_H265_CTB_SIZE_64_BIT_KHR = 0x00000004, + VK_VIDEO_ENCODE_H265_CTB_SIZE_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF +} VkVideoEncodeH265CtbSizeFlagBitsKHR; +typedef VkFlags VkVideoEncodeH265CtbSizeFlagsKHR; + +typedef enum VkVideoEncodeH265TransformBlockSizeFlagBitsKHR { + VK_VIDEO_ENCODE_H265_TRANSFORM_BLOCK_SIZE_4_BIT_KHR = 0x00000001, + VK_VIDEO_ENCODE_H265_TRANSFORM_BLOCK_SIZE_8_BIT_KHR = 0x00000002, + VK_VIDEO_ENCODE_H265_TRANSFORM_BLOCK_SIZE_16_BIT_KHR = 0x00000004, + VK_VIDEO_ENCODE_H265_TRANSFORM_BLOCK_SIZE_32_BIT_KHR = 0x00000008, + VK_VIDEO_ENCODE_H265_TRANSFORM_BLOCK_SIZE_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF +} VkVideoEncodeH265TransformBlockSizeFlagBitsKHR; +typedef VkFlags VkVideoEncodeH265TransformBlockSizeFlagsKHR; + +typedef enum VkVideoEncodeH265RateControlFlagBitsKHR { + VK_VIDEO_ENCODE_H265_RATE_CONTROL_ATTEMPT_HRD_COMPLIANCE_BIT_KHR = 0x00000001, + VK_VIDEO_ENCODE_H265_RATE_CONTROL_REGULAR_GOP_BIT_KHR = 0x00000002, + VK_VIDEO_ENCODE_H265_RATE_CONTROL_REFERENCE_PATTERN_FLAT_BIT_KHR = 0x00000004, + VK_VIDEO_ENCODE_H265_RATE_CONTROL_REFERENCE_PATTERN_DYADIC_BIT_KHR = 0x00000008, + VK_VIDEO_ENCODE_H265_RATE_CONTROL_TEMPORAL_SUB_LAYER_PATTERN_DYADIC_BIT_KHR = 0x00000010, + VK_VIDEO_ENCODE_H265_RATE_CONTROL_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF +} VkVideoEncodeH265RateControlFlagBitsKHR; +typedef VkFlags VkVideoEncodeH265RateControlFlagsKHR; +typedef struct VkVideoEncodeH265CapabilitiesKHR { + VkStructureType sType; + void* pNext; + VkVideoEncodeH265CapabilityFlagsKHR flags; + StdVideoH265LevelIdc maxLevelIdc; + uint32_t maxSliceSegmentCount; + VkExtent2D maxTiles; + VkVideoEncodeH265CtbSizeFlagsKHR ctbSizes; + VkVideoEncodeH265TransformBlockSizeFlagsKHR transformBlockSizes; + uint32_t maxPPictureL0ReferenceCount; + uint32_t maxBPictureL0ReferenceCount; + uint32_t maxL1ReferenceCount; + uint32_t maxSubLayerCount; + VkBool32 expectDyadicTemporalSubLayerPattern; + int32_t minQp; + int32_t maxQp; + VkBool32 prefersGopRemainingFrames; + VkBool32 requiresGopRemainingFrames; + VkVideoEncodeH265StdFlagsKHR stdSyntaxFlags; +} VkVideoEncodeH265CapabilitiesKHR; + +typedef struct VkVideoEncodeH265SessionCreateInfoKHR { + VkStructureType sType; + const void* pNext; + VkBool32 useMaxLevelIdc; + StdVideoH265LevelIdc maxLevelIdc; +} VkVideoEncodeH265SessionCreateInfoKHR; + +typedef struct VkVideoEncodeH265QpKHR { + int32_t qpI; + int32_t qpP; + int32_t qpB; +} VkVideoEncodeH265QpKHR; + +typedef struct VkVideoEncodeH265QualityLevelPropertiesKHR { + VkStructureType sType; + void* pNext; + VkVideoEncodeH265RateControlFlagsKHR preferredRateControlFlags; + uint32_t preferredGopFrameCount; + uint32_t preferredIdrPeriod; + uint32_t preferredConsecutiveBFrameCount; + uint32_t preferredSubLayerCount; + VkVideoEncodeH265QpKHR preferredConstantQp; + uint32_t preferredMaxL0ReferenceCount; + uint32_t preferredMaxL1ReferenceCount; +} VkVideoEncodeH265QualityLevelPropertiesKHR; + +typedef struct VkVideoEncodeH265SessionParametersAddInfoKHR { + VkStructureType sType; + const void* pNext; + uint32_t stdVPSCount; + const StdVideoH265VideoParameterSet* pStdVPSs; + uint32_t stdSPSCount; + const StdVideoH265SequenceParameterSet* pStdSPSs; + uint32_t stdPPSCount; + const StdVideoH265PictureParameterSet* pStdPPSs; +} VkVideoEncodeH265SessionParametersAddInfoKHR; + +typedef struct VkVideoEncodeH265SessionParametersCreateInfoKHR { + VkStructureType sType; + const void* pNext; + uint32_t maxStdVPSCount; + uint32_t maxStdSPSCount; + uint32_t maxStdPPSCount; + const VkVideoEncodeH265SessionParametersAddInfoKHR* pParametersAddInfo; +} VkVideoEncodeH265SessionParametersCreateInfoKHR; + +typedef struct VkVideoEncodeH265SessionParametersGetInfoKHR { + VkStructureType sType; + const void* pNext; + VkBool32 writeStdVPS; + VkBool32 writeStdSPS; + VkBool32 writeStdPPS; + uint32_t stdVPSId; + uint32_t stdSPSId; + uint32_t stdPPSId; +} VkVideoEncodeH265SessionParametersGetInfoKHR; + +typedef struct VkVideoEncodeH265SessionParametersFeedbackInfoKHR { + VkStructureType sType; + void* pNext; + VkBool32 hasStdVPSOverrides; + VkBool32 hasStdSPSOverrides; + VkBool32 hasStdPPSOverrides; +} VkVideoEncodeH265SessionParametersFeedbackInfoKHR; + +typedef struct VkVideoEncodeH265NaluSliceSegmentInfoKHR { + VkStructureType sType; + const void* pNext; + int32_t constantQp; + const StdVideoEncodeH265SliceSegmentHeader* pStdSliceSegmentHeader; +} VkVideoEncodeH265NaluSliceSegmentInfoKHR; + +typedef struct VkVideoEncodeH265PictureInfoKHR { + VkStructureType sType; + const void* pNext; + uint32_t naluSliceSegmentEntryCount; + const VkVideoEncodeH265NaluSliceSegmentInfoKHR* pNaluSliceSegmentEntries; + const StdVideoEncodeH265PictureInfo* pStdPictureInfo; +} VkVideoEncodeH265PictureInfoKHR; + +typedef struct VkVideoEncodeH265DpbSlotInfoKHR { + VkStructureType sType; + const void* pNext; + const StdVideoEncodeH265ReferenceInfo* pStdReferenceInfo; +} VkVideoEncodeH265DpbSlotInfoKHR; + +typedef struct VkVideoEncodeH265ProfileInfoKHR { + VkStructureType sType; + const void* pNext; + StdVideoH265ProfileIdc stdProfileIdc; +} VkVideoEncodeH265ProfileInfoKHR; + +typedef struct VkVideoEncodeH265RateControlInfoKHR { + VkStructureType sType; + const void* pNext; + VkVideoEncodeH265RateControlFlagsKHR flags; + uint32_t gopFrameCount; + uint32_t idrPeriod; + uint32_t consecutiveBFrameCount; + uint32_t subLayerCount; +} VkVideoEncodeH265RateControlInfoKHR; + +typedef struct VkVideoEncodeH265FrameSizeKHR { + uint32_t frameISize; + uint32_t framePSize; + uint32_t frameBSize; +} VkVideoEncodeH265FrameSizeKHR; + +typedef struct VkVideoEncodeH265RateControlLayerInfoKHR { + VkStructureType sType; + const void* pNext; + VkBool32 useMinQp; + VkVideoEncodeH265QpKHR minQp; + VkBool32 useMaxQp; + VkVideoEncodeH265QpKHR maxQp; + VkBool32 useMaxFrameSize; + VkVideoEncodeH265FrameSizeKHR maxFrameSize; +} VkVideoEncodeH265RateControlLayerInfoKHR; + +typedef struct VkVideoEncodeH265GopRemainingFrameInfoKHR { + VkStructureType sType; + const void* pNext; + VkBool32 useGopRemainingFrames; + uint32_t gopRemainingI; + uint32_t gopRemainingP; + uint32_t gopRemainingB; +} VkVideoEncodeH265GopRemainingFrameInfoKHR; + + + +// VK_KHR_video_decode_h264 is a preprocessor guard. Do not pass it to API calls. +#define VK_KHR_video_decode_h264 1 +#include "../vk_video/vulkan_video_codec_h264std_decode.h" +#define VK_KHR_VIDEO_DECODE_H264_SPEC_VERSION 9 +#define VK_KHR_VIDEO_DECODE_H264_EXTENSION_NAME "VK_KHR_video_decode_h264" + +typedef enum VkVideoDecodeH264PictureLayoutFlagBitsKHR { + VK_VIDEO_DECODE_H264_PICTURE_LAYOUT_PROGRESSIVE_KHR = 0, + VK_VIDEO_DECODE_H264_PICTURE_LAYOUT_INTERLACED_INTERLEAVED_LINES_BIT_KHR = 0x00000001, + VK_VIDEO_DECODE_H264_PICTURE_LAYOUT_INTERLACED_SEPARATE_PLANES_BIT_KHR = 0x00000002, + VK_VIDEO_DECODE_H264_PICTURE_LAYOUT_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF +} VkVideoDecodeH264PictureLayoutFlagBitsKHR; +typedef VkFlags VkVideoDecodeH264PictureLayoutFlagsKHR; +typedef struct VkVideoDecodeH264ProfileInfoKHR { + VkStructureType sType; + const void* pNext; + StdVideoH264ProfileIdc stdProfileIdc; + VkVideoDecodeH264PictureLayoutFlagBitsKHR pictureLayout; +} VkVideoDecodeH264ProfileInfoKHR; + +typedef struct VkVideoDecodeH264CapabilitiesKHR { + VkStructureType sType; + void* pNext; + StdVideoH264LevelIdc maxLevelIdc; + VkOffset2D fieldOffsetGranularity; +} VkVideoDecodeH264CapabilitiesKHR; + +typedef struct VkVideoDecodeH264SessionParametersAddInfoKHR { + VkStructureType sType; + const void* pNext; + uint32_t stdSPSCount; + const StdVideoH264SequenceParameterSet* pStdSPSs; + uint32_t stdPPSCount; + const StdVideoH264PictureParameterSet* pStdPPSs; +} VkVideoDecodeH264SessionParametersAddInfoKHR; + +typedef struct VkVideoDecodeH264SessionParametersCreateInfoKHR { + VkStructureType sType; + const void* pNext; + uint32_t maxStdSPSCount; + uint32_t maxStdPPSCount; + const VkVideoDecodeH264SessionParametersAddInfoKHR* pParametersAddInfo; +} VkVideoDecodeH264SessionParametersCreateInfoKHR; + +typedef struct VkVideoDecodeH264PictureInfoKHR { + VkStructureType sType; + const void* pNext; + const StdVideoDecodeH264PictureInfo* pStdPictureInfo; + uint32_t sliceCount; + const uint32_t* pSliceOffsets; +} VkVideoDecodeH264PictureInfoKHR; + +typedef struct VkVideoDecodeH264DpbSlotInfoKHR { + VkStructureType sType; + const void* pNext; + const StdVideoDecodeH264ReferenceInfo* pStdReferenceInfo; +} VkVideoDecodeH264DpbSlotInfoKHR; + + + +// VK_KHR_dynamic_rendering is a preprocessor guard. Do not pass it to API calls. +#define VK_KHR_dynamic_rendering 1 +#define VK_KHR_DYNAMIC_RENDERING_SPEC_VERSION 1 +#define VK_KHR_DYNAMIC_RENDERING_EXTENSION_NAME "VK_KHR_dynamic_rendering" +typedef VkRenderingFlags VkRenderingFlagsKHR; + +typedef VkRenderingFlagBits VkRenderingFlagBitsKHR; + +typedef VkRenderingInfo VkRenderingInfoKHR; + +typedef VkRenderingAttachmentInfo VkRenderingAttachmentInfoKHR; + +typedef VkPipelineRenderingCreateInfo VkPipelineRenderingCreateInfoKHR; typedef VkPhysicalDeviceDynamicRenderingFeatures VkPhysicalDeviceDynamicRenderingFeaturesKHR; @@ -7880,6 +8830,7 @@ VKAPI_ATTR void VKAPI_CALL vkCmdEndRenderingKHR( #endif +// VK_KHR_multiview is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_multiview 1 #define VK_KHR_MULTIVIEW_SPEC_VERSION 1 #define VK_KHR_MULTIVIEW_EXTENSION_NAME "VK_KHR_multiview" @@ -7891,6 +8842,7 @@ typedef VkPhysicalDeviceMultiviewProperties VkPhysicalDeviceMultiviewPropertiesK +// VK_KHR_get_physical_device_properties2 is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_get_physical_device_properties2 1 #define VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_SPEC_VERSION 2 #define VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME "VK_KHR_get_physical_device_properties2" @@ -7956,6 +8908,7 @@ VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceSparseImageFormatProperties2KHR( #endif +// VK_KHR_device_group is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_device_group 1 #define VK_KHR_DEVICE_GROUP_SPEC_VERSION 4 #define VK_KHR_DEVICE_GROUP_EXTENSION_NAME "VK_KHR_device_group" @@ -8008,11 +8961,13 @@ VKAPI_ATTR void VKAPI_CALL vkCmdDispatchBaseKHR( #endif +// VK_KHR_shader_draw_parameters is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_shader_draw_parameters 1 #define VK_KHR_SHADER_DRAW_PARAMETERS_SPEC_VERSION 1 #define VK_KHR_SHADER_DRAW_PARAMETERS_EXTENSION_NAME "VK_KHR_shader_draw_parameters" +// VK_KHR_maintenance1 is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_maintenance1 1 #define VK_KHR_MAINTENANCE_1_SPEC_VERSION 2 #define VK_KHR_MAINTENANCE_1_EXTENSION_NAME "VK_KHR_maintenance1" @@ -8030,6 +8985,7 @@ VKAPI_ATTR void VKAPI_CALL vkTrimCommandPoolKHR( #endif +// VK_KHR_device_group_creation is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_device_group_creation 1 #define VK_KHR_DEVICE_GROUP_CREATION_SPEC_VERSION 1 #define VK_KHR_DEVICE_GROUP_CREATION_EXTENSION_NAME "VK_KHR_device_group_creation" @@ -8048,6 +9004,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkEnumeratePhysicalDeviceGroupsKHR( #endif +// VK_KHR_external_memory_capabilities is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_external_memory_capabilities 1 #define VK_KHR_EXTERNAL_MEMORY_CAPABILITIES_SPEC_VERSION 1 #define VK_KHR_EXTERNAL_MEMORY_CAPABILITIES_EXTENSION_NAME "VK_KHR_external_memory_capabilities" @@ -8082,6 +9039,7 @@ VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceExternalBufferPropertiesKHR( #endif +// VK_KHR_external_memory is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_external_memory 1 #define VK_KHR_EXTERNAL_MEMORY_SPEC_VERSION 1 #define VK_KHR_EXTERNAL_MEMORY_EXTENSION_NAME "VK_KHR_external_memory" @@ -8094,6 +9052,7 @@ typedef VkExportMemoryAllocateInfo VkExportMemoryAllocateInfoKHR; +// VK_KHR_external_memory_fd is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_external_memory_fd 1 #define VK_KHR_EXTERNAL_MEMORY_FD_SPEC_VERSION 1 #define VK_KHR_EXTERNAL_MEMORY_FD_EXTENSION_NAME "VK_KHR_external_memory_fd" @@ -8134,6 +9093,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryFdPropertiesKHR( #endif +// VK_KHR_external_semaphore_capabilities is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_external_semaphore_capabilities 1 #define VK_KHR_EXTERNAL_SEMAPHORE_CAPABILITIES_SPEC_VERSION 1 #define VK_KHR_EXTERNAL_SEMAPHORE_CAPABILITIES_EXTENSION_NAME "VK_KHR_external_semaphore_capabilities" @@ -8159,6 +9119,7 @@ VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceExternalSemaphorePropertiesKHR( #endif +// VK_KHR_external_semaphore is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_external_semaphore 1 #define VK_KHR_EXTERNAL_SEMAPHORE_SPEC_VERSION 1 #define VK_KHR_EXTERNAL_SEMAPHORE_EXTENSION_NAME "VK_KHR_external_semaphore" @@ -8170,6 +9131,7 @@ typedef VkExportSemaphoreCreateInfo VkExportSemaphoreCreateInfoKHR; +// VK_KHR_external_semaphore_fd is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_external_semaphore_fd 1 #define VK_KHR_EXTERNAL_SEMAPHORE_FD_SPEC_VERSION 1 #define VK_KHR_EXTERNAL_SEMAPHORE_FD_EXTENSION_NAME "VK_KHR_external_semaphore_fd" @@ -8204,6 +9166,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkGetSemaphoreFdKHR( #endif +// VK_KHR_push_descriptor is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_push_descriptor 1 #define VK_KHR_PUSH_DESCRIPTOR_SPEC_VERSION 2 #define VK_KHR_PUSH_DESCRIPTOR_EXTENSION_NAME "VK_KHR_push_descriptor" @@ -8234,6 +9197,7 @@ VKAPI_ATTR void VKAPI_CALL vkCmdPushDescriptorSetWithTemplateKHR( #endif +// VK_KHR_shader_float16_int8 is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_shader_float16_int8 1 #define VK_KHR_SHADER_FLOAT16_INT8_SPEC_VERSION 1 #define VK_KHR_SHADER_FLOAT16_INT8_EXTENSION_NAME "VK_KHR_shader_float16_int8" @@ -8243,6 +9207,7 @@ typedef VkPhysicalDeviceShaderFloat16Int8Features VkPhysicalDeviceFloat16Int8Fea +// VK_KHR_16bit_storage is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_16bit_storage 1 #define VK_KHR_16BIT_STORAGE_SPEC_VERSION 1 #define VK_KHR_16BIT_STORAGE_EXTENSION_NAME "VK_KHR_16bit_storage" @@ -8250,6 +9215,7 @@ typedef VkPhysicalDevice16BitStorageFeatures VkPhysicalDevice16BitStorageFeature +// VK_KHR_incremental_present is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_incremental_present 1 #define VK_KHR_INCREMENTAL_PRESENT_SPEC_VERSION 2 #define VK_KHR_INCREMENTAL_PRESENT_EXTENSION_NAME "VK_KHR_incremental_present" @@ -8273,6 +9239,7 @@ typedef struct VkPresentRegionsKHR { +// VK_KHR_descriptor_update_template is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_descriptor_update_template 1 typedef VkDescriptorUpdateTemplate VkDescriptorUpdateTemplateKHR; @@ -8310,6 +9277,7 @@ VKAPI_ATTR void VKAPI_CALL vkUpdateDescriptorSetWithTemplateKHR( #endif +// VK_KHR_imageless_framebuffer is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_imageless_framebuffer 1 #define VK_KHR_IMAGELESS_FRAMEBUFFER_SPEC_VERSION 1 #define VK_KHR_IMAGELESS_FRAMEBUFFER_EXTENSION_NAME "VK_KHR_imageless_framebuffer" @@ -8323,6 +9291,7 @@ typedef VkRenderPassAttachmentBeginInfo VkRenderPassAttachmentBeginInfoKHR; +// VK_KHR_create_renderpass2 is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_create_renderpass2 1 #define VK_KHR_CREATE_RENDERPASS_2_SPEC_VERSION 1 #define VK_KHR_CREATE_RENDERPASS_2_EXTENSION_NAME "VK_KHR_create_renderpass2" @@ -8368,6 +9337,7 @@ VKAPI_ATTR void VKAPI_CALL vkCmdEndRenderPass2KHR( #endif +// VK_KHR_shared_presentable_image is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_shared_presentable_image 1 #define VK_KHR_SHARED_PRESENTABLE_IMAGE_SPEC_VERSION 1 #define VK_KHR_SHARED_PRESENTABLE_IMAGE_EXTENSION_NAME "VK_KHR_shared_presentable_image" @@ -8386,6 +9356,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkGetSwapchainStatusKHR( #endif +// VK_KHR_external_fence_capabilities is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_external_fence_capabilities 1 #define VK_KHR_EXTERNAL_FENCE_CAPABILITIES_SPEC_VERSION 1 #define VK_KHR_EXTERNAL_FENCE_CAPABILITIES_EXTENSION_NAME "VK_KHR_external_fence_capabilities" @@ -8411,6 +9382,7 @@ VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceExternalFencePropertiesKHR( #endif +// VK_KHR_external_fence is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_external_fence 1 #define VK_KHR_EXTERNAL_FENCE_SPEC_VERSION 1 #define VK_KHR_EXTERNAL_FENCE_EXTENSION_NAME "VK_KHR_external_fence" @@ -8422,6 +9394,7 @@ typedef VkExportFenceCreateInfo VkExportFenceCreateInfoKHR; +// VK_KHR_external_fence_fd is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_external_fence_fd 1 #define VK_KHR_EXTERNAL_FENCE_FD_SPEC_VERSION 1 #define VK_KHR_EXTERNAL_FENCE_FD_EXTENSION_NAME "VK_KHR_external_fence_fd" @@ -8456,6 +9429,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkGetFenceFdKHR( #endif +// VK_KHR_performance_query is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_performance_query 1 #define VK_KHR_PERFORMANCE_QUERY_SPEC_VERSION 1 #define VK_KHR_PERFORMANCE_QUERY_EXTENSION_NAME "VK_KHR_performance_query" @@ -8596,6 +9570,7 @@ VKAPI_ATTR void VKAPI_CALL vkReleaseProfilingLockKHR( #endif +// VK_KHR_maintenance2 is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_maintenance2 1 #define VK_KHR_MAINTENANCE_2_SPEC_VERSION 1 #define VK_KHR_MAINTENANCE_2_EXTENSION_NAME "VK_KHR_maintenance2" @@ -8617,6 +9592,7 @@ typedef VkPipelineTessellationDomainOriginStateCreateInfo VkPipelineTessellation +// VK_KHR_get_surface_capabilities2 is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_get_surface_capabilities2 1 #define VK_KHR_GET_SURFACE_CAPABILITIES_2_SPEC_VERSION 1 #define VK_KHR_GET_SURFACE_CAPABILITIES_2_EXTENSION_NAME "VK_KHR_get_surface_capabilities2" @@ -8655,6 +9631,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfaceFormats2KHR( #endif +// VK_KHR_variable_pointers is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_variable_pointers 1 #define VK_KHR_VARIABLE_POINTERS_SPEC_VERSION 1 #define VK_KHR_VARIABLE_POINTERS_EXTENSION_NAME "VK_KHR_variable_pointers" @@ -8664,6 +9641,7 @@ typedef VkPhysicalDeviceVariablePointersFeatures VkPhysicalDeviceVariablePointer +// VK_KHR_get_display_properties2 is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_get_display_properties2 1 #define VK_KHR_GET_DISPLAY_PROPERTIES_2_SPEC_VERSION 1 #define VK_KHR_GET_DISPLAY_PROPERTIES_2_EXTENSION_NAME "VK_KHR_get_display_properties2" @@ -8727,6 +9705,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkGetDisplayPlaneCapabilities2KHR( #endif +// VK_KHR_dedicated_allocation is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_dedicated_allocation 1 #define VK_KHR_DEDICATED_ALLOCATION_SPEC_VERSION 3 #define VK_KHR_DEDICATED_ALLOCATION_EXTENSION_NAME "VK_KHR_dedicated_allocation" @@ -8736,16 +9715,19 @@ typedef VkMemoryDedicatedAllocateInfo VkMemoryDedicatedAllocateInfoKHR; +// VK_KHR_storage_buffer_storage_class is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_storage_buffer_storage_class 1 #define VK_KHR_STORAGE_BUFFER_STORAGE_CLASS_SPEC_VERSION 1 #define VK_KHR_STORAGE_BUFFER_STORAGE_CLASS_EXTENSION_NAME "VK_KHR_storage_buffer_storage_class" +// VK_KHR_relaxed_block_layout is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_relaxed_block_layout 1 #define VK_KHR_RELAXED_BLOCK_LAYOUT_SPEC_VERSION 1 #define VK_KHR_RELAXED_BLOCK_LAYOUT_EXTENSION_NAME "VK_KHR_relaxed_block_layout" +// VK_KHR_get_memory_requirements2 is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_get_memory_requirements2 1 #define VK_KHR_GET_MEMORY_REQUIREMENTS_2_SPEC_VERSION 1 #define VK_KHR_GET_MEMORY_REQUIREMENTS_2_EXTENSION_NAME "VK_KHR_get_memory_requirements2" @@ -8782,6 +9764,7 @@ VKAPI_ATTR void VKAPI_CALL vkGetImageSparseMemoryRequirements2KHR( #endif +// VK_KHR_image_format_list is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_image_format_list 1 #define VK_KHR_IMAGE_FORMAT_LIST_SPEC_VERSION 1 #define VK_KHR_IMAGE_FORMAT_LIST_EXTENSION_NAME "VK_KHR_image_format_list" @@ -8789,6 +9772,7 @@ typedef VkImageFormatListCreateInfo VkImageFormatListCreateInfoKHR; +// VK_KHR_sampler_ycbcr_conversion is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_sampler_ycbcr_conversion 1 typedef VkSamplerYcbcrConversion VkSamplerYcbcrConversionKHR; @@ -8829,6 +9813,7 @@ VKAPI_ATTR void VKAPI_CALL vkDestroySamplerYcbcrConversionKHR( #endif +// VK_KHR_bind_memory2 is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_bind_memory2 1 #define VK_KHR_BIND_MEMORY_2_SPEC_VERSION 1 #define VK_KHR_BIND_MEMORY_2_EXTENSION_NAME "VK_KHR_bind_memory2" @@ -8852,6 +9837,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkBindImageMemory2KHR( #endif +// VK_KHR_maintenance3 is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_maintenance3 1 #define VK_KHR_MAINTENANCE_3_SPEC_VERSION 1 #define VK_KHR_MAINTENANCE_3_EXTENSION_NAME "VK_KHR_maintenance3" @@ -8871,6 +9857,7 @@ VKAPI_ATTR void VKAPI_CALL vkGetDescriptorSetLayoutSupportKHR( #endif +// VK_KHR_draw_indirect_count is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_draw_indirect_count 1 #define VK_KHR_DRAW_INDIRECT_COUNT_SPEC_VERSION 1 #define VK_KHR_DRAW_INDIRECT_COUNT_EXTENSION_NAME "VK_KHR_draw_indirect_count" @@ -8898,6 +9885,7 @@ VKAPI_ATTR void VKAPI_CALL vkCmdDrawIndexedIndirectCountKHR( #endif +// VK_KHR_shader_subgroup_extended_types is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_shader_subgroup_extended_types 1 #define VK_KHR_SHADER_SUBGROUP_EXTENDED_TYPES_SPEC_VERSION 1 #define VK_KHR_SHADER_SUBGROUP_EXTENDED_TYPES_EXTENSION_NAME "VK_KHR_shader_subgroup_extended_types" @@ -8905,6 +9893,7 @@ typedef VkPhysicalDeviceShaderSubgroupExtendedTypesFeatures VkPhysicalDeviceShad +// VK_KHR_8bit_storage is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_8bit_storage 1 #define VK_KHR_8BIT_STORAGE_SPEC_VERSION 1 #define VK_KHR_8BIT_STORAGE_EXTENSION_NAME "VK_KHR_8bit_storage" @@ -8912,6 +9901,7 @@ typedef VkPhysicalDevice8BitStorageFeatures VkPhysicalDevice8BitStorageFeaturesK +// VK_KHR_shader_atomic_int64 is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_shader_atomic_int64 1 #define VK_KHR_SHADER_ATOMIC_INT64_SPEC_VERSION 1 #define VK_KHR_SHADER_ATOMIC_INT64_EXTENSION_NAME "VK_KHR_shader_atomic_int64" @@ -8919,6 +9909,7 @@ typedef VkPhysicalDeviceShaderAtomicInt64Features VkPhysicalDeviceShaderAtomicIn +// VK_KHR_shader_clock is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_shader_clock 1 #define VK_KHR_SHADER_CLOCK_SPEC_VERSION 1 #define VK_KHR_SHADER_CLOCK_EXTENSION_NAME "VK_KHR_shader_clock" @@ -8931,6 +9922,60 @@ typedef struct VkPhysicalDeviceShaderClockFeaturesKHR { +// VK_KHR_video_decode_h265 is a preprocessor guard. Do not pass it to API calls. +#define VK_KHR_video_decode_h265 1 +#include "../vk_video/vulkan_video_codec_h265std_decode.h" +#define VK_KHR_VIDEO_DECODE_H265_SPEC_VERSION 8 +#define VK_KHR_VIDEO_DECODE_H265_EXTENSION_NAME "VK_KHR_video_decode_h265" +typedef struct VkVideoDecodeH265ProfileInfoKHR { + VkStructureType sType; + const void* pNext; + StdVideoH265ProfileIdc stdProfileIdc; +} VkVideoDecodeH265ProfileInfoKHR; + +typedef struct VkVideoDecodeH265CapabilitiesKHR { + VkStructureType sType; + void* pNext; + StdVideoH265LevelIdc maxLevelIdc; +} VkVideoDecodeH265CapabilitiesKHR; + +typedef struct VkVideoDecodeH265SessionParametersAddInfoKHR { + VkStructureType sType; + const void* pNext; + uint32_t stdVPSCount; + const StdVideoH265VideoParameterSet* pStdVPSs; + uint32_t stdSPSCount; + const StdVideoH265SequenceParameterSet* pStdSPSs; + uint32_t stdPPSCount; + const StdVideoH265PictureParameterSet* pStdPPSs; +} VkVideoDecodeH265SessionParametersAddInfoKHR; + +typedef struct VkVideoDecodeH265SessionParametersCreateInfoKHR { + VkStructureType sType; + const void* pNext; + uint32_t maxStdVPSCount; + uint32_t maxStdSPSCount; + uint32_t maxStdPPSCount; + const VkVideoDecodeH265SessionParametersAddInfoKHR* pParametersAddInfo; +} VkVideoDecodeH265SessionParametersCreateInfoKHR; + +typedef struct VkVideoDecodeH265PictureInfoKHR { + VkStructureType sType; + const void* pNext; + const StdVideoDecodeH265PictureInfo* pStdPictureInfo; + uint32_t sliceSegmentCount; + const uint32_t* pSliceSegmentOffsets; +} VkVideoDecodeH265PictureInfoKHR; + +typedef struct VkVideoDecodeH265DpbSlotInfoKHR { + VkStructureType sType; + const void* pNext; + const StdVideoDecodeH265ReferenceInfo* pStdReferenceInfo; +} VkVideoDecodeH265DpbSlotInfoKHR; + + + +// VK_KHR_global_priority is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_global_priority 1 #define VK_MAX_GLOBAL_PRIORITY_SIZE_KHR 16U #define VK_KHR_GLOBAL_PRIORITY_SPEC_VERSION 1 @@ -8968,6 +10013,7 @@ typedef struct VkQueueFamilyGlobalPriorityPropertiesKHR { +// VK_KHR_driver_properties is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_driver_properties 1 #define VK_KHR_DRIVER_PROPERTIES_SPEC_VERSION 1 #define VK_KHR_DRIVER_PROPERTIES_EXTENSION_NAME "VK_KHR_driver_properties" @@ -8981,6 +10027,7 @@ typedef VkPhysicalDeviceDriverProperties VkPhysicalDeviceDriverPropertiesKHR; +// VK_KHR_shader_float_controls is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_shader_float_controls 1 #define VK_KHR_SHADER_FLOAT_CONTROLS_SPEC_VERSION 4 #define VK_KHR_SHADER_FLOAT_CONTROLS_EXTENSION_NAME "VK_KHR_shader_float_controls" @@ -8990,6 +10037,7 @@ typedef VkPhysicalDeviceFloatControlsProperties VkPhysicalDeviceFloatControlsPro +// VK_KHR_depth_stencil_resolve is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_depth_stencil_resolve 1 #define VK_KHR_DEPTH_STENCIL_RESOLVE_SPEC_VERSION 1 #define VK_KHR_DEPTH_STENCIL_RESOLVE_EXTENSION_NAME "VK_KHR_depth_stencil_resolve" @@ -9003,11 +10051,13 @@ typedef VkPhysicalDeviceDepthStencilResolveProperties VkPhysicalDeviceDepthStenc +// VK_KHR_swapchain_mutable_format is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_swapchain_mutable_format 1 #define VK_KHR_SWAPCHAIN_MUTABLE_FORMAT_SPEC_VERSION 1 #define VK_KHR_SWAPCHAIN_MUTABLE_FORMAT_EXTENSION_NAME "VK_KHR_swapchain_mutable_format" +// VK_KHR_timeline_semaphore is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_timeline_semaphore 1 #define VK_KHR_TIMELINE_SEMAPHORE_SPEC_VERSION 2 #define VK_KHR_TIMELINE_SEMAPHORE_EXTENSION_NAME "VK_KHR_timeline_semaphore" @@ -9050,6 +10100,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkSignalSemaphoreKHR( #endif +// VK_KHR_vulkan_memory_model is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_vulkan_memory_model 1 #define VK_KHR_VULKAN_MEMORY_MODEL_SPEC_VERSION 3 #define VK_KHR_VULKAN_MEMORY_MODEL_EXTENSION_NAME "VK_KHR_vulkan_memory_model" @@ -9057,6 +10108,7 @@ typedef VkPhysicalDeviceVulkanMemoryModelFeatures VkPhysicalDeviceVulkanMemoryMo +// VK_KHR_shader_terminate_invocation is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_shader_terminate_invocation 1 #define VK_KHR_SHADER_TERMINATE_INVOCATION_SPEC_VERSION 1 #define VK_KHR_SHADER_TERMINATE_INVOCATION_EXTENSION_NAME "VK_KHR_shader_terminate_invocation" @@ -9064,6 +10116,7 @@ typedef VkPhysicalDeviceShaderTerminateInvocationFeatures VkPhysicalDeviceShader +// VK_KHR_fragment_shading_rate is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_fragment_shading_rate 1 #define VK_KHR_FRAGMENT_SHADING_RATE_SPEC_VERSION 2 #define VK_KHR_FRAGMENT_SHADING_RATE_EXTENSION_NAME "VK_KHR_fragment_shading_rate" @@ -9143,11 +10196,13 @@ VKAPI_ATTR void VKAPI_CALL vkCmdSetFragmentShadingRateKHR( #endif +// VK_KHR_spirv_1_4 is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_spirv_1_4 1 #define VK_KHR_SPIRV_1_4_SPEC_VERSION 1 #define VK_KHR_SPIRV_1_4_EXTENSION_NAME "VK_KHR_spirv_1_4" +// VK_KHR_surface_protected_capabilities is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_surface_protected_capabilities 1 #define VK_KHR_SURFACE_PROTECTED_CAPABILITIES_SPEC_VERSION 1 #define VK_KHR_SURFACE_PROTECTED_CAPABILITIES_EXTENSION_NAME "VK_KHR_surface_protected_capabilities" @@ -9159,6 +10214,7 @@ typedef struct VkSurfaceProtectedCapabilitiesKHR { +// VK_KHR_separate_depth_stencil_layouts is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_separate_depth_stencil_layouts 1 #define VK_KHR_SEPARATE_DEPTH_STENCIL_LAYOUTS_SPEC_VERSION 1 #define VK_KHR_SEPARATE_DEPTH_STENCIL_LAYOUTS_EXTENSION_NAME "VK_KHR_separate_depth_stencil_layouts" @@ -9170,6 +10226,7 @@ typedef VkAttachmentDescriptionStencilLayout VkAttachmentDescriptionStencilLayou +// VK_KHR_present_wait is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_present_wait 1 #define VK_KHR_PRESENT_WAIT_SPEC_VERSION 1 #define VK_KHR_PRESENT_WAIT_EXTENSION_NAME "VK_KHR_present_wait" @@ -9190,6 +10247,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkWaitForPresentKHR( #endif +// VK_KHR_uniform_buffer_standard_layout is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_uniform_buffer_standard_layout 1 #define VK_KHR_UNIFORM_BUFFER_STANDARD_LAYOUT_SPEC_VERSION 1 #define VK_KHR_UNIFORM_BUFFER_STANDARD_LAYOUT_EXTENSION_NAME "VK_KHR_uniform_buffer_standard_layout" @@ -9197,6 +10255,7 @@ typedef VkPhysicalDeviceUniformBufferStandardLayoutFeatures VkPhysicalDeviceUnif +// VK_KHR_buffer_device_address is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_buffer_device_address 1 #define VK_KHR_BUFFER_DEVICE_ADDRESS_SPEC_VERSION 1 #define VK_KHR_BUFFER_DEVICE_ADDRESS_EXTENSION_NAME "VK_KHR_buffer_device_address" @@ -9229,6 +10288,7 @@ VKAPI_ATTR uint64_t VKAPI_CALL vkGetDeviceMemoryOpaqueCaptureAddressKHR( #endif +// VK_KHR_deferred_host_operations is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_deferred_host_operations 1 VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDeferredOperationKHR) #define VK_KHR_DEFERRED_HOST_OPERATIONS_SPEC_VERSION 4 @@ -9264,6 +10324,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkDeferredOperationJoinKHR( #endif +// VK_KHR_pipeline_executable_properties is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_pipeline_executable_properties 1 #define VK_KHR_PIPELINE_EXECUTABLE_PROPERTIES_SPEC_VERSION 1 #define VK_KHR_PIPELINE_EXECUTABLE_PROPERTIES_EXTENSION_NAME "VK_KHR_pipeline_executable_properties" @@ -9354,6 +10415,43 @@ VKAPI_ATTR VkResult VKAPI_CALL vkGetPipelineExecutableInternalRepresentationsKHR #endif +// VK_KHR_map_memory2 is a preprocessor guard. Do not pass it to API calls. +#define VK_KHR_map_memory2 1 +#define VK_KHR_MAP_MEMORY_2_SPEC_VERSION 1 +#define VK_KHR_MAP_MEMORY_2_EXTENSION_NAME "VK_KHR_map_memory2" +typedef VkFlags VkMemoryUnmapFlagsKHR; +typedef struct VkMemoryMapInfoKHR { + VkStructureType sType; + const void* pNext; + VkMemoryMapFlags flags; + VkDeviceMemory memory; + VkDeviceSize offset; + VkDeviceSize size; +} VkMemoryMapInfoKHR; + +typedef struct VkMemoryUnmapInfoKHR { + VkStructureType sType; + const void* pNext; + VkMemoryUnmapFlagsKHR flags; + VkDeviceMemory memory; +} VkMemoryUnmapInfoKHR; + +typedef VkResult (VKAPI_PTR *PFN_vkMapMemory2KHR)(VkDevice device, const VkMemoryMapInfoKHR* pMemoryMapInfo, void** ppData); +typedef VkResult (VKAPI_PTR *PFN_vkUnmapMemory2KHR)(VkDevice device, const VkMemoryUnmapInfoKHR* pMemoryUnmapInfo); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkMapMemory2KHR( + VkDevice device, + const VkMemoryMapInfoKHR* pMemoryMapInfo, + void** ppData); + +VKAPI_ATTR VkResult VKAPI_CALL vkUnmapMemory2KHR( + VkDevice device, + const VkMemoryUnmapInfoKHR* pMemoryUnmapInfo); +#endif + + +// VK_KHR_shader_integer_dot_product is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_shader_integer_dot_product 1 #define VK_KHR_SHADER_INTEGER_DOT_PRODUCT_SPEC_VERSION 1 #define VK_KHR_SHADER_INTEGER_DOT_PRODUCT_EXTENSION_NAME "VK_KHR_shader_integer_dot_product" @@ -9363,6 +10461,7 @@ typedef VkPhysicalDeviceShaderIntegerDotProductProperties VkPhysicalDeviceShader +// VK_KHR_pipeline_library is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_pipeline_library 1 #define VK_KHR_PIPELINE_LIBRARY_SPEC_VERSION 1 #define VK_KHR_PIPELINE_LIBRARY_EXTENSION_NAME "VK_KHR_pipeline_library" @@ -9375,11 +10474,13 @@ typedef struct VkPipelineLibraryCreateInfoKHR { +// VK_KHR_shader_non_semantic_info is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_shader_non_semantic_info 1 #define VK_KHR_SHADER_NON_SEMANTIC_INFO_SPEC_VERSION 1 #define VK_KHR_SHADER_NON_SEMANTIC_INFO_EXTENSION_NAME "VK_KHR_shader_non_semantic_info" +// VK_KHR_present_id is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_present_id 1 #define VK_KHR_PRESENT_ID_SPEC_VERSION 1 #define VK_KHR_PRESENT_ID_EXTENSION_NAME "VK_KHR_present_id" @@ -9398,28 +10499,202 @@ typedef struct VkPhysicalDevicePresentIdFeaturesKHR { -#define VK_KHR_synchronization2 1 -#define VK_KHR_SYNCHRONIZATION_2_SPEC_VERSION 1 -#define VK_KHR_SYNCHRONIZATION_2_EXTENSION_NAME "VK_KHR_synchronization2" -typedef VkPipelineStageFlags2 VkPipelineStageFlags2KHR; +// VK_KHR_video_encode_queue is a preprocessor guard. Do not pass it to API calls. +#define VK_KHR_video_encode_queue 1 +#define VK_KHR_VIDEO_ENCODE_QUEUE_SPEC_VERSION 12 +#define VK_KHR_VIDEO_ENCODE_QUEUE_EXTENSION_NAME "VK_KHR_video_encode_queue" + +typedef enum VkVideoEncodeTuningModeKHR { + VK_VIDEO_ENCODE_TUNING_MODE_DEFAULT_KHR = 0, + VK_VIDEO_ENCODE_TUNING_MODE_HIGH_QUALITY_KHR = 1, + VK_VIDEO_ENCODE_TUNING_MODE_LOW_LATENCY_KHR = 2, + VK_VIDEO_ENCODE_TUNING_MODE_ULTRA_LOW_LATENCY_KHR = 3, + VK_VIDEO_ENCODE_TUNING_MODE_LOSSLESS_KHR = 4, + VK_VIDEO_ENCODE_TUNING_MODE_MAX_ENUM_KHR = 0x7FFFFFFF +} VkVideoEncodeTuningModeKHR; +typedef VkFlags VkVideoEncodeFlagsKHR; + +typedef enum VkVideoEncodeCapabilityFlagBitsKHR { + VK_VIDEO_ENCODE_CAPABILITY_PRECEDING_EXTERNALLY_ENCODED_BYTES_BIT_KHR = 0x00000001, + VK_VIDEO_ENCODE_CAPABILITY_INSUFFICIENT_BITSTREAM_BUFFER_RANGE_DETECTION_BIT_KHR = 0x00000002, + VK_VIDEO_ENCODE_CAPABILITY_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF +} VkVideoEncodeCapabilityFlagBitsKHR; +typedef VkFlags VkVideoEncodeCapabilityFlagsKHR; + +typedef enum VkVideoEncodeRateControlModeFlagBitsKHR { + VK_VIDEO_ENCODE_RATE_CONTROL_MODE_DEFAULT_KHR = 0, + VK_VIDEO_ENCODE_RATE_CONTROL_MODE_DISABLED_BIT_KHR = 0x00000001, + VK_VIDEO_ENCODE_RATE_CONTROL_MODE_CBR_BIT_KHR = 0x00000002, + VK_VIDEO_ENCODE_RATE_CONTROL_MODE_VBR_BIT_KHR = 0x00000004, + VK_VIDEO_ENCODE_RATE_CONTROL_MODE_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF +} VkVideoEncodeRateControlModeFlagBitsKHR; +typedef VkFlags VkVideoEncodeRateControlModeFlagsKHR; + +typedef enum VkVideoEncodeFeedbackFlagBitsKHR { + VK_VIDEO_ENCODE_FEEDBACK_BITSTREAM_BUFFER_OFFSET_BIT_KHR = 0x00000001, + VK_VIDEO_ENCODE_FEEDBACK_BITSTREAM_BYTES_WRITTEN_BIT_KHR = 0x00000002, + VK_VIDEO_ENCODE_FEEDBACK_BITSTREAM_HAS_OVERRIDES_BIT_KHR = 0x00000004, + VK_VIDEO_ENCODE_FEEDBACK_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF +} VkVideoEncodeFeedbackFlagBitsKHR; +typedef VkFlags VkVideoEncodeFeedbackFlagsKHR; + +typedef enum VkVideoEncodeUsageFlagBitsKHR { + VK_VIDEO_ENCODE_USAGE_DEFAULT_KHR = 0, + VK_VIDEO_ENCODE_USAGE_TRANSCODING_BIT_KHR = 0x00000001, + VK_VIDEO_ENCODE_USAGE_STREAMING_BIT_KHR = 0x00000002, + VK_VIDEO_ENCODE_USAGE_RECORDING_BIT_KHR = 0x00000004, + VK_VIDEO_ENCODE_USAGE_CONFERENCING_BIT_KHR = 0x00000008, + VK_VIDEO_ENCODE_USAGE_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF +} VkVideoEncodeUsageFlagBitsKHR; +typedef VkFlags VkVideoEncodeUsageFlagsKHR; + +typedef enum VkVideoEncodeContentFlagBitsKHR { + VK_VIDEO_ENCODE_CONTENT_DEFAULT_KHR = 0, + VK_VIDEO_ENCODE_CONTENT_CAMERA_BIT_KHR = 0x00000001, + VK_VIDEO_ENCODE_CONTENT_DESKTOP_BIT_KHR = 0x00000002, + VK_VIDEO_ENCODE_CONTENT_RENDERED_BIT_KHR = 0x00000004, + VK_VIDEO_ENCODE_CONTENT_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF +} VkVideoEncodeContentFlagBitsKHR; +typedef VkFlags VkVideoEncodeContentFlagsKHR; +typedef VkFlags VkVideoEncodeRateControlFlagsKHR; +typedef struct VkVideoEncodeInfoKHR { + VkStructureType sType; + const void* pNext; + VkVideoEncodeFlagsKHR flags; + VkBuffer dstBuffer; + VkDeviceSize dstBufferOffset; + VkDeviceSize dstBufferRange; + VkVideoPictureResourceInfoKHR srcPictureResource; + const VkVideoReferenceSlotInfoKHR* pSetupReferenceSlot; + uint32_t referenceSlotCount; + const VkVideoReferenceSlotInfoKHR* pReferenceSlots; + uint32_t precedingExternallyEncodedBytes; +} VkVideoEncodeInfoKHR; + +typedef struct VkVideoEncodeCapabilitiesKHR { + VkStructureType sType; + void* pNext; + VkVideoEncodeCapabilityFlagsKHR flags; + VkVideoEncodeRateControlModeFlagsKHR rateControlModes; + uint32_t maxRateControlLayers; + uint64_t maxBitrate; + uint32_t maxQualityLevels; + VkExtent2D encodeInputPictureGranularity; + VkVideoEncodeFeedbackFlagsKHR supportedEncodeFeedbackFlags; +} VkVideoEncodeCapabilitiesKHR; + +typedef struct VkQueryPoolVideoEncodeFeedbackCreateInfoKHR { + VkStructureType sType; + const void* pNext; + VkVideoEncodeFeedbackFlagsKHR encodeFeedbackFlags; +} VkQueryPoolVideoEncodeFeedbackCreateInfoKHR; -typedef VkPipelineStageFlagBits2 VkPipelineStageFlagBits2KHR; +typedef struct VkVideoEncodeUsageInfoKHR { + VkStructureType sType; + const void* pNext; + VkVideoEncodeUsageFlagsKHR videoUsageHints; + VkVideoEncodeContentFlagsKHR videoContentHints; + VkVideoEncodeTuningModeKHR tuningMode; +} VkVideoEncodeUsageInfoKHR; -typedef VkAccessFlags2 VkAccessFlags2KHR; +typedef struct VkVideoEncodeRateControlLayerInfoKHR { + VkStructureType sType; + const void* pNext; + uint64_t averageBitrate; + uint64_t maxBitrate; + uint32_t frameRateNumerator; + uint32_t frameRateDenominator; +} VkVideoEncodeRateControlLayerInfoKHR; -typedef VkAccessFlagBits2 VkAccessFlagBits2KHR; +typedef struct VkVideoEncodeRateControlInfoKHR { + VkStructureType sType; + const void* pNext; + VkVideoEncodeRateControlFlagsKHR flags; + VkVideoEncodeRateControlModeFlagBitsKHR rateControlMode; + uint32_t layerCount; + const VkVideoEncodeRateControlLayerInfoKHR* pLayers; + uint32_t virtualBufferSizeInMs; + uint32_t initialVirtualBufferSizeInMs; +} VkVideoEncodeRateControlInfoKHR; + +typedef struct VkPhysicalDeviceVideoEncodeQualityLevelInfoKHR { + VkStructureType sType; + const void* pNext; + const VkVideoProfileInfoKHR* pVideoProfile; + uint32_t qualityLevel; +} VkPhysicalDeviceVideoEncodeQualityLevelInfoKHR; -typedef VkSubmitFlagBits VkSubmitFlagBitsKHR; +typedef struct VkVideoEncodeQualityLevelPropertiesKHR { + VkStructureType sType; + void* pNext; + VkVideoEncodeRateControlModeFlagBitsKHR preferredRateControlMode; + uint32_t preferredRateControlLayerCount; +} VkVideoEncodeQualityLevelPropertiesKHR; -typedef VkSubmitFlags VkSubmitFlagsKHR; +typedef struct VkVideoEncodeQualityLevelInfoKHR { + VkStructureType sType; + const void* pNext; + uint32_t qualityLevel; +} VkVideoEncodeQualityLevelInfoKHR; -typedef VkMemoryBarrier2 VkMemoryBarrier2KHR; +typedef struct VkVideoEncodeSessionParametersGetInfoKHR { + VkStructureType sType; + const void* pNext; + VkVideoSessionParametersKHR videoSessionParameters; +} VkVideoEncodeSessionParametersGetInfoKHR; -typedef VkBufferMemoryBarrier2 VkBufferMemoryBarrier2KHR; +typedef struct VkVideoEncodeSessionParametersFeedbackInfoKHR { + VkStructureType sType; + void* pNext; + VkBool32 hasOverrides; +} VkVideoEncodeSessionParametersFeedbackInfoKHR; -typedef VkImageMemoryBarrier2 VkImageMemoryBarrier2KHR; +typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceVideoEncodeQualityLevelPropertiesKHR)(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceVideoEncodeQualityLevelInfoKHR* pQualityLevelInfo, VkVideoEncodeQualityLevelPropertiesKHR* pQualityLevelProperties); +typedef VkResult (VKAPI_PTR *PFN_vkGetEncodedVideoSessionParametersKHR)(VkDevice device, const VkVideoEncodeSessionParametersGetInfoKHR* pVideoSessionParametersInfo, VkVideoEncodeSessionParametersFeedbackInfoKHR* pFeedbackInfo, size_t* pDataSize, void* pData); +typedef void (VKAPI_PTR *PFN_vkCmdEncodeVideoKHR)(VkCommandBuffer commandBuffer, const VkVideoEncodeInfoKHR* pEncodeInfo); -typedef VkDependencyInfo VkDependencyInfoKHR; +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceVideoEncodeQualityLevelPropertiesKHR( + VkPhysicalDevice physicalDevice, + const VkPhysicalDeviceVideoEncodeQualityLevelInfoKHR* pQualityLevelInfo, + VkVideoEncodeQualityLevelPropertiesKHR* pQualityLevelProperties); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetEncodedVideoSessionParametersKHR( + VkDevice device, + const VkVideoEncodeSessionParametersGetInfoKHR* pVideoSessionParametersInfo, + VkVideoEncodeSessionParametersFeedbackInfoKHR* pFeedbackInfo, + size_t* pDataSize, + void* pData); + +VKAPI_ATTR void VKAPI_CALL vkCmdEncodeVideoKHR( + VkCommandBuffer commandBuffer, + const VkVideoEncodeInfoKHR* pEncodeInfo); +#endif + + +// VK_KHR_synchronization2 is a preprocessor guard. Do not pass it to API calls. +#define VK_KHR_synchronization2 1 +#define VK_KHR_SYNCHRONIZATION_2_SPEC_VERSION 1 +#define VK_KHR_SYNCHRONIZATION_2_EXTENSION_NAME "VK_KHR_synchronization2" +typedef VkPipelineStageFlags2 VkPipelineStageFlags2KHR; + +typedef VkPipelineStageFlagBits2 VkPipelineStageFlagBits2KHR; + +typedef VkAccessFlags2 VkAccessFlags2KHR; + +typedef VkAccessFlagBits2 VkAccessFlagBits2KHR; + +typedef VkSubmitFlagBits VkSubmitFlagBitsKHR; + +typedef VkSubmitFlags VkSubmitFlagsKHR; + +typedef VkMemoryBarrier2 VkMemoryBarrier2KHR; + +typedef VkBufferMemoryBarrier2 VkBufferMemoryBarrier2KHR; + +typedef VkImageMemoryBarrier2 VkImageMemoryBarrier2KHR; + +typedef VkDependencyInfo VkDependencyInfoKHR; typedef VkSubmitInfo2 VkSubmitInfo2KHR; @@ -9498,6 +10773,7 @@ VKAPI_ATTR void VKAPI_CALL vkGetQueueCheckpointData2NV( #endif +// VK_KHR_fragment_shader_barycentric is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_fragment_shader_barycentric 1 #define VK_KHR_FRAGMENT_SHADER_BARYCENTRIC_SPEC_VERSION 1 #define VK_KHR_FRAGMENT_SHADER_BARYCENTRIC_EXTENSION_NAME "VK_KHR_fragment_shader_barycentric" @@ -9515,6 +10791,7 @@ typedef struct VkPhysicalDeviceFragmentShaderBarycentricPropertiesKHR { +// VK_KHR_shader_subgroup_uniform_control_flow is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_shader_subgroup_uniform_control_flow 1 #define VK_KHR_SHADER_SUBGROUP_UNIFORM_CONTROL_FLOW_SPEC_VERSION 1 #define VK_KHR_SHADER_SUBGROUP_UNIFORM_CONTROL_FLOW_EXTENSION_NAME "VK_KHR_shader_subgroup_uniform_control_flow" @@ -9526,6 +10803,7 @@ typedef struct VkPhysicalDeviceShaderSubgroupUniformControlFlowFeaturesKHR { +// VK_KHR_zero_initialize_workgroup_memory is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_zero_initialize_workgroup_memory 1 #define VK_KHR_ZERO_INITIALIZE_WORKGROUP_MEMORY_SPEC_VERSION 1 #define VK_KHR_ZERO_INITIALIZE_WORKGROUP_MEMORY_EXTENSION_NAME "VK_KHR_zero_initialize_workgroup_memory" @@ -9533,6 +10811,7 @@ typedef VkPhysicalDeviceZeroInitializeWorkgroupMemoryFeatures VkPhysicalDeviceZe +// VK_KHR_workgroup_memory_explicit_layout is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_workgroup_memory_explicit_layout 1 #define VK_KHR_WORKGROUP_MEMORY_EXPLICIT_LAYOUT_SPEC_VERSION 1 #define VK_KHR_WORKGROUP_MEMORY_EXPLICIT_LAYOUT_EXTENSION_NAME "VK_KHR_workgroup_memory_explicit_layout" @@ -9547,6 +10826,7 @@ typedef struct VkPhysicalDeviceWorkgroupMemoryExplicitLayoutFeaturesKHR { +// VK_KHR_copy_commands2 is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_copy_commands2 1 #define VK_KHR_COPY_COMMANDS_2_SPEC_VERSION 1 #define VK_KHR_COPY_COMMANDS_2_EXTENSION_NAME "VK_KHR_copy_commands2" @@ -9606,6 +10886,7 @@ VKAPI_ATTR void VKAPI_CALL vkCmdResolveImage2KHR( #endif +// VK_KHR_format_feature_flags2 is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_format_feature_flags2 1 #define VK_KHR_FORMAT_FEATURE_FLAGS_2_SPEC_VERSION 2 #define VK_KHR_FORMAT_FEATURE_FLAGS_2_EXTENSION_NAME "VK_KHR_format_feature_flags2" @@ -9617,6 +10898,7 @@ typedef VkFormatProperties3 VkFormatProperties3KHR; +// VK_KHR_ray_tracing_maintenance1 is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_ray_tracing_maintenance1 1 #define VK_KHR_RAY_TRACING_MAINTENANCE_1_SPEC_VERSION 1 #define VK_KHR_RAY_TRACING_MAINTENANCE_1_EXTENSION_NAME "VK_KHR_ray_tracing_maintenance1" @@ -9653,11 +10935,13 @@ VKAPI_ATTR void VKAPI_CALL vkCmdTraceRaysIndirect2KHR( #endif +// VK_KHR_portability_enumeration is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_portability_enumeration 1 #define VK_KHR_PORTABILITY_ENUMERATION_SPEC_VERSION 1 #define VK_KHR_PORTABILITY_ENUMERATION_EXTENSION_NAME "VK_KHR_portability_enumeration" +// VK_KHR_maintenance4 is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_maintenance4 1 #define VK_KHR_MAINTENANCE_4_SPEC_VERSION 2 #define VK_KHR_MAINTENANCE_4_EXTENSION_NAME "VK_KHR_maintenance4" @@ -9692,6 +10976,473 @@ VKAPI_ATTR void VKAPI_CALL vkGetDeviceImageSparseMemoryRequirementsKHR( #endif +// VK_KHR_maintenance5 is a preprocessor guard. Do not pass it to API calls. +#define VK_KHR_maintenance5 1 +#define VK_KHR_MAINTENANCE_5_SPEC_VERSION 1 +#define VK_KHR_MAINTENANCE_5_EXTENSION_NAME "VK_KHR_maintenance5" +typedef VkFlags64 VkPipelineCreateFlags2KHR; + +// Flag bits for VkPipelineCreateFlagBits2KHR +typedef VkFlags64 VkPipelineCreateFlagBits2KHR; +static const VkPipelineCreateFlagBits2KHR VK_PIPELINE_CREATE_2_DISABLE_OPTIMIZATION_BIT_KHR = 0x00000001ULL; +static const VkPipelineCreateFlagBits2KHR VK_PIPELINE_CREATE_2_ALLOW_DERIVATIVES_BIT_KHR = 0x00000002ULL; +static const VkPipelineCreateFlagBits2KHR VK_PIPELINE_CREATE_2_DERIVATIVE_BIT_KHR = 0x00000004ULL; +static const VkPipelineCreateFlagBits2KHR VK_PIPELINE_CREATE_2_VIEW_INDEX_FROM_DEVICE_INDEX_BIT_KHR = 0x00000008ULL; +static const VkPipelineCreateFlagBits2KHR VK_PIPELINE_CREATE_2_DISPATCH_BASE_BIT_KHR = 0x00000010ULL; +static const VkPipelineCreateFlagBits2KHR VK_PIPELINE_CREATE_2_DEFER_COMPILE_BIT_NV = 0x00000020ULL; +static const VkPipelineCreateFlagBits2KHR VK_PIPELINE_CREATE_2_CAPTURE_STATISTICS_BIT_KHR = 0x00000040ULL; +static const VkPipelineCreateFlagBits2KHR VK_PIPELINE_CREATE_2_CAPTURE_INTERNAL_REPRESENTATIONS_BIT_KHR = 0x00000080ULL; +static const VkPipelineCreateFlagBits2KHR VK_PIPELINE_CREATE_2_FAIL_ON_PIPELINE_COMPILE_REQUIRED_BIT_KHR = 0x00000100ULL; +static const VkPipelineCreateFlagBits2KHR VK_PIPELINE_CREATE_2_EARLY_RETURN_ON_FAILURE_BIT_KHR = 0x00000200ULL; +static const VkPipelineCreateFlagBits2KHR VK_PIPELINE_CREATE_2_LINK_TIME_OPTIMIZATION_BIT_EXT = 0x00000400ULL; +static const VkPipelineCreateFlagBits2KHR VK_PIPELINE_CREATE_2_RETAIN_LINK_TIME_OPTIMIZATION_INFO_BIT_EXT = 0x00800000ULL; +static const VkPipelineCreateFlagBits2KHR VK_PIPELINE_CREATE_2_LIBRARY_BIT_KHR = 0x00000800ULL; +static const VkPipelineCreateFlagBits2KHR VK_PIPELINE_CREATE_2_RAY_TRACING_SKIP_TRIANGLES_BIT_KHR = 0x00001000ULL; +static const VkPipelineCreateFlagBits2KHR VK_PIPELINE_CREATE_2_RAY_TRACING_SKIP_AABBS_BIT_KHR = 0x00002000ULL; +static const VkPipelineCreateFlagBits2KHR VK_PIPELINE_CREATE_2_RAY_TRACING_NO_NULL_ANY_HIT_SHADERS_BIT_KHR = 0x00004000ULL; +static const VkPipelineCreateFlagBits2KHR VK_PIPELINE_CREATE_2_RAY_TRACING_NO_NULL_CLOSEST_HIT_SHADERS_BIT_KHR = 0x00008000ULL; +static const VkPipelineCreateFlagBits2KHR VK_PIPELINE_CREATE_2_RAY_TRACING_NO_NULL_MISS_SHADERS_BIT_KHR = 0x00010000ULL; +static const VkPipelineCreateFlagBits2KHR VK_PIPELINE_CREATE_2_RAY_TRACING_NO_NULL_INTERSECTION_SHADERS_BIT_KHR = 0x00020000ULL; +static const VkPipelineCreateFlagBits2KHR VK_PIPELINE_CREATE_2_RAY_TRACING_SHADER_GROUP_HANDLE_CAPTURE_REPLAY_BIT_KHR = 0x00080000ULL; +static const VkPipelineCreateFlagBits2KHR VK_PIPELINE_CREATE_2_INDIRECT_BINDABLE_BIT_NV = 0x00040000ULL; +static const VkPipelineCreateFlagBits2KHR VK_PIPELINE_CREATE_2_RAY_TRACING_ALLOW_MOTION_BIT_NV = 0x00100000ULL; +static const VkPipelineCreateFlagBits2KHR VK_PIPELINE_CREATE_2_RENDERING_FRAGMENT_SHADING_RATE_ATTACHMENT_BIT_KHR = 0x00200000ULL; +static const VkPipelineCreateFlagBits2KHR VK_PIPELINE_CREATE_2_RENDERING_FRAGMENT_DENSITY_MAP_ATTACHMENT_BIT_EXT = 0x00400000ULL; +static const VkPipelineCreateFlagBits2KHR VK_PIPELINE_CREATE_2_RAY_TRACING_OPACITY_MICROMAP_BIT_EXT = 0x01000000ULL; +static const VkPipelineCreateFlagBits2KHR VK_PIPELINE_CREATE_2_COLOR_ATTACHMENT_FEEDBACK_LOOP_BIT_EXT = 0x02000000ULL; +static const VkPipelineCreateFlagBits2KHR VK_PIPELINE_CREATE_2_DEPTH_STENCIL_ATTACHMENT_FEEDBACK_LOOP_BIT_EXT = 0x04000000ULL; +static const VkPipelineCreateFlagBits2KHR VK_PIPELINE_CREATE_2_NO_PROTECTED_ACCESS_BIT_EXT = 0x08000000ULL; +static const VkPipelineCreateFlagBits2KHR VK_PIPELINE_CREATE_2_PROTECTED_ACCESS_ONLY_BIT_EXT = 0x40000000ULL; +static const VkPipelineCreateFlagBits2KHR VK_PIPELINE_CREATE_2_RAY_TRACING_DISPLACEMENT_MICROMAP_BIT_NV = 0x10000000ULL; +static const VkPipelineCreateFlagBits2KHR VK_PIPELINE_CREATE_2_DESCRIPTOR_BUFFER_BIT_EXT = 0x20000000ULL; + +typedef VkFlags64 VkBufferUsageFlags2KHR; + +// Flag bits for VkBufferUsageFlagBits2KHR +typedef VkFlags64 VkBufferUsageFlagBits2KHR; +static const VkBufferUsageFlagBits2KHR VK_BUFFER_USAGE_2_TRANSFER_SRC_BIT_KHR = 0x00000001ULL; +static const VkBufferUsageFlagBits2KHR VK_BUFFER_USAGE_2_TRANSFER_DST_BIT_KHR = 0x00000002ULL; +static const VkBufferUsageFlagBits2KHR VK_BUFFER_USAGE_2_UNIFORM_TEXEL_BUFFER_BIT_KHR = 0x00000004ULL; +static const VkBufferUsageFlagBits2KHR VK_BUFFER_USAGE_2_STORAGE_TEXEL_BUFFER_BIT_KHR = 0x00000008ULL; +static const VkBufferUsageFlagBits2KHR VK_BUFFER_USAGE_2_UNIFORM_BUFFER_BIT_KHR = 0x00000010ULL; +static const VkBufferUsageFlagBits2KHR VK_BUFFER_USAGE_2_STORAGE_BUFFER_BIT_KHR = 0x00000020ULL; +static const VkBufferUsageFlagBits2KHR VK_BUFFER_USAGE_2_INDEX_BUFFER_BIT_KHR = 0x00000040ULL; +static const VkBufferUsageFlagBits2KHR VK_BUFFER_USAGE_2_VERTEX_BUFFER_BIT_KHR = 0x00000080ULL; +static const VkBufferUsageFlagBits2KHR VK_BUFFER_USAGE_2_INDIRECT_BUFFER_BIT_KHR = 0x00000100ULL; +static const VkBufferUsageFlagBits2KHR VK_BUFFER_USAGE_2_EXECUTION_GRAPH_SCRATCH_BIT_AMDX = 0x02000000ULL; +static const VkBufferUsageFlagBits2KHR VK_BUFFER_USAGE_2_CONDITIONAL_RENDERING_BIT_EXT = 0x00000200ULL; +static const VkBufferUsageFlagBits2KHR VK_BUFFER_USAGE_2_SHADER_BINDING_TABLE_BIT_KHR = 0x00000400ULL; +static const VkBufferUsageFlagBits2KHR VK_BUFFER_USAGE_2_RAY_TRACING_BIT_NV = 0x00000400ULL; +static const VkBufferUsageFlagBits2KHR VK_BUFFER_USAGE_2_TRANSFORM_FEEDBACK_BUFFER_BIT_EXT = 0x00000800ULL; +static const VkBufferUsageFlagBits2KHR VK_BUFFER_USAGE_2_TRANSFORM_FEEDBACK_COUNTER_BUFFER_BIT_EXT = 0x00001000ULL; +static const VkBufferUsageFlagBits2KHR VK_BUFFER_USAGE_2_VIDEO_DECODE_SRC_BIT_KHR = 0x00002000ULL; +static const VkBufferUsageFlagBits2KHR VK_BUFFER_USAGE_2_VIDEO_DECODE_DST_BIT_KHR = 0x00004000ULL; +#ifdef VK_ENABLE_BETA_EXTENSIONS +static const VkBufferUsageFlagBits2KHR VK_BUFFER_USAGE_2_VIDEO_ENCODE_DST_BIT_KHR = 0x00008000ULL; +#endif +#ifdef VK_ENABLE_BETA_EXTENSIONS +static const VkBufferUsageFlagBits2KHR VK_BUFFER_USAGE_2_VIDEO_ENCODE_SRC_BIT_KHR = 0x00010000ULL; +#endif +static const VkBufferUsageFlagBits2KHR VK_BUFFER_USAGE_2_SHADER_DEVICE_ADDRESS_BIT_KHR = 0x00020000ULL; +static const VkBufferUsageFlagBits2KHR VK_BUFFER_USAGE_2_ACCELERATION_STRUCTURE_BUILD_INPUT_READ_ONLY_BIT_KHR = 0x00080000ULL; +static const VkBufferUsageFlagBits2KHR VK_BUFFER_USAGE_2_ACCELERATION_STRUCTURE_STORAGE_BIT_KHR = 0x00100000ULL; +static const VkBufferUsageFlagBits2KHR VK_BUFFER_USAGE_2_SAMPLER_DESCRIPTOR_BUFFER_BIT_EXT = 0x00200000ULL; +static const VkBufferUsageFlagBits2KHR VK_BUFFER_USAGE_2_RESOURCE_DESCRIPTOR_BUFFER_BIT_EXT = 0x00400000ULL; +static const VkBufferUsageFlagBits2KHR VK_BUFFER_USAGE_2_PUSH_DESCRIPTORS_DESCRIPTOR_BUFFER_BIT_EXT = 0x04000000ULL; +static const VkBufferUsageFlagBits2KHR VK_BUFFER_USAGE_2_MICROMAP_BUILD_INPUT_READ_ONLY_BIT_EXT = 0x00800000ULL; +static const VkBufferUsageFlagBits2KHR VK_BUFFER_USAGE_2_MICROMAP_STORAGE_BIT_EXT = 0x01000000ULL; + +typedef struct VkPhysicalDeviceMaintenance5FeaturesKHR { + VkStructureType sType; + void* pNext; + VkBool32 maintenance5; +} VkPhysicalDeviceMaintenance5FeaturesKHR; + +typedef struct VkPhysicalDeviceMaintenance5PropertiesKHR { + VkStructureType sType; + void* pNext; + VkBool32 earlyFragmentMultisampleCoverageAfterSampleCounting; + VkBool32 earlyFragmentSampleMaskTestBeforeSampleCounting; + VkBool32 depthStencilSwizzleOneSupport; + VkBool32 polygonModePointSize; + VkBool32 nonStrictSinglePixelWideLinesUseParallelogram; + VkBool32 nonStrictWideLinesUseParallelogram; +} VkPhysicalDeviceMaintenance5PropertiesKHR; + +typedef struct VkRenderingAreaInfoKHR { + VkStructureType sType; + const void* pNext; + uint32_t viewMask; + uint32_t colorAttachmentCount; + const VkFormat* pColorAttachmentFormats; + VkFormat depthAttachmentFormat; + VkFormat stencilAttachmentFormat; +} VkRenderingAreaInfoKHR; + +typedef struct VkImageSubresource2KHR { + VkStructureType sType; + void* pNext; + VkImageSubresource imageSubresource; +} VkImageSubresource2KHR; + +typedef struct VkDeviceImageSubresourceInfoKHR { + VkStructureType sType; + const void* pNext; + const VkImageCreateInfo* pCreateInfo; + const VkImageSubresource2KHR* pSubresource; +} VkDeviceImageSubresourceInfoKHR; + +typedef struct VkSubresourceLayout2KHR { + VkStructureType sType; + void* pNext; + VkSubresourceLayout subresourceLayout; +} VkSubresourceLayout2KHR; + +typedef struct VkPipelineCreateFlags2CreateInfoKHR { + VkStructureType sType; + const void* pNext; + VkPipelineCreateFlags2KHR flags; +} VkPipelineCreateFlags2CreateInfoKHR; + +typedef struct VkBufferUsageFlags2CreateInfoKHR { + VkStructureType sType; + const void* pNext; + VkBufferUsageFlags2KHR usage; +} VkBufferUsageFlags2CreateInfoKHR; + +typedef void (VKAPI_PTR *PFN_vkCmdBindIndexBuffer2KHR)(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkDeviceSize size, VkIndexType indexType); +typedef void (VKAPI_PTR *PFN_vkGetRenderingAreaGranularityKHR)(VkDevice device, const VkRenderingAreaInfoKHR* pRenderingAreaInfo, VkExtent2D* pGranularity); +typedef void (VKAPI_PTR *PFN_vkGetDeviceImageSubresourceLayoutKHR)(VkDevice device, const VkDeviceImageSubresourceInfoKHR* pInfo, VkSubresourceLayout2KHR* pLayout); +typedef void (VKAPI_PTR *PFN_vkGetImageSubresourceLayout2KHR)(VkDevice device, VkImage image, const VkImageSubresource2KHR* pSubresource, VkSubresourceLayout2KHR* pLayout); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR void VKAPI_CALL vkCmdBindIndexBuffer2KHR( + VkCommandBuffer commandBuffer, + VkBuffer buffer, + VkDeviceSize offset, + VkDeviceSize size, + VkIndexType indexType); + +VKAPI_ATTR void VKAPI_CALL vkGetRenderingAreaGranularityKHR( + VkDevice device, + const VkRenderingAreaInfoKHR* pRenderingAreaInfo, + VkExtent2D* pGranularity); + +VKAPI_ATTR void VKAPI_CALL vkGetDeviceImageSubresourceLayoutKHR( + VkDevice device, + const VkDeviceImageSubresourceInfoKHR* pInfo, + VkSubresourceLayout2KHR* pLayout); + +VKAPI_ATTR void VKAPI_CALL vkGetImageSubresourceLayout2KHR( + VkDevice device, + VkImage image, + const VkImageSubresource2KHR* pSubresource, + VkSubresourceLayout2KHR* pLayout); +#endif + + +// VK_KHR_ray_tracing_position_fetch is a preprocessor guard. Do not pass it to API calls. +#define VK_KHR_ray_tracing_position_fetch 1 +#define VK_KHR_RAY_TRACING_POSITION_FETCH_SPEC_VERSION 1 +#define VK_KHR_RAY_TRACING_POSITION_FETCH_EXTENSION_NAME "VK_KHR_ray_tracing_position_fetch" +typedef struct VkPhysicalDeviceRayTracingPositionFetchFeaturesKHR { + VkStructureType sType; + void* pNext; + VkBool32 rayTracingPositionFetch; +} VkPhysicalDeviceRayTracingPositionFetchFeaturesKHR; + + + +// VK_KHR_cooperative_matrix is a preprocessor guard. Do not pass it to API calls. +#define VK_KHR_cooperative_matrix 1 +#define VK_KHR_COOPERATIVE_MATRIX_SPEC_VERSION 2 +#define VK_KHR_COOPERATIVE_MATRIX_EXTENSION_NAME "VK_KHR_cooperative_matrix" + +typedef enum VkComponentTypeKHR { + VK_COMPONENT_TYPE_FLOAT16_KHR = 0, + VK_COMPONENT_TYPE_FLOAT32_KHR = 1, + VK_COMPONENT_TYPE_FLOAT64_KHR = 2, + VK_COMPONENT_TYPE_SINT8_KHR = 3, + VK_COMPONENT_TYPE_SINT16_KHR = 4, + VK_COMPONENT_TYPE_SINT32_KHR = 5, + VK_COMPONENT_TYPE_SINT64_KHR = 6, + VK_COMPONENT_TYPE_UINT8_KHR = 7, + VK_COMPONENT_TYPE_UINT16_KHR = 8, + VK_COMPONENT_TYPE_UINT32_KHR = 9, + VK_COMPONENT_TYPE_UINT64_KHR = 10, + VK_COMPONENT_TYPE_FLOAT16_NV = VK_COMPONENT_TYPE_FLOAT16_KHR, + VK_COMPONENT_TYPE_FLOAT32_NV = VK_COMPONENT_TYPE_FLOAT32_KHR, + VK_COMPONENT_TYPE_FLOAT64_NV = VK_COMPONENT_TYPE_FLOAT64_KHR, + VK_COMPONENT_TYPE_SINT8_NV = VK_COMPONENT_TYPE_SINT8_KHR, + VK_COMPONENT_TYPE_SINT16_NV = VK_COMPONENT_TYPE_SINT16_KHR, + VK_COMPONENT_TYPE_SINT32_NV = VK_COMPONENT_TYPE_SINT32_KHR, + VK_COMPONENT_TYPE_SINT64_NV = VK_COMPONENT_TYPE_SINT64_KHR, + VK_COMPONENT_TYPE_UINT8_NV = VK_COMPONENT_TYPE_UINT8_KHR, + VK_COMPONENT_TYPE_UINT16_NV = VK_COMPONENT_TYPE_UINT16_KHR, + VK_COMPONENT_TYPE_UINT32_NV = VK_COMPONENT_TYPE_UINT32_KHR, + VK_COMPONENT_TYPE_UINT64_NV = VK_COMPONENT_TYPE_UINT64_KHR, + VK_COMPONENT_TYPE_MAX_ENUM_KHR = 0x7FFFFFFF +} VkComponentTypeKHR; + +typedef enum VkScopeKHR { + VK_SCOPE_DEVICE_KHR = 1, + VK_SCOPE_WORKGROUP_KHR = 2, + VK_SCOPE_SUBGROUP_KHR = 3, + VK_SCOPE_QUEUE_FAMILY_KHR = 5, + VK_SCOPE_DEVICE_NV = VK_SCOPE_DEVICE_KHR, + VK_SCOPE_WORKGROUP_NV = VK_SCOPE_WORKGROUP_KHR, + VK_SCOPE_SUBGROUP_NV = VK_SCOPE_SUBGROUP_KHR, + VK_SCOPE_QUEUE_FAMILY_NV = VK_SCOPE_QUEUE_FAMILY_KHR, + VK_SCOPE_MAX_ENUM_KHR = 0x7FFFFFFF +} VkScopeKHR; +typedef struct VkCooperativeMatrixPropertiesKHR { + VkStructureType sType; + void* pNext; + uint32_t MSize; + uint32_t NSize; + uint32_t KSize; + VkComponentTypeKHR AType; + VkComponentTypeKHR BType; + VkComponentTypeKHR CType; + VkComponentTypeKHR ResultType; + VkBool32 saturatingAccumulation; + VkScopeKHR scope; +} VkCooperativeMatrixPropertiesKHR; + +typedef struct VkPhysicalDeviceCooperativeMatrixFeaturesKHR { + VkStructureType sType; + void* pNext; + VkBool32 cooperativeMatrix; + VkBool32 cooperativeMatrixRobustBufferAccess; +} VkPhysicalDeviceCooperativeMatrixFeaturesKHR; + +typedef struct VkPhysicalDeviceCooperativeMatrixPropertiesKHR { + VkStructureType sType; + void* pNext; + VkShaderStageFlags cooperativeMatrixSupportedStages; +} VkPhysicalDeviceCooperativeMatrixPropertiesKHR; + +typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceCooperativeMatrixPropertiesKHR)(VkPhysicalDevice physicalDevice, uint32_t* pPropertyCount, VkCooperativeMatrixPropertiesKHR* pProperties); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceCooperativeMatrixPropertiesKHR( + VkPhysicalDevice physicalDevice, + uint32_t* pPropertyCount, + VkCooperativeMatrixPropertiesKHR* pProperties); +#endif + + +// VK_KHR_video_maintenance1 is a preprocessor guard. Do not pass it to API calls. +#define VK_KHR_video_maintenance1 1 +#define VK_KHR_VIDEO_MAINTENANCE_1_SPEC_VERSION 1 +#define VK_KHR_VIDEO_MAINTENANCE_1_EXTENSION_NAME "VK_KHR_video_maintenance1" +typedef struct VkPhysicalDeviceVideoMaintenance1FeaturesKHR { + VkStructureType sType; + void* pNext; + VkBool32 videoMaintenance1; +} VkPhysicalDeviceVideoMaintenance1FeaturesKHR; + +typedef struct VkVideoInlineQueryInfoKHR { + VkStructureType sType; + const void* pNext; + VkQueryPool queryPool; + uint32_t firstQuery; + uint32_t queryCount; +} VkVideoInlineQueryInfoKHR; + + + +// VK_KHR_vertex_attribute_divisor is a preprocessor guard. Do not pass it to API calls. +#define VK_KHR_vertex_attribute_divisor 1 +#define VK_KHR_VERTEX_ATTRIBUTE_DIVISOR_SPEC_VERSION 1 +#define VK_KHR_VERTEX_ATTRIBUTE_DIVISOR_EXTENSION_NAME "VK_KHR_vertex_attribute_divisor" +typedef struct VkPhysicalDeviceVertexAttributeDivisorPropertiesKHR { + VkStructureType sType; + void* pNext; + uint32_t maxVertexAttribDivisor; + VkBool32 supportsNonZeroFirstInstance; +} VkPhysicalDeviceVertexAttributeDivisorPropertiesKHR; + +typedef struct VkVertexInputBindingDivisorDescriptionKHR { + uint32_t binding; + uint32_t divisor; +} VkVertexInputBindingDivisorDescriptionKHR; + +typedef struct VkPipelineVertexInputDivisorStateCreateInfoKHR { + VkStructureType sType; + const void* pNext; + uint32_t vertexBindingDivisorCount; + const VkVertexInputBindingDivisorDescriptionKHR* pVertexBindingDivisors; +} VkPipelineVertexInputDivisorStateCreateInfoKHR; + +typedef struct VkPhysicalDeviceVertexAttributeDivisorFeaturesKHR { + VkStructureType sType; + void* pNext; + VkBool32 vertexAttributeInstanceRateDivisor; + VkBool32 vertexAttributeInstanceRateZeroDivisor; +} VkPhysicalDeviceVertexAttributeDivisorFeaturesKHR; + + + +// VK_KHR_calibrated_timestamps is a preprocessor guard. Do not pass it to API calls. +#define VK_KHR_calibrated_timestamps 1 +#define VK_KHR_CALIBRATED_TIMESTAMPS_SPEC_VERSION 1 +#define VK_KHR_CALIBRATED_TIMESTAMPS_EXTENSION_NAME "VK_KHR_calibrated_timestamps" + +typedef enum VkTimeDomainKHR { + VK_TIME_DOMAIN_DEVICE_KHR = 0, + VK_TIME_DOMAIN_CLOCK_MONOTONIC_KHR = 1, + VK_TIME_DOMAIN_CLOCK_MONOTONIC_RAW_KHR = 2, + VK_TIME_DOMAIN_QUERY_PERFORMANCE_COUNTER_KHR = 3, + VK_TIME_DOMAIN_DEVICE_EXT = VK_TIME_DOMAIN_DEVICE_KHR, + VK_TIME_DOMAIN_CLOCK_MONOTONIC_EXT = VK_TIME_DOMAIN_CLOCK_MONOTONIC_KHR, + VK_TIME_DOMAIN_CLOCK_MONOTONIC_RAW_EXT = VK_TIME_DOMAIN_CLOCK_MONOTONIC_RAW_KHR, + VK_TIME_DOMAIN_QUERY_PERFORMANCE_COUNTER_EXT = VK_TIME_DOMAIN_QUERY_PERFORMANCE_COUNTER_KHR, + VK_TIME_DOMAIN_MAX_ENUM_KHR = 0x7FFFFFFF +} VkTimeDomainKHR; +typedef struct VkCalibratedTimestampInfoKHR { + VkStructureType sType; + const void* pNext; + VkTimeDomainKHR timeDomain; +} VkCalibratedTimestampInfoKHR; + +typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceCalibrateableTimeDomainsKHR)(VkPhysicalDevice physicalDevice, uint32_t* pTimeDomainCount, VkTimeDomainKHR* pTimeDomains); +typedef VkResult (VKAPI_PTR *PFN_vkGetCalibratedTimestampsKHR)(VkDevice device, uint32_t timestampCount, const VkCalibratedTimestampInfoKHR* pTimestampInfos, uint64_t* pTimestamps, uint64_t* pMaxDeviation); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceCalibrateableTimeDomainsKHR( + VkPhysicalDevice physicalDevice, + uint32_t* pTimeDomainCount, + VkTimeDomainKHR* pTimeDomains); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetCalibratedTimestampsKHR( + VkDevice device, + uint32_t timestampCount, + const VkCalibratedTimestampInfoKHR* pTimestampInfos, + uint64_t* pTimestamps, + uint64_t* pMaxDeviation); +#endif + + +// VK_KHR_maintenance6 is a preprocessor guard. Do not pass it to API calls. +#define VK_KHR_maintenance6 1 +#define VK_KHR_MAINTENANCE_6_SPEC_VERSION 1 +#define VK_KHR_MAINTENANCE_6_EXTENSION_NAME "VK_KHR_maintenance6" +typedef struct VkPhysicalDeviceMaintenance6FeaturesKHR { + VkStructureType sType; + void* pNext; + VkBool32 maintenance6; +} VkPhysicalDeviceMaintenance6FeaturesKHR; + +typedef struct VkPhysicalDeviceMaintenance6PropertiesKHR { + VkStructureType sType; + void* pNext; + VkBool32 blockTexelViewCompatibleMultipleLayers; + uint32_t maxCombinedImageSamplerDescriptorCount; + VkBool32 fragmentShadingRateClampCombinerInputs; +} VkPhysicalDeviceMaintenance6PropertiesKHR; + +typedef struct VkBindMemoryStatusKHR { + VkStructureType sType; + const void* pNext; + VkResult* pResult; +} VkBindMemoryStatusKHR; + +typedef struct VkBindDescriptorSetsInfoKHR { + VkStructureType sType; + const void* pNext; + VkShaderStageFlags stageFlags; + VkPipelineLayout layout; + uint32_t firstSet; + uint32_t descriptorSetCount; + const VkDescriptorSet* pDescriptorSets; + uint32_t dynamicOffsetCount; + const uint32_t* pDynamicOffsets; +} VkBindDescriptorSetsInfoKHR; + +typedef struct VkPushConstantsInfoKHR { + VkStructureType sType; + const void* pNext; + VkPipelineLayout layout; + VkShaderStageFlags stageFlags; + uint32_t offset; + uint32_t size; + const void* pValues; +} VkPushConstantsInfoKHR; + +typedef struct VkPushDescriptorSetInfoKHR { + VkStructureType sType; + const void* pNext; + VkShaderStageFlags stageFlags; + VkPipelineLayout layout; + uint32_t set; + uint32_t descriptorWriteCount; + const VkWriteDescriptorSet* pDescriptorWrites; +} VkPushDescriptorSetInfoKHR; + +typedef struct VkPushDescriptorSetWithTemplateInfoKHR { + VkStructureType sType; + const void* pNext; + VkDescriptorUpdateTemplate descriptorUpdateTemplate; + VkPipelineLayout layout; + uint32_t set; + const void* pData; +} VkPushDescriptorSetWithTemplateInfoKHR; + +typedef struct VkSetDescriptorBufferOffsetsInfoEXT { + VkStructureType sType; + const void* pNext; + VkShaderStageFlags stageFlags; + VkPipelineLayout layout; + uint32_t firstSet; + uint32_t setCount; + const uint32_t* pBufferIndices; + const VkDeviceSize* pOffsets; +} VkSetDescriptorBufferOffsetsInfoEXT; + +typedef struct VkBindDescriptorBufferEmbeddedSamplersInfoEXT { + VkStructureType sType; + const void* pNext; + VkShaderStageFlags stageFlags; + VkPipelineLayout layout; + uint32_t set; +} VkBindDescriptorBufferEmbeddedSamplersInfoEXT; + +typedef void (VKAPI_PTR *PFN_vkCmdBindDescriptorSets2KHR)(VkCommandBuffer commandBuffer, const VkBindDescriptorSetsInfoKHR* pBindDescriptorSetsInfo); +typedef void (VKAPI_PTR *PFN_vkCmdPushConstants2KHR)(VkCommandBuffer commandBuffer, const VkPushConstantsInfoKHR* pPushConstantsInfo); +typedef void (VKAPI_PTR *PFN_vkCmdPushDescriptorSet2KHR)(VkCommandBuffer commandBuffer, const VkPushDescriptorSetInfoKHR* pPushDescriptorSetInfo); +typedef void (VKAPI_PTR *PFN_vkCmdPushDescriptorSetWithTemplate2KHR)(VkCommandBuffer commandBuffer, const VkPushDescriptorSetWithTemplateInfoKHR* pPushDescriptorSetWithTemplateInfo); +typedef void (VKAPI_PTR *PFN_vkCmdSetDescriptorBufferOffsets2EXT)(VkCommandBuffer commandBuffer, const VkSetDescriptorBufferOffsetsInfoEXT* pSetDescriptorBufferOffsetsInfo); +typedef void (VKAPI_PTR *PFN_vkCmdBindDescriptorBufferEmbeddedSamplers2EXT)(VkCommandBuffer commandBuffer, const VkBindDescriptorBufferEmbeddedSamplersInfoEXT* pBindDescriptorBufferEmbeddedSamplersInfo); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR void VKAPI_CALL vkCmdBindDescriptorSets2KHR( + VkCommandBuffer commandBuffer, + const VkBindDescriptorSetsInfoKHR* pBindDescriptorSetsInfo); + +VKAPI_ATTR void VKAPI_CALL vkCmdPushConstants2KHR( + VkCommandBuffer commandBuffer, + const VkPushConstantsInfoKHR* pPushConstantsInfo); + +VKAPI_ATTR void VKAPI_CALL vkCmdPushDescriptorSet2KHR( + VkCommandBuffer commandBuffer, + const VkPushDescriptorSetInfoKHR* pPushDescriptorSetInfo); + +VKAPI_ATTR void VKAPI_CALL vkCmdPushDescriptorSetWithTemplate2KHR( + VkCommandBuffer commandBuffer, + const VkPushDescriptorSetWithTemplateInfoKHR* pPushDescriptorSetWithTemplateInfo); + +VKAPI_ATTR void VKAPI_CALL vkCmdSetDescriptorBufferOffsets2EXT( + VkCommandBuffer commandBuffer, + const VkSetDescriptorBufferOffsetsInfoEXT* pSetDescriptorBufferOffsetsInfo); + +VKAPI_ATTR void VKAPI_CALL vkCmdBindDescriptorBufferEmbeddedSamplers2EXT( + VkCommandBuffer commandBuffer, + const VkBindDescriptorBufferEmbeddedSamplersInfoEXT* pBindDescriptorBufferEmbeddedSamplersInfo); +#endif + + +// VK_EXT_debug_report is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_debug_report 1 VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDebugReportCallbackEXT) #define VK_EXT_DEBUG_REPORT_SPEC_VERSION 10 @@ -9736,6 +11487,8 @@ typedef enum VkDebugReportObjectTypeEXT { VK_DEBUG_REPORT_OBJECT_TYPE_CU_FUNCTION_NVX_EXT = 1000029001, VK_DEBUG_REPORT_OBJECT_TYPE_ACCELERATION_STRUCTURE_KHR_EXT = 1000150000, VK_DEBUG_REPORT_OBJECT_TYPE_ACCELERATION_STRUCTURE_NV_EXT = 1000165000, + VK_DEBUG_REPORT_OBJECT_TYPE_CUDA_MODULE_NV_EXT = 1000307000, + VK_DEBUG_REPORT_OBJECT_TYPE_CUDA_FUNCTION_NV_EXT = 1000307001, VK_DEBUG_REPORT_OBJECT_TYPE_BUFFER_COLLECTION_FUCHSIA_EXT = 1000366000, VK_DEBUG_REPORT_OBJECT_TYPE_DEBUG_REPORT_EXT = VK_DEBUG_REPORT_OBJECT_TYPE_DEBUG_REPORT_CALLBACK_EXT_EXT, VK_DEBUG_REPORT_OBJECT_TYPE_VALIDATION_CACHE_EXT = VK_DEBUG_REPORT_OBJECT_TYPE_VALIDATION_CACHE_EXT_EXT, @@ -9799,21 +11552,25 @@ VKAPI_ATTR void VKAPI_CALL vkDebugReportMessageEXT( #endif +// VK_NV_glsl_shader is a preprocessor guard. Do not pass it to API calls. #define VK_NV_glsl_shader 1 #define VK_NV_GLSL_SHADER_SPEC_VERSION 1 #define VK_NV_GLSL_SHADER_EXTENSION_NAME "VK_NV_glsl_shader" +// VK_EXT_depth_range_unrestricted is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_depth_range_unrestricted 1 #define VK_EXT_DEPTH_RANGE_UNRESTRICTED_SPEC_VERSION 1 #define VK_EXT_DEPTH_RANGE_UNRESTRICTED_EXTENSION_NAME "VK_EXT_depth_range_unrestricted" +// VK_IMG_filter_cubic is a preprocessor guard. Do not pass it to API calls. #define VK_IMG_filter_cubic 1 #define VK_IMG_FILTER_CUBIC_SPEC_VERSION 1 #define VK_IMG_FILTER_CUBIC_EXTENSION_NAME "VK_IMG_filter_cubic" +// VK_AMD_rasterization_order is a preprocessor guard. Do not pass it to API calls. #define VK_AMD_rasterization_order 1 #define VK_AMD_RASTERIZATION_ORDER_SPEC_VERSION 1 #define VK_AMD_RASTERIZATION_ORDER_EXTENSION_NAME "VK_AMD_rasterization_order" @@ -9831,16 +11588,19 @@ typedef struct VkPipelineRasterizationStateRasterizationOrderAMD { +// VK_AMD_shader_trinary_minmax is a preprocessor guard. Do not pass it to API calls. #define VK_AMD_shader_trinary_minmax 1 #define VK_AMD_SHADER_TRINARY_MINMAX_SPEC_VERSION 1 #define VK_AMD_SHADER_TRINARY_MINMAX_EXTENSION_NAME "VK_AMD_shader_trinary_minmax" +// VK_AMD_shader_explicit_vertex_parameter is a preprocessor guard. Do not pass it to API calls. #define VK_AMD_shader_explicit_vertex_parameter 1 #define VK_AMD_SHADER_EXPLICIT_VERTEX_PARAMETER_SPEC_VERSION 1 #define VK_AMD_SHADER_EXPLICIT_VERTEX_PARAMETER_EXTENSION_NAME "VK_AMD_shader_explicit_vertex_parameter" +// VK_EXT_debug_marker is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_debug_marker 1 #define VK_EXT_DEBUG_MARKER_SPEC_VERSION 4 #define VK_EXT_DEBUG_MARKER_EXTENSION_NAME "VK_EXT_debug_marker" @@ -9897,11 +11657,13 @@ VKAPI_ATTR void VKAPI_CALL vkCmdDebugMarkerInsertEXT( #endif +// VK_AMD_gcn_shader is a preprocessor guard. Do not pass it to API calls. #define VK_AMD_gcn_shader 1 #define VK_AMD_GCN_SHADER_SPEC_VERSION 1 #define VK_AMD_GCN_SHADER_EXTENSION_NAME "VK_AMD_gcn_shader" +// VK_NV_dedicated_allocation is a preprocessor guard. Do not pass it to API calls. #define VK_NV_dedicated_allocation 1 #define VK_NV_DEDICATED_ALLOCATION_SPEC_VERSION 1 #define VK_NV_DEDICATED_ALLOCATION_EXTENSION_NAME "VK_NV_dedicated_allocation" @@ -9926,6 +11688,7 @@ typedef struct VkDedicatedAllocationMemoryAllocateInfoNV { +// VK_EXT_transform_feedback is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_transform_feedback 1 #define VK_EXT_TRANSFORM_FEEDBACK_SPEC_VERSION 1 #define VK_EXT_TRANSFORM_FEEDBACK_EXTENSION_NAME "VK_EXT_transform_feedback" @@ -10013,6 +11776,7 @@ VKAPI_ATTR void VKAPI_CALL vkCmdDrawIndirectByteCountEXT( #endif +// VK_NVX_binary_import is a preprocessor guard. Do not pass it to API calls. #define VK_NVX_binary_import 1 VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkCuModuleNVX) VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkCuFunctionNVX) @@ -10084,6 +11848,7 @@ VKAPI_ATTR void VKAPI_CALL vkCmdCuLaunchKernelNVX( #endif +// VK_NVX_image_view_handle is a preprocessor guard. Do not pass it to API calls. #define VK_NVX_image_view_handle 1 #define VK_NVX_IMAGE_VIEW_HANDLE_SPEC_VERSION 2 #define VK_NVX_IMAGE_VIEW_HANDLE_EXTENSION_NAME "VK_NVX_image_view_handle" @@ -10117,6 +11882,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkGetImageViewAddressNVX( #endif +// VK_AMD_draw_indirect_count is a preprocessor guard. Do not pass it to API calls. #define VK_AMD_draw_indirect_count 1 #define VK_AMD_DRAW_INDIRECT_COUNT_SPEC_VERSION 2 #define VK_AMD_DRAW_INDIRECT_COUNT_EXTENSION_NAME "VK_AMD_draw_indirect_count" @@ -10144,21 +11910,25 @@ VKAPI_ATTR void VKAPI_CALL vkCmdDrawIndexedIndirectCountAMD( #endif +// VK_AMD_negative_viewport_height is a preprocessor guard. Do not pass it to API calls. #define VK_AMD_negative_viewport_height 1 #define VK_AMD_NEGATIVE_VIEWPORT_HEIGHT_SPEC_VERSION 1 #define VK_AMD_NEGATIVE_VIEWPORT_HEIGHT_EXTENSION_NAME "VK_AMD_negative_viewport_height" +// VK_AMD_gpu_shader_half_float is a preprocessor guard. Do not pass it to API calls. #define VK_AMD_gpu_shader_half_float 1 #define VK_AMD_GPU_SHADER_HALF_FLOAT_SPEC_VERSION 2 #define VK_AMD_GPU_SHADER_HALF_FLOAT_EXTENSION_NAME "VK_AMD_gpu_shader_half_float" +// VK_AMD_shader_ballot is a preprocessor guard. Do not pass it to API calls. #define VK_AMD_shader_ballot 1 #define VK_AMD_SHADER_BALLOT_SPEC_VERSION 1 #define VK_AMD_SHADER_BALLOT_EXTENSION_NAME "VK_AMD_shader_ballot" +// VK_AMD_texture_gather_bias_lod is a preprocessor guard. Do not pass it to API calls. #define VK_AMD_texture_gather_bias_lod 1 #define VK_AMD_TEXTURE_GATHER_BIAS_LOD_SPEC_VERSION 1 #define VK_AMD_TEXTURE_GATHER_BIAS_LOD_EXTENSION_NAME "VK_AMD_texture_gather_bias_lod" @@ -10170,6 +11940,7 @@ typedef struct VkTextureLODGatherFormatPropertiesAMD { +// VK_AMD_shader_info is a preprocessor guard. Do not pass it to API calls. #define VK_AMD_shader_info 1 #define VK_AMD_SHADER_INFO_SPEC_VERSION 1 #define VK_AMD_SHADER_INFO_EXTENSION_NAME "VK_AMD_shader_info" @@ -10211,11 +11982,13 @@ VKAPI_ATTR VkResult VKAPI_CALL vkGetShaderInfoAMD( #endif +// VK_AMD_shader_image_load_store_lod is a preprocessor guard. Do not pass it to API calls. #define VK_AMD_shader_image_load_store_lod 1 #define VK_AMD_SHADER_IMAGE_LOAD_STORE_LOD_SPEC_VERSION 1 #define VK_AMD_SHADER_IMAGE_LOAD_STORE_LOD_EXTENSION_NAME "VK_AMD_shader_image_load_store_lod" +// VK_NV_corner_sampled_image is a preprocessor guard. Do not pass it to API calls. #define VK_NV_corner_sampled_image 1 #define VK_NV_CORNER_SAMPLED_IMAGE_SPEC_VERSION 2 #define VK_NV_CORNER_SAMPLED_IMAGE_EXTENSION_NAME "VK_NV_corner_sampled_image" @@ -10227,11 +12000,13 @@ typedef struct VkPhysicalDeviceCornerSampledImageFeaturesNV { +// VK_IMG_format_pvrtc is a preprocessor guard. Do not pass it to API calls. #define VK_IMG_format_pvrtc 1 #define VK_IMG_FORMAT_PVRTC_SPEC_VERSION 1 #define VK_IMG_FORMAT_PVRTC_EXTENSION_NAME "VK_IMG_format_pvrtc" +// VK_NV_external_memory_capabilities is a preprocessor guard. Do not pass it to API calls. #define VK_NV_external_memory_capabilities 1 #define VK_NV_EXTERNAL_MEMORY_CAPABILITIES_SPEC_VERSION 1 #define VK_NV_EXTERNAL_MEMORY_CAPABILITIES_EXTENSION_NAME "VK_NV_external_memory_capabilities" @@ -10274,6 +12049,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceExternalImageFormatPropertiesN #endif +// VK_NV_external_memory is a preprocessor guard. Do not pass it to API calls. #define VK_NV_external_memory 1 #define VK_NV_EXTERNAL_MEMORY_SPEC_VERSION 1 #define VK_NV_EXTERNAL_MEMORY_EXTENSION_NAME "VK_NV_external_memory" @@ -10291,8 +12067,9 @@ typedef struct VkExportMemoryAllocateInfoNV { +// VK_EXT_validation_flags is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_validation_flags 1 -#define VK_EXT_VALIDATION_FLAGS_SPEC_VERSION 2 +#define VK_EXT_VALIDATION_FLAGS_SPEC_VERSION 3 #define VK_EXT_VALIDATION_FLAGS_EXTENSION_NAME "VK_EXT_validation_flags" typedef enum VkValidationCheckEXT { @@ -10309,16 +12086,19 @@ typedef struct VkValidationFlagsEXT { +// VK_EXT_shader_subgroup_ballot is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_shader_subgroup_ballot 1 #define VK_EXT_SHADER_SUBGROUP_BALLOT_SPEC_VERSION 1 #define VK_EXT_SHADER_SUBGROUP_BALLOT_EXTENSION_NAME "VK_EXT_shader_subgroup_ballot" +// VK_EXT_shader_subgroup_vote is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_shader_subgroup_vote 1 #define VK_EXT_SHADER_SUBGROUP_VOTE_SPEC_VERSION 1 #define VK_EXT_SHADER_SUBGROUP_VOTE_EXTENSION_NAME "VK_EXT_shader_subgroup_vote" +// VK_EXT_texture_compression_astc_hdr is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_texture_compression_astc_hdr 1 #define VK_EXT_TEXTURE_COMPRESSION_ASTC_HDR_SPEC_VERSION 1 #define VK_EXT_TEXTURE_COMPRESSION_ASTC_HDR_EXTENSION_NAME "VK_EXT_texture_compression_astc_hdr" @@ -10326,6 +12106,7 @@ typedef VkPhysicalDeviceTextureCompressionASTCHDRFeatures VkPhysicalDeviceTextur +// VK_EXT_astc_decode_mode is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_astc_decode_mode 1 #define VK_EXT_ASTC_DECODE_MODE_SPEC_VERSION 1 #define VK_EXT_ASTC_DECODE_MODE_EXTENSION_NAME "VK_EXT_astc_decode_mode" @@ -10343,6 +12124,7 @@ typedef struct VkPhysicalDeviceASTCDecodeFeaturesEXT { +// VK_EXT_pipeline_robustness is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_pipeline_robustness 1 #define VK_EXT_PIPELINE_ROBUSTNESS_SPEC_VERSION 1 #define VK_EXT_PIPELINE_ROBUSTNESS_EXTENSION_NAME "VK_EXT_pipeline_robustness" @@ -10388,6 +12170,7 @@ typedef struct VkPipelineRobustnessCreateInfoEXT { +// VK_EXT_conditional_rendering is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_conditional_rendering 1 #define VK_EXT_CONDITIONAL_RENDERING_SPEC_VERSION 2 #define VK_EXT_CONDITIONAL_RENDERING_EXTENSION_NAME "VK_EXT_conditional_rendering" @@ -10431,6 +12214,7 @@ VKAPI_ATTR void VKAPI_CALL vkCmdEndConditionalRenderingEXT( #endif +// VK_NV_clip_space_w_scaling is a preprocessor guard. Do not pass it to API calls. #define VK_NV_clip_space_w_scaling 1 #define VK_NV_CLIP_SPACE_W_SCALING_SPEC_VERSION 1 #define VK_NV_CLIP_SPACE_W_SCALING_EXTENSION_NAME "VK_NV_clip_space_w_scaling" @@ -10458,6 +12242,7 @@ VKAPI_ATTR void VKAPI_CALL vkCmdSetViewportWScalingNV( #endif +// VK_EXT_direct_mode_display is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_direct_mode_display 1 #define VK_EXT_DIRECT_MODE_DISPLAY_SPEC_VERSION 1 #define VK_EXT_DIRECT_MODE_DISPLAY_EXTENSION_NAME "VK_EXT_direct_mode_display" @@ -10470,6 +12255,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkReleaseDisplayEXT( #endif +// VK_EXT_display_surface_counter is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_display_surface_counter 1 #define VK_EXT_DISPLAY_SURFACE_COUNTER_SPEC_VERSION 1 #define VK_EXT_DISPLAY_SURFACE_COUNTER_EXTENSION_NAME "VK_EXT_display_surface_counter" @@ -10506,6 +12292,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfaceCapabilities2EXT( #endif +// VK_EXT_display_control is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_display_control 1 #define VK_EXT_DISPLAY_CONTROL_SPEC_VERSION 1 #define VK_EXT_DISPLAY_CONTROL_EXTENSION_NAME "VK_EXT_display_control" @@ -10582,6 +12369,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkGetSwapchainCounterEXT( #endif +// VK_GOOGLE_display_timing is a preprocessor guard. Do not pass it to API calls. #define VK_GOOGLE_display_timing 1 #define VK_GOOGLE_DISPLAY_TIMING_SPEC_VERSION 1 #define VK_GOOGLE_DISPLAY_TIMING_EXTENSION_NAME "VK_GOOGLE_display_timing" @@ -10626,16 +12414,19 @@ VKAPI_ATTR VkResult VKAPI_CALL vkGetPastPresentationTimingGOOGLE( #endif +// VK_NV_sample_mask_override_coverage is a preprocessor guard. Do not pass it to API calls. #define VK_NV_sample_mask_override_coverage 1 #define VK_NV_SAMPLE_MASK_OVERRIDE_COVERAGE_SPEC_VERSION 1 #define VK_NV_SAMPLE_MASK_OVERRIDE_COVERAGE_EXTENSION_NAME "VK_NV_sample_mask_override_coverage" +// VK_NV_geometry_shader_passthrough is a preprocessor guard. Do not pass it to API calls. #define VK_NV_geometry_shader_passthrough 1 #define VK_NV_GEOMETRY_SHADER_PASSTHROUGH_SPEC_VERSION 1 #define VK_NV_GEOMETRY_SHADER_PASSTHROUGH_EXTENSION_NAME "VK_NV_geometry_shader_passthrough" +// VK_NV_viewport_array2 is a preprocessor guard. Do not pass it to API calls. #define VK_NV_viewport_array2 1 #define VK_NV_VIEWPORT_ARRAY_2_SPEC_VERSION 1 #define VK_NV_VIEWPORT_ARRAY_2_EXTENSION_NAME "VK_NV_viewport_array2" @@ -10643,6 +12434,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkGetPastPresentationTimingGOOGLE( #define VK_NV_VIEWPORT_ARRAY2_EXTENSION_NAME VK_NV_VIEWPORT_ARRAY_2_EXTENSION_NAME +// VK_NVX_multiview_per_view_attributes is a preprocessor guard. Do not pass it to API calls. #define VK_NVX_multiview_per_view_attributes 1 #define VK_NVX_MULTIVIEW_PER_VIEW_ATTRIBUTES_SPEC_VERSION 1 #define VK_NVX_MULTIVIEW_PER_VIEW_ATTRIBUTES_EXTENSION_NAME "VK_NVX_multiview_per_view_attributes" @@ -10654,6 +12446,7 @@ typedef struct VkPhysicalDeviceMultiviewPerViewAttributesPropertiesNVX { +// VK_NV_viewport_swizzle is a preprocessor guard. Do not pass it to API calls. #define VK_NV_viewport_swizzle 1 #define VK_NV_VIEWPORT_SWIZZLE_SPEC_VERSION 1 #define VK_NV_VIEWPORT_SWIZZLE_EXTENSION_NAME "VK_NV_viewport_swizzle" @@ -10687,8 +12480,9 @@ typedef struct VkPipelineViewportSwizzleStateCreateInfoNV { +// VK_EXT_discard_rectangles is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_discard_rectangles 1 -#define VK_EXT_DISCARD_RECTANGLES_SPEC_VERSION 1 +#define VK_EXT_DISCARD_RECTANGLES_SPEC_VERSION 2 #define VK_EXT_DISCARD_RECTANGLES_EXTENSION_NAME "VK_EXT_discard_rectangles" typedef enum VkDiscardRectangleModeEXT { @@ -10713,6 +12507,8 @@ typedef struct VkPipelineDiscardRectangleStateCreateInfoEXT { } VkPipelineDiscardRectangleStateCreateInfoEXT; typedef void (VKAPI_PTR *PFN_vkCmdSetDiscardRectangleEXT)(VkCommandBuffer commandBuffer, uint32_t firstDiscardRectangle, uint32_t discardRectangleCount, const VkRect2D* pDiscardRectangles); +typedef void (VKAPI_PTR *PFN_vkCmdSetDiscardRectangleEnableEXT)(VkCommandBuffer commandBuffer, VkBool32 discardRectangleEnable); +typedef void (VKAPI_PTR *PFN_vkCmdSetDiscardRectangleModeEXT)(VkCommandBuffer commandBuffer, VkDiscardRectangleModeEXT discardRectangleMode); #ifndef VK_NO_PROTOTYPES VKAPI_ATTR void VKAPI_CALL vkCmdSetDiscardRectangleEXT( @@ -10720,9 +12516,18 @@ VKAPI_ATTR void VKAPI_CALL vkCmdSetDiscardRectangleEXT( uint32_t firstDiscardRectangle, uint32_t discardRectangleCount, const VkRect2D* pDiscardRectangles); + +VKAPI_ATTR void VKAPI_CALL vkCmdSetDiscardRectangleEnableEXT( + VkCommandBuffer commandBuffer, + VkBool32 discardRectangleEnable); + +VKAPI_ATTR void VKAPI_CALL vkCmdSetDiscardRectangleModeEXT( + VkCommandBuffer commandBuffer, + VkDiscardRectangleModeEXT discardRectangleMode); #endif +// VK_EXT_conservative_rasterization is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_conservative_rasterization 1 #define VK_EXT_CONSERVATIVE_RASTERIZATION_SPEC_VERSION 1 #define VK_EXT_CONSERVATIVE_RASTERIZATION_EXTENSION_NAME "VK_EXT_conservative_rasterization" @@ -10758,6 +12563,7 @@ typedef struct VkPipelineRasterizationConservativeStateCreateInfoEXT { +// VK_EXT_depth_clip_enable is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_depth_clip_enable 1 #define VK_EXT_DEPTH_CLIP_ENABLE_SPEC_VERSION 1 #define VK_EXT_DEPTH_CLIP_ENABLE_EXTENSION_NAME "VK_EXT_depth_clip_enable" @@ -10777,11 +12583,13 @@ typedef struct VkPipelineRasterizationDepthClipStateCreateInfoEXT { +// VK_EXT_swapchain_colorspace is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_swapchain_colorspace 1 #define VK_EXT_SWAPCHAIN_COLOR_SPACE_SPEC_VERSION 4 #define VK_EXT_SWAPCHAIN_COLOR_SPACE_EXTENSION_NAME "VK_EXT_swapchain_colorspace" +// VK_EXT_hdr_metadata is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_hdr_metadata 1 #define VK_EXT_HDR_METADATA_SPEC_VERSION 2 #define VK_EXT_HDR_METADATA_EXTENSION_NAME "VK_EXT_hdr_metadata" @@ -10814,17 +12622,32 @@ VKAPI_ATTR void VKAPI_CALL vkSetHdrMetadataEXT( #endif +// VK_IMG_relaxed_line_rasterization is a preprocessor guard. Do not pass it to API calls. +#define VK_IMG_relaxed_line_rasterization 1 +#define VK_IMG_RELAXED_LINE_RASTERIZATION_SPEC_VERSION 1 +#define VK_IMG_RELAXED_LINE_RASTERIZATION_EXTENSION_NAME "VK_IMG_relaxed_line_rasterization" +typedef struct VkPhysicalDeviceRelaxedLineRasterizationFeaturesIMG { + VkStructureType sType; + void* pNext; + VkBool32 relaxedLineRasterization; +} VkPhysicalDeviceRelaxedLineRasterizationFeaturesIMG; + + + +// VK_EXT_external_memory_dma_buf is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_external_memory_dma_buf 1 #define VK_EXT_EXTERNAL_MEMORY_DMA_BUF_SPEC_VERSION 1 #define VK_EXT_EXTERNAL_MEMORY_DMA_BUF_EXTENSION_NAME "VK_EXT_external_memory_dma_buf" +// VK_EXT_queue_family_foreign is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_queue_family_foreign 1 #define VK_EXT_QUEUE_FAMILY_FOREIGN_SPEC_VERSION 1 #define VK_EXT_QUEUE_FAMILY_FOREIGN_EXTENSION_NAME "VK_EXT_queue_family_foreign" #define VK_QUEUE_FAMILY_FOREIGN_EXT (~2U) +// VK_EXT_debug_utils is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_debug_utils 1 VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDebugUtilsMessengerEXT) #define VK_EXT_DEBUG_UTILS_SPEC_VERSION 2 @@ -10843,6 +12666,7 @@ typedef enum VkDebugUtilsMessageTypeFlagBitsEXT { VK_DEBUG_UTILS_MESSAGE_TYPE_GENERAL_BIT_EXT = 0x00000001, VK_DEBUG_UTILS_MESSAGE_TYPE_VALIDATION_BIT_EXT = 0x00000002, VK_DEBUG_UTILS_MESSAGE_TYPE_PERFORMANCE_BIT_EXT = 0x00000004, + VK_DEBUG_UTILS_MESSAGE_TYPE_DEVICE_ADDRESS_BINDING_BIT_EXT = 0x00000008, VK_DEBUG_UTILS_MESSAGE_TYPE_FLAG_BITS_MAX_ENUM_EXT = 0x7FFFFFFF } VkDebugUtilsMessageTypeFlagBitsEXT; typedef VkFlags VkDebugUtilsMessageTypeFlagsEXT; @@ -10966,6 +12790,7 @@ VKAPI_ATTR void VKAPI_CALL vkSubmitDebugUtilsMessageEXT( #endif +// VK_EXT_sampler_filter_minmax is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_sampler_filter_minmax 1 #define VK_EXT_SAMPLER_FILTER_MINMAX_SPEC_VERSION 2 #define VK_EXT_SAMPLER_FILTER_MINMAX_EXTENSION_NAME "VK_EXT_sampler_filter_minmax" @@ -10977,21 +12802,25 @@ typedef VkPhysicalDeviceSamplerFilterMinmaxProperties VkPhysicalDeviceSamplerFil +// VK_AMD_gpu_shader_int16 is a preprocessor guard. Do not pass it to API calls. #define VK_AMD_gpu_shader_int16 1 #define VK_AMD_GPU_SHADER_INT16_SPEC_VERSION 2 #define VK_AMD_GPU_SHADER_INT16_EXTENSION_NAME "VK_AMD_gpu_shader_int16" +// VK_AMD_mixed_attachment_samples is a preprocessor guard. Do not pass it to API calls. #define VK_AMD_mixed_attachment_samples 1 #define VK_AMD_MIXED_ATTACHMENT_SAMPLES_SPEC_VERSION 1 #define VK_AMD_MIXED_ATTACHMENT_SAMPLES_EXTENSION_NAME "VK_AMD_mixed_attachment_samples" +// VK_AMD_shader_fragment_mask is a preprocessor guard. Do not pass it to API calls. #define VK_AMD_shader_fragment_mask 1 #define VK_AMD_SHADER_FRAGMENT_MASK_SPEC_VERSION 1 #define VK_AMD_SHADER_FRAGMENT_MASK_EXTENSION_NAME "VK_AMD_shader_fragment_mask" +// VK_EXT_inline_uniform_block is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_inline_uniform_block 1 #define VK_EXT_INLINE_UNIFORM_BLOCK_SPEC_VERSION 1 #define VK_EXT_INLINE_UNIFORM_BLOCK_EXTENSION_NAME "VK_EXT_inline_uniform_block" @@ -11005,11 +12834,13 @@ typedef VkDescriptorPoolInlineUniformBlockCreateInfo VkDescriptorPoolInlineUnifo +// VK_EXT_shader_stencil_export is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_shader_stencil_export 1 #define VK_EXT_SHADER_STENCIL_EXPORT_SPEC_VERSION 1 #define VK_EXT_SHADER_STENCIL_EXPORT_EXTENSION_NAME "VK_EXT_shader_stencil_export" +// VK_EXT_sample_locations is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_sample_locations 1 #define VK_EXT_SAMPLE_LOCATIONS_SPEC_VERSION 1 #define VK_EXT_SAMPLE_LOCATIONS_EXTENSION_NAME "VK_EXT_sample_locations" @@ -11084,6 +12915,7 @@ VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceMultisamplePropertiesEXT( #endif +// VK_EXT_blend_operation_advanced is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_blend_operation_advanced 1 #define VK_EXT_BLEND_OPERATION_ADVANCED_SPEC_VERSION 2 #define VK_EXT_BLEND_OPERATION_ADVANCED_EXTENSION_NAME "VK_EXT_blend_operation_advanced" @@ -11121,6 +12953,7 @@ typedef struct VkPipelineColorBlendAdvancedStateCreateInfoEXT { +// VK_NV_fragment_coverage_to_color is a preprocessor guard. Do not pass it to API calls. #define VK_NV_fragment_coverage_to_color 1 #define VK_NV_FRAGMENT_COVERAGE_TO_COLOR_SPEC_VERSION 1 #define VK_NV_FRAGMENT_COVERAGE_TO_COLOR_EXTENSION_NAME "VK_NV_fragment_coverage_to_color" @@ -11135,6 +12968,7 @@ typedef struct VkPipelineCoverageToColorStateCreateInfoNV { +// VK_NV_framebuffer_mixed_samples is a preprocessor guard. Do not pass it to API calls. #define VK_NV_framebuffer_mixed_samples 1 #define VK_NV_FRAMEBUFFER_MIXED_SAMPLES_SPEC_VERSION 1 #define VK_NV_FRAMEBUFFER_MIXED_SAMPLES_EXTENSION_NAME "VK_NV_framebuffer_mixed_samples" @@ -11159,11 +12993,13 @@ typedef struct VkPipelineCoverageModulationStateCreateInfoNV { +// VK_NV_fill_rectangle is a preprocessor guard. Do not pass it to API calls. #define VK_NV_fill_rectangle 1 #define VK_NV_FILL_RECTANGLE_SPEC_VERSION 1 #define VK_NV_FILL_RECTANGLE_EXTENSION_NAME "VK_NV_fill_rectangle" +// VK_NV_shader_sm_builtins is a preprocessor guard. Do not pass it to API calls. #define VK_NV_shader_sm_builtins 1 #define VK_NV_SHADER_SM_BUILTINS_SPEC_VERSION 1 #define VK_NV_SHADER_SM_BUILTINS_EXTENSION_NAME "VK_NV_shader_sm_builtins" @@ -11182,11 +13018,13 @@ typedef struct VkPhysicalDeviceShaderSMBuiltinsFeaturesNV { +// VK_EXT_post_depth_coverage is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_post_depth_coverage 1 #define VK_EXT_POST_DEPTH_COVERAGE_SPEC_VERSION 1 #define VK_EXT_POST_DEPTH_COVERAGE_EXTENSION_NAME "VK_EXT_post_depth_coverage" +// VK_EXT_image_drm_format_modifier is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_image_drm_format_modifier 1 #define VK_EXT_IMAGE_DRM_FORMAT_MODIFIER_SPEC_VERSION 2 #define VK_EXT_IMAGE_DRM_FORMAT_MODIFIER_EXTENSION_NAME "VK_EXT_image_drm_format_modifier" @@ -11256,6 +13094,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkGetImageDrmFormatModifierPropertiesEXT( #endif +// VK_EXT_validation_cache is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_validation_cache 1 VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkValidationCacheEXT) #define VK_EXT_VALIDATION_CACHE_SPEC_VERSION 1 @@ -11311,6 +13150,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkGetValidationCacheDataEXT( #endif +// VK_EXT_descriptor_indexing is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_descriptor_indexing 1 #define VK_EXT_DESCRIPTOR_INDEXING_SPEC_VERSION 2 #define VK_EXT_DESCRIPTOR_INDEXING_EXTENSION_NAME "VK_EXT_descriptor_indexing" @@ -11330,11 +13170,13 @@ typedef VkDescriptorSetVariableDescriptorCountLayoutSupport VkDescriptorSetVaria +// VK_EXT_shader_viewport_index_layer is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_shader_viewport_index_layer 1 #define VK_EXT_SHADER_VIEWPORT_INDEX_LAYER_SPEC_VERSION 1 #define VK_EXT_SHADER_VIEWPORT_INDEX_LAYER_EXTENSION_NAME "VK_EXT_shader_viewport_index_layer" +// VK_NV_shading_rate_image is a preprocessor guard. Do not pass it to API calls. #define VK_NV_shading_rate_image 1 #define VK_NV_SHADING_RATE_IMAGE_SPEC_VERSION 3 #define VK_NV_SHADING_RATE_IMAGE_EXTENSION_NAME "VK_NV_shading_rate_image" @@ -11435,6 +13277,7 @@ VKAPI_ATTR void VKAPI_CALL vkCmdSetCoarseSampleOrderNV( #endif +// VK_NV_ray_tracing is a preprocessor guard. Do not pass it to API calls. #define VK_NV_ray_tracing 1 VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkAccelerationStructureNV) #define VK_NV_RAY_TRACING_SPEC_VERSION 3 @@ -11513,6 +13356,8 @@ typedef enum VkGeometryInstanceFlagBitsKHR { VK_GEOMETRY_INSTANCE_TRIANGLE_FLIP_FACING_BIT_KHR = 0x00000002, VK_GEOMETRY_INSTANCE_FORCE_OPAQUE_BIT_KHR = 0x00000004, VK_GEOMETRY_INSTANCE_FORCE_NO_OPAQUE_BIT_KHR = 0x00000008, + VK_GEOMETRY_INSTANCE_FORCE_OPACITY_MICROMAP_2_STATE_EXT = 0x00000010, + VK_GEOMETRY_INSTANCE_DISABLE_OPACITY_MICROMAPS_EXT = 0x00000020, VK_GEOMETRY_INSTANCE_TRIANGLE_FRONT_COUNTERCLOCKWISE_BIT_KHR = VK_GEOMETRY_INSTANCE_TRIANGLE_FLIP_FACING_BIT_KHR, VK_GEOMETRY_INSTANCE_TRIANGLE_CULL_DISABLE_BIT_NV = VK_GEOMETRY_INSTANCE_TRIANGLE_FACING_CULL_DISABLE_BIT_KHR, VK_GEOMETRY_INSTANCE_TRIANGLE_FRONT_COUNTERCLOCKWISE_BIT_NV = VK_GEOMETRY_INSTANCE_TRIANGLE_FRONT_COUNTERCLOCKWISE_BIT_KHR, @@ -11533,6 +13378,13 @@ typedef enum VkBuildAccelerationStructureFlagBitsKHR { VK_BUILD_ACCELERATION_STRUCTURE_PREFER_FAST_BUILD_BIT_KHR = 0x00000008, VK_BUILD_ACCELERATION_STRUCTURE_LOW_MEMORY_BIT_KHR = 0x00000010, VK_BUILD_ACCELERATION_STRUCTURE_MOTION_BIT_NV = 0x00000020, + VK_BUILD_ACCELERATION_STRUCTURE_ALLOW_OPACITY_MICROMAP_UPDATE_EXT = 0x00000040, + VK_BUILD_ACCELERATION_STRUCTURE_ALLOW_DISABLE_OPACITY_MICROMAPS_EXT = 0x00000080, + VK_BUILD_ACCELERATION_STRUCTURE_ALLOW_OPACITY_MICROMAP_DATA_UPDATE_EXT = 0x00000100, +#ifdef VK_ENABLE_BETA_EXTENSIONS + VK_BUILD_ACCELERATION_STRUCTURE_ALLOW_DISPLACEMENT_MICROMAP_UPDATE_NV = 0x00000200, +#endif + VK_BUILD_ACCELERATION_STRUCTURE_ALLOW_DATA_ACCESS_KHR = 0x00000800, VK_BUILD_ACCELERATION_STRUCTURE_ALLOW_UPDATE_BIT_NV = VK_BUILD_ACCELERATION_STRUCTURE_ALLOW_UPDATE_BIT_KHR, VK_BUILD_ACCELERATION_STRUCTURE_ALLOW_COMPACTION_BIT_NV = VK_BUILD_ACCELERATION_STRUCTURE_ALLOW_COMPACTION_BIT_KHR, VK_BUILD_ACCELERATION_STRUCTURE_PREFER_FAST_TRACE_BIT_NV = VK_BUILD_ACCELERATION_STRUCTURE_PREFER_FAST_TRACE_BIT_KHR, @@ -11804,6 +13656,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkCompileDeferredNV( #endif +// VK_NV_representative_fragment_test is a preprocessor guard. Do not pass it to API calls. #define VK_NV_representative_fragment_test 1 #define VK_NV_REPRESENTATIVE_FRAGMENT_TEST_SPEC_VERSION 2 #define VK_NV_REPRESENTATIVE_FRAGMENT_TEST_EXTENSION_NAME "VK_NV_representative_fragment_test" @@ -11821,6 +13674,7 @@ typedef struct VkPipelineRepresentativeFragmentTestStateCreateInfoNV { +// VK_EXT_filter_cubic is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_filter_cubic 1 #define VK_EXT_FILTER_CUBIC_SPEC_VERSION 3 #define VK_EXT_FILTER_CUBIC_EXTENSION_NAME "VK_EXT_filter_cubic" @@ -11839,11 +13693,13 @@ typedef struct VkFilterCubicImageViewImageFormatPropertiesEXT { +// VK_QCOM_render_pass_shader_resolve is a preprocessor guard. Do not pass it to API calls. #define VK_QCOM_render_pass_shader_resolve 1 #define VK_QCOM_RENDER_PASS_SHADER_RESOLVE_SPEC_VERSION 4 #define VK_QCOM_RENDER_PASS_SHADER_RESOLVE_EXTENSION_NAME "VK_QCOM_render_pass_shader_resolve" +// VK_EXT_global_priority is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_global_priority 1 #define VK_EXT_GLOBAL_PRIORITY_SPEC_VERSION 2 #define VK_EXT_GLOBAL_PRIORITY_EXTENSION_NAME "VK_EXT_global_priority" @@ -11853,6 +13709,7 @@ typedef VkDeviceQueueGlobalPriorityCreateInfoKHR VkDeviceQueueGlobalPriorityCrea +// VK_EXT_external_memory_host is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_external_memory_host 1 #define VK_EXT_EXTERNAL_MEMORY_HOST_SPEC_VERSION 1 #define VK_EXT_EXTERNAL_MEMORY_HOST_EXTENSION_NAME "VK_EXT_external_memory_host" @@ -11886,6 +13743,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryHostPointerPropertiesEXT( #endif +// VK_AMD_buffer_marker is a preprocessor guard. Do not pass it to API calls. #define VK_AMD_buffer_marker 1 #define VK_AMD_BUFFER_MARKER_SPEC_VERSION 1 #define VK_AMD_BUFFER_MARKER_EXTENSION_NAME "VK_AMD_buffer_marker" @@ -11901,6 +13759,7 @@ VKAPI_ATTR void VKAPI_CALL vkCmdWriteBufferMarkerAMD( #endif +// VK_AMD_pipeline_compiler_control is a preprocessor guard. Do not pass it to API calls. #define VK_AMD_pipeline_compiler_control 1 #define VK_AMD_PIPELINE_COMPILER_CONTROL_SPEC_VERSION 1 #define VK_AMD_PIPELINE_COMPILER_CONTROL_EXTENSION_NAME "VK_AMD_pipeline_compiler_control" @@ -11917,41 +13776,33 @@ typedef struct VkPipelineCompilerControlCreateInfoAMD { +// VK_EXT_calibrated_timestamps is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_calibrated_timestamps 1 #define VK_EXT_CALIBRATED_TIMESTAMPS_SPEC_VERSION 2 #define VK_EXT_CALIBRATED_TIMESTAMPS_EXTENSION_NAME "VK_EXT_calibrated_timestamps" +typedef VkTimeDomainKHR VkTimeDomainEXT; -typedef enum VkTimeDomainEXT { - VK_TIME_DOMAIN_DEVICE_EXT = 0, - VK_TIME_DOMAIN_CLOCK_MONOTONIC_EXT = 1, - VK_TIME_DOMAIN_CLOCK_MONOTONIC_RAW_EXT = 2, - VK_TIME_DOMAIN_QUERY_PERFORMANCE_COUNTER_EXT = 3, - VK_TIME_DOMAIN_MAX_ENUM_EXT = 0x7FFFFFFF -} VkTimeDomainEXT; -typedef struct VkCalibratedTimestampInfoEXT { - VkStructureType sType; - const void* pNext; - VkTimeDomainEXT timeDomain; -} VkCalibratedTimestampInfoEXT; +typedef VkCalibratedTimestampInfoKHR VkCalibratedTimestampInfoEXT; -typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceCalibrateableTimeDomainsEXT)(VkPhysicalDevice physicalDevice, uint32_t* pTimeDomainCount, VkTimeDomainEXT* pTimeDomains); -typedef VkResult (VKAPI_PTR *PFN_vkGetCalibratedTimestampsEXT)(VkDevice device, uint32_t timestampCount, const VkCalibratedTimestampInfoEXT* pTimestampInfos, uint64_t* pTimestamps, uint64_t* pMaxDeviation); +typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceCalibrateableTimeDomainsEXT)(VkPhysicalDevice physicalDevice, uint32_t* pTimeDomainCount, VkTimeDomainKHR* pTimeDomains); +typedef VkResult (VKAPI_PTR *PFN_vkGetCalibratedTimestampsEXT)(VkDevice device, uint32_t timestampCount, const VkCalibratedTimestampInfoKHR* pTimestampInfos, uint64_t* pTimestamps, uint64_t* pMaxDeviation); #ifndef VK_NO_PROTOTYPES VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceCalibrateableTimeDomainsEXT( VkPhysicalDevice physicalDevice, uint32_t* pTimeDomainCount, - VkTimeDomainEXT* pTimeDomains); + VkTimeDomainKHR* pTimeDomains); VKAPI_ATTR VkResult VKAPI_CALL vkGetCalibratedTimestampsEXT( VkDevice device, uint32_t timestampCount, - const VkCalibratedTimestampInfoEXT* pTimestampInfos, + const VkCalibratedTimestampInfoKHR* pTimestampInfos, uint64_t* pTimestamps, uint64_t* pMaxDeviation); #endif +// VK_AMD_shader_core_properties is a preprocessor guard. Do not pass it to API calls. #define VK_AMD_shader_core_properties 1 #define VK_AMD_SHADER_CORE_PROPERTIES_SPEC_VERSION 2 #define VK_AMD_SHADER_CORE_PROPERTIES_EXTENSION_NAME "VK_AMD_shader_core_properties" @@ -11976,6 +13827,7 @@ typedef struct VkPhysicalDeviceShaderCorePropertiesAMD { +// VK_AMD_memory_overallocation_behavior is a preprocessor guard. Do not pass it to API calls. #define VK_AMD_memory_overallocation_behavior 1 #define VK_AMD_MEMORY_OVERALLOCATION_BEHAVIOR_SPEC_VERSION 1 #define VK_AMD_MEMORY_OVERALLOCATION_BEHAVIOR_EXTENSION_NAME "VK_AMD_memory_overallocation_behavior" @@ -11994,6 +13846,7 @@ typedef struct VkDeviceMemoryOverallocationCreateInfoAMD { +// VK_EXT_vertex_attribute_divisor is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_vertex_attribute_divisor 1 #define VK_EXT_VERTEX_ATTRIBUTE_DIVISOR_SPEC_VERSION 3 #define VK_EXT_VERTEX_ATTRIBUTE_DIVISOR_EXTENSION_NAME "VK_EXT_vertex_attribute_divisor" @@ -12003,27 +13856,15 @@ typedef struct VkPhysicalDeviceVertexAttributeDivisorPropertiesEXT { uint32_t maxVertexAttribDivisor; } VkPhysicalDeviceVertexAttributeDivisorPropertiesEXT; -typedef struct VkVertexInputBindingDivisorDescriptionEXT { - uint32_t binding; - uint32_t divisor; -} VkVertexInputBindingDivisorDescriptionEXT; +typedef VkVertexInputBindingDivisorDescriptionKHR VkVertexInputBindingDivisorDescriptionEXT; -typedef struct VkPipelineVertexInputDivisorStateCreateInfoEXT { - VkStructureType sType; - const void* pNext; - uint32_t vertexBindingDivisorCount; - const VkVertexInputBindingDivisorDescriptionEXT* pVertexBindingDivisors; -} VkPipelineVertexInputDivisorStateCreateInfoEXT; +typedef VkPipelineVertexInputDivisorStateCreateInfoKHR VkPipelineVertexInputDivisorStateCreateInfoEXT; -typedef struct VkPhysicalDeviceVertexAttributeDivisorFeaturesEXT { - VkStructureType sType; - void* pNext; - VkBool32 vertexAttributeInstanceRateDivisor; - VkBool32 vertexAttributeInstanceRateZeroDivisor; -} VkPhysicalDeviceVertexAttributeDivisorFeaturesEXT; +typedef VkPhysicalDeviceVertexAttributeDivisorFeaturesKHR VkPhysicalDeviceVertexAttributeDivisorFeaturesEXT; +// VK_EXT_pipeline_creation_feedback is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_pipeline_creation_feedback 1 #define VK_EXT_PIPELINE_CREATION_FEEDBACK_SPEC_VERSION 1 #define VK_EXT_PIPELINE_CREATION_FEEDBACK_EXTENSION_NAME "VK_EXT_pipeline_creation_feedback" @@ -12037,11 +13878,13 @@ typedef VkPipelineCreationFeedback VkPipelineCreationFeedbackEXT; +// VK_NV_shader_subgroup_partitioned is a preprocessor guard. Do not pass it to API calls. #define VK_NV_shader_subgroup_partitioned 1 #define VK_NV_SHADER_SUBGROUP_PARTITIONED_SPEC_VERSION 1 #define VK_NV_SHADER_SUBGROUP_PARTITIONED_EXTENSION_NAME "VK_NV_shader_subgroup_partitioned" +// VK_NV_compute_shader_derivatives is a preprocessor guard. Do not pass it to API calls. #define VK_NV_compute_shader_derivatives 1 #define VK_NV_COMPUTE_SHADER_DERIVATIVES_SPEC_VERSION 1 #define VK_NV_COMPUTE_SHADER_DERIVATIVES_EXTENSION_NAME "VK_NV_compute_shader_derivatives" @@ -12054,6 +13897,7 @@ typedef struct VkPhysicalDeviceComputeShaderDerivativesFeaturesNV { +// VK_NV_mesh_shader is a preprocessor guard. Do not pass it to API calls. #define VK_NV_mesh_shader 1 #define VK_NV_MESH_SHADER_SPEC_VERSION 1 #define VK_NV_MESH_SHADER_EXTENSION_NAME "VK_NV_mesh_shader" @@ -12115,6 +13959,7 @@ VKAPI_ATTR void VKAPI_CALL vkCmdDrawMeshTasksIndirectCountNV( #endif +// VK_NV_fragment_shader_barycentric is a preprocessor guard. Do not pass it to API calls. #define VK_NV_fragment_shader_barycentric 1 #define VK_NV_FRAGMENT_SHADER_BARYCENTRIC_SPEC_VERSION 1 #define VK_NV_FRAGMENT_SHADER_BARYCENTRIC_EXTENSION_NAME "VK_NV_fragment_shader_barycentric" @@ -12122,6 +13967,7 @@ typedef VkPhysicalDeviceFragmentShaderBarycentricFeaturesKHR VkPhysicalDeviceFra +// VK_NV_shader_image_footprint is a preprocessor guard. Do not pass it to API calls. #define VK_NV_shader_image_footprint 1 #define VK_NV_SHADER_IMAGE_FOOTPRINT_SPEC_VERSION 2 #define VK_NV_SHADER_IMAGE_FOOTPRINT_EXTENSION_NAME "VK_NV_shader_image_footprint" @@ -12133,8 +13979,9 @@ typedef struct VkPhysicalDeviceShaderImageFootprintFeaturesNV { +// VK_NV_scissor_exclusive is a preprocessor guard. Do not pass it to API calls. #define VK_NV_scissor_exclusive 1 -#define VK_NV_SCISSOR_EXCLUSIVE_SPEC_VERSION 1 +#define VK_NV_SCISSOR_EXCLUSIVE_SPEC_VERSION 2 #define VK_NV_SCISSOR_EXCLUSIVE_EXTENSION_NAME "VK_NV_scissor_exclusive" typedef struct VkPipelineViewportExclusiveScissorStateCreateInfoNV { VkStructureType sType; @@ -12149,9 +13996,16 @@ typedef struct VkPhysicalDeviceExclusiveScissorFeaturesNV { VkBool32 exclusiveScissor; } VkPhysicalDeviceExclusiveScissorFeaturesNV; +typedef void (VKAPI_PTR *PFN_vkCmdSetExclusiveScissorEnableNV)(VkCommandBuffer commandBuffer, uint32_t firstExclusiveScissor, uint32_t exclusiveScissorCount, const VkBool32* pExclusiveScissorEnables); typedef void (VKAPI_PTR *PFN_vkCmdSetExclusiveScissorNV)(VkCommandBuffer commandBuffer, uint32_t firstExclusiveScissor, uint32_t exclusiveScissorCount, const VkRect2D* pExclusiveScissors); #ifndef VK_NO_PROTOTYPES +VKAPI_ATTR void VKAPI_CALL vkCmdSetExclusiveScissorEnableNV( + VkCommandBuffer commandBuffer, + uint32_t firstExclusiveScissor, + uint32_t exclusiveScissorCount, + const VkBool32* pExclusiveScissorEnables); + VKAPI_ATTR void VKAPI_CALL vkCmdSetExclusiveScissorNV( VkCommandBuffer commandBuffer, uint32_t firstExclusiveScissor, @@ -12160,6 +14014,7 @@ VKAPI_ATTR void VKAPI_CALL vkCmdSetExclusiveScissorNV( #endif +// VK_NV_device_diagnostic_checkpoints is a preprocessor guard. Do not pass it to API calls. #define VK_NV_device_diagnostic_checkpoints 1 #define VK_NV_DEVICE_DIAGNOSTIC_CHECKPOINTS_SPEC_VERSION 2 #define VK_NV_DEVICE_DIAGNOSTIC_CHECKPOINTS_EXTENSION_NAME "VK_NV_device_diagnostic_checkpoints" @@ -12191,6 +14046,7 @@ VKAPI_ATTR void VKAPI_CALL vkGetQueueCheckpointDataNV( #endif +// VK_INTEL_shader_integer_functions2 is a preprocessor guard. Do not pass it to API calls. #define VK_INTEL_shader_integer_functions2 1 #define VK_INTEL_SHADER_INTEGER_FUNCTIONS_2_SPEC_VERSION 1 #define VK_INTEL_SHADER_INTEGER_FUNCTIONS_2_EXTENSION_NAME "VK_INTEL_shader_integer_functions2" @@ -12202,6 +14058,7 @@ typedef struct VkPhysicalDeviceShaderIntegerFunctions2FeaturesINTEL { +// VK_INTEL_performance_query is a preprocessor guard. Do not pass it to API calls. #define VK_INTEL_performance_query 1 VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkPerformanceConfigurationINTEL) #define VK_INTEL_PERFORMANCE_QUERY_SPEC_VERSION 2 @@ -12340,6 +14197,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkGetPerformanceParameterINTEL( #endif +// VK_EXT_pci_bus_info is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_pci_bus_info 1 #define VK_EXT_PCI_BUS_INFO_SPEC_VERSION 2 #define VK_EXT_PCI_BUS_INFO_EXTENSION_NAME "VK_EXT_pci_bus_info" @@ -12354,6 +14212,7 @@ typedef struct VkPhysicalDevicePCIBusInfoPropertiesEXT { +// VK_AMD_display_native_hdr is a preprocessor guard. Do not pass it to API calls. #define VK_AMD_display_native_hdr 1 #define VK_AMD_DISPLAY_NATIVE_HDR_SPEC_VERSION 1 #define VK_AMD_DISPLAY_NATIVE_HDR_EXTENSION_NAME "VK_AMD_display_native_hdr" @@ -12379,6 +14238,7 @@ VKAPI_ATTR void VKAPI_CALL vkSetLocalDimmingAMD( #endif +// VK_EXT_fragment_density_map is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_fragment_density_map 1 #define VK_EXT_FRAGMENT_DENSITY_MAP_SPEC_VERSION 2 #define VK_EXT_FRAGMENT_DENSITY_MAP_EXTENSION_NAME "VK_EXT_fragment_density_map" @@ -12406,6 +14266,7 @@ typedef struct VkRenderPassFragmentDensityMapCreateInfoEXT { +// VK_EXT_scalar_block_layout is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_scalar_block_layout 1 #define VK_EXT_SCALAR_BLOCK_LAYOUT_SPEC_VERSION 1 #define VK_EXT_SCALAR_BLOCK_LAYOUT_EXTENSION_NAME "VK_EXT_scalar_block_layout" @@ -12413,6 +14274,7 @@ typedef VkPhysicalDeviceScalarBlockLayoutFeatures VkPhysicalDeviceScalarBlockLay +// VK_GOOGLE_hlsl_functionality1 is a preprocessor guard. Do not pass it to API calls. #define VK_GOOGLE_hlsl_functionality1 1 #define VK_GOOGLE_HLSL_FUNCTIONALITY_1_SPEC_VERSION 1 #define VK_GOOGLE_HLSL_FUNCTIONALITY_1_EXTENSION_NAME "VK_GOOGLE_hlsl_functionality1" @@ -12420,11 +14282,13 @@ typedef VkPhysicalDeviceScalarBlockLayoutFeatures VkPhysicalDeviceScalarBlockLay #define VK_GOOGLE_HLSL_FUNCTIONALITY1_EXTENSION_NAME VK_GOOGLE_HLSL_FUNCTIONALITY_1_EXTENSION_NAME +// VK_GOOGLE_decorate_string is a preprocessor guard. Do not pass it to API calls. #define VK_GOOGLE_decorate_string 1 #define VK_GOOGLE_DECORATE_STRING_SPEC_VERSION 1 #define VK_GOOGLE_DECORATE_STRING_EXTENSION_NAME "VK_GOOGLE_decorate_string" +// VK_EXT_subgroup_size_control is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_subgroup_size_control 1 #define VK_EXT_SUBGROUP_SIZE_CONTROL_SPEC_VERSION 2 #define VK_EXT_SUBGROUP_SIZE_CONTROL_EXTENSION_NAME "VK_EXT_subgroup_size_control" @@ -12436,6 +14300,7 @@ typedef VkPipelineShaderStageRequiredSubgroupSizeCreateInfo VkPipelineShaderStag +// VK_AMD_shader_core_properties2 is a preprocessor guard. Do not pass it to API calls. #define VK_AMD_shader_core_properties2 1 #define VK_AMD_SHADER_CORE_PROPERTIES_2_SPEC_VERSION 1 #define VK_AMD_SHADER_CORE_PROPERTIES_2_EXTENSION_NAME "VK_AMD_shader_core_properties2" @@ -12453,6 +14318,7 @@ typedef struct VkPhysicalDeviceShaderCoreProperties2AMD { +// VK_AMD_device_coherent_memory is a preprocessor guard. Do not pass it to API calls. #define VK_AMD_device_coherent_memory 1 #define VK_AMD_DEVICE_COHERENT_MEMORY_SPEC_VERSION 1 #define VK_AMD_DEVICE_COHERENT_MEMORY_EXTENSION_NAME "VK_AMD_device_coherent_memory" @@ -12464,6 +14330,7 @@ typedef struct VkPhysicalDeviceCoherentMemoryFeaturesAMD { +// VK_EXT_shader_image_atomic_int64 is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_shader_image_atomic_int64 1 #define VK_EXT_SHADER_IMAGE_ATOMIC_INT64_SPEC_VERSION 1 #define VK_EXT_SHADER_IMAGE_ATOMIC_INT64_EXTENSION_NAME "VK_EXT_shader_image_atomic_int64" @@ -12476,6 +14343,7 @@ typedef struct VkPhysicalDeviceShaderImageAtomicInt64FeaturesEXT { +// VK_EXT_memory_budget is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_memory_budget 1 #define VK_EXT_MEMORY_BUDGET_SPEC_VERSION 1 #define VK_EXT_MEMORY_BUDGET_EXTENSION_NAME "VK_EXT_memory_budget" @@ -12488,6 +14356,7 @@ typedef struct VkPhysicalDeviceMemoryBudgetPropertiesEXT { +// VK_EXT_memory_priority is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_memory_priority 1 #define VK_EXT_MEMORY_PRIORITY_SPEC_VERSION 1 #define VK_EXT_MEMORY_PRIORITY_EXTENSION_NAME "VK_EXT_memory_priority" @@ -12505,6 +14374,7 @@ typedef struct VkMemoryPriorityAllocateInfoEXT { +// VK_NV_dedicated_allocation_image_aliasing is a preprocessor guard. Do not pass it to API calls. #define VK_NV_dedicated_allocation_image_aliasing 1 #define VK_NV_DEDICATED_ALLOCATION_IMAGE_ALIASING_SPEC_VERSION 1 #define VK_NV_DEDICATED_ALLOCATION_IMAGE_ALIASING_EXTENSION_NAME "VK_NV_dedicated_allocation_image_aliasing" @@ -12516,6 +14386,7 @@ typedef struct VkPhysicalDeviceDedicatedAllocationImageAliasingFeaturesNV { +// VK_EXT_buffer_device_address is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_buffer_device_address 1 #define VK_EXT_BUFFER_DEVICE_ADDRESS_SPEC_VERSION 2 #define VK_EXT_BUFFER_DEVICE_ADDRESS_EXTENSION_NAME "VK_EXT_buffer_device_address" @@ -12546,6 +14417,7 @@ VKAPI_ATTR VkDeviceAddress VKAPI_CALL vkGetBufferDeviceAddressEXT( #endif +// VK_EXT_tooling_info is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_tooling_info 1 #define VK_EXT_TOOLING_INFO_SPEC_VERSION 1 #define VK_EXT_TOOLING_INFO_EXTENSION_NAME "VK_EXT_tooling_info" @@ -12565,6 +14437,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceToolPropertiesEXT( #endif +// VK_EXT_separate_stencil_usage is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_separate_stencil_usage 1 #define VK_EXT_SEPARATE_STENCIL_USAGE_SPEC_VERSION 1 #define VK_EXT_SEPARATE_STENCIL_USAGE_EXTENSION_NAME "VK_EXT_separate_stencil_usage" @@ -12572,8 +14445,9 @@ typedef VkImageStencilUsageCreateInfo VkImageStencilUsageCreateInfoEXT; +// VK_EXT_validation_features is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_validation_features 1 -#define VK_EXT_VALIDATION_FEATURES_SPEC_VERSION 5 +#define VK_EXT_VALIDATION_FEATURES_SPEC_VERSION 6 #define VK_EXT_VALIDATION_FEATURES_EXTENSION_NAME "VK_EXT_validation_features" typedef enum VkValidationFeatureEnableEXT { @@ -12607,32 +14481,14 @@ typedef struct VkValidationFeaturesEXT { +// VK_NV_cooperative_matrix is a preprocessor guard. Do not pass it to API calls. #define VK_NV_cooperative_matrix 1 #define VK_NV_COOPERATIVE_MATRIX_SPEC_VERSION 1 #define VK_NV_COOPERATIVE_MATRIX_EXTENSION_NAME "VK_NV_cooperative_matrix" +typedef VkComponentTypeKHR VkComponentTypeNV; + +typedef VkScopeKHR VkScopeNV; -typedef enum VkComponentTypeNV { - VK_COMPONENT_TYPE_FLOAT16_NV = 0, - VK_COMPONENT_TYPE_FLOAT32_NV = 1, - VK_COMPONENT_TYPE_FLOAT64_NV = 2, - VK_COMPONENT_TYPE_SINT8_NV = 3, - VK_COMPONENT_TYPE_SINT16_NV = 4, - VK_COMPONENT_TYPE_SINT32_NV = 5, - VK_COMPONENT_TYPE_SINT64_NV = 6, - VK_COMPONENT_TYPE_UINT8_NV = 7, - VK_COMPONENT_TYPE_UINT16_NV = 8, - VK_COMPONENT_TYPE_UINT32_NV = 9, - VK_COMPONENT_TYPE_UINT64_NV = 10, - VK_COMPONENT_TYPE_MAX_ENUM_NV = 0x7FFFFFFF -} VkComponentTypeNV; - -typedef enum VkScopeNV { - VK_SCOPE_DEVICE_NV = 1, - VK_SCOPE_WORKGROUP_NV = 2, - VK_SCOPE_SUBGROUP_NV = 3, - VK_SCOPE_QUEUE_FAMILY_NV = 5, - VK_SCOPE_MAX_ENUM_NV = 0x7FFFFFFF -} VkScopeNV; typedef struct VkCooperativeMatrixPropertiesNV { VkStructureType sType; void* pNext; @@ -12669,6 +14525,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceCooperativeMatrixPropertiesNV( #endif +// VK_NV_coverage_reduction_mode is a preprocessor guard. Do not pass it to API calls. #define VK_NV_coverage_reduction_mode 1 #define VK_NV_COVERAGE_REDUCTION_MODE_SPEC_VERSION 1 #define VK_NV_COVERAGE_REDUCTION_MODE_EXTENSION_NAME "VK_NV_coverage_reduction_mode" @@ -12711,6 +14568,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSupportedFramebufferMixedSampl #endif +// VK_EXT_fragment_shader_interlock is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_fragment_shader_interlock 1 #define VK_EXT_FRAGMENT_SHADER_INTERLOCK_SPEC_VERSION 1 #define VK_EXT_FRAGMENT_SHADER_INTERLOCK_EXTENSION_NAME "VK_EXT_fragment_shader_interlock" @@ -12724,6 +14582,7 @@ typedef struct VkPhysicalDeviceFragmentShaderInterlockFeaturesEXT { +// VK_EXT_ycbcr_image_arrays is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_ycbcr_image_arrays 1 #define VK_EXT_YCBCR_IMAGE_ARRAYS_SPEC_VERSION 1 #define VK_EXT_YCBCR_IMAGE_ARRAYS_EXTENSION_NAME "VK_EXT_ycbcr_image_arrays" @@ -12735,6 +14594,7 @@ typedef struct VkPhysicalDeviceYcbcrImageArraysFeaturesEXT { +// VK_EXT_provoking_vertex is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_provoking_vertex 1 #define VK_EXT_PROVOKING_VERTEX_SPEC_VERSION 1 #define VK_EXT_PROVOKING_VERTEX_EXTENSION_NAME "VK_EXT_provoking_vertex" @@ -12766,6 +14626,7 @@ typedef struct VkPipelineRasterizationProvokingVertexStateCreateInfoEXT { +// VK_EXT_headless_surface is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_headless_surface 1 #define VK_EXT_HEADLESS_SURFACE_SPEC_VERSION 1 #define VK_EXT_HEADLESS_SURFACE_EXTENSION_NAME "VK_EXT_headless_surface" @@ -12787,6 +14648,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkCreateHeadlessSurfaceEXT( #endif +// VK_EXT_line_rasterization is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_line_rasterization 1 #define VK_EXT_LINE_RASTERIZATION_SPEC_VERSION 1 #define VK_EXT_LINE_RASTERIZATION_EXTENSION_NAME "VK_EXT_line_rasterization" @@ -12834,6 +14696,7 @@ VKAPI_ATTR void VKAPI_CALL vkCmdSetLineStippleEXT( #endif +// VK_EXT_shader_atomic_float is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_shader_atomic_float 1 #define VK_EXT_SHADER_ATOMIC_FLOAT_SPEC_VERSION 1 #define VK_EXT_SHADER_ATOMIC_FLOAT_EXTENSION_NAME "VK_EXT_shader_atomic_float" @@ -12856,6 +14719,7 @@ typedef struct VkPhysicalDeviceShaderAtomicFloatFeaturesEXT { +// VK_EXT_host_query_reset is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_host_query_reset 1 #define VK_EXT_HOST_QUERY_RESET_SPEC_VERSION 1 #define VK_EXT_HOST_QUERY_RESET_EXTENSION_NAME "VK_EXT_host_query_reset" @@ -12872,6 +14736,7 @@ VKAPI_ATTR void VKAPI_CALL vkResetQueryPoolEXT( #endif +// VK_EXT_index_type_uint8 is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_index_type_uint8 1 #define VK_EXT_INDEX_TYPE_UINT8_SPEC_VERSION 1 #define VK_EXT_INDEX_TYPE_UINT8_EXTENSION_NAME "VK_EXT_index_type_uint8" @@ -12883,6 +14748,7 @@ typedef struct VkPhysicalDeviceIndexTypeUint8FeaturesEXT { +// VK_EXT_extended_dynamic_state is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_extended_dynamic_state 1 #define VK_EXT_EXTENDED_DYNAMIC_STATE_SPEC_VERSION 1 #define VK_EXT_EXTENDED_DYNAMIC_STATE_EXTENSION_NAME "VK_EXT_extended_dynamic_state" @@ -12967,36 +14833,279 @@ VKAPI_ATTR void VKAPI_CALL vkCmdSetStencilOpEXT( #endif -#define VK_EXT_shader_atomic_float2 1 -#define VK_EXT_SHADER_ATOMIC_FLOAT_2_SPEC_VERSION 1 -#define VK_EXT_SHADER_ATOMIC_FLOAT_2_EXTENSION_NAME "VK_EXT_shader_atomic_float2" -typedef struct VkPhysicalDeviceShaderAtomicFloat2FeaturesEXT { +// VK_EXT_host_image_copy is a preprocessor guard. Do not pass it to API calls. +#define VK_EXT_host_image_copy 1 +#define VK_EXT_HOST_IMAGE_COPY_SPEC_VERSION 1 +#define VK_EXT_HOST_IMAGE_COPY_EXTENSION_NAME "VK_EXT_host_image_copy" + +typedef enum VkHostImageCopyFlagBitsEXT { + VK_HOST_IMAGE_COPY_MEMCPY_EXT = 0x00000001, + VK_HOST_IMAGE_COPY_FLAG_BITS_MAX_ENUM_EXT = 0x7FFFFFFF +} VkHostImageCopyFlagBitsEXT; +typedef VkFlags VkHostImageCopyFlagsEXT; +typedef struct VkPhysicalDeviceHostImageCopyFeaturesEXT { VkStructureType sType; void* pNext; - VkBool32 shaderBufferFloat16Atomics; - VkBool32 shaderBufferFloat16AtomicAdd; - VkBool32 shaderBufferFloat16AtomicMinMax; - VkBool32 shaderBufferFloat32AtomicMinMax; - VkBool32 shaderBufferFloat64AtomicMinMax; - VkBool32 shaderSharedFloat16Atomics; - VkBool32 shaderSharedFloat16AtomicAdd; - VkBool32 shaderSharedFloat16AtomicMinMax; - VkBool32 shaderSharedFloat32AtomicMinMax; - VkBool32 shaderSharedFloat64AtomicMinMax; - VkBool32 shaderImageFloat32AtomicMinMax; - VkBool32 sparseImageFloat32AtomicMinMax; -} VkPhysicalDeviceShaderAtomicFloat2FeaturesEXT; - - - -#define VK_EXT_shader_demote_to_helper_invocation 1 -#define VK_EXT_SHADER_DEMOTE_TO_HELPER_INVOCATION_SPEC_VERSION 1 -#define VK_EXT_SHADER_DEMOTE_TO_HELPER_INVOCATION_EXTENSION_NAME "VK_EXT_shader_demote_to_helper_invocation" -typedef VkPhysicalDeviceShaderDemoteToHelperInvocationFeatures VkPhysicalDeviceShaderDemoteToHelperInvocationFeaturesEXT; + VkBool32 hostImageCopy; +} VkPhysicalDeviceHostImageCopyFeaturesEXT; +typedef struct VkPhysicalDeviceHostImageCopyPropertiesEXT { + VkStructureType sType; + void* pNext; + uint32_t copySrcLayoutCount; + VkImageLayout* pCopySrcLayouts; + uint32_t copyDstLayoutCount; + VkImageLayout* pCopyDstLayouts; + uint8_t optimalTilingLayoutUUID[VK_UUID_SIZE]; + VkBool32 identicalMemoryTypeRequirements; +} VkPhysicalDeviceHostImageCopyPropertiesEXT; + +typedef struct VkMemoryToImageCopyEXT { + VkStructureType sType; + const void* pNext; + const void* pHostPointer; + uint32_t memoryRowLength; + uint32_t memoryImageHeight; + VkImageSubresourceLayers imageSubresource; + VkOffset3D imageOffset; + VkExtent3D imageExtent; +} VkMemoryToImageCopyEXT; +typedef struct VkImageToMemoryCopyEXT { + VkStructureType sType; + const void* pNext; + void* pHostPointer; + uint32_t memoryRowLength; + uint32_t memoryImageHeight; + VkImageSubresourceLayers imageSubresource; + VkOffset3D imageOffset; + VkExtent3D imageExtent; +} VkImageToMemoryCopyEXT; -#define VK_NV_device_generated_commands 1 +typedef struct VkCopyMemoryToImageInfoEXT { + VkStructureType sType; + const void* pNext; + VkHostImageCopyFlagsEXT flags; + VkImage dstImage; + VkImageLayout dstImageLayout; + uint32_t regionCount; + const VkMemoryToImageCopyEXT* pRegions; +} VkCopyMemoryToImageInfoEXT; + +typedef struct VkCopyImageToMemoryInfoEXT { + VkStructureType sType; + const void* pNext; + VkHostImageCopyFlagsEXT flags; + VkImage srcImage; + VkImageLayout srcImageLayout; + uint32_t regionCount; + const VkImageToMemoryCopyEXT* pRegions; +} VkCopyImageToMemoryInfoEXT; + +typedef struct VkCopyImageToImageInfoEXT { + VkStructureType sType; + const void* pNext; + VkHostImageCopyFlagsEXT flags; + VkImage srcImage; + VkImageLayout srcImageLayout; + VkImage dstImage; + VkImageLayout dstImageLayout; + uint32_t regionCount; + const VkImageCopy2* pRegions; +} VkCopyImageToImageInfoEXT; + +typedef struct VkHostImageLayoutTransitionInfoEXT { + VkStructureType sType; + const void* pNext; + VkImage image; + VkImageLayout oldLayout; + VkImageLayout newLayout; + VkImageSubresourceRange subresourceRange; +} VkHostImageLayoutTransitionInfoEXT; + +typedef struct VkSubresourceHostMemcpySizeEXT { + VkStructureType sType; + void* pNext; + VkDeviceSize size; +} VkSubresourceHostMemcpySizeEXT; + +typedef struct VkHostImageCopyDevicePerformanceQueryEXT { + VkStructureType sType; + void* pNext; + VkBool32 optimalDeviceAccess; + VkBool32 identicalMemoryLayout; +} VkHostImageCopyDevicePerformanceQueryEXT; + +typedef VkSubresourceLayout2KHR VkSubresourceLayout2EXT; + +typedef VkImageSubresource2KHR VkImageSubresource2EXT; + +typedef VkResult (VKAPI_PTR *PFN_vkCopyMemoryToImageEXT)(VkDevice device, const VkCopyMemoryToImageInfoEXT* pCopyMemoryToImageInfo); +typedef VkResult (VKAPI_PTR *PFN_vkCopyImageToMemoryEXT)(VkDevice device, const VkCopyImageToMemoryInfoEXT* pCopyImageToMemoryInfo); +typedef VkResult (VKAPI_PTR *PFN_vkCopyImageToImageEXT)(VkDevice device, const VkCopyImageToImageInfoEXT* pCopyImageToImageInfo); +typedef VkResult (VKAPI_PTR *PFN_vkTransitionImageLayoutEXT)(VkDevice device, uint32_t transitionCount, const VkHostImageLayoutTransitionInfoEXT* pTransitions); +typedef void (VKAPI_PTR *PFN_vkGetImageSubresourceLayout2EXT)(VkDevice device, VkImage image, const VkImageSubresource2KHR* pSubresource, VkSubresourceLayout2KHR* pLayout); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkCopyMemoryToImageEXT( + VkDevice device, + const VkCopyMemoryToImageInfoEXT* pCopyMemoryToImageInfo); + +VKAPI_ATTR VkResult VKAPI_CALL vkCopyImageToMemoryEXT( + VkDevice device, + const VkCopyImageToMemoryInfoEXT* pCopyImageToMemoryInfo); + +VKAPI_ATTR VkResult VKAPI_CALL vkCopyImageToImageEXT( + VkDevice device, + const VkCopyImageToImageInfoEXT* pCopyImageToImageInfo); + +VKAPI_ATTR VkResult VKAPI_CALL vkTransitionImageLayoutEXT( + VkDevice device, + uint32_t transitionCount, + const VkHostImageLayoutTransitionInfoEXT* pTransitions); + +VKAPI_ATTR void VKAPI_CALL vkGetImageSubresourceLayout2EXT( + VkDevice device, + VkImage image, + const VkImageSubresource2KHR* pSubresource, + VkSubresourceLayout2KHR* pLayout); +#endif + + +// VK_EXT_shader_atomic_float2 is a preprocessor guard. Do not pass it to API calls. +#define VK_EXT_shader_atomic_float2 1 +#define VK_EXT_SHADER_ATOMIC_FLOAT_2_SPEC_VERSION 1 +#define VK_EXT_SHADER_ATOMIC_FLOAT_2_EXTENSION_NAME "VK_EXT_shader_atomic_float2" +typedef struct VkPhysicalDeviceShaderAtomicFloat2FeaturesEXT { + VkStructureType sType; + void* pNext; + VkBool32 shaderBufferFloat16Atomics; + VkBool32 shaderBufferFloat16AtomicAdd; + VkBool32 shaderBufferFloat16AtomicMinMax; + VkBool32 shaderBufferFloat32AtomicMinMax; + VkBool32 shaderBufferFloat64AtomicMinMax; + VkBool32 shaderSharedFloat16Atomics; + VkBool32 shaderSharedFloat16AtomicAdd; + VkBool32 shaderSharedFloat16AtomicMinMax; + VkBool32 shaderSharedFloat32AtomicMinMax; + VkBool32 shaderSharedFloat64AtomicMinMax; + VkBool32 shaderImageFloat32AtomicMinMax; + VkBool32 sparseImageFloat32AtomicMinMax; +} VkPhysicalDeviceShaderAtomicFloat2FeaturesEXT; + + + +// VK_EXT_surface_maintenance1 is a preprocessor guard. Do not pass it to API calls. +#define VK_EXT_surface_maintenance1 1 +#define VK_EXT_SURFACE_MAINTENANCE_1_SPEC_VERSION 1 +#define VK_EXT_SURFACE_MAINTENANCE_1_EXTENSION_NAME "VK_EXT_surface_maintenance1" + +typedef enum VkPresentScalingFlagBitsEXT { + VK_PRESENT_SCALING_ONE_TO_ONE_BIT_EXT = 0x00000001, + VK_PRESENT_SCALING_ASPECT_RATIO_STRETCH_BIT_EXT = 0x00000002, + VK_PRESENT_SCALING_STRETCH_BIT_EXT = 0x00000004, + VK_PRESENT_SCALING_FLAG_BITS_MAX_ENUM_EXT = 0x7FFFFFFF +} VkPresentScalingFlagBitsEXT; +typedef VkFlags VkPresentScalingFlagsEXT; + +typedef enum VkPresentGravityFlagBitsEXT { + VK_PRESENT_GRAVITY_MIN_BIT_EXT = 0x00000001, + VK_PRESENT_GRAVITY_MAX_BIT_EXT = 0x00000002, + VK_PRESENT_GRAVITY_CENTERED_BIT_EXT = 0x00000004, + VK_PRESENT_GRAVITY_FLAG_BITS_MAX_ENUM_EXT = 0x7FFFFFFF +} VkPresentGravityFlagBitsEXT; +typedef VkFlags VkPresentGravityFlagsEXT; +typedef struct VkSurfacePresentModeEXT { + VkStructureType sType; + void* pNext; + VkPresentModeKHR presentMode; +} VkSurfacePresentModeEXT; + +typedef struct VkSurfacePresentScalingCapabilitiesEXT { + VkStructureType sType; + void* pNext; + VkPresentScalingFlagsEXT supportedPresentScaling; + VkPresentGravityFlagsEXT supportedPresentGravityX; + VkPresentGravityFlagsEXT supportedPresentGravityY; + VkExtent2D minScaledImageExtent; + VkExtent2D maxScaledImageExtent; +} VkSurfacePresentScalingCapabilitiesEXT; + +typedef struct VkSurfacePresentModeCompatibilityEXT { + VkStructureType sType; + void* pNext; + uint32_t presentModeCount; + VkPresentModeKHR* pPresentModes; +} VkSurfacePresentModeCompatibilityEXT; + + + +// VK_EXT_swapchain_maintenance1 is a preprocessor guard. Do not pass it to API calls. +#define VK_EXT_swapchain_maintenance1 1 +#define VK_EXT_SWAPCHAIN_MAINTENANCE_1_SPEC_VERSION 1 +#define VK_EXT_SWAPCHAIN_MAINTENANCE_1_EXTENSION_NAME "VK_EXT_swapchain_maintenance1" +typedef struct VkPhysicalDeviceSwapchainMaintenance1FeaturesEXT { + VkStructureType sType; + void* pNext; + VkBool32 swapchainMaintenance1; +} VkPhysicalDeviceSwapchainMaintenance1FeaturesEXT; + +typedef struct VkSwapchainPresentFenceInfoEXT { + VkStructureType sType; + const void* pNext; + uint32_t swapchainCount; + const VkFence* pFences; +} VkSwapchainPresentFenceInfoEXT; + +typedef struct VkSwapchainPresentModesCreateInfoEXT { + VkStructureType sType; + const void* pNext; + uint32_t presentModeCount; + const VkPresentModeKHR* pPresentModes; +} VkSwapchainPresentModesCreateInfoEXT; + +typedef struct VkSwapchainPresentModeInfoEXT { + VkStructureType sType; + const void* pNext; + uint32_t swapchainCount; + const VkPresentModeKHR* pPresentModes; +} VkSwapchainPresentModeInfoEXT; + +typedef struct VkSwapchainPresentScalingCreateInfoEXT { + VkStructureType sType; + const void* pNext; + VkPresentScalingFlagsEXT scalingBehavior; + VkPresentGravityFlagsEXT presentGravityX; + VkPresentGravityFlagsEXT presentGravityY; +} VkSwapchainPresentScalingCreateInfoEXT; + +typedef struct VkReleaseSwapchainImagesInfoEXT { + VkStructureType sType; + const void* pNext; + VkSwapchainKHR swapchain; + uint32_t imageIndexCount; + const uint32_t* pImageIndices; +} VkReleaseSwapchainImagesInfoEXT; + +typedef VkResult (VKAPI_PTR *PFN_vkReleaseSwapchainImagesEXT)(VkDevice device, const VkReleaseSwapchainImagesInfoEXT* pReleaseInfo); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkReleaseSwapchainImagesEXT( + VkDevice device, + const VkReleaseSwapchainImagesInfoEXT* pReleaseInfo); +#endif + + +// VK_EXT_shader_demote_to_helper_invocation is a preprocessor guard. Do not pass it to API calls. +#define VK_EXT_shader_demote_to_helper_invocation 1 +#define VK_EXT_SHADER_DEMOTE_TO_HELPER_INVOCATION_SPEC_VERSION 1 +#define VK_EXT_SHADER_DEMOTE_TO_HELPER_INVOCATION_EXTENSION_NAME "VK_EXT_shader_demote_to_helper_invocation" +typedef VkPhysicalDeviceShaderDemoteToHelperInvocationFeatures VkPhysicalDeviceShaderDemoteToHelperInvocationFeaturesEXT; + + + +// VK_NV_device_generated_commands is a preprocessor guard. Do not pass it to API calls. +#define VK_NV_device_generated_commands 1 VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkIndirectCommandsLayoutNV) #define VK_NV_DEVICE_GENERATED_COMMANDS_SPEC_VERSION 3 #define VK_NV_DEVICE_GENERATED_COMMANDS_EXTENSION_NAME "VK_NV_device_generated_commands" @@ -13011,6 +15120,8 @@ typedef enum VkIndirectCommandsTokenTypeNV { VK_INDIRECT_COMMANDS_TOKEN_TYPE_DRAW_NV = 6, VK_INDIRECT_COMMANDS_TOKEN_TYPE_DRAW_TASKS_NV = 7, VK_INDIRECT_COMMANDS_TOKEN_TYPE_DRAW_MESH_TASKS_NV = 1000328000, + VK_INDIRECT_COMMANDS_TOKEN_TYPE_PIPELINE_NV = 1000428003, + VK_INDIRECT_COMMANDS_TOKEN_TYPE_DISPATCH_NV = 1000428004, VK_INDIRECT_COMMANDS_TOKEN_TYPE_MAX_ENUM_NV = 0x7FFFFFFF } VkIndirectCommandsTokenTypeNV; @@ -13187,6 +15298,7 @@ VKAPI_ATTR void VKAPI_CALL vkDestroyIndirectCommandsLayoutNV( #endif +// VK_NV_inherited_viewport_scissor is a preprocessor guard. Do not pass it to API calls. #define VK_NV_inherited_viewport_scissor 1 #define VK_NV_INHERITED_VIEWPORT_SCISSOR_SPEC_VERSION 1 #define VK_NV_INHERITED_VIEWPORT_SCISSOR_EXTENSION_NAME "VK_NV_inherited_viewport_scissor" @@ -13206,6 +15318,7 @@ typedef struct VkCommandBufferInheritanceViewportScissorInfoNV { +// VK_EXT_texel_buffer_alignment is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_texel_buffer_alignment 1 #define VK_EXT_TEXEL_BUFFER_ALIGNMENT_SPEC_VERSION 1 #define VK_EXT_TEXEL_BUFFER_ALIGNMENT_EXTENSION_NAME "VK_EXT_texel_buffer_alignment" @@ -13219,8 +15332,9 @@ typedef VkPhysicalDeviceTexelBufferAlignmentProperties VkPhysicalDeviceTexelBuff +// VK_QCOM_render_pass_transform is a preprocessor guard. Do not pass it to API calls. #define VK_QCOM_render_pass_transform 1 -#define VK_QCOM_RENDER_PASS_TRANSFORM_SPEC_VERSION 3 +#define VK_QCOM_RENDER_PASS_TRANSFORM_SPEC_VERSION 4 #define VK_QCOM_RENDER_PASS_TRANSFORM_EXTENSION_NAME "VK_QCOM_render_pass_transform" typedef struct VkRenderPassTransformBeginInfoQCOM { VkStructureType sType; @@ -13237,6 +15351,51 @@ typedef struct VkCommandBufferInheritanceRenderPassTransformInfoQCOM { +// VK_EXT_depth_bias_control is a preprocessor guard. Do not pass it to API calls. +#define VK_EXT_depth_bias_control 1 +#define VK_EXT_DEPTH_BIAS_CONTROL_SPEC_VERSION 1 +#define VK_EXT_DEPTH_BIAS_CONTROL_EXTENSION_NAME "VK_EXT_depth_bias_control" + +typedef enum VkDepthBiasRepresentationEXT { + VK_DEPTH_BIAS_REPRESENTATION_LEAST_REPRESENTABLE_VALUE_FORMAT_EXT = 0, + VK_DEPTH_BIAS_REPRESENTATION_LEAST_REPRESENTABLE_VALUE_FORCE_UNORM_EXT = 1, + VK_DEPTH_BIAS_REPRESENTATION_FLOAT_EXT = 2, + VK_DEPTH_BIAS_REPRESENTATION_MAX_ENUM_EXT = 0x7FFFFFFF +} VkDepthBiasRepresentationEXT; +typedef struct VkPhysicalDeviceDepthBiasControlFeaturesEXT { + VkStructureType sType; + void* pNext; + VkBool32 depthBiasControl; + VkBool32 leastRepresentableValueForceUnormRepresentation; + VkBool32 floatRepresentation; + VkBool32 depthBiasExact; +} VkPhysicalDeviceDepthBiasControlFeaturesEXT; + +typedef struct VkDepthBiasInfoEXT { + VkStructureType sType; + const void* pNext; + float depthBiasConstantFactor; + float depthBiasClamp; + float depthBiasSlopeFactor; +} VkDepthBiasInfoEXT; + +typedef struct VkDepthBiasRepresentationInfoEXT { + VkStructureType sType; + const void* pNext; + VkDepthBiasRepresentationEXT depthBiasRepresentation; + VkBool32 depthBiasExact; +} VkDepthBiasRepresentationInfoEXT; + +typedef void (VKAPI_PTR *PFN_vkCmdSetDepthBias2EXT)(VkCommandBuffer commandBuffer, const VkDepthBiasInfoEXT* pDepthBiasInfo); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR void VKAPI_CALL vkCmdSetDepthBias2EXT( + VkCommandBuffer commandBuffer, + const VkDepthBiasInfoEXT* pDepthBiasInfo); +#endif + + +// VK_EXT_device_memory_report is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_device_memory_report 1 #define VK_EXT_DEVICE_MEMORY_REPORT_SPEC_VERSION 2 #define VK_EXT_DEVICE_MEMORY_REPORT_EXTENSION_NAME "VK_EXT_device_memory_report" @@ -13282,6 +15441,7 @@ typedef struct VkDeviceDeviceMemoryReportCreateInfoEXT { +// VK_EXT_acquire_drm_display is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_acquire_drm_display 1 #define VK_EXT_ACQUIRE_DRM_DISPLAY_SPEC_VERSION 1 #define VK_EXT_ACQUIRE_DRM_DISPLAY_EXTENSION_NAME "VK_EXT_acquire_drm_display" @@ -13302,6 +15462,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkGetDrmDisplayEXT( #endif +// VK_EXT_robustness2 is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_robustness2 1 #define VK_EXT_ROBUSTNESS_2_SPEC_VERSION 1 #define VK_EXT_ROBUSTNESS_2_EXTENSION_NAME "VK_EXT_robustness2" @@ -13322,6 +15483,7 @@ typedef struct VkPhysicalDeviceRobustness2PropertiesEXT { +// VK_EXT_custom_border_color is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_custom_border_color 1 #define VK_EXT_CUSTOM_BORDER_COLOR_SPEC_VERSION 12 #define VK_EXT_CUSTOM_BORDER_COLOR_EXTENSION_NAME "VK_EXT_custom_border_color" @@ -13347,11 +15509,37 @@ typedef struct VkPhysicalDeviceCustomBorderColorFeaturesEXT { +// VK_GOOGLE_user_type is a preprocessor guard. Do not pass it to API calls. #define VK_GOOGLE_user_type 1 #define VK_GOOGLE_USER_TYPE_SPEC_VERSION 1 #define VK_GOOGLE_USER_TYPE_EXTENSION_NAME "VK_GOOGLE_user_type" +// VK_NV_present_barrier is a preprocessor guard. Do not pass it to API calls. +#define VK_NV_present_barrier 1 +#define VK_NV_PRESENT_BARRIER_SPEC_VERSION 1 +#define VK_NV_PRESENT_BARRIER_EXTENSION_NAME "VK_NV_present_barrier" +typedef struct VkPhysicalDevicePresentBarrierFeaturesNV { + VkStructureType sType; + void* pNext; + VkBool32 presentBarrier; +} VkPhysicalDevicePresentBarrierFeaturesNV; + +typedef struct VkSurfaceCapabilitiesPresentBarrierNV { + VkStructureType sType; + void* pNext; + VkBool32 presentBarrierSupported; +} VkSurfaceCapabilitiesPresentBarrierNV; + +typedef struct VkSwapchainPresentBarrierCreateInfoNV { + VkStructureType sType; + void* pNext; + VkBool32 presentBarrierEnable; +} VkSwapchainPresentBarrierCreateInfoNV; + + + +// VK_EXT_private_data is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_private_data 1 typedef VkPrivateDataSlot VkPrivateDataSlotEXT; @@ -13398,6 +15586,7 @@ VKAPI_ATTR void VKAPI_CALL vkGetPrivateDataEXT( #endif +// VK_EXT_pipeline_creation_cache_control is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_pipeline_creation_cache_control 1 #define VK_EXT_PIPELINE_CREATION_CACHE_CONTROL_SPEC_VERSION 3 #define VK_EXT_PIPELINE_CREATION_CACHE_CONTROL_EXTENSION_NAME "VK_EXT_pipeline_creation_cache_control" @@ -13405,6 +15594,7 @@ typedef VkPhysicalDevicePipelineCreationCacheControlFeatures VkPhysicalDevicePip +// VK_NV_device_diagnostics_config is a preprocessor guard. Do not pass it to API calls. #define VK_NV_device_diagnostics_config 1 #define VK_NV_DEVICE_DIAGNOSTICS_CONFIG_SPEC_VERSION 2 #define VK_NV_DEVICE_DIAGNOSTICS_CONFIG_EXTENSION_NAME "VK_NV_device_diagnostics_config" @@ -13431,113 +15621,435 @@ typedef struct VkDeviceDiagnosticsConfigCreateInfoNV { +// VK_QCOM_render_pass_store_ops is a preprocessor guard. Do not pass it to API calls. #define VK_QCOM_render_pass_store_ops 1 #define VK_QCOM_RENDER_PASS_STORE_OPS_SPEC_VERSION 2 #define VK_QCOM_RENDER_PASS_STORE_OPS_EXTENSION_NAME "VK_QCOM_render_pass_store_ops" -#define VK_EXT_graphics_pipeline_library 1 -#define VK_EXT_GRAPHICS_PIPELINE_LIBRARY_SPEC_VERSION 1 -#define VK_EXT_GRAPHICS_PIPELINE_LIBRARY_EXTENSION_NAME "VK_EXT_graphics_pipeline_library" +// VK_NV_cuda_kernel_launch is a preprocessor guard. Do not pass it to API calls. +#define VK_NV_cuda_kernel_launch 1 +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkCudaModuleNV) +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkCudaFunctionNV) +#define VK_NV_CUDA_KERNEL_LAUNCH_SPEC_VERSION 2 +#define VK_NV_CUDA_KERNEL_LAUNCH_EXTENSION_NAME "VK_NV_cuda_kernel_launch" +typedef struct VkCudaModuleCreateInfoNV { + VkStructureType sType; + const void* pNext; + size_t dataSize; + const void* pData; +} VkCudaModuleCreateInfoNV; -typedef enum VkGraphicsPipelineLibraryFlagBitsEXT { - VK_GRAPHICS_PIPELINE_LIBRARY_VERTEX_INPUT_INTERFACE_BIT_EXT = 0x00000001, - VK_GRAPHICS_PIPELINE_LIBRARY_PRE_RASTERIZATION_SHADERS_BIT_EXT = 0x00000002, - VK_GRAPHICS_PIPELINE_LIBRARY_FRAGMENT_SHADER_BIT_EXT = 0x00000004, - VK_GRAPHICS_PIPELINE_LIBRARY_FRAGMENT_OUTPUT_INTERFACE_BIT_EXT = 0x00000008, - VK_GRAPHICS_PIPELINE_LIBRARY_FLAG_BITS_MAX_ENUM_EXT = 0x7FFFFFFF -} VkGraphicsPipelineLibraryFlagBitsEXT; -typedef VkFlags VkGraphicsPipelineLibraryFlagsEXT; -typedef struct VkPhysicalDeviceGraphicsPipelineLibraryFeaturesEXT { +typedef struct VkCudaFunctionCreateInfoNV { + VkStructureType sType; + const void* pNext; + VkCudaModuleNV module; + const char* pName; +} VkCudaFunctionCreateInfoNV; + +typedef struct VkCudaLaunchInfoNV { + VkStructureType sType; + const void* pNext; + VkCudaFunctionNV function; + uint32_t gridDimX; + uint32_t gridDimY; + uint32_t gridDimZ; + uint32_t blockDimX; + uint32_t blockDimY; + uint32_t blockDimZ; + uint32_t sharedMemBytes; + size_t paramCount; + const void* const * pParams; + size_t extraCount; + const void* const * pExtras; +} VkCudaLaunchInfoNV; + +typedef struct VkPhysicalDeviceCudaKernelLaunchFeaturesNV { VkStructureType sType; void* pNext; - VkBool32 graphicsPipelineLibrary; -} VkPhysicalDeviceGraphicsPipelineLibraryFeaturesEXT; + VkBool32 cudaKernelLaunchFeatures; +} VkPhysicalDeviceCudaKernelLaunchFeaturesNV; -typedef struct VkPhysicalDeviceGraphicsPipelineLibraryPropertiesEXT { +typedef struct VkPhysicalDeviceCudaKernelLaunchPropertiesNV { VkStructureType sType; void* pNext; - VkBool32 graphicsPipelineLibraryFastLinking; - VkBool32 graphicsPipelineLibraryIndependentInterpolationDecoration; -} VkPhysicalDeviceGraphicsPipelineLibraryPropertiesEXT; + uint32_t computeCapabilityMinor; + uint32_t computeCapabilityMajor; +} VkPhysicalDeviceCudaKernelLaunchPropertiesNV; -typedef struct VkGraphicsPipelineLibraryCreateInfoEXT { - VkStructureType sType; - void* pNext; - VkGraphicsPipelineLibraryFlagsEXT flags; -} VkGraphicsPipelineLibraryCreateInfoEXT; +typedef VkResult (VKAPI_PTR *PFN_vkCreateCudaModuleNV)(VkDevice device, const VkCudaModuleCreateInfoNV* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkCudaModuleNV* pModule); +typedef VkResult (VKAPI_PTR *PFN_vkGetCudaModuleCacheNV)(VkDevice device, VkCudaModuleNV module, size_t* pCacheSize, void* pCacheData); +typedef VkResult (VKAPI_PTR *PFN_vkCreateCudaFunctionNV)(VkDevice device, const VkCudaFunctionCreateInfoNV* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkCudaFunctionNV* pFunction); +typedef void (VKAPI_PTR *PFN_vkDestroyCudaModuleNV)(VkDevice device, VkCudaModuleNV module, const VkAllocationCallbacks* pAllocator); +typedef void (VKAPI_PTR *PFN_vkDestroyCudaFunctionNV)(VkDevice device, VkCudaFunctionNV function, const VkAllocationCallbacks* pAllocator); +typedef void (VKAPI_PTR *PFN_vkCmdCudaLaunchKernelNV)(VkCommandBuffer commandBuffer, const VkCudaLaunchInfoNV* pLaunchInfo); +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkCreateCudaModuleNV( + VkDevice device, + const VkCudaModuleCreateInfoNV* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkCudaModuleNV* pModule); +VKAPI_ATTR VkResult VKAPI_CALL vkGetCudaModuleCacheNV( + VkDevice device, + VkCudaModuleNV module, + size_t* pCacheSize, + void* pCacheData); -#define VK_AMD_shader_early_and_late_fragment_tests 1 -#define VK_AMD_SHADER_EARLY_AND_LATE_FRAGMENT_TESTS_SPEC_VERSION 1 -#define VK_AMD_SHADER_EARLY_AND_LATE_FRAGMENT_TESTS_EXTENSION_NAME "VK_AMD_shader_early_and_late_fragment_tests" -typedef struct VkPhysicalDeviceShaderEarlyAndLateFragmentTestsFeaturesAMD { - VkStructureType sType; - void* pNext; - VkBool32 shaderEarlyAndLateFragmentTests; -} VkPhysicalDeviceShaderEarlyAndLateFragmentTestsFeaturesAMD; +VKAPI_ATTR VkResult VKAPI_CALL vkCreateCudaFunctionNV( + VkDevice device, + const VkCudaFunctionCreateInfoNV* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkCudaFunctionNV* pFunction); +VKAPI_ATTR void VKAPI_CALL vkDestroyCudaModuleNV( + VkDevice device, + VkCudaModuleNV module, + const VkAllocationCallbacks* pAllocator); +VKAPI_ATTR void VKAPI_CALL vkDestroyCudaFunctionNV( + VkDevice device, + VkCudaFunctionNV function, + const VkAllocationCallbacks* pAllocator); -#define VK_NV_fragment_shading_rate_enums 1 -#define VK_NV_FRAGMENT_SHADING_RATE_ENUMS_SPEC_VERSION 1 -#define VK_NV_FRAGMENT_SHADING_RATE_ENUMS_EXTENSION_NAME "VK_NV_fragment_shading_rate_enums" +VKAPI_ATTR void VKAPI_CALL vkCmdCudaLaunchKernelNV( + VkCommandBuffer commandBuffer, + const VkCudaLaunchInfoNV* pLaunchInfo); +#endif -typedef enum VkFragmentShadingRateTypeNV { - VK_FRAGMENT_SHADING_RATE_TYPE_FRAGMENT_SIZE_NV = 0, - VK_FRAGMENT_SHADING_RATE_TYPE_ENUMS_NV = 1, - VK_FRAGMENT_SHADING_RATE_TYPE_MAX_ENUM_NV = 0x7FFFFFFF -} VkFragmentShadingRateTypeNV; -typedef enum VkFragmentShadingRateNV { - VK_FRAGMENT_SHADING_RATE_1_INVOCATION_PER_PIXEL_NV = 0, - VK_FRAGMENT_SHADING_RATE_1_INVOCATION_PER_1X2_PIXELS_NV = 1, - VK_FRAGMENT_SHADING_RATE_1_INVOCATION_PER_2X1_PIXELS_NV = 4, - VK_FRAGMENT_SHADING_RATE_1_INVOCATION_PER_2X2_PIXELS_NV = 5, - VK_FRAGMENT_SHADING_RATE_1_INVOCATION_PER_2X4_PIXELS_NV = 6, - VK_FRAGMENT_SHADING_RATE_1_INVOCATION_PER_4X2_PIXELS_NV = 9, - VK_FRAGMENT_SHADING_RATE_1_INVOCATION_PER_4X4_PIXELS_NV = 10, - VK_FRAGMENT_SHADING_RATE_2_INVOCATIONS_PER_PIXEL_NV = 11, - VK_FRAGMENT_SHADING_RATE_4_INVOCATIONS_PER_PIXEL_NV = 12, - VK_FRAGMENT_SHADING_RATE_8_INVOCATIONS_PER_PIXEL_NV = 13, - VK_FRAGMENT_SHADING_RATE_16_INVOCATIONS_PER_PIXEL_NV = 14, - VK_FRAGMENT_SHADING_RATE_NO_INVOCATIONS_NV = 15, - VK_FRAGMENT_SHADING_RATE_MAX_ENUM_NV = 0x7FFFFFFF -} VkFragmentShadingRateNV; -typedef struct VkPhysicalDeviceFragmentShadingRateEnumsFeaturesNV { +// VK_NV_low_latency is a preprocessor guard. Do not pass it to API calls. +#define VK_NV_low_latency 1 +#define VK_NV_LOW_LATENCY_SPEC_VERSION 1 +#define VK_NV_LOW_LATENCY_EXTENSION_NAME "VK_NV_low_latency" +typedef struct VkQueryLowLatencySupportNV { VkStructureType sType; - void* pNext; - VkBool32 fragmentShadingRateEnums; - VkBool32 supersampleFragmentShadingRates; - VkBool32 noInvocationFragmentShadingRates; -} VkPhysicalDeviceFragmentShadingRateEnumsFeaturesNV; + const void* pNext; + void* pQueriedLowLatencyData; +} VkQueryLowLatencySupportNV; -typedef struct VkPhysicalDeviceFragmentShadingRateEnumsPropertiesNV { - VkStructureType sType; - void* pNext; - VkSampleCountFlagBits maxFragmentShadingRateInvocationCount; -} VkPhysicalDeviceFragmentShadingRateEnumsPropertiesNV; -typedef struct VkPipelineFragmentShadingRateEnumStateCreateInfoNV { - VkStructureType sType; - const void* pNext; - VkFragmentShadingRateTypeNV shadingRateType; - VkFragmentShadingRateNV shadingRate; - VkFragmentShadingRateCombinerOpKHR combinerOps[2]; -} VkPipelineFragmentShadingRateEnumStateCreateInfoNV; -typedef void (VKAPI_PTR *PFN_vkCmdSetFragmentShadingRateEnumNV)(VkCommandBuffer commandBuffer, VkFragmentShadingRateNV shadingRate, const VkFragmentShadingRateCombinerOpKHR combinerOps[2]); +// VK_EXT_descriptor_buffer is a preprocessor guard. Do not pass it to API calls. +#define VK_EXT_descriptor_buffer 1 +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkAccelerationStructureKHR) +#define VK_EXT_DESCRIPTOR_BUFFER_SPEC_VERSION 1 +#define VK_EXT_DESCRIPTOR_BUFFER_EXTENSION_NAME "VK_EXT_descriptor_buffer" +typedef struct VkPhysicalDeviceDescriptorBufferPropertiesEXT { + VkStructureType sType; + void* pNext; + VkBool32 combinedImageSamplerDescriptorSingleArray; + VkBool32 bufferlessPushDescriptors; + VkBool32 allowSamplerImageViewPostSubmitCreation; + VkDeviceSize descriptorBufferOffsetAlignment; + uint32_t maxDescriptorBufferBindings; + uint32_t maxResourceDescriptorBufferBindings; + uint32_t maxSamplerDescriptorBufferBindings; + uint32_t maxEmbeddedImmutableSamplerBindings; + uint32_t maxEmbeddedImmutableSamplers; + size_t bufferCaptureReplayDescriptorDataSize; + size_t imageCaptureReplayDescriptorDataSize; + size_t imageViewCaptureReplayDescriptorDataSize; + size_t samplerCaptureReplayDescriptorDataSize; + size_t accelerationStructureCaptureReplayDescriptorDataSize; + size_t samplerDescriptorSize; + size_t combinedImageSamplerDescriptorSize; + size_t sampledImageDescriptorSize; + size_t storageImageDescriptorSize; + size_t uniformTexelBufferDescriptorSize; + size_t robustUniformTexelBufferDescriptorSize; + size_t storageTexelBufferDescriptorSize; + size_t robustStorageTexelBufferDescriptorSize; + size_t uniformBufferDescriptorSize; + size_t robustUniformBufferDescriptorSize; + size_t storageBufferDescriptorSize; + size_t robustStorageBufferDescriptorSize; + size_t inputAttachmentDescriptorSize; + size_t accelerationStructureDescriptorSize; + VkDeviceSize maxSamplerDescriptorBufferRange; + VkDeviceSize maxResourceDescriptorBufferRange; + VkDeviceSize samplerDescriptorBufferAddressSpaceSize; + VkDeviceSize resourceDescriptorBufferAddressSpaceSize; + VkDeviceSize descriptorBufferAddressSpaceSize; +} VkPhysicalDeviceDescriptorBufferPropertiesEXT; + +typedef struct VkPhysicalDeviceDescriptorBufferDensityMapPropertiesEXT { + VkStructureType sType; + void* pNext; + size_t combinedImageSamplerDensityMapDescriptorSize; +} VkPhysicalDeviceDescriptorBufferDensityMapPropertiesEXT; -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR void VKAPI_CALL vkCmdSetFragmentShadingRateEnumNV( - VkCommandBuffer commandBuffer, - VkFragmentShadingRateNV shadingRate, - const VkFragmentShadingRateCombinerOpKHR combinerOps[2]); -#endif +typedef struct VkPhysicalDeviceDescriptorBufferFeaturesEXT { + VkStructureType sType; + void* pNext; + VkBool32 descriptorBuffer; + VkBool32 descriptorBufferCaptureReplay; + VkBool32 descriptorBufferImageLayoutIgnored; + VkBool32 descriptorBufferPushDescriptors; +} VkPhysicalDeviceDescriptorBufferFeaturesEXT; +typedef struct VkDescriptorAddressInfoEXT { + VkStructureType sType; + void* pNext; + VkDeviceAddress address; + VkDeviceSize range; + VkFormat format; +} VkDescriptorAddressInfoEXT; -#define VK_NV_ray_tracing_motion_blur 1 +typedef struct VkDescriptorBufferBindingInfoEXT { + VkStructureType sType; + void* pNext; + VkDeviceAddress address; + VkBufferUsageFlags usage; +} VkDescriptorBufferBindingInfoEXT; + +typedef struct VkDescriptorBufferBindingPushDescriptorBufferHandleEXT { + VkStructureType sType; + void* pNext; + VkBuffer buffer; +} VkDescriptorBufferBindingPushDescriptorBufferHandleEXT; + +typedef union VkDescriptorDataEXT { + const VkSampler* pSampler; + const VkDescriptorImageInfo* pCombinedImageSampler; + const VkDescriptorImageInfo* pInputAttachmentImage; + const VkDescriptorImageInfo* pSampledImage; + const VkDescriptorImageInfo* pStorageImage; + const VkDescriptorAddressInfoEXT* pUniformTexelBuffer; + const VkDescriptorAddressInfoEXT* pStorageTexelBuffer; + const VkDescriptorAddressInfoEXT* pUniformBuffer; + const VkDescriptorAddressInfoEXT* pStorageBuffer; + VkDeviceAddress accelerationStructure; +} VkDescriptorDataEXT; + +typedef struct VkDescriptorGetInfoEXT { + VkStructureType sType; + const void* pNext; + VkDescriptorType type; + VkDescriptorDataEXT data; +} VkDescriptorGetInfoEXT; + +typedef struct VkBufferCaptureDescriptorDataInfoEXT { + VkStructureType sType; + const void* pNext; + VkBuffer buffer; +} VkBufferCaptureDescriptorDataInfoEXT; + +typedef struct VkImageCaptureDescriptorDataInfoEXT { + VkStructureType sType; + const void* pNext; + VkImage image; +} VkImageCaptureDescriptorDataInfoEXT; + +typedef struct VkImageViewCaptureDescriptorDataInfoEXT { + VkStructureType sType; + const void* pNext; + VkImageView imageView; +} VkImageViewCaptureDescriptorDataInfoEXT; + +typedef struct VkSamplerCaptureDescriptorDataInfoEXT { + VkStructureType sType; + const void* pNext; + VkSampler sampler; +} VkSamplerCaptureDescriptorDataInfoEXT; + +typedef struct VkOpaqueCaptureDescriptorDataCreateInfoEXT { + VkStructureType sType; + const void* pNext; + const void* opaqueCaptureDescriptorData; +} VkOpaqueCaptureDescriptorDataCreateInfoEXT; + +typedef struct VkAccelerationStructureCaptureDescriptorDataInfoEXT { + VkStructureType sType; + const void* pNext; + VkAccelerationStructureKHR accelerationStructure; + VkAccelerationStructureNV accelerationStructureNV; +} VkAccelerationStructureCaptureDescriptorDataInfoEXT; + +typedef void (VKAPI_PTR *PFN_vkGetDescriptorSetLayoutSizeEXT)(VkDevice device, VkDescriptorSetLayout layout, VkDeviceSize* pLayoutSizeInBytes); +typedef void (VKAPI_PTR *PFN_vkGetDescriptorSetLayoutBindingOffsetEXT)(VkDevice device, VkDescriptorSetLayout layout, uint32_t binding, VkDeviceSize* pOffset); +typedef void (VKAPI_PTR *PFN_vkGetDescriptorEXT)(VkDevice device, const VkDescriptorGetInfoEXT* pDescriptorInfo, size_t dataSize, void* pDescriptor); +typedef void (VKAPI_PTR *PFN_vkCmdBindDescriptorBuffersEXT)(VkCommandBuffer commandBuffer, uint32_t bufferCount, const VkDescriptorBufferBindingInfoEXT* pBindingInfos); +typedef void (VKAPI_PTR *PFN_vkCmdSetDescriptorBufferOffsetsEXT)(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipelineLayout layout, uint32_t firstSet, uint32_t setCount, const uint32_t* pBufferIndices, const VkDeviceSize* pOffsets); +typedef void (VKAPI_PTR *PFN_vkCmdBindDescriptorBufferEmbeddedSamplersEXT)(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipelineLayout layout, uint32_t set); +typedef VkResult (VKAPI_PTR *PFN_vkGetBufferOpaqueCaptureDescriptorDataEXT)(VkDevice device, const VkBufferCaptureDescriptorDataInfoEXT* pInfo, void* pData); +typedef VkResult (VKAPI_PTR *PFN_vkGetImageOpaqueCaptureDescriptorDataEXT)(VkDevice device, const VkImageCaptureDescriptorDataInfoEXT* pInfo, void* pData); +typedef VkResult (VKAPI_PTR *PFN_vkGetImageViewOpaqueCaptureDescriptorDataEXT)(VkDevice device, const VkImageViewCaptureDescriptorDataInfoEXT* pInfo, void* pData); +typedef VkResult (VKAPI_PTR *PFN_vkGetSamplerOpaqueCaptureDescriptorDataEXT)(VkDevice device, const VkSamplerCaptureDescriptorDataInfoEXT* pInfo, void* pData); +typedef VkResult (VKAPI_PTR *PFN_vkGetAccelerationStructureOpaqueCaptureDescriptorDataEXT)(VkDevice device, const VkAccelerationStructureCaptureDescriptorDataInfoEXT* pInfo, void* pData); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR void VKAPI_CALL vkGetDescriptorSetLayoutSizeEXT( + VkDevice device, + VkDescriptorSetLayout layout, + VkDeviceSize* pLayoutSizeInBytes); + +VKAPI_ATTR void VKAPI_CALL vkGetDescriptorSetLayoutBindingOffsetEXT( + VkDevice device, + VkDescriptorSetLayout layout, + uint32_t binding, + VkDeviceSize* pOffset); + +VKAPI_ATTR void VKAPI_CALL vkGetDescriptorEXT( + VkDevice device, + const VkDescriptorGetInfoEXT* pDescriptorInfo, + size_t dataSize, + void* pDescriptor); + +VKAPI_ATTR void VKAPI_CALL vkCmdBindDescriptorBuffersEXT( + VkCommandBuffer commandBuffer, + uint32_t bufferCount, + const VkDescriptorBufferBindingInfoEXT* pBindingInfos); + +VKAPI_ATTR void VKAPI_CALL vkCmdSetDescriptorBufferOffsetsEXT( + VkCommandBuffer commandBuffer, + VkPipelineBindPoint pipelineBindPoint, + VkPipelineLayout layout, + uint32_t firstSet, + uint32_t setCount, + const uint32_t* pBufferIndices, + const VkDeviceSize* pOffsets); + +VKAPI_ATTR void VKAPI_CALL vkCmdBindDescriptorBufferEmbeddedSamplersEXT( + VkCommandBuffer commandBuffer, + VkPipelineBindPoint pipelineBindPoint, + VkPipelineLayout layout, + uint32_t set); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetBufferOpaqueCaptureDescriptorDataEXT( + VkDevice device, + const VkBufferCaptureDescriptorDataInfoEXT* pInfo, + void* pData); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetImageOpaqueCaptureDescriptorDataEXT( + VkDevice device, + const VkImageCaptureDescriptorDataInfoEXT* pInfo, + void* pData); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetImageViewOpaqueCaptureDescriptorDataEXT( + VkDevice device, + const VkImageViewCaptureDescriptorDataInfoEXT* pInfo, + void* pData); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetSamplerOpaqueCaptureDescriptorDataEXT( + VkDevice device, + const VkSamplerCaptureDescriptorDataInfoEXT* pInfo, + void* pData); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetAccelerationStructureOpaqueCaptureDescriptorDataEXT( + VkDevice device, + const VkAccelerationStructureCaptureDescriptorDataInfoEXT* pInfo, + void* pData); +#endif + + +// VK_EXT_graphics_pipeline_library is a preprocessor guard. Do not pass it to API calls. +#define VK_EXT_graphics_pipeline_library 1 +#define VK_EXT_GRAPHICS_PIPELINE_LIBRARY_SPEC_VERSION 1 +#define VK_EXT_GRAPHICS_PIPELINE_LIBRARY_EXTENSION_NAME "VK_EXT_graphics_pipeline_library" + +typedef enum VkGraphicsPipelineLibraryFlagBitsEXT { + VK_GRAPHICS_PIPELINE_LIBRARY_VERTEX_INPUT_INTERFACE_BIT_EXT = 0x00000001, + VK_GRAPHICS_PIPELINE_LIBRARY_PRE_RASTERIZATION_SHADERS_BIT_EXT = 0x00000002, + VK_GRAPHICS_PIPELINE_LIBRARY_FRAGMENT_SHADER_BIT_EXT = 0x00000004, + VK_GRAPHICS_PIPELINE_LIBRARY_FRAGMENT_OUTPUT_INTERFACE_BIT_EXT = 0x00000008, + VK_GRAPHICS_PIPELINE_LIBRARY_FLAG_BITS_MAX_ENUM_EXT = 0x7FFFFFFF +} VkGraphicsPipelineLibraryFlagBitsEXT; +typedef VkFlags VkGraphicsPipelineLibraryFlagsEXT; +typedef struct VkPhysicalDeviceGraphicsPipelineLibraryFeaturesEXT { + VkStructureType sType; + void* pNext; + VkBool32 graphicsPipelineLibrary; +} VkPhysicalDeviceGraphicsPipelineLibraryFeaturesEXT; + +typedef struct VkPhysicalDeviceGraphicsPipelineLibraryPropertiesEXT { + VkStructureType sType; + void* pNext; + VkBool32 graphicsPipelineLibraryFastLinking; + VkBool32 graphicsPipelineLibraryIndependentInterpolationDecoration; +} VkPhysicalDeviceGraphicsPipelineLibraryPropertiesEXT; + +typedef struct VkGraphicsPipelineLibraryCreateInfoEXT { + VkStructureType sType; + const void* pNext; + VkGraphicsPipelineLibraryFlagsEXT flags; +} VkGraphicsPipelineLibraryCreateInfoEXT; + + + +// VK_AMD_shader_early_and_late_fragment_tests is a preprocessor guard. Do not pass it to API calls. +#define VK_AMD_shader_early_and_late_fragment_tests 1 +#define VK_AMD_SHADER_EARLY_AND_LATE_FRAGMENT_TESTS_SPEC_VERSION 1 +#define VK_AMD_SHADER_EARLY_AND_LATE_FRAGMENT_TESTS_EXTENSION_NAME "VK_AMD_shader_early_and_late_fragment_tests" +typedef struct VkPhysicalDeviceShaderEarlyAndLateFragmentTestsFeaturesAMD { + VkStructureType sType; + void* pNext; + VkBool32 shaderEarlyAndLateFragmentTests; +} VkPhysicalDeviceShaderEarlyAndLateFragmentTestsFeaturesAMD; + + + +// VK_NV_fragment_shading_rate_enums is a preprocessor guard. Do not pass it to API calls. +#define VK_NV_fragment_shading_rate_enums 1 +#define VK_NV_FRAGMENT_SHADING_RATE_ENUMS_SPEC_VERSION 1 +#define VK_NV_FRAGMENT_SHADING_RATE_ENUMS_EXTENSION_NAME "VK_NV_fragment_shading_rate_enums" + +typedef enum VkFragmentShadingRateTypeNV { + VK_FRAGMENT_SHADING_RATE_TYPE_FRAGMENT_SIZE_NV = 0, + VK_FRAGMENT_SHADING_RATE_TYPE_ENUMS_NV = 1, + VK_FRAGMENT_SHADING_RATE_TYPE_MAX_ENUM_NV = 0x7FFFFFFF +} VkFragmentShadingRateTypeNV; + +typedef enum VkFragmentShadingRateNV { + VK_FRAGMENT_SHADING_RATE_1_INVOCATION_PER_PIXEL_NV = 0, + VK_FRAGMENT_SHADING_RATE_1_INVOCATION_PER_1X2_PIXELS_NV = 1, + VK_FRAGMENT_SHADING_RATE_1_INVOCATION_PER_2X1_PIXELS_NV = 4, + VK_FRAGMENT_SHADING_RATE_1_INVOCATION_PER_2X2_PIXELS_NV = 5, + VK_FRAGMENT_SHADING_RATE_1_INVOCATION_PER_2X4_PIXELS_NV = 6, + VK_FRAGMENT_SHADING_RATE_1_INVOCATION_PER_4X2_PIXELS_NV = 9, + VK_FRAGMENT_SHADING_RATE_1_INVOCATION_PER_4X4_PIXELS_NV = 10, + VK_FRAGMENT_SHADING_RATE_2_INVOCATIONS_PER_PIXEL_NV = 11, + VK_FRAGMENT_SHADING_RATE_4_INVOCATIONS_PER_PIXEL_NV = 12, + VK_FRAGMENT_SHADING_RATE_8_INVOCATIONS_PER_PIXEL_NV = 13, + VK_FRAGMENT_SHADING_RATE_16_INVOCATIONS_PER_PIXEL_NV = 14, + VK_FRAGMENT_SHADING_RATE_NO_INVOCATIONS_NV = 15, + VK_FRAGMENT_SHADING_RATE_MAX_ENUM_NV = 0x7FFFFFFF +} VkFragmentShadingRateNV; +typedef struct VkPhysicalDeviceFragmentShadingRateEnumsFeaturesNV { + VkStructureType sType; + void* pNext; + VkBool32 fragmentShadingRateEnums; + VkBool32 supersampleFragmentShadingRates; + VkBool32 noInvocationFragmentShadingRates; +} VkPhysicalDeviceFragmentShadingRateEnumsFeaturesNV; + +typedef struct VkPhysicalDeviceFragmentShadingRateEnumsPropertiesNV { + VkStructureType sType; + void* pNext; + VkSampleCountFlagBits maxFragmentShadingRateInvocationCount; +} VkPhysicalDeviceFragmentShadingRateEnumsPropertiesNV; + +typedef struct VkPipelineFragmentShadingRateEnumStateCreateInfoNV { + VkStructureType sType; + const void* pNext; + VkFragmentShadingRateTypeNV shadingRateType; + VkFragmentShadingRateNV shadingRate; + VkFragmentShadingRateCombinerOpKHR combinerOps[2]; +} VkPipelineFragmentShadingRateEnumStateCreateInfoNV; + +typedef void (VKAPI_PTR *PFN_vkCmdSetFragmentShadingRateEnumNV)(VkCommandBuffer commandBuffer, VkFragmentShadingRateNV shadingRate, const VkFragmentShadingRateCombinerOpKHR combinerOps[2]); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR void VKAPI_CALL vkCmdSetFragmentShadingRateEnumNV( + VkCommandBuffer commandBuffer, + VkFragmentShadingRateNV shadingRate, + const VkFragmentShadingRateCombinerOpKHR combinerOps[2]); +#endif + + +// VK_NV_ray_tracing_motion_blur is a preprocessor guard. Do not pass it to API calls. +#define VK_NV_ray_tracing_motion_blur 1 #define VK_NV_RAY_TRACING_MOTION_BLUR_SPEC_VERSION 1 #define VK_NV_RAY_TRACING_MOTION_BLUR_EXTENSION_NAME "VK_NV_ray_tracing_motion_blur" @@ -13627,6 +16139,7 @@ typedef struct VkPhysicalDeviceRayTracingMotionBlurFeaturesNV { +// VK_EXT_ycbcr_2plane_444_formats is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_ycbcr_2plane_444_formats 1 #define VK_EXT_YCBCR_2PLANE_444_FORMATS_SPEC_VERSION 1 #define VK_EXT_YCBCR_2PLANE_444_FORMATS_EXTENSION_NAME "VK_EXT_ycbcr_2plane_444_formats" @@ -13638,6 +16151,7 @@ typedef struct VkPhysicalDeviceYcbcr2Plane444FormatsFeaturesEXT { +// VK_EXT_fragment_density_map2 is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_fragment_density_map2 1 #define VK_EXT_FRAGMENT_DENSITY_MAP_2_SPEC_VERSION 1 #define VK_EXT_FRAGMENT_DENSITY_MAP_2_EXTENSION_NAME "VK_EXT_fragment_density_map2" @@ -13658,8 +16172,9 @@ typedef struct VkPhysicalDeviceFragmentDensityMap2PropertiesEXT { +// VK_QCOM_rotated_copy_commands is a preprocessor guard. Do not pass it to API calls. #define VK_QCOM_rotated_copy_commands 1 -#define VK_QCOM_ROTATED_COPY_COMMANDS_SPEC_VERSION 1 +#define VK_QCOM_ROTATED_COPY_COMMANDS_SPEC_VERSION 2 #define VK_QCOM_ROTATED_COPY_COMMANDS_EXTENSION_NAME "VK_QCOM_rotated_copy_commands" typedef struct VkCopyCommandTransformInfoQCOM { VkStructureType sType; @@ -13669,6 +16184,7 @@ typedef struct VkCopyCommandTransformInfoQCOM { +// VK_EXT_image_robustness is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_image_robustness 1 #define VK_EXT_IMAGE_ROBUSTNESS_SPEC_VERSION 1 #define VK_EXT_IMAGE_ROBUSTNESS_EXTENSION_NAME "VK_EXT_image_robustness" @@ -13676,6 +16192,7 @@ typedef VkPhysicalDeviceImageRobustnessFeatures VkPhysicalDeviceImageRobustnessF +// VK_EXT_image_compression_control is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_image_compression_control 1 #define VK_EXT_IMAGE_COMPRESSION_CONTROL_SPEC_VERSION 1 #define VK_EXT_IMAGE_COMPRESSION_CONTROL_EXTENSION_NAME "VK_EXT_image_compression_control" @@ -13732,18 +16249,6 @@ typedef struct VkImageCompressionControlEXT { VkImageCompressionFixedRateFlagsEXT* pFixedRateFlags; } VkImageCompressionControlEXT; -typedef struct VkSubresourceLayout2EXT { - VkStructureType sType; - void* pNext; - VkSubresourceLayout subresourceLayout; -} VkSubresourceLayout2EXT; - -typedef struct VkImageSubresource2EXT { - VkStructureType sType; - void* pNext; - VkImageSubresource imageSubresource; -} VkImageSubresource2EXT; - typedef struct VkImageCompressionPropertiesEXT { VkStructureType sType; void* pNext; @@ -13751,17 +16256,9 @@ typedef struct VkImageCompressionPropertiesEXT { VkImageCompressionFixedRateFlagsEXT imageCompressionFixedRateFlags; } VkImageCompressionPropertiesEXT; -typedef void (VKAPI_PTR *PFN_vkGetImageSubresourceLayout2EXT)(VkDevice device, VkImage image, const VkImageSubresource2EXT* pSubresource, VkSubresourceLayout2EXT* pLayout); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR void VKAPI_CALL vkGetImageSubresourceLayout2EXT( - VkDevice device, - VkImage image, - const VkImageSubresource2EXT* pSubresource, - VkSubresourceLayout2EXT* pLayout); -#endif +// VK_EXT_attachment_feedback_loop_layout is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_attachment_feedback_loop_layout 1 #define VK_EXT_ATTACHMENT_FEEDBACK_LOOP_LAYOUT_SPEC_VERSION 2 #define VK_EXT_ATTACHMENT_FEEDBACK_LOOP_LAYOUT_EXTENSION_NAME "VK_EXT_attachment_feedback_loop_layout" @@ -13773,6 +16270,7 @@ typedef struct VkPhysicalDeviceAttachmentFeedbackLoopLayoutFeaturesEXT { +// VK_EXT_4444_formats is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_4444_formats 1 #define VK_EXT_4444_FORMATS_SPEC_VERSION 1 #define VK_EXT_4444_FORMATS_EXTENSION_NAME "VK_EXT_4444_formats" @@ -13785,6 +16283,87 @@ typedef struct VkPhysicalDevice4444FormatsFeaturesEXT { +// VK_EXT_device_fault is a preprocessor guard. Do not pass it to API calls. +#define VK_EXT_device_fault 1 +#define VK_EXT_DEVICE_FAULT_SPEC_VERSION 2 +#define VK_EXT_DEVICE_FAULT_EXTENSION_NAME "VK_EXT_device_fault" + +typedef enum VkDeviceFaultAddressTypeEXT { + VK_DEVICE_FAULT_ADDRESS_TYPE_NONE_EXT = 0, + VK_DEVICE_FAULT_ADDRESS_TYPE_READ_INVALID_EXT = 1, + VK_DEVICE_FAULT_ADDRESS_TYPE_WRITE_INVALID_EXT = 2, + VK_DEVICE_FAULT_ADDRESS_TYPE_EXECUTE_INVALID_EXT = 3, + VK_DEVICE_FAULT_ADDRESS_TYPE_INSTRUCTION_POINTER_UNKNOWN_EXT = 4, + VK_DEVICE_FAULT_ADDRESS_TYPE_INSTRUCTION_POINTER_INVALID_EXT = 5, + VK_DEVICE_FAULT_ADDRESS_TYPE_INSTRUCTION_POINTER_FAULT_EXT = 6, + VK_DEVICE_FAULT_ADDRESS_TYPE_MAX_ENUM_EXT = 0x7FFFFFFF +} VkDeviceFaultAddressTypeEXT; + +typedef enum VkDeviceFaultVendorBinaryHeaderVersionEXT { + VK_DEVICE_FAULT_VENDOR_BINARY_HEADER_VERSION_ONE_EXT = 1, + VK_DEVICE_FAULT_VENDOR_BINARY_HEADER_VERSION_MAX_ENUM_EXT = 0x7FFFFFFF +} VkDeviceFaultVendorBinaryHeaderVersionEXT; +typedef struct VkPhysicalDeviceFaultFeaturesEXT { + VkStructureType sType; + void* pNext; + VkBool32 deviceFault; + VkBool32 deviceFaultVendorBinary; +} VkPhysicalDeviceFaultFeaturesEXT; + +typedef struct VkDeviceFaultCountsEXT { + VkStructureType sType; + void* pNext; + uint32_t addressInfoCount; + uint32_t vendorInfoCount; + VkDeviceSize vendorBinarySize; +} VkDeviceFaultCountsEXT; + +typedef struct VkDeviceFaultAddressInfoEXT { + VkDeviceFaultAddressTypeEXT addressType; + VkDeviceAddress reportedAddress; + VkDeviceSize addressPrecision; +} VkDeviceFaultAddressInfoEXT; + +typedef struct VkDeviceFaultVendorInfoEXT { + char description[VK_MAX_DESCRIPTION_SIZE]; + uint64_t vendorFaultCode; + uint64_t vendorFaultData; +} VkDeviceFaultVendorInfoEXT; + +typedef struct VkDeviceFaultInfoEXT { + VkStructureType sType; + void* pNext; + char description[VK_MAX_DESCRIPTION_SIZE]; + VkDeviceFaultAddressInfoEXT* pAddressInfos; + VkDeviceFaultVendorInfoEXT* pVendorInfos; + void* pVendorBinaryData; +} VkDeviceFaultInfoEXT; + +typedef struct VkDeviceFaultVendorBinaryHeaderVersionOneEXT { + uint32_t headerSize; + VkDeviceFaultVendorBinaryHeaderVersionEXT headerVersion; + uint32_t vendorID; + uint32_t deviceID; + uint32_t driverVersion; + uint8_t pipelineCacheUUID[VK_UUID_SIZE]; + uint32_t applicationNameOffset; + uint32_t applicationVersion; + uint32_t engineNameOffset; + uint32_t engineVersion; + uint32_t apiVersion; +} VkDeviceFaultVendorBinaryHeaderVersionOneEXT; + +typedef VkResult (VKAPI_PTR *PFN_vkGetDeviceFaultInfoEXT)(VkDevice device, VkDeviceFaultCountsEXT* pFaultCounts, VkDeviceFaultInfoEXT* pFaultInfo); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkGetDeviceFaultInfoEXT( + VkDevice device, + VkDeviceFaultCountsEXT* pFaultCounts, + VkDeviceFaultInfoEXT* pFaultInfo); +#endif + + +// VK_ARM_rasterization_order_attachment_access is a preprocessor guard. Do not pass it to API calls. #define VK_ARM_rasterization_order_attachment_access 1 #define VK_ARM_RASTERIZATION_ORDER_ATTACHMENT_ACCESS_SPEC_VERSION 1 #define VK_ARM_RASTERIZATION_ORDER_ATTACHMENT_ACCESS_EXTENSION_NAME "VK_ARM_rasterization_order_attachment_access" @@ -13800,6 +16379,7 @@ typedef VkPhysicalDeviceRasterizationOrderAttachmentAccessFeaturesEXT VkPhysical +// VK_EXT_rgba10x6_formats is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_rgba10x6_formats 1 #define VK_EXT_RGBA10X6_FORMATS_SPEC_VERSION 1 #define VK_EXT_RGBA10X6_FORMATS_EXTENSION_NAME "VK_EXT_rgba10x6_formats" @@ -13811,47 +16391,37 @@ typedef struct VkPhysicalDeviceRGBA10X6FormatsFeaturesEXT { -#define VK_NV_acquire_winrt_display 1 -#define VK_NV_ACQUIRE_WINRT_DISPLAY_SPEC_VERSION 1 -#define VK_NV_ACQUIRE_WINRT_DISPLAY_EXTENSION_NAME "VK_NV_acquire_winrt_display" -typedef VkResult (VKAPI_PTR *PFN_vkAcquireWinrtDisplayNV)(VkPhysicalDevice physicalDevice, VkDisplayKHR display); -typedef VkResult (VKAPI_PTR *PFN_vkGetWinrtDisplayNV)(VkPhysicalDevice physicalDevice, uint32_t deviceRelativeId, VkDisplayKHR* pDisplay); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR VkResult VKAPI_CALL vkAcquireWinrtDisplayNV( - VkPhysicalDevice physicalDevice, - VkDisplayKHR display); - -VKAPI_ATTR VkResult VKAPI_CALL vkGetWinrtDisplayNV( - VkPhysicalDevice physicalDevice, - uint32_t deviceRelativeId, - VkDisplayKHR* pDisplay); -#endif - - +// VK_VALVE_mutable_descriptor_type is a preprocessor guard. Do not pass it to API calls. #define VK_VALVE_mutable_descriptor_type 1 #define VK_VALVE_MUTABLE_DESCRIPTOR_TYPE_SPEC_VERSION 1 #define VK_VALVE_MUTABLE_DESCRIPTOR_TYPE_EXTENSION_NAME "VK_VALVE_mutable_descriptor_type" -typedef struct VkPhysicalDeviceMutableDescriptorTypeFeaturesVALVE { +typedef struct VkPhysicalDeviceMutableDescriptorTypeFeaturesEXT { VkStructureType sType; void* pNext; VkBool32 mutableDescriptorType; -} VkPhysicalDeviceMutableDescriptorTypeFeaturesVALVE; +} VkPhysicalDeviceMutableDescriptorTypeFeaturesEXT; + +typedef VkPhysicalDeviceMutableDescriptorTypeFeaturesEXT VkPhysicalDeviceMutableDescriptorTypeFeaturesVALVE; -typedef struct VkMutableDescriptorTypeListVALVE { +typedef struct VkMutableDescriptorTypeListEXT { uint32_t descriptorTypeCount; const VkDescriptorType* pDescriptorTypes; -} VkMutableDescriptorTypeListVALVE; +} VkMutableDescriptorTypeListEXT; -typedef struct VkMutableDescriptorTypeCreateInfoVALVE { - VkStructureType sType; - const void* pNext; - uint32_t mutableDescriptorTypeListCount; - const VkMutableDescriptorTypeListVALVE* pMutableDescriptorTypeLists; -} VkMutableDescriptorTypeCreateInfoVALVE; +typedef VkMutableDescriptorTypeListEXT VkMutableDescriptorTypeListVALVE; + +typedef struct VkMutableDescriptorTypeCreateInfoEXT { + VkStructureType sType; + const void* pNext; + uint32_t mutableDescriptorTypeListCount; + const VkMutableDescriptorTypeListEXT* pMutableDescriptorTypeLists; +} VkMutableDescriptorTypeCreateInfoEXT; + +typedef VkMutableDescriptorTypeCreateInfoEXT VkMutableDescriptorTypeCreateInfoVALVE; +// VK_EXT_vertex_input_dynamic_state is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_vertex_input_dynamic_state 1 #define VK_EXT_VERTEX_INPUT_DYNAMIC_STATE_SPEC_VERSION 2 #define VK_EXT_VERTEX_INPUT_DYNAMIC_STATE_EXTENSION_NAME "VK_EXT_vertex_input_dynamic_state" @@ -13891,6 +16461,7 @@ VKAPI_ATTR void VKAPI_CALL vkCmdSetVertexInputEXT( #endif +// VK_EXT_physical_device_drm is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_physical_device_drm 1 #define VK_EXT_PHYSICAL_DEVICE_DRM_SPEC_VERSION 1 #define VK_EXT_PHYSICAL_DEVICE_DRM_EXTENSION_NAME "VK_EXT_physical_device_drm" @@ -13907,6 +16478,40 @@ typedef struct VkPhysicalDeviceDrmPropertiesEXT { +// VK_EXT_device_address_binding_report is a preprocessor guard. Do not pass it to API calls. +#define VK_EXT_device_address_binding_report 1 +#define VK_EXT_DEVICE_ADDRESS_BINDING_REPORT_SPEC_VERSION 1 +#define VK_EXT_DEVICE_ADDRESS_BINDING_REPORT_EXTENSION_NAME "VK_EXT_device_address_binding_report" + +typedef enum VkDeviceAddressBindingTypeEXT { + VK_DEVICE_ADDRESS_BINDING_TYPE_BIND_EXT = 0, + VK_DEVICE_ADDRESS_BINDING_TYPE_UNBIND_EXT = 1, + VK_DEVICE_ADDRESS_BINDING_TYPE_MAX_ENUM_EXT = 0x7FFFFFFF +} VkDeviceAddressBindingTypeEXT; + +typedef enum VkDeviceAddressBindingFlagBitsEXT { + VK_DEVICE_ADDRESS_BINDING_INTERNAL_OBJECT_BIT_EXT = 0x00000001, + VK_DEVICE_ADDRESS_BINDING_FLAG_BITS_MAX_ENUM_EXT = 0x7FFFFFFF +} VkDeviceAddressBindingFlagBitsEXT; +typedef VkFlags VkDeviceAddressBindingFlagsEXT; +typedef struct VkPhysicalDeviceAddressBindingReportFeaturesEXT { + VkStructureType sType; + void* pNext; + VkBool32 reportAddressBinding; +} VkPhysicalDeviceAddressBindingReportFeaturesEXT; + +typedef struct VkDeviceAddressBindingCallbackDataEXT { + VkStructureType sType; + void* pNext; + VkDeviceAddressBindingFlagsEXT flags; + VkDeviceAddress baseAddress; + VkDeviceSize size; + VkDeviceAddressBindingTypeEXT bindingType; +} VkDeviceAddressBindingCallbackDataEXT; + + + +// VK_EXT_depth_clip_control is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_depth_clip_control 1 #define VK_EXT_DEPTH_CLIP_CONTROL_SPEC_VERSION 1 #define VK_EXT_DEPTH_CLIP_CONTROL_EXTENSION_NAME "VK_EXT_depth_clip_control" @@ -13924,6 +16529,7 @@ typedef struct VkPipelineViewportDepthClipControlCreateInfoEXT { +// VK_EXT_primitive_topology_list_restart is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_primitive_topology_list_restart 1 #define VK_EXT_PRIMITIVE_TOPOLOGY_LIST_RESTART_SPEC_VERSION 1 #define VK_EXT_PRIMITIVE_TOPOLOGY_LIST_RESTART_EXTENSION_NAME "VK_EXT_primitive_topology_list_restart" @@ -13936,8 +16542,9 @@ typedef struct VkPhysicalDevicePrimitiveTopologyListRestartFeaturesEXT { +// VK_HUAWEI_subpass_shading is a preprocessor guard. Do not pass it to API calls. #define VK_HUAWEI_subpass_shading 1 -#define VK_HUAWEI_SUBPASS_SHADING_SPEC_VERSION 2 +#define VK_HUAWEI_SUBPASS_SHADING_SPEC_VERSION 3 #define VK_HUAWEI_SUBPASS_SHADING_EXTENSION_NAME "VK_HUAWEI_subpass_shading" typedef struct VkSubpassShadingPipelineCreateInfoHUAWEI { VkStructureType sType; @@ -13972,6 +16579,7 @@ VKAPI_ATTR void VKAPI_CALL vkCmdSubpassShadingHUAWEI( #endif +// VK_HUAWEI_invocation_mask is a preprocessor guard. Do not pass it to API calls. #define VK_HUAWEI_invocation_mask 1 #define VK_HUAWEI_INVOCATION_MASK_SPEC_VERSION 1 #define VK_HUAWEI_INVOCATION_MASK_EXTENSION_NAME "VK_HUAWEI_invocation_mask" @@ -13991,6 +16599,7 @@ VKAPI_ATTR void VKAPI_CALL vkCmdBindInvocationMaskHUAWEI( #endif +// VK_NV_external_memory_rdma is a preprocessor guard. Do not pass it to API calls. #define VK_NV_external_memory_rdma 1 typedef void* VkRemoteAddressNV; #define VK_NV_EXTERNAL_MEMORY_RDMA_SPEC_VERSION 1 @@ -14018,6 +16627,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryRemoteAddressNV( #endif +// VK_EXT_pipeline_properties is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_pipeline_properties 1 #define VK_EXT_PIPELINE_PROPERTIES_SPEC_VERSION 1 #define VK_EXT_PIPELINE_PROPERTIES_EXTENSION_NAME "VK_EXT_pipeline_properties" @@ -14045,6 +16655,39 @@ VKAPI_ATTR VkResult VKAPI_CALL vkGetPipelinePropertiesEXT( #endif +// VK_EXT_frame_boundary is a preprocessor guard. Do not pass it to API calls. +#define VK_EXT_frame_boundary 1 +#define VK_EXT_FRAME_BOUNDARY_SPEC_VERSION 1 +#define VK_EXT_FRAME_BOUNDARY_EXTENSION_NAME "VK_EXT_frame_boundary" + +typedef enum VkFrameBoundaryFlagBitsEXT { + VK_FRAME_BOUNDARY_FRAME_END_BIT_EXT = 0x00000001, + VK_FRAME_BOUNDARY_FLAG_BITS_MAX_ENUM_EXT = 0x7FFFFFFF +} VkFrameBoundaryFlagBitsEXT; +typedef VkFlags VkFrameBoundaryFlagsEXT; +typedef struct VkPhysicalDeviceFrameBoundaryFeaturesEXT { + VkStructureType sType; + void* pNext; + VkBool32 frameBoundary; +} VkPhysicalDeviceFrameBoundaryFeaturesEXT; + +typedef struct VkFrameBoundaryEXT { + VkStructureType sType; + const void* pNext; + VkFrameBoundaryFlagsEXT flags; + uint64_t frameID; + uint32_t imageCount; + const VkImage* pImages; + uint32_t bufferCount; + const VkBuffer* pBuffers; + uint64_t tagName; + size_t tagSize; + const void* pTag; +} VkFrameBoundaryEXT; + + + +// VK_EXT_multisampled_render_to_single_sampled is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_multisampled_render_to_single_sampled 1 #define VK_EXT_MULTISAMPLED_RENDER_TO_SINGLE_SAMPLED_SPEC_VERSION 1 #define VK_EXT_MULTISAMPLED_RENDER_TO_SINGLE_SAMPLED_EXTENSION_NAME "VK_EXT_multisampled_render_to_single_sampled" @@ -14069,6 +16712,7 @@ typedef struct VkMultisampledRenderToSingleSampledInfoEXT { +// VK_EXT_extended_dynamic_state2 is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_extended_dynamic_state2 1 #define VK_EXT_EXTENDED_DYNAMIC_STATE_2_SPEC_VERSION 1 #define VK_EXT_EXTENDED_DYNAMIC_STATE_2_EXTENSION_NAME "VK_EXT_extended_dynamic_state2" @@ -14109,6 +16753,7 @@ VKAPI_ATTR void VKAPI_CALL vkCmdSetPrimitiveRestartEnableEXT( #endif +// VK_EXT_color_write_enable is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_color_write_enable 1 #define VK_EXT_COLOR_WRITE_ENABLE_SPEC_VERSION 1 #define VK_EXT_COLOR_WRITE_ENABLE_EXTENSION_NAME "VK_EXT_color_write_enable" @@ -14135,6 +16780,7 @@ VKAPI_ATTR void VKAPI_CALL vkCmdSetColorWrite #endif +// VK_EXT_primitives_generated_query is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_primitives_generated_query 1 #define VK_EXT_PRIMITIVES_GENERATED_QUERY_SPEC_VERSION 1 #define VK_EXT_PRIMITIVES_GENERATED_QUERY_EXTENSION_NAME "VK_EXT_primitives_generated_query" @@ -14148,6 +16794,7 @@ typedef struct VkPhysicalDevicePrimitivesGeneratedQueryFeaturesEXT { +// VK_EXT_global_priority_query is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_global_priority_query 1 #define VK_EXT_GLOBAL_PRIORITY_QUERY_SPEC_VERSION 1 #define VK_EXT_GLOBAL_PRIORITY_QUERY_EXTENSION_NAME "VK_EXT_global_priority_query" @@ -14158,6 +16805,7 @@ typedef VkQueueFamilyGlobalPriorityPropertiesKHR VkQueueFamilyGlobalPriorityProp +// VK_EXT_image_view_min_lod is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_image_view_min_lod 1 #define VK_EXT_IMAGE_VIEW_MIN_LOD_SPEC_VERSION 1 #define VK_EXT_IMAGE_VIEW_MIN_LOD_EXTENSION_NAME "VK_EXT_image_view_min_lod" @@ -14175,6 +16823,7 @@ typedef struct VkImageViewMinLodCreateInfoEXT { +// VK_EXT_multi_draw is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_multi_draw 1 #define VK_EXT_MULTI_DRAW_SPEC_VERSION 1 #define VK_EXT_MULTI_DRAW_EXTENSION_NAME "VK_EXT_multi_draw" @@ -14224,6 +16873,7 @@ VKAPI_ATTR void VKAPI_CALL vkCmdDrawMultiIndexedEXT( #endif +// VK_EXT_image_2d_view_of_3d is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_image_2d_view_of_3d 1 #define VK_EXT_IMAGE_2D_VIEW_OF_3D_SPEC_VERSION 1 #define VK_EXT_IMAGE_2D_VIEW_OF_3D_EXTENSION_NAME "VK_EXT_image_2d_view_of_3d" @@ -14236,32 +16886,372 @@ typedef struct VkPhysicalDeviceImage2DViewOf3DFeaturesEXT { -#define VK_EXT_load_store_op_none 1 -#define VK_EXT_LOAD_STORE_OP_NONE_SPEC_VERSION 1 -#define VK_EXT_LOAD_STORE_OP_NONE_EXTENSION_NAME "VK_EXT_load_store_op_none" - +// VK_EXT_shader_tile_image is a preprocessor guard. Do not pass it to API calls. +#define VK_EXT_shader_tile_image 1 +#define VK_EXT_SHADER_TILE_IMAGE_SPEC_VERSION 1 +#define VK_EXT_SHADER_TILE_IMAGE_EXTENSION_NAME "VK_EXT_shader_tile_image" +typedef struct VkPhysicalDeviceShaderTileImageFeaturesEXT { + VkStructureType sType; + void* pNext; + VkBool32 shaderTileImageColorReadAccess; + VkBool32 shaderTileImageDepthReadAccess; + VkBool32 shaderTileImageStencilReadAccess; +} VkPhysicalDeviceShaderTileImageFeaturesEXT; -#define VK_EXT_border_color_swizzle 1 -#define VK_EXT_BORDER_COLOR_SWIZZLE_SPEC_VERSION 1 -#define VK_EXT_BORDER_COLOR_SWIZZLE_EXTENSION_NAME "VK_EXT_border_color_swizzle" -typedef struct VkPhysicalDeviceBorderColorSwizzleFeaturesEXT { +typedef struct VkPhysicalDeviceShaderTileImagePropertiesEXT { VkStructureType sType; void* pNext; - VkBool32 borderColorSwizzle; - VkBool32 borderColorSwizzleFromImage; -} VkPhysicalDeviceBorderColorSwizzleFeaturesEXT; + VkBool32 shaderTileImageCoherentReadAccelerated; + VkBool32 shaderTileImageReadSampleFromPixelRateInvocation; + VkBool32 shaderTileImageReadFromHelperInvocation; +} VkPhysicalDeviceShaderTileImagePropertiesEXT; -typedef struct VkSamplerBorderColorComponentMappingCreateInfoEXT { - VkStructureType sType; - const void* pNext; - VkComponentMapping components; - VkBool32 srgb; -} VkSamplerBorderColorComponentMappingCreateInfoEXT; +// VK_EXT_opacity_micromap is a preprocessor guard. Do not pass it to API calls. +#define VK_EXT_opacity_micromap 1 +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkMicromapEXT) +#define VK_EXT_OPACITY_MICROMAP_SPEC_VERSION 2 +#define VK_EXT_OPACITY_MICROMAP_EXTENSION_NAME "VK_EXT_opacity_micromap" -#define VK_EXT_pageable_device_local_memory 1 -#define VK_EXT_PAGEABLE_DEVICE_LOCAL_MEMORY_SPEC_VERSION 1 +typedef enum VkMicromapTypeEXT { + VK_MICROMAP_TYPE_OPACITY_MICROMAP_EXT = 0, +#ifdef VK_ENABLE_BETA_EXTENSIONS + VK_MICROMAP_TYPE_DISPLACEMENT_MICROMAP_NV = 1000397000, +#endif + VK_MICROMAP_TYPE_MAX_ENUM_EXT = 0x7FFFFFFF +} VkMicromapTypeEXT; + +typedef enum VkBuildMicromapModeEXT { + VK_BUILD_MICROMAP_MODE_BUILD_EXT = 0, + VK_BUILD_MICROMAP_MODE_MAX_ENUM_EXT = 0x7FFFFFFF +} VkBuildMicromapModeEXT; + +typedef enum VkCopyMicromapModeEXT { + VK_COPY_MICROMAP_MODE_CLONE_EXT = 0, + VK_COPY_MICROMAP_MODE_SERIALIZE_EXT = 1, + VK_COPY_MICROMAP_MODE_DESERIALIZE_EXT = 2, + VK_COPY_MICROMAP_MODE_COMPACT_EXT = 3, + VK_COPY_MICROMAP_MODE_MAX_ENUM_EXT = 0x7FFFFFFF +} VkCopyMicromapModeEXT; + +typedef enum VkOpacityMicromapFormatEXT { + VK_OPACITY_MICROMAP_FORMAT_2_STATE_EXT = 1, + VK_OPACITY_MICROMAP_FORMAT_4_STATE_EXT = 2, + VK_OPACITY_MICROMAP_FORMAT_MAX_ENUM_EXT = 0x7FFFFFFF +} VkOpacityMicromapFormatEXT; + +typedef enum VkOpacityMicromapSpecialIndexEXT { + VK_OPACITY_MICROMAP_SPECIAL_INDEX_FULLY_TRANSPARENT_EXT = -1, + VK_OPACITY_MICROMAP_SPECIAL_INDEX_FULLY_OPAQUE_EXT = -2, + VK_OPACITY_MICROMAP_SPECIAL_INDEX_FULLY_UNKNOWN_TRANSPARENT_EXT = -3, + VK_OPACITY_MICROMAP_SPECIAL_INDEX_FULLY_UNKNOWN_OPAQUE_EXT = -4, + VK_OPACITY_MICROMAP_SPECIAL_INDEX_MAX_ENUM_EXT = 0x7FFFFFFF +} VkOpacityMicromapSpecialIndexEXT; + +typedef enum VkAccelerationStructureCompatibilityKHR { + VK_ACCELERATION_STRUCTURE_COMPATIBILITY_COMPATIBLE_KHR = 0, + VK_ACCELERATION_STRUCTURE_COMPATIBILITY_INCOMPATIBLE_KHR = 1, + VK_ACCELERATION_STRUCTURE_COMPATIBILITY_MAX_ENUM_KHR = 0x7FFFFFFF +} VkAccelerationStructureCompatibilityKHR; + +typedef enum VkAccelerationStructureBuildTypeKHR { + VK_ACCELERATION_STRUCTURE_BUILD_TYPE_HOST_KHR = 0, + VK_ACCELERATION_STRUCTURE_BUILD_TYPE_DEVICE_KHR = 1, + VK_ACCELERATION_STRUCTURE_BUILD_TYPE_HOST_OR_DEVICE_KHR = 2, + VK_ACCELERATION_STRUCTURE_BUILD_TYPE_MAX_ENUM_KHR = 0x7FFFFFFF +} VkAccelerationStructureBuildTypeKHR; + +typedef enum VkBuildMicromapFlagBitsEXT { + VK_BUILD_MICROMAP_PREFER_FAST_TRACE_BIT_EXT = 0x00000001, + VK_BUILD_MICROMAP_PREFER_FAST_BUILD_BIT_EXT = 0x00000002, + VK_BUILD_MICROMAP_ALLOW_COMPACTION_BIT_EXT = 0x00000004, + VK_BUILD_MICROMAP_FLAG_BITS_MAX_ENUM_EXT = 0x7FFFFFFF +} VkBuildMicromapFlagBitsEXT; +typedef VkFlags VkBuildMicromapFlagsEXT; + +typedef enum VkMicromapCreateFlagBitsEXT { + VK_MICROMAP_CREATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT_EXT = 0x00000001, + VK_MICROMAP_CREATE_FLAG_BITS_MAX_ENUM_EXT = 0x7FFFFFFF +} VkMicromapCreateFlagBitsEXT; +typedef VkFlags VkMicromapCreateFlagsEXT; +typedef struct VkMicromapUsageEXT { + uint32_t count; + uint32_t subdivisionLevel; + uint32_t format; +} VkMicromapUsageEXT; + +typedef union VkDeviceOrHostAddressKHR { + VkDeviceAddress deviceAddress; + void* hostAddress; +} VkDeviceOrHostAddressKHR; + +typedef struct VkMicromapBuildInfoEXT { + VkStructureType sType; + const void* pNext; + VkMicromapTypeEXT type; + VkBuildMicromapFlagsEXT flags; + VkBuildMicromapModeEXT mode; + VkMicromapEXT dstMicromap; + uint32_t usageCountsCount; + const VkMicromapUsageEXT* pUsageCounts; + const VkMicromapUsageEXT* const* ppUsageCounts; + VkDeviceOrHostAddressConstKHR data; + VkDeviceOrHostAddressKHR scratchData; + VkDeviceOrHostAddressConstKHR triangleArray; + VkDeviceSize triangleArrayStride; +} VkMicromapBuildInfoEXT; + +typedef struct VkMicromapCreateInfoEXT { + VkStructureType sType; + const void* pNext; + VkMicromapCreateFlagsEXT createFlags; + VkBuffer buffer; + VkDeviceSize offset; + VkDeviceSize size; + VkMicromapTypeEXT type; + VkDeviceAddress deviceAddress; +} VkMicromapCreateInfoEXT; + +typedef struct VkPhysicalDeviceOpacityMicromapFeaturesEXT { + VkStructureType sType; + void* pNext; + VkBool32 micromap; + VkBool32 micromapCaptureReplay; + VkBool32 micromapHostCommands; +} VkPhysicalDeviceOpacityMicromapFeaturesEXT; + +typedef struct VkPhysicalDeviceOpacityMicromapPropertiesEXT { + VkStructureType sType; + void* pNext; + uint32_t maxOpacity2StateSubdivisionLevel; + uint32_t maxOpacity4StateSubdivisionLevel; +} VkPhysicalDeviceOpacityMicromapPropertiesEXT; + +typedef struct VkMicromapVersionInfoEXT { + VkStructureType sType; + const void* pNext; + const uint8_t* pVersionData; +} VkMicromapVersionInfoEXT; + +typedef struct VkCopyMicromapToMemoryInfoEXT { + VkStructureType sType; + const void* pNext; + VkMicromapEXT src; + VkDeviceOrHostAddressKHR dst; + VkCopyMicromapModeEXT mode; +} VkCopyMicromapToMemoryInfoEXT; + +typedef struct VkCopyMemoryToMicromapInfoEXT { + VkStructureType sType; + const void* pNext; + VkDeviceOrHostAddressConstKHR src; + VkMicromapEXT dst; + VkCopyMicromapModeEXT mode; +} VkCopyMemoryToMicromapInfoEXT; + +typedef struct VkCopyMicromapInfoEXT { + VkStructureType sType; + const void* pNext; + VkMicromapEXT src; + VkMicromapEXT dst; + VkCopyMicromapModeEXT mode; +} VkCopyMicromapInfoEXT; + +typedef struct VkMicromapBuildSizesInfoEXT { + VkStructureType sType; + const void* pNext; + VkDeviceSize micromapSize; + VkDeviceSize buildScratchSize; + VkBool32 discardable; +} VkMicromapBuildSizesInfoEXT; + +typedef struct VkAccelerationStructureTrianglesOpacityMicromapEXT { + VkStructureType sType; + void* pNext; + VkIndexType indexType; + VkDeviceOrHostAddressConstKHR indexBuffer; + VkDeviceSize indexStride; + uint32_t baseTriangle; + uint32_t usageCountsCount; + const VkMicromapUsageEXT* pUsageCounts; + const VkMicromapUsageEXT* const* ppUsageCounts; + VkMicromapEXT micromap; +} VkAccelerationStructureTrianglesOpacityMicromapEXT; + +typedef struct VkMicromapTriangleEXT { + uint32_t dataOffset; + uint16_t subdivisionLevel; + uint16_t format; +} VkMicromapTriangleEXT; + +typedef VkResult (VKAPI_PTR *PFN_vkCreateMicromapEXT)(VkDevice device, const VkMicromapCreateInfoEXT* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkMicromapEXT* pMicromap); +typedef void (VKAPI_PTR *PFN_vkDestroyMicromapEXT)(VkDevice device, VkMicromapEXT micromap, const VkAllocationCallbacks* pAllocator); +typedef void (VKAPI_PTR *PFN_vkCmdBuildMicromapsEXT)(VkCommandBuffer commandBuffer, uint32_t infoCount, const VkMicromapBuildInfoEXT* pInfos); +typedef VkResult (VKAPI_PTR *PFN_vkBuildMicromapsEXT)(VkDevice device, VkDeferredOperationKHR deferredOperation, uint32_t infoCount, const VkMicromapBuildInfoEXT* pInfos); +typedef VkResult (VKAPI_PTR *PFN_vkCopyMicromapEXT)(VkDevice device, VkDeferredOperationKHR deferredOperation, const VkCopyMicromapInfoEXT* pInfo); +typedef VkResult (VKAPI_PTR *PFN_vkCopyMicromapToMemoryEXT)(VkDevice device, VkDeferredOperationKHR deferredOperation, const VkCopyMicromapToMemoryInfoEXT* pInfo); +typedef VkResult (VKAPI_PTR *PFN_vkCopyMemoryToMicromapEXT)(VkDevice device, VkDeferredOperationKHR deferredOperation, const VkCopyMemoryToMicromapInfoEXT* pInfo); +typedef VkResult (VKAPI_PTR *PFN_vkWriteMicromapsPropertiesEXT)(VkDevice device, uint32_t micromapCount, const VkMicromapEXT* pMicromaps, VkQueryType queryType, size_t dataSize, void* pData, size_t stride); +typedef void (VKAPI_PTR *PFN_vkCmdCopyMicromapEXT)(VkCommandBuffer commandBuffer, const VkCopyMicromapInfoEXT* pInfo); +typedef void (VKAPI_PTR *PFN_vkCmdCopyMicromapToMemoryEXT)(VkCommandBuffer commandBuffer, const VkCopyMicromapToMemoryInfoEXT* pInfo); +typedef void (VKAPI_PTR *PFN_vkCmdCopyMemoryToMicromapEXT)(VkCommandBuffer commandBuffer, const VkCopyMemoryToMicromapInfoEXT* pInfo); +typedef void (VKAPI_PTR *PFN_vkCmdWriteMicromapsPropertiesEXT)(VkCommandBuffer commandBuffer, uint32_t micromapCount, const VkMicromapEXT* pMicromaps, VkQueryType queryType, VkQueryPool queryPool, uint32_t firstQuery); +typedef void (VKAPI_PTR *PFN_vkGetDeviceMicromapCompatibilityEXT)(VkDevice device, const VkMicromapVersionInfoEXT* pVersionInfo, VkAccelerationStructureCompatibilityKHR* pCompatibility); +typedef void (VKAPI_PTR *PFN_vkGetMicromapBuildSizesEXT)(VkDevice device, VkAccelerationStructureBuildTypeKHR buildType, const VkMicromapBuildInfoEXT* pBuildInfo, VkMicromapBuildSizesInfoEXT* pSizeInfo); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkCreateMicromapEXT( + VkDevice device, + const VkMicromapCreateInfoEXT* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkMicromapEXT* pMicromap); + +VKAPI_ATTR void VKAPI_CALL vkDestroyMicromapEXT( + VkDevice device, + VkMicromapEXT micromap, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR void VKAPI_CALL vkCmdBuildMicromapsEXT( + VkCommandBuffer commandBuffer, + uint32_t infoCount, + const VkMicromapBuildInfoEXT* pInfos); + +VKAPI_ATTR VkResult VKAPI_CALL vkBuildMicromapsEXT( + VkDevice device, + VkDeferredOperationKHR deferredOperation, + uint32_t infoCount, + const VkMicromapBuildInfoEXT* pInfos); + +VKAPI_ATTR VkResult VKAPI_CALL vkCopyMicromapEXT( + VkDevice device, + VkDeferredOperationKHR deferredOperation, + const VkCopyMicromapInfoEXT* pInfo); + +VKAPI_ATTR VkResult VKAPI_CALL vkCopyMicromapToMemoryEXT( + VkDevice device, + VkDeferredOperationKHR deferredOperation, + const VkCopyMicromapToMemoryInfoEXT* pInfo); + +VKAPI_ATTR VkResult VKAPI_CALL vkCopyMemoryToMicromapEXT( + VkDevice device, + VkDeferredOperationKHR deferredOperation, + const VkCopyMemoryToMicromapInfoEXT* pInfo); + +VKAPI_ATTR VkResult VKAPI_CALL vkWriteMicromapsPropertiesEXT( + VkDevice device, + uint32_t micromapCount, + const VkMicromapEXT* pMicromaps, + VkQueryType queryType, + size_t dataSize, + void* pData, + size_t stride); + +VKAPI_ATTR void VKAPI_CALL vkCmdCopyMicromapEXT( + VkCommandBuffer commandBuffer, + const VkCopyMicromapInfoEXT* pInfo); + +VKAPI_ATTR void VKAPI_CALL vkCmdCopyMicromapToMemoryEXT( + VkCommandBuffer commandBuffer, + const VkCopyMicromapToMemoryInfoEXT* pInfo); + +VKAPI_ATTR void VKAPI_CALL vkCmdCopyMemoryToMicromapEXT( + VkCommandBuffer commandBuffer, + const VkCopyMemoryToMicromapInfoEXT* pInfo); + +VKAPI_ATTR void VKAPI_CALL vkCmdWriteMicromapsPropertiesEXT( + VkCommandBuffer commandBuffer, + uint32_t micromapCount, + const VkMicromapEXT* pMicromaps, + VkQueryType queryType, + VkQueryPool queryPool, + uint32_t firstQuery); + +VKAPI_ATTR void VKAPI_CALL vkGetDeviceMicromapCompatibilityEXT( + VkDevice device, + const VkMicromapVersionInfoEXT* pVersionInfo, + VkAccelerationStructureCompatibilityKHR* pCompatibility); + +VKAPI_ATTR void VKAPI_CALL vkGetMicromapBuildSizesEXT( + VkDevice device, + VkAccelerationStructureBuildTypeKHR buildType, + const VkMicromapBuildInfoEXT* pBuildInfo, + VkMicromapBuildSizesInfoEXT* pSizeInfo); +#endif + + +// VK_EXT_load_store_op_none is a preprocessor guard. Do not pass it to API calls. +#define VK_EXT_load_store_op_none 1 +#define VK_EXT_LOAD_STORE_OP_NONE_SPEC_VERSION 1 +#define VK_EXT_LOAD_STORE_OP_NONE_EXTENSION_NAME "VK_EXT_load_store_op_none" + + +// VK_HUAWEI_cluster_culling_shader is a preprocessor guard. Do not pass it to API calls. +#define VK_HUAWEI_cluster_culling_shader 1 +#define VK_HUAWEI_CLUSTER_CULLING_SHADER_SPEC_VERSION 3 +#define VK_HUAWEI_CLUSTER_CULLING_SHADER_EXTENSION_NAME "VK_HUAWEI_cluster_culling_shader" +typedef struct VkPhysicalDeviceClusterCullingShaderFeaturesHUAWEI { + VkStructureType sType; + void* pNext; + VkBool32 clustercullingShader; + VkBool32 multiviewClusterCullingShader; +} VkPhysicalDeviceClusterCullingShaderFeaturesHUAWEI; + +typedef struct VkPhysicalDeviceClusterCullingShaderPropertiesHUAWEI { + VkStructureType sType; + void* pNext; + uint32_t maxWorkGroupCount[3]; + uint32_t maxWorkGroupSize[3]; + uint32_t maxOutputClusterCount; + VkDeviceSize indirectBufferOffsetAlignment; +} VkPhysicalDeviceClusterCullingShaderPropertiesHUAWEI; + +typedef struct VkPhysicalDeviceClusterCullingShaderVrsFeaturesHUAWEI { + VkStructureType sType; + void* pNext; + VkBool32 clusterShadingRate; +} VkPhysicalDeviceClusterCullingShaderVrsFeaturesHUAWEI; + +typedef void (VKAPI_PTR *PFN_vkCmdDrawClusterHUAWEI)(VkCommandBuffer commandBuffer, uint32_t groupCountX, uint32_t groupCountY, uint32_t groupCountZ); +typedef void (VKAPI_PTR *PFN_vkCmdDrawClusterIndirectHUAWEI)(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR void VKAPI_CALL vkCmdDrawClusterHUAWEI( + VkCommandBuffer commandBuffer, + uint32_t groupCountX, + uint32_t groupCountY, + uint32_t groupCountZ); + +VKAPI_ATTR void VKAPI_CALL vkCmdDrawClusterIndirectHUAWEI( + VkCommandBuffer commandBuffer, + VkBuffer buffer, + VkDeviceSize offset); +#endif + + +// VK_EXT_border_color_swizzle is a preprocessor guard. Do not pass it to API calls. +#define VK_EXT_border_color_swizzle 1 +#define VK_EXT_BORDER_COLOR_SWIZZLE_SPEC_VERSION 1 +#define VK_EXT_BORDER_COLOR_SWIZZLE_EXTENSION_NAME "VK_EXT_border_color_swizzle" +typedef struct VkPhysicalDeviceBorderColorSwizzleFeaturesEXT { + VkStructureType sType; + void* pNext; + VkBool32 borderColorSwizzle; + VkBool32 borderColorSwizzleFromImage; +} VkPhysicalDeviceBorderColorSwizzleFeaturesEXT; + +typedef struct VkSamplerBorderColorComponentMappingCreateInfoEXT { + VkStructureType sType; + const void* pNext; + VkComponentMapping components; + VkBool32 srgb; +} VkSamplerBorderColorComponentMappingCreateInfoEXT; + + + +// VK_EXT_pageable_device_local_memory is a preprocessor guard. Do not pass it to API calls. +#define VK_EXT_pageable_device_local_memory 1 +#define VK_EXT_PAGEABLE_DEVICE_LOCAL_MEMORY_SPEC_VERSION 1 #define VK_EXT_PAGEABLE_DEVICE_LOCAL_MEMORY_EXTENSION_NAME "VK_EXT_pageable_device_local_memory" typedef struct VkPhysicalDevicePageableDeviceLocalMemoryFeaturesEXT { VkStructureType sType; @@ -14279,6 +17269,71 @@ VKAPI_ATTR void VKAPI_CALL vkSetDeviceMemoryPriorityEXT( #endif +// VK_ARM_shader_core_properties is a preprocessor guard. Do not pass it to API calls. +#define VK_ARM_shader_core_properties 1 +#define VK_ARM_SHADER_CORE_PROPERTIES_SPEC_VERSION 1 +#define VK_ARM_SHADER_CORE_PROPERTIES_EXTENSION_NAME "VK_ARM_shader_core_properties" +typedef struct VkPhysicalDeviceShaderCorePropertiesARM { + VkStructureType sType; + void* pNext; + uint32_t pixelRate; + uint32_t texelRate; + uint32_t fmaRate; +} VkPhysicalDeviceShaderCorePropertiesARM; + + + +// VK_ARM_scheduling_controls is a preprocessor guard. Do not pass it to API calls. +#define VK_ARM_scheduling_controls 1 +#define VK_ARM_SCHEDULING_CONTROLS_SPEC_VERSION 1 +#define VK_ARM_SCHEDULING_CONTROLS_EXTENSION_NAME "VK_ARM_scheduling_controls" +typedef VkFlags64 VkPhysicalDeviceSchedulingControlsFlagsARM; + +// Flag bits for VkPhysicalDeviceSchedulingControlsFlagBitsARM +typedef VkFlags64 VkPhysicalDeviceSchedulingControlsFlagBitsARM; +static const VkPhysicalDeviceSchedulingControlsFlagBitsARM VK_PHYSICAL_DEVICE_SCHEDULING_CONTROLS_SHADER_CORE_COUNT_ARM = 0x00000001ULL; + +typedef struct VkDeviceQueueShaderCoreControlCreateInfoARM { + VkStructureType sType; + void* pNext; + uint32_t shaderCoreCount; +} VkDeviceQueueShaderCoreControlCreateInfoARM; + +typedef struct VkPhysicalDeviceSchedulingControlsFeaturesARM { + VkStructureType sType; + void* pNext; + VkBool32 schedulingControls; +} VkPhysicalDeviceSchedulingControlsFeaturesARM; + +typedef struct VkPhysicalDeviceSchedulingControlsPropertiesARM { + VkStructureType sType; + void* pNext; + VkPhysicalDeviceSchedulingControlsFlagsARM schedulingControlsFlags; +} VkPhysicalDeviceSchedulingControlsPropertiesARM; + + + +// VK_EXT_image_sliced_view_of_3d is a preprocessor guard. Do not pass it to API calls. +#define VK_EXT_image_sliced_view_of_3d 1 +#define VK_EXT_IMAGE_SLICED_VIEW_OF_3D_SPEC_VERSION 1 +#define VK_EXT_IMAGE_SLICED_VIEW_OF_3D_EXTENSION_NAME "VK_EXT_image_sliced_view_of_3d" +#define VK_REMAINING_3D_SLICES_EXT (~0U) +typedef struct VkPhysicalDeviceImageSlicedViewOf3DFeaturesEXT { + VkStructureType sType; + void* pNext; + VkBool32 imageSlicedViewOf3D; +} VkPhysicalDeviceImageSlicedViewOf3DFeaturesEXT; + +typedef struct VkImageViewSlicedCreateInfoEXT { + VkStructureType sType; + const void* pNext; + uint32_t sliceOffset; + uint32_t sliceCount; +} VkImageViewSlicedCreateInfoEXT; + + + +// VK_VALVE_descriptor_set_host_mapping is a preprocessor guard. Do not pass it to API calls. #define VK_VALVE_descriptor_set_host_mapping 1 #define VK_VALVE_DESCRIPTOR_SET_HOST_MAPPING_SPEC_VERSION 1 #define VK_VALVE_DESCRIPTOR_SET_HOST_MAPPING_EXTENSION_NAME "VK_VALVE_descriptor_set_host_mapping" @@ -14318,6 +17373,7 @@ VKAPI_ATTR void VKAPI_CALL vkGetDescriptorSetHostMappingVALVE( #endif +// VK_EXT_depth_clamp_zero_one is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_depth_clamp_zero_one 1 #define VK_EXT_DEPTH_CLAMP_ZERO_ONE_SPEC_VERSION 1 #define VK_EXT_DEPTH_CLAMP_ZERO_ONE_EXTENSION_NAME "VK_EXT_depth_clamp_zero_one" @@ -14329,6 +17385,7 @@ typedef struct VkPhysicalDeviceDepthClampZeroOneFeaturesEXT { +// VK_EXT_non_seamless_cube_map is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_non_seamless_cube_map 1 #define VK_EXT_NON_SEAMLESS_CUBE_MAP_SPEC_VERSION 1 #define VK_EXT_NON_SEAMLESS_CUBE_MAP_EXTENSION_NAME "VK_EXT_non_seamless_cube_map" @@ -14340,6 +17397,46 @@ typedef struct VkPhysicalDeviceNonSeamlessCubeMapFeaturesEXT { +// VK_ARM_render_pass_striped is a preprocessor guard. Do not pass it to API calls. +#define VK_ARM_render_pass_striped 1 +#define VK_ARM_RENDER_PASS_STRIPED_SPEC_VERSION 1 +#define VK_ARM_RENDER_PASS_STRIPED_EXTENSION_NAME "VK_ARM_render_pass_striped" +typedef struct VkPhysicalDeviceRenderPassStripedFeaturesARM { + VkStructureType sType; + void* pNext; + VkBool32 renderPassStriped; +} VkPhysicalDeviceRenderPassStripedFeaturesARM; + +typedef struct VkPhysicalDeviceRenderPassStripedPropertiesARM { + VkStructureType sType; + void* pNext; + VkExtent2D renderPassStripeGranularity; + uint32_t maxRenderPassStripes; +} VkPhysicalDeviceRenderPassStripedPropertiesARM; + +typedef struct VkRenderPassStripeInfoARM { + VkStructureType sType; + const void* pNext; + VkRect2D stripeArea; +} VkRenderPassStripeInfoARM; + +typedef struct VkRenderPassStripeBeginInfoARM { + VkStructureType sType; + const void* pNext; + uint32_t stripeInfoCount; + const VkRenderPassStripeInfoARM* pStripeInfos; +} VkRenderPassStripeBeginInfoARM; + +typedef struct VkRenderPassStripeSubmitInfoARM { + VkStructureType sType; + const void* pNext; + uint32_t stripeSemaphoreInfoCount; + const VkSemaphoreSubmitInfo* pStripeSemaphoreInfos; +} VkRenderPassStripeSubmitInfoARM; + + + +// VK_QCOM_fragment_density_map_offset is a preprocessor guard. Do not pass it to API calls. #define VK_QCOM_fragment_density_map_offset 1 #define VK_QCOM_FRAGMENT_DENSITY_MAP_OFFSET_SPEC_VERSION 1 #define VK_QCOM_FRAGMENT_DENSITY_MAP_OFFSET_EXTENSION_NAME "VK_QCOM_fragment_density_map_offset" @@ -14364,6 +17461,159 @@ typedef struct VkSubpassFragmentDensityMapOffsetEndInfoQCOM { +// VK_NV_copy_memory_indirect is a preprocessor guard. Do not pass it to API calls. +#define VK_NV_copy_memory_indirect 1 +#define VK_NV_COPY_MEMORY_INDIRECT_SPEC_VERSION 1 +#define VK_NV_COPY_MEMORY_INDIRECT_EXTENSION_NAME "VK_NV_copy_memory_indirect" +typedef struct VkCopyMemoryIndirectCommandNV { + VkDeviceAddress srcAddress; + VkDeviceAddress dstAddress; + VkDeviceSize size; +} VkCopyMemoryIndirectCommandNV; + +typedef struct VkCopyMemoryToImageIndirectCommandNV { + VkDeviceAddress srcAddress; + uint32_t bufferRowLength; + uint32_t bufferImageHeight; + VkImageSubresourceLayers imageSubresource; + VkOffset3D imageOffset; + VkExtent3D imageExtent; +} VkCopyMemoryToImageIndirectCommandNV; + +typedef struct VkPhysicalDeviceCopyMemoryIndirectFeaturesNV { + VkStructureType sType; + void* pNext; + VkBool32 indirectCopy; +} VkPhysicalDeviceCopyMemoryIndirectFeaturesNV; + +typedef struct VkPhysicalDeviceCopyMemoryIndirectPropertiesNV { + VkStructureType sType; + void* pNext; + VkQueueFlags supportedQueues; +} VkPhysicalDeviceCopyMemoryIndirectPropertiesNV; + +typedef void (VKAPI_PTR *PFN_vkCmdCopyMemoryIndirectNV)(VkCommandBuffer commandBuffer, VkDeviceAddress copyBufferAddress, uint32_t copyCount, uint32_t stride); +typedef void (VKAPI_PTR *PFN_vkCmdCopyMemoryToImageIndirectNV)(VkCommandBuffer commandBuffer, VkDeviceAddress copyBufferAddress, uint32_t copyCount, uint32_t stride, VkImage dstImage, VkImageLayout dstImageLayout, const VkImageSubresourceLayers* pImageSubresources); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR void VKAPI_CALL vkCmdCopyMemoryIndirectNV( + VkCommandBuffer commandBuffer, + VkDeviceAddress copyBufferAddress, + uint32_t copyCount, + uint32_t stride); + +VKAPI_ATTR void VKAPI_CALL vkCmdCopyMemoryToImageIndirectNV( + VkCommandBuffer commandBuffer, + VkDeviceAddress copyBufferAddress, + uint32_t copyCount, + uint32_t stride, + VkImage dstImage, + VkImageLayout dstImageLayout, + const VkImageSubresourceLayers* pImageSubresources); +#endif + + +// VK_NV_memory_decompression is a preprocessor guard. Do not pass it to API calls. +#define VK_NV_memory_decompression 1 +#define VK_NV_MEMORY_DECOMPRESSION_SPEC_VERSION 1 +#define VK_NV_MEMORY_DECOMPRESSION_EXTENSION_NAME "VK_NV_memory_decompression" + +// Flag bits for VkMemoryDecompressionMethodFlagBitsNV +typedef VkFlags64 VkMemoryDecompressionMethodFlagBitsNV; +static const VkMemoryDecompressionMethodFlagBitsNV VK_MEMORY_DECOMPRESSION_METHOD_GDEFLATE_1_0_BIT_NV = 0x00000001ULL; + +typedef VkFlags64 VkMemoryDecompressionMethodFlagsNV; +typedef struct VkDecompressMemoryRegionNV { + VkDeviceAddress srcAddress; + VkDeviceAddress dstAddress; + VkDeviceSize compressedSize; + VkDeviceSize decompressedSize; + VkMemoryDecompressionMethodFlagsNV decompressionMethod; +} VkDecompressMemoryRegionNV; + +typedef struct VkPhysicalDeviceMemoryDecompressionFeaturesNV { + VkStructureType sType; + void* pNext; + VkBool32 memoryDecompression; +} VkPhysicalDeviceMemoryDecompressionFeaturesNV; + +typedef struct VkPhysicalDeviceMemoryDecompressionPropertiesNV { + VkStructureType sType; + void* pNext; + VkMemoryDecompressionMethodFlagsNV decompressionMethods; + uint64_t maxDecompressionIndirectCount; +} VkPhysicalDeviceMemoryDecompressionPropertiesNV; + +typedef void (VKAPI_PTR *PFN_vkCmdDecompressMemoryNV)(VkCommandBuffer commandBuffer, uint32_t decompressRegionCount, const VkDecompressMemoryRegionNV* pDecompressMemoryRegions); +typedef void (VKAPI_PTR *PFN_vkCmdDecompressMemoryIndirectCountNV)(VkCommandBuffer commandBuffer, VkDeviceAddress indirectCommandsAddress, VkDeviceAddress indirectCommandsCountAddress, uint32_t stride); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR void VKAPI_CALL vkCmdDecompressMemoryNV( + VkCommandBuffer commandBuffer, + uint32_t decompressRegionCount, + const VkDecompressMemoryRegionNV* pDecompressMemoryRegions); + +VKAPI_ATTR void VKAPI_CALL vkCmdDecompressMemoryIndirectCountNV( + VkCommandBuffer commandBuffer, + VkDeviceAddress indirectCommandsAddress, + VkDeviceAddress indirectCommandsCountAddress, + uint32_t stride); +#endif + + +// VK_NV_device_generated_commands_compute is a preprocessor guard. Do not pass it to API calls. +#define VK_NV_device_generated_commands_compute 1 +#define VK_NV_DEVICE_GENERATED_COMMANDS_COMPUTE_SPEC_VERSION 2 +#define VK_NV_DEVICE_GENERATED_COMMANDS_COMPUTE_EXTENSION_NAME "VK_NV_device_generated_commands_compute" +typedef struct VkPhysicalDeviceDeviceGeneratedCommandsComputeFeaturesNV { + VkStructureType sType; + void* pNext; + VkBool32 deviceGeneratedCompute; + VkBool32 deviceGeneratedComputePipelines; + VkBool32 deviceGeneratedComputeCaptureReplay; +} VkPhysicalDeviceDeviceGeneratedCommandsComputeFeaturesNV; + +typedef struct VkComputePipelineIndirectBufferInfoNV { + VkStructureType sType; + const void* pNext; + VkDeviceAddress deviceAddress; + VkDeviceSize size; + VkDeviceAddress pipelineDeviceAddressCaptureReplay; +} VkComputePipelineIndirectBufferInfoNV; + +typedef struct VkPipelineIndirectDeviceAddressInfoNV { + VkStructureType sType; + const void* pNext; + VkPipelineBindPoint pipelineBindPoint; + VkPipeline pipeline; +} VkPipelineIndirectDeviceAddressInfoNV; + +typedef struct VkBindPipelineIndirectCommandNV { + VkDeviceAddress pipelineAddress; +} VkBindPipelineIndirectCommandNV; + +typedef void (VKAPI_PTR *PFN_vkGetPipelineIndirectMemoryRequirementsNV)(VkDevice device, const VkComputePipelineCreateInfo* pCreateInfo, VkMemoryRequirements2* pMemoryRequirements); +typedef void (VKAPI_PTR *PFN_vkCmdUpdatePipelineIndirectBufferNV)(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipeline pipeline); +typedef VkDeviceAddress (VKAPI_PTR *PFN_vkGetPipelineIndirectDeviceAddressNV)(VkDevice device, const VkPipelineIndirectDeviceAddressInfoNV* pInfo); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR void VKAPI_CALL vkGetPipelineIndirectMemoryRequirementsNV( + VkDevice device, + const VkComputePipelineCreateInfo* pCreateInfo, + VkMemoryRequirements2* pMemoryRequirements); + +VKAPI_ATTR void VKAPI_CALL vkCmdUpdatePipelineIndirectBufferNV( + VkCommandBuffer commandBuffer, + VkPipelineBindPoint pipelineBindPoint, + VkPipeline pipeline); + +VKAPI_ATTR VkDeviceAddress VKAPI_CALL vkGetPipelineIndirectDeviceAddressNV( + VkDevice device, + const VkPipelineIndirectDeviceAddressInfoNV* pInfo); +#endif + + +// VK_NV_linear_color_attachment is a preprocessor guard. Do not pass it to API calls. #define VK_NV_linear_color_attachment 1 #define VK_NV_LINEAR_COLOR_ATTACHMENT_SPEC_VERSION 1 #define VK_NV_LINEAR_COLOR_ATTACHMENT_EXTENSION_NAME "VK_NV_linear_color_attachment" @@ -14375,11 +17625,13 @@ typedef struct VkPhysicalDeviceLinearColorAttachmentFeaturesNV { +// VK_GOOGLE_surfaceless_query is a preprocessor guard. Do not pass it to API calls. #define VK_GOOGLE_surfaceless_query 1 -#define VK_GOOGLE_SURFACELESS_QUERY_SPEC_VERSION 1 +#define VK_GOOGLE_SURFACELESS_QUERY_SPEC_VERSION 2 #define VK_GOOGLE_SURFACELESS_QUERY_EXTENSION_NAME "VK_GOOGLE_surfaceless_query" +// VK_EXT_image_compression_control_swapchain is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_image_compression_control_swapchain 1 #define VK_EXT_IMAGE_COMPRESSION_CONTROL_SWAPCHAIN_SPEC_VERSION 1 #define VK_EXT_IMAGE_COMPRESSION_CONTROL_SWAPCHAIN_EXTENSION_NAME "VK_EXT_image_compression_control_swapchain" @@ -14391,6 +17643,7 @@ typedef struct VkPhysicalDeviceImageCompressionControlSwapchainFeaturesEXT { +// VK_QCOM_image_processing is a preprocessor guard. Do not pass it to API calls. #define VK_QCOM_image_processing 1 #define VK_QCOM_IMAGE_PROCESSING_SPEC_VERSION 1 #define VK_QCOM_IMAGE_PROCESSING_EXTENSION_NAME "VK_QCOM_image_processing" @@ -14421,6 +17674,273 @@ typedef struct VkPhysicalDeviceImageProcessingPropertiesQCOM { +// VK_EXT_nested_command_buffer is a preprocessor guard. Do not pass it to API calls. +#define VK_EXT_nested_command_buffer 1 +#define VK_EXT_NESTED_COMMAND_BUFFER_SPEC_VERSION 1 +#define VK_EXT_NESTED_COMMAND_BUFFER_EXTENSION_NAME "VK_EXT_nested_command_buffer" +typedef struct VkPhysicalDeviceNestedCommandBufferFeaturesEXT { + VkStructureType sType; + void* pNext; + VkBool32 nestedCommandBuffer; + VkBool32 nestedCommandBufferRendering; + VkBool32 nestedCommandBufferSimultaneousUse; +} VkPhysicalDeviceNestedCommandBufferFeaturesEXT; + +typedef struct VkPhysicalDeviceNestedCommandBufferPropertiesEXT { + VkStructureType sType; + void* pNext; + uint32_t maxCommandBufferNestingLevel; +} VkPhysicalDeviceNestedCommandBufferPropertiesEXT; + + + +// VK_EXT_external_memory_acquire_unmodified is a preprocessor guard. Do not pass it to API calls. +#define VK_EXT_external_memory_acquire_unmodified 1 +#define VK_EXT_EXTERNAL_MEMORY_ACQUIRE_UNMODIFIED_SPEC_VERSION 1 +#define VK_EXT_EXTERNAL_MEMORY_ACQUIRE_UNMODIFIED_EXTENSION_NAME "VK_EXT_external_memory_acquire_unmodified" +typedef struct VkExternalMemoryAcquireUnmodifiedEXT { + VkStructureType sType; + const void* pNext; + VkBool32 acquireUnmodifiedMemory; +} VkExternalMemoryAcquireUnmodifiedEXT; + + + +// VK_EXT_extended_dynamic_state3 is a preprocessor guard. Do not pass it to API calls. +#define VK_EXT_extended_dynamic_state3 1 +#define VK_EXT_EXTENDED_DYNAMIC_STATE_3_SPEC_VERSION 2 +#define VK_EXT_EXTENDED_DYNAMIC_STATE_3_EXTENSION_NAME "VK_EXT_extended_dynamic_state3" +typedef struct VkPhysicalDeviceExtendedDynamicState3FeaturesEXT { + VkStructureType sType; + void* pNext; + VkBool32 extendedDynamicState3TessellationDomainOrigin; + VkBool32 extendedDynamicState3DepthClampEnable; + VkBool32 extendedDynamicState3PolygonMode; + VkBool32 extendedDynamicState3RasterizationSamples; + VkBool32 extendedDynamicState3SampleMask; + VkBool32 extendedDynamicState3AlphaToCoverageEnable; + VkBool32 extendedDynamicState3AlphaToOneEnable; + VkBool32 extendedDynamicState3LogicOpEnable; + VkBool32 extendedDynamicState3ColorBlendEnable; + VkBool32 extendedDynamicState3ColorBlendEquation; + VkBool32 extendedDynamicState3ColorWriteMask; + VkBool32 extendedDynamicState3RasterizationStream; + VkBool32 extendedDynamicState3ConservativeRasterizationMode; + VkBool32 extendedDynamicState3ExtraPrimitiveOverestimationSize; + VkBool32 extendedDynamicState3DepthClipEnable; + VkBool32 extendedDynamicState3SampleLocationsEnable; + VkBool32 extendedDynamicState3ColorBlendAdvanced; + VkBool32 extendedDynamicState3ProvokingVertexMode; + VkBool32 extendedDynamicState3LineRasterizationMode; + VkBool32 extendedDynamicState3LineStippleEnable; + VkBool32 extendedDynamicState3DepthClipNegativeOneToOne; + VkBool32 extendedDynamicState3ViewportWScalingEnable; + VkBool32 extendedDynamicState3ViewportSwizzle; + VkBool32 extendedDynamicState3CoverageToColorEnable; + VkBool32 extendedDynamicState3CoverageToColorLocation; + VkBool32 extendedDynamicState3CoverageModulationMode; + VkBool32 extendedDynamicState3CoverageModulationTableEnable; + VkBool32 extendedDynamicState3CoverageModulationTable; + VkBool32 extendedDynamicState3CoverageReductionMode; + VkBool32 extendedDynamicState3RepresentativeFragmentTestEnable; + VkBool32 extendedDynamicState3ShadingRateImageEnable; +} VkPhysicalDeviceExtendedDynamicState3FeaturesEXT; + +typedef struct VkPhysicalDeviceExtendedDynamicState3PropertiesEXT { + VkStructureType sType; + void* pNext; + VkBool32 dynamicPrimitiveTopologyUnrestricted; +} VkPhysicalDeviceExtendedDynamicState3PropertiesEXT; + +typedef struct VkColorBlendEquationEXT { + VkBlendFactor srcColorBlendFactor; + VkBlendFactor dstColorBlendFactor; + VkBlendOp colorBlendOp; + VkBlendFactor srcAlphaBlendFactor; + VkBlendFactor dstAlphaBlendFactor; + VkBlendOp alphaBlendOp; +} VkColorBlendEquationEXT; + +typedef struct VkColorBlendAdvancedEXT { + VkBlendOp advancedBlendOp; + VkBool32 srcPremultiplied; + VkBool32 dstPremultiplied; + VkBlendOverlapEXT blendOverlap; + VkBool32 clampResults; +} VkColorBlendAdvancedEXT; + +typedef void (VKAPI_PTR *PFN_vkCmdSetTessellationDomainOriginEXT)(VkCommandBuffer commandBuffer, VkTessellationDomainOrigin domainOrigin); +typedef void (VKAPI_PTR *PFN_vkCmdSetDepthClampEnableEXT)(VkCommandBuffer commandBuffer, VkBool32 depthClampEnable); +typedef void (VKAPI_PTR *PFN_vkCmdSetPolygonModeEXT)(VkCommandBuffer commandBuffer, VkPolygonMode polygonMode); +typedef void (VKAPI_PTR *PFN_vkCmdSetRasterizationSamplesEXT)(VkCommandBuffer commandBuffer, VkSampleCountFlagBits rasterizationSamples); +typedef void (VKAPI_PTR *PFN_vkCmdSetSampleMaskEXT)(VkCommandBuffer commandBuffer, VkSampleCountFlagBits samples, const VkSampleMask* pSampleMask); +typedef void (VKAPI_PTR *PFN_vkCmdSetAlphaToCoverageEnableEXT)(VkCommandBuffer commandBuffer, VkBool32 alphaToCoverageEnable); +typedef void (VKAPI_PTR *PFN_vkCmdSetAlphaToOneEnableEXT)(VkCommandBuffer commandBuffer, VkBool32 alphaToOneEnable); +typedef void (VKAPI_PTR *PFN_vkCmdSetLogicOpEnableEXT)(VkCommandBuffer commandBuffer, VkBool32 logicOpEnable); +typedef void (VKAPI_PTR *PFN_vkCmdSetColorBlendEnableEXT)(VkCommandBuffer commandBuffer, uint32_t firstAttachment, uint32_t attachmentCount, const VkBool32* pColorBlendEnables); +typedef void (VKAPI_PTR *PFN_vkCmdSetColorBlendEquationEXT)(VkCommandBuffer commandBuffer, uint32_t firstAttachment, uint32_t attachmentCount, const VkColorBlendEquationEXT* pColorBlendEquations); +typedef void (VKAPI_PTR *PFN_vkCmdSetColorWriteMaskEXT)(VkCommandBuffer commandBuffer, uint32_t firstAttachment, uint32_t attachmentCount, const VkColorComponentFlags* pColorWriteMasks); +typedef void (VKAPI_PTR *PFN_vkCmdSetRasterizationStreamEXT)(VkCommandBuffer commandBuffer, uint32_t rasterizationStream); +typedef void (VKAPI_PTR *PFN_vkCmdSetConservativeRasterizationModeEXT)(VkCommandBuffer commandBuffer, VkConservativeRasterizationModeEXT conservativeRasterizationMode); +typedef void (VKAPI_PTR *PFN_vkCmdSetExtraPrimitiveOverestimationSizeEXT)(VkCommandBuffer commandBuffer, float extraPrimitiveOverestimationSize); +typedef void (VKAPI_PTR *PFN_vkCmdSetDepthClipEnableEXT)(VkCommandBuffer commandBuffer, VkBool32 depthClipEnable); +typedef void (VKAPI_PTR *PFN_vkCmdSetSampleLocationsEnableEXT)(VkCommandBuffer commandBuffer, VkBool32 sampleLocationsEnable); +typedef void (VKAPI_PTR *PFN_vkCmdSetColorBlendAdvancedEXT)(VkCommandBuffer commandBuffer, uint32_t firstAttachment, uint32_t attachmentCount, const VkColorBlendAdvancedEXT* pColorBlendAdvanced); +typedef void (VKAPI_PTR *PFN_vkCmdSetProvokingVertexModeEXT)(VkCommandBuffer commandBuffer, VkProvokingVertexModeEXT provokingVertexMode); +typedef void (VKAPI_PTR *PFN_vkCmdSetLineRasterizationModeEXT)(VkCommandBuffer commandBuffer, VkLineRasterizationModeEXT lineRasterizationMode); +typedef void (VKAPI_PTR *PFN_vkCmdSetLineStippleEnableEXT)(VkCommandBuffer commandBuffer, VkBool32 stippledLineEnable); +typedef void (VKAPI_PTR *PFN_vkCmdSetDepthClipNegativeOneToOneEXT)(VkCommandBuffer commandBuffer, VkBool32 negativeOneToOne); +typedef void (VKAPI_PTR *PFN_vkCmdSetViewportWScalingEnableNV)(VkCommandBuffer commandBuffer, VkBool32 viewportWScalingEnable); +typedef void (VKAPI_PTR *PFN_vkCmdSetViewportSwizzleNV)(VkCommandBuffer commandBuffer, uint32_t firstViewport, uint32_t viewportCount, const VkViewportSwizzleNV* pViewportSwizzles); +typedef void (VKAPI_PTR *PFN_vkCmdSetCoverageToColorEnableNV)(VkCommandBuffer commandBuffer, VkBool32 coverageToColorEnable); +typedef void (VKAPI_PTR *PFN_vkCmdSetCoverageToColorLocationNV)(VkCommandBuffer commandBuffer, uint32_t coverageToColorLocation); +typedef void (VKAPI_PTR *PFN_vkCmdSetCoverageModulationModeNV)(VkCommandBuffer commandBuffer, VkCoverageModulationModeNV coverageModulationMode); +typedef void (VKAPI_PTR *PFN_vkCmdSetCoverageModulationTableEnableNV)(VkCommandBuffer commandBuffer, VkBool32 coverageModulationTableEnable); +typedef void (VKAPI_PTR *PFN_vkCmdSetCoverageModulationTableNV)(VkCommandBuffer commandBuffer, uint32_t coverageModulationTableCount, const float* pCoverageModulationTable); +typedef void (VKAPI_PTR *PFN_vkCmdSetShadingRateImageEnableNV)(VkCommandBuffer commandBuffer, VkBool32 shadingRateImageEnable); +typedef void (VKAPI_PTR *PFN_vkCmdSetRepresentativeFragmentTestEnableNV)(VkCommandBuffer commandBuffer, VkBool32 representativeFragmentTestEnable); +typedef void (VKAPI_PTR *PFN_vkCmdSetCoverageReductionModeNV)(VkCommandBuffer commandBuffer, VkCoverageReductionModeNV coverageReductionMode); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR void VKAPI_CALL vkCmdSetTessellationDomainOriginEXT( + VkCommandBuffer commandBuffer, + VkTessellationDomainOrigin domainOrigin); + +VKAPI_ATTR void VKAPI_CALL vkCmdSetDepthClampEnableEXT( + VkCommandBuffer commandBuffer, + VkBool32 depthClampEnable); + +VKAPI_ATTR void VKAPI_CALL vkCmdSetPolygonModeEXT( + VkCommandBuffer commandBuffer, + VkPolygonMode polygonMode); + +VKAPI_ATTR void VKAPI_CALL vkCmdSetRasterizationSamplesEXT( + VkCommandBuffer commandBuffer, + VkSampleCountFlagBits rasterizationSamples); + +VKAPI_ATTR void VKAPI_CALL vkCmdSetSampleMaskEXT( + VkCommandBuffer commandBuffer, + VkSampleCountFlagBits samples, + const VkSampleMask* pSampleMask); + +VKAPI_ATTR void VKAPI_CALL vkCmdSetAlphaToCoverageEnableEXT( + VkCommandBuffer commandBuffer, + VkBool32 alphaToCoverageEnable); + +VKAPI_ATTR void VKAPI_CALL vkCmdSetAlphaToOneEnableEXT( + VkCommandBuffer commandBuffer, + VkBool32 alphaToOneEnable); + +VKAPI_ATTR void VKAPI_CALL vkCmdSetLogicOpEnableEXT( + VkCommandBuffer commandBuffer, + VkBool32 logicOpEnable); + +VKAPI_ATTR void VKAPI_CALL vkCmdSetColorBlendEnableEXT( + VkCommandBuffer commandBuffer, + uint32_t firstAttachment, + uint32_t attachmentCount, + const VkBool32* pColorBlendEnables); + +VKAPI_ATTR void VKAPI_CALL vkCmdSetColorBlendEquationEXT( + VkCommandBuffer commandBuffer, + uint32_t firstAttachment, + uint32_t attachmentCount, + const VkColorBlendEquationEXT* pColorBlendEquations); + +VKAPI_ATTR void VKAPI_CALL vkCmdSetColorWriteMaskEXT( + VkCommandBuffer commandBuffer, + uint32_t firstAttachment, + uint32_t attachmentCount, + const VkColorComponentFlags* pColorWriteMasks); + +VKAPI_ATTR void VKAPI_CALL vkCmdSetRasterizationStreamEXT( + VkCommandBuffer commandBuffer, + uint32_t rasterizationStream); + +VKAPI_ATTR void VKAPI_CALL vkCmdSetConservativeRasterizationModeEXT( + VkCommandBuffer commandBuffer, + VkConservativeRasterizationModeEXT conservativeRasterizationMode); + +VKAPI_ATTR void VKAPI_CALL vkCmdSetExtraPrimitiveOverestimationSizeEXT( + VkCommandBuffer commandBuffer, + float extraPrimitiveOverestimationSize); + +VKAPI_ATTR void VKAPI_CALL vkCmdSetDepthClipEnableEXT( + VkCommandBuffer commandBuffer, + VkBool32 depthClipEnable); + +VKAPI_ATTR void VKAPI_CALL vkCmdSetSampleLocationsEnableEXT( + VkCommandBuffer commandBuffer, + VkBool32 sampleLocationsEnable); + +VKAPI_ATTR void VKAPI_CALL vkCmdSetColorBlendAdvancedEXT( + VkCommandBuffer commandBuffer, + uint32_t firstAttachment, + uint32_t attachmentCount, + const VkColorBlendAdvancedEXT* pColorBlendAdvanced); + +VKAPI_ATTR void VKAPI_CALL vkCmdSetProvokingVertexModeEXT( + VkCommandBuffer commandBuffer, + VkProvokingVertexModeEXT provokingVertexMode); + +VKAPI_ATTR void VKAPI_CALL vkCmdSetLineRasterizationModeEXT( + VkCommandBuffer commandBuffer, + VkLineRasterizationModeEXT lineRasterizationMode); + +VKAPI_ATTR void VKAPI_CALL vkCmdSetLineStippleEnableEXT( + VkCommandBuffer commandBuffer, + VkBool32 stippledLineEnable); + +VKAPI_ATTR void VKAPI_CALL vkCmdSetDepthClipNegativeOneToOneEXT( + VkCommandBuffer commandBuffer, + VkBool32 negativeOneToOne); + +VKAPI_ATTR void VKAPI_CALL vkCmdSetViewportWScalingEnableNV( + VkCommandBuffer commandBuffer, + VkBool32 viewportWScalingEnable); + +VKAPI_ATTR void VKAPI_CALL vkCmdSetViewportSwizzleNV( + VkCommandBuffer commandBuffer, + uint32_t firstViewport, + uint32_t viewportCount, + const VkViewportSwizzleNV* pViewportSwizzles); + +VKAPI_ATTR void VKAPI_CALL vkCmdSetCoverageToColorEnableNV( + VkCommandBuffer commandBuffer, + VkBool32 coverageToColorEnable); + +VKAPI_ATTR void VKAPI_CALL vkCmdSetCoverageToColorLocationNV( + VkCommandBuffer commandBuffer, + uint32_t coverageToColorLocation); + +VKAPI_ATTR void VKAPI_CALL vkCmdSetCoverageModulationModeNV( + VkCommandBuffer commandBuffer, + VkCoverageModulationModeNV coverageModulationMode); + +VKAPI_ATTR void VKAPI_CALL vkCmdSetCoverageModulationTableEnableNV( + VkCommandBuffer commandBuffer, + VkBool32 coverageModulationTableEnable); + +VKAPI_ATTR void VKAPI_CALL vkCmdSetCoverageModulationTableNV( + VkCommandBuffer commandBuffer, + uint32_t coverageModulationTableCount, + const float* pCoverageModulationTable); + +VKAPI_ATTR void VKAPI_CALL vkCmdSetShadingRateImageEnableNV( + VkCommandBuffer commandBuffer, + VkBool32 shadingRateImageEnable); + +VKAPI_ATTR void VKAPI_CALL vkCmdSetRepresentativeFragmentTestEnableNV( + VkCommandBuffer commandBuffer, + VkBool32 representativeFragmentTestEnable); + +VKAPI_ATTR void VKAPI_CALL vkCmdSetCoverageReductionModeNV( + VkCommandBuffer commandBuffer, + VkCoverageReductionModeNV coverageReductionMode); +#endif + + +// VK_EXT_subpass_merge_feedback is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_subpass_merge_feedback 1 #define VK_EXT_SUBPASS_MERGE_FEEDBACK_SPEC_VERSION 2 #define VK_EXT_SUBPASS_MERGE_FEEDBACK_EXTENSION_NAME "VK_EXT_subpass_merge_feedback" @@ -14478,6 +17998,38 @@ typedef struct VkRenderPassSubpassFeedbackCreateInfoEXT { +// VK_LUNARG_direct_driver_loading is a preprocessor guard. Do not pass it to API calls. +#define VK_LUNARG_direct_driver_loading 1 +#define VK_LUNARG_DIRECT_DRIVER_LOADING_SPEC_VERSION 1 +#define VK_LUNARG_DIRECT_DRIVER_LOADING_EXTENSION_NAME "VK_LUNARG_direct_driver_loading" + +typedef enum VkDirectDriverLoadingModeLUNARG { + VK_DIRECT_DRIVER_LOADING_MODE_EXCLUSIVE_LUNARG = 0, + VK_DIRECT_DRIVER_LOADING_MODE_INCLUSIVE_LUNARG = 1, + VK_DIRECT_DRIVER_LOADING_MODE_MAX_ENUM_LUNARG = 0x7FFFFFFF +} VkDirectDriverLoadingModeLUNARG; +typedef VkFlags VkDirectDriverLoadingFlagsLUNARG; +typedef PFN_vkVoidFunction (VKAPI_PTR *PFN_vkGetInstanceProcAddrLUNARG)( + VkInstance instance, const char* pName); + +typedef struct VkDirectDriverLoadingInfoLUNARG { + VkStructureType sType; + void* pNext; + VkDirectDriverLoadingFlagsLUNARG flags; + PFN_vkGetInstanceProcAddrLUNARG pfnGetInstanceProcAddr; +} VkDirectDriverLoadingInfoLUNARG; + +typedef struct VkDirectDriverLoadingListLUNARG { + VkStructureType sType; + const void* pNext; + VkDirectDriverLoadingModeLUNARG mode; + uint32_t driverCount; + const VkDirectDriverLoadingInfoLUNARG* pDrivers; +} VkDirectDriverLoadingListLUNARG; + + + +// VK_EXT_shader_module_identifier is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_shader_module_identifier 1 #define VK_MAX_SHADER_MODULE_IDENTIFIER_SIZE_EXT 32U #define VK_EXT_SHADER_MODULE_IDENTIFIER_SPEC_VERSION 1 @@ -14524,11 +18076,178 @@ VKAPI_ATTR void VKAPI_CALL vkGetShaderModuleCreateInfoIdentifierEXT( #endif +// VK_EXT_rasterization_order_attachment_access is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_rasterization_order_attachment_access 1 #define VK_EXT_RASTERIZATION_ORDER_ATTACHMENT_ACCESS_SPEC_VERSION 1 #define VK_EXT_RASTERIZATION_ORDER_ATTACHMENT_ACCESS_EXTENSION_NAME "VK_EXT_rasterization_order_attachment_access" +// VK_NV_optical_flow is a preprocessor guard. Do not pass it to API calls. +#define VK_NV_optical_flow 1 +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkOpticalFlowSessionNV) +#define VK_NV_OPTICAL_FLOW_SPEC_VERSION 1 +#define VK_NV_OPTICAL_FLOW_EXTENSION_NAME "VK_NV_optical_flow" + +typedef enum VkOpticalFlowPerformanceLevelNV { + VK_OPTICAL_FLOW_PERFORMANCE_LEVEL_UNKNOWN_NV = 0, + VK_OPTICAL_FLOW_PERFORMANCE_LEVEL_SLOW_NV = 1, + VK_OPTICAL_FLOW_PERFORMANCE_LEVEL_MEDIUM_NV = 2, + VK_OPTICAL_FLOW_PERFORMANCE_LEVEL_FAST_NV = 3, + VK_OPTICAL_FLOW_PERFORMANCE_LEVEL_MAX_ENUM_NV = 0x7FFFFFFF +} VkOpticalFlowPerformanceLevelNV; + +typedef enum VkOpticalFlowSessionBindingPointNV { + VK_OPTICAL_FLOW_SESSION_BINDING_POINT_UNKNOWN_NV = 0, + VK_OPTICAL_FLOW_SESSION_BINDING_POINT_INPUT_NV = 1, + VK_OPTICAL_FLOW_SESSION_BINDING_POINT_REFERENCE_NV = 2, + VK_OPTICAL_FLOW_SESSION_BINDING_POINT_HINT_NV = 3, + VK_OPTICAL_FLOW_SESSION_BINDING_POINT_FLOW_VECTOR_NV = 4, + VK_OPTICAL_FLOW_SESSION_BINDING_POINT_BACKWARD_FLOW_VECTOR_NV = 5, + VK_OPTICAL_FLOW_SESSION_BINDING_POINT_COST_NV = 6, + VK_OPTICAL_FLOW_SESSION_BINDING_POINT_BACKWARD_COST_NV = 7, + VK_OPTICAL_FLOW_SESSION_BINDING_POINT_GLOBAL_FLOW_NV = 8, + VK_OPTICAL_FLOW_SESSION_BINDING_POINT_MAX_ENUM_NV = 0x7FFFFFFF +} VkOpticalFlowSessionBindingPointNV; + +typedef enum VkOpticalFlowGridSizeFlagBitsNV { + VK_OPTICAL_FLOW_GRID_SIZE_UNKNOWN_NV = 0, + VK_OPTICAL_FLOW_GRID_SIZE_1X1_BIT_NV = 0x00000001, + VK_OPTICAL_FLOW_GRID_SIZE_2X2_BIT_NV = 0x00000002, + VK_OPTICAL_FLOW_GRID_SIZE_4X4_BIT_NV = 0x00000004, + VK_OPTICAL_FLOW_GRID_SIZE_8X8_BIT_NV = 0x00000008, + VK_OPTICAL_FLOW_GRID_SIZE_FLAG_BITS_MAX_ENUM_NV = 0x7FFFFFFF +} VkOpticalFlowGridSizeFlagBitsNV; +typedef VkFlags VkOpticalFlowGridSizeFlagsNV; + +typedef enum VkOpticalFlowUsageFlagBitsNV { + VK_OPTICAL_FLOW_USAGE_UNKNOWN_NV = 0, + VK_OPTICAL_FLOW_USAGE_INPUT_BIT_NV = 0x00000001, + VK_OPTICAL_FLOW_USAGE_OUTPUT_BIT_NV = 0x00000002, + VK_OPTICAL_FLOW_USAGE_HINT_BIT_NV = 0x00000004, + VK_OPTICAL_FLOW_USAGE_COST_BIT_NV = 0x00000008, + VK_OPTICAL_FLOW_USAGE_GLOBAL_FLOW_BIT_NV = 0x00000010, + VK_OPTICAL_FLOW_USAGE_FLAG_BITS_MAX_ENUM_NV = 0x7FFFFFFF +} VkOpticalFlowUsageFlagBitsNV; +typedef VkFlags VkOpticalFlowUsageFlagsNV; + +typedef enum VkOpticalFlowSessionCreateFlagBitsNV { + VK_OPTICAL_FLOW_SESSION_CREATE_ENABLE_HINT_BIT_NV = 0x00000001, + VK_OPTICAL_FLOW_SESSION_CREATE_ENABLE_COST_BIT_NV = 0x00000002, + VK_OPTICAL_FLOW_SESSION_CREATE_ENABLE_GLOBAL_FLOW_BIT_NV = 0x00000004, + VK_OPTICAL_FLOW_SESSION_CREATE_ALLOW_REGIONS_BIT_NV = 0x00000008, + VK_OPTICAL_FLOW_SESSION_CREATE_BOTH_DIRECTIONS_BIT_NV = 0x00000010, + VK_OPTICAL_FLOW_SESSION_CREATE_FLAG_BITS_MAX_ENUM_NV = 0x7FFFFFFF +} VkOpticalFlowSessionCreateFlagBitsNV; +typedef VkFlags VkOpticalFlowSessionCreateFlagsNV; + +typedef enum VkOpticalFlowExecuteFlagBitsNV { + VK_OPTICAL_FLOW_EXECUTE_DISABLE_TEMPORAL_HINTS_BIT_NV = 0x00000001, + VK_OPTICAL_FLOW_EXECUTE_FLAG_BITS_MAX_ENUM_NV = 0x7FFFFFFF +} VkOpticalFlowExecuteFlagBitsNV; +typedef VkFlags VkOpticalFlowExecuteFlagsNV; +typedef struct VkPhysicalDeviceOpticalFlowFeaturesNV { + VkStructureType sType; + void* pNext; + VkBool32 opticalFlow; +} VkPhysicalDeviceOpticalFlowFeaturesNV; + +typedef struct VkPhysicalDeviceOpticalFlowPropertiesNV { + VkStructureType sType; + void* pNext; + VkOpticalFlowGridSizeFlagsNV supportedOutputGridSizes; + VkOpticalFlowGridSizeFlagsNV supportedHintGridSizes; + VkBool32 hintSupported; + VkBool32 costSupported; + VkBool32 bidirectionalFlowSupported; + VkBool32 globalFlowSupported; + uint32_t minWidth; + uint32_t minHeight; + uint32_t maxWidth; + uint32_t maxHeight; + uint32_t maxNumRegionsOfInterest; +} VkPhysicalDeviceOpticalFlowPropertiesNV; + +typedef struct VkOpticalFlowImageFormatInfoNV { + VkStructureType sType; + const void* pNext; + VkOpticalFlowUsageFlagsNV usage; +} VkOpticalFlowImageFormatInfoNV; + +typedef struct VkOpticalFlowImageFormatPropertiesNV { + VkStructureType sType; + const void* pNext; + VkFormat format; +} VkOpticalFlowImageFormatPropertiesNV; + +typedef struct VkOpticalFlowSessionCreateInfoNV { + VkStructureType sType; + void* pNext; + uint32_t width; + uint32_t height; + VkFormat imageFormat; + VkFormat flowVectorFormat; + VkFormat costFormat; + VkOpticalFlowGridSizeFlagsNV outputGridSize; + VkOpticalFlowGridSizeFlagsNV hintGridSize; + VkOpticalFlowPerformanceLevelNV performanceLevel; + VkOpticalFlowSessionCreateFlagsNV flags; +} VkOpticalFlowSessionCreateInfoNV; + +typedef struct VkOpticalFlowSessionCreatePrivateDataInfoNV { + VkStructureType sType; + void* pNext; + uint32_t id; + uint32_t size; + const void* pPrivateData; +} VkOpticalFlowSessionCreatePrivateDataInfoNV; + +typedef struct VkOpticalFlowExecuteInfoNV { + VkStructureType sType; + void* pNext; + VkOpticalFlowExecuteFlagsNV flags; + uint32_t regionCount; + const VkRect2D* pRegions; +} VkOpticalFlowExecuteInfoNV; + +typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceOpticalFlowImageFormatsNV)(VkPhysicalDevice physicalDevice, const VkOpticalFlowImageFormatInfoNV* pOpticalFlowImageFormatInfo, uint32_t* pFormatCount, VkOpticalFlowImageFormatPropertiesNV* pImageFormatProperties); +typedef VkResult (VKAPI_PTR *PFN_vkCreateOpticalFlowSessionNV)(VkDevice device, const VkOpticalFlowSessionCreateInfoNV* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkOpticalFlowSessionNV* pSession); +typedef void (VKAPI_PTR *PFN_vkDestroyOpticalFlowSessionNV)(VkDevice device, VkOpticalFlowSessionNV session, const VkAllocationCallbacks* pAllocator); +typedef VkResult (VKAPI_PTR *PFN_vkBindOpticalFlowSessionImageNV)(VkDevice device, VkOpticalFlowSessionNV session, VkOpticalFlowSessionBindingPointNV bindingPoint, VkImageView view, VkImageLayout layout); +typedef void (VKAPI_PTR *PFN_vkCmdOpticalFlowExecuteNV)(VkCommandBuffer commandBuffer, VkOpticalFlowSessionNV session, const VkOpticalFlowExecuteInfoNV* pExecuteInfo); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceOpticalFlowImageFormatsNV( + VkPhysicalDevice physicalDevice, + const VkOpticalFlowImageFormatInfoNV* pOpticalFlowImageFormatInfo, + uint32_t* pFormatCount, + VkOpticalFlowImageFormatPropertiesNV* pImageFormatProperties); + +VKAPI_ATTR VkResult VKAPI_CALL vkCreateOpticalFlowSessionNV( + VkDevice device, + const VkOpticalFlowSessionCreateInfoNV* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkOpticalFlowSessionNV* pSession); + +VKAPI_ATTR void VKAPI_CALL vkDestroyOpticalFlowSessionNV( + VkDevice device, + VkOpticalFlowSessionNV session, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR VkResult VKAPI_CALL vkBindOpticalFlowSessionImageNV( + VkDevice device, + VkOpticalFlowSessionNV session, + VkOpticalFlowSessionBindingPointNV bindingPoint, + VkImageView view, + VkImageLayout layout); + +VKAPI_ATTR void VKAPI_CALL vkCmdOpticalFlowExecuteNV( + VkCommandBuffer commandBuffer, + VkOpticalFlowSessionNV session, + const VkOpticalFlowExecuteInfoNV* pExecuteInfo); +#endif + + +// VK_EXT_legacy_dithering is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_legacy_dithering 1 #define VK_EXT_LEGACY_DITHERING_SPEC_VERSION 1 #define VK_EXT_LEGACY_DITHERING_EXTENSION_NAME "VK_EXT_legacy_dithering" @@ -14540,6 +18259,106 @@ typedef struct VkPhysicalDeviceLegacyDitheringFeaturesEXT { +// VK_EXT_pipeline_protected_access is a preprocessor guard. Do not pass it to API calls. +#define VK_EXT_pipeline_protected_access 1 +#define VK_EXT_PIPELINE_PROTECTED_ACCESS_SPEC_VERSION 1 +#define VK_EXT_PIPELINE_PROTECTED_ACCESS_EXTENSION_NAME "VK_EXT_pipeline_protected_access" +typedef struct VkPhysicalDevicePipelineProtectedAccessFeaturesEXT { + VkStructureType sType; + void* pNext; + VkBool32 pipelineProtectedAccess; +} VkPhysicalDevicePipelineProtectedAccessFeaturesEXT; + + + +// VK_EXT_shader_object is a preprocessor guard. Do not pass it to API calls. +#define VK_EXT_shader_object 1 +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkShaderEXT) +#define VK_EXT_SHADER_OBJECT_SPEC_VERSION 1 +#define VK_EXT_SHADER_OBJECT_EXTENSION_NAME "VK_EXT_shader_object" + +typedef enum VkShaderCodeTypeEXT { + VK_SHADER_CODE_TYPE_BINARY_EXT = 0, + VK_SHADER_CODE_TYPE_SPIRV_EXT = 1, + VK_SHADER_CODE_TYPE_MAX_ENUM_EXT = 0x7FFFFFFF +} VkShaderCodeTypeEXT; + +typedef enum VkShaderCreateFlagBitsEXT { + VK_SHADER_CREATE_LINK_STAGE_BIT_EXT = 0x00000001, + VK_SHADER_CREATE_ALLOW_VARYING_SUBGROUP_SIZE_BIT_EXT = 0x00000002, + VK_SHADER_CREATE_REQUIRE_FULL_SUBGROUPS_BIT_EXT = 0x00000004, + VK_SHADER_CREATE_NO_TASK_SHADER_BIT_EXT = 0x00000008, + VK_SHADER_CREATE_DISPATCH_BASE_BIT_EXT = 0x00000010, + VK_SHADER_CREATE_FRAGMENT_SHADING_RATE_ATTACHMENT_BIT_EXT = 0x00000020, + VK_SHADER_CREATE_FRAGMENT_DENSITY_MAP_ATTACHMENT_BIT_EXT = 0x00000040, + VK_SHADER_CREATE_FLAG_BITS_MAX_ENUM_EXT = 0x7FFFFFFF +} VkShaderCreateFlagBitsEXT; +typedef VkFlags VkShaderCreateFlagsEXT; +typedef struct VkPhysicalDeviceShaderObjectFeaturesEXT { + VkStructureType sType; + void* pNext; + VkBool32 shaderObject; +} VkPhysicalDeviceShaderObjectFeaturesEXT; + +typedef struct VkPhysicalDeviceShaderObjectPropertiesEXT { + VkStructureType sType; + void* pNext; + uint8_t shaderBinaryUUID[VK_UUID_SIZE]; + uint32_t shaderBinaryVersion; +} VkPhysicalDeviceShaderObjectPropertiesEXT; + +typedef struct VkShaderCreateInfoEXT { + VkStructureType sType; + const void* pNext; + VkShaderCreateFlagsEXT flags; + VkShaderStageFlagBits stage; + VkShaderStageFlags nextStage; + VkShaderCodeTypeEXT codeType; + size_t codeSize; + const void* pCode; + const char* pName; + uint32_t setLayoutCount; + const VkDescriptorSetLayout* pSetLayouts; + uint32_t pushConstantRangeCount; + const VkPushConstantRange* pPushConstantRanges; + const VkSpecializationInfo* pSpecializationInfo; +} VkShaderCreateInfoEXT; + +typedef VkPipelineShaderStageRequiredSubgroupSizeCreateInfo VkShaderRequiredSubgroupSizeCreateInfoEXT; + +typedef VkResult (VKAPI_PTR *PFN_vkCreateShadersEXT)(VkDevice device, uint32_t createInfoCount, const VkShaderCreateInfoEXT* pCreateInfos, const VkAllocationCallbacks* pAllocator, VkShaderEXT* pShaders); +typedef void (VKAPI_PTR *PFN_vkDestroyShaderEXT)(VkDevice device, VkShaderEXT shader, const VkAllocationCallbacks* pAllocator); +typedef VkResult (VKAPI_PTR *PFN_vkGetShaderBinaryDataEXT)(VkDevice device, VkShaderEXT shader, size_t* pDataSize, void* pData); +typedef void (VKAPI_PTR *PFN_vkCmdBindShadersEXT)(VkCommandBuffer commandBuffer, uint32_t stageCount, const VkShaderStageFlagBits* pStages, const VkShaderEXT* pShaders); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkCreateShadersEXT( + VkDevice device, + uint32_t createInfoCount, + const VkShaderCreateInfoEXT* pCreateInfos, + const VkAllocationCallbacks* pAllocator, + VkShaderEXT* pShaders); + +VKAPI_ATTR void VKAPI_CALL vkDestroyShaderEXT( + VkDevice device, + VkShaderEXT shader, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetShaderBinaryDataEXT( + VkDevice device, + VkShaderEXT shader, + size_t* pDataSize, + void* pData); + +VKAPI_ATTR void VKAPI_CALL vkCmdBindShadersEXT( + VkCommandBuffer commandBuffer, + uint32_t stageCount, + const VkShaderStageFlagBits* pStages, + const VkShaderEXT* pShaders); +#endif + + +// VK_QCOM_tile_properties is a preprocessor guard. Do not pass it to API calls. #define VK_QCOM_tile_properties 1 #define VK_QCOM_TILE_PROPERTIES_SPEC_VERSION 1 #define VK_QCOM_TILE_PROPERTIES_EXTENSION_NAME "VK_QCOM_tile_properties" @@ -14574,6 +18393,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkGetDynamicRenderingTilePropertiesQCOM( #endif +// VK_SEC_amigo_profiling is a preprocessor guard. Do not pass it to API calls. #define VK_SEC_amigo_profiling 1 #define VK_SEC_AMIGO_PROFILING_SPEC_VERSION 1 #define VK_SEC_AMIGO_PROFILING_EXTENSION_NAME "VK_SEC_amigo_profiling" @@ -14592,8 +18412,454 @@ typedef struct VkAmigoProfilingSubmitInfoSEC { +// VK_QCOM_multiview_per_view_viewports is a preprocessor guard. Do not pass it to API calls. +#define VK_QCOM_multiview_per_view_viewports 1 +#define VK_QCOM_MULTIVIEW_PER_VIEW_VIEWPORTS_SPEC_VERSION 1 +#define VK_QCOM_MULTIVIEW_PER_VIEW_VIEWPORTS_EXTENSION_NAME "VK_QCOM_multiview_per_view_viewports" +typedef struct VkPhysicalDeviceMultiviewPerViewViewportsFeaturesQCOM { + VkStructureType sType; + void* pNext; + VkBool32 multiviewPerViewViewports; +} VkPhysicalDeviceMultiviewPerViewViewportsFeaturesQCOM; + + + +// VK_NV_ray_tracing_invocation_reorder is a preprocessor guard. Do not pass it to API calls. +#define VK_NV_ray_tracing_invocation_reorder 1 +#define VK_NV_RAY_TRACING_INVOCATION_REORDER_SPEC_VERSION 1 +#define VK_NV_RAY_TRACING_INVOCATION_REORDER_EXTENSION_NAME "VK_NV_ray_tracing_invocation_reorder" + +typedef enum VkRayTracingInvocationReorderModeNV { + VK_RAY_TRACING_INVOCATION_REORDER_MODE_NONE_NV = 0, + VK_RAY_TRACING_INVOCATION_REORDER_MODE_REORDER_NV = 1, + VK_RAY_TRACING_INVOCATION_REORDER_MODE_MAX_ENUM_NV = 0x7FFFFFFF +} VkRayTracingInvocationReorderModeNV; +typedef struct VkPhysicalDeviceRayTracingInvocationReorderPropertiesNV { + VkStructureType sType; + void* pNext; + VkRayTracingInvocationReorderModeNV rayTracingInvocationReorderReorderingHint; +} VkPhysicalDeviceRayTracingInvocationReorderPropertiesNV; + +typedef struct VkPhysicalDeviceRayTracingInvocationReorderFeaturesNV { + VkStructureType sType; + void* pNext; + VkBool32 rayTracingInvocationReorder; +} VkPhysicalDeviceRayTracingInvocationReorderFeaturesNV; + + + +// VK_NV_extended_sparse_address_space is a preprocessor guard. Do not pass it to API calls. +#define VK_NV_extended_sparse_address_space 1 +#define VK_NV_EXTENDED_SPARSE_ADDRESS_SPACE_SPEC_VERSION 1 +#define VK_NV_EXTENDED_SPARSE_ADDRESS_SPACE_EXTENSION_NAME "VK_NV_extended_sparse_address_space" +typedef struct VkPhysicalDeviceExtendedSparseAddressSpaceFeaturesNV { + VkStructureType sType; + void* pNext; + VkBool32 extendedSparseAddressSpace; +} VkPhysicalDeviceExtendedSparseAddressSpaceFeaturesNV; + +typedef struct VkPhysicalDeviceExtendedSparseAddressSpacePropertiesNV { + VkStructureType sType; + void* pNext; + VkDeviceSize extendedSparseAddressSpaceSize; + VkImageUsageFlags extendedSparseImageUsageFlags; + VkBufferUsageFlags extendedSparseBufferUsageFlags; +} VkPhysicalDeviceExtendedSparseAddressSpacePropertiesNV; + + + +// VK_EXT_mutable_descriptor_type is a preprocessor guard. Do not pass it to API calls. +#define VK_EXT_mutable_descriptor_type 1 +#define VK_EXT_MUTABLE_DESCRIPTOR_TYPE_SPEC_VERSION 1 +#define VK_EXT_MUTABLE_DESCRIPTOR_TYPE_EXTENSION_NAME "VK_EXT_mutable_descriptor_type" + + +// VK_EXT_layer_settings is a preprocessor guard. Do not pass it to API calls. +#define VK_EXT_layer_settings 1 +#define VK_EXT_LAYER_SETTINGS_SPEC_VERSION 2 +#define VK_EXT_LAYER_SETTINGS_EXTENSION_NAME "VK_EXT_layer_settings" + +typedef enum VkLayerSettingTypeEXT { + VK_LAYER_SETTING_TYPE_BOOL32_EXT = 0, + VK_LAYER_SETTING_TYPE_INT32_EXT = 1, + VK_LAYER_SETTING_TYPE_INT64_EXT = 2, + VK_LAYER_SETTING_TYPE_UINT32_EXT = 3, + VK_LAYER_SETTING_TYPE_UINT64_EXT = 4, + VK_LAYER_SETTING_TYPE_FLOAT32_EXT = 5, + VK_LAYER_SETTING_TYPE_FLOAT64_EXT = 6, + VK_LAYER_SETTING_TYPE_STRING_EXT = 7, + VK_LAYER_SETTING_TYPE_MAX_ENUM_EXT = 0x7FFFFFFF +} VkLayerSettingTypeEXT; +typedef struct VkLayerSettingEXT { + const char* pLayerName; + const char* pSettingName; + VkLayerSettingTypeEXT type; + uint32_t valueCount; + const void* pValues; +} VkLayerSettingEXT; + +typedef struct VkLayerSettingsCreateInfoEXT { + VkStructureType sType; + const void* pNext; + uint32_t settingCount; + const VkLayerSettingEXT* pSettings; +} VkLayerSettingsCreateInfoEXT; + + + +// VK_ARM_shader_core_builtins is a preprocessor guard. Do not pass it to API calls. +#define VK_ARM_shader_core_builtins 1 +#define VK_ARM_SHADER_CORE_BUILTINS_SPEC_VERSION 2 +#define VK_ARM_SHADER_CORE_BUILTINS_EXTENSION_NAME "VK_ARM_shader_core_builtins" +typedef struct VkPhysicalDeviceShaderCoreBuiltinsFeaturesARM { + VkStructureType sType; + void* pNext; + VkBool32 shaderCoreBuiltins; +} VkPhysicalDeviceShaderCoreBuiltinsFeaturesARM; + +typedef struct VkPhysicalDeviceShaderCoreBuiltinsPropertiesARM { + VkStructureType sType; + void* pNext; + uint64_t shaderCoreMask; + uint32_t shaderCoreCount; + uint32_t shaderWarpsPerCore; +} VkPhysicalDeviceShaderCoreBuiltinsPropertiesARM; + + + +// VK_EXT_pipeline_library_group_handles is a preprocessor guard. Do not pass it to API calls. +#define VK_EXT_pipeline_library_group_handles 1 +#define VK_EXT_PIPELINE_LIBRARY_GROUP_HANDLES_SPEC_VERSION 1 +#define VK_EXT_PIPELINE_LIBRARY_GROUP_HANDLES_EXTENSION_NAME "VK_EXT_pipeline_library_group_handles" +typedef struct VkPhysicalDevicePipelineLibraryGroupHandlesFeaturesEXT { + VkStructureType sType; + void* pNext; + VkBool32 pipelineLibraryGroupHandles; +} VkPhysicalDevicePipelineLibraryGroupHandlesFeaturesEXT; + + + +// VK_EXT_dynamic_rendering_unused_attachments is a preprocessor guard. Do not pass it to API calls. +#define VK_EXT_dynamic_rendering_unused_attachments 1 +#define VK_EXT_DYNAMIC_RENDERING_UNUSED_ATTACHMENTS_SPEC_VERSION 1 +#define VK_EXT_DYNAMIC_RENDERING_UNUSED_ATTACHMENTS_EXTENSION_NAME "VK_EXT_dynamic_rendering_unused_attachments" +typedef struct VkPhysicalDeviceDynamicRenderingUnusedAttachmentsFeaturesEXT { + VkStructureType sType; + void* pNext; + VkBool32 dynamicRenderingUnusedAttachments; +} VkPhysicalDeviceDynamicRenderingUnusedAttachmentsFeaturesEXT; + + + +// VK_NV_low_latency2 is a preprocessor guard. Do not pass it to API calls. +#define VK_NV_low_latency2 1 +#define VK_NV_LOW_LATENCY_2_SPEC_VERSION 2 +#define VK_NV_LOW_LATENCY_2_EXTENSION_NAME "VK_NV_low_latency2" + +typedef enum VkLatencyMarkerNV { + VK_LATENCY_MARKER_SIMULATION_START_NV = 0, + VK_LATENCY_MARKER_SIMULATION_END_NV = 1, + VK_LATENCY_MARKER_RENDERSUBMIT_START_NV = 2, + VK_LATENCY_MARKER_RENDERSUBMIT_END_NV = 3, + VK_LATENCY_MARKER_PRESENT_START_NV = 4, + VK_LATENCY_MARKER_PRESENT_END_NV = 5, + VK_LATENCY_MARKER_INPUT_SAMPLE_NV = 6, + VK_LATENCY_MARKER_TRIGGER_FLASH_NV = 7, + VK_LATENCY_MARKER_OUT_OF_BAND_RENDERSUBMIT_START_NV = 8, + VK_LATENCY_MARKER_OUT_OF_BAND_RENDERSUBMIT_END_NV = 9, + VK_LATENCY_MARKER_OUT_OF_BAND_PRESENT_START_NV = 10, + VK_LATENCY_MARKER_OUT_OF_BAND_PRESENT_END_NV = 11, + VK_LATENCY_MARKER_MAX_ENUM_NV = 0x7FFFFFFF +} VkLatencyMarkerNV; + +typedef enum VkOutOfBandQueueTypeNV { + VK_OUT_OF_BAND_QUEUE_TYPE_RENDER_NV = 0, + VK_OUT_OF_BAND_QUEUE_TYPE_PRESENT_NV = 1, + VK_OUT_OF_BAND_QUEUE_TYPE_MAX_ENUM_NV = 0x7FFFFFFF +} VkOutOfBandQueueTypeNV; +typedef struct VkLatencySleepModeInfoNV { + VkStructureType sType; + const void* pNext; + VkBool32 lowLatencyMode; + VkBool32 lowLatencyBoost; + uint32_t minimumIntervalUs; +} VkLatencySleepModeInfoNV; + +typedef struct VkLatencySleepInfoNV { + VkStructureType sType; + const void* pNext; + VkSemaphore signalSemaphore; + uint64_t value; +} VkLatencySleepInfoNV; + +typedef struct VkSetLatencyMarkerInfoNV { + VkStructureType sType; + const void* pNext; + uint64_t presentID; + VkLatencyMarkerNV marker; +} VkSetLatencyMarkerInfoNV; + +typedef struct VkLatencyTimingsFrameReportNV { + VkStructureType sType; + const void* pNext; + uint64_t presentID; + uint64_t inputSampleTimeUs; + uint64_t simStartTimeUs; + uint64_t simEndTimeUs; + uint64_t renderSubmitStartTimeUs; + uint64_t renderSubmitEndTimeUs; + uint64_t presentStartTimeUs; + uint64_t presentEndTimeUs; + uint64_t driverStartTimeUs; + uint64_t driverEndTimeUs; + uint64_t osRenderQueueStartTimeUs; + uint64_t osRenderQueueEndTimeUs; + uint64_t gpuRenderStartTimeUs; + uint64_t gpuRenderEndTimeUs; +} VkLatencyTimingsFrameReportNV; + +typedef struct VkGetLatencyMarkerInfoNV { + VkStructureType sType; + const void* pNext; + uint32_t timingCount; + VkLatencyTimingsFrameReportNV* pTimings; +} VkGetLatencyMarkerInfoNV; + +typedef struct VkLatencySubmissionPresentIdNV { + VkStructureType sType; + const void* pNext; + uint64_t presentID; +} VkLatencySubmissionPresentIdNV; + +typedef struct VkSwapchainLatencyCreateInfoNV { + VkStructureType sType; + const void* pNext; + VkBool32 latencyModeEnable; +} VkSwapchainLatencyCreateInfoNV; + +typedef struct VkOutOfBandQueueTypeInfoNV { + VkStructureType sType; + const void* pNext; + VkOutOfBandQueueTypeNV queueType; +} VkOutOfBandQueueTypeInfoNV; + +typedef struct VkLatencySurfaceCapabilitiesNV { + VkStructureType sType; + const void* pNext; + uint32_t presentModeCount; + VkPresentModeKHR* pPresentModes; +} VkLatencySurfaceCapabilitiesNV; + +typedef VkResult (VKAPI_PTR *PFN_vkSetLatencySleepModeNV)(VkDevice device, VkSwapchainKHR swapchain, const VkLatencySleepModeInfoNV* pSleepModeInfo); +typedef VkResult (VKAPI_PTR *PFN_vkLatencySleepNV)(VkDevice device, VkSwapchainKHR swapchain, const VkLatencySleepInfoNV* pSleepInfo); +typedef void (VKAPI_PTR *PFN_vkSetLatencyMarkerNV)(VkDevice device, VkSwapchainKHR swapchain, const VkSetLatencyMarkerInfoNV* pLatencyMarkerInfo); +typedef void (VKAPI_PTR *PFN_vkGetLatencyTimingsNV)(VkDevice device, VkSwapchainKHR swapchain, VkGetLatencyMarkerInfoNV* pLatencyMarkerInfo); +typedef void (VKAPI_PTR *PFN_vkQueueNotifyOutOfBandNV)(VkQueue queue, const VkOutOfBandQueueTypeInfoNV* pQueueTypeInfo); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkSetLatencySleepModeNV( + VkDevice device, + VkSwapchainKHR swapchain, + const VkLatencySleepModeInfoNV* pSleepModeInfo); + +VKAPI_ATTR VkResult VKAPI_CALL vkLatencySleepNV( + VkDevice device, + VkSwapchainKHR swapchain, + const VkLatencySleepInfoNV* pSleepInfo); + +VKAPI_ATTR void VKAPI_CALL vkSetLatencyMarkerNV( + VkDevice device, + VkSwapchainKHR swapchain, + const VkSetLatencyMarkerInfoNV* pLatencyMarkerInfo); + +VKAPI_ATTR void VKAPI_CALL vkGetLatencyTimingsNV( + VkDevice device, + VkSwapchainKHR swapchain, + VkGetLatencyMarkerInfoNV* pLatencyMarkerInfo); + +VKAPI_ATTR void VKAPI_CALL vkQueueNotifyOutOfBandNV( + VkQueue queue, + const VkOutOfBandQueueTypeInfoNV* pQueueTypeInfo); +#endif + + +// VK_QCOM_multiview_per_view_render_areas is a preprocessor guard. Do not pass it to API calls. +#define VK_QCOM_multiview_per_view_render_areas 1 +#define VK_QCOM_MULTIVIEW_PER_VIEW_RENDER_AREAS_SPEC_VERSION 1 +#define VK_QCOM_MULTIVIEW_PER_VIEW_RENDER_AREAS_EXTENSION_NAME "VK_QCOM_multiview_per_view_render_areas" +typedef struct VkPhysicalDeviceMultiviewPerViewRenderAreasFeaturesQCOM { + VkStructureType sType; + void* pNext; + VkBool32 multiviewPerViewRenderAreas; +} VkPhysicalDeviceMultiviewPerViewRenderAreasFeaturesQCOM; + +typedef struct VkMultiviewPerViewRenderAreasRenderPassBeginInfoQCOM { + VkStructureType sType; + const void* pNext; + uint32_t perViewRenderAreaCount; + const VkRect2D* pPerViewRenderAreas; +} VkMultiviewPerViewRenderAreasRenderPassBeginInfoQCOM; + + + +// VK_NV_per_stage_descriptor_set is a preprocessor guard. Do not pass it to API calls. +#define VK_NV_per_stage_descriptor_set 1 +#define VK_NV_PER_STAGE_DESCRIPTOR_SET_SPEC_VERSION 1 +#define VK_NV_PER_STAGE_DESCRIPTOR_SET_EXTENSION_NAME "VK_NV_per_stage_descriptor_set" +typedef struct VkPhysicalDevicePerStageDescriptorSetFeaturesNV { + VkStructureType sType; + void* pNext; + VkBool32 perStageDescriptorSet; + VkBool32 dynamicPipelineLayout; +} VkPhysicalDevicePerStageDescriptorSetFeaturesNV; + + + +// VK_QCOM_image_processing2 is a preprocessor guard. Do not pass it to API calls. +#define VK_QCOM_image_processing2 1 +#define VK_QCOM_IMAGE_PROCESSING_2_SPEC_VERSION 1 +#define VK_QCOM_IMAGE_PROCESSING_2_EXTENSION_NAME "VK_QCOM_image_processing2" + +typedef enum VkBlockMatchWindowCompareModeQCOM { + VK_BLOCK_MATCH_WINDOW_COMPARE_MODE_MIN_QCOM = 0, + VK_BLOCK_MATCH_WINDOW_COMPARE_MODE_MAX_QCOM = 1, + VK_BLOCK_MATCH_WINDOW_COMPARE_MODE_MAX_ENUM_QCOM = 0x7FFFFFFF +} VkBlockMatchWindowCompareModeQCOM; +typedef struct VkPhysicalDeviceImageProcessing2FeaturesQCOM { + VkStructureType sType; + void* pNext; + VkBool32 textureBlockMatch2; +} VkPhysicalDeviceImageProcessing2FeaturesQCOM; + +typedef struct VkPhysicalDeviceImageProcessing2PropertiesQCOM { + VkStructureType sType; + void* pNext; + VkExtent2D maxBlockMatchWindow; +} VkPhysicalDeviceImageProcessing2PropertiesQCOM; + +typedef struct VkSamplerBlockMatchWindowCreateInfoQCOM { + VkStructureType sType; + const void* pNext; + VkExtent2D windowExtent; + VkBlockMatchWindowCompareModeQCOM windowCompareMode; +} VkSamplerBlockMatchWindowCreateInfoQCOM; + + + +// VK_QCOM_filter_cubic_weights is a preprocessor guard. Do not pass it to API calls. +#define VK_QCOM_filter_cubic_weights 1 +#define VK_QCOM_FILTER_CUBIC_WEIGHTS_SPEC_VERSION 1 +#define VK_QCOM_FILTER_CUBIC_WEIGHTS_EXTENSION_NAME "VK_QCOM_filter_cubic_weights" + +typedef enum VkCubicFilterWeightsQCOM { + VK_CUBIC_FILTER_WEIGHTS_CATMULL_ROM_QCOM = 0, + VK_CUBIC_FILTER_WEIGHTS_ZERO_TANGENT_CARDINAL_QCOM = 1, + VK_CUBIC_FILTER_WEIGHTS_B_SPLINE_QCOM = 2, + VK_CUBIC_FILTER_WEIGHTS_MITCHELL_NETRAVALI_QCOM = 3, + VK_CUBIC_FILTER_WEIGHTS_MAX_ENUM_QCOM = 0x7FFFFFFF +} VkCubicFilterWeightsQCOM; +typedef struct VkPhysicalDeviceCubicWeightsFeaturesQCOM { + VkStructureType sType; + void* pNext; + VkBool32 selectableCubicWeights; +} VkPhysicalDeviceCubicWeightsFeaturesQCOM; + +typedef struct VkSamplerCubicWeightsCreateInfoQCOM { + VkStructureType sType; + const void* pNext; + VkCubicFilterWeightsQCOM cubicWeights; +} VkSamplerCubicWeightsCreateInfoQCOM; + +typedef struct VkBlitImageCubicWeightsInfoQCOM { + VkStructureType sType; + const void* pNext; + VkCubicFilterWeightsQCOM cubicWeights; +} VkBlitImageCubicWeightsInfoQCOM; + + + +// VK_QCOM_ycbcr_degamma is a preprocessor guard. Do not pass it to API calls. +#define VK_QCOM_ycbcr_degamma 1 +#define VK_QCOM_YCBCR_DEGAMMA_SPEC_VERSION 1 +#define VK_QCOM_YCBCR_DEGAMMA_EXTENSION_NAME "VK_QCOM_ycbcr_degamma" +typedef struct VkPhysicalDeviceYcbcrDegammaFeaturesQCOM { + VkStructureType sType; + void* pNext; + VkBool32 ycbcrDegamma; +} VkPhysicalDeviceYcbcrDegammaFeaturesQCOM; + +typedef struct VkSamplerYcbcrConversionYcbcrDegammaCreateInfoQCOM { + VkStructureType sType; + void* pNext; + VkBool32 enableYDegamma; + VkBool32 enableCbCrDegamma; +} VkSamplerYcbcrConversionYcbcrDegammaCreateInfoQCOM; + + + +// VK_QCOM_filter_cubic_clamp is a preprocessor guard. Do not pass it to API calls. +#define VK_QCOM_filter_cubic_clamp 1 +#define VK_QCOM_FILTER_CUBIC_CLAMP_SPEC_VERSION 1 +#define VK_QCOM_FILTER_CUBIC_CLAMP_EXTENSION_NAME "VK_QCOM_filter_cubic_clamp" +typedef struct VkPhysicalDeviceCubicClampFeaturesQCOM { + VkStructureType sType; + void* pNext; + VkBool32 cubicRangeClamp; +} VkPhysicalDeviceCubicClampFeaturesQCOM; + + + +// VK_EXT_attachment_feedback_loop_dynamic_state is a preprocessor guard. Do not pass it to API calls. +#define VK_EXT_attachment_feedback_loop_dynamic_state 1 +#define VK_EXT_ATTACHMENT_FEEDBACK_LOOP_DYNAMIC_STATE_SPEC_VERSION 1 +#define VK_EXT_ATTACHMENT_FEEDBACK_LOOP_DYNAMIC_STATE_EXTENSION_NAME "VK_EXT_attachment_feedback_loop_dynamic_state" +typedef struct VkPhysicalDeviceAttachmentFeedbackLoopDynamicStateFeaturesEXT { + VkStructureType sType; + void* pNext; + VkBool32 attachmentFeedbackLoopDynamicState; +} VkPhysicalDeviceAttachmentFeedbackLoopDynamicStateFeaturesEXT; + +typedef void (VKAPI_PTR *PFN_vkCmdSetAttachmentFeedbackLoopEnableEXT)(VkCommandBuffer commandBuffer, VkImageAspectFlags aspectMask); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR void VKAPI_CALL vkCmdSetAttachmentFeedbackLoopEnableEXT( + VkCommandBuffer commandBuffer, + VkImageAspectFlags aspectMask); +#endif + + +// VK_MSFT_layered_driver is a preprocessor guard. Do not pass it to API calls. +#define VK_MSFT_layered_driver 1 +#define VK_MSFT_LAYERED_DRIVER_SPEC_VERSION 1 +#define VK_MSFT_LAYERED_DRIVER_EXTENSION_NAME "VK_MSFT_layered_driver" + +typedef enum VkLayeredDriverUnderlyingApiMSFT { + VK_LAYERED_DRIVER_UNDERLYING_API_NONE_MSFT = 0, + VK_LAYERED_DRIVER_UNDERLYING_API_D3D12_MSFT = 1, + VK_LAYERED_DRIVER_UNDERLYING_API_MAX_ENUM_MSFT = 0x7FFFFFFF +} VkLayeredDriverUnderlyingApiMSFT; +typedef struct VkPhysicalDeviceLayeredDriverPropertiesMSFT { + VkStructureType sType; + void* pNext; + VkLayeredDriverUnderlyingApiMSFT underlyingAPI; +} VkPhysicalDeviceLayeredDriverPropertiesMSFT; + + + +// VK_NV_descriptor_pool_overallocation is a preprocessor guard. Do not pass it to API calls. +#define VK_NV_descriptor_pool_overallocation 1 +#define VK_NV_DESCRIPTOR_POOL_OVERALLOCATION_SPEC_VERSION 1 +#define VK_NV_DESCRIPTOR_POOL_OVERALLOCATION_EXTENSION_NAME "VK_NV_descriptor_pool_overallocation" +typedef struct VkPhysicalDeviceDescriptorPoolOverallocationFeaturesNV { + VkStructureType sType; + void* pNext; + VkBool32 descriptorPoolOverallocation; +} VkPhysicalDeviceDescriptorPoolOverallocationFeaturesNV; + + + +// VK_KHR_acceleration_structure is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_acceleration_structure 1 -VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkAccelerationStructureKHR) #define VK_KHR_ACCELERATION_STRUCTURE_SPEC_VERSION 13 #define VK_KHR_ACCELERATION_STRUCTURE_EXTENSION_NAME "VK_KHR_acceleration_structure" @@ -14603,30 +18869,13 @@ typedef enum VkBuildAccelerationStructureModeKHR { VK_BUILD_ACCELERATION_STRUCTURE_MODE_MAX_ENUM_KHR = 0x7FFFFFFF } VkBuildAccelerationStructureModeKHR; -typedef enum VkAccelerationStructureBuildTypeKHR { - VK_ACCELERATION_STRUCTURE_BUILD_TYPE_HOST_KHR = 0, - VK_ACCELERATION_STRUCTURE_BUILD_TYPE_DEVICE_KHR = 1, - VK_ACCELERATION_STRUCTURE_BUILD_TYPE_HOST_OR_DEVICE_KHR = 2, - VK_ACCELERATION_STRUCTURE_BUILD_TYPE_MAX_ENUM_KHR = 0x7FFFFFFF -} VkAccelerationStructureBuildTypeKHR; - -typedef enum VkAccelerationStructureCompatibilityKHR { - VK_ACCELERATION_STRUCTURE_COMPATIBILITY_COMPATIBLE_KHR = 0, - VK_ACCELERATION_STRUCTURE_COMPATIBILITY_INCOMPATIBLE_KHR = 1, - VK_ACCELERATION_STRUCTURE_COMPATIBILITY_MAX_ENUM_KHR = 0x7FFFFFFF -} VkAccelerationStructureCompatibilityKHR; - typedef enum VkAccelerationStructureCreateFlagBitsKHR { VK_ACCELERATION_STRUCTURE_CREATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT_KHR = 0x00000001, + VK_ACCELERATION_STRUCTURE_CREATE_DESCRIPTOR_BUFFER_CAPTURE_REPLAY_BIT_EXT = 0x00000008, VK_ACCELERATION_STRUCTURE_CREATE_MOTION_BIT_NV = 0x00000004, VK_ACCELERATION_STRUCTURE_CREATE_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF } VkAccelerationStructureCreateFlagBitsKHR; typedef VkFlags VkAccelerationStructureCreateFlagsKHR; -typedef union VkDeviceOrHostAddressKHR { - VkDeviceAddress deviceAddress; - void* hostAddress; -} VkDeviceOrHostAddressKHR; - typedef struct VkAccelerationStructureBuildRangeInfoKHR { uint32_t primitiveCount; uint32_t primitiveOffset; @@ -14885,6 +19134,7 @@ VKAPI_ATTR void VKAPI_CALL vkGetAccelerationStructureBuildSizesKHR( #endif +// VK_KHR_ray_tracing_pipeline is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_ray_tracing_pipeline 1 #define VK_KHR_RAY_TRACING_PIPELINE_SPEC_VERSION 1 #define VK_KHR_RAY_TRACING_PIPELINE_EXTENSION_NAME "VK_KHR_ray_tracing_pipeline" @@ -15021,6 +19271,7 @@ VKAPI_ATTR void VKAPI_CALL vkCmdSetRayTracingPipelineStackSizeKHR( #endif +// VK_KHR_ray_query is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_ray_query 1 #define VK_KHR_RAY_QUERY_SPEC_VERSION 1 #define VK_KHR_RAY_QUERY_EXTENSION_NAME "VK_KHR_ray_query" @@ -15032,6 +19283,7 @@ typedef struct VkPhysicalDeviceRayQueryFeaturesKHR { +// VK_EXT_mesh_shader is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_mesh_shader 1 #define VK_EXT_MESH_SHADER_SPEC_VERSION 1 #define VK_EXT_MESH_SHADER_EXTENSION_NAME "VK_EXT_mesh_shader" diff --git a/thirdparty/SDL/src/video/khronos/vulkan/vulkan_directfb.h b/thirdparty/SDL/src/video/khronos/vulkan/vulkan_directfb.h index ab3504efa..f06f80b70 100644 --- a/thirdparty/SDL/src/video/khronos/vulkan/vulkan_directfb.h +++ b/thirdparty/SDL/src/video/khronos/vulkan/vulkan_directfb.h @@ -2,7 +2,7 @@ #define VULKAN_DIRECTFB_H_ 1 /* -** Copyright 2015-2022 The Khronos Group Inc. +** Copyright 2015-2024 The Khronos Group Inc. ** ** SPDX-License-Identifier: Apache-2.0 */ @@ -19,6 +19,7 @@ extern "C" { +// VK_EXT_directfb_surface is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_directfb_surface 1 #define VK_EXT_DIRECTFB_SURFACE_SPEC_VERSION 1 #define VK_EXT_DIRECTFB_SURFACE_EXTENSION_NAME "VK_EXT_directfb_surface" diff --git a/thirdparty/SDL/src/video/khronos/vulkan/vulkan_fuchsia.h b/thirdparty/SDL/src/video/khronos/vulkan/vulkan_fuchsia.h index 61774ff9c..f60907d10 100644 --- a/thirdparty/SDL/src/video/khronos/vulkan/vulkan_fuchsia.h +++ b/thirdparty/SDL/src/video/khronos/vulkan/vulkan_fuchsia.h @@ -2,7 +2,7 @@ #define VULKAN_FUCHSIA_H_ 1 /* -** Copyright 2015-2022 The Khronos Group Inc. +** Copyright 2015-2024 The Khronos Group Inc. ** ** SPDX-License-Identifier: Apache-2.0 */ @@ -19,6 +19,7 @@ extern "C" { +// VK_FUCHSIA_imagepipe_surface is a preprocessor guard. Do not pass it to API calls. #define VK_FUCHSIA_imagepipe_surface 1 #define VK_FUCHSIA_IMAGEPIPE_SURFACE_SPEC_VERSION 1 #define VK_FUCHSIA_IMAGEPIPE_SURFACE_EXTENSION_NAME "VK_FUCHSIA_imagepipe_surface" @@ -41,6 +42,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkCreateImagePipeSurfaceFUCHSIA( #endif +// VK_FUCHSIA_external_memory is a preprocessor guard. Do not pass it to API calls. #define VK_FUCHSIA_external_memory 1 #define VK_FUCHSIA_EXTERNAL_MEMORY_SPEC_VERSION 1 #define VK_FUCHSIA_EXTERNAL_MEMORY_EXTENSION_NAME "VK_FUCHSIA_external_memory" @@ -81,6 +83,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryZirconHandlePropertiesFUCHSIA( #endif +// VK_FUCHSIA_external_semaphore is a preprocessor guard. Do not pass it to API calls. #define VK_FUCHSIA_external_semaphore 1 #define VK_FUCHSIA_EXTERNAL_SEMAPHORE_SPEC_VERSION 1 #define VK_FUCHSIA_EXTERNAL_SEMAPHORE_EXTENSION_NAME "VK_FUCHSIA_external_semaphore" @@ -115,6 +118,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkGetSemaphoreZirconHandleFUCHSIA( #endif +// VK_FUCHSIA_buffer_collection is a preprocessor guard. Do not pass it to API calls. #define VK_FUCHSIA_buffer_collection 1 VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkBufferCollectionFUCHSIA) #define VK_FUCHSIA_BUFFER_COLLECTION_SPEC_VERSION 2 diff --git a/thirdparty/SDL/src/video/khronos/vulkan/vulkan_ggp.h b/thirdparty/SDL/src/video/khronos/vulkan/vulkan_ggp.h index 19dfd2261..0a8863a14 100644 --- a/thirdparty/SDL/src/video/khronos/vulkan/vulkan_ggp.h +++ b/thirdparty/SDL/src/video/khronos/vulkan/vulkan_ggp.h @@ -2,7 +2,7 @@ #define VULKAN_GGP_H_ 1 /* -** Copyright 2015-2022 The Khronos Group Inc. +** Copyright 2015-2024 The Khronos Group Inc. ** ** SPDX-License-Identifier: Apache-2.0 */ @@ -19,6 +19,7 @@ extern "C" { +// VK_GGP_stream_descriptor_surface is a preprocessor guard. Do not pass it to API calls. #define VK_GGP_stream_descriptor_surface 1 #define VK_GGP_STREAM_DESCRIPTOR_SURFACE_SPEC_VERSION 1 #define VK_GGP_STREAM_DESCRIPTOR_SURFACE_EXTENSION_NAME "VK_GGP_stream_descriptor_surface" @@ -41,6 +42,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkCreateStreamDescriptorSurfaceGGP( #endif +// VK_GGP_frame_token is a preprocessor guard. Do not pass it to API calls. #define VK_GGP_frame_token 1 #define VK_GGP_FRAME_TOKEN_SPEC_VERSION 1 #define VK_GGP_FRAME_TOKEN_EXTENSION_NAME "VK_GGP_frame_token" diff --git a/thirdparty/SDL/src/video/khronos/vulkan/vulkan_ios.h b/thirdparty/SDL/src/video/khronos/vulkan/vulkan_ios.h index 579220543..22ed2c039 100644 --- a/thirdparty/SDL/src/video/khronos/vulkan/vulkan_ios.h +++ b/thirdparty/SDL/src/video/khronos/vulkan/vulkan_ios.h @@ -2,7 +2,7 @@ #define VULKAN_IOS_H_ 1 /* -** Copyright 2015-2022 The Khronos Group Inc. +** Copyright 2015-2024 The Khronos Group Inc. ** ** SPDX-License-Identifier: Apache-2.0 */ @@ -19,6 +19,7 @@ extern "C" { +// VK_MVK_ios_surface is a preprocessor guard. Do not pass it to API calls. #define VK_MVK_ios_surface 1 #define VK_MVK_IOS_SURFACE_SPEC_VERSION 3 #define VK_MVK_IOS_SURFACE_EXTENSION_NAME "VK_MVK_ios_surface" diff --git a/thirdparty/SDL/src/video/khronos/vulkan/vulkan_macos.h b/thirdparty/SDL/src/video/khronos/vulkan/vulkan_macos.h index 8e197c7cf..a7f5613a0 100644 --- a/thirdparty/SDL/src/video/khronos/vulkan/vulkan_macos.h +++ b/thirdparty/SDL/src/video/khronos/vulkan/vulkan_macos.h @@ -2,7 +2,7 @@ #define VULKAN_MACOS_H_ 1 /* -** Copyright 2015-2022 The Khronos Group Inc. +** Copyright 2015-2024 The Khronos Group Inc. ** ** SPDX-License-Identifier: Apache-2.0 */ @@ -19,6 +19,7 @@ extern "C" { +// VK_MVK_macos_surface is a preprocessor guard. Do not pass it to API calls. #define VK_MVK_macos_surface 1 #define VK_MVK_MACOS_SURFACE_SPEC_VERSION 3 #define VK_MVK_MACOS_SURFACE_EXTENSION_NAME "VK_MVK_macos_surface" diff --git a/thirdparty/SDL/src/video/khronos/vulkan/vulkan_metal.h b/thirdparty/SDL/src/video/khronos/vulkan/vulkan_metal.h index 898d3f298..badb45078 100644 --- a/thirdparty/SDL/src/video/khronos/vulkan/vulkan_metal.h +++ b/thirdparty/SDL/src/video/khronos/vulkan/vulkan_metal.h @@ -2,7 +2,7 @@ #define VULKAN_METAL_H_ 1 /* -** Copyright 2015-2022 The Khronos Group Inc. +** Copyright 2015-2024 The Khronos Group Inc. ** ** SPDX-License-Identifier: Apache-2.0 */ @@ -19,6 +19,7 @@ extern "C" { +// VK_EXT_metal_surface is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_metal_surface 1 #ifdef __OBJC__ @class CAMetalLayer; @@ -55,6 +56,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkCreateMetalSurfaceEXT( #endif +// VK_EXT_metal_objects is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_metal_objects 1 #ifdef __OBJC__ @protocol MTLDevice; diff --git a/thirdparty/SDL/src/video/khronos/vulkan/vulkan_screen.h b/thirdparty/SDL/src/video/khronos/vulkan/vulkan_screen.h index f0ef40a6c..7e84d4d96 100644 --- a/thirdparty/SDL/src/video/khronos/vulkan/vulkan_screen.h +++ b/thirdparty/SDL/src/video/khronos/vulkan/vulkan_screen.h @@ -2,7 +2,7 @@ #define VULKAN_SCREEN_H_ 1 /* -** Copyright 2015-2022 The Khronos Group Inc. +** Copyright 2015-2024 The Khronos Group Inc. ** ** SPDX-License-Identifier: Apache-2.0 */ @@ -19,6 +19,7 @@ extern "C" { +// VK_QNX_screen_surface is a preprocessor guard. Do not pass it to API calls. #define VK_QNX_screen_surface 1 #define VK_QNX_SCREEN_SURFACE_SPEC_VERSION 1 #define VK_QNX_SCREEN_SURFACE_EXTENSION_NAME "VK_QNX_screen_surface" @@ -47,6 +48,59 @@ VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceScreenPresentationSupportQNX( struct _screen_window* window); #endif + +// VK_QNX_external_memory_screen_buffer is a preprocessor guard. Do not pass it to API calls. +#define VK_QNX_external_memory_screen_buffer 1 +#define VK_QNX_EXTERNAL_MEMORY_SCREEN_BUFFER_SPEC_VERSION 1 +#define VK_QNX_EXTERNAL_MEMORY_SCREEN_BUFFER_EXTENSION_NAME "VK_QNX_external_memory_screen_buffer" +typedef struct VkScreenBufferPropertiesQNX { + VkStructureType sType; + void* pNext; + VkDeviceSize allocationSize; + uint32_t memoryTypeBits; +} VkScreenBufferPropertiesQNX; + +typedef struct VkScreenBufferFormatPropertiesQNX { + VkStructureType sType; + void* pNext; + VkFormat format; + uint64_t externalFormat; + uint64_t screenUsage; + VkFormatFeatureFlags formatFeatures; + VkComponentMapping samplerYcbcrConversionComponents; + VkSamplerYcbcrModelConversion suggestedYcbcrModel; + VkSamplerYcbcrRange suggestedYcbcrRange; + VkChromaLocation suggestedXChromaOffset; + VkChromaLocation suggestedYChromaOffset; +} VkScreenBufferFormatPropertiesQNX; + +typedef struct VkImportScreenBufferInfoQNX { + VkStructureType sType; + const void* pNext; + struct _screen_buffer* buffer; +} VkImportScreenBufferInfoQNX; + +typedef struct VkExternalFormatQNX { + VkStructureType sType; + void* pNext; + uint64_t externalFormat; +} VkExternalFormatQNX; + +typedef struct VkPhysicalDeviceExternalMemoryScreenBufferFeaturesQNX { + VkStructureType sType; + void* pNext; + VkBool32 screenBufferImport; +} VkPhysicalDeviceExternalMemoryScreenBufferFeaturesQNX; + +typedef VkResult (VKAPI_PTR *PFN_vkGetScreenBufferPropertiesQNX)(VkDevice device, const struct _screen_buffer* buffer, VkScreenBufferPropertiesQNX* pProperties); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkGetScreenBufferPropertiesQNX( + VkDevice device, + const struct _screen_buffer* buffer, + VkScreenBufferPropertiesQNX* pProperties); +#endif + #ifdef __cplusplus } #endif diff --git a/thirdparty/SDL/src/video/khronos/vulkan/vulkan_vi.h b/thirdparty/SDL/src/video/khronos/vulkan/vulkan_vi.h index 0355e7a16..c145f4a80 100644 --- a/thirdparty/SDL/src/video/khronos/vulkan/vulkan_vi.h +++ b/thirdparty/SDL/src/video/khronos/vulkan/vulkan_vi.h @@ -2,7 +2,7 @@ #define VULKAN_VI_H_ 1 /* -** Copyright 2015-2022 The Khronos Group Inc. +** Copyright 2015-2024 The Khronos Group Inc. ** ** SPDX-License-Identifier: Apache-2.0 */ @@ -19,6 +19,7 @@ extern "C" { +// VK_NN_vi_surface is a preprocessor guard. Do not pass it to API calls. #define VK_NN_vi_surface 1 #define VK_NN_VI_SURFACE_SPEC_VERSION 1 #define VK_NN_VI_SURFACE_EXTENSION_NAME "VK_NN_vi_surface" diff --git a/thirdparty/SDL/src/video/khronos/vulkan/vulkan_wayland.h b/thirdparty/SDL/src/video/khronos/vulkan/vulkan_wayland.h index 9afd0b76d..ec706a114 100644 --- a/thirdparty/SDL/src/video/khronos/vulkan/vulkan_wayland.h +++ b/thirdparty/SDL/src/video/khronos/vulkan/vulkan_wayland.h @@ -2,7 +2,7 @@ #define VULKAN_WAYLAND_H_ 1 /* -** Copyright 2015-2022 The Khronos Group Inc. +** Copyright 2015-2024 The Khronos Group Inc. ** ** SPDX-License-Identifier: Apache-2.0 */ @@ -19,6 +19,7 @@ extern "C" { +// VK_KHR_wayland_surface is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_wayland_surface 1 #define VK_KHR_WAYLAND_SURFACE_SPEC_VERSION 6 #define VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME "VK_KHR_wayland_surface" diff --git a/thirdparty/SDL/src/video/khronos/vulkan/vulkan_win32.h b/thirdparty/SDL/src/video/khronos/vulkan/vulkan_win32.h index affe0c02a..d7a0b2bab 100644 --- a/thirdparty/SDL/src/video/khronos/vulkan/vulkan_win32.h +++ b/thirdparty/SDL/src/video/khronos/vulkan/vulkan_win32.h @@ -2,7 +2,7 @@ #define VULKAN_WIN32_H_ 1 /* -** Copyright 2015-2022 The Khronos Group Inc. +** Copyright 2015-2024 The Khronos Group Inc. ** ** SPDX-License-Identifier: Apache-2.0 */ @@ -19,6 +19,7 @@ extern "C" { +// VK_KHR_win32_surface is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_win32_surface 1 #define VK_KHR_WIN32_SURFACE_SPEC_VERSION 6 #define VK_KHR_WIN32_SURFACE_EXTENSION_NAME "VK_KHR_win32_surface" @@ -47,6 +48,7 @@ VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceWin32PresentationSupportKHR( #endif +// VK_KHR_external_memory_win32 is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_external_memory_win32 1 #define VK_KHR_EXTERNAL_MEMORY_WIN32_SPEC_VERSION 1 #define VK_KHR_EXTERNAL_MEMORY_WIN32_EXTENSION_NAME "VK_KHR_external_memory_win32" @@ -96,6 +98,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryWin32HandlePropertiesKHR( #endif +// VK_KHR_win32_keyed_mutex is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_win32_keyed_mutex 1 #define VK_KHR_WIN32_KEYED_MUTEX_SPEC_VERSION 1 #define VK_KHR_WIN32_KEYED_MUTEX_EXTENSION_NAME "VK_KHR_win32_keyed_mutex" @@ -113,6 +116,7 @@ typedef struct VkWin32KeyedMutexAcquireReleaseInfoKHR { +// VK_KHR_external_semaphore_win32 is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_external_semaphore_win32 1 #define VK_KHR_EXTERNAL_SEMAPHORE_WIN32_SPEC_VERSION 1 #define VK_KHR_EXTERNAL_SEMAPHORE_WIN32_EXTENSION_NAME "VK_KHR_external_semaphore_win32" @@ -165,6 +169,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkGetSemaphoreWin32HandleKHR( #endif +// VK_KHR_external_fence_win32 is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_external_fence_win32 1 #define VK_KHR_EXTERNAL_FENCE_WIN32_SPEC_VERSION 1 #define VK_KHR_EXTERNAL_FENCE_WIN32_EXTENSION_NAME "VK_KHR_external_fence_win32" @@ -208,6 +213,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkGetFenceWin32HandleKHR( #endif +// VK_NV_external_memory_win32 is a preprocessor guard. Do not pass it to API calls. #define VK_NV_external_memory_win32 1 #define VK_NV_EXTERNAL_MEMORY_WIN32_SPEC_VERSION 1 #define VK_NV_EXTERNAL_MEMORY_WIN32_EXTENSION_NAME "VK_NV_external_memory_win32" @@ -236,6 +242,7 @@ VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryWin32HandleNV( #endif +// VK_NV_win32_keyed_mutex is a preprocessor guard. Do not pass it to API calls. #define VK_NV_win32_keyed_mutex 1 #define VK_NV_WIN32_KEYED_MUTEX_SPEC_VERSION 2 #define VK_NV_WIN32_KEYED_MUTEX_EXTENSION_NAME "VK_NV_win32_keyed_mutex" @@ -253,6 +260,7 @@ typedef struct VkWin32KeyedMutexAcquireReleaseInfoNV { +// VK_EXT_full_screen_exclusive is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_full_screen_exclusive 1 #define VK_EXT_FULL_SCREEN_EXCLUSIVE_SPEC_VERSION 4 #define VK_EXT_FULL_SCREEN_EXCLUSIVE_EXTENSION_NAME "VK_EXT_full_screen_exclusive" @@ -308,6 +316,25 @@ VKAPI_ATTR VkResult VKAPI_CALL vkGetDeviceGroupSurfacePresentModes2EXT( VkDeviceGroupPresentModeFlagsKHR* pModes); #endif + +// VK_NV_acquire_winrt_display is a preprocessor guard. Do not pass it to API calls. +#define VK_NV_acquire_winrt_display 1 +#define VK_NV_ACQUIRE_WINRT_DISPLAY_SPEC_VERSION 1 +#define VK_NV_ACQUIRE_WINRT_DISPLAY_EXTENSION_NAME "VK_NV_acquire_winrt_display" +typedef VkResult (VKAPI_PTR *PFN_vkAcquireWinrtDisplayNV)(VkPhysicalDevice physicalDevice, VkDisplayKHR display); +typedef VkResult (VKAPI_PTR *PFN_vkGetWinrtDisplayNV)(VkPhysicalDevice physicalDevice, uint32_t deviceRelativeId, VkDisplayKHR* pDisplay); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkAcquireWinrtDisplayNV( + VkPhysicalDevice physicalDevice, + VkDisplayKHR display); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetWinrtDisplayNV( + VkPhysicalDevice physicalDevice, + uint32_t deviceRelativeId, + VkDisplayKHR* pDisplay); +#endif + #ifdef __cplusplus } #endif diff --git a/thirdparty/SDL/src/video/khronos/vulkan/vulkan_xcb.h b/thirdparty/SDL/src/video/khronos/vulkan/vulkan_xcb.h index 68e61b88f..cdf6b5269 100644 --- a/thirdparty/SDL/src/video/khronos/vulkan/vulkan_xcb.h +++ b/thirdparty/SDL/src/video/khronos/vulkan/vulkan_xcb.h @@ -2,7 +2,7 @@ #define VULKAN_XCB_H_ 1 /* -** Copyright 2015-2022 The Khronos Group Inc. +** Copyright 2015-2024 The Khronos Group Inc. ** ** SPDX-License-Identifier: Apache-2.0 */ @@ -19,6 +19,7 @@ extern "C" { +// VK_KHR_xcb_surface is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_xcb_surface 1 #define VK_KHR_XCB_SURFACE_SPEC_VERSION 6 #define VK_KHR_XCB_SURFACE_EXTENSION_NAME "VK_KHR_xcb_surface" diff --git a/thirdparty/SDL/src/video/khronos/vulkan/vulkan_xlib.h b/thirdparty/SDL/src/video/khronos/vulkan/vulkan_xlib.h index ea5360ab6..b3c3e27d7 100644 --- a/thirdparty/SDL/src/video/khronos/vulkan/vulkan_xlib.h +++ b/thirdparty/SDL/src/video/khronos/vulkan/vulkan_xlib.h @@ -2,7 +2,7 @@ #define VULKAN_XLIB_H_ 1 /* -** Copyright 2015-2022 The Khronos Group Inc. +** Copyright 2015-2024 The Khronos Group Inc. ** ** SPDX-License-Identifier: Apache-2.0 */ @@ -19,6 +19,7 @@ extern "C" { +// VK_KHR_xlib_surface is a preprocessor guard. Do not pass it to API calls. #define VK_KHR_xlib_surface 1 #define VK_KHR_XLIB_SURFACE_SPEC_VERSION 6 #define VK_KHR_XLIB_SURFACE_EXTENSION_NAME "VK_KHR_xlib_surface" diff --git a/thirdparty/SDL/src/video/khronos/vulkan/vulkan_xlib_xrandr.h b/thirdparty/SDL/src/video/khronos/vulkan/vulkan_xlib_xrandr.h index 8fc35cfc5..8e99190b4 100644 --- a/thirdparty/SDL/src/video/khronos/vulkan/vulkan_xlib_xrandr.h +++ b/thirdparty/SDL/src/video/khronos/vulkan/vulkan_xlib_xrandr.h @@ -2,7 +2,7 @@ #define VULKAN_XLIB_XRANDR_H_ 1 /* -** Copyright 2015-2022 The Khronos Group Inc. +** Copyright 2015-2024 The Khronos Group Inc. ** ** SPDX-License-Identifier: Apache-2.0 */ @@ -19,6 +19,7 @@ extern "C" { +// VK_EXT_acquire_xlib_display is a preprocessor guard. Do not pass it to API calls. #define VK_EXT_acquire_xlib_display 1 #define VK_EXT_ACQUIRE_XLIB_DISPLAY_SPEC_VERSION 1 #define VK_EXT_ACQUIRE_XLIB_DISPLAY_EXTENSION_NAME "VK_EXT_acquire_xlib_display" diff --git a/thirdparty/SDL/src/video/kmsdrm/SDL_kmsdrmdyn.c b/thirdparty/SDL/src/video/kmsdrm/SDL_kmsdrmdyn.c index 15c0f0d39..750babbcd 100644 --- a/thirdparty/SDL/src/video/kmsdrm/SDL_kmsdrmdyn.c +++ b/thirdparty/SDL/src/video/kmsdrm/SDL_kmsdrmdyn.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,7 +21,7 @@ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_KMSDRM +#ifdef SDL_VIDEO_DRIVER_KMSDRM #define DEBUG_DYNAMIC_KMSDRM 0 @@ -52,22 +52,22 @@ static void *KMSDRM_GetSym(const char *fnname, int *pHasModule) int i; void *fn = NULL; for (i = 0; i < SDL_TABLESIZE(kmsdrmlibs); i++) { - if (kmsdrmlibs[i].lib != NULL) { + if (kmsdrmlibs[i].lib) { fn = SDL_LoadFunction(kmsdrmlibs[i].lib, fnname); - if (fn != NULL) { + if (fn) { break; } } } #if DEBUG_DYNAMIC_KMSDRM - if (fn != NULL) + if (fn) SDL_Log("KMSDRM: Found '%s' in %s (%p)\n", fnname, kmsdrmlibs[i].libname, fn); else SDL_Log("KMSDRM: Symbol '%s' NOT FOUND!\n", fnname); #endif - if (fn == NULL) { + if (!fn) { *pHasModule = 0; /* kill this module. */ } @@ -101,7 +101,7 @@ void SDL_KMSDRM_UnloadSymbols(void) #ifdef SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC for (i = 0; i < SDL_TABLESIZE(kmsdrmlibs); i++) { - if (kmsdrmlibs[i].lib != NULL) { + if (kmsdrmlibs[i].lib) { SDL_UnloadObject(kmsdrmlibs[i].lib); kmsdrmlibs[i].lib = NULL; } @@ -122,7 +122,7 @@ int SDL_KMSDRM_LoadSymbols(void) int i; int *thismod = NULL; for (i = 0; i < SDL_TABLESIZE(kmsdrmlibs); i++) { - if (kmsdrmlibs[i].libname != NULL) { + if (kmsdrmlibs[i].libname) { kmsdrmlibs[i].lib = SDL_LoadObject(kmsdrmlibs[i].libname); } } diff --git a/thirdparty/SDL/src/video/kmsdrm/SDL_kmsdrmdyn.h b/thirdparty/SDL/src/video/kmsdrm/SDL_kmsdrmdyn.h index 319e3f0e3..e6da33792 100644 --- a/thirdparty/SDL/src/video/kmsdrm/SDL_kmsdrmdyn.h +++ b/thirdparty/SDL/src/video/kmsdrm/SDL_kmsdrmdyn.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/kmsdrm/SDL_kmsdrmevents.c b/thirdparty/SDL/src/video/kmsdrm/SDL_kmsdrmevents.c index 8a97c8798..a52f1b6b1 100644 --- a/thirdparty/SDL/src/video/kmsdrm/SDL_kmsdrmevents.c +++ b/thirdparty/SDL/src/video/kmsdrm/SDL_kmsdrmevents.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,7 +21,7 @@ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_KMSDRM +#ifdef SDL_VIDEO_DRIVER_KMSDRM #include "SDL_kmsdrmvideo.h" #include "SDL_kmsdrmevents.h" diff --git a/thirdparty/SDL/src/video/kmsdrm/SDL_kmsdrmevents.h b/thirdparty/SDL/src/video/kmsdrm/SDL_kmsdrmevents.h index 59226dd47..74625e34f 100644 --- a/thirdparty/SDL/src/video/kmsdrm/SDL_kmsdrmevents.h +++ b/thirdparty/SDL/src/video/kmsdrm/SDL_kmsdrmevents.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,7 +25,5 @@ #define SDL_kmsdrmevents_h_ extern void KMSDRM_PumpEvents(_THIS); -extern void KMSDRM_EventInit(_THIS); -extern void KMSDRM_EventQuit(_THIS); #endif /* SDL_kmsdrmevents_h_ */ diff --git a/thirdparty/SDL/src/video/kmsdrm/SDL_kmsdrmmouse.c b/thirdparty/SDL/src/video/kmsdrm/SDL_kmsdrmmouse.c index 955045a7e..ec01004ef 100644 --- a/thirdparty/SDL/src/video/kmsdrm/SDL_kmsdrmmouse.c +++ b/thirdparty/SDL/src/video/kmsdrm/SDL_kmsdrmmouse.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,7 +21,7 @@ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_KMSDRM +#ifdef SDL_VIDEO_DRIVER_KMSDRM #include "SDL_kmsdrmvideo.h" #include "SDL_kmsdrmmouse.h" @@ -152,7 +152,7 @@ static int KMSDRM_DumpCursorToBO(SDL_VideoDisplay *display, SDL_Cursor *cursor) int i; int ret; - if (curdata == NULL || !dispdata->cursor_bo) { + if (!curdata || !dispdata->cursor_bo) { return SDL_SetError("Cursor or display not initialized properly."); } @@ -163,7 +163,7 @@ static int KMSDRM_DumpCursorToBO(SDL_VideoDisplay *display, SDL_Cursor *cursor) ready_buffer = (uint8_t *)SDL_calloc(1, bufsize); - if (ready_buffer == NULL) { + if (!ready_buffer) { ret = SDL_OutOfMemory(); goto cleanup; } @@ -241,12 +241,12 @@ static SDL_Cursor *KMSDRM_CreateCursor(SDL_Surface *surface, int hot_x, int hot_ ret = NULL; cursor = (SDL_Cursor *)SDL_calloc(1, sizeof(*cursor)); - if (cursor == NULL) { + if (!cursor) { SDL_OutOfMemory(); goto cleanup; } curdata = (KMSDRM_CursorData *)SDL_calloc(1, sizeof(*curdata)); - if (curdata == NULL) { + if (!curdata) { SDL_OutOfMemory(); goto cleanup; } @@ -282,7 +282,7 @@ static SDL_Cursor *KMSDRM_CreateCursor(SDL_Surface *surface, int hot_x, int hot_ ret = cursor; cleanup: - if (ret == NULL) { + if (!ret) { if (curdata) { if (curdata->buffer) { SDL_free(curdata->buffer); @@ -310,13 +310,13 @@ static int KMSDRM_ShowCursor(SDL_Cursor *cursor) /* Get the mouse focused window, if any. */ mouse = SDL_GetMouse(); - if (mouse == NULL) { + if (!mouse) { return SDL_SetError("No mouse."); } window = mouse->focus; - if (window == NULL || cursor == NULL) { + if (!window || !cursor) { /* If no window is focused by mouse or cursor is NULL, since we have no window (no mouse->focus) and hence diff --git a/thirdparty/SDL/src/video/kmsdrm/SDL_kmsdrmmouse.h b/thirdparty/SDL/src/video/kmsdrm/SDL_kmsdrmmouse.h index bcd89f2ac..0485abfb3 100644 --- a/thirdparty/SDL/src/video/kmsdrm/SDL_kmsdrmmouse.h +++ b/thirdparty/SDL/src/video/kmsdrm/SDL_kmsdrmmouse.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/kmsdrm/SDL_kmsdrmopengles.c b/thirdparty/SDL/src/video/kmsdrm/SDL_kmsdrmopengles.c index 8dc2bfdc6..cbf86c949 100644 --- a/thirdparty/SDL/src/video/kmsdrm/SDL_kmsdrmopengles.c +++ b/thirdparty/SDL/src/video/kmsdrm/SDL_kmsdrmopengles.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,9 +21,10 @@ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_KMSDRM +#ifdef SDL_VIDEO_DRIVER_KMSDRM #include "SDL_log.h" +#include "SDL_timer.h" #include "SDL_kmsdrmvideo.h" #include "SDL_kmsdrmopengles.h" @@ -40,7 +41,7 @@ void KMSDRM_GLES_DefaultProfileConfig(_THIS, int *mask, int *major, int *minor) { /* if SDL was _also_ built with the Raspberry Pi driver (so we're definitely a Pi device), default to GLES2. */ -#if SDL_VIDEO_DRIVER_RPI +#ifdef SDL_VIDEO_DRIVER_RPI *mask = SDL_GL_CONTEXT_PROFILE_ES; *major = 2; *minor = 0; @@ -97,6 +98,13 @@ int KMSDRM_GLES_SwapWindow(_THIS, SDL_Window *window) even if you do async flips. */ uint32_t flip_flags = DRM_MODE_PAGE_FLIP_EVENT; + /* Skip the swap if we've switched away to another VT */ + if (windata->egl_surface == EGL_NO_SURFACE) { + /* Wait a bit, throttling to ~100 FPS */ + SDL_Delay(10); + return 0; + } + /* Recreate the GBM / EGL surfaces if the display mode has changed */ if (windata->egl_surface_dirty) { KMSDRM_CreateSurfaces(_this, window); @@ -117,7 +125,7 @@ int KMSDRM_GLES_SwapWindow(_THIS, SDL_Window *window) windata->bo = windata->next_bo; - /* Mark a buffer to becume the next front buffer. + /* Mark a buffer to become the next front buffer. This won't happen until pagelip completes. */ if (!(_this->egl_data->eglSwapBuffers(_this->egl_data->egl_display, windata->egl_surface))) { @@ -136,7 +144,7 @@ int KMSDRM_GLES_SwapWindow(_THIS, SDL_Window *window) /* Get an actual usable fb for the next front buffer. */ fb_info = KMSDRM_FBFromBO(_this, windata->next_bo); - if (fb_info == NULL) { + if (!fb_info) { SDL_LogError(SDL_LOG_CATEGORY_VIDEO, "Could not get a framebuffer"); return 0; } @@ -186,7 +194,7 @@ int KMSDRM_GLES_SwapWindow(_THIS, SDL_Window *window) we have waited here, there won't be a pending pageflip so the WaitPageflip at the beginning of this function will be a no-op. Just leave it here and don't worry. - Run your SDL2 program with "SDL_KMSDRM_DOUBLE_BUFFER=1 " + Run your SDL2 program with "SDL_VIDEO_DOUBLE_BUFFER=1 " to enable this. */ if (windata->double_buffer) { if (!KMSDRM_WaitPageflip(_this, windata)) { diff --git a/thirdparty/SDL/src/video/kmsdrm/SDL_kmsdrmopengles.h b/thirdparty/SDL/src/video/kmsdrm/SDL_kmsdrmopengles.h index 0f1ef8740..63e548a33 100644 --- a/thirdparty/SDL/src/video/kmsdrm/SDL_kmsdrmopengles.h +++ b/thirdparty/SDL/src/video/kmsdrm/SDL_kmsdrmopengles.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -23,7 +23,7 @@ #ifndef SDL_kmsdrmopengles_h_ #define SDL_kmsdrmopengles_h_ -#if SDL_VIDEO_DRIVER_KMSDRM +#ifdef SDL_VIDEO_DRIVER_KMSDRM #include "../SDL_sysvideo.h" #include "../SDL_egl_c.h" diff --git a/thirdparty/SDL/src/video/kmsdrm/SDL_kmsdrmsym.h b/thirdparty/SDL/src/video/kmsdrm/SDL_kmsdrmsym.h index 8b9e7b257..7a99e1b6a 100644 --- a/thirdparty/SDL/src/video/kmsdrm/SDL_kmsdrmsym.h +++ b/thirdparty/SDL/src/video/kmsdrm/SDL_kmsdrmsym.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -42,6 +42,7 @@ SDL_KMSDRM_SYM(void,drmModeFreeConnector,(drmModeConnectorPtr ptr)) SDL_KMSDRM_SYM(void,drmModeFreeEncoder,(drmModeEncoderPtr ptr)) SDL_KMSDRM_SYM(int,drmGetCap,(int fd, uint64_t capability, uint64_t *value)) SDL_KMSDRM_SYM(int,drmSetMaster,(int fd)) +SDL_KMSDRM_SYM(int,drmDropMaster,(int fd)) SDL_KMSDRM_SYM(int,drmAuthMagic,(int fd, drm_magic_t magic)) SDL_KMSDRM_SYM(drmModeResPtr,drmModeGetResources,(int fd)) SDL_KMSDRM_SYM(int,drmModeAddFB,(int fd, uint32_t width, uint32_t height, uint8_t depth, @@ -53,6 +54,11 @@ SDL_KMSDRM_SYM(int,drmModeAddFB2,(int fd, uint32_t width, uint32_t height, const uint32_t pitches[4], const uint32_t offsets[4], uint32_t *buf_id, uint32_t flags)) +SDL_KMSDRM_SYM(int,drmModeAddFB2WithModifiers,(int fd, uint32_t width, + uint32_t height, uint32_t pixel_format, const uint32_t bo_handles[4], + const uint32_t pitches[4], const uint32_t offsets[4], + const uint64_t modifier[4], uint32_t *buf_id, uint32_t flags)) + SDL_KMSDRM_SYM(int,drmModeRmFB,(int fd, uint32_t bufferId)) SDL_KMSDRM_SYM(drmModeFBPtr,drmModeGetFB,(int fd, uint32_t buf)) SDL_KMSDRM_SYM(drmModeCrtcPtr,drmModeGetCrtc,(int fd, uint32_t crtcId)) @@ -62,7 +68,7 @@ SDL_KMSDRM_SYM(int,drmModeSetCrtc,(int fd, uint32_t crtcId, uint32_t bufferId, SDL_KMSDRM_SYM(int,drmModeCrtcGetGamma,(int fd, uint32_t crtc_id, uint32_t size, uint16_t *red, uint16_t *green, uint16_t *blue)) SDL_KMSDRM_SYM(int,drmModeCrtcSetGamma,(int fd, uint32_t crtc_id, uint32_t size, - uint16_t *red, uint16_t *green, uint16_t *blue)) + const uint16_t *red, const uint16_t *green, const uint16_t *blue)) SDL_KMSDRM_SYM(int,drmModeSetCursor,(int fd, uint32_t crtcId, uint32_t bo_handle, uint32_t width, uint32_t height)) SDL_KMSDRM_SYM(int,drmModeSetCursor2,(int fd, uint32_t crtcId, uint32_t bo_handle, @@ -123,6 +129,11 @@ SDL_KMSDRM_SYM(void,gbm_surface_destroy,(struct gbm_surface *surf)) SDL_KMSDRM_SYM(struct gbm_bo *,gbm_surface_lock_front_buffer,(struct gbm_surface *surf)) SDL_KMSDRM_SYM(void,gbm_surface_release_buffer,(struct gbm_surface *surf, struct gbm_bo *bo)) +SDL_KMSDRM_SYM(uint64_t,gbm_bo_get_modifier,(struct gbm_bo *bo)) +SDL_KMSDRM_SYM(int,gbm_bo_get_plane_count,(struct gbm_bo *bo)) +SDL_KMSDRM_SYM(uint32_t,gbm_bo_get_offset,(struct gbm_bo *bo, int plane)) +SDL_KMSDRM_SYM(uint32_t,gbm_bo_get_stride_for_plane,(struct gbm_bo *bo, int plane)) +SDL_KMSDRM_SYM(union gbm_bo_handle,gbm_bo_get_handle_for_plane,(struct gbm_bo *bo, int plane);) #undef SDL_KMSDRM_MODULE #undef SDL_KMSDRM_SYM diff --git a/thirdparty/SDL/src/video/kmsdrm/SDL_kmsdrmvideo.c b/thirdparty/SDL/src/video/kmsdrm/SDL_kmsdrmvideo.c index ebe15fe9c..b7abb4fc7 100644 --- a/thirdparty/SDL/src/video/kmsdrm/SDL_kmsdrmvideo.c +++ b/thirdparty/SDL/src/video/kmsdrm/SDL_kmsdrmvideo.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,7 +21,7 @@ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_KMSDRM +#ifdef SDL_VIDEO_DRIVER_KMSDRM /* SDL internals */ #include "../SDL_sysvideo.h" @@ -77,6 +77,7 @@ static int get_driindex(void) int devindex = -1; DIR *folder; const char *hint; + struct dirent *res; hint = SDL_GetHint(SDL_HINT_KMSDRM_DEVICE_INDEX); if (hint && *hint) { @@ -89,14 +90,14 @@ static int get_driindex(void) SDL_strlcpy(device, kmsdrm_dri_path, sizeof(device)); folder = opendir(device); - if (folder == NULL) { + if (!folder) { SDL_SetError("Failed to open directory '%s'", device); return -ENOENT; } SDL_strlcpy(device + kmsdrm_dri_pathsize, kmsdrm_dri_devname, sizeof(device) - kmsdrm_dri_devnamesize); - for (struct dirent *res; (res = readdir(folder));) { + while((res = readdir(folder)) != NULL && available < 0) { if (SDL_memcmp(res->d_name, kmsdrm_dri_devname, kmsdrm_dri_devnamesize) == 0) { SDL_strlcpy(device + kmsdrm_dri_pathsize + kmsdrm_dri_devnamesize, @@ -122,31 +123,32 @@ static int get_driindex(void) resources->count_encoders > 0 && resources->count_crtcs > 0) { available = -ENOENT; - for (i = 0; i < resources->count_connectors; i++) { + for (i = 0; i < resources->count_connectors && available < 0; i++) { drmModeConnector *conn = KMSDRM_drmModeGetConnector( drm_fd, resources->connectors[i]); - if (conn == NULL) { + if (!conn) { continue; } if (conn->connection == DRM_MODE_CONNECTED && conn->count_modes) { + SDL_bool access_denied = SDL_FALSE; if (SDL_GetHintBoolean( SDL_HINT_KMSDRM_REQUIRE_DRM_MASTER, SDL_TRUE)) { /* Skip this device if we can't obtain * DRM master */ KMSDRM_drmSetMaster(drm_fd); - if (KMSDRM_drmAuthMagic(drm_fd, 0) == - -EACCES) { - continue; + if (KMSDRM_drmAuthMagic(drm_fd, 0) == -EACCES) { + access_denied = SDL_TRUE; } } - available = devindex; - break; + if (!access_denied) { + available = devindex; + } } KMSDRM_drmModeFreeConnector(conn); @@ -157,11 +159,10 @@ static int get_driindex(void) SDL_KMSDRM_UnloadSymbols(); } close(drm_fd); + } else { + SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, + "Failed to open KMSDRM device %s, errno: %d\n", device, errno); } - - SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, - "Failed to open KMSDRM device %s, errno: %d\n", device, - errno); } } @@ -241,13 +242,13 @@ static SDL_VideoDevice *KMSDRM_CreateDevice(void) } device = (SDL_VideoDevice *)SDL_calloc(1, sizeof(SDL_VideoDevice)); - if (device == NULL) { + if (!device) { SDL_OutOfMemory(); return NULL; } viddata = (SDL_VideoData *)SDL_calloc(1, sizeof(SDL_VideoData)); - if (viddata == NULL) { + if (!viddata) { SDL_OutOfMemory(); goto cleanup; } @@ -290,7 +291,7 @@ static SDL_VideoDevice *KMSDRM_CreateDevice(void) device->GL_DeleteContext = KMSDRM_GLES_DeleteContext; device->GL_DefaultProfileConfig = KMSDRM_GLES_DefaultProfileConfig; -#if SDL_VIDEO_VULKAN +#ifdef SDL_VIDEO_VULKAN device->Vulkan_LoadLibrary = KMSDRM_Vulkan_LoadLibrary; device->Vulkan_UnloadLibrary = KMSDRM_Vulkan_UnloadLibrary; device->Vulkan_GetInstanceExtensions = KMSDRM_Vulkan_GetInstanceExtensions; @@ -315,7 +316,8 @@ static SDL_VideoDevice *KMSDRM_CreateDevice(void) VideoBootStrap KMSDRM_bootstrap = { "KMSDRM", "KMS/DRM Video Driver", - KMSDRM_CreateDevice + KMSDRM_CreateDevice, + NULL /* no ShowMessageBox implementation */ }; static void KMSDRM_FBDestroyCallback(struct gbm_bo *bo, void *data) @@ -334,8 +336,9 @@ KMSDRM_FBInfo *KMSDRM_FBFromBO(_THIS, struct gbm_bo *bo) { SDL_VideoData *viddata = ((SDL_VideoData *)_this->driverdata); unsigned w, h; - int ret; - Uint32 stride, handle; + int ret, num_planes = 0; + Uint32 format, strides[4] = { 0 }, handles[4] = { 0 }, offsets[4] = { 0 }, flags = 0; + uint64_t modifiers[4] = { 0 }; /* Check for an existing framebuffer */ KMSDRM_FBInfo *fb_info = (KMSDRM_FBInfo *)KMSDRM_gbm_bo_get_user_data(bo); @@ -348,27 +351,47 @@ KMSDRM_FBInfo *KMSDRM_FBFromBO(_THIS, struct gbm_bo *bo) when the backing buffer is destroyed */ fb_info = (KMSDRM_FBInfo *)SDL_calloc(1, sizeof(KMSDRM_FBInfo)); - if (fb_info == NULL) { + if (!fb_info) { SDL_OutOfMemory(); return NULL; } fb_info->drm_fd = viddata->drm_fd; - /* Create framebuffer object for the buffer */ + /* Create framebuffer object for the buffer using the modifiers requested by GBM. + Use of the modifiers is necessary on some platforms. */ w = KMSDRM_gbm_bo_get_width(bo); h = KMSDRM_gbm_bo_get_height(bo); - stride = KMSDRM_gbm_bo_get_stride(bo); - handle = KMSDRM_gbm_bo_get_handle(bo).u32; - ret = KMSDRM_drmModeAddFB(viddata->drm_fd, w, h, 24, 32, stride, handle, - &fb_info->fb_id); + format = KMSDRM_gbm_bo_get_format(bo); + + modifiers[0] = KMSDRM_gbm_bo_get_modifier(bo); + num_planes = KMSDRM_gbm_bo_get_plane_count(bo); + for (int i = 0; i < num_planes; i++) { + strides[i] = KMSDRM_gbm_bo_get_stride_for_plane(bo, i); + handles[i] = KMSDRM_gbm_bo_get_handle_for_plane(bo, i).u32; + offsets[i] = KMSDRM_gbm_bo_get_offset(bo, i); + modifiers[i] = modifiers[0]; + } + + if (modifiers[0] && modifiers[0] != DRM_FORMAT_MOD_INVALID) { + flags = DRM_MODE_FB_MODIFIERS; + } + + ret = KMSDRM_drmModeAddFB2WithModifiers(viddata->drm_fd, w, h, format, handles, strides, offsets, modifiers, &fb_info->fb_id, flags); + + if (ret) { + strides[0] = KMSDRM_gbm_bo_get_stride(bo); + handles[0] = KMSDRM_gbm_bo_get_handle(bo).u32; + ret = KMSDRM_drmModeAddFB(viddata->drm_fd, w, h, 24, 32, strides[0], handles[0], &fb_info->fb_id); + } + if (ret) { SDL_free(fb_info); return NULL; } - SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "New DRM FB (%u): %ux%u, stride %u from BO %p", - fb_info->fb_id, w, h, stride, (void *)bo); + SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "New DRM FB (%u): %ux%u, from BO %p", + fb_info->fb_id, w, h, (void *)bo); /* Associate our DRM framebuffer with this buffer object */ KMSDRM_gbm_bo_set_user_data(bo, fb_info, KMSDRM_FBDestroyCallback); @@ -677,7 +700,7 @@ static void KMSDRM_AddDisplay(_THIS, drmModeConnector *connector, drmModeRes *re /* Reserve memory for the new display's driverdata. */ dispdata = (SDL_DisplayData *)SDL_calloc(1, sizeof(SDL_DisplayData)); - if (dispdata == NULL) { + if (!dispdata) { ret = SDL_OutOfMemory(); goto cleanup; } @@ -698,7 +721,7 @@ static void KMSDRM_AddDisplay(_THIS, drmModeConnector *connector, drmModeRes *re for (i = 0; i < resources->count_encoders; i++) { encoder = KMSDRM_drmModeGetEncoder(viddata->drm_fd, resources->encoders[i]); - if (encoder == NULL) { + if (!encoder) { continue; } @@ -710,13 +733,13 @@ static void KMSDRM_AddDisplay(_THIS, drmModeConnector *connector, drmModeRes *re encoder = NULL; } - if (encoder == NULL) { + if (!encoder) { /* No encoder was connected, find the first supported one */ for (i = 0; i < resources->count_encoders; i++) { encoder = KMSDRM_drmModeGetEncoder(viddata->drm_fd, resources->encoders[i]); - if (encoder == NULL) { + if (!encoder) { continue; } @@ -735,7 +758,7 @@ static void KMSDRM_AddDisplay(_THIS, drmModeConnector *connector, drmModeRes *re } } - if (encoder == NULL) { + if (!encoder) { ret = SDL_SetError("No connected encoder found for connector."); goto cleanup; } @@ -745,7 +768,7 @@ static void KMSDRM_AddDisplay(_THIS, drmModeConnector *connector, drmModeRes *re /* If no CRTC was connected to the encoder, find the first CRTC that is supported by the encoder, and use that. */ - if (crtc == NULL) { + if (!crtc) { for (i = 0; i < resources->count_crtcs; i++) { if (encoder->possible_crtcs & (1 << i)) { encoder->crtc_id = resources->crtcs[i]; @@ -755,7 +778,7 @@ static void KMSDRM_AddDisplay(_THIS, drmModeConnector *connector, drmModeRes *re } } - if (crtc == NULL) { + if (!crtc) { ret = SDL_SetError("No CRTC found for connector."); goto cleanup; } @@ -840,7 +863,7 @@ static void KMSDRM_AddDisplay(_THIS, drmModeConnector *connector, drmModeRes *re There's no problem with it being still incomplete. */ modedata = SDL_calloc(1, sizeof(SDL_DisplayModeData)); - if (modedata == NULL) { + if (!modedata) { ret = SDL_OutOfMemory(); goto cleanup; } @@ -910,7 +933,7 @@ static int KMSDRM_InitDisplays(_THIS) /* Get all of the available connectors / devices / crtcs */ resources = KMSDRM_drmModeGetResources(viddata->drm_fd); - if (resources == NULL) { + if (!resources) { ret = SDL_SetError("drmModeGetResources(%d) failed", viddata->drm_fd); goto cleanup; } @@ -921,7 +944,7 @@ static int KMSDRM_InitDisplays(_THIS) drmModeConnector *connector = KMSDRM_drmModeGetConnector(viddata->drm_fd, resources->connectors[i]); - if (connector == NULL) { + if (!connector) { continue; } @@ -1206,6 +1229,38 @@ int KMSDRM_CreateSurfaces(_THIS, SDL_Window *window) return ret; } +#ifdef SDL_INPUT_LINUXEV +static void KMSDRM_ReleaseVT(void *userdata) +{ + SDL_VideoDevice *_this = (SDL_VideoDevice *)userdata; + SDL_VideoData *viddata = _this->driverdata; + int i; + + for (i = 0; i < viddata->num_windows; i++) { + SDL_Window *window = viddata->windows[i]; + if (!(window->flags & SDL_WINDOW_VULKAN)) { + KMSDRM_DestroySurfaces(_this, window); + } + } + KMSDRM_drmDropMaster(viddata->drm_fd); +} + +static void KMSDRM_AcquireVT(void *userdata) +{ + SDL_VideoDevice *_this = (SDL_VideoDevice *)userdata; + SDL_VideoData *viddata = _this->driverdata; + int i; + + KMSDRM_drmSetMaster(viddata->drm_fd); + for (i = 0; i < viddata->num_windows; i++) { + SDL_Window *window = viddata->windows[i]; + if (!(window->flags & SDL_WINDOW_VULKAN)) { + KMSDRM_CreateSurfaces(_this, window); + } + } +} +#endif /* defined SDL_INPUT_LINUXEV */ + int KMSDRM_VideoInit(_THIS) { int ret = 0; @@ -1226,6 +1281,7 @@ int KMSDRM_VideoInit(_THIS) #ifdef SDL_INPUT_LINUXEV SDL_EVDEV_Init(); + SDL_EVDEV_SetVTSwitchCallbacks(KMSDRM_ReleaseVT, _this, KMSDRM_AcquireVT, _this); #elif defined(SDL_INPUT_WSCONS) SDL_WSCONS_Init(); #endif @@ -1244,6 +1300,7 @@ void KMSDRM_VideoQuit(_THIS) KMSDRM_DeinitDisplays(_this); #ifdef SDL_INPUT_LINUXEV + SDL_EVDEV_SetVTSwitchCallbacks(NULL, NULL, NULL, NULL); SDL_EVDEV_Quit(); #elif defined(SDL_INPUT_WSCONS) SDL_WSCONS_Quit(); @@ -1300,7 +1357,7 @@ int KMSDRM_SetDisplayMode(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mod return 0; } - if (modedata == NULL) { + if (!modedata) { return SDL_SetError("Mode doesn't have an associated index"); } @@ -1323,7 +1380,7 @@ void KMSDRM_DestroyWindow(_THIS, SDL_Window *window) SDL_bool is_vulkan = window->flags & SDL_WINDOW_VULKAN; /* Is this a VK window? */ unsigned int i, j; - if (windata == NULL) { + if (!windata) { return; } @@ -1407,7 +1464,7 @@ int KMSDRM_CreateWindow(_THIS, SDL_Window *window) /* Allocate window internal data */ windata = (SDL_WindowData *)SDL_calloc(1, sizeof(SDL_WindowData)); - if (windata == NULL) { + if (!windata) { return SDL_OutOfMemory(); } @@ -1415,6 +1472,12 @@ int KMSDRM_CreateWindow(_THIS, SDL_Window *window) windata->viddata = viddata; window->driverdata = windata; + /* Do we want a double buffering scheme to get low video lag? */ + windata->double_buffer = SDL_FALSE; + if (SDL_GetHintBoolean(SDL_HINT_VIDEO_DOUBLE_BUFFER, SDL_FALSE)) { + windata->double_buffer = SDL_TRUE; + } + if (!is_vulkan && !vulkan_mode) { /* NON-Vulkan block. */ /* Maybe you didn't ask for an OPENGL window, but that's what you will get. @@ -1520,7 +1583,12 @@ int KMSDRM_CreateWindow(_THIS, SDL_Window *window) SDL_SetKeyboardFocus(window); /* Tell the app that the window has moved to top-left. */ - SDL_SendWindowEvent(window, SDL_WINDOWEVENT_MOVED, 0, 0); + { + SDL_Rect display_bounds; + SDL_zero(display_bounds); + SDL_GetDisplayBounds(SDL_GetWindowDisplayIndex(window), &display_bounds); + SDL_SendWindowEvent(window, SDL_WINDOWEVENT_MOVED, display_bounds.x, display_bounds.y); + } /* Allocated windata will be freed in KMSDRM_DestroyWindow, and KMSDRM_DestroyWindow() will be called by SDL_CreateWindow() @@ -1548,7 +1616,7 @@ int KMSDRM_SetWindowGammaRamp(_THIS, SDL_Window * window, const Uint16 * ramp) SDL_VideoDisplay *disp = SDL_GetDisplayForWindow(window); SDL_DisplayData* dispdata = (SDL_DisplayData*)disp->driverdata; Uint16* tempRamp = SDL_calloc(3 * sizeof(Uint16), 256); - if (tempRamp == NULL) + if (!tempRamp) { return SDL_OutOfMemory(); } diff --git a/thirdparty/SDL/src/video/kmsdrm/SDL_kmsdrmvideo.h b/thirdparty/SDL/src/video/kmsdrm/SDL_kmsdrmvideo.h index b48f6ef70..1fe77f697 100644 --- a/thirdparty/SDL/src/video/kmsdrm/SDL_kmsdrmvideo.h +++ b/thirdparty/SDL/src/video/kmsdrm/SDL_kmsdrmvideo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -33,6 +33,45 @@ #include #include +#ifndef DRM_FORMAT_MOD_INVALID +#define DRM_FORMAT_MOD_INVALID 0x00ffffffffffffffULL +#endif + +#ifndef DRM_MODE_FB_MODIFIERS +#define DRM_MODE_FB_MODIFIERS 2 +#endif + +#ifndef DRM_MODE_PAGE_FLIP_ASYNC +#define DRM_MODE_PAGE_FLIP_ASYNC 2 +#endif + +#ifndef DRM_MODE_OBJECT_CONNECTOR +#define DRM_MODE_OBJECT_CONNECTOR 0xc0c0c0c0 +#endif + +#ifndef DRM_MODE_OBJECT_CRTC +#define DRM_MODE_OBJECT_CRTC 0xcccccccc +#endif + +#ifndef DRM_CAP_ASYNC_PAGE_FLIP +#define DRM_CAP_ASYNC_PAGE_FLIP 7 +#endif + +#ifndef DRM_CAP_CURSOR_WIDTH +#define DRM_CAP_CURSOR_WIDTH 8 +#endif + +#ifndef DRM_CAP_CURSOR_HEIGHT +#define DRM_CAP_CURSOR_HEIGHT 9 +#endif + +#ifndef GBM_FORMAT_ARGB8888 +#define GBM_FORMAT_ARGB8888 ((uint32_t)('A') | ((uint32_t)('R') << 8) | ((uint32_t)('2') << 16) | ((uint32_t)('4') << 24)) +#define GBM_BO_USE_CURSOR (1 << 1) +#define GBM_BO_USE_WRITE (1 << 3) +#define GBM_BO_USE_LINEAR (1 << 4) +#endif + typedef struct SDL_VideoData { int devindex; /* device index that was passed on creation */ diff --git a/thirdparty/SDL/src/video/kmsdrm/SDL_kmsdrmvulkan.c b/thirdparty/SDL/src/video/kmsdrm/SDL_kmsdrmvulkan.c index 567bfc71d..b5dc7b802 100644 --- a/thirdparty/SDL/src/video/kmsdrm/SDL_kmsdrmvulkan.c +++ b/thirdparty/SDL/src/video/kmsdrm/SDL_kmsdrmvulkan.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -26,7 +26,7 @@ #include "../../SDL_internal.h" -#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_KMSDRM +#if defined(SDL_VIDEO_VULKAN) && defined(SDL_VIDEO_DRIVER_KMSDRM) #include "SDL_kmsdrmvideo.h" #include "SDL_kmsdrmdyn.h" @@ -56,10 +56,10 @@ int KMSDRM_Vulkan_LoadLibrary(_THIS, const char *path) } /* Load the Vulkan library */ - if (path == NULL) { + if (!path) { path = SDL_getenv("SDL_VULKAN_LIBRARY"); } - if (path == NULL) { + if (!path) { path = DEFAULT_VULKAN; } @@ -93,7 +93,7 @@ int KMSDRM_Vulkan_LoadLibrary(_THIS, const char *path) _this->vulkan_config.vkEnumerateInstanceExtensionProperties, &extensionCount); - if (extensions == NULL) { + if (!extensions) { goto fail; } diff --git a/thirdparty/SDL/src/video/kmsdrm/SDL_kmsdrmvulkan.h b/thirdparty/SDL/src/video/kmsdrm/SDL_kmsdrmvulkan.h index 76e865ad0..01a582aaa 100644 --- a/thirdparty/SDL/src/video/kmsdrm/SDL_kmsdrmvulkan.h +++ b/thirdparty/SDL/src/video/kmsdrm/SDL_kmsdrmvulkan.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -32,7 +32,7 @@ #include "../SDL_vulkan_internal.h" #include "../SDL_sysvideo.h" -#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_KMSDRM +#if defined(SDL_VIDEO_VULKAN) && defined(SDL_VIDEO_DRIVER_KMSDRM) int KMSDRM_Vulkan_LoadLibrary(_THIS, const char *path); void KMSDRM_Vulkan_UnloadLibrary(_THIS); diff --git a/thirdparty/SDL/src/video/n3ds/SDL_n3dsevents.c b/thirdparty/SDL/src/video/n3ds/SDL_n3dsevents.c index a5489fbf2..c45bb8089 100644 --- a/thirdparty/SDL/src/video/n3ds/SDL_n3dsevents.c +++ b/thirdparty/SDL/src/video/n3ds/SDL_n3dsevents.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/n3ds/SDL_n3dsevents_c.h b/thirdparty/SDL/src/video/n3ds/SDL_n3dsevents_c.h index f3b7b3948..2e75951fd 100644 --- a/thirdparty/SDL/src/video/n3ds/SDL_n3dsevents_c.h +++ b/thirdparty/SDL/src/video/n3ds/SDL_n3dsevents_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/n3ds/SDL_n3dsframebuffer.c b/thirdparty/SDL/src/video/n3ds/SDL_n3dsframebuffer.c index 601e8bc0f..784c2df44 100644 --- a/thirdparty/SDL/src/video/n3ds/SDL_n3dsframebuffer.c +++ b/thirdparty/SDL/src/video/n3ds/SDL_n3dsframebuffer.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -47,7 +47,7 @@ int SDL_N3DS_CreateWindowFramebuffer(_THIS, SDL_Window *window, Uint32 *format, FreePreviousWindowFramebuffer(window); framebuffer = CreateNewWindowFramebuffer(window); - if (framebuffer == NULL) { + if (!framebuffer) { return SDL_OutOfMemory(); } @@ -84,7 +84,7 @@ int SDL_N3DS_UpdateWindowFramebuffer(_THIS, SDL_Window *window, const SDL_Rect * u32 bufsize; surface = (SDL_Surface *)SDL_GetWindowData(window, N3DS_SURFACE); - if (surface == NULL) { + if (!surface) { return SDL_SetError("%s: Unable to get the window surface.", __func__); } diff --git a/thirdparty/SDL/src/video/n3ds/SDL_n3dsframebuffer_c.h b/thirdparty/SDL/src/video/n3ds/SDL_n3dsframebuffer_c.h index cd690748a..19a9e9575 100644 --- a/thirdparty/SDL/src/video/n3ds/SDL_n3dsframebuffer_c.h +++ b/thirdparty/SDL/src/video/n3ds/SDL_n3dsframebuffer_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/n3ds/SDL_n3dsswkb.c b/thirdparty/SDL/src/video/n3ds/SDL_n3dsswkb.c index 9170a2ae9..1543c0b00 100644 --- a/thirdparty/SDL/src/video/n3ds/SDL_n3dsswkb.c +++ b/thirdparty/SDL/src/video/n3ds/SDL_n3dsswkb.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -30,17 +30,17 @@ static SwkbdState sw_keyboard; const static size_t BUFFER_SIZE = 256; -void N3DS_SwkbInit() +void N3DS_SwkbInit(void) { swkbdInit(&sw_keyboard, SWKBD_TYPE_NORMAL, 2, -1); } -void N3DS_SwkbPoll() +void N3DS_SwkbPoll(void) { return; } -void N3DS_SwkbQuit() +void N3DS_SwkbQuit(void) { return; } diff --git a/thirdparty/SDL/src/video/n3ds/SDL_n3dsswkb.h b/thirdparty/SDL/src/video/n3ds/SDL_n3dsswkb.h index 86f6a096c..04a355b29 100644 --- a/thirdparty/SDL/src/video/n3ds/SDL_n3dsswkb.h +++ b/thirdparty/SDL/src/video/n3ds/SDL_n3dsswkb.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/n3ds/SDL_n3dstouch.c b/thirdparty/SDL/src/video/n3ds/SDL_n3dstouch.c index 02e3b6f6f..982c578ac 100644 --- a/thirdparty/SDL/src/video/n3ds/SDL_n3dstouch.c +++ b/thirdparty/SDL/src/video/n3ds/SDL_n3dstouch.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/n3ds/SDL_n3dstouch.h b/thirdparty/SDL/src/video/n3ds/SDL_n3dstouch.h index 4a99d6259..d99e5a321 100644 --- a/thirdparty/SDL/src/video/n3ds/SDL_n3dstouch.h +++ b/thirdparty/SDL/src/video/n3ds/SDL_n3dstouch.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/n3ds/SDL_n3dsvideo.c b/thirdparty/SDL/src/video/n3ds/SDL_n3dsvideo.c index 1668f9dec..fc875d3ce 100644 --- a/thirdparty/SDL/src/video/n3ds/SDL_n3dsvideo.c +++ b/thirdparty/SDL/src/video/n3ds/SDL_n3dsvideo.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -57,7 +57,7 @@ static void N3DS_DeleteDevice(SDL_VideoDevice *device) static SDL_VideoDevice *N3DS_CreateDevice(void) { SDL_VideoDevice *device = (SDL_VideoDevice *)SDL_calloc(1, sizeof(SDL_VideoDevice)); - if (device == NULL) { + if (!device) { SDL_OutOfMemory(); return 0; } @@ -86,7 +86,7 @@ static SDL_VideoDevice *N3DS_CreateDevice(void) return device; } -VideoBootStrap N3DS_bootstrap = { N3DSVID_DRIVER_NAME, "N3DS Video Driver", N3DS_CreateDevice }; +VideoBootStrap N3DS_bootstrap = { N3DSVID_DRIVER_NAME, "N3DS Video Driver", N3DS_CreateDevice, NULL /* no ShowMessageBox implementation */ }; static int N3DS_VideoInit(_THIS) { @@ -108,7 +108,7 @@ AddN3DSDisplay(gfxScreen_t screen) SDL_DisplayMode mode; SDL_VideoDisplay display; DisplayDriverData *display_driver_data = SDL_calloc(1, sizeof(DisplayDriverData)); - if (display_driver_data == NULL) { + if (!display_driver_data) { SDL_OutOfMemory(); return; } @@ -150,7 +150,7 @@ static void N3DS_GetDisplayModes(_THIS, SDL_VideoDisplay *display) static int N3DS_GetDisplayBounds(_THIS, SDL_VideoDisplay *display, SDL_Rect *rect) { DisplayDriverData *driver_data = (DisplayDriverData *)display->driverdata; - if (driver_data == NULL) { + if (!driver_data) { return -1; } rect->x = 0; @@ -165,7 +165,7 @@ static int N3DS_CreateWindow(_THIS, SDL_Window *window) { DisplayDriverData *display_data; SDL_WindowData *window_data = (SDL_WindowData *)SDL_calloc(1, sizeof(SDL_WindowData)); - if (window_data == NULL) { + if (!window_data) { return SDL_OutOfMemory(); } display_data = (DisplayDriverData *)SDL_GetDisplayDriverData(window->display_index); @@ -177,7 +177,7 @@ static int N3DS_CreateWindow(_THIS, SDL_Window *window) static void N3DS_DestroyWindow(_THIS, SDL_Window *window) { - if (window == NULL) { + if (!window) { return; } SDL_free(window->driverdata); diff --git a/thirdparty/SDL/src/video/n3ds/SDL_n3dsvideo.h b/thirdparty/SDL/src/video/n3ds/SDL_n3dsvideo.h index 05561b9b9..455eaf425 100644 --- a/thirdparty/SDL/src/video/n3ds/SDL_n3dsvideo.h +++ b/thirdparty/SDL/src/video/n3ds/SDL_n3dsvideo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/nacl/SDL_naclevents.c b/thirdparty/SDL/src/video/nacl/SDL_naclevents.c index ce03e525e..6e7226e1c 100644 --- a/thirdparty/SDL/src/video/nacl/SDL_naclevents.c +++ b/thirdparty/SDL/src/video/nacl/SDL_naclevents.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_NACL +#ifdef SDL_VIDEO_DRIVER_NACL #include "SDL.h" #include "../../events/SDL_events_c.h" diff --git a/thirdparty/SDL/src/video/nacl/SDL_naclevents_c.h b/thirdparty/SDL/src/video/nacl/SDL_naclevents_c.h index fbf51fdcc..4bf777a76 100644 --- a/thirdparty/SDL/src/video/nacl/SDL_naclevents_c.h +++ b/thirdparty/SDL/src/video/nacl/SDL_naclevents_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/nacl/SDL_naclglue.c b/thirdparty/SDL/src/video/nacl/SDL_naclglue.c index 1146c6883..04b0823ab 100644 --- a/thirdparty/SDL/src/video/nacl/SDL_naclglue.c +++ b/thirdparty/SDL/src/video/nacl/SDL_naclglue.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,5 +20,5 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_NACL +#ifdef SDL_VIDEO_DRIVER_NACL #endif /* SDL_VIDEO_DRIVER_NACL */ diff --git a/thirdparty/SDL/src/video/nacl/SDL_naclopengles.c b/thirdparty/SDL/src/video/nacl/SDL_naclopengles.c index 5889839f3..fd121b711 100644 --- a/thirdparty/SDL/src/video/nacl/SDL_naclopengles.c +++ b/thirdparty/SDL/src/video/nacl/SDL_naclopengles.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_NACL +#ifdef SDL_VIDEO_DRIVER_NACL /* NaCl SDL video GLES 2 driver implementation */ diff --git a/thirdparty/SDL/src/video/nacl/SDL_naclopengles.h b/thirdparty/SDL/src/video/nacl/SDL_naclopengles.h index 62e90b153..5ae394612 100644 --- a/thirdparty/SDL/src/video/nacl/SDL_naclopengles.h +++ b/thirdparty/SDL/src/video/nacl/SDL_naclopengles.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/nacl/SDL_naclvideo.c b/thirdparty/SDL/src/video/nacl/SDL_naclvideo.c index ef8903807..53fc679b0 100644 --- a/thirdparty/SDL/src/video/nacl/SDL_naclvideo.c +++ b/thirdparty/SDL/src/video/nacl/SDL_naclvideo.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_NACL +#ifdef SDL_VIDEO_DRIVER_NACL #include "ppapi/c/pp_errors.h" #include "ppapi/c/pp_instance.h" @@ -134,7 +134,8 @@ static SDL_VideoDevice *NACL_CreateDevice(void) { VideoBootStrap NACL_bootstrap = { NACLVID_DRIVER_NAME, "SDL Native Client Video Driver", - NACL_CreateDevice + NACL_CreateDevice, + NULL /* no ShowMessageBox implementation */ }; int NACL_VideoInit(_THIS) { diff --git a/thirdparty/SDL/src/video/nacl/SDL_naclvideo.h b/thirdparty/SDL/src/video/nacl/SDL_naclvideo.h index b2a85588e..504f4d622 100644 --- a/thirdparty/SDL/src/video/nacl/SDL_naclvideo.h +++ b/thirdparty/SDL/src/video/nacl/SDL_naclvideo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/nacl/SDL_naclwindow.c b/thirdparty/SDL/src/video/nacl/SDL_naclwindow.c index 3c2222051..200b345f9 100644 --- a/thirdparty/SDL/src/video/nacl/SDL_naclwindow.c +++ b/thirdparty/SDL/src/video/nacl/SDL_naclwindow.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_NACL +#ifdef SDL_VIDEO_DRIVER_NACL #include "../SDL_sysvideo.h" diff --git a/thirdparty/SDL/src/video/nacl/SDL_naclwindow.h b/thirdparty/SDL/src/video/nacl/SDL_naclwindow.h index 26f09cd3e..9ac941c47 100644 --- a/thirdparty/SDL/src/video/nacl/SDL_naclwindow.h +++ b/thirdparty/SDL/src/video/nacl/SDL_naclwindow.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/ngage/SDL_ngageevents.cpp b/thirdparty/SDL/src/video/ngage/SDL_ngageevents.cpp index d5b8b3abf..3ecf164ef 100644 --- a/thirdparty/SDL/src/video/ngage/SDL_ngageevents.cpp +++ b/thirdparty/SDL/src/video/ngage/SDL_ngageevents.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,7 +21,7 @@ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_NGAGE +#ifdef SDL_VIDEO_DRIVER_NGAGE /* Being a ngage driver, there's no event stream. We just define stubs for most of the API. */ diff --git a/thirdparty/SDL/src/video/ngage/SDL_ngageevents_c.h b/thirdparty/SDL/src/video/ngage/SDL_ngageevents_c.h index 1fa0ba76c..e0ef5a031 100644 --- a/thirdparty/SDL/src/video/ngage/SDL_ngageevents_c.h +++ b/thirdparty/SDL/src/video/ngage/SDL_ngageevents_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/ngage/SDL_ngageframebuffer.cpp b/thirdparty/SDL/src/video/ngage/SDL_ngageframebuffer.cpp index 20b1857dc..98fb495d4 100644 --- a/thirdparty/SDL/src/video/ngage/SDL_ngageframebuffer.cpp +++ b/thirdparty/SDL/src/video/ngage/SDL_ngageframebuffer.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,7 +21,7 @@ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_NGAGE +#ifdef SDL_VIDEO_DRIVER_NGAGE #include @@ -57,7 +57,7 @@ int SDL_NGAGE_CreateWindowFramebuffer(_THIS, SDL_Window *window, Uint32 *format, /* Create a new one */ SDL_GetWindowSizeInPixels(window, &w, &h); surface = SDL_CreateRGBSurfaceWithFormat(0, w, h, 0, surface_format); - if (surface == NULL) { + if (!surface) { return -1; } @@ -149,7 +149,7 @@ int SDL_NGAGE_UpdateWindowFramebuffer(_THIS, SDL_Window *window, const SDL_Rect SDL_Surface *surface; surface = (SDL_Surface *)SDL_GetWindowData(window, NGAGE_SURFACE); - if (surface == NULL) { + if (!surface) { return SDL_SetError("Couldn't find ngage surface for window"); } diff --git a/thirdparty/SDL/src/video/ngage/SDL_ngageframebuffer_c.h b/thirdparty/SDL/src/video/ngage/SDL_ngageframebuffer_c.h index adbfff510..02c50efa3 100644 --- a/thirdparty/SDL/src/video/ngage/SDL_ngageframebuffer_c.h +++ b/thirdparty/SDL/src/video/ngage/SDL_ngageframebuffer_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/ngage/SDL_ngagevideo.cpp b/thirdparty/SDL/src/video/ngage/SDL_ngagevideo.cpp index 4b5c692e6..d18abc837 100644 --- a/thirdparty/SDL/src/video/ngage/SDL_ngagevideo.cpp +++ b/thirdparty/SDL/src/video/ngage/SDL_ngagevideo.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,7 +25,7 @@ #endif #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_NGAGE +#ifdef SDL_VIDEO_DRIVER_NGAGE #ifdef __cplusplus extern "C" { @@ -106,14 +106,14 @@ static SDL_VideoDevice *NGAGE_CreateDevice(void) /* Initialize all variables that we clean on shutdown */ device = (SDL_VideoDevice *)SDL_calloc(1, sizeof(SDL_VideoDevice)); - if (device == NULL) { + if (!device) { SDL_OutOfMemory(); return 0; } /* Initialize internal N-Gage specific data */ phdata = (SDL_VideoData *)SDL_calloc(1, sizeof(SDL_VideoData)); - if (phdata == NULL) { + if (!phdata) { SDL_OutOfMemory(); SDL_free(device); return 0; @@ -141,7 +141,8 @@ static SDL_VideoDevice *NGAGE_CreateDevice(void) VideoBootStrap NGAGE_bootstrap = { NGAGEVID_DRIVER_NAME, "SDL ngage video driver", - NGAGE_CreateDevice + NGAGE_CreateDevice, + NULL /* no ShowMessageBox implementation */ }; int NGAGE_VideoInit(_THIS) diff --git a/thirdparty/SDL/src/video/ngage/SDL_ngagevideo.h b/thirdparty/SDL/src/video/ngage/SDL_ngagevideo.h index 367814117..57386e102 100644 --- a/thirdparty/SDL/src/video/ngage/SDL_ngagevideo.h +++ b/thirdparty/SDL/src/video/ngage/SDL_ngagevideo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/ngage/SDL_ngagewindow.cpp b/thirdparty/SDL/src/video/ngage/SDL_ngagewindow.cpp index 9d598b79f..37a6be05c 100644 --- a/thirdparty/SDL/src/video/ngage/SDL_ngagewindow.cpp +++ b/thirdparty/SDL/src/video/ngage/SDL_ngagewindow.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,7 +21,7 @@ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_NGAGE +#ifdef SDL_VIDEO_DRIVER_NGAGE #include "../SDL_sysvideo.h" @@ -36,7 +36,7 @@ int NGAGE_CreateWindow(_THIS, SDL_Window *window) { NGAGE_Window *ngage_window = (NGAGE_Window *)SDL_calloc(1, sizeof(NGAGE_Window)); - if (ngage_window == NULL) { + if (!ngage_window) { return SDL_OutOfMemory(); } diff --git a/thirdparty/SDL/src/video/ngage/SDL_ngagewindow.h b/thirdparty/SDL/src/video/ngage/SDL_ngagewindow.h index 500d8dcd1..933ca8e9e 100644 --- a/thirdparty/SDL/src/video/ngage/SDL_ngagewindow.h +++ b/thirdparty/SDL/src/video/ngage/SDL_ngagewindow.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/offscreen/SDL_offscreenevents.c b/thirdparty/SDL/src/video/offscreen/SDL_offscreenevents.c index 57e12b473..d825162b8 100644 --- a/thirdparty/SDL/src/video/offscreen/SDL_offscreenevents.c +++ b/thirdparty/SDL/src/video/offscreen/SDL_offscreenevents.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_OFFSCREEN +#ifdef SDL_VIDEO_DRIVER_OFFSCREEN /* Being a offscreen driver, there's no event stream. We just define stubs for most of the API. */ diff --git a/thirdparty/SDL/src/video/offscreen/SDL_offscreenevents_c.h b/thirdparty/SDL/src/video/offscreen/SDL_offscreenevents_c.h index de1d53093..ccbef93f2 100644 --- a/thirdparty/SDL/src/video/offscreen/SDL_offscreenevents_c.h +++ b/thirdparty/SDL/src/video/offscreen/SDL_offscreenevents_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/offscreen/SDL_offscreenframebuffer.c b/thirdparty/SDL/src/video/offscreen/SDL_offscreenframebuffer.c index 4e27c7250..2b9337b11 100644 --- a/thirdparty/SDL/src/video/offscreen/SDL_offscreenframebuffer.c +++ b/thirdparty/SDL/src/video/offscreen/SDL_offscreenframebuffer.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_OFFSCREEN +#ifdef SDL_VIDEO_DRIVER_OFFSCREEN #include "../SDL_sysvideo.h" #include "SDL_offscreenframebuffer_c.h" @@ -39,7 +39,7 @@ int SDL_OFFSCREEN_CreateWindowFramebuffer(_THIS, SDL_Window *window, Uint32 *for /* Create a new one */ SDL_GetWindowSizeInPixels(window, &w, &h); surface = SDL_CreateRGBSurfaceWithFormat(0, w, h, 0, surface_format); - if (surface == NULL) { + if (!surface) { return -1; } @@ -58,7 +58,7 @@ int SDL_OFFSCREEN_UpdateWindowFramebuffer(_THIS, SDL_Window *window, const SDL_R SDL_Surface *surface; surface = (SDL_Surface *)SDL_GetWindowData(window, OFFSCREEN_SURFACE); - if (surface == NULL) { + if (!surface) { return SDL_SetError("Couldn't find offscreen surface for window"); } diff --git a/thirdparty/SDL/src/video/offscreen/SDL_offscreenframebuffer_c.h b/thirdparty/SDL/src/video/offscreen/SDL_offscreenframebuffer_c.h index abad40f5e..1151576f3 100644 --- a/thirdparty/SDL/src/video/offscreen/SDL_offscreenframebuffer_c.h +++ b/thirdparty/SDL/src/video/offscreen/SDL_offscreenframebuffer_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/offscreen/SDL_offscreenopengles.c b/thirdparty/SDL/src/video/offscreen/SDL_offscreenopengles.c index 818569677..a36cf5188 100644 --- a/thirdparty/SDL/src/video/offscreen/SDL_offscreenopengles.c +++ b/thirdparty/SDL/src/video/offscreen/SDL_offscreenopengles.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_OFFSCREEN && SDL_VIDEO_OPENGL_EGL +#if defined(SDL_VIDEO_DRIVER_OFFSCREEN) && defined(SDL_VIDEO_OPENGL_EGL) #include "SDL_offscreenopengles.h" #include "SDL_offscreenvideo.h" diff --git a/thirdparty/SDL/src/video/offscreen/SDL_offscreenopengles.h b/thirdparty/SDL/src/video/offscreen/SDL_offscreenopengles.h index 12a068afc..c8c23f1c0 100644 --- a/thirdparty/SDL/src/video/offscreen/SDL_offscreenopengles.h +++ b/thirdparty/SDL/src/video/offscreen/SDL_offscreenopengles.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -23,7 +23,7 @@ #ifndef _SDL_offscreenopengles_h #define _SDL_offscreenopengles_h -#if SDL_VIDEO_DRIVER_OFFSCREEN && SDL_VIDEO_OPENGL_EGL +#if defined(SDL_VIDEO_DRIVER_OFFSCREEN) && defined(SDL_VIDEO_OPENGL_EGL) #include "../SDL_sysvideo.h" #include "../SDL_egl_c.h" diff --git a/thirdparty/SDL/src/video/offscreen/SDL_offscreenvideo.c b/thirdparty/SDL/src/video/offscreen/SDL_offscreenvideo.c index 2fd86d98f..2d42374ad 100644 --- a/thirdparty/SDL/src/video/offscreen/SDL_offscreenvideo.c +++ b/thirdparty/SDL/src/video/offscreen/SDL_offscreenvideo.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_OFFSCREEN +#ifdef SDL_VIDEO_DRIVER_OFFSCREEN /* Offscreen video driver is similar to dummy driver, however its purpose * is enabling applications to use some of the SDL video functionality @@ -58,7 +58,7 @@ static SDL_VideoDevice *OFFSCREEN_CreateDevice(void) /* Initialize all variables that we clean on shutdown */ device = (SDL_VideoDevice *)SDL_calloc(1, sizeof(SDL_VideoDevice)); - if (device == NULL) { + if (!device) { SDL_OutOfMemory(); return 0; } @@ -73,7 +73,7 @@ static SDL_VideoDevice *OFFSCREEN_CreateDevice(void) device->DestroyWindowFramebuffer = SDL_OFFSCREEN_DestroyWindowFramebuffer; device->free = OFFSCREEN_DeleteDevice; -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL /* GL context */ device->GL_SwapWindow = OFFSCREEN_GLES_SwapWindow; device->GL_MakeCurrent = OFFSCREEN_GLES_MakeCurrent; @@ -95,7 +95,8 @@ static SDL_VideoDevice *OFFSCREEN_CreateDevice(void) VideoBootStrap OFFSCREEN_bootstrap = { OFFSCREENVID_DRIVER_NAME, "SDL offscreen video driver", - OFFSCREEN_CreateDevice + OFFSCREEN_CreateDevice, + NULL /* no ShowMessageBox implementation */ }; int OFFSCREEN_VideoInit(_THIS) diff --git a/thirdparty/SDL/src/video/offscreen/SDL_offscreenvideo.h b/thirdparty/SDL/src/video/offscreen/SDL_offscreenvideo.h index 7780f4909..f4e3c8fe8 100644 --- a/thirdparty/SDL/src/video/offscreen/SDL_offscreenvideo.h +++ b/thirdparty/SDL/src/video/offscreen/SDL_offscreenvideo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/offscreen/SDL_offscreenwindow.c b/thirdparty/SDL/src/video/offscreen/SDL_offscreenwindow.c index 03a14c390..58fc2e95e 100644 --- a/thirdparty/SDL/src/video/offscreen/SDL_offscreenwindow.c +++ b/thirdparty/SDL/src/video/offscreen/SDL_offscreenwindow.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_OFFSCREEN +#ifdef SDL_VIDEO_DRIVER_OFFSCREEN #include "../SDL_sysvideo.h" #include "../SDL_egl_c.h" @@ -31,7 +31,7 @@ int OFFSCREEN_CreateWindow(_THIS, SDL_Window *window) { OFFSCREEN_Window *offscreen_window = SDL_calloc(1, sizeof(OFFSCREEN_Window)); - if (offscreen_window == NULL) { + if (!offscreen_window) { return SDL_OutOfMemory(); } @@ -47,7 +47,7 @@ int OFFSCREEN_CreateWindow(_THIS, SDL_Window *window) offscreen_window->sdl_window = window; -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL if (window->flags & SDL_WINDOW_OPENGL) { if (!_this->egl_data) { @@ -73,7 +73,7 @@ void OFFSCREEN_DestroyWindow(_THIS, SDL_Window *window) OFFSCREEN_Window *offscreen_window = window->driverdata; if (offscreen_window) { -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL SDL_EGL_DestroySurface(_this, offscreen_window->egl_surface); #endif SDL_free(offscreen_window); diff --git a/thirdparty/SDL/src/video/offscreen/SDL_offscreenwindow.h b/thirdparty/SDL/src/video/offscreen/SDL_offscreenwindow.h index 692f5d5d6..aa189c086 100644 --- a/thirdparty/SDL/src/video/offscreen/SDL_offscreenwindow.h +++ b/thirdparty/SDL/src/video/offscreen/SDL_offscreenwindow.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -28,7 +28,7 @@ typedef struct { SDL_Window *sdl_window; -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL EGLSurface egl_surface; #endif diff --git a/thirdparty/SDL/src/video/os2/SDL_os2dive.c b/thirdparty/SDL/src/video/os2/SDL_os2dive.c index 1b3eb13ba..0cb873532 100644 --- a/thirdparty/SDL/src/video/os2/SDL_os2dive.c +++ b/thirdparty/SDL/src/video/os2/SDL_os2dive.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -101,7 +101,7 @@ PVODATA voOpen(void) { PVODATA pVOData = SDL_calloc(1, sizeof(VODATA)); - if (pVOData == NULL) { + if (!pVOData) { SDL_OutOfMemory(); return NULL; } @@ -277,7 +277,7 @@ static VOID voVideoBufFree(PVODATA pVOData) pVOData->ulDIVEBufNum = 0; } - if (pVOData->pBuffer != NULL) { + if (pVOData->pBuffer) { ulRC = DosFreeMem(pVOData->pBuffer); if (ulRC != NO_ERROR) { debug_os2("DosFreeMem(), rc = %u", ulRC); @@ -296,11 +296,11 @@ static BOOL voUpdate(PVODATA pVOData, HWND hwnd, SDL_Rect *pSDLRects, return FALSE; } - if (pSDLRects != NULL) { + if (pSDLRects) { PBYTE pbLineMask; pbLineMask = SDL_stack_alloc(BYTE, pVOData->ulHeight); - if (pbLineMask == NULL) { + if (!pbLineMask) { debug_os2("Not enough stack size"); return FALSE; } diff --git a/thirdparty/SDL/src/video/os2/SDL_os2messagebox.c b/thirdparty/SDL/src/video/os2/SDL_os2messagebox.c index 83ac8775e..e39463575 100644 --- a/thirdparty/SDL/src/video/os2/SDL_os2messagebox.c +++ b/thirdparty/SDL/src/video/os2/SDL_os2messagebox.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_OS2 +#ifdef SDL_VIDEO_DRIVER_OS2 /* Display a OS/2 message box */ @@ -206,9 +206,9 @@ static HWND _makeDlg(const SDL_MessageBoxData *messageboxdata) ULONG cSDLBtnData = messageboxdata->numbuttons; PSZ pszTitle = OS2_UTF8ToSys(messageboxdata->title); - ULONG cbTitle = (pszTitle == NULL)? 1 : (SDL_strlen(pszTitle) + 1); + ULONG cbTitle = (!pszTitle)? 1 : (SDL_strlen(pszTitle) + 1); PSZ pszText = OS2_UTF8ToSys(messageboxdata->message); - ULONG cbText = (pszText == NULL)? 1 : (SDL_strlen(pszText) + 1); + ULONG cbText = (!pszText)? 1 : (SDL_strlen(pszText) + 1); PDLGTEMPLATE pTemplate; ULONG cbTemplate; @@ -219,7 +219,7 @@ static HWND _makeDlg(const SDL_MessageBoxData *messageboxdata) ULONG cbBtnText; HWND hwnd; - const SDL_MessageBoxColor* pSDLColors = (messageboxdata->colorScheme == NULL)? + const SDL_MessageBoxColor* pSDLColors = (!messageboxdata->colorScheme)? NULL : messageboxdata->colorScheme->colors; const SDL_MessageBoxColor* pSDLColor; @@ -237,11 +237,11 @@ static HWND _makeDlg(const SDL_MessageBoxData *messageboxdata) /* Button items datas - text for buttons. */ for (ulIdx = 0; ulIdx < cSDLBtnData; ulIdx++) { pszBtnText = (PSZ)pSDLBtnData[ulIdx].text; - cbTemplate += (pszBtnText == NULL)? 1 : (SDL_strlen(pszBtnText) + 1); + cbTemplate += (!pszBtnText)? 1 : (SDL_strlen(pszBtnText) + 1); } /* Presentation parameter space. */ - if (pSDLColors != NULL) { + if (pSDLColors) { cbTemplate += 26 /* PP for frame. */ + 26 /* PP for static text. */ + (48 * cSDLBtnData); /* PP for buttons. */ @@ -284,14 +284,14 @@ static HWND _makeDlg(const SDL_MessageBoxData *messageboxdata) } pcDlgData += pDlgItem->cchText; - pDlgItem->flStyle = WS_GROUP | WS_VISIBLE | WS_CLIPSIBLINGS | + pDlgItem->flStyle = WS_GROUP | WS_VISIBLE | WS_CLIPSIBLINGS | FS_DLGBORDER | WS_SAVEBITS; pDlgItem->x = 100; pDlgItem->y = 100; pDlgItem->cx = 175; pDlgItem->cy = 65; pDlgItem->id = DID_OK; /* An ID value? */ - if (pSDLColors == NULL) + if (!pSDLColors) pDlgItem->offPresParams = 0; else { /* Presentation parameter for the frame - dialog colors. */ @@ -346,7 +346,7 @@ static HWND _makeDlg(const SDL_MessageBoxData *messageboxdata) pDlgItem->cy = 62; /* It will be used. */ pDlgItem->id = IDD_TEXT_MESSAGE; /* an ID value */ - if (pSDLColors == NULL) + if (!pSDLColors) pDlgItem->offPresParams = 0; else { /* Presentation parameter for the static text - dialog colors. */ @@ -407,7 +407,7 @@ static HWND _makeDlg(const SDL_MessageBoxData *messageboxdata) pDlgItem->offClassName = (USHORT)WC_BUTTON; pszBtnText = OS2_UTF8ToSys(pSDLBtnData[ulIdx].text); - cbBtnText = (pszBtnText == NULL)? 1 : (SDL_strlen(pszBtnText) + 1); + cbBtnText = (!pszBtnText)? 1 : (SDL_strlen(pszBtnText) + 1); pDlgItem->cchText = cbBtnText; pDlgItem->offText = pcDlgData - (PCHAR)pTemplate; /* Offset to the text. */ /* Copy text for the button into the dialog template. */ @@ -435,7 +435,7 @@ static HWND _makeDlg(const SDL_MessageBoxData *messageboxdata) pDlgItem->cy = 15; pDlgItem->id = IDD_PB_FIRST + ulIdx; /* an ID value */ - if (pSDLColors == NULL) + if (!pSDLColors) pDlgItem->offPresParams = 0; else { /* Presentation parameter for the button - dialog colors. */ @@ -473,7 +473,7 @@ static HWND _makeDlg(const SDL_MessageBoxData *messageboxdata) /* Create the dialog from template. */ stDlgData.cb = sizeof(MSGBOXDLGDATA); - stDlgData.hwndUnder = (messageboxdata->window != NULL && messageboxdata->window->driverdata != NULL)? + stDlgData.hwndUnder = (messageboxdata->window && messageboxdata->window->driverdata)? ((WINDATA *)messageboxdata->window->driverdata)->hwnd : HWND_DESKTOP; hwnd = WinCreateDlg(HWND_DESKTOP, /* Parent is desktop. */ diff --git a/thirdparty/SDL/src/video/os2/SDL_os2messagebox.h b/thirdparty/SDL/src/video/os2/SDL_os2messagebox.h index 92b94d98c..453d035a7 100644 --- a/thirdparty/SDL/src/video/os2/SDL_os2messagebox.h +++ b/thirdparty/SDL/src/video/os2/SDL_os2messagebox.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_OS2 +#ifdef SDL_VIDEO_DRIVER_OS2 extern int OS2_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid); diff --git a/thirdparty/SDL/src/video/os2/SDL_os2mouse.c b/thirdparty/SDL/src/video/os2/SDL_os2mouse.c index 3ffdef917..220766a4c 100644 --- a/thirdparty/SDL/src/video/os2/SDL_os2mouse.c +++ b/thirdparty/SDL/src/video/os2/SDL_os2mouse.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_OS2 +#ifdef SDL_VIDEO_DRIVER_OS2 #include "SDL_os2video.h" #include "../../events/SDL_mouse_c.h" @@ -46,7 +46,7 @@ static SDL_Cursor* OS2_CreateCursor(SDL_Surface *surface, int hot_x, int hot_y) return NULL; pSDLCursor = SDL_calloc(1, sizeof(SDL_Cursor)); - if (pSDLCursor == NULL) { + if (!pSDLCursor) { WinDestroyPointer(hptr); SDL_OutOfMemory(); return NULL; @@ -91,7 +91,7 @@ static SDL_Cursor* OS2_CreateSystemCursor(SDL_SystemCursor id) } pSDLCursor = SDL_calloc(1, sizeof(SDL_Cursor)); - if (pSDLCursor == NULL) { + if (!pSDLCursor) { WinDestroyPointer(hptr); SDL_OutOfMemory(); return NULL; @@ -111,7 +111,7 @@ static void OS2_FreeCursor(SDL_Cursor *cursor) static int OS2_ShowCursor(SDL_Cursor *cursor) { - hptrCursor = (cursor != NULL)? (HPOINTER)cursor->driverdata : NULLHANDLE; + hptrCursor = (cursor)? (HPOINTER)cursor->driverdata : NULLHANDLE; return ((SDL_GetMouseFocus() == NULL) || WinSetPointer(HWND_DESKTOP, hptrCursor))? 0 : -1; } @@ -137,7 +137,7 @@ static int OS2_WarpMouseGlobal(int x, int y) static int OS2_CaptureMouse(SDL_Window *window) { - return WinSetCapture(HWND_DESKTOP, (window == NULL)? NULLHANDLE : + return WinSetCapture(HWND_DESKTOP, (!window)? NULLHANDLE : ((WINDATA *)window->driverdata)->hwnd)? 0 : -1; } @@ -182,7 +182,7 @@ void OS2_QuitMouse(_THIS) { SDL_Mouse *pSDLMouse = SDL_GetMouse(); - if (pSDLMouse->def_cursor != NULL) { + if (pSDLMouse->def_cursor) { SDL_free(pSDLMouse->def_cursor); pSDLMouse->def_cursor = NULL; pSDLMouse->cur_cursor = NULL; diff --git a/thirdparty/SDL/src/video/os2/SDL_os2mouse.h b/thirdparty/SDL/src/video/os2/SDL_os2mouse.h index e9c4d476d..ccd99da7a 100644 --- a/thirdparty/SDL/src/video/os2/SDL_os2mouse.h +++ b/thirdparty/SDL/src/video/os2/SDL_os2mouse.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/os2/SDL_os2output.h b/thirdparty/SDL/src/video/os2/SDL_os2output.h index 284fc856c..7115ab72d 100644 --- a/thirdparty/SDL/src/video/os2/SDL_os2output.h +++ b/thirdparty/SDL/src/video/os2/SDL_os2output.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/os2/SDL_os2util.c b/thirdparty/SDL/src/video/os2/SDL_os2util.c index e6a306fbf..44450b6eb 100644 --- a/thirdparty/SDL/src/video/os2/SDL_os2util.c +++ b/thirdparty/SDL/src/video/os2/SDL_os2util.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_OS2 +#ifdef SDL_VIDEO_DRIVER_OS2 #include "SDL_os2util.h" @@ -41,7 +41,7 @@ HPOINTER utilCreatePointer(SDL_Surface *surface, ULONG ulHotX, ULONG ulHotY) } pulBitmap = (PULONG) SDL_malloc(surface->h * surface->w * 2 * sizeof(ULONG)); - if (pulBitmap == NULL) { + if (!pulBitmap) { SDL_OutOfMemory(); return NULLHANDLE; } diff --git a/thirdparty/SDL/src/video/os2/SDL_os2util.h b/thirdparty/SDL/src/video/os2/SDL_os2util.h index 88f64c079..5def7b6be 100644 --- a/thirdparty/SDL/src/video/os2/SDL_os2util.h +++ b/thirdparty/SDL/src/video/os2/SDL_os2util.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/os2/SDL_os2video.c b/thirdparty/SDL/src/video/os2/SDL_os2video.c index 1fdd2c64f..8da1f4f48 100644 --- a/thirdparty/SDL/src/video/os2/SDL_os2video.c +++ b/thirdparty/SDL/src/video/os2/SDL_os2video.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,7 +21,7 @@ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_OS2 +#ifdef SDL_VIDEO_DRIVER_OS2 #include "SDL_video.h" #include "SDL_mouse.h" @@ -31,6 +31,7 @@ #include "SDL_os2video.h" #include "SDL_syswm.h" #include "SDL_os2util.h" +#include "SDL_os2messagebox.h" #define __MEERROR_H__ #define _MEERROR_H_ @@ -171,7 +172,7 @@ static SDL_DisplayMode *_getDisplayModeForSDLWindow(SDL_Window *window) { SDL_VideoDisplay *pSDLDisplay = SDL_GetDisplayForWindow(window); - if (pSDLDisplay == NULL) { + if (!pSDLDisplay) { debug_os2("No display for the window"); return FALSE; } @@ -201,19 +202,19 @@ static VOID _setVisibleRegion(WINDATA *pWinData, BOOL fVisible) { SDL_VideoDisplay *pSDLDisplay; - if (! pWinData->pVOData) + if (!pWinData->pVOData) return; pSDLDisplay = (fVisible)? SDL_GetDisplayForWindow(pWinData->window) : NULL; pWinData->pOutput->SetVisibleRegion(pWinData->pVOData, pWinData->hwnd, - (pSDLDisplay == NULL) ? - NULL : &pSDLDisplay->current_mode, + (!pSDLDisplay) ? + NULL : &pSDLDisplay->current_mode, pWinData->hrgnShape, fVisible); } static VOID _wmPaint(WINDATA *pWinData, HWND hwnd) { - if (pWinData->pVOData == NULL || + if (!pWinData->pVOData || !pWinData->pOutput->Update(pWinData->pVOData, hwnd, NULL, 0)) { RECTL rectl; HPS hps; @@ -438,7 +439,7 @@ static MRESULT EXPENTRY wndFrameProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp HWND hwndClient = WinQueryWindow(hwnd, QW_BOTTOM); WINDATA * pWinData = (WINDATA *)WinQueryWindowULong(hwndClient, 0); - if (pWinData == NULL) + if (!pWinData) return WinDefWindowProc(hwnd, msg, mp1, mp2); /* Send a SDL_SYSWMEVENT if the application wants them */ @@ -544,7 +545,7 @@ static MRESULT EXPENTRY wndProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) { WINDATA *pWinData = (WINDATA *)WinQueryWindowULong(hwnd, 0); - if (pWinData == NULL) + if (!pWinData) return WinDefWindowProc(hwnd, msg, mp1, mp2); /* Send a SDL_SYSWMEVENT if the application wants them */ @@ -565,7 +566,7 @@ static MRESULT EXPENTRY wndProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) case WM_CLOSE: case WM_QUIT: SDL_SendWindowEvent(pWinData->window, SDL_WINDOWEVENT_CLOSE, 0, 0); - if (pWinData->fnUserWndProc == NULL) + if (!pWinData->fnUserWndProc) return (MRESULT)FALSE; break; @@ -642,7 +643,7 @@ static MRESULT EXPENTRY wndProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) case WM_TRANSLATEACCEL: /* ALT and acceleration keys not allowed (must be processed in WM_CHAR) */ - if (mp1 == NULL || ((PQMSG)mp1)->msg != WM_CHAR) + if (!mp1 || ((PQMSG)mp1)->msg != WM_CHAR) break; return (MRESULT)FALSE; @@ -690,7 +691,7 @@ static MRESULT EXPENTRY wndProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) return _wmDrop(pWinData, (PDRAGINFO)PVOIDFROMMP(mp1)); } - return (pWinData->fnUserWndProc != NULL)? + return (pWinData->fnUserWndProc)? pWinData->fnUserWndProc(hwnd, msg, mp1, mp2) : WinDefWindowProc(hwnd, msg, mp1, mp2); } @@ -715,7 +716,7 @@ static WINDATA *_setupWindow(_THIS, SDL_Window *window, HWND hwndFrame, SDL_VideoData *pVData = (SDL_VideoData *)_this->driverdata; WINDATA *pWinData = SDL_calloc(1, sizeof(WINDATA)); - if (pWinData == NULL) { + if (!pWinData) { SDL_OutOfMemory(); return NULL; } @@ -745,7 +746,7 @@ static int OS2_CreateWindow(_THIS, SDL_Window *window) ULONG ulSWPFlags = SWP_SIZE | SWP_SHOW | SWP_ZORDER | SWP_ACTIVATE; WINDATA *pWinData; - if (pSDLDisplayMode == NULL) + if (!pSDLDisplayMode) return -1; /* Create a PM window */ @@ -766,7 +767,7 @@ static int OS2_CreateWindow(_THIS, SDL_Window *window) /* Setup window data and frame window procedure */ pWinData = _setupWindow(_this, window, hwndFrame, hwnd); - if (pWinData == NULL) { + if (!pWinData) { WinDestroyWindow(hwndFrame); return -1; } @@ -809,7 +810,7 @@ static int OS2_CreateWindowFrom(_THIS, SDL_Window *window, const void *data) POINTL pointl; debug_os2("Enter"); - if (pSDLDisplayMode == NULL) + if (!pSDLDisplayMode) return -1; /* User can accept client OR frame window handle. @@ -892,7 +893,7 @@ static int OS2_CreateWindowFrom(_THIS, SDL_Window *window, const void *data) /* Setup window data and frame window procedure */ pWinData = _setupWindow(_this, window, hwndFrame, hwnd); - if (pWinData == NULL) { + if (!pWinData) { SDL_free(window->title); window->title = NULL; return -1; @@ -911,7 +912,7 @@ static void OS2_DestroyWindow(_THIS, SDL_Window * window) WINDATA *pWinData = (WINDATA *)window->driverdata; debug_os2("Enter"); - if (pWinData == NULL) + if (!pWinData) return; if (pWinData->hrgnShape != NULLHANDLE) { @@ -925,7 +926,7 @@ static void OS2_DestroyWindow(_THIS, SDL_Window * window) window->shaper = NULL; } - if (pWinData->fnUserWndProc == NULL) { + if (!pWinData->fnUserWndProc) { /* Window was created by SDL (OS2_CreateWindow()), * not by user (OS2_CreateWindowFrom()) */ WinDestroyWindow(pWinData->hwndFrame); @@ -933,7 +934,7 @@ static void OS2_DestroyWindow(_THIS, SDL_Window * window) WinSetWindowULong(pWinData->hwnd, 0, 0); } - if ((pVData != NULL) && (pWinData->pVOData != NULL)) { + if ((pVData) && (pWinData->pVOData)) { pVData->pOutput->Close(pWinData->pVOData); pWinData->pVOData = NULL; } @@ -949,7 +950,7 @@ static void OS2_DestroyWindow(_THIS, SDL_Window * window) static void OS2_SetWindowTitle(_THIS, SDL_Window *window) { - PSZ pszTitle = (window->title == NULL)? NULL : OS2_UTF8ToSys(window->title); + PSZ pszTitle = (!window->title)? NULL : OS2_UTF8ToSys(window->title); WinSetWindowText(((WINDATA *)window->driverdata)->hwndFrame, pszTitle); SDL_free(pszTitle); @@ -982,7 +983,7 @@ static void OS2_SetWindowPosition(_THIS, SDL_Window *window) SDL_DisplayMode *pSDLDisplayMode = _getDisplayModeForSDLWindow(window); debug_os2("Enter"); - if (pSDLDisplayMode == NULL) + if (!pSDLDisplayMode) return; rectl.xLeft = 0; @@ -1102,7 +1103,7 @@ static void OS2_SetWindowFullscreen(_THIS, SDL_Window *window, debug_os2("Enter, fullscreen: %u", fullscreen); - if (pSDLDisplayMode == NULL) + if (!pSDLDisplayMode) return; if (SDL_ShouldAllowTopmost() && @@ -1189,7 +1190,7 @@ static void _combineRectRegions(SDL_ShapeTree *node, void *closure) /* Expand rectangles list */ if ((pShapeRects->cRects & 0x0F) == 0) { pRect = SDL_realloc(pShapeRects->pRects, (pShapeRects->cRects + 0x10) * sizeof(RECTL)); - if (pRect == NULL) + if (!pRect) return; pShapeRects->pRects = pRect; } @@ -1235,13 +1236,13 @@ static int OS2_SetWindowShape(SDL_WindowShaper *shaper, SDL_Surface *shape, HPS hps; debug_os2("Enter"); - if (shaper == NULL || shape == NULL || + if (!shaper || !shape || (shape->format->Amask == 0 && shape_mode->mode != ShapeModeColorKey) || shape->w != shaper->window->w || shape->h != shaper->window->h) { return SDL_INVALID_SHAPE_ARGUMENT; } - if (shaper->driverdata != NULL) + if (shaper->driverdata) SDL_FreeShapeTree((SDL_ShapeTree **)&shaper->driverdata); pShapeTree = SDL_CalculateShapeTree(*shape_mode, shape); @@ -1257,7 +1258,7 @@ static int OS2_SetWindowShape(SDL_WindowShaper *shaper, SDL_Surface *shape, if (pWinData->hrgnShape != NULLHANDLE) GpiDestroyRegion(hps, pWinData->hrgnShape); - pWinData->hrgnShape = (stShapeRects.pRects == NULL) ? NULLHANDLE : + pWinData->hrgnShape = (!stShapeRects.pRects) ? NULLHANDLE : GpiCreateRegion(hps, stShapeRects.cRects, stShapeRects.pRects); WinReleasePS(hps); @@ -1270,11 +1271,11 @@ static int OS2_SetWindowShape(SDL_WindowShaper *shaper, SDL_Surface *shape, static int OS2_ResizeWindowShape(SDL_Window *window) { debug_os2("Enter"); - if (window == NULL) + if (!window) return -1; if (window->x != -1000) { - if (window->shaper->driverdata != NULL) + if (window->shaper->driverdata) SDL_FreeShapeTree((SDL_ShapeTree **)window->shaper->driverdata); if (window->shaper->hasshape == SDL_TRUE) { @@ -1295,7 +1296,7 @@ static void OS2_DestroyWindowFramebuffer(_THIS, SDL_Window *window) WINDATA *pWinData = (WINDATA *)window->driverdata; debug_os2("Enter"); - if (pWinData != NULL && pWinData->pVOData != NULL) + if (pWinData && pWinData->pVOData) pWinData->pOutput->VideoBufFree(pWinData->pVOData); } @@ -1310,14 +1311,14 @@ static int OS2_CreateWindowFramebuffer(_THIS, SDL_Window *window, ULONG ulWidth, ulHeight; debug_os2("Enter"); - if (pSDLDisplay == NULL) { + if (!pSDLDisplay) { debug_os2("No display for the window"); return -1; } pSDLDisplayMode = &pSDLDisplay->current_mode; pModeData = (MODEDATA *)pSDLDisplayMode->driverdata; - if (pModeData == NULL) + if (!pModeData) return SDL_SetError("No mode data for the display"); SDL_GetWindowSize(window, (int *)&ulWidth, (int *)&ulHeight); @@ -1326,7 +1327,7 @@ static int OS2_CreateWindowFramebuffer(_THIS, SDL_Window *window, *pixels = pWinData->pOutput->VideoBufAlloc( pWinData->pVOData, ulWidth, ulHeight, pModeData->ulDepth, pModeData->fccColorEncoding, (PULONG)pitch); - if (*pixels == NULL) + if (!*pixels) return -1; *format = pSDLDisplayMode->format; @@ -1353,13 +1354,13 @@ static int OS2_SetClipboardText(_THIS, const char *text) { SDL_VideoData *pVData = (SDL_VideoData *)_this->driverdata; PSZ pszClipboard; - PSZ pszText = (text == NULL)? NULL : OS2_UTF8ToSys(text); + PSZ pszText = (!text)? NULL : OS2_UTF8ToSys(text); ULONG cbText; ULONG ulRC; BOOL fSuccess; debug_os2("Enter"); - if (pszText == NULL) + if (!pszText) return -1; cbText = SDL_strlen(pszText) + 1; @@ -1408,7 +1409,7 @@ static char *OS2_GetClipboardText(_THIS) WinCloseClipbrd(pVData->hab); } - return (pszClipboard == NULL) ? SDL_strdup("") : pszClipboard; + return (!pszClipboard) ? SDL_strdup("") : pszClipboard; } static SDL_bool OS2_HasClipboardText(_THIS) @@ -1438,7 +1439,7 @@ static int OS2_VideoInit(_THIS) /* Create SDL video driver private data */ pVData = SDL_calloc(1, sizeof(SDL_VideoData)); - if (pVData == NULL) + if (!pVData) return SDL_OutOfMemory(); /* Change process type code for use Win* API from VIO session */ @@ -1493,7 +1494,7 @@ static int OS2_VideoInit(_THIS) stSDLDisplayMode.driverdata = NULL; pModeData = SDL_malloc(sizeof(MODEDATA)); - if (pModeData != NULL) { + if (pModeData) { pModeData->ulDepth = stVOInfo.ulBPP; pModeData->fccColorEncoding = stVOInfo.fccColorEncoding; pModeData->ulScanLineBytes = stVOInfo.ulScanLineSize; @@ -1507,7 +1508,7 @@ static int OS2_VideoInit(_THIS) stSDLDisplay.num_display_modes = 0; pDisplayData = SDL_malloc(sizeof(DISPLAYDATA)); - if (pDisplayData != NULL) { + if (pDisplayData) { HPS hps = WinGetPS(HWND_DESKTOP); HDC hdc = GpiQueryDevice(hps); @@ -1566,14 +1567,14 @@ static int OS2_GetDisplayDPI(_THIS, SDL_VideoDisplay *display, float *ddpi, DISPLAYDATA *pDisplayData = (DISPLAYDATA *)display->driverdata; debug_os2("Enter"); - if (pDisplayData == NULL) + if (!pDisplayData) return -1; - if (ddpi != NULL) + if (ddpi) *hdpi = pDisplayData->ulDPIDiag; - if (hdpi != NULL) + if (hdpi) *hdpi = pDisplayData->ulDPIHor; - if (vdpi != NULL) + if (vdpi) *vdpi = pDisplayData->ulDPIVer; return 0; @@ -1683,12 +1684,14 @@ static SDL_VideoDevice *OS2VMAN_CreateDevice(void) VideoBootStrap OS2DIVE_bootstrap = { OS2DRIVER_NAME_DIVE, "OS/2 video driver", - OS2DIVE_CreateDevice + OS2DIVE_CreateDevice, + OS2_ShowMessageBox }; VideoBootStrap OS2VMAN_bootstrap = { OS2DRIVER_NAME_VMAN, "OS/2 video driver", - OS2VMAN_CreateDevice + OS2VMAN_CreateDevice, + OS2_ShowMessageBox }; #endif /* SDL_VIDEO_DRIVER_OS2 */ diff --git a/thirdparty/SDL/src/video/os2/SDL_os2video.h b/thirdparty/SDL/src/video/os2/SDL_os2video.h index da6afb606..0f9f3799c 100644 --- a/thirdparty/SDL/src/video/os2/SDL_os2video.h +++ b/thirdparty/SDL/src/video/os2/SDL_os2video.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/os2/SDL_os2vman.c b/thirdparty/SDL/src/video/os2/SDL_os2vman.c index 00ae4bca2..5945e8e4b 100644 --- a/thirdparty/SDL/src/video/os2/SDL_os2vman.c +++ b/thirdparty/SDL/src/video/os2/SDL_os2vman.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -143,7 +143,7 @@ static PRECTL _getRectlArray(PVODATA pVOData, ULONG cRects) return pVOData->pRectl; pRectl = SDL_realloc(pVOData->pRectl, cRects * sizeof(RECTL)); - if (pRectl == NULL) + if (!pRectl) return NULL; pVOData->pRectl = pRectl; @@ -159,7 +159,7 @@ static PBLTRECT _getBltRectArray(PVODATA pVOData, ULONG cRects) return pVOData->pBltRect; pBltRect = SDL_realloc(pVOData->pBltRect, cRects * sizeof(BLTRECT)); - if (pBltRect == NULL) + if (!pBltRect) return NULL; pVOData->pBltRect = pBltRect; @@ -200,7 +200,7 @@ static PVODATA voOpen(void) return NULL; pVOData = SDL_calloc(1, sizeof(VODATA)); - if (pVOData == NULL) { + if (!pVOData) { SDL_OutOfMemory(); return NULL; } @@ -210,10 +210,10 @@ static PVODATA voOpen(void) static VOID voClose(PVODATA pVOData) { - if (pVOData->pRectl != NULL) + if (pVOData->pRectl) SDL_free(pVOData->pRectl); - if (pVOData->pBltRect != NULL) + if (pVOData->pBltRect) SDL_free(pVOData->pBltRect); voVideoBufFree(pVOData); @@ -253,7 +253,7 @@ static BOOL voSetVisibleRegion(PVODATA pVOData, HWND hwnd, WinQueryWindowRect(hwnd, &pVOData->rectlWin); WinMapWindowPoints(hwnd, HWND_DESKTOP, (PPOINTL)&pVOData->rectlWin, 2); - if (pSDLDisplayMode != NULL) { + if (pSDLDisplayMode) { pVOData->ulScreenHeight = pSDLDisplayMode->h; pVOData->ulScreenBytesPerLine = ((MODEDATA *)pSDLDisplayMode->driverdata)->ulScanLineBytes; @@ -302,7 +302,7 @@ static VOID voVideoBufFree(PVODATA pVOData) { ULONG ulRC; - if (pVOData->pBuffer == NULL) + if (!pVOData->pBuffer) return; ulRC = DosFreeMem(pVOData->pBuffer); @@ -329,7 +329,7 @@ static BOOL voUpdate(PVODATA pVOData, HWND hwnd, SDL_Rect *pSDLRects, BITBLTINFO sBitbltInfo; ULONG ulIdx; - if (pVOData->pBuffer == NULL) + if (!pVOData->pBuffer) return FALSE; if (pVOData->hrgnVisible == NULLHANDLE) @@ -366,7 +366,7 @@ static BOOL voUpdate(PVODATA pVOData, HWND hwnd, SDL_Rect *pSDLRects, /* Make list of destination rectangles (prectlDst) list from the source * list (prectl). */ prectlDst = _getRectlArray(pVOData, cSDLRects); - if (prectlDst == NULL) { + if (!prectlDst) { debug_os2("Not enough memory"); return FALSE; } @@ -400,7 +400,7 @@ static BOOL voUpdate(PVODATA pVOData, HWND hwnd, SDL_Rect *pSDLRects, } /* We don't need prectlDst, use it again to store update regions */ prectlDst = _getRectlArray(pVOData, rgnCtl.crcReturned); - if (prectlDst == NULL) { + if (!prectlDst) { debug_os2("Not enough memory"); GpiDestroyRegion(hps, hrgnUpdate); WinReleasePS(hps); @@ -418,7 +418,7 @@ static BOOL voUpdate(PVODATA pVOData, HWND hwnd, SDL_Rect *pSDLRects, /* Make lists for blitting from update regions */ pbrDst = _getBltRectArray(pVOData, cSDLRects); - if (pbrDst == NULL) { + if (!pbrDst) { debug_os2("Not enough memory"); return FALSE; } diff --git a/thirdparty/SDL/src/video/pandora/SDL_pandora.c b/thirdparty/SDL/src/video/pandora/SDL_pandora.c index 16debcb13..35e062347 100644 --- a/thirdparty/SDL/src/video/pandora/SDL_pandora.c +++ b/thirdparty/SDL/src/video/pandora/SDL_pandora.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_PANDORA +#ifdef SDL_VIDEO_DRIVER_PANDORA /* SDL internals */ #include "../SDL_sysvideo.h" @@ -41,43 +41,30 @@ static NativeWindowType hNativeWnd = 0; /* A handle to the window we will create. */ #endif -static int PND_available(void) -{ - return 1; -} - static void PND_destroy(SDL_VideoDevice * device) { - if (device->driverdata != NULL) { + if (device->driverdata) { SDL_free(device->driverdata); device->driverdata = NULL; } SDL_free(device); } -static SDL_VideoDevice *PND_create() +static SDL_VideoDevice *PND_create(void) { SDL_VideoDevice *device; SDL_VideoData *phdata; - int status; - - /* Check if pandora could be initialized */ - status = PND_available(); - if (status == 0) { - /* PND could not be used */ - return NULL; - } /* Initialize SDL_VideoDevice structure */ device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice)); - if (device == NULL) { + if (!device) { SDL_OutOfMemory(); return NULL; } /* Initialize internal Pandora specific data */ phdata = (SDL_VideoData *) SDL_calloc(1, sizeof(SDL_VideoData)); - if (phdata == NULL) { + if (!phdata) { SDL_OutOfMemory(); SDL_free(device); return NULL; @@ -139,8 +126,8 @@ VideoBootStrap PND_bootstrap = { "pandora", "SDL Pandora Video Driver", #endif - PND_available, - PND_create + PND_create, + NULL /* no ShowMessageBox implementation */ }; /*****************************************************************************/ @@ -196,7 +183,7 @@ int PND_createwindow(_THIS, SDL_Window * window) /* Allocate window internal data */ wdata = (SDL_WindowData *) SDL_calloc(1, sizeof(SDL_WindowData)); - if (wdata == NULL) { + if (!wdata) { return SDL_OutOfMemory(); } @@ -297,15 +284,15 @@ SDL_bool PND_getwindowwminfo(_THIS, SDL_Window * window, struct SDL_SysWMinfo *i int PND_gl_loadlibrary(_THIS, const char *path) { /* Check if OpenGL ES library is specified for GF driver */ - if (path == NULL) { + if (!path) { path = SDL_getenv("SDL_OPENGL_LIBRARY"); - if (path == NULL) { + if (!path) { path = SDL_getenv("SDL_OPENGLES_LIBRARY"); } } /* Check if default library loading requested */ - if (path == NULL) { + if (!path) { /* Already linked with GF library which provides egl* subset of */ /* functions, use Common profile of OpenGL ES library by default */ #ifdef WIZ_GLES_LITE @@ -336,7 +323,7 @@ void *PND_gl_getprocaddres(_THIS, const char *proc) /* Try to get function address through the egl interface */ function_address = eglGetProcAddress(proc); - if (function_address != NULL) { + if (function_address) { return function_address; } @@ -344,7 +331,7 @@ void *PND_gl_getprocaddres(_THIS, const char *proc) if (_this->gl_config.dll_handle) { function_address = SDL_LoadFunction(_this->gl_config.dll_handle, proc); - if (function_address != NULL) { + if (function_address) { return function_address; } } @@ -586,16 +573,16 @@ SDL_GLContext PND_gl_createcontext(_THIS, SDL_Window * window) } #ifdef WIZ_GLES_LITE - if( !hNativeWnd ) { - hNativeWnd = (NativeWindowType)SDL_malloc(16*1024); - - if(!hNativeWnd) - printf( "Error: Wiz framebuffer allocatation failed\n" ); - else - printf( "SDL: Wiz framebuffer allocated: %X\n", hNativeWnd ); + if (!hNativeWnd) { + hNativeWnd = (NativeWindowType)SDL_malloc(16*1024); + if (!hNativeWnd) { + printf("Error: Wiz framebuffer allocatation failed\n"); + } else { + printf("SDL: Wiz framebuffer allocated: %X\n", hNativeWnd); + } } else { - printf( "SDL: Wiz framebuffer already allocated: %X\n", hNativeWnd ); + printf("SDL: Wiz framebuffer already allocated: %X\n", hNativeWnd); } wdata->gles_surface = @@ -683,7 +670,7 @@ int PND_gl_makecurrent(_THIS, SDL_Window * window, SDL_GLContext context) return SDL_SetError("PND: GF initialization failed, no OpenGL ES support"); } - if ((window == NULL) && (context == NULL)) { + if ((!window) && (!context)) { status = eglMakeCurrent(phdata->egl_display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); @@ -787,11 +774,10 @@ void PND_gl_deletecontext(_THIS, SDL_GLContext context) } #ifdef WIZ_GLES_LITE - if( hNativeWnd != 0 ) - { + if (hNativeWnd != 0) { SDL_free(hNativeWnd); hNativeWnd = 0; - printf( "SDL: Wiz framebuffer released\n" ); + printf("SDL: Wiz framebuffer released\n"); } #endif diff --git a/thirdparty/SDL/src/video/pandora/SDL_pandora.h b/thirdparty/SDL/src/video/pandora/SDL_pandora.h index 66e5d220f..43faa6a8c 100644 --- a/thirdparty/SDL/src/video/pandora/SDL_pandora.h +++ b/thirdparty/SDL/src/video/pandora/SDL_pandora.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/pandora/SDL_pandora_events.c b/thirdparty/SDL/src/video/pandora/SDL_pandora_events.c index 906c75800..4d6ef6e8c 100644 --- a/thirdparty/SDL/src/video/pandora/SDL_pandora_events.c +++ b/thirdparty/SDL/src/video/pandora/SDL_pandora_events.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_PANDORA +#ifdef SDL_VIDEO_DRIVER_PANDORA /* Being a null driver, there's no event stream. We just define stubs for most of the API. */ diff --git a/thirdparty/SDL/src/video/pandora/SDL_pandora_events.h b/thirdparty/SDL/src/video/pandora/SDL_pandora_events.h index 98974b4ca..4753ff11f 100644 --- a/thirdparty/SDL/src/video/pandora/SDL_pandora_events.h +++ b/thirdparty/SDL/src/video/pandora/SDL_pandora_events.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/ps2/SDL_ps2video.c b/thirdparty/SDL/src/video/ps2/SDL_ps2video.c index 490ea259e..4e823fe2d 100644 --- a/thirdparty/SDL/src/video/ps2/SDL_ps2video.c +++ b/thirdparty/SDL/src/video/ps2/SDL_ps2video.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_PS2 +#ifdef SDL_VIDEO_DRIVER_PS2 /* PS2 SDL video driver implementation; this is just enough to make an * SDL-based application THINK it's got a working video driver, for @@ -107,7 +107,7 @@ static SDL_VideoDevice *PS2_CreateDevice(void) /* Initialize all variables that we clean on shutdown */ device = (SDL_VideoDevice *)SDL_calloc(1, sizeof(SDL_VideoDevice)); - if (device == NULL) { + if (!device) { SDL_OutOfMemory(); return 0; } @@ -126,7 +126,8 @@ static SDL_VideoDevice *PS2_CreateDevice(void) VideoBootStrap PS2_bootstrap = { "PS2", "PS2 Video Driver", - PS2_CreateDevice + PS2_CreateDevice, + NULL /* no ShowMessageBox implementation */ }; #endif /* SDL_VIDEO_DRIVER_PS2 */ diff --git a/thirdparty/SDL/src/video/ps2/SDL_ps2video.h b/thirdparty/SDL/src/video/ps2/SDL_ps2video.h index 70c2b8514..6bc13b81e 100644 --- a/thirdparty/SDL/src/video/ps2/SDL_ps2video.h +++ b/thirdparty/SDL/src/video/ps2/SDL_ps2video.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/psp/SDL_pspevents.c b/thirdparty/SDL/src/video/psp/SDL_pspevents.c index ebea736df..44b487faf 100644 --- a/thirdparty/SDL/src/video/psp/SDL_pspevents.c +++ b/thirdparty/SDL/src/video/psp/SDL_pspevents.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_PSP +#ifdef SDL_VIDEO_DRIVER_PSP /* Being a null driver, there's no event stream. We just define stubs for most of the API. */ @@ -237,7 +237,7 @@ void PSP_InitOSKeymap(_THIS) #endif } -void PSP_EventInit(_THIS) +int PSP_EventInit(_THIS) { #ifdef PSPIRKEYB int outputmode = PSP_IRKBD_OUTPUT_MODE_SCANCODE; @@ -251,14 +251,13 @@ void PSP_EventInit(_THIS) #endif /* Start thread to read data */ if ((event_sem = SDL_CreateSemaphore(1)) == NULL) { - SDL_SetError("Can't create input semaphore"); - return; + return SDL_SetError("Can't create input semaphore"); } running = 1; if ((thread = SDL_CreateThreadInternal(EventUpdate, "PSPInputThread", 4096, NULL)) == NULL) { - SDL_SetError("Can't create input thread"); - return; + return SDL_SetError("Can't create input thread"); } + return 0; } void PSP_EventQuit(_THIS) diff --git a/thirdparty/SDL/src/video/psp/SDL_pspevents_c.h b/thirdparty/SDL/src/video/psp/SDL_pspevents_c.h index 9183def4c..fc9cd0e94 100644 --- a/thirdparty/SDL/src/video/psp/SDL_pspevents_c.h +++ b/thirdparty/SDL/src/video/psp/SDL_pspevents_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -23,5 +23,7 @@ extern void PSP_InitOSKeymap(_THIS); extern void PSP_PumpEvents(_THIS); +extern int PSP_EventInit(_THIS); +extern void PSP_EventQuit(_THIS); /* end of SDL_pspevents_c.h ... */ diff --git a/thirdparty/SDL/src/video/psp/SDL_pspgl.c b/thirdparty/SDL/src/video/psp/SDL_pspgl.c index a00e638e9..7071091e7 100644 --- a/thirdparty/SDL/src/video/psp/SDL_pspgl.c +++ b/thirdparty/SDL/src/video/psp/SDL_pspgl.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_PSP +#ifdef SDL_VIDEO_DRIVER_PSP #include #include diff --git a/thirdparty/SDL/src/video/psp/SDL_pspgl_c.h b/thirdparty/SDL/src/video/psp/SDL_pspgl_c.h index 00128d762..b302c8e3f 100644 --- a/thirdparty/SDL/src/video/psp/SDL_pspgl_c.h +++ b/thirdparty/SDL/src/video/psp/SDL_pspgl_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/psp/SDL_pspmouse.c b/thirdparty/SDL/src/video/psp/SDL_pspmouse.c index 774649adb..57fc45cdd 100644 --- a/thirdparty/SDL/src/video/psp/SDL_pspmouse.c +++ b/thirdparty/SDL/src/video/psp/SDL_pspmouse.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_PSP +#ifdef SDL_VIDEO_DRIVER_PSP #include diff --git a/thirdparty/SDL/src/video/psp/SDL_pspmouse_c.h b/thirdparty/SDL/src/video/psp/SDL_pspmouse_c.h index 3742738ad..a961232b5 100644 --- a/thirdparty/SDL/src/video/psp/SDL_pspmouse_c.h +++ b/thirdparty/SDL/src/video/psp/SDL_pspmouse_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/psp/SDL_pspvideo.c b/thirdparty/SDL/src/video/psp/SDL_pspvideo.c index 676196c01..9631904bd 100644 --- a/thirdparty/SDL/src/video/psp/SDL_pspvideo.c +++ b/thirdparty/SDL/src/video/psp/SDL_pspvideo.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,7 +21,7 @@ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_PSP +#ifdef SDL_VIDEO_DRIVER_PSP /* SDL internals */ #include "../SDL_sysvideo.h" @@ -46,7 +46,7 @@ static void PSP_Destroy(SDL_VideoDevice *device) { /* SDL_VideoData *phdata = (SDL_VideoData *) device->driverdata; */ - if (device->driverdata != NULL) { + if (device->driverdata) { device->driverdata = NULL; } } @@ -59,21 +59,21 @@ static SDL_VideoDevice *PSP_Create() /* Initialize SDL_VideoDevice structure */ device = (SDL_VideoDevice *)SDL_calloc(1, sizeof(SDL_VideoDevice)); - if (device == NULL) { + if (!device) { SDL_OutOfMemory(); return NULL; } /* Initialize internal PSP specific data */ phdata = (SDL_VideoData *)SDL_calloc(1, sizeof(SDL_VideoData)); - if (phdata == NULL) { + if (!phdata) { SDL_OutOfMemory(); SDL_free(device); return NULL; } gldata = (SDL_GLDriverData *)SDL_calloc(1, sizeof(SDL_GLDriverData)); - if (gldata == NULL) { + if (!gldata) { SDL_OutOfMemory(); SDL_free(device); SDL_free(phdata); @@ -134,7 +134,8 @@ static SDL_VideoDevice *PSP_Create() VideoBootStrap PSP_bootstrap = { "PSP", "PSP Video Driver", - PSP_Create + PSP_Create, + NULL /* no ShowMessageBox implementation */ }; /*****************************************************************************/ @@ -145,6 +146,10 @@ int PSP_VideoInit(_THIS) SDL_VideoDisplay display; SDL_DisplayMode current_mode; + if (PSP_EventInit(_this) == -1) { + return -1; /* error string would already be set */ + } + SDL_zero(current_mode); current_mode.w = 480; @@ -169,11 +174,13 @@ int PSP_VideoInit(_THIS) SDL_AddDisplayMode(&display, ¤t_mode); SDL_AddVideoDisplay(&display, SDL_FALSE); - return 1; + + return 0; } void PSP_VideoQuit(_THIS) { + PSP_EventQuit(_this); } void PSP_GetDisplayModes(_THIS, SDL_VideoDisplay *display) @@ -202,7 +209,7 @@ int PSP_CreateWindow(_THIS, SDL_Window *window) /* Allocate window internal data */ wdata = (SDL_WindowData *)SDL_calloc(1, sizeof(SDL_WindowData)); - if (wdata == NULL) { + if (!wdata) { return SDL_OutOfMemory(); } diff --git a/thirdparty/SDL/src/video/psp/SDL_pspvideo.h b/thirdparty/SDL/src/video/psp/SDL_pspvideo.h index 1b9ae9287..442d3eae0 100644 --- a/thirdparty/SDL/src/video/psp/SDL_pspvideo.h +++ b/thirdparty/SDL/src/video/psp/SDL_pspvideo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/qnx/gl.c b/thirdparty/SDL/src/video/qnx/gl.c index cf487ed46..e6e999a60 100644 --- a/thirdparty/SDL/src/video/qnx/gl.c +++ b/thirdparty/SDL/src/video/qnx/gl.c @@ -84,7 +84,7 @@ int glGetConfig(EGLConfig *pconf, int *pformat) // Allocate enough memory for all configurations. egl_configs = SDL_malloc(egl_num_configs * sizeof(*egl_configs)); - if (egl_configs == NULL) { + if (!egl_configs) { return -1; } diff --git a/thirdparty/SDL/src/video/qnx/video.c b/thirdparty/SDL/src/video/qnx/video.c index cecd717d5..924eaa307 100644 --- a/thirdparty/SDL/src/video/qnx/video.c +++ b/thirdparty/SDL/src/video/qnx/video.c @@ -74,7 +74,7 @@ static int createWindow(_THIS, SDL_Window *window) int usage; impl = SDL_calloc(1, sizeof(*impl)); - if (impl == NULL) { + if (!impl) { return -1; } @@ -311,7 +311,7 @@ static SDL_VideoDevice *createDevice(int devindex) SDL_VideoDevice *device; device = (SDL_VideoDevice *)SDL_calloc(1, sizeof(SDL_VideoDevice)); - if (device == NULL) { + if (!device) { return NULL; } @@ -342,5 +342,6 @@ static SDL_VideoDevice *createDevice(int devindex) VideoBootStrap QNX_bootstrap = { "qnx", "QNX Screen", - createDevice + createDevice, + NULL /* no ShowMessageBox implementation */ }; diff --git a/thirdparty/SDL/src/video/raspberry/SDL_rpievents.c b/thirdparty/SDL/src/video/raspberry/SDL_rpievents.c index 9f2fccc0e..5b9bdf062 100644 --- a/thirdparty/SDL/src/video/raspberry/SDL_rpievents.c +++ b/thirdparty/SDL/src/video/raspberry/SDL_rpievents.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,7 +21,7 @@ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_RPI +#ifdef SDL_VIDEO_DRIVER_RPI #include "../../events/SDL_events_c.h" #include "../../events/SDL_keyboard_c.h" diff --git a/thirdparty/SDL/src/video/raspberry/SDL_rpievents_c.h b/thirdparty/SDL/src/video/raspberry/SDL_rpievents_c.h index a4c349676..e3b826c38 100644 --- a/thirdparty/SDL/src/video/raspberry/SDL_rpievents_c.h +++ b/thirdparty/SDL/src/video/raspberry/SDL_rpievents_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,7 +25,5 @@ #include "SDL_rpivideo.h" void RPI_PumpEvents(_THIS); -void RPI_EventInit(_THIS); -void RPI_EventQuit(_THIS); #endif /* SDL_rpievents_c_h_ */ diff --git a/thirdparty/SDL/src/video/raspberry/SDL_rpimouse.c b/thirdparty/SDL/src/video/raspberry/SDL_rpimouse.c index 2d9b884d9..ff35a7913 100644 --- a/thirdparty/SDL/src/video/raspberry/SDL_rpimouse.c +++ b/thirdparty/SDL/src/video/raspberry/SDL_rpimouse.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_RPI +#ifdef SDL_VIDEO_DRIVER_RPI #include "SDL_surface.h" #include "SDL_hints.h" @@ -70,12 +70,12 @@ static SDL_Cursor *RPI_CreateCursor(SDL_Surface *surface, int hot_x, int hot_y) SDL_assert(surface->pitch == surface->w * 4); cursor = (SDL_Cursor *)SDL_calloc(1, sizeof(*cursor)); - if (cursor == NULL) { + if (!cursor) { SDL_OutOfMemory(); return NULL; } curdata = (RPI_CursorData *)SDL_calloc(1, sizeof(*curdata)); - if (curdata == NULL) { + if (!curdata) { SDL_OutOfMemory(); SDL_free(cursor); return NULL; @@ -119,12 +119,12 @@ static int RPI_ShowCursor(SDL_Cursor *cursor) const char *env; mouse = SDL_GetMouse(); - if (mouse == NULL) { + if (!mouse) { return -1; } if (cursor != global_cursor) { - if (global_cursor != NULL) { + if (global_cursor) { curdata = (RPI_CursorData *)global_cursor->driverdata; if (curdata && curdata->element > DISPMANX_NO_HANDLE) { update = vc_dispmanx_update_start(0); @@ -139,26 +139,26 @@ static int RPI_ShowCursor(SDL_Cursor *cursor) global_cursor = cursor; } - if (cursor == NULL) { + if (!cursor) { return 0; } curdata = (RPI_CursorData *)cursor->driverdata; - if (curdata == NULL) { + if (!curdata) { return -1; } - if (mouse->focus == NULL) { + if (!mouse->focus) { return -1; } display = SDL_GetDisplayForWindow(mouse->focus); - if (display == NULL) { + if (!display) { return -1; } data = (SDL_DisplayData *)display->driverdata; - if (data == NULL) { + if (!data) { return -1; } @@ -199,10 +199,10 @@ static void RPI_FreeCursor(SDL_Cursor *cursor) DISPMANX_UPDATE_HANDLE_T update; RPI_CursorData *curdata; - if (cursor != NULL) { + if (cursor) { curdata = (RPI_CursorData *)cursor->driverdata; - if (curdata != NULL) { + if (curdata) { if (curdata->element != DISPMANX_NO_HANDLE) { update = vc_dispmanx_update_start(0); SDL_assert(update); @@ -242,7 +242,7 @@ static int RPI_WarpMouseGlobal(int x, int y) VC_RECT_T src_rect; SDL_Mouse *mouse = SDL_GetMouse(); - if (mouse == NULL || mouse->cur_cursor == NULL || mouse->cur_cursor->driverdata == NULL) { + if (!mouse || !mouse->cur_cursor || !mouse->cur_cursor->driverdata) { return 0; } @@ -300,7 +300,7 @@ static int RPI_WarpMouseGlobalGraphicOnly(int x, int y) VC_RECT_T src_rect; SDL_Mouse *mouse = SDL_GetMouse(); - if (mouse == NULL || mouse->cur_cursor == NULL || mouse->cur_cursor->driverdata == NULL) { + if (!mouse || !mouse->cur_cursor || !mouse->cur_cursor->driverdata) { return 0; } diff --git a/thirdparty/SDL/src/video/raspberry/SDL_rpimouse.h b/thirdparty/SDL/src/video/raspberry/SDL_rpimouse.h index 895fa39a2..8ff70dec6 100644 --- a/thirdparty/SDL/src/video/raspberry/SDL_rpimouse.h +++ b/thirdparty/SDL/src/video/raspberry/SDL_rpimouse.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/raspberry/SDL_rpiopengles.c b/thirdparty/SDL/src/video/raspberry/SDL_rpiopengles.c index bce27e2c4..27b4edffc 100644 --- a/thirdparty/SDL/src/video/raspberry/SDL_rpiopengles.c +++ b/thirdparty/SDL/src/video/raspberry/SDL_rpiopengles.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -22,7 +22,7 @@ #include "SDL_hints.h" -#if SDL_VIDEO_DRIVER_RPI && SDL_VIDEO_OPENGL_EGL +#if defined(SDL_VIDEO_DRIVER_RPI) && defined(SDL_VIDEO_OPENGL_EGL) #include "SDL_rpivideo.h" #include "SDL_rpiopengles.h" diff --git a/thirdparty/SDL/src/video/raspberry/SDL_rpiopengles.h b/thirdparty/SDL/src/video/raspberry/SDL_rpiopengles.h index cfe7a9473..15c6ab1fa 100644 --- a/thirdparty/SDL/src/video/raspberry/SDL_rpiopengles.h +++ b/thirdparty/SDL/src/video/raspberry/SDL_rpiopengles.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -23,7 +23,7 @@ #ifndef SDL_rpiopengles_h_ #define SDL_rpiopengles_h_ -#if SDL_VIDEO_DRIVER_RPI && SDL_VIDEO_OPENGL_EGL +#if defined(SDL_VIDEO_DRIVER_RPI) && defined(SDL_VIDEO_OPENGL_EGL) #include "../SDL_sysvideo.h" #include "../SDL_egl_c.h" diff --git a/thirdparty/SDL/src/video/raspberry/SDL_rpivideo.c b/thirdparty/SDL/src/video/raspberry/SDL_rpivideo.c index f56e23d95..1bcddc3b8 100644 --- a/thirdparty/SDL/src/video/raspberry/SDL_rpivideo.c +++ b/thirdparty/SDL/src/video/raspberry/SDL_rpivideo.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,7 +21,7 @@ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_RPI +#ifdef SDL_VIDEO_DRIVER_RPI /* References * http://elinux.org/RPi_VideoCore_APIs @@ -56,7 +56,7 @@ static void RPI_Destroy(SDL_VideoDevice *device) SDL_free(device); } -static int RPI_GetRefreshRate() +static int RPI_GetRefreshRate(void) { TV_DISPLAY_STATE_T tvstate; if (vc_tv_get_display_state(&tvstate) == 0) { @@ -77,14 +77,14 @@ static SDL_VideoDevice *RPI_Create() /* Initialize SDL_VideoDevice structure */ device = (SDL_VideoDevice *)SDL_calloc(1, sizeof(SDL_VideoDevice)); - if (device == NULL) { + if (!device) { SDL_OutOfMemory(); return NULL; } /* Initialize internal data */ phdata = (SDL_VideoData *)SDL_calloc(1, sizeof(SDL_VideoData)); - if (phdata == NULL) { + if (!phdata) { SDL_OutOfMemory(); SDL_free(device); return NULL; @@ -138,7 +138,8 @@ static SDL_VideoDevice *RPI_Create() VideoBootStrap RPI_bootstrap = { "RPI", "RPI Video Driver", - RPI_Create + RPI_Create, + NULL /* no ShowMessageBox implementation */ }; /*****************************************************************************/ @@ -179,7 +180,7 @@ static void AddDispManXDisplay(const int display_id) /* Allocate display internal data */ data = (SDL_DisplayData *)SDL_calloc(1, sizeof(SDL_DisplayData)); - if (data == NULL) { + if (!data) { vc_dispmanx_display_close(handle); return; /* oh well */ } @@ -256,7 +257,7 @@ int RPI_CreateWindow(_THIS, SDL_Window *window) /* Allocate window internal data */ wdata = (SDL_WindowData *)SDL_calloc(1, sizeof(SDL_WindowData)); - if (wdata == NULL) { + if (!wdata) { return SDL_OutOfMemory(); } display = SDL_GetDisplayForWindow(window); @@ -350,7 +351,7 @@ void RPI_DestroyWindow(_THIS, SDL_Window *window) SDL_DestroyMutex(data->vsync_cond_mutex); } -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL if (data->egl_surface != EGL_NO_SURFACE) { SDL_EGL_DestroySurface(_this, data->egl_surface); } diff --git a/thirdparty/SDL/src/video/raspberry/SDL_rpivideo.h b/thirdparty/SDL/src/video/raspberry/SDL_rpivideo.h index a0e9d21a6..e2ffe6f9f 100644 --- a/thirdparty/SDL/src/video/raspberry/SDL_rpivideo.h +++ b/thirdparty/SDL/src/video/raspberry/SDL_rpivideo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -43,7 +43,7 @@ typedef struct SDL_DisplayData typedef struct SDL_WindowData { EGL_DISPMANX_WINDOW_T dispman_window; -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL EGLSurface egl_surface; #endif diff --git a/thirdparty/SDL/src/video/riscos/SDL_riscosdefs.h b/thirdparty/SDL/src/video/riscos/SDL_riscosdefs.h index 81c505856..8a621c209 100644 --- a/thirdparty/SDL/src/video/riscos/SDL_riscosdefs.h +++ b/thirdparty/SDL/src/video/riscos/SDL_riscosdefs.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/riscos/SDL_riscosevents.c b/thirdparty/SDL/src/video/riscos/SDL_riscosevents.c index 77b3ba94d..cebb89f5b 100644 --- a/thirdparty/SDL/src/video/riscos/SDL_riscosevents.c +++ b/thirdparty/SDL/src/video/riscos/SDL_riscosevents.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_RISCOS +#ifdef SDL_VIDEO_DRIVER_RISCOS #include "../../events/SDL_events_c.h" @@ -152,7 +152,7 @@ int RISCOS_InitEvents(_THIS) SDL_ToggleModState(KMOD_NUM, (status & (1 << 2)) ? SDL_FALSE : SDL_TRUE); SDL_ToggleModState(KMOD_CAPS, (status & (1 << 4)) ? SDL_FALSE : SDL_TRUE); SDL_ToggleModState(KMOD_SCROLL, (status & (1 << 1)) ? SDL_TRUE : SDL_FALSE); - + _kernel_swi(OS_Mouse, ®s, ®s); driverdata->last_mouse_buttons = regs.r[2]; diff --git a/thirdparty/SDL/src/video/riscos/SDL_riscosevents_c.h b/thirdparty/SDL/src/video/riscos/SDL_riscosevents_c.h index 1acaca804..6f16b193c 100644 --- a/thirdparty/SDL/src/video/riscos/SDL_riscosevents_c.h +++ b/thirdparty/SDL/src/video/riscos/SDL_riscosevents_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/riscos/SDL_riscosframebuffer.c b/thirdparty/SDL/src/video/riscos/SDL_riscosframebuffer.c index 36ce340ef..ae128d351 100644 --- a/thirdparty/SDL/src/video/riscos/SDL_riscosframebuffer.c +++ b/thirdparty/SDL/src/video/riscos/SDL_riscosframebuffer.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_RISCOS +#ifdef SDL_VIDEO_DRIVER_RISCOS #include "../SDL_sysvideo.h" #include "SDL_riscosframebuffer_c.h" @@ -80,7 +80,7 @@ int RISCOS_CreateWindowFramebuffer(_THIS, SDL_Window *window, Uint32 *format, vo regs.r[5] = h; regs.r[6] = sprite_mode; error = _kernel_swi(OS_SpriteOp, ®s, ®s); - if (error != NULL) { + if (error) { SDL_free(driverdata->fb_area); return SDL_SetError("Unable to create sprite: %s (%i)", error->errmess, error->errnum); } @@ -106,7 +106,7 @@ int RISCOS_UpdateWindowFramebuffer(_THIS, SDL_Window *window, const SDL_Rect *re regs.r[6] = 0; regs.r[7] = 0; error = _kernel_swi(OS_SpriteOp, ®s, ®s); - if (error != NULL) { + if (error) { return SDL_SetError("OS_SpriteOp 52 failed: %s (%i)", error->errmess, error->errnum); } diff --git a/thirdparty/SDL/src/video/riscos/SDL_riscosframebuffer_c.h b/thirdparty/SDL/src/video/riscos/SDL_riscosframebuffer_c.h index 3c304ab37..e4f79ad3e 100644 --- a/thirdparty/SDL/src/video/riscos/SDL_riscosframebuffer_c.h +++ b/thirdparty/SDL/src/video/riscos/SDL_riscosframebuffer_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/riscos/SDL_riscosmessagebox.c b/thirdparty/SDL/src/video/riscos/SDL_riscosmessagebox.c index c2fe81b97..9d44e07b4 100644 --- a/thirdparty/SDL/src/video/riscos/SDL_riscosmessagebox.c +++ b/thirdparty/SDL/src/video/riscos/SDL_riscosmessagebox.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_RISCOS +#ifdef SDL_VIDEO_DRIVER_RISCOS #include "SDL_messagebox.h" #include "SDL_riscosmessagebox.h" diff --git a/thirdparty/SDL/src/video/riscos/SDL_riscosmessagebox.h b/thirdparty/SDL/src/video/riscos/SDL_riscosmessagebox.h index 4fbf6afa7..09f9c76b9 100644 --- a/thirdparty/SDL/src/video/riscos/SDL_riscosmessagebox.h +++ b/thirdparty/SDL/src/video/riscos/SDL_riscosmessagebox.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_RISCOS +#ifdef SDL_VIDEO_DRIVER_RISCOS extern int RISCOS_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid); diff --git a/thirdparty/SDL/src/video/riscos/SDL_riscosmodes.c b/thirdparty/SDL/src/video/riscos/SDL_riscosmodes.c index 35a42e38e..79f5fa39e 100644 --- a/thirdparty/SDL/src/video/riscos/SDL_riscosmodes.c +++ b/thirdparty/SDL/src/video/riscos/SDL_riscosmodes.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_RISCOS +#ifdef SDL_VIDEO_DRIVER_RISCOS #include "../SDL_sysvideo.h" #include "../../events/SDL_mouse_c.h" @@ -166,7 +166,7 @@ static void *convert_mode_block(const int *block) } dst = SDL_malloc(40); - if (dst == NULL) { + if (!dst) { return NULL; } @@ -207,7 +207,7 @@ int RISCOS_InitModes(_THIS) regs.r[0] = 1; error = _kernel_swi(OS_ScreenMode, ®s, ®s); - if (error != NULL) { + if (error) { return SDL_SetError("Unable to retrieve the current screen mode: %s (%i)", error->errmess, error->errnum); } @@ -237,13 +237,13 @@ void RISCOS_GetDisplayModes(_THIS, SDL_VideoDisplay *display) regs.r[6] = 0; regs.r[7] = 0; error = _kernel_swi(OS_ScreenMode, ®s, ®s); - if (error != NULL) { + if (error) { SDL_SetError("Unable to enumerate screen modes: %s (%i)", error->errmess, error->errnum); return; } block = SDL_malloc(-regs.r[7]); - if (block == NULL) { + if (!block) { SDL_OutOfMemory(); return; } @@ -251,7 +251,7 @@ void RISCOS_GetDisplayModes(_THIS, SDL_VideoDisplay *display) regs.r[6] = (int)block; regs.r[7] = -regs.r[7]; error = _kernel_swi(OS_ScreenMode, ®s, ®s); - if (error != NULL) { + if (error) { SDL_free(block); SDL_SetError("Unable to enumerate screen modes: %s (%i)", error->errmess, error->errnum); return; @@ -290,7 +290,7 @@ int RISCOS_SetDisplayMode(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mod regs.r[0] = 0; regs.r[1] = (int)mode->driverdata; error = _kernel_swi(OS_ScreenMode, ®s, ®s); - if (error != NULL) { + if (error) { return SDL_SetError("Unable to set the current screen mode: %s (%i)", error->errmess, error->errnum); } diff --git a/thirdparty/SDL/src/video/riscos/SDL_riscosmodes.h b/thirdparty/SDL/src/video/riscos/SDL_riscosmodes.h index 7ff1f12e4..f523dd493 100644 --- a/thirdparty/SDL/src/video/riscos/SDL_riscosmodes.h +++ b/thirdparty/SDL/src/video/riscos/SDL_riscosmodes.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/riscos/SDL_riscosmouse.c b/thirdparty/SDL/src/video/riscos/SDL_riscosmouse.c index e4c42222b..90c6de06b 100644 --- a/thirdparty/SDL/src/video/riscos/SDL_riscosmouse.c +++ b/thirdparty/SDL/src/video/riscos/SDL_riscosmouse.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_RISCOS +#ifdef SDL_VIDEO_DRIVER_RISCOS #include "../../events/SDL_mouse_c.h" diff --git a/thirdparty/SDL/src/video/riscos/SDL_riscosmouse.h b/thirdparty/SDL/src/video/riscos/SDL_riscosmouse.h index c0aec8077..e675d84f4 100644 --- a/thirdparty/SDL/src/video/riscos/SDL_riscosmouse.h +++ b/thirdparty/SDL/src/video/riscos/SDL_riscosmouse.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/riscos/SDL_riscosvideo.c b/thirdparty/SDL/src/video/riscos/SDL_riscosvideo.c index 05c7d925b..1550139b7 100644 --- a/thirdparty/SDL/src/video/riscos/SDL_riscosvideo.c +++ b/thirdparty/SDL/src/video/riscos/SDL_riscosvideo.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_RISCOS +#ifdef SDL_VIDEO_DRIVER_RISCOS #include "SDL_video.h" #include "SDL_mouse.h" @@ -34,6 +34,7 @@ #include "SDL_riscosmouse.h" #include "SDL_riscosmodes.h" #include "SDL_riscoswindow.h" +#include "SDL_riscosmessagebox.h" #define RISCOSVID_DRIVER_NAME "riscos" @@ -56,14 +57,14 @@ static SDL_VideoDevice *RISCOS_CreateDevice(void) /* Initialize all variables that we clean on shutdown */ device = (SDL_VideoDevice *)SDL_calloc(1, sizeof(SDL_VideoDevice)); - if (device == NULL) { + if (!device) { SDL_OutOfMemory(); return 0; } /* Initialize internal data */ phdata = (SDL_VideoData *)SDL_calloc(1, sizeof(SDL_VideoData)); - if (phdata == NULL) { + if (!phdata) { SDL_OutOfMemory(); SDL_free(device); return NULL; @@ -94,7 +95,8 @@ static SDL_VideoDevice *RISCOS_CreateDevice(void) VideoBootStrap RISCOS_bootstrap = { RISCOSVID_DRIVER_NAME, "SDL RISC OS video driver", - RISCOS_CreateDevice + RISCOS_CreateDevice, + RISCOS_ShowMessageBox }; static int RISCOS_VideoInit(_THIS) diff --git a/thirdparty/SDL/src/video/riscos/SDL_riscosvideo.h b/thirdparty/SDL/src/video/riscos/SDL_riscosvideo.h index ffa6c7f53..d014458fa 100644 --- a/thirdparty/SDL/src/video/riscos/SDL_riscosvideo.h +++ b/thirdparty/SDL/src/video/riscos/SDL_riscosvideo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/riscos/SDL_riscoswindow.c b/thirdparty/SDL/src/video/riscos/SDL_riscoswindow.c index cf8e71dfa..5a59c4994 100644 --- a/thirdparty/SDL/src/video/riscos/SDL_riscoswindow.c +++ b/thirdparty/SDL/src/video/riscos/SDL_riscoswindow.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_RISCOS +#ifdef SDL_VIDEO_DRIVER_RISCOS #include "SDL_version.h" #include "SDL_syswm.h" @@ -36,7 +36,7 @@ int RISCOS_CreateWindow(_THIS, SDL_Window *window) SDL_WindowData *driverdata; driverdata = (SDL_WindowData *)SDL_calloc(1, sizeof(*driverdata)); - if (driverdata == NULL) { + if (!driverdata) { return SDL_OutOfMemory(); } driverdata->window = window; @@ -54,7 +54,7 @@ void RISCOS_DestroyWindow(_THIS, SDL_Window *window) { SDL_WindowData *driverdata = (SDL_WindowData *)window->driverdata; - if (driverdata == NULL) { + if (!driverdata) { return; } diff --git a/thirdparty/SDL/src/video/riscos/SDL_riscoswindow.h b/thirdparty/SDL/src/video/riscos/SDL_riscoswindow.h index 154823747..48d17baaa 100644 --- a/thirdparty/SDL/src/video/riscos/SDL_riscoswindow.h +++ b/thirdparty/SDL/src/video/riscos/SDL_riscoswindow.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/riscos/scancodes_riscos.h b/thirdparty/SDL/src/video/riscos/scancodes_riscos.h index 5e742e327..1caa33af0 100644 --- a/thirdparty/SDL/src/video/riscos/scancodes_riscos.h +++ b/thirdparty/SDL/src/video/riscos/scancodes_riscos.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/sdlgenblit.pl b/thirdparty/SDL/src/video/sdlgenblit.pl index 8ea89668e..4afef7a0d 100755 --- a/thirdparty/SDL/src/video/sdlgenblit.pl +++ b/thirdparty/SDL/src/video/sdlgenblit.pl @@ -92,7 +92,7 @@ sub open_file { /* DO NOT EDIT! This file is generated by sdlgenblit.pl */ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -518,15 +518,15 @@ sub output_copyfunc } if ( $scale ) { print FILE <<__EOF__; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; __EOF__ print FILE <<__EOF__; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { diff --git a/thirdparty/SDL/src/video/uikit/SDL_uikitappdelegate.h b/thirdparty/SDL/src/video/uikit/SDL_uikitappdelegate.h index ac0a88ac9..c40dae079 100644 --- a/thirdparty/SDL/src/video/uikit/SDL_uikitappdelegate.h +++ b/thirdparty/SDL/src/video/uikit/SDL_uikitappdelegate.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/uikit/SDL_uikitappdelegate.m b/thirdparty/SDL/src/video/uikit/SDL_uikitappdelegate.m index 1e27200e0..8fd4c7101 100644 --- a/thirdparty/SDL/src/video/uikit/SDL_uikitappdelegate.m +++ b/thirdparty/SDL/src/video/uikit/SDL_uikitappdelegate.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_UIKIT +#ifdef SDL_VIDEO_DRIVER_UIKIT #include "../SDL_sysvideo.h" #include "SDL_hints.h" @@ -408,7 +408,7 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:( { NSBundle *bundle = [NSBundle mainBundle]; -#if SDL_IPHONE_LAUNCHSCREEN +#ifdef SDL_IPHONE_LAUNCHSCREEN /* The normal launch screen is displayed until didFinishLaunching returns, * but SDL_main is called after that happens and there may be a noticeable * delay between the start of SDL_main and when the first real frame is diff --git a/thirdparty/SDL/src/video/uikit/SDL_uikitclipboard.h b/thirdparty/SDL/src/video/uikit/SDL_uikitclipboard.h index 2e18a0eb6..ad2674293 100644 --- a/thirdparty/SDL/src/video/uikit/SDL_uikitclipboard.h +++ b/thirdparty/SDL/src/video/uikit/SDL_uikitclipboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/uikit/SDL_uikitclipboard.m b/thirdparty/SDL/src/video/uikit/SDL_uikitclipboard.m index da475f308..b025697e1 100644 --- a/thirdparty/SDL/src/video/uikit/SDL_uikitclipboard.m +++ b/thirdparty/SDL/src/video/uikit/SDL_uikitclipboard.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_UIKIT +#ifdef SDL_VIDEO_DRIVER_UIKIT #include "SDL_uikitvideo.h" #include "../../events/SDL_clipboardevents_c.h" diff --git a/thirdparty/SDL/src/video/uikit/SDL_uikitevents.h b/thirdparty/SDL/src/video/uikit/SDL_uikitevents.h index f7cd77651..fae375918 100644 --- a/thirdparty/SDL/src/video/uikit/SDL_uikitevents.h +++ b/thirdparty/SDL/src/video/uikit/SDL_uikitevents.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/uikit/SDL_uikitevents.m b/thirdparty/SDL/src/video/uikit/SDL_uikitevents.m index 68d38bcac..938b70a7d 100644 --- a/thirdparty/SDL/src/video/uikit/SDL_uikitevents.m +++ b/thirdparty/SDL/src/video/uikit/SDL_uikitevents.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_UIKIT +#ifdef SDL_VIDEO_DRIVER_UIKIT #include "../../events/SDL_events_c.h" @@ -146,7 +146,7 @@ touch events to get processed (which is important to get certain } while(result == kCFRunLoopRunHandledSource); /* See the comment in the function definition. */ -#if SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2 +#if defined(SDL_VIDEO_OPENGL_ES) || defined(SDL_VIDEO_OPENGL_ES2) UIKit_GL_RestoreCurrentContext(); #endif } @@ -257,8 +257,33 @@ void SDL_QuitGCKeyboard(void) static id mouse_connect_observer = nil; static id mouse_disconnect_observer = nil; static bool mouse_relative_mode = SDL_FALSE; +static SDL_MouseWheelDirection mouse_scroll_direction = SDL_MOUSEWHEEL_NORMAL; -static void UpdatePointerLock() +static void UpdateScrollDirection(void) +{ +#if 0 /* This code doesn't work for some reason */ + NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults]; + if ([userDefaults boolForKey:@"com.apple.swipescrolldirection"]) { + mouse_scroll_direction = SDL_MOUSEWHEEL_FLIPPED; + } else { + mouse_scroll_direction = SDL_MOUSEWHEEL_NORMAL; + } +#else + Boolean keyExistsAndHasValidFormat = NO; + Boolean naturalScrollDirection = CFPreferencesGetAppBooleanValue(CFSTR("com.apple.swipescrolldirection"), kCFPreferencesAnyApplication, &keyExistsAndHasValidFormat); + if (!keyExistsAndHasValidFormat) { + /* Couldn't read the preference, assume natural scrolling direction */ + naturalScrollDirection = YES; + } + if (naturalScrollDirection) { + mouse_scroll_direction = SDL_MOUSEWHEEL_FLIPPED; + } else { + mouse_scroll_direction = SDL_MOUSEWHEEL_NORMAL; + } +#endif +} + +static void UpdatePointerLock(void) { SDL_VideoDevice *_this = SDL_GetVideoDevice(); SDL_Window *window; @@ -313,10 +338,22 @@ static void OnGCMouseConnected(GCMouse *mouse) API_AVAILABLE(macos(11.0), ios(14 } }; - mouse.mouseInput.scroll.valueChangedHandler = ^(GCControllerDirectionPad *dpad, float xValue, float yValue) - { - SDL_SendMouseWheel(SDL_GetMouseFocus(), 0, xValue, yValue, SDL_MOUSEWHEEL_NORMAL); + mouse.mouseInput.scroll.valueChangedHandler = ^(GCControllerDirectionPad *dpad, float xValue, float yValue) { + /* Raw scroll values come in here, vertical values in the first axis, horizontal values in the second axis. + * The vertical values are negative moving the mouse wheel up and positive moving it down. + * The horizontal values are negative moving the mouse wheel left and positive moving it right. + * The vertical values are inverted compared to SDL, and the horizontal values are as expected. + */ + float vertical = -xValue; + float horizontal = yValue; + if (mouse_scroll_direction == SDL_MOUSEWHEEL_FLIPPED) { + /* Since these are raw values, we need to flip them ourselves */ + vertical = -vertical; + horizontal = -horizontal; + } + SDL_SendMouseWheel(SDL_GetMouseFocus(), mouseID, horizontal, vertical, mouse_scroll_direction); }; + UpdateScrollDirection(); dispatch_queue_t queue = dispatch_queue_create( "org.libsdl.input.mouse", DISPATCH_QUEUE_SERIAL ); dispatch_set_target_queue( queue, dispatch_get_global_queue( DISPATCH_QUEUE_PRIORITY_HIGH, 0 ) ); diff --git a/thirdparty/SDL/src/video/uikit/SDL_uikitmessagebox.h b/thirdparty/SDL/src/video/uikit/SDL_uikitmessagebox.h index c553c0459..872398370 100644 --- a/thirdparty/SDL/src/video/uikit/SDL_uikitmessagebox.h +++ b/thirdparty/SDL/src/video/uikit/SDL_uikitmessagebox.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_UIKIT +#ifdef SDL_VIDEO_DRIVER_UIKIT extern SDL_bool UIKit_ShowingMessageBox(void); diff --git a/thirdparty/SDL/src/video/uikit/SDL_uikitmessagebox.m b/thirdparty/SDL/src/video/uikit/SDL_uikitmessagebox.m index 03e3f3803..b68c0657e 100644 --- a/thirdparty/SDL/src/video/uikit/SDL_uikitmessagebox.m +++ b/thirdparty/SDL/src/video/uikit/SDL_uikitmessagebox.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_UIKIT +#ifdef SDL_VIDEO_DRIVER_UIKIT #include "SDL.h" #include "SDL_uikitvideo.h" diff --git a/thirdparty/SDL/src/video/uikit/SDL_uikitmetalview.h b/thirdparty/SDL/src/video/uikit/SDL_uikitmetalview.h index 3f9112368..7a3060e7e 100644 --- a/thirdparty/SDL/src/video/uikit/SDL_uikitmetalview.h +++ b/thirdparty/SDL/src/video/uikit/SDL_uikitmetalview.h @@ -1,15 +1,15 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga - + Copyright (C) 1997-2024 Sam Lantinga + This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. - + Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: - + 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be @@ -32,7 +32,7 @@ #include "../SDL_sysvideo.h" #include "SDL_uikitwindow.h" -#if SDL_VIDEO_DRIVER_UIKIT && (SDL_VIDEO_VULKAN || SDL_VIDEO_METAL) +#if defined(SDL_VIDEO_DRIVER_UIKIT) && (defined(SDL_VIDEO_VULKAN) || defined(SDL_VIDEO_METAL)) #import #import diff --git a/thirdparty/SDL/src/video/uikit/SDL_uikitmetalview.m b/thirdparty/SDL/src/video/uikit/SDL_uikitmetalview.m index 6bb43eaa5..5c41aa5b8 100644 --- a/thirdparty/SDL/src/video/uikit/SDL_uikitmetalview.m +++ b/thirdparty/SDL/src/video/uikit/SDL_uikitmetalview.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -28,7 +28,7 @@ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_UIKIT && (SDL_VIDEO_VULKAN || SDL_VIDEO_METAL) +#if defined(SDL_VIDEO_DRIVER_UIKIT) && (defined(SDL_VIDEO_VULKAN) || defined(SDL_VIDEO_METAL)) #include "SDL_syswm.h" #include "../SDL_sysvideo.h" diff --git a/thirdparty/SDL/src/video/uikit/SDL_uikitmodes.h b/thirdparty/SDL/src/video/uikit/SDL_uikitmodes.h index e3f3d22e7..38511a299 100644 --- a/thirdparty/SDL/src/video/uikit/SDL_uikitmodes.h +++ b/thirdparty/SDL/src/video/uikit/SDL_uikitmodes.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/uikit/SDL_uikitmodes.m b/thirdparty/SDL/src/video/uikit/SDL_uikitmodes.m index e60badaec..47723070a 100644 --- a/thirdparty/SDL/src/video/uikit/SDL_uikitmodes.m +++ b/thirdparty/SDL/src/video/uikit/SDL_uikitmodes.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_UIKIT +#ifdef SDL_VIDEO_DRIVER_UIKIT #include "SDL_system.h" #include "SDL_uikitmodes.h" @@ -517,7 +517,7 @@ void UIKit_QuitModes(_THIS) } #if !TARGET_OS_TV -void SDL_OnApplicationDidChangeStatusBarOrientation() +void SDL_OnApplicationDidChangeStatusBarOrientation(void) { BOOL isLandscape = UIInterfaceOrientationIsLandscape([UIApplication sharedApplication].statusBarOrientation); SDL_VideoDisplay *display = SDL_GetDisplay(0); diff --git a/thirdparty/SDL/src/video/uikit/SDL_uikitopengles.h b/thirdparty/SDL/src/video/uikit/SDL_uikitopengles.h index 509c0c885..00efc464e 100644 --- a/thirdparty/SDL/src/video/uikit/SDL_uikitopengles.h +++ b/thirdparty/SDL/src/video/uikit/SDL_uikitopengles.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,7 +21,7 @@ #ifndef SDL_uikitopengles_ #define SDL_uikitopengles_ -#if SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2 +#if defined(SDL_VIDEO_OPENGL_ES) || defined(SDL_VIDEO_OPENGL_ES2) #include "../SDL_sysvideo.h" @@ -37,7 +37,7 @@ extern int UIKit_GL_LoadLibrary(_THIS, const char *path); extern void UIKit_GL_RestoreCurrentContext(void); -#endif // SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2 +#endif // SDL_VIDEO_OPENGL_ES || defined(SDL_VIDEO_OPENGL_ES2) #endif /* SDL_uikitopengles_ */ diff --git a/thirdparty/SDL/src/video/uikit/SDL_uikitopengles.m b/thirdparty/SDL/src/video/uikit/SDL_uikitopengles.m index e0e7b5b38..8713ae340 100644 --- a/thirdparty/SDL/src/video/uikit/SDL_uikitopengles.m +++ b/thirdparty/SDL/src/video/uikit/SDL_uikitopengles.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_UIKIT && (SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2) +#if defined(SDL_VIDEO_DRIVER_UIKIT) && (defined(SDL_VIDEO_OPENGL_ES) || defined(SDL_VIDEO_OPENGL_ES2)) #include "SDL_uikitopengles.h" #import "SDL_uikitopenglview.h" @@ -114,7 +114,7 @@ int UIKit_GL_SwapWindow(_THIS, SDL_Window * window) @autoreleasepool { SDLEAGLContext *context = (__bridge SDLEAGLContext *) SDL_GL_GetCurrentContext(); -#if SDL_POWER_UIKIT +#ifdef SDL_POWER_UIKIT /* Check once a frame to see if we should turn off the battery monitor. */ SDL_UIKit_UpdateBatteryMonitoring(); #endif diff --git a/thirdparty/SDL/src/video/uikit/SDL_uikitopenglview.h b/thirdparty/SDL/src/video/uikit/SDL_uikitopenglview.h index 15f1770a4..d0eb0ac10 100644 --- a/thirdparty/SDL/src/video/uikit/SDL_uikitopenglview.h +++ b/thirdparty/SDL/src/video/uikit/SDL_uikitopenglview.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,7 +19,7 @@ 3. This notice may not be removed or altered from any source distribution. */ -#if SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2 +#if defined(SDL_VIDEO_OPENGL_ES) || defined(SDL_VIDEO_OPENGL_ES2) #import #import diff --git a/thirdparty/SDL/src/video/uikit/SDL_uikitopenglview.m b/thirdparty/SDL/src/video/uikit/SDL_uikitopenglview.m index 3e59f19bc..145e8673f 100644 --- a/thirdparty/SDL/src/video/uikit/SDL_uikitopenglview.m +++ b/thirdparty/SDL/src/video/uikit/SDL_uikitopenglview.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_UIKIT && (SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2) +#if defined(SDL_VIDEO_DRIVER_UIKIT) && (defined(SDL_VIDEO_OPENGL_ES) || defined(SDL_VIDEO_OPENGL_ES2)) #include #include diff --git a/thirdparty/SDL/src/video/uikit/SDL_uikitvideo.h b/thirdparty/SDL/src/video/uikit/SDL_uikitvideo.h index 99e8b0fb2..02a011042 100644 --- a/thirdparty/SDL/src/video/uikit/SDL_uikitvideo.h +++ b/thirdparty/SDL/src/video/uikit/SDL_uikitvideo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/uikit/SDL_uikitvideo.m b/thirdparty/SDL/src/video/uikit/SDL_uikitvideo.m index 8b16c2399..f3257ea3f 100644 --- a/thirdparty/SDL/src/video/uikit/SDL_uikitvideo.m +++ b/thirdparty/SDL/src/video/uikit/SDL_uikitvideo.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_UIKIT +#ifdef SDL_VIDEO_DRIVER_UIKIT #import @@ -39,6 +39,7 @@ #include "SDL_uikitclipboard.h" #include "SDL_uikitvulkan.h" #include "SDL_uikitmetalview.h" +#include "SDL_uikitmessagebox.h" #define UIKITVID_DRIVER_NAME "uikit" @@ -99,7 +100,7 @@ static void UIKit_DeleteDevice(SDL_VideoDevice * device) device->GetDisplayDPI = UIKit_GetDisplayDPI; device->GetWindowSizeInPixels = UIKit_GetWindowSizeInPixels; -#if SDL_IPHONE_KEYBOARD +#ifdef SDL_IPHONE_KEYBOARD device->HasScreenKeyboardSupport = UIKit_HasScreenKeyboardSupport; device->ShowScreenKeyboard = UIKit_ShowScreenKeyboard; device->HideScreenKeyboard = UIKit_HideScreenKeyboard; @@ -112,7 +113,7 @@ static void UIKit_DeleteDevice(SDL_VideoDevice * device) device->HasClipboardText = UIKit_HasClipboardText; /* OpenGL (ES) functions */ -#if SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2 +#if defined(SDL_VIDEO_OPENGL_ES) || defined(SDL_VIDEO_OPENGL_ES2) device->GL_MakeCurrent = UIKit_GL_MakeCurrent; device->GL_GetDrawableSize = UIKit_GL_GetDrawableSize; device->GL_SwapWindow = UIKit_GL_SwapWindow; @@ -123,7 +124,7 @@ static void UIKit_DeleteDevice(SDL_VideoDevice * device) #endif device->free = UIKit_DeleteDevice; -#if SDL_VIDEO_VULKAN +#ifdef SDL_VIDEO_VULKAN device->Vulkan_LoadLibrary = UIKit_Vulkan_LoadLibrary; device->Vulkan_UnloadLibrary = UIKit_Vulkan_UnloadLibrary; device->Vulkan_GetInstanceExtensions @@ -132,7 +133,7 @@ static void UIKit_DeleteDevice(SDL_VideoDevice * device) device->Vulkan_GetDrawableSize = UIKit_Vulkan_GetDrawableSize; #endif -#if SDL_VIDEO_METAL +#ifdef SDL_VIDEO_METAL device->Metal_CreateView = UIKit_Metal_CreateView; device->Metal_DestroyView = UIKit_Metal_DestroyView; device->Metal_GetLayer = UIKit_Metal_GetLayer; @@ -147,7 +148,8 @@ static void UIKit_DeleteDevice(SDL_VideoDevice * device) VideoBootStrap UIKIT_bootstrap = { UIKITVID_DRIVER_NAME, "SDL UIKit video driver", - UIKit_CreateDevice + UIKit_CreateDevice, + UIKit_ShowMessageBox }; @@ -230,7 +232,7 @@ CGRect UIKit_ComputeViewFrame(SDL_Window *window, UIScreen *screen) return frame; } -void UIKit_ForceUpdateHomeIndicator() +void UIKit_ForceUpdateHomeIndicator(void) { #if !TARGET_OS_TV /* Force the main SDL window to re-evaluate home indicator state */ diff --git a/thirdparty/SDL/src/video/uikit/SDL_uikitview.h b/thirdparty/SDL/src/video/uikit/SDL_uikitview.h index cdb2a4070..c7fa8a8c3 100644 --- a/thirdparty/SDL/src/video/uikit/SDL_uikitview.h +++ b/thirdparty/SDL/src/video/uikit/SDL_uikitview.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/uikit/SDL_uikitview.m b/thirdparty/SDL/src/video/uikit/SDL_uikitview.m index b9c332614..63afa0942 100644 --- a/thirdparty/SDL/src/video/uikit/SDL_uikitview.m +++ b/thirdparty/SDL/src/video/uikit/SDL_uikitview.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_UIKIT +#ifdef SDL_VIDEO_DRIVER_UIKIT #include "SDL_uikitview.h" @@ -38,7 +38,7 @@ #define MAX_MOUSE_BUTTONS 5 /* This is defined in SDL_sysjoystick.m */ -#if !SDL_JOYSTICK_DISABLED +#ifndef SDL_JOYSTICK_DISABLED extern int SDL_AppleTVRemoteOpenedAsJoystick; #endif @@ -374,7 +374,7 @@ - (SDL_Scancode)scancodeFromPress:(UIPress*)press } #endif -#if !SDL_JOYSTICK_DISABLED +#ifndef SDL_JOYSTICK_DISABLED /* Presses from Apple TV remote */ if (!SDL_AppleTVRemoteOpenedAsJoystick) { switch (press.type) { @@ -458,7 +458,7 @@ -(void)swipeGesture:(UISwipeGestureRecognizer *)gesture { /* Swipe gestures don't trigger begin states. */ if (gesture.state == UIGestureRecognizerStateEnded) { -#if !SDL_JOYSTICK_DISABLED +#ifndef SDL_JOYSTICK_DISABLED if (!SDL_AppleTVRemoteOpenedAsJoystick) { /* Send arrow key presses for now, as we don't have an external API * which better maps to swipe gestures. */ diff --git a/thirdparty/SDL/src/video/uikit/SDL_uikitviewcontroller.h b/thirdparty/SDL/src/video/uikit/SDL_uikitviewcontroller.h index 6fdcbecb0..660e11c4e 100644 --- a/thirdparty/SDL/src/video/uikit/SDL_uikitviewcontroller.h +++ b/thirdparty/SDL/src/video/uikit/SDL_uikitviewcontroller.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -33,7 +33,11 @@ #define SDLRootViewController UIViewController #endif -#if SDL_IPHONE_KEYBOARD +@interface SDLUITextField : UITextField +- (BOOL)canPerformAction:(SEL)action withSender:(id)sender; +@end + +#ifdef SDL_IPHONE_KEYBOARD @interface SDL_uikitviewcontroller : SDLRootViewController #else @interface SDL_uikitviewcontroller : SDLRootViewController @@ -64,7 +68,7 @@ @property (nonatomic, assign) int homeIndicatorHidden; #endif -#if SDL_IPHONE_KEYBOARD +#ifdef SDL_IPHONE_KEYBOARD - (void)showKeyboard; - (void)hideKeyboard; - (void)initKeyboard; @@ -82,7 +86,7 @@ @end -#if SDL_IPHONE_KEYBOARD +#ifdef SDL_IPHONE_KEYBOARD SDL_bool UIKit_HasScreenKeyboardSupport(_THIS); void UIKit_ShowScreenKeyboard(_THIS, SDL_Window *window); void UIKit_HideScreenKeyboard(_THIS, SDL_Window *window); diff --git a/thirdparty/SDL/src/video/uikit/SDL_uikitviewcontroller.m b/thirdparty/SDL/src/video/uikit/SDL_uikitviewcontroller.m index b9ccf6b0f..0d8052b7f 100644 --- a/thirdparty/SDL/src/video/uikit/SDL_uikitviewcontroller.m +++ b/thirdparty/SDL/src/video/uikit/SDL_uikitviewcontroller.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_UIKIT +#ifdef SDL_VIDEO_DRIVER_UIKIT #include "SDL_video.h" #include "SDL_hints.h" @@ -64,14 +64,25 @@ } #endif +@implementation SDLUITextField : UITextField +- (BOOL)canPerformAction:(SEL)action withSender:(id)sender +{ + if (action == @selector(paste:)) { + return NO; + } + + return [super canPerformAction:action withSender:sender]; +} +@end + @implementation SDL_uikitviewcontroller { CADisplayLink *displayLink; int animationInterval; void (*animationCallback)(void*); void *animationCallbackParam; -#if SDL_IPHONE_KEYBOARD - UITextField *textField; +#ifdef SDL_IPHONE_KEYBOARD + SDLUITextField *textField; BOOL hardwareKeyboard; BOOL showingKeyboard; BOOL hidingKeyboard; @@ -88,7 +99,7 @@ - (instancetype)initWithSDLWindow:(SDL_Window *)_window if (self = [super initWithNibName:nil bundle:nil]) { self.window = _window; -#if SDL_IPHONE_KEYBOARD +#ifdef SDL_IPHONE_KEYBOARD [self initKeyboard]; hardwareKeyboard = NO; showingKeyboard = NO; @@ -113,7 +124,7 @@ - (instancetype)initWithSDLWindow:(SDL_Window *)_window - (void)dealloc { -#if SDL_IPHONE_KEYBOARD +#ifdef SDL_IPHONE_KEYBOARD [self deinitKeyboard]; #endif @@ -178,7 +189,7 @@ - (void)doLoop:(CADisplayLink*)sender /* Don't run the game loop while a messagebox is up */ if (!UIKit_ShowingMessageBox()) { /* See the comment in the function definition. */ -#if SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2 +#if defined(SDL_VIDEO_OPENGL_ES) || defined(SDL_VIDEO_OPENGL_ES2) UIKit_GL_RestoreCurrentContext(); #endif @@ -249,7 +260,7 @@ - (BOOL)prefersPointerLocked /* ---- Keyboard related functionality below this line ---- */ -#if SDL_IPHONE_KEYBOARD +#ifdef SDL_IPHONE_KEYBOARD @synthesize textInputRect; @synthesize keyboardHeight; @@ -259,7 +270,7 @@ - (BOOL)prefersPointerLocked - (void)initKeyboard { obligateForBackspace = @" "; /* 64 space */ - textField = [[UITextField alloc] initWithFrame:CGRectZero]; + textField = [[SDLUITextField alloc] initWithFrame:CGRectZero]; textField.delegate = self; /* placeholder so there is something to delete! */ textField.text = obligateForBackspace; @@ -491,9 +502,11 @@ - (void)textFieldTextDidChange:(NSNotification *)notification - (void)updateKeyboard { + SDL_WindowData *data = (__bridge SDL_WindowData *)window->driverdata; + CGAffineTransform t = self.view.transform; CGPoint offset = CGPointMake(0.0, 0.0); - CGRect frame = UIKit_ComputeViewFrame(window, self.view.window.screen); + CGRect frame = UIKit_ComputeViewFrame(window, data.uiwindow.screen); if (self.keyboardHeight) { int rectbottom = self.textInputRect.y + self.textInputRect.h; @@ -551,7 +564,7 @@ - (BOOL)textFieldShouldReturn:(UITextField*)_textField @end /* iPhone keyboard addition functions */ -#if SDL_IPHONE_KEYBOARD +#ifdef SDL_IPHONE_KEYBOARD static SDL_uikitviewcontroller *GetWindowViewController(SDL_Window * window) { diff --git a/thirdparty/SDL/src/video/uikit/SDL_uikitvulkan.h b/thirdparty/SDL/src/video/uikit/SDL_uikitvulkan.h index d8dd9183d..fe558f91a 100644 --- a/thirdparty/SDL/src/video/uikit/SDL_uikitvulkan.h +++ b/thirdparty/SDL/src/video/uikit/SDL_uikitvulkan.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -32,7 +32,7 @@ #include "../SDL_vulkan_internal.h" #include "../SDL_sysvideo.h" -#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_UIKIT +#if defined(SDL_VIDEO_VULKAN) && defined(SDL_VIDEO_DRIVER_UIKIT) int UIKit_Vulkan_LoadLibrary(_THIS, const char *path); void UIKit_Vulkan_UnloadLibrary(_THIS); diff --git a/thirdparty/SDL/src/video/uikit/SDL_uikitvulkan.m b/thirdparty/SDL/src/video/uikit/SDL_uikitvulkan.m index 892de1e0c..c0dfd29d2 100644 --- a/thirdparty/SDL/src/video/uikit/SDL_uikitvulkan.m +++ b/thirdparty/SDL/src/video/uikit/SDL_uikitvulkan.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -26,7 +26,7 @@ #include "../../SDL_internal.h" -#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_UIKIT +#if defined(SDL_VIDEO_VULKAN) && defined(SDL_VIDEO_DRIVER_UIKIT) #include "SDL_uikitvideo.h" #include "SDL_uikitwindow.h" diff --git a/thirdparty/SDL/src/video/uikit/SDL_uikitwindow.h b/thirdparty/SDL/src/video/uikit/SDL_uikitwindow.h index 70fb0464f..bf79ee159 100644 --- a/thirdparty/SDL/src/video/uikit/SDL_uikitwindow.h +++ b/thirdparty/SDL/src/video/uikit/SDL_uikitwindow.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/uikit/SDL_uikitwindow.m b/thirdparty/SDL/src/video/uikit/SDL_uikitwindow.m index d69617983..ff3cb859d 100644 --- a/thirdparty/SDL/src/video/uikit/SDL_uikitwindow.m +++ b/thirdparty/SDL/src/video/uikit/SDL_uikitwindow.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_UIKIT +#ifdef SDL_VIDEO_DRIVER_UIKIT #include "SDL_hints.h" #include "SDL_mouse.h" @@ -114,14 +114,6 @@ static int SetupWindowData(_THIS, SDL_Window *window, UIWindow *uiwindow, SDL_bo #if !TARGET_OS_TV if (displaydata.uiscreen == [UIScreen mainScreen]) { - /* SDL_CreateWindow sets the window w&h to the display's bounds if the - * fullscreen flag is set. But the display bounds orientation might not - * match what we want, and GetSupportedOrientations call below uses the - * window w&h. They're overridden below anyway, so we'll just set them - * to the requested size for the purposes of determining orientation. */ - window->w = window->windowed.w; - window->h = window->windowed.h; - NSUInteger orients = UIKit_GetSupportedOrientations(window); BOOL supportsLandscape = (orients & UIInterfaceOrientationMaskLandscape) != 0; BOOL supportsPortrait = (orients & (UIInterfaceOrientationMaskPortrait|UIInterfaceOrientationMaskPortraitUpsideDown)) != 0; @@ -392,7 +384,7 @@ SDL_bool UIKit_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info) /* These struct members were added in SDL 2.0.4. */ if (versionnum >= SDL_VERSIONNUM(2,0,4)) { -#if SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2 +#if defined(SDL_VIDEO_OPENGL_ES) || defined(SDL_VIDEO_OPENGL_ES2) if ([data.viewcontroller.view isKindOfClass:[SDL_uikitopenglview class]]) { SDL_uikitopenglview *glview = (SDL_uikitopenglview *)data.viewcontroller.view; info->info.uikit.framebuffer = glview.drawableFramebuffer; @@ -459,10 +451,10 @@ NSUInteger UIKit_GetSupportedOrientations(SDL_Window * window) } if (orientationMask == 0) { - if (window->w >= window->h) { + if (window->windowed.w >= window->windowed.h) { orientationMask |= UIInterfaceOrientationMaskLandscape; } - if (window->h >= window->w) { + if (window->windowed.h >= window->windowed.w) { orientationMask |= (UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskPortraitUpsideDown); } } diff --git a/thirdparty/SDL/src/video/vita/SDL_vitaframebuffer.c b/thirdparty/SDL/src/video/vita/SDL_vitaframebuffer.c index 43b657bd3..56069b29c 100644 --- a/thirdparty/SDL/src/video/vita/SDL_vitaframebuffer.c +++ b/thirdparty/SDL/src/video/vita/SDL_vitaframebuffer.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_VITA +#ifdef SDL_VIDEO_DRIVER_VITA #include "SDL_vitavideo.h" @@ -103,7 +103,7 @@ void VITA_DestroyWindowFramebuffer(_THIS, SDL_Window *window) { SDL_WindowData *data = (SDL_WindowData *)window->driverdata; - if (data == NULL) { + if (!data) { /* The window wasn't fully initialized */ return; } diff --git a/thirdparty/SDL/src/video/vita/SDL_vitaframebuffer.h b/thirdparty/SDL/src/video/vita/SDL_vitaframebuffer.h index 8b0a53e61..495d51b81 100644 --- a/thirdparty/SDL/src/video/vita/SDL_vitaframebuffer.h +++ b/thirdparty/SDL/src/video/vita/SDL_vitaframebuffer.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/vita/SDL_vitagl_pvr.c b/thirdparty/SDL/src/video/vita/SDL_vitagl_pvr.c index ea920ad5a..5e148f967 100644 --- a/thirdparty/SDL/src/video/vita/SDL_vitagl_pvr.c +++ b/thirdparty/SDL/src/video/vita/SDL_vitagl_pvr.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_VITA && SDL_VIDEO_VITA_PVR && SDL_VIDEO_VITA_PVR_OGL +#if defined(SDL_VIDEO_DRIVER_VITA) && defined(SDL_VIDEO_VITA_PVR) && defined(SDL_VIDEO_VITA_PVR_OGL) #include #include #include @@ -53,8 +53,8 @@ int VITA_GL_LoadLibrary(_THIS, const char *path) char *default_path = "app0:module"; char target_path[MAX_PATH]; - if (skip_init == NULL) { // we don't care about actual value - if (override != NULL) { + if (!skip_init) { // we don't care about actual value + if (override) { default_path = override; } diff --git a/thirdparty/SDL/src/video/vita/SDL_vitagl_pvr_c.h b/thirdparty/SDL/src/video/vita/SDL_vitagl_pvr_c.h index 33ee642ee..fee3d30fb 100644 --- a/thirdparty/SDL/src/video/vita/SDL_vitagl_pvr_c.h +++ b/thirdparty/SDL/src/video/vita/SDL_vitagl_pvr_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/vita/SDL_vitagles.c b/thirdparty/SDL/src/video/vita/SDL_vitagles.c index 89f29d36a..1944112f7 100644 --- a/thirdparty/SDL/src/video/vita/SDL_vitagles.c +++ b/thirdparty/SDL/src/video/vita/SDL_vitagles.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_VITA && SDL_VIDEO_VITA_PIB +#if defined(SDL_VIDEO_DRIVER_VITA) && defined(SDL_VIDEO_VITA_PIB) #include #include diff --git a/thirdparty/SDL/src/video/vita/SDL_vitagles_c.h b/thirdparty/SDL/src/video/vita/SDL_vitagles_c.h index 4e4545b78..6dcc65147 100644 --- a/thirdparty/SDL/src/video/vita/SDL_vitagles_c.h +++ b/thirdparty/SDL/src/video/vita/SDL_vitagles_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/vita/SDL_vitagles_pvr.c b/thirdparty/SDL/src/video/vita/SDL_vitagles_pvr.c index 711d1ddd3..cf917af72 100644 --- a/thirdparty/SDL/src/video/vita/SDL_vitagles_pvr.c +++ b/thirdparty/SDL/src/video/vita/SDL_vitagles_pvr.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_VITA && SDL_VIDEO_VITA_PVR +#if defined(SDL_VIDEO_DRIVER_VITA) && defined(SDL_VIDEO_VITA_PVR) #include #include #include @@ -42,9 +42,9 @@ int VITA_GLES_LoadLibrary(_THIS, const char *path) char *default_path = "app0:module"; char target_path[MAX_PATH]; - if (skip_init == NULL) { // we don't care about actual value + if (!skip_init) { // we don't care about actual value - if (override != NULL) { + if (override) { default_path = override; } diff --git a/thirdparty/SDL/src/video/vita/SDL_vitagles_pvr_c.h b/thirdparty/SDL/src/video/vita/SDL_vitagles_pvr_c.h index 6cf2fa4c6..2815057b1 100644 --- a/thirdparty/SDL/src/video/vita/SDL_vitagles_pvr_c.h +++ b/thirdparty/SDL/src/video/vita/SDL_vitagles_pvr_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/vita/SDL_vitakeyboard.c b/thirdparty/SDL/src/video/vita/SDL_vitakeyboard.c index 56be9e6fa..038e0ff37 100644 --- a/thirdparty/SDL/src/video/vita/SDL_vitakeyboard.c +++ b/thirdparty/SDL/src/video/vita/SDL_vitakeyboard.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_VITA +#ifdef SDL_VIDEO_DRIVER_VITA #include #include @@ -50,7 +50,7 @@ void VITA_InitKeyboard(void) void VITA_PollKeyboard(void) { // We skip polling keyboard if no window is created - if (Vita_Window == NULL) { + if (!Vita_Window) { return; } diff --git a/thirdparty/SDL/src/video/vita/SDL_vitakeyboard.h b/thirdparty/SDL/src/video/vita/SDL_vitakeyboard.h index fd0f13734..3ea646592 100644 --- a/thirdparty/SDL/src/video/vita/SDL_vitakeyboard.h +++ b/thirdparty/SDL/src/video/vita/SDL_vitakeyboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/vita/SDL_vitamessagebox.c b/thirdparty/SDL/src/video/vita/SDL_vitamessagebox.c index 358271349..6811748c8 100644 --- a/thirdparty/SDL/src/video/vita/SDL_vitamessagebox.c +++ b/thirdparty/SDL/src/video/vita/SDL_vitamessagebox.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_VITA +#ifdef SDL_VIDEO_DRIVER_VITA #include "SDL_vitavideo.h" #include "SDL_vitamessagebox.h" diff --git a/thirdparty/SDL/src/video/vita/SDL_vitamessagebox.h b/thirdparty/SDL/src/video/vita/SDL_vitamessagebox.h index f119275b6..15aeb6d1e 100644 --- a/thirdparty/SDL/src/video/vita/SDL_vitamessagebox.h +++ b/thirdparty/SDL/src/video/vita/SDL_vitamessagebox.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -22,7 +22,7 @@ #ifndef SDL_vitamessagebox_h_ #define SDL_vitamessagebox_h_ -#if SDL_VIDEO_DRIVER_VITA +#ifdef SDL_VIDEO_DRIVER_VITA extern int VITA_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid); diff --git a/thirdparty/SDL/src/video/vita/SDL_vitamouse.c b/thirdparty/SDL/src/video/vita/SDL_vitamouse.c index b14690fc2..47fa095bb 100644 --- a/thirdparty/SDL/src/video/vita/SDL_vitamouse.c +++ b/thirdparty/SDL/src/video/vita/SDL_vitamouse.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_VITA +#ifdef SDL_VIDEO_DRIVER_VITA #include #include @@ -45,7 +45,7 @@ void VITA_InitMouse(void) void VITA_PollMouse(void) { // We skip polling mouse if no window is created - if (Vita_Window == NULL) { + if (!Vita_Window) { return; } diff --git a/thirdparty/SDL/src/video/vita/SDL_vitamouse_c.h b/thirdparty/SDL/src/video/vita/SDL_vitamouse_c.h index b676a7084..281a611cc 100644 --- a/thirdparty/SDL/src/video/vita/SDL_vitamouse_c.h +++ b/thirdparty/SDL/src/video/vita/SDL_vitamouse_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/vita/SDL_vitatouch.c b/thirdparty/SDL/src/video/vita/SDL_vitatouch.c index 87939b322..3587822d5 100644 --- a/thirdparty/SDL/src/video/vita/SDL_vitatouch.c +++ b/thirdparty/SDL/src/video/vita/SDL_vitatouch.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_VITA +#ifdef SDL_VIDEO_DRIVER_VITA #include #include @@ -70,8 +70,8 @@ void VITA_InitTouch(void) } // Support passing both front and back touch devices in events - SDL_AddTouch((SDL_TouchID)0, SDL_TOUCH_DEVICE_DIRECT, "Front"); - SDL_AddTouch((SDL_TouchID)1, SDL_TOUCH_DEVICE_INDIRECT_ABSOLUTE, "Back"); + SDL_AddTouch((SDL_TouchID)1, SDL_TOUCH_DEVICE_DIRECT, "Front"); + SDL_AddTouch((SDL_TouchID)2, SDL_TOUCH_DEVICE_INDIRECT_ABSOLUTE, "Back"); } void VITA_QuitTouch(void) @@ -86,7 +86,7 @@ void VITA_PollTouch(void) int port; // We skip polling touch if no window is created - if (Vita_Window == NULL) { + if (!Vita_Window) { return; } diff --git a/thirdparty/SDL/src/video/vita/SDL_vitatouch.h b/thirdparty/SDL/src/video/vita/SDL_vitatouch.h index d48999cdc..29369dcea 100644 --- a/thirdparty/SDL/src/video/vita/SDL_vitatouch.h +++ b/thirdparty/SDL/src/video/vita/SDL_vitatouch.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/vita/SDL_vitavideo.c b/thirdparty/SDL/src/video/vita/SDL_vitavideo.c index 9e823996e..9b8839d2c 100644 --- a/thirdparty/SDL/src/video/vita/SDL_vitavideo.c +++ b/thirdparty/SDL/src/video/vita/SDL_vitavideo.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,7 +21,7 @@ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_VITA +#ifdef SDL_VIDEO_DRIVER_VITA /* SDL internals */ #include "../SDL_sysvideo.h" @@ -39,6 +39,7 @@ #include "SDL_vitakeyboard.h" #include "SDL_vitamouse_c.h" #include "SDL_vitaframebuffer.h" +#include "SDL_vitamessagebox.h" #if defined(SDL_VIDEO_VITA_PIB) #include "SDL_vitagles_c.h" @@ -71,27 +72,27 @@ static SDL_VideoDevice *VITA_Create() { SDL_VideoDevice *device; SDL_VideoData *phdata; -#if SDL_VIDEO_VITA_PIB +#ifdef SDL_VIDEO_VITA_PIB SDL_GLDriverData *gldata; #endif /* Initialize SDL_VideoDevice structure */ device = (SDL_VideoDevice *)SDL_calloc(1, sizeof(SDL_VideoDevice)); - if (device == NULL) { + if (!device) { SDL_OutOfMemory(); return NULL; } /* Initialize internal VITA specific data */ phdata = (SDL_VideoData *)SDL_calloc(1, sizeof(SDL_VideoData)); - if (phdata == NULL) { + if (!phdata) { SDL_OutOfMemory(); SDL_free(device); return NULL; } -#if SDL_VIDEO_VITA_PIB +#ifdef SDL_VIDEO_VITA_PIB gldata = (SDL_GLDriverData *)SDL_calloc(1, sizeof(SDL_GLDriverData)); - if (gldata == NULL) { + if (!gldata) { SDL_OutOfMemory(); SDL_free(device); SDL_free(phdata); @@ -175,7 +176,8 @@ static SDL_VideoDevice *VITA_Create() VideoBootStrap VITA_bootstrap = { "VITA", "VITA Video Driver", - VITA_Create + VITA_Create, + VITA_ShowMessageBox }; /*****************************************************************************/ @@ -258,7 +260,7 @@ int VITA_CreateWindow(_THIS, SDL_Window *window) /* Allocate window internal data */ wdata = (SDL_WindowData *)SDL_calloc(1, sizeof(SDL_WindowData)); - if (wdata == NULL) { + if (!wdata) { return SDL_OutOfMemory(); } @@ -266,7 +268,7 @@ int VITA_CreateWindow(_THIS, SDL_Window *window) window->driverdata = wdata; // Vita can only have one window - if (Vita_Window != NULL) { + if (Vita_Window) { return SDL_SetError("Only one window supported"); } diff --git a/thirdparty/SDL/src/video/vita/SDL_vitavideo.h b/thirdparty/SDL/src/video/vita/SDL_vitavideo.h index bafee68f3..5f2345916 100644 --- a/thirdparty/SDL/src/video/vita/SDL_vitavideo.h +++ b/thirdparty/SDL/src/video/vita/SDL_vitavideo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -86,7 +86,7 @@ void VITA_DestroyWindow(_THIS, SDL_Window *window); SDL_bool VITA_GetWindowWMInfo(_THIS, SDL_Window * window, struct SDL_SysWMinfo *info); -#if SDL_VIDEO_DRIVER_VITA +#ifdef SDL_VIDEO_DRIVER_VITA #if defined(SDL_VIDEO_VITA_PVR_OGL) /* OpenGL functions */ int VITA_GL_LoadLibrary(_THIS, const char *path); diff --git a/thirdparty/SDL/src/video/vivante/SDL_vivanteopengles.c b/thirdparty/SDL/src/video/vivante/SDL_vivanteopengles.c index 9d9c6388b..e088cf470 100644 --- a/thirdparty/SDL/src/video/vivante/SDL_vivanteopengles.c +++ b/thirdparty/SDL/src/video/vivante/SDL_vivanteopengles.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_VIVANTE && SDL_VIDEO_OPENGL_EGL +#if defined(SDL_VIDEO_DRIVER_VIVANTE) && defined(SDL_VIDEO_OPENGL_EGL) #include "SDL_vivanteopengles.h" #include "SDL_vivantevideo.h" diff --git a/thirdparty/SDL/src/video/vivante/SDL_vivanteopengles.h b/thirdparty/SDL/src/video/vivante/SDL_vivanteopengles.h index 8e420a1a5..7dc55c223 100644 --- a/thirdparty/SDL/src/video/vivante/SDL_vivanteopengles.h +++ b/thirdparty/SDL/src/video/vivante/SDL_vivanteopengles.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -23,7 +23,7 @@ #ifndef SDL_vivanteopengles_h_ #define SDL_vivanteopengles_h_ -#if SDL_VIDEO_DRIVER_VIVANTE && SDL_VIDEO_OPENGL_EGL +#if defined(SDL_VIDEO_DRIVER_VIVANTE) && defined(SDL_VIDEO_OPENGL_EGL) #include "../SDL_sysvideo.h" #include "../SDL_egl_c.h" diff --git a/thirdparty/SDL/src/video/vivante/SDL_vivanteplatform.c b/thirdparty/SDL/src/video/vivante/SDL_vivanteplatform.c index 8d3aff3df..cf4b5ac45 100644 --- a/thirdparty/SDL/src/video/vivante/SDL_vivanteplatform.c +++ b/thirdparty/SDL/src/video/vivante/SDL_vivanteplatform.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_VIVANTE +#ifdef SDL_VIDEO_DRIVER_VIVANTE #include "SDL_vivanteplatform.h" diff --git a/thirdparty/SDL/src/video/vivante/SDL_vivanteplatform.h b/thirdparty/SDL/src/video/vivante/SDL_vivanteplatform.h index 69ce9bd1f..19e8e3e60 100644 --- a/thirdparty/SDL/src/video/vivante/SDL_vivanteplatform.h +++ b/thirdparty/SDL/src/video/vivante/SDL_vivanteplatform.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -23,7 +23,7 @@ #ifndef SDL_vivanteplatform_h_ #define SDL_vivanteplatform_h_ -#if SDL_VIDEO_DRIVER_VIVANTE +#ifdef SDL_VIDEO_DRIVER_VIVANTE #include "SDL_vivantevideo.h" diff --git a/thirdparty/SDL/src/video/vivante/SDL_vivantevideo.c b/thirdparty/SDL/src/video/vivante/SDL_vivantevideo.c index aaf645c45..a501f65b6 100644 --- a/thirdparty/SDL/src/video/vivante/SDL_vivantevideo.c +++ b/thirdparty/SDL/src/video/vivante/SDL_vivantevideo.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_VIVANTE +#ifdef SDL_VIDEO_DRIVER_VIVANTE /* SDL internals */ #include "../SDL_sysvideo.h" @@ -41,7 +41,7 @@ static void VIVANTE_Destroy(SDL_VideoDevice *device) { - if (device->driverdata != NULL) { + if (device->driverdata) { SDL_free(device->driverdata); device->driverdata = NULL; } @@ -54,14 +54,14 @@ static SDL_VideoDevice *VIVANTE_Create() /* Initialize SDL_VideoDevice structure */ device = (SDL_VideoDevice *)SDL_calloc(1, sizeof(SDL_VideoDevice)); - if (device == NULL) { + if (!device) { SDL_OutOfMemory(); return NULL; } /* Initialize internal data */ data = (SDL_VideoData *)SDL_calloc(1, sizeof(SDL_VideoData)); - if (data == NULL) { + if (!data) { SDL_OutOfMemory(); SDL_free(device); return NULL; @@ -89,7 +89,7 @@ static SDL_VideoDevice *VIVANTE_Create() device->DestroyWindow = VIVANTE_DestroyWindow; device->GetWindowWMInfo = VIVANTE_GetWindowWMInfo; -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL device->GL_LoadLibrary = VIVANTE_GLES_LoadLibrary; device->GL_GetProcAddress = VIVANTE_GLES_GetProcAddress; device->GL_UnloadLibrary = VIVANTE_GLES_UnloadLibrary; @@ -101,7 +101,7 @@ static SDL_VideoDevice *VIVANTE_Create() device->GL_DeleteContext = VIVANTE_GLES_DeleteContext; #endif -#if SDL_VIDEO_VULKAN +#ifdef SDL_VIDEO_VULKAN device->Vulkan_LoadLibrary = VIVANTE_Vulkan_LoadLibrary; device->Vulkan_UnloadLibrary = VIVANTE_Vulkan_UnloadLibrary; device->Vulkan_GetInstanceExtensions = VIVANTE_Vulkan_GetInstanceExtensions; @@ -116,7 +116,8 @@ static SDL_VideoDevice *VIVANTE_Create() VideoBootStrap VIVANTE_bootstrap = { "vivante", "Vivante EGL Video Driver", - VIVANTE_Create + VIVANTE_Create, + NULL /* no ShowMessageBox implementation */ }; /*****************************************************************************/ @@ -133,12 +134,12 @@ static int VIVANTE_AddVideoDisplays(_THIS) unsigned long pixels = 0; data = (SDL_DisplayData *)SDL_calloc(1, sizeof(SDL_DisplayData)); - if (data == NULL) { + if (!data) { return SDL_OutOfMemory(); } SDL_zero(current_mode); -#if SDL_VIDEO_DRIVER_VIVANTE_VDK +#ifdef SDL_VIDEO_DRIVER_VIVANTE_VDK data->native_display = vdkGetDisplay(videodata->vdk_private); vdkGetDisplayInfo(data->native_display, ¤t_mode.w, ¤t_mode.h, &pixels, &pitch, &bpp); @@ -173,7 +174,7 @@ int VIVANTE_VideoInit(_THIS) { SDL_VideoData *videodata = (SDL_VideoData *)_this->driverdata; -#if SDL_VIDEO_DRIVER_VIVANTE_VDK +#ifdef SDL_VIDEO_DRIVER_VIVANTE_VDK videodata->vdk_private = vdkInitialize(); if (!videodata->vdk_private) { return SDL_SetError("vdkInitialize() failed"); @@ -231,7 +232,7 @@ void VIVANTE_VideoQuit(_THIS) VIVANTE_CleanupPlatform(_this); -#if SDL_VIDEO_DRIVER_VIVANTE_VDK +#ifdef SDL_VIDEO_DRIVER_VIVANTE_VDK if (videodata->vdk_private) { vdkExit(videodata->vdk_private); videodata->vdk_private = NULL; @@ -265,14 +266,14 @@ int VIVANTE_CreateWindow(_THIS, SDL_Window *window) /* Allocate window internal data */ data = (SDL_WindowData *)SDL_calloc(1, sizeof(SDL_WindowData)); - if (data == NULL) { + if (!data) { return SDL_OutOfMemory(); } /* Setup driver data for this window */ window->driverdata = data; -#if SDL_VIDEO_DRIVER_VIVANTE_VDK +#ifdef SDL_VIDEO_DRIVER_VIVANTE_VDK data->native_window = vdkCreateWindow(displaydata->native_display, window->x, window->y, window->w, window->h); #else data->native_window = videodata->fbCreateWindow(displaydata->native_display, window->x, window->y, window->w, window->h); @@ -281,7 +282,7 @@ int VIVANTE_CreateWindow(_THIS, SDL_Window *window) return SDL_SetError("VIVANTE: Can't create native window"); } -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL if (window->flags & SDL_WINDOW_OPENGL) { data->egl_surface = SDL_EGL_CreateSurface(_this, data->native_window); if (data->egl_surface == EGL_NO_SURFACE) { @@ -303,14 +304,14 @@ void VIVANTE_DestroyWindow(_THIS, SDL_Window *window) data = window->driverdata; if (data) { -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL if (data->egl_surface != EGL_NO_SURFACE) { SDL_EGL_DestroySurface(_this, data->egl_surface); } #endif if (data->native_window) { -#if SDL_VIDEO_DRIVER_VIVANTE_VDK +#ifdef SDL_VIDEO_DRIVER_VIVANTE_VDK vdkDestroyWindow(data->native_window); #else videodata->fbDestroyWindow(data->native_window); @@ -324,7 +325,7 @@ void VIVANTE_DestroyWindow(_THIS, SDL_Window *window) void VIVANTE_SetWindowTitle(_THIS, SDL_Window *window) { -#if SDL_VIDEO_DRIVER_VIVANTE_VDK +#ifdef SDL_VIDEO_DRIVER_VIVANTE_VDK SDL_WindowData *data = window->driverdata; vdkSetWindowTitle(data->native_window, window->title); #endif @@ -342,7 +343,7 @@ void VIVANTE_SetWindowSize(_THIS, SDL_Window *window) void VIVANTE_ShowWindow(_THIS, SDL_Window *window) { -#if SDL_VIDEO_DRIVER_VIVANTE_VDK +#ifdef SDL_VIDEO_DRIVER_VIVANTE_VDK SDL_WindowData *data = window->driverdata; vdkShowWindow(data->native_window); #endif @@ -352,10 +353,12 @@ void VIVANTE_ShowWindow(_THIS, SDL_Window *window) void VIVANTE_HideWindow(_THIS, SDL_Window *window) { -#if SDL_VIDEO_DRIVER_VIVANTE_VDK +#ifdef SDL_VIDEO_DRIVER_VIVANTE_VDK SDL_WindowData *data = window->driverdata; vdkHideWindow(data->native_window); #endif + SDL_SetMouseFocus(NULL); + SDL_SetKeyboardFocus(NULL); } /*****************************************************************************/ diff --git a/thirdparty/SDL/src/video/vivante/SDL_vivantevideo.h b/thirdparty/SDL/src/video/vivante/SDL_vivantevideo.h index f68f0f925..03dcb7e9e 100644 --- a/thirdparty/SDL/src/video/vivante/SDL_vivantevideo.h +++ b/thirdparty/SDL/src/video/vivante/SDL_vivantevideo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -27,7 +27,7 @@ #include "SDL_egl.h" -#if SDL_VIDEO_DRIVER_VIVANTE_VDK +#ifdef SDL_VIDEO_DRIVER_VIVANTE_VDK #include #else #include @@ -35,7 +35,7 @@ typedef struct SDL_VideoData { -#if SDL_VIDEO_DRIVER_VIVANTE_VDK +#ifdef SDL_VIDEO_DRIVER_VIVANTE_VDK vdkPrivate vdk_private; #else void *egl_handle; /* EGL shared library handle */ diff --git a/thirdparty/SDL/src/video/vivante/SDL_vivantevulkan.c b/thirdparty/SDL/src/video/vivante/SDL_vivantevulkan.c index 8e4c867c6..ce1e80cad 100644 --- a/thirdparty/SDL/src/video/vivante/SDL_vivantevulkan.c +++ b/thirdparty/SDL/src/video/vivante/SDL_vivantevulkan.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -27,7 +27,7 @@ #include "../../SDL_internal.h" -#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_VIVANTE +#if defined(SDL_VIDEO_VULKAN) && defined(SDL_VIDEO_DRIVER_VIVANTE) #include "SDL_vivantevideo.h" @@ -47,10 +47,10 @@ int VIVANTE_Vulkan_LoadLibrary(_THIS, const char *path) } /* Load the Vulkan loader library */ - if (path == NULL) { + if (!path) { path = SDL_getenv("SDL_VULKAN_LIBRARY"); } - if (path == NULL) { + if (!path) { /* If no path set, try Vivante fb vulkan driver explicitly */ path = "libvulkan-fb.so"; _this->vulkan_config.loader_handle = SDL_LoadObject(path); @@ -84,7 +84,7 @@ int VIVANTE_Vulkan_LoadLibrary(_THIS, const char *path) (PFN_vkEnumerateInstanceExtensionProperties) _this->vulkan_config.vkEnumerateInstanceExtensionProperties, &extensionCount); - if (extensions == NULL) { + if (!extensions) { goto fail; } for (i = 0; i < extensionCount; i++) { diff --git a/thirdparty/SDL/src/video/vivante/SDL_vivantevulkan.h b/thirdparty/SDL/src/video/vivante/SDL_vivantevulkan.h index 1b0500c21..4fb696418 100644 --- a/thirdparty/SDL/src/video/vivante/SDL_vivantevulkan.h +++ b/thirdparty/SDL/src/video/vivante/SDL_vivantevulkan.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -32,7 +32,7 @@ #include "../SDL_vulkan_internal.h" #include "../SDL_sysvideo.h" -#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_VIVANTE +#if defined(SDL_VIDEO_VULKAN) && defined(SDL_VIDEO_DRIVER_VIVANTE) int VIVANTE_Vulkan_LoadLibrary(_THIS, const char *path); void VIVANTE_Vulkan_UnloadLibrary(_THIS); diff --git a/thirdparty/SDL/src/video/wayland/SDL_waylandclipboard.c b/thirdparty/SDL/src/video/wayland/SDL_waylandclipboard.c index bf4dca44a..fc3d285cf 100644 --- a/thirdparty/SDL/src/video/wayland/SDL_waylandclipboard.c +++ b/thirdparty/SDL/src/video/wayland/SDL_waylandclipboard.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_WAYLAND +#ifdef SDL_VIDEO_DRIVER_WAYLAND #include "SDL_waylanddatamanager.h" #include "SDL_waylandevents_c.h" @@ -33,11 +33,11 @@ int Wayland_SetClipboardText(_THIS, const char *text) int status = 0; - if (_this == NULL || _this->driverdata == NULL) { + if (!_this || !_this->driverdata) { status = SDL_SetError("Video driver uninitialized"); } else { video_data = _this->driverdata; - if (video_data->input != NULL && video_data->input->data_device != NULL) { + if (video_data->input && video_data->input->data_device) { data_device = video_data->input->data_device; if (text[0] != '\0') { SDL_WaylandDataSource *source = Wayland_data_source_create(_this); @@ -64,11 +64,11 @@ int Wayland_SetPrimarySelectionText(_THIS, const char *text) int status = 0; - if (_this == NULL || _this->driverdata == NULL) { + if (!_this || !_this->driverdata) { status = SDL_SetError("Video driver uninitialized"); } else { video_data = _this->driverdata; - if (video_data->input != NULL && video_data->input->primary_selection_device != NULL) { + if (video_data->input && video_data->input->primary_selection_device) { primary_selection_device = video_data->input->primary_selection_device; if (text[0] != '\0') { SDL_WaylandPrimarySelectionSource *source = Wayland_primary_selection_source_create(_this); @@ -97,11 +97,11 @@ char *Wayland_GetClipboardText(_THIS) char *text = NULL; size_t length = 0; - if (_this == NULL || _this->driverdata == NULL) { + if (!_this || !_this->driverdata) { SDL_SetError("Video driver uninitialized"); } else { video_data = _this->driverdata; - if (video_data->input != NULL && video_data->input->data_device != NULL) { + if (video_data->input && video_data->input->data_device) { data_device = video_data->input->data_device; /* Prefer own selection, if not canceled */ if (Wayland_data_source_has_mime( @@ -116,7 +116,7 @@ char *Wayland_GetClipboardText(_THIS) } } - if (text == NULL) { + if (!text) { text = SDL_strdup(""); } @@ -131,11 +131,11 @@ char *Wayland_GetPrimarySelectionText(_THIS) char *text = NULL; size_t length = 0; - if (_this == NULL || _this->driverdata == NULL) { + if (!_this || !_this->driverdata) { SDL_SetError("Video driver uninitialized"); } else { video_data = _this->driverdata; - if (video_data->input != NULL && video_data->input->primary_selection_device != NULL) { + if (video_data->input && video_data->input->primary_selection_device) { primary_selection_device = video_data->input->primary_selection_device; /* Prefer own selection, if not canceled */ if (Wayland_primary_selection_source_has_mime( @@ -150,7 +150,7 @@ char *Wayland_GetPrimarySelectionText(_THIS) } } - if (text == NULL) { + if (!text) { text = SDL_strdup(""); } @@ -163,11 +163,11 @@ SDL_bool Wayland_HasClipboardText(_THIS) SDL_WaylandDataDevice *data_device = NULL; SDL_bool result = SDL_FALSE; - if (_this == NULL || _this->driverdata == NULL) { + if (!_this || !_this->driverdata) { SDL_SetError("Video driver uninitialized"); } else { video_data = _this->driverdata; - if (video_data->input != NULL && video_data->input->data_device != NULL) { + if (video_data->input && video_data->input->data_device) { data_device = video_data->input->data_device; result = result || Wayland_data_source_has_mime(data_device->selection_source, TEXT_MIME) || @@ -183,11 +183,11 @@ SDL_bool Wayland_HasPrimarySelectionText(_THIS) SDL_WaylandPrimarySelectionDevice *primary_selection_device = NULL; SDL_bool result = SDL_FALSE; - if (_this == NULL || _this->driverdata == NULL) { + if (!_this || !_this->driverdata) { SDL_SetError("Video driver uninitialized"); } else { video_data = _this->driverdata; - if (video_data->input != NULL && video_data->input->primary_selection_device != NULL) { + if (video_data->input && video_data->input->primary_selection_device) { primary_selection_device = video_data->input->primary_selection_device; result = result || Wayland_primary_selection_source_has_mime( diff --git a/thirdparty/SDL/src/video/wayland/SDL_waylandclipboard.h b/thirdparty/SDL/src/video/wayland/SDL_waylandclipboard.h index 67e27d961..012bf8222 100644 --- a/thirdparty/SDL/src/video/wayland/SDL_waylandclipboard.h +++ b/thirdparty/SDL/src/video/wayland/SDL_waylandclipboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/wayland/SDL_waylanddatamanager.c b/thirdparty/SDL/src/video/wayland/SDL_waylanddatamanager.c index 3d580ce6c..8839e235c 100644 --- a/thirdparty/SDL/src/video/wayland/SDL_waylanddatamanager.c +++ b/thirdparty/SDL/src/video/wayland/SDL_waylanddatamanager.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,7 +21,7 @@ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_WAYLAND +#ifdef SDL_VIDEO_DRIVER_WAYLAND #include #include @@ -55,7 +55,7 @@ static ssize_t write_pipe(int fd, const void *buffer, size_t total_length, size_ sigemptyset(&sig_set); sigaddset(&sig_set, SIGPIPE); -#if SDL_THREADS_DISABLED +#ifdef SDL_THREADS_DISABLED sigprocmask(SIG_BLOCK, &sig_set, &old_sig_set); #else pthread_sigmask(SIG_BLOCK, &sig_set, &old_sig_set); @@ -77,7 +77,7 @@ static ssize_t write_pipe(int fd, const void *buffer, size_t total_length, size_ sigtimedwait(&sig_set, 0, &zerotime); -#if SDL_THREADS_DISABLED +#ifdef SDL_THREADS_DISABLED sigprocmask(SIG_SETMASK, &old_sig_set, NULL); #else pthread_sigmask(SIG_SETMASK, &old_sig_set, NULL); @@ -115,13 +115,13 @@ static ssize_t read_pipe(int fd, void **buffer, size_t *total_length, SDL_bool n new_buffer_length = *total_length; } - if (*buffer == NULL) { + if (!*buffer) { output_buffer = SDL_malloc(new_buffer_length); } else { output_buffer = SDL_realloc(*buffer, new_buffer_length); } - if (output_buffer == NULL) { + if (!output_buffer) { bytes_read = SDL_OutOfMemory(); } else { SDL_memcpy((Uint8 *)output_buffer + pos, temp, bytes_read); @@ -186,9 +186,9 @@ static int mime_data_list_add(struct wl_list *list, SDL_MimeDataList *mime_data = NULL; void *internal_buffer = NULL; - if (buffer != NULL) { + if (buffer) { internal_buffer = SDL_malloc(length); - if (internal_buffer == NULL) { + if (!internal_buffer) { return SDL_OutOfMemory(); } SDL_memcpy(internal_buffer, buffer, length); @@ -196,16 +196,16 @@ static int mime_data_list_add(struct wl_list *list, mime_data = mime_data_list_find(list, mime_type); - if (mime_data == NULL) { + if (!mime_data) { mime_data = SDL_calloc(1, sizeof(*mime_data)); - if (mime_data == NULL) { + if (!mime_data) { status = SDL_OutOfMemory(); } else { WAYLAND_wl_list_insert(list, &(mime_data->link)); mime_type_length = SDL_strlen(mime_type) + 1; mime_data->mime_type = SDL_malloc(mime_type_length); - if (mime_data->mime_type == NULL) { + if (!mime_data->mime_type) { status = SDL_OutOfMemory(); } else { SDL_memcpy(mime_data->mime_type, mime_type, mime_type_length); @@ -213,8 +213,8 @@ static int mime_data_list_add(struct wl_list *list, } } - if (mime_data != NULL && buffer != NULL && length > 0) { - if (mime_data->data != NULL) { + if (mime_data && buffer && length > 0) { + if (mime_data->data) { SDL_free(mime_data->data); } mime_data->data = internal_buffer; @@ -233,10 +233,10 @@ static void mime_data_list_free(struct wl_list *list) wl_list_for_each_safe(mime_data, next, list, link) { - if (mime_data->data != NULL) { + if (mime_data->data) { SDL_free(mime_data->data); } - if (mime_data->mime_type != NULL) { + if (mime_data->mime_type) { SDL_free(mime_data->mime_type); } SDL_free(mime_data); @@ -248,7 +248,7 @@ static ssize_t Wayland_source_send(SDL_MimeDataList *mime_data, const char *mime size_t written_bytes = 0; ssize_t status = 0; - if (mime_data == NULL || mime_data->data == NULL) { + if (!mime_data || !mime_data->data) { status = SDL_SetError("Invalid mime type"); close(fd); } else { @@ -306,7 +306,7 @@ SDL_bool Wayland_data_source_has_mime(SDL_WaylandDataSource *source, { SDL_bool found = SDL_FALSE; - if (source != NULL) { + if (source) { found = mime_data_list_find(&source->mimes, mime_type) != NULL; } return found; @@ -317,7 +317,7 @@ SDL_bool Wayland_primary_selection_source_has_mime(SDL_WaylandPrimarySelectionSo { SDL_bool found = SDL_FALSE; - if (source != NULL) { + if (source) { found = mime_data_list_find(&source->mimes, mime_type) != NULL; } return found; @@ -329,14 +329,14 @@ static void *Wayland_source_get_data(SDL_MimeDataList *mime_data, { void *buffer = NULL; - if (mime_data != NULL && mime_data->length > 0) { + if (mime_data && mime_data->length > 0) { size_t buffer_length = mime_data->length; if (null_terminate == SDL_TRUE) { ++buffer_length; } buffer = SDL_malloc(buffer_length); - if (buffer == NULL) { + if (!buffer) { *length = SDL_OutOfMemory(); } else { *length = mime_data->length; @@ -358,7 +358,7 @@ void *Wayland_data_source_get_data(SDL_WaylandDataSource *source, void *buffer = NULL; *length = 0; - if (source == NULL) { + if (!source) { SDL_SetError("Invalid data source"); } else { mime_data = mime_data_list_find(&source->mimes, mime_type); @@ -376,7 +376,7 @@ void *Wayland_primary_selection_source_get_data(SDL_WaylandPrimarySelectionSourc void *buffer = NULL; *length = 0; - if (source == NULL) { + if (!source) { SDL_SetError("Invalid primary selection source"); } else { mime_data = mime_data_list_find(&source->mimes, mime_type); @@ -388,7 +388,7 @@ void *Wayland_primary_selection_source_get_data(SDL_WaylandPrimarySelectionSourc void Wayland_data_source_destroy(SDL_WaylandDataSource *source) { - if (source != NULL) { + if (source) { SDL_WaylandDataDevice *data_device = (SDL_WaylandDataDevice *)source->data_device; if (data_device && (data_device->selection_source == source)) { data_device->selection_source = NULL; @@ -401,7 +401,7 @@ void Wayland_data_source_destroy(SDL_WaylandDataSource *source) void Wayland_primary_selection_source_destroy(SDL_WaylandPrimarySelectionSource *source) { - if (source != NULL) { + if (source) { SDL_WaylandPrimarySelectionDevice *primary_selection_device = (SDL_WaylandPrimarySelectionDevice *)source->primary_selection_device; if (primary_selection_device && (primary_selection_device->selection_source == source)) { primary_selection_device->selection_source = NULL; @@ -422,12 +422,12 @@ void *Wayland_data_offer_receive(SDL_WaylandDataOffer *offer, void *buffer = NULL; *length = 0; - if (offer == NULL) { + if (!offer) { SDL_SetError("Invalid data offer"); return NULL; } data_device = offer->data_device; - if (data_device == NULL) { + if (!data_device) { SDL_SetError("Data device not initialized"); } else if (pipe2(pipefd, O_CLOEXEC | O_NONBLOCK) == -1) { SDL_SetError("Could not read pipe"); @@ -456,12 +456,12 @@ void *Wayland_primary_selection_offer_receive(SDL_WaylandPrimarySelectionOffer * void *buffer = NULL; *length = 0; - if (offer == NULL) { + if (!offer) { SDL_SetError("Invalid data offer"); return NULL; } primary_selection_device = offer->primary_selection_device; - if (primary_selection_device == NULL) { + if (!primary_selection_device) { SDL_SetError("Primary selection device not initialized"); } else if (pipe2(pipefd, O_CLOEXEC | O_NONBLOCK) == -1) { SDL_SetError("Could not read pipe"); @@ -497,7 +497,7 @@ SDL_bool Wayland_data_offer_has_mime(SDL_WaylandDataOffer *offer, { SDL_bool found = SDL_FALSE; - if (offer != NULL) { + if (offer) { found = mime_data_list_find(&offer->mimes, mime_type) != NULL; } return found; @@ -508,7 +508,7 @@ SDL_bool Wayland_primary_selection_offer_has_mime(SDL_WaylandPrimarySelectionOff { SDL_bool found = SDL_FALSE; - if (offer != NULL) { + if (offer) { found = mime_data_list_find(&offer->mimes, mime_type) != NULL; } return found; @@ -516,7 +516,7 @@ SDL_bool Wayland_primary_selection_offer_has_mime(SDL_WaylandPrimarySelectionOff void Wayland_data_offer_destroy(SDL_WaylandDataOffer *offer) { - if (offer != NULL) { + if (offer) { wl_data_offer_destroy(offer->offer); mime_data_list_free(&offer->mimes); SDL_free(offer); @@ -525,7 +525,7 @@ void Wayland_data_offer_destroy(SDL_WaylandDataOffer *offer) void Wayland_primary_selection_offer_destroy(SDL_WaylandPrimarySelectionOffer *offer) { - if (offer != NULL) { + if (offer) { zwp_primary_selection_offer_v1_destroy(offer->offer); mime_data_list_free(&offer->mimes); SDL_free(offer); @@ -536,9 +536,9 @@ int Wayland_data_device_clear_selection(SDL_WaylandDataDevice *data_device) { int status = 0; - if (data_device == NULL || data_device->data_device == NULL) { + if (!data_device || !data_device->data_device) { status = SDL_SetError("Invalid Data Device"); - } else if (data_device->selection_source != NULL) { + } else if (data_device->selection_source) { wl_data_device_set_selection(data_device->data_device, NULL, 0); Wayland_data_source_destroy(data_device->selection_source); data_device->selection_source = NULL; @@ -550,9 +550,9 @@ int Wayland_primary_selection_device_clear_selection(SDL_WaylandPrimarySelection { int status = 0; - if (primary_selection_device == NULL || primary_selection_device->primary_selection_device == NULL) { + if (!primary_selection_device || !primary_selection_device->primary_selection_device) { status = SDL_SetError("Invalid Primary Selection Device"); - } else if (primary_selection_device->selection_source != NULL) { + } else if (primary_selection_device->selection_source) { zwp_primary_selection_device_v1_set_selection(primary_selection_device->primary_selection_device, NULL, 0); Wayland_primary_selection_source_destroy(primary_selection_device->selection_source); @@ -568,9 +568,9 @@ int Wayland_data_device_set_selection(SDL_WaylandDataDevice *data_device, size_t num_offers = 0; size_t index = 0; - if (data_device == NULL) { + if (!data_device) { status = SDL_SetError("Invalid Data Device"); - } else if (source == NULL) { + } else if (!source) { status = SDL_SetError("Invalid source"); } else { SDL_MimeDataList *mime_data = NULL; @@ -601,7 +601,7 @@ int Wayland_data_device_set_selection(SDL_WaylandDataDevice *data_device, source->source, data_device->selection_serial); } - if (data_device->selection_source != NULL) { + if (data_device->selection_source) { Wayland_data_source_destroy(data_device->selection_source); } data_device->selection_source = source; @@ -619,9 +619,9 @@ int Wayland_primary_selection_device_set_selection(SDL_WaylandPrimarySelectionDe size_t num_offers = 0; size_t index = 0; - if (primary_selection_device == NULL) { + if (!primary_selection_device) { status = SDL_SetError("Invalid Primary Selection Device"); - } else if (source == NULL) { + } else if (!source) { status = SDL_SetError("Invalid source"); } else { SDL_MimeDataList *mime_data = NULL; @@ -652,7 +652,7 @@ int Wayland_primary_selection_device_set_selection(SDL_WaylandPrimarySelectionDe source->source, primary_selection_device->selection_serial); } - if (primary_selection_device->selection_source != NULL) { + if (primary_selection_device->selection_source) { Wayland_primary_selection_source_destroy(primary_selection_device->selection_source); } primary_selection_device->selection_source = source; @@ -667,11 +667,11 @@ int Wayland_data_device_set_serial(SDL_WaylandDataDevice *data_device, uint32_t serial) { int status = -1; - if (data_device != NULL) { + if (data_device) { status = 0; /* If there was no serial and there is a pending selection set it now. */ - if (data_device->selection_serial == 0 && data_device->selection_source != NULL) { + if (data_device->selection_serial == 0 && data_device->selection_source) { wl_data_device_set_selection(data_device->data_device, data_device->selection_source->source, data_device->selection_serial); @@ -687,11 +687,11 @@ int Wayland_primary_selection_device_set_serial(SDL_WaylandPrimarySelectionDevic uint32_t serial) { int status = -1; - if (primary_selection_device != NULL) { + if (primary_selection_device) { status = 0; /* If there was no serial and there is a pending selection set it now. */ - if (primary_selection_device->selection_serial == 0 && primary_selection_device->selection_source != NULL) { + if (primary_selection_device->selection_serial == 0 && primary_selection_device->selection_source) { zwp_primary_selection_device_v1_set_selection(primary_selection_device->primary_selection_device, primary_selection_device->selection_source->source, primary_selection_device->selection_serial); diff --git a/thirdparty/SDL/src/video/wayland/SDL_waylanddatamanager.h b/thirdparty/SDL/src/video/wayland/SDL_waylanddatamanager.h index 7f0cb7e5a..496de21df 100644 --- a/thirdparty/SDL/src/video/wayland/SDL_waylanddatamanager.h +++ b/thirdparty/SDL/src/video/wayland/SDL_waylanddatamanager.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -29,6 +29,7 @@ #define TEXT_MIME "text/plain;charset=utf-8" #define FILE_MIME "text/uri-list" +#define FILE_PORTAL_MIME "application/vnd.portal.filetransfer" typedef struct { diff --git a/thirdparty/SDL/src/video/wayland/SDL_waylanddyn.c b/thirdparty/SDL/src/video/wayland/SDL_waylanddyn.c index 8ebeaede2..f7d501ac7 100644 --- a/thirdparty/SDL/src/video/wayland/SDL_waylanddyn.c +++ b/thirdparty/SDL/src/video/wayland/SDL_waylanddyn.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_WAYLAND +#ifdef SDL_VIDEO_DRIVER_WAYLAND #define DEBUG_DYNAMIC_WAYLAND 0 @@ -59,23 +59,23 @@ static void *WAYLAND_GetSym(const char *fnname, int *pHasModule, SDL_bool requir void *fn = NULL; waylanddynlib *dynlib; for (dynlib = waylandlibs; dynlib->libname; dynlib++) { - if (dynlib->lib != NULL) { + if (dynlib->lib) { fn = SDL_LoadFunction(dynlib->lib, fnname); - if (fn != NULL) { + if (fn) { break; } } } #if DEBUG_DYNAMIC_WAYLAND - if (fn != NULL) { + if (fn) { SDL_Log("WAYLAND: Found '%s' in %s (%p)\n", fnname, dynlib->libname, fn); } else { SDL_Log("WAYLAND: Symbol '%s' NOT FOUND!\n", fnname); } #endif - if (fn == NULL && required) { + if (!fn && required) { *pHasModule = 0; /* kill this module. */ } @@ -115,7 +115,7 @@ void SDL_WAYLAND_UnloadSymbols(void) #ifdef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC for (i = 0; i < SDL_TABLESIZE(waylandlibs); i++) { - if (waylandlibs[i].lib != NULL) { + if (waylandlibs[i].lib) { SDL_UnloadObject(waylandlibs[i].lib); waylandlibs[i].lib = NULL; } @@ -136,7 +136,7 @@ int SDL_WAYLAND_LoadSymbols(void) int i; int *thismod = NULL; for (i = 0; i < SDL_TABLESIZE(waylandlibs); i++) { - if (waylandlibs[i].libname != NULL) { + if (waylandlibs[i].libname) { waylandlibs[i].lib = SDL_LoadObject(waylandlibs[i].libname); } } diff --git a/thirdparty/SDL/src/video/wayland/SDL_waylanddyn.h b/thirdparty/SDL/src/video/wayland/SDL_waylanddyn.h index 36f4fde04..6feb34391 100644 --- a/thirdparty/SDL/src/video/wayland/SDL_waylanddyn.h +++ b/thirdparty/SDL/src/video/wayland/SDL_waylanddyn.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/wayland/SDL_waylandevents.c b/thirdparty/SDL/src/video/wayland/SDL_waylandevents.c index 65adff64c..9e9c39340 100644 --- a/thirdparty/SDL/src/video/wayland/SDL_waylandevents.c +++ b/thirdparty/SDL/src/video/wayland/SDL_waylandevents.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,7 +21,7 @@ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_WAYLAND +#ifdef SDL_VIDEO_DRIVER_WAYLAND #include "SDL_stdinc.h" #include "SDL_timer.h" @@ -163,6 +163,21 @@ static void touch_del(SDL_TouchID id, wl_fixed_t *x, wl_fixed_t *y, struct wl_su } } +static SDL_bool Wayland_SurfaceHasActiveTouches(struct wl_surface *surface) +{ + struct SDL_WaylandTouchPoint *tp = touch_points.head; + + while (tp) { + if (tp->surface == surface) { + return SDL_TRUE; + } + + tp = tp->next; + } + + return SDL_FALSE; +} + /* Returns SDL_TRUE if a key repeat event was due */ static SDL_bool keyboard_repeat_handle(SDL_WaylandKeyboardRepeat *repeat_info, uint32_t elapsed) { @@ -269,7 +284,7 @@ int Wayland_WaitEventTimeout(_THIS, int timeout) WAYLAND_wl_display_flush(d->display); #ifdef SDL_USE_IME - if (d->text_input_manager == NULL && SDL_GetEventState(SDL_TEXTINPUT) == SDL_ENABLE) { + if (!d->text_input_manager && SDL_GetEventState(SDL_TEXTINPUT) == SDL_ENABLE) { SDL_IME_PumpEvents(); } #endif @@ -338,7 +353,7 @@ void Wayland_PumpEvents(_THIS) int err; #ifdef SDL_USE_IME - if (d->text_input_manager == NULL && SDL_GetEventState(SDL_TEXTINPUT) == SDL_ENABLE) { + if (!d->text_input_manager && SDL_GetEventState(SDL_TEXTINPUT) == SDL_ENABLE) { SDL_IME_PumpEvents(); } #endif @@ -410,7 +425,7 @@ static void pointer_handle_enter(void *data, struct wl_pointer *pointer, struct SDL_WaylandInput *input = data; SDL_WindowData *window; - if (surface == NULL) { + if (!surface) { /* enter event for a window we've just destroyed */ return; } @@ -448,12 +463,17 @@ static void pointer_handle_leave(void *data, struct wl_pointer *pointer, { struct SDL_WaylandInput *input = data; - if (surface == NULL || !SDL_WAYLAND_own_surface(surface)) { + if (!surface || !SDL_WAYLAND_own_surface(surface)) { return; } if (input->pointer_focus) { - SDL_SetMouseFocus(NULL); + /* A pointer leave event may be emitted if the compositor hides the pointer in response to receiving a touch event. + * Don't relinquish focus if the surface has active touches, as the compositor is just transitioning from mouse to touch mode. + */ + if (!Wayland_SurfaceHasActiveTouches(surface)) { + SDL_SetMouseFocus(NULL); + } input->pointer_focus = NULL; } } @@ -820,6 +840,8 @@ static void touch_handler_down(void *data, struct wl_touch *touch, uint32_t seri const float x = dblx / window_data->sdlwindow->w; const float y = dbly / window_data->sdlwindow->h; + SDL_SetMouseFocus(window_data->sdlwindow); + SDL_SendTouch((SDL_TouchID)(intptr_t)touch, (SDL_FingerID)id, window_data->sdlwindow, SDL_TRUE, x, y, 1.0f); } @@ -829,6 +851,7 @@ static void touch_handler_up(void *data, struct wl_touch *touch, uint32_t serial uint32_t timestamp, int id) { wl_fixed_t fx = 0, fy = 0; + struct SDL_WaylandInput *input = (struct SDL_WaylandInput *)data; struct wl_surface *surface = NULL; touch_del(id, &fx, &fy, &surface); @@ -844,6 +867,14 @@ static void touch_handler_up(void *data, struct wl_touch *touch, uint32_t serial SDL_SendTouch((SDL_TouchID)(intptr_t)touch, (SDL_FingerID)id, window_data->sdlwindow, SDL_FALSE, x, y, 1.0f); + + /* If the seat lacks pointer focus, the seat's keyboard focus is another window or NULL, this window curently + * has mouse focus, and the surface has no active touch events, consider mouse focus to be lost. + */ + if (!input->pointer_focus && input->keyboard_focus != window_data && + SDL_GetMouseFocus() == window_data->sdlwindow && !Wayland_SurfaceHasActiveTouches(surface)) { + SDL_SetMouseFocus(NULL); + } } } } @@ -947,7 +978,7 @@ static void keyboard_handle_keymap(void *data, struct wl_keyboard *keyboard, char *map_str; const char *locale; - if (data == NULL) { + if (!data) { close(fd); return; } @@ -963,6 +994,13 @@ static void keyboard_handle_keymap(void *data, struct wl_keyboard *keyboard, return; } + if (input->xkb.keymap != NULL) { + /* if there's already a keymap loaded, throw it away rather than leaking it before + * parsing the new one + */ + WAYLAND_xkb_keymap_unref(input->xkb.keymap); + input->xkb.keymap = NULL; + } input->xkb.keymap = WAYLAND_xkb_keymap_new_from_string(input->display->xkb_context, map_str, XKB_KEYMAP_FORMAT_TEXT_V1, @@ -985,6 +1023,13 @@ static void keyboard_handle_keymap(void *data, struct wl_keyboard *keyboard, input->xkb.idx_caps = 1 << GET_MOD_INDEX(CAPS); #undef GET_MOD_INDEX + if (input->xkb.state != NULL) { + /* if there's already a state, throw it away rather than leaking it before + * trying to create a new one with the new keymap. + */ + WAYLAND_xkb_state_unref(input->xkb.state); + input->xkb.state = NULL; + } input->xkb.state = WAYLAND_xkb_state_new(input->xkb.keymap); if (!input->xkb.state) { SDL_SetError("failed to create XKB state\n"); @@ -1019,21 +1064,29 @@ static void keyboard_handle_keymap(void *data, struct wl_keyboard *keyboard, /* Look up the preferred locale, falling back to "C" as default */ locale = SDL_getenv("LC_ALL"); - if (locale == NULL) { + if (!locale) { locale = SDL_getenv("LC_CTYPE"); - if (locale == NULL) { + if (!locale) { locale = SDL_getenv("LANG"); - if (locale == NULL) { + if (!locale) { locale = "C"; } } } /* Set up XKB compose table */ + if (input->xkb.compose_table != NULL) { + WAYLAND_xkb_compose_table_unref(input->xkb.compose_table); + input->xkb.compose_table = NULL; + } input->xkb.compose_table = WAYLAND_xkb_compose_table_new_from_locale(input->display->xkb_context, locale, XKB_COMPOSE_COMPILE_NO_FLAGS); if (input->xkb.compose_table) { /* Set up XKB compose state */ + if (input->xkb.compose_state != NULL) { + WAYLAND_xkb_compose_state_unref(input->xkb.compose_state); + input->xkb.compose_state = NULL; + } input->xkb.compose_state = WAYLAND_xkb_compose_state_new(input->xkb.compose_table, XKB_COMPOSE_STATE_NO_FLAGS); if (!input->xkb.compose_state) { @@ -1087,7 +1140,7 @@ static void keyboard_handle_enter(void *data, struct wl_keyboard *keyboard, SDL_WindowData *window; uint32_t *key; - if (surface == NULL) { + if (!surface) { /* enter event for a window we've just destroyed */ return; } @@ -1113,7 +1166,8 @@ static void keyboard_handle_enter(void *data, struct wl_keyboard *keyboard, const SDL_Scancode scancode = Wayland_get_scancode_from_key(input, *key + 8); if (scancode != SDL_SCANCODE_UNKNOWN) { - for (uint32_t i = 0; i < SDL_arraysize(mod_scancodes); ++i) { + uint32_t i; + for (i = 0; i < SDL_arraysize(mod_scancodes); ++i) { if (mod_scancodes[i] == scancode) { SDL_SendKeyboardKey(SDL_PRESSED, scancode); break; @@ -1127,15 +1181,18 @@ static void keyboard_handle_leave(void *data, struct wl_keyboard *keyboard, uint32_t serial, struct wl_surface *surface) { struct SDL_WaylandInput *input = data; - SDL_WindowData *window; + SDL_WindowData *wind; + SDL_Window *window = NULL; - if (surface == NULL || !SDL_WAYLAND_own_surface(surface)) { + if (!surface || !SDL_WAYLAND_own_surface(surface)) { return; } - window = wl_surface_get_user_data(surface); - if (window) { - window->sdlwindow->flags &= ~SDL_WINDOW_MOUSE_CAPTURE; + wind = wl_surface_get_user_data(surface); + if (wind) { + wind->keyboard_device = NULL; + window = wind->sdlwindow; + window->flags &= ~SDL_WINDOW_MOUSE_CAPTURE; } /* Stop key repeat before clearing keyboard focus */ @@ -1143,12 +1200,20 @@ static void keyboard_handle_leave(void *data, struct wl_keyboard *keyboard, /* This will release any keys still pressed */ SDL_SetKeyboardFocus(NULL); + input->keyboard_focus = NULL; #ifdef SDL_USE_IME if (!input->text_input) { SDL_IME_SetFocus(SDL_FALSE); } #endif + + /* If the surface had a pointer leave event while still having active touch events, it retained mouse focus. + * Clear it now if all touch events are raised. + */ + if (!input->pointer_focus && SDL_GetMouseFocus() == window && !Wayland_SurfaceHasActiveTouches(surface)) { + SDL_SetMouseFocus(NULL); + } } static SDL_bool keyboard_input_get_text(char text[8], const struct SDL_WaylandInput *input, uint32_t key, Uint8 state, SDL_bool *handled_by_ime) @@ -1157,7 +1222,7 @@ static SDL_bool keyboard_input_get_text(char text[8], const struct SDL_WaylandIn const xkb_keysym_t *syms; xkb_keysym_t sym; - if (window == NULL || window->keyboard_device != input || !input->xkb.state) { + if (!window || window->keyboard_device != input || !input->xkb.state) { return SDL_FALSE; } @@ -1233,10 +1298,11 @@ static void keyboard_handle_key(void *data, struct wl_keyboard *keyboard, SDL_SendKeyboardKey(state == WL_KEYBOARD_KEY_STATE_PRESSED ? SDL_PRESSED : SDL_RELEASED, scancode); } + Wayland_data_device_set_serial(input->data_device, serial); + Wayland_primary_selection_device_set_serial(input->primary_selection_device, serial); + if (state == WL_KEYBOARD_KEY_STATE_PRESSED) { if (has_text && !(SDL_GetModState() & KMOD_CTRL)) { - Wayland_data_device_set_serial(input->data_device, serial); - Wayland_primary_selection_device_set_serial(input->primary_selection_device, serial); if (!handled_by_ime) { SDL_SendKeyboardText(text); } @@ -1256,6 +1322,12 @@ static void keyboard_handle_modifiers(void *data, struct wl_keyboard *keyboard, Wayland_Keymap keymap; const uint32_t modstate = (mods_depressed | mods_latched | mods_locked); + if (input->xkb.state == NULL) { + /* if we get a modifier notification before the keymap, there's nothing we can do with the information + */ + return; + } + WAYLAND_xkb_state_update_mask(input->xkb.state, mods_depressed, mods_latched, mods_locked, 0, 0, group); @@ -1426,21 +1498,21 @@ SDL_WaylandDataSource *Wayland_data_source_create(_THIS) SDL_VideoData *driver_data = NULL; struct wl_data_source *id = NULL; - if (_this == NULL || _this->driverdata == NULL) { + if (!_this || !_this->driverdata) { SDL_SetError("Video driver uninitialized"); } else { driver_data = _this->driverdata; - if (driver_data->data_device_manager != NULL) { + if (driver_data->data_device_manager) { id = wl_data_device_manager_create_data_source( driver_data->data_device_manager); } - if (id == NULL) { + if (!id) { SDL_SetError("Wayland unable to create data source"); } else { data_source = SDL_calloc(1, sizeof(*data_source)); - if (data_source == NULL) { + if (!data_source) { SDL_OutOfMemory(); wl_data_source_destroy(id); } else { @@ -1461,21 +1533,21 @@ SDL_WaylandPrimarySelectionSource *Wayland_primary_selection_source_create(_THIS SDL_VideoData *driver_data = NULL; struct zwp_primary_selection_source_v1 *id = NULL; - if (_this == NULL || _this->driverdata == NULL) { + if (!_this || !_this->driverdata) { SDL_SetError("Video driver uninitialized"); } else { driver_data = _this->driverdata; - if (driver_data->primary_selection_device_manager != NULL) { + if (driver_data->primary_selection_device_manager) { id = zwp_primary_selection_device_manager_v1_create_source( driver_data->primary_selection_device_manager); } - if (id == NULL) { + if (!id) { SDL_SetError("Wayland unable to create primary selection source"); } else { primary_selection_source = SDL_calloc(1, sizeof(*primary_selection_source)); - if (primary_selection_source == NULL) { + if (!primary_selection_source) { SDL_OutOfMemory(); zwp_primary_selection_source_v1_destroy(id); } else { @@ -1529,7 +1601,7 @@ static void data_device_handle_data_offer(void *data, struct wl_data_device *wl_ SDL_WaylandDataOffer *data_offer = NULL; data_offer = SDL_calloc(1, sizeof(*data_offer)); - if (data_offer == NULL) { + if (!data_offer) { SDL_OutOfMemory(); } else { data_offer->offer = id; @@ -1550,20 +1622,27 @@ static void data_device_handle_enter(void *data, struct wl_data_device *wl_data_ data_device->drag_serial = serial; - if (id != NULL) { + if (id) { data_device->drag_offer = wl_data_offer_get_user_data(id); /* TODO: SDL Support more mime types */ - has_mime = Wayland_data_offer_has_mime( - data_device->drag_offer, FILE_MIME); - - /* If drag_mime is NULL this will decline the offer */ - wl_data_offer_accept(id, serial, - (has_mime == SDL_TRUE) ? FILE_MIME : NULL); +#ifdef SDL_USE_LIBDBUS + if (Wayland_data_offer_has_mime(data_device->drag_offer, FILE_PORTAL_MIME)) { + has_mime = SDL_TRUE; + wl_data_offer_accept(id, serial, FILE_PORTAL_MIME); + } +#endif + if (Wayland_data_offer_has_mime(data_device->drag_offer, FILE_MIME)) { + has_mime = SDL_TRUE; + wl_data_offer_accept(id, serial, FILE_MIME); + } /* SDL only supports "copy" style drag and drop */ - if (has_mime == SDL_TRUE) { + if (has_mime) { dnd_action = WL_DATA_DEVICE_MANAGER_DND_ACTION_COPY; + } else { + /* drag_mime is NULL this will decline the offer */ + wl_data_offer_accept(id, serial, NULL); } if (wl_data_offer_get_version(data_device->drag_offer->offer) >= 3) { wl_data_offer_set_actions(data_device->drag_offer->offer, @@ -1583,11 +1662,10 @@ static void data_device_handle_enter(void *data, struct wl_data_device *wl_data_ static void data_device_handle_leave(void *data, struct wl_data_device *wl_data_device) { SDL_WaylandDataDevice *data_device = data; - SDL_WaylandDataOffer *offer = NULL; - if (data_device->selection_offer != NULL) { - data_device->selection_offer = NULL; - Wayland_data_offer_destroy(offer); + if (data_device->drag_offer) { + Wayland_data_offer_destroy(data_device->drag_offer); + data_device->drag_offer = NULL; } } @@ -1615,7 +1693,7 @@ static int Wayland_URIDecode(char *buf, int len) { int ri, wi, di; char decode = '\0'; - if (buf == NULL || len < 0) { + if (!buf || len < 0) { errno = EINVAL; return -1; } @@ -1693,7 +1771,7 @@ static char *Wayland_URIToLocal(char *uri) /* got a hostname? */ if (!local && uri[0] == '/' && uri[2] != '/') { char *hostname_end = SDL_strchr(uri + 1, '/'); - if (hostname_end != NULL) { + if (hostname_end) { char hostname[257]; if (gethostname(hostname, 255) == 0) { hostname[256] = '\0'; @@ -1721,24 +1799,65 @@ static void data_device_handle_drop(void *data, struct wl_data_device *wl_data_d { SDL_WaylandDataDevice *data_device = data; - if (data_device->drag_offer != NULL) { + if (data_device->drag_offer) { /* TODO: SDL Support more mime types */ size_t length; - void *buffer = Wayland_data_offer_receive(data_device->drag_offer, - &length, FILE_MIME, SDL_TRUE); - if (buffer) { - char *saveptr = NULL; - char *token = SDL_strtokr((char *)buffer, "\r\n", &saveptr); - while (token != NULL) { - char *fn = Wayland_URIToLocal(token); - if (fn) { - SDL_SendDropFile(data_device->dnd_window, fn); + SDL_bool drop_handled = SDL_FALSE; +#ifdef SDL_USE_LIBDBUS + if (Wayland_data_offer_has_mime( + data_device->drag_offer, FILE_PORTAL_MIME)) { + void *buffer = Wayland_data_offer_receive(data_device->drag_offer, + &length, FILE_PORTAL_MIME, SDL_TRUE); + if (buffer) { + SDL_DBusContext *dbus = SDL_DBus_GetContext(); + if (dbus) { + int path_count = 0; + char **paths = SDL_DBus_DocumentsPortalRetrieveFiles(buffer, &path_count); + /* If dropped files contain a directory the list is empty */ + if (paths && path_count > 0) { + int i; + for (i = 0; i < path_count; i++) { + SDL_SendDropFile(data_device->dnd_window, paths[i]); + } + dbus->free_string_array(paths); + SDL_SendDropComplete(data_device->dnd_window); + drop_handled = SDL_TRUE; + } } - token = SDL_strtokr(NULL, "\r\n", &saveptr); + SDL_free(buffer); } - SDL_SendDropComplete(data_device->dnd_window); - SDL_free(buffer); } +#endif + /* If XDG document portal fails fallback. + * When running a flatpak sandbox this will most likely be a list of + * non paths that are not visible to the application + */ + if (!drop_handled && Wayland_data_offer_has_mime( + data_device->drag_offer, FILE_MIME)) { + void *buffer = Wayland_data_offer_receive(data_device->drag_offer, + &length, FILE_MIME, SDL_TRUE); + if (buffer) { + char *saveptr = NULL; + char *token = SDL_strtokr((char *)buffer, "\r\n", &saveptr); + while (token) { + char *fn = Wayland_URIToLocal(token); + if (fn) { + SDL_SendDropFile(data_device->dnd_window, fn); + } + token = SDL_strtokr(NULL, "\r\n", &saveptr); + } + SDL_SendDropComplete(data_device->dnd_window); + SDL_free(buffer); + drop_handled = SDL_TRUE; + } + } + + if (drop_handled && wl_data_offer_get_version(data_device->drag_offer->offer) >= + WL_DATA_OFFER_FINISH_SINCE_VERSION) { + wl_data_offer_finish(data_device->drag_offer->offer); + } + Wayland_data_offer_destroy(data_device->drag_offer); + data_device->drag_offer = NULL; } } @@ -1748,7 +1867,7 @@ static void data_device_handle_selection(void *data, struct wl_data_device *wl_d SDL_WaylandDataDevice *data_device = data; SDL_WaylandDataOffer *offer = NULL; - if (id != NULL) { + if (id) { offer = wl_data_offer_get_user_data(id); } @@ -1775,7 +1894,7 @@ static void primary_selection_device_handle_offer(void *data, struct zwp_primary SDL_WaylandPrimarySelectionOffer *primary_selection_offer = NULL; primary_selection_offer = SDL_calloc(1, sizeof(*primary_selection_offer)); - if (primary_selection_offer == NULL) { + if (!primary_selection_offer) { SDL_OutOfMemory(); } else { primary_selection_offer->offer = id; @@ -1792,7 +1911,7 @@ static void primary_selection_device_handle_selection(void *data, struct zwp_pri SDL_WaylandPrimarySelectionDevice *primary_selection_device = data; SDL_WaylandPrimarySelectionOffer *offer = NULL; - if (id != NULL) { + if (id) { offer = zwp_primary_selection_offer_v1_get_user_data(id); } @@ -1915,8 +2034,13 @@ static void Wayland_create_data_device(SDL_VideoData *d) { SDL_WaylandDataDevice *data_device = NULL; + if (!d->input->seat) { + /* No seat yet, will be initialized later. */ + return; + } + data_device = SDL_calloc(1, sizeof(*data_device)); - if (data_device == NULL) { + if (!data_device) { return; } @@ -1924,7 +2048,7 @@ static void Wayland_create_data_device(SDL_VideoData *d) d->data_device_manager, d->input->seat); data_device->video_data = d; - if (data_device->data_device == NULL) { + if (!data_device->data_device) { SDL_free(data_device); } else { wl_data_device_set_user_data(data_device->data_device, data_device); @@ -1938,8 +2062,13 @@ static void Wayland_create_primary_selection_device(SDL_VideoData *d) { SDL_WaylandPrimarySelectionDevice *primary_selection_device = NULL; + if (!d->input->seat) { + /* No seat yet, will be initialized later. */ + return; + } + primary_selection_device = SDL_calloc(1, sizeof(*primary_selection_device)); - if (primary_selection_device == NULL) { + if (!primary_selection_device) { return; } @@ -1947,7 +2076,7 @@ static void Wayland_create_primary_selection_device(SDL_VideoData *d) d->primary_selection_device_manager, d->input->seat); primary_selection_device->video_data = d; - if (primary_selection_device->primary_selection_device == NULL) { + if (!primary_selection_device->primary_selection_device) { SDL_free(primary_selection_device); } else { zwp_primary_selection_device_v1_set_user_data(primary_selection_device->primary_selection_device, @@ -1962,15 +2091,20 @@ static void Wayland_create_text_input(SDL_VideoData *d) { SDL_WaylandTextInput *text_input = NULL; + if (!d->input->seat) { + /* No seat yet, will be initialized later. */ + return; + } + text_input = SDL_calloc(1, sizeof(*text_input)); - if (text_input == NULL) { + if (!text_input) { return; } text_input->text_input = zwp_text_input_manager_v3_get_text_input( d->text_input_manager, d->input->seat); - if (text_input->text_input == NULL) { + if (!text_input->text_input) { SDL_free(text_input); } else { zwp_text_input_v3_set_user_data(text_input->text_input, text_input); @@ -1984,7 +2118,7 @@ void Wayland_add_data_device_manager(SDL_VideoData *d, uint32_t id, uint32_t ver { d->data_device_manager = wl_registry_bind(d->registry, id, &wl_data_device_manager_interface, SDL_min(3, version)); - if (d->input != NULL) { + if (d->input) { Wayland_create_data_device(d); } } @@ -1993,7 +2127,7 @@ void Wayland_add_primary_selection_device_manager(SDL_VideoData *d, uint32_t id, { d->primary_selection_device_manager = wl_registry_bind(d->registry, id, &zwp_primary_selection_device_manager_v1_interface, 1); - if (d->input != NULL) { + if (d->input) { Wayland_create_primary_selection_device(d); } } @@ -2002,7 +2136,7 @@ void Wayland_add_text_input_manager(SDL_VideoData *d, uint32_t id, uint32_t vers { d->text_input_manager = wl_registry_bind(d->registry, id, &zwp_text_input_manager_v3_interface, 1); - if (d->input != NULL) { + if (d->input) { Wayland_create_text_input(d); } } @@ -2042,7 +2176,7 @@ static void tablet_tool_handle_proximity_in(void *data, struct zwp_tablet_tool_v struct SDL_WaylandTabletInput *input = data; SDL_WindowData *window; - if (surface == NULL) { + if (!surface) { return; } @@ -2099,7 +2233,7 @@ static void tablet_tool_handle_down(void *data, struct zwp_tablet_tool_v2 *tool, struct SDL_WaylandTabletInput *input = data; SDL_WindowData *window = input->tool_focus; input->is_down = SDL_TRUE; - if (window == NULL) { + if (!window) { /* tablet_tool_handle_proximity_out gets called when moving over the libdecoration csd. * that sets input->tool_focus (window) to NULL, but handle_{down,up} events are still * received. To prevent SIGSEGV this returns when this is the case. @@ -2117,7 +2251,7 @@ static void tablet_tool_handle_up(void *data, struct zwp_tablet_tool_v2 *tool) input->is_down = SDL_FALSE; - if (window == NULL) { + if (!window) { /* tablet_tool_handle_proximity_out gets called when moving over the libdecoration csd. * that sets input->tool_focus (window) to NULL, but handle_{down,up} events are still * received. To prevent SIGSEGV this returns when this is the case. @@ -2233,7 +2367,7 @@ struct SDL_WaylandTabletObjectListNode *tablet_object_list_new_node(void *object struct SDL_WaylandTabletObjectListNode *node; node = SDL_calloc(1, sizeof(*node)); - if (node == NULL) { + if (!node) { return NULL; } @@ -2245,7 +2379,7 @@ struct SDL_WaylandTabletObjectListNode *tablet_object_list_new_node(void *object void tablet_object_list_append(struct SDL_WaylandTabletObjectListNode *head, void *object) { - if (head->object == NULL) { + if (!head->object) { head->object = object; return; } @@ -2303,12 +2437,12 @@ void Wayland_input_add_tablet(struct SDL_WaylandInput *input, struct SDL_Wayland { struct SDL_WaylandTabletInput *tablet_input; - if (tablet_manager == NULL || input == NULL || !input->seat) { + if (!tablet_manager || !input->seat) { return; } tablet_input = SDL_calloc(1, sizeof(*tablet_input)); - if (tablet_input == NULL) { + if (!tablet_input) { return; } @@ -2338,27 +2472,17 @@ void Wayland_input_destroy_tablet(struct SDL_WaylandInput *input) void Wayland_display_add_input(SDL_VideoData *d, uint32_t id, uint32_t version) { - struct SDL_WaylandInput *input; - - input = SDL_calloc(1, sizeof(*input)); - if (input == NULL) { - return; - } + struct SDL_WaylandInput *input = d->input; - input->display = d; input->seat = wl_registry_bind(d->registry, id, &wl_seat_interface, SDL_min(SDL_WL_SEAT_VERSION, version)); - input->sx_w = wl_fixed_from_int(0); - input->sy_w = wl_fixed_from_int(0); - input->xkb.current_group = XKB_GROUP_INVALID; - d->input = input; - if (d->data_device_manager != NULL) { + if (d->data_device_manager) { Wayland_create_data_device(d); } - if (d->primary_selection_device_manager != NULL) { + if (d->primary_selection_device_manager) { Wayland_create_primary_selection_device(d); } - if (d->text_input_manager != NULL) { + if (d->text_input_manager) { Wayland_create_text_input(d); } @@ -2376,32 +2500,32 @@ void Wayland_display_destroy_input(SDL_VideoData *d) { struct SDL_WaylandInput *input = d->input; - if (input == NULL) { + if (!input) { return; } - if (input->data_device != NULL) { + if (input->data_device) { Wayland_data_device_clear_selection(input->data_device); - if (input->data_device->selection_offer != NULL) { + if (input->data_device->selection_offer) { Wayland_data_offer_destroy(input->data_device->selection_offer); } - if (input->data_device->drag_offer != NULL) { + if (input->data_device->drag_offer) { Wayland_data_offer_destroy(input->data_device->drag_offer); } - if (input->data_device->data_device != NULL) { + if (input->data_device->data_device) { wl_data_device_release(input->data_device->data_device); } SDL_free(input->data_device); } - if (input->primary_selection_device != NULL) { - if (input->primary_selection_device->selection_offer != NULL) { + if (input->primary_selection_device) { + if (input->primary_selection_device->selection_offer) { Wayland_primary_selection_offer_destroy(input->primary_selection_device->selection_offer); } SDL_free(input->primary_selection_device); } - if (input->text_input != NULL) { + if (input->text_input) { zwp_text_input_v3_destroy(input->text_input->text_input); SDL_free(input->text_input); } @@ -2714,7 +2838,7 @@ int Wayland_input_confine_pointer(struct SDL_WaylandInput *input, SDL_Window *wi &confined_pointer_listener, window); - if (confine_rect != NULL) { + if (confine_rect) { wl_region_destroy(confine_rect); } diff --git a/thirdparty/SDL/src/video/wayland/SDL_waylandevents_c.h b/thirdparty/SDL/src/video/wayland/SDL_waylandevents_c.h index 3b8f92ab8..d69888c82 100644 --- a/thirdparty/SDL/src/video/wayland/SDL_waylandevents_c.h +++ b/thirdparty/SDL/src/video/wayland/SDL_waylandevents_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/wayland/SDL_waylandkeyboard.c b/thirdparty/SDL/src/video/wayland/SDL_waylandkeyboard.c index d8cf07579..df0f865c0 100644 --- a/thirdparty/SDL/src/video/wayland/SDL_waylandkeyboard.c +++ b/thirdparty/SDL/src/video/wayland/SDL_waylandkeyboard.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_WAYLAND +#ifdef SDL_VIDEO_DRIVER_WAYLAND #include "../SDL_sysvideo.h" #include "SDL_waylandvideo.h" @@ -32,7 +32,7 @@ int Wayland_InitKeyboard(_THIS) { #ifdef SDL_USE_IME SDL_VideoData *driverdata = _this->driverdata; - if (driverdata->text_input_manager == NULL) { + if (!driverdata->text_input_manager) { SDL_IME_Init(); } #endif @@ -45,7 +45,7 @@ void Wayland_QuitKeyboard(_THIS) { #ifdef SDL_USE_IME SDL_VideoData *driverdata = _this->driverdata; - if (driverdata->text_input_manager == NULL) { + if (!driverdata->text_input_manager) { SDL_IME_Quit(); } #endif @@ -57,7 +57,7 @@ void Wayland_StartTextInput(_THIS) if (driverdata->text_input_manager) { struct SDL_WaylandInput *input = driverdata->input; - if (input != NULL && input->text_input) { + if (input && input->text_input) { const SDL_Rect *rect = &input->text_input->cursor_rect; /* Don't re-enable if we're already enabled. */ @@ -98,7 +98,7 @@ void Wayland_StopTextInput(_THIS) if (driverdata->text_input_manager) { struct SDL_WaylandInput *input = driverdata->input; - if (input != NULL && input->text_input) { + if (input && input->text_input) { zwp_text_input_v3_disable(input->text_input->text_input); zwp_text_input_v3_commit(input->text_input->text_input); input->text_input->is_enabled = SDL_FALSE; @@ -116,14 +116,14 @@ void Wayland_SetTextInputRect(_THIS, const SDL_Rect *rect) { SDL_VideoData *driverdata = _this->driverdata; - if (rect == NULL) { + if (!rect) { SDL_InvalidParamError("rect"); return; } if (driverdata->text_input_manager) { struct SDL_WaylandInput *input = driverdata->input; - if (input != NULL && input->text_input) { + if (input && input->text_input) { if (!SDL_RectEquals(rect, &input->text_input->cursor_rect)) { SDL_copyp(&input->text_input->cursor_rect, rect); zwp_text_input_v3_set_cursor_rectangle(input->text_input->text_input, diff --git a/thirdparty/SDL/src/video/wayland/SDL_waylandkeyboard.h b/thirdparty/SDL/src/video/wayland/SDL_waylandkeyboard.h index 98e42eec3..6a0fccda1 100644 --- a/thirdparty/SDL/src/video/wayland/SDL_waylandkeyboard.h +++ b/thirdparty/SDL/src/video/wayland/SDL_waylandkeyboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/wayland/SDL_waylandmessagebox.c b/thirdparty/SDL/src/video/wayland/SDL_waylandmessagebox.c index 24bc21a6f..2fea3dece 100644 --- a/thirdparty/SDL/src/video/wayland/SDL_waylandmessagebox.c +++ b/thirdparty/SDL/src/video/wayland/SDL_waylandmessagebox.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,7 +21,7 @@ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_WAYLAND +#ifdef SDL_VIDEO_DRIVER_WAYLAND #include "SDL.h" #include /* fgets */ @@ -89,7 +89,7 @@ static int get_zenity_version(int *major, int *minor) { int tmp; outputfp = fdopen(fd_pipe[0], "r"); - if (outputfp == NULL) { + if (!outputfp) { close(fd_pipe[0]); return SDL_SetError("failed to open pipe for reading: %s", strerror(errno)); } @@ -194,7 +194,7 @@ int Wayland_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *button char *output = NULL; char *tmp = NULL; - if (buttonid == NULL) { + if (!buttonid) { /* if we don't need buttonid, we can return immediately */ close(fd_pipe[0]); return 0; /* success */ @@ -202,14 +202,14 @@ int Wayland_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *button *buttonid = -1; output = SDL_malloc(output_len + 1); - if (output == NULL) { + if (!output) { close(fd_pipe[0]); return SDL_OutOfMemory(); } output[0] = '\0'; outputfp = fdopen(fd_pipe[0], "r"); - if (outputfp == NULL) { + if (!outputfp) { SDL_free(output); close(fd_pipe[0]); return SDL_SetError("Couldn't open pipe for reading: %s", strerror(errno)); @@ -217,20 +217,20 @@ int Wayland_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *button tmp = fgets(output, output_len + 1, outputfp); (void)fclose(outputfp); - if ((tmp == NULL) || (*tmp == '\0') || (*tmp == '\n')) { + if ((!tmp) || (*tmp == '\0') || (*tmp == '\n')) { SDL_free(output); return 0; /* User simply closed the dialog */ } /* It likes to add a newline... */ tmp = SDL_strrchr(output, '\n'); - if (tmp != NULL) { + if (tmp) { *tmp = '\0'; } /* Check which button got pressed */ for (i = 0; i < messageboxdata->numbuttons; i += 1) { - if (messageboxdata->buttons[i].text != NULL) { + if (messageboxdata->buttons[i].text) { if (SDL_strcmp(output, messageboxdata->buttons[i].text) == 0) { *buttonid = messageboxdata->buttons[i].buttonid; break; diff --git a/thirdparty/SDL/src/video/wayland/SDL_waylandmessagebox.h b/thirdparty/SDL/src/video/wayland/SDL_waylandmessagebox.h index 277577419..2193a6bf8 100644 --- a/thirdparty/SDL/src/video/wayland/SDL_waylandmessagebox.h +++ b/thirdparty/SDL/src/video/wayland/SDL_waylandmessagebox.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -22,7 +22,7 @@ #ifndef SDL_waylandmessagebox_h_ #define SDL_waylandmessagebox_h_ -#if SDL_VIDEO_DRIVER_WAYLAND +#ifdef SDL_VIDEO_DRIVER_WAYLAND extern int Wayland_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid); diff --git a/thirdparty/SDL/src/video/wayland/SDL_waylandmouse.c b/thirdparty/SDL/src/video/wayland/SDL_waylandmouse.c index adc91271e..278daabc3 100644 --- a/thirdparty/SDL/src/video/wayland/SDL_waylandmouse.c +++ b/thirdparty/SDL/src/video/wayland/SDL_waylandmouse.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,13 +21,14 @@ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_WAYLAND +#ifdef SDL_VIDEO_DRIVER_WAYLAND -#include #include #include #include #include +#include +#include #include "../SDL_sysvideo.h" @@ -58,6 +59,7 @@ typedef struct */ SDL_SystemCursor system_cursor; void *shm_data; + size_t shm_data_size; } Wayland_CursorData; #ifdef SDL_USE_LIBDBUS @@ -115,7 +117,7 @@ static SDL_bool wayland_dbus_read_cursor_size(int *size) DBusMessage *reply; SDL_DBusContext *dbus = SDL_DBus_GetContext(); - if (dbus == NULL || size == NULL) { + if (!dbus || !size) { return SDL_FALSE; } @@ -137,7 +139,7 @@ static SDL_bool wayland_dbus_read_cursor_theme(char **theme) DBusMessage *reply; SDL_DBusContext *dbus = SDL_DBus_GetContext(); - if (dbus == NULL || theme == NULL) { + if (!dbus || !theme) { return SDL_FALSE; } @@ -156,16 +158,40 @@ static SDL_bool wayland_dbus_read_cursor_theme(char **theme) #endif + +static const char *GetLegacyCursorName(SDL_SystemCursor system_cursor) +{ + switch (system_cursor) { + case SDL_SYSTEM_CURSOR_ARROW: return "left_ptr"; + case SDL_SYSTEM_CURSOR_IBEAM: return "xterm"; + case SDL_SYSTEM_CURSOR_WAIT: return "watch"; + case SDL_SYSTEM_CURSOR_CROSSHAIR: return "tcross"; + case SDL_SYSTEM_CURSOR_WAITARROW: return "watch"; + case SDL_SYSTEM_CURSOR_SIZENWSE: return "top_left_corner"; + case SDL_SYSTEM_CURSOR_SIZENESW: return "top_right_corner"; + case SDL_SYSTEM_CURSOR_SIZEWE: return "sb_h_double_arrow"; + case SDL_SYSTEM_CURSOR_SIZENS: return "sb_v_double_arrow"; + case SDL_SYSTEM_CURSOR_SIZEALL: return "fleur"; + case SDL_SYSTEM_CURSOR_NO: return "pirate"; + case SDL_SYSTEM_CURSOR_HAND: return "hand2"; + case SDL_NUM_SYSTEM_CURSORS: break; /* so the compiler might notice if an enum value is missing here. */ + } + + SDL_assert(0); + return NULL; +} + static SDL_bool wayland_get_system_cursor(SDL_VideoData *vdata, Wayland_CursorData *cdata, float *scale) { struct wl_cursor_theme *theme = NULL; struct wl_cursor *cursor; + const char *cssname = NULL; + const char *fallback_name = NULL; char *xcursor_size; int size = 0; SDL_Window *focus; - SDL_WindowData *focusdata; int i; /* @@ -179,7 +205,7 @@ static SDL_bool wayland_get_system_cursor(SDL_VideoData *vdata, Wayland_CursorDa if ((xcursor_size = SDL_getenv("XCURSOR_SIZE"))) { size = SDL_atoi(xcursor_size); } -#if SDL_USE_LIBDBUS +#ifdef SDL_USE_LIBDBUS if (size <= 0) { wayland_dbus_read_cursor_size(&size); } @@ -189,34 +215,35 @@ static SDL_bool wayland_get_system_cursor(SDL_VideoData *vdata, Wayland_CursorDa } /* First, find the appropriate theme based on the current scale... */ focus = SDL_GetMouse()->focus; - if (focus == NULL) { - /* Nothing to see here, bail. */ - return SDL_FALSE; + if (focus) { + SDL_WindowData *focusdata = (SDL_WindowData*)focus->driverdata; + + /* Cursors use integer scaling. */ + *scale = SDL_ceilf(focusdata->scale_factor); + } else { + *scale = 1.0f; } - focusdata = focus->driverdata; - /* Cursors use integer scaling. */ - *scale = SDL_ceilf(focusdata->scale_factor); - size *= *scale; - for (i = 0; i < vdata->num_cursor_themes; i += 1) { + size *= (int)*scale; + for (i = 0; i < vdata->num_cursor_themes; ++i) { if (vdata->cursor_themes[i].size == size) { theme = vdata->cursor_themes[i].theme; break; } } - if (theme == NULL) { + if (!theme) { char *xcursor_theme = NULL; SDL_bool free_theme_str = SDL_FALSE; vdata->cursor_themes = SDL_realloc(vdata->cursor_themes, sizeof(SDL_WaylandCursorTheme) * (vdata->num_cursor_themes + 1)); - if (vdata->cursor_themes == NULL) { + if (!vdata->cursor_themes) { SDL_OutOfMemory(); return SDL_FALSE; } xcursor_theme = SDL_getenv("XCURSOR_THEME"); -#if SDL_USE_LIBDBUS - if (xcursor_theme == NULL) { +#ifdef SDL_USE_LIBDBUS + if (!xcursor_theme) { /* Allocates the string with SDL_strdup, which must be freed. */ free_theme_str = wayland_dbus_read_cursor_theme(&xcursor_theme); } @@ -231,54 +258,28 @@ static SDL_bool wayland_get_system_cursor(SDL_VideoData *vdata, Wayland_CursorDa } /* Next, find the cursor from the theme... */ - switch (cdata->system_cursor) { - case SDL_SYSTEM_CURSOR_ARROW: - cursor = WAYLAND_wl_cursor_theme_get_cursor(theme, "left_ptr"); - break; - case SDL_SYSTEM_CURSOR_IBEAM: - cursor = WAYLAND_wl_cursor_theme_get_cursor(theme, "xterm"); - break; - case SDL_SYSTEM_CURSOR_WAIT: - cursor = WAYLAND_wl_cursor_theme_get_cursor(theme, "watch"); - break; - case SDL_SYSTEM_CURSOR_CROSSHAIR: - cursor = WAYLAND_wl_cursor_theme_get_cursor(theme, "tcross"); - break; - case SDL_SYSTEM_CURSOR_WAITARROW: - cursor = WAYLAND_wl_cursor_theme_get_cursor(theme, "watch"); - break; - case SDL_SYSTEM_CURSOR_SIZENWSE: - cursor = WAYLAND_wl_cursor_theme_get_cursor(theme, "top_left_corner"); - break; - case SDL_SYSTEM_CURSOR_SIZENESW: - cursor = WAYLAND_wl_cursor_theme_get_cursor(theme, "top_right_corner"); - break; - case SDL_SYSTEM_CURSOR_SIZEWE: - cursor = WAYLAND_wl_cursor_theme_get_cursor(theme, "sb_h_double_arrow"); - break; - case SDL_SYSTEM_CURSOR_SIZENS: - cursor = WAYLAND_wl_cursor_theme_get_cursor(theme, "sb_v_double_arrow"); - break; - case SDL_SYSTEM_CURSOR_SIZEALL: - cursor = WAYLAND_wl_cursor_theme_get_cursor(theme, "fleur"); - break; - case SDL_SYSTEM_CURSOR_NO: - cursor = WAYLAND_wl_cursor_theme_get_cursor(theme, "pirate"); - break; - case SDL_SYSTEM_CURSOR_HAND: - cursor = WAYLAND_wl_cursor_theme_get_cursor(theme, "hand2"); - break; - default: - SDL_assert(0); - return SDL_FALSE; + cssname = SDL_GetCSSCursorName(cdata->system_cursor, &fallback_name); + + cursor = WAYLAND_wl_cursor_theme_get_cursor(theme, cssname); + if (!cursor && fallback_name) { + cursor = WAYLAND_wl_cursor_theme_get_cursor(theme, fallback_name); + } + + /* try the legacy name if the fancy new CSS name doesn't work... */ + if (!cursor) { + cursor = WAYLAND_wl_cursor_theme_get_cursor(theme, GetLegacyCursorName(cdata->system_cursor)); } /* Fallback to the default cursor if the chosen one wasn't found */ + if (!cursor) { + cursor = WAYLAND_wl_cursor_theme_get_cursor(theme, "default"); + } + /* Try the old X11 name as a last resort */ if (!cursor) { cursor = WAYLAND_wl_cursor_theme_get_cursor(theme, "left_ptr"); - if (!cursor) { - return SDL_FALSE; - } + } + if (!cursor) { + return SDL_FALSE; } /* ... Set the cursor data, finally. */ @@ -290,27 +291,72 @@ static SDL_bool wayland_get_system_cursor(SDL_VideoData *vdata, Wayland_CursorDa return SDL_TRUE; } -static int wayland_create_tmp_file(off_t size) +static int set_tmp_file_size(int fd, off_t size) { - static const char template[] = "/sdl-shared-XXXXXX"; - char *xdg_path; - char tmp_path[PATH_MAX]; - int fd; +#ifdef HAVE_POSIX_FALLOCATE + sigset_t set, old_set; + int ret; - xdg_path = SDL_getenv("XDG_RUNTIME_DIR"); - if (xdg_path == NULL) { - return -1; - } + /* SIGALRM can potentially block a large posix_fallocate() operation + * from succeeding, so block it. + */ + sigemptyset(&set); + sigaddset(&set, SIGALRM); + sigprocmask(SIG_BLOCK, &set, &old_set); + + do { + ret = posix_fallocate(fd, 0, size); + } while (ret == EINTR); - SDL_strlcpy(tmp_path, xdg_path, PATH_MAX); - SDL_strlcat(tmp_path, template, PATH_MAX); + sigprocmask(SIG_SETMASK, &old_set, NULL); - fd = mkostemp(tmp_path, O_CLOEXEC); - if (fd < 0) { + if (ret == 0) { + return 0; + } + else if (ret != EINVAL && errno != EOPNOTSUPP) { return -1; } +#endif if (ftruncate(fd, size) < 0) { + return -1; + } + return 0; +} + +static int wayland_create_tmp_file(off_t size) +{ + int fd; + +#ifdef HAVE_MEMFD_CREATE + fd = memfd_create("SDL", MFD_CLOEXEC | MFD_ALLOW_SEALING); + if (fd >= 0) { + fcntl(fd, F_ADD_SEALS, F_SEAL_SHRINK | F_SEAL_SEAL); + } else +#endif + { + static const char template[] = "/sdl-shared-XXXXXX"; + char *xdg_path; + char tmp_path[PATH_MAX]; + + xdg_path = SDL_getenv("XDG_RUNTIME_DIR"); + if (!xdg_path) { + return -1; + } + + SDL_strlcpy(tmp_path, xdg_path, PATH_MAX); + SDL_strlcat(tmp_path, template, PATH_MAX); + + fd = mkostemp(tmp_path, O_CLOEXEC); + if (fd < 0) { + return -1; + } + + /* Need to manually unlink the temp files, or they can persist after close and fill up the temp storage. */ + unlink(tmp_path); + } + + if (set_tmp_file_size(fd, size) < 0) { close(fd); return -1; } @@ -334,19 +380,18 @@ static int create_buffer_from_shm(Wayland_CursorData *d, SDL_VideoDevice *vd = SDL_GetVideoDevice(); SDL_VideoData *data = (SDL_VideoData *)vd->driverdata; struct wl_shm_pool *shm_pool; + int shm_fd; int stride = width * 4; - int size = stride * height; + d->shm_data_size = stride * height; - int shm_fd; - - shm_fd = wayland_create_tmp_file(size); + shm_fd = wayland_create_tmp_file(d->shm_data_size); if (shm_fd < 0) { return SDL_SetError("Creating mouse cursor buffer failed."); } d->shm_data = mmap(NULL, - size, + d->shm_data_size, PROT_READ | PROT_WRITE, MAP_SHARED, shm_fd, @@ -359,7 +404,7 @@ static int create_buffer_from_shm(Wayland_CursorData *d, SDL_assert(d->shm_data != NULL); - shm_pool = wl_shm_create_pool(data->shm, shm_fd, size); + shm_pool = wl_shm_create_pool(data->shm, shm_fd, d->shm_data_size); d->buffer = wl_shm_pool_create_buffer(shm_pool, 0, width, @@ -385,7 +430,7 @@ static SDL_Cursor *Wayland_CreateCursor(SDL_Surface *surface, int hot_x, int hot SDL_VideoDevice *vd = SDL_GetVideoDevice(); SDL_VideoData *wd = (SDL_VideoData *)vd->driverdata; Wayland_CursorData *data = SDL_calloc(1, sizeof(Wayland_CursorData)); - if (data == NULL) { + if (!data) { SDL_OutOfMemory(); SDL_free(cursor); return NULL; @@ -429,7 +474,7 @@ static SDL_Cursor *Wayland_CreateSystemCursor(SDL_SystemCursor id) cursor = SDL_calloc(1, sizeof(*cursor)); if (cursor) { Wayland_CursorData *cdata = SDL_calloc(1, sizeof(Wayland_CursorData)); - if (cdata == NULL) { + if (!cdata) { SDL_OutOfMemory(); SDL_free(cursor); return NULL; @@ -460,6 +505,7 @@ static void Wayland_FreeCursorData(Wayland_CursorData *d) if (d->buffer) { if (d->shm_data) { wl_buffer_destroy(d->buffer); + munmap(d->shm_data, d->shm_data_size); } d->buffer = NULL; } @@ -472,7 +518,7 @@ static void Wayland_FreeCursorData(Wayland_CursorData *d) static void Wayland_FreeCursor(SDL_Cursor *cursor) { - if (cursor == NULL) { + if (!cursor) { return; } @@ -483,7 +529,6 @@ static void Wayland_FreeCursor(SDL_Cursor *cursor) Wayland_FreeCursorData((Wayland_CursorData *)cursor->driverdata); - /* Not sure what's meant to happen to shm_data */ SDL_free(cursor->driverdata); SDL_free(cursor); } @@ -496,7 +541,7 @@ static int Wayland_ShowCursor(SDL_Cursor *cursor) struct wl_pointer *pointer = d->pointer; float scale = 1.0f; - if (pointer == NULL) { + if (!pointer) { return -1; } @@ -504,7 +549,7 @@ static int Wayland_ShowCursor(SDL_Cursor *cursor) Wayland_CursorData *data = cursor->driverdata; /* TODO: High-DPI custom cursors? -flibit */ - if (data->shm_data == NULL) { + if (!data->shm_data) { if (!wayland_get_system_cursor(d, data, &scale)) { return -1; } @@ -550,6 +595,7 @@ static void Wayland_WarpMouse(SDL_Window *window, int x, int y) Wayland_input_lock_pointer(input); input->relative_mode_override = SDL_TRUE; } + SDL_SendMouseMotion(window, 0, 0, x, y); } } diff --git a/thirdparty/SDL/src/video/wayland/SDL_waylandmouse.h b/thirdparty/SDL/src/video/wayland/SDL_waylandmouse.h index dd3e8f83d..4f3296d0e 100644 --- a/thirdparty/SDL/src/video/wayland/SDL_waylandmouse.h +++ b/thirdparty/SDL/src/video/wayland/SDL_waylandmouse.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -23,7 +23,7 @@ #include "SDL_mouse.h" #include "SDL_waylandvideo.h" -#if SDL_VIDEO_DRIVER_WAYLAND +#ifdef SDL_VIDEO_DRIVER_WAYLAND extern void Wayland_InitMouse(void); extern void Wayland_FiniMouse(SDL_VideoData *data); diff --git a/thirdparty/SDL/src/video/wayland/SDL_waylandopengles.c b/thirdparty/SDL/src/video/wayland/SDL_waylandopengles.c index 41e84fbaf..22311a63e 100644 --- a/thirdparty/SDL/src/video/wayland/SDL_waylandopengles.c +++ b/thirdparty/SDL/src/video/wayland/SDL_waylandopengles.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_WAYLAND && SDL_VIDEO_OPENGL_EGL +#if defined(SDL_VIDEO_DRIVER_WAYLAND) && defined(SDL_VIDEO_OPENGL_EGL) #include "SDL_timer.h" #include "../../core/unix/SDL_poll.h" @@ -125,8 +125,8 @@ int Wayland_GLES_SwapWindow(_THIS, SDL_Window *window) SDL_VideoData *videodata = (SDL_VideoData *)_this->driverdata; struct wl_display *display = videodata->display; SDL_VideoDisplay *sdldisplay = SDL_GetDisplayForWindow(window); - /* ~10 frames (or 1 sec), so we'll progress even if throttled to zero. */ - const Uint32 max_wait = SDL_GetTicks() + (sdldisplay->current_mode.refresh_rate ? (10000 / sdldisplay->current_mode.refresh_rate) : 1000); + /* 1/3 speed (or 20hz), so we'll progress even if throttled to zero. */ + const Uint32 max_wait = SDL_GetTicks() + (sdldisplay && sdldisplay->current_mode.refresh_rate ? (3000 / sdldisplay->current_mode.refresh_rate) : 50); while (SDL_AtomicGet(&data->swap_interval_ready) == 0) { Uint32 now; diff --git a/thirdparty/SDL/src/video/wayland/SDL_waylandopengles.h b/thirdparty/SDL/src/video/wayland/SDL_waylandopengles.h index deb7dd109..772a80a04 100644 --- a/thirdparty/SDL/src/video/wayland/SDL_waylandopengles.h +++ b/thirdparty/SDL/src/video/wayland/SDL_waylandopengles.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/wayland/SDL_waylandsym.h b/thirdparty/SDL/src/video/wayland/SDL_waylandsym.h index c59bb30c9..1b02b01c6 100644 --- a/thirdparty/SDL/src/video/wayland/SDL_waylandsym.h +++ b/thirdparty/SDL/src/video/wayland/SDL_waylandsym.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -219,10 +219,10 @@ SDL_WAYLAND_SYM(int, libdecor_dispatch, (struct libdecor *, int)) #if defined(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_LIBDECOR) || defined(SDL_HAVE_LIBDECOR_GET_MIN_MAX) /* Only found in libdecor 0.1.1 or higher, so failure to load them is not fatal. */ -SDL_WAYLAND_SYM_OPT(void, libdecor_frame_get_min_content_size, (struct libdecor_frame *,\ +SDL_WAYLAND_SYM_OPT(void, libdecor_frame_get_min_content_size, (const struct libdecor_frame *,\ int *,\ int *)) -SDL_WAYLAND_SYM_OPT(void, libdecor_frame_get_max_content_size, (struct libdecor_frame *,\ +SDL_WAYLAND_SYM_OPT(void, libdecor_frame_get_max_content_size, (const struct libdecor_frame *,\ int *,\ int *)) #endif diff --git a/thirdparty/SDL/src/video/wayland/SDL_waylandtouch.c b/thirdparty/SDL/src/video/wayland/SDL_waylandtouch.c index 7c7a300d7..7a6b7fcd0 100644 --- a/thirdparty/SDL/src/video/wayland/SDL_waylandtouch.c +++ b/thirdparty/SDL/src/video/wayland/SDL_waylandtouch.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -99,7 +99,7 @@ static void touch_handle_touch(void *data, /* FIXME: This should be the window the given wayland surface is associated * with, but how do we get the wayland surface? */ window = SDL_GetMouseFocus(); - if (window == NULL) { + if (!window) { window = SDL_GetKeyboardFocus(); } diff --git a/thirdparty/SDL/src/video/wayland/SDL_waylandtouch.h b/thirdparty/SDL/src/video/wayland/SDL_waylandtouch.h index 5a542e2dd..ed260ea39 100644 --- a/thirdparty/SDL/src/video/wayland/SDL_waylandtouch.h +++ b/thirdparty/SDL/src/video/wayland/SDL_waylandtouch.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -94,7 +94,7 @@ static inline struct qt_extended_surface *qt_surface_extension_get_extended_surf id = wl_proxy_create((struct wl_proxy *)qt_surface_extension, &qt_extended_surface_interface); - if (id == NULL) + if (!id) return NULL; WAYLAND_wl_proxy_marshal((struct wl_proxy *)qt_surface_extension, diff --git a/thirdparty/SDL/src/video/wayland/SDL_waylandvideo.c b/thirdparty/SDL/src/video/wayland/SDL_waylandvideo.c index 8fd65813a..636b5afbd 100644 --- a/thirdparty/SDL/src/video/wayland/SDL_waylandvideo.c +++ b/thirdparty/SDL/src/video/wayland/SDL_waylandvideo.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,7 +21,7 @@ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_WAYLAND +#ifdef SDL_VIDEO_DRIVER_WAYLAND #include "SDL_video.h" #include "SDL_mouse.h" @@ -37,6 +37,7 @@ #include "SDL_waylandtouch.h" #include "SDL_waylandclipboard.h" #include "SDL_waylandvulkan.h" +#include "SDL_waylandmessagebox.h" #include "SDL_hints.h" #include @@ -77,7 +78,7 @@ static void Wayland_VideoQuit(_THIS); /* Find out what class name we should use * Based on src/video/x11/SDL_x11video.c */ -static char *get_classname() +static char *get_classname(void) { /* !!! FIXME: this is probably wrong, albeit harmless in many common cases. From protocol spec: "The surface class identifies the general class of applications @@ -171,33 +172,58 @@ static SDL_VideoDevice *Wayland_CreateDevice(void) { SDL_VideoDevice *device; SDL_VideoData *data; + struct SDL_WaylandInput *input; struct wl_display *display; + /* Are we trying to connect to or are currently in a Wayland session? */ + if (!getenv("WAYLAND_DISPLAY")) { + const char *session = getenv("XDG_SESSION_TYPE"); + if (session && SDL_strcasecmp(session, "wayland")) { + return NULL; + } + } + if (!SDL_WAYLAND_LoadSymbols()) { return NULL; } display = WAYLAND_wl_display_connect(NULL); - if (display == NULL) { + if (!display) { SDL_WAYLAND_UnloadSymbols(); return NULL; } data = SDL_calloc(1, sizeof(*data)); - if (data == NULL) { + if (!data) { WAYLAND_wl_display_disconnect(display); SDL_WAYLAND_UnloadSymbols(); SDL_OutOfMemory(); return NULL; } + input = SDL_calloc(1, sizeof(*input)); + if (!input) { + SDL_free(data); + WAYLAND_wl_display_disconnect(display); + SDL_WAYLAND_UnloadSymbols(); + SDL_OutOfMemory(); + return NULL; + } + + input->display = data; + input->sx_w = wl_fixed_from_int(0); + input->sy_w = wl_fixed_from_int(0); + input->xkb.current_group = XKB_GROUP_INVALID; + data->initializing = SDL_TRUE; data->display = display; + data->input = input; /* Initialize all variables that we clean on shutdown */ device = SDL_calloc(1, sizeof(SDL_VideoDevice)); - if (device == NULL) { + if (!device) { SDL_free(data); + SDL_free(input); WAYLAND_wl_display_disconnect(display); SDL_WAYLAND_UnloadSymbols(); SDL_OutOfMemory(); @@ -219,7 +245,7 @@ static SDL_VideoDevice *Wayland_CreateDevice(void) device->WaitEventTimeout = Wayland_WaitEventTimeout; device->SendWakeupEvent = Wayland_SendWakeupEvent; -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL device->GL_SwapWindow = Wayland_GLES_SwapWindow; device->GL_GetSwapInterval = Wayland_GLES_GetSwapInterval; device->GL_SetSwapInterval = Wayland_GLES_SetSwapInterval; @@ -265,7 +291,7 @@ static SDL_VideoDevice *Wayland_CreateDevice(void) device->StopTextInput = Wayland_StopTextInput; device->SetTextInputRect = Wayland_SetTextInputRect; -#if SDL_VIDEO_VULKAN +#ifdef SDL_VIDEO_VULKAN device->Vulkan_LoadLibrary = Wayland_Vulkan_LoadLibrary; device->Vulkan_UnloadLibrary = Wayland_Vulkan_UnloadLibrary; device->Vulkan_GetInstanceExtensions = Wayland_Vulkan_GetInstanceExtensions; @@ -282,7 +308,8 @@ static SDL_VideoDevice *Wayland_CreateDevice(void) VideoBootStrap Wayland_bootstrap = { WAYLANDVID_DRIVER_NAME, "SDL Wayland video driver", - Wayland_CreateDevice + Wayland_CreateDevice, + Wayland_ShowMessageBox }; static void xdg_output_handle_logical_position(void *data, struct zxdg_output_v1 *xdg_output, @@ -348,7 +375,7 @@ static void xdg_output_handle_description(void *data, struct zxdg_output_v1 *xdg if (driverdata->index == -1) { /* xdg-output descriptions, if available, supersede wl-output model names. */ - if (driverdata->placeholder.name != NULL) { + if (driverdata->placeholder.name) { SDL_free(driverdata->placeholder.name); } @@ -451,17 +478,8 @@ static void display_handle_geometry(void *data, { SDL_WaylandOutputData *driverdata = data; - SDL_VideoDisplay *display; - int i; if (driverdata->wl_output_done_count) { - /* Clear the wl_output ref so Reset doesn't free it */ - display = SDL_GetDisplay(driverdata->index); - for (i = 0; i < display->num_display_modes; i += 1) { - display->display_modes[i].driverdata = NULL; - } - - /* Okay, now it's safe to reset */ SDL_ResetDisplayModes(driverdata->index); /* The display has officially started over. */ @@ -477,7 +495,7 @@ static void display_handle_geometry(void *data, driverdata->physical_height = physical_height; /* The output name is only set if xdg-output hasn't provided a description. */ - if (driverdata->index == -1 && driverdata->placeholder.name == NULL) { + if (driverdata->index == -1 && !driverdata->placeholder.name) { driverdata->placeholder.name = SDL_strdup(model); } @@ -573,7 +591,6 @@ static void display_handle_done(void *data, native_mode.h = driverdata->native_height; } native_mode.refresh_rate = (int)SDL_round(driverdata->refresh / 1000.0); /* mHz to Hz */ - native_mode.driverdata = driverdata->output; /* The scaled desktop mode */ SDL_zero(desktop_mode); @@ -595,13 +612,12 @@ static void display_handle_done(void *data, desktop_mode.h = driverdata->width; } desktop_mode.refresh_rate = (int)SDL_round(driverdata->refresh / 1000.0); /* mHz to Hz */ - desktop_mode.driverdata = driverdata->output; /* * The native display mode is only exposed separately from the desktop size if the * desktop is scaled and the wp_viewporter protocol is supported. */ - if (driverdata->scale_factor > 1.0f && video->viewporter != NULL) { + if (driverdata->scale_factor > 1.0f && video->viewporter) { if (driverdata->index > -1) { SDL_AddDisplayMode(SDL_GetDisplay(driverdata->index), &native_mode); } else { @@ -611,17 +627,17 @@ static void display_handle_done(void *data, /* Calculate the display DPI */ if (driverdata->transform & WL_OUTPUT_TRANSFORM_90) { - driverdata->hdpi = driverdata->physical_height ? (((float)driverdata->height) * 25.4f / driverdata->physical_height) : 0.0f; - driverdata->vdpi = driverdata->physical_width ? (((float)driverdata->width) * 25.4f / driverdata->physical_width) : 0.0f; - driverdata->ddpi = SDL_ComputeDiagonalDPI(driverdata->height, - driverdata->width, + driverdata->hdpi = driverdata->physical_height ? (((float)driverdata->native_height) * 25.4f / driverdata->physical_height) : 0.0f; + driverdata->vdpi = driverdata->physical_width ? (((float)driverdata->native_width) * 25.4f / driverdata->physical_width) : 0.0f; + driverdata->ddpi = SDL_ComputeDiagonalDPI(driverdata->native_height, + driverdata->native_width, ((float)driverdata->physical_height) / 25.4f, ((float)driverdata->physical_width) / 25.4f); } else { - driverdata->hdpi = driverdata->physical_width ? (((float)driverdata->width) * 25.4f / driverdata->physical_width) : 0.0f; - driverdata->vdpi = driverdata->physical_height ? (((float)driverdata->height) * 25.4f / driverdata->physical_height) : 0.0f; - driverdata->ddpi = SDL_ComputeDiagonalDPI(driverdata->width, - driverdata->height, + driverdata->hdpi = driverdata->physical_width ? (((float)driverdata->native_width) * 25.4f / driverdata->physical_width) : 0.0f; + driverdata->vdpi = driverdata->physical_height ? (((float)driverdata->native_height) * 25.4f / driverdata->physical_height) : 0.0f; + driverdata->ddpi = SDL_ComputeDiagonalDPI(driverdata->native_width, + driverdata->native_height, ((float)driverdata->physical_width) / 25.4f, ((float)driverdata->physical_height) / 25.4f); } @@ -677,7 +693,7 @@ static void Wayland_add_display(SDL_VideoData *d, uint32_t id) SDL_WaylandOutputData *data; output = wl_registry_bind(d->registry, id, &wl_output_interface, 2); - if (output == NULL) { + if (!output) { SDL_SetError("Failed to retrieve output."); return; } @@ -693,10 +709,10 @@ static void Wayland_add_display(SDL_VideoData *d, uint32_t id) SDL_WAYLAND_register_output(output); /* Keep a list of outputs for deferred xdg-output initialization. */ - if (d->output_list != NULL) { + if (d->output_list) { SDL_WaylandOutputData *node = d->output_list; - while (node->next != NULL) { + while (node->next) { node = node->next; } @@ -722,25 +738,24 @@ static void Wayland_free_display(SDL_VideoData *d, uint32_t id) display = SDL_GetDisplay(i); data = (SDL_WaylandOutputData *)display->driverdata; if (data->registry_id == id) { - if (d->output_list != NULL) { + if (d->output_list) { SDL_WaylandOutputData *node = d->output_list; if (node == data) { d->output_list = node->next; } else { - while (node->next != data && node->next != NULL) { + while (node->next != data && node->next) { node = node->next; } - if (node->next != NULL) { + if (node->next) { node->next = node->next->next; } } } - SDL_DelVideoDisplay(i); if (data->xdg_output) { zxdg_output_v1_destroy(data->xdg_output); } wl_output_destroy(data->output); - SDL_free(data); + SDL_DelVideoDisplay(i); /* Update the index for all remaining displays */ num_displays -= 1; @@ -758,7 +773,7 @@ static void Wayland_free_display(SDL_VideoData *d, uint32_t id) static void Wayland_init_xdg_output(SDL_VideoData *d) { SDL_WaylandOutputData *node; - for (node = d->output_list; node != NULL; node = node->next) { + for (node = d->output_list; node; node = node->next) { node->xdg_output = zxdg_output_manager_v1_get_xdg_output(node->videodata->xdg_output_manager, node->output); zxdg_output_v1_add_listener(node->xdg_output, &xdg_output_listener, node); } @@ -841,9 +856,7 @@ static void display_handle_global(void *data, struct wl_registry *registry, uint d->decoration_manager = wl_registry_bind(d->registry, id, &zxdg_decoration_manager_v1_interface, 1); } else if (SDL_strcmp(interface, "zwp_tablet_manager_v2") == 0) { d->tablet_manager = wl_registry_bind(d->registry, id, &zwp_tablet_manager_v2_interface, 1); - if (d->input) { - Wayland_input_add_tablet(d->input, d->tablet_manager); - } + Wayland_input_add_tablet(d->input, d->tablet_manager); } else if (SDL_strcmp(interface, "zxdg_output_manager_v1") == 0) { version = SDL_min(version, 3); /* Versions 1 through 3 are supported. */ d->xdg_output_manager = wl_registry_bind(d->registry, id, &zxdg_output_manager_v1_interface, version); @@ -929,7 +942,7 @@ int Wayland_VideoInit(_THIS) } data->registry = wl_display_get_registry(data->display); - if (data->registry == NULL) { + if (!data->registry) { return SDL_SetError("Failed to get the Wayland registry"); } @@ -989,7 +1002,7 @@ static int Wayland_GetDisplayDPI(_THIS, SDL_VideoDisplay *sdl_display, float *dd static void Wayland_VideoCleanup(_THIS) { SDL_VideoData *data = _this->driverdata; - int i, j; + int i; Wayland_QuitWin(data); Wayland_FiniMouse(data); @@ -1002,13 +1015,6 @@ static void Wayland_VideoCleanup(_THIS) } wl_output_destroy(((SDL_WaylandOutputData *)display->driverdata)->output); - SDL_free(display->driverdata); - display->driverdata = NULL; - - for (j = display->num_display_modes; j--;) { - display->display_modes[j].driverdata = NULL; - } - display->desktop_mode.driverdata = NULL; SDL_DelVideoDisplay(i); } data->output_list = NULL; diff --git a/thirdparty/SDL/src/video/wayland/SDL_waylandvideo.h b/thirdparty/SDL/src/video/wayland/SDL_waylandvideo.h index 2f3eb4c82..b7b3348c6 100644 --- a/thirdparty/SDL/src/video/wayland/SDL_waylandvideo.h +++ b/thirdparty/SDL/src/video/wayland/SDL_waylandvideo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/wayland/SDL_waylandvulkan.c b/thirdparty/SDL/src/video/wayland/SDL_waylandvulkan.c index 59427dedb..af956dad2 100644 --- a/thirdparty/SDL/src/video/wayland/SDL_waylandvulkan.c +++ b/thirdparty/SDL/src/video/wayland/SDL_waylandvulkan.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -26,7 +26,7 @@ #include "../../SDL_internal.h" -#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_WAYLAND +#if defined(SDL_VIDEO_VULKAN) && defined(SDL_VIDEO_DRIVER_WAYLAND) #include "SDL_waylandvideo.h" #include "SDL_waylandwindow.h" @@ -53,10 +53,10 @@ int Wayland_Vulkan_LoadLibrary(_THIS, const char *path) } /* Load the Vulkan loader library */ - if (path == NULL) { + if (!path) { path = SDL_getenv("SDL_VULKAN_LIBRARY"); } - if (path == NULL) { + if (!path) { path = DEFAULT_VULKAN; } _this->vulkan_config.loader_handle = SDL_LoadObject(path); @@ -81,7 +81,7 @@ int Wayland_Vulkan_LoadLibrary(_THIS, const char *path) (PFN_vkEnumerateInstanceExtensionProperties) _this->vulkan_config.vkEnumerateInstanceExtensionProperties, &extensionCount); - if (extensions == NULL) { + if (!extensions) { goto fail; } for (i = 0; i < extensionCount; i++) { diff --git a/thirdparty/SDL/src/video/wayland/SDL_waylandvulkan.h b/thirdparty/SDL/src/video/wayland/SDL_waylandvulkan.h index c22e34df6..f42ed8e3b 100644 --- a/thirdparty/SDL/src/video/wayland/SDL_waylandvulkan.h +++ b/thirdparty/SDL/src/video/wayland/SDL_waylandvulkan.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -32,7 +32,7 @@ #include "../SDL_vulkan_internal.h" #include "../SDL_sysvideo.h" -#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_WAYLAND +#if defined(SDL_VIDEO_VULKAN) && defined(SDL_VIDEO_DRIVER_WAYLAND) int Wayland_Vulkan_LoadLibrary(_THIS, const char *path); void Wayland_Vulkan_UnloadLibrary(_THIS); diff --git a/thirdparty/SDL/src/video/wayland/SDL_waylandwindow.c b/thirdparty/SDL/src/video/wayland/SDL_waylandwindow.c index ff323083e..c8d55def1 100644 --- a/thirdparty/SDL/src/video/wayland/SDL_waylandwindow.c +++ b/thirdparty/SDL/src/video/wayland/SDL_waylandwindow.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,7 +21,7 @@ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_WAYLAND +#ifdef SDL_VIDEO_DRIVER_WAYLAND #include "../SDL_sysvideo.h" #include "../../events/SDL_windowevents_c.h" @@ -145,7 +145,7 @@ static SDL_bool NeedViewport(SDL_Window *window) * - A fullscreen mode is being emulated and the mode does not match the logical desktop dimensions. * - The desktop uses fractional scaling and the high-DPI flag is set. */ - if (video->viewporter != NULL) { + if (video->viewporter) { if (FullscreenModeEmulation(window)) { GetFullScreenDimensions(window, &fs_width, &fs_height, NULL, NULL); if (fs_width != output_width || fs_height != output_height) { @@ -198,11 +198,11 @@ static void SetDrawSurfaceViewport(SDL_Window *window, int src_width, int src_he SDL_VideoData *video = wind->waylandData; if (video->viewporter) { - if (wind->draw_viewport == NULL) { + if (!wind->draw_viewport) { wind->draw_viewport = wp_viewporter_get_viewport(video->viewporter, wind->surface); } - wp_viewport_set_source(wind->draw_viewport, wl_fixed_from_int(0), wl_fixed_from_int(0), wl_fixed_from_int(src_width), wl_fixed_from_int(src_height)); + wp_viewport_set_source(wind->draw_viewport, wl_fixed_from_int(-1), wl_fixed_from_int(-1), wl_fixed_from_int(-1), wl_fixed_from_int(-1)); wp_viewport_set_destination(wind->draw_viewport, dst_width, dst_height); } } @@ -295,7 +295,7 @@ static void ConfigureWindowGeometry(SDL_Window *window) if (window_size_changed) { /* libdecor does this internally on frame commits, so it's only needed for xdg surfaces. */ if (data->shell_surface_type != WAYLAND_SURFACE_LIBDECOR && - viddata->shell.xdg && data->shell_surface.xdg.surface != NULL) { + viddata->shell.xdg && data->shell_surface.xdg.surface) { xdg_surface_set_window_geometry(data->shell_surface.xdg.surface, 0, 0, data->window_width, data->window_height); } @@ -360,7 +360,7 @@ static void SetMinMaxDimensions(SDL_Window *window, SDL_bool commit) #ifdef HAVE_LIBDECOR_H if (wind->shell_surface_type == WAYLAND_SURFACE_LIBDECOR) { - if (wind->shell_surface.libdecor.frame == NULL) { + if (!wind->shell_surface.libdecor.frame) { return; /* Can't do anything yet, wait for ShowWindow */ } libdecor_frame_set_min_content_size(wind->shell_surface.libdecor.frame, @@ -404,7 +404,7 @@ static void SetFullscreen(SDL_Window *window, struct wl_output *output) #ifdef HAVE_LIBDECOR_H if (wind->shell_surface_type == WAYLAND_SURFACE_LIBDECOR) { - if (wind->shell_surface.libdecor.frame == NULL) { + if (!wind->shell_surface.libdecor.frame) { return; /* Can't do anything yet, wait for ShowWindow */ } if (output) { @@ -755,11 +755,10 @@ static void handle_configure_zxdg_decoration(void *data, WAYLAND_wl_display_roundtrip(driverdata->waylandData->display); Wayland_HideWindow(device, window); + SDL_zero(driverdata->shell_surface); driverdata->shell_surface_type = WAYLAND_SURFACE_LIBDECOR; - if (!window->is_hiding && !(window->flags & SDL_WINDOW_HIDDEN)) { - Wayland_ShowWindow(device, window); - } + Wayland_ShowWindow(device, window); } } @@ -782,7 +781,7 @@ static const struct zxdg_toplevel_decoration_v1_listener decoration_listener = { static void OverrideLibdecorLimits(SDL_Window *window) { #if defined(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_LIBDECOR) - if (libdecor_frame_get_min_content_size == NULL) { + if (!libdecor_frame_get_min_content_size) { SetMinMaxDimensions(window, SDL_FALSE); } #elif !defined(SDL_HAVE_LIBDECOR_GET_MIN_MAX) @@ -1209,7 +1208,7 @@ SDL_bool Wayland_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * inf #ifdef HAVE_LIBDECOR_H if (data->shell_surface_type == WAYLAND_SURFACE_LIBDECOR) { - if (data->shell_surface.libdecor.frame != NULL) { + if (data->shell_surface.libdecor.frame) { info->info.wl.xdg_surface = libdecor_frame_get_xdg_surface(data->shell_surface.libdecor.frame); if (version >= SDL_VERSIONNUM(2, 0, 17)) { info->info.wl.xdg_toplevel = libdecor_frame_get_xdg_toplevel(data->shell_surface.libdecor.frame); @@ -1224,7 +1223,7 @@ SDL_bool Wayland_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * inf } } else #endif - if (viddata->shell.xdg && data->shell_surface.xdg.surface != NULL) { + if (viddata->shell.xdg && data->shell_surface.xdg.surface) { info->info.wl.xdg_surface = data->shell_surface.xdg.surface; if (version >= SDL_VERSIONNUM(2, 0, 17)) { SDL_bool popup = data->shell_surface_type == WAYLAND_SURFACE_XDG_POPUP; @@ -1270,10 +1269,10 @@ int Wayland_SetWindowModalFor(_THIS, SDL_Window *modal_window, SDL_Window *paren #ifdef HAVE_LIBDECOR_H if (viddata->shell.libdecor) { - if (modal_data->shell_surface.libdecor.frame == NULL) { + if (!modal_data->shell_surface.libdecor.frame) { return SDL_SetError("Modal window was hidden"); } - if (parent_data->shell_surface.libdecor.frame == NULL) { + if (!parent_data->shell_surface.libdecor.frame) { return SDL_SetError("Parent window was hidden"); } libdecor_frame_set_parent(modal_data->shell_surface.libdecor.frame, @@ -1326,7 +1325,7 @@ void Wayland_ShowWindow(_THIS, SDL_Window *window) data->surface, &libdecor_frame_interface, data); - if (data->shell_surface.libdecor.frame == NULL) { + if (!data->shell_surface.libdecor.frame) { SDL_LogError(SDL_LOG_CATEGORY_VIDEO, "Failed to create libdecor frame!"); } else { libdecor_frame_set_app_id(data->shell_surface.libdecor.frame, c->classname); @@ -1374,6 +1373,8 @@ void Wayland_ShowWindow(_THIS, SDL_Window *window) data->shell_surface.xdg.roleobj.toplevel = xdg_surface_get_toplevel(data->shell_surface.xdg.surface); xdg_toplevel_set_app_id(data->shell_surface.xdg.roleobj.toplevel, c->classname); xdg_toplevel_add_listener(data->shell_surface.xdg.roleobj.toplevel, &toplevel_listener_xdg, data); + + SetMinMaxDimensions(window, SDL_FALSE); } } @@ -1487,11 +1488,11 @@ static void Wayland_ReleasePopup(_THIS, SDL_Window *popup) SDL_WindowData *popupdata; /* Basic sanity checks to weed out the weird popup closures */ - if (popup == NULL || popup->magic != &_this->window_magic) { + if (!popup || popup->magic != &_this->window_magic) { return; } popupdata = popup->driverdata; - if (popupdata == NULL) { + if (!popupdata) { return; } @@ -1602,7 +1603,7 @@ static void Wayland_activate_window(SDL_VideoData *data, SDL_WindowData *wind, uint32_t serial, struct wl_seat *seat) { if (data->activation_manager) { - if (wind->activation_token != NULL) { + if (wind->activation_token) { /* We're about to overwrite this with a new request */ xdg_activation_token_v1_destroy(wind->activation_token); } @@ -1619,10 +1620,10 @@ static void Wayland_activate_window(SDL_VideoData *data, SDL_WindowData *wind, * * -flibit */ - if (surface != NULL) { + if (surface) { xdg_activation_token_v1_set_surface(wind->activation_token, surface); } - if (seat != NULL) { + if (seat) { xdg_activation_token_v1_set_serial(wind->activation_token, serial, seat); } xdg_activation_token_v1_commit(wind->activation_token); @@ -1696,20 +1697,20 @@ static void SDLCALL QtExtendedSurface_OnHintChanged(void *userdata, const char * { "inverted-landscape", QT_EXTENDED_SURFACE_ORIENTATION_INVERTEDLANDSCAPEORIENTATION } }; - if (name == NULL) { + if (!name) { return; } if (SDL_strcmp(name, SDL_HINT_QTWAYLAND_CONTENT_ORIENTATION) == 0) { int32_t orientation = QT_EXTENDED_SURFACE_ORIENTATION_PRIMARYORIENTATION; - if (newValue != NULL) { + if (newValue) { const char *value_attempt = newValue; orientation = 0; - while (value_attempt != NULL && *value_attempt != 0) { + while (value_attempt && *value_attempt != 0) { const char *value_attempt_end = SDL_strchr(value_attempt, ','); - size_t value_attempt_len = (value_attempt_end != NULL) ? (value_attempt_end - value_attempt) + size_t value_attempt_len = (value_attempt_end) ? (value_attempt_end - value_attempt) : SDL_strlen(value_attempt); for (i = 0; i < SDL_arraysize(orientations); i += 1) { @@ -1720,7 +1721,7 @@ static void SDLCALL QtExtendedSurface_OnHintChanged(void *userdata, const char * } } - value_attempt = (value_attempt_end != NULL) ? (value_attempt_end + 1) : NULL; + value_attempt = (value_attempt_end) ? (value_attempt_end + 1) : NULL; } } @@ -1728,7 +1729,7 @@ static void SDLCALL QtExtendedSurface_OnHintChanged(void *userdata, const char * } else if (SDL_strcmp(name, SDL_HINT_QTWAYLAND_WINDOW_FLAGS) == 0) { uint32_t flags = 0; - if (newValue != NULL) { + if (newValue) { char *tmp = SDL_strdup(newValue); char *saveptr = NULL; @@ -1818,7 +1819,7 @@ void Wayland_RestoreWindow(_THIS, SDL_Window *window) #ifdef HAVE_LIBDECOR_H if (wind->shell_surface_type == WAYLAND_SURFACE_LIBDECOR) { - if (wind->shell_surface.libdecor.frame == NULL) { + if (!wind->shell_surface.libdecor.frame) { return; /* Can't do anything yet, wait for ShowWindow */ } libdecor_frame_unset_maximized(wind->shell_surface.libdecor.frame); @@ -1863,7 +1864,7 @@ void Wayland_SetWindowResizable(_THIS, SDL_Window *window, SDL_bool resizable) const SDL_WindowData *wind = window->driverdata; if (wind->shell_surface_type == WAYLAND_SURFACE_LIBDECOR) { - if (wind->shell_surface.libdecor.frame == NULL) { + if (!wind->shell_surface.libdecor.frame) { return; /* Can't do anything yet, wait for ShowWindow */ } if (resizable) { @@ -1898,7 +1899,7 @@ void Wayland_MaximizeWindow(_THIS, SDL_Window *window) #ifdef HAVE_LIBDECOR_H if (wind->shell_surface_type == WAYLAND_SURFACE_LIBDECOR) { - if (wind->shell_surface.libdecor.frame == NULL) { + if (!wind->shell_surface.libdecor.frame) { return; /* Can't do anything yet, wait for ShowWindow */ } libdecor_frame_set_maximized(wind->shell_surface.libdecor.frame); @@ -1925,7 +1926,7 @@ void Wayland_MinimizeWindow(_THIS, SDL_Window *window) #ifdef HAVE_LIBDECOR_H if (wind->shell_surface_type == WAYLAND_SURFACE_LIBDECOR) { - if (wind->shell_surface.libdecor.frame == NULL) { + if (!wind->shell_surface.libdecor.frame) { return; /* Can't do anything yet, wait for ShowWindow */ } libdecor_frame_set_minimized(wind->shell_surface.libdecor.frame); @@ -1988,7 +1989,7 @@ int Wayland_CreateWindow(_THIS, SDL_Window *window) SDL_VideoData *c; data = SDL_calloc(1, sizeof(*data)); - if (data == NULL) { + if (!data) { return SDL_OutOfMemory(); } @@ -2067,7 +2068,7 @@ int Wayland_CreateWindow(_THIS, SDL_Window *window) if (window->flags & SDL_WINDOW_OPENGL) { data->egl_window = WAYLAND_wl_egl_window_create(data->surface, data->drawable_width, data->drawable_height); -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL /* Create the GLES window surface */ data->egl_surface = SDL_EGL_CreateSurface(_this, (NativeWindowType)data->egl_window); @@ -2206,7 +2207,7 @@ void Wayland_SetWindowTitle(_THIS, SDL_Window *window) #ifdef HAVE_LIBDECOR_H if (wind->shell_surface_type == WAYLAND_SURFACE_LIBDECOR) { - if (wind->shell_surface.libdecor.frame == NULL) { + if (!wind->shell_surface.libdecor.frame) { return; /* Can't do anything yet, wait for ShowWindow */ } libdecor_frame_set_title(wind->shell_surface.libdecor.frame, title); @@ -2226,7 +2227,7 @@ void Wayland_SuspendScreenSaver(_THIS) { SDL_VideoData *data = (SDL_VideoData *)_this->driverdata; -#if SDL_USE_LIBDBUS +#ifdef SDL_USE_LIBDBUS if (SDL_DBus_ScreensaverInhibit(_this->suspend_screensaver)) { return; } @@ -2265,7 +2266,7 @@ void Wayland_DestroyWindow(_THIS, SDL_Window *window) SDL_WindowData *wind = window->driverdata; if (data) { -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL if (wind->egl_surface) { SDL_EGL_DestroySurface(_this, wind->egl_surface); } @@ -2330,7 +2331,7 @@ static void EGLTransparencyChangedCallback(void *userdata, const char *name, con viddata->egl_transparency_enabled = newval; /* Iterate over all windows and update the surface opaque regions */ - for (window = dev->windows; window != NULL; window = window->next) { + for (window = dev->windows; window; window = window->next) { SDL_WindowData *wind = (SDL_WindowData *)window->driverdata; if (!newval) { diff --git a/thirdparty/SDL/src/video/wayland/SDL_waylandwindow.h b/thirdparty/SDL/src/video/wayland/SDL_waylandwindow.h index 89f0d7766..36600a4d2 100644 --- a/thirdparty/SDL/src/video/wayland/SDL_waylandwindow.h +++ b/thirdparty/SDL/src/video/wayland/SDL_waylandwindow.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -78,7 +78,7 @@ typedef struct struct wl_egl_window *egl_window; struct SDL_WaylandInput *keyboard_device; -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL EGLSurface egl_surface; #endif struct zwp_locked_pointer_v1 *locked_pointer; diff --git a/thirdparty/SDL/src/video/windows/SDL_msctf.h b/thirdparty/SDL/src/video/windows/SDL_msctf.h index 5f6829a07..738696f01 100644 --- a/thirdparty/SDL/src/video/windows/SDL_msctf.h +++ b/thirdparty/SDL/src/video/windows/SDL_msctf.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/windows/SDL_vkeys.h b/thirdparty/SDL/src/video/windows/SDL_vkeys.h index 12f3440d9..fb4d27de9 100644 --- a/thirdparty/SDL/src/video/windows/SDL_vkeys.h +++ b/thirdparty/SDL/src/video/windows/SDL_vkeys.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/windows/SDL_windowsclipboard.c b/thirdparty/SDL/src/video/windows/SDL_windowsclipboard.c index df8a404a7..24bc5abef 100644 --- a/thirdparty/SDL/src/video/windows/SDL_windowsclipboard.c +++ b/thirdparty/SDL/src/video/windows/SDL_windowsclipboard.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_WINDOWS && !defined(__XBOXONE__) && !defined(__XBOXSERIES__) +#if defined(SDL_VIDEO_DRIVER_WINDOWS) && !defined(__XBOXONE__) && !defined(__XBOXSERIES__) #include "SDL_windowsvideo.h" #include "SDL_windowswindow.h" @@ -129,7 +129,7 @@ char *WIN_GetClipboardText(_THIS) SDL_Delay(10); } } - if (text == NULL) { + if (!text) { text = SDL_strdup(""); } return text; diff --git a/thirdparty/SDL/src/video/windows/SDL_windowsclipboard.h b/thirdparty/SDL/src/video/windows/SDL_windowsclipboard.h index d91eefe42..3db9bb936 100644 --- a/thirdparty/SDL/src/video/windows/SDL_windowsclipboard.h +++ b/thirdparty/SDL/src/video/windows/SDL_windowsclipboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/windows/SDL_windowsevents.c b/thirdparty/SDL/src/video/windows/SDL_windowsevents.c index 180c1a8eb..75feb5cbe 100644 --- a/thirdparty/SDL/src/video/windows/SDL_windowsevents.c +++ b/thirdparty/SDL/src/video/windows/SDL_windowsevents.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_WINDOWS +#ifdef SDL_VIDEO_DRIVER_WINDOWS #include "SDL_windowsvideo.h" #include "SDL_windowsshape.h" @@ -43,7 +43,7 @@ #include /* For WM_TABLET_QUERYSYSTEMGESTURESTATUS et. al. */ -#if HAVE_TPCSHRD_H +#ifdef HAVE_TPCSHRD_H #include #endif /* HAVE_TPCSHRD_H */ @@ -99,6 +99,9 @@ #ifndef WM_GETDPISCALEDSIZE #define WM_GETDPISCALEDSIZE 0x02E4 #endif +#ifndef TOUCHEVENTF_PEN +#define TOUCHEVENTF_PEN 0x0040 +#endif #ifndef IS_HIGH_SURROGATE #define IS_HIGH_SURROGATE(x) (((x) >= 0xd800) && ((x) <= 0xdbff)) @@ -110,6 +113,10 @@ #define IS_SURROGATE_PAIR(h, l) (IS_HIGH_SURROGATE(h) && IS_LOW_SURROGATE(l)) #endif +#ifndef USER_TIMER_MINIMUM +#define USER_TIMER_MINIMUM 0x0000000A +#endif + static SDL_Scancode VKeytoScancodeFallback(WPARAM vkey) { switch (vkey) { @@ -121,6 +128,10 @@ static SDL_Scancode VKeytoScancodeFallback(WPARAM vkey) return SDL_SCANCODE_RIGHT; case VK_DOWN: return SDL_SCANCODE_DOWN; + case VK_CONTROL: + return SDL_SCANCODE_LCTRL; + case VK_V: + return SDL_SCANCODE_V; default: return SDL_SCANCODE_UNKNOWN; @@ -130,6 +141,11 @@ static SDL_Scancode VKeytoScancodeFallback(WPARAM vkey) static SDL_Scancode VKeytoScancode(WPARAM vkey) { switch (vkey) { + case VK_BACK: + return SDL_SCANCODE_BACKSPACE; + case VK_CAPITAL: + return SDL_SCANCODE_CAPSLOCK; + case VK_MODECHANGE: return SDL_SCANCODE_MODE; case VK_SELECT: @@ -185,7 +201,7 @@ static SDL_Scancode VKeytoScancode(WPARAM vkey) case VK_BROWSER_HOME: return SDL_SCANCODE_AC_HOME; case VK_VOLUME_MUTE: - return SDL_SCANCODE_AUDIOMUTE; + return SDL_SCANCODE_MUTE; case VK_VOLUME_DOWN: return SDL_SCANCODE_VOLUMEDOWN; case VK_VOLUME_UP: @@ -311,7 +327,7 @@ static SDL_Scancode WindowsScanCodeToSDLScanCode(LPARAM lParam, WPARAM wParam) } #if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) -static SDL_bool WIN_ShouldIgnoreFocusClick() +static SDL_bool WIN_ShouldIgnoreFocusClick(void) { return !SDL_GetHintBoolean(SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH, SDL_FALSE); } @@ -364,7 +380,7 @@ static void WIN_CheckWParamMouseButtons(WPARAM wParam, SDL_WindowData *data, SDL } } -static void WIN_CheckRawMouseButtons(ULONG rawButtons, SDL_WindowData *data, SDL_MouseID mouseID) +static void WIN_CheckRawMouseButtons(HANDLE hDevice, ULONG rawButtons, SDL_WindowData *data, SDL_MouseID mouseID) { // Add a flag to distinguish raw mouse buttons from wParam above rawButtons |= 0x8000000; @@ -372,6 +388,10 @@ static void WIN_CheckRawMouseButtons(ULONG rawButtons, SDL_WindowData *data, SDL if (rawButtons != data->mouse_button_flags) { Uint32 mouseFlags = SDL_GetMouseState(NULL, NULL); SDL_bool swapButtons = GetSystemMetrics(SM_SWAPBUTTON) != 0; + if (swapButtons && hDevice == NULL) { + /* Touchpad, already has buttons swapped */ + swapButtons = SDL_FALSE; + } if (rawButtons & RI_MOUSE_BUTTON_1_DOWN) { WIN_CheckWParamMouseButton((rawButtons & RI_MOUSE_BUTTON_1_DOWN), mouseFlags, swapButtons, data, SDL_BUTTON_LEFT, mouseID); } @@ -496,7 +516,7 @@ static void WIN_UpdateFocus(SDL_Window *window, SDL_bool expect_focus) SDL_ToggleModState(KMOD_CAPS, (GetKeyState(VK_CAPITAL) & 0x0001) ? SDL_TRUE : SDL_FALSE); SDL_ToggleModState(KMOD_NUM, (GetKeyState(VK_NUMLOCK) & 0x0001) ? SDL_TRUE : SDL_FALSE); SDL_ToggleModState(KMOD_SCROLL, (GetKeyState(VK_SCROLL) & 0x0001) ? SDL_TRUE : SDL_FALSE); - + WIN_UpdateWindowICCProfile(data->window, SDL_TRUE); } else { RECT rect; @@ -572,7 +592,7 @@ typedef enum SDL_MOUSE_EVENT_SOURCE_PEN, } SDL_MOUSE_EVENT_SOURCE; -static SDL_MOUSE_EVENT_SOURCE GetMouseMessageSource() +static SDL_MOUSE_EVENT_SOURCE GetMouseMessageSource(void) { LPARAM extrainfo = GetMessageExtraInfo(); /* Mouse data (ignoring synthetic mouse events generated for touchscreens) */ @@ -618,6 +638,10 @@ WIN_KeyboardHookProc(int nCode, WPARAM wParam, LPARAM lParam) if (nCode < 0 || nCode != HC_ACTION) { return CallNextHookEx(NULL, nCode, wParam, lParam); } + if (hookData->scanCode == 0x21d) { + // Skip fake LCtrl when RAlt is pressed + return 1; + } switch (hookData->vkCode) { case VK_LWIN: @@ -672,9 +696,43 @@ WIN_KeyboardHookProc(int nCode, WPARAM wParam, LPARAM lParam) #endif /*!defined(__XBOXONE__) && !defined(__XBOXSERIES__)*/ + +// Return 1 if spruious LCtrl is pressed +// LCtrl is sent when RAltGR is pressed +int skip_bad_lcrtl(WPARAM wParam, LPARAM lParam) +{ + MSG next_msg; + DWORD msg_time; + if (wParam != VK_CONTROL) { + return 0; + } + // Is this an extended key (i.e. right key)? + if (lParam & 0x01000000) + return 0; + + // Here is a trick: "Alt Gr" sends LCTRL, then RALT. We only + // want the RALT message, so we try to see if the next message + // is a RALT message. In that case, this is a false LCTRL! + msg_time = GetMessageTime(); + if (PeekMessage(&next_msg, NULL, 0, 0, PM_NOREMOVE)) { + if (next_msg.message == WM_KEYDOWN || + next_msg.message == WM_SYSKEYDOWN) { + if (next_msg.wParam == VK_MENU && + (next_msg.lParam & 0x01000000) && + next_msg.time == msg_time) { + // Next message is a RALT down message, which + // means that this is NOT a proper LCTRL message! + return 1; + } + } + } + return 0; +} + LRESULT CALLBACK WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { + static SDL_bool s_ModalMoveResizeLoop; SDL_WindowData *data; LRESULT returnCode = -1; @@ -694,12 +752,12 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) /* Get the window data for the window */ data = WIN_GetWindowDataFromHWND(hwnd); #if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) - if (data == NULL) { + if (!data) { /* Fallback */ data = (SDL_WindowData *)GetProp(hwnd, TEXT("SDL_WindowData")); } #endif - if (data == NULL) { + if (!data) { return CallWindowProc(DefWindowProc, hwnd, msg, wParam, lParam); } @@ -845,7 +903,7 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) SDL_MouseID mouseID; RAWMOUSE *rawmouse; if (SDL_GetNumTouchDevices() > 0 && - (GetMouseMessageSource() == SDL_MOUSE_EVENT_SOURCE_TOUCH || (GetMessageExtraInfo() & 0x82) == 0x82)) { + (GetMouseMessageSource() == SDL_MOUSE_EVENT_SOURCE_TOUCH || (GetMessageExtraInfo() & 0x80) == 0x80)) { break; } /* We do all of our mouse state checking against mouse ID 0 @@ -929,7 +987,7 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) data->last_raw_mouse_position.x = x; data->last_raw_mouse_position.y = y; } - WIN_CheckRawMouseButtons(rawmouse->usButtonFlags, data, mouseID); + WIN_CheckRawMouseButtons(inp.header.hDevice, rawmouse->usButtonFlags, data, mouseID); } } break; @@ -988,6 +1046,11 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) SDL_Scancode code = WindowsScanCodeToSDLScanCode(lParam, wParam); const Uint8 *keyboardState = SDL_GetKeyboardState(NULL); + if (skip_bad_lcrtl(wParam, lParam)) { + returnCode = 0; + break; + } + /* Detect relevant keyboard shortcuts */ if (keyboardState[SDL_SCANCODE_LALT] == SDL_PRESSED || keyboardState[SDL_SCANCODE_RALT] == SDL_PRESSED) { /* ALT+F4: Close window */ @@ -1010,6 +1073,11 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) SDL_Scancode code = WindowsScanCodeToSDLScanCode(lParam, wParam); const Uint8 *keyboardState = SDL_GetKeyboardState(NULL); + if (skip_bad_lcrtl(wParam, lParam)) { + returnCode = 0; + break; + } + if (code != SDL_SCANCODE_UNKNOWN) { if (code == SDL_SCANCODE_PRINTSCREEN && keyboardState[code] == SDL_RELEASED) { @@ -1253,6 +1321,27 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) } } break; + case WM_ENTERSIZEMOVE: + case WM_ENTERMENULOOP: + { + SetTimer(hwnd, (UINT_PTR)&s_ModalMoveResizeLoop, USER_TIMER_MINIMUM, NULL); + } break; + + case WM_TIMER: + { + if (wParam == (UINT_PTR)&s_ModalMoveResizeLoop) { + // Send an expose event so the application can redraw + SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_EXPOSED, 0, 0); + return 0; + } + } break; + + case WM_EXITSIZEMOVE: + case WM_EXITMENULOOP: + { + KillTimer(hwnd, (UINT_PTR)&s_ModalMoveResizeLoop); + } break; + case WM_SIZE: { switch (wParam) { @@ -1370,7 +1459,7 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) /* TODO: Can we use GetRawInputDeviceInfo and HID info to determine if this is a direct or indirect touch device? */ - if (SDL_AddTouch(touchId, SDL_TOUCH_DEVICE_DIRECT, "") < 0) { + if (SDL_AddTouch(touchId, SDL_TOUCH_DEVICE_DIRECT, (input->dwFlags & TOUCHEVENTF_PEN) == TOUCHEVENTF_PEN ? "pen" : "touch") < 0) { continue; } @@ -1396,7 +1485,7 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) } break; -#if HAVE_TPCSHRD_H +#ifdef HAVE_TPCSHRD_H case WM_TABLET_QUERYSYSTEMGESTURESTATUS: /* See https://msdn.microsoft.com/en-us/library/windows/desktop/bb969148(v=vs.85).aspx . @@ -1705,7 +1794,7 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) } #if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) -static void WIN_UpdateClipCursorForWindows() +static void WIN_UpdateClipCursorForWindows(void) { SDL_VideoDevice *_this = SDL_GetVideoDevice(); SDL_Window *window; @@ -1727,7 +1816,7 @@ static void WIN_UpdateClipCursorForWindows() } } -static void WIN_UpdateMouseCapture() +static void WIN_UpdateMouseCapture(void) { SDL_Window *focusWindow = SDL_GetKeyboardFocus(); @@ -1769,8 +1858,19 @@ void SDL_SetWindowsMessageHook(SDL_WindowsMessageHook callback, void *userdata) int WIN_WaitEventTimeout(_THIS, int timeout) { - MSG msg; if (g_WindowsEnableMessageLoop) { +#if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) + DWORD dwMilliseconds, ret; + dwMilliseconds = timeout < 0 ? INFINITE : (DWORD)timeout; + ret = MsgWaitForMultipleObjects(0, NULL, FALSE, dwMilliseconds, QS_ALLINPUT); + if (ret == WAIT_OBJECT_0) { + return 1; + } else { + return 0; + } +#else + /* MsgWaitForMultipleObjects is desktop-only. */ + MSG msg; BOOL message_result; UINT_PTR timer_id = 0; if (timeout > 0) { @@ -1783,7 +1883,7 @@ int WIN_WaitEventTimeout(_THIS, int timeout) message_result = GetMessage(&msg, 0, 0, 0); } if (message_result) { - if (msg.message == WM_TIMER && msg.hwnd == NULL && msg.wParam == timer_id) { + if (msg.message == WM_TIMER && !msg.hwnd && msg.wParam == timer_id) { return 0; } if (g_WindowsMessageHook) { @@ -1796,6 +1896,7 @@ int WIN_WaitEventTimeout(_THIS, int timeout) } else { return 0; } +#endif /*!defined(__XBOXONE__) && !defined(__XBOXSERIES__)*/ } else { /* Fail the wait so the caller falls back to polling */ return -1; @@ -1872,7 +1973,7 @@ void WIN_PumpEvents(_THIS) not grabbing the keyboard. Note: If we *are* grabbing the keyboard, GetKeyState() will return inaccurate results for VK_LWIN and VK_RWIN but we don't need it anyway. */ focusWindow = SDL_GetKeyboardFocus(); - if (focusWindow == NULL || !(focusWindow->flags & SDL_WINDOW_KEYBOARD_GRABBED)) { + if (!focusWindow || !(focusWindow->flags & SDL_WINDOW_KEYBOARD_GRABBED)) { if ((keystate[SDL_SCANCODE_LGUI] == SDL_PRESSED) && !(GetKeyState(VK_LWIN) & 0x8000)) { SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_LGUI); } @@ -1912,13 +2013,26 @@ static void WIN_CleanRegisterApp(WNDCLASSEX wcex) SDL_Appname = NULL; } +static BOOL CALLBACK WIN_ResourceNameCallback(HMODULE hModule, LPCTSTR lpType, LPTSTR lpName, LONG_PTR lParam) +{ + WNDCLASSEX *wcex = (WNDCLASSEX *)lParam; + + (void)lpType; /* We already know that the resource type is RT_GROUP_ICON. */ + + /* We leave hIconSm as NULL as it will allow Windows to automatically + choose the appropriate small icon size to suit the current DPI. */ + wcex->hIcon = LoadIcon(hModule, lpName); + + /* Do not bother enumerating any more. */ + return FALSE; +} + /* Register the class for this application */ int SDL_RegisterApp(const char *name, Uint32 style, void *hInst) { WNDCLASSEX wcex; #if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) const char *hint; - TCHAR path[MAX_PATH]; #endif /* Only do this once... */ @@ -1926,8 +2040,8 @@ int SDL_RegisterApp(const char *name, Uint32 style, void *hInst) ++app_registered; return 0; } - SDL_assert(SDL_Appname == NULL); - if (name == NULL) { + SDL_assert(!SDL_Appname); + if (!name) { name = "SDL_app"; #if defined(CS_BYTEALIGNCLIENT) || defined(CS_OWNDC) style = (CS_BYTEALIGNCLIENT | CS_OWNDC); @@ -1961,9 +2075,8 @@ int SDL_RegisterApp(const char *name, Uint32 style, void *hInst) wcex.hIconSm = LoadIcon(SDL_Instance, MAKEINTRESOURCE(SDL_atoi(hint))); } } else { - /* Use the first icon as a default icon, like in the Explorer */ - GetModuleFileName(SDL_Instance, path, MAX_PATH); - ExtractIconEx(path, 0, &wcex.hIcon, &wcex.hIconSm, 1); + /* Use the first icon as a default icon, like in the Explorer. */ + EnumResourceNames(SDL_Instance, RT_GROUP_ICON, WIN_ResourceNameCallback, (LONG_PTR)&wcex); } #endif /*!defined(__XBOXONE__) && !defined(__XBOXSERIES__)*/ @@ -1977,7 +2090,7 @@ int SDL_RegisterApp(const char *name, Uint32 style, void *hInst) } /* Unregisters the windowclass registered in SDL_RegisterApp above. */ -void SDL_UnregisterApp() +void SDL_UnregisterApp(void) { WNDCLASSEX wcex; diff --git a/thirdparty/SDL/src/video/windows/SDL_windowsevents.h b/thirdparty/SDL/src/video/windows/SDL_windowsevents.h index 98a45add2..3e337d092 100644 --- a/thirdparty/SDL/src/video/windows/SDL_windowsevents.h +++ b/thirdparty/SDL/src/video/windows/SDL_windowsevents.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/windows/SDL_windowsframebuffer.c b/thirdparty/SDL/src/video/windows/SDL_windowsframebuffer.c index 82483526d..423462222 100644 --- a/thirdparty/SDL/src/video/windows/SDL_windowsframebuffer.c +++ b/thirdparty/SDL/src/video/windows/SDL_windowsframebuffer.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_WINDOWS && !defined(__XBOXONE__) && !defined(__XBOXSERIES__) +#if defined(SDL_VIDEO_DRIVER_WINDOWS) && !defined(__XBOXONE__) && !defined(__XBOXSERIES__) #include "SDL_windowsvideo.h" @@ -114,7 +114,7 @@ void WIN_DestroyWindowFramebuffer(_THIS, SDL_Window *window) { SDL_WindowData *data = (SDL_WindowData *)window->driverdata; - if (data == NULL) { + if (!data) { /* The window wasn't fully initialized */ return; } diff --git a/thirdparty/SDL/src/video/windows/SDL_windowsframebuffer.h b/thirdparty/SDL/src/video/windows/SDL_windowsframebuffer.h index fa626b8c9..adcac8a35 100644 --- a/thirdparty/SDL/src/video/windows/SDL_windowsframebuffer.h +++ b/thirdparty/SDL/src/video/windows/SDL_windowsframebuffer.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/windows/SDL_windowskeyboard.c b/thirdparty/SDL/src/video/windows/SDL_windowskeyboard.c index d4d2238a7..9e6acac2f 100644 --- a/thirdparty/SDL/src/video/windows/SDL_windowskeyboard.c +++ b/thirdparty/SDL/src/video/windows/SDL_windowskeyboard.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_WINDOWS && !defined(__XBOXONE__) && !defined(__XBOXSERIES__) +#if defined(SDL_VIDEO_DRIVER_WINDOWS) && !defined(__XBOXONE__) && !defined(__XBOXSERIES__) #include "SDL_windowsvideo.h" #include "SDL_hints.h" @@ -166,7 +166,7 @@ void WIN_QuitKeyboard(_THIS) #endif /* !SDL_DISABLE_WINDOWS_IME */ } -void WIN_ResetDeadKeys() +void WIN_ResetDeadKeys(void) { /* if a deadkey has been typed, but not the next character (which the deadkey might modify), @@ -239,7 +239,7 @@ void WIN_SetTextInputRect(_THIS, const SDL_Rect *rect) SDL_VideoData *videodata = (SDL_VideoData *)_this->driverdata; HIMC himc = 0; - if (rect == NULL) { + if (!rect) { SDL_InvalidParamError("rect"); return; } @@ -367,7 +367,7 @@ static void UILess_ReleaseSinks(SDL_VideoData *videodata); static void UILess_EnableUIUpdates(SDL_VideoData *videodata); static void UILess_DisableUIUpdates(SDL_VideoData *videodata); -static SDL_bool WIN_ShouldShowNativeUI() +static SDL_bool WIN_ShouldShowNativeUI(void) { return SDL_GetHintBoolean(SDL_HINT_IME_SHOW_UI, SDL_FALSE); } @@ -698,7 +698,7 @@ static void IME_SetupAPI(SDL_VideoData *videodata) } hime = SDL_LoadObject(ime_file); - if (hime == NULL) { + if (!hime) { return; } @@ -781,7 +781,7 @@ static void IME_GetCompositionString(SDL_VideoData *videodata, HIMC himc, DWORD length = ImmGetCompositionStringW(himc, string, NULL, 0); if (length > 0 && videodata->ime_composition_length < length) { - if (videodata->ime_composition != NULL) { + if (videodata->ime_composition) { SDL_free(videodata->ime_composition); } @@ -973,11 +973,11 @@ static int IME_ShowCandidateList(SDL_VideoData *videodata) videodata->ime_candcount = 0; candidates = SDL_realloc(videodata->ime_candidates, MAX_CANDSIZE); - if (candidates != NULL) { + if (candidates) { videodata->ime_candidates = (WCHAR *)candidates; } - if (videodata->ime_candidates == NULL) { + if (!videodata->ime_candidates) { return -1; } @@ -1191,7 +1191,7 @@ TSFSink_Release(TSFSink *sink) STDMETHODIMP UIElementSink_QueryInterface(TSFSink *sink, REFIID riid, PVOID *ppv) { - if (ppv == NULL) { + if (!ppv) { return E_INVALIDARG; } @@ -1228,7 +1228,7 @@ STDMETHODIMP UIElementSink_BeginUIElement(TSFSink *sink, DWORD dwUIElementId, BO ITfReadingInformationUIElement *preading = 0; ITfCandidateListUIElement *pcandlist = 0; SDL_VideoData *videodata = (SDL_VideoData *)sink->data; - if (element == NULL) { + if (!element) { return E_INVALIDARG; } @@ -1253,7 +1253,7 @@ STDMETHODIMP UIElementSink_UpdateUIElement(TSFSink *sink, DWORD dwUIElementId) ITfReadingInformationUIElement *preading = 0; ITfCandidateListUIElement *pcandlist = 0; SDL_VideoData *videodata = (SDL_VideoData *)sink->data; - if (element == NULL) { + if (!element) { return E_INVALIDARG; } @@ -1279,7 +1279,7 @@ STDMETHODIMP UIElementSink_EndUIElement(TSFSink *sink, DWORD dwUIElementId) ITfReadingInformationUIElement *preading = 0; ITfCandidateListUIElement *pcandlist = 0; SDL_VideoData *videodata = (SDL_VideoData *)sink->data; - if (element == NULL) { + if (!element) { return E_INVALIDARG; } @@ -1301,7 +1301,7 @@ STDMETHODIMP UIElementSink_EndUIElement(TSFSink *sink, DWORD dwUIElementId) STDMETHODIMP IPPASink_QueryInterface(TSFSink *sink, REFIID riid, PVOID *ppv) { - if (ppv == NULL) { + if (!ppv) { return E_INVALIDARG; } @@ -1321,9 +1321,9 @@ STDMETHODIMP IPPASink_QueryInterface(TSFSink *sink, REFIID riid, PVOID *ppv) STDMETHODIMP IPPASink_OnActivated(TSFSink *sink, DWORD dwProfileType, LANGID langid, REFCLSID clsid, REFGUID catid, REFGUID guidProfile, HKL hkl, DWORD dwFlags) { - static const GUID TF_PROFILE_DAYI = { 0x037B2C25, 0x480C, 0x4D7F, { 0xB0, 0x27, 0xD6, 0xCA, 0x6B, 0x69, 0x78, 0x8A } }; + static const GUID SDL_TF_PROFILE_DAYI = { 0x037B2C25, 0x480C, 0x4D7F, { 0xB0, 0x27, 0xD6, 0xCA, 0x6B, 0x69, 0x78, 0x8A } }; SDL_VideoData *videodata = (SDL_VideoData *)sink->data; - videodata->ime_candlistindexbase = WIN_IsEqualGUID(&TF_PROFILE_DAYI, guidProfile) ? 0 : 1; + videodata->ime_candlistindexbase = WIN_IsEqualGUID(&SDL_TF_PROFILE_DAYI, guidProfile) ? 0 : 1; if (WIN_IsEqualIID(catid, &GUID_TFCAT_TIP_KEYBOARD) && (dwFlags & TF_IPSINK_FLAG_ACTIVE)) { IME_InputLangChanged((SDL_VideoData *)sink->data); } diff --git a/thirdparty/SDL/src/video/windows/SDL_windowskeyboard.h b/thirdparty/SDL/src/video/windows/SDL_windowskeyboard.h index 876a722f3..3eb2398ea 100644 --- a/thirdparty/SDL/src/video/windows/SDL_windowskeyboard.h +++ b/thirdparty/SDL/src/video/windows/SDL_windowskeyboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/windows/SDL_windowsmessagebox.c b/thirdparty/SDL/src/video/windows/SDL_windowsmessagebox.c index 9272f536c..f90e0d2e9 100644 --- a/thirdparty/SDL/src/video/windows/SDL_windowsmessagebox.c +++ b/thirdparty/SDL/src/video/windows/SDL_windowsmessagebox.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_WINDOWS && !defined(__XBOXONE__) && !defined(__XBOXSERIES__) +#if defined(SDL_VIDEO_DRIVER_WINDOWS) && !defined(__XBOXONE__) && !defined(__XBOXSERIES__) #ifdef HAVE_LIMITS_H #include @@ -265,7 +265,7 @@ static INT_PTR CALLBACK MessageBoxDialogProc(HWND hDlg, UINT iMessage, WPARAM wP if (GetButtonIndex(messageboxdata, SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT, &buttonindex)) { /* Focus on the first default return-key button */ HWND buttonctl = GetDlgItem(hDlg, (int)(IDBUTTONINDEX0 + buttonindex)); - if (buttonctl == NULL) { + if (!buttonctl) { EndDialog(hDlg, IDINVALPTRDLGITEM); } PostMessage(hDlg, WM_NEXTDLGCTL, (WPARAM)buttonctl, TRUE); @@ -276,7 +276,7 @@ static INT_PTR CALLBACK MessageBoxDialogProc(HWND hDlg, UINT iMessage, WPARAM wP return FALSE; case WM_SETFOCUS: messageboxdata = (const SDL_MessageBoxData *)GetWindowLongPtr(hDlg, GWLP_USERDATA); - if (messageboxdata == NULL) { + if (!messageboxdata) { EndDialog(hDlg, IDINVALPTRSETFOCUS); return TRUE; } @@ -288,7 +288,7 @@ static INT_PTR CALLBACK MessageBoxDialogProc(HWND hDlg, UINT iMessage, WPARAM wP return TRUE; case WM_COMMAND: messageboxdata = (const SDL_MessageBoxData *)GetWindowLongPtr(hDlg, GWLP_USERDATA); - if (messageboxdata == NULL) { + if (!messageboxdata) { EndDialog(hDlg, IDINVALPTRCOMMAND); return TRUE; } @@ -344,7 +344,7 @@ static SDL_bool ExpandDialogSpace(WIN_DialogData *dialog, size_t space) if (size > dialog->size) { void *data = SDL_realloc(dialog->data, size); - if (data == NULL) { + if (!data) { SDL_OutOfMemory(); return SDL_FALSE; } @@ -387,12 +387,12 @@ static SDL_bool AddDialogString(WIN_DialogData *dialog, const char *string) size_t count; SDL_bool status; - if (string == NULL) { + if (!string) { string = ""; } wstring = WIN_UTF8ToStringW(string); - if (wstring == NULL) { + if (!wstring) { return SDL_FALSE; } @@ -448,7 +448,7 @@ static SDL_bool AddDialogControl(WIN_DialogData *dialog, WORD type, DWORD style, if (!AddDialogData(dialog, &type, sizeof(type))) { return SDL_FALSE; } - if (type == DLGITEMTYPEBUTTON || (type == DLGITEMTYPESTATIC && caption != NULL)) { + if (type == DLGITEMTYPEBUTTON || (type == DLGITEMTYPESTATIC && caption)) { if (!AddDialogString(dialog, caption)) { return SDL_FALSE; } @@ -521,7 +521,7 @@ static WIN_DialogData *CreateDialogData(int w, int h, const char *caption) Vec2ToDLU(&dialogTemplate.cx, &dialogTemplate.cy); dialog = (WIN_DialogData *)SDL_calloc(1, sizeof(*dialog)); - if (dialog == NULL) { + if (!dialog) { return NULL; } @@ -623,7 +623,7 @@ static const char *EscapeAmpersands(char **dst, size_t *dstlen, const char *src) size_t ampcount = 0; size_t srclen = 0; - if (src == NULL) { + if (!src) { return NULL; } @@ -642,7 +642,7 @@ static const char *EscapeAmpersands(char **dst, size_t *dstlen, const char *src) if (SIZE_MAX - srclen < ampcount) { return NULL; } - if (*dst == NULL || *dstlen < srclen + ampcount) { + if (!*dst || *dstlen < srclen + ampcount) { /* Allocating extra space in case the next strings are a bit longer. */ size_t extraspace = SIZE_MAX - (srclen + ampcount); if (extraspace > 512) { @@ -652,7 +652,7 @@ static const char *EscapeAmpersands(char **dst, size_t *dstlen, const char *src) SDL_free(*dst); *dst = NULL; newdst = SDL_malloc(*dstlen); - if (newdst == NULL) { + if (!newdst) { return NULL; } *dst = newdst; @@ -817,7 +817,7 @@ static int WIN_ShowOldMessageBox(const SDL_MessageBoxData *messageboxdata, int * Size.cy += ButtonHeight + TextMargin; dialog = CreateDialogData(Size.cx, Size.cy, messageboxdata->title); - if (dialog == NULL) { + if (!dialog) { return -1; } @@ -858,7 +858,7 @@ static int WIN_ShowOldMessageBox(const SDL_MessageBoxData *messageboxdata, int * buttontext = EscapeAmpersands(&escape, &escapesize, sdlButton->text); /* Make sure to provide the correct ID to keep buttons indexed in the * same order as how they are in messageboxdata. */ - if (buttontext == NULL || !AddDialogButton(dialog, x, y, ButtonWidth, ButtonHeight, buttontext, IDBUTTONINDEX0 + (int)(sdlButton - messageboxdata->buttons), isdefault)) { + if (!buttontext || !AddDialogButton(dialog, x, y, ButtonWidth, ButtonHeight, buttontext, IDBUTTONINDEX0 + (int)(sdlButton - messageboxdata->buttons), isdefault)) { FreeDialogData(dialog); SDL_free(ampescape); return -1; @@ -932,7 +932,7 @@ int WIN_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid) /* If we cannot load comctl32.dll use the old messagebox! */ hComctl32 = LoadLibrary(TEXT("comctl32.dll")); - if (hComctl32 == NULL) { + if (!hComctl32) { return WIN_ShowOldMessageBox(messageboxdata, buttonid); } @@ -944,7 +944,7 @@ int WIN_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid) pragma comment(linker,"\"/manifestdependency:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"") */ pfnTaskDialogIndirect = (TASKDIALOGINDIRECTPROC)GetProcAddress(hComctl32, "TaskDialogIndirect"); - if (pfnTaskDialogIndirect == NULL) { + if (!pfnTaskDialogIndirect) { FreeLibrary(hComctl32); return WIN_ShowOldMessageBox(messageboxdata, buttonid); } @@ -992,7 +992,7 @@ int WIN_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid) pButton->nButtonID = IDBUTTONINDEX0 + i; } buttontext = EscapeAmpersands(&escape, &escapesize, messageboxdata->buttons[i].text); - if (buttontext == NULL) { + if (!buttontext) { int j; FreeLibrary(hComctl32); SDL_free(ampescape); diff --git a/thirdparty/SDL/src/video/windows/SDL_windowsmessagebox.h b/thirdparty/SDL/src/video/windows/SDL_windowsmessagebox.h index b87ecfde7..5cddc87e0 100644 --- a/thirdparty/SDL/src/video/windows/SDL_windowsmessagebox.h +++ b/thirdparty/SDL/src/video/windows/SDL_windowsmessagebox.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_WINDOWS +#if defined(SDL_VIDEO_DRIVER_WINDOWS) extern int WIN_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid); diff --git a/thirdparty/SDL/src/video/windows/SDL_windowsmodes.c b/thirdparty/SDL/src/video/windows/SDL_windowsmodes.c index b8f47a13a..9a37a11ac 100644 --- a/thirdparty/SDL/src/video/windows/SDL_windowsmodes.c +++ b/thirdparty/SDL/src/video/windows/SDL_windowsmodes.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_WINDOWS && !defined(__XBOXONE__) && !defined(__XBOXSERIES__) +#if defined(SDL_VIDEO_DRIVER_WINDOWS) && !defined(__XBOXONE__) && !defined(__XBOXSERIES__) #include "SDL_windowsvideo.h" #include "../../events/SDL_displayevents_c.h" @@ -171,7 +171,7 @@ static SDL_bool WIN_GetDisplayMode(_THIS, LPCWSTR deviceName, DWORD index, SDL_D } data = (SDL_DisplayModeData *)SDL_malloc(sizeof(*data)); - if (data == NULL) { + if (!data) { return SDL_FALSE; } @@ -215,7 +215,7 @@ static char *WIN_GetDisplayNameVista(const WCHAR *deviceName) LONG rc; dll = SDL_LoadObject("USER32.DLL"); - if (dll == NULL) { + if (!dll) { return NULL; } @@ -223,7 +223,7 @@ static char *WIN_GetDisplayNameVista(const WCHAR *deviceName) pQueryDisplayConfig = (SDL_WIN32PROC_QueryDisplayConfig)SDL_LoadFunction(dll, "QueryDisplayConfig"); pDisplayConfigGetDeviceInfo = (SDL_WIN32PROC_DisplayConfigGetDeviceInfo)SDL_LoadFunction(dll, "DisplayConfigGetDeviceInfo"); - if (pGetDisplayConfigBufferSizes == NULL || pQueryDisplayConfig == NULL || pDisplayConfigGetDeviceInfo == NULL) { + if (!pGetDisplayConfigBufferSizes || !pQueryDisplayConfig || !pDisplayConfigGetDeviceInfo) { goto WIN_GetDisplayNameVista_failed; } @@ -238,7 +238,7 @@ static char *WIN_GetDisplayNameVista(const WCHAR *deviceName) paths = (DISPLAYCONFIG_PATH_INFO *)SDL_malloc(sizeof(DISPLAYCONFIG_PATH_INFO) * pathCount); modes = (DISPLAYCONFIG_MODE_INFO *)SDL_malloc(sizeof(DISPLAYCONFIG_MODE_INFO) * modeCount); - if ((paths == NULL) || (modes == NULL)) { + if ((!paths) || (!modes)) { goto WIN_GetDisplayNameVista_failed; } @@ -352,7 +352,7 @@ static void WIN_AddDisplay(_THIS, HMONITOR hMonitor, const MONITORINFOEXW *info, } displaydata = (SDL_DisplayData *)SDL_calloc(1, sizeof(*displaydata)); - if (displaydata == NULL) { + if (!displaydata) { return; } SDL_memcpy(displaydata->DeviceName, info->szDevice, sizeof(displaydata->DeviceName)); @@ -361,7 +361,7 @@ static void WIN_AddDisplay(_THIS, HMONITOR hMonitor, const MONITORINFOEXW *info, SDL_zero(display); display.name = WIN_GetDisplayNameVista(info->szDevice); - if (display.name == NULL) { + if (!display.name) { DISPLAY_DEVICEW device; SDL_zero(device); device.cb = sizeof(device); @@ -521,7 +521,7 @@ int WIN_GetDisplayDPI(_THIS, SDL_VideoDisplay *display, float *ddpi_out, float * float hinches, vinches; hdc = GetDC(NULL); - if (hdc == NULL) { + if (!hdc) { return SDL_SetError("GetDC failed"); } hdpi_int = GetDeviceCaps(hdc, LOGPIXELSX); @@ -603,7 +603,7 @@ void WIN_ScreenPointFromSDL(int *x, int *y, int *dpiOut) *dpiOut = 96; } - if (videodevice == NULL || !videodevice->driverdata) { + if (!videodevice || !videodevice->driverdata) { return; } @@ -656,7 +656,7 @@ void WIN_ScreenPointToSDL(int *x, int *y) float ddpi, hdpi, vdpi; int x_pixels, y_pixels; - if (videodevice == NULL || !videodevice->driverdata) { + if (!videodevice || !videodevice->driverdata) { return; } diff --git a/thirdparty/SDL/src/video/windows/SDL_windowsmodes.h b/thirdparty/SDL/src/video/windows/SDL_windowsmodes.h index 1fc5eef60..9cec89ebd 100644 --- a/thirdparty/SDL/src/video/windows/SDL_windowsmodes.h +++ b/thirdparty/SDL/src/video/windows/SDL_windowsmodes.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/windows/SDL_windowsmouse.c b/thirdparty/SDL/src/video/windows/SDL_windowsmouse.c index 5844da79e..127bdc689 100644 --- a/thirdparty/SDL/src/video/windows/SDL_windowsmouse.c +++ b/thirdparty/SDL/src/video/windows/SDL_windowsmouse.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_WINDOWS && !defined(__XBOXONE__) && !defined(__XBOXSERIES__) +#if defined(SDL_VIDEO_DRIVER_WINDOWS) && !defined(__XBOXONE__) && !defined(__XBOXSERIES__) #include "SDL_windowsvideo.h" @@ -114,7 +114,7 @@ static SDL_Cursor *WIN_CreateCursor(SDL_Surface *surface, int hot_x, int hot_y) maskbitslen = ((surface->w + (pad - (surface->w % pad))) / 8) * surface->h; maskbits = SDL_small_alloc(Uint8, maskbitslen, &isstack); - if (maskbits == NULL) { + if (!maskbits) { SDL_OutOfMemory(); return NULL; } @@ -249,7 +249,7 @@ static void WIN_FreeCursor(SDL_Cursor *cursor) static int WIN_ShowCursor(SDL_Cursor *cursor) { - if (cursor == NULL) { + if (!cursor) { cursor = SDL_blank_cursor; } if (cursor) { @@ -282,6 +282,8 @@ static void WIN_WarpMouse(SDL_Window *window, int x, int y) SDL_WindowData *data = (SDL_WindowData *)window->driverdata; HWND hwnd = data->hwnd; POINT pt; + int warp_x = x; + int warp_y = y; /* Don't warp the mouse while we're doing a modal interaction */ if (data->in_title_click || data->focus_click_pending) { @@ -295,7 +297,7 @@ static void WIN_WarpMouse(SDL_Window *window, int x, int y) WIN_SetCursorPos(pt.x, pt.y); /* Send the exact mouse motion associated with this warp */ - SDL_SendMouseMotion(window, SDL_GetMouse()->mouseID, 0, x, y); + SDL_SendMouseMotion(window, SDL_GetMouse()->mouseID, 0, warp_x, warp_y); } static int WIN_WarpMouseGlobal(int x, int y) @@ -472,7 +474,7 @@ static void WIN_SetLinearMouseScale(int mouse_speed) } } -void WIN_UpdateMouseSystemScale() +void WIN_UpdateMouseSystemScale(void) { int mouse_speed; int params[3] = { 0, 0, 0 }; diff --git a/thirdparty/SDL/src/video/windows/SDL_windowsmouse.h b/thirdparty/SDL/src/video/windows/SDL_windowsmouse.h index 262b6992a..25f510e5e 100644 --- a/thirdparty/SDL/src/video/windows/SDL_windowsmouse.h +++ b/thirdparty/SDL/src/video/windows/SDL_windowsmouse.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/windows/SDL_windowsopengl.c b/thirdparty/SDL/src/video/windows/SDL_windowsopengl.c index 947e30946..4cbebed93 100644 --- a/thirdparty/SDL/src/video/windows/SDL_windowsopengl.c +++ b/thirdparty/SDL/src/video/windows/SDL_windowsopengl.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_WINDOWS +#ifdef SDL_VIDEO_DRIVER_WINDOWS #include "SDL_loadso.h" #include "SDL_windowsvideo.h" @@ -29,7 +29,7 @@ /* WGL implementation of SDL OpenGL support */ -#if SDL_VIDEO_OPENGL_WGL +#ifdef SDL_VIDEO_OPENGL_WGL #include "SDL_opengl.h" #define DEFAULT_OPENGL "OPENGL32.DLL" @@ -97,7 +97,7 @@ typedef HGLRC(APIENTRYP PFNWGLCREATECONTEXTATTRIBSARBPROC)(HDC hDC, const int *attribList); -#if __XBOXONE__ || __XBOXSERIES__ +#if defined(__XBOXONE__) || defined(__XBOXSERIES__) #define GetDC(hwnd) (HDC) hwnd #define ReleaseDC(hwnd, hdc) 1 #define SwapBuffers _this->gl_data->wglSwapBuffers @@ -145,7 +145,7 @@ int WIN_GL_LoadLibrary(_THIS, const char *path) SDL_LoadFunction(handle, "wglShareLists"); /* *INDENT-ON* */ /* clang-format on */ -#if __XBOXONE__ || __XBOXSERIES__ +#if defined(__XBOXONE__) || defined(__XBOXSERIES__) _this->gl_data->wglSwapBuffers = (BOOL(WINAPI *)(HDC)) SDL_LoadFunction(handle, "wglSwapBuffers"); _this->gl_data->wglDescribePixelFormat = (int(WINAPI *)(HDC, int, UINT, LPPIXELFORMATDESCRIPTOR)) @@ -162,7 +162,7 @@ int WIN_GL_LoadLibrary(_THIS, const char *path) !_this->gl_data->wglCreateContext || !_this->gl_data->wglDeleteContext || !_this->gl_data->wglMakeCurrent -#if __XBOXONE__ || __XBOXSERIES__ +#if defined(__XBOXONE__) || defined(__XBOXSERIES__) || !_this->gl_data->wglSwapBuffers || !_this->gl_data->wglDescribePixelFormat || !_this->gl_data->wglChoosePixelFormat || @@ -220,7 +220,7 @@ void *WIN_GL_GetProcAddress(_THIS, const char *proc) /* This is to pick up extensions */ func = _this->gl_data->wglGetProcAddress(proc); - if (func == NULL) { + if (!func) { /* This is probably a normal GL function */ func = GetProcAddress(_this->gl_config.dll_handle, proc); } @@ -383,7 +383,7 @@ static SDL_bool HasExtension(const char *extension, const char *extensions) return SDL_FALSE; } - if (extensions == NULL) { + if (!extensions) { return SDL_FALSE; } @@ -395,7 +395,7 @@ static SDL_bool HasExtension(const char *extension, const char *extensions) for (;;) { where = SDL_strstr(start, extension); - if (where == NULL) { + if (!where) { break; } @@ -527,6 +527,9 @@ static int WIN_GL_ChoosePixelFormatARB(_THIS, int *iAttribs, float *fAttribs) int pixel_format = 0; unsigned int matching; + int qAttrib = WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB; + int srgb = 0; + hwnd = CreateWindow(SDL_Appname, SDL_Appname, (WS_POPUP | WS_DISABLED), 0, 0, 10, 10, NULL, NULL, SDL_Instance, NULL); @@ -546,6 +549,10 @@ static int WIN_GL_ChoosePixelFormatARB(_THIS, int *iAttribs, float *fAttribs) _this->gl_data->wglChoosePixelFormatARB(hdc, iAttribs, fAttribs, 1, &pixel_format, &matching); + + /* Check whether we actually got an SRGB capable buffer */ + _this->gl_data->wglGetPixelFormatAttribivARB(hdc, pixel_format, 0, 1, &qAttrib, &srgb); + _this->gl_config.framebuffer_srgb_capable = srgb; } _this->gl_data->wglMakeCurrent(hdc, NULL); @@ -635,6 +642,7 @@ static int WIN_GL_SetupWindowInternal(_THIS, SDL_Window *window) } if (_this->gl_config.floatbuffers) { + *iAttr++ = WGL_PIXEL_TYPE_ARB; *iAttr++ = WGL_TYPE_RGBA_FLOAT_ARB; } @@ -702,7 +710,7 @@ SDL_GLContext WIN_GL_CreateContext(_THIS, SDL_Window *window) HGLRC context, share_context; if (_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES && WIN_GL_UseEGL(_this)) { -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL /* Switch to EGL based functions */ WIN_GL_UnloadLibrary(_this); _this->GL_LoadLibrary = WIN_GLES_LoadLibrary; @@ -835,9 +843,9 @@ int WIN_GL_MakeCurrent(_THIS, SDL_Window *window, SDL_GLContext context) NULL, against spec. Since hdc is _supposed_ to be ignored if context is NULL, we either use the current GL window, or do nothing if we already have no current context. */ - if (window == NULL) { + if (!window) { window = SDL_GL_GetCurrentWindow(); - if (window == NULL) { + if (!window) { SDL_assert(SDL_GL_GetCurrentContext() == NULL); return 0; /* already done. */ } diff --git a/thirdparty/SDL/src/video/windows/SDL_windowsopengl.h b/thirdparty/SDL/src/video/windows/SDL_windowsopengl.h index 0d30068ad..184a313ab 100644 --- a/thirdparty/SDL/src/video/windows/SDL_windowsopengl.h +++ b/thirdparty/SDL/src/video/windows/SDL_windowsopengl.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -23,9 +23,9 @@ #ifndef SDL_windowsopengl_h_ #define SDL_windowsopengl_h_ -#if SDL_VIDEO_OPENGL_WGL +#ifdef SDL_VIDEO_OPENGL_WGL -#if __XBOXONE__ || __XBOXSERIES__ +#if defined(__XBOXONE__) || defined(__XBOXSERIES__) typedef struct tagPIXELFORMATDESCRIPTOR { WORD nSize; @@ -85,7 +85,7 @@ struct SDL_GLDriverData BOOL (WINAPI *wglGetPixelFormatAttribivARB)(HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, int *piValues); BOOL (WINAPI *wglSwapIntervalEXT)(int interval); int (WINAPI *wglGetSwapIntervalEXT)(void); -#if __XBOXONE__ || __XBOXSERIES__ +#if defined(__XBOXONE__) || defined(__XBOXSERIES__) BOOL (WINAPI *wglSwapBuffers)(HDC hdc); int (WINAPI *wglDescribePixelFormat)(HDC hdc, int iPixelFormat, diff --git a/thirdparty/SDL/src/video/windows/SDL_windowsopengles.c b/thirdparty/SDL/src/video/windows/SDL_windowsopengles.c index d410141ea..1450d5015 100644 --- a/thirdparty/SDL/src/video/windows/SDL_windowsopengles.c +++ b/thirdparty/SDL/src/video/windows/SDL_windowsopengles.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_WINDOWS && SDL_VIDEO_OPENGL_EGL && !defined(__XBOXONE__) && !defined(__XBOXSERIES__) +#if defined(SDL_VIDEO_DRIVER_WINDOWS) && defined(SDL_VIDEO_OPENGL_EGL) && !defined(__XBOXONE__) && !defined(__XBOXSERIES__) #include "SDL_windowsvideo.h" #include "SDL_windowsopengles.h" @@ -34,7 +34,7 @@ int WIN_GLES_LoadLibrary(_THIS, const char *path) /* If the profile requested is not GL ES, switch over to WIN_GL functions */ if (_this->gl_config.profile_mask != SDL_GL_CONTEXT_PROFILE_ES) { -#if SDL_VIDEO_OPENGL_WGL +#ifdef SDL_VIDEO_OPENGL_WGL WIN_GLES_UnloadLibrary(_this); _this->GL_LoadLibrary = WIN_GL_LoadLibrary; _this->GL_GetProcAddress = WIN_GL_GetProcAddress; @@ -51,7 +51,7 @@ int WIN_GLES_LoadLibrary(_THIS, const char *path) #endif } - if (_this->egl_data == NULL) { + if (!_this->egl_data) { return SDL_EGL_LoadLibrary(_this, NULL, EGL_DEFAULT_DISPLAY, 0); } @@ -63,7 +63,7 @@ SDL_GLContext WIN_GLES_CreateContext(_THIS, SDL_Window *window) SDL_GLContext context; SDL_WindowData *data = (SDL_WindowData *)window->driverdata; -#if SDL_VIDEO_OPENGL_WGL +#ifdef SDL_VIDEO_OPENGL_WGL if (_this->gl_config.profile_mask != SDL_GL_CONTEXT_PROFILE_ES) { /* Switch to WGL based functions */ WIN_GLES_UnloadLibrary(_this); @@ -106,7 +106,7 @@ int WIN_GLES_SetupWindow(_THIS, SDL_Window *window) SDL_Window *current_win = SDL_GL_GetCurrentWindow(); SDL_GLContext current_ctx = SDL_GL_GetCurrentContext(); - if (_this->egl_data == NULL) { + if (!_this->egl_data) { /* !!! FIXME: commenting out this assertion is (I think) incorrect; figure out why driver_loaded is wrong for ANGLE instead. --ryan. */ #if 0 /* When hint SDL_HINT_OPENGL_ES_DRIVER is set to "1" (e.g. for ANGLE support), _this->gl_config.driver_loaded can be 1, while the below lines function. */ SDL_assert(!_this->gl_config.driver_loaded); diff --git a/thirdparty/SDL/src/video/windows/SDL_windowsopengles.h b/thirdparty/SDL/src/video/windows/SDL_windowsopengles.h index 65b71f5c8..f7844b47d 100644 --- a/thirdparty/SDL/src/video/windows/SDL_windowsopengles.h +++ b/thirdparty/SDL/src/video/windows/SDL_windowsopengles.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -23,7 +23,7 @@ #ifndef SDL_winopengles_h_ #define SDL_winopengles_h_ -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL #include "../SDL_sysvideo.h" #include "../SDL_egl_c.h" diff --git a/thirdparty/SDL/src/video/windows/SDL_windowsshape.c b/thirdparty/SDL/src/video/windows/SDL_windowsshape.c index 9aa75d2cb..fdeb1cdd3 100644 --- a/thirdparty/SDL/src/video/windows/SDL_windowsshape.c +++ b/thirdparty/SDL/src/video/windows/SDL_windowsshape.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_WINDOWS && !defined(__XBOXONE__) && !defined(__XBOXSERIES__) +#if defined(SDL_VIDEO_DRIVER_WINDOWS) && !defined(__XBOXONE__) && !defined(__XBOXSERIES__) #include "SDL_windowsshape.h" #include "SDL_windowsvideo.h" @@ -29,7 +29,7 @@ SDL_WindowShaper *Win32_CreateShaper(SDL_Window *window) { int resized_properly; SDL_WindowShaper *result = (SDL_WindowShaper *)SDL_malloc(sizeof(SDL_WindowShaper)); - if (result == NULL) { + if (!result) { SDL_OutOfMemory(); return NULL; } @@ -77,8 +77,8 @@ int Win32_SetWindowShape(SDL_WindowShaper *shaper, SDL_Surface *shape, SDL_Windo SDL_ShapeData *data; HRGN mask_region = NULL; - if ((shaper == NULL) || - (shape == NULL) || + if ((!shaper) || + (!shape) || ((shape->format->Amask == 0) && (shape_mode->mode != ShapeModeColorKey)) || (shape->w != shaper->window->w) || (shape->h != shaper->window->h)) { @@ -86,7 +86,7 @@ int Win32_SetWindowShape(SDL_WindowShaper *shaper, SDL_Surface *shape, SDL_Windo } data = (SDL_ShapeData *)shaper->driverdata; - if (data->mask_tree != NULL) { + if (data->mask_tree) { SDL_FreeShapeTree(&data->mask_tree); } data->mask_tree = SDL_CalculateShapeTree(*shape_mode, shape); @@ -103,15 +103,15 @@ int Win32_ResizeWindowShape(SDL_Window *window) { SDL_ShapeData *data; - if (window == NULL) { + if (!window) { return -1; } data = (SDL_ShapeData *)window->shaper->driverdata; - if (data == NULL) { + if (!data) { return -1; } - if (data->mask_tree != NULL) { + if (data->mask_tree) { SDL_FreeShapeTree(&data->mask_tree); } if (window->shaper->hasshape == SDL_TRUE) { diff --git a/thirdparty/SDL/src/video/windows/SDL_windowsshape.h b/thirdparty/SDL/src/video/windows/SDL_windowsshape.h index 875538b93..e1ce96a18 100644 --- a/thirdparty/SDL/src/video/windows/SDL_windowsshape.h +++ b/thirdparty/SDL/src/video/windows/SDL_windowsshape.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/windows/SDL_windowsvideo.c b/thirdparty/SDL/src/video/windows/SDL_windowsvideo.c index 5621293f5..5f1902aae 100644 --- a/thirdparty/SDL/src/video/windows/SDL_windowsvideo.c +++ b/thirdparty/SDL/src/video/windows/SDL_windowsvideo.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_WINDOWS +#ifdef SDL_VIDEO_DRIVER_WINDOWS #include "SDL_main.h" #include "SDL_video.h" @@ -35,6 +35,7 @@ #include "SDL_windowsframebuffer.h" #include "SDL_windowsshape.h" #include "SDL_windowsvulkan.h" +#include "SDL_windowsmessagebox.h" /* #define HIGHDPI_DEBUG */ @@ -215,7 +216,7 @@ static SDL_VideoDevice *WIN_CreateDevice(void) device->shape_driver.ResizeWindowShape = Win32_ResizeWindowShape; #endif -#if SDL_VIDEO_OPENGL_WGL +#ifdef SDL_VIDEO_OPENGL_WGL device->GL_LoadLibrary = WIN_GL_LoadLibrary; device->GL_GetProcAddress = WIN_GL_GetProcAddress; device->GL_UnloadLibrary = WIN_GL_UnloadLibrary; @@ -225,7 +226,7 @@ static SDL_VideoDevice *WIN_CreateDevice(void) device->GL_GetSwapInterval = WIN_GL_GetSwapInterval; device->GL_SwapWindow = WIN_GL_SwapWindow; device->GL_DeleteContext = WIN_GL_DeleteContext; -#elif SDL_VIDEO_OPENGL_EGL +#elif defined(SDL_VIDEO_OPENGL_EGL) /* Use EGL based functions */ device->GL_LoadLibrary = WIN_GLES_LoadLibrary; device->GL_GetProcAddress = WIN_GLES_GetProcAddress; @@ -237,7 +238,7 @@ static SDL_VideoDevice *WIN_CreateDevice(void) device->GL_SwapWindow = WIN_GLES_SwapWindow; device->GL_DeleteContext = WIN_GLES_DeleteContext; #endif -#if SDL_VIDEO_VULKAN +#ifdef SDL_VIDEO_VULKAN device->Vulkan_LoadLibrary = WIN_Vulkan_LoadLibrary; device->Vulkan_UnloadLibrary = WIN_Vulkan_UnloadLibrary; device->Vulkan_GetInstanceExtensions = WIN_Vulkan_GetInstanceExtensions; @@ -262,7 +263,12 @@ static SDL_VideoDevice *WIN_CreateDevice(void) } VideoBootStrap WINDOWS_bootstrap = { - "windows", "SDL Windows video driver", WIN_CreateDevice + "windows", "SDL Windows video driver", WIN_CreateDevice, + #if !defined(__XBOXONE__) && !defined(__XBOXSERIES__) + WIN_ShowMessageBox + #else + NULL + #endif }; static BOOL WIN_DeclareDPIAwareUnaware(_THIS) @@ -385,7 +391,7 @@ static void WIN_InitDPIAwareness(_THIS) { const char *hint = SDL_GetHint(SDL_HINT_WINDOWS_DPI_AWARENESS); - if (hint != NULL) { + if (hint) { if (SDL_strcmp(hint, "permonitorv2") == 0) { WIN_DeclareDPIAwarePerMonitorV2(_this); } else if (SDL_strcmp(hint, "permonitor") == 0) { @@ -540,7 +546,7 @@ int SDL_Direct3D9GetAdapterIndex(int displayIndex) SDL_DisplayData *pData = (SDL_DisplayData *)SDL_GetDisplayDriverData(displayIndex); int adapterIndex = D3DADAPTER_DEFAULT; - if (pData == NULL) { + if (!pData) { SDL_SetError("Invalid display index"); adapterIndex = -1; /* make sure we return something invalid */ } else { @@ -623,12 +629,12 @@ SDL_bool SDL_DXGIGetOutputInfo(int displayIndex, int *adapterIndex, int *outputI IDXGIAdapter *pDXGIAdapter; IDXGIOutput *pDXGIOutput; - if (adapterIndex == NULL) { + if (!adapterIndex) { SDL_InvalidParamError("adapterIndex"); return SDL_FALSE; } - if (outputIndex == NULL) { + if (!outputIndex) { SDL_InvalidParamError("outputIndex"); return SDL_FALSE; } @@ -636,7 +642,7 @@ SDL_bool SDL_DXGIGetOutputInfo(int displayIndex, int *adapterIndex, int *outputI *adapterIndex = -1; *outputIndex = -1; - if (pData == NULL) { + if (!pData) { SDL_SetError("Invalid display index"); return SDL_FALSE; } diff --git a/thirdparty/SDL/src/video/windows/SDL_windowsvideo.h b/thirdparty/SDL/src/video/windows/SDL_windowsvideo.h index 7c44328fb..93ca1cb63 100644 --- a/thirdparty/SDL/src/video/windows/SDL_windowsvideo.h +++ b/thirdparty/SDL/src/video/windows/SDL_windowsvideo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/windows/SDL_windowsvulkan.c b/thirdparty/SDL/src/video/windows/SDL_windowsvulkan.c index aa5f01823..01ab8a55e 100644 --- a/thirdparty/SDL/src/video/windows/SDL_windowsvulkan.c +++ b/thirdparty/SDL/src/video/windows/SDL_windowsvulkan.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -26,7 +26,7 @@ #include "../../SDL_internal.h" -#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_WINDOWS +#if defined(SDL_VIDEO_VULKAN) && defined(SDL_VIDEO_DRIVER_WINDOWS) #include "SDL_windowsvideo.h" #include "SDL_windowswindow.h" @@ -48,10 +48,10 @@ int WIN_Vulkan_LoadLibrary(_THIS, const char *path) } /* Load the Vulkan loader library */ - if (path == NULL) { + if (!path) { path = SDL_getenv("SDL_VULKAN_LIBRARY"); } - if (path == NULL) { + if (!path) { path = "vulkan-1.dll"; } _this->vulkan_config.loader_handle = SDL_LoadObject(path); @@ -76,7 +76,7 @@ int WIN_Vulkan_LoadLibrary(_THIS, const char *path) (PFN_vkEnumerateInstanceExtensionProperties) _this->vulkan_config.vkEnumerateInstanceExtensionProperties, &extensionCount); - if (extensions == NULL) { + if (!extensions) { goto fail; } for (i = 0; i < extensionCount; i++) { diff --git a/thirdparty/SDL/src/video/windows/SDL_windowsvulkan.h b/thirdparty/SDL/src/video/windows/SDL_windowsvulkan.h index b2fe17ded..1545dcd89 100644 --- a/thirdparty/SDL/src/video/windows/SDL_windowsvulkan.h +++ b/thirdparty/SDL/src/video/windows/SDL_windowsvulkan.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -32,7 +32,7 @@ #include "../SDL_vulkan_internal.h" #include "../SDL_sysvideo.h" -#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_WINDOWS +#if defined(SDL_VIDEO_VULKAN) && defined(SDL_VIDEO_DRIVER_WINDOWS) int WIN_Vulkan_LoadLibrary(_THIS, const char *path); void WIN_Vulkan_UnloadLibrary(_THIS); diff --git a/thirdparty/SDL/src/video/windows/SDL_windowswindow.c b/thirdparty/SDL/src/video/windows/SDL_windowswindow.c index 1d128f7dd..cf49fbfbf 100644 --- a/thirdparty/SDL/src/video/windows/SDL_windowswindow.c +++ b/thirdparty/SDL/src/video/windows/SDL_windowswindow.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_WINDOWS +#ifdef SDL_VIDEO_DRIVER_WINDOWS #include "../../core/windows/SDL_windows.h" @@ -179,7 +179,7 @@ static void WIN_AdjustWindowRectWithStyle(SDL_Window *window, DWORD style, BOOL mon = MonitorFromRect(&screen_rect, MONITOR_DEFAULTTONEAREST); - if (videodata != NULL) { + if (videodata) { /* GetDpiForMonitor docs promise to return the same hdpi / vdpi */ if (videodata->GetDpiForMonitor(mon, MDT_EFFECTIVE_DPI, &frame_dpi, &unused) != S_OK) { frame_dpi = 96; @@ -300,7 +300,7 @@ static int SetupWindowData(_THIS, SDL_Window *window, HWND hwnd, HWND parent, SD /* Allocate the window data */ data = (SDL_WindowData *)SDL_calloc(1, sizeof(*data)); - if (data == NULL) { + if (!data) { return SDL_OutOfMemory(); } data->window = window; @@ -477,7 +477,7 @@ static void CleanupWindowData(_THIS, SDL_Window *window) } } else { /* Restore any original event handler... */ - if (data->wndproc != NULL) { + if (data->wndproc) { #ifdef GWLP_WNDPROC SetWindowLongPtr(data->hwnd, GWLP_WNDPROC, (LONG_PTR)data->wndproc); @@ -537,13 +537,13 @@ int WIN_CreateWindow(_THIS, SDL_Window *window) } /* The rest of this macro mess is for OpenGL or OpenGL ES windows */ -#if SDL_VIDEO_OPENGL_ES2 +#ifdef SDL_VIDEO_OPENGL_ES2 if (_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES -#if SDL_VIDEO_OPENGL_WGL +#ifdef SDL_VIDEO_OPENGL_WGL && (!_this->gl_data || WIN_GL_UseEGL(_this)) #endif /* SDL_VIDEO_OPENGL_WGL */ ) { -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL if (WIN_GLES_SetupWindow(_this, window) < 0) { WIN_DestroyWindow(_this, window); return -1; @@ -555,7 +555,7 @@ int WIN_CreateWindow(_THIS, SDL_Window *window) } #endif /* SDL_VIDEO_OPENGL_ES2 */ -#if SDL_VIDEO_OPENGL_WGL +#ifdef SDL_VIDEO_OPENGL_WGL if (WIN_GL_SetupWindow(_this, window) < 0) { WIN_DestroyWindow(_this, window); return -1; @@ -596,7 +596,7 @@ int WIN_CreateWindowFrom(_THIS, SDL_Window *window, const void *data) return -1; } -#if SDL_VIDEO_OPENGL_WGL +#ifdef SDL_VIDEO_OPENGL_WGL { const char *hint = SDL_GetHint(SDL_HINT_VIDEO_WINDOW_SHARE_PIXEL_FORMAT); if (hint) { @@ -607,7 +607,7 @@ int WIN_CreateWindowFrom(_THIS, SDL_Window *window, const void *data) (void)SDL_sscanf(hint, "%p", (void **)&otherWindow); /* Do some error checking on the pointer */ - if (otherWindow != NULL && otherWindow->magic == &_this->window_magic) { + if (otherWindow && otherWindow->magic == &_this->window_magic) { /* If the otherWindow has SDL_WINDOW_OPENGL set, set it for the new window as well */ if (otherWindow->flags & SDL_WINDOW_OPENGL) { window->flags |= SDL_WINDOW_OPENGL; @@ -1058,7 +1058,7 @@ void *WIN_GetWindowICCProfile(_THIS, SDL_Window *window, size_t *size) filename_utf8 = WIN_StringToUTF8(data->ICMFileName); if (filename_utf8) { iccProfileData = SDL_LoadFile(filename_utf8, size); - if (iccProfileData == NULL) { + if (!iccProfileData) { SDL_SetError("Could not open ICC profile"); } SDL_free(filename_utf8); @@ -1224,7 +1224,7 @@ int SDL_HelperWindowCreate(void) CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, HWND_MESSAGE, NULL, hInstance, NULL); - if (SDL_HelperWindow == NULL) { + if (!SDL_HelperWindow) { UnregisterClass(SDL_HelperWindowClassName, hInstance); return WIN_SetError("Unable to create Helper Window"); } @@ -1263,7 +1263,7 @@ void WIN_OnWindowEnter(_THIS, SDL_Window *window) { SDL_WindowData *data = (SDL_WindowData *)window->driverdata; - if (data == NULL || !data->hwnd) { + if (!data || !data->hwnd) { /* The window wasn't fully initialized */ return; } @@ -1273,6 +1273,13 @@ void WIN_OnWindowEnter(_THIS, SDL_Window *window) } } +static BOOL GetClientScreenRect(HWND hwnd, RECT *rect) +{ + return GetClientRect(hwnd, rect) && /* RECT( left , top , right , bottom ) */ + ClientToScreen(hwnd, (LPPOINT)rect) && /* POINT( left , top ) */ + ClientToScreen(hwnd, (LPPOINT)rect + 1); /* POINT( right , bottom ) */ +} + void WIN_UpdateClipCursor(SDL_Window *window) { SDL_WindowData *data = (SDL_WindowData *)window->driverdata; @@ -1293,7 +1300,7 @@ void WIN_UpdateClipCursor(SDL_Window *window) (window->mouse_rect.w > 0 && window->mouse_rect.h > 0)) && (window->flags & SDL_WINDOW_INPUT_FOCUS)) { if (mouse->relative_mode && !mouse->relative_mode_warp && data->mouse_relative_mode_center) { - if (GetWindowRect(data->hwnd, &rect)) { + if (GetClientScreenRect(data->hwnd, &rect)) { /* WIN_WarpCursor() jitters by +1, and remote desktop warp wobble is +/- 1 */ LONG remote_desktop_adjustment = GetSystemMetrics(SM_REMOTESESSION) ? 2 : 0; LONG cx, cy; @@ -1314,9 +1321,7 @@ void WIN_UpdateClipCursor(SDL_Window *window) } } } else { - if (GetClientRect(data->hwnd, &rect)) { - ClientToScreen(data->hwnd, (LPPOINT)&rect); - ClientToScreen(data->hwnd, (LPPOINT)&rect + 1); + if (GetClientScreenRect(data->hwnd, &rect)) { if (window->mouse_rect.w > 0 && window->mouse_rect.h > 0) { SDL_Rect mouse_rect_win_client; RECT mouse_rect, intersection; diff --git a/thirdparty/SDL/src/video/windows/SDL_windowswindow.h b/thirdparty/SDL/src/video/windows/SDL_windowswindow.h index fe2e35f58..20f78b97d 100644 --- a/thirdparty/SDL/src/video/windows/SDL_windowswindow.h +++ b/thirdparty/SDL/src/video/windows/SDL_windowswindow.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -23,7 +23,7 @@ #ifndef SDL_windowswindow_h_ #define SDL_windowswindow_h_ -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL #include "../SDL_egl_c.h" #else #include "../SDL_sysvideo.h" @@ -64,7 +64,7 @@ typedef struct SDL_bool mouse_tracked; WCHAR *ICMFileName; struct SDL_VideoData *videodata; -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL EGLSurface egl_surface; #endif /** diff --git a/thirdparty/SDL/src/video/windows/wmmsg.h b/thirdparty/SDL/src/video/windows/wmmsg.h index d0cb887fc..86e6c2a90 100644 --- a/thirdparty/SDL/src/video/windows/wmmsg.h +++ b/thirdparty/SDL/src/video/windows/wmmsg.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/winrt/SDL_winrtevents.cpp b/thirdparty/SDL/src/video/winrt/SDL_winrtevents.cpp index 30d1fac4b..79468f7cd 100644 --- a/thirdparty/SDL/src/video/winrt/SDL_winrtevents.cpp +++ b/thirdparty/SDL/src/video/winrt/SDL_winrtevents.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_WINRT +#ifdef SDL_VIDEO_DRIVER_WINRT /* * Windows includes: diff --git a/thirdparty/SDL/src/video/winrt/SDL_winrtevents_c.h b/thirdparty/SDL/src/video/winrt/SDL_winrtevents_c.h index b761a4036..d08cf9aea 100644 --- a/thirdparty/SDL/src/video/winrt/SDL_winrtevents_c.h +++ b/thirdparty/SDL/src/video/winrt/SDL_winrtevents_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/winrt/SDL_winrtgamebar.cpp b/thirdparty/SDL/src/video/winrt/SDL_winrtgamebar.cpp index fd71a55be..e56def1d1 100644 --- a/thirdparty/SDL/src/video/winrt/SDL_winrtgamebar.cpp +++ b/thirdparty/SDL/src/video/winrt/SDL_winrtgamebar.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_WINRT +#ifdef SDL_VIDEO_DRIVER_WINRT /* Windows includes */ #include @@ -116,7 +116,7 @@ static void WINRT_HandleGameBarIsInputRedirected_MainThread() return; } gameBar = WINRT_GetGameBar(); - if (gameBar == NULL) { + if (!gameBar) { /* Shouldn't happen, but just in case... */ return; } @@ -167,11 +167,11 @@ void WINRT_QuitGameBar(_THIS) { SDL_VideoData *driverdata; IGameBarStatics_ *gameBar; - if (_this == NULL || _this->driverdata == NULL) { + if (!_this || !_this->driverdata) { return; } gameBar = WINRT_GetGameBar(); - if (gameBar == NULL) { + if (!gameBar) { return; } driverdata = (SDL_VideoData *)_this->driverdata; diff --git a/thirdparty/SDL/src/video/winrt/SDL_winrtgamebar_cpp.h b/thirdparty/SDL/src/video/winrt/SDL_winrtgamebar_cpp.h index 059a62cfe..7e3f5d927 100644 --- a/thirdparty/SDL/src/video/winrt/SDL_winrtgamebar_cpp.h +++ b/thirdparty/SDL/src/video/winrt/SDL_winrtgamebar_cpp.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/winrt/SDL_winrtkeyboard.cpp b/thirdparty/SDL/src/video/winrt/SDL_winrtkeyboard.cpp index 9e6e141c4..26a1902d5 100644 --- a/thirdparty/SDL/src/video/winrt/SDL_winrtkeyboard.cpp +++ b/thirdparty/SDL/src/video/winrt/SDL_winrtkeyboard.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_WINRT +#ifdef SDL_VIDEO_DRIVER_WINRT /* Windows-specific includes */ #include diff --git a/thirdparty/SDL/src/video/winrt/SDL_winrtmessagebox.cpp b/thirdparty/SDL/src/video/winrt/SDL_winrtmessagebox.cpp index 42a8f3207..a2d66a3c4 100644 --- a/thirdparty/SDL/src/video/winrt/SDL_winrtmessagebox.cpp +++ b/thirdparty/SDL/src/video/winrt/SDL_winrtmessagebox.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_WINRT +#ifdef SDL_VIDEO_DRIVER_WINRT extern "C" { #include "SDL_messagebox.h" @@ -41,9 +41,9 @@ static String ^ WINRT_UTF8ToPlatformString(const char *str) { return rtstr; } - extern "C" int WINRT_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid) +extern "C" int WINRT_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid) { -#if (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) && (NTDDI_VERSION == NTDDI_WIN8) +#if SDL_WINAPI_FAMILY_PHONE && (NTDDI_VERSION == NTDDI_WIN8) /* Sadly, Windows Phone 8 doesn't include the MessageDialog class that * Windows 8.x/RT does, even though MSDN's reference documentation for * Windows Phone 8 mentions it. @@ -55,7 +55,7 @@ static String ^ WINRT_UTF8ToPlatformString(const char *str) { #else SDL_VideoDevice *_this = SDL_GetVideoDevice(); -#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP +#if SDL_WINAPI_FAMILY_PHONE const int maxbuttons = 2; const char *platform = "Windows Phone 8.1+"; #else @@ -106,7 +106,7 @@ static String ^ WINRT_UTF8ToPlatformString(const char *str) { *buttonid = messageboxdata->buttons[clicked_index].buttonid; } return 0; -#endif /* if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP / else */ +#endif /* if SDL_WINAPI_FAMILY_PHONE / else */ } #endif /* SDL_VIDEO_DRIVER_WINRT */ diff --git a/thirdparty/SDL/src/video/winrt/SDL_winrtmessagebox.h b/thirdparty/SDL/src/video/winrt/SDL_winrtmessagebox.h index 4ea65c550..ab02d3a8b 100644 --- a/thirdparty/SDL/src/video/winrt/SDL_winrtmessagebox.h +++ b/thirdparty/SDL/src/video/winrt/SDL_winrtmessagebox.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_WINRT +#ifdef SDL_VIDEO_DRIVER_WINRT extern int WINRT_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid); diff --git a/thirdparty/SDL/src/video/winrt/SDL_winrtmouse.cpp b/thirdparty/SDL/src/video/winrt/SDL_winrtmouse.cpp index 05fae956a..e46687fd4 100644 --- a/thirdparty/SDL/src/video/winrt/SDL_winrtmouse.cpp +++ b/thirdparty/SDL/src/video/winrt/SDL_winrtmouse.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_WINRT +#ifdef SDL_VIDEO_DRIVER_WINRT /* * Windows includes: @@ -215,7 +215,7 @@ void WINRT_InitMouse(_THIS) - programmatically moveable cursors */ -#if WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP +#if !SDL_WINAPI_FAMILY_PHONE // mouse->CreateCursor = WINRT_CreateCursor; mouse->CreateSystemCursor = WINRT_CreateSystemCursor; mouse->ShowCursor = WINRT_ShowCursor; diff --git a/thirdparty/SDL/src/video/winrt/SDL_winrtmouse_c.h b/thirdparty/SDL/src/video/winrt/SDL_winrtmouse_c.h index 730bb1ea5..2271a14cd 100644 --- a/thirdparty/SDL/src/video/winrt/SDL_winrtmouse_c.h +++ b/thirdparty/SDL/src/video/winrt/SDL_winrtmouse_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/winrt/SDL_winrtopengles.cpp b/thirdparty/SDL/src/video/winrt/SDL_winrtopengles.cpp index 34889595b..cf7024174 100644 --- a/thirdparty/SDL/src/video/winrt/SDL_winrtopengles.cpp +++ b/thirdparty/SDL/src/video/winrt/SDL_winrtopengles.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_WINRT && SDL_VIDEO_OPENGL_EGL +#if defined(SDL_VIDEO_DRIVER_WINRT) && defined(SDL_VIDEO_OPENGL_EGL) /* EGL implementation of SDL OpenGL support */ @@ -144,7 +144,7 @@ WINRT_GLES_LoadLibrary(_THIS, const char *path) return SDL_EGL_SetError("Could not retrieve ANGLE/WinRT display function(s)", "eglGetProcAddress"); } -#if (WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP) +#if !SDL_WINAPI_FAMILY_PHONE /* Try initializing EGL at D3D11 Feature Level 10_0+ (which is not * supported on WinPhone 8.x. */ diff --git a/thirdparty/SDL/src/video/winrt/SDL_winrtopengles.h b/thirdparty/SDL/src/video/winrt/SDL_winrtopengles.h index dc495609d..c48a2df67 100644 --- a/thirdparty/SDL/src/video/winrt/SDL_winrtopengles.h +++ b/thirdparty/SDL/src/video/winrt/SDL_winrtopengles.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -23,7 +23,7 @@ #ifndef SDL_winrtopengles_h_ #define SDL_winrtopengles_h_ -#if SDL_VIDEO_DRIVER_WINRT && SDL_VIDEO_OPENGL_EGL +#if defined(SDL_VIDEO_DRIVER_WINRT) && defined(SDL_VIDEO_OPENGL_EGL) #include "../SDL_sysvideo.h" #include "../SDL_egl_c.h" diff --git a/thirdparty/SDL/src/video/winrt/SDL_winrtpointerinput.cpp b/thirdparty/SDL/src/video/winrt/SDL_winrtpointerinput.cpp index e80d99dfe..63c2c8605 100644 --- a/thirdparty/SDL/src/video/winrt/SDL_winrtpointerinput.cpp +++ b/thirdparty/SDL/src/video/winrt/SDL_winrtpointerinput.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_WINRT +#ifdef SDL_VIDEO_DRIVER_WINRT /* SDL includes */ #include "SDL_winrtevents_c.h" @@ -78,7 +78,7 @@ WINRT_TransformCursorPosition(SDL_Window *window, // Compute coordinates normalized from 0..1. // If the coordinates need to be sized to the SDL window, // we'll do that after. -#if (WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP) || (NTDDI_VERSION > NTDDI_WIN8) +#if !SDL_WINAPI_FAMILY_PHONE || (NTDDI_VERSION > NTDDI_WIN8) outputPosition.X = rawPosition.X / nativeWindow->Bounds.Width; outputPosition.Y = rawPosition.Y / nativeWindow->Bounds.Height; #else @@ -116,7 +116,7 @@ SDL_bool WINRT_GetSDLButtonForPointerPoint(Windows::UI::Input::PointerPoint ^ pt { using namespace Windows::UI::Input; -#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP +#if SDL_WINAPI_FAMILY_PHONE *button = SDL_BUTTON_LEFT; return SDL_TRUE; #else @@ -197,7 +197,7 @@ SDL_bool WINRT_GetSDLButtonForPointerPoint(Windows::UI::Input::PointerPoint ^ pt static bool WINRT_IsTouchEvent(Windows::UI::Input::PointerPoint ^ pointerPoint) { -#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP +#if SDL_WINAPI_FAMILY_PHONE return true; #else using namespace Windows::Devices::Input; diff --git a/thirdparty/SDL/src/video/winrt/SDL_winrtvideo.cpp b/thirdparty/SDL/src/video/winrt/SDL_winrtvideo.cpp index 9a38e6ccc..9160bbb63 100644 --- a/thirdparty/SDL/src/video/winrt/SDL_winrtvideo.cpp +++ b/thirdparty/SDL/src/video/winrt/SDL_winrtvideo.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_WINRT +#ifdef SDL_VIDEO_DRIVER_WINRT /* WinRT SDL video driver implementation @@ -29,10 +29,8 @@ */ /* Standard C++11 includes */ -#include -#include #include -using namespace std; +#include /* Windows includes */ #include @@ -61,6 +59,7 @@ extern "C" { #include "SDL_syswm.h" #include "SDL_winrtopengles.h" #include "../../core/windows/SDL_windows.h" +#include "SDL_winrtmessagebox.h" } #include "../../core/winrt/SDL_winrtapp_direct3d.h" @@ -116,13 +115,13 @@ static SDL_VideoDevice *WINRT_CreateDevice(void) /* Initialize all variables that we clean on shutdown */ device = (SDL_VideoDevice *)SDL_calloc(1, sizeof(SDL_VideoDevice)); - if (device == NULL) { + if (!device) { SDL_OutOfMemory(); return 0; } data = (SDL_VideoData *)SDL_calloc(1, sizeof(SDL_VideoData)); - if (data == NULL) { + if (!data) { SDL_OutOfMemory(); SDL_free(device); return 0; @@ -166,10 +165,10 @@ static SDL_VideoDevice *WINRT_CreateDevice(void) return device; } -#define WINRTVID_DRIVER_NAME "winrt" VideoBootStrap WINRT_bootstrap = { - WINRTVID_DRIVER_NAME, "SDL WinRT video driver", - WINRT_CreateDevice + "winrt", "SDL WinRT video driver", + WINRT_CreateDevice, + WINRT_ShowMessageBox }; static void SDLCALL WINRT_SetDisplayOrientationsPreference(void *userdata, const char *name, const char *oldValue, const char *newValue) @@ -182,7 +181,7 @@ static void SDLCALL WINRT_SetDisplayOrientationsPreference(void *userdata, const * * TODO, WinRT: consider reading in an app's .appxmanifest file, and apply its orientation when 'newValue == NULL'. */ - if ((oldValue == NULL) && (newValue == NULL)) { + if ((!oldValue) && (!newValue)) { return; } @@ -337,7 +336,7 @@ static int WINRT_AddDisplaysForOutput(_THIS, IDXGIAdapter1 *dxgiAdapter1, int ou } dxgiModes = (DXGI_MODE_DESC *)SDL_calloc(numModes, sizeof(DXGI_MODE_DESC)); - if (dxgiModes == NULL) { + if (!dxgiModes) { SDL_OutOfMemory(); goto done; } @@ -406,7 +405,7 @@ static int WINRT_AddDisplaysForAdapter(_THIS, IDXGIFactory2 *dxgiFactory2, int a if (adapterIndex == 0 && outputIndex == 0) { SDL_VideoDisplay display; SDL_DisplayMode mode; -#if SDL_WINRT_USE_APPLICATIONVIEW +#ifdef SDL_WINRT_USE_APPLICATIONVIEW ApplicationView ^ appView = ApplicationView::GetForCurrentView(); #endif CoreWindow ^ coreWin = CoreWindow::GetForCurrentThread(); @@ -421,7 +420,7 @@ static int WINRT_AddDisplaysForAdapter(_THIS, IDXGIFactory2 *dxgiFactory2, int a failing test), whereas CoreWindow might not. -- DavidL */ -#if (NTDDI_VERSION >= NTDDI_WIN10) || (SDL_WINRT_USE_APPLICATIONVIEW && WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) +#if (NTDDI_VERSION >= NTDDI_WIN10) || (defined(SDL_WINRT_USE_APPLICATIONVIEW) && SDL_WINAPI_FAMILY_PHONE) mode.w = WINRT_DIPS_TO_PHYSICAL_PIXELS(appView->VisibleBounds.Width); mode.h = WINRT_DIPS_TO_PHYSICAL_PIXELS(appView->VisibleBounds.Height); #else @@ -500,11 +499,11 @@ WINRT_DetectWindowFlags(SDL_Window *window) SDL_WindowData *data = (SDL_WindowData *)window->driverdata; bool is_fullscreen = false; -#if SDL_WINRT_USE_APPLICATIONVIEW +#ifdef SDL_WINRT_USE_APPLICATIONVIEW if (data->appView) { is_fullscreen = data->appView->IsFullScreenMode; } -#elif (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) || (NTDDI_VERSION == NTDDI_WIN8) +#elif SDL_WINAPI_FAMILY_PHONE || (NTDDI_VERSION == NTDDI_WIN8) is_fullscreen = true; #endif @@ -514,13 +513,13 @@ WINRT_DetectWindowFlags(SDL_Window *window) int w = WINRT_DIPS_TO_PHYSICAL_PIXELS(data->coreWindow->Bounds.Width); int h = WINRT_DIPS_TO_PHYSICAL_PIXELS(data->coreWindow->Bounds.Height); -#if (WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP) || (NTDDI_VERSION > NTDDI_WIN8) +#if !SDL_WINAPI_FAMILY_PHONE || (NTDDI_VERSION > NTDDI_WIN8) // On all WinRT platforms, except for WinPhone 8.0, rotate the // window size. This is needed to properly calculate // fullscreen vs. maximized. const DisplayOrientations currentOrientation = WINRT_DISPLAY_PROPERTY(CurrentOrientation); switch (currentOrientation) { -#if (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) +#if SDL_WINAPI_FAMILY_PHONE case DisplayOrientations::Landscape: case DisplayOrientations::LandscapeFlipped: #else @@ -548,7 +547,7 @@ WINRT_DetectWindowFlags(SDL_Window *window) latestFlags |= SDL_WINDOW_HIDDEN; } -#if (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) && (NTDDI_VERSION < NTDDI_WINBLUE) +#if SDL_WINAPI_FAMILY_PHONE && (NTDDI_VERSION < NTDDI_WINBLUE) // data->coreWindow->PointerPosition is not supported on WinPhone 8.0 latestFlags |= SDL_WINDOW_MOUSE_FOCUS; #else @@ -622,7 +621,7 @@ int WINRT_CreateWindow(_THIS, SDL_Window *window) */ if (!WINRT_XAMLWasEnabled) { data->coreWindow = CoreWindow::GetForCurrentThread(); -#if SDL_WINRT_USE_APPLICATIONVIEW +#ifdef SDL_WINRT_USE_APPLICATIONVIEW data->appView = ApplicationView::GetForCurrentView(); #endif } @@ -630,7 +629,7 @@ int WINRT_CreateWindow(_THIS, SDL_Window *window) /* Make note of the requested window flags, before they start getting changed. */ const Uint32 requestedFlags = window->flags; -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL /* Setup the EGL surface, but only if OpenGL ES 2 was requested. */ if (!(window->flags & SDL_WINDOW_OPENGL)) { /* OpenGL ES 2 wasn't requested. Don't set up an EGL surface. */ @@ -685,7 +684,7 @@ int WINRT_CreateWindow(_THIS, SDL_Window *window) SDL_WINDOW_BORDERLESS | SDL_WINDOW_RESIZABLE; -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL if (data->egl_surface) { window->flags |= SDL_WINDOW_OPENGL; } diff --git a/thirdparty/SDL/src/video/winrt/SDL_winrtvideo_cpp.h b/thirdparty/SDL/src/video/winrt/SDL_winrtvideo_cpp.h index a34b79e60..a60b3aa74 100644 --- a/thirdparty/SDL/src/video/winrt/SDL_winrtvideo_cpp.h +++ b/thirdparty/SDL/src/video/winrt/SDL_winrtvideo_cpp.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -99,7 +99,7 @@ struct SDL_WindowData #ifdef SDL_VIDEO_OPENGL_EGL EGLSurface egl_surface; #endif -#if SDL_WINRT_USE_APPLICATIONVIEW +#ifdef SDL_WINRT_USE_APPLICATIONVIEW Windows::UI::ViewManagement::ApplicationView ^ appView; #endif }; diff --git a/thirdparty/SDL/src/video/x11/SDL_x11clipboard.c b/thirdparty/SDL/src/video/x11/SDL_x11clipboard.c index 5d28eecca..cf826a559 100644 --- a/thirdparty/SDL/src/video/x11/SDL_x11clipboard.c +++ b/thirdparty/SDL/src/video/x11/SDL_x11clipboard.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_X11 +#ifdef SDL_VIDEO_DRIVER_X11 #include /* For INT_MAX */ @@ -206,7 +206,7 @@ static char *GetSlectionText(_THIS, Atom selection_type) X11_XFree(src); } - if (text == NULL) { + if (!text) { text = SDL_strdup(""); } diff --git a/thirdparty/SDL/src/video/x11/SDL_x11clipboard.h b/thirdparty/SDL/src/video/x11/SDL_x11clipboard.h index 21575dda4..c9849b7bb 100644 --- a/thirdparty/SDL/src/video/x11/SDL_x11clipboard.h +++ b/thirdparty/SDL/src/video/x11/SDL_x11clipboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/x11/SDL_x11dyn.c b/thirdparty/SDL/src/video/x11/SDL_x11dyn.c index 818729970..7a4f5cc0e 100644 --- a/thirdparty/SDL/src/video/x11/SDL_x11dyn.c +++ b/thirdparty/SDL/src/video/x11/SDL_x11dyn.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_X11 +#ifdef SDL_VIDEO_DRIVER_X11 #define DEBUG_DYNAMIC_X11 0 @@ -75,22 +75,22 @@ static void *X11_GetSym(const char *fnname, int *pHasModule) int i; void *fn = NULL; for (i = 0; i < SDL_TABLESIZE(x11libs); i++) { - if (x11libs[i].lib != NULL) { + if (x11libs[i].lib) { fn = SDL_LoadFunction(x11libs[i].lib, fnname); - if (fn != NULL) { + if (fn) { break; } } } #if DEBUG_DYNAMIC_X11 - if (fn != NULL) + if (fn) printf("X11: Found '%s' in %s (%p)\n", fnname, x11libs[i].libname, fn); else printf("X11: Symbol '%s' NOT FOUND!\n", fnname); #endif - if (fn == NULL) { + if (!fn) { *pHasModule = 0; /* kill this module. */ } @@ -136,7 +136,7 @@ void SDL_X11_UnloadSymbols(void) #ifdef SDL_VIDEO_DRIVER_X11_DYNAMIC for (i = 0; i < SDL_TABLESIZE(x11libs); i++) { - if (x11libs[i].lib != NULL) { + if (x11libs[i].lib) { SDL_UnloadObject(x11libs[i].lib); x11libs[i].lib = NULL; } @@ -157,7 +157,7 @@ int SDL_X11_LoadSymbols(void) int i; int *thismod = NULL; for (i = 0; i < SDL_TABLESIZE(x11libs); i++) { - if (x11libs[i].libname != NULL) { + if (x11libs[i].libname) { x11libs[i].lib = SDL_LoadObject(x11libs[i].libname); } } diff --git a/thirdparty/SDL/src/video/x11/SDL_x11dyn.h b/thirdparty/SDL/src/video/x11/SDL_x11dyn.h index a18e41f24..5a78ad000 100644 --- a/thirdparty/SDL/src/video/x11/SDL_x11dyn.h +++ b/thirdparty/SDL/src/video/x11/SDL_x11dyn.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -27,7 +27,7 @@ #include #include -#if SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM +#ifdef SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM #include #endif @@ -46,25 +46,25 @@ #include #endif -#if SDL_VIDEO_DRIVER_X11_XCURSOR +#ifdef SDL_VIDEO_DRIVER_X11_XCURSOR #include #endif -#if SDL_VIDEO_DRIVER_X11_XDBE +#ifdef SDL_VIDEO_DRIVER_X11_XDBE #include #endif -#if SDL_VIDEO_DRIVER_X11_XINPUT2 || SDL_VIDEO_DRIVER_X11_XFIXES +#if defined(SDL_VIDEO_DRIVER_X11_XINPUT2) || defined(SDL_VIDEO_DRIVER_X11_XFIXES) #include #endif -#if SDL_VIDEO_DRIVER_X11_XFIXES +#ifdef SDL_VIDEO_DRIVER_X11_XFIXES #include #endif -#if SDL_VIDEO_DRIVER_X11_XRANDR +#ifdef SDL_VIDEO_DRIVER_X11_XRANDR #include #endif -#if SDL_VIDEO_DRIVER_X11_XSCRNSAVER +#ifdef SDL_VIDEO_DRIVER_X11_XSCRNSAVER #include #endif -#if SDL_VIDEO_DRIVER_X11_XSHAPE +#ifdef SDL_VIDEO_DRIVER_X11_XSHAPE #include #endif diff --git a/thirdparty/SDL/src/video/x11/SDL_x11events.c b/thirdparty/SDL/src/video/x11/SDL_x11events.c index a28ccce3d..21b66ff77 100644 --- a/thirdparty/SDL/src/video/x11/SDL_x11events.c +++ b/thirdparty/SDL/src/video/x11/SDL_x11events.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_X11 +#ifdef SDL_VIDEO_DRIVER_X11 #include #include @@ -102,7 +102,7 @@ static void X11_ReadProperty(SDL_x11Prop *p, Display *disp, Window w, Atom prop) int bytes_fetch = 0; do { - if (ret != NULL) { + if (ret) { X11_XFree(ret); } X11_XGetWindowProperty(disp, w, prop, 0, bytes_fetch, False, AnyPropertyType, &type, &fmt, &count, &bytes_left, &ret); @@ -224,7 +224,7 @@ static int X11_URIDecode(char *buf, int len) { int ri, wi, di; char decode = '\0'; - if (buf == NULL || len < 0) { + if (!buf || len < 0) { errno = EINVAL; return -1; } @@ -300,7 +300,7 @@ static char *X11_URIToLocal(char *uri) /* got a hostname? */ if (!local && uri[0] == '/' && uri[2] != '/') { char *hostname_end = SDL_strchr(uri + 1, '/'); - if (hostname_end != NULL) { + if (hostname_end) { char hostname[257]; if (gethostname(hostname, 255) == 0) { hostname[256] = '\0'; @@ -324,7 +324,7 @@ static char *X11_URIToLocal(char *uri) return file; } -#if SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS +#ifdef SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS static void X11_HandleGenericEvent(SDL_VideoData *videodata, XEvent *xev) { /* event is a union, so cookie == &event, but this is type safe. */ @@ -756,7 +756,7 @@ static int XLookupStringAsUTF8(XKeyEvent *event_struct, char *buffer_return, int { int result = X11_XLookupString(event_struct, buffer_return, bytes_buffer, keysym_return, status_in_out); if (IsHighLatin1(buffer_return, result)) { - char *utf8_text = SDL_iconv_string("UTF-8", "ISO-8859-1", buffer_return, result); + char *utf8_text = SDL_iconv_string("UTF-8", "ISO-8859-1", buffer_return, result + 1); if (utf8_text) { SDL_strlcpy(buffer_return, utf8_text, bytes_buffer); SDL_free(utf8_text); @@ -841,14 +841,14 @@ static void X11_DispatchEvent(_THIS, XEvent *xevent) return; } -#if SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS +#ifdef SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS if (xevent->type == GenericEvent) { X11_HandleGenericEvent(videodata, xevent); return; } #endif -#if SDL_VIDEO_DRIVER_X11_XRANDR +#ifdef SDL_VIDEO_DRIVER_X11_XRANDR if (videodata->xrandr_event_base && (xevent->type == (videodata->xrandr_event_base + RRNotify))) { X11_HandleXRandREvent(_this, xevent); } @@ -869,6 +869,27 @@ static void X11_DispatchEvent(_THIS, XEvent *xevent) xevent->type, xevent->xany.display, xevent->xany.window); #endif +#ifdef SDL_VIDEO_DRIVER_X11_XFIXES + if (SDL_X11_HAVE_XFIXES && + xevent->type == X11_GetXFixesSelectionNotifyEvent()) { + XFixesSelectionNotifyEvent *ev = (XFixesSelectionNotifyEvent *) xevent; + + /* !!! FIXME: cache atoms */ + Atom XA_CLIPBOARD = X11_XInternAtom(display, "CLIPBOARD", 0); + +#ifdef DEBUG_XEVENTS + printf("window CLIPBOARD: XFixesSelectionNotify (selection = %s)\n", + X11_XGetAtomName(display, ev->selection)); +#endif + + if (ev->selection == XA_PRIMARY || + (XA_CLIPBOARD != None && ev->selection == XA_CLIPBOARD)) { + SDL_SendClipboardUpdate(); + return; + } + } +#endif /* SDL_VIDEO_DRIVER_X11_XFIXES */ + if ((videodata->clipboard_window != None) && (videodata->clipboard_window == xevent->xany.window)) { X11_HandleClipboardEvent(_this, xevent); @@ -885,7 +906,7 @@ static void X11_DispatchEvent(_THIS, XEvent *xevent) } } } - if (data == NULL) { + if (!data) { /* The window for KeymapNotify, etc events is 0 */ if (xevent->type == KeymapNotify) { #ifdef DEBUG_XEVENTS @@ -960,7 +981,7 @@ static void X11_DispatchEvent(_THIS, XEvent *xevent) mouse->last_x = xevent->xcrossing.x; mouse->last_y = xevent->xcrossing.y; -#if SDL_VIDEO_DRIVER_X11_XFIXES +#ifdef SDL_VIDEO_DRIVER_X11_XFIXES { /* Only create the barriers if we have input focus */ SDL_WindowData *windowdata = (SDL_WindowData *)data->window->driverdata; @@ -1072,7 +1093,7 @@ static void X11_DispatchEvent(_THIS, XEvent *xevent) data->pending_focus_time = SDL_GetTicks() + PENDING_FOCUS_TIME; } -#if SDL_VIDEO_DRIVER_X11_XFIXES +#ifdef SDL_VIDEO_DRIVER_X11_XFIXES /* Disable confinement if it is activated. */ if (data->pointer_barrier_active == SDL_TRUE) { X11_ConfineCursorWithFlags(_this, data->window, NULL, X11_BARRIER_HANDLED_BY_EVENT); @@ -1159,7 +1180,7 @@ static void X11_DispatchEvent(_THIS, XEvent *xevent) X11_DispatchUnmapNotify(data); } -#if SDL_VIDEO_DRIVER_X11_XFIXES +#ifdef SDL_VIDEO_DRIVER_X11_XFIXES /* Disable confinement if the window gets hidden. */ if (data->pointer_barrier_active == SDL_TRUE) { X11_ConfineCursorWithFlags(_this, data->window, NULL, X11_BARRIER_HANDLED_BY_EVENT); @@ -1175,7 +1196,7 @@ static void X11_DispatchEvent(_THIS, XEvent *xevent) #endif X11_DispatchMapNotify(data); -#if SDL_VIDEO_DRIVER_X11_XFIXES +#ifdef SDL_VIDEO_DRIVER_X11_XFIXES /* Enable confinement if it was activated. */ if (data->pointer_barrier_active == SDL_TRUE) { X11_ConfineCursorWithFlags(_this, data->window, &data->barrier_rect, X11_BARRIER_HANDLED_BY_EVENT); @@ -1549,7 +1570,7 @@ static void X11_DispatchEvent(_THIS, XEvent *xevent) char *name = X11_XGetAtomName(display, target); if (name) { char *token = SDL_strtokr((char *)p.data, "\r\n", &saveptr); - while (token != NULL) { + while (token) { if (SDL_strcmp("text/plain", name) == 0) { SDL_SendDropText(data->window, token); } else if (SDL_strcmp("text/uri-list", name) == 0) { @@ -1717,7 +1738,7 @@ void X11_PumpEvents(_THIS) SDL_TICKS_PASSED(now, data->screensaver_activity + 30000)) { X11_XResetScreenSaver(data->display); -#if SDL_USE_LIBDBUS +#ifdef SDL_USE_LIBDBUS SDL_DBus_ScreensaverTickle(); #endif @@ -1753,13 +1774,13 @@ void X11_PumpEvents(_THIS) void X11_SuspendScreenSaver(_THIS) { -#if SDL_VIDEO_DRIVER_X11_XSCRNSAVER +#ifdef SDL_VIDEO_DRIVER_X11_XSCRNSAVER SDL_VideoData *data = (SDL_VideoData *)_this->driverdata; int dummy; int major_version, minor_version; #endif /* SDL_VIDEO_DRIVER_X11_XSCRNSAVER */ -#if SDL_USE_LIBDBUS +#ifdef SDL_USE_LIBDBUS if (SDL_DBus_ScreensaverInhibit(_this->suspend_screensaver)) { return; } @@ -1769,7 +1790,7 @@ void X11_SuspendScreenSaver(_THIS) } #endif -#if SDL_VIDEO_DRIVER_X11_XSCRNSAVER +#ifdef SDL_VIDEO_DRIVER_X11_XSCRNSAVER if (SDL_X11_HAVE_XSS) { /* X11_XScreenSaverSuspend was introduced in MIT-SCREEN-SAVER 1.1 */ if (!X11_XScreenSaverQueryExtension(data->display, &dummy, &dummy) || diff --git a/thirdparty/SDL/src/video/x11/SDL_x11events.h b/thirdparty/SDL/src/video/x11/SDL_x11events.h index 1c595f98b..cec823c0c 100644 --- a/thirdparty/SDL/src/video/x11/SDL_x11events.h +++ b/thirdparty/SDL/src/video/x11/SDL_x11events.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/x11/SDL_x11framebuffer.c b/thirdparty/SDL/src/video/x11/SDL_x11framebuffer.c index 403dbd338..0a63eda7c 100644 --- a/thirdparty/SDL/src/video/x11/SDL_x11framebuffer.c +++ b/thirdparty/SDL/src/video/x11/SDL_x11framebuffer.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_X11 +#ifdef SDL_VIDEO_DRIVER_X11 #include "SDL_x11video.h" #include "SDL_x11framebuffer.h" @@ -127,7 +127,7 @@ int X11_CreateWindowFramebuffer(_THIS, SDL_Window *window, Uint32 *format, #endif /* not NO_SHARED_MEMORY */ *pixels = SDL_malloc((size_t)h * (*pitch)); - if (*pixels == NULL) { + if (!*pixels) { return SDL_OutOfMemory(); } @@ -226,7 +226,7 @@ void X11_DestroyWindowFramebuffer(_THIS, SDL_Window *window) SDL_WindowData *data = (SDL_WindowData *)window->driverdata; Display *display; - if (data == NULL) { + if (!data) { /* The window wasn't fully initialized */ return; } diff --git a/thirdparty/SDL/src/video/x11/SDL_x11framebuffer.h b/thirdparty/SDL/src/video/x11/SDL_x11framebuffer.h index 033022335..f5fe14224 100644 --- a/thirdparty/SDL/src/video/x11/SDL_x11framebuffer.h +++ b/thirdparty/SDL/src/video/x11/SDL_x11framebuffer.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/x11/SDL_x11keyboard.c b/thirdparty/SDL/src/video/x11/SDL_x11keyboard.c index 12818ed69..9a23baf32 100644 --- a/thirdparty/SDL/src/video/x11/SDL_x11keyboard.c +++ b/thirdparty/SDL/src/video/x11/SDL_x11keyboard.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_X11 +#ifdef SDL_VIDEO_DRIVER_X11 #include "SDL_hints.h" #include "SDL_misc.h" @@ -100,7 +100,7 @@ X11_KeyCodeToSym(_THIS, KeyCode keycode, unsigned char group) SDL_VideoData *data = (SDL_VideoData *)_this->driverdata; KeySym keysym; -#if SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM +#ifdef SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM if (data->xkb) { int num_groups = XkbKeyNumGroups(data->xkb, keycode); unsigned char info = XkbKeyGroupInfo(data->xkb, keycode); @@ -155,7 +155,7 @@ int X11_InitKeyboard(_THIS) int distance; Bool xkb_repeat = 0; -#if SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM +#ifdef SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM { int xkb_major = XkbMajorVersion; int xkb_minor = XkbMinorVersion; @@ -347,7 +347,7 @@ void X11_UpdateKeymap(_THIS, SDL_bool send_event) SDL_GetDefaultKeymap(keymap); -#if SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM +#ifdef SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM if (data->xkb) { XkbStateRec state; X11_XkbGetUpdatedMap(data->display, XkbAllClientInfoMask, data->xkb); @@ -403,7 +403,7 @@ void X11_QuitKeyboard(_THIS) { SDL_VideoData *data = (SDL_VideoData *)_this->driverdata; -#if SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM +#ifdef SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM if (data->xkb) { X11_XkbFreeKeyboard(data->xkb, 0, True); data->xkb = NULL; @@ -451,7 +451,7 @@ void X11_StopTextInput(_THIS) void X11_SetTextInputRect(_THIS, const SDL_Rect *rect) { - if (rect == NULL) { + if (!rect) { SDL_InvalidParamError("rect"); return; } diff --git a/thirdparty/SDL/src/video/x11/SDL_x11keyboard.h b/thirdparty/SDL/src/video/x11/SDL_x11keyboard.h index c6be19c0e..53cf51253 100644 --- a/thirdparty/SDL/src/video/x11/SDL_x11keyboard.h +++ b/thirdparty/SDL/src/video/x11/SDL_x11keyboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/x11/SDL_x11messagebox.c b/thirdparty/SDL/src/video/x11/SDL_x11messagebox.c index 12e40f46d..0e3b67af1 100644 --- a/thirdparty/SDL/src/video/x11/SDL_x11messagebox.c +++ b/thirdparty/SDL/src/video/x11/SDL_x11messagebox.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,7 +21,7 @@ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_X11 +#ifdef SDL_VIDEO_DRIVER_X11 #include "SDL.h" #include "SDL_x11video.h" @@ -84,7 +84,7 @@ typedef struct SDL_MessageBoxDataX11 Display *display; int screen; Window window; -#if SDL_VIDEO_DRIVER_X11_XDBE +#ifdef SDL_VIDEO_DRIVER_X11_XDBE XdbeBackBuffer buf; SDL_bool xdbe; /* Whether Xdbe is present or not */ #endif @@ -191,15 +191,15 @@ static int X11_MessageBoxInit(SDL_MessageBoxDataX11 *data, const SDL_MessageBoxD int num_missing = 0; data->font_set = X11_XCreateFontSet(data->display, g_MessageBoxFont, &missing, &num_missing, NULL); - if (missing != NULL) { + if (missing) { X11_XFreeStringList(missing); } - if (data->font_set == NULL) { + if (!data->font_set) { return SDL_SetError("Couldn't load font %s", g_MessageBoxFont); } } else { data->font_struct = X11_XLoadQueryFont(data->display, g_MessageBoxFontLatin1); - if (data->font_struct == NULL) { + if (!data->font_struct) { return SDL_SetError("Couldn't load font %s", g_MessageBoxFontLatin1); } } @@ -240,12 +240,12 @@ static int X11_MessageBoxInitPositions(SDL_MessageBoxDataX11 *data) const SDL_MessageBoxData *messageboxdata = data->messageboxdata; /* Go over text and break linefeeds into separate lines. */ - if (messageboxdata != NULL && messageboxdata->message[0]) { + if (messageboxdata && messageboxdata->message[0]) { const char *text = messageboxdata->message; const int linecount = CountLinesOfText(text); TextLineData *plinedata = (TextLineData *)SDL_malloc(sizeof(TextLineData) * linecount); - if (plinedata == NULL) { + if (!plinedata) { return SDL_OutOfMemory(); } @@ -273,7 +273,7 @@ static int X11_MessageBoxInitPositions(SDL_MessageBoxDataX11 *data) text += length + 1; /* Break if there are no more linefeeds. */ - if (lf == NULL) { + if (!lf) { break; } } @@ -362,17 +362,17 @@ static int X11_MessageBoxInitPositions(SDL_MessageBoxDataX11 *data) /* Free SDL_MessageBoxData data. */ static void X11_MessageBoxShutdown(SDL_MessageBoxDataX11 *data) { - if (data->font_set != NULL) { + if (data->font_set) { X11_XFreeFontSet(data->display, data->font_set); data->font_set = NULL; } - if (data->font_struct != NULL) { + if (data->font_struct) { X11_XFreeFont(data->display, data->font_struct); data->font_struct = NULL; } -#if SDL_VIDEO_DRIVER_X11_XDBE +#ifdef SDL_VIDEO_DRIVER_X11_XDBE if (SDL_X11_HAVE_XDBE && data->xdbe) { X11_XdbeDeallocateBackBufferName(data->display, data->buf); } @@ -499,7 +499,7 @@ static int X11_MessageBoxCreateWindow(SDL_MessageBoxDataX11 *data) X11_XMapRaised(display, data->window); -#if SDL_VIDEO_DRIVER_X11_XDBE +#ifdef SDL_VIDEO_DRIVER_X11_XDBE /* Initialise a back buffer for double buffering */ if (SDL_X11_HAVE_XDBE) { int xdbe_major, xdbe_minor; @@ -522,7 +522,7 @@ static void X11_MessageBoxDraw(SDL_MessageBoxDataX11 *data, GC ctx) Drawable window = data->window; Display *display = data->display; -#if SDL_VIDEO_DRIVER_X11_XDBE +#ifdef SDL_VIDEO_DRIVER_X11_XDBE if (SDL_X11_HAVE_XDBE && data->xdbe) { window = data->buf; X11_XdbeBeginIdiom(data->display); @@ -577,7 +577,7 @@ static void X11_MessageBoxDraw(SDL_MessageBoxDataX11 *data, GC ctx) } } -#if SDL_VIDEO_DRIVER_X11_XDBE +#ifdef SDL_VIDEO_DRIVER_X11_XDBE if (SDL_X11_HAVE_XDBE && data->xdbe) { XdbeSwapInfo swap_info; swap_info.swap_window = data->window; @@ -762,9 +762,9 @@ static int X11_ShowMessageBoxImpl(const SDL_MessageBoxData *messageboxdata, int #if SDL_SET_LOCALE origlocale = setlocale(LC_ALL, NULL); - if (origlocale != NULL) { + if (origlocale) { origlocale = SDL_strdup(origlocale); - if (origlocale == NULL) { + if (!origlocale) { return SDL_OutOfMemory(); } (void)setlocale(LC_ALL, ""); diff --git a/thirdparty/SDL/src/video/x11/SDL_x11messagebox.h b/thirdparty/SDL/src/video/x11/SDL_x11messagebox.h index 8e4cc0338..16759798f 100644 --- a/thirdparty/SDL/src/video/x11/SDL_x11messagebox.h +++ b/thirdparty/SDL/src/video/x11/SDL_x11messagebox.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -22,7 +22,7 @@ #ifndef SDL_x11messagebox_h_ #define SDL_x11messagebox_h_ -#if SDL_VIDEO_DRIVER_X11 +#ifdef SDL_VIDEO_DRIVER_X11 extern int X11_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid); diff --git a/thirdparty/SDL/src/video/x11/SDL_x11modes.c b/thirdparty/SDL/src/video/x11/SDL_x11modes.c index e3c24b24b..35c02e304 100644 --- a/thirdparty/SDL/src/video/x11/SDL_x11modes.c +++ b/thirdparty/SDL/src/video/x11/SDL_x11modes.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_X11 +#ifdef SDL_VIDEO_DRIVER_X11 #include "SDL_hints.h" #include "SDL_x11video.h" @@ -144,7 +144,7 @@ Uint32 X11_GetPixelFormatFromVisualInfo(Display *display, XVisualInfo *vinfo) return SDL_PIXELFORMAT_UNKNOWN; } -#if SDL_VIDEO_DRIVER_X11_XRANDR +#ifdef SDL_VIDEO_DRIVER_X11_XRANDR static SDL_bool CheckXRandR(Display *display, int *major, int *minor) { /* Default the extension not available */ @@ -323,7 +323,7 @@ static int X11_AddXRandRDisplay(_THIS, Display *dpy, int screen, RROutput output } output_info = X11_XRRGetOutputInfo(dpy, res, outputid); - if (output_info == NULL || !output_info->crtc || output_info->connection == RR_Disconnected) { + if (!output_info || !output_info->crtc || output_info->connection == RR_Disconnected) { X11_XRRFreeOutputInfo(output_info); return 0; /* ignore this one. */ } @@ -335,7 +335,7 @@ static int X11_AddXRandRDisplay(_THIS, Display *dpy, int screen, RROutput output X11_XRRFreeOutputInfo(output_info); crtc = X11_XRRGetCrtcInfo(dpy, res, output_crtc); - if (crtc == NULL) { + if (!crtc) { return 0; /* oh well, ignore it. */ } @@ -351,12 +351,12 @@ static int X11_AddXRandRDisplay(_THIS, Display *dpy, int screen, RROutput output X11_XRRFreeCrtcInfo(crtc); displaydata = (SDL_DisplayData *)SDL_calloc(1, sizeof(*displaydata)); - if (displaydata == NULL) { + if (!displaydata) { return SDL_OutOfMemory(); } modedata = (SDL_DisplayModeData *)SDL_calloc(1, sizeof(SDL_DisplayModeData)); - if (modedata == NULL) { + if (!modedata) { SDL_free(displaydata); return SDL_OutOfMemory(); } @@ -413,11 +413,11 @@ static void X11_HandleXRandROutputChange(_THIS, const XRROutputChangeNotifyEvent SDL_assert((displayidx == -1) == (display == NULL)); if (ev->connection == RR_Disconnected) { /* output is going away */ - if (display != NULL) { + if (display) { SDL_DelVideoDisplay(displayidx); } } else if (ev->connection == RR_Connected) { /* output is coming online */ - if (display != NULL) { + if (display) { /* !!! FIXME: update rotation or current mode of existing display? */ } else { Display *dpy = ev->display; @@ -425,7 +425,7 @@ static void X11_HandleXRandROutputChange(_THIS, const XRROutputChangeNotifyEvent XVisualInfo vinfo; if (get_visualinfo(dpy, screen, &vinfo) == 0) { XRRScreenResources *res = X11_XRRGetScreenResourcesCurrent(dpy, RootWindow(dpy, screen)); - if (res == NULL || res->noutput == 0) { + if (!res || res->noutput == 0) { if (res) { X11_XRRFreeScreenResources(res); } @@ -481,13 +481,13 @@ static int X11_InitModes_XRandR(_THIS) } res = X11_XRRGetScreenResourcesCurrent(dpy, RootWindow(dpy, screen)); - if (res == NULL || res->noutput == 0) { + if (!res || res->noutput == 0) { if (res) { X11_XRRFreeScreenResources(res); } res = X11_XRRGetScreenResources(dpy, RootWindow(dpy, screen)); - if (res == NULL) { + if (!res) { continue; } } @@ -525,7 +525,7 @@ static int GetXftDPI(Display *dpy) xdefault_resource = X11_XGetDefault(dpy, "Xft", "dpi"); - if (xdefault_resource == NULL) { + if (!xdefault_resource) { return 0; } @@ -578,12 +578,12 @@ static int X11_InitModes_StdXlib(_THIS) mode.refresh_rate = 0; /* don't know it, sorry. */ displaydata = (SDL_DisplayData *)SDL_calloc(1, sizeof(*displaydata)); - if (displaydata == NULL) { + if (!displaydata) { return SDL_OutOfMemory(); } modedata = (SDL_DisplayModeData *)SDL_calloc(1, sizeof(SDL_DisplayModeData)); - if (modedata == NULL) { + if (!modedata) { SDL_free(displaydata); return SDL_OutOfMemory(); } @@ -637,7 +637,7 @@ int X11_InitModes(_THIS) /* XRandR is the One True Modern Way to do this on X11. If this fails, we just won't report any display modes except the current desktop size. */ -#if SDL_VIDEO_DRIVER_X11_XRANDR +#ifdef SDL_VIDEO_DRIVER_X11_XRANDR { SDL_VideoData *data = (SDL_VideoData *)_this->driverdata; int xrandr_major, xrandr_minor; @@ -668,7 +668,7 @@ void X11_GetDisplayModes(_THIS, SDL_VideoDisplay *sdl_display) mode.format = sdl_display->current_mode.format; mode.driverdata = NULL; -#if SDL_VIDEO_DRIVER_X11_XRANDR +#ifdef SDL_VIDEO_DRIVER_X11_XRANDR if (data->use_xrandr) { Display *display = ((SDL_VideoData *)_this->driverdata)->display; XRRScreenResources *res; @@ -683,7 +683,7 @@ void X11_GetDisplayModes(_THIS, SDL_VideoDisplay *sdl_display) if (output_info && output_info->connection != RR_Disconnected) { for (i = 0; i < output_info->nmode; ++i) { modedata = (SDL_DisplayModeData *)SDL_calloc(1, sizeof(SDL_DisplayModeData)); - if (modedata == NULL) { + if (!modedata) { continue; } mode.driverdata = modedata; @@ -716,7 +716,7 @@ void X11_GetDisplayModes(_THIS, SDL_VideoDisplay *sdl_display) } } -#if SDL_VIDEO_DRIVER_X11_XRANDR +#ifdef SDL_VIDEO_DRIVER_X11_XRANDR /* This catches an error from XRRSetScreenSize, as a workaround for now. */ /* !!! FIXME: remove this later when we have a better solution. */ static int (*PreXRRSetScreenSizeErrorHandler)(Display *, XErrorEvent *) = NULL; @@ -739,7 +739,7 @@ int X11_SetDisplayMode(_THIS, SDL_VideoDisplay *sdl_display, SDL_DisplayMode *mo viddata->last_mode_change_deadline = SDL_GetTicks() + (PENDING_FOCUS_TIME * 2); -#if SDL_VIDEO_DRIVER_X11_XRANDR +#ifdef SDL_VIDEO_DRIVER_X11_XRANDR if (data->use_xrandr) { Display *display = viddata->display; SDL_DisplayModeData *modedata = (SDL_DisplayModeData *)mode->driverdata; @@ -750,18 +750,18 @@ int X11_SetDisplayMode(_THIS, SDL_VideoDisplay *sdl_display, SDL_DisplayMode *mo Status status; res = X11_XRRGetScreenResources(display, RootWindow(display, data->screen)); - if (res == NULL) { + if (!res) { return SDL_SetError("Couldn't get XRandR screen resources"); } output_info = X11_XRRGetOutputInfo(display, res, data->xrandr_output); - if (output_info == NULL || output_info->connection == RR_Disconnected) { + if (!output_info || output_info->connection == RR_Disconnected) { X11_XRRFreeScreenResources(res); return SDL_SetError("Couldn't get XRandR output info"); } crtc = X11_XRRGetCrtcInfo(display, res, output_info->crtc); - if (crtc == NULL) { + if (!crtc) { X11_XRRFreeOutputInfo(output_info); X11_XRRFreeScreenResources(res); return SDL_SetError("Couldn't get XRandR crtc info"); diff --git a/thirdparty/SDL/src/video/x11/SDL_x11modes.h b/thirdparty/SDL/src/video/x11/SDL_x11modes.h index 178c7277c..8c6c1c24e 100644 --- a/thirdparty/SDL/src/video/x11/SDL_x11modes.h +++ b/thirdparty/SDL/src/video/x11/SDL_x11modes.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -37,14 +37,14 @@ typedef struct SDL_bool use_xrandr; -#if SDL_VIDEO_DRIVER_X11_XRANDR +#ifdef SDL_VIDEO_DRIVER_X11_XRANDR RROutput xrandr_output; #endif } SDL_DisplayData; typedef struct { -#if SDL_VIDEO_DRIVER_X11_XRANDR +#ifdef SDL_VIDEO_DRIVER_X11_XRANDR RRMode xrandr_mode; #else int unused; /* just so struct isn't empty. */ @@ -65,7 +65,7 @@ extern int X11_GetDisplayBounds(_THIS, SDL_VideoDisplay *sdl_display, SDL_Rect * extern int X11_GetDisplayUsableBounds(_THIS, SDL_VideoDisplay *sdl_display, SDL_Rect *rect); extern int X11_GetDisplayDPI(_THIS, SDL_VideoDisplay *sdl_display, float *ddpi, float *hdpi, float *vdpi); -#if SDL_VIDEO_DRIVER_X11_XRANDR +#ifdef SDL_VIDEO_DRIVER_X11_XRANDR extern void X11_HandleXRandREvent(_THIS, const XEvent *xevent); #endif diff --git a/thirdparty/SDL/src/video/x11/SDL_x11mouse.c b/thirdparty/SDL/src/video/x11/SDL_x11mouse.c index 7c3d20216..5048cd01b 100644 --- a/thirdparty/SDL/src/video/x11/SDL_x11mouse.c +++ b/thirdparty/SDL/src/video/x11/SDL_x11mouse.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_X11 +#ifdef SDL_VIDEO_DRIVER_X11 #include #include "SDL_x11video.h" @@ -30,6 +30,7 @@ /* FIXME: Find a better place to put this... */ static Cursor x11_empty_cursor = None; +static SDL_bool x11_cursor_visible = SDL_TRUE; static Display *GetDisplay(void) { @@ -80,7 +81,7 @@ static SDL_Cursor *X11_CreateDefaultCursor() return cursor; } -#if SDL_VIDEO_DRIVER_X11_XCURSOR +#ifdef SDL_VIDEO_DRIVER_X11_XCURSOR static Cursor X11_CreateXCursorCursor(SDL_Surface *surface, int hot_x, int hot_y) { Display *display = GetDisplay(); @@ -88,7 +89,7 @@ static Cursor X11_CreateXCursorCursor(SDL_Surface *surface, int hot_x, int hot_y XcursorImage *image; image = X11_XcursorImageCreate(surface->w, surface->h); - if (image == NULL) { + if (!image) { SDL_OutOfMemory(); return None; } @@ -121,13 +122,13 @@ static Cursor X11_CreatePixmapCursor(SDL_Surface *surface, int hot_x, int hot_y) size_t width_bytes = ((surface->w + 7) & ~((size_t)7)) / 8; data_bits = SDL_calloc(1, surface->h * width_bytes); - if (data_bits == NULL) { + if (!data_bits) { SDL_OutOfMemory(); return None; } mask_bits = SDL_calloc(1, surface->h * width_bytes); - if (mask_bits == NULL) { + if (!mask_bits) { SDL_free(data_bits); SDL_OutOfMemory(); return None; @@ -204,7 +205,7 @@ static SDL_Cursor *X11_CreateCursor(SDL_Surface *surface, int hot_x, int hot_y) if (cursor) { Cursor x11_cursor = None; -#if SDL_VIDEO_DRIVER_X11_XCURSOR +#ifdef SDL_VIDEO_DRIVER_X11_XCURSOR if (SDL_X11_HAVE_XCURSOR) { x11_cursor = X11_CreateXCursorCursor(surface, hot_x, hot_y); } @@ -220,64 +221,53 @@ static SDL_Cursor *X11_CreateCursor(SDL_Surface *surface, int hot_x, int hot_y) return cursor; } -static SDL_Cursor *X11_CreateSystemCursor(SDL_SystemCursor id) +static unsigned int GetLegacySystemCursorShape(SDL_SystemCursor id) { - SDL_Cursor *cursor; - unsigned int shape; - switch (id) { - default: - SDL_assert(0); - return NULL; - /* X Font Cursors reference: */ - /* http://tronche.com/gui/x/xlib/appendix/b/ */ - case SDL_SYSTEM_CURSOR_ARROW: - shape = XC_left_ptr; - break; - case SDL_SYSTEM_CURSOR_IBEAM: - shape = XC_xterm; - break; - case SDL_SYSTEM_CURSOR_WAIT: - shape = XC_watch; - break; - case SDL_SYSTEM_CURSOR_CROSSHAIR: - shape = XC_tcross; - break; - case SDL_SYSTEM_CURSOR_WAITARROW: - shape = XC_watch; - break; - case SDL_SYSTEM_CURSOR_SIZENWSE: - shape = XC_top_left_corner; - break; - case SDL_SYSTEM_CURSOR_SIZENESW: - shape = XC_top_right_corner; - break; - case SDL_SYSTEM_CURSOR_SIZEWE: - shape = XC_sb_h_double_arrow; - break; - case SDL_SYSTEM_CURSOR_SIZENS: - shape = XC_sb_v_double_arrow; - break; - case SDL_SYSTEM_CURSOR_SIZEALL: - shape = XC_fleur; - break; - case SDL_SYSTEM_CURSOR_NO: - shape = XC_pirate; - break; - case SDL_SYSTEM_CURSOR_HAND: - shape = XC_hand2; - break; + /* X Font Cursors reference: */ + /* http://tronche.com/gui/x/xlib/appendix/b/ */ + case SDL_SYSTEM_CURSOR_ARROW: return XC_left_ptr; + case SDL_SYSTEM_CURSOR_IBEAM: return XC_xterm; + case SDL_SYSTEM_CURSOR_WAIT: return XC_watch; + case SDL_SYSTEM_CURSOR_CROSSHAIR: return XC_tcross; + case SDL_SYSTEM_CURSOR_WAITARROW: return XC_watch; + case SDL_SYSTEM_CURSOR_SIZENWSE: return XC_top_left_corner; + case SDL_SYSTEM_CURSOR_SIZENESW: return XC_top_right_corner; + case SDL_SYSTEM_CURSOR_SIZEWE: return XC_sb_h_double_arrow; + case SDL_SYSTEM_CURSOR_SIZENS: return XC_sb_v_double_arrow; + case SDL_SYSTEM_CURSOR_SIZEALL: return XC_fleur; + case SDL_SYSTEM_CURSOR_NO: return XC_pirate; + case SDL_SYSTEM_CURSOR_HAND: return XC_hand2; + case SDL_NUM_SYSTEM_CURSORS: break; /* so the compiler might notice if an enum value is missing here. */ } - cursor = SDL_calloc(1, sizeof(*cursor)); - if (cursor) { - Cursor x11_cursor; + SDL_assert(0); + return 0; +} - x11_cursor = X11_XCreateFontCursor(GetDisplay(), shape); +static SDL_Cursor *X11_CreateSystemCursor(SDL_SystemCursor id) +{ + SDL_Cursor *cursor = NULL; + Display *dpy = GetDisplay(); + Cursor x11_cursor = None; - cursor->driverdata = (void *)(uintptr_t)x11_cursor; - } else { - SDL_OutOfMemory(); +#ifdef SDL_VIDEO_DRIVER_X11_XCURSOR + if (SDL_X11_HAVE_XCURSOR) { + x11_cursor = X11_XcursorLibraryLoadCursor(dpy, SDL_GetCSSCursorName(id, NULL)); + } +#endif + + if (x11_cursor == None) { + x11_cursor = X11_XCreateFontCursor(dpy, GetLegacySystemCursorShape(id)); + } + + if (x11_cursor != None) { + cursor = SDL_calloc(1, sizeof(*cursor)); + if (!cursor) { + SDL_OutOfMemory(); + } else { + cursor->driverdata = (void *)(uintptr_t)x11_cursor; + } } return cursor; @@ -309,6 +299,8 @@ static int X11_ShowCursor(SDL_Cursor *cursor) Display *display = GetDisplay(); SDL_Window *window; + x11_cursor_visible = !!cursor; + for (window = video->windows; window; window = window->next) { SDL_WindowData *data = (SDL_WindowData *)window->driverdata; if (data) { @@ -328,8 +320,20 @@ static void WarpMouseInternal(Window xwindow, const int x, const int y) { SDL_VideoData *videodata = (SDL_VideoData *)SDL_GetVideoDevice()->driverdata; Display *display = videodata->display; -#if SDL_VIDEO_DRIVER_X11_XINPUT2 +#ifdef SDL_VIDEO_DRIVER_X11_XINPUT2 int deviceid = 0; +#endif + SDL_bool warp_hack = SDL_FALSE; + + /* XWayland will only warp the cursor if it is hidden, so this workaround is required. */ + if (videodata->is_xwayland && x11_cursor_visible) { + warp_hack = SDL_TRUE; + } + + if (warp_hack) { + X11_ShowCursor(NULL); + } +#ifdef SDL_VIDEO_DRIVER_X11_XINPUT2 if (X11_Xinput2IsInitialized()) { /* It seems XIWarpPointer() doesn't work correctly on multi-head setups: * https://developer.blender.org/rB165caafb99c6846e53d11c4e966990aaffc06cea @@ -346,6 +350,10 @@ static void WarpMouseInternal(Window xwindow, const int x, const int y) { X11_XWarpPointer(display, None, xwindow, 0, 0, 0, 0, x, y); } + + if (warp_hack) { + X11_ShowCursor(SDL_GetCursor()); + } X11_XSync(display, False); videodata->global_mouse_changed = SDL_TRUE; } @@ -354,7 +362,7 @@ static void X11_WarpMouse(SDL_Window *window, int x, int y) { SDL_WindowData *data = (SDL_WindowData *)window->driverdata; -#if SDL_VIDEO_DRIVER_X11_XFIXES +#ifdef SDL_VIDEO_DRIVER_X11_XFIXES /* If we have no barrier, we need to warp */ if (data->pointer_barrier_active == SDL_FALSE) { WarpMouseInternal(data->xwindow, x, y); @@ -419,7 +427,7 @@ static Uint32 X11_GetGlobalMouseState(int *x, int *y) if (videodata->global_mouse_changed) { for (i = 0; i < num_screens; i++) { SDL_DisplayData *data = (SDL_DisplayData *)SDL_GetDisplayDriverData(i); - if (data != NULL) { + if (data) { Window root, child; int rootx, rooty, winx, winy; unsigned int mask; @@ -476,7 +484,7 @@ void X11_QuitMouse(_THIS) SDL_XInput2DeviceInfo *i; SDL_XInput2DeviceInfo *next; - for (i = data->mouse_device_info; i != NULL; i = next) { + for (i = data->mouse_device_info; i; i = next) { next = i->next; SDL_free(i); } @@ -486,5 +494,3 @@ void X11_QuitMouse(_THIS) } #endif /* SDL_VIDEO_DRIVER_X11 */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/thirdparty/SDL/src/video/x11/SDL_x11mouse.h b/thirdparty/SDL/src/video/x11/SDL_x11mouse.h index 0a7f165b1..5cccd31d4 100644 --- a/thirdparty/SDL/src/video/x11/SDL_x11mouse.h +++ b/thirdparty/SDL/src/video/x11/SDL_x11mouse.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/x11/SDL_x11opengl.c b/thirdparty/SDL/src/video/x11/SDL_x11opengl.c index 3e95d8d85..da252615f 100644 --- a/thirdparty/SDL/src/video/x11/SDL_x11opengl.c +++ b/thirdparty/SDL/src/video/x11/SDL_x11opengl.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga Copyright (C) 2021 NVIDIA Corporation This software is provided 'as-is', without any express or implied @@ -21,14 +21,14 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_X11 +#ifdef SDL_VIDEO_DRIVER_X11 #include "SDL_x11video.h" #include "SDL_hints.h" /* GLX implementation of SDL OpenGL support */ -#if SDL_VIDEO_OPENGL_GLX +#ifdef SDL_VIDEO_OPENGL_GLX #include "SDL_loadso.h" #include "SDL_x11opengles.h" @@ -241,6 +241,8 @@ int X11_GL_LoadLibrary(_THIS, const char *path) return SDL_SetError("GLX is not supported"); } + _this->gl_data->swap_interval_tear_behavior = SDL_SWAPINTERVALTEAR_UNTESTED; + /* Initialize extensions */ /* See lengthy comment about the inc/dec in ../windows/SDL_windowsopengl.c. */ @@ -254,7 +256,7 @@ int X11_GL_LoadLibrary(_THIS, const char *path) if (((_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES) || SDL_GetHintBoolean(SDL_HINT_VIDEO_X11_FORCE_EGL, SDL_FALSE)) && X11_GL_UseEGL(_this) ) { -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL X11_GL_UnloadLibrary(_this); _this->GL_LoadLibrary = X11_GLES_LoadLibrary; _this->GL_GetProcAddress = X11_GLES_GetProcAddress; @@ -573,6 +575,7 @@ static int X11_GL_GetAttributes(_THIS, Display *display, int screen, int *attrib } if (_this->gl_config.floatbuffers) { + attribs[i++] = GLX_RENDER_TYPE; attribs[i++] = GLX_RGBA_FLOAT_TYPE_ARB; } @@ -889,7 +892,6 @@ int X11_GL_SetSwapInterval(_THIS, int interval) int currentInterval = X11_GL_GetSwapInterval(_this); _this->gl_data->glXSwapIntervalEXT(display, drawable, currentInterval); _this->gl_data->glXSwapIntervalEXT(display, drawable, interval); - status = 0; swapinterval = interval; } else if (_this->gl_data->glXSwapIntervalMESA) { @@ -912,6 +914,53 @@ int X11_GL_SetSwapInterval(_THIS, int interval) return status; } +static SDL_GLSwapIntervalTearBehavior CheckSwapIntervalTearBehavior(SDL_VideoDevice *_this, Window drawable, unsigned int current_val, unsigned int current_allow_late) +{ + /* Mesa and Nvidia interpret GLX_EXT_swap_control_tear differently, as of this writing, so + figure out which behavior we have. + Technical details: https://github.com/libsdl-org/SDL/issues/8004#issuecomment-1819603282 */ + if (_this->gl_data->swap_interval_tear_behavior == SDL_SWAPINTERVALTEAR_UNTESTED) { + if (!_this->gl_data->HAS_GLX_EXT_swap_control_tear) { + _this->gl_data->swap_interval_tear_behavior = SDL_SWAPINTERVALTEAR_UNKNOWN; + } else { + Display *display = ((SDL_VideoData *)_this->driverdata)->display; + unsigned int allow_late_swap_tearing = 22; + int original_val = (int) current_val; + + /* + * This is a workaround for a bug in NVIDIA drivers. Bug has been reported + * and will be fixed in a future release (probably 319.xx). + * + * There's a bug where glXSetSwapIntervalEXT ignores updates because + * it has the wrong value cached. To work around it, we just run a no-op + * update to the current value. + */ + _this->gl_data->glXSwapIntervalEXT(display, drawable, current_val); + + /* set it to no swap interval and see how it affects GLX_LATE_SWAPS_TEAR_EXT... */ + _this->gl_data->glXSwapIntervalEXT(display, drawable, 0); + _this->gl_data->glXQueryDrawable(display, drawable, GLX_LATE_SWAPS_TEAR_EXT, &allow_late_swap_tearing); + + if (allow_late_swap_tearing == 0) { /* GLX_LATE_SWAPS_TEAR_EXT says whether late swapping is currently in use */ + _this->gl_data->swap_interval_tear_behavior = SDL_SWAPINTERVALTEAR_NVIDIA; + if (current_allow_late) { + original_val = -original_val; + } + } else if (allow_late_swap_tearing == 1) { /* GLX_LATE_SWAPS_TEAR_EXT says whether the Drawable can use late swapping at all */ + _this->gl_data->swap_interval_tear_behavior = SDL_SWAPINTERVALTEAR_MESA; + } else { /* unexpected outcome! */ + _this->gl_data->swap_interval_tear_behavior = SDL_SWAPINTERVALTEAR_UNKNOWN; + } + + /* set us back to what it was originally... */ + _this->gl_data->glXSwapIntervalEXT(display, drawable, original_val); + } + } + + return _this->gl_data->swap_interval_tear_behavior; +} + + int X11_GL_GetSwapInterval(_THIS) { if (_this->gl_data->glXSwapIntervalEXT) { @@ -924,6 +973,7 @@ int X11_GL_GetSwapInterval(_THIS) unsigned int interval = 0; if (_this->gl_data->HAS_GLX_EXT_swap_control_tear) { + allow_late_swap_tearing = 22; /* set this to nonsense. */ _this->gl_data->glXQueryDrawable(display, drawable, GLX_LATE_SWAPS_TEAR_EXT, &allow_late_swap_tearing); @@ -932,11 +982,19 @@ int X11_GL_GetSwapInterval(_THIS) _this->gl_data->glXQueryDrawable(display, drawable, GLX_SWAP_INTERVAL_EXT, &interval); - if ((allow_late_swap_tearing) && (interval > 0)) { - return -((int)interval); + switch (CheckSwapIntervalTearBehavior(_this, drawable, interval, allow_late_swap_tearing)) { + case SDL_SWAPINTERVALTEAR_MESA: + return (int)interval; /* unsigned int cast to signed that generates negative value if necessary. */ + + case SDL_SWAPINTERVALTEAR_NVIDIA: + default: + if ((allow_late_swap_tearing) && (interval > 0)) { + return -((int)interval); + } + return (int)interval; } - return (int)interval; + return (int)interval; /* shouldn't hit this, but just in case. */ } else if (_this->gl_data->glXGetSwapIntervalMESA) { return _this->gl_data->glXGetSwapIntervalMESA(); } else { diff --git a/thirdparty/SDL/src/video/x11/SDL_x11opengl.h b/thirdparty/SDL/src/video/x11/SDL_x11opengl.h index a3413982d..e0e8e195d 100644 --- a/thirdparty/SDL/src/video/x11/SDL_x11opengl.h +++ b/thirdparty/SDL/src/video/x11/SDL_x11opengl.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -23,10 +23,18 @@ #ifndef SDL_x11opengl_h_ #define SDL_x11opengl_h_ -#if SDL_VIDEO_OPENGL_GLX +#ifdef SDL_VIDEO_OPENGL_GLX #include "SDL_opengl.h" #include +typedef enum SDL_GLSwapIntervalTearBehavior +{ + SDL_SWAPINTERVALTEAR_UNTESTED, + SDL_SWAPINTERVALTEAR_UNKNOWN, + SDL_SWAPINTERVALTEAR_MESA, + SDL_SWAPINTERVALTEAR_NVIDIA +} SDL_GLSwapIntervalTearBehavior; + struct SDL_GLDriverData { int errorBase, eventBase; @@ -48,6 +56,8 @@ struct SDL_GLDriverData int minor; } es_profile_max_supported_version; + SDL_GLSwapIntervalTearBehavior swap_interval_tear_behavior; + Bool (*glXQueryExtension)(Display *, int *, int *); void *(*glXGetProcAddress)(const GLubyte *); XVisualInfo *(*glXChooseVisual)(Display *, int, int *); diff --git a/thirdparty/SDL/src/video/x11/SDL_x11opengles.c b/thirdparty/SDL/src/video/x11/SDL_x11opengles.c index 4d38a71e8..ad1e26b1f 100644 --- a/thirdparty/SDL/src/video/x11/SDL_x11opengles.c +++ b/thirdparty/SDL/src/video/x11/SDL_x11opengles.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_X11 && SDL_VIDEO_OPENGL_EGL +#if defined(SDL_VIDEO_DRIVER_X11) && defined(SDL_VIDEO_OPENGL_EGL) #include "SDL_hints.h" #include "SDL_x11video.h" @@ -36,7 +36,7 @@ int X11_GLES_LoadLibrary(_THIS, const char *path) /* If the profile requested is not GL ES, switch over to X11_GL functions */ if ((_this->gl_config.profile_mask != SDL_GL_CONTEXT_PROFILE_ES) && !SDL_GetHintBoolean(SDL_HINT_VIDEO_X11_FORCE_EGL, SDL_FALSE)) { - #if SDL_VIDEO_OPENGL_GLX + #ifdef SDL_VIDEO_OPENGL_GLX X11_GLES_UnloadLibrary(_this); _this->GL_LoadLibrary = X11_GL_LoadLibrary; _this->GL_GetProcAddress = X11_GL_GetProcAddress; diff --git a/thirdparty/SDL/src/video/x11/SDL_x11opengles.h b/thirdparty/SDL/src/video/x11/SDL_x11opengles.h index cd5bfba0a..23530d854 100644 --- a/thirdparty/SDL/src/video/x11/SDL_x11opengles.h +++ b/thirdparty/SDL/src/video/x11/SDL_x11opengles.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -23,7 +23,7 @@ #ifndef SDL_x11opengles_h_ #define SDL_x11opengles_h_ -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL #include "../SDL_sysvideo.h" #include "../SDL_egl_c.h" diff --git a/thirdparty/SDL/src/video/x11/SDL_x11shape.c b/thirdparty/SDL/src/video/x11/SDL_x11shape.c index 4a8d9462f..fee1c7aa8 100644 --- a/thirdparty/SDL/src/video/x11/SDL_x11shape.c +++ b/thirdparty/SDL/src/video/x11/SDL_x11shape.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_X11 +#ifdef SDL_VIDEO_DRIVER_X11 #include "SDL_x11video.h" #include "SDL_x11shape.h" @@ -30,12 +30,12 @@ SDL_WindowShaper *X11_CreateShaper(SDL_Window *window) { SDL_WindowShaper *result = NULL; - SDL_ShapeData *data = NULL; -#if SDL_VIDEO_DRIVER_X11_XSHAPE +#ifdef SDL_VIDEO_DRIVER_X11_XSHAPE + SDL_ShapeData *data = NULL; if (SDL_X11_HAVE_XSHAPE) { /* Make sure X server supports it. */ result = SDL_malloc(sizeof(SDL_WindowShaper)); - if (result == NULL) { + if (!result) { SDL_OutOfMemory(); return NULL; } @@ -44,7 +44,7 @@ SDL_WindowShaper *X11_CreateShaper(SDL_Window *window) result->mode.parameters.binarizationCutoff = 1; result->userx = result->usery = 0; data = SDL_malloc(sizeof(SDL_ShapeData)); - if (data == NULL) { + if (!data) { SDL_free(result); SDL_OutOfMemory(); return NULL; @@ -75,11 +75,11 @@ int X11_ResizeWindowShape(SDL_Window *window) bitmapsize += 1; } bitmapsize *= window->h; - if (data->bitmapsize != bitmapsize || data->bitmap == NULL) { + if (data->bitmapsize != bitmapsize || !data->bitmap) { data->bitmapsize = bitmapsize; SDL_free(data->bitmap); data->bitmap = SDL_malloc(data->bitmapsize); - if (data->bitmap == NULL) { + if (!data->bitmap) { return SDL_OutOfMemory(); } } @@ -94,15 +94,17 @@ int X11_ResizeWindowShape(SDL_Window *window) int X11_SetWindowShape(SDL_WindowShaper *shaper, SDL_Surface *shape, SDL_WindowShapeMode *shape_mode) { +#ifdef SDL_VIDEO_DRIVER_X11_XSHAPE SDL_ShapeData *data = NULL; SDL_WindowData *windowdata = NULL; Pixmap shapemask; +#endif - if (shaper == NULL || shape == NULL || shaper->driverdata == NULL) { + if (!shaper || !shape || !shaper->driverdata) { return -1; } -#if SDL_VIDEO_DRIVER_X11_XSHAPE +#ifdef SDL_VIDEO_DRIVER_X11_XSHAPE if (shape->format->Amask == 0 && SDL_SHAPEMODEALPHA(shape_mode->mode)) { return -2; } diff --git a/thirdparty/SDL/src/video/x11/SDL_x11shape.h b/thirdparty/SDL/src/video/x11/SDL_x11shape.h index b1741d1e1..7cd168c8f 100644 --- a/thirdparty/SDL/src/video/x11/SDL_x11shape.h +++ b/thirdparty/SDL/src/video/x11/SDL_x11shape.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/x11/SDL_x11sym.h b/thirdparty/SDL/src/video/x11/SDL_x11sym.h index beb0d3811..450c07ebf 100644 --- a/thirdparty/SDL/src/video/x11/SDL_x11sym.h +++ b/thirdparty/SDL/src/video/x11/SDL_x11sym.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -156,20 +156,21 @@ SDL_X11_SYM(int,XQueryTree,(Display* a,Window b,Window* c,Window* d,Window** e,u SDL_X11_SYM(Bool,XSupportsLocale,(void),(),return) SDL_X11_SYM(Status,XmbTextListToTextProperty,(Display* a,char** b,int c,XICCEncodingStyle d,XTextProperty* e),(a,b,c,d,e),return) -#if SDL_VIDEO_DRIVER_X11_XFIXES +#ifdef SDL_VIDEO_DRIVER_X11_XFIXES SDL_X11_MODULE(XFIXES) SDL_X11_SYM(PointerBarrier, XFixesCreatePointerBarrier, (Display* a, Window b, int c, int d, int e, int f, int g, int h, int *i),(a,b,c,d,e,f,g,h,i),return) SDL_X11_SYM(void, XFixesDestroyPointerBarrier, (Display* a, PointerBarrier b), (a,b),) SDL_X11_SYM(int, XIBarrierReleasePointer,(Display* a, int b, PointerBarrier c, BarrierEventID d), (a,b,c,d), return) /* this is actually Xinput2 */ SDL_X11_SYM(Status, XFixesQueryVersion,(Display* a, int* b, int* c), (a,b,c), return) +SDL_X11_SYM(Status, XFixesSelectSelectionInput, (Display* a, Window b, Atom c, unsigned long d), (a,b,c,d), return) #endif -#if SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS +#ifdef SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS SDL_X11_SYM(Bool,XGetEventData,(Display* a,XGenericEventCookie* b),(a,b),return) SDL_X11_SYM(void,XFreeEventData,(Display* a,XGenericEventCookie* b),(a,b),) #endif -#if SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM +#ifdef SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM SDL_X11_SYM(Bool,XkbQueryExtension,(Display* a,int * b,int * c,int * d,int * e, int *f),(a,b,c,d,e,f),return) #if NeedWidePrototypes SDL_X11_SYM(KeySym,XkbKeycodeToKeysym,(Display* a,unsigned int b,int c,int d),(a,b,c,d),return) @@ -184,11 +185,19 @@ SDL_X11_SYM(void,XkbFreeKeyboard,(XkbDescPtr a,unsigned int b, Bool c),(a,b,c),) SDL_X11_SYM(Bool,XkbSetDetectableAutoRepeat,(Display* a, Bool b, Bool* c),(a,b,c),return) #endif +/* XKeycodeToKeysym is a deprecated function */ +#if (defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))) || defined(__clang__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" +#endif #if NeedWidePrototypes SDL_X11_SYM(KeySym,XKeycodeToKeysym,(Display* a,unsigned int b,int c),(a,b,c),return) #else SDL_X11_SYM(KeySym,XKeycodeToKeysym,(Display* a,KeyCode b,int c),(a,b,c),return) #endif +#if (defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))) || defined(__clang__) +#pragma GCC diagnostic pop +#endif #ifdef X_HAVE_UTF8_STRING SDL_X11_MODULE(UTF8) @@ -239,15 +248,16 @@ SDL_X11_SYM(int,ipUnallocateAndSendData,(ChannelPtr a,IPCard b),(a,b),return) #endif /* XCursor support */ -#if SDL_VIDEO_DRIVER_X11_XCURSOR +#ifdef SDL_VIDEO_DRIVER_X11_XCURSOR SDL_X11_MODULE(XCURSOR) SDL_X11_SYM(XcursorImage*,XcursorImageCreate,(int a,int b),(a,b),return) SDL_X11_SYM(void,XcursorImageDestroy,(XcursorImage *a),(a),) SDL_X11_SYM(Cursor,XcursorImageLoadCursor,(Display *a,const XcursorImage *b),(a,b),return) +SDL_X11_SYM(Cursor,XcursorLibraryLoadCursor,(Display *a, const char *b),(a,b),return) #endif /* Xdbe support */ -#if SDL_VIDEO_DRIVER_X11_XDBE +#ifdef SDL_VIDEO_DRIVER_X11_XDBE SDL_X11_MODULE(XDBE) SDL_X11_SYM(Status,XdbeQueryExtension,(Display *dpy,int *major_version_return,int *minor_version_return),(dpy,major_version_return,minor_version_return),return) SDL_X11_SYM(XdbeBackBuffer,XdbeAllocateBackBufferName,(Display *dpy,Window window,XdbeSwapAction swap_action),(dpy,window,swap_action),return) @@ -261,7 +271,7 @@ SDL_X11_SYM(XdbeBackBufferAttributes*,XdbeGetBackBufferAttributes,(Display *dpy, #endif /* XInput2 support for multiple mice, tablets, etc. */ -#if SDL_VIDEO_DRIVER_X11_XINPUT2 +#ifdef SDL_VIDEO_DRIVER_X11_XINPUT2 SDL_X11_MODULE(XINPUT2) SDL_X11_SYM(XIDeviceInfo*,XIQueryDevice,(Display *a,int b,int *c),(a,b,c),return) SDL_X11_SYM(void,XIFreeDeviceInfo,(XIDeviceInfo *a),(a),) @@ -275,7 +285,7 @@ SDL_X11_SYM(Bool,XIWarpPointer,(Display *a,int b,Window c,Window d,double e,doub #endif /* XRandR support */ -#if SDL_VIDEO_DRIVER_X11_XRANDR +#ifdef SDL_VIDEO_DRIVER_X11_XRANDR SDL_X11_MODULE(XRANDR) SDL_X11_SYM(Status,XRRQueryVersion,(Display *dpy,int *major_versionp,int *minor_versionp),(dpy,major_versionp,minor_versionp),return) SDL_X11_SYM(Bool,XRRQueryExtension,(Display *dpy,int *event_base_return,int *error_base_return),(dpy,event_base_return,error_base_return),return); @@ -304,14 +314,14 @@ SDL_X11_SYM(void,XRRSelectInput,(Display *dpy, Window window, int mask),(dpy,win #endif /* MIT-SCREEN-SAVER support */ -#if SDL_VIDEO_DRIVER_X11_XSCRNSAVER +#ifdef SDL_VIDEO_DRIVER_X11_XSCRNSAVER SDL_X11_MODULE(XSS) SDL_X11_SYM(Bool,XScreenSaverQueryExtension,(Display *dpy,int *event_base,int *error_base),(dpy,event_base,error_base),return) SDL_X11_SYM(Status,XScreenSaverQueryVersion,(Display *dpy,int *major_versionp,int *minor_versionp),(dpy,major_versionp,minor_versionp),return) SDL_X11_SYM(void,XScreenSaverSuspend,(Display *dpy,Bool suspend),(dpy,suspend),return) #endif -#if SDL_VIDEO_DRIVER_X11_XSHAPE +#ifdef SDL_VIDEO_DRIVER_X11_XSHAPE SDL_X11_MODULE(XSHAPE) SDL_X11_SYM(void,XShapeCombineMask,(Display *dpy,Window dest,int dest_kind,int x_off,int y_off,Pixmap src,int op),(dpy,dest,dest_kind,x_off,y_off,src,op),) #endif diff --git a/thirdparty/SDL/src/video/x11/SDL_x11touch.c b/thirdparty/SDL/src/video/x11/SDL_x11touch.c index 90a41353e..338001fd6 100644 --- a/thirdparty/SDL/src/video/x11/SDL_x11touch.c +++ b/thirdparty/SDL/src/video/x11/SDL_x11touch.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_X11 +#ifdef SDL_VIDEO_DRIVER_X11 #include "SDL_x11video.h" #include "SDL_x11touch.h" diff --git a/thirdparty/SDL/src/video/x11/SDL_x11touch.h b/thirdparty/SDL/src/video/x11/SDL_x11touch.h index 246e0bdeb..ca6edac54 100644 --- a/thirdparty/SDL/src/video/x11/SDL_x11touch.h +++ b/thirdparty/SDL/src/video/x11/SDL_x11touch.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/x11/SDL_x11video.c b/thirdparty/SDL/src/video/x11/SDL_x11video.c index e2b36a849..2377f2b79 100644 --- a/thirdparty/SDL/src/video/x11/SDL_x11video.c +++ b/thirdparty/SDL/src/video/x11/SDL_x11video.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_X11 +#ifdef SDL_VIDEO_DRIVER_X11 #include /* For getpid() and readlink() */ @@ -37,8 +37,9 @@ #include "SDL_x11touch.h" #include "SDL_x11xinput2.h" #include "SDL_x11xfixes.h" +#include "SDL_x11messagebox.h" -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL #include "SDL_x11opengles.h" #endif @@ -49,7 +50,7 @@ static int X11_VideoInit(_THIS); static void X11_VideoQuit(_THIS); /* Find out what class name we should use */ -static char *get_classname() +static char *get_classname(void) { char *spot; #if defined(__LINUX__) || defined(__FREEBSD__) @@ -125,7 +126,7 @@ static int X11_SafetyNetErrHandler(Display *d, XErrorEvent *e) if (!safety_net_triggered) { safety_net_triggered = SDL_TRUE; device = SDL_GetVideoDevice(); - if (device != NULL) { + if (device) { int i; for (i = 0; i < device->num_displays; i++) { SDL_VideoDisplay *display = &device->displays[i]; @@ -137,13 +138,19 @@ static int X11_SafetyNetErrHandler(Display *d, XErrorEvent *e) } } - if (orig_x11_errhandler != NULL) { + if (orig_x11_errhandler) { return orig_x11_errhandler(d, e); /* probably terminate. */ } return 0; } +static SDL_bool X11_IsXWayland(Display *d) +{ + int opcode, event, error; + return X11_XQueryExtension(d, "XWAYLAND", &opcode, &event, &error) == True; +} + static SDL_VideoDevice *X11_CreateDevice(void) { SDL_VideoDevice *device; @@ -162,19 +169,19 @@ static SDL_VideoDevice *X11_CreateDevice(void) /* Open the display first to be sure that X11 is available */ x11_display = X11_XOpenDisplay(display); - if (x11_display == NULL) { + if (!x11_display) { SDL_X11_UnloadSymbols(); return NULL; } /* Initialize all variables that we clean on shutdown */ device = (SDL_VideoDevice *)SDL_calloc(1, sizeof(SDL_VideoDevice)); - if (device == NULL) { + if (!device) { SDL_OutOfMemory(); return NULL; } data = (struct SDL_VideoData *)SDL_calloc(1, sizeof(SDL_VideoData)); - if (data == NULL) { + if (!data) { SDL_free(device); SDL_OutOfMemory(); return NULL; @@ -183,13 +190,13 @@ static SDL_VideoDevice *X11_CreateDevice(void) data->global_mouse_changed = SDL_TRUE; -#if SDL_VIDEO_DRIVER_X11_XFIXES +#ifdef SDL_VIDEO_DRIVER_X11_XFIXES data->active_cursor_confined_window = NULL; #endif /* SDL_VIDEO_DRIVER_X11_XFIXES */ data->display = x11_display; data->request_display = X11_XOpenDisplay(display); - if (data->request_display == NULL) { + if (!data->request_display) { X11_XCloseDisplay(data->display); SDL_free(device->driverdata); SDL_free(device); @@ -261,7 +268,7 @@ static SDL_VideoDevice *X11_CreateDevice(void) device->AcceptDragAndDrop = X11_AcceptDragAndDrop; device->FlashWindow = X11_FlashWindow; -#if SDL_VIDEO_DRIVER_X11_XFIXES +#ifdef SDL_VIDEO_DRIVER_X11_XFIXES device->SetWindowMouseRect = X11_SetWindowMouseRect; #endif /* SDL_VIDEO_DRIVER_X11_XFIXES */ @@ -269,7 +276,7 @@ static SDL_VideoDevice *X11_CreateDevice(void) device->shape_driver.SetWindowShape = X11_SetWindowShape; device->shape_driver.ResizeWindowShape = X11_ResizeWindowShape; -#if SDL_VIDEO_OPENGL_GLX +#ifdef SDL_VIDEO_OPENGL_GLX device->GL_LoadLibrary = X11_GL_LoadLibrary; device->GL_GetProcAddress = X11_GL_GetProcAddress; device->GL_UnloadLibrary = X11_GL_UnloadLibrary; @@ -280,8 +287,8 @@ static SDL_VideoDevice *X11_CreateDevice(void) device->GL_SwapWindow = X11_GL_SwapWindow; device->GL_DeleteContext = X11_GL_DeleteContext; #endif -#if SDL_VIDEO_OPENGL_EGL -#if SDL_VIDEO_OPENGL_GLX +#ifdef SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_GLX if (SDL_GetHintBoolean(SDL_HINT_VIDEO_X11_FORCE_EGL, SDL_FALSE)) { #endif device->GL_LoadLibrary = X11_GLES_LoadLibrary; @@ -293,7 +300,7 @@ static SDL_VideoDevice *X11_CreateDevice(void) device->GL_GetSwapInterval = X11_GLES_GetSwapInterval; device->GL_SwapWindow = X11_GLES_SwapWindow; device->GL_DeleteContext = X11_GLES_DeleteContext; -#if SDL_VIDEO_OPENGL_GLX +#ifdef SDL_VIDEO_OPENGL_GLX } #endif #endif @@ -314,19 +321,22 @@ static SDL_VideoDevice *X11_CreateDevice(void) device->free = X11_DeleteDevice; -#if SDL_VIDEO_VULKAN +#ifdef SDL_VIDEO_VULKAN device->Vulkan_LoadLibrary = X11_Vulkan_LoadLibrary; device->Vulkan_UnloadLibrary = X11_Vulkan_UnloadLibrary; device->Vulkan_GetInstanceExtensions = X11_Vulkan_GetInstanceExtensions; device->Vulkan_CreateSurface = X11_Vulkan_CreateSurface; #endif + data->is_xwayland = X11_IsXWayland(x11_display); + return device; } VideoBootStrap X11_bootstrap = { "x11", "SDL X11 video driver", - X11_CreateDevice + X11_CreateDevice, + X11_ShowMessageBox }; static int (*handler)(Display *, XErrorEvent *) = NULL; diff --git a/thirdparty/SDL/src/video/x11/SDL_x11video.h b/thirdparty/SDL/src/video/x11/SDL_x11video.h index 65876c220..a12a34b96 100644 --- a/thirdparty/SDL/src/video/x11/SDL_x11video.h +++ b/thirdparty/SDL/src/video/x11/SDL_x11video.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -31,22 +31,22 @@ #include #include -#if SDL_VIDEO_DRIVER_X11_XCURSOR +#ifdef SDL_VIDEO_DRIVER_X11_XCURSOR #include #endif -#if SDL_VIDEO_DRIVER_X11_XDBE +#ifdef SDL_VIDEO_DRIVER_X11_XDBE #include #endif -#if SDL_VIDEO_DRIVER_X11_XINPUT2 +#ifdef SDL_VIDEO_DRIVER_X11_XINPUT2 #include #endif -#if SDL_VIDEO_DRIVER_X11_XRANDR +#ifdef SDL_VIDEO_DRIVER_X11_XRANDR #include #endif -#if SDL_VIDEO_DRIVER_X11_XSCRNSAVER +#ifdef SDL_VIDEO_DRIVER_X11_XSCRNSAVER #include #endif -#if SDL_VIDEO_DRIVER_X11_XSHAPE +#ifdef SDL_VIDEO_DRIVER_X11_XSHAPE #include #endif @@ -79,7 +79,7 @@ typedef struct SDL_VideoData int windowlistlength; XID window_group; Window clipboard_window; -#if SDL_VIDEO_DRIVER_X11_XFIXES +#ifdef SDL_VIDEO_DRIVER_X11_XFIXES SDL_Window *active_cursor_confined_window; #endif /* SDL_VIDEO_DRIVER_X11_XFIXES */ @@ -138,7 +138,7 @@ typedef struct SDL_VideoData int xrandr_event_base; -#if SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM +#ifdef SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM XkbDescPtr xkb; #endif int xkb_event; @@ -146,7 +146,7 @@ typedef struct SDL_VideoData KeyCode filter_code; Time filter_time; -#if SDL_VIDEO_VULKAN +#ifdef SDL_VIDEO_VULKAN /* Vulkan variables only valid if _this->vulkan_config.loader_handle is not NULL */ void *vulkan_xlib_xcb_library; PFN_XGetXCBConnection vulkan_XGetXCBConnection; @@ -156,6 +156,8 @@ typedef struct SDL_VideoData SDL_bool is_steam_deck; SDL_bool steam_keyboard_open; + SDL_bool is_xwayland; + } SDL_VideoData; extern SDL_bool X11_UseDirectColorVisuals(void); diff --git a/thirdparty/SDL/src/video/x11/SDL_x11vulkan.c b/thirdparty/SDL/src/video/x11/SDL_x11vulkan.c index 07b4a8028..d9a0d2f35 100644 --- a/thirdparty/SDL/src/video/x11/SDL_x11vulkan.c +++ b/thirdparty/SDL/src/video/x11/SDL_x11vulkan.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_X11 +#if defined(SDL_VIDEO_VULKAN) && defined(SDL_VIDEO_DRIVER_X11) #include "SDL_x11video.h" @@ -56,10 +56,10 @@ int X11_Vulkan_LoadLibrary(_THIS, const char *path) } /* Load the Vulkan loader library */ - if (path == NULL) { + if (!path) { path = SDL_getenv("SDL_VULKAN_LIBRARY"); } - if (path == NULL) { + if (!path) { path = DEFAULT_VULKAN; } _this->vulkan_config.loader_handle = SDL_LoadObject(path); @@ -83,7 +83,7 @@ int X11_Vulkan_LoadLibrary(_THIS, const char *path) (PFN_vkEnumerateInstanceExtensionProperties) _this->vulkan_config.vkEnumerateInstanceExtensionProperties, &extensionCount); - if (extensions == NULL) { + if (!extensions) { goto fail; } for (i = 0; i < extensionCount; i++) { @@ -107,7 +107,7 @@ int X11_Vulkan_LoadLibrary(_THIS, const char *path) goto fail; } else { const char *libX11XCBLibraryName = SDL_getenv("SDL_X11_XCB_LIBRARY"); - if (libX11XCBLibraryName == NULL) { + if (!libX11XCBLibraryName) { libX11XCBLibraryName = "libX11-xcb.so"; } videoData->vulkan_xlib_xcb_library = SDL_LoadObject(libX11XCBLibraryName); diff --git a/thirdparty/SDL/src/video/x11/SDL_x11vulkan.h b/thirdparty/SDL/src/video/x11/SDL_x11vulkan.h index 775e07de9..438b16d07 100644 --- a/thirdparty/SDL/src/video/x11/SDL_x11vulkan.h +++ b/thirdparty/SDL/src/video/x11/SDL_x11vulkan.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,7 +25,7 @@ #include "../SDL_vulkan_internal.h" -#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_X11 +#if defined(SDL_VIDEO_VULKAN) && defined(SDL_VIDEO_DRIVER_X11) /*typedef struct xcb_connection_t xcb_connection_t;*/ typedef xcb_connection_t *(*PFN_XGetXCBConnection)(Display *dpy); diff --git a/thirdparty/SDL/src/video/x11/SDL_x11window.c b/thirdparty/SDL/src/video/x11/SDL_x11window.c index 2a2a160f8..07ec43156 100644 --- a/thirdparty/SDL/src/video/x11/SDL_x11window.c +++ b/thirdparty/SDL/src/video/x11/SDL_x11window.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_X11 +#ifdef SDL_VIDEO_DRIVER_X11 #include "SDL_hints.h" #include "../SDL_sysvideo.h" @@ -35,7 +35,7 @@ #include "SDL_x11xinput2.h" #include "SDL_x11xfixes.h" -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL #include "SDL_x11opengles.h" #endif @@ -256,7 +256,7 @@ static int SetupWindowData(_THIS, SDL_Window *window, Window w, BOOL created) /* Allocate the window data */ data = (SDL_WindowData *)SDL_calloc(1, sizeof(*data)); - if (data == NULL) { + if (!data) { return SDL_OutOfMemory(); } data->window = window; @@ -284,7 +284,7 @@ static int SetupWindowData(_THIS, SDL_Window *window, Window w, BOOL created) (numwindows + 1) * sizeof(*windowlist)); - if (windowlist == NULL) { + if (!windowlist) { SDL_free(data); return SDL_OutOfMemory(); } @@ -391,10 +391,10 @@ int X11_CreateWindow(_THIS, SDL_Window *window) long fevent = 0; const char *hint = NULL; -#if SDL_VIDEO_OPENGL_GLX || SDL_VIDEO_OPENGL_EGL +#if defined(SDL_VIDEO_OPENGL_GLX) || defined(SDL_VIDEO_OPENGL_EGL) const char *forced_visual_id = SDL_GetHint(SDL_HINT_VIDEO_X11_WINDOW_VISUALID); - if (forced_visual_id != NULL && forced_visual_id[0] != '\0') { + if (forced_visual_id && forced_visual_id[0] != '\0') { XVisualInfo *vi, template; int nvis; @@ -412,23 +412,23 @@ int X11_CreateWindow(_THIS, SDL_Window *window) !SDL_getenv("SDL_VIDEO_X11_VISUALID")) { XVisualInfo *vinfo = NULL; -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL if (((_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES) || SDL_GetHintBoolean(SDL_HINT_VIDEO_X11_FORCE_EGL, SDL_FALSE)) -#if SDL_VIDEO_OPENGL_GLX - && ( !_this->gl_data || X11_GL_UseEGL(_this) ) +#ifdef SDL_VIDEO_OPENGL_GLX + && (!_this->gl_data || X11_GL_UseEGL(_this) ) #endif ) { vinfo = X11_GLES_GetVisual(_this, display, screen); } else #endif { -#if SDL_VIDEO_OPENGL_GLX +#ifdef SDL_VIDEO_OPENGL_GLX vinfo = X11_GL_GetVisual(_this, display, screen); #endif } - if (vinfo == NULL) { + if (!vinfo) { return -1; } visual = vinfo->visual; @@ -465,7 +465,7 @@ int X11_CreateWindow(_THIS, SDL_Window *window) /* OK, we got a colormap, now fill it in as best as we can */ colorcells = SDL_malloc(visual->map_entries * sizeof(XColor)); - if (colorcells == NULL) { + if (!colorcells) { return SDL_OutOfMemory(); } ncolors = visual->map_entries; @@ -592,7 +592,7 @@ int X11_CreateWindow(_THIS, SDL_Window *window) wintype_name = "_NET_WM_WINDOW_TYPE_TOOLTIP"; } else if (window->flags & SDL_WINDOW_POPUP_MENU) { wintype_name = "_NET_WM_WINDOW_TYPE_POPUP_MENU"; - } else if (hint != NULL && *hint) { + } else if (hint && *hint) { wintype_name = hint; } else { wintype_name = "_NET_WM_WINDOW_TYPE_NORMAL"; @@ -634,15 +634,15 @@ int X11_CreateWindow(_THIS, SDL_Window *window) } windowdata = (SDL_WindowData *)window->driverdata; -#if SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2 || SDL_VIDEO_OPENGL_EGL +#if defined(SDL_VIDEO_OPENGL_ES) || defined(SDL_VIDEO_OPENGL_ES2) || defined(SDL_VIDEO_OPENGL_EGL) if ((window->flags & SDL_WINDOW_OPENGL) && ((_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES) || SDL_GetHintBoolean(SDL_HINT_VIDEO_X11_FORCE_EGL, SDL_FALSE)) -#if SDL_VIDEO_OPENGL_GLX - && ( !_this->gl_data || X11_GL_UseEGL(_this) ) +#ifdef SDL_VIDEO_OPENGL_GLX + && (!_this->gl_data || X11_GL_UseEGL(_this) ) #endif ) { -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL if (!_this->egl_data) { return -1; } @@ -1612,7 +1612,7 @@ static void X11_ReadProperty(SDL_x11Prop *p, Display *disp, Window w, Atom prop) int bytes_fetch = 0; do { - if (ret != NULL) { + if (ret) { X11_XFree(ret); } X11_XGetWindowProperty(disp, w, prop, 0, bytes_fetch, False, AnyPropertyType, &type, &fmt, &count, &bytes_left, &ret); @@ -1662,7 +1662,7 @@ void *X11_GetWindowICCProfile(_THIS, SDL_Window *window, size_t *size) } ret_icc_profile_data = SDL_malloc(real_nitems); - if (ret_icc_profile_data == NULL) { + if (!ret_icc_profile_data) { SDL_OutOfMemory(); return NULL; } @@ -1679,7 +1679,7 @@ void X11_SetWindowMouseGrab(_THIS, SDL_Window *window, SDL_bool grabbed) SDL_WindowData *data = (SDL_WindowData *)window->driverdata; Display *display; - if (data == NULL) { + if (!data) { return; } data->mouse_grabbed = SDL_FALSE; @@ -1734,7 +1734,7 @@ void X11_SetWindowKeyboardGrab(_THIS, SDL_Window *window, SDL_bool grabbed) SDL_WindowData *data = (SDL_WindowData *)window->driverdata; Display *display; - if (data == NULL) { + if (!data) { return; } @@ -1798,7 +1798,7 @@ void X11_DestroyWindow(_THIS, SDL_Window *window) } SDL_free(data); -#if SDL_VIDEO_DRIVER_X11_XFIXES +#ifdef SDL_VIDEO_DRIVER_X11_XFIXES /* If the pointer barriers are active for this, deactivate it.*/ if (videodata->active_cursor_confined_window == window) { X11_DestroyPointerBarrier(_this, window); @@ -1813,7 +1813,7 @@ SDL_bool X11_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info) SDL_WindowData *data = (SDL_WindowData *) window->driverdata; Display *display; - if (data == NULL) { + if (!data) { /* This sometimes happens in SDL_IBus_UpdateTextRect() while creating the window */ SDL_SetError("Window not initialized"); return SDL_FALSE; @@ -1860,7 +1860,7 @@ int X11_FlashWindow(_THIS, SDL_Window *window, SDL_FlashOperation operation) XWMHints *wmhints; wmhints = X11_XGetWMHints(display, data->xwindow); - if (wmhints == NULL) { + if (!wmhints) { return SDL_SetError("Couldn't get WM hints"); } diff --git a/thirdparty/SDL/src/video/x11/SDL_x11window.h b/thirdparty/SDL/src/video/x11/SDL_x11window.h index f31eb403e..12a89b03b 100644 --- a/thirdparty/SDL/src/video/x11/SDL_x11window.h +++ b/thirdparty/SDL/src/video/x11/SDL_x11window.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -29,7 +29,7 @@ */ #define PENDING_FOCUS_TIME 200 -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL #include #endif @@ -70,10 +70,10 @@ typedef struct Window xdnd_source; SDL_bool flashing_window; Uint32 flash_cancel_time; -#if SDL_VIDEO_OPENGL_EGL +#ifdef SDL_VIDEO_OPENGL_EGL EGLSurface egl_surface; #endif -#if SDL_VIDEO_DRIVER_X11_XFIXES +#ifdef SDL_VIDEO_DRIVER_X11_XFIXES SDL_bool pointer_barrier_active; PointerBarrier barrier[4]; SDL_Rect barrier_rect; diff --git a/thirdparty/SDL/src/video/x11/SDL_x11xfixes.c b/thirdparty/SDL/src/video/x11/SDL_x11xfixes.c index 662759f67..e624f16e1 100644 --- a/thirdparty/SDL/src/video/x11/SDL_x11xfixes.c +++ b/thirdparty/SDL/src/video/x11/SDL_x11xfixes.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,7 +21,7 @@ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_X11 && SDL_VIDEO_DRIVER_X11_XFIXES +#if defined(SDL_VIDEO_DRIVER_X11) && defined(SDL_VIDEO_DRIVER_X11_XFIXES) #include "SDL_x11video.h" #include "SDL_x11xfixes.h" @@ -29,6 +29,7 @@ #include "../../events/SDL_touch_c.h" static int xfixes_initialized = 0; +static int xfixes_selection_notify_event = 0; static int query_xfixes_version(Display *display, int major, int minor) { @@ -50,11 +51,20 @@ void X11_InitXfixes(_THIS) int event, error; int fixes_opcode; + Atom XA_CLIPBOARD = X11_XInternAtom(data->display, "CLIPBOARD", 0); + if (!SDL_X11_HAVE_XFIXES || !X11_XQueryExtension(data->display, "XFIXES", &fixes_opcode, &event, &error)) { return; } + /* Selection tracking is available in all versions of XFixes */ + xfixes_selection_notify_event = event + XFixesSelectionNotify; + X11_XFixesSelectSelectionInput(data->display, DefaultRootWindow(data->display), + XA_CLIPBOARD, XFixesSetSelectionOwnerNotifyMask); + X11_XFixesSelectSelectionInput(data->display, DefaultRootWindow(data->display), + XA_PRIMARY, XFixesSetSelectionOwnerNotifyMask); + /* We need at least 5.0 for barriers. */ version = query_xfixes_version(data->display, 5, 0); if (!xfixes_version_atleast(version, 5, 0)) { @@ -64,11 +74,16 @@ void X11_InitXfixes(_THIS) xfixes_initialized = 1; } -int X11_XfixesIsInitialized() +int X11_XfixesIsInitialized(void) { return xfixes_initialized; } +int X11_GetXFixesSelectionNotifyEvent(void) +{ + return xfixes_selection_notify_event; +} + void X11_SetWindowMouseRect(_THIS, SDL_Window *window) { if (SDL_RectEmpty(&window->mouse_rect)) { diff --git a/thirdparty/SDL/src/video/x11/SDL_x11xfixes.h b/thirdparty/SDL/src/video/x11/SDL_x11xfixes.h index 92c659406..346486737 100644 --- a/thirdparty/SDL/src/video/x11/SDL_x11xfixes.h +++ b/thirdparty/SDL/src/video/x11/SDL_x11xfixes.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -24,7 +24,7 @@ #ifndef SDL_x11xfixes_h_ #define SDL_x11xfixes_h_ -#if SDL_VIDEO_DRIVER_X11_XFIXES +#ifdef SDL_VIDEO_DRIVER_X11_XFIXES #define X11_BARRIER_HANDLED_BY_EVENT 1 @@ -33,7 +33,7 @@ extern int X11_XfixesIsInitialized(void); extern void X11_SetWindowMouseRect(_THIS, SDL_Window *window); extern int X11_ConfineCursorWithFlags(_THIS, SDL_Window *window, const SDL_Rect *rect, int flags); extern void X11_DestroyPointerBarrier(_THIS, SDL_Window *window); - +extern int X11_GetXFixesSelectionNotifyEvent(void); #endif /* SDL_VIDEO_DRIVER_X11_XFIXES */ #endif /* SDL_x11xfixes_h_ */ diff --git a/thirdparty/SDL/src/video/x11/SDL_x11xinput2.c b/thirdparty/SDL/src/video/x11/SDL_x11xinput2.c index 4fe205b7e..9d673b5f6 100644 --- a/thirdparty/SDL/src/video/x11/SDL_x11xinput2.c +++ b/thirdparty/SDL/src/video/x11/SDL_x11xinput2.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_X11 +#ifdef SDL_VIDEO_DRIVER_X11 #include "SDL_x11video.h" #include "SDL_x11xinput2.h" @@ -29,10 +29,10 @@ #define MAX_AXIS 16 -#if SDL_VIDEO_DRIVER_X11_XINPUT2 +#ifdef SDL_VIDEO_DRIVER_X11_XINPUT2 static int xinput2_initialized = 0; -#if SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH +#ifdef SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH static int xinput2_multitouch_supported = 0; #endif @@ -74,7 +74,7 @@ static SDL_bool xinput2_version_atleast(const int version, const int wantmajor, return version >= ((wantmajor * 1000) + wantminor); } -#if SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH +#ifdef SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH static SDL_Window *xinput2_get_sdlwindow(SDL_VideoData *videodata, Window window) { int i; @@ -112,7 +112,7 @@ static void xinput2_normalize_touch_coordinates(SDL_Window *window, double in_x, void X11_InitXinput2(_THIS) { -#if SDL_VIDEO_DRIVER_X11_XINPUT2 +#ifdef SDL_VIDEO_DRIVER_X11_XINPUT2 SDL_VideoData *data = (SDL_VideoData *)_this->driverdata; int version = 0; @@ -142,7 +142,7 @@ void X11_InitXinput2(_THIS) xinput2_initialized = 1; -#if SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH /* Multitouch needs XInput 2.2 */ +#ifdef SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH /* Multitouch needs XInput 2.2 */ xinput2_multitouch_supported = xinput2_version_atleast(version, 2, 2); #endif @@ -155,7 +155,7 @@ void X11_InitXinput2(_THIS) XISetMask(mask, XI_RawButtonPress); XISetMask(mask, XI_RawButtonRelease); -#if SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH +#ifdef SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH /* Enable raw touch events if supported */ if (X11_Xinput2IsMultitouchSupported()) { XISetMask(mask, XI_RawTouchBegin); @@ -181,17 +181,17 @@ void X11_InitXinput2(_THIS) #endif } -#if SDL_VIDEO_DRIVER_X11_XINPUT2 +#ifdef SDL_VIDEO_DRIVER_X11_XINPUT2 /* xi2 device went away? take it out of the list. */ static void xinput2_remove_device_info(SDL_VideoData *videodata, const int device_id) { SDL_XInput2DeviceInfo *prev = NULL; SDL_XInput2DeviceInfo *devinfo; - for (devinfo = videodata->mouse_device_info; devinfo != NULL; devinfo = devinfo->next) { + for (devinfo = videodata->mouse_device_info; devinfo; devinfo = devinfo->next) { if (devinfo->device_id == device_id) { SDL_assert((devinfo == videodata->mouse_device_info) == (prev == NULL)); - if (prev == NULL) { + if (!prev) { videodata->mouse_device_info = devinfo->next; } else { prev->next = devinfo->next; @@ -212,10 +212,10 @@ static SDL_XInput2DeviceInfo *xinput2_get_device_info(SDL_VideoData *videodata, int axis = 0; int i; - for (devinfo = videodata->mouse_device_info; devinfo != NULL; devinfo = devinfo->next) { + for (devinfo = videodata->mouse_device_info; devinfo; devinfo = devinfo->next) { if (devinfo->device_id == device_id) { SDL_assert((devinfo == videodata->mouse_device_info) == (prev == NULL)); - if (prev != NULL) { /* move this to the front of the list, assuming we'll get more from this one. */ + if (prev) { /* move this to the front of the list, assuming we'll get more from this one. */ prev->next = devinfo->next; devinfo->next = videodata->mouse_device_info; videodata->mouse_device_info = devinfo; @@ -227,13 +227,13 @@ static SDL_XInput2DeviceInfo *xinput2_get_device_info(SDL_VideoData *videodata, /* don't know about this device yet, query and cache it. */ devinfo = (SDL_XInput2DeviceInfo *)SDL_calloc(1, sizeof(SDL_XInput2DeviceInfo)); - if (devinfo == NULL) { + if (!devinfo) { SDL_OutOfMemory(); return NULL; } xidevinfo = X11_XIQueryDevice(videodata->display, device_id, &i); - if (xidevinfo == NULL) { + if (!xidevinfo) { SDL_free(devinfo); return NULL; } @@ -266,7 +266,7 @@ static SDL_XInput2DeviceInfo *xinput2_get_device_info(SDL_VideoData *videodata, int X11_HandleXinput2Event(SDL_VideoData *videodata, XGenericEventCookie *cookie) { -#if SDL_VIDEO_DRIVER_X11_XINPUT2 +#ifdef SDL_VIDEO_DRIVER_X11_XINPUT2 if (cookie->extension != xinput2_opcode) { return 0; } @@ -287,7 +287,7 @@ int X11_HandleXinput2Event(SDL_VideoData *videodata, XGenericEventCookie *cookie } devinfo = xinput2_get_device_info(videodata, rawev->deviceid); - if (devinfo == NULL) { + if (!devinfo) { return 0; /* oh well. */ } @@ -321,7 +321,7 @@ int X11_HandleXinput2Event(SDL_VideoData *videodata, XGenericEventCookie *cookie case XI_RawButtonPress: case XI_RawButtonRelease: -#if SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH +#ifdef SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH case XI_RawTouchBegin: case XI_RawTouchUpdate: case XI_RawTouchEnd: @@ -329,7 +329,7 @@ int X11_HandleXinput2Event(SDL_VideoData *videodata, XGenericEventCookie *cookie videodata->global_mouse_changed = SDL_TRUE; break; -#if SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH +#ifdef SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH /* With multitouch, register to receive XI_Motion (which desctivates MotionNotify), * so that we can distinguish real mouse motions from synthetic one. */ case XI_Motion: @@ -337,6 +337,8 @@ int X11_HandleXinput2Event(SDL_VideoData *videodata, XGenericEventCookie *cookie const XIDeviceEvent *xev = (const XIDeviceEvent *)cookie->data; int pointer_emulated = (xev->flags & XIPointerEmulated); + videodata->global_mouse_changed = SDL_TRUE; + if (!pointer_emulated) { SDL_Mouse *mouse = SDL_GetMouse(); if (!mouse->relative_mode || mouse->relative_mode_warp) { @@ -385,7 +387,7 @@ int X11_HandleXinput2Event(SDL_VideoData *videodata, XGenericEventCookie *cookie void X11_InitXinput2Multitouch(_THIS) { -#if SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH +#ifdef SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH SDL_VideoData *data = (SDL_VideoData *)_this->driverdata; XIDeviceInfo *info; int ndevices, i, j; @@ -425,7 +427,7 @@ void X11_InitXinput2Multitouch(_THIS) void X11_Xinput2SelectTouch(_THIS, SDL_Window *window) { -#if SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH +#ifdef SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH SDL_VideoData *data = NULL; XIEventMask eventmask; unsigned char mask[4] = { 0, 0, 0, 0 }; @@ -451,18 +453,18 @@ void X11_Xinput2SelectTouch(_THIS, SDL_Window *window) #endif } -int X11_Xinput2IsInitialized() +int X11_Xinput2IsInitialized(void) { -#if SDL_VIDEO_DRIVER_X11_XINPUT2 +#ifdef SDL_VIDEO_DRIVER_X11_XINPUT2 return xinput2_initialized; #else return 0; #endif } -int X11_Xinput2IsMultitouchSupported() +int X11_Xinput2IsMultitouchSupported(void) { -#if SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH +#ifdef SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH return xinput2_initialized && xinput2_multitouch_supported; #else return 0; @@ -471,7 +473,7 @@ int X11_Xinput2IsMultitouchSupported() void X11_Xinput2GrabTouch(_THIS, SDL_Window *window) { -#if SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH +#ifdef SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH SDL_WindowData *data = (SDL_WindowData *)window->driverdata; Display *display = data->videodata->display; @@ -501,7 +503,7 @@ void X11_Xinput2GrabTouch(_THIS, SDL_Window *window) void X11_Xinput2UngrabTouch(_THIS, SDL_Window *window) { -#if SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH +#ifdef SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH SDL_WindowData *data = (SDL_WindowData *)window->driverdata; Display *display = data->videodata->display; diff --git a/thirdparty/SDL/src/video/x11/SDL_x11xinput2.h b/thirdparty/SDL/src/video/x11/SDL_x11xinput2.h index 4d7890b13..3a8e3c0f4 100644 --- a/thirdparty/SDL/src/video/x11/SDL_x11xinput2.h +++ b/thirdparty/SDL/src/video/x11/SDL_x11xinput2.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/src/video/yuv2rgb/yuv_rgb.h b/thirdparty/SDL/src/video/yuv2rgb/yuv_rgb.h index 5668c0fc4..c3593168f 100644 --- a/thirdparty/SDL/src/video/yuv2rgb/yuv_rgb.h +++ b/thirdparty/SDL/src/video/yuv2rgb/yuv_rgb.h @@ -1,412 +1,33 @@ +#ifndef YUV_RGB_H_ +#define YUV_RGB_H_ + // Copyright 2016 Adrien Descamps // Distributed under BSD 3-Clause License // Provide optimized functions to convert images from 8bits yuv420 to rgb24 format -// There are a few slightly different variations of the YCbCr color space with different parameters that +// There are a few slightly different variations of the YCbCr color space with different parameters that // change the conversion matrix. // The three most common YCbCr color space, defined by BT.601, BT.709 and JPEG standard are implemented here. // See the respective standards for details // The matrix values used are derived from http://www.equasys.de/colorconversion.html // YUV420 is stored as three separate channels, with U and V (Cb and Cr) subsampled by a 2 factor -// For conversion from yuv to rgb, no interpolation is done, and the same UV value are used for 4 rgb pixels. This +// For conversion from yuv to rgb, no interpolation is done, and the same UV value are used for 4 rgb pixels. This // is suboptimal for image quality, but by far the fastest method. // For all methods, width and height should be even, if not, the last row/column of the result image won't be affected. // For sse methods, if the width if not divisable by 32, the last (width%32) pixels of each line won't be affected. -#include "SDL_stdinc.h" /*#include */ -typedef enum -{ - YCBCR_JPEG, - YCBCR_601, - YCBCR_709 -} YCbCrType; - // yuv to rgb, standard c implementation -void yuv420_rgb565_std( - uint32_t width, uint32_t height, - const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, - uint8_t *rgb, uint32_t rgb_stride, - YCbCrType yuv_type); - -void yuv420_rgb24_std( - uint32_t width, uint32_t height, - const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, - uint8_t *rgb, uint32_t rgb_stride, - YCbCrType yuv_type); - -void yuv420_rgba_std( - uint32_t width, uint32_t height, - const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, - uint8_t *rgb, uint32_t rgb_stride, - YCbCrType yuv_type); - -void yuv420_bgra_std( - uint32_t width, uint32_t height, - const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, - uint8_t *rgb, uint32_t rgb_stride, - YCbCrType yuv_type); - -void yuv420_argb_std( - uint32_t width, uint32_t height, - const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, - uint8_t *rgb, uint32_t rgb_stride, - YCbCrType yuv_type); - -void yuv420_abgr_std( - uint32_t width, uint32_t height, - const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, - uint8_t *rgb, uint32_t rgb_stride, - YCbCrType yuv_type); - -void yuv422_rgb565_std( - uint32_t width, uint32_t height, - const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, - uint8_t *rgb, uint32_t rgb_stride, - YCbCrType yuv_type); - -void yuv422_rgb24_std( - uint32_t width, uint32_t height, - const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, - uint8_t *rgb, uint32_t rgb_stride, - YCbCrType yuv_type); - -void yuv422_rgba_std( - uint32_t width, uint32_t height, - const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, - uint8_t *rgb, uint32_t rgb_stride, - YCbCrType yuv_type); - -void yuv422_bgra_std( - uint32_t width, uint32_t height, - const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, - uint8_t *rgb, uint32_t rgb_stride, - YCbCrType yuv_type); - -void yuv422_argb_std( - uint32_t width, uint32_t height, - const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, - uint8_t *rgb, uint32_t rgb_stride, - YCbCrType yuv_type); - -void yuv422_abgr_std( - uint32_t width, uint32_t height, - const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, - uint8_t *rgb, uint32_t rgb_stride, - YCbCrType yuv_type); - -void yuvnv12_rgb565_std( - uint32_t width, uint32_t height, - const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, - uint8_t *rgb, uint32_t rgb_stride, - YCbCrType yuv_type); - -void yuvnv12_rgb24_std( - uint32_t width, uint32_t height, - const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, - uint8_t *rgb, uint32_t rgb_stride, - YCbCrType yuv_type); - -void yuvnv12_rgba_std( - uint32_t width, uint32_t height, - const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, - uint8_t *rgb, uint32_t rgb_stride, - YCbCrType yuv_type); - -void yuvnv12_bgra_std( - uint32_t width, uint32_t height, - const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, - uint8_t *rgb, uint32_t rgb_stride, - YCbCrType yuv_type); - -void yuvnv12_argb_std( - uint32_t width, uint32_t height, - const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, - uint8_t *rgb, uint32_t rgb_stride, - YCbCrType yuv_type); - -void yuvnv12_abgr_std( - uint32_t width, uint32_t height, - const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, - uint8_t *rgb, uint32_t rgb_stride, - YCbCrType yuv_type); - -// yuv to rgb, sse implementation -// pointers must be 16 byte aligned, and strides must be divisable by 16 -void yuv420_rgb565_sse( - uint32_t width, uint32_t height, - const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, - uint8_t *rgb, uint32_t rgb_stride, - YCbCrType yuv_type); - -void yuv420_rgb24_sse( - uint32_t width, uint32_t height, - const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, - uint8_t *rgb, uint32_t rgb_stride, - YCbCrType yuv_type); - -void yuv420_rgba_sse( - uint32_t width, uint32_t height, - const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, - uint8_t *rgb, uint32_t rgb_stride, - YCbCrType yuv_type); - -void yuv420_bgra_sse( - uint32_t width, uint32_t height, - const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, - uint8_t *rgb, uint32_t rgb_stride, - YCbCrType yuv_type); - -void yuv420_argb_sse( - uint32_t width, uint32_t height, - const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, - uint8_t *rgb, uint32_t rgb_stride, - YCbCrType yuv_type); - -void yuv420_abgr_sse( - uint32_t width, uint32_t height, - const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, - uint8_t *rgb, uint32_t rgb_stride, - YCbCrType yuv_type); - -void yuv422_rgb565_sse( - uint32_t width, uint32_t height, - const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, - uint8_t *rgb, uint32_t rgb_stride, - YCbCrType yuv_type); - -void yuv422_rgb24_sse( - uint32_t width, uint32_t height, - const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, - uint8_t *rgb, uint32_t rgb_stride, - YCbCrType yuv_type); - -void yuv422_rgba_sse( - uint32_t width, uint32_t height, - const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, - uint8_t *rgb, uint32_t rgb_stride, - YCbCrType yuv_type); - -void yuv422_bgra_sse( - uint32_t width, uint32_t height, - const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, - uint8_t *rgb, uint32_t rgb_stride, - YCbCrType yuv_type); - -void yuv422_argb_sse( - uint32_t width, uint32_t height, - const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, - uint8_t *rgb, uint32_t rgb_stride, - YCbCrType yuv_type); - -void yuv422_abgr_sse( - uint32_t width, uint32_t height, - const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, - uint8_t *rgb, uint32_t rgb_stride, - YCbCrType yuv_type); - -void yuvnv12_rgb565_sse( - uint32_t width, uint32_t height, - const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, - uint8_t *rgb, uint32_t rgb_stride, - YCbCrType yuv_type); - -void yuvnv12_rgb24_sse( - uint32_t width, uint32_t height, - const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, - uint8_t *rgb, uint32_t rgb_stride, - YCbCrType yuv_type); - -void yuvnv12_rgba_sse( - uint32_t width, uint32_t height, - const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, - uint8_t *rgb, uint32_t rgb_stride, - YCbCrType yuv_type); - -void yuvnv12_bgra_sse( - uint32_t width, uint32_t height, - const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, - uint8_t *rgb, uint32_t rgb_stride, - YCbCrType yuv_type); - -void yuvnv12_argb_sse( - uint32_t width, uint32_t height, - const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, - uint8_t *rgb, uint32_t rgb_stride, - YCbCrType yuv_type); - -void yuvnv12_abgr_sse( - uint32_t width, uint32_t height, - const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, - uint8_t *rgb, uint32_t rgb_stride, - YCbCrType yuv_type); - -// yuv to rgb, sse implementation -// pointers do not need to be 16 byte aligned -void yuv420_rgb565_sseu( - uint32_t width, uint32_t height, - const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, - uint8_t *rgb, uint32_t rgb_stride, - YCbCrType yuv_type); - -void yuv420_rgb24_sseu( - uint32_t width, uint32_t height, - const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, - uint8_t *rgb, uint32_t rgb_stride, - YCbCrType yuv_type); - -void yuv420_rgba_sseu( - uint32_t width, uint32_t height, - const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, - uint8_t *rgb, uint32_t rgb_stride, - YCbCrType yuv_type); - -void yuv420_bgra_sseu( - uint32_t width, uint32_t height, - const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, - uint8_t *rgb, uint32_t rgb_stride, - YCbCrType yuv_type); - -void yuv420_argb_sseu( - uint32_t width, uint32_t height, - const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, - uint8_t *rgb, uint32_t rgb_stride, - YCbCrType yuv_type); - -void yuv420_abgr_sseu( - uint32_t width, uint32_t height, - const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, - uint8_t *rgb, uint32_t rgb_stride, - YCbCrType yuv_type); - -void yuv422_rgb565_sseu( - uint32_t width, uint32_t height, - const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, - uint8_t *rgb, uint32_t rgb_stride, - YCbCrType yuv_type); - -void yuv422_rgb24_sseu( - uint32_t width, uint32_t height, - const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, - uint8_t *rgb, uint32_t rgb_stride, - YCbCrType yuv_type); - -void yuv422_rgba_sseu( - uint32_t width, uint32_t height, - const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, - uint8_t *rgb, uint32_t rgb_stride, - YCbCrType yuv_type); - -void yuv422_bgra_sseu( - uint32_t width, uint32_t height, - const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, - uint8_t *rgb, uint32_t rgb_stride, - YCbCrType yuv_type); - -void yuv422_argb_sseu( - uint32_t width, uint32_t height, - const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, - uint8_t *rgb, uint32_t rgb_stride, - YCbCrType yuv_type); - -void yuv422_abgr_sseu( - uint32_t width, uint32_t height, - const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, - uint8_t *rgb, uint32_t rgb_stride, - YCbCrType yuv_type); - -void yuvnv12_rgb565_sseu( - uint32_t width, uint32_t height, - const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, - uint8_t *rgb, uint32_t rgb_stride, - YCbCrType yuv_type); - -void yuvnv12_rgb24_sseu( - uint32_t width, uint32_t height, - const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, - uint8_t *rgb, uint32_t rgb_stride, - YCbCrType yuv_type); - -void yuvnv12_rgba_sseu( - uint32_t width, uint32_t height, - const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, - uint8_t *rgb, uint32_t rgb_stride, - YCbCrType yuv_type); - -void yuvnv12_bgra_sseu( - uint32_t width, uint32_t height, - const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, - uint8_t *rgb, uint32_t rgb_stride, - YCbCrType yuv_type); - -void yuvnv12_argb_sseu( - uint32_t width, uint32_t height, - const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, - uint8_t *rgb, uint32_t rgb_stride, - YCbCrType yuv_type); - -void yuvnv12_abgr_sseu( - uint32_t width, uint32_t height, - const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, - uint8_t *rgb, uint32_t rgb_stride, - YCbCrType yuv_type); - - -// rgb to yuv, standard c implementation -void rgb24_yuv420_std( - uint32_t width, uint32_t height, - const uint8_t *rgb, uint32_t rgb_stride, - uint8_t *y, uint8_t *u, uint8_t *v, uint32_t y_stride, uint32_t uv_stride, - YCbCrType yuv_type); - -// rgb to yuv, sse implementation -// pointers must be 16 byte aligned, and strides must be divisible by 16 -void rgb24_yuv420_sse( - uint32_t width, uint32_t height, - const uint8_t *rgb, uint32_t rgb_stride, - uint8_t *y, uint8_t *u, uint8_t *v, uint32_t y_stride, uint32_t uv_stride, - YCbCrType yuv_type); - -// rgb to yuv, sse implementation -// pointers do not need to be 16 byte aligned -void rgb24_yuv420_sseu( - uint32_t width, uint32_t height, - const uint8_t *rgb, uint32_t rgb_stride, - uint8_t *y, uint8_t *u, uint8_t *v, uint32_t y_stride, uint32_t uv_stride, - YCbCrType yuv_type); - - -//yuv420 to bgra, lsx implementation -void yuv420_rgb24_lsx( - uint32_t width, uint32_t height, - const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, - uint8_t *rgb, uint32_t rgb_stride, - YCbCrType yuv_type); - -void yuv420_rgba_lsx( - uint32_t width, uint32_t height, - const uint8_t *y, const uint8_t *v, const uint8_t *u, uint32_t y_stride, uint32_t uv_stride, - uint8_t *rgb, uint32_t rgb_stride, - YCbCrType yuv_type); +#include "yuv_rgb_std.h" -void yuv420_bgra_lsx( - uint32_t width, uint32_t height, - const uint8_t *y, const uint8_t *v, const uint8_t *u, uint32_t y_stride, uint32_t uv_stride, - uint8_t *rgb, uint32_t rgb_stride, - YCbCrType yuv_type); +// yuv to rgb, sse2 implementation +#include "yuv_rgb_sse.h" -void yuv420_argb_lsx( - uint32_t width, uint32_t height, - const uint8_t *y, const uint8_t *v, const uint8_t *u, uint32_t y_stride, uint32_t uv_stride, - uint8_t *rgb, uint32_t rgb_stride, - YCbCrType yuv_type); +// yuv to rgb, lsx implementation +#include "yuv_rgb_lsx.h" -void yuv420_abgr_lsx( - uint32_t width, uint32_t height, - const uint8_t *y, const uint8_t *v, const uint8_t *u, uint32_t y_stride, uint32_t uv_stride, - uint8_t *rgb, uint32_t rgb_stride, - YCbCrType yuv_type); +#endif /* YUV_RGB_H_ */ diff --git a/thirdparty/SDL/src/video/yuv2rgb/yuv_rgb_common.h b/thirdparty/SDL/src/video/yuv2rgb/yuv_rgb_common.h new file mode 100644 index 000000000..ae787ed5f --- /dev/null +++ b/thirdparty/SDL/src/video/yuv2rgb/yuv_rgb_common.h @@ -0,0 +1,13 @@ +#ifndef YUV_RGB_COMMON_H_ +#define YUV_RGB_COMMON_H_ +// Copyright 2016 Adrien Descamps +// Distributed under BSD 3-Clause License + +typedef enum +{ + YCBCR_JPEG, + YCBCR_601, + YCBCR_709 +} YCbCrType; + +#endif /* YUV_RGB_COMMON_H_ */ diff --git a/thirdparty/SDL/src/video/yuv2rgb/yuv_rgb_internal.h b/thirdparty/SDL/src/video/yuv2rgb/yuv_rgb_internal.h new file mode 100644 index 000000000..cad978b5f --- /dev/null +++ b/thirdparty/SDL/src/video/yuv2rgb/yuv_rgb_internal.h @@ -0,0 +1,74 @@ +// Copyright 2016 Adrien Descamps +// Distributed under BSD 3-Clause License + +#define PRECISION 6 +#define PRECISION_FACTOR (1<[0-255]) +// for ITU-R BT.709-6 values are derived from equations in sections 3.2-3.4, assuming RGB is encoded using full range ([0-1]<->[0-255]) +// all values are rounded to the fourth decimal + +static const YUV2RGBParam YUV2RGB[3] = { + // ITU-T T.871 (JPEG) + {/*.y_shift=*/ 0, /*.y_factor=*/ V(1.0), /*.v_r_factor=*/ V(1.402), /*.u_g_factor=*/ -V(0.3441), /*.v_g_factor=*/ -V(0.7141), /*.u_b_factor=*/ V(1.772)}, + // ITU-R BT.601-7 + {/*.y_shift=*/ 16, /*.y_factor=*/ V(1.1644), /*.v_r_factor=*/ V(1.596), /*.u_g_factor=*/ -V(0.3918), /*.v_g_factor=*/ -V(0.813), /*.u_b_factor=*/ V(2.0172)}, + // ITU-R BT.709-6 + {/*.y_shift=*/ 16, /*.y_factor=*/ V(1.1644), /*.v_r_factor=*/ V(1.7927), /*.u_g_factor=*/ -V(0.2132), /*.v_g_factor=*/ -V(0.5329), /*.u_b_factor=*/ V(2.1124)} +}; + +static const RGB2YUVParam RGB2YUV[3] = { + // ITU-T T.871 (JPEG) + {/*.y_shift=*/ 0, /*.matrix=*/ {{V(0.299), V(0.587), V(0.114)}, {-V(0.1687), -V(0.3313), V(0.5)}, {V(0.5), -V(0.4187), -V(0.0813)}}}, + // ITU-R BT.601-7 + {/*.y_shift=*/ 16, /*.matrix=*/ {{V(0.2568), V(0.5041), V(0.0979)}, {-V(0.1482), -V(0.291), V(0.4392)}, {V(0.4392), -V(0.3678), -V(0.0714)}}}, + // ITU-R BT.709-6 + {/*.y_shift=*/ 16, /*.matrix=*/ {{V(0.1826), V(0.6142), V(0.062)}, {-V(0.1006), -V(0.3386), V(0.4392)}, {V(0.4392), -V(0.3989), -V(0.0403)}}} +}; + +#ifdef _MSC_VER +#pragma warning(pop) +#endif + +/* The various layouts of YUV data we support */ +#define YUV_FORMAT_420 1 +#define YUV_FORMAT_422 2 +#define YUV_FORMAT_NV12 3 + +/* The various formats of RGB pixel that we support */ +#define RGB_FORMAT_RGB565 1 +#define RGB_FORMAT_RGB24 2 +#define RGB_FORMAT_RGBA 3 +#define RGB_FORMAT_BGRA 4 +#define RGB_FORMAT_ARGB 5 +#define RGB_FORMAT_ABGR 6 diff --git a/thirdparty/SDL/src/video/yuv2rgb/yuv_rgb_lsx.c b/thirdparty/SDL/src/video/yuv2rgb/yuv_rgb_lsx.c new file mode 100644 index 000000000..f24a05276 --- /dev/null +++ b/thirdparty/SDL/src/video/yuv2rgb/yuv_rgb_lsx.c @@ -0,0 +1,44 @@ +// Copyright 2016 Adrien Descamps +// Distributed under BSD 3-Clause License +#include "../../SDL_internal.h" + +#if SDL_HAVE_YUV +#include "yuv_rgb.h" +#include "yuv_rgb_internal.h" +#include "SDL_cpuinfo.h" + +#ifdef __loongarch_sx + +#define LSX_FUNCTION_NAME yuv420_rgb24_lsx +#define STD_FUNCTION_NAME yuv420_rgb24_std +#define YUV_FORMAT YUV_FORMAT_420 +#define RGB_FORMAT RGB_FORMAT_RGB24 +#include "yuv_rgb_lsx_func.h" + +#define LSX_FUNCTION_NAME yuv420_rgba_lsx +#define STD_FUNCTION_NAME yuv420_rgba_std +#define YUV_FORMAT YUV_FORMAT_420 +#define RGB_FORMAT RGB_FORMAT_RGBA +#include "yuv_rgb_lsx_func.h" + +#define LSX_FUNCTION_NAME yuv420_bgra_lsx +#define STD_FUNCTION_NAME yuv420_bgra_std +#define YUV_FORMAT YUV_FORMAT_420 +#define RGB_FORMAT RGB_FORMAT_BGRA +#include "yuv_rgb_lsx_func.h" + +#define LSX_FUNCTION_NAME yuv420_argb_lsx +#define STD_FUNCTION_NAME yuv420_argb_std +#define YUV_FORMAT YUV_FORMAT_420 +#define RGB_FORMAT RGB_FORMAT_ARGB +#include "yuv_rgb_lsx_func.h" + +#define LSX_FUNCTION_NAME yuv420_abgr_lsx +#define STD_FUNCTION_NAME yuv420_abgr_std +#define YUV_FORMAT YUV_FORMAT_420 +#define RGB_FORMAT RGB_FORMAT_ABGR +#include "yuv_rgb_lsx_func.h" + +#endif //__loongarch_sx + +#endif /* SDL_HAVE_YUV */ diff --git a/thirdparty/SDL/src/video/yuv2rgb/yuv_rgb_lsx.h b/thirdparty/SDL/src/video/yuv2rgb/yuv_rgb_lsx.h new file mode 100644 index 000000000..bcffd95c6 --- /dev/null +++ b/thirdparty/SDL/src/video/yuv2rgb/yuv_rgb_lsx.h @@ -0,0 +1,407 @@ +// Copyright 2016 Adrien Descamps +// Distributed under BSD 3-Clause License + +// Provide optimized functions to convert images from 8bits yuv420 to rgb24 format + +// There are a few slightly different variations of the YCbCr color space with different parameters that +// change the conversion matrix. +// The three most common YCbCr color space, defined by BT.601, BT.709 and JPEG standard are implemented here. +// See the respective standards for details +// The matrix values used are derived from http://www.equasys.de/colorconversion.html + +// YUV420 is stored as three separate channels, with U and V (Cb and Cr) subsampled by a 2 factor +// For conversion from yuv to rgb, no interpolation is done, and the same UV value are used for 4 rgb pixels. This +// is suboptimal for image quality, but by far the fastest method. + +// For all methods, width and height should be even, if not, the last row/column of the result image won't be affected. +// For sse methods, if the width if not divisable by 32, the last (width%32) pixels of each line won't be affected. + +/*#include */ +#include "yuv_rgb_common.h" + +#include "SDL_stdinc.h" + +// yuv to rgb, standard c implementation +void yuv420_rgb565_std( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv420_rgb24_std( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv420_rgba_std( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv420_bgra_std( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv420_argb_std( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv420_abgr_std( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv422_rgb565_std( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv422_rgb24_std( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv422_rgba_std( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv422_bgra_std( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv422_argb_std( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv422_abgr_std( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuvnv12_rgb565_std( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuvnv12_rgb24_std( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuvnv12_rgba_std( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuvnv12_bgra_std( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuvnv12_argb_std( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuvnv12_abgr_std( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +// yuv to rgb, sse implementation +// pointers must be 16 byte aligned, and strides must be divisable by 16 +void yuv420_rgb565_sse( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv420_rgb24_sse( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv420_rgba_sse( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv420_bgra_sse( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv420_argb_sse( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv420_abgr_sse( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv422_rgb565_sse( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv422_rgb24_sse( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv422_rgba_sse( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv422_bgra_sse( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv422_argb_sse( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv422_abgr_sse( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuvnv12_rgb565_sse( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuvnv12_rgb24_sse( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuvnv12_rgba_sse( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuvnv12_bgra_sse( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuvnv12_argb_sse( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuvnv12_abgr_sse( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +// yuv to rgb, sse implementation +// pointers do not need to be 16 byte aligned +void yuv420_rgb565_sseu( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv420_rgb24_sseu( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv420_rgba_sseu( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv420_bgra_sseu( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv420_argb_sseu( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv420_abgr_sseu( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv422_rgb565_sseu( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv422_rgb24_sseu( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv422_rgba_sseu( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv422_bgra_sseu( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv422_argb_sseu( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv422_abgr_sseu( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuvnv12_rgb565_sseu( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuvnv12_rgb24_sseu( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuvnv12_rgba_sseu( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuvnv12_bgra_sseu( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuvnv12_argb_sseu( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuvnv12_abgr_sseu( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + + +// rgb to yuv, standard c implementation +void rgb24_yuv420_std( + uint32_t width, uint32_t height, + const uint8_t *rgb, uint32_t rgb_stride, + uint8_t *y, uint8_t *u, uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + YCbCrType yuv_type); + +// rgb to yuv, sse implementation +// pointers must be 16 byte aligned, and strides must be divisible by 16 +void rgb24_yuv420_sse( + uint32_t width, uint32_t height, + const uint8_t *rgb, uint32_t rgb_stride, + uint8_t *y, uint8_t *u, uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + YCbCrType yuv_type); + +// rgb to yuv, sse implementation +// pointers do not need to be 16 byte aligned +void rgb24_yuv420_sseu( + uint32_t width, uint32_t height, + const uint8_t *rgb, uint32_t rgb_stride, + uint8_t *y, uint8_t *u, uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + YCbCrType yuv_type); + + +//yuv420 to bgra, lsx implementation +void yuv420_rgb24_lsx( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv420_rgba_lsx( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *v, const uint8_t *u, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv420_bgra_lsx( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *v, const uint8_t *u, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv420_argb_lsx( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *v, const uint8_t *u, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv420_abgr_lsx( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *v, const uint8_t *u, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); diff --git a/thirdparty/SDL/src/video/yuv2rgb/yuv_rgb.c b/thirdparty/SDL/src/video/yuv2rgb/yuv_rgb_sse.c similarity index 52% rename from thirdparty/SDL/src/video/yuv2rgb/yuv_rgb.c rename to thirdparty/SDL/src/video/yuv2rgb/yuv_rgb_sse.c index c7415aa72..b22a89fa4 100644 --- a/thirdparty/SDL/src/video/yuv2rgb/yuv_rgb.c +++ b/thirdparty/SDL/src/video/yuv2rgb/yuv_rgb_sse.c @@ -3,253 +3,141 @@ #include "../../SDL_internal.h" #if SDL_HAVE_YUV - #include "yuv_rgb.h" +#include "yuv_rgb_internal.h" #include "SDL_cpuinfo.h" /*#include */ -#define PRECISION 6 -#define PRECISION_FACTOR (1<[0-255]) -// for ITU-R BT.709-6 values are derived from equations in sections 3.2-3.4, assuming RGB is encoded using full range ([0-1]<->[0-255]) -// all values are rounded to the fourth decimal - -static const YUV2RGBParam YUV2RGB[3] = { - // ITU-T T.871 (JPEG) - {/*.y_shift=*/ 0, /*.y_factor=*/ V(1.0), /*.v_r_factor=*/ V(1.402), /*.u_g_factor=*/ -V(0.3441), /*.v_g_factor=*/ -V(0.7141), /*.u_b_factor=*/ V(1.772)}, - // ITU-R BT.601-7 - {/*.y_shift=*/ 16, /*.y_factor=*/ V(1.1644), /*.v_r_factor=*/ V(1.596), /*.u_g_factor=*/ -V(0.3918), /*.v_g_factor=*/ -V(0.813), /*.u_b_factor=*/ V(2.0172)}, - // ITU-R BT.709-6 - {/*.y_shift=*/ 16, /*.y_factor=*/ V(1.1644), /*.v_r_factor=*/ V(1.7927), /*.u_g_factor=*/ -V(0.2132), /*.v_g_factor=*/ -V(0.5329), /*.u_b_factor=*/ V(2.1124)} -}; - -static const RGB2YUVParam RGB2YUV[3] = { - // ITU-T T.871 (JPEG) - {/*.y_shift=*/ 0, /*.matrix=*/ {{V(0.299), V(0.587), V(0.114)}, {-V(0.1687), -V(0.3313), V(0.5)}, {V(0.5), -V(0.4187), -V(0.0813)}}}, - // ITU-R BT.601-7 - {/*.y_shift=*/ 16, /*.matrix=*/ {{V(0.2568), V(0.5041), V(0.0979)}, {-V(0.1482), -V(0.291), V(0.4392)}, {V(0.4392), -V(0.3678), -V(0.0714)}}}, - // ITU-R BT.709-6 - {/*.y_shift=*/ 16, /*.matrix=*/ {{V(0.1826), V(0.6142), V(0.062)}, {-V(0.1006), -V(0.3386), V(0.4392)}, {V(0.4392), -V(0.3989), -V(0.0403)}}} -}; - -/* The various layouts of YUV data we support */ -#define YUV_FORMAT_420 1 -#define YUV_FORMAT_422 2 -#define YUV_FORMAT_NV12 3 - -/* The various formats of RGB pixel that we support */ -#define RGB_FORMAT_RGB565 1 -#define RGB_FORMAT_RGB24 2 -#define RGB_FORMAT_RGBA 3 -#define RGB_FORMAT_BGRA 4 -#define RGB_FORMAT_ARGB 5 -#define RGB_FORMAT_ABGR 6 - -// divide by PRECISION_FACTOR and clamp to [0:255] interval -// input must be in the [-128*PRECISION_FACTOR:384*PRECISION_FACTOR] range -static uint8_t clampU8(int32_t v) -{ - static const uint8_t lut[512] = - {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46, - 47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90, - 91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125, - 126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158, - 159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191, - 192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224, - 225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255, - 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255 - }; - return lut[((v+128*PRECISION_FACTOR)>>PRECISION)&511]; -} - +#ifdef __SSE2__ +/* SDL doesn't use these atm and compiling them adds seconds onto the build. --ryan. +#define SSE_FUNCTION_NAME yuv420_rgb565_sse #define STD_FUNCTION_NAME yuv420_rgb565_std #define YUV_FORMAT YUV_FORMAT_420 #define RGB_FORMAT RGB_FORMAT_RGB565 -#include "yuv_rgb_std_func.h" +#define SSE_ALIGNED +#include "yuv_rgb_sse_func.h" +#define SSE_FUNCTION_NAME yuv420_rgb24_sse #define STD_FUNCTION_NAME yuv420_rgb24_std #define YUV_FORMAT YUV_FORMAT_420 #define RGB_FORMAT RGB_FORMAT_RGB24 -#include "yuv_rgb_std_func.h" +#define SSE_ALIGNED +#include "yuv_rgb_sse_func.h" +#define SSE_FUNCTION_NAME yuv420_rgba_sse #define STD_FUNCTION_NAME yuv420_rgba_std #define YUV_FORMAT YUV_FORMAT_420 #define RGB_FORMAT RGB_FORMAT_RGBA -#include "yuv_rgb_std_func.h" +#define SSE_ALIGNED +#include "yuv_rgb_sse_func.h" +#define SSE_FUNCTION_NAME yuv420_bgra_sse #define STD_FUNCTION_NAME yuv420_bgra_std #define YUV_FORMAT YUV_FORMAT_420 #define RGB_FORMAT RGB_FORMAT_BGRA -#include "yuv_rgb_std_func.h" +#define SSE_ALIGNED +#include "yuv_rgb_sse_func.h" +#define SSE_FUNCTION_NAME yuv420_argb_sse #define STD_FUNCTION_NAME yuv420_argb_std #define YUV_FORMAT YUV_FORMAT_420 #define RGB_FORMAT RGB_FORMAT_ARGB -#include "yuv_rgb_std_func.h" +#define SSE_ALIGNED +#include "yuv_rgb_sse_func.h" +#define SSE_FUNCTION_NAME yuv420_abgr_sse #define STD_FUNCTION_NAME yuv420_abgr_std #define YUV_FORMAT YUV_FORMAT_420 #define RGB_FORMAT RGB_FORMAT_ABGR -#include "yuv_rgb_std_func.h" +#define SSE_ALIGNED +#include "yuv_rgb_sse_func.h" +#define SSE_FUNCTION_NAME yuv422_rgb565_sse #define STD_FUNCTION_NAME yuv422_rgb565_std #define YUV_FORMAT YUV_FORMAT_422 #define RGB_FORMAT RGB_FORMAT_RGB565 -#include "yuv_rgb_std_func.h" +#define SSE_ALIGNED +#include "yuv_rgb_sse_func.h" +#define SSE_FUNCTION_NAME yuv422_rgb24_sse #define STD_FUNCTION_NAME yuv422_rgb24_std #define YUV_FORMAT YUV_FORMAT_422 #define RGB_FORMAT RGB_FORMAT_RGB24 -#include "yuv_rgb_std_func.h" +#define SSE_ALIGNED +#include "yuv_rgb_sse_func.h" +#define SSE_FUNCTION_NAME yuv422_rgba_sse #define STD_FUNCTION_NAME yuv422_rgba_std #define YUV_FORMAT YUV_FORMAT_422 #define RGB_FORMAT RGB_FORMAT_RGBA -#include "yuv_rgb_std_func.h" +#define SSE_ALIGNED +#include "yuv_rgb_sse_func.h" +#define SSE_FUNCTION_NAME yuv422_bgra_sse #define STD_FUNCTION_NAME yuv422_bgra_std #define YUV_FORMAT YUV_FORMAT_422 #define RGB_FORMAT RGB_FORMAT_BGRA -#include "yuv_rgb_std_func.h" +#define SSE_ALIGNED +#include "yuv_rgb_sse_func.h" +#define SSE_FUNCTION_NAME yuv422_argb_sse #define STD_FUNCTION_NAME yuv422_argb_std #define YUV_FORMAT YUV_FORMAT_422 #define RGB_FORMAT RGB_FORMAT_ARGB -#include "yuv_rgb_std_func.h" +#define SSE_ALIGNED +#include "yuv_rgb_sse_func.h" +#define SSE_FUNCTION_NAME yuv422_abgr_sse #define STD_FUNCTION_NAME yuv422_abgr_std #define YUV_FORMAT YUV_FORMAT_422 #define RGB_FORMAT RGB_FORMAT_ABGR -#include "yuv_rgb_std_func.h" +#define SSE_ALIGNED +#include "yuv_rgb_sse_func.h" +#define SSE_FUNCTION_NAME yuvnv12_rgb565_sse #define STD_FUNCTION_NAME yuvnv12_rgb565_std #define YUV_FORMAT YUV_FORMAT_NV12 #define RGB_FORMAT RGB_FORMAT_RGB565 -#include "yuv_rgb_std_func.h" +#define SSE_ALIGNED +#include "yuv_rgb_sse_func.h" +#define SSE_FUNCTION_NAME yuvnv12_rgb24_sse #define STD_FUNCTION_NAME yuvnv12_rgb24_std #define YUV_FORMAT YUV_FORMAT_NV12 #define RGB_FORMAT RGB_FORMAT_RGB24 -#include "yuv_rgb_std_func.h" +#define SSE_ALIGNED +#include "yuv_rgb_sse_func.h" +#define SSE_FUNCTION_NAME yuvnv12_rgba_sse #define STD_FUNCTION_NAME yuvnv12_rgba_std #define YUV_FORMAT YUV_FORMAT_NV12 #define RGB_FORMAT RGB_FORMAT_RGBA -#include "yuv_rgb_std_func.h" +#define SSE_ALIGNED +#include "yuv_rgb_sse_func.h" +#define SSE_FUNCTION_NAME yuvnv12_bgra_sse #define STD_FUNCTION_NAME yuvnv12_bgra_std #define YUV_FORMAT YUV_FORMAT_NV12 #define RGB_FORMAT RGB_FORMAT_BGRA -#include "yuv_rgb_std_func.h" +#define SSE_ALIGNED +#include "yuv_rgb_sse_func.h" +#define SSE_FUNCTION_NAME yuvnv12_argb_sse #define STD_FUNCTION_NAME yuvnv12_argb_std #define YUV_FORMAT YUV_FORMAT_NV12 #define RGB_FORMAT RGB_FORMAT_ARGB -#include "yuv_rgb_std_func.h" +#define SSE_ALIGNED +#include "yuv_rgb_sse_func.h" +#define SSE_FUNCTION_NAME yuvnv12_abgr_sse #define STD_FUNCTION_NAME yuvnv12_abgr_std #define YUV_FORMAT YUV_FORMAT_NV12 #define RGB_FORMAT RGB_FORMAT_ABGR -#include "yuv_rgb_std_func.h" - -void rgb24_yuv420_std( - uint32_t width, uint32_t height, - const uint8_t *RGB, uint32_t RGB_stride, - uint8_t *Y, uint8_t *U, uint8_t *V, uint32_t Y_stride, uint32_t UV_stride, - YCbCrType yuv_type) -{ - const RGB2YUVParam *const param = &(RGB2YUV[yuv_type]); - - uint32_t x, y; - for(y=0; y<(height-1); y+=2) - { - const uint8_t *rgb_ptr1=RGB+y*RGB_stride, - *rgb_ptr2=RGB+(y+1)*RGB_stride; - - uint8_t *y_ptr1=Y+y*Y_stride, - *y_ptr2=Y+(y+1)*Y_stride, - *u_ptr=U+(y/2)*UV_stride, - *v_ptr=V+(y/2)*UV_stride; - - for(x=0; x<(width-1); x+=2) - { - // compute yuv for the four pixels, u and v values are summed - int32_t y_tmp, u_tmp, v_tmp; - - y_tmp = param->matrix[0][0]*rgb_ptr1[0] + param->matrix[0][1]*rgb_ptr1[1] + param->matrix[0][2]*rgb_ptr1[2]; - u_tmp = param->matrix[1][0]*rgb_ptr1[0] + param->matrix[1][1]*rgb_ptr1[1] + param->matrix[1][2]*rgb_ptr1[2]; - v_tmp = param->matrix[2][0]*rgb_ptr1[0] + param->matrix[2][1]*rgb_ptr1[1] + param->matrix[2][2]*rgb_ptr1[2]; - y_ptr1[0]=clampU8(y_tmp+((param->y_shift)<matrix[0][0]*rgb_ptr1[3] + param->matrix[0][1]*rgb_ptr1[4] + param->matrix[0][2]*rgb_ptr1[5]; - u_tmp += param->matrix[1][0]*rgb_ptr1[3] + param->matrix[1][1]*rgb_ptr1[4] + param->matrix[1][2]*rgb_ptr1[5]; - v_tmp += param->matrix[2][0]*rgb_ptr1[3] + param->matrix[2][1]*rgb_ptr1[4] + param->matrix[2][2]*rgb_ptr1[5]; - y_ptr1[1]=clampU8(y_tmp+((param->y_shift)<matrix[0][0]*rgb_ptr2[0] + param->matrix[0][1]*rgb_ptr2[1] + param->matrix[0][2]*rgb_ptr2[2]; - u_tmp += param->matrix[1][0]*rgb_ptr2[0] + param->matrix[1][1]*rgb_ptr2[1] + param->matrix[1][2]*rgb_ptr2[2]; - v_tmp += param->matrix[2][0]*rgb_ptr2[0] + param->matrix[2][1]*rgb_ptr2[1] + param->matrix[2][2]*rgb_ptr2[2]; - y_ptr2[0]=clampU8(y_tmp+((param->y_shift)<matrix[0][0]*rgb_ptr2[3] + param->matrix[0][1]*rgb_ptr2[4] + param->matrix[0][2]*rgb_ptr2[5]; - u_tmp += param->matrix[1][0]*rgb_ptr2[3] + param->matrix[1][1]*rgb_ptr2[4] + param->matrix[1][2]*rgb_ptr2[5]; - v_tmp += param->matrix[2][0]*rgb_ptr2[3] + param->matrix[2][1]*rgb_ptr2[4] + param->matrix[2][2]*rgb_ptr2[5]; - y_ptr2[1]=clampU8(y_tmp+((param->y_shift)<matrix[0][0])), \ - _mm_mullo_epi16(G, _mm_set1_epi16(param->matrix[0][1]))); \ + _mm_mullo_epi16(G, _mm_set1_epi16(param->matrix[0][1]))); \ Y = _mm_add_epi16(Y, _mm_mullo_epi16(B, _mm_set1_epi16(param->matrix[0][2]))); \ Y = _mm_add_epi16(Y, _mm_set1_epi16((param->y_shift)<matrix[1][0])), \ - _mm_mullo_epi16(G, _mm_set1_epi16(param->matrix[1][1]))); \ + _mm_mullo_epi16(G, _mm_set1_epi16(param->matrix[1][1]))); \ U = _mm_add_epi16(U, _mm_mullo_epi16(B, _mm_set1_epi16(param->matrix[1][2]))); \ U = _mm_add_epi16(U, _mm_set1_epi16(128<matrix[2][0])), \ - _mm_mullo_epi16(G, _mm_set1_epi16(param->matrix[2][1]))); \ + _mm_mullo_epi16(G, _mm_set1_epi16(param->matrix[2][1]))); \ V = _mm_add_epi16(V, _mm_mullo_epi16(B, _mm_set1_epi16(param->matrix[2][2]))); \ V = _mm_add_epi16(V, _mm_set1_epi16(128<*/ +#include "yuv_rgb_common.h" + +#include "SDL_stdinc.h" + +// yuv to rgb, sse implementation +// pointers must be 16 byte aligned, and strides must be divisable by 16 +void yuv420_rgb565_sse( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv420_rgb24_sse( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv420_rgba_sse( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv420_bgra_sse( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv420_argb_sse( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv420_abgr_sse( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv422_rgb565_sse( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv422_rgb24_sse( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv422_rgba_sse( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv422_bgra_sse( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv422_argb_sse( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv422_abgr_sse( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuvnv12_rgb565_sse( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuvnv12_rgb24_sse( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuvnv12_rgba_sse( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuvnv12_bgra_sse( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuvnv12_argb_sse( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuvnv12_abgr_sse( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +// yuv to rgb, sse implementation +// pointers do not need to be 16 byte aligned +void yuv420_rgb565_sseu( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv420_rgb24_sseu( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv420_rgba_sseu( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv420_bgra_sseu( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv420_argb_sseu( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv420_abgr_sseu( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv422_rgb565_sseu( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv422_rgb24_sseu( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv422_rgba_sseu( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv422_bgra_sseu( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv422_argb_sseu( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv422_abgr_sseu( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuvnv12_rgb565_sseu( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuvnv12_rgb24_sseu( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuvnv12_rgba_sseu( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuvnv12_bgra_sseu( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuvnv12_argb_sseu( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuvnv12_abgr_sseu( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + + +// rgb to yuv, standard c implementation +void rgb24_yuv420_std( + uint32_t width, uint32_t height, + const uint8_t *rgb, uint32_t rgb_stride, + uint8_t *y, uint8_t *u, uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + YCbCrType yuv_type); + +// rgb to yuv, sse implementation +// pointers must be 16 byte aligned, and strides must be divisible by 16 +void rgb24_yuv420_sse( + uint32_t width, uint32_t height, + const uint8_t *rgb, uint32_t rgb_stride, + uint8_t *y, uint8_t *u, uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + YCbCrType yuv_type); + +// rgb to yuv, sse implementation +// pointers do not need to be 16 byte aligned +void rgb24_yuv420_sseu( + uint32_t width, uint32_t height, + const uint8_t *rgb, uint32_t rgb_stride, + uint8_t *y, uint8_t *u, uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + YCbCrType yuv_type); diff --git a/thirdparty/SDL/src/video/yuv2rgb/yuv_rgb_sse_func.h b/thirdparty/SDL/src/video/yuv2rgb/yuv_rgb_sse_func.h index f541017a4..295749a87 100644 --- a/thirdparty/SDL/src/video/yuv2rgb/yuv_rgb_sse_func.h +++ b/thirdparty/SDL/src/video/yuv2rgb/yuv_rgb_sse_func.h @@ -52,7 +52,7 @@ { \ __m128i red_mask, tmp1, tmp2, tmp3, tmp4; \ \ - red_mask = _mm_set1_epi16((short)0xF800); \ + red_mask = _mm_set1_epi16((unsigned short)0xF800); \ RGB1 = _mm_and_si128(_mm_unpacklo_epi8(_mm_setzero_si128(), R1), red_mask); \ RGB2 = _mm_and_si128(_mm_unpackhi_epi8(_mm_setzero_si128(), R1), red_mask); \ RGB3 = _mm_and_si128(_mm_unpacklo_epi8(_mm_setzero_si128(), R2), red_mask); \ @@ -145,7 +145,7 @@ PACK_RGB24_32_STEP1(R1, R2, G1, G2, B1, B2, RGB1, RGB2, RGB3, RGB4, RGB5, RGB6) #define PACK_PIXEL \ __m128i rgb_1, rgb_2, rgb_3, rgb_4, rgb_5, rgb_6, rgb_7, rgb_8; \ __m128i rgb_9, rgb_10, rgb_11, rgb_12, rgb_13, rgb_14, rgb_15, rgb_16; \ - __m128i a = _mm_set1_epi8((char)0xFF); \ + __m128i a = _mm_set1_epi8((unsigned char)0xFF); \ \ PACK_RGBA_32(r_8_11, r_8_12, g_8_11, g_8_12, b_8_11, b_8_12, a, a, rgb_1, rgb_2, rgb_3, rgb_4, rgb_5, rgb_6, rgb_7, rgb_8) \ \ @@ -156,7 +156,7 @@ PACK_RGB24_32_STEP1(R1, R2, G1, G2, B1, B2, RGB1, RGB2, RGB3, RGB4, RGB5, RGB6) #define PACK_PIXEL \ __m128i rgb_1, rgb_2, rgb_3, rgb_4, rgb_5, rgb_6, rgb_7, rgb_8; \ __m128i rgb_9, rgb_10, rgb_11, rgb_12, rgb_13, rgb_14, rgb_15, rgb_16; \ - __m128i a = _mm_set1_epi8((char)0xFF); \ + __m128i a = _mm_set1_epi8((unsigned char)0xFF); \ \ PACK_RGBA_32(b_8_11, b_8_12, g_8_11, g_8_12, r_8_11, r_8_12, a, a, rgb_1, rgb_2, rgb_3, rgb_4, rgb_5, rgb_6, rgb_7, rgb_8) \ \ @@ -167,7 +167,7 @@ PACK_RGB24_32_STEP1(R1, R2, G1, G2, B1, B2, RGB1, RGB2, RGB3, RGB4, RGB5, RGB6) #define PACK_PIXEL \ __m128i rgb_1, rgb_2, rgb_3, rgb_4, rgb_5, rgb_6, rgb_7, rgb_8; \ __m128i rgb_9, rgb_10, rgb_11, rgb_12, rgb_13, rgb_14, rgb_15, rgb_16; \ - __m128i a = _mm_set1_epi8((char)0xFF); \ + __m128i a = _mm_set1_epi8((unsigned char)0xFF); \ \ PACK_RGBA_32(a, a, r_8_11, r_8_12, g_8_11, g_8_12, b_8_11, b_8_12, rgb_1, rgb_2, rgb_3, rgb_4, rgb_5, rgb_6, rgb_7, rgb_8) \ \ @@ -178,7 +178,7 @@ PACK_RGB24_32_STEP1(R1, R2, G1, G2, B1, B2, RGB1, RGB2, RGB3, RGB4, RGB5, RGB6) #define PACK_PIXEL \ __m128i rgb_1, rgb_2, rgb_3, rgb_4, rgb_5, rgb_6, rgb_7, rgb_8; \ __m128i rgb_9, rgb_10, rgb_11, rgb_12, rgb_13, rgb_14, rgb_15, rgb_16; \ - __m128i a = _mm_set1_epi8((char)0xFF); \ + __m128i a = _mm_set1_epi8((unsigned char)0xFF); \ \ PACK_RGBA_32(a, a, b_8_11, b_8_12, g_8_11, g_8_12, r_8_11, r_8_12, rgb_1, rgb_2, rgb_3, rgb_4, rgb_5, rgb_6, rgb_7, rgb_8) \ \ @@ -491,7 +491,7 @@ void SSE_FUNCTION_NAME(uint32_t width, uint32_t height, /* Catch the right column, if needed */ { - int converted = (width & ~31); + uint32_t converted = (width & ~31); if (fix_read_nv12) { converted -= 32; } diff --git a/thirdparty/SDL/src/video/yuv2rgb/yuv_rgb_std.c b/thirdparty/SDL/src/video/yuv2rgb/yuv_rgb_std.c new file mode 100644 index 000000000..a222a3abb --- /dev/null +++ b/thirdparty/SDL/src/video/yuv2rgb/yuv_rgb_std.c @@ -0,0 +1,179 @@ +// Copyright 2016 Adrien Descamps +// Distributed under BSD 3-Clause License +#include "../../SDL_internal.h" + +#if SDL_HAVE_YUV +#include "yuv_rgb.h" +#include "yuv_rgb_internal.h" + +// divide by PRECISION_FACTOR and clamp to [0:255] interval +// input must be in the [-128*PRECISION_FACTOR:384*PRECISION_FACTOR] range +static uint8_t clampU8(int32_t v) +{ + static const uint8_t lut[512] = + {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46, + 47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90, + 91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125, + 126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158, + 159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191, + 192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224, + 225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255 + }; + return lut[((v+128*PRECISION_FACTOR)>>PRECISION)&511]; +} + + +#define STD_FUNCTION_NAME yuv420_rgb565_std +#define YUV_FORMAT YUV_FORMAT_420 +#define RGB_FORMAT RGB_FORMAT_RGB565 +#include "yuv_rgb_std_func.h" + +#define STD_FUNCTION_NAME yuv420_rgb24_std +#define YUV_FORMAT YUV_FORMAT_420 +#define RGB_FORMAT RGB_FORMAT_RGB24 +#include "yuv_rgb_std_func.h" + +#define STD_FUNCTION_NAME yuv420_rgba_std +#define YUV_FORMAT YUV_FORMAT_420 +#define RGB_FORMAT RGB_FORMAT_RGBA +#include "yuv_rgb_std_func.h" + +#define STD_FUNCTION_NAME yuv420_bgra_std +#define YUV_FORMAT YUV_FORMAT_420 +#define RGB_FORMAT RGB_FORMAT_BGRA +#include "yuv_rgb_std_func.h" + +#define STD_FUNCTION_NAME yuv420_argb_std +#define YUV_FORMAT YUV_FORMAT_420 +#define RGB_FORMAT RGB_FORMAT_ARGB +#include "yuv_rgb_std_func.h" + +#define STD_FUNCTION_NAME yuv420_abgr_std +#define YUV_FORMAT YUV_FORMAT_420 +#define RGB_FORMAT RGB_FORMAT_ABGR +#include "yuv_rgb_std_func.h" + +#define STD_FUNCTION_NAME yuv422_rgb565_std +#define YUV_FORMAT YUV_FORMAT_422 +#define RGB_FORMAT RGB_FORMAT_RGB565 +#include "yuv_rgb_std_func.h" + +#define STD_FUNCTION_NAME yuv422_rgb24_std +#define YUV_FORMAT YUV_FORMAT_422 +#define RGB_FORMAT RGB_FORMAT_RGB24 +#include "yuv_rgb_std_func.h" + +#define STD_FUNCTION_NAME yuv422_rgba_std +#define YUV_FORMAT YUV_FORMAT_422 +#define RGB_FORMAT RGB_FORMAT_RGBA +#include "yuv_rgb_std_func.h" + +#define STD_FUNCTION_NAME yuv422_bgra_std +#define YUV_FORMAT YUV_FORMAT_422 +#define RGB_FORMAT RGB_FORMAT_BGRA +#include "yuv_rgb_std_func.h" + +#define STD_FUNCTION_NAME yuv422_argb_std +#define YUV_FORMAT YUV_FORMAT_422 +#define RGB_FORMAT RGB_FORMAT_ARGB +#include "yuv_rgb_std_func.h" + +#define STD_FUNCTION_NAME yuv422_abgr_std +#define YUV_FORMAT YUV_FORMAT_422 +#define RGB_FORMAT RGB_FORMAT_ABGR +#include "yuv_rgb_std_func.h" + +#define STD_FUNCTION_NAME yuvnv12_rgb565_std +#define YUV_FORMAT YUV_FORMAT_NV12 +#define RGB_FORMAT RGB_FORMAT_RGB565 +#include "yuv_rgb_std_func.h" + +#define STD_FUNCTION_NAME yuvnv12_rgb24_std +#define YUV_FORMAT YUV_FORMAT_NV12 +#define RGB_FORMAT RGB_FORMAT_RGB24 +#include "yuv_rgb_std_func.h" + +#define STD_FUNCTION_NAME yuvnv12_rgba_std +#define YUV_FORMAT YUV_FORMAT_NV12 +#define RGB_FORMAT RGB_FORMAT_RGBA +#include "yuv_rgb_std_func.h" + +#define STD_FUNCTION_NAME yuvnv12_bgra_std +#define YUV_FORMAT YUV_FORMAT_NV12 +#define RGB_FORMAT RGB_FORMAT_BGRA +#include "yuv_rgb_std_func.h" + +#define STD_FUNCTION_NAME yuvnv12_argb_std +#define YUV_FORMAT YUV_FORMAT_NV12 +#define RGB_FORMAT RGB_FORMAT_ARGB +#include "yuv_rgb_std_func.h" + +#define STD_FUNCTION_NAME yuvnv12_abgr_std +#define YUV_FORMAT YUV_FORMAT_NV12 +#define RGB_FORMAT RGB_FORMAT_ABGR +#include "yuv_rgb_std_func.h" + +void rgb24_yuv420_std( + uint32_t width, uint32_t height, + const uint8_t *RGB, uint32_t RGB_stride, + uint8_t *Y, uint8_t *U, uint8_t *V, uint32_t Y_stride, uint32_t UV_stride, + YCbCrType yuv_type) +{ + const RGB2YUVParam *const param = &(RGB2YUV[yuv_type]); + + uint32_t x, y; + for(y=0; y<(height-1); y+=2) + { + const uint8_t *rgb_ptr1=RGB+y*RGB_stride, + *rgb_ptr2=RGB+(y+1)*RGB_stride; + + uint8_t *y_ptr1=Y+y*Y_stride, + *y_ptr2=Y+(y+1)*Y_stride, + *u_ptr=U+(y/2)*UV_stride, + *v_ptr=V+(y/2)*UV_stride; + + for(x=0; x<(width-1); x+=2) + { + // compute yuv for the four pixels, u and v values are summed + int32_t y_tmp, u_tmp, v_tmp; + + y_tmp = param->matrix[0][0]*rgb_ptr1[0] + param->matrix[0][1]*rgb_ptr1[1] + param->matrix[0][2]*rgb_ptr1[2]; + u_tmp = param->matrix[1][0]*rgb_ptr1[0] + param->matrix[1][1]*rgb_ptr1[1] + param->matrix[1][2]*rgb_ptr1[2]; + v_tmp = param->matrix[2][0]*rgb_ptr1[0] + param->matrix[2][1]*rgb_ptr1[1] + param->matrix[2][2]*rgb_ptr1[2]; + y_ptr1[0]=clampU8(y_tmp+((param->y_shift)<matrix[0][0]*rgb_ptr1[3] + param->matrix[0][1]*rgb_ptr1[4] + param->matrix[0][2]*rgb_ptr1[5]; + u_tmp += param->matrix[1][0]*rgb_ptr1[3] + param->matrix[1][1]*rgb_ptr1[4] + param->matrix[1][2]*rgb_ptr1[5]; + v_tmp += param->matrix[2][0]*rgb_ptr1[3] + param->matrix[2][1]*rgb_ptr1[4] + param->matrix[2][2]*rgb_ptr1[5]; + y_ptr1[1]=clampU8(y_tmp+((param->y_shift)<matrix[0][0]*rgb_ptr2[0] + param->matrix[0][1]*rgb_ptr2[1] + param->matrix[0][2]*rgb_ptr2[2]; + u_tmp += param->matrix[1][0]*rgb_ptr2[0] + param->matrix[1][1]*rgb_ptr2[1] + param->matrix[1][2]*rgb_ptr2[2]; + v_tmp += param->matrix[2][0]*rgb_ptr2[0] + param->matrix[2][1]*rgb_ptr2[1] + param->matrix[2][2]*rgb_ptr2[2]; + y_ptr2[0]=clampU8(y_tmp+((param->y_shift)<matrix[0][0]*rgb_ptr2[3] + param->matrix[0][1]*rgb_ptr2[4] + param->matrix[0][2]*rgb_ptr2[5]; + u_tmp += param->matrix[1][0]*rgb_ptr2[3] + param->matrix[1][1]*rgb_ptr2[4] + param->matrix[1][2]*rgb_ptr2[5]; + v_tmp += param->matrix[2][0]*rgb_ptr2[3] + param->matrix[2][1]*rgb_ptr2[4] + param->matrix[2][2]*rgb_ptr2[5]; + y_ptr2[1]=clampU8(y_tmp+((param->y_shift)<*/ +#include "yuv_rgb_common.h" + +#include "SDL_stdinc.h" + +// yuv to rgb, standard c implementation +void yuv420_rgb565_std( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv420_rgb24_std( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv420_rgba_std( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv420_bgra_std( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv420_argb_std( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv420_abgr_std( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv422_rgb565_std( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv422_rgb24_std( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv422_rgba_std( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv422_bgra_std( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv422_argb_std( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv422_abgr_std( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuvnv12_rgb565_std( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuvnv12_rgb24_std( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuvnv12_rgba_std( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuvnv12_bgra_std( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuvnv12_argb_std( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuvnv12_abgr_std( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); diff --git a/thirdparty/SDL/src/video/yuv2rgb/yuv_rgb_std_func.h b/thirdparty/SDL/src/video/yuv2rgb/yuv_rgb_std_func.h index 94872ec9f..f359abae8 100644 --- a/thirdparty/SDL/src/video/yuv2rgb/yuv_rgb_std_func.h +++ b/thirdparty/SDL/src/video/yuv2rgb/yuv_rgb_std_func.h @@ -69,10 +69,15 @@ #endif +#ifdef _MSC_VER /* Visual Studio analyzer can't tell that we're building this with different constants */ +#pragma warning(push) +#pragma warning(disable : 6239) +#endif + void STD_FUNCTION_NAME( - uint32_t width, uint32_t height, - const uint8_t *Y, const uint8_t *U, const uint8_t *V, uint32_t Y_stride, uint32_t UV_stride, - uint8_t *RGB, uint32_t RGB_stride, + uint32_t width, uint32_t height, + const uint8_t *Y, const uint8_t *U, const uint8_t *V, uint32_t Y_stride, uint32_t UV_stride, + uint8_t *RGB, uint32_t RGB_stride, YCbCrType yuv_type) { const YUV2RGBParam *const param = &(YUV2RGB[yuv_type]); @@ -113,26 +118,26 @@ void STD_FUNCTION_NAME( for(x=0; x<(width-(uv_x_sample_interval-1)); x+=uv_x_sample_interval) { // Compute U and V contributions, common to the four pixels - + int32_t u_tmp = ((*u_ptr)-128); int32_t v_tmp = ((*v_ptr)-128); - + int32_t r_tmp = (v_tmp*param->v_r_factor); int32_t g_tmp = (u_tmp*param->u_g_factor + v_tmp*param->v_g_factor); int32_t b_tmp = (u_tmp*param->u_b_factor); - + // Compute the Y contribution for each pixel - + int32_t y_tmp = ((y_ptr1[0]-param->y_shift)*param->y_factor); PACK_PIXEL(rgb_ptr1); - + y_tmp = ((y_ptr1[y_pixel_stride]-param->y_shift)*param->y_factor); PACK_PIXEL(rgb_ptr1); - + #if uv_y_sample_interval > 1 y_tmp = ((y_ptr2[0]-param->y_shift)*param->y_factor); PACK_PIXEL(rgb_ptr2); - + y_tmp = ((y_ptr2[y_pixel_stride]-param->y_shift)*param->y_factor); PACK_PIXEL(rgb_ptr2); #endif @@ -149,19 +154,19 @@ void STD_FUNCTION_NAME( if (uv_x_sample_interval == 2 && x == (width-1)) { // Compute U and V contributions, common to the four pixels - + int32_t u_tmp = ((*u_ptr)-128); int32_t v_tmp = ((*v_ptr)-128); - + int32_t r_tmp = (v_tmp*param->v_r_factor); int32_t g_tmp = (u_tmp*param->u_g_factor + v_tmp*param->v_g_factor); int32_t b_tmp = (u_tmp*param->u_b_factor); - + // Compute the Y contribution for each pixel - + int32_t y_tmp = ((y_ptr1[0]-param->y_shift)*param->y_factor); PACK_PIXEL(rgb_ptr1); - + #if uv_y_sample_interval > 1 y_tmp = ((y_ptr2[0]-param->y_shift)*param->y_factor); PACK_PIXEL(rgb_ptr2); @@ -175,28 +180,28 @@ void STD_FUNCTION_NAME( const uint8_t *y_ptr1=Y+y*Y_stride, *u_ptr=U+(y/uv_y_sample_interval)*UV_stride, *v_ptr=V+(y/uv_y_sample_interval)*UV_stride; - + uint8_t *rgb_ptr1=RGB+y*RGB_stride; - + for(x=0; x<(width-(uv_x_sample_interval-1)); x+=uv_x_sample_interval) { // Compute U and V contributions, common to the four pixels - + int32_t u_tmp = ((*u_ptr)-128); int32_t v_tmp = ((*v_ptr)-128); - + int32_t r_tmp = (v_tmp*param->v_r_factor); int32_t g_tmp = (u_tmp*param->u_g_factor + v_tmp*param->v_g_factor); int32_t b_tmp = (u_tmp*param->u_b_factor); - + // Compute the Y contribution for each pixel - + int32_t y_tmp = ((y_ptr1[0]-param->y_shift)*param->y_factor); PACK_PIXEL(rgb_ptr1); - + y_tmp = ((y_ptr1[y_pixel_stride]-param->y_shift)*param->y_factor); PACK_PIXEL(rgb_ptr1); - + y_ptr1+=2*y_pixel_stride; u_ptr+=2*uv_pixel_stride/uv_x_sample_interval; v_ptr+=2*uv_pixel_stride/uv_x_sample_interval; @@ -206,16 +211,16 @@ void STD_FUNCTION_NAME( if (uv_x_sample_interval == 2 && x == (width-1)) { // Compute U and V contributions, common to the four pixels - + int32_t u_tmp = ((*u_ptr)-128); int32_t v_tmp = ((*v_ptr)-128); - + int32_t r_tmp = (v_tmp*param->v_r_factor); int32_t g_tmp = (u_tmp*param->u_g_factor + v_tmp*param->v_g_factor); int32_t b_tmp = (u_tmp*param->u_b_factor); - + // Compute the Y contribution for each pixel - + int32_t y_tmp = ((y_ptr1[0]-param->y_shift)*param->y_factor); PACK_PIXEL(rgb_ptr1); } @@ -227,6 +232,10 @@ void STD_FUNCTION_NAME( #undef uv_y_sample_interval } +#ifdef _MSC_VER +#pragma warning(pop) +#endif + #undef STD_FUNCTION_NAME #undef YUV_FORMAT #undef RGB_FORMAT diff --git a/thirdparty/SDL/test/CMakeLists.txt b/thirdparty/SDL/test/CMakeLists.txt index 52a268561..f048d51f9 100644 --- a/thirdparty/SDL/test/CMakeLists.txt +++ b/thirdparty/SDL/test/CMakeLists.txt @@ -7,18 +7,55 @@ include(CMakePushCheckState) set(SDL_TEST_EXECUTABLES) set(SDL_TESTS_NONINTERACTIVE) -set(SDL_TESTS_NEEDS_ESOURCES) +set(SDL_TESTS_NEEDS_RESOURCES) macro(add_sdl_test_executable TARGET) cmake_parse_arguments(AST "NONINTERACTIVE;NEEDS_RESOURCES" "" "" ${ARGN}) - add_executable(${TARGET} ${AST_UNPARSED_ARGUMENTS}) + if(ANDROID) + add_library(${TARGET} SHARED ${AST_UNPARSED_ARGUMENTS}) + else() + add_executable(${TARGET} ${AST_UNPARSED_ARGUMENTS}) + endif() list(APPEND SDL_TEST_EXECUTABLES ${TARGET}) if(AST_NONINTERACTIVE) list(APPEND SDL_TESTS_NONINTERACTIVE ${TARGET}) endif() if(AST_NEEDS_RESOURCES) - list(APPEND SDL_TESTS_NEEDS_ESOURCES ${TARGET}) + list(APPEND SDL_TESTS_NEEDS_RESOURCES ${TARGET}) + endif() + + if(HAVE_GCC_WDOCUMENTATION) + target_compile_options(${TARGET} PRIVATE "-Wdocumentation") + if(HAVE_GCC_WERROR_DOCUMENTATION) + target_compile_options(${TARGET} PRIVATE "-Werror=documentation") + endif() + endif() + + if(HAVE_GCC_WDOCUMENTATION_UNKNOWN_COMMAND) + if(SDL_WERROR) + if(HAVE_GCC_WERROR_DOCUMENTATION_UNKNOWN_COMMAND) + target_compile_options(${TARGET} PRIVATE "-Werror=documentation-unknown-command") + endif() + endif() + target_compile_options(${TARGET} PRIVATE "-Wdocumentation-unknown-command") + endif() + + if(HAVE_GCC_COMMENT_BLOCK_COMMANDS) + target_compile_options(${TARGET} PRIVATE "-fcomment-block-commands=threadsafety") + target_compile_options(${TARGET} PRIVATE "-fcomment-block-commands=deprecated") + else() + if(HAVE_CLANG_COMMENT_BLOCK_COMMANDS) + target_compile_options(${TARGET} PRIVATE "/clang:-fcomment-block-commands=threadsafety") + target_compile_options(${TARGET} PRIVATE "/clang:-fcomment-block-commands=deprecated") + endif() + endif() + + if(USE_GCC OR USE_CLANG) + check_c_compiler_flag(-fno-fast-math HAVE_GCC_FNO_FAST_MATH) + if(HAVE_GCC_FNO_FAST_MATH) + target_compile_options(${TARGET} PRIVATE -fno-fast-math) + endif() endif() endmacro() @@ -53,7 +90,7 @@ if(PSP) psppower ) elseif(PS2) -link_libraries( + link_libraries( SDL2main SDL2_test SDL2-static @@ -61,7 +98,7 @@ link_libraries( gskit dmakit ps2_drivers -) + ) else() link_libraries(SDL2::SDL2test SDL2::SDL2-static) endif() @@ -91,7 +128,7 @@ if(NOT MSVC OR NOT CMAKE_GENERATOR_PLATFORM STREQUAL "ARM64") endif() if (OPENGL_FOUND) -add_definitions(-DHAVE_OPENGL) + add_definitions(-DHAVE_OPENGL) endif() add_sdl_test_executable(checkkeys checkkeys.c) @@ -103,7 +140,7 @@ add_sdl_test_executable(testresample NEEDS_RESOURCES testresample.c) add_sdl_test_executable(testaudioinfo testaudioinfo.c) file(GLOB TESTAUTOMATION_SOURCE_FILES testautomation*.c) -add_sdl_test_executable(testautomation NEEDS_RESOURCES ${TESTAUTOMATION_SOURCE_FILES}) +add_sdl_test_executable(testautomation NONINTERACTIVE NEEDS_RESOURCES ${TESTAUTOMATION_SOURCE_FILES}) add_sdl_test_executable(testmultiaudio NEEDS_RESOURCES testmultiaudio.c testutils.c) add_sdl_test_executable(testaudiohotplug NEEDS_RESOURCES testaudiohotplug.c testutils.c) add_sdl_test_executable(testaudiocapture testaudiocapture.c) @@ -217,18 +254,18 @@ endif() cmake_pop_check_state() if(SDL_DUMMYAUDIO) - list(APPEND SDL_TESTS_NONINTERACTIVE - testaudioinfo - testsurround - ) + list(APPEND SDL_TESTS_NONINTERACTIVE + testaudioinfo + testsurround + ) endif() if(SDL_DUMMYVIDEO) - list(APPEND SDL_TESTS_NONINTERACTIVE - testkeys - testbounds - testdisplayinfo - ) + list(APPEND SDL_TESTS_NONINTERACTIVE + testkeys + testbounds + testdisplayinfo + ) endif() if(OPENGL_FOUND) @@ -254,7 +291,7 @@ file(COPY ${RESOURCE_FILES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) if(PSP) # Build EBOOT files if building for PSP set(BUILD_EBOOT - ${SDL_TESTS_NEEDS_ESOURCES} + ${SDL_TESTS_NEEDS_RESOURCES} testatomic testaudiocapture testaudioinfo @@ -363,14 +400,41 @@ if(RISCOS) endforeach() endif() +if(CMAKE_RUNTIME_OUTPUT_DIRECTORY) + set(test_bin_dir "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}") + if(NOT IS_ABSOLUTE "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}") + set(test_bin_dir "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_RUNTIME_OUTPUT_DIRECTORY}") + endif() +else() + set(test_bin_dir "${CMAKE_CURRENT_BINARY_DIR}") +endif() +if(NOT CMAKE_VERSION VERSION_LESS 3.20) + get_property(is_multi_config GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) + set(test_bin_dir "${test_bin_dir}$<$:/$>") +endif() + +set(RESOURCE_FILES_BINDIR) +foreach(resource_file IN LISTS RESOURCE_FILES) + get_filename_component(res_file_name ${resource_file} NAME) + set(resource_file_bindir "${test_bin_dir}/${res_file_name}") + add_custom_command(OUTPUT "${resource_file_bindir}" + COMMAND "${CMAKE_COMMAND}" -E copy "${resource_file}" "${resource_file_bindir}" + DEPENDS "${resource_file}" + ) + list(APPEND RESOURCE_FILES_BINDIR "${resource_file_bindir}") +endforeach() +add_custom_target(copy-sdl-test-resources + DEPENDS "${RESOURCE_FILES_BINDIR}" +) + foreach(APP IN LISTS SDL_TESTS_NEEDS_RESOURCES) - foreach(RESOURCE_FILE ${RESOURCE_FILES}) - if(PSP OR PS2) + if(PSP OR PS2) + foreach(RESOURCE_FILE ${RESOURCE_FILES}) add_custom_command(TARGET ${APP} POST_BUILD COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different ${RESOURCE_FILE} $/sdl-${APP}) - else() - add_custom_command(TARGET ${APP} POST_BUILD COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different ${RESOURCE_FILE} $) - endif() - endforeach(RESOURCE_FILE) + endforeach() + else() + add_dependencies(${APP} copy-sdl-test-resources) + endif() if(APPLE) # Make sure resource files get installed into macOS/iOS .app bundles. target_sources(${APP} PRIVATE "${RESOURCE_FILES}") @@ -427,6 +491,7 @@ foreach(TESTCASE ${SDL_TESTS_NONINTERACTIVE}) endif() endforeach() +set_tests_properties(testautomation PROPERTIES TIMEOUT 120) set_tests_properties(testthread PROPERTIES TIMEOUT 40) set_tests_properties(testtimer PROPERTIES TIMEOUT 60) if(TARGET testfilesystem_pre) @@ -446,6 +511,11 @@ if(SDL_INSTALL_TESTS) DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}/installed-tests/SDL2 ) endif() + if(MSVC) + foreach(test ${SDL_TEST_EXECUTABLES}) + SDL_install_pdb(${test} "${CMAKE_INSTALL_LIBEXECDIR}/installed-tests/SDL2") + endforeach() + endif() install( FILES ${RESOURCE_FILES} DESTINATION ${CMAKE_INSTALL_LIBEXECDIR}/installed-tests/SDL2 diff --git a/thirdparty/SDL/test/Makefile.in b/thirdparty/SDL/test/Makefile.in index 93df6360e..76331d67f 100644 --- a/thirdparty/SDL/test/Makefile.in +++ b/thirdparty/SDL/test/Makefile.in @@ -95,7 +95,7 @@ installedtestsmetadir = $(datadir)/installed-tests/SDL2 generatetestmeta: rm -f *.test - set -e; for exe in $(noninteractive) $(needs_audio) $(needs_display); do \ + set -e; for exe in $(TESTS); do \ sed \ -e 's#@installedtestsdir@#$(installedtestsdir)#g' \ -e "s#@exe@#$$exe#g" \ @@ -141,6 +141,7 @@ testautomation$(EXE): $(srcdir)/testautomation.c \ $(srcdir)/testautomation_hints.c \ $(srcdir)/testautomation_joystick.c \ $(srcdir)/testautomation_keyboard.c \ + $(srcdir)/testautomation_log.c \ $(srcdir)/testautomation_main.c \ $(srcdir)/testautomation_math.c \ $(srcdir)/testautomation_mouse.c \ @@ -151,6 +152,7 @@ testautomation$(EXE): $(srcdir)/testautomation.c \ $(srcdir)/testautomation_rwops.c \ $(srcdir)/testautomation_sdltest.c \ $(srcdir)/testautomation_stdlib.c \ + $(srcdir)/testautomation_subsystems.c \ $(srcdir)/testautomation_surface.c \ $(srcdir)/testautomation_syswm.c \ $(srcdir)/testautomation_timer.c \ @@ -385,8 +387,12 @@ distclean: clean rm -f config.status config.cache config.log rm -rf $(srcdir)/autom4te* -noninteractive = \ +TESTS = \ testatomic$(EXE) \ + testaudioinfo$(EXE) \ + testautomation$(EXE) \ + testbounds$(EXE) \ + testdisplayinfo$(EXE) \ testerror$(EXE) \ testevdev$(EXE) \ testfilesystem$(EXE) \ @@ -395,23 +401,12 @@ noninteractive = \ testplatform$(EXE) \ testpower$(EXE) \ testqsort$(EXE) \ + testsurround$(EXE) \ testthread$(EXE) \ testtimer$(EXE) \ testver$(EXE) \ $(NULL) -needs_audio = \ - testaudioinfo$(EXE) \ - testsurround$(EXE) \ - $(NULL) - -needs_display = \ - testbounds$(EXE) \ - testdisplayinfo$(EXE) \ - $(NULL) - -TESTS = $(noninteractive) $(needs_audio) $(needs_display) - check: @set -e; \ status=0; \ diff --git a/thirdparty/SDL/test/acinclude.m4 b/thirdparty/SDL/test/acinclude.m4 index 0fdf353ea..ebee8238a 100644 --- a/thirdparty/SDL/test/acinclude.m4 +++ b/thirdparty/SDL/test/acinclude.m4 @@ -5,8 +5,6 @@ # stolen from Manish Singh # Shamelessly stolen from Owen Taylor -# serial 2 - dnl AM_PATH_SDL2([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) dnl Test for SDL, and define SDL_CFLAGS and SDL_LIBS dnl @@ -45,7 +43,7 @@ AC_ARG_ENABLE(sdltest, [ --disable-sdltest Do not try to compile and run if test "x$sdl_pc" = xyes ; then no_sdl="" - SDL2_CONFIG="pkg-config sdl2" + SDL2_CONFIG="$PKG_CONFIG sdl2" else as_save_PATH="$PATH" if test "x$prefix" != xNONE && test "$cross_compiling" != yes; then diff --git a/thirdparty/SDL/test/checkkeys.c b/thirdparty/SDL/test/checkkeys.c index 4efdc721e..f37f3c489 100644 --- a/thirdparty/SDL/test/checkkeys.c +++ b/thirdparty/SDL/test/checkkeys.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -107,7 +107,7 @@ print_modifiers(char **text, size_t *maxlen) } static void -PrintModifierState() +PrintModifierState(void) { char message[512]; char *spot; @@ -166,7 +166,7 @@ PrintText(const char *eventtype, const char *text) SDL_Log("%s Text (%s): \"%s%s\"\n", eventtype, expanded, *text == '"' ? "\\" : "", text); } -void loop() +void loop(void) { SDL_Event event; /* Check for events */ @@ -269,14 +269,14 @@ int main(int argc, char *argv[]) window = SDL_CreateWindow("CheckKeys Test", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 640, 480, 0); - if (window == NULL) { + if (!window) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create 640x480 window: %s\n", SDL_GetError()); quit(2); } renderer = SDL_CreateRenderer(window, -1, 0); - if (renderer == NULL) { + if (!renderer) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create renderer: %s\n", SDL_GetError()); quit(2); @@ -284,7 +284,7 @@ int main(int argc, char *argv[]) textwin = SDLTest_TextWindowCreate(0, 0, 640, 480); -#if __IPHONEOS__ +#ifdef __IPHONEOS__ /* Creating the context creates the view, which we need to show keyboard */ SDL_GL_CreateContext(window); #endif diff --git a/thirdparty/SDL/test/checkkeysthreads.c b/thirdparty/SDL/test/checkkeysthreads.c index 3db5dd2dc..fe0408c45 100644 --- a/thirdparty/SDL/test/checkkeysthreads.c +++ b/thirdparty/SDL/test/checkkeysthreads.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -103,7 +103,7 @@ print_modifiers(char **text, size_t *maxlen) } static void -PrintModifierState() +PrintModifierState(void) { char message[512]; char *spot; @@ -162,7 +162,7 @@ PrintText(const char *eventtype, const char *text) SDL_Log("%s Text (%s): \"%s%s\"\n", eventtype, expanded, *text == '"' ? "\\" : "", text); } -void loop() +void loop(void) { SDL_Event event; /* Check for events */ @@ -254,7 +254,7 @@ int main(int argc, char *argv[]) window = SDL_CreateWindow("CheckKeys Test", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 640, 480, 0); - if (window == NULL) { + if (!window) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create 640x480 window: %s\n", SDL_GetError()); quit(2); @@ -266,7 +266,7 @@ int main(int argc, char *argv[]) renderer = SDL_CreateRenderer(window, -1, 0); SDL_RenderPresent(renderer); -#if __IPHONEOS__ +#ifdef __IPHONEOS__ /* Creating the context creates the view, which we need to show keyboard */ SDL_GL_CreateContext(window); #endif diff --git a/thirdparty/SDL/test/configure b/thirdparty/SDL/test/configure index c71abe489..8ea80bc27 100755 --- a/thirdparty/SDL/test/configure +++ b/thirdparty/SDL/test/configure @@ -3966,7 +3966,7 @@ fi if test "x$sdl_pc" = xyes ; then no_sdl="" - SDL2_CONFIG="pkg-config sdl2" + SDL2_CONFIG="$PKG_CONFIG sdl2" else as_save_PATH="$PATH" if test "x$prefix" != xNONE && test "$cross_compiling" != yes; then diff --git a/thirdparty/SDL/test/controllermap.c b/thirdparty/SDL/test/controllermap.c index cfb0effac..982a9fb6f 100644 --- a/thirdparty/SDL/test/controllermap.c +++ b/thirdparty/SDL/test/controllermap.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -288,7 +288,8 @@ ConfigureBinding(const SDL_GameControllerExtendedBind *pBinding) SDL_Log("Configuring button binding for button %d\n", pBinding->value.button); break; case SDL_CONTROLLER_BINDTYPE_AXIS: - SDL_Log("Configuring axis binding for axis %d %d/%d committed = %s\n", pBinding->value.axis.axis, pBinding->value.axis.axis_min, pBinding->value.axis.axis_max, pBinding->committed ? "true" : "false"); + SDL_Log("Configuring axis binding for axis %d %d/%d committed = %s\n", pBinding->value.axis.axis, pBinding->value.axis.axis_min, pBinding->value.axis.axis_max, + pBinding->committed ? "true" : "false"); break; case SDL_CONTROLLER_BINDTYPE_HAT: SDL_Log("Configuring hat binding for hat %d %d\n", pBinding->value.hat.hat, pBinding->value.hat.hat_mask); @@ -729,13 +730,13 @@ int main(int argc, char *argv[]) window = SDL_CreateWindow("Game Controller Map", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, SCREEN_WIDTH, SCREEN_HEIGHT, 0); - if (window == NULL) { + if (!window) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create window: %s\n", SDL_GetError()); return 2; } screen = SDL_CreateRenderer(window, -1, 0); - if (screen == NULL) { + if (!screen) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create renderer: %s\n", SDL_GetError()); return 2; } @@ -766,7 +767,7 @@ int main(int argc, char *argv[]) name = SDL_JoystickNameForIndex(i); SDL_Log("Joystick %d: %s\n", i, name ? name : "Unknown Joystick"); joystick = SDL_JoystickOpen(i); - if (joystick == NULL) { + if (!joystick) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_JoystickOpen(%d) failed: %s\n", i, SDL_GetError()); } else { @@ -792,7 +793,7 @@ int main(int argc, char *argv[]) } } joystick = SDL_JoystickOpen(joystick_index); - if (joystick == NULL) { + if (!joystick) { SDL_Log("Couldn't open joystick %d: %s\n", joystick_index, SDL_GetError()); } else { WatchJoystick(joystick); diff --git a/thirdparty/SDL/test/loopwave.c b/thirdparty/SDL/test/loopwave.c index 156767c20..eb98c74df 100644 --- a/thirdparty/SDL/test/loopwave.c +++ b/thirdparty/SDL/test/loopwave.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -46,7 +46,7 @@ quit(int rc) } static void -close_audio() +close_audio(void) { if (device != 0) { SDL_CloseAudioDevice(device); @@ -55,7 +55,7 @@ close_audio() } static void -open_audio() +open_audio(void) { /* Initialize fillerup() variables */ device = SDL_OpenAudioDevice(NULL, SDL_FALSE, &wave.spec, NULL, 0); @@ -70,7 +70,7 @@ open_audio() } #ifndef __EMSCRIPTEN__ -static void reopen_audio() +static void reopen_audio(void) { close_audio(); open_audio(); @@ -103,7 +103,7 @@ fillerup(void *unused, Uint8 *stream, int len) static int done = 0; #ifdef __EMSCRIPTEN__ -void loop() +void loop(void) { if (done || (SDL_GetAudioDeviceStatus(device) != SDL_AUDIO_PLAYING)) { emscripten_cancel_main_loop(); @@ -127,7 +127,7 @@ int main(int argc, char *argv[]) filename = GetResourceFilename(argc > 1 ? argv[1] : NULL, "sample.wav"); - if (filename == NULL) { + if (!filename) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "%s\n", SDL_GetError()); quit(1); } diff --git a/thirdparty/SDL/test/loopwavequeue.c b/thirdparty/SDL/test/loopwavequeue.c index 70dd072d2..68c0b01e7 100644 --- a/thirdparty/SDL/test/loopwavequeue.c +++ b/thirdparty/SDL/test/loopwavequeue.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,7 +21,7 @@ #include "SDL.h" -#if HAVE_SIGNAL_H +#ifdef HAVE_SIGNAL_H #include #endif @@ -48,7 +48,7 @@ void poked(int sig) done = 1; } -void loop() +void loop(void) { #ifdef __EMSCRIPTEN__ if (done || (SDL_GetAudioStatus() != SDL_AUDIO_PLAYING)) { @@ -84,7 +84,7 @@ int main(int argc, char *argv[]) filename = GetResourceFilename(argc > 1 ? argv[1] : NULL, "sample.wav"); - if (filename == NULL) { + if (!filename) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "%s\n", SDL_GetError()); quit(1); } @@ -97,7 +97,7 @@ int main(int argc, char *argv[]) wave.spec.callback = NULL; /* we'll push audio. */ -#if HAVE_SIGNAL_H +#ifdef HAVE_SIGNAL_H /* Set the signals */ #ifdef SIGHUP (void)signal(SIGHUP, poked); diff --git a/thirdparty/SDL/test/testatomic.c b/thirdparty/SDL/test/testatomic.c index 15a7a6a7d..c19415ac1 100644 --- a/thirdparty/SDL/test/testatomic.c +++ b/thirdparty/SDL/test/testatomic.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -31,7 +31,7 @@ tf(SDL_bool _tf) return f; } -static void RunBasicTest() +static void RunBasicTest(void) { int value; SDL_SpinLock lock = 0; @@ -153,7 +153,7 @@ static void runAdder(void) SDL_Log("Finished in %f sec\n", (end - start) / 1000.f); } -static void RunEpicTest() +static void RunEpicTest(void) { int b; atomicValue v; @@ -234,7 +234,8 @@ static void RunEpicTest() v = SDL_AtomicGet(&good); SDL_Log("Atomic %d Non-Atomic %d\n", v, bad); SDL_assert(v == Expect); - SDL_assert(bad != Expect); + /* We can't guarantee that bad != Expect, this would happen on a single core system, for example. */ + /*SDL_assert(bad != Expect);*/ } /* End atomic operation test */ diff --git a/thirdparty/SDL/test/testaudiocapture.c b/thirdparty/SDL/test/testaudiocapture.c index a8fdf5ec5..c09c40086 100644 --- a/thirdparty/SDL/test/testaudiocapture.c +++ b/thirdparty/SDL/test/testaudiocapture.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -24,7 +24,7 @@ static SDL_AudioDeviceID devid_in = 0; static SDL_AudioDeviceID devid_out = 0; static void -loop() +loop(void) { SDL_bool please_quit = SDL_FALSE; SDL_Event e; diff --git a/thirdparty/SDL/test/testaudiohotplug.c b/thirdparty/SDL/test/testaudiohotplug.c index e4bd9ac09..692bada91 100644 --- a/thirdparty/SDL/test/testaudiohotplug.c +++ b/thirdparty/SDL/test/testaudiohotplug.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -17,7 +17,7 @@ #include #include -#if HAVE_SIGNAL_H +#ifdef HAVE_SIGNAL_H #include #endif @@ -81,7 +81,7 @@ devtypestr(int iscapture) } static void -iteration() +iteration(void) { SDL_Event e; SDL_AudioDeviceID dev; @@ -96,7 +96,7 @@ iteration() int index = e.adevice.which; int iscapture = e.adevice.iscapture; const char *name = SDL_GetAudioDeviceName(index, iscapture); - if (name != NULL) { + if (name) { SDL_Log("New %s audio device at index %u: %s\n", devtypestr(iscapture), (unsigned int)index, name); } else { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Got new %s device at index %u, but failed to get the name: %s\n", @@ -124,7 +124,7 @@ iteration() } #ifdef __EMSCRIPTEN__ -void loop() +void loop(void) { if (done) emscripten_cancel_main_loop(); @@ -152,7 +152,7 @@ int main(int argc, char *argv[]) filename = GetResourceFilename(argc > 1 ? argv[1] : NULL, "sample.wav"); - if (filename == NULL) { + if (!filename) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "%s\n", SDL_GetError()); quit(1); } @@ -163,7 +163,7 @@ int main(int argc, char *argv[]) quit(1); } -#if HAVE_SIGNAL_H +#ifdef HAVE_SIGNAL_H /* Set the signals */ #ifdef SIGHUP (void)signal(SIGHUP, poked); diff --git a/thirdparty/SDL/test/testaudioinfo.c b/thirdparty/SDL/test/testaudioinfo.c index ae59cbcc8..ec4b86470 100644 --- a/thirdparty/SDL/test/testaudioinfo.c +++ b/thirdparty/SDL/test/testaudioinfo.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -29,7 +29,7 @@ print_devices(int iscapture) int i; for (i = 0; i < n; i++) { const char *name = SDL_GetAudioDeviceName(i, iscapture); - if (name != NULL) { + if (name) { SDL_Log(" %d: %s\n", i, name); } else { SDL_Log(" %d Error: %s\n", i, SDL_GetError()); @@ -81,7 +81,7 @@ int main(int argc, char **argv) if (SDL_GetDefaultAudioInfo(&deviceName, &spec, 0) < 0) { SDL_Log("Error when calling SDL_GetDefaultAudioInfo: %s\n", SDL_GetError()); } else { - SDL_Log("Default Output Name: %s\n", deviceName != NULL ? deviceName : "unknown"); + SDL_Log("Default Output Name: %s\n", deviceName ? deviceName : "unknown"); SDL_free(deviceName); SDL_Log("Sample Rate: %d\n", spec.freq); SDL_Log("Channels: %d\n", spec.channels); @@ -91,7 +91,7 @@ int main(int argc, char **argv) if (SDL_GetDefaultAudioInfo(&deviceName, &spec, 1) < 0) { SDL_Log("Error when calling SDL_GetDefaultAudioInfo: %s\n", SDL_GetError()); } else { - SDL_Log("Default Capture Name: %s\n", deviceName != NULL ? deviceName : "unknown"); + SDL_Log("Default Capture Name: %s\n", deviceName ? deviceName : "unknown"); SDL_free(deviceName); SDL_Log("Sample Rate: %d\n", spec.freq); SDL_Log("Channels: %d\n", spec.channels); diff --git a/thirdparty/SDL/test/testautomation.c b/thirdparty/SDL/test/testautomation.c index 2150ed246..3b5fad808 100644 --- a/thirdparty/SDL/test/testautomation.c +++ b/thirdparty/SDL/test/testautomation.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -41,7 +41,7 @@ int main(int argc, char *argv[]) /* Initialize test framework */ state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO); - if (state == NULL) { + if (!state) { return 1; } diff --git a/thirdparty/SDL/test/testautomation_audio.c b/thirdparty/SDL/test/testautomation_audio.c index bd586314f..1564f0554 100644 --- a/thirdparty/SDL/test/testautomation_audio.c +++ b/thirdparty/SDL/test/testautomation_audio.c @@ -52,6 +52,42 @@ void SDLCALL _audio_testCallback(void *userdata, Uint8 *stream, int len) _audio_testCallbackLength += len; } +#if defined(__linux__) +/* Linux builds can include many audio drivers, but some are very + * obscure and typically unsupported on modern systems. They will + * be skipped in tests that run against all included drivers, as + * they are basically guaranteed to fail. + */ +static SDL_bool DriverIsProblematic(const char *driver) +{ + static const char *driverList[] = { + /* Omnipresent in Linux builds, but deprecated since 2002, + * very rarely used on Linux nowadays, and is almost certainly + * guaranteed to fail. + */ + "dsp", + + /* OpenBSD sound API. Can be used on Linux, but very rare. */ + "sndio", + + /* Always fails on initialization and/or opening a device. + * Does anyone or anything actually use this? + */ + "nas" + }; + + int i; + + for (i = 0; i < SDL_arraysize(driverList); ++i) { + if (SDL_strcmp(driver, driverList[i]) == 0) { + return SDL_TRUE; + } + } + + return SDL_FALSE; +} +#endif + /* Test case functions */ /** @@ -60,7 +96,7 @@ void SDLCALL _audio_testCallback(void *userdata, Uint8 *stream, int len) * \sa https://wiki.libsdl.org/SDL_QuitSubSystem * \sa https://wiki.libsdl.org/SDL_InitSubSystem */ -int audio_quitInitAudioSubSystem() +int audio_quitInitAudioSubSystem(void) { /* Stop SDL audio subsystem */ SDL_QuitSubSystem(SDL_INIT_AUDIO); @@ -78,25 +114,48 @@ int audio_quitInitAudioSubSystem() * \sa https://wiki.libsdl.org/SDL_InitAudio * \sa https://wiki.libsdl.org/SDL_QuitAudio */ -int audio_initQuitAudio() +int audio_initQuitAudio(void) { int result; int i, iMax; const char *audioDriver; + const char *hint = SDL_GetHint(SDL_HINT_AUDIODRIVER); /* Stop SDL audio subsystem */ SDL_QuitSubSystem(SDL_INIT_AUDIO); SDLTest_AssertPass("Call to SDL_QuitSubSystem(SDL_INIT_AUDIO)"); - /* Loop over all available audio drivers */ - iMax = SDL_GetNumAudioDrivers(); - SDLTest_AssertPass("Call to SDL_GetNumAudioDrivers()"); - SDLTest_AssertCheck(iMax > 0, "Validate number of audio drivers; expected: >0 got: %d", iMax); + /* Was a specific driver requested? */ + audioDriver = SDL_GetHint(SDL_HINT_AUDIODRIVER); + + if (audioDriver == NULL) { + /* Loop over all available audio drivers */ + iMax = SDL_GetNumAudioDrivers(); + SDLTest_AssertPass("Call to SDL_GetNumAudioDrivers()"); + SDLTest_AssertCheck(iMax > 0, "Validate number of audio drivers; expected: >0 got: %d", iMax); + } else { + /* A specific driver was requested for testing */ + iMax = 1; + } for (i = 0; i < iMax; i++) { - audioDriver = SDL_GetAudioDriver(i); - SDLTest_AssertPass("Call to SDL_GetAudioDriver(%d)", i); - SDLTest_Assert(audioDriver != NULL, "Audio driver name is not NULL"); - SDLTest_AssertCheck(audioDriver[0] != '\0', "Audio driver name is not empty; got: %s", audioDriver); /* NOLINT(clang-analyzer-core.NullDereference): Checked for NULL above */ + if (audioDriver == NULL) { + audioDriver = SDL_GetAudioDriver(i); + SDLTest_AssertPass("Call to SDL_GetAudioDriver(%d)", i); + SDLTest_Assert(audioDriver != NULL, "Audio driver name is not NULL"); + SDLTest_AssertCheck(audioDriver[0] != '\0', "Audio driver name is not empty; got: %s", audioDriver); /* NOLINT(clang-analyzer-core.NullDereference): Checked for NULL above */ + +#if defined(__linux__) + if (DriverIsProblematic(audioDriver)) { + SDLTest_Log("Audio driver '%s' flagged as problematic: skipping init/quit test (set SDL_AUDIODRIVER=%s to force)", audioDriver, audioDriver); + audioDriver = NULL; + continue; + } +#endif + } + + if (hint && SDL_strcmp(audioDriver, hint) != 0) { + continue; + } /* Call Init */ result = SDL_AudioInit(audioDriver); @@ -106,6 +165,8 @@ int audio_initQuitAudio() /* Call Quit */ SDL_AudioQuit(); SDLTest_AssertPass("Call to SDL_AudioQuit()"); + + audioDriver = NULL; } /* NULL driver specification */ @@ -134,26 +195,49 @@ int audio_initQuitAudio() * \sa https://wiki.libsdl.org/SDL_CloseAudio * \sa https://wiki.libsdl.org/SDL_QuitAudio */ -int audio_initOpenCloseQuitAudio() +int audio_initOpenCloseQuitAudio(void) { int result, expectedResult; int i, iMax, j, k; const char *audioDriver; SDL_AudioSpec desired; + const char *hint = SDL_GetHint(SDL_HINT_AUDIODRIVER); /* Stop SDL audio subsystem */ SDL_QuitSubSystem(SDL_INIT_AUDIO); SDLTest_AssertPass("Call to SDL_QuitSubSystem(SDL_INIT_AUDIO)"); - /* Loop over all available audio drivers */ - iMax = SDL_GetNumAudioDrivers(); - SDLTest_AssertPass("Call to SDL_GetNumAudioDrivers()"); - SDLTest_AssertCheck(iMax > 0, "Validate number of audio drivers; expected: >0 got: %d", iMax); + /* Was a specific driver requested? */ + audioDriver = SDL_GetHint(SDL_HINT_AUDIODRIVER); + + if (audioDriver == NULL) { + /* Loop over all available audio drivers */ + iMax = SDL_GetNumAudioDrivers(); + SDLTest_AssertPass("Call to SDL_GetNumAudioDrivers()"); + SDLTest_AssertCheck(iMax > 0, "Validate number of audio drivers; expected: >0 got: %d", iMax); + } else { + /* A specific driver was requested for testing */ + iMax = 1; + } for (i = 0; i < iMax; i++) { - audioDriver = SDL_GetAudioDriver(i); - SDLTest_AssertPass("Call to SDL_GetAudioDriver(%d)", i); - SDLTest_Assert(audioDriver != NULL, "Audio driver name is not NULL"); - SDLTest_AssertCheck(audioDriver[0] != '\0', "Audio driver name is not empty; got: %s", audioDriver); /* NOLINT(clang-analyzer-core.NullDereference): Checked for NULL above */ + if (audioDriver == NULL) { + audioDriver = SDL_GetAudioDriver(i); + SDLTest_AssertPass("Call to SDL_GetAudioDriver(%d)", i); + SDLTest_Assert(audioDriver != NULL, "Audio driver name is not NULL"); + SDLTest_AssertCheck(audioDriver[0] != '\0', "Audio driver name is not empty; got: %s", audioDriver); /* NOLINT(clang-analyzer-core.NullDereference): Checked for NULL above */ + +#if defined(__linux__) + if (DriverIsProblematic(audioDriver)) { + SDLTest_Log("Audio driver '%s' flagged as problematic: skipping device open/close test (set SDL_AUDIODRIVER=%s to force)", audioDriver, audioDriver); + audioDriver = NULL; + continue; + } +#endif + } + + if (hint && SDL_strcmp(audioDriver, hint) != 0) { + continue; + } /* Change specs */ for (j = 0; j < 2; j++) { @@ -163,6 +247,17 @@ int audio_initOpenCloseQuitAudio() SDLTest_AssertPass("Call to SDL_AudioInit('%s')", audioDriver); SDLTest_AssertCheck(result == 0, "Validate result value; expected: 0 got: %d", result); + /* Check for output devices */ + result = SDL_GetNumAudioDevices(SDL_FALSE); + SDLTest_AssertPass("Call to SDL_GetNumAudioDevices(SDL_FALSE)"); + SDLTest_AssertCheck(result >= 0, "Validate result value; expected: >=0 got: %d", result); + if (result <= 0) { + SDLTest_Log("No output devices for '%s': skipping device open/close test", audioDriver); + SDL_AudioQuit(); + SDLTest_AssertPass("Call to SDL_AudioQuit()"); + break; + } + /* Set spec */ SDL_memset(&desired, 0, sizeof(desired)); switch (j) { @@ -207,7 +302,10 @@ int audio_initOpenCloseQuitAudio() } } /* spec loop */ - } /* driver loop */ + + audioDriver = NULL; + + } /* driver loop */ /* Restart audio again */ _audioSetUp(NULL); @@ -220,7 +318,7 @@ int audio_initOpenCloseQuitAudio() * * \sa https://wiki.libsdl.org/SDL_PauseAudio */ -int audio_pauseUnpauseAudio() +int audio_pauseUnpauseAudio(void) { int result; int i, iMax, j, k, l; @@ -229,20 +327,43 @@ int audio_pauseUnpauseAudio() int originalCounter; const char *audioDriver; SDL_AudioSpec desired; + const char *hint = SDL_GetHint(SDL_HINT_AUDIODRIVER); /* Stop SDL audio subsystem */ SDL_QuitSubSystem(SDL_INIT_AUDIO); SDLTest_AssertPass("Call to SDL_QuitSubSystem(SDL_INIT_AUDIO)"); - /* Loop over all available audio drivers */ - iMax = SDL_GetNumAudioDrivers(); - SDLTest_AssertPass("Call to SDL_GetNumAudioDrivers()"); - SDLTest_AssertCheck(iMax > 0, "Validate number of audio drivers; expected: >0 got: %d", iMax); + /* Was a specific driver requested? */ + audioDriver = SDL_GetHint(SDL_HINT_AUDIODRIVER); + + if (audioDriver == NULL) { + /* Loop over all available audio drivers */ + iMax = SDL_GetNumAudioDrivers(); + SDLTest_AssertPass("Call to SDL_GetNumAudioDrivers()"); + SDLTest_AssertCheck(iMax > 0, "Validate number of audio drivers; expected: >0 got: %d", iMax); + } else { + /* A specific driver was requested for testing */ + iMax = 1; + } for (i = 0; i < iMax; i++) { - audioDriver = SDL_GetAudioDriver(i); - SDLTest_AssertPass("Call to SDL_GetAudioDriver(%d)", i); - SDLTest_Assert(audioDriver != NULL, "Audio driver name is not NULL"); - SDLTest_AssertCheck(audioDriver[0] != '\0', "Audio driver name is not empty; got: %s", audioDriver); /* NOLINT(clang-analyzer-core.NullDereference): Checked for NULL above */ + if (audioDriver == NULL) { + audioDriver = SDL_GetAudioDriver(i); + SDLTest_AssertPass("Call to SDL_GetAudioDriver(%d)", i); + SDLTest_Assert(audioDriver != NULL, "Audio driver name is not NULL"); + SDLTest_AssertCheck(audioDriver[0] != '\0', "Audio driver name is not empty; got: %s", audioDriver); /* NOLINT(clang-analyzer-core.NullDereference): Checked for NULL above */ + +#if defined(__linux__) + if (DriverIsProblematic(audioDriver)) { + SDLTest_Log("Audio driver '%s' flagged as problematic: skipping pause/unpause test (set SDL_AUDIODRIVER=%s to force)", audioDriver, audioDriver); + audioDriver = NULL; + continue; + } +#endif + } + + if (hint && SDL_strcmp(audioDriver, hint) != 0) { + continue; + } /* Change specs */ for (j = 0; j < 2; j++) { @@ -252,6 +373,16 @@ int audio_pauseUnpauseAudio() SDLTest_AssertPass("Call to SDL_AudioInit('%s')", audioDriver); SDLTest_AssertCheck(result == 0, "Validate result value; expected: 0 got: %d", result); + result = SDL_GetNumAudioDevices(SDL_FALSE); + SDLTest_AssertPass("Call to SDL_GetNumAudioDevices(SDL_FALSE)"); + SDLTest_AssertCheck(result >= 0, "Validate result value; expected: >=0 got: %d", result); + if (result <= 0) { + SDLTest_Log("No output devices for '%s': skipping pause/unpause test", audioDriver); + SDL_AudioQuit(); + SDLTest_AssertPass("Call to SDL_AudioQuit()"); + break; + } + /* Set spec */ SDL_memset(&desired, 0, sizeof(desired)); switch (j) { @@ -326,7 +457,10 @@ int audio_pauseUnpauseAudio() SDLTest_AssertPass("Call to SDL_AudioQuit()"); } /* spec loop */ - } /* driver loop */ + + audioDriver = NULL; + + } /* driver loop */ /* Restart audio again */ _audioSetUp(NULL); @@ -340,7 +474,7 @@ int audio_pauseUnpauseAudio() * \sa https://wiki.libsdl.org/SDL_GetNumAudioDevices * \sa https://wiki.libsdl.org/SDL_GetAudioDeviceName */ -int audio_enumerateAndNameAudioDevices() +int audio_enumerateAndNameAudioDevices(void) { int t, tt; int i, n, nn; @@ -398,7 +532,7 @@ int audio_enumerateAndNameAudioDevices() * \sa https://wiki.libsdl.org/SDL_GetNumAudioDevices * \sa https://wiki.libsdl.org/SDL_GetAudioDeviceName */ -int audio_enumerateAndNameAudioDevicesNegativeTests() +int audio_enumerateAndNameAudioDevicesNegativeTests(void) { int t; int i, j, no, nc; @@ -444,7 +578,7 @@ int audio_enumerateAndNameAudioDevicesNegativeTests() * \sa https://wiki.libsdl.org/SDL_GetNumAudioDrivers * \sa https://wiki.libsdl.org/SDL_GetAudioDriver */ -int audio_printAudioDrivers() +int audio_printAudioDrivers(void) { int i, n; const char *name; @@ -474,7 +608,7 @@ int audio_printAudioDrivers() * * \sa https://wiki.libsdl.org/SDL_GetCurrentAudioDriver */ -int audio_printCurrentAudioDriver() +int audio_printCurrentAudioDriver(void) { /* Check current audio driver */ const char *name = SDL_GetCurrentAudioDriver(); @@ -505,7 +639,7 @@ int _audioFrequencies[] = { 11025, 22050, 44100, 48000 }; * * \sa https://wiki.libsdl.org/SDL_BuildAudioCVT */ -int audio_buildAudioCVT() +int audio_buildAudioCVT(void) { int result; SDL_AudioCVT cvt; @@ -569,7 +703,7 @@ int audio_buildAudioCVT() * * \sa https://wiki.libsdl.org/SDL_BuildAudioCVT */ -int audio_buildAudioCVTNegative() +int audio_buildAudioCVTNegative(void) { const char *expectedError = "Parameter 'cvt' is invalid"; const char *error; @@ -664,7 +798,7 @@ int audio_buildAudioCVTNegative() * * \sa https://wiki.libsdl.org/SDL_GetAudioStatus */ -int audio_getAudioStatus() +int audio_getAudioStatus(void) { SDL_AudioStatus result; @@ -683,7 +817,7 @@ int audio_getAudioStatus() * * \sa https://wiki.libsdl.org/SDL_GetAudioStatus */ -int audio_openCloseAndGetAudioStatus() +int audio_openCloseAndGetAudioStatus(void) { SDL_AudioStatus result; int i; @@ -744,7 +878,7 @@ int audio_openCloseAndGetAudioStatus() * \sa https://wiki.libsdl.org/SDL_LockAudioDevice * \sa https://wiki.libsdl.org/SDL_UnlockAudioDevice */ -int audio_lockUnlockOpenAudioDevice() +int audio_lockUnlockOpenAudioDevice(void) { int i; int count; @@ -808,7 +942,7 @@ int audio_lockUnlockOpenAudioDevice() * \sa https://wiki.libsdl.org/SDL_BuildAudioCVT * \sa https://wiki.libsdl.org/SDL_ConvertAudio */ -int audio_convertAudio() +int audio_convertAudio(void) { int result; SDL_AudioCVT cvt; @@ -909,7 +1043,7 @@ int audio_convertAudio() * * \sa https://wiki.libsdl.org/SDL_AudioDeviceConnected */ -int audio_openCloseAudioDeviceConnected() +int audio_openCloseAudioDeviceConnected(void) { int result = -1; int i; @@ -984,7 +1118,7 @@ static double sine_wave_sample(const Sint64 idx, const Sint64 rate, const Sint64 * \sa https://wiki.libsdl.org/SDL_BuildAudioCVT * \sa https://wiki.libsdl.org/SDL_ConvertAudio */ -int audio_resampleLoss() +int audio_resampleLoss(void) { /* Note: always test long input time (>= 5s from experience) in some test * cases because an improper implementation may suffer from low resampling @@ -1025,8 +1159,8 @@ int audio_resampleLoss() SDLTest_AssertPass("Test resampling of %i s %i Hz %f phase sine wave from sampling rate of %i Hz to %i Hz", spec->time, spec->freq, spec->phase, spec->rate_in, spec->rate_out); - ret = SDL_BuildAudioCVT(&cvt, AUDIO_F32, 1, spec->rate_in, AUDIO_F32, 1, spec->rate_out); - SDLTest_AssertPass("Call to SDL_BuildAudioCVT(&cvt, AUDIO_F32, 1, %i, AUDIO_F32, 1, %i)", spec->rate_in, spec->rate_out); + ret = SDL_BuildAudioCVT(&cvt, AUDIO_F32SYS, 1, spec->rate_in, AUDIO_F32SYS, 1, spec->rate_out); + SDLTest_AssertPass("Call to SDL_BuildAudioCVT(&cvt, AUDIO_F32SYS, 1, %i, AUDIO_F32SYS, 1, %i)", spec->rate_in, spec->rate_out); SDLTest_AssertCheck(ret == 1, "Expected SDL_BuildAudioCVT to succeed and conversion to be needed."); if (ret != 1) { return TEST_ABORTED; diff --git a/thirdparty/SDL/test/testautomation_clipboard.c b/thirdparty/SDL/test/testautomation_clipboard.c index dbe1ef8e4..ce8ea1bd3 100644 --- a/thirdparty/SDL/test/testautomation_clipboard.c +++ b/thirdparty/SDL/test/testautomation_clipboard.c @@ -84,7 +84,7 @@ int clipboard_testSetClipboardText(void *arg) char *textRef = SDLTest_RandomAsciiString(); char *text = SDL_strdup(textRef); int result; - result = SDL_SetClipboardText((const char *)text); + result = SDL_SetClipboardText(text); SDLTest_AssertPass("Call to SDL_SetClipboardText succeeded"); SDLTest_AssertCheck( result == 0, @@ -112,7 +112,7 @@ int clipboard_testSetPrimarySelectionText(void *arg) char *textRef = SDLTest_RandomAsciiString(); char *text = SDL_strdup(textRef); int result; - result = SDL_SetPrimarySelectionText((const char *)text); + result = SDL_SetPrimarySelectionText(text); SDLTest_AssertPass("Call to SDL_SetPrimarySelectionText succeeded"); SDLTest_AssertCheck( result == 0, @@ -149,7 +149,7 @@ int clipboard_testClipboardTextFunctions(void *arg) boolResult = SDL_HasClipboardText(); SDLTest_AssertPass("Call to SDL_HasClipboardText succeeded"); if (boolResult == SDL_TRUE) { - intResult = SDL_SetClipboardText((const char *)NULL); + intResult = SDL_SetClipboardText(NULL); SDLTest_AssertPass("Call to SDL_SetClipboardText(NULL) succeeded"); SDLTest_AssertCheck( intResult == 0, @@ -176,7 +176,7 @@ int clipboard_testClipboardTextFunctions(void *arg) charResult[0] == '\0', /* NOLINT(clang-analyzer-core.NullDereference): Checked for NULL above */ "Verify SDL_GetClipboardText returned string with length 0, got length %i", (int)SDL_strlen(charResult)); - intResult = SDL_SetClipboardText((const char *)text); + intResult = SDL_SetClipboardText(text); SDLTest_AssertPass("Call to SDL_SetClipboardText succeeded"); SDLTest_AssertCheck( intResult == 0, @@ -227,7 +227,7 @@ int clipboard_testPrimarySelectionTextFunctions(void *arg) boolResult = SDL_HasPrimarySelectionText(); SDLTest_AssertPass("Call to SDL_HasPrimarySelectionText succeeded"); if (boolResult == SDL_TRUE) { - intResult = SDL_SetPrimarySelectionText((const char *)NULL); + intResult = SDL_SetPrimarySelectionText(NULL); SDLTest_AssertPass("Call to SDL_SetPrimarySelectionText(NULL) succeeded"); SDLTest_AssertCheck( intResult == 0, @@ -254,7 +254,7 @@ int clipboard_testPrimarySelectionTextFunctions(void *arg) charResult[0] == '\0', /* NOLINT(clang-analyzer-core.NullDereference): Checked for NULL above */ "Verify SDL_GetPrimarySelectionText returned string with length 0, got length %i", (int)SDL_strlen(charResult)); - intResult = SDL_SetPrimarySelectionText((const char *)text); + intResult = SDL_SetPrimarySelectionText(text); SDLTest_AssertPass("Call to SDL_SetPrimarySelectionText succeeded"); SDLTest_AssertCheck( intResult == 0, diff --git a/thirdparty/SDL/test/testautomation_events.c b/thirdparty/SDL/test/testautomation_events.c index 6d0f3ff53..d4babdafc 100644 --- a/thirdparty/SDL/test/testautomation_events.c +++ b/thirdparty/SDL/test/testautomation_events.c @@ -68,6 +68,10 @@ int events_pushPumpAndPollUserevent(void *arg) SDLTest_AssertPass("Call to SDL_PollEvent()"); SDLTest_AssertCheck(result == 1, "Check result from SDL_PollEvent, expected: 1, got: %d", result); + /* Need to finish getting all events and sentinel, otherwise other tests that rely on event are in bad state */ + while (SDL_PollEvent(&event2)) { + } + return TEST_COMPLETED; } diff --git a/thirdparty/SDL/test/testautomation_guid.c b/thirdparty/SDL/test/testautomation_guid.c index cf99dea81..81e60e8f4 100644 --- a/thirdparty/SDL/test/testautomation_guid.c +++ b/thirdparty/SDL/test/testautomation_guid.c @@ -125,7 +125,7 @@ TestGuidToString(void *arg) SDL_GUIDToString(guid, guid_str, size); /* Check bytes before guid_str_buf */ - expected_prefix = fill_char | (fill_char << 8) | (fill_char << 16) | (fill_char << 24); + expected_prefix = fill_char | (fill_char << 8) | (fill_char << 16) | (((Uint32)fill_char) << 24); SDL_memcpy(&actual_prefix, guid_str_buf, 4); SDLTest_AssertCheck(expected_prefix == actual_prefix, "String buffer memory before output untouched, expected: %" SDL_PRIu32 ", got: %" SDL_PRIu32 ", at size=%d", expected_prefix, actual_prefix, size); diff --git a/thirdparty/SDL/test/testautomation_keyboard.c b/thirdparty/SDL/test/testautomation_keyboard.c index 0d459d0b2..d59f2fdd8 100644 --- a/thirdparty/SDL/test/testautomation_keyboard.c +++ b/thirdparty/SDL/test/testautomation_keyboard.c @@ -102,7 +102,7 @@ int keyboard_getKeyFromName(void *arg) /* * Local helper to check for the invalid scancode error message */ -void _checkInvalidScancodeError() +void _checkInvalidScancodeError(void) { const char *expectedError = "Parameter 'scancode' is invalid"; const char *error; @@ -463,32 +463,34 @@ int keyboard_setTextInputRect(void *arg) */ int keyboard_setTextInputRectNegative(void *arg) { + int platform_sets_error_message = SDL_strcmp(SDL_GetCurrentVideoDriver(), "windows") == 0 || + SDL_strcmp(SDL_GetCurrentVideoDriver(), "android") == 0 || + SDL_strcmp(SDL_GetCurrentVideoDriver(), "cococa") == 0; /* Some platforms set also an error message; prepare for checking it */ -#if SDL_VIDEO_DRIVER_WINDOWS || SDL_VIDEO_DRIVER_ANDROID || SDL_VIDEO_DRIVER_COCOA const char *expectedError = "Parameter 'rect' is invalid"; const char *error; SDL_ClearError(); SDLTest_AssertPass("Call to SDL_ClearError()"); -#endif /* NULL refRect */ SDL_SetTextInputRect(NULL); SDLTest_AssertPass("Call to SDL_SetTextInputRect(NULL)"); /* Some platforms set also an error message; so check it */ -#if SDL_VIDEO_DRIVER_WINDOWS || SDL_VIDEO_DRIVER_ANDROID || SDL_VIDEO_DRIVER_COCOA - error = SDL_GetError(); - SDLTest_AssertPass("Call to SDL_GetError()"); - SDLTest_AssertCheck(error != NULL, "Validate that error message was not NULL"); - if (error != NULL) { - SDLTest_AssertCheck(SDL_strcmp(error, expectedError) == 0, - "Validate error message, expected: '%s', got: '%s'", expectedError, error); + + if (platform_sets_error_message) { + error = SDL_GetError(); + SDLTest_AssertPass("Call to SDL_GetError()"); + SDLTest_AssertCheck(error != NULL, "Validate that error message was not NULL"); + if (error != NULL) { + SDLTest_AssertCheck(SDL_strcmp(error, expectedError) == 0, + "Validate error message, expected: '%s', got: '%s'", expectedError, error); + } } SDL_ClearError(); SDLTest_AssertPass("Call to SDL_ClearError()"); -#endif return TEST_COMPLETED; } @@ -572,7 +574,7 @@ int keyboard_getScancodeFromName(void *arg) /* * Local helper to check for the invalid scancode error message */ -void _checkInvalidNameError() +void _checkInvalidNameError(void) { const char *expectedError = "Parameter 'name' is invalid"; const char *error; diff --git a/thirdparty/SDL/test/testautomation_log.c b/thirdparty/SDL/test/testautomation_log.c new file mode 100644 index 000000000..1ad1894e6 --- /dev/null +++ b/thirdparty/SDL/test/testautomation_log.c @@ -0,0 +1,209 @@ +/** + * Log test suite + */ +#include "SDL.h" +#include "SDL_test.h" + + +static SDL_LogOutputFunction original_function; +static void *original_userdata; + +static void SDLCALL TestLogOutput(void *userdata, int category, SDL_LogPriority priority, const char *message) +{ + int *message_count = (int *)userdata; + ++(*message_count); +} + +static void EnableTestLog(int *message_count) +{ + *message_count = 0; + SDL_LogGetOutputFunction(&original_function, &original_userdata); + SDL_LogSetOutputFunction(TestLogOutput, message_count); +} + +static void DisableTestLog(void) +{ + SDL_LogSetOutputFunction(original_function, original_userdata); +} + +/* Fixture */ + +/* Test case functions */ + +/** + * Check SDL_HINT_LOGGING functionality + */ +static int log_testHint(void *arg) +{ + int count; + + SDL_SetHint(SDL_HINT_LOGGING, NULL); + SDLTest_AssertPass("SDL_SetHint(SDL_HINT_LOGGING, NULL)"); + { + EnableTestLog(&count); + SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO, "test"); + DisableTestLog(); + SDLTest_AssertPass("SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO, \"test\")"); + SDLTest_AssertCheck(count == 1, "Check result value, expected: 1, got: %d", count); + + EnableTestLog(&count); + SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_DEBUG, "test"); + DisableTestLog(); + SDLTest_AssertPass("SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_DEBUG, \"test\")"); + SDLTest_AssertCheck(count == 0, "Check result value, expected: 0, got: %d", count); + } + + SDL_SetHint(SDL_HINT_LOGGING, "debug"); + SDLTest_AssertPass("SDL_SetHint(SDL_HINT_LOGGING, \"debug\")"); + { + EnableTestLog(&count); + SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_DEBUG, "test"); + DisableTestLog(); + SDLTest_AssertPass("SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_DEBUG, \"test\")"); + SDLTest_AssertCheck(count == 1, "Check result value, expected: 1, got: %d", count); + + EnableTestLog(&count); + SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_VERBOSE, "test"); + DisableTestLog(); + SDLTest_AssertPass("SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_VERBOSE, \"test\")"); + SDLTest_AssertCheck(count == 0, "Check result value, expected: 0, got: %d", count); + } + + SDL_SetHint(SDL_HINT_LOGGING, "system=debug"); + SDLTest_AssertPass("SDL_SetHint(SDL_HINT_LOGGING, \"system=debug\")"); + { + EnableTestLog(&count); + SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_DEBUG, "test"); + DisableTestLog(); + SDLTest_AssertPass("SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_DEBUG, \"test\")"); + SDLTest_AssertCheck(count == 0, "Check result value, expected: 0, got: %d", count); + + EnableTestLog(&count); + SDL_LogMessage(SDL_LOG_CATEGORY_SYSTEM, SDL_LOG_PRIORITY_DEBUG, "test"); + DisableTestLog(); + SDLTest_AssertPass("SDL_LogMessage(SDL_LOG_CATEGORY_SYSTEM, SDL_LOG_PRIORITY_DEBUG, \"test\")"); + SDLTest_AssertCheck(count == 1, "Check result value, expected: 1, got: %d", count); + + EnableTestLog(&count); + SDL_LogMessage(SDL_LOG_CATEGORY_SYSTEM, SDL_LOG_PRIORITY_VERBOSE, "test"); + DisableTestLog(); + SDLTest_AssertPass("SDL_LogMessage(SDL_LOG_CATEGORY_SYSTEM, SDL_LOG_PRIORITY_VERBOSE, \"test\")"); + SDLTest_AssertCheck(count == 0, "Check result value, expected: 0, got: %d", count); + } + + SDL_SetHint(SDL_HINT_LOGGING, "app=warn,system=debug,assert=quiet,*=info"); + SDLTest_AssertPass("SDL_SetHint(SDL_HINT_LOGGING, \"app=warn,system=debug,assert=quiet,*=info\")"); + { + EnableTestLog(&count); + SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_WARN, "test"); + DisableTestLog(); + SDLTest_AssertPass("SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_WARN, \"test\")"); + SDLTest_AssertCheck(count == 1, "Check result value, expected: 1, got: %d", count); + + EnableTestLog(&count); + SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO, "test"); + DisableTestLog(); + SDLTest_AssertPass("SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO, \"test\")"); + SDLTest_AssertCheck(count == 0, "Check result value, expected: 0, got: %d", count); + + EnableTestLog(&count); + SDL_LogMessage(SDL_LOG_CATEGORY_SYSTEM, SDL_LOG_PRIORITY_DEBUG, "test"); + DisableTestLog(); + SDLTest_AssertPass("SDL_LogMessage(SDL_LOG_CATEGORY_SYSTEM, SDL_LOG_PRIORITY_DEBUG, \"test\")"); + SDLTest_AssertCheck(count == 1, "Check result value, expected: 1, got: %d", count); + + EnableTestLog(&count); + SDL_LogMessage(SDL_LOG_CATEGORY_SYSTEM, SDL_LOG_PRIORITY_VERBOSE, "test"); + DisableTestLog(); + SDLTest_AssertPass("SDL_LogMessage(SDL_LOG_CATEGORY_SYSTEM, SDL_LOG_PRIORITY_VERBOSE, \"test\")"); + SDLTest_AssertCheck(count == 0, "Check result value, expected: 0, got: %d", count); + + EnableTestLog(&count); + SDL_LogMessage(SDL_LOG_CATEGORY_ASSERT, SDL_LOG_PRIORITY_CRITICAL, "test"); + DisableTestLog(); + SDLTest_AssertPass("SDL_LogMessage(SDL_LOG_CATEGORY_ASSERT, SDL_LOG_PRIORITY_CRITICAL, \"test\")"); + SDLTest_AssertCheck(count == 0, "Check result value, expected: 0, got: %d", count); + + EnableTestLog(&count); + SDL_LogMessage(SDL_LOG_CATEGORY_CUSTOM, SDL_LOG_PRIORITY_INFO, "test"); + DisableTestLog(); + SDLTest_AssertPass("SDL_LogMessage(SDL_LOG_CATEGORY_CUSTOM, SDL_LOG_PRIORITY_INFO, \"test\")"); + SDLTest_AssertCheck(count == 1, "Check result value, expected: 1, got: %d", count); + + EnableTestLog(&count); + SDL_LogMessage(SDL_LOG_CATEGORY_CUSTOM, SDL_LOG_PRIORITY_DEBUG, "test"); + DisableTestLog(); + SDLTest_AssertPass("SDL_LogMessage(SDL_LOG_CATEGORY_CUSTOM, SDL_LOG_PRIORITY_DEBUG, \"test\")"); + SDLTest_AssertCheck(count == 0, "Check result value, expected: 0, got: %d", count); + + } + + SDL_SetHint(SDL_HINT_LOGGING, "0=4,3=2,2=0,*=3"); + SDLTest_AssertPass("SDL_SetHint(SDL_HINT_LOGGING, \"0=4,3=2,2=0,*=3\")"); + { + EnableTestLog(&count); + SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_WARN, "test"); + DisableTestLog(); + SDLTest_AssertPass("SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_WARN, \"test\")"); + SDLTest_AssertCheck(count == 1, "Check result value, expected: 1, got: %d", count); + + EnableTestLog(&count); + SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO, "test"); + DisableTestLog(); + SDLTest_AssertPass("SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO, \"test\")"); + SDLTest_AssertCheck(count == 0, "Check result value, expected: 0, got: %d", count); + + EnableTestLog(&count); + SDL_LogMessage(SDL_LOG_CATEGORY_SYSTEM, SDL_LOG_PRIORITY_DEBUG, "test"); + DisableTestLog(); + SDLTest_AssertPass("SDL_LogMessage(SDL_LOG_CATEGORY_SYSTEM, SDL_LOG_PRIORITY_DEBUG, \"test\")"); + SDLTest_AssertCheck(count == 1, "Check result value, expected: 1, got: %d", count); + + EnableTestLog(&count); + SDL_LogMessage(SDL_LOG_CATEGORY_SYSTEM, SDL_LOG_PRIORITY_VERBOSE, "test"); + DisableTestLog(); + SDLTest_AssertPass("SDL_LogMessage(SDL_LOG_CATEGORY_SYSTEM, SDL_LOG_PRIORITY_VERBOSE, \"test\")"); + SDLTest_AssertCheck(count == 0, "Check result value, expected: 0, got: %d", count); + + EnableTestLog(&count); + SDL_LogMessage(SDL_LOG_CATEGORY_ASSERT, SDL_LOG_PRIORITY_CRITICAL, "test"); + DisableTestLog(); + SDLTest_AssertPass("SDL_LogMessage(SDL_LOG_CATEGORY_ASSERT, SDL_LOG_PRIORITY_CRITICAL, \"test\")"); + SDLTest_AssertCheck(count == 0, "Check result value, expected: 0, got: %d", count); + + EnableTestLog(&count); + SDL_LogMessage(SDL_LOG_CATEGORY_CUSTOM, SDL_LOG_PRIORITY_INFO, "test"); + DisableTestLog(); + SDLTest_AssertPass("SDL_LogMessage(SDL_LOG_CATEGORY_CUSTOM, SDL_LOG_PRIORITY_INFO, \"test\")"); + SDLTest_AssertCheck(count == 1, "Check result value, expected: 1, got: %d", count); + + EnableTestLog(&count); + SDL_LogMessage(SDL_LOG_CATEGORY_CUSTOM, SDL_LOG_PRIORITY_DEBUG, "test"); + DisableTestLog(); + SDLTest_AssertPass("SDL_LogMessage(SDL_LOG_CATEGORY_CUSTOM, SDL_LOG_PRIORITY_DEBUG, \"test\")"); + SDLTest_AssertCheck(count == 0, "Check result value, expected: 0, got: %d", count); + + } + + return TEST_COMPLETED; +} + +/* ================= Test References ================== */ + +/* Log test cases */ +static const SDLTest_TestCaseReference logTestHint = { + (SDLTest_TestCaseFp)log_testHint, "log_testHint", "Check SDL_HINT_LOGGING functionality", TEST_ENABLED +}; + +/* Sequence of Log test cases */ +static const SDLTest_TestCaseReference *logTests[] = { + &logTestHint, NULL +}; + +/* Timer test suite (global) */ +SDLTest_TestSuiteReference logTestSuite = { + "Log", + NULL, + logTests, + NULL +}; diff --git a/thirdparty/SDL/test/testautomation_main.c b/thirdparty/SDL/test/testautomation_main.c index ed72e0d95..78572d1a4 100644 --- a/thirdparty/SDL/test/testautomation_main.c +++ b/thirdparty/SDL/test/testautomation_main.c @@ -9,34 +9,6 @@ #include "SDL.h" #include "SDL_test.h" -/* ! - * \brief Tests SDL_Init() and SDL_Quit() of Joystick and Haptic subsystems - * \sa - * http://wiki.libsdl.org/SDL_Init - * http://wiki.libsdl.org/SDL_Quit - */ -static int main_testInitQuitJoystickHaptic(void *arg) -{ -#if defined SDL_JOYSTICK_DISABLED || defined SDL_HAPTIC_DISABLED - return TEST_SKIPPED; -#else - int enabled_subsystems; - int initialized_subsystems = SDL_INIT_JOYSTICK | SDL_INIT_HAPTIC; - - SDLTest_AssertCheck(SDL_Init(initialized_subsystems) == 0, "SDL_Init multiple systems."); - - enabled_subsystems = SDL_WasInit(initialized_subsystems); - SDLTest_AssertCheck(enabled_subsystems == initialized_subsystems, "SDL_WasInit(SDL_INIT_EVERYTHING) contains all systems (%i)", enabled_subsystems); - - SDL_Quit(); - - enabled_subsystems = SDL_WasInit(initialized_subsystems); - SDLTest_AssertCheck(enabled_subsystems == 0, "SDL_Quit should shut down everything (%i)", enabled_subsystems); - - return TEST_COMPLETED; -#endif -} - /* ! * \brief Tests SDL_InitSubSystem() and SDL_QuitSubSystem() * \sa @@ -154,22 +126,18 @@ main_testSetError(void *arg) #endif static const SDLTest_TestCaseReference mainTest1 = { - (SDLTest_TestCaseFp)main_testInitQuitJoystickHaptic, "main_testInitQuitJoystickHaptic", "Tests SDL_Init/Quit of Joystick and Haptic subsystem", TEST_ENABLED -}; - -static const SDLTest_TestCaseReference mainTest2 = { (SDLTest_TestCaseFp)main_testInitQuitSubSystem, "main_testInitQuitSubSystem", "Tests SDL_InitSubSystem/QuitSubSystem", TEST_ENABLED }; -static const SDLTest_TestCaseReference mainTest3 = { +static const SDLTest_TestCaseReference mainTest2 = { (SDLTest_TestCaseFp)main_testImpliedJoystickInit, "main_testImpliedJoystickInit", "Tests that init for gamecontroller properly implies joystick", TEST_ENABLED }; -static const SDLTest_TestCaseReference mainTest4 = { +static const SDLTest_TestCaseReference mainTest3 = { (SDLTest_TestCaseFp)main_testImpliedJoystickQuit, "main_testImpliedJoystickQuit", "Tests that quit for gamecontroller doesn't quit joystick if you inited it explicitly", TEST_ENABLED }; -static const SDLTest_TestCaseReference mainTest5 = { +static const SDLTest_TestCaseReference mainTest4 = { (SDLTest_TestCaseFp)main_testSetError, "main_testSetError", "Tests that SDL_SetError() handles arbitrarily large strings", TEST_ENABLED }; @@ -179,7 +147,6 @@ static const SDLTest_TestCaseReference *mainTests[] = { &mainTest2, &mainTest3, &mainTest4, - &mainTest5, NULL }; @@ -190,5 +157,3 @@ SDLTest_TestSuiteReference mainTestSuite = { mainTests, NULL }; - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/thirdparty/SDL/test/testautomation_math.c b/thirdparty/SDL/test/testautomation_math.c index 87637c01d..314d8ba7f 100644 --- a/thirdparty/SDL/test/testautomation_math.c +++ b/thirdparty/SDL/test/testautomation_math.c @@ -49,6 +49,12 @@ typedef struct double expected; } dd_to_d; +#define DD_TO_D_CASE(IDX, X, Y, E) do { \ + cases[IDX].x_input = (X); \ + cases[IDX].y_input = (Y); \ + cases[IDX].expected = (E); \ + } while (0) + /* NB: You cannot create an array of these structures containing INFINITY or NAN. On platforms such as OS/2, they are defined as 'extern const double' making them @@ -64,10 +70,10 @@ typedef double(SDLCALL *dd_to_d_func)(double, double); * \brief Runs all the cases on a given function with a signature double -> double. * The result is expected to be exact. * - * \param func_name, a printable name for the tested function. - * \param func, the function to call. - * \param cases, an array of all the cases. - * \param cases_size, the size of the cases array. + * \param func_name a printable name for the tested function. + * \param func the function to call. + * \param cases an array of all the cases. + * \param cases_size the size of the cases array. */ static int helper_dtod(const char *func_name, d_to_d_func func, @@ -76,7 +82,7 @@ helper_dtod(const char *func_name, d_to_d_func func, Uint32 i; for (i = 0; i < cases_size; i++) { const double result = func(cases[i].input); - SDLTest_AssertCheck(result == cases[i].expected, + SDLTest_AssertCheck(SDL_fabs(result - cases[i].expected) < FLT_EPSILON, "%s(%f), expected %f, got %f", func_name, cases[i].input, @@ -90,10 +96,10 @@ helper_dtod(const char *func_name, d_to_d_func func, * \brief Runs all the cases on a given function with a signature double -> double. * Checks if the result between expected +/- EPSILON. * - * \param func_name, a printable name for the tested function. - * \param func, the function to call. - * \param cases, an array of all the cases. - * \param cases_size, the size of the cases array. + * \param func_name a printable name for the tested function. + * \param func the function to call. + * \param cases an array of all the cases. + * \param cases_size the size of the cases array. */ static int helper_dtod_inexact(const char *func_name, d_to_d_func func, @@ -102,13 +108,19 @@ helper_dtod_inexact(const char *func_name, d_to_d_func func, Uint32 i; for (i = 0; i < cases_size; i++) { const double result = func(cases[i].input); - SDLTest_AssertCheck(result >= cases[i].expected - EPSILON && - result <= cases[i].expected + EPSILON, - "%s(%f), expected [%f,%f], got %f", + double diff = result - cases[i].expected; + double max_err = (cases[i].expected + 1.) * EPSILON; + if (diff < 0) { + diff = -diff; + } + if (max_err < 0) { + max_err = -max_err; + } + SDLTest_AssertCheck(diff <= max_err, + "%s(%f), expected %f +/- %g, got %f", func_name, cases[i].input, - cases[i].expected - EPSILON, - cases[i].expected + EPSILON, + cases[i].expected, max_err, result); } @@ -119,10 +131,10 @@ helper_dtod_inexact(const char *func_name, d_to_d_func func, * \brief Runs all the cases on a given function with a signature * (double, double) -> double. The result is expected to be exact. * - * \param func_name, a printable name for the tested function. - * \param func, the function to call. - * \param cases, an array of all the cases. - * \param cases_size, the size of the cases array. + * \param func_name a printable name for the tested function. + * \param func the function to call. + * \param cases an array of all the cases. + * \param cases_size the size of the cases array. */ static int helper_ddtod(const char *func_name, dd_to_d_func func, @@ -131,6 +143,8 @@ helper_ddtod(const char *func_name, dd_to_d_func func, Uint32 i; for (i = 0; i < cases_size; i++) { const double result = func(cases[i].x_input, cases[i].y_input); + /* By using the result as input, the compiler is less likely to use higher precision floating point number */ + (void)SDL_sin(result); SDLTest_AssertCheck(result == cases[i].expected, "%s(%f,%f), expected %f, got %f", func_name, @@ -145,10 +159,10 @@ helper_ddtod(const char *func_name, dd_to_d_func func, * \brief Runs all the cases on a given function with a signature * (double, double) -> double. Checks if the result between expected +/- EPSILON. * - * \param func_name, a printable name for the tested function. - * \param func, the function to call. - * \param cases, an array of all the cases. - * \param cases_size, the size of the cases array. + * \param func_name a printable name for the tested function. + * \param func the function to call. + * \param cases an array of all the cases. + * \param cases_size the size of the cases array. */ static int helper_ddtod_inexact(const char *func_name, dd_to_d_func func, @@ -157,13 +171,20 @@ helper_ddtod_inexact(const char *func_name, dd_to_d_func func, Uint32 i; for (i = 0; i < cases_size; i++) { const double result = func(cases[i].x_input, cases[i].y_input); - SDLTest_AssertCheck(result >= cases[i].expected - EPSILON && - result <= cases[i].expected + EPSILON, - "%s(%f,%f), expected [%f,%f], got %f", + double diff = result - cases[i].expected; + double max_err = (cases[i].expected + 1.) * EPSILON; + if (diff < 0) { + diff = -diff; + } + if (max_err < 0) { + max_err = -max_err; + } + + SDLTest_AssertCheck(diff <= max_err, + "%s(%f,%f), expected %f +/- %g, got %f", func_name, cases[i].x_input, cases[i].y_input, - cases[i].expected - EPSILON, - cases[i].expected + EPSILON, + cases[i].expected, max_err, result); } @@ -176,8 +197,8 @@ helper_ddtod_inexact(const char *func_name, dd_to_d_func func, * This function is only meant to test functions that returns the input value if it is * integral: f(x) -> x for x in N. * - * \param func_name, a printable name for the tested function. - * \param func, the function to call. + * \param func_name a printable name for the tested function. + * \param func the function to call. */ static int helper_range(const char *func_name, d_to_d_func func) @@ -1091,7 +1112,7 @@ exp_regularCases(void *args) { 112.89, 10653788283588960962604279261058893737879589093376.0 }, { 539.483, 1970107755334319939701129934673541628417235942656909222826926175622435588279443011110464355295725187195188154768877850257012251677751742837992843520967922303961718983154427294786640886286983037548604937796221048661733679844353544028160.0 }, }; - return helper_dtod("Exp", SDL_exp, regular_cases, SDL_arraysize(regular_cases)); + return helper_dtod_inexact("Exp", SDL_exp, regular_cases, SDL_arraysize(regular_cases)); } /* SDL_log tests functions */ @@ -1138,7 +1159,7 @@ log_baseCases(void *args) 1.0, 0.0, result); result = SDL_log(EULER); - SDLTest_AssertCheck(1.0 == result, + SDLTest_AssertCheck(SDL_fabs(result - 1.) < FLT_EPSILON, "Log(%f), expected %f, got %f", EULER, 1.0, result); @@ -1646,14 +1667,16 @@ static int pow_regularCases(void *args) { const dd_to_d regular_cases[] = { +#if 0 /* These tests fail when using the Mingw C runtime, we'll disable them for now */ { -391.25, -2.0, 0.00000653267870448815438463212659780943170062528224661946296691894531250 }, { -72.3, 12.0, 20401381050275984310272.0 }, +#endif { -5.0, 3.0, -125.0 }, { 3.0, 2.5, 15.58845726811989607085706666111946105957031250 }, { 39.23, -1.5, 0.0040697950366865498147972424192175822099670767784118652343750 }, { 478.972, 12.125, 315326359630449587856007411793920.0 } }; - return helper_ddtod("Pow", SDL_pow, regular_cases, SDL_arraysize(regular_cases)); + return helper_ddtod_inexact("Pow", SDL_pow, regular_cases, SDL_arraysize(regular_cases)); } /** @@ -1981,24 +2004,24 @@ static int cos_precisionTest(void *args) { const d_to_d precision_cases[] = { - { M_PI * 1.0 / 10.0, 0.9510565162 }, - { M_PI * 2.0 / 10.0, 0.8090169943 }, - { M_PI * 3.0 / 10.0, 0.5877852522 }, - { M_PI * 4.0 / 10.0, 0.3090169943 }, + { M_PI * 1.0 / 10.0, 0.9510565162951535 }, + { M_PI * 2.0 / 10.0, 0.8090169943749475 }, + { M_PI * 3.0 / 10.0, 0.5877852522924731 }, + { M_PI * 4.0 / 10.0, 0.30901699437494745 }, { M_PI * 5.0 / 10.0, 0.0 }, - { M_PI * 6.0 / 10.0, -0.3090169943 }, - { M_PI * 7.0 / 10.0, -0.5877852522 }, - { M_PI * 8.0 / 10.0, -0.8090169943 }, - { M_PI * 9.0 / 10.0, -0.9510565162 }, - { M_PI * -1.0 / 10.0, 0.9510565162 }, - { M_PI * -2.0 / 10.0, 0.8090169943 }, - { M_PI * -3.0 / 10.0, 0.5877852522 }, - { M_PI * -4.0 / 10.0, 0.3090169943 }, + { M_PI * 6.0 / 10.0, -0.30901699437494734 }, + { M_PI * 7.0 / 10.0, -0.587785252292473 }, + { M_PI * 8.0 / 10.0, -0.8090169943749473 }, + { M_PI * 9.0 / 10.0, -0.9510565162951535 }, + { M_PI * -1.0 / 10.0, 0.9510565162951535 }, + { M_PI * -2.0 / 10.0, 0.8090169943749475 }, + { M_PI * -3.0 / 10.0, 0.5877852522924731 }, + { M_PI * -4.0 / 10.0, 0.30901699437494745 }, { M_PI * -5.0 / 10.0, 0.0 }, - { M_PI * -6.0 / 10.0, -0.3090169943 }, - { M_PI * -7.0 / 10.0, -0.5877852522 }, - { M_PI * -8.0 / 10.0, -0.8090169943 }, - { M_PI * -9.0 / 10.0, -0.9510565162 } + { M_PI * -6.0 / 10.0, -0.30901699437494734 }, + { M_PI * -7.0 / 10.0, -0.587785252292473 }, + { M_PI * -8.0 / 10.0, -0.8090169943749473 }, + { M_PI * -9.0 / 10.0, -0.9510565162951535 } }; return helper_dtod_inexact("Cos", SDL_cos, precision_cases, SDL_arraysize(precision_cases)); } @@ -2099,23 +2122,23 @@ static int sin_precisionTest(void *args) { const d_to_d precision_cases[] = { - { M_PI * 1.0 / 10.0, 0.3090169943 }, - { M_PI * 2.0 / 10.0, 0.5877852522 }, - { M_PI * 3.0 / 10.0, 0.8090169943 }, - { M_PI * 4.0 / 10.0, 0.9510565162 }, - { M_PI * 6.0 / 10.0, 0.9510565162 }, - { M_PI * 7.0 / 10.0, 0.8090169943 }, - { M_PI * 8.0 / 10.0, 0.5877852522 }, - { M_PI * 9.0 / 10.0, 0.3090169943 }, + { M_PI * 1.0 / 10.0, 0.3090169943749474 }, + { M_PI * 2.0 / 10.0, 0.5877852522924731 }, + { M_PI * 3.0 / 10.0, 0.8090169943749475 }, + { M_PI * 4.0 / 10.0, 0.9510565162951535 }, + { M_PI * 6.0 / 10.0, 0.9510565162951536 }, + { M_PI * 7.0 / 10.0, 0.8090169943749475 }, + { M_PI * 8.0 / 10.0, 0.5877852522924732 }, + { M_PI * 9.0 / 10.0, 0.3090169943749475 }, { M_PI, 0.0 }, - { M_PI * -1.0 / 10.0, -0.3090169943 }, - { M_PI * -2.0 / 10.0, -0.5877852522 }, - { M_PI * -3.0 / 10.0, -0.8090169943 }, - { M_PI * -4.0 / 10.0, -0.9510565162 }, - { M_PI * -6.0 / 10.0, -0.9510565162 }, - { M_PI * -7.0 / 10.0, -0.8090169943 }, - { M_PI * -8.0 / 10.0, -0.5877852522 }, - { M_PI * -9.0 / 10.0, -0.3090169943 }, + { M_PI * -1.0 / 10.0, -0.3090169943749474 }, + { M_PI * -2.0 / 10.0, -0.5877852522924731 }, + { M_PI * -3.0 / 10.0, -0.8090169943749475 }, + { M_PI * -4.0 / 10.0, -0.9510565162951535 }, + { M_PI * -6.0 / 10.0, -0.9510565162951536 }, + { M_PI * -7.0 / 10.0, -0.8090169943749475 }, + { M_PI * -8.0 / 10.0, -0.5877852522924732 }, + { M_PI * -9.0 / 10.0, -0.3090169943749475 }, { -M_PI, 0.0 }, }; return helper_dtod_inexact("Sin", SDL_sin, precision_cases, SDL_arraysize(precision_cases)); @@ -2215,26 +2238,26 @@ static int tan_precisionTest(void *args) { const d_to_d precision_cases[] = { - { M_PI * 1.0 / 11.0, 0.2936264929 }, - { M_PI * 2.0 / 11.0, 0.6426609771 }, - { M_PI * 3.0 / 11.0, 1.1540615205 }, - { M_PI * 4.0 / 11.0, 2.1896945629 }, - { M_PI * 5.0 / 11.0, 6.9551527717 }, - { M_PI * 6.0 / 11.0, -6.9551527717 }, - { M_PI * 7.0 / 11.0, -2.1896945629 }, - { M_PI * 8.0 / 11.0, -1.1540615205 }, - { M_PI * 9.0 / 11.0, -0.6426609771 }, - { M_PI * 10.0 / 11.0, -0.2936264929 }, - { M_PI * -1.0 / 11.0, -0.2936264929 }, - { M_PI * -2.0 / 11.0, -0.6426609771 }, - { M_PI * -3.0 / 11.0, -1.1540615205 }, - { M_PI * -4.0 / 11.0, -2.1896945629 }, - { M_PI * -5.0 / 11.0, -6.9551527717 }, - { M_PI * -6.0 / 11.0, 6.9551527717 }, - { M_PI * -7.0 / 11.0, 2.1896945629 }, - { M_PI * -8.0 / 11.0, 1.1540615205 }, - { M_PI * -9.0 / 11.0, 0.6426609771 }, - { M_PI * -10.0 / 11.0, 0.2936264929 } + { M_PI * 1.0 / 11.0, 0.29362649293836673 }, + { M_PI * 2.0 / 11.0, 0.642660977168331 }, + { M_PI * 3.0 / 11.0, 1.1540615205330094 }, + { M_PI * 4.0 / 11.0, 2.189694562989681 }, + { M_PI * 5.0 / 11.0, 6.9551527717734745 }, + { M_PI * 6.0 / 11.0, -6.955152771773481 }, + { M_PI * 7.0 / 11.0, -2.189694562989682 }, + { M_PI * 8.0 / 11.0, -1.1540615205330096 }, + { M_PI * 9.0 / 11.0, -0.6426609771683314 }, + { M_PI * 10.0 / 11.0, -0.2936264929383667 }, + { M_PI * -1.0 / 11.0, -0.29362649293836673 }, + { M_PI * -2.0 / 11.0, -0.642660977168331 }, + { M_PI * -3.0 / 11.0, -1.1540615205330094 }, + { M_PI * -4.0 / 11.0, -2.189694562989681 }, + { M_PI * -5.0 / 11.0, -6.9551527717734745 }, + { M_PI * -6.0 / 11.0, 6.955152771773481 }, + { M_PI * -7.0 / 11.0, 2.189694562989682 }, + { M_PI * -8.0 / 11.0, 1.1540615205330096 }, + { M_PI * -9.0 / 11.0, 0.6426609771683314 }, + { M_PI * -10.0 / 11.0, 0.2936264929383667 } }; return helper_dtod_inexact("Tan", SDL_tan, precision_cases, SDL_arraysize(precision_cases)); } @@ -2256,7 +2279,7 @@ acos_limitCases(void *args) 1.0, 0.0, result); result = SDL_acos(-1.0); - SDLTest_AssertCheck(M_PI == result, + SDLTest_AssertCheck(SDL_fabs(M_PI - result) <= EPSILON, "Acos(%f), expected %f, got %f", -1.0, M_PI, result); @@ -2343,12 +2366,12 @@ asin_limitCases(void *args) double result; result = SDL_asin(1.0); - SDLTest_AssertCheck(M_PI / 2.0 == result, + SDLTest_AssertCheck(SDL_fabs(M_PI / 2.0 - result) <= EPSILON, "Asin(%f), expected %f, got %f", 1.0, M_PI / 2.0, result); result = SDL_asin(-1.0); - SDLTest_AssertCheck(-M_PI / 2.0 == result, + SDLTest_AssertCheck(SDL_fabs(-M_PI / 2.0 - result) <= EPSILON, "Asin(%f), expected %f, got %f", -1.0, -M_PI / 2.0, result); @@ -2399,26 +2422,26 @@ static int asin_precisionTest(void *args) { const d_to_d precision_cases[] = { - { 0.9, 1.1197695149 }, - { 0.8, 0.9272952180 }, - { 0.7, 0.7753974966 }, - { 0.6, 0.6435011087 }, - { 0.5, 0.5235987755 }, - { 0.4, 0.4115168460 }, - { 0.3, 0.3046926540 }, - { 0.2, 0.2013579207 }, - { 0.1, 0.1001674211 }, + { 0.9, 1.1197695149986342 }, + { 0.8, 0.9272952180016123 }, + { 0.7, 0.775397496610753 }, + { 0.6, 0.6435011087932844 }, + { 0.5, 0.5235987755982989 }, + { 0.4, 0.41151684606748806 }, + { 0.3, 0.3046926540153976 }, + { 0.2, 0.20135792079033074 }, + { 0.1, 0.10016742116155977 }, { 0.0, 0.0 }, { -0.0, -0.0 }, - { -0.1, -0.1001674211 }, - { -0.2, -0.2013579207 }, - { -0.3, -0.3046926540 }, - { -0.4, -0.4115168460 }, - { -0.5, -0.5235987755 }, - { -0.6, -0.6435011087 }, - { -0.7, -0.7753974966 }, - { -0.8, -0.9272952180 }, - { -0.9, -1.1197695149 } + { -0.1, -0.10016742116155977 }, + { -0.2, -0.20135792079033074 }, + { -0.3, -0.3046926540153976 }, + { -0.4, -0.41151684606748806 }, + { -0.5, -0.5235987755982989 }, + { -0.6, -0.6435011087932844 }, + { -0.7, -0.775397496610753 }, + { -0.8, -0.9272952180016123 }, + { -0.9, -1.1197695149986342 } }; return helper_dtod_inexact("Asin", SDL_asin, precision_cases, SDL_arraysize(precision_cases)); } @@ -2493,24 +2516,24 @@ static int atan_precisionTest(void *args) { const d_to_d precision_cases[] = { - { 6.313751514675041, 1.4137166941 }, - { 3.0776835371752527, 1.2566370614 }, - { 1.9626105055051504, 1.0995574287 }, - { 1.3763819204711734, 0.9424777960 }, - { 1.0, 0.7853981633 }, - { 0.7265425280053609, 0.6283185307 }, - { 0.5095254494944288, 0.4712388980 }, - { 0.3249196962329063, 0.3141592653 }, - { 0.15838444032453627, 0.1570796326 }, - { -0.15838444032453627, -0.1570796326 }, - { -0.3249196962329063, -0.3141592653 }, - { -0.5095254494944288, -0.4712388980 }, - { -0.7265425280053609, -0.6283185307 }, - { -1.0, -0.7853981633 }, - { -1.3763819204711734, -0.9424777960 }, - { -1.9626105055051504, -1.0995574287 }, - { -3.0776835371752527, -1.2566370614 }, - { -6.313751514675041, -1.4137166941 }, + { 6.313751514675041, 1.413716694115407 }, + { 3.0776835371752527, 1.2566370614359172 }, + { 1.9626105055051504, 1.0995574287564276 }, + { 1.3763819204711734, 0.9424777960769379 }, + { 1.0, 0.7853981633974483 }, + { 0.7265425280053609, 0.6283185307179586 }, + { 0.5095254494944288, 0.47123889803846897 }, + { 0.3249196962329063, 0.3141592653589793 }, + { 0.15838444032453627, 0.15707963267948966 }, + { -0.15838444032453627, -0.15707963267948966 }, + { -0.3249196962329063, -0.3141592653589793 }, + { -0.5095254494944288, -0.47123889803846897 }, + { -0.7265425280053609, -0.6283185307179586 }, + { -1.0, -0.7853981633974483 }, + { -1.3763819204711734, -0.9424777960769379 }, + { -1.9626105055051504, -1.0995574287564276 }, + { -3.0776835371752527, -1.2566370614359172 }, + { -6.313751514675041, -1.413716694115407 }, }; return helper_dtod_inexact("Atan", SDL_atan, precision_cases, SDL_arraysize(precision_cases)); } @@ -2535,7 +2558,7 @@ atan2_bothZeroCases(void *args) { 0.0, -0.0, M_PI }, { -0.0, -0.0, -M_PI }, }; - return helper_ddtod("SDL_atan2", SDL_atan2, cases, SDL_arraysize(cases)); + return helper_ddtod_inexact("SDL_atan2", SDL_atan2, cases, SDL_arraysize(cases)); } /** @@ -2554,7 +2577,7 @@ atan2_yZeroCases(void *args) { -0.0, 1.0, -0.0 }, { -0.0, -1.0, -M_PI } }; - return helper_ddtod("SDL_atan2", SDL_atan2, cases, SDL_arraysize(cases)); + return helper_ddtod_inexact("SDL_atan2", SDL_atan2, cases, SDL_arraysize(cases)); } /** @@ -2570,7 +2593,7 @@ atan2_xZeroCases(void *args) { 1.0, -0.0, M_PI / 2.0 }, { -1.0, -0.0, -M_PI / 2.0 } }; - return helper_ddtod("SDL_atan2", SDL_atan2, cases, SDL_arraysize(cases)); + return helper_ddtod_inexact("SDL_atan2", SDL_atan2, cases, SDL_arraysize(cases)); } /* Infinity cases */ @@ -2586,29 +2609,12 @@ atan2_xZeroCases(void *args) static int atan2_bothInfCases(void *args) { - double result; - - result = SDL_atan2(INFINITY, INFINITY); - SDLTest_AssertCheck(M_PI / 4.0 == result, - "Atan2(%f,%f), expected %f, got %f", - INFINITY, INFINITY, M_PI / 4.0, result); - - result = SDL_atan2(INFINITY, -INFINITY); - SDLTest_AssertCheck(3.0 * M_PI / 4.0 == result, - "Atan2(%f,%f), expected %f, got %f", - INFINITY, -INFINITY, 3.0 * M_PI / 4.0, result); - - result = SDL_atan2(-INFINITY, INFINITY); - SDLTest_AssertCheck(-M_PI / 4.0 == result, - "Atan2(%f,%f), expected %f, got %f", - -INFINITY, INFINITY, -M_PI / 4.0, result); - - result = SDL_atan2(-INFINITY, -INFINITY); - SDLTest_AssertCheck(-3.0 * M_PI / 4.0 == result, - "Atan2(%f,%f), expected %f, got %f", - -INFINITY, -INFINITY, -3.0 * M_PI / 4.0, result); - - return TEST_COMPLETED; + dd_to_d cases[4]; + DD_TO_D_CASE(0, INFINITY, INFINITY, 1.0 * M_PI / 4.0); + DD_TO_D_CASE(1, INFINITY, -INFINITY, 3.0 * M_PI / 4.0); + DD_TO_D_CASE(2, -INFINITY, INFINITY, -1.0 * M_PI / 4.0); + DD_TO_D_CASE(3, -INFINITY, -INFINITY, -3.0 * M_PI / 4.0); + return helper_ddtod("SDL_atan2(bothInfCases)", SDL_atan2, cases, SDL_arraysize(cases)); } /** @@ -2618,29 +2624,12 @@ atan2_bothInfCases(void *args) static int atan2_yInfCases(void *args) { - double result; - - result = SDL_atan2(INFINITY, 1.0); - SDLTest_AssertCheck(M_PI / 2.0 == result, - "Atan2(%f,%f), expected %f, got %f", - INFINITY, 1.0, M_PI / 2.0, result); - - result = SDL_atan2(INFINITY, -1.0); - SDLTest_AssertCheck(M_PI / 2.0 == result, - "Atan2(%f,%f), expected %f, got %f", - INFINITY, -1.0, M_PI / 2.0, result); - - result = SDL_atan2(-INFINITY, 1.0); - SDLTest_AssertCheck(-M_PI / 2.0 == result, - "Atan2(%f,%f), expected %f, got %f", - -INFINITY, 1.0, -M_PI / 2.0, result); - - result = SDL_atan2(-INFINITY, -1.0); - SDLTest_AssertCheck(-M_PI / 2.0 == result, - "Atan2(%f,%f), expected %f, got %f", - -INFINITY, -1.0, -M_PI / 2.0, result); - - return TEST_COMPLETED; + dd_to_d cases[4]; + DD_TO_D_CASE(0, INFINITY, 1.0, 1.0 * M_PI / 2.0); + DD_TO_D_CASE(1, INFINITY, -1.0, 1.0 * M_PI / 2.0); + DD_TO_D_CASE(2, -INFINITY, 1.0, -1.0 * M_PI / 2.0); + DD_TO_D_CASE(3, -INFINITY, -1.0, -1.0 * M_PI / 2.0); + return helper_ddtod("SDL_atan2(atan2_yInfCases)", SDL_atan2, cases, SDL_arraysize(cases)); } /** @@ -2652,29 +2641,12 @@ atan2_yInfCases(void *args) static int atan2_xInfCases(void *args) { - double result; - - result = SDL_atan2(1.0, INFINITY); - SDLTest_AssertCheck(0.0 == result, - "Atan2(%f,%f), expected %f, got %f", - 1.0, INFINITY, 0.0, result); - - result = SDL_atan2(-1.0, INFINITY); - SDLTest_AssertCheck(-0.0 == result, - "Atan2(%f,%f), expected %f, got %f", - -1.0, INFINITY, -0.0, result); - - result = SDL_atan2(1.0, -INFINITY); - SDLTest_AssertCheck(M_PI == result, - "Atan2(%f,%f), expected %f, got %f", - 1.0, -INFINITY, M_PI, result); - - result = SDL_atan2(-1.0, -INFINITY); - SDLTest_AssertCheck(-M_PI == result, - "Atan2(%f,%f), expected %f, got %f", - -1.0, -INFINITY, -M_PI, result); - - return TEST_COMPLETED; + dd_to_d cases[4]; + DD_TO_D_CASE(0, 1.0, INFINITY, 0.0); + DD_TO_D_CASE(1, -1.0, INFINITY, -0.0); + DD_TO_D_CASE(2, 1.0, -INFINITY, M_PI); + DD_TO_D_CASE(3, -1.0, -INFINITY, -M_PI); + return helper_ddtod("atan2_xInfCases(atan2_yInfCases)", SDL_atan2, cases, SDL_arraysize(cases)); } /* Miscelanious cases */ diff --git a/thirdparty/SDL/test/testautomation_mouse.c b/thirdparty/SDL/test/testautomation_mouse.c index 22a437801..19b1a9f58 100644 --- a/thirdparty/SDL/test/testautomation_mouse.c +++ b/thirdparty/SDL/test/testautomation_mouse.c @@ -423,7 +423,7 @@ SDL_Window *_createMouseSuiteTestWindow() */ void _destroyMouseSuiteTestWindow(SDL_Window *window) { - if (window != NULL) { + if (window) { SDL_DestroyWindow(window); window = NULL; SDLTest_AssertPass("SDL_DestroyWindow()"); @@ -458,7 +458,7 @@ int mouse_warpMouseInWindow(void *arg) yPositions[5] = h + 1; /* Create test window */ window = _createMouseSuiteTestWindow(); - if (window == NULL) { + if (!window) { return TEST_ABORTED; } @@ -503,6 +503,7 @@ int mouse_getMouseFocus(void *arg) int x, y; SDL_Window *window; SDL_Window *focusWindow; + const SDL_bool video_driver_is_wayland = !SDL_strcmp(SDL_GetCurrentVideoDriver(), "wayland"); /* Get focus - focus non-deterministic */ focusWindow = SDL_GetMouseFocus(); @@ -510,32 +511,37 @@ int mouse_getMouseFocus(void *arg) /* Create test window */ window = _createMouseSuiteTestWindow(); - if (window == NULL) { + if (!window) { return TEST_ABORTED; } - /* Mouse to random position inside window */ - x = SDLTest_RandomIntegerInRange(1, w - 1); - y = SDLTest_RandomIntegerInRange(1, h - 1); - SDL_WarpMouseInWindow(window, x, y); - SDLTest_AssertPass("SDL_WarpMouseInWindow(...,%i,%i)", x, y); - - /* Pump events to update focus state */ - SDL_Delay(100); - SDL_PumpEvents(); - SDLTest_AssertPass("SDL_PumpEvents()"); - - /* Get focus with explicit window setup - focus deterministic */ - focusWindow = SDL_GetMouseFocus(); - SDLTest_AssertPass("SDL_GetMouseFocus()"); - SDLTest_AssertCheck(focusWindow != NULL, "Check returned window value is not NULL"); - SDLTest_AssertCheck(focusWindow == window, "Check returned window value is test window"); - - /* Mouse to random position outside window */ - x = SDLTest_RandomIntegerInRange(-9, -1); - y = SDLTest_RandomIntegerInRange(-9, -1); - SDL_WarpMouseInWindow(window, x, y); - SDLTest_AssertPass("SDL_WarpMouseInWindow(...,%i,%i)", x, y); + /* Wayland explicitly disallows warping the mouse pointer, so this test must be skipped. */ + if (!video_driver_is_wayland) { + /* Mouse to random position inside window */ + x = SDLTest_RandomIntegerInRange(1, w - 1); + y = SDLTest_RandomIntegerInRange(1, h - 1); + SDL_WarpMouseInWindow(window, x, y); + SDLTest_AssertPass("SDL_WarpMouseInWindow(...,%i,%i)", x, y); + + /* Pump events to update focus state */ + SDL_Delay(100); + SDL_PumpEvents(); + SDLTest_AssertPass("SDL_PumpEvents()"); + + /* Get focus with explicit window setup - focus deterministic */ + focusWindow = SDL_GetMouseFocus(); + SDLTest_AssertPass("SDL_GetMouseFocus()"); + SDLTest_AssertCheck(focusWindow != NULL, "Check returned window value is not NULL"); + SDLTest_AssertCheck(focusWindow == window, "Check returned window value is test window"); + + /* Mouse to random position outside window */ + x = SDLTest_RandomIntegerInRange(-9, -1); + y = SDLTest_RandomIntegerInRange(-9, -1); + SDL_WarpMouseInWindow(window, x, y); + SDLTest_AssertPass("SDL_WarpMouseInWindow(...,%i,%i)", x, y); + } else { + SDLTest_Log("Skipping mouse warp focus tests: Wayland does not support warping the mouse pointer"); + } /* Clean up test window */ _destroyMouseSuiteTestWindow(window); diff --git a/thirdparty/SDL/test/testautomation_pixels.c b/thirdparty/SDL/test/testautomation_pixels.c index d5440e5b4..12cf63249 100644 --- a/thirdparty/SDL/test/testautomation_pixels.c +++ b/thirdparty/SDL/test/testautomation_pixels.c @@ -14,6 +14,8 @@ const int _numRGBPixelFormats = 31; Uint32 _RGBPixelFormats[] = { SDL_PIXELFORMAT_INDEX1LSB, SDL_PIXELFORMAT_INDEX1MSB, + SDL_PIXELFORMAT_INDEX2LSB, + SDL_PIXELFORMAT_INDEX2MSB, SDL_PIXELFORMAT_INDEX4LSB, SDL_PIXELFORMAT_INDEX4MSB, SDL_PIXELFORMAT_INDEX8, @@ -47,6 +49,8 @@ Uint32 _RGBPixelFormats[] = { const char *_RGBPixelFormatsVerbose[] = { "SDL_PIXELFORMAT_INDEX1LSB", "SDL_PIXELFORMAT_INDEX1MSB", + "SDL_PIXELFORMAT_INDEX2LSB", + "SDL_PIXELFORMAT_INDEX2MSB", "SDL_PIXELFORMAT_INDEX4LSB", "SDL_PIXELFORMAT_INDEX4MSB", "SDL_PIXELFORMAT_INDEX8", diff --git a/thirdparty/SDL/test/testautomation_platform.c b/thirdparty/SDL/test/testautomation_platform.c index ac85eef23..bd2aabed6 100644 --- a/thirdparty/SDL/test/testautomation_platform.c +++ b/thirdparty/SDL/test/testautomation_platform.c @@ -386,7 +386,7 @@ int platform_testSetErrorEmptyInput(void *arg) int platform_testSetErrorInvalidInput(void *arg) { int result; - const char *invalidError = NULL; + const char *invalidError = ""; const char *probeError = "Testing"; char *lastError; size_t len; diff --git a/thirdparty/SDL/test/testautomation_render.c b/thirdparty/SDL/test/testautomation_render.c index 74b963146..45198a826 100644 --- a/thirdparty/SDL/test/testautomation_render.c +++ b/thirdparty/SDL/test/testautomation_render.c @@ -43,6 +43,7 @@ static int _isSupported(int code); void InitCreateRenderer(void *arg) { int posX = 100, posY = 100, width = 320, height = 240; + int renderer_flags = SDL_RENDERER_ACCELERATED; renderer = NULL; window = SDL_CreateWindow("render_testCreateRenderer", posX, posY, width, height, 0); SDLTest_AssertPass("SDL_CreateWindow()"); @@ -51,7 +52,11 @@ void InitCreateRenderer(void *arg) return; } - renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED); + if (SDL_strcmp(SDL_GetCurrentVideoDriver(), "dummy") == 0) { + renderer_flags = 0; + } + + renderer = SDL_CreateRenderer(window, -1, renderer_flags); SDLTest_AssertPass("SDL_CreateRenderer()"); SDLTest_AssertCheck(renderer != NULL, "Check SDL_CreateRenderer result"); if (renderer == NULL) { @@ -65,13 +70,13 @@ void InitCreateRenderer(void *arg) */ void CleanupDestroyRenderer(void *arg) { - if (renderer != NULL) { + if (renderer) { SDL_DestroyRenderer(renderer); renderer = NULL; SDLTest_AssertPass("SDL_DestroyRenderer()"); } - if (window != NULL) { + if (window) { SDL_DestroyWindow(window); window = NULL; SDLTest_AssertPass("SDL_DestroyWindow"); @@ -938,12 +943,12 @@ _loadTestFace(void) SDL_Texture *tface; face = SDLTest_ImageFace(); - if (face == NULL) { + if (!face) { return NULL; } tface = SDL_CreateTextureFromSurface(renderer, face); - if (tface == NULL) { + if (!tface) { SDLTest_LogError("SDL_CreateTextureFromSurface() failed with error: %s", SDL_GetError()); } @@ -970,7 +975,7 @@ _hasTexColor(void) /* Get test face. */ tface = _loadTestFace(); - if (tface == NULL) { + if (!tface) { return 0; } @@ -1014,7 +1019,7 @@ _hasTexAlpha(void) /* Get test face. */ tface = _loadTestFace(); - if (tface == NULL) { + if (!tface) { return 0; } @@ -1043,7 +1048,7 @@ _hasTexAlpha(void) /** * @brief Compares screen pixels with image pixels. Helper function. * - * @param s Image to compare against. + * @param referenceSurface Image to compare against. * * \sa * http://wiki.libsdl.org/SDL_RenderReadPixels diff --git a/thirdparty/SDL/test/testautomation_stdlib.c b/thirdparty/SDL/test/testautomation_stdlib.c index a75e4570b..969dd39b4 100644 --- a/thirdparty/SDL/test/testautomation_stdlib.c +++ b/thirdparty/SDL/test/testautomation_stdlib.c @@ -53,7 +53,7 @@ int stdlib_snprintf(void *arg) int result; int predicted; char text[1024]; - const char *expected; + const char *expected, *expected2, *expected3, *expected4, *expected5; size_t size; result = SDL_snprintf(text, sizeof(text), "%s", "foo"); @@ -62,6 +62,18 @@ int stdlib_snprintf(void *arg) SDLTest_AssertCheck(SDL_strcmp(text, expected) == 0, "Check text, expected: %s, got: %s", expected, text); SDLTest_AssertCheck(result == SDL_strlen(text), "Check result value, expected: %d, got: %d", (int)SDL_strlen(text), result); + result = SDL_snprintf(text, sizeof(text), "%10sA", "foo"); + expected = " fooA"; + SDLTest_AssertPass("Call to SDL_snprintf(\"%%10sA\", \"foo\")"); + SDLTest_AssertCheck(SDL_strcmp(text, expected) == 0, "Check text, expected: %s, got: %s", expected, text); + SDLTest_AssertCheck(result == SDL_strlen(text), "Check result value, expected: %d, got: %d", (int)SDL_strlen(text), result); + + result = SDL_snprintf(text, sizeof(text), "%-10sA", "foo"); + expected = "foo A"; + SDLTest_AssertPass("Call to SDL_snprintf(\"%%-10sA\", \"foo\")"); + SDLTest_AssertCheck(SDL_strcmp(text, expected) == 0, "Check text, expected: %s, got: %s", expected, text); + SDLTest_AssertCheck(result == SDL_strlen(text), "Check result value, expected: %d, got: %d", (int)SDL_strlen(text), result); + result = SDL_snprintf(text, sizeof(text), "%S", L"foo"); expected = "foo"; SDLTest_AssertPass("Call to SDL_snprintf(\"%%S\", \"foo\")"); @@ -175,6 +187,61 @@ int stdlib_snprintf(void *arg) SDLTest_AssertCheck(SDL_strcmp(text, expected) == 0, "Check text, expected: '%s', got: '%s'", expected, text); SDLTest_AssertCheck(result == 7, "Check result value, expected: 7, got: %d", result); + result = SDL_snprintf(text, sizeof(text), "%p", (void *)0x1234abcd); + expected = "0x1234abcd"; + expected2 = "1234ABCD"; + expected3 = "000000001234ABCD"; + expected4 = "1234abcd"; + expected5 = "000000001234abcd"; + SDLTest_AssertPass("Call to SDL_snprintf(text, sizeof(text), \"%%p\", 0x1234abcd)"); + SDLTest_AssertCheck(SDL_strcmp(text, expected) == 0 || + SDL_strcmp(text, expected2) == 0 || + SDL_strcmp(text, expected3) == 0 || + SDL_strcmp(text, expected4) == 0 || + SDL_strcmp(text, expected5) == 0, + "Check text, expected: '%s', got: '%s'", expected, text); + SDLTest_AssertCheck(result == SDL_strlen(expected) || + result == SDL_strlen(expected2) || + result == SDL_strlen(expected3) || + result == SDL_strlen(expected4) || + result == SDL_strlen(expected5), + "Check result value, expected: %d, got: %d", (int)SDL_strlen(expected), result); + + result = SDL_snprintf(text, sizeof(text), "A %p B", (void *)0x1234abcd); + expected = "A 0x1234abcd B"; + expected2 = "A 1234ABCD B"; + expected3 = "A 000000001234ABCD B"; + expected4 = "A 1234abcd B"; + expected5 = "A 000000001234abcd B"; + SDLTest_AssertPass("Call to SDL_snprintf(text, sizeof(text), \"A %%p B\", 0x1234abcd)"); + SDLTest_AssertCheck(SDL_strcmp(text, expected) == 0 || + SDL_strcmp(text, expected2) == 0 || + SDL_strcmp(text, expected3) == 0 || + SDL_strcmp(text, expected4) == 0 || + SDL_strcmp(text, expected5) == 0, + "Check text, expected: '%s', got: '%s'", expected, text); + SDLTest_AssertCheck(result == SDL_strlen(expected) || + result == SDL_strlen(expected2) || + result == SDL_strlen(expected3) || + result == SDL_strlen(expected4) || + result == SDL_strlen(expected5), + "Check result value, expected: %d, got: %d", (int)SDL_strlen(expected), result); + + if (sizeof(void *) >= 8) { + result = SDL_snprintf(text, sizeof(text), "%p", (void *)0x1ba07bddf60L); + expected = "0x1ba07bddf60"; + expected2 = "000001BA07BDDF60"; + expected3 = "000001ba07bddf60"; + SDLTest_AssertPass("Call to SDL_snprintf(text, sizeof(text), \"%%p\", 0x1ba07bddf60)"); + SDLTest_AssertCheck(SDL_strcmp(text, expected) == 0 || + SDL_strcmp(text, expected2) == 0 || + SDL_strcmp(text, expected3) == 0, + "Check text, expected: '%s', got: '%s'", expected, text); + SDLTest_AssertCheck(result == SDL_strlen(expected) || + result == SDL_strlen(expected2) || + result == SDL_strlen(expected3), + "Check result value, expected: %d, got: %d", (int)SDL_strlen(expected), result); + } return TEST_COMPLETED; } @@ -207,10 +274,10 @@ int stdlib_getsetenv(void *arg) text = SDL_getenv(name); SDLTest_AssertPass("Call to SDL_getenv('%s')", name); - if (text != NULL) { + if (text) { SDLTest_Log("Expected: NULL, Got: '%s' (%i)", text, (int)SDL_strlen(text)); } - } while (text != NULL); + } while (text); /* Create random values to set */ value1 = SDLTest_RandomAsciiStringOfSize(10); diff --git a/thirdparty/SDL/test/testautomation_subsystems.c b/thirdparty/SDL/test/testautomation_subsystems.c new file mode 100644 index 000000000..15b175359 --- /dev/null +++ b/thirdparty/SDL/test/testautomation_subsystems.c @@ -0,0 +1,239 @@ +/** + * Subsystem test suite + */ + +#include "SDL.h" +#include "SDL_test.h" + +/* ================= Test Case Implementation ================== */ + +/* Fixture */ + +static void subsystemsSetUp(void *arg) +{ + /* Reset each one of the SDL subsystems */ + /* CHECKME: can we use SDL_Quit here, or this will break the flow of tests? */ + SDL_Quit(); + /* Alternate variant without SDL_Quit: + while (SDL_WasInit(SDL_INIT_EVERYTHING) != 0) { + SDL_QuitSubSystem(SDL_INIT_EVERYTHING); + } + */ + SDLTest_AssertPass("Reset all subsystems before subsystems test"); + SDLTest_AssertCheck(SDL_WasInit(SDL_INIT_EVERYTHING) == 0, "Check result from SDL_WasInit(SDL_INIT_EVERYTHING)"); +} + +static void subsystemsTearDown(void *arg) +{ + /* Reset each one of the SDL subsystems */ + SDL_Quit(); + + SDLTest_AssertPass("Cleanup of subsystems test completed"); +} + +/* Test case functions */ + +/** + * \brief Inits and Quits particular subsystem, checking its Init status. + * + * \sa SDL_InitSubSystem + * \sa SDL_QuitSubSystem + * + */ +static int subsystems_referenceCount(void) +{ + const int system = SDL_INIT_VIDEO; + int result; + /* Ensure that we start with a non-initialized subsystem. */ + SDLTest_AssertCheck(SDL_WasInit(system) == 0, "Check result from SDL_WasInit(0x%x)", system); + + /* Init subsystem once, and quit once */ + SDL_InitSubSystem(system); + SDLTest_AssertPass("Call to SDL_InitSubSystem(0x%x)", system); + result = SDL_WasInit(system); + SDLTest_AssertCheck(result == system, "Check result from SDL_WasInit(0x%x), expected: 0x%x, got: 0x%x", system, system, result); + + SDL_QuitSubSystem(system); + SDLTest_AssertPass("Call to SDL_QuitSubSystem(0x%x)", system); + result = SDL_WasInit(system); + SDLTest_AssertCheck(result == 0, "Check result from SDL_WasInit(0x%x), expected: 0, got: 0x%x", system, result); + + /* Init subsystem number of times, then decrement reference count until it's disposed of. */ + SDL_InitSubSystem(system); + SDL_InitSubSystem(system); + SDL_InitSubSystem(system); + SDLTest_AssertPass("Call to SDL_InitSubSystem(0x%x) x3 times", system); + result = SDL_WasInit(system); + SDLTest_AssertCheck(result == system, "Check result from SDL_WasInit(0x%x), expected: 0x%x, got: 0x%x", system, system, result); + + SDL_QuitSubSystem(system); + SDLTest_AssertPass("Call to SDL_QuitSubSystem(0x%x) x1", system); + result = SDL_WasInit(system); + SDLTest_AssertCheck(result == system, "Check result from SDL_WasInit(0x%x), expected: 0x%x, got: 0x%x", system, system, result); + SDL_QuitSubSystem(system); + SDLTest_AssertPass("Call to SDL_QuitSubSystem(0x%x) x2", system); + result = SDL_WasInit(system); + SDLTest_AssertCheck(result == system, "Check result from SDL_WasInit(0x%x), expected: 0x%x, got: 0x%x", system, system, result); + SDL_QuitSubSystem(system); + SDLTest_AssertPass("Call to SDL_QuitSubSystem(0x%x) x3", system); + result = SDL_WasInit(system); + SDLTest_AssertCheck(result == 0, "Check result from SDL_WasInit(0x%x), expected: 0, got: 0x%x", system, result); + + return TEST_COMPLETED; +} + +/** + * \brief Inits and Quits subsystems that have another as dependency; + * check that the dependency is not removed before the last of its dependents. + * + * \sa SDL_InitSubSystem + * \sa SDL_QuitSubSystem + * + */ +static int subsystems_dependRefCountInitAllQuitByOne(void) +{ + int result; + /* Ensure that we start with reset subsystems. */ + SDLTest_AssertCheck(SDL_WasInit(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_JOYSTICK | SDL_INIT_EVENTS) == 0, + "Check result from SDL_WasInit(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_JOYSTICK | SDL_INIT_EVENTS)"); + + /* Following should init SDL_INIT_EVENTS and give it +3 ref counts. */ + SDL_InitSubSystem(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_JOYSTICK); + SDLTest_AssertPass("Call to SDL_InitSubSystem(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_JOYSTICK)"); + result = SDL_WasInit(SDL_INIT_EVENTS); + SDLTest_AssertCheck(result == SDL_INIT_EVENTS, "Check result from SDL_WasInit(SDL_INIT_EVENTS), expected: 0x4000, got: 0x%x", result); + + /* Quit systems one by one. */ + SDL_QuitSubSystem(SDL_INIT_VIDEO); + SDLTest_AssertPass("Call to SDL_QuitSubSystem(SDL_INIT_VIDEO)"); + result = SDL_WasInit(SDL_INIT_EVENTS); + SDLTest_AssertCheck(result == SDL_INIT_EVENTS, "Check result from SDL_WasInit(SDL_INIT_EVENTS), expected: 0x4000, got: 0x%x", result); + SDL_QuitSubSystem(SDL_INIT_AUDIO); + SDLTest_AssertPass("Call to SDL_QuitSubSystem(SDL_INIT_AUDIO)"); + result = SDL_WasInit(SDL_INIT_EVENTS); + SDLTest_AssertCheck(result == SDL_INIT_EVENTS, "Check result from SDL_WasInit(SDL_INIT_EVENTS), expected: 0x4000, got: 0x%x", result); + SDL_QuitSubSystem(SDL_INIT_JOYSTICK); + SDLTest_AssertPass("Call to SDL_QuitSubSystem(SDL_INIT_JOYSTICK)"); + result = SDL_WasInit(SDL_INIT_EVENTS); + SDLTest_AssertCheck(result == 0, "Check result from SDL_WasInit(SDL_INIT_EVENTS), expected: 0, got: 0x%x", result); + + return TEST_COMPLETED; +} + +/** + * \brief Inits and Quits subsystems that have another as dependency; + * check that the dependency is not removed before the last of its dependents. + * + * \sa SDL_InitSubSystem + * \sa SDL_QuitSubSystem + * + */ +static int subsystems_dependRefCountInitByOneQuitAll(void) +{ + int result; + /* Ensure that we start with reset subsystems. */ + SDLTest_AssertCheck(SDL_WasInit(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_JOYSTICK | SDL_INIT_EVENTS) == 0, + "Check result from SDL_WasInit(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_JOYSTICK | SDL_INIT_EVENTS)"); + + /* Following should init SDL_INIT_EVENTS and give it +3 ref counts. */ + SDL_InitSubSystem(SDL_INIT_VIDEO); + SDLTest_AssertPass("Call to SDL_InitSubSystem(SDL_INIT_VIDEO)"); + result = SDL_WasInit(SDL_INIT_EVENTS); + SDLTest_AssertCheck(result == SDL_INIT_EVENTS, "Check result from SDL_WasInit(SDL_INIT_EVENTS), expected: 0x4000, got: 0x%x", result); + SDL_InitSubSystem(SDL_INIT_AUDIO); + SDLTest_AssertPass("Call to SDL_InitSubSystem(SDL_INIT_AUDIO)"); + SDL_InitSubSystem(SDL_INIT_JOYSTICK); + SDLTest_AssertPass("Call to SDL_InitSubSystem(SDL_INIT_JOYSTICK)"); + + /* Quit systems all at once. */ + SDL_QuitSubSystem(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_JOYSTICK); + SDLTest_AssertPass("Call to SDL_QuitSubSystem(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_JOYSTICK)"); + result = SDL_WasInit(SDL_INIT_EVENTS); + SDLTest_AssertCheck(result == 0, "Check result from SDL_WasInit(SDL_INIT_EVENTS), expected: 0, got: 0x%x", result); + + return TEST_COMPLETED; +} + +/** + * \brief Inits and Quits subsystems that have another as dependency, + * but also inits that dependency explicitly, giving it extra ref count. + * Check that the dependency is not removed before the last reference is gone. + * + * \sa SDL_InitSubSystem + * \sa SDL_QuitSubSystem + * + */ +static int subsystems_dependRefCountWithExtraInit(void) +{ + int result; + /* Ensure that we start with reset subsystems. */ + SDLTest_AssertCheck(SDL_WasInit(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_JOYSTICK | SDL_INIT_EVENTS) == 0, + "Check result from SDL_WasInit(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_JOYSTICK | SDL_INIT_EVENTS)"); + + /* Init EVENTS explicitly, +1 ref count. */ + SDL_InitSubSystem(SDL_INIT_EVENTS); + SDLTest_AssertPass("Call to SDL_InitSubSystem(SDL_INIT_EVENTS)"); + result = SDL_WasInit(SDL_INIT_EVENTS); + SDLTest_AssertCheck(result == SDL_INIT_EVENTS, "Check result from SDL_WasInit(SDL_INIT_EVENTS), expected: 0x4000, got: 0x%x", result); + /* Following should init SDL_INIT_EVENTS and give it +3 ref counts. */ + SDL_InitSubSystem(SDL_INIT_VIDEO); + SDLTest_AssertPass("Call to SDL_InitSubSystem(SDL_INIT_VIDEO)"); + SDL_InitSubSystem(SDL_INIT_AUDIO); + SDLTest_AssertPass("Call to SDL_InitSubSystem(SDL_INIT_AUDIO)"); + SDL_InitSubSystem(SDL_INIT_JOYSTICK); + SDLTest_AssertPass("Call to SDL_InitSubSystem(SDL_INIT_JOYSTICK)"); + + /* Quit EVENTS explicitly, -1 ref count. */ + SDL_QuitSubSystem(SDL_INIT_EVENTS); + SDLTest_AssertPass("Call to SDL_QuitSubSystem(SDL_INIT_EVENTS)"); + result = SDL_WasInit(SDL_INIT_EVENTS); + SDLTest_AssertCheck(result == SDL_INIT_EVENTS, "Check result from SDL_WasInit(SDL_INIT_EVENTS), expected: 0x4000, got: 0x%x", result); + + /* Quit systems one by one. */ + SDL_QuitSubSystem(SDL_INIT_VIDEO); + SDLTest_AssertPass("Call to SDL_QuitSubSystem(SDL_INIT_VIDEO)"); + result = SDL_WasInit(SDL_INIT_EVENTS); + SDLTest_AssertCheck(result == SDL_INIT_EVENTS, "Check result from SDL_WasInit(SDL_INIT_EVENTS), expected: 0x4000, got: 0x%x", result); + SDL_QuitSubSystem(SDL_INIT_AUDIO); + SDLTest_AssertPass("Call to SDL_QuitSubSystem(SDL_INIT_AUDIO)"); + result = SDL_WasInit(SDL_INIT_EVENTS); + SDLTest_AssertCheck(result == SDL_INIT_EVENTS, "Check result from SDL_WasInit(SDL_INIT_EVENTS), expected: 0x4000, got: 0x%x", result); + SDL_QuitSubSystem(SDL_INIT_JOYSTICK); + SDLTest_AssertPass("Call to SDL_QuitSubSystem(SDL_INIT_JOYSTICK)"); + result = SDL_WasInit(SDL_INIT_EVENTS); + SDLTest_AssertCheck(result == 0, "Check result from SDL_WasInit(SDL_INIT_EVENTS), expected: 0, got: 0x%x", result); + + return TEST_COMPLETED; +} + +/* ================= Test References ================== */ + +/* Subsystems test cases */ +static const SDLTest_TestCaseReference subsystemsTest1 = { + (SDLTest_TestCaseFp)subsystems_referenceCount, "subsystems_referenceCount", "Makes sure that subsystem stays until number of quits matches inits.", TEST_ENABLED +}; + +static const SDLTest_TestCaseReference subsystemsTest2 = { + (SDLTest_TestCaseFp)subsystems_dependRefCountInitAllQuitByOne, "subsystems_dependRefCountInitAllQuitByOne", "Check reference count of subsystem dependencies.", TEST_ENABLED +}; + +static const SDLTest_TestCaseReference subsystemsTest3 = { + (SDLTest_TestCaseFp)subsystems_dependRefCountInitByOneQuitAll, "subsystems_dependRefCountInitByOneQuitAll", "Check reference count of subsystem dependencies.", TEST_ENABLED +}; + +static const SDLTest_TestCaseReference subsystemsTest4 = { + (SDLTest_TestCaseFp)subsystems_dependRefCountWithExtraInit, "subsystems_dependRefCountWithExtraInit", "Check reference count of subsystem dependencies.", TEST_ENABLED +}; + +/* Sequence of Events test cases */ +static const SDLTest_TestCaseReference *subsystemsTests[] = { + &subsystemsTest1, &subsystemsTest2, &subsystemsTest3, &subsystemsTest4, NULL +}; + +/* Events test suite (global) */ +SDLTest_TestSuiteReference subsystemsTestSuite = { + "Subsystems", + subsystemsSetUp, + subsystemsTests, + subsystemsTearDown +}; diff --git a/thirdparty/SDL/test/testautomation_suites.h b/thirdparty/SDL/test/testautomation_suites.h index 6fdcd8388..95528f271 100644 --- a/thirdparty/SDL/test/testautomation_suites.h +++ b/thirdparty/SDL/test/testautomation_suites.h @@ -16,6 +16,7 @@ extern SDLTest_TestSuiteReference guidTestSuite; extern SDLTest_TestSuiteReference hintsTestSuite; extern SDLTest_TestSuiteReference joystickTestSuite; extern SDLTest_TestSuiteReference keyboardTestSuite; +extern SDLTest_TestSuiteReference logTestSuite; extern SDLTest_TestSuiteReference mainTestSuite; extern SDLTest_TestSuiteReference mathTestSuite; extern SDLTest_TestSuiteReference mouseTestSuite; @@ -26,6 +27,7 @@ extern SDLTest_TestSuiteReference renderTestSuite; extern SDLTest_TestSuiteReference rwopsTestSuite; extern SDLTest_TestSuiteReference sdltestTestSuite; extern SDLTest_TestSuiteReference stdlibTestSuite; +extern SDLTest_TestSuiteReference subsystemsTestSuite; extern SDLTest_TestSuiteReference surfaceTestSuite; extern SDLTest_TestSuiteReference syswmTestSuite; extern SDLTest_TestSuiteReference timerTestSuite; @@ -40,6 +42,7 @@ SDLTest_TestSuiteReference *testSuites[] = { &hintsTestSuite, &joystickTestSuite, &keyboardTestSuite, + &logTestSuite, &mainTestSuite, &mathTestSuite, &mouseTestSuite, @@ -54,6 +57,7 @@ SDLTest_TestSuiteReference *testSuites[] = { &syswmTestSuite, &timerTestSuite, &videoTestSuite, + &subsystemsTestSuite, /* run last, not interfere with other test enviroment */ NULL }; diff --git a/thirdparty/SDL/test/testautomation_surface.c b/thirdparty/SDL/test/testautomation_surface.c index 41aa24142..575ebcfb4 100644 --- a/thirdparty/SDL/test/testautomation_surface.c +++ b/thirdparty/SDL/test/testautomation_surface.c @@ -81,7 +81,7 @@ void _surfaceTearDown(void *arg) /** * Helper that clears the test surface */ -void _clearTestSurface() +void _clearTestSurface(void) { int ret; Uint32 color; @@ -346,7 +346,9 @@ int surface_testCompleteSurfaceConversion(void *arg) SDL_PIXELFORMAT_RGBA8888, SDL_PIXELFORMAT_ABGR8888, SDL_PIXELFORMAT_BGRA8888, +#if 0 /* We aren't testing HDR10 colorspace conversion */ SDL_PIXELFORMAT_ARGB2101010, +#endif }; SDL_Surface *face = NULL, *cvt1, *cvt2, *final; SDL_PixelFormat *fmt1, *fmt2; @@ -668,6 +670,34 @@ int surface_testOverflow(void *arg) surface != NULL ? "(success)" : SDL_GetError()); SDL_FreeSurface(surface); + /* SDL_PIXELFORMAT_INDEX2* needs 1 byte per 4 pixels. */ + surface = SDL_CreateRGBSurfaceWithFormatFrom(buf, 12, 1, 2, 3, SDL_PIXELFORMAT_INDEX2LSB); + SDLTest_AssertCheck(surface != NULL, "12px * 2 bits per px fits in 3 bytes: %s", + surface != NULL ? "(success)" : SDL_GetError()); + SDL_FreeSurface(surface); + surface = SDL_CreateRGBSurfaceFrom(buf, 12, 1, 2, 3, 0, 0, 0, 0); + SDLTest_AssertCheck(surface != NULL, "12px * 2 bits per px fits in 3 bytes: %s", + surface != NULL ? "(success)" : SDL_GetError()); + SDL_FreeSurface(surface); + + surface = SDL_CreateRGBSurfaceWithFormatFrom(buf, 13, 1, 2, 3, SDL_PIXELFORMAT_INDEX2LSB); + SDLTest_AssertCheck(surface == NULL, "Should detect pitch < width * bpp (%d)", surface ? surface->pitch : 0); + SDLTest_AssertCheck(SDL_strcmp(SDL_GetError(), expectedError) == 0, + "Expected \"%s\", got \"%s\"", expectedError, SDL_GetError()); + surface = SDL_CreateRGBSurfaceFrom(buf, 13, 1, 2, 3, 0, 0, 0, 0); + SDLTest_AssertCheck(surface == NULL, "Should detect pitch < width * bpp"); + SDLTest_AssertCheck(SDL_strcmp(SDL_GetError(), expectedError) == 0, + "Expected \"%s\", got \"%s\"", expectedError, SDL_GetError()); + + surface = SDL_CreateRGBSurfaceWithFormatFrom(buf, 13, 1, 2, 4, SDL_PIXELFORMAT_INDEX2LSB); + SDLTest_AssertCheck(surface != NULL, "13px * 2 bits per px fits in 4 bytes: %s", + surface != NULL ? "(success)" : SDL_GetError()); + SDL_FreeSurface(surface); + surface = SDL_CreateRGBSurfaceFrom(buf, 13, 1, 2, 4, 0, 0, 0, 0); + SDLTest_AssertCheck(surface != NULL, "13px * 2 bits per px fits in 4 bytes: %s", + surface != NULL ? "(success)" : SDL_GetError()); + SDL_FreeSurface(surface); + /* SDL_PIXELFORMAT_INDEX1* needs 1 byte per 8 pixels. */ surface = SDL_CreateRGBSurfaceWithFormatFrom(buf, 16, 1, 1, 2, SDL_PIXELFORMAT_INDEX1LSB); SDLTest_AssertCheck(surface != NULL, "16px * 1 bit per px fits in 2 bytes: %s", @@ -737,19 +767,26 @@ int surface_testOverflow(void *arg) "Expected \"%s\", got \"%s\"", expectedError, SDL_GetError()); if (sizeof(size_t) == 4 && sizeof(int) >= 4) { + SDL_ClearError(); expectedError = "Out of memory"; - surface = SDL_CreateRGBSurfaceWithFormat(0, SDL_MAX_SINT32, 1, 8, SDL_PIXELFORMAT_INDEX8); + /* 0x5555'5555 * 3bpp = 0xffff'ffff which fits in size_t, but adding + * alignment padding makes it overflow */ + surface = SDL_CreateRGBSurfaceWithFormat(0, 0x55555555, 1, 24, SDL_PIXELFORMAT_RGB24); SDLTest_AssertCheck(surface == NULL, "Should detect overflow in width + alignment"); SDLTest_AssertCheck(SDL_strcmp(SDL_GetError(), expectedError) == 0, "Expected \"%s\", got \"%s\"", expectedError, SDL_GetError()); - surface = SDL_CreateRGBSurfaceWithFormat(0, SDL_MAX_SINT32 / 2, 1, 32, SDL_PIXELFORMAT_ARGB8888); + SDL_ClearError(); + /* 0x4000'0000 * 4bpp = 0x1'0000'0000 which (just) overflows */ + surface = SDL_CreateRGBSurfaceWithFormat(0, 0x40000000, 1, 32, SDL_PIXELFORMAT_ARGB8888); SDLTest_AssertCheck(surface == NULL, "Should detect overflow in width * bytes per pixel"); SDLTest_AssertCheck(SDL_strcmp(SDL_GetError(), expectedError) == 0, "Expected \"%s\", got \"%s\"", expectedError, SDL_GetError()); + SDL_ClearError(); surface = SDL_CreateRGBSurfaceWithFormat(0, (1 << 29) - 1, (1 << 29) - 1, 8, SDL_PIXELFORMAT_INDEX8); SDLTest_AssertCheck(surface == NULL, "Should detect overflow in width * height"); SDLTest_AssertCheck(SDL_strcmp(SDL_GetError(), expectedError) == 0, "Expected \"%s\", got \"%s\"", expectedError, SDL_GetError()); + SDL_ClearError(); surface = SDL_CreateRGBSurfaceWithFormat(0, (1 << 15) + 1, (1 << 15) + 1, 32, SDL_PIXELFORMAT_ARGB8888); SDLTest_AssertCheck(surface == NULL, "Should detect overflow in width * height * bytes per pixel"); SDLTest_AssertCheck(SDL_strcmp(SDL_GetError(), expectedError) == 0, diff --git a/thirdparty/SDL/test/testautomation_timer.c b/thirdparty/SDL/test/testautomation_timer.c index 1002a36eb..a7160e76c 100644 --- a/thirdparty/SDL/test/testautomation_timer.c +++ b/thirdparty/SDL/test/testautomation_timer.c @@ -94,7 +94,10 @@ int timer_delayAndGetTicks(void *arg) SDLTest_AssertCheck(result2 > 0, "Check result value, expected: >0, got: %" SDL_PRIu32, result2); difference = result2 - result; SDLTest_AssertCheck(difference > (testDelay - marginOfError), "Check difference, expected: >%" SDL_PRIu32 ", got: %" SDL_PRIu32, testDelay - marginOfError, difference); +#if 0 + /* Disabled because this might fail on non-interactive systems. Moved to testtimer. */ SDLTest_AssertCheck(difference < (testDelay + marginOfError), "Check difference, expected: <%" SDL_PRIu32 ", got: %" SDL_PRIu32, testDelay + marginOfError, difference); +#endif return TEST_COMPLETED; } diff --git a/thirdparty/SDL/test/testautomation_video.c b/thirdparty/SDL/test/testautomation_video.c index aa9e7b92b..bf24bbb08 100644 --- a/thirdparty/SDL/test/testautomation_video.c +++ b/thirdparty/SDL/test/testautomation_video.c @@ -28,6 +28,7 @@ SDL_Window *_createVideoSuiteTestWindow(const char *title) SDL_Window *window; int x, y, w, h; SDL_WindowFlags flags; + SDL_bool needs_renderer = SDL_FALSE; /* Standard window */ x = SDLTest_RandomIntegerInRange(1, 100); @@ -40,6 +41,35 @@ SDL_Window *_createVideoSuiteTestWindow(const char *title) SDLTest_AssertPass("Call to SDL_CreateWindow('Title',%d,%d,%d,%d,%d)", x, y, w, h, flags); SDLTest_AssertCheck(window != NULL, "Validate that returned window struct is not NULL"); + /* Wayland and XWayland windows require that a frame be presented before they are fully mapped and visible onscreen. + * This is required for the mouse/keyboard grab tests to pass. + */ + if (SDL_strcmp(SDL_GetCurrentVideoDriver(), "wayland") == 0) { + needs_renderer = SDL_TRUE; + } else if (SDL_strcmp(SDL_GetCurrentVideoDriver(), "x11") == 0) { + /* Try to detect if the x11 driver is running under XWayland */ + const char *session_type = SDL_getenv("XDG_SESSION_TYPE"); + if (session_type && SDL_strcasecmp(session_type, "wayland") == 0) { + needs_renderer = SDL_TRUE; + } + } + + if (needs_renderer) { + SDL_Renderer *renderer = SDL_CreateRenderer(window, -1, 0); + if (renderer) { + SDL_SetRenderDrawColor(renderer, 0x00, 0x00, 0x00, 0xFF); + SDL_RenderClear(renderer); + SDL_RenderPresent(renderer); + + /* Some desktops don't display the window immediately after presentation, + * so delay to give the window time to actually appear on the desktop. + */ + SDL_Delay(100); + } else { + SDLTest_Log("Unable to create a renderer, some tests may fail on Wayland/XWayland"); + } + } + return window; } @@ -48,7 +78,7 @@ SDL_Window *_createVideoSuiteTestWindow(const char *title) */ void _destroyVideoSuiteTestWindow(SDL_Window *window) { - if (window != NULL) { + if (window) { SDL_DestroyWindow(window); window = NULL; SDLTest_AssertPass("Call to SDL_DestroyWindow()"); @@ -278,6 +308,8 @@ int video_createWindowVariousFlags(void *arg) break; case 2: flags = SDL_WINDOW_OPENGL; + /* Skip - not every video driver supports OpenGL; comment out next line to run test */ + continue; break; case 3: flags = SDL_WINDOW_SHOWN; @@ -576,7 +608,7 @@ int video_getWindowDisplayMode(void *arg) /* Call against new test window */ window = _createVideoSuiteTestWindow(title); - if (window != NULL) { + if (window) { result = SDL_GetWindowDisplayMode(window, &mode); SDLTest_AssertPass("Call to SDL_GetWindowDisplayMode()"); SDLTest_AssertCheck(result == 0, "Validate result value; expected: 0, got: %d", result); @@ -592,7 +624,7 @@ int video_getWindowDisplayMode(void *arg) } /* Helper function that checks for an 'Invalid window' error */ -void _checkInvalidWindowError() +void _checkInvalidWindowError(void) { const char *invalidWindowError = "Invalid window"; char *lastError; @@ -670,7 +702,7 @@ video_getWindowGammaRamp(void *arg) /* Call against new test window */ window = _createVideoSuiteTestWindow(title); - if (window == NULL) return TEST_ABORTED; + if (!window) return TEST_ABORTED; /* Retrieve no channel */ result = SDL_GetWindowGammaRamp(window, NULL, NULL, NULL); @@ -820,13 +852,33 @@ int video_getSetWindowGrab(void *arg) const char *title = "video_getSetWindowGrab Test Window"; SDL_Window *window; SDL_bool originalMouseState, originalKeyboardState; + SDL_bool hasFocusGained = SDL_FALSE; /* Call against new test window */ window = _createVideoSuiteTestWindow(title); - if (window == NULL) { + if (!window) { return TEST_ABORTED; } + /* Need to raise the window to have and SDL_EVENT_WINDOW_FOCUS_GAINED, + * so that the window gets the flags SDL_WINDOW_INPUT_FOCUS, + * so that it can be "grabbed" */ + SDL_RaiseWindow(window); + + { + SDL_Event evt; + SDL_zero(evt); + while (SDL_PollEvent(&evt)) { + if (evt.type == SDL_WINDOWEVENT) { + if (evt.window.event == SDL_WINDOWEVENT_FOCUS_GAINED) { + hasFocusGained = SDL_TRUE; + } + } + } + } + + SDLTest_AssertCheck(hasFocusGained == SDL_TRUE, "Expected window with focus"); + /* Get state */ originalMouseState = SDL_GetWindowMouseGrab(window); SDLTest_AssertPass("Call to SDL_GetWindowMouseGrab()"); @@ -967,7 +1019,7 @@ int video_getWindowId(void *arg) /* Call against new test window */ window = _createVideoSuiteTestWindow(title); - if (window == NULL) { + if (!window) { return TEST_ABORTED; } @@ -1022,7 +1074,7 @@ int video_getWindowPixelFormat(void *arg) /* Call against new test window */ window = _createVideoSuiteTestWindow(title); - if (window == NULL) { + if (!window) { return TEST_ABORTED; } @@ -1085,28 +1137,58 @@ int video_getSetWindowPosition(void *arg) { const char *title = "video_getSetWindowPosition Test Window"; SDL_Window *window; + int maxxVariation, maxyVariation; int xVariation, yVariation; int referenceX, referenceY; int currentX, currentY; int desiredX, desiredY; + SDL_Rect display_bounds; + + if (SDL_strcmp(SDL_GetCurrentVideoDriver(), "wayland") == 0) { + SDLTest_Log("Skipping test: wayland does not support window positioning"); + return TEST_SKIPPED; + } /* Call against new test window */ window = _createVideoSuiteTestWindow(title); - if (window == NULL) { + if (!window) { return TEST_ABORTED; } - for (xVariation = 0; xVariation < 4; xVariation++) { - for (yVariation = 0; yVariation < 4; yVariation++) { + if (SDL_strcmp(SDL_GetCurrentVideoDriver(), "x11") == 0) { + /* The X11 server allows arbitrary window placement, but compositing + * window managers such as GNOME and KDE force windows to be within + * desktop bounds. + */ + maxxVariation = 2; + maxyVariation = 2; + + SDL_GetDisplayUsableBounds(SDL_GetWindowDisplayIndex(window), &display_bounds); + } else if (SDL_strcmp(SDL_GetCurrentVideoDriver(), "cocoa") == 0) { + /* Platform doesn't allow windows with negative Y desktop bounds */ + maxxVariation = 4; + maxyVariation = 3; + + SDL_GetDisplayUsableBounds(SDL_GetWindowDisplayIndex(window), &display_bounds); + } else { + /* Platform allows windows to be placed out of bounds */ + maxxVariation = 4; + maxyVariation = 4; + + SDL_GetDisplayBounds(SDL_GetWindowDisplayIndex(window), &display_bounds); + } + + for (xVariation = 0; xVariation < maxxVariation; xVariation++) { + for (yVariation = 0; yVariation < maxyVariation; yVariation++) { switch (xVariation) { default: case 0: /* Zero X Position */ - desiredX = 0; + desiredX = display_bounds.x > 0 ? display_bounds.x : 0; break; case 1: /* Random X position inside screen */ - desiredX = SDLTest_RandomIntegerInRange(1, 100); + desiredX = SDLTest_RandomIntegerInRange(display_bounds.x + 1, display_bounds.x + 100); break; case 2: /* Random X position outside screen (positive) */ @@ -1121,15 +1203,15 @@ int video_getSetWindowPosition(void *arg) switch (yVariation) { default: case 0: - /* Zero X Position */ - desiredY = 0; + /* Zero Y Position */ + desiredY = display_bounds.y > 0 ? display_bounds.y : 0; break; case 1: - /* Random X position inside screen */ - desiredY = SDLTest_RandomIntegerInRange(1, 100); + /* Random Y position inside screen */ + desiredY = SDLTest_RandomIntegerInRange(display_bounds.y + 1, display_bounds.y + 100); break; case 2: - /* Random X position outside screen (positive) */ + /* Random Y position outside screen (positive) */ desiredY = SDLTest_RandomIntegerInRange(10000, 11000); break; case 3: @@ -1218,7 +1300,7 @@ int video_getSetWindowPosition(void *arg) } /* Helper function that checks for an 'Invalid parameter' error */ -void _checkInvalidParameterError() +void _checkInvalidParameterError(void) { const char *invalidParameterError = "Parameter"; char *lastError; @@ -1255,7 +1337,7 @@ int video_getSetWindowSize(void *arg) int desiredW, desiredH; /* Get display bounds for size range */ - result = SDL_GetDisplayBounds(0, &display); + result = SDL_GetDisplayUsableBounds(0, &display); SDLTest_AssertPass("SDL_GetDisplayBounds()"); SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result); if (result != 0) { @@ -1264,19 +1346,20 @@ int video_getSetWindowSize(void *arg) /* Call against new test window */ window = _createVideoSuiteTestWindow(title); - if (window == NULL) { + if (!window) { return TEST_ABORTED; } -#ifdef __WIN32__ - /* Platform clips window size to screen size */ - maxwVariation = 4; - maxhVariation = 4; -#else - /* Platform allows window size >= screen size */ - maxwVariation = 5; - maxhVariation = 5; -#endif + if (SDL_strcmp(SDL_GetCurrentVideoDriver(), "windows") == 0 || + SDL_strcmp(SDL_GetCurrentVideoDriver(), "x11") == 0) { + /* Platform clips window size to screen size */ + maxwVariation = 4; + maxhVariation = 4; + } else { + /* Platform allows window size >= screen size */ + maxwVariation = 5; + maxhVariation = 5; + } for (wVariation = 0; wVariation < maxwVariation; wVariation++) { for (hVariation = 0; hVariation < maxhVariation; hVariation++) { @@ -1355,7 +1438,6 @@ int video_getSetWindowSize(void *arg) } } - /* Get just width */ currentW = desiredW + 1; SDL_GetWindowSize(window, ¤tW, NULL); @@ -1447,7 +1529,7 @@ int video_getSetWindowMinimumSize(void *arg) /* Call against new test window */ window = _createVideoSuiteTestWindow(title); - if (window == NULL) { + if (!window) { return TEST_ABORTED; } @@ -1589,7 +1671,7 @@ int video_getSetWindowMaximumSize(void *arg) /* Call against new test window */ window = _createVideoSuiteTestWindow(title); - if (window == NULL) { + if (!window) { return TEST_ABORTED; } @@ -1727,30 +1809,30 @@ int video_getSetWindowData(void *arg) /* Call against new test window */ window = _createVideoSuiteTestWindow(title); - if (window == NULL) { + if (!window) { return TEST_ABORTED; } /* Create testdata */ datasize = SDLTest_RandomIntegerInRange(1, 32); referenceUserdata = SDLTest_RandomAsciiStringOfSize(datasize); - if (referenceUserdata == NULL) { + if (!referenceUserdata) { returnValue = TEST_ABORTED; goto cleanup; } userdata = SDL_strdup(referenceUserdata); - if (userdata == NULL) { + if (!userdata) { returnValue = TEST_ABORTED; goto cleanup; } datasize = SDLTest_RandomIntegerInRange(1, 32); referenceUserdata2 = SDLTest_RandomAsciiStringOfSize(datasize); - if (referenceUserdata2 == NULL) { + if (!referenceUserdata2) { returnValue = TEST_ABORTED; goto cleanup; } userdata2 = SDL_strdup(referenceUserdata2); - if (userdata2 == NULL) { + if (!userdata2) { returnValue = TEST_ABORTED; goto cleanup; } @@ -1935,6 +2017,11 @@ int video_setWindowCenteredOnDisplay(void *arg) SDL_Rect display0, display1; displayNum = SDL_GetNumVideoDisplays(); + SDLTest_AssertPass("SDL_GetNumVideoDisplays()"); + SDLTest_AssertCheck(displayNum >= 1, "Validate result (current: %d, expected >= 1)", displayNum); + if (displayNum <= 0) { + return TEST_ABORTED; + } /* Get display bounds */ result = SDL_GetDisplayBounds(0 % displayNum, &display0); @@ -1959,6 +2046,7 @@ int video_setWindowCenteredOnDisplay(void *arg) int currentDisplay; int expectedDisplay; SDL_Rect expectedDisplayRect; + SDL_bool video_driver_is_wayland = SDL_strcmp(SDL_GetCurrentVideoDriver(), "wayland") == 0; /* xVariation is the display we start on */ expectedDisplay = xVariation % displayNum; @@ -1970,20 +2058,46 @@ int video_setWindowCenteredOnDisplay(void *arg) expectedX = (expectedDisplayRect.x + ((expectedDisplayRect.w - w) / 2)); expectedY = (expectedDisplayRect.y + ((expectedDisplayRect.h - h) / 2)); - window = SDL_CreateWindow(title, x, y, w, h, SDL_WINDOW_SHOWN | SDL_WINDOW_ALLOW_HIGHDPI); + window = SDL_CreateWindow(title, x, y, w, h, SDL_WINDOW_SHOWN | SDL_WINDOW_ALLOW_HIGHDPI | SDL_WINDOW_BORDERLESS); SDLTest_AssertPass("Call to SDL_CreateWindow('Title',%d,%d,%d,%d,SHOWN)", x, y, w, h); SDLTest_AssertCheck(window != NULL, "Validate that returned window struct is not NULL"); + /* Wayland windows require that a frame be presented before they are fully mapped and visible onscreen. */ + if (video_driver_is_wayland) { + SDL_Renderer *renderer = SDL_CreateRenderer(window, -1, 0); + + if (renderer) { + SDL_SetRenderDrawColor(renderer, 0x00, 0x00, 0x00, 0xFF); + SDL_RenderClear(renderer); + SDL_RenderPresent(renderer); + + /* Some desktops don't display the window immediately after presentation, + * so delay to give the window time to actually appear on the desktop. + */ + SDL_Delay(100); + } else { + SDLTest_Log("Unable to create a renderer, tests may fail under Wayland"); + } + } + /* Check the window is centered on the requested display */ currentDisplay = SDL_GetWindowDisplayIndex(window); SDL_GetWindowSize(window, ¤tW, ¤tH); SDL_GetWindowPosition(window, ¤tX, ¤tY); - SDLTest_AssertCheck(currentDisplay == expectedDisplay, "Validate display index (current: %d, expected: %d)", currentDisplay, expectedDisplay); + if (!video_driver_is_wayland) { + SDLTest_AssertCheck(currentDisplay == expectedDisplay, "Validate display index (current: %d, expected: %d)", currentDisplay, expectedDisplay); + } else { + SDLTest_Log("Skipping display index validation: Wayland driver does not support window positioning"); + } SDLTest_AssertCheck(currentW == w, "Validate width (current: %d, expected: %d)", currentW, w); SDLTest_AssertCheck(currentH == h, "Validate height (current: %d, expected: %d)", currentH, h); - SDLTest_AssertCheck(currentX == expectedX, "Validate x (current: %d, expected: %d)", currentX, expectedX); - SDLTest_AssertCheck(currentY == expectedY, "Validate y (current: %d, expected: %d)", currentY, expectedY); + if (!video_driver_is_wayland) { + SDLTest_AssertCheck(currentX == expectedX, "Validate x (current: %d, expected: %d)", currentX, expectedX); + SDLTest_AssertCheck(currentY == expectedY, "Validate y (current: %d, expected: %d)", currentY, expectedY); + } else { + SDLTest_Log("Skipping window position validation: Wayland driver does not support window positioning"); + } /* Enter fullscreen desktop */ result = SDL_SetWindowFullscreen(window, SDL_WINDOW_FULLSCREEN_DESKTOP); @@ -1994,11 +2108,19 @@ int video_setWindowCenteredOnDisplay(void *arg) SDL_GetWindowSize(window, ¤tW, ¤tH); SDL_GetWindowPosition(window, ¤tX, ¤tY); - SDLTest_AssertCheck(currentDisplay == expectedDisplay, "Validate display index (current: %d, expected: %d)", currentDisplay, expectedDisplay); + if (!video_driver_is_wayland) { + SDLTest_AssertCheck(currentDisplay == expectedDisplay, "Validate display index (current: %d, expected: %d)", currentDisplay, expectedDisplay); + } else { + SDLTest_Log("Skipping display index validation: Wayland driver does not support window positioning"); + } SDLTest_AssertCheck(currentW == expectedDisplayRect.w, "Validate width (current: %d, expected: %d)", currentW, expectedDisplayRect.w); SDLTest_AssertCheck(currentH == expectedDisplayRect.h, "Validate height (current: %d, expected: %d)", currentH, expectedDisplayRect.h); - SDLTest_AssertCheck(currentX == expectedDisplayRect.x, "Validate x (current: %d, expected: %d)", currentX, expectedDisplayRect.x); - SDLTest_AssertCheck(currentY == expectedDisplayRect.y, "Validate y (current: %d, expected: %d)", currentY, expectedDisplayRect.y); + if (!video_driver_is_wayland) { + SDLTest_AssertCheck(currentX == expectedDisplayRect.x, "Validate x (current: %d, expected: %d)", currentX, expectedDisplayRect.x); + SDLTest_AssertCheck(currentY == expectedDisplayRect.y, "Validate y (current: %d, expected: %d)", currentY, expectedDisplayRect.y); + } else { + SDLTest_Log("Skipping window position validation: Wayland driver does not support window positioning"); + } /* Leave fullscreen desktop */ result = SDL_SetWindowFullscreen(window, 0); @@ -2009,11 +2131,19 @@ int video_setWindowCenteredOnDisplay(void *arg) SDL_GetWindowSize(window, ¤tW, ¤tH); SDL_GetWindowPosition(window, ¤tX, ¤tY); - SDLTest_AssertCheck(currentDisplay == expectedDisplay, "Validate display index (current: %d, expected: %d)", currentDisplay, expectedDisplay); + if (!video_driver_is_wayland) { + SDLTest_AssertCheck(currentDisplay == expectedDisplay, "Validate display index (current: %d, expected: %d)", currentDisplay, expectedDisplay); + } else { + SDLTest_Log("Skipping display index validation: Wayland driver does not support window positioning"); + } SDLTest_AssertCheck(currentW == w, "Validate width (current: %d, expected: %d)", currentW, w); SDLTest_AssertCheck(currentH == h, "Validate height (current: %d, expected: %d)", currentH, h); - SDLTest_AssertCheck(currentX == expectedX, "Validate x (current: %d, expected: %d)", currentX, expectedX); - SDLTest_AssertCheck(currentY == expectedY, "Validate y (current: %d, expected: %d)", currentY, expectedY); + if (!video_driver_is_wayland) { + SDLTest_AssertCheck(currentX == expectedX, "Validate x (current: %d, expected: %d)", currentX, expectedX); + SDLTest_AssertCheck(currentY == expectedY, "Validate y (current: %d, expected: %d)", currentY, expectedY); + } else { + SDLTest_Log("Skipping window position validation: Wayland driver does not support window positioning"); + } /* Center on display yVariation, and check window properties */ @@ -2029,11 +2159,19 @@ int video_setWindowCenteredOnDisplay(void *arg) SDL_GetWindowSize(window, ¤tW, ¤tH); SDL_GetWindowPosition(window, ¤tX, ¤tY); - SDLTest_AssertCheck(currentDisplay == expectedDisplay, "Validate display index (current: %d, expected: %d)", currentDisplay, expectedDisplay); + if (!video_driver_is_wayland) { + SDLTest_AssertCheck(currentDisplay == expectedDisplay, "Validate display index (current: %d, expected: %d)", currentDisplay, expectedDisplay); + } else { + SDLTest_Log("Skipping display index validation: Wayland driver does not support window positioning"); + } SDLTest_AssertCheck(currentW == w, "Validate width (current: %d, expected: %d)", currentW, w); SDLTest_AssertCheck(currentH == h, "Validate height (current: %d, expected: %d)", currentH, h); - SDLTest_AssertCheck(currentX == expectedX, "Validate x (current: %d, expected: %d)", currentX, expectedX); - SDLTest_AssertCheck(currentY == expectedY, "Validate y (current: %d, expected: %d)", currentY, expectedY); + if (!video_driver_is_wayland) { + SDLTest_AssertCheck(currentX == expectedX, "Validate x (current: %d, expected: %d)", currentX, expectedX); + SDLTest_AssertCheck(currentY == expectedY, "Validate y (current: %d, expected: %d)", currentY, expectedY); + } else { + SDLTest_Log("Skipping window position validation: Wayland driver does not support window positioning"); + } /* Clean up */ _destroyVideoSuiteTestWindow(window); @@ -2043,6 +2181,76 @@ int video_setWindowCenteredOnDisplay(void *arg) return TEST_COMPLETED; } +/** + * Tests window surface functionality + */ +static int video_getWindowSurface(void *arg) +{ + const char *title = "video_getWindowSurface Test Window"; + SDL_Window *window; + SDL_Surface *surface; + SDL_Renderer *renderer; + Uint32 renderer_flags = SDL_RENDERER_ACCELERATED; + int result; + + if (SDL_strcmp(SDL_GetCurrentVideoDriver(), "dummy") == 0) { + renderer_flags = SDL_RENDERER_SOFTWARE; + } + + /* Make sure we're testing interaction with an accelerated renderer */ + SDL_SetHint(SDL_HINT_FRAMEBUFFER_ACCELERATION, "1"); + + window = SDL_CreateWindow(title, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 320, 320, 0); + SDLTest_AssertPass("Call to SDL_CreateWindow('%s', SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 320, 320, 0)", title); + SDLTest_AssertCheck(window != NULL, "Validate that returned window is not NULL"); + + surface = SDL_GetWindowSurface(window); + SDLTest_AssertPass("Call to SDL_GetWindowSurface(window)"); + SDLTest_AssertCheck(surface != NULL, "Validate that returned surface is not NULL"); + SDLTest_AssertCheck(SDL_HasWindowSurface(window), "Validate that window has a surface"); + + result = SDL_UpdateWindowSurface(window); + SDLTest_AssertPass("Call to SDL_UpdateWindowSurface(window)"); + SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result); + + /* We shouldn't be able to create a renderer on a window with a surface */ + renderer = SDL_CreateRenderer(window, -1, renderer_flags); + SDLTest_AssertPass("Call to SDL_CreateRenderer(window)"); + SDLTest_AssertCheck(renderer == NULL, "Validate that returned renderer is NULL"); + + result = SDL_DestroyWindowSurface(window); + SDLTest_AssertPass("Call to SDL_DestroyWindowSurface(window)"); + SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result); + SDLTest_AssertCheck(!SDL_HasWindowSurface(window), "Validate that window does not have a surface"); + + /* We should be able to create a renderer on the window now */ + renderer = SDL_CreateRenderer(window, -1, renderer_flags); + SDLTest_AssertPass("Call to SDL_CreateRenderer(window)"); + SDLTest_AssertCheck(renderer != NULL, "Validate that returned renderer is not NULL"); + + /* We should not be able to create a window surface now, unless it was created by the renderer */ + if (!SDL_HasWindowSurface(window)) { + surface = SDL_GetWindowSurface(window); + SDLTest_AssertPass("Call to SDL_GetWindowSurface(window)"); + SDLTest_AssertCheck(surface == NULL, "Validate that returned surface is NULL"); + } + + SDL_DestroyRenderer(renderer); + SDLTest_AssertPass("Call to SDL_DestroyRenderer(renderer)"); + SDLTest_AssertCheck(!SDL_HasWindowSurface(window), "Validate that window does not have a surface"); + + /* We should be able to create a window surface again */ + surface = SDL_GetWindowSurface(window); + SDLTest_AssertPass("Call to SDL_GetWindowSurface(window)"); + SDLTest_AssertCheck(surface != NULL, "Validate that returned surface is not NULL"); + SDLTest_AssertCheck(SDL_HasWindowSurface(window), "Validate that window has a surface"); + + /* Clean up */ + SDL_DestroyWindow(window); + + return TEST_COMPLETED; +} + /* ================= Test References ================== */ /* Video test cases */ @@ -2127,13 +2335,17 @@ static const SDLTest_TestCaseReference videoTest23 = static const SDLTest_TestCaseReference videoTest24 = { (SDLTest_TestCaseFp) video_setWindowCenteredOnDisplay, "video_setWindowCenteredOnDisplay", "Checks using SDL_WINDOWPOS_CENTERED_DISPLAY centers the window on a display", TEST_ENABLED }; +static const SDLTest_TestCaseReference videoTest25 = { + (SDLTest_TestCaseFp)video_getWindowSurface, "video_getWindowSurface", "Checks window surface functionality", TEST_ENABLED +}; + /* Sequence of Video test cases */ static const SDLTest_TestCaseReference *videoTests[] = { &videoTest1, &videoTest2, &videoTest3, &videoTest4, &videoTest5, &videoTest6, &videoTest7, &videoTest8, &videoTest9, &videoTest10, &videoTest11, &videoTest12, &videoTest13, &videoTest14, &videoTest15, &videoTest16, &videoTest17, &videoTest18, &videoTest19, &videoTest20, &videoTest21, &videoTest22, - &videoTest23, &videoTest24, NULL + &videoTest23, &videoTest24, &videoTest25, NULL }; /* Video test suite (global) */ diff --git a/thirdparty/SDL/test/testbounds.c b/thirdparty/SDL/test/testbounds.c index 42213f546..9bd73ac96 100644 --- a/thirdparty/SDL/test/testbounds.c +++ b/thirdparty/SDL/test/testbounds.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/test/testcustomcursor.c b/thirdparty/SDL/test/testcustomcursor.c index dc1c3718c..985f20fbe 100644 --- a/thirdparty/SDL/test/testcustomcursor.c +++ b/thirdparty/SDL/test/testcustomcursor.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -148,7 +148,7 @@ quit(int rc) exit(rc); } -void loop() +void loop(void) { int i; SDL_Event event; @@ -242,7 +242,7 @@ int main(int argc, char *argv[]) /* Initialize test framework */ state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO); - if (state == NULL) { + if (!state) { return 1; } for (i = 1; i < argc;) { diff --git a/thirdparty/SDL/test/testdisplayinfo.c b/thirdparty/SDL/test/testdisplayinfo.c index 66cc5d875..9740ab174 100644 --- a/thirdparty/SDL/test/testdisplayinfo.c +++ b/thirdparty/SDL/test/testdisplayinfo.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ static void print_mode(const char *prefix, const SDL_DisplayMode *mode) { - if (mode == NULL) { + if (!mode) { return; } diff --git a/thirdparty/SDL/test/testdraw2.c b/thirdparty/SDL/test/testdraw2.c index f660c2845..26053d56b 100644 --- a/thirdparty/SDL/test/testdraw2.c +++ b/thirdparty/SDL/test/testdraw2.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -174,7 +174,7 @@ void DrawRects(SDL_Renderer *renderer) } } -void loop() +void loop(void) { Uint32 now; int i; @@ -227,7 +227,7 @@ int main(int argc, char *argv[]) /* Initialize test framework */ state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO); - if (state == NULL) { + if (!state) { return 1; } for (i = 1; i < argc;) { diff --git a/thirdparty/SDL/test/testdrawchessboard.c b/thirdparty/SDL/test/testdrawchessboard.c index 8ff21a4c4..6f0362fdb 100644 --- a/thirdparty/SDL/test/testdrawchessboard.c +++ b/thirdparty/SDL/test/testdrawchessboard.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -28,7 +28,7 @@ SDL_Renderer *renderer; SDL_Surface *surface; int done; -void DrawChessBoard() +void DrawChessBoard(void) { int row = 0, column = 0, x = 0; SDL_Rect rect, darea; @@ -50,9 +50,10 @@ void DrawChessBoard() SDL_RenderFillRect(renderer, &rect); } } + SDL_RenderPresent(renderer); } -void loop() +void loop(void) { SDL_Event e; while (SDL_PollEvent(&e)) { @@ -106,13 +107,13 @@ int main(int argc, char *argv[]) /* Create window and renderer for given surface */ window = SDL_CreateWindow("Chess Board", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 640, 480, SDL_WINDOW_RESIZABLE); - if (window == NULL) { + if (!window) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Window creation fail : %s\n", SDL_GetError()); return 1; } surface = SDL_GetWindowSurface(window); renderer = SDL_CreateSoftwareRenderer(surface); - if (renderer == NULL) { + if (!renderer) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Render creation for surface fail : %s\n", SDL_GetError()); return 1; } diff --git a/thirdparty/SDL/test/testdropfile.c b/thirdparty/SDL/test/testdropfile.c index b80633365..2184f062e 100644 --- a/thirdparty/SDL/test/testdropfile.c +++ b/thirdparty/SDL/test/testdropfile.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -35,7 +35,7 @@ int main(int argc, char *argv[]) /* Initialize test framework */ state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO); - if (state == NULL) { + if (!state) { return 1; } diff --git a/thirdparty/SDL/test/testerror.c b/thirdparty/SDL/test/testerror.c index f3f11b661..25874d1ea 100644 --- a/thirdparty/SDL/test/testerror.c +++ b/thirdparty/SDL/test/testerror.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -65,7 +65,7 @@ int main(int argc, char *argv[]) alive = 1; thread = SDL_CreateThread(ThreadFunc, NULL, "#1"); - if (thread == NULL) { + if (!thread) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create thread: %s\n", SDL_GetError()); quit(1); } diff --git a/thirdparty/SDL/test/testevdev.c b/thirdparty/SDL/test/testevdev.c index e61579158..67124ae0f 100644 --- a/thirdparty/SDL/test/testevdev.c +++ b/thirdparty/SDL/test/testevdev.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga Copyright (C) 2020-2022 Collabora Ltd. This software is provided 'as-is', without any express or implied @@ -18,7 +18,7 @@ static int run_test(void); -#if HAVE_LIBUDEV_H || defined(SDL_JOYSTICK_LINUX) +#if defined(HAVE_LIBUDEV_H) || defined(SDL_JOYSTICK_LINUX) #include diff --git a/thirdparty/SDL/test/testfile.c b/thirdparty/SDL/test/testfile.c index 40d52ca22..a35da02bd 100644 --- a/thirdparty/SDL/test/testfile.c +++ b/thirdparty/SDL/test/testfile.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -107,25 +107,25 @@ int main(int argc, char *argv[]) RWOP_ERR_QUIT(rwops); } rwops = SDL_RWFromFile(FBASENAME2, "wb"); - if (rwops == NULL) { + if (!rwops) { RWOP_ERR_QUIT(rwops); } rwops->close(rwops); unlink(FBASENAME2); rwops = SDL_RWFromFile(FBASENAME2, "wb+"); - if (rwops == NULL) { + if (!rwops) { RWOP_ERR_QUIT(rwops); } rwops->close(rwops); unlink(FBASENAME2); rwops = SDL_RWFromFile(FBASENAME2, "ab"); - if (rwops == NULL) { + if (!rwops) { RWOP_ERR_QUIT(rwops); } rwops->close(rwops); unlink(FBASENAME2); rwops = SDL_RWFromFile(FBASENAME2, "ab+"); - if (rwops == NULL) { + if (!rwops) { RWOP_ERR_QUIT(rwops); } rwops->close(rwops); @@ -136,7 +136,7 @@ int main(int argc, char *argv[]) test : w mode, r mode, w+ mode */ rwops = SDL_RWFromFile(FBASENAME1, "wb"); /* write only */ - if (rwops == NULL) { + if (!rwops) { RWOP_ERR_QUIT(rwops); } if (1 != rwops->write(rwops, "1234567890", 10, 1)) { @@ -158,7 +158,7 @@ int main(int argc, char *argv[]) rwops->close(rwops); rwops = SDL_RWFromFile(FBASENAME1, "rb"); /* read mode, file must exists */ - if (rwops == NULL) { + if (!rwops) { RWOP_ERR_QUIT(rwops); } if (0 != rwops->seek(rwops, 0L, RW_SEEK_SET)) { @@ -196,7 +196,7 @@ int main(int argc, char *argv[]) /* test 3: same with w+ mode */ rwops = SDL_RWFromFile(FBASENAME1, "wb+"); /* write + read + truncation */ - if (rwops == NULL) { + if (!rwops) { RWOP_ERR_QUIT(rwops); } if (1 != rwops->write(rwops, "1234567890", 10, 1)) { @@ -247,7 +247,7 @@ int main(int argc, char *argv[]) /* test 4: same in r+ mode */ rwops = SDL_RWFromFile(FBASENAME1, "rb+"); /* write + read + file must exists, no truncation */ - if (rwops == NULL) { + if (!rwops) { RWOP_ERR_QUIT(rwops); } if (1 != rwops->write(rwops, "1234567890", 10, 1)) { @@ -298,7 +298,7 @@ int main(int argc, char *argv[]) /* test5 : append mode */ rwops = SDL_RWFromFile(FBASENAME1, "ab+"); /* write + read + append */ - if (rwops == NULL) { + if (!rwops) { RWOP_ERR_QUIT(rwops); } if (1 != rwops->write(rwops, "1234567890", 10, 1)) { diff --git a/thirdparty/SDL/test/testfilesystem.c b/thirdparty/SDL/test/testfilesystem.c index f452d7761..af0bd9f05 100644 --- a/thirdparty/SDL/test/testfilesystem.c +++ b/thirdparty/SDL/test/testfilesystem.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -28,7 +28,7 @@ int main(int argc, char *argv[]) } base_path = SDL_GetBasePath(); - if (base_path == NULL) { + if (!base_path) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't find base path: %s\n", SDL_GetError()); } else { @@ -37,7 +37,7 @@ int main(int argc, char *argv[]) } pref_path = SDL_GetPrefPath("libsdl", "test_filesystem"); - if (pref_path == NULL) { + if (!pref_path) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't find pref path: %s\n", SDL_GetError()); } else { @@ -46,7 +46,7 @@ int main(int argc, char *argv[]) } pref_path = SDL_GetPrefPath(NULL, "test_filesystem"); - if (pref_path == NULL) { + if (!pref_path) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't find pref path without organization: %s\n", SDL_GetError()); } else { diff --git a/thirdparty/SDL/test/testfilesystem_pre.c b/thirdparty/SDL/test/testfilesystem_pre.c index dba8b51fb..11615abd2 100644 --- a/thirdparty/SDL/test/testfilesystem_pre.c +++ b/thirdparty/SDL/test/testfilesystem_pre.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/test/testgamecontroller.c b/thirdparty/SDL/test/testgamecontroller.c index e2bdebdec..bf4125788 100644 --- a/thirdparty/SDL/test/testgamecontroller.c +++ b/thirdparty/SDL/test/testgamecontroller.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -107,9 +107,9 @@ static int virtual_axis_start_x; static int virtual_axis_start_y; static SDL_GameControllerButton virtual_button_active = SDL_CONTROLLER_BUTTON_INVALID; -static void UpdateWindowTitle() +static void UpdateWindowTitle(void) { - if (window == NULL) { + if (!window) { return; } @@ -201,13 +201,13 @@ static void AddController(int device_index, SDL_bool verbose) } controller = SDL_GameControllerOpen(device_index); - if (controller == NULL) { + if (!controller) { SDL_Log("Couldn't open controller: %s\n", SDL_GetError()); return; } controllers = (SDL_GameController **)SDL_realloc(gamecontrollers, (num_controllers + 1) * sizeof(*controllers)); - if (controllers == NULL) { + if (!controllers) { SDL_GameControllerClose(controller); return; } @@ -221,6 +221,7 @@ static void AddController(int device_index, SDL_bool verbose) const char *name = SDL_GameControllerName(gamecontroller); const char *path = SDL_GameControllerPath(gamecontroller); SDL_Log("Opened game controller %s%s%s\n", name, path ? ", " : "", path ? path : ""); + SDL_Log("Mapping: %s\n", SDL_GameControllerMapping(gamecontroller)); } firmware_version = SDL_GameControllerGetFirmwareVersion(gamecontroller); @@ -328,7 +329,7 @@ typedef struct Uint8 ucLedBlue; /* 46 */ } DS5EffectsState_t; -static void CyclePS5TriggerEffect() +static void CyclePS5TriggerEffect(void) { DS5EffectsState_t state; @@ -350,7 +351,7 @@ static void CyclePS5TriggerEffect() SDL_GameControllerSendEffect(gamecontroller, &state, sizeof(state)); } -static SDL_bool ShowingFront() +static SDL_bool ShowingFront(void) { SDL_bool showing_front = SDL_TRUE; int i; @@ -393,7 +394,7 @@ static int SDLCALL VirtualControllerSetLED(void *userdata, Uint8 red, Uint8 gree return 0; } -static void OpenVirtualController() +static void OpenVirtualController(void) { SDL_VirtualJoystickDesc desc; int virtual_index; @@ -413,13 +414,13 @@ static void OpenVirtualController() SDL_Log("Couldn't open virtual device: %s\n", SDL_GetError()); } else { virtual_joystick = SDL_JoystickOpen(virtual_index); - if (virtual_joystick == NULL) { + if (!virtual_joystick) { SDL_Log("Couldn't open virtual device: %s\n", SDL_GetError()); } } } -static void CloseVirtualController() +static void CloseVirtualController(void) { int i; @@ -624,7 +625,8 @@ void loop(void *arg) if (event.type == SDL_CONTROLLERBUTTONDOWN) { SetController(event.cbutton.which); } - SDL_Log("Controller %" SDL_PRIs32 " button %s %s\n", event.cbutton.which, SDL_GameControllerGetStringForButton((SDL_GameControllerButton)event.cbutton.button), event.cbutton.state ? "pressed" : "released"); + SDL_Log("Controller %" SDL_PRIs32 " button %s %s\n", event.cbutton.which, SDL_GameControllerGetStringForButton((SDL_GameControllerButton)event.cbutton.button), + event.cbutton.state ? "pressed" : "released"); /* Cycle PS5 trigger effects when the microphone button is pressed */ if (event.type == SDL_CONTROLLERBUTTONDOWN && @@ -896,13 +898,13 @@ int main(int argc, char *argv[]) window = SDL_CreateWindow("Game Controller Test", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, SCREEN_WIDTH, SCREEN_HEIGHT, 0); - if (window == NULL) { + if (!window) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create window: %s\n", SDL_GetError()); return 2; } screen = SDL_CreateRenderer(window, -1, 0); - if (screen == NULL) { + if (!screen) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create renderer: %s\n", SDL_GetError()); SDL_DestroyWindow(window); return 2; @@ -920,7 +922,7 @@ int main(int argc, char *argv[]) button_texture = LoadTexture(screen, "button.bmp", SDL_TRUE, NULL, NULL); axis_texture = LoadTexture(screen, "axis.bmp", SDL_TRUE, NULL, NULL); - if (background_front == NULL || background_back == NULL || button_texture == NULL || axis_texture == NULL) { + if (!background_front || !background_back || !button_texture || !axis_texture) { SDL_DestroyRenderer(screen); SDL_DestroyWindow(window); return 2; diff --git a/thirdparty/SDL/test/testgeometry.c b/thirdparty/SDL/test/testgeometry.c index 9742a1416..f8c46993f 100644 --- a/thirdparty/SDL/test/testgeometry.c +++ b/thirdparty/SDL/test/testgeometry.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -62,7 +62,7 @@ int LoadSprite(const char *file) return 0; } -void loop() +void loop(void) { int i; SDL_Event event; @@ -172,7 +172,7 @@ int main(int argc, char *argv[]) /* Initialize test framework */ state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO); - if (state == NULL) { + if (!state) { return 1; } for (i = 1; i < argc;) { @@ -216,7 +216,7 @@ int main(int argc, char *argv[]) /* Create the windows, initialize the renderers, and load the textures */ sprites = (SDL_Texture **)SDL_malloc(state->num_windows * sizeof(*sprites)); - if (sprites == NULL) { + if (!sprites) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory!\n"); quit(2); } diff --git a/thirdparty/SDL/test/testgesture.c b/thirdparty/SDL/test/testgesture.c index f37635f33..9870b6059 100644 --- a/thirdparty/SDL/test/testgesture.c +++ b/thirdparty/SDL/test/testgesture.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -131,7 +131,7 @@ DrawScreen(SDL_Window *window) SDL_Surface *screen = SDL_GetWindowSurface(window); int i; - if (screen == NULL) { + if (!screen) { return; } @@ -251,7 +251,7 @@ loop(void) break; case SDL_DOLLARRECORD: - SDL_Log("Recorded gesture: %" SDL_PRIs64 "", event.dgesture.gestureId); + SDL_Log("Recorded gesture: %" SDL_PRIs64, event.dgesture.gestureId); break; } } @@ -272,7 +272,7 @@ loop(void) int main(int argc, char *argv[]) { state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO); - if (state == NULL) { + if (!state) { return 1; } diff --git a/thirdparty/SDL/test/testgl2.c b/thirdparty/SDL/test/testgl2.c index b58798c32..a4fdacb5a 100644 --- a/thirdparty/SDL/test/testgl2.c +++ b/thirdparty/SDL/test/testgl2.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -40,11 +40,11 @@ static GL_Context ctx; static int LoadContext(GL_Context *data) { -#if SDL_VIDEO_DRIVER_UIKIT +#ifdef SDL_VIDEO_DRIVER_UIKIT #define __SDL_NOGETPROCADDR__ -#elif SDL_VIDEO_DRIVER_ANDROID +#elif defined(SDL_VIDEO_DRIVER_ANDROID) #define __SDL_NOGETPROCADDR__ -#elif SDL_VIDEO_DRIVER_PANDORA +#elif defined(SDL_VIDEO_DRIVER_PANDORA) #define __SDL_NOGETPROCADDR__ #endif @@ -78,7 +78,7 @@ quit(int rc) } static void -Render() +Render(void) { static float color[8][3] = { { 1.0, 1.0, 0.0 }, @@ -205,6 +205,11 @@ Render() ctx.glRotatef(5.0, 1.0, 1.0, 1.0); } +static void LogSwapInterval(void) +{ + SDL_Log("Swap Interval : %d\n", SDL_GL_GetSwapInterval()); +} + int main(int argc, char *argv[]) { int fsaa, accel; @@ -226,7 +231,7 @@ int main(int argc, char *argv[]) /* Initialize test framework */ state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO); - if (state == NULL) { + if (!state) { return 1; } for (i = 1; i < argc;) { @@ -300,7 +305,9 @@ int main(int argc, char *argv[]) SDL_GetCurrentDisplayMode(0, &mode); SDL_Log("Screen BPP : %" SDL_PRIu32 "\n", SDL_BITSPERPIXEL(mode.format)); - SDL_Log("Swap Interval : %d\n", SDL_GL_GetSwapInterval()); + + LogSwapInterval(); + SDL_GetWindowSize(state->windows[0], &dw, &dh); SDL_Log("Window Size : %d,%d\n", dw, dh); SDL_GL_GetDrawableSize(state->windows[0], &dw, &dh); @@ -408,6 +415,7 @@ int main(int argc, char *argv[]) SDL_GL_MakeCurrent(state->windows[i], context); if (update_swap_interval) { SDL_GL_SetSwapInterval(swap_interval); + LogSwapInterval(); } SDL_GL_GetDrawableSize(state->windows[i], &w, &h); ctx.glViewport(0, 0, w, h); diff --git a/thirdparty/SDL/test/testgles.c b/thirdparty/SDL/test/testgles.c index 498dbce5c..63861edc1 100644 --- a/thirdparty/SDL/test/testgles.c +++ b/thirdparty/SDL/test/testgles.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -34,7 +34,7 @@ quit(int rc) { int i; - if (context != NULL) { + if (context) { for (i = 0; i < state->num_windows; i++) { if (context[i]) { SDL_GL_DeleteContext(context[i]); @@ -49,7 +49,7 @@ quit(int rc) } static void -Render() +Render(void) { static GLubyte color[8][4] = { { 255, 0, 0, 0 }, { 255, 0, 0, 255 }, @@ -114,7 +114,7 @@ int main(int argc, char *argv[]) /* Initialize test framework */ state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO); - if (state == NULL) { + if (!state) { return 1; } for (i = 1; i < argc;) { @@ -169,7 +169,7 @@ int main(int argc, char *argv[]) } context = (SDL_GLContext *)SDL_calloc(state->num_windows, sizeof(*context)); - if (context == NULL) { + if (!context) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory!\n"); quit(2); } diff --git a/thirdparty/SDL/test/testgles2.c b/thirdparty/SDL/test/testgles2.c index 656e5e611..e4b086420 100644 --- a/thirdparty/SDL/test/testgles2.c +++ b/thirdparty/SDL/test/testgles2.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -65,11 +65,11 @@ static GLES2_Context ctx; static int LoadContext(GLES2_Context *data) { -#if SDL_VIDEO_DRIVER_UIKIT +#ifdef SDL_VIDEO_DRIVER_UIKIT #define __SDL_NOGETPROCADDR__ -#elif SDL_VIDEO_DRIVER_ANDROID +#elif defined(SDL_VIDEO_DRIVER_ANDROID) #define __SDL_NOGETPROCADDR__ -#elif SDL_VIDEO_DRIVER_PANDORA +#elif defined(SDL_VIDEO_DRIVER_PANDORA) #define __SDL_NOGETPROCADDR__ #endif @@ -96,7 +96,7 @@ quit(int rc) { int i; - if (context != NULL) { + if (context) { for (i = 0; i < state->num_windows; i++) { if (context[i]) { SDL_GL_DeleteContext(context[i]); @@ -569,7 +569,7 @@ render_thread_fn(void *render_ctx) } static void -loop_threaded() +loop_threaded(void) { SDL_Event event; int i; @@ -598,7 +598,7 @@ loop_threaded() #endif static void -loop() +loop(void) { SDL_Event event; int i; @@ -636,7 +636,7 @@ int main(int argc, char *argv[]) /* Initialize test framework */ state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO); - if (state == NULL) { + if (!state) { return 1; } for (i = 1; i < argc;) { @@ -696,7 +696,7 @@ int main(int argc, char *argv[]) } context = (SDL_GLContext *)SDL_calloc(state->num_windows, sizeof(*context)); - if (context == NULL) { + if (!context) { SDL_Log("Out of memory!\n"); quit(2); } @@ -893,9 +893,9 @@ int main(int argc, char *argv[]) SDL_Log("%2.2f frames per second\n", ((double)frames * 1000) / (now - then)); } -#if !defined(__ANDROID__) && !defined(__NACL__) +#if !defined(__ANDROID__) && !defined(__NACL__) quit(0); -#endif +#endif return 0; } diff --git a/thirdparty/SDL/test/testgles2_sdf.c b/thirdparty/SDL/test/testgles2_sdf.c index 91f49064a..6f96338ac 100644 --- a/thirdparty/SDL/test/testgles2_sdf.c +++ b/thirdparty/SDL/test/testgles2_sdf.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -63,11 +63,11 @@ static GLES2_Context ctx; static int LoadContext(GLES2_Context *data) { -#if SDL_VIDEO_DRIVER_UIKIT +#ifdef SDL_VIDEO_DRIVER_UIKIT #define __SDL_NOGETPROCADDR__ -#elif SDL_VIDEO_DRIVER_ANDROID +#elif defined(SDL_VIDEO_DRIVER_ANDROID) #define __SDL_NOGETPROCADDR__ -#elif SDL_VIDEO_DRIVER_PANDORA +#elif defined(SDL_VIDEO_DRIVER_PANDORA) #define __SDL_NOGETPROCADDR__ #endif @@ -94,7 +94,7 @@ quit(int rc) { int i; - if (context != NULL) { + if (context) { for (i = 0; i < state->num_windows; i++) { if (context[i]) { SDL_GL_DeleteContext(context[i]); @@ -325,7 +325,7 @@ int done; Uint32 frames; shader_data *datas; -void loop() +void loop(void) { SDL_Event event; int i; @@ -445,7 +445,7 @@ int main(int argc, char *argv[]) /* Initialize test framework */ state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO); - if (state == NULL) { + if (!state) { return 1; } for (i = 1; i < argc;) { @@ -502,7 +502,7 @@ int main(int argc, char *argv[]) } context = (SDL_GLContext *)SDL_calloc(state->num_windows, sizeof(*context)); - if (context == NULL) { + if (!context) { SDL_Log("Out of memory!\n"); quit(2); } @@ -543,17 +543,17 @@ int main(int argc, char *argv[]) #if 1 path = GetNearbyFilename(f); - if (path == NULL) { + if (!path) { path = SDL_strdup(f); } - if (path == NULL) { + if (!path) { SDL_Log("out of memory\n"); exit(-1); } tmp = SDL_LoadBMP(path); - if (tmp == NULL) { + if (!tmp) { SDL_Log("missing image file: %s", path); exit(-1); } else { diff --git a/thirdparty/SDL/test/testhaptic.c b/thirdparty/SDL/test/testhaptic.c index fa4186376..56602cafb 100644 --- a/thirdparty/SDL/test/testhaptic.c +++ b/thirdparty/SDL/test/testhaptic.c @@ -16,6 +16,8 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND */ #include "SDL.h" +#include + #ifndef SDL_HAPTIC_DISABLED static SDL_Haptic *haptic; @@ -69,7 +71,7 @@ int main(int argc, char **argv) SDL_Log("%d Haptic devices detected.\n", SDL_NumHaptics()); if (SDL_NumHaptics() > 0) { /* We'll just use index or the first force feedback device found */ - if (name == NULL) { + if (!name) { i = (index != -1) ? index : 0; } /* Try to find matching device */ @@ -88,7 +90,7 @@ int main(int argc, char **argv) } haptic = SDL_HapticOpen(i); - if (haptic == NULL) { + if (!haptic) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Unable to create the haptic device: %s\n", SDL_GetError()); return 1; @@ -279,7 +281,7 @@ int main(int argc, char **argv) } /* Quit */ - if (haptic != NULL) { + if (haptic) { SDL_HapticClose(haptic); } SDL_Quit(); diff --git a/thirdparty/SDL/test/testhittesting.c b/thirdparty/SDL/test/testhittesting.c index 92ddf8c42..94c5ea9ae 100644 --- a/thirdparty/SDL/test/testhittesting.c +++ b/thirdparty/SDL/test/testhittesting.c @@ -106,7 +106,7 @@ int main(int argc, char **argv) if (e.key.keysym.sym == SDLK_ESCAPE) { done = 1; } else if (e.key.keysym.sym == SDLK_x) { - if (areas == NULL) { + if (!areas) { areas = drag_areas; numareas = SDL_arraysize(drag_areas); } else { diff --git a/thirdparty/SDL/test/testhotplug.c b/thirdparty/SDL/test/testhotplug.c index 1ac73a7fb..aca1741d7 100644 --- a/thirdparty/SDL/test/testhotplug.c +++ b/thirdparty/SDL/test/testhotplug.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -68,7 +68,7 @@ int main(int argc, char *argv[]) keepGoing = SDL_FALSE; break; case SDL_JOYDEVICEADDED: - if (joystick != NULL) { + if (joystick) { SDL_Log("Only one joystick supported by this test\n"); } else { joystick = SDL_JoystickOpen(event.jdevice.which); diff --git a/thirdparty/SDL/test/testiconv.c b/thirdparty/SDL/test/testiconv.c index b2d13a6aa..fcdd72892 100644 --- a/thirdparty/SDL/test/testiconv.c +++ b/thirdparty/SDL/test/testiconv.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -61,7 +61,7 @@ int main(int argc, char *argv[]) fname = GetResourceFilename(argc > 1 ? argv[1] : NULL, "utf8.txt"); file = fopen(fname, "rb"); - if (file == NULL) { + if (!file) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Unable to open %s\n", fname); return 1; } diff --git a/thirdparty/SDL/test/testime.c b/thirdparty/SDL/test/testime.c index 51f685b1e..cfb4b3873 100644 --- a/thirdparty/SDL/test/testime.c +++ b/thirdparty/SDL/test/testime.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -29,7 +29,7 @@ #ifdef HAVE_SDL_TTF #ifdef __MACOSX__ #define DEFAULT_FONT "/System/Library/Fonts/华文细黑.ttf" -#elif __WIN32__ +#elif defined(__WIN32__) /* Some japanese font present on at least Windows 8.1. */ #define DEFAULT_FONT "C:\\Windows\\Fonts\\yugothic.ttf" #else @@ -97,7 +97,7 @@ static Uint8 validate_hex(const char *cp, size_t len, Uint32 *np) } n = (n << 4) | c; } - if (np != NULL) { + if (np) { *np = n; } return 1; @@ -116,7 +116,7 @@ static int unifont_init(const char *fontname) /* Allocate memory for the glyph data so the file can be closed after initialization. */ unifontGlyph = (struct UnifontGlyph *)SDL_malloc(unifontGlyphSize); - if (unifontGlyph == NULL) { + if (!unifontGlyph) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Failed to allocate %d KiB for glyph data.\n", (int)(unifontGlyphSize + 1023) / 1024); return -1; } @@ -124,20 +124,20 @@ static int unifont_init(const char *fontname) /* Allocate memory for texture pointers for all renderers. */ unifontTexture = (SDL_Texture **)SDL_malloc(unifontTextureSize); - if (unifontTexture == NULL) { + if (!unifontTexture) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Failed to allocate %d KiB for texture pointer data.\n", (int)(unifontTextureSize + 1023) / 1024); return -1; } SDL_memset(unifontTexture, 0, unifontTextureSize); filename = GetResourceFilename(NULL, fontname); - if (filename == NULL) { + if (!filename) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory\n"); return -1; } hexFile = SDL_RWFromFile(filename, "rb"); SDL_free(filename); - if (hexFile == NULL) { + if (!hexFile) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Failed to open font file: %s\n", fontname); return -1; } @@ -269,7 +269,7 @@ static int unifont_load_texture(Uint32 textureID) } textureRGBA = (Uint8 *)SDL_malloc(UNIFONT_TEXTURE_SIZE); - if (textureRGBA == NULL) { + if (!textureRGBA) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Failed to allocate %d MiB for a texture.\n", UNIFONT_TEXTURE_SIZE / 1024 / 1024); return -1; } @@ -324,7 +324,7 @@ static Sint32 unifont_draw_glyph(Uint32 codepoint, int rendererID, SDL_Rect *dst } } texture = unifontTexture[UNIFONT_NUM_TEXTURES * rendererID + textureID]; - if (texture != NULL) { + if (texture) { const Uint32 cInTex = codepoint % UNIFONT_GLYPHS_IN_TEXTURE; srcrect.x = cInTex % UNIFONT_GLYPHS_IN_ROW * 16; srcrect.y = cInTex / UNIFONT_GLYPHS_IN_ROW * 16; @@ -333,17 +333,17 @@ static Sint32 unifont_draw_glyph(Uint32 codepoint, int rendererID, SDL_Rect *dst return unifontGlyph[codepoint].width; } -static void unifont_cleanup() +static void unifont_cleanup(void) { int i, j; for (i = 0; i < state->num_windows; ++i) { SDL_Renderer *renderer = state->renderers[i]; - if (state->windows[i] == NULL || renderer == NULL) { + if (state->windows[i] == NULL || !renderer) { continue; } for (j = 0; j < UNIFONT_NUM_TEXTURES; j++) { SDL_Texture *tex = unifontTexture[UNIFONT_NUM_TEXTURES * i + j]; - if (tex != NULL) { + if (tex) { SDL_DestroyTexture(tex); } } @@ -425,12 +425,12 @@ Uint32 utf8_decode(char *p, size_t len) return codepoint; } -void usage() +void usage(void) { SDL_Log("usage: testime [--font fontfile]\n"); } -void InitInput() +void InitInput(void) { /* Prepare a rect for text input */ textRect.x = textRect.y = 100; @@ -444,7 +444,7 @@ void InitInput() SDL_StartTextInput(); } -void CleanupVideo() +void CleanupVideo(void) { SDL_StopTextInput(); #ifdef HAVE_SDL_TTF @@ -530,7 +530,7 @@ void _Redraw(int rendererID) if (cursor) { char *p = utf8_advance(markedText, cursor); char c = 0; - if (p == NULL) { + if (!p) { p = &markedText[SDL_strlen(markedText)]; } @@ -597,7 +597,7 @@ void _Redraw(int rendererID) SDL_SetTextInputRect(&markedRect); } -void Redraw() +void Redraw(void) { int i; for (i = 0; i < state->num_windows; ++i) { @@ -626,7 +626,7 @@ int main(int argc, char *argv[]) /* Initialize test framework */ state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO); - if (state == NULL) { + if (!state) { return 1; } for (i = 1; i < argc; i++) { @@ -660,7 +660,7 @@ int main(int argc, char *argv[]) TTF_Init(); font = TTF_OpenFont(fontname, DEFAULT_PTSIZE); - if (font == NULL) { + if (!font) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to find font: %s\n", TTF_GetError()); return -1; } diff --git a/thirdparty/SDL/test/testintersections.c b/thirdparty/SDL/test/testintersections.c index f24d9fbf5..20488bbac 100644 --- a/thirdparty/SDL/test/testintersections.c +++ b/thirdparty/SDL/test/testintersections.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -208,7 +208,7 @@ DrawRectRectIntersections(SDL_Renderer *renderer) } } -void loop() +void loop(void) { int i; SDL_Event event; @@ -289,7 +289,7 @@ int main(int argc, char *argv[]) /* Initialize test framework */ state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO); - if (state == NULL) { + if (!state) { return 1; } for (i = 1; i < argc;) { diff --git a/thirdparty/SDL/test/testjoystick.c b/thirdparty/SDL/test/testjoystick.c index adb31dc14..389858049 100644 --- a/thirdparty/SDL/test/testjoystick.c +++ b/thirdparty/SDL/test/testjoystick.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -117,7 +117,7 @@ void loop(void *arg) case SDL_JOYDEVICEADDED: SDL_Log("Joystick device %d added.\n", (int)event.jdevice.which); - if (joystick == NULL) { + if (!joystick) { joystick = SDL_JoystickOpen(event.jdevice.which); if (joystick) { PrintJoystick(joystick); @@ -296,13 +296,13 @@ int main(int argc, char *argv[]) window = SDL_CreateWindow("Joystick Test", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, SCREEN_WIDTH, SCREEN_HEIGHT, 0); - if (window == NULL) { + if (!window) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create window: %s\n", SDL_GetError()); return SDL_FALSE; } screen = SDL_CreateRenderer(window, -1, 0); - if (screen == NULL) { + if (!screen) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create renderer: %s\n", SDL_GetError()); SDL_DestroyWindow(window); return SDL_FALSE; diff --git a/thirdparty/SDL/test/testkeys.c b/thirdparty/SDL/test/testkeys.c index f80f0b9dc..c7b120b4f 100644 --- a/thirdparty/SDL/test/testkeys.c +++ b/thirdparty/SDL/test/testkeys.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/test/testloadso.c b/thirdparty/SDL/test/testloadso.c index f404a6813..fa6923b97 100644 --- a/thirdparty/SDL/test/testloadso.c +++ b/thirdparty/SDL/test/testloadso.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -53,13 +53,13 @@ int main(int argc, char *argv[]) } lib = SDL_LoadObject(libname); - if (lib == NULL) { + if (!lib) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_LoadObject('%s') failed: %s\n", libname, SDL_GetError()); retval = 3; } else { fn = (fntype)SDL_LoadFunction(lib, symname); - if (fn == NULL) { + if (!fn) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_LoadFunction('%s') failed: %s\n", symname, SDL_GetError()); retval = 4; diff --git a/thirdparty/SDL/test/testlocale.c b/thirdparty/SDL/test/testlocale.c index f8ff1a37b..6e371ca10 100644 --- a/thirdparty/SDL/test/testlocale.c +++ b/thirdparty/SDL/test/testlocale.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -17,7 +17,7 @@ static void log_locales(void) { SDL_Locale *locales = SDL_GetPreferredLocales(); - if (locales == NULL) { + if (!locales) { SDL_Log("Couldn't determine locales: %s", SDL_GetError()); } else { SDL_Locale *l; diff --git a/thirdparty/SDL/test/testlock.c b/thirdparty/SDL/test/testlock.c index 544ec322b..1af8846fa 100644 --- a/thirdparty/SDL/test/testlock.c +++ b/thirdparty/SDL/test/testlock.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -106,7 +106,7 @@ int main(int argc, char *argv[]) SDL_AtomicSet(&doterminate, 0); mutex = SDL_CreateMutex(); - if (mutex == NULL) { + if (!mutex) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create mutex: %s\n", SDL_GetError()); exit(1); } diff --git a/thirdparty/SDL/test/testmessage.c b/thirdparty/SDL/test/testmessage.c index f805f8301..d3de67ee7 100644 --- a/thirdparty/SDL/test/testmessage.c +++ b/thirdparty/SDL/test/testmessage.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/test/testmouse.c b/thirdparty/SDL/test/testmouse.c index d1c4edc06..0583ead5a 100644 --- a/thirdparty/SDL/test/testmouse.c +++ b/thirdparty/SDL/test/testmouse.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -83,7 +83,7 @@ void DrawObject(SDL_Renderer *renderer, Object *object) void DrawObjects(SDL_Renderer *renderer) { Object *next = objects; - while (next != NULL) { + while (next) { DrawObject(renderer, next); next = next->next; } @@ -93,7 +93,7 @@ void AppendObject(Object *object) { if (objects) { Object *next = objects; - while (next->next != NULL) { + while (next->next) { next = next->next; } next->next = object; @@ -130,7 +130,7 @@ void loop(void *arg) break; case SDL_MOUSEMOTION: - if (active == NULL) { + if (!active) { break; } @@ -139,7 +139,7 @@ void loop(void *arg) break; case SDL_MOUSEBUTTONDOWN: - if (active == NULL) { + if (!active) { active = SDL_calloc(1, sizeof(*active)); active->x1 = active->x2 = event.button.x; active->y1 = active->y2 = event.button.y; @@ -173,7 +173,7 @@ void loop(void *arg) break; case SDL_MOUSEBUTTONUP: - if (active == NULL) { + if (!active) { break; } @@ -266,13 +266,13 @@ int main(int argc, char *argv[]) window = SDL_CreateWindow("Mouse Test", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, SCREEN_WIDTH, SCREEN_HEIGHT, 0); - if (window == NULL) { + if (!window) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create window: %s\n", SDL_GetError()); return SDL_FALSE; } renderer = SDL_CreateRenderer(window, -1, 0); - if (renderer == NULL) { + if (!renderer) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create renderer: %s\n", SDL_GetError()); SDL_DestroyWindow(window); return SDL_FALSE; diff --git a/thirdparty/SDL/test/testmultiaudio.c b/thirdparty/SDL/test/testmultiaudio.c index 2fd352b52..bd3ee0db3 100644 --- a/thirdparty/SDL/test/testmultiaudio.c +++ b/thirdparty/SDL/test/testmultiaudio.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -53,7 +53,7 @@ play_through_once(void *arg, Uint8 *stream, int len) } } -void loop() +void loop(void) { if (SDL_AtomicGet(&cbd[0].done)) { #ifdef __EMSCRIPTEN__ diff --git a/thirdparty/SDL/test/testnative.c b/thirdparty/SDL/test/testnative.c index e803b822d..ad47e4a07 100644 --- a/thirdparty/SDL/test/testnative.c +++ b/thirdparty/SDL/test/testnative.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -47,7 +47,7 @@ static void quit(int rc) { SDL_VideoQuit(); - if (native_window != NULL && factory != NULL) { + if (native_window && factory) { factory->DestroyNativeWindow(native_window); } exit(rc); @@ -119,19 +119,19 @@ int main(int argc, char *argv[]) break; } } - if (factory == NULL) { + if (!factory) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't find native window code for %s driver\n", driver); quit(2); } SDL_Log("Creating native window for %s driver\n", driver); native_window = factory->CreateNativeWindow(WINDOW_W, WINDOW_H); - if (native_window == NULL) { + if (!native_window) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create native window\n"); quit(3); } window = SDL_CreateWindowFrom(native_window); - if (window == NULL) { + if (!window) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create SDL window: %s\n", SDL_GetError()); quit(4); } @@ -139,7 +139,7 @@ int main(int argc, char *argv[]) /* Create the renderer */ renderer = SDL_CreateRenderer(window, -1, 0); - if (renderer == NULL) { + if (!renderer) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create renderer: %s\n", SDL_GetError()); quit(5); } @@ -149,7 +149,7 @@ int main(int argc, char *argv[]) SDL_RenderClear(renderer); sprite = LoadTexture(renderer, "icon.bmp", SDL_TRUE, NULL, NULL); - if (sprite == NULL) { + if (!sprite) { quit(6); } @@ -158,7 +158,7 @@ int main(int argc, char *argv[]) SDL_QueryTexture(sprite, NULL, NULL, &sprite_w, &sprite_h); positions = (SDL_Rect *)SDL_malloc(NUM_SPRITES * sizeof(SDL_Rect)); velocities = (SDL_Rect *)SDL_malloc(NUM_SPRITES * sizeof(SDL_Rect)); - if (positions == NULL || velocities == NULL) { + if (!positions || !velocities) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory!\n"); quit(2); } diff --git a/thirdparty/SDL/test/testnative.h b/thirdparty/SDL/test/testnative.h index 2ba900586..e2643902e 100644 --- a/thirdparty/SDL/test/testnative.h +++ b/thirdparty/SDL/test/testnative.h @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/test/testnativeos2.c b/thirdparty/SDL/test/testnativeos2.c index e0f249121..bbdbe9025 100644 --- a/thirdparty/SDL/test/testnativeos2.c +++ b/thirdparty/SDL/test/testnativeos2.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/test/testnativew32.c b/thirdparty/SDL/test/testnativew32.c index e1574583d..dfd0b63f4 100644 --- a/thirdparty/SDL/test/testnativew32.c +++ b/thirdparty/SDL/test/testnativew32.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -66,7 +66,7 @@ CreateWindowNative(int w, int h) CreateWindow("SDL Test", "", WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, w, h, NULL, NULL, GetModuleHandle(NULL), NULL); - if (hwnd == NULL) { + if (!hwnd) { MessageBox(NULL, "Window Creation Failed!", "Error!", MB_ICONEXCLAMATION | MB_OK); return 0; diff --git a/thirdparty/SDL/test/testnativex11.c b/thirdparty/SDL/test/testnativex11.c index 95dc3d644..a891f466e 100644 --- a/thirdparty/SDL/test/testnativex11.c +++ b/thirdparty/SDL/test/testnativex11.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/test/testoffscreen.c b/thirdparty/SDL/test/testoffscreen.c index fa511e8ce..917a32ec5 100644 --- a/thirdparty/SDL/test/testoffscreen.c +++ b/thirdparty/SDL/test/testoffscreen.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -32,7 +32,7 @@ static int width = 640; static int height = 480; static unsigned int max_frames = 200; -void draw() +void draw(void) { SDL_Rect Rect; @@ -50,7 +50,7 @@ void draw() SDL_RenderPresent(renderer); } -void save_surface_to_bmp() +void save_surface_to_bmp(void) { SDL_Surface *surface; Uint32 r_mask, g_mask, b_mask, a_mask; @@ -71,7 +71,7 @@ void save_surface_to_bmp() SDL_FreeSurface(surface); } -void loop() +void loop(void) { SDL_Event event; @@ -115,14 +115,14 @@ int main(int argc, char *argv[]) SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, width, height, 0); - if (window == NULL) { + if (!window) { SDL_Log("Couldn't create window: %s\n", SDL_GetError()); return SDL_FALSE; } renderer = SDL_CreateRenderer(window, -1, 0); - if (renderer == NULL) { + if (!renderer) { SDL_Log("Couldn't create renderer: %s\n", SDL_GetError()); return SDL_FALSE; diff --git a/thirdparty/SDL/test/testoverlay2.c b/thirdparty/SDL/test/testoverlay2.c index a5dba6863..236458d88 100644 --- a/thirdparty/SDL/test/testoverlay2.c +++ b/thirdparty/SDL/test/testoverlay2.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -178,7 +178,7 @@ PrintUsage(char *argv0) SDL_Log("\n"); } -void loop() +void loop(void) { SDL_Event event; @@ -311,21 +311,21 @@ int main(int argc, char **argv) } RawMooseData = (Uint8 *)SDL_malloc(MOOSEFRAME_SIZE * MOOSEFRAMES_COUNT); - if (RawMooseData == NULL) { + if (!RawMooseData) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Can't allocate memory for movie !\n"); quit(1); } /* load the trojan moose images */ filename = GetResourceFilename(NULL, "moose.dat"); - if (filename == NULL) { + if (!filename) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory\n"); SDL_free(RawMooseData); return -1; } handle = SDL_RWFromFile(filename, "rb"); SDL_free(filename); - if (handle == NULL) { + if (!handle) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Can't find the file moose.dat !\n"); SDL_free(RawMooseData); quit(2); @@ -343,21 +343,21 @@ int main(int argc, char **argv) SDL_WINDOWPOS_UNDEFINED, window_w, window_h, SDL_WINDOW_RESIZABLE); - if (window == NULL) { + if (!window) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't set create window: %s\n", SDL_GetError()); SDL_free(RawMooseData); quit(4); } renderer = SDL_CreateRenderer(window, -1, 0); - if (renderer == NULL) { + if (!renderer) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't set create renderer: %s\n", SDL_GetError()); SDL_free(RawMooseData); quit(4); } MooseTexture = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_YV12, SDL_TEXTUREACCESS_STREAMING, MOOSEPIC_W, MOOSEPIC_H); - if (MooseTexture == NULL) { + if (!MooseTexture) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't set create texture: %s\n", SDL_GetError()); SDL_free(RawMooseData); quit(5); diff --git a/thirdparty/SDL/test/testplatform.c b/thirdparty/SDL/test/testplatform.c index 7e89d2f81..353758a7d 100644 --- a/thirdparty/SDL/test/testplatform.c +++ b/thirdparty/SDL/test/testplatform.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -366,7 +366,7 @@ int Test64Bit(SDL_bool verbose) LL_Test *t; int failed = 0; - for (t = LL_Tests; t->routine != NULL; t++) { + for (t = LL_Tests; t->routine; t++) { unsigned long long result = 0; unsigned int *al = (unsigned int *)&t->a; unsigned int *bl = (unsigned int *)&t->b; diff --git a/thirdparty/SDL/test/testpower.c b/thirdparty/SDL/test/testpower.c index af60258d7..1c13b4dba 100644 --- a/thirdparty/SDL/test/testpower.c +++ b/thirdparty/SDL/test/testpower.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/test/testqsort.c b/thirdparty/SDL/test/testqsort.c index 271671e91..9c1f7646d 100644 --- a/thirdparty/SDL/test/testqsort.c +++ b/thirdparty/SDL/test/testqsort.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/test/testrelative.c b/thirdparty/SDL/test/testrelative.c index 88ed0bf5a..12ba6eb79 100644 --- a/thirdparty/SDL/test/testrelative.c +++ b/thirdparty/SDL/test/testrelative.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -35,7 +35,7 @@ DrawRects(SDL_Renderer *renderer) } static void -loop() +loop(void) { /* Check for events */ while (SDL_PollEvent(&event)) { @@ -91,7 +91,7 @@ int main(int argc, char *argv[]) /* Initialize test framework */ state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO); - if (state == NULL) { + if (!state) { return 1; } for (i = 1; i < argc; ++i) { diff --git a/thirdparty/SDL/test/testrendercopyex.c b/thirdparty/SDL/test/testrendercopyex.c index de7bc019a..2363ec59e 100644 --- a/thirdparty/SDL/test/testrendercopyex.c +++ b/thirdparty/SDL/test/testrendercopyex.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -87,7 +87,7 @@ void Draw(DrawState *s) /* SDL_Delay(10); */ } -void loop() +void loop(void) { int i; SDL_Event event; @@ -121,7 +121,7 @@ int main(int argc, char *argv[]) /* Initialize test framework */ state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO); - if (state == NULL) { + if (!state) { return 1; } diff --git a/thirdparty/SDL/test/testrendertarget.c b/thirdparty/SDL/test/testrendertarget.c index 1ae609987..656213398 100644 --- a/thirdparty/SDL/test/testrendertarget.c +++ b/thirdparty/SDL/test/testrendertarget.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -138,7 +138,7 @@ Draw(DrawState *s) SDL_RenderGetViewport(s->renderer, &viewport); target = SDL_CreateTexture(s->renderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_TARGET, viewport.w, viewport.h); - if (target == NULL) { + if (!target) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create render target texture: %s\n", SDL_GetError()); return SDL_FALSE; } @@ -173,7 +173,7 @@ Draw(DrawState *s) return SDL_TRUE; } -void loop() +void loop(void) { int i; SDL_Event event; @@ -214,7 +214,7 @@ int main(int argc, char *argv[]) /* Initialize test framework */ state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO); - if (state == NULL) { + if (!state) { return 1; } for (i = 1; i < argc;) { diff --git a/thirdparty/SDL/test/testresample.c b/thirdparty/SDL/test/testresample.c index 8bb603ac2..21ff8e170 100644 --- a/thirdparty/SDL/test/testresample.c +++ b/thirdparty/SDL/test/testresample.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -57,7 +57,7 @@ int main(int argc, char **argv) cvt.len = len; cvt.buf = (Uint8 *)SDL_malloc((size_t)len * cvt.len_mult); - if (cvt.buf == NULL) { + if (!cvt.buf) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory.\n"); SDL_FreeWAV(data); SDL_Quit(); @@ -75,7 +75,7 @@ int main(int argc, char **argv) /* write out a WAV header... */ io = SDL_RWFromFile(argv[2], "wb"); - if (io == NULL) { + if (!io) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "fopen('%s') failed: %s\n", argv[2], SDL_GetError()); SDL_free(cvt.buf); SDL_FreeWAV(data); diff --git a/thirdparty/SDL/test/testrumble.c b/thirdparty/SDL/test/testrumble.c index d6288d592..401b7605e 100644 --- a/thirdparty/SDL/test/testrumble.c +++ b/thirdparty/SDL/test/testrumble.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -71,7 +71,7 @@ int main(int argc, char **argv) SDL_Log("%d Haptic devices detected.\n", SDL_NumHaptics()); if (SDL_NumHaptics() > 0) { /* We'll just use index or the first force feedback device found */ - if (name == NULL) { + if (!name) { i = (index != -1) ? index : 0; } /* Try to find matching device */ @@ -90,7 +90,7 @@ int main(int argc, char **argv) } haptic = SDL_HapticOpen(i); - if (haptic == NULL) { + if (!haptic) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Unable to create the haptic device: %s\n", SDL_GetError()); return 1; @@ -129,7 +129,7 @@ int main(int argc, char **argv) SDL_Delay(2000); /* Quit */ - if (haptic != NULL) { + if (haptic) { SDL_HapticClose(haptic); } SDL_Quit(); diff --git a/thirdparty/SDL/test/testscale.c b/thirdparty/SDL/test/testscale.c index dca3d0960..83978123f 100644 --- a/thirdparty/SDL/test/testscale.c +++ b/thirdparty/SDL/test/testscale.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -78,7 +78,7 @@ void Draw(DrawState *s) SDL_RenderPresent(s->renderer); } -void loop() +void loop(void) { int i; SDL_Event event; @@ -111,7 +111,7 @@ int main(int argc, char *argv[]) /* Initialize test framework */ state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO); - if (state == NULL) { + if (!state) { return 1; } diff --git a/thirdparty/SDL/test/testsem.c b/thirdparty/SDL/test/testsem.c index c0036e882..5740833f4 100644 --- a/thirdparty/SDL/test/testsem.c +++ b/thirdparty/SDL/test/testsem.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/test/testsensor.c b/thirdparty/SDL/test/testsensor.c index 3da7e015e..2b9af5835 100644 --- a/thirdparty/SDL/test/testsensor.c +++ b/thirdparty/SDL/test/testsensor.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -36,7 +36,7 @@ static const char *GetSensorTypeString(SDL_SensorType type) static void HandleSensorEvent(SDL_SensorEvent *event) { SDL_Sensor *sensor = SDL_SensorFromInstanceID(event->which); - if (sensor == NULL) { + if (!sensor) { SDL_Log("Couldn't get sensor for sensor event\n"); return; } @@ -78,7 +78,7 @@ int main(int argc, char **argv) if (SDL_SensorGetDeviceType(i) != SDL_SENSOR_UNKNOWN) { SDL_Sensor *sensor = SDL_SensorOpen(i); - if (sensor == NULL) { + if (!sensor) { SDL_Log("Couldn't open sensor %" SDL_PRIs32 ": %s\n", SDL_SensorGetDeviceInstanceID(i), SDL_GetError()); } else { ++num_opened; diff --git a/thirdparty/SDL/test/testshader.c b/thirdparty/SDL/test/testshader.c index 2371fcefb..7ca10f1fb 100644 --- a/thirdparty/SDL/test/testshader.c +++ b/thirdparty/SDL/test/testshader.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -11,6 +11,7 @@ */ /* This is a simple example of using GLSL shaders with SDL */ +#include #include "SDL.h" #ifdef HAVE_OPENGL @@ -109,36 +110,36 @@ static ShaderData shaders[NUM_SHADERS] = { "}" }, }; -static PFNGLATTACHOBJECTARBPROC glAttachObjectARB; -static PFNGLCOMPILESHADERARBPROC glCompileShaderARB; -static PFNGLCREATEPROGRAMOBJECTARBPROC glCreateProgramObjectARB; -static PFNGLCREATESHADEROBJECTARBPROC glCreateShaderObjectARB; -static PFNGLDELETEOBJECTARBPROC glDeleteObjectARB; -static PFNGLGETINFOLOGARBPROC glGetInfoLogARB; -static PFNGLGETOBJECTPARAMETERIVARBPROC glGetObjectParameterivARB; -static PFNGLGETUNIFORMLOCATIONARBPROC glGetUniformLocationARB; -static PFNGLLINKPROGRAMARBPROC glLinkProgramARB; -static PFNGLSHADERSOURCEARBPROC glShaderSourceARB; -static PFNGLUNIFORM1IARBPROC glUniform1iARB; -static PFNGLUSEPROGRAMOBJECTARBPROC glUseProgramObjectARB; +static PFNGLATTACHOBJECTARBPROC pglAttachObjectARB; +static PFNGLCOMPILESHADERARBPROC pglCompileShaderARB; +static PFNGLCREATEPROGRAMOBJECTARBPROC pglCreateProgramObjectARB; +static PFNGLCREATESHADEROBJECTARBPROC pglCreateShaderObjectARB; +static PFNGLDELETEOBJECTARBPROC pglDeleteObjectARB; +static PFNGLGETINFOLOGARBPROC pglGetInfoLogARB; +static PFNGLGETOBJECTPARAMETERIVARBPROC pglGetObjectParameterivARB; +static PFNGLGETUNIFORMLOCATIONARBPROC pglGetUniformLocationARB; +static PFNGLLINKPROGRAMARBPROC pglLinkProgramARB; +static PFNGLSHADERSOURCEARBPROC pglShaderSourceARB; +static PFNGLUNIFORM1IARBPROC pglUniform1iARB; +static PFNGLUSEPROGRAMOBJECTARBPROC pglUseProgramObjectARB; static SDL_bool CompileShader(GLhandleARB shader, const char *source) { GLint status = 0; - glShaderSourceARB(shader, 1, &source, NULL); - glCompileShaderARB(shader); - glGetObjectParameterivARB(shader, GL_OBJECT_COMPILE_STATUS_ARB, &status); + pglShaderSourceARB(shader, 1, &source, NULL); + pglCompileShaderARB(shader); + pglGetObjectParameterivARB(shader, GL_OBJECT_COMPILE_STATUS_ARB, &status); if (status == 0) { GLint length = 0; char *info; - glGetObjectParameterivARB(shader, GL_OBJECT_INFO_LOG_LENGTH_ARB, &length); + pglGetObjectParameterivARB(shader, GL_OBJECT_INFO_LOG_LENGTH_ARB, &length); info = (char *)SDL_malloc((size_t)length + 1); - if (info == NULL) { + if (!info) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory!"); } else { - glGetInfoLogARB(shader, length, NULL, info); + pglGetInfoLogARB(shader, length, NULL, info); SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to compile shader:\n%s\n%s", source, info); SDL_free(info); } @@ -152,21 +153,21 @@ static SDL_bool LinkProgram(ShaderData *data) { GLint status = 0; - glAttachObjectARB(data->program, data->vert_shader); - glAttachObjectARB(data->program, data->frag_shader); - glLinkProgramARB(data->program); + pglAttachObjectARB(data->program, data->vert_shader); + pglAttachObjectARB(data->program, data->frag_shader); + pglLinkProgramARB(data->program); - glGetObjectParameterivARB(data->program, GL_OBJECT_LINK_STATUS_ARB, &status); + pglGetObjectParameterivARB(data->program, GL_OBJECT_LINK_STATUS_ARB, &status); if (status == 0) { GLint length = 0; char *info; - glGetObjectParameterivARB(data->program, GL_OBJECT_INFO_LOG_LENGTH_ARB, &length); + pglGetObjectParameterivARB(data->program, GL_OBJECT_INFO_LOG_LENGTH_ARB, &length); info = (char *)SDL_malloc((size_t)length + 1); - if (info == NULL) { + if (!info) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory!"); } else { - glGetInfoLogARB(data->program, length, NULL, info); + pglGetInfoLogARB(data->program, length, NULL, info); SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to link program:\n%s", info); SDL_free(info); } @@ -185,16 +186,16 @@ static SDL_bool CompileShaderProgram(ShaderData *data) glGetError(); /* Create one program object to rule them all */ - data->program = glCreateProgramObjectARB(); + data->program = pglCreateProgramObjectARB(); /* Create the vertex shader */ - data->vert_shader = glCreateShaderObjectARB(GL_VERTEX_SHADER_ARB); + data->vert_shader = pglCreateShaderObjectARB(GL_VERTEX_SHADER_ARB); if (!CompileShader(data->vert_shader, data->vert_source)) { return SDL_FALSE; } /* Create the fragment shader */ - data->frag_shader = glCreateShaderObjectARB(GL_FRAGMENT_SHADER_ARB); + data->frag_shader = pglCreateShaderObjectARB(GL_FRAGMENT_SHADER_ARB); if (!CompileShader(data->frag_shader, data->frag_source)) { return SDL_FALSE; } @@ -205,16 +206,16 @@ static SDL_bool CompileShaderProgram(ShaderData *data) } /* Set up some uniform variables */ - glUseProgramObjectARB(data->program); + pglUseProgramObjectARB(data->program); for (i = 0; i < num_tmus_bound; ++i) { char tex_name[5]; (void)SDL_snprintf(tex_name, SDL_arraysize(tex_name), "tex%d", i); - location = glGetUniformLocationARB(data->program, tex_name); + location = pglGetUniformLocationARB(data->program, tex_name); if (location >= 0) { - glUniform1iARB(location, i); + pglUniform1iARB(location, i); } } - glUseProgramObjectARB(0); + pglUseProgramObjectARB(0); return (glGetError() == GL_NO_ERROR) ? SDL_TRUE : SDL_FALSE; } @@ -222,13 +223,13 @@ static SDL_bool CompileShaderProgram(ShaderData *data) static void DestroyShaderProgram(ShaderData *data) { if (shaders_supported) { - glDeleteObjectARB(data->vert_shader); - glDeleteObjectARB(data->frag_shader); - glDeleteObjectARB(data->program); + pglDeleteObjectARB(data->vert_shader); + pglDeleteObjectARB(data->frag_shader); + pglDeleteObjectARB(data->program); } } -static SDL_bool InitShaders() +static SDL_bool InitShaders(void) { int i; @@ -238,30 +239,30 @@ static SDL_bool InitShaders() SDL_GL_ExtensionSupported("GL_ARB_shading_language_100") && SDL_GL_ExtensionSupported("GL_ARB_vertex_shader") && SDL_GL_ExtensionSupported("GL_ARB_fragment_shader")) { - glAttachObjectARB = (PFNGLATTACHOBJECTARBPROC)SDL_GL_GetProcAddress("glAttachObjectARB"); - glCompileShaderARB = (PFNGLCOMPILESHADERARBPROC)SDL_GL_GetProcAddress("glCompileShaderARB"); - glCreateProgramObjectARB = (PFNGLCREATEPROGRAMOBJECTARBPROC)SDL_GL_GetProcAddress("glCreateProgramObjectARB"); - glCreateShaderObjectARB = (PFNGLCREATESHADEROBJECTARBPROC)SDL_GL_GetProcAddress("glCreateShaderObjectARB"); - glDeleteObjectARB = (PFNGLDELETEOBJECTARBPROC)SDL_GL_GetProcAddress("glDeleteObjectARB"); - glGetInfoLogARB = (PFNGLGETINFOLOGARBPROC)SDL_GL_GetProcAddress("glGetInfoLogARB"); - glGetObjectParameterivARB = (PFNGLGETOBJECTPARAMETERIVARBPROC)SDL_GL_GetProcAddress("glGetObjectParameterivARB"); - glGetUniformLocationARB = (PFNGLGETUNIFORMLOCATIONARBPROC)SDL_GL_GetProcAddress("glGetUniformLocationARB"); - glLinkProgramARB = (PFNGLLINKPROGRAMARBPROC)SDL_GL_GetProcAddress("glLinkProgramARB"); - glShaderSourceARB = (PFNGLSHADERSOURCEARBPROC)SDL_GL_GetProcAddress("glShaderSourceARB"); - glUniform1iARB = (PFNGLUNIFORM1IARBPROC)SDL_GL_GetProcAddress("glUniform1iARB"); - glUseProgramObjectARB = (PFNGLUSEPROGRAMOBJECTARBPROC)SDL_GL_GetProcAddress("glUseProgramObjectARB"); - if (glAttachObjectARB && - glCompileShaderARB && - glCreateProgramObjectARB && - glCreateShaderObjectARB && - glDeleteObjectARB && - glGetInfoLogARB && - glGetObjectParameterivARB && - glGetUniformLocationARB && - glLinkProgramARB && - glShaderSourceARB && - glUniform1iARB && - glUseProgramObjectARB) { + pglAttachObjectARB = (PFNGLATTACHOBJECTARBPROC)SDL_GL_GetProcAddress("glAttachObjectARB"); + pglCompileShaderARB = (PFNGLCOMPILESHADERARBPROC)SDL_GL_GetProcAddress("glCompileShaderARB"); + pglCreateProgramObjectARB = (PFNGLCREATEPROGRAMOBJECTARBPROC)SDL_GL_GetProcAddress("glCreateProgramObjectARB"); + pglCreateShaderObjectARB = (PFNGLCREATESHADEROBJECTARBPROC)SDL_GL_GetProcAddress("glCreateShaderObjectARB"); + pglDeleteObjectARB = (PFNGLDELETEOBJECTARBPROC)SDL_GL_GetProcAddress("glDeleteObjectARB"); + pglGetInfoLogARB = (PFNGLGETINFOLOGARBPROC)SDL_GL_GetProcAddress("glGetInfoLogARB"); + pglGetObjectParameterivARB = (PFNGLGETOBJECTPARAMETERIVARBPROC)SDL_GL_GetProcAddress("glGetObjectParameterivARB"); + pglGetUniformLocationARB = (PFNGLGETUNIFORMLOCATIONARBPROC)SDL_GL_GetProcAddress("glGetUniformLocationARB"); + pglLinkProgramARB = (PFNGLLINKPROGRAMARBPROC)SDL_GL_GetProcAddress("glLinkProgramARB"); + pglShaderSourceARB = (PFNGLSHADERSOURCEARBPROC)SDL_GL_GetProcAddress("glShaderSourceARB"); + pglUniform1iARB = (PFNGLUNIFORM1IARBPROC)SDL_GL_GetProcAddress("glUniform1iARB"); + pglUseProgramObjectARB = (PFNGLUSEPROGRAMOBJECTARBPROC)SDL_GL_GetProcAddress("glUseProgramObjectARB"); + if (pglAttachObjectARB && + pglCompileShaderARB && + pglCreateProgramObjectARB && + pglCreateShaderObjectARB && + pglDeleteObjectARB && + pglGetInfoLogARB && + pglGetObjectParameterivARB && + pglGetUniformLocationARB && + pglLinkProgramARB && + pglShaderSourceARB && + pglUniform1iARB && + pglUseProgramObjectARB) { shaders_supported = SDL_TRUE; } } @@ -282,7 +283,7 @@ static SDL_bool InitShaders() return SDL_TRUE; } -static void QuitShaders() +static void QuitShaders(void) { int i; @@ -329,7 +330,7 @@ SDL_GL_LoadTexture(SDL_Surface *surface, GLfloat *texcoord) 0x00FF0000, 0x0000FF00, 0x000000FF #endif ); - if (image == NULL) { + if (!image) { return 0; } @@ -420,7 +421,7 @@ void DrawGLScene(SDL_Window *window, GLuint texture, GLfloat *texcoord) glBindTexture(GL_TEXTURE_2D, texture); glColor3f(1.0f, 1.0f, 1.0f); if (shaders_supported) { - glUseProgramObjectARB(shaders[current_shader].program); + pglUseProgramObjectARB(shaders[current_shader].program); } glBegin(GL_QUADS); /* start drawing a polygon (4 sided) */ @@ -435,7 +436,7 @@ void DrawGLScene(SDL_Window *window, GLuint texture, GLfloat *texcoord) glEnd(); /* done with the polygon */ if (shaders_supported) { - glUseProgramObjectARB(0); + pglUseProgramObjectARB(0); } glDisable(GL_TEXTURE_2D); @@ -462,7 +463,7 @@ int main(int argc, char **argv) /* Create a 640x480 OpenGL screen */ window = SDL_CreateWindow("Shader Demo", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 640, 480, SDL_WINDOW_OPENGL); - if (window == NULL) { + if (!window) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Unable to create OpenGL window: %s\n", SDL_GetError()); SDL_Quit(); exit(2); @@ -475,7 +476,7 @@ int main(int argc, char **argv) } surface = SDL_LoadBMP("icon.bmp"); - if (surface == NULL) { + if (!surface) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Unable to load icon.bmp: %s\n", SDL_GetError()); SDL_Quit(); exit(3); diff --git a/thirdparty/SDL/test/testshape.c b/thirdparty/SDL/test/testshape.c index 4e3c12cdd..112ec0c60 100644 --- a/thirdparty/SDL/test/testshape.c +++ b/thirdparty/SDL/test/testshape.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -71,7 +71,7 @@ int main(int argc, char **argv) num_pictures = argc - 1; pictures = (LoadedPicture *)SDL_malloc(sizeof(LoadedPicture) * num_pictures); - if (pictures == NULL) { + if (!pictures) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Could not allocate memory."); exit(1); } @@ -106,7 +106,7 @@ int main(int argc, char **argv) SHAPED_WINDOW_DIMENSION, SHAPED_WINDOW_DIMENSION, 0); SDL_SetWindowPosition(window, SHAPED_WINDOW_X, SHAPED_WINDOW_Y); - if (window == NULL) { + if (!window) { for (i = 0; i < num_pictures; i++) { SDL_FreeSurface(pictures[i].surface); } @@ -116,7 +116,7 @@ int main(int argc, char **argv) exit(-4); } renderer = SDL_CreateRenderer(window, -1, 0); - if (renderer == NULL) { + if (!renderer) { SDL_DestroyWindow(window); for (i = 0; i < num_pictures; i++) { SDL_FreeSurface(pictures[i].surface); diff --git a/thirdparty/SDL/test/testsprite2.c b/thirdparty/SDL/test/testsprite2.c index 89037fd09..8be33907d 100644 --- a/thirdparty/SDL/test/testsprite2.c +++ b/thirdparty/SDL/test/testsprite2.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -392,22 +392,30 @@ void MoveSprites(SDL_Renderer *renderer, SDL_Texture *sprite) SDL_RenderPresent(renderer); } -void loop() +static void MoveAllSprites(void) { - Uint32 now; int i; - SDL_Event event; - /* Check for events */ - while (SDL_PollEvent(&event)) { - SDLTest_CommonEvent(state, &event, &done); - } for (i = 0; i < state->num_windows; ++i) { if (state->windows[i] == NULL) { continue; } MoveSprites(state->renderers[i], sprites[i]); } +} + +void loop(void) +{ + Uint32 now; + SDL_Event event; + + /* Check for events */ + while (SDL_PollEvent(&event)) { + SDLTest_CommonEvent(state, &event, &done); + } + + MoveAllSprites(); + #ifdef __EMSCRIPTEN__ if (done) { emscripten_cancel_main_loop(); @@ -426,6 +434,14 @@ void loop() } } +static int SDLCALL ExposeEventWatcher(void *userdata, SDL_Event *event) +{ + if (event->type == SDL_WINDOWEVENT && event->window.event == SDL_WINDOWEVENT_EXPOSED) { + MoveAllSprites(); + } + return 0; +} + int main(int argc, char *argv[]) { int i; @@ -437,7 +453,7 @@ int main(int argc, char *argv[]) /* Initialize test framework */ state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO); - if (state == NULL) { + if (!state) { return 1; } @@ -525,7 +541,7 @@ int main(int argc, char *argv[]) /* Create the windows, initialize the renderers, and load the textures */ sprites = (SDL_Texture **)SDL_malloc(state->num_windows * sizeof(*sprites)); - if (sprites == NULL) { + if (!sprites) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory!\n"); quit(2); } @@ -541,7 +557,7 @@ int main(int argc, char *argv[]) /* Allocate memory for the sprite info */ positions = (SDL_Rect *)SDL_malloc(num_sprites * sizeof(SDL_Rect)); velocities = (SDL_Rect *)SDL_malloc(num_sprites * sizeof(SDL_Rect)); - if (positions == NULL || velocities == NULL) { + if (!positions || !velocities) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory!\n"); quit(2); } @@ -568,6 +584,9 @@ int main(int argc, char *argv[]) } } + /* Add an event watcher to redraw from within modal window resize/move loops */ + SDL_AddEventWatch(ExposeEventWatcher, NULL); + /* Main render loop */ frames = 0; next_fps_check = SDL_GetTicks() + fps_check_delay; diff --git a/thirdparty/SDL/test/testspriteminimal.c b/thirdparty/SDL/test/testspriteminimal.c index 16b4fa4a3..56f626324 100644 --- a/thirdparty/SDL/test/testspriteminimal.c +++ b/thirdparty/SDL/test/testspriteminimal.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -43,7 +43,7 @@ quit(int rc) exit(rc); } -void MoveSprites() +void MoveSprites(void) { int i; int window_w = WINDOW_WIDTH; @@ -77,7 +77,7 @@ void MoveSprites() SDL_RenderPresent(renderer); } -void loop() +void loop(void) { SDL_Event event; @@ -109,7 +109,7 @@ int main(int argc, char *argv[]) sprite = LoadTexture(renderer, "icon.bmp", SDL_TRUE, &sprite_w, &sprite_h); - if (sprite == NULL) { + if (!sprite) { quit(2); } diff --git a/thirdparty/SDL/test/teststreaming.c b/thirdparty/SDL/test/teststreaming.c index 15c1aefea..7931d2281 100644 --- a/thirdparty/SDL/test/teststreaming.c +++ b/thirdparty/SDL/test/teststreaming.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -94,7 +94,7 @@ void UpdateTexture(SDL_Texture *texture) SDL_UnlockTexture(texture); } -void loop() +void loop(void) { SDL_Event event; @@ -141,13 +141,13 @@ int main(int argc, char **argv) /* load the moose images */ filename = GetResourceFilename(NULL, "moose.dat"); - if (filename == NULL) { + if (!filename) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory\n"); return -1; } handle = SDL_RWFromFile(filename, "rb"); SDL_free(filename); - if (handle == NULL) { + if (!handle) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Can't find the file moose.dat !\n"); quit(2); } @@ -160,19 +160,19 @@ int main(int argc, char **argv) SDL_WINDOWPOS_UNDEFINED, MOOSEPIC_W * 4, MOOSEPIC_H * 4, SDL_WINDOW_RESIZABLE); - if (window == NULL) { + if (!window) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't set create window: %s\n", SDL_GetError()); quit(3); } renderer = SDL_CreateRenderer(window, -1, 0); - if (renderer == NULL) { + if (!renderer) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't set create renderer: %s\n", SDL_GetError()); quit(4); } MooseTexture = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STREAMING, MOOSEPIC_W, MOOSEPIC_H); - if (MooseTexture == NULL) { + if (!MooseTexture) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't set create texture: %s\n", SDL_GetError()); quit(5); } diff --git a/thirdparty/SDL/test/testsurround.c b/thirdparty/SDL/test/testsurround.c index b28436977..b7dc7d781 100644 --- a/thirdparty/SDL/test/testsurround.c +++ b/thirdparty/SDL/test/testsurround.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/test/testthread.c b/thirdparty/SDL/test/testthread.c index f6d967560..5ceac05ff 100644 --- a/thirdparty/SDL/test/testthread.c +++ b/thirdparty/SDL/test/testthread.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -114,7 +114,7 @@ int main(int argc, char *argv[]) alive = 1; thread = SDL_CreateThread(ThreadFunc, "One", "#1"); - if (thread == NULL) { + if (!thread) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create thread: %s\n", SDL_GetError()); quit(1); } @@ -128,7 +128,7 @@ int main(int argc, char *argv[]) alive = 1; (void)signal(SIGTERM, killed); thread = SDL_CreateThread(ThreadFunc, "Two", "#2"); - if (thread == NULL) { + if (!thread) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create thread: %s\n", SDL_GetError()); quit(1); } diff --git a/thirdparty/SDL/test/testtimer.c b/thirdparty/SDL/test/testtimer.c index 54a903ad0..eea9730c5 100644 --- a/thirdparty/SDL/test/testtimer.c +++ b/thirdparty/SDL/test/testtimer.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -18,9 +18,38 @@ #include #include "SDL.h" +#include "SDL_test.h" #define DEFAULT_RESOLUTION 1 +static int test_sdl_delay_within_bounds(void) { + const int testDelay = 100; + const int marginOfError = 25; + Uint64 result; + Uint64 result2; + Sint64 difference; + + SDLTest_ResetAssertSummary(); + + /* Get ticks count - should be non-zero by now */ + result = SDL_GetTicks(); + SDLTest_AssertPass("Call to SDL_GetTicks()"); + SDLTest_AssertCheck(result > 0, "Check result value, expected: >0, got: %" SDL_PRIu64, result); + + /* Delay a bit longer and measure ticks and verify difference */ + SDL_Delay(testDelay); + SDLTest_AssertPass("Call to SDL_Delay(%d)", testDelay); + result2 = SDL_GetTicks(); + SDLTest_AssertPass("Call to SDL_GetTicks()"); + SDLTest_AssertCheck(result2 > 0, "Check result value, expected: >0, got: %" SDL_PRIu64, result2); + difference = result2 - result; + SDLTest_AssertCheck(difference > (testDelay - marginOfError), "Check difference, expected: >%d, got: %" SDL_PRIu64, testDelay - marginOfError, difference); + /* Disabled because this might fail on non-interactive systems. */ + SDLTest_AssertCheck(difference < (testDelay + marginOfError), "Check difference, expected: <%d, got: %" SDL_PRIu64, testDelay + marginOfError, difference); + + return SDLTest_AssertSummaryToTestResult() == TEST_RESULT_PASSED ? 0 : 1; +} + static int ticks = 0; static Uint32 SDLCALL @@ -39,15 +68,43 @@ callback(Uint32 interval, void *param) int main(int argc, char *argv[]) { - int i, desired; + int i; + int desired = -1; SDL_TimerID t1, t2, t3; Uint64 start64, now64; Uint32 start32, now32; Uint64 start, now; + SDL_bool run_interactive_tests = SDL_FALSE; + int return_code = 0; /* Enable standard application logging */ SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO); + /* Parse commandline */ + for (i = 1; i < argc;) { + int consumed = 0; + + if (!consumed) { + if (SDL_strcmp(argv[i], "--interactive") == 0) { + run_interactive_tests = SDL_TRUE; + consumed = 1; + } else if (desired < 0) { + char *endptr; + + desired = SDL_strtoul(argv[i], &endptr, 0); + if (desired != 0 && endptr != argv[i] && *endptr == '\0') { + consumed = 1; + } + } + } + if (consumed <= 0) { + SDL_Log("Usage: %s [--interactive] [interval]", argv[0]); + return 1; + } + + i += consumed; + } + if (SDL_Init(SDL_INIT_TIMER) < 0) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError()); return 1; @@ -74,14 +131,11 @@ int main(int argc, char *argv[]) } } - /* Start the timer */ - desired = 0; - if (argv[1]) { - desired = SDL_atoi(argv[1]); - } - if (desired == 0) { + if (desired < 0) { desired = DEFAULT_RESOLUTION; } + + /* Start the timer */ t1 = SDL_AddTimer(desired, ticktock, NULL); /* Wait 10 seconds */ @@ -102,14 +156,17 @@ int main(int argc, char *argv[]) t1 = SDL_AddTimer(100, callback, (void *)1); if (!t1) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Could not create timer 1: %s\n", SDL_GetError()); + return_code = 1; } t2 = SDL_AddTimer(50, callback, (void *)2); if (!t2) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Could not create timer 2: %s\n", SDL_GetError()); + return_code = 1; } t3 = SDL_AddTimer(233, callback, (void *)3); if (!t3) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Could not create timer 3: %s\n", SDL_GetError()); + return_code = 1; } /* Wait 10 seconds */ @@ -141,8 +198,11 @@ int main(int argc, char *argv[]) now32 = SDL_GetTicks(); SDL_Log("Delay 1 second = %d ms in ticks, %d ms in ticks64, %f ms according to performance counter\n", (int)(now32 - start32), (int)(now64 - start64), (double)((now - start) * 1000) / SDL_GetPerformanceFrequency()); + if (run_interactive_tests) { + return_code |= test_sdl_delay_within_bounds(); + } SDL_Quit(); - return 0; + return return_code; } /* vi: set ts=4 sw=4 expandtab: */ diff --git a/thirdparty/SDL/test/testurl.c b/thirdparty/SDL/test/testurl.c index ef22083ff..2008186f3 100644 --- a/thirdparty/SDL/test/testurl.c +++ b/thirdparty/SDL/test/testurl.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/test/testutils.c b/thirdparty/SDL/test/testutils.c index 20efef027..3b76ea833 100644 --- a/thirdparty/SDL/test/testutils.c +++ b/thirdparty/SDL/test/testutils.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga Copyright 2022 Collabora Ltd. This software is provided 'as-is', without any express or implied @@ -28,13 +28,13 @@ GetNearbyFilename(const char *file) base = SDL_GetBasePath(); - if (base != NULL) { + if (base) { SDL_RWops *rw; size_t len = SDL_strlen(base) + SDL_strlen(file) + 1; path = SDL_malloc(len); - if (path == NULL) { + if (!path) { SDL_free(base); SDL_OutOfMemory(); return NULL; @@ -54,7 +54,7 @@ GetNearbyFilename(const char *file) } path = SDL_strdup(file); - if (path == NULL) { + if (!path) { SDL_OutOfMemory(); } return path; @@ -72,10 +72,10 @@ GetNearbyFilename(const char *file) char * GetResourceFilename(const char *user_specified, const char *def) { - if (user_specified != NULL) { + if (user_specified) { char *ret = SDL_strdup(user_specified); - if (ret == NULL) { + if (!ret) { SDL_OutOfMemory(); } @@ -105,12 +105,12 @@ LoadTexture(SDL_Renderer *renderer, const char *file, SDL_bool transparent, path = GetNearbyFilename(file); - if (path != NULL) { + if (path) { file = path; } temp = SDL_LoadBMP(file); - if (temp == NULL) { + if (!temp) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s", file, SDL_GetError()); } else { /* Set transparent pixel as the pixel at (0,0) */ @@ -137,16 +137,16 @@ LoadTexture(SDL_Renderer *renderer, const char *file, SDL_bool transparent, } } - if (width_out != NULL) { + if (width_out) { *width_out = temp->w; } - if (height_out != NULL) { + if (height_out) { *height_out = temp->h; } texture = SDL_CreateTextureFromSurface(renderer, temp); - if (texture == NULL) { + if (!texture) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create texture: %s\n", SDL_GetError()); } } diff --git a/thirdparty/SDL/test/testutils.h b/thirdparty/SDL/test/testutils.h index 1f69673ce..a10aaadd3 100644 --- a/thirdparty/SDL/test/testutils.h +++ b/thirdparty/SDL/test/testutils.h @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga Copyright 2022 Collabora Ltd. This software is provided 'as-is', without any express or implied diff --git a/thirdparty/SDL/test/testver.c b/thirdparty/SDL/test/testver.c index eeecb14a6..409b1f12f 100644 --- a/thirdparty/SDL/test/testver.c +++ b/thirdparty/SDL/test/testver.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/test/testviewport.c b/thirdparty/SDL/test/testviewport.c index 932f24832..1e866d342 100644 --- a/thirdparty/SDL/test/testviewport.c +++ b/thirdparty/SDL/test/testviewport.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -95,7 +95,7 @@ void DrawOnViewport(SDL_Renderer *renderer) SDL_RenderSetClipRect(renderer, NULL); } -void loop() +void loop(void) { SDL_Event event; int i; @@ -152,7 +152,7 @@ int main(int argc, char *argv[]) /* Initialize test framework */ state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO); - if (state == NULL) { + if (!state) { return 1; } @@ -180,7 +180,7 @@ int main(int argc, char *argv[]) sprite = LoadTexture(state->renderers[0], "icon.bmp", SDL_TRUE, &sprite_w, &sprite_h); - if (sprite == NULL) { + if (!sprite) { quit(2); } diff --git a/thirdparty/SDL/test/testvulkan.c b/thirdparty/SDL/test/testvulkan.c index acdde28fd..8a4ac8934 100644 --- a/thirdparty/SDL/test/testvulkan.c +++ b/thirdparty/SDL/test/testvulkan.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -236,7 +236,7 @@ static void createInstance(void) quit(2); } extensions = (const char **)SDL_malloc(sizeof(const char *) * extensionCount); - if (extensions == NULL) { + if (!extensions) { SDL_OutOfMemory(); quit(2); } @@ -312,7 +312,7 @@ static void findPhysicalDevice(void) quit(2); } physicalDevices = (VkPhysicalDevice *)SDL_malloc(sizeof(VkPhysicalDevice) * physicalDeviceCount); - if (physicalDevices == NULL) { + if (!physicalDevices) { SDL_OutOfMemory(); quit(2); } @@ -346,7 +346,7 @@ static void findPhysicalDevice(void) SDL_free(queueFamiliesProperties); queueFamiliesPropertiesAllocatedSize = queueFamiliesCount; queueFamiliesProperties = (VkQueueFamilyProperties *)SDL_malloc(sizeof(VkQueueFamilyProperties) * queueFamiliesPropertiesAllocatedSize); - if (queueFamiliesProperties == NULL) { + if (!queueFamiliesProperties) { SDL_free(physicalDevices); SDL_free(deviceExtensions); SDL_OutOfMemory(); @@ -408,7 +408,7 @@ static void findPhysicalDevice(void) SDL_free(deviceExtensions); deviceExtensionsAllocatedSize = deviceExtensionCount; deviceExtensions = SDL_malloc(sizeof(VkExtensionProperties) * deviceExtensionsAllocatedSize); - if (deviceExtensions == NULL) { + if (!deviceExtensions) { SDL_free(physicalDevices); SDL_free(queueFamiliesProperties); SDL_OutOfMemory(); @@ -929,7 +929,7 @@ static void initVulkan(void) SDL_Vulkan_LoadLibrary(NULL); vulkanContexts = (VulkanContext *)SDL_calloc(state->num_windows, sizeof(VulkanContext)); - if (vulkanContexts == NULL) { + if (!vulkanContexts) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory!"); quit(2); } @@ -1092,7 +1092,7 @@ int main(int argc, char **argv) /* Initialize test framework */ state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO); - if (state == NULL) { + if (!state) { return 1; } diff --git a/thirdparty/SDL/test/testwm2.c b/thirdparty/SDL/test/testwm2.c index 7fc189bd7..6d8e02542 100644 --- a/thirdparty/SDL/test/testwm2.c +++ b/thirdparty/SDL/test/testwm2.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -143,7 +143,7 @@ draw_modes_menu(SDL_Window *window, SDL_Renderer *renderer, SDL_Rect viewport) } } -void loop() +void loop(void) { int i; SDL_Event event; @@ -208,7 +208,7 @@ void loop() } if (event.type == SDL_MOUSEBUTTONUP) { SDL_Window *window = SDL_GetMouseFocus(); - if (highlighted_mode != -1 && window != NULL) { + if (highlighted_mode != -1 && window) { const int display_index = SDL_GetWindowDisplayIndex(window); SDL_DisplayMode mode; if (0 != SDL_GetDisplayMode(display_index, highlighted_mode, &mode)) { @@ -223,7 +223,7 @@ void loop() for (i = 0; i < state->num_windows; ++i) { SDL_Window *window = state->windows[i]; SDL_Renderer *renderer = state->renderers[i]; - if (window != NULL && renderer != NULL) { + if (window && renderer) { int y = 0; SDL_Rect viewport, menurect; @@ -262,7 +262,7 @@ int main(int argc, char *argv[]) /* Initialize test framework */ state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO); - if (state == NULL) { + if (!state) { return 1; } diff --git a/thirdparty/SDL/test/testyuv.c b/thirdparty/SDL/test/testyuv.c index e7373a8b1..e9038ed0d 100644 --- a/thirdparty/SDL/test/testyuv.c +++ b/thirdparty/SDL/test/testyuv.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -75,7 +75,7 @@ static SDL_bool verify_yuv_data(Uint32 format, const Uint8 *yuv, int yuv_pitch, SDL_bool result = SDL_FALSE; rgb = (Uint8 *)SDL_malloc(size); - if (rgb == NULL) { + if (!rgb) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory"); return SDL_FALSE; } @@ -126,7 +126,7 @@ static int run_automated_tests(int pattern_size, int extra_pitch) int yuv1_pitch, yuv2_pitch; int result = -1; - if (pattern == NULL || yuv1 == NULL || yuv2 == NULL) { + if (!pattern || !yuv1 || !yuv2) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't allocate test surfaces"); goto done; } @@ -327,7 +327,7 @@ int main(int argc, char **argv) filename = "testyuv.bmp"; } original = SDL_ConvertSurfaceFormat(SDL_LoadBMP(filename), SDL_PIXELFORMAT_RGB24, 0); - if (original == NULL) { + if (!original) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s\n", filename, SDL_GetError()); return 3; } @@ -339,7 +339,7 @@ int main(int argc, char **argv) pitch = CalculateYUVPitch(yuv_format, original->w); converted = SDL_CreateRGBSurfaceWithFormat(0, original->w, original->h, 0, rgb_format); - if (converted == NULL) { + if (!converted) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create converted surface: %s\n", SDL_GetError()); return 3; } @@ -356,13 +356,13 @@ int main(int argc, char **argv) SDL_WINDOWPOS_UNDEFINED, original->w, original->h, 0); - if (window == NULL) { + if (!window) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create window: %s\n", SDL_GetError()); return 4; } renderer = SDL_CreateRenderer(window, -1, 0); - if (renderer == NULL) { + if (!renderer) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create renderer: %s\n", SDL_GetError()); return 4; } diff --git a/thirdparty/SDL/test/testyuv_cvt.c b/thirdparty/SDL/test/testyuv_cvt.c index 3bd2df3ff..d78e5b196 100644 --- a/thirdparty/SDL/test/testyuv_cvt.c +++ b/thirdparty/SDL/test/testyuv_cvt.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/test/testyuv_cvt.h b/thirdparty/SDL/test/testyuv_cvt.h index 781b632ea..fa736be3c 100644 --- a/thirdparty/SDL/test/testyuv_cvt.h +++ b/thirdparty/SDL/test/testyuv_cvt.h @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/test/torturethread.c b/thirdparty/SDL/test/torturethread.c index 1976800f0..b612cda49 100644 --- a/thirdparty/SDL/test/torturethread.c +++ b/thirdparty/SDL/test/torturethread.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2023 Sam Lantinga + Copyright (C) 1997-2024 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/thirdparty/SDL/test/watcom.mif b/thirdparty/SDL/test/watcom.mif index 2189fd49c..aa15f6695 100644 --- a/thirdparty/SDL/test/watcom.mif +++ b/thirdparty/SDL/test/watcom.mif @@ -53,12 +53,13 @@ TASRCS = testautomation.c & testautomation_audio.c testautomation_clipboard.c & testautomation_events.c testautomation_guid.c & testautomation_hints.c testautomation_joystick.c & - testautomation_keyboard.c testautomation_main.c & - testautomation_math.c testautomation_mouse.c & - testautomation_pixels.c testautomation_platform.c & - testautomation_rect.c testautomation_render.c & - testautomation_rwops.c testautomation_sdltest.c & - testautomation_stdlib.c testautomation_surface.c & + testautomation_keyboard.c testautomation_log.c & + testautomation_main.c testautomation_math.c & + testautomation_mouse.c testautomation_pixels.c & + testautomation_platform.c testautomation_rect.c & + testautomation_render.c testautomation_rwops.c & + testautomation_sdltest.c testautomation_stdlib.c & + testautomation_subsystems.c testautomation_surface.c & testautomation_syswm.c testautomation_timer.c & testautomation_video.c @@ -69,8 +70,6 @@ TNOBJS = $(TNSRCS:.c=.obj) all: testutils.lib $(TARGETS) -.c: ../src/test - .obj.exe: wlink SYS $(SYSTEM) libpath $(LIBPATH) lib {$(LIBS)} op q op el file {$<} name $@ @@ -82,6 +81,9 @@ testvulkan.obj: testvulkan.c # new vulkan headers result in lots of W202 warnings wcc386 $(CFLAGS) -wcd=202 -fo=$^@ $< +testautomation_stdlib.obj: testautomation_stdlib.c + wcc386 $(CFLAGS) -wcd=201 -fo=$^@ $< + testautomation.exe: $(TAOBJS) wlink SYS $(SYSTEM) libpath $(LIBPATH) lib {$(LIBS)} op q op el file {$<} name $@ @@ -106,14 +108,14 @@ testutils.lib: testutils.obj check: .SYMBOLIC $(TESTS) @set SDL_AUDIODRIVER=dummy @set SDL_VIDEODRIVER=dummy - @copy "../SDL2.dll" . + @copy ..\SDL2.dll . @for %exe in ($(TESTS)) do %exe check-quick: .SYMBOLIC $(TESTS) @set SDL_TESTS_QUICK=1 @set SDL_AUDIODRIVER=dummy @set SDL_VIDEODRIVER=dummy - @copy "../SDL2.dll" . + @copy ..\SDL2.dll . @for %exe in ($(TESTS)) do %exe clean: .SYMBOLIC diff --git a/thirdparty/glfw/.appveyor.yml b/thirdparty/glfw/.appveyor.yml new file mode 100644 index 000000000..c58911ccf --- /dev/null +++ b/thirdparty/glfw/.appveyor.yml @@ -0,0 +1,47 @@ +image: + - Visual Studio 2015 +branches: + only: + - ci + - master + - latest + - 3.3-stable +skip_tags: true +environment: + matrix: + - GENERATOR: MinGW Makefiles + BUILD_SHARED_LIBS: ON + CFLAGS: -Werror + - GENERATOR: MinGW Makefiles + BUILD_SHARED_LIBS: OFF + CFLAGS: -Werror + - GENERATOR: Visual Studio 12 2013 + BUILD_SHARED_LIBS: ON + CFLAGS: /WX + - GENERATOR: Visual Studio 12 2013 + BUILD_SHARED_LIBS: OFF + CFLAGS: /WX +matrix: + fast_finish: true +for: +- + matrix: + only: + - GENERATOR: MinGW Makefiles + build_script: + - set PATH=%PATH:C:\Program Files\Git\usr\bin=C:\MinGW\bin% + - cmake -B build -G "%GENERATOR%" -DBUILD_SHARED_LIBS=%BUILD_SHARED_LIBS% + - cmake --build build +- + matrix: + only: + - GENERATOR: Visual Studio 12 2013 + build_script: + - cmake -B build -G "%GENERATOR%" -DBUILD_SHARED_LIBS=%BUILD_SHARED_LIBS% + - cmake --build build --target glfw +notifications: + - provider: Email + to: + - ci@glfw.org + on_build_failure: true + on_build_success: false diff --git a/thirdparty/glfw/.editorconfig b/thirdparty/glfw/.editorconfig new file mode 100644 index 000000000..2b44e7b2e --- /dev/null +++ b/thirdparty/glfw/.editorconfig @@ -0,0 +1,67 @@ +# EditorConfig for GLFW and its internal dependencies +# +# All files created by GLFW should indent with four spaces unless their format requires +# otherwise. A few files still use other indent styles for historical reasons. +# +# Dependencies have (what seemed to be) their existing styles described. Those with +# existing trailing whitespace have it preserved to avoid cluttering future commits. + +root = true + +[*] +charset = utf-8 +end_of_line = lf + +[include/GLFW/*.h] +indent_style = space +indent_size = 4 + +[{src,examples,tests}/*.{c,m,h,rc,in}] +indent_style = space +indent_size = 4 + +[CMakeLists.txt] +indent_style = space +indent_size = 4 + +[CMake/**.{cmake,in}] +indent_style = space +indent_size = 4 + +[*.{md}] +indent_style = space +indent_size = 4 +trim_trailing_whitespace = false + +[DoxygenLayout.xml] +indent_style = space +indent_size = 2 + +[docs/*.{scss,html}] +indent_style = tab +indent_size = unset + +[deps/mingw/*.h] +indent_style = space +indent_size = 4 +tab_width = 8 +trim_trailing_whitespace = false + +[deps/getopt.{c,h}] +indent_style = space +indent_size = 2 + +[deps/linmath.h] +indent_style = tab +tab_width = 4 +indent_size = 4 +trim_trailing_whitespace = false + +[deps/nuklear*.h] +indent_style = space +indent_size = 4 + +[deps/tinycthread.{c,h}] +indent_style = space +indent_size = 2 + diff --git a/thirdparty/glfw/.gitattributes b/thirdparty/glfw/.gitattributes new file mode 100644 index 000000000..805f4036b --- /dev/null +++ b/thirdparty/glfw/.gitattributes @@ -0,0 +1,5 @@ +*.m linguist-language=Objective-C +.gitignore export-ignore +.gitattributes export-ignore +.travis.yml export-ignore +.appveyor.yml export-ignore diff --git a/thirdparty/glfw/.github/CODEOWNERS b/thirdparty/glfw/.github/CODEOWNERS new file mode 100644 index 000000000..585b20901 --- /dev/null +++ b/thirdparty/glfw/.github/CODEOWNERS @@ -0,0 +1,8 @@ + +* @elmindreda + +docs/*.css @glfw/webdev +docs/*.scss @glfw/webdev +docs/*.html @glfw/webdev +docs/*.xml @glfw/webdev + diff --git a/thirdparty/glfw/.github/workflows/build.yml b/thirdparty/glfw/.github/workflows/build.yml new file mode 100644 index 000000000..e980c5479 --- /dev/null +++ b/thirdparty/glfw/.github/workflows/build.yml @@ -0,0 +1,100 @@ +name: Build +on: + pull_request: + push: + branches: [ ci, master, latest, 3.3-stable ] + workflow_dispatch: +permissions: + statuses: write + contents: read + +jobs: + build-linux-clang: + name: Linux (Clang) + runs-on: ubuntu-latest + timeout-minutes: 4 + env: + CC: clang + CFLAGS: -Werror + steps: + - uses: actions/checkout@v4 + - name: Install dependencies + run: | + sudo apt update + sudo apt install libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libxext-dev libwayland-dev libxkbcommon-dev + + - name: Configure Null shared library + run: cmake -B build-null-shared -D GLFW_BUILD_WAYLAND=OFF -D GLFW_BUILD_X11=OFF -D BUILD_SHARED_LIBS=ON + - name: Build Null shared library + run: cmake --build build-null-shared --parallel + + - name: Configure X11 shared library + run: cmake -B build-x11-shared -D GLFW_BUILD_WAYLAND=OFF -D GLFW_BUILD_X11=ON -D BUILD_SHARED_LIBS=ON + - name: Build X11 shared library + run: cmake --build build-x11-shared --parallel + + - name: Configure Wayland shared library + run: cmake -B build-wayland-shared -D GLFW_BUILD_WAYLAND=ON -D GLFW_BUILD_X11=OFF -D BUILD_SHARED_LIBS=ON + - name: Build Wayland shared library + run: cmake --build build-wayland-shared --parallel + + - name: Configure Wayland+X11 static library + run: cmake -B build-full-static -D GLFW_BUILD_WAYLAND=ON -D GLFW_BUILD_X11=ON + - name: Build Wayland+X11 static library + run: cmake --build build-full-static --parallel + + - name: Configure Wayland+X11 shared library + run: cmake -B build-full-shared -D GLFW_BUILD_WAYLAND=ON -D BUILD_SHARED_LIBS=ON -D GLFW_BUILD_X11=ON + - name: Build Wayland+X11 shared library + run: cmake --build build-full-shared --parallel + + build-macos-clang: + name: macOS (Clang) + runs-on: macos-latest + timeout-minutes: 4 + env: + CFLAGS: -Werror + MACOSX_DEPLOYMENT_TARGET: 10.8 + CMAKE_OSX_ARCHITECTURES: x86_64;arm64 + steps: + - uses: actions/checkout@v4 + + - name: Configure Null shared library + run: cmake -B build-null-shared -D GLFW_BUILD_COCOA=OFF -D BUILD_SHARED_LIBS=ON + - name: Build Null shared library + run: cmake --build build-null-shared --parallel + + - name: Configure Cocoa static library + run: cmake -B build-cocoa-static + - name: Build Cocoa static library + run: cmake --build build-cocoa-static --parallel + + - name: Configure Cocoa shared library + run: cmake -B build-cocoa-shared -D BUILD_SHARED_LIBS=ON + - name: Build Cocoa shared library + run: cmake --build build-cocoa-shared --parallel + + build-windows-vs2022: + name: Windows (VS2022) + runs-on: windows-latest + timeout-minutes: 4 + env: + CFLAGS: /WX + steps: + - uses: actions/checkout@v4 + + - name: Configure Win32 shared x86 library + run: cmake -B build-win32-shared-x86 -G "Visual Studio 17 2022" -A Win32 -D BUILD_SHARED_LIBS=ON + - name: Build Win32 shared x86 library + run: cmake --build build-win32-shared-x86 --parallel + + - name: Configure Win32 static x64 library + run: cmake -B build-win32-static-x64 -G "Visual Studio 17 2022" -A x64 + - name: Build Win32 static x64 library + run: cmake --build build-win32-static-x64 --parallel + + - name: Configure Win32 shared x64 library + run: cmake -B build-win32-shared-x64 -G "Visual Studio 17 2022" -A x64 -D BUILD_SHARED_LIBS=ON + - name: Build Win32 shared x64 library + run: cmake --build build-win32-shared-x64 --parallel + diff --git a/thirdparty/glfw/.gitignore b/thirdparty/glfw/.gitignore new file mode 100644 index 000000000..9d2d504b2 --- /dev/null +++ b/thirdparty/glfw/.gitignore @@ -0,0 +1,104 @@ +# The canonical out-of-tree build subdirectory +build +build-* + +# Visual Studio clutter +_ReSharper* +*.sdf +*.suo +*.dir +*.vcxproj* +*.sln +.vs +CMakeSettings.json +Win32 +x64 +Debug +Release +MinSizeRel +RelWithDebInfo +*.opensdf + +# Xcode clutter +GLFW.build +GLFW.xcodeproj + +# macOS clutter +.DS_Store + +# Makefile generator clutter +Makefile + +# Ninja generator clutter +build.ninja +rules.ninja +.ninja_deps +.ninja_log + +# CMake clutter +CMakeCache.txt +CMakeFiles +CMakeScripts +CMakeDoxyfile.in +CMakeDoxygenDefaults.cmake +cmake_install.cmake +cmake_uninstall.cmake + +# Generated files +docs/Doxyfile +docs/html +docs/warnings.txt +docs/doxygen_sqlite3.db +src/glfw_config.h +src/glfw3.pc +src/glfw3Config.cmake +src/glfw3ConfigVersion.cmake + +# Compiled binaries +src/libglfw.so +src/libglfw.so.3 +src/libglfw.so.3.4 +src/libglfw.dylib +src/libglfw.dylib +src/libglfw.3.dylib +src/libglfw.3.4.dylib +src/libglfw3.a +src/glfw3.lib +src/glfw3.dll +src/glfw3dll.lib +src/libglfw3dll.a +examples/*.app +examples/*.exe +examples/boing +examples/gears +examples/heightmap +examples/offscreen +examples/particles +examples/splitview +examples/sharing +examples/triangle-opengl +examples/wave +examples/windows +tests/*.app +tests/*.exe +tests/clipboard +tests/cursor +tests/empty +tests/events +tests/gamma +tests/glfwinfo +tests/icon +tests/iconify +tests/inputlag +tests/joysticks +tests/monitors +tests/msaa +tests/reopen +tests/tearing +tests/threads +tests/timeout +tests/title +tests/triangle-vulkan +tests/window +tests/windows + diff --git a/thirdparty/glfw/.mailmap b/thirdparty/glfw/.mailmap new file mode 100644 index 000000000..96d8a9b77 --- /dev/null +++ b/thirdparty/glfw/.mailmap @@ -0,0 +1,10 @@ +Camilla Löwy +Camilla Löwy +Camilla Löwy + +Emmanuel Gil Peyrot + +Marcus Geelnard +Marcus Geelnard +Marcus Geelnard + diff --git a/thirdparty/glfw/CMake/GenerateMappings.cmake b/thirdparty/glfw/CMake/GenerateMappings.cmake index 47e63741d..c8c9e23f2 100644 --- a/thirdparty/glfw/CMake/GenerateMappings.cmake +++ b/thirdparty/glfw/CMake/GenerateMappings.cmake @@ -26,19 +26,19 @@ foreach(line ${lines}) if (line MATCHES "^[0-9a-fA-F]") if (line MATCHES "platform:Windows") if (GLFW_WIN32_MAPPINGS) - set(GLFW_WIN32_MAPPINGS "${GLFW_WIN32_MAPPINGS}\n") + string(APPEND GLFW_WIN32_MAPPINGS "\n") endif() - set(GLFW_WIN32_MAPPINGS "${GLFW_WIN32_MAPPINGS}\"${line}\",") + string(APPEND GLFW_WIN32_MAPPINGS "\"${line}\",") elseif (line MATCHES "platform:Mac OS X") if (GLFW_COCOA_MAPPINGS) - set(GLFW_COCOA_MAPPINGS "${GLFW_COCOA_MAPPINGS}\n") + string(APPEND GLFW_COCOA_MAPPINGS "\n") endif() - set(GLFW_COCOA_MAPPINGS "${GLFW_COCOA_MAPPINGS}\"${line}\",") + string(APPEND GLFW_COCOA_MAPPINGS "\"${line}\",") elseif (line MATCHES "platform:Linux") if (GLFW_LINUX_MAPPINGS) - set(GLFW_LINUX_MAPPINGS "${GLFW_LINUX_MAPPINGS}\n") + string(APPEND GLFW_LINUX_MAPPINGS "\n") endif() - set(GLFW_LINUX_MAPPINGS "${GLFW_LINUX_MAPPINGS}\"${line}\",") + string(APPEND GLFW_LINUX_MAPPINGS "\"${line}\",") endif() endif() endforeach() diff --git a/thirdparty/glfw/CMake/Info.plist.in b/thirdparty/glfw/CMake/Info.plist.in new file mode 100644 index 000000000..684ad7908 --- /dev/null +++ b/thirdparty/glfw/CMake/Info.plist.in @@ -0,0 +1,38 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + ${MACOSX_BUNDLE_EXECUTABLE_NAME} + CFBundleGetInfoString + ${MACOSX_BUNDLE_INFO_STRING} + CFBundleIconFile + ${MACOSX_BUNDLE_ICON_FILE} + CFBundleIdentifier + ${MACOSX_BUNDLE_GUI_IDENTIFIER} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleLongVersionString + ${MACOSX_BUNDLE_LONG_VERSION_STRING} + CFBundleName + ${MACOSX_BUNDLE_BUNDLE_NAME} + CFBundlePackageType + APPL + CFBundleShortVersionString + ${MACOSX_BUNDLE_SHORT_VERSION_STRING} + CFBundleSignature + ???? + CFBundleVersion + ${MACOSX_BUNDLE_BUNDLE_VERSION} + CSResourcesFileMapped + + LSRequiresCarbon + + NSHumanReadableCopyright + ${MACOSX_BUNDLE_COPYRIGHT} + NSHighResolutionCapable + + + diff --git a/thirdparty/glfw/CMake/cmake_uninstall.cmake.in b/thirdparty/glfw/CMake/cmake_uninstall.cmake.in new file mode 100644 index 000000000..5ecc476db --- /dev/null +++ b/thirdparty/glfw/CMake/cmake_uninstall.cmake.in @@ -0,0 +1,29 @@ + +if (NOT EXISTS "@GLFW_BINARY_DIR@/install_manifest.txt") + message(FATAL_ERROR "Cannot find install manifest: \"@GLFW_BINARY_DIR@/install_manifest.txt\"") +endif() + +file(READ "@GLFW_BINARY_DIR@/install_manifest.txt" files) +string(REGEX REPLACE "\n" ";" files "${files}") + +foreach (file ${files}) + message(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"") + if (EXISTS "$ENV{DESTDIR}${file}") + exec_program("@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" + OUTPUT_VARIABLE rm_out + RETURN_VALUE rm_retval) + if (NOT "${rm_retval}" STREQUAL 0) + MESSAGE(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"") + endif() + elseif (IS_SYMLINK "$ENV{DESTDIR}${file}") + EXEC_PROGRAM("@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" + OUTPUT_VARIABLE rm_out + RETURN_VALUE rm_retval) + if (NOT "${rm_retval}" STREQUAL 0) + message(FATAL_ERROR "Problem when removing symlink \"$ENV{DESTDIR}${file}\"") + endif() + else() + message(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.") + endif() +endforeach() + diff --git a/thirdparty/glfw/CMake/glfw3.pc.in b/thirdparty/glfw/CMake/glfw3.pc.in new file mode 100644 index 000000000..36ee218e7 --- /dev/null +++ b/thirdparty/glfw/CMake/glfw3.pc.in @@ -0,0 +1,13 @@ +prefix=@CMAKE_INSTALL_PREFIX@ +exec_prefix=${prefix} +includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@ +libdir=@CMAKE_INSTALL_FULL_LIBDIR@ + +Name: GLFW +Description: A multi-platform library for OpenGL, window and input +Version: @GLFW_VERSION@ +URL: https://www.glfw.org/ +Requires.private: @GLFW_PKG_CONFIG_REQUIRES_PRIVATE@ +Libs: -L${libdir} -l@GLFW_LIB_NAME@@GLFW_LIB_NAME_SUFFIX@ +Libs.private: @GLFW_PKG_CONFIG_LIBS_PRIVATE@ +Cflags: -I${includedir} diff --git a/thirdparty/glfw/CMake/glfw3Config.cmake.in b/thirdparty/glfw/CMake/glfw3Config.cmake.in new file mode 100644 index 000000000..4a13a88b9 --- /dev/null +++ b/thirdparty/glfw/CMake/glfw3Config.cmake.in @@ -0,0 +1,3 @@ +include(CMakeFindDependencyMacro) +find_dependency(Threads) +include("${CMAKE_CURRENT_LIST_DIR}/glfw3Targets.cmake") diff --git a/thirdparty/glfw/CMakeLists.txt b/thirdparty/glfw/CMakeLists.txt index 75069161f..a3cb1fe68 100644 --- a/thirdparty/glfw/CMakeLists.txt +++ b/thirdparty/glfw/CMakeLists.txt @@ -1,12 +1,6 @@ -cmake_minimum_required(VERSION 3.0...3.20 FATAL_ERROR) +cmake_minimum_required(VERSION 3.4...3.28 FATAL_ERROR) -project(GLFW VERSION 3.3.8 LANGUAGES C) - -set(CMAKE_LEGACY_CYGWIN_WIN32 OFF) - -if (POLICY CMP0054) - cmake_policy(SET CMP0054 NEW) -endif() +project(GLFW VERSION 3.4.0 LANGUAGES C) if (POLICY CMP0069) cmake_policy(SET CMP0069 NEW) @@ -18,71 +12,73 @@ endif() set_property(GLOBAL PROPERTY USE_FOLDERS ON) +string(COMPARE EQUAL "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_SOURCE_DIR}" GLFW_STANDALONE) + option(BUILD_SHARED_LIBS "Build shared libraries" OFF) -option(GLFW_BUILD_EXAMPLES "Build the GLFW example programs" ON) -option(GLFW_BUILD_TESTS "Build the GLFW test programs" ON) +option(GLFW_BUILD_EXAMPLES "Build the GLFW example programs" ${GLFW_STANDALONE}) +option(GLFW_BUILD_TESTS "Build the GLFW test programs" ${GLFW_STANDALONE}) option(GLFW_BUILD_DOCS "Build the GLFW documentation" ON) option(GLFW_INSTALL "Generate installation target" ON) -option(GLFW_VULKAN_STATIC "Assume the Vulkan loader is linked with the application" OFF) include(GNUInstallDirs) include(CMakeDependentOption) -cmake_dependent_option(GLFW_USE_OSMESA "Use OSMesa for offscreen context creation" OFF - "UNIX" OFF) +if (GLFW_USE_OSMESA) + message(FATAL_ERROR "GLFW_USE_OSMESA has been removed; set the GLFW_PLATFORM init hint") +endif() + +if (DEFINED GLFW_USE_WAYLAND AND UNIX AND NOT APPLE) + message(FATAL_ERROR + "GLFW_USE_WAYLAND has been removed; delete the CMake cache and set GLFW_BUILD_WAYLAND and GLFW_BUILD_X11 instead") +endif() + +cmake_dependent_option(GLFW_BUILD_WIN32 "Build support for Win32" ON "WIN32" OFF) +cmake_dependent_option(GLFW_BUILD_COCOA "Build support for Cocoa" ON "APPLE" OFF) +cmake_dependent_option(GLFW_BUILD_X11 "Build support for X11" ON "UNIX;NOT APPLE" OFF) +cmake_dependent_option(GLFW_BUILD_WAYLAND "Build support for Wayland" ON "UNIX;NOT APPLE" OFF) + cmake_dependent_option(GLFW_USE_HYBRID_HPG "Force use of high-performance GPU on hybrid systems" OFF "WIN32" OFF) -cmake_dependent_option(GLFW_USE_WAYLAND "Use Wayland for window creation" OFF - "UNIX;NOT APPLE" OFF) cmake_dependent_option(USE_MSVC_RUNTIME_LIBRARY_DLL "Use MSVC runtime library DLL" ON "MSVC" OFF) -if (BUILD_SHARED_LIBS) - set(_GLFW_BUILD_DLL 1) -endif() +set(GLFW_LIBRARY_TYPE "${GLFW_LIBRARY_TYPE}" CACHE STRING + "Library type override for GLFW (SHARED, STATIC, OBJECT, or empty to follow BUILD_SHARED_LIBS)") -if (BUILD_SHARED_LIBS AND UNIX) - # On Unix-like systems, shared libraries can use the soname system. - set(GLFW_LIB_NAME glfw) -else() - set(GLFW_LIB_NAME glfw3) -endif() - -if (GLFW_VULKAN_STATIC) - if (BUILD_SHARED_LIBS) - # If you absolutely must do this, remove this line and add the Vulkan - # loader static library via the CMAKE_SHARED_LINKER_FLAGS - message(FATAL_ERROR "You are trying to link the Vulkan loader static library into the GLFW shared library") +if (GLFW_LIBRARY_TYPE) + if (GLFW_LIBRARY_TYPE STREQUAL "SHARED") + set(GLFW_BUILD_SHARED_LIBRARY TRUE) + else() + set(GLFW_BUILD_SHARED_LIBRARY FALSE) endif() - set(_GLFW_VULKAN_STATIC 1) +else() + set(GLFW_BUILD_SHARED_LIBRARY ${BUILD_SHARED_LIBS}) endif() list(APPEND CMAKE_MODULE_PATH "${GLFW_SOURCE_DIR}/CMake/modules") find_package(Threads REQUIRED) -if (GLFW_BUILD_DOCS) - set(DOXYGEN_SKIP_DOT TRUE) - find_package(Doxygen) +#-------------------------------------------------------------------- +# Report backend selection +#-------------------------------------------------------------------- +if (GLFW_BUILD_WIN32) + message(STATUS "Including Win32 support") +endif() +if (GLFW_BUILD_COCOA) + message(STATUS "Including Cocoa support") +endif() +if (GLFW_BUILD_WAYLAND) + message(STATUS "Including Wayland support") +endif() +if (GLFW_BUILD_X11) + message(STATUS "Including X11 support") endif() #-------------------------------------------------------------------- # Apply Microsoft C runtime library option # This is here because it also applies to tests and examples #-------------------------------------------------------------------- -if (MSVC) - if (MSVC90) - # Workaround for VS 2008 not shipping with the DirectX 9 SDK - include(CheckIncludeFile) - check_include_file(dinput.h DINPUT_H_FOUND) - if (NOT DINPUT_H_FOUND) - message(FATAL_ERROR "DirectX 9 headers not found; install DirectX 9 SDK") - endif() - # Workaround for VS 2008 not shipping with stdint.h - list(APPEND glfw_INCLUDE_DIRS "${GLFW_SOURCE_DIR}/deps/vs2008") - endif() -endif() - if (MSVC AND NOT USE_MSVC_RUNTIME_LIBRARY_DLL) if (CMAKE_VERSION VERSION_LESS 3.15) foreach (flag CMAKE_C_FLAGS @@ -104,218 +100,6 @@ if (MSVC AND NOT USE_MSVC_RUNTIME_LIBRARY_DLL) endif() endif() -if (MINGW) - # Workaround for legacy MinGW not providing XInput and DirectInput - include(CheckIncludeFile) - - check_include_file(dinput.h DINPUT_H_FOUND) - check_include_file(xinput.h XINPUT_H_FOUND) - if (NOT DINPUT_H_FOUND OR NOT XINPUT_H_FOUND) - list(APPEND glfw_INCLUDE_DIRS "${GLFW_SOURCE_DIR}/deps/mingw") - endif() - - # Enable link-time exploit mitigation features enabled by default on MSVC - include(CheckCCompilerFlag) - - # Compatibility with data execution prevention (DEP) - set(CMAKE_REQUIRED_FLAGS "-Wl,--nxcompat") - check_c_compiler_flag("" _GLFW_HAS_DEP) - if (_GLFW_HAS_DEP) - set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--nxcompat ${CMAKE_SHARED_LINKER_FLAGS}") - endif() - - # Compatibility with address space layout randomization (ASLR) - set(CMAKE_REQUIRED_FLAGS "-Wl,--dynamicbase") - check_c_compiler_flag("" _GLFW_HAS_ASLR) - if (_GLFW_HAS_ASLR) - set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--dynamicbase ${CMAKE_SHARED_LINKER_FLAGS}") - endif() - - # Compatibility with 64-bit address space layout randomization (ASLR) - set(CMAKE_REQUIRED_FLAGS "-Wl,--high-entropy-va") - check_c_compiler_flag("" _GLFW_HAS_64ASLR) - if (_GLFW_HAS_64ASLR) - set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--high-entropy-va ${CMAKE_SHARED_LINKER_FLAGS}") - endif() - - # Clear flags again to avoid breaking later tests - set(CMAKE_REQUIRED_FLAGS) -endif() - -#-------------------------------------------------------------------- -# Detect and select backend APIs -#-------------------------------------------------------------------- -if (GLFW_USE_WAYLAND) - set(_GLFW_WAYLAND 1) - message(STATUS "Using Wayland for window creation") -elseif (GLFW_USE_OSMESA) - set(_GLFW_OSMESA 1) - message(STATUS "Using OSMesa for headless context creation") -elseif (WIN32) - set(_GLFW_WIN32 1) - message(STATUS "Using Win32 for window creation") -elseif (APPLE) - set(_GLFW_COCOA 1) - message(STATUS "Using Cocoa for window creation") -elseif (UNIX) - set(_GLFW_X11 1) - message(STATUS "Using X11 for window creation") -else() - message(FATAL_ERROR "No supported platform was detected") -endif() - -#-------------------------------------------------------------------- -# Find and add Unix math and time libraries -#-------------------------------------------------------------------- -if (UNIX AND NOT APPLE) - find_library(RT_LIBRARY rt) - mark_as_advanced(RT_LIBRARY) - if (RT_LIBRARY) - list(APPEND glfw_LIBRARIES "${RT_LIBRARY}") - list(APPEND glfw_PKG_LIBS "-lrt") - endif() - - find_library(MATH_LIBRARY m) - mark_as_advanced(MATH_LIBRARY) - if (MATH_LIBRARY) - list(APPEND glfw_LIBRARIES "${MATH_LIBRARY}") - list(APPEND glfw_PKG_LIBS "-lm") - endif() - - if (CMAKE_DL_LIBS) - list(APPEND glfw_LIBRARIES "${CMAKE_DL_LIBS}") - list(APPEND glfw_PKG_LIBS "-l${CMAKE_DL_LIBS}") - endif() -endif() - -#-------------------------------------------------------------------- -# Use Win32 for window creation -#-------------------------------------------------------------------- -if (_GLFW_WIN32) - - list(APPEND glfw_PKG_LIBS "-lgdi32") - - if (GLFW_USE_HYBRID_HPG) - set(_GLFW_USE_HYBRID_HPG 1) - endif() -endif() - -#-------------------------------------------------------------------- -# Use X11 for window creation -#-------------------------------------------------------------------- -if (_GLFW_X11) - - find_package(X11 REQUIRED) - - list(APPEND glfw_PKG_DEPS "x11") - - # Set up library and include paths - list(APPEND glfw_INCLUDE_DIRS "${X11_X11_INCLUDE_PATH}") - list(APPEND glfw_LIBRARIES "${X11_X11_LIB}" "${CMAKE_THREAD_LIBS_INIT}") - - # Check for XRandR (modern resolution switching and gamma control) - if (NOT X11_Xrandr_INCLUDE_PATH) - message(FATAL_ERROR "RandR headers not found; install libxrandr development package") - endif() - - # Check for Xinerama (legacy multi-monitor support) - if (NOT X11_Xinerama_INCLUDE_PATH) - message(FATAL_ERROR "Xinerama headers not found; install libxinerama development package") - endif() - - # Check for Xkb (X keyboard extension) - if (NOT X11_Xkb_INCLUDE_PATH) - message(FATAL_ERROR "XKB headers not found; install X11 development package") - endif() - - # Check for Xcursor (cursor creation from RGBA images) - if (NOT X11_Xcursor_INCLUDE_PATH) - message(FATAL_ERROR "Xcursor headers not found; install libxcursor development package") - endif() - - # Check for XInput (modern HID input) - if (NOT X11_Xi_INCLUDE_PATH) - message(FATAL_ERROR "XInput headers not found; install libxi development package") - endif() - - list(APPEND glfw_INCLUDE_DIRS "${X11_Xrandr_INCLUDE_PATH}" - "${X11_Xinerama_INCLUDE_PATH}" - "${X11_Xkb_INCLUDE_PATH}" - "${X11_Xcursor_INCLUDE_PATH}" - "${X11_Xi_INCLUDE_PATH}") -endif() - -#-------------------------------------------------------------------- -# Use Wayland for window creation -#-------------------------------------------------------------------- -if (_GLFW_WAYLAND) - find_package(ECM REQUIRED NO_MODULE) - list(APPEND CMAKE_MODULE_PATH "${ECM_MODULE_PATH}") - - find_package(Wayland REQUIRED Client Cursor Egl) - find_package(WaylandScanner REQUIRED) - find_package(WaylandProtocols 1.15 REQUIRED) - - list(APPEND glfw_PKG_DEPS "wayland-client") - - list(APPEND glfw_INCLUDE_DIRS "${Wayland_INCLUDE_DIRS}") - list(APPEND glfw_LIBRARIES "${Wayland_LIBRARIES}" "${CMAKE_THREAD_LIBS_INIT}") - - find_package(XKBCommon REQUIRED) - list(APPEND glfw_INCLUDE_DIRS "${XKBCOMMON_INCLUDE_DIRS}") - - include(CheckIncludeFiles) - include(CheckFunctionExists) - check_function_exists(memfd_create HAVE_MEMFD_CREATE) - - if (NOT CMAKE_SYSTEM_NAME STREQUAL "Linux") - find_package(EpollShim) - if (EPOLLSHIM_FOUND) - list(APPEND glfw_INCLUDE_DIRS "${EPOLLSHIM_INCLUDE_DIRS}") - list(APPEND glfw_LIBRARIES "${EPOLLSHIM_LIBRARIES}") - endif() - endif() -endif() - -#-------------------------------------------------------------------- -# Use OSMesa for offscreen context creation -#-------------------------------------------------------------------- -if (_GLFW_OSMESA) - find_package(OSMesa REQUIRED) - list(APPEND glfw_LIBRARIES "${CMAKE_THREAD_LIBS_INIT}") -endif() - -#-------------------------------------------------------------------- -# Use Cocoa for window creation and NSOpenGL for context creation -#-------------------------------------------------------------------- -if (_GLFW_COCOA) - - list(APPEND glfw_LIBRARIES - "-framework Cocoa" - "-framework IOKit" - "-framework CoreFoundation") - - set(glfw_PKG_DEPS "") - set(glfw_PKG_LIBS "-framework Cocoa -framework IOKit -framework CoreFoundation") -endif() - -#-------------------------------------------------------------------- -# Add the Vulkan loader as a dependency if necessary -#-------------------------------------------------------------------- -if (GLFW_VULKAN_STATIC) - list(APPEND glfw_PKG_DEPS "vulkan") -endif() - -#-------------------------------------------------------------------- -# Export GLFW library dependencies -#-------------------------------------------------------------------- -foreach(arg ${glfw_PKG_DEPS}) - set(GLFW_PKG_DEPS "${GLFW_PKG_DEPS} ${arg}") -endforeach() -foreach(arg ${glfw_PKG_LIBS}) - set(GLFW_PKG_LIBS "${GLFW_PKG_LIBS} ${arg}") -endforeach() - #-------------------------------------------------------------------- # Create generated files #-------------------------------------------------------------------- @@ -323,7 +107,7 @@ include(CMakePackageConfigHelpers) set(GLFW_CONFIG_PATH "${CMAKE_INSTALL_LIBDIR}/cmake/glfw3") -configure_package_config_file(src/glfw3Config.cmake.in +configure_package_config_file(CMake/glfw3Config.cmake.in src/glfw3Config.cmake INSTALL_DESTINATION "${GLFW_CONFIG_PATH}" NO_CHECK_REQUIRED_COMPONENTS_MACRO) @@ -332,10 +116,6 @@ write_basic_package_version_file(src/glfw3ConfigVersion.cmake VERSION ${GLFW_VERSION} COMPATIBILITY SameMajorVersion) -configure_file(src/glfw_config.h.in src/glfw_config.h @ONLY) - -configure_file(src/glfw3.pc.in src/glfw3.pc @ONLY) - #-------------------------------------------------------------------- # Add subdirectories #-------------------------------------------------------------------- @@ -349,7 +129,7 @@ if (GLFW_BUILD_TESTS) add_subdirectory(tests) endif() -if (DOXYGEN_FOUND AND GLFW_BUILD_DOCS) +if (GLFW_BUILD_DOCS) add_subdirectory(docs) endif() @@ -373,7 +153,7 @@ if (GLFW_INSTALL) # Only generate this target if no higher-level project already has if (NOT TARGET uninstall) - configure_file(cmake_uninstall.cmake.in + configure_file(CMake/cmake_uninstall.cmake.in cmake_uninstall.cmake IMMEDIATE @ONLY) add_custom_target(uninstall diff --git a/thirdparty/glfw/CONTRIBUTORS.md b/thirdparty/glfw/CONTRIBUTORS.md index 0c7141b82..c4c74adeb 100644 --- a/thirdparty/glfw/CONTRIBUTORS.md +++ b/thirdparty/glfw/CONTRIBUTORS.md @@ -8,11 +8,14 @@ video tutorials. - Bobyshev Alexander - Laurent Aphecetche - Matt Arsenault + - Takuro Ashie - ashishgamedev - David Avedissian + - Luca Bacci - Keith Bauer - John Bartholomew - Coşku Baş + - Bayemite - Niklas Behrens - Andrew Belt - Nevyn Bengtsson @@ -31,7 +34,9 @@ video tutorials. - David Carlier - Arturo Castro - Chi-kwan Chan + - Victor Chernyakin - TheChocolateOre + - Ali Chraghi - Joseph Chua - Ian Clarkson - Michał Cichoń @@ -44,6 +49,7 @@ video tutorials. - Bailey Cosier - Noel Cower - CuriouserThing + - Bill Currie - Jason Daly - danhambleton - Jarrod Davis @@ -59,15 +65,17 @@ video tutorials. - Robin Eklind - Jan Ekström - Siavash Eliasi - - TheExileFox + - Ahmad Fatoum - Nikita Fediuchin - Felipe Ferreira - Michael Fogleman + - forworldm - Jason Francis - Gerald Franz - Mário Freitas - GeO4d - Marcus Geelnard + - Gegy - ghuser404 - Charles Giessen - Ryan C. Gordon @@ -75,12 +83,16 @@ video tutorials. - Kovid Goyal - Kevin Grandemange - Eloi Marín Gratacós + - Grzesiek11 - Stefan Gustavson - Andrew Gutekanst - Stephen Gutekanst - Jonathan Hale + - Daniel Hauser - hdf89shfdfs + - Moritz Heinemann - Sylvain Hellegouarch + - Björn Hempel - Matthew Henry - heromyth - Lucas Hinderberger @@ -89,6 +101,7 @@ video tutorials. - Warren Hu - Charles Huber - Brent Huisman + - Florian Hülsmann - illustris - InKryption - IntellectualKitty @@ -96,6 +109,7 @@ video tutorials. - JannikGM - Erik S. V. Jansson - jjYBdx4IL + - Peter Johnson - Toni Jovanoski - Arseny Kapoulkine - Cem Karan @@ -110,6 +124,7 @@ video tutorials. - Rokas Kupstys - Konstantin Käfer - Eric Larson + - Guillaume Lebrun - Francis Lecavalier - Jong Won Lee - Robin Leffmann @@ -118,12 +133,16 @@ video tutorials. - Anders Lindqvist - Leon Linhart - Marco Lizza + - lo-v-ol - Eyal Lotem - Aaron Loucks + - Ned Loynd - Luflosi - lukect - Tristam MacDonald + - Jean-Luc Mackail - Hans Mackowiak + - Ramiro Magno - Дмитри Малышев - Zbigniew Mandziejewicz - Adam Marcus @@ -135,7 +154,9 @@ video tutorials. - Jonathan Mercier - Marcel Metz - Liam Middlebrook + - mightgoyardstill - Ave Milia + - Icyllis Milica - Jonathan Miller - Kenneth Miller - Bruce Mitchener @@ -147,20 +168,28 @@ video tutorials. - Jon Morton - Pierre Moulon - Martins Mozeiko + - Pascal Muetschard - James Murphy - Julian Møller + - Julius Häger + - Nat! + - NateIsStalling - ndogxj - F. Nedelec + - n3rdopolis - Kristian Nielsen - Joel Niemelä + - Victor Nova - Kamil Nowakowski - onox - Denis Ovod - Ozzy - Andri Pálsson + - luz paz - Peoro - Braden Pellett - Christopher Pelloux + - Michael Pennington - Arturo J. Pérez - Vladimir Perminov - Olivier Perret @@ -173,34 +202,46 @@ video tutorials. - Stanislav Podgorskiy - Konstantin Podsvirov - Nathan Poirier + - Pokechu22 - Alexandre Pretyman - Pablo Prietz - przemekmirek - pthom - Martin Pulec - Guillaume Racicot + - Juan Ramos + - Christian Rauch - Philip Rideout - Eddie Ringle - Max Risuhin + - Joe Roback - Jorge Rodriguez + - Jari Ronkainen - Luca Rood - Ed Ropple - Aleksey Rybalkin - Mikko Rytkönen - Riku Salminen + - Yoshinori Sano - Brandon Schaefer - Sebastian Schuberth + - Scr3amer + - Jan Schuerkamp - Christian Sdunek - Matt Sealey - Steve Sexton - Arkady Shapkin + - Mingjie Shen - Ali Sherief - Yoshiki Shibukawa - Dmitri Shuralyov - Joao da Silva - Daniel Sieger + - Daljit Singh + - Michael Skec - Daniel Skorupski - Slemmie + - Anthony Smith - Bradley Smith - Cliff Smolinsky - Patrick Snape @@ -215,6 +256,8 @@ video tutorials. - Paul Sultana - Nathan Sweet - TTK-Bandit + - Nuno Teixeira + - Jared Tiala - Sergey Tikhomirov - Arthur Tombs - TronicLabs @@ -227,17 +270,21 @@ video tutorials. - Jari Vetoniemi - Ricardo Vieira - Nicholas Vitovitch + - Vladimír Vondruš - Simon Voordouw - Corentin Wallez - Torsten Walluhn - Patrick Walton + - Jim Wang - Xo Wang + - Andre Weissflog - Jay Weisskopf - Frank Wille + - Andy Williams + - Joel Winarske - Richard A. Wilkes - Tatsuya Yatagawa - Ryogo Yoshimura - - Rácz Zalán - Lukas Zanner - Andrey Zholos - Aihui Zhu diff --git a/thirdparty/glfw/README.md b/thirdparty/glfw/README.md index 4abb16c70..efd1383f8 100644 --- a/thirdparty/glfw/README.md +++ b/thirdparty/glfw/README.md @@ -2,7 +2,6 @@ [![Build status](https://github.com/glfw/glfw/actions/workflows/build.yml/badge.svg)](https://github.com/glfw/glfw/actions) [![Build status](https://ci.appveyor.com/api/projects/status/0kf0ct9831i5l6sp/branch/master?svg=true)](https://ci.appveyor.com/project/elmindreda/glfw) -[![Coverity Scan](https://scan.coverity.com/projects/4884/badge.svg)](https://scan.coverity.com/projects/glfw-glfw) ## Introduction @@ -11,15 +10,15 @@ application development. It provides a simple, platform-independent API for creating windows, contexts and surfaces, reading input, handling events, etc. GLFW natively supports Windows, macOS and Linux and other Unix-like systems. On -Linux both X11 and Wayland are supported. +Linux both Wayland and X11 are supported. GLFW is licensed under the [zlib/libpng license](https://www.glfw.org/license.html). You can [download](https://www.glfw.org/download.html) the latest stable release -as source or Windows binaries, or fetch the `latest` branch from GitHub. Each -release starting with 3.0 also has a corresponding [annotated -tag](https://github.com/glfw/glfw/releases) with source and binary archives. +as source or Windows binaries. Each release starting with 3.0 also has +a corresponding [annotated tag](https://github.com/glfw/glfw/releases) with +source and binary archives. The [documentation](https://www.glfw.org/docs/latest/) is available online and is included in all source and binary archives. See the [release @@ -47,18 +46,19 @@ features or fixing bugs. ## Compiling GLFW -GLFW itself requires only the headers and libraries for your OS and window -system. It does not need the headers for any context creation API (WGL, GLX, -EGL, NSGL, OSMesa) or rendering API (OpenGL, OpenGL ES, Vulkan) to enable -support for them. +GLFW is written primarily in C99, with parts of macOS support being written in +Objective-C. GLFW itself requires only the headers and libraries for your OS +and window system. It does not need any additional headers for context creation +APIs (WGL, GLX, EGL, NSGL, OSMesa) or rendering APIs (OpenGL, OpenGL ES, Vulkan) +to enable support for them. -GLFW supports compilation on Windows with Visual C++ 2010 and later, MinGW and +GLFW supports compilation on Windows with Visual C++ 2013 and later, MinGW and MinGW-w64, on macOS with Clang and on Linux and other Unix-like systems with GCC and Clang. It will likely compile in other environments as well, but this is not regularly tested. -There are [pre-compiled Windows binaries](https://www.glfw.org/download.html) -available for all supported compilers. +There are [pre-compiled binaries](https://www.glfw.org/download.html) available +for all supported compilers on Windows and macOS. See the [compilation guide](https://www.glfw.org/docs/latest/compile.html) for more information about how to compile GLFW yourself. @@ -90,10 +90,8 @@ in the documentation for more information. ## Dependencies -GLFW itself depends only on the headers and libraries for your window system. - -The (experimental) Wayland backend also depends on the `extra-cmake-modules` -package, which is used to generate Wayland protocol headers. +GLFW itself needs only CMake 3.1 or later and the headers and libraries for your +OS and window system. The examples and test programs depend on a number of tiny libraries. These are located in the `deps/` directory. @@ -121,12 +119,149 @@ guide](https://github.com/glfw/glfw/blob/master/docs/CONTRIBUTING.md) for information on what to include when reporting a bug. -## Changelog - +## Changelog since 3.3.10 + + - Added `GLFW_PLATFORM` init hint for runtime platform selection (#1958) + - Added `GLFW_ANY_PLATFORM`, `GLFW_PLATFORM_WIN32`, `GLFW_PLATFORM_COCOA`, + `GLFW_PLATFORM_WAYLAND`, `GLFW_PLATFORM_X11` and `GLFW_PLATFORM_NULL` symbols to + specify the desired platform (#1958) + - Added `glfwGetPlatform` function to query what platform was selected (#1655,#1958) + - Added `glfwPlatformSupported` function to query if a platform is supported + (#1655,#1958) + - Added `glfwInitAllocator` for setting a custom memory allocator (#544,#1628,#1947) + - Added `GLFWallocator` struct and `GLFWallocatefun`, `GLFWreallocatefun` and + `GLFWdeallocatefun` types (#544,#1628,#1947) + - Added `glfwGetWindowTitle` function for querying window title (#1448,#1909,#2482) + - Added `glfwInitVulkanLoader` for using a non-default Vulkan loader (#1374,#1890) + - Added `GLFW_RESIZE_NWSE_CURSOR`, `GLFW_RESIZE_NESW_CURSOR`, + `GLFW_RESIZE_ALL_CURSOR` and `GLFW_NOT_ALLOWED_CURSOR` cursor shapes (#427) + - Added `GLFW_RESIZE_EW_CURSOR` alias for `GLFW_HRESIZE_CURSOR` (#427) + - Added `GLFW_RESIZE_NS_CURSOR` alias for `GLFW_VRESIZE_CURSOR` (#427) + - Added `GLFW_POINTING_HAND_CURSOR` alias for `GLFW_HAND_CURSOR` (#427) + - Added `GLFW_MOUSE_PASSTHROUGH` window hint for letting mouse input pass + through the window (#1236,#1568) + - Added `GLFW_CURSOR_CAPTURED` cursor mode to confine the cursor to the window + content area (#58) + - Added `GLFW_POSITION_X` and `GLFW_POSITION_Y` window hints for initial position + (#1603,#1747) + - Added `GLFW_SCALE_FRAMEBUFFER` window hint for Wayland and macOS scaling (#2457) + - Added `GLFW_ANY_POSITION` hint value for letting the window manager choose (#1603,#1747) + - Added `GLFW_PLATFORM_UNAVAILABLE` error for platform detection failures (#1958) + - Added `GLFW_FEATURE_UNAVAILABLE` error for platform limitations (#1692) + - Added `GLFW_FEATURE_UNIMPLEMENTED` error for incomplete backends (#1692) + - Added `GLFW_WAYLAND_APP_ID` window hint string for Wayland app\_id selection + (#2121,#2122) + - Added `GLFW_ANGLE_PLATFORM_TYPE` init hint and `GLFW_ANGLE_PLATFORM_TYPE_*` + values to select ANGLE backend (#1380) + - Added `GLFW_X11_XCB_VULKAN_SURFACE` init hint for selecting X11 Vulkan + surface extension (#1793) + - Added `GLFW_WIN32_KEYBOARD_MENU` window hint for enabling access to the window menu + - Added `GLFW_WIN32_SHOWDEFAULT` window hint for applying the parent process + show command (#2359) - Added `GLFW_NATIVE_INCLUDE_NONE` for disabling inclusion of native headers (#1348) + - Added `GLFW_BUILD_WIN32` CMake option for enabling Win32 support (#1958) + - Added `GLFW_BUILD_COCOA` CMake option for enabling Cocoa support (#1958) + - Added `GLFW_BUILD_X11` CMake option for enabling X11 support (#1958) + - Added `GLFW_LIBRARY_TYPE` CMake variable for overriding the library type + (#279,#1307,#1497,#1574,#1928) + - Added support for `XDG_SESSION_TYPE` environment variable + - Added `GLFW_PKG_CONFIG_REQUIRES_PRIVATE` and `GLFW_PKG_CONFIG_LIBS_PRIVATE` CMake + variables exposing pkg-config dependencies (#1307) + - Made joystick subsystem initialize at first use (#1284,#1646) + - Made `GLFW_DOUBLEBUFFER` a read-only window attribute + - Made Wayland the preferred platform over X11 if both are available (#2035) + - Updated the minimum required CMake version to 3.4 + - Updated gamepad mappings from upstream + - Renamed `GLFW_USE_WAYLAND` CMake option to `GLFW_BUILD_WAYLAND` (#1958) + - Disabled tests and examples by default when built as a CMake subdirectory + - Removed `GLFW_USE_OSMESA` CMake option enabling the Null platform (#1958) + - Removed CMake generated configuration header + - Bugfix: `glfwGetVideoMode` returned an invalid mode on error (#1292) + - [Win32] Added a version info resource to the GLFW DLL + - [Win32] Made hidden helper window use its own window class + - [Win32] Bugfix: The foreground lock timeout was overridden, ignoring the user + - [Cocoa] Added `glfwGetCocoaView` native access function (#2235) + - [Cocoa] Moved main menu creation to GLFW initialization time (#1649) + - [Cocoa] Bugfix: Touching event queue from secondary thread before main thread + would abort (#1649) + - [Wayland] Added support for `glfwRequestWindowAttention` (#2287) + - [Wayland] Added support for `glfwFocusWindow` + - [Wayland] Added support for `GLFW_RESIZABLE` (#2203) + - [Wayland] Added support for fractional scaling of window contents + - [Wayland] Added dynamic loading of all Wayland libraries + - [Wayland] Bugfix: `CLOCK_MONOTONIC` was not correctly enabled + - [Wayland] Bugfix: `GLFW_HOVERED` was true when the cursor was over any + fallback window decoration + - [Wayland] Bugfix: Fallback decorations allowed resizing to invalid size + (#2204) + - [X11] Bugfix: Termination would segfault if the IM had been destroyed + - [X11] Bugfix: Any IM started after initialization would not be detected + - [Linux] Bugfix: Joystick evdev fds remained open in forks (#2446) + - [POSIX] Removed use of deprecated function `gettimeofday` + - [POSIX] Bugfix: `CLOCK_MONOTONIC` was not correctly tested for or enabled + - [WGL] Disabled the DWM swap interval hack for Windows 8 and later (#1072) + - [NSGL] Removed enforcement of forward-compatible flag for core contexts + - [NSGL] Bugfix: A core profile OpenGL context was returned if 3.2+ + compatibility profile was requested + - [EGL] Added platform selection via the `EGL_EXT_platform_base` extension + (#442) + - [EGL] Added ANGLE backend selection via `EGL_ANGLE_platform_angle` extension + (#1380) + + +## Changelog since 3.3 + + - Added `GLFW_WAYLAND_LIBDECOR` init hint for disabling libdecor support (#1639,#1693) + - Bugfix: The CMake config-file package used an absolute path and was not + relocatable (#1470) + - Bugfix: Video modes with a duplicate screen area were discarded (#1555,#1556) + - Bugfix: Compiling with -Wextra-semi caused warnings (#1440) + - Bugfix: Built-in mappings failed because some OEMs re-used VID/PID (#1583) + - Bugfix: Some extension loader headers did not prevent default OpenGL header + inclusion (#1695) + - Bugfix: Buffers were swapped at creation on single-buffered windows (#1873) + - Bugfix: Gamepad mapping updates could spam `GLFW_INVALID_VALUE` due to + incompatible controllers sharing hardware ID (#1763) + - Bugfix: Native access functions for context handles did not check that the API matched - Bugfix: `glfwMakeContextCurrent` would access TLS slot before initialization - Bugfix: `glfwSetGammaRamp` could emit `GLFW_INVALID_VALUE` before initialization - Bugfix: `glfwGetJoystickUserPointer` returned `NULL` during disconnection (#2092) + - Bugfix: `glfwGetKeyScancode` returned `0` on error when initialized instead of `-1` + - Bugfix: Failure to make a newly created context current could cause segfault (#2327) + - [Win32] Disabled framebuffer transparency on Windows 7 when DWM windows are + opaque (#1512) + - [Win32] Bugfix: `GLFW_INCLUDE_VULKAN` plus `VK_USE_PLATFORM_WIN32_KHR` caused + symbol redefinition (#1524) + - [Win32] Bugfix: The cursor position event was emitted before its cursor enter + event (#1490) + - [Win32] Bugfix: The window hint `GLFW_MAXIMIZED` did not move or resize the + window (#1499) + - [Win32] Bugfix: Disabled cursor mode interfered with some non-client actions + - [Win32] Bugfix: Super key was not released after Win+V hotkey (#1622) + - [Win32] Bugfix: `glfwGetKeyName` could access out of bounds and return an + invalid pointer + - [Win32] Bugfix: Some synthetic key events were reported as `GLFW_KEY_UNKNOWN` + (#1623) + - [Win32] Bugfix: Non-BMP Unicode codepoint input was reported as UTF-16 + - [Win32] Bugfix: Monitor functions could return invalid values after + configuration change (#1761) + - [Win32] Bugfix: Initialization would segfault on Windows 8 (not 8.1) (#1775) + - [Win32] Bugfix: Duplicate size events were not filtered (#1610) + - [Win32] Bugfix: Full screen windows were incorrectly resized by DPI changes + (#1582) + - [Win32] Bugfix: `GLFW_SCALE_TO_MONITOR` had no effect on systems older than + Windows 10 version 1703 (#1511) + - [Win32] Bugfix: `USE_MSVC_RUNTIME_LIBRARY_DLL` had no effect on CMake 3.15 or + later (#1783,#1796) + - [Win32] Bugfix: Compilation with LLVM for Windows failed (#1807,#1824,#1874) + - [Win32] Bugfix: Content scale queries could fail silently (#1615) + - [Win32] Bugfix: Content scales could have garbage values if monitor was recently + disconnected (#1615) + - [Win32] Bugfix: A window created maximized and undecorated would cover the whole + monitor (#1806) + - [Win32] Bugfix: The default restored window position was lost when creating a maximized + window + - [Win32] Bugfix: `glfwMaximizeWindow` would make a hidden window visible - [Win32] Bugfix: `Alt+PrtSc` would emit `GLFW_KEY_UNKNOWN` and a different scancode than `PrtSc` (#1993) - [Win32] Bugfix: `GLFW_KEY_PAUSE` scancode from `glfwGetKeyScancode` did not @@ -134,7 +269,39 @@ information on what to include when reporting a bug. - [Win32] Bugfix: Instance-local operations used executable instance (#469,#1296,#1395) - [Win32] Bugfix: The OSMesa library was not unloaded on termination - [Win32] Bugfix: Right shift emitted `GLFW_KEY_UNKNOWN` when using a CJK IME (#2050) + - [Win32] Bugfix: `glfwWaitEventsTimeout` did not return for some sent messages (#2408) + - [Win32] Bugfix: Fix pkg-config for dynamic library on Windows (#2386, #2420) + - [Win32] Bugfix: XInput could reportedly provide invalid DPad bit masks (#2291) + - [Win32] Bugfix: Rapid clipboard calls could fail due to Clipboard History + - [Win32] Bugfix: Disabled cursor mode doesn't work right when connected over RDP (#1276,#1279,#2431) + - [Cocoa] Added support for `VK_EXT_metal_surface` (#1619) + - [Cocoa] Added locating the Vulkan loader at runtime in an application bundle + - [Cocoa] Changed `EGLNativeWindowType` from `NSView` to `CALayer` (#1169) + - [Cocoa] Changed F13 key to report Print Screen for cross-platform consistency + (#1786) - [Cocoa] Disabled macOS fullscreen when `GLFW_RESIZABLE` is false + - [Cocoa] Removed dependency on the CoreVideo framework + - [Cocoa] Bugfix: `glfwSetWindowSize` used a bottom-left anchor point (#1553) + - [Cocoa] Bugfix: Window remained on screen after destruction until event poll + (#1412) + - [Cocoa] Bugfix: Event processing before window creation would assert (#1543) + - [Cocoa] Bugfix: Undecorated windows could not be iconified on recent macOS + - [Cocoa] Bugfix: Non-BMP Unicode codepoint input was reported as UTF-16 + (#1635) + - [Cocoa] Bugfix: Failing to retrieve the refresh rate of built-in displays + could leak memory + - [Cocoa] Bugfix: Objective-C files were compiled as C with CMake 3.19 (#1787) + - [Cocoa] Bugfix: Duplicate video modes were not filtered out (#1830) + - [Cocoa] Bugfix: Menu bar was not clickable on macOS 10.15+ until it lost and + regained focus (#1648,#1802) + - [Cocoa] Bugfix: Monitor name query could segfault on macOS 11 (#1809,#1833) + - [Cocoa] Bugfix: The install name of the installed dylib was relative (#1504) + - [Cocoa] Bugfix: The MoltenVK layer contents scale was updated only after + related events were emitted + - [Cocoa] Bugfix: Moving the cursor programmatically would freeze it for + a fraction of a second (#1962) + - [Cocoa] Bugfix: `kIOMasterPortDefault` was deprecated in macOS 12.0 (#1980) + - [Cocoa] Bugfix: `kUTTypeURL` was deprecated in macOS 12.0 (#2003) - [Cocoa] Bugfix: A connected Apple AirPlay would emit a useless error (#1791) - [Cocoa] Bugfix: The EGL and OSMesa libraries were not unloaded on termination - [Cocoa] Bugfix: `GLFW_MAXIMIZED` was always true when `GLFW_RESIZABLE` was false @@ -144,12 +311,78 @@ information on what to include when reporting a bug. application (#2110) - [Cocoa] Bugfix: The Vulkan loader was not loaded from the `Frameworks` bundle subdirectory (#2113,#2120) + - [Cocoa] Bugfix: Compilation failed on OS X 10.8 due to unconditional use of 10.9+ + symbols (#2161) + - [Cocoa] Bugfix: Querying joystick elements could reportedly segfault on macOS + 13 Ventura (#2320) + - [X11] Bugfix: The CMake files did not check for the XInput headers (#1480) + - [X11] Bugfix: Key names were not updated when the keyboard layout changed + (#1462,#1528) + - [X11] Bugfix: Decorations could not be enabled after window creation (#1566) + - [X11] Bugfix: Content scale fallback value could be inconsistent (#1578) + - [X11] Bugfix: `glfwMaximizeWindow` had no effect on hidden windows + - [X11] Bugfix: Clearing `GLFW_FLOATING` on a hidden window caused invalid read + - [X11] Bugfix: Changing `GLFW_FLOATING` on a hidden window could silently fail + - [X11] Bugfix: Disabled cursor mode was interrupted by indicator windows + - [X11] Bugfix: Monitor physical dimensions could be reported as zero mm + - [X11] Bugfix: Window position events were not emitted during resizing (#1613) + - [X11] Bugfix: `glfwFocusWindow` could terminate on older WMs or without a WM + - [X11] Bugfix: Querying a disconnected monitor could segfault (#1602) + - [X11] Bugfix: IME input of CJK was broken for "C" locale (#1587,#1636) + - [X11] Bugfix: Xlib errors caused by other parts of the application could be + reported as GLFW errors + - [X11] Bugfix: A handle race condition could cause a `BadWindow` error (#1633) + - [X11] Bugfix: XKB path used keysyms instead of physical locations for + non-printable keys (#1598) + - [X11] Bugfix: Function keys were mapped to `GLFW_KEY_UNKNOWN` for some layout + combinations (#1598) + - [X11] Bugfix: Keys pressed simultaneously with others were not always + reported (#1112,#1415,#1472,#1616) + - [X11] Bugfix: Some window attributes were not applied on leaving fullscreen + (#1863) + - [X11] Bugfix: Changing `GLFW_FLOATING` could leak memory + - [X11] Bugfix: Icon pixel format conversion worked only by accident, relying on + undefined behavior (#1986) + - [X11] Bugfix: Dynamic loading on OpenBSD failed due to soname differences + - [X11] Bugfix: Waiting for events would fail if file descriptor was too large + (#2024) + - [X11] Bugfix: Joystick events could lead to busy-waiting (#1872) + - [X11] Bugfix: `glfwWaitEvents*` did not continue for joystick events + - [X11] Bugfix: `glfwPostEmptyEvent` could be ignored due to race condition + (#379,#1281,#1285,#2033) + - [X11] Bugfix: Dynamic loading on NetBSD failed due to soname differences + - [X11] Bugfix: Left shift of int constant relied on undefined behavior (#1951) - [X11] Bugfix: The OSMesa libray was not unloaded on termination - [X11] Bugfix: A malformed response during selection transfer could cause a segfault - [X11] Bugfix: Some calls would reset Xlib to the default error handler (#2108) + - [Wayland] Added improved fallback window decorations via libdecor (#1639,#1693) + - [Wayland] Added support for key names via xkbcommon - [Wayland] Added support for file path drop events (#2040) - [Wayland] Added support for more human-readable monitor names where available - - [Wayland] Removed support for the deprecated wl\_shell protocol + - [Wayland] Disabled alpha channel for opaque windows on systems lacking + `EGL_EXT_present_opaque` (#1895) + - [Wayland] Removed support for `wl_shell` (#1443) + - [Wayland] Bugfix: The `GLFW_HAND_CURSOR` shape used the wrong image (#1432) + - [Wayland] Bugfix: Repeated keys could be reported with `NULL` window (#1704) + - [Wayland] Bugfix: Retrieving partial framebuffer size would segfault + - [Wayland] Bugfix: Scrolling offsets were inverted compared to other platforms + (#1463) + - [Wayland] Bugfix: Client-Side Decorations were destroyed in the wrong order + (#1798) + - [Wayland] Bugfix: Monitors physical size could report zero (#1784,#1792) + - [Wayland] Bugfix: Some keys were not repeating in Wayland (#1908) + - [Wayland] Bugfix: Non-arrow cursors are offset from the hotspot (#1706,#1899) + - [Wayland] Bugfix: The `O_CLOEXEC` flag was not defined on FreeBSD + - [Wayland] Bugfix: Key repeat could lead to a race condition (#1710) + - [Wayland] Bugfix: Activating a window would emit two input focus events + - [Wayland] Bugfix: Disable key repeat mechanism when window loses input focus + - [Wayland] Bugfix: Window hiding and showing did not work (#1492,#1731) + - [Wayland] Bugfix: A key being repeated was not released when window lost focus + - [Wayland] Bugfix: Showing a hidden window did not emit a window refresh event + - [Wayland] Bugfix: Full screen window creation did not ignore `GLFW_VISIBLE` + - [Wayland] Bugfix: Some keys were reported as wrong key or `GLFW_KEY_UNKNOWN` + - [Wayland] Bugfix: Text input did not repeat along with key repeat + - [Wayland] Bugfix: `glfwPostEmptyEvent` sometimes had no effect (#1520,#1521) - [Wayland] Bugfix: `glfwSetClipboardString` would fail if set to result of `glfwGetClipboardString` - [Wayland] Bugfix: Data source creation error would cause double free at termination @@ -158,7 +391,7 @@ information on what to include when reporting a bug. - [Wayland] Bugfix: Drag and drop data was misinterpreted as clipboard string - [Wayland] Bugfix: MIME type matching was not performed for clipboard string - [Wayland] Bugfix: The OSMesa library was not unloaded on termination - - [Wayland] Bugfix: `glfwCreateWindow` could emit `GLFW_PLATFORM_ERROR` + - [Wayland] Bugfix: `glfwCreateWindow` could emit `GLFW_FEATURE_UNAVAILABLE` - [Wayland] Bugfix: Lock key modifier bits were only set when lock keys were pressed - [Wayland] Bugfix: A window leaving full screen mode would be iconified (#1995) - [Wayland] Bugfix: A window leaving full screen mode ignored its desired size @@ -191,6 +424,21 @@ information on what to include when reporting a bug. wlroots compositors (#1268) - [Wayland] Bugfix: `GLFW_DECORATED` was ignored when showing a window with XDG decorations + - [Wayland] Bugfix: Connecting a mouse after `glfwInit` would segfault (#1450) + - [Wayland] Bugfix: Joysticks connected after `glfwInit` were not detected (#2198) + - [Wayland] Bugfix: Fallback decorations emitted `GLFW_CURSOR_UNAVAILABLE` errors + - [Linux] Bugfix: Joysticks without buttons were ignored (#2042,#2043) + - [Linux] Bugfix: A small amount of memory could leak if initialization failed (#2229) + - [NSGL] Bugfix: `GLFW_COCOA_RETINA_FRAMEBUFFER` had no effect on newer + macOS versions (#1442) + - [NSGL] Bugfix: Workaround for swap interval on 10.14 broke on 10.12 (#1483) + - [NSGL] Bugfix: Defining `GL_SILENCE_DEPRECATION` externally caused + a duplicate definition warning (#1840) + - [EGL] Added loading of glvnd `libOpenGL.so.0` where available for OpenGL + - [EGL] Bugfix: The `GLFW_DOUBLEBUFFER` context attribute was ignored (#1843) + - [EGL] Bugfix: Setting `GLFW_CONTEXT_DEBUG` caused creation to fail (#2348) + - [GLX] Added loading of glvnd `libGLX.so.0` where available + - [GLX] Bugfix: Context creation failed if GLX 1.4 was not exported by GLX library ## Contact @@ -199,13 +447,12 @@ On [glfw.org](https://www.glfw.org/) you can find the latest version of GLFW, as well as news, documentation and other information about the project. If you have questions related to the use of GLFW, we have a -[forum](https://discourse.glfw.org/), and the `#glfw` IRC channel on -[Libera.Chat](https://libera.chat/). +[forum](https://discourse.glfw.org/). If you have a bug to report, a patch to submit or a feature you'd like to request, please file it in the [issue tracker](https://github.com/glfw/glfw/issues) on GitHub. Finally, if you're interested in helping out with the development of GLFW or -porting it to your favorite platform, join us on the forum, GitHub or IRC. +porting it to your favorite platform, join us on the forum or GitHub. diff --git a/thirdparty/glfw/deps/glad/gl.h b/thirdparty/glfw/deps/glad/gl.h index 5c7879f8a..b421fe080 100644 --- a/thirdparty/glfw/deps/glad/gl.h +++ b/thirdparty/glfw/deps/glad/gl.h @@ -1,5 +1,5 @@ /** - * Loader generated by glad 2.0.0-beta on Sun Apr 14 17:03:32 2019 + * Loader generated by glad 2.0.0-beta on Tue Aug 24 22:51:07 2021 * * Generator: C/C++ * Specification: gl @@ -9,31 +9,51 @@ * - gl:compatibility=3.3 * * Options: - * - MX_GLOBAL = False - * - LOADER = False * - ALIAS = False - * - HEADER_ONLY = False * - DEBUG = False + * - HEADER_ONLY = True + * - LOADER = False * - MX = False + * - MX_GLOBAL = False + * - ON_DEMAND = False * * Commandline: - * --api='gl:compatibility=3.3' --extensions='GL_ARB_multisample,GL_ARB_robustness,GL_KHR_debug' c + * --api='gl:compatibility=3.3' --extensions='GL_ARB_multisample,GL_ARB_robustness,GL_KHR_debug' c --header-only * * Online: - * http://glad.sh/#api=gl%3Acompatibility%3D3.3&extensions=GL_ARB_multisample%2CGL_ARB_robustness%2CGL_KHR_debug&generator=c&options= + * http://glad.sh/#api=gl%3Acompatibility%3D3.3&extensions=GL_ARB_multisample%2CGL_ARB_robustness%2CGL_KHR_debug&generator=c&options=HEADER_ONLY * */ #ifndef GLAD_GL_H_ #define GLAD_GL_H_ +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wreserved-id-macro" +#endif #ifdef __gl_h_ - #error OpenGL header already included (API: gl), remove previous include! + #error OpenGL (gl.h) header already included (API: gl), remove previous include! #endif #define __gl_h_ 1 - +#ifdef __gl3_h_ + #error OpenGL (gl3.h) header already included (API: gl), remove previous include! +#endif +#define __gl3_h_ 1 +#ifdef __glext_h_ + #error OpenGL (glext.h) header already included (API: gl), remove previous include! +#endif +#define __glext_h_ 1 +#ifdef __gl3ext_h_ + #error OpenGL (gl3ext.h) header already included (API: gl), remove previous include! +#endif +#define __gl3ext_h_ 1 +#ifdef __clang__ +#pragma clang diagnostic pop +#endif #define GLAD_GL +#define GLAD_OPTION_GL_HEADER_ONLY #ifdef __cplusplus extern "C" { @@ -137,15 +157,16 @@ extern "C" { #define GLAPIENTRY GLAD_API_PTR #endif - #define GLAD_MAKE_VERSION(major, minor) (major * 10000 + minor) #define GLAD_VERSION_MAJOR(version) (version / 10000) #define GLAD_VERSION_MINOR(version) (version % 10000) +#define GLAD_GENERATOR_VERSION "2.0.0-beta" + typedef void (*GLADapiproc)(void); typedef GLADapiproc (*GLADloadfunc)(const char *name); -typedef GLADapiproc (*GLADuserptrloadfunc)(const char *name, void *userptr); +typedef GLADapiproc (*GLADuserptrloadfunc)(void *userptr, const char *name); typedef void (*GLADprecallback)(const char *name, GLADapiproc apiproc, int len_args, ...); typedef void (*GLADpostcallback)(void *ret, const char *name, GLADapiproc apiproc, int len_args, ...); @@ -1458,69 +1479,401 @@ typedef void (*GLADpostcallback)(void *ret, const char *name, GLADapiproc apipro #define GL_ZOOM_Y 0x0D17 -#include +#ifndef __khrplatform_h_ +#define __khrplatform_h_ + +/* +** Copyright (c) 2008-2018 The Khronos Group Inc. +** +** Permission is hereby granted, free of charge, to any person obtaining a +** copy of this software and/or associated documentation files (the +** "Materials"), to deal in the Materials without restriction, including +** without limitation the rights to use, copy, modify, merge, publish, +** distribute, sublicense, and/or sell copies of the Materials, and to +** permit persons to whom the Materials are furnished to do so, subject to +** the following conditions: +** +** The above copyright notice and this permission notice shall be included +** in all copies or substantial portions of the Materials. +** +** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. +*/ + +/* Khronos platform-specific types and definitions. + * + * The master copy of khrplatform.h is maintained in the Khronos EGL + * Registry repository at https://github.com/KhronosGroup/EGL-Registry + * The last semantic modification to khrplatform.h was at commit ID: + * 67a3e0864c2d75ea5287b9f3d2eb74a745936692 + * + * Adopters may modify this file to suit their platform. Adopters are + * encouraged to submit platform specific modifications to the Khronos + * group so that they can be included in future versions of this file. + * Please submit changes by filing pull requests or issues on + * the EGL Registry repository linked above. + * + * + * See the Implementer's Guidelines for information about where this file + * should be located on your system and for more details of its use: + * http://www.khronos.org/registry/implementers_guide.pdf + * + * This file should be included as + * #include + * by Khronos client API header files that use its types and defines. + * + * The types in khrplatform.h should only be used to define API-specific types. + * + * Types defined in khrplatform.h: + * khronos_int8_t signed 8 bit + * khronos_uint8_t unsigned 8 bit + * khronos_int16_t signed 16 bit + * khronos_uint16_t unsigned 16 bit + * khronos_int32_t signed 32 bit + * khronos_uint32_t unsigned 32 bit + * khronos_int64_t signed 64 bit + * khronos_uint64_t unsigned 64 bit + * khronos_intptr_t signed same number of bits as a pointer + * khronos_uintptr_t unsigned same number of bits as a pointer + * khronos_ssize_t signed size + * khronos_usize_t unsigned size + * khronos_float_t signed 32 bit floating point + * khronos_time_ns_t unsigned 64 bit time in nanoseconds + * khronos_utime_nanoseconds_t unsigned time interval or absolute time in + * nanoseconds + * khronos_stime_nanoseconds_t signed time interval in nanoseconds + * khronos_boolean_enum_t enumerated boolean type. This should + * only be used as a base type when a client API's boolean type is + * an enum. Client APIs which use an integer or other type for + * booleans cannot use this as the base type for their boolean. + * + * Tokens defined in khrplatform.h: + * + * KHRONOS_FALSE, KHRONOS_TRUE Enumerated boolean false/true values. + * + * KHRONOS_SUPPORT_INT64 is 1 if 64 bit integers are supported; otherwise 0. + * KHRONOS_SUPPORT_FLOAT is 1 if floats are supported; otherwise 0. + * + * Calling convention macros defined in this file: + * KHRONOS_APICALL + * KHRONOS_GLAD_API_PTR + * KHRONOS_APIATTRIBUTES + * + * These may be used in function prototypes as: + * + * KHRONOS_APICALL void KHRONOS_GLAD_API_PTR funcname( + * int arg1, + * int arg2) KHRONOS_APIATTRIBUTES; + */ + +#if defined(__SCITECH_SNAP__) && !defined(KHRONOS_STATIC) +# define KHRONOS_STATIC 1 +#endif + +/*------------------------------------------------------------------------- + * Definition of KHRONOS_APICALL + *------------------------------------------------------------------------- + * This precedes the return type of the function in the function prototype. + */ +#if defined(KHRONOS_STATIC) + /* If the preprocessor constant KHRONOS_STATIC is defined, make the + * header compatible with static linking. */ +# define KHRONOS_APICALL +#elif defined(_WIN32) +# define KHRONOS_APICALL __declspec(dllimport) +#elif defined (__SYMBIAN32__) +# define KHRONOS_APICALL IMPORT_C +#elif defined(__ANDROID__) +# define KHRONOS_APICALL __attribute__((visibility("default"))) +#else +# define KHRONOS_APICALL +#endif + +/*------------------------------------------------------------------------- + * Definition of KHRONOS_GLAD_API_PTR + *------------------------------------------------------------------------- + * This follows the return type of the function and precedes the function + * name in the function prototype. + */ +#if defined(_WIN32) && !defined(_WIN32_WCE) && !defined(__SCITECH_SNAP__) + /* Win32 but not WinCE */ +# define KHRONOS_GLAD_API_PTR __stdcall +#else +# define KHRONOS_GLAD_API_PTR +#endif + +/*------------------------------------------------------------------------- + * Definition of KHRONOS_APIATTRIBUTES + *------------------------------------------------------------------------- + * This follows the closing parenthesis of the function prototype arguments. + */ +#if defined (__ARMCC_2__) +#define KHRONOS_APIATTRIBUTES __softfp +#else +#define KHRONOS_APIATTRIBUTES +#endif + +/*------------------------------------------------------------------------- + * basic type definitions + *-----------------------------------------------------------------------*/ +#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__GNUC__) || defined(__SCO__) || defined(__USLC__) + + +/* + * Using + */ +#include +typedef int32_t khronos_int32_t; +typedef uint32_t khronos_uint32_t; +typedef int64_t khronos_int64_t; +typedef uint64_t khronos_uint64_t; +#define KHRONOS_SUPPORT_INT64 1 +#define KHRONOS_SUPPORT_FLOAT 1 + +#elif defined(__VMS ) || defined(__sgi) + +/* + * Using + */ +#include +typedef int32_t khronos_int32_t; +typedef uint32_t khronos_uint32_t; +typedef int64_t khronos_int64_t; +typedef uint64_t khronos_uint64_t; +#define KHRONOS_SUPPORT_INT64 1 +#define KHRONOS_SUPPORT_FLOAT 1 + +#elif defined(_WIN32) && !defined(__SCITECH_SNAP__) + +/* + * Win32 + */ +typedef __int32 khronos_int32_t; +typedef unsigned __int32 khronos_uint32_t; +typedef __int64 khronos_int64_t; +typedef unsigned __int64 khronos_uint64_t; +#define KHRONOS_SUPPORT_INT64 1 +#define KHRONOS_SUPPORT_FLOAT 1 + +#elif defined(__sun__) || defined(__digital__) + +/* + * Sun or Digital + */ +typedef int khronos_int32_t; +typedef unsigned int khronos_uint32_t; +#if defined(__arch64__) || defined(_LP64) +typedef long int khronos_int64_t; +typedef unsigned long int khronos_uint64_t; +#else +typedef long long int khronos_int64_t; +typedef unsigned long long int khronos_uint64_t; +#endif /* __arch64__ */ +#define KHRONOS_SUPPORT_INT64 1 +#define KHRONOS_SUPPORT_FLOAT 1 + +#elif 0 + +/* + * Hypothetical platform with no float or int64 support + */ +typedef int khronos_int32_t; +typedef unsigned int khronos_uint32_t; +#define KHRONOS_SUPPORT_INT64 0 +#define KHRONOS_SUPPORT_FLOAT 0 + +#else + +/* + * Generic fallback + */ +#include +typedef int32_t khronos_int32_t; +typedef uint32_t khronos_uint32_t; +typedef int64_t khronos_int64_t; +typedef uint64_t khronos_uint64_t; +#define KHRONOS_SUPPORT_INT64 1 +#define KHRONOS_SUPPORT_FLOAT 1 + +#endif + + +/* + * Types that are (so far) the same on all platforms + */ +typedef signed char khronos_int8_t; +typedef unsigned char khronos_uint8_t; +typedef signed short int khronos_int16_t; +typedef unsigned short int khronos_uint16_t; + +/* + * Types that differ between LLP64 and LP64 architectures - in LLP64, + * pointers are 64 bits, but 'long' is still 32 bits. Win64 appears + * to be the only LLP64 architecture in current use. + */ +#ifdef _WIN64 +typedef signed long long int khronos_intptr_t; +typedef unsigned long long int khronos_uintptr_t; +typedef signed long long int khronos_ssize_t; +typedef unsigned long long int khronos_usize_t; +#else +typedef signed long int khronos_intptr_t; +typedef unsigned long int khronos_uintptr_t; +typedef signed long int khronos_ssize_t; +typedef unsigned long int khronos_usize_t; +#endif + +#if KHRONOS_SUPPORT_FLOAT +/* + * Float type + */ +typedef float khronos_float_t; +#endif + +#if KHRONOS_SUPPORT_INT64 +/* Time types + * + * These types can be used to represent a time interval in nanoseconds or + * an absolute Unadjusted System Time. Unadjusted System Time is the number + * of nanoseconds since some arbitrary system event (e.g. since the last + * time the system booted). The Unadjusted System Time is an unsigned + * 64 bit value that wraps back to 0 every 584 years. Time intervals + * may be either signed or unsigned. + */ +typedef khronos_uint64_t khronos_utime_nanoseconds_t; +typedef khronos_int64_t khronos_stime_nanoseconds_t; +#endif + +/* + * Dummy value used to pad enum types to 32 bits. + */ +#ifndef KHRONOS_MAX_ENUM +#define KHRONOS_MAX_ENUM 0x7FFFFFFF +#endif + +/* + * Enumerated boolean type + * + * Values other than zero should be considered to be true. Therefore + * comparisons should not be made against KHRONOS_TRUE. + */ +typedef enum { + KHRONOS_FALSE = 0, + KHRONOS_TRUE = 1, + KHRONOS_BOOLEAN_ENUM_FORCE_SIZE = KHRONOS_MAX_ENUM +} khronos_boolean_enum_t; + +#endif /* __khrplatform_h_ */ + typedef unsigned int GLenum; + typedef unsigned char GLboolean; + typedef unsigned int GLbitfield; + typedef void GLvoid; + typedef khronos_int8_t GLbyte; + typedef khronos_uint8_t GLubyte; + typedef khronos_int16_t GLshort; + typedef khronos_uint16_t GLushort; + typedef int GLint; + typedef unsigned int GLuint; + typedef khronos_int32_t GLclampx; + typedef int GLsizei; + typedef khronos_float_t GLfloat; + typedef khronos_float_t GLclampf; + typedef double GLdouble; + typedef double GLclampd; + typedef void *GLeglClientBufferEXT; + typedef void *GLeglImageOES; + typedef char GLchar; + typedef char GLcharARB; + #ifdef __APPLE__ typedef void *GLhandleARB; #else typedef unsigned int GLhandleARB; #endif + typedef khronos_uint16_t GLhalf; + typedef khronos_uint16_t GLhalfARB; + typedef khronos_int32_t GLfixed; + #if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ > 1060) typedef khronos_intptr_t GLintptr; #else typedef khronos_intptr_t GLintptr; #endif + #if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ > 1060) typedef khronos_intptr_t GLintptrARB; #else typedef khronos_intptr_t GLintptrARB; #endif + #if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ > 1060) typedef khronos_ssize_t GLsizeiptr; #else typedef khronos_ssize_t GLsizeiptr; #endif + #if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ > 1060) typedef khronos_ssize_t GLsizeiptrARB; #else typedef khronos_ssize_t GLsizeiptrARB; #endif + typedef khronos_int64_t GLint64; + typedef khronos_int64_t GLint64EXT; + typedef khronos_uint64_t GLuint64; + typedef khronos_uint64_t GLuint64EXT; + typedef struct __GLsync *GLsync; + struct _cl_context; + struct _cl_event; -typedef void ( *GLDEBUGPROC)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam); -typedef void ( *GLDEBUGPROCARB)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam); -typedef void ( *GLDEBUGPROCKHR)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam); -typedef void ( *GLDEBUGPROCAMD)(GLuint id,GLenum category,GLenum severity,GLsizei length,const GLchar *message,void *userParam); + +typedef void (GLAD_API_PTR *GLDEBUGPROC)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam); + +typedef void (GLAD_API_PTR *GLDEBUGPROCARB)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam); + +typedef void (GLAD_API_PTR *GLDEBUGPROCKHR)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam); + +typedef void (GLAD_API_PTR *GLDEBUGPROCAMD)(GLuint id,GLenum category,GLenum severity,GLsizei length,const GLchar *message,void *userParam); + typedef unsigned short GLhalfNV; + typedef GLintptr GLvdpauSurfaceNV; -typedef void ( *GLVULKANPROCNV)(void); + +typedef void (GLAD_API_PTR *GLVULKANPROCNV)(void); + #define GL_VERSION_1_0 1 @@ -1555,762 +1908,761 @@ GLAD_API_CALL int GLAD_GL_ARB_robustness; GLAD_API_CALL int GLAD_GL_KHR_debug; -typedef void (GLAD_API_PTR *PFNGLACCUMPROC)(GLenum op, GLfloat value); -typedef void (GLAD_API_PTR *PFNGLACTIVETEXTUREPROC)(GLenum texture); -typedef void (GLAD_API_PTR *PFNGLALPHAFUNCPROC)(GLenum func, GLfloat ref); -typedef GLboolean (GLAD_API_PTR *PFNGLARETEXTURESRESIDENTPROC)(GLsizei n, const GLuint * textures, GLboolean * residences); -typedef void (GLAD_API_PTR *PFNGLARRAYELEMENTPROC)(GLint i); -typedef void (GLAD_API_PTR *PFNGLATTACHSHADERPROC)(GLuint program, GLuint shader); -typedef void (GLAD_API_PTR *PFNGLBEGINPROC)(GLenum mode); -typedef void (GLAD_API_PTR *PFNGLBEGINCONDITIONALRENDERPROC)(GLuint id, GLenum mode); -typedef void (GLAD_API_PTR *PFNGLBEGINQUERYPROC)(GLenum target, GLuint id); -typedef void (GLAD_API_PTR *PFNGLBEGINTRANSFORMFEEDBACKPROC)(GLenum primitiveMode); -typedef void (GLAD_API_PTR *PFNGLBINDATTRIBLOCATIONPROC)(GLuint program, GLuint index, const GLchar * name); -typedef void (GLAD_API_PTR *PFNGLBINDBUFFERPROC)(GLenum target, GLuint buffer); -typedef void (GLAD_API_PTR *PFNGLBINDBUFFERBASEPROC)(GLenum target, GLuint index, GLuint buffer); -typedef void (GLAD_API_PTR *PFNGLBINDBUFFERRANGEPROC)(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); -typedef void (GLAD_API_PTR *PFNGLBINDFRAGDATALOCATIONPROC)(GLuint program, GLuint color, const GLchar * name); -typedef void (GLAD_API_PTR *PFNGLBINDFRAGDATALOCATIONINDEXEDPROC)(GLuint program, GLuint colorNumber, GLuint index, const GLchar * name); -typedef void (GLAD_API_PTR *PFNGLBINDFRAMEBUFFERPROC)(GLenum target, GLuint framebuffer); -typedef void (GLAD_API_PTR *PFNGLBINDRENDERBUFFERPROC)(GLenum target, GLuint renderbuffer); -typedef void (GLAD_API_PTR *PFNGLBINDSAMPLERPROC)(GLuint unit, GLuint sampler); -typedef void (GLAD_API_PTR *PFNGLBINDTEXTUREPROC)(GLenum target, GLuint texture); -typedef void (GLAD_API_PTR *PFNGLBINDVERTEXARRAYPROC)(GLuint array); -typedef void (GLAD_API_PTR *PFNGLBITMAPPROC)(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte * bitmap); -typedef void (GLAD_API_PTR *PFNGLBLENDCOLORPROC)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); -typedef void (GLAD_API_PTR *PFNGLBLENDEQUATIONPROC)(GLenum mode); -typedef void (GLAD_API_PTR *PFNGLBLENDEQUATIONSEPARATEPROC)(GLenum modeRGB, GLenum modeAlpha); -typedef void (GLAD_API_PTR *PFNGLBLENDFUNCPROC)(GLenum sfactor, GLenum dfactor); -typedef void (GLAD_API_PTR *PFNGLBLENDFUNCSEPARATEPROC)(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); -typedef void (GLAD_API_PTR *PFNGLBLITFRAMEBUFFERPROC)(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); -typedef void (GLAD_API_PTR *PFNGLBUFFERDATAPROC)(GLenum target, GLsizeiptr size, const void * data, GLenum usage); -typedef void (GLAD_API_PTR *PFNGLBUFFERSUBDATAPROC)(GLenum target, GLintptr offset, GLsizeiptr size, const void * data); -typedef void (GLAD_API_PTR *PFNGLCALLLISTPROC)(GLuint list); -typedef void (GLAD_API_PTR *PFNGLCALLLISTSPROC)(GLsizei n, GLenum type, const void * lists); -typedef GLenum (GLAD_API_PTR *PFNGLCHECKFRAMEBUFFERSTATUSPROC)(GLenum target); -typedef void (GLAD_API_PTR *PFNGLCLAMPCOLORPROC)(GLenum target, GLenum clamp); -typedef void (GLAD_API_PTR *PFNGLCLEARPROC)(GLbitfield mask); -typedef void (GLAD_API_PTR *PFNGLCLEARACCUMPROC)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); -typedef void (GLAD_API_PTR *PFNGLCLEARBUFFERFIPROC)(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil); -typedef void (GLAD_API_PTR *PFNGLCLEARBUFFERFVPROC)(GLenum buffer, GLint drawbuffer, const GLfloat * value); -typedef void (GLAD_API_PTR *PFNGLCLEARBUFFERIVPROC)(GLenum buffer, GLint drawbuffer, const GLint * value); -typedef void (GLAD_API_PTR *PFNGLCLEARBUFFERUIVPROC)(GLenum buffer, GLint drawbuffer, const GLuint * value); -typedef void (GLAD_API_PTR *PFNGLCLEARCOLORPROC)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); -typedef void (GLAD_API_PTR *PFNGLCLEARDEPTHPROC)(GLdouble depth); -typedef void (GLAD_API_PTR *PFNGLCLEARINDEXPROC)(GLfloat c); -typedef void (GLAD_API_PTR *PFNGLCLEARSTENCILPROC)(GLint s); -typedef void (GLAD_API_PTR *PFNGLCLIENTACTIVETEXTUREPROC)(GLenum texture); -typedef GLenum (GLAD_API_PTR *PFNGLCLIENTWAITSYNCPROC)(GLsync sync, GLbitfield flags, GLuint64 timeout); -typedef void (GLAD_API_PTR *PFNGLCLIPPLANEPROC)(GLenum plane, const GLdouble * equation); -typedef void (GLAD_API_PTR *PFNGLCOLOR3BPROC)(GLbyte red, GLbyte green, GLbyte blue); -typedef void (GLAD_API_PTR *PFNGLCOLOR3BVPROC)(const GLbyte * v); -typedef void (GLAD_API_PTR *PFNGLCOLOR3DPROC)(GLdouble red, GLdouble green, GLdouble blue); -typedef void (GLAD_API_PTR *PFNGLCOLOR3DVPROC)(const GLdouble * v); -typedef void (GLAD_API_PTR *PFNGLCOLOR3FPROC)(GLfloat red, GLfloat green, GLfloat blue); -typedef void (GLAD_API_PTR *PFNGLCOLOR3FVPROC)(const GLfloat * v); -typedef void (GLAD_API_PTR *PFNGLCOLOR3IPROC)(GLint red, GLint green, GLint blue); -typedef void (GLAD_API_PTR *PFNGLCOLOR3IVPROC)(const GLint * v); -typedef void (GLAD_API_PTR *PFNGLCOLOR3SPROC)(GLshort red, GLshort green, GLshort blue); -typedef void (GLAD_API_PTR *PFNGLCOLOR3SVPROC)(const GLshort * v); -typedef void (GLAD_API_PTR *PFNGLCOLOR3UBPROC)(GLubyte red, GLubyte green, GLubyte blue); -typedef void (GLAD_API_PTR *PFNGLCOLOR3UBVPROC)(const GLubyte * v); -typedef void (GLAD_API_PTR *PFNGLCOLOR3UIPROC)(GLuint red, GLuint green, GLuint blue); -typedef void (GLAD_API_PTR *PFNGLCOLOR3UIVPROC)(const GLuint * v); -typedef void (GLAD_API_PTR *PFNGLCOLOR3USPROC)(GLushort red, GLushort green, GLushort blue); -typedef void (GLAD_API_PTR *PFNGLCOLOR3USVPROC)(const GLushort * v); -typedef void (GLAD_API_PTR *PFNGLCOLOR4BPROC)(GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha); -typedef void (GLAD_API_PTR *PFNGLCOLOR4BVPROC)(const GLbyte * v); -typedef void (GLAD_API_PTR *PFNGLCOLOR4DPROC)(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha); -typedef void (GLAD_API_PTR *PFNGLCOLOR4DVPROC)(const GLdouble * v); -typedef void (GLAD_API_PTR *PFNGLCOLOR4FPROC)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); -typedef void (GLAD_API_PTR *PFNGLCOLOR4FVPROC)(const GLfloat * v); -typedef void (GLAD_API_PTR *PFNGLCOLOR4IPROC)(GLint red, GLint green, GLint blue, GLint alpha); -typedef void (GLAD_API_PTR *PFNGLCOLOR4IVPROC)(const GLint * v); -typedef void (GLAD_API_PTR *PFNGLCOLOR4SPROC)(GLshort red, GLshort green, GLshort blue, GLshort alpha); -typedef void (GLAD_API_PTR *PFNGLCOLOR4SVPROC)(const GLshort * v); -typedef void (GLAD_API_PTR *PFNGLCOLOR4UBPROC)(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha); -typedef void (GLAD_API_PTR *PFNGLCOLOR4UBVPROC)(const GLubyte * v); -typedef void (GLAD_API_PTR *PFNGLCOLOR4UIPROC)(GLuint red, GLuint green, GLuint blue, GLuint alpha); -typedef void (GLAD_API_PTR *PFNGLCOLOR4UIVPROC)(const GLuint * v); -typedef void (GLAD_API_PTR *PFNGLCOLOR4USPROC)(GLushort red, GLushort green, GLushort blue, GLushort alpha); -typedef void (GLAD_API_PTR *PFNGLCOLOR4USVPROC)(const GLushort * v); -typedef void (GLAD_API_PTR *PFNGLCOLORMASKPROC)(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); -typedef void (GLAD_API_PTR *PFNGLCOLORMASKIPROC)(GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a); -typedef void (GLAD_API_PTR *PFNGLCOLORMATERIALPROC)(GLenum face, GLenum mode); -typedef void (GLAD_API_PTR *PFNGLCOLORP3UIPROC)(GLenum type, GLuint color); -typedef void (GLAD_API_PTR *PFNGLCOLORP3UIVPROC)(GLenum type, const GLuint * color); -typedef void (GLAD_API_PTR *PFNGLCOLORP4UIPROC)(GLenum type, GLuint color); -typedef void (GLAD_API_PTR *PFNGLCOLORP4UIVPROC)(GLenum type, const GLuint * color); -typedef void (GLAD_API_PTR *PFNGLCOLORPOINTERPROC)(GLint size, GLenum type, GLsizei stride, const void * pointer); -typedef void (GLAD_API_PTR *PFNGLCOMPILESHADERPROC)(GLuint shader); -typedef void (GLAD_API_PTR *PFNGLCOMPRESSEDTEXIMAGE1DPROC)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const void * data); -typedef void (GLAD_API_PTR *PFNGLCOMPRESSEDTEXIMAGE2DPROC)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void * data); -typedef void (GLAD_API_PTR *PFNGLCOMPRESSEDTEXIMAGE3DPROC)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void * data); -typedef void (GLAD_API_PTR *PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void * data); -typedef void (GLAD_API_PTR *PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void * data); -typedef void (GLAD_API_PTR *PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void * data); -typedef void (GLAD_API_PTR *PFNGLCOPYBUFFERSUBDATAPROC)(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); -typedef void (GLAD_API_PTR *PFNGLCOPYPIXELSPROC)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type); -typedef void (GLAD_API_PTR *PFNGLCOPYTEXIMAGE1DPROC)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border); -typedef void (GLAD_API_PTR *PFNGLCOPYTEXIMAGE2DPROC)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); -typedef void (GLAD_API_PTR *PFNGLCOPYTEXSUBIMAGE1DPROC)(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); -typedef void (GLAD_API_PTR *PFNGLCOPYTEXSUBIMAGE2DPROC)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); -typedef void (GLAD_API_PTR *PFNGLCOPYTEXSUBIMAGE3DPROC)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (GLAD_API_PTR *PFNGLACCUMPROC)(GLenum op, GLfloat value); +typedef void (GLAD_API_PTR *PFNGLACTIVETEXTUREPROC)(GLenum texture); +typedef void (GLAD_API_PTR *PFNGLALPHAFUNCPROC)(GLenum func, GLfloat ref); +typedef GLboolean (GLAD_API_PTR *PFNGLARETEXTURESRESIDENTPROC)(GLsizei n, const GLuint * textures, GLboolean * residences); +typedef void (GLAD_API_PTR *PFNGLARRAYELEMENTPROC)(GLint i); +typedef void (GLAD_API_PTR *PFNGLATTACHSHADERPROC)(GLuint program, GLuint shader); +typedef void (GLAD_API_PTR *PFNGLBEGINPROC)(GLenum mode); +typedef void (GLAD_API_PTR *PFNGLBEGINCONDITIONALRENDERPROC)(GLuint id, GLenum mode); +typedef void (GLAD_API_PTR *PFNGLBEGINQUERYPROC)(GLenum target, GLuint id); +typedef void (GLAD_API_PTR *PFNGLBEGINTRANSFORMFEEDBACKPROC)(GLenum primitiveMode); +typedef void (GLAD_API_PTR *PFNGLBINDATTRIBLOCATIONPROC)(GLuint program, GLuint index, const GLchar * name); +typedef void (GLAD_API_PTR *PFNGLBINDBUFFERPROC)(GLenum target, GLuint buffer); +typedef void (GLAD_API_PTR *PFNGLBINDBUFFERBASEPROC)(GLenum target, GLuint index, GLuint buffer); +typedef void (GLAD_API_PTR *PFNGLBINDBUFFERRANGEPROC)(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); +typedef void (GLAD_API_PTR *PFNGLBINDFRAGDATALOCATIONPROC)(GLuint program, GLuint color, const GLchar * name); +typedef void (GLAD_API_PTR *PFNGLBINDFRAGDATALOCATIONINDEXEDPROC)(GLuint program, GLuint colorNumber, GLuint index, const GLchar * name); +typedef void (GLAD_API_PTR *PFNGLBINDFRAMEBUFFERPROC)(GLenum target, GLuint framebuffer); +typedef void (GLAD_API_PTR *PFNGLBINDRENDERBUFFERPROC)(GLenum target, GLuint renderbuffer); +typedef void (GLAD_API_PTR *PFNGLBINDSAMPLERPROC)(GLuint unit, GLuint sampler); +typedef void (GLAD_API_PTR *PFNGLBINDTEXTUREPROC)(GLenum target, GLuint texture); +typedef void (GLAD_API_PTR *PFNGLBINDVERTEXARRAYPROC)(GLuint array); +typedef void (GLAD_API_PTR *PFNGLBITMAPPROC)(GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte * bitmap); +typedef void (GLAD_API_PTR *PFNGLBLENDCOLORPROC)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); +typedef void (GLAD_API_PTR *PFNGLBLENDEQUATIONPROC)(GLenum mode); +typedef void (GLAD_API_PTR *PFNGLBLENDEQUATIONSEPARATEPROC)(GLenum modeRGB, GLenum modeAlpha); +typedef void (GLAD_API_PTR *PFNGLBLENDFUNCPROC)(GLenum sfactor, GLenum dfactor); +typedef void (GLAD_API_PTR *PFNGLBLENDFUNCSEPARATEPROC)(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); +typedef void (GLAD_API_PTR *PFNGLBLITFRAMEBUFFERPROC)(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); +typedef void (GLAD_API_PTR *PFNGLBUFFERDATAPROC)(GLenum target, GLsizeiptr size, const void * data, GLenum usage); +typedef void (GLAD_API_PTR *PFNGLBUFFERSUBDATAPROC)(GLenum target, GLintptr offset, GLsizeiptr size, const void * data); +typedef void (GLAD_API_PTR *PFNGLCALLLISTPROC)(GLuint list); +typedef void (GLAD_API_PTR *PFNGLCALLLISTSPROC)(GLsizei n, GLenum type, const void * lists); +typedef GLenum (GLAD_API_PTR *PFNGLCHECKFRAMEBUFFERSTATUSPROC)(GLenum target); +typedef void (GLAD_API_PTR *PFNGLCLAMPCOLORPROC)(GLenum target, GLenum clamp); +typedef void (GLAD_API_PTR *PFNGLCLEARPROC)(GLbitfield mask); +typedef void (GLAD_API_PTR *PFNGLCLEARACCUMPROC)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); +typedef void (GLAD_API_PTR *PFNGLCLEARBUFFERFIPROC)(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil); +typedef void (GLAD_API_PTR *PFNGLCLEARBUFFERFVPROC)(GLenum buffer, GLint drawbuffer, const GLfloat * value); +typedef void (GLAD_API_PTR *PFNGLCLEARBUFFERIVPROC)(GLenum buffer, GLint drawbuffer, const GLint * value); +typedef void (GLAD_API_PTR *PFNGLCLEARBUFFERUIVPROC)(GLenum buffer, GLint drawbuffer, const GLuint * value); +typedef void (GLAD_API_PTR *PFNGLCLEARCOLORPROC)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); +typedef void (GLAD_API_PTR *PFNGLCLEARDEPTHPROC)(GLdouble depth); +typedef void (GLAD_API_PTR *PFNGLCLEARINDEXPROC)(GLfloat c); +typedef void (GLAD_API_PTR *PFNGLCLEARSTENCILPROC)(GLint s); +typedef void (GLAD_API_PTR *PFNGLCLIENTACTIVETEXTUREPROC)(GLenum texture); +typedef GLenum (GLAD_API_PTR *PFNGLCLIENTWAITSYNCPROC)(GLsync sync, GLbitfield flags, GLuint64 timeout); +typedef void (GLAD_API_PTR *PFNGLCLIPPLANEPROC)(GLenum plane, const GLdouble * equation); +typedef void (GLAD_API_PTR *PFNGLCOLOR3BPROC)(GLbyte red, GLbyte green, GLbyte blue); +typedef void (GLAD_API_PTR *PFNGLCOLOR3BVPROC)(const GLbyte * v); +typedef void (GLAD_API_PTR *PFNGLCOLOR3DPROC)(GLdouble red, GLdouble green, GLdouble blue); +typedef void (GLAD_API_PTR *PFNGLCOLOR3DVPROC)(const GLdouble * v); +typedef void (GLAD_API_PTR *PFNGLCOLOR3FPROC)(GLfloat red, GLfloat green, GLfloat blue); +typedef void (GLAD_API_PTR *PFNGLCOLOR3FVPROC)(const GLfloat * v); +typedef void (GLAD_API_PTR *PFNGLCOLOR3IPROC)(GLint red, GLint green, GLint blue); +typedef void (GLAD_API_PTR *PFNGLCOLOR3IVPROC)(const GLint * v); +typedef void (GLAD_API_PTR *PFNGLCOLOR3SPROC)(GLshort red, GLshort green, GLshort blue); +typedef void (GLAD_API_PTR *PFNGLCOLOR3SVPROC)(const GLshort * v); +typedef void (GLAD_API_PTR *PFNGLCOLOR3UBPROC)(GLubyte red, GLubyte green, GLubyte blue); +typedef void (GLAD_API_PTR *PFNGLCOLOR3UBVPROC)(const GLubyte * v); +typedef void (GLAD_API_PTR *PFNGLCOLOR3UIPROC)(GLuint red, GLuint green, GLuint blue); +typedef void (GLAD_API_PTR *PFNGLCOLOR3UIVPROC)(const GLuint * v); +typedef void (GLAD_API_PTR *PFNGLCOLOR3USPROC)(GLushort red, GLushort green, GLushort blue); +typedef void (GLAD_API_PTR *PFNGLCOLOR3USVPROC)(const GLushort * v); +typedef void (GLAD_API_PTR *PFNGLCOLOR4BPROC)(GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha); +typedef void (GLAD_API_PTR *PFNGLCOLOR4BVPROC)(const GLbyte * v); +typedef void (GLAD_API_PTR *PFNGLCOLOR4DPROC)(GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha); +typedef void (GLAD_API_PTR *PFNGLCOLOR4DVPROC)(const GLdouble * v); +typedef void (GLAD_API_PTR *PFNGLCOLOR4FPROC)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); +typedef void (GLAD_API_PTR *PFNGLCOLOR4FVPROC)(const GLfloat * v); +typedef void (GLAD_API_PTR *PFNGLCOLOR4IPROC)(GLint red, GLint green, GLint blue, GLint alpha); +typedef void (GLAD_API_PTR *PFNGLCOLOR4IVPROC)(const GLint * v); +typedef void (GLAD_API_PTR *PFNGLCOLOR4SPROC)(GLshort red, GLshort green, GLshort blue, GLshort alpha); +typedef void (GLAD_API_PTR *PFNGLCOLOR4SVPROC)(const GLshort * v); +typedef void (GLAD_API_PTR *PFNGLCOLOR4UBPROC)(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha); +typedef void (GLAD_API_PTR *PFNGLCOLOR4UBVPROC)(const GLubyte * v); +typedef void (GLAD_API_PTR *PFNGLCOLOR4UIPROC)(GLuint red, GLuint green, GLuint blue, GLuint alpha); +typedef void (GLAD_API_PTR *PFNGLCOLOR4UIVPROC)(const GLuint * v); +typedef void (GLAD_API_PTR *PFNGLCOLOR4USPROC)(GLushort red, GLushort green, GLushort blue, GLushort alpha); +typedef void (GLAD_API_PTR *PFNGLCOLOR4USVPROC)(const GLushort * v); +typedef void (GLAD_API_PTR *PFNGLCOLORMASKPROC)(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); +typedef void (GLAD_API_PTR *PFNGLCOLORMASKIPROC)(GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a); +typedef void (GLAD_API_PTR *PFNGLCOLORMATERIALPROC)(GLenum face, GLenum mode); +typedef void (GLAD_API_PTR *PFNGLCOLORP3UIPROC)(GLenum type, GLuint color); +typedef void (GLAD_API_PTR *PFNGLCOLORP3UIVPROC)(GLenum type, const GLuint * color); +typedef void (GLAD_API_PTR *PFNGLCOLORP4UIPROC)(GLenum type, GLuint color); +typedef void (GLAD_API_PTR *PFNGLCOLORP4UIVPROC)(GLenum type, const GLuint * color); +typedef void (GLAD_API_PTR *PFNGLCOLORPOINTERPROC)(GLint size, GLenum type, GLsizei stride, const void * pointer); +typedef void (GLAD_API_PTR *PFNGLCOMPILESHADERPROC)(GLuint shader); +typedef void (GLAD_API_PTR *PFNGLCOMPRESSEDTEXIMAGE1DPROC)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const void * data); +typedef void (GLAD_API_PTR *PFNGLCOMPRESSEDTEXIMAGE2DPROC)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void * data); +typedef void (GLAD_API_PTR *PFNGLCOMPRESSEDTEXIMAGE3DPROC)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void * data); +typedef void (GLAD_API_PTR *PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void * data); +typedef void (GLAD_API_PTR *PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void * data); +typedef void (GLAD_API_PTR *PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void * data); +typedef void (GLAD_API_PTR *PFNGLCOPYBUFFERSUBDATAPROC)(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); +typedef void (GLAD_API_PTR *PFNGLCOPYPIXELSPROC)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type); +typedef void (GLAD_API_PTR *PFNGLCOPYTEXIMAGE1DPROC)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border); +typedef void (GLAD_API_PTR *PFNGLCOPYTEXIMAGE2DPROC)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); +typedef void (GLAD_API_PTR *PFNGLCOPYTEXSUBIMAGE1DPROC)(GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width); +typedef void (GLAD_API_PTR *PFNGLCOPYTEXSUBIMAGE2DPROC)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (GLAD_API_PTR *PFNGLCOPYTEXSUBIMAGE3DPROC)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); typedef GLuint (GLAD_API_PTR *PFNGLCREATEPROGRAMPROC)(void); -typedef GLuint (GLAD_API_PTR *PFNGLCREATESHADERPROC)(GLenum type); -typedef void (GLAD_API_PTR *PFNGLCULLFACEPROC)(GLenum mode); -typedef void (GLAD_API_PTR *PFNGLDEBUGMESSAGECALLBACKPROC)(GLDEBUGPROC callback, const void * userParam); -typedef void (GLAD_API_PTR *PFNGLDEBUGMESSAGECONTROLPROC)(GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint * ids, GLboolean enabled); -typedef void (GLAD_API_PTR *PFNGLDEBUGMESSAGEINSERTPROC)(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar * buf); -typedef void (GLAD_API_PTR *PFNGLDELETEBUFFERSPROC)(GLsizei n, const GLuint * buffers); -typedef void (GLAD_API_PTR *PFNGLDELETEFRAMEBUFFERSPROC)(GLsizei n, const GLuint * framebuffers); -typedef void (GLAD_API_PTR *PFNGLDELETELISTSPROC)(GLuint list, GLsizei range); -typedef void (GLAD_API_PTR *PFNGLDELETEPROGRAMPROC)(GLuint program); -typedef void (GLAD_API_PTR *PFNGLDELETEQUERIESPROC)(GLsizei n, const GLuint * ids); -typedef void (GLAD_API_PTR *PFNGLDELETERENDERBUFFERSPROC)(GLsizei n, const GLuint * renderbuffers); -typedef void (GLAD_API_PTR *PFNGLDELETESAMPLERSPROC)(GLsizei count, const GLuint * samplers); -typedef void (GLAD_API_PTR *PFNGLDELETESHADERPROC)(GLuint shader); -typedef void (GLAD_API_PTR *PFNGLDELETESYNCPROC)(GLsync sync); -typedef void (GLAD_API_PTR *PFNGLDELETETEXTURESPROC)(GLsizei n, const GLuint * textures); -typedef void (GLAD_API_PTR *PFNGLDELETEVERTEXARRAYSPROC)(GLsizei n, const GLuint * arrays); -typedef void (GLAD_API_PTR *PFNGLDEPTHFUNCPROC)(GLenum func); -typedef void (GLAD_API_PTR *PFNGLDEPTHMASKPROC)(GLboolean flag); -typedef void (GLAD_API_PTR *PFNGLDEPTHRANGEPROC)(GLdouble n, GLdouble f); -typedef void (GLAD_API_PTR *PFNGLDETACHSHADERPROC)(GLuint program, GLuint shader); -typedef void (GLAD_API_PTR *PFNGLDISABLEPROC)(GLenum cap); -typedef void (GLAD_API_PTR *PFNGLDISABLECLIENTSTATEPROC)(GLenum array); -typedef void (GLAD_API_PTR *PFNGLDISABLEVERTEXATTRIBARRAYPROC)(GLuint index); -typedef void (GLAD_API_PTR *PFNGLDISABLEIPROC)(GLenum target, GLuint index); -typedef void (GLAD_API_PTR *PFNGLDRAWARRAYSPROC)(GLenum mode, GLint first, GLsizei count); -typedef void (GLAD_API_PTR *PFNGLDRAWARRAYSINSTANCEDPROC)(GLenum mode, GLint first, GLsizei count, GLsizei instancecount); -typedef void (GLAD_API_PTR *PFNGLDRAWBUFFERPROC)(GLenum buf); -typedef void (GLAD_API_PTR *PFNGLDRAWBUFFERSPROC)(GLsizei n, const GLenum * bufs); -typedef void (GLAD_API_PTR *PFNGLDRAWELEMENTSPROC)(GLenum mode, GLsizei count, GLenum type, const void * indices); -typedef void (GLAD_API_PTR *PFNGLDRAWELEMENTSBASEVERTEXPROC)(GLenum mode, GLsizei count, GLenum type, const void * indices, GLint basevertex); -typedef void (GLAD_API_PTR *PFNGLDRAWELEMENTSINSTANCEDPROC)(GLenum mode, GLsizei count, GLenum type, const void * indices, GLsizei instancecount); -typedef void (GLAD_API_PTR *PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC)(GLenum mode, GLsizei count, GLenum type, const void * indices, GLsizei instancecount, GLint basevertex); -typedef void (GLAD_API_PTR *PFNGLDRAWPIXELSPROC)(GLsizei width, GLsizei height, GLenum format, GLenum type, const void * pixels); -typedef void (GLAD_API_PTR *PFNGLDRAWRANGEELEMENTSPROC)(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void * indices); -typedef void (GLAD_API_PTR *PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC)(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void * indices, GLint basevertex); -typedef void (GLAD_API_PTR *PFNGLEDGEFLAGPROC)(GLboolean flag); -typedef void (GLAD_API_PTR *PFNGLEDGEFLAGPOINTERPROC)(GLsizei stride, const void * pointer); -typedef void (GLAD_API_PTR *PFNGLEDGEFLAGVPROC)(const GLboolean * flag); -typedef void (GLAD_API_PTR *PFNGLENABLEPROC)(GLenum cap); -typedef void (GLAD_API_PTR *PFNGLENABLECLIENTSTATEPROC)(GLenum array); -typedef void (GLAD_API_PTR *PFNGLENABLEVERTEXATTRIBARRAYPROC)(GLuint index); -typedef void (GLAD_API_PTR *PFNGLENABLEIPROC)(GLenum target, GLuint index); +typedef GLuint (GLAD_API_PTR *PFNGLCREATESHADERPROC)(GLenum type); +typedef void (GLAD_API_PTR *PFNGLCULLFACEPROC)(GLenum mode); +typedef void (GLAD_API_PTR *PFNGLDEBUGMESSAGECALLBACKPROC)(GLDEBUGPROC callback, const void * userParam); +typedef void (GLAD_API_PTR *PFNGLDEBUGMESSAGECONTROLPROC)(GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint * ids, GLboolean enabled); +typedef void (GLAD_API_PTR *PFNGLDEBUGMESSAGEINSERTPROC)(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar * buf); +typedef void (GLAD_API_PTR *PFNGLDELETEBUFFERSPROC)(GLsizei n, const GLuint * buffers); +typedef void (GLAD_API_PTR *PFNGLDELETEFRAMEBUFFERSPROC)(GLsizei n, const GLuint * framebuffers); +typedef void (GLAD_API_PTR *PFNGLDELETELISTSPROC)(GLuint list, GLsizei range); +typedef void (GLAD_API_PTR *PFNGLDELETEPROGRAMPROC)(GLuint program); +typedef void (GLAD_API_PTR *PFNGLDELETEQUERIESPROC)(GLsizei n, const GLuint * ids); +typedef void (GLAD_API_PTR *PFNGLDELETERENDERBUFFERSPROC)(GLsizei n, const GLuint * renderbuffers); +typedef void (GLAD_API_PTR *PFNGLDELETESAMPLERSPROC)(GLsizei count, const GLuint * samplers); +typedef void (GLAD_API_PTR *PFNGLDELETESHADERPROC)(GLuint shader); +typedef void (GLAD_API_PTR *PFNGLDELETESYNCPROC)(GLsync sync); +typedef void (GLAD_API_PTR *PFNGLDELETETEXTURESPROC)(GLsizei n, const GLuint * textures); +typedef void (GLAD_API_PTR *PFNGLDELETEVERTEXARRAYSPROC)(GLsizei n, const GLuint * arrays); +typedef void (GLAD_API_PTR *PFNGLDEPTHFUNCPROC)(GLenum func); +typedef void (GLAD_API_PTR *PFNGLDEPTHMASKPROC)(GLboolean flag); +typedef void (GLAD_API_PTR *PFNGLDEPTHRANGEPROC)(GLdouble n, GLdouble f); +typedef void (GLAD_API_PTR *PFNGLDETACHSHADERPROC)(GLuint program, GLuint shader); +typedef void (GLAD_API_PTR *PFNGLDISABLEPROC)(GLenum cap); +typedef void (GLAD_API_PTR *PFNGLDISABLECLIENTSTATEPROC)(GLenum array); +typedef void (GLAD_API_PTR *PFNGLDISABLEVERTEXATTRIBARRAYPROC)(GLuint index); +typedef void (GLAD_API_PTR *PFNGLDISABLEIPROC)(GLenum target, GLuint index); +typedef void (GLAD_API_PTR *PFNGLDRAWARRAYSPROC)(GLenum mode, GLint first, GLsizei count); +typedef void (GLAD_API_PTR *PFNGLDRAWARRAYSINSTANCEDPROC)(GLenum mode, GLint first, GLsizei count, GLsizei instancecount); +typedef void (GLAD_API_PTR *PFNGLDRAWBUFFERPROC)(GLenum buf); +typedef void (GLAD_API_PTR *PFNGLDRAWBUFFERSPROC)(GLsizei n, const GLenum * bufs); +typedef void (GLAD_API_PTR *PFNGLDRAWELEMENTSPROC)(GLenum mode, GLsizei count, GLenum type, const void * indices); +typedef void (GLAD_API_PTR *PFNGLDRAWELEMENTSBASEVERTEXPROC)(GLenum mode, GLsizei count, GLenum type, const void * indices, GLint basevertex); +typedef void (GLAD_API_PTR *PFNGLDRAWELEMENTSINSTANCEDPROC)(GLenum mode, GLsizei count, GLenum type, const void * indices, GLsizei instancecount); +typedef void (GLAD_API_PTR *PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC)(GLenum mode, GLsizei count, GLenum type, const void * indices, GLsizei instancecount, GLint basevertex); +typedef void (GLAD_API_PTR *PFNGLDRAWPIXELSPROC)(GLsizei width, GLsizei height, GLenum format, GLenum type, const void * pixels); +typedef void (GLAD_API_PTR *PFNGLDRAWRANGEELEMENTSPROC)(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void * indices); +typedef void (GLAD_API_PTR *PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC)(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void * indices, GLint basevertex); +typedef void (GLAD_API_PTR *PFNGLEDGEFLAGPROC)(GLboolean flag); +typedef void (GLAD_API_PTR *PFNGLEDGEFLAGPOINTERPROC)(GLsizei stride, const void * pointer); +typedef void (GLAD_API_PTR *PFNGLEDGEFLAGVPROC)(const GLboolean * flag); +typedef void (GLAD_API_PTR *PFNGLENABLEPROC)(GLenum cap); +typedef void (GLAD_API_PTR *PFNGLENABLECLIENTSTATEPROC)(GLenum array); +typedef void (GLAD_API_PTR *PFNGLENABLEVERTEXATTRIBARRAYPROC)(GLuint index); +typedef void (GLAD_API_PTR *PFNGLENABLEIPROC)(GLenum target, GLuint index); typedef void (GLAD_API_PTR *PFNGLENDPROC)(void); typedef void (GLAD_API_PTR *PFNGLENDCONDITIONALRENDERPROC)(void); typedef void (GLAD_API_PTR *PFNGLENDLISTPROC)(void); -typedef void (GLAD_API_PTR *PFNGLENDQUERYPROC)(GLenum target); +typedef void (GLAD_API_PTR *PFNGLENDQUERYPROC)(GLenum target); typedef void (GLAD_API_PTR *PFNGLENDTRANSFORMFEEDBACKPROC)(void); -typedef void (GLAD_API_PTR *PFNGLEVALCOORD1DPROC)(GLdouble u); -typedef void (GLAD_API_PTR *PFNGLEVALCOORD1DVPROC)(const GLdouble * u); -typedef void (GLAD_API_PTR *PFNGLEVALCOORD1FPROC)(GLfloat u); -typedef void (GLAD_API_PTR *PFNGLEVALCOORD1FVPROC)(const GLfloat * u); -typedef void (GLAD_API_PTR *PFNGLEVALCOORD2DPROC)(GLdouble u, GLdouble v); -typedef void (GLAD_API_PTR *PFNGLEVALCOORD2DVPROC)(const GLdouble * u); -typedef void (GLAD_API_PTR *PFNGLEVALCOORD2FPROC)(GLfloat u, GLfloat v); -typedef void (GLAD_API_PTR *PFNGLEVALCOORD2FVPROC)(const GLfloat * u); -typedef void (GLAD_API_PTR *PFNGLEVALMESH1PROC)(GLenum mode, GLint i1, GLint i2); -typedef void (GLAD_API_PTR *PFNGLEVALMESH2PROC)(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2); -typedef void (GLAD_API_PTR *PFNGLEVALPOINT1PROC)(GLint i); -typedef void (GLAD_API_PTR *PFNGLEVALPOINT2PROC)(GLint i, GLint j); -typedef void (GLAD_API_PTR *PFNGLFEEDBACKBUFFERPROC)(GLsizei size, GLenum type, GLfloat * buffer); -typedef GLsync (GLAD_API_PTR *PFNGLFENCESYNCPROC)(GLenum condition, GLbitfield flags); +typedef void (GLAD_API_PTR *PFNGLEVALCOORD1DPROC)(GLdouble u); +typedef void (GLAD_API_PTR *PFNGLEVALCOORD1DVPROC)(const GLdouble * u); +typedef void (GLAD_API_PTR *PFNGLEVALCOORD1FPROC)(GLfloat u); +typedef void (GLAD_API_PTR *PFNGLEVALCOORD1FVPROC)(const GLfloat * u); +typedef void (GLAD_API_PTR *PFNGLEVALCOORD2DPROC)(GLdouble u, GLdouble v); +typedef void (GLAD_API_PTR *PFNGLEVALCOORD2DVPROC)(const GLdouble * u); +typedef void (GLAD_API_PTR *PFNGLEVALCOORD2FPROC)(GLfloat u, GLfloat v); +typedef void (GLAD_API_PTR *PFNGLEVALCOORD2FVPROC)(const GLfloat * u); +typedef void (GLAD_API_PTR *PFNGLEVALMESH1PROC)(GLenum mode, GLint i1, GLint i2); +typedef void (GLAD_API_PTR *PFNGLEVALMESH2PROC)(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2); +typedef void (GLAD_API_PTR *PFNGLEVALPOINT1PROC)(GLint i); +typedef void (GLAD_API_PTR *PFNGLEVALPOINT2PROC)(GLint i, GLint j); +typedef void (GLAD_API_PTR *PFNGLFEEDBACKBUFFERPROC)(GLsizei size, GLenum type, GLfloat * buffer); +typedef GLsync (GLAD_API_PTR *PFNGLFENCESYNCPROC)(GLenum condition, GLbitfield flags); typedef void (GLAD_API_PTR *PFNGLFINISHPROC)(void); typedef void (GLAD_API_PTR *PFNGLFLUSHPROC)(void); -typedef void (GLAD_API_PTR *PFNGLFLUSHMAPPEDBUFFERRANGEPROC)(GLenum target, GLintptr offset, GLsizeiptr length); -typedef void (GLAD_API_PTR *PFNGLFOGCOORDPOINTERPROC)(GLenum type, GLsizei stride, const void * pointer); -typedef void (GLAD_API_PTR *PFNGLFOGCOORDDPROC)(GLdouble coord); -typedef void (GLAD_API_PTR *PFNGLFOGCOORDDVPROC)(const GLdouble * coord); -typedef void (GLAD_API_PTR *PFNGLFOGCOORDFPROC)(GLfloat coord); -typedef void (GLAD_API_PTR *PFNGLFOGCOORDFVPROC)(const GLfloat * coord); -typedef void (GLAD_API_PTR *PFNGLFOGFPROC)(GLenum pname, GLfloat param); -typedef void (GLAD_API_PTR *PFNGLFOGFVPROC)(GLenum pname, const GLfloat * params); -typedef void (GLAD_API_PTR *PFNGLFOGIPROC)(GLenum pname, GLint param); -typedef void (GLAD_API_PTR *PFNGLFOGIVPROC)(GLenum pname, const GLint * params); -typedef void (GLAD_API_PTR *PFNGLFRAMEBUFFERRENDERBUFFERPROC)(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); -typedef void (GLAD_API_PTR *PFNGLFRAMEBUFFERTEXTUREPROC)(GLenum target, GLenum attachment, GLuint texture, GLint level); -typedef void (GLAD_API_PTR *PFNGLFRAMEBUFFERTEXTURE1DPROC)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); -typedef void (GLAD_API_PTR *PFNGLFRAMEBUFFERTEXTURE2DPROC)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); -typedef void (GLAD_API_PTR *PFNGLFRAMEBUFFERTEXTURE3DPROC)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); -typedef void (GLAD_API_PTR *PFNGLFRAMEBUFFERTEXTURELAYERPROC)(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); -typedef void (GLAD_API_PTR *PFNGLFRONTFACEPROC)(GLenum mode); -typedef void (GLAD_API_PTR *PFNGLFRUSTUMPROC)(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar); -typedef void (GLAD_API_PTR *PFNGLGENBUFFERSPROC)(GLsizei n, GLuint * buffers); -typedef void (GLAD_API_PTR *PFNGLGENFRAMEBUFFERSPROC)(GLsizei n, GLuint * framebuffers); -typedef GLuint (GLAD_API_PTR *PFNGLGENLISTSPROC)(GLsizei range); -typedef void (GLAD_API_PTR *PFNGLGENQUERIESPROC)(GLsizei n, GLuint * ids); -typedef void (GLAD_API_PTR *PFNGLGENRENDERBUFFERSPROC)(GLsizei n, GLuint * renderbuffers); -typedef void (GLAD_API_PTR *PFNGLGENSAMPLERSPROC)(GLsizei count, GLuint * samplers); -typedef void (GLAD_API_PTR *PFNGLGENTEXTURESPROC)(GLsizei n, GLuint * textures); -typedef void (GLAD_API_PTR *PFNGLGENVERTEXARRAYSPROC)(GLsizei n, GLuint * arrays); -typedef void (GLAD_API_PTR *PFNGLGENERATEMIPMAPPROC)(GLenum target); -typedef void (GLAD_API_PTR *PFNGLGETACTIVEATTRIBPROC)(GLuint program, GLuint index, GLsizei bufSize, GLsizei * length, GLint * size, GLenum * type, GLchar * name); -typedef void (GLAD_API_PTR *PFNGLGETACTIVEUNIFORMPROC)(GLuint program, GLuint index, GLsizei bufSize, GLsizei * length, GLint * size, GLenum * type, GLchar * name); -typedef void (GLAD_API_PTR *PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC)(GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei * length, GLchar * uniformBlockName); -typedef void (GLAD_API_PTR *PFNGLGETACTIVEUNIFORMBLOCKIVPROC)(GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint * params); -typedef void (GLAD_API_PTR *PFNGLGETACTIVEUNIFORMNAMEPROC)(GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei * length, GLchar * uniformName); -typedef void (GLAD_API_PTR *PFNGLGETACTIVEUNIFORMSIVPROC)(GLuint program, GLsizei uniformCount, const GLuint * uniformIndices, GLenum pname, GLint * params); -typedef void (GLAD_API_PTR *PFNGLGETATTACHEDSHADERSPROC)(GLuint program, GLsizei maxCount, GLsizei * count, GLuint * shaders); -typedef GLint (GLAD_API_PTR *PFNGLGETATTRIBLOCATIONPROC)(GLuint program, const GLchar * name); -typedef void (GLAD_API_PTR *PFNGLGETBOOLEANI_VPROC)(GLenum target, GLuint index, GLboolean * data); -typedef void (GLAD_API_PTR *PFNGLGETBOOLEANVPROC)(GLenum pname, GLboolean * data); -typedef void (GLAD_API_PTR *PFNGLGETBUFFERPARAMETERI64VPROC)(GLenum target, GLenum pname, GLint64 * params); -typedef void (GLAD_API_PTR *PFNGLGETBUFFERPARAMETERIVPROC)(GLenum target, GLenum pname, GLint * params); -typedef void (GLAD_API_PTR *PFNGLGETBUFFERPOINTERVPROC)(GLenum target, GLenum pname, void ** params); -typedef void (GLAD_API_PTR *PFNGLGETBUFFERSUBDATAPROC)(GLenum target, GLintptr offset, GLsizeiptr size, void * data); -typedef void (GLAD_API_PTR *PFNGLGETCLIPPLANEPROC)(GLenum plane, GLdouble * equation); -typedef void (GLAD_API_PTR *PFNGLGETCOMPRESSEDTEXIMAGEPROC)(GLenum target, GLint level, void * img); -typedef GLuint (GLAD_API_PTR *PFNGLGETDEBUGMESSAGELOGPROC)(GLuint count, GLsizei bufSize, GLenum * sources, GLenum * types, GLuint * ids, GLenum * severities, GLsizei * lengths, GLchar * messageLog); -typedef void (GLAD_API_PTR *PFNGLGETDOUBLEVPROC)(GLenum pname, GLdouble * data); +typedef void (GLAD_API_PTR *PFNGLFLUSHMAPPEDBUFFERRANGEPROC)(GLenum target, GLintptr offset, GLsizeiptr length); +typedef void (GLAD_API_PTR *PFNGLFOGCOORDPOINTERPROC)(GLenum type, GLsizei stride, const void * pointer); +typedef void (GLAD_API_PTR *PFNGLFOGCOORDDPROC)(GLdouble coord); +typedef void (GLAD_API_PTR *PFNGLFOGCOORDDVPROC)(const GLdouble * coord); +typedef void (GLAD_API_PTR *PFNGLFOGCOORDFPROC)(GLfloat coord); +typedef void (GLAD_API_PTR *PFNGLFOGCOORDFVPROC)(const GLfloat * coord); +typedef void (GLAD_API_PTR *PFNGLFOGFPROC)(GLenum pname, GLfloat param); +typedef void (GLAD_API_PTR *PFNGLFOGFVPROC)(GLenum pname, const GLfloat * params); +typedef void (GLAD_API_PTR *PFNGLFOGIPROC)(GLenum pname, GLint param); +typedef void (GLAD_API_PTR *PFNGLFOGIVPROC)(GLenum pname, const GLint * params); +typedef void (GLAD_API_PTR *PFNGLFRAMEBUFFERRENDERBUFFERPROC)(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); +typedef void (GLAD_API_PTR *PFNGLFRAMEBUFFERTEXTUREPROC)(GLenum target, GLenum attachment, GLuint texture, GLint level); +typedef void (GLAD_API_PTR *PFNGLFRAMEBUFFERTEXTURE1DPROC)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +typedef void (GLAD_API_PTR *PFNGLFRAMEBUFFERTEXTURE2DPROC)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +typedef void (GLAD_API_PTR *PFNGLFRAMEBUFFERTEXTURE3DPROC)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); +typedef void (GLAD_API_PTR *PFNGLFRAMEBUFFERTEXTURELAYERPROC)(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); +typedef void (GLAD_API_PTR *PFNGLFRONTFACEPROC)(GLenum mode); +typedef void (GLAD_API_PTR *PFNGLFRUSTUMPROC)(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar); +typedef void (GLAD_API_PTR *PFNGLGENBUFFERSPROC)(GLsizei n, GLuint * buffers); +typedef void (GLAD_API_PTR *PFNGLGENFRAMEBUFFERSPROC)(GLsizei n, GLuint * framebuffers); +typedef GLuint (GLAD_API_PTR *PFNGLGENLISTSPROC)(GLsizei range); +typedef void (GLAD_API_PTR *PFNGLGENQUERIESPROC)(GLsizei n, GLuint * ids); +typedef void (GLAD_API_PTR *PFNGLGENRENDERBUFFERSPROC)(GLsizei n, GLuint * renderbuffers); +typedef void (GLAD_API_PTR *PFNGLGENSAMPLERSPROC)(GLsizei count, GLuint * samplers); +typedef void (GLAD_API_PTR *PFNGLGENTEXTURESPROC)(GLsizei n, GLuint * textures); +typedef void (GLAD_API_PTR *PFNGLGENVERTEXARRAYSPROC)(GLsizei n, GLuint * arrays); +typedef void (GLAD_API_PTR *PFNGLGENERATEMIPMAPPROC)(GLenum target); +typedef void (GLAD_API_PTR *PFNGLGETACTIVEATTRIBPROC)(GLuint program, GLuint index, GLsizei bufSize, GLsizei * length, GLint * size, GLenum * type, GLchar * name); +typedef void (GLAD_API_PTR *PFNGLGETACTIVEUNIFORMPROC)(GLuint program, GLuint index, GLsizei bufSize, GLsizei * length, GLint * size, GLenum * type, GLchar * name); +typedef void (GLAD_API_PTR *PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC)(GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei * length, GLchar * uniformBlockName); +typedef void (GLAD_API_PTR *PFNGLGETACTIVEUNIFORMBLOCKIVPROC)(GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint * params); +typedef void (GLAD_API_PTR *PFNGLGETACTIVEUNIFORMNAMEPROC)(GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei * length, GLchar * uniformName); +typedef void (GLAD_API_PTR *PFNGLGETACTIVEUNIFORMSIVPROC)(GLuint program, GLsizei uniformCount, const GLuint * uniformIndices, GLenum pname, GLint * params); +typedef void (GLAD_API_PTR *PFNGLGETATTACHEDSHADERSPROC)(GLuint program, GLsizei maxCount, GLsizei * count, GLuint * shaders); +typedef GLint (GLAD_API_PTR *PFNGLGETATTRIBLOCATIONPROC)(GLuint program, const GLchar * name); +typedef void (GLAD_API_PTR *PFNGLGETBOOLEANI_VPROC)(GLenum target, GLuint index, GLboolean * data); +typedef void (GLAD_API_PTR *PFNGLGETBOOLEANVPROC)(GLenum pname, GLboolean * data); +typedef void (GLAD_API_PTR *PFNGLGETBUFFERPARAMETERI64VPROC)(GLenum target, GLenum pname, GLint64 * params); +typedef void (GLAD_API_PTR *PFNGLGETBUFFERPARAMETERIVPROC)(GLenum target, GLenum pname, GLint * params); +typedef void (GLAD_API_PTR *PFNGLGETBUFFERPOINTERVPROC)(GLenum target, GLenum pname, void ** params); +typedef void (GLAD_API_PTR *PFNGLGETBUFFERSUBDATAPROC)(GLenum target, GLintptr offset, GLsizeiptr size, void * data); +typedef void (GLAD_API_PTR *PFNGLGETCLIPPLANEPROC)(GLenum plane, GLdouble * equation); +typedef void (GLAD_API_PTR *PFNGLGETCOMPRESSEDTEXIMAGEPROC)(GLenum target, GLint level, void * img); +typedef GLuint (GLAD_API_PTR *PFNGLGETDEBUGMESSAGELOGPROC)(GLuint count, GLsizei bufSize, GLenum * sources, GLenum * types, GLuint * ids, GLenum * severities, GLsizei * lengths, GLchar * messageLog); +typedef void (GLAD_API_PTR *PFNGLGETDOUBLEVPROC)(GLenum pname, GLdouble * data); typedef GLenum (GLAD_API_PTR *PFNGLGETERRORPROC)(void); -typedef void (GLAD_API_PTR *PFNGLGETFLOATVPROC)(GLenum pname, GLfloat * data); -typedef GLint (GLAD_API_PTR *PFNGLGETFRAGDATAINDEXPROC)(GLuint program, const GLchar * name); -typedef GLint (GLAD_API_PTR *PFNGLGETFRAGDATALOCATIONPROC)(GLuint program, const GLchar * name); -typedef void (GLAD_API_PTR *PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC)(GLenum target, GLenum attachment, GLenum pname, GLint * params); +typedef void (GLAD_API_PTR *PFNGLGETFLOATVPROC)(GLenum pname, GLfloat * data); +typedef GLint (GLAD_API_PTR *PFNGLGETFRAGDATAINDEXPROC)(GLuint program, const GLchar * name); +typedef GLint (GLAD_API_PTR *PFNGLGETFRAGDATALOCATIONPROC)(GLuint program, const GLchar * name); +typedef void (GLAD_API_PTR *PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC)(GLenum target, GLenum attachment, GLenum pname, GLint * params); typedef GLenum (GLAD_API_PTR *PFNGLGETGRAPHICSRESETSTATUSARBPROC)(void); -typedef void (GLAD_API_PTR *PFNGLGETINTEGER64I_VPROC)(GLenum target, GLuint index, GLint64 * data); -typedef void (GLAD_API_PTR *PFNGLGETINTEGER64VPROC)(GLenum pname, GLint64 * data); -typedef void (GLAD_API_PTR *PFNGLGETINTEGERI_VPROC)(GLenum target, GLuint index, GLint * data); -typedef void (GLAD_API_PTR *PFNGLGETINTEGERVPROC)(GLenum pname, GLint * data); -typedef void (GLAD_API_PTR *PFNGLGETLIGHTFVPROC)(GLenum light, GLenum pname, GLfloat * params); -typedef void (GLAD_API_PTR *PFNGLGETLIGHTIVPROC)(GLenum light, GLenum pname, GLint * params); -typedef void (GLAD_API_PTR *PFNGLGETMAPDVPROC)(GLenum target, GLenum query, GLdouble * v); -typedef void (GLAD_API_PTR *PFNGLGETMAPFVPROC)(GLenum target, GLenum query, GLfloat * v); -typedef void (GLAD_API_PTR *PFNGLGETMAPIVPROC)(GLenum target, GLenum query, GLint * v); -typedef void (GLAD_API_PTR *PFNGLGETMATERIALFVPROC)(GLenum face, GLenum pname, GLfloat * params); -typedef void (GLAD_API_PTR *PFNGLGETMATERIALIVPROC)(GLenum face, GLenum pname, GLint * params); -typedef void (GLAD_API_PTR *PFNGLGETMULTISAMPLEFVPROC)(GLenum pname, GLuint index, GLfloat * val); -typedef void (GLAD_API_PTR *PFNGLGETOBJECTLABELPROC)(GLenum identifier, GLuint name, GLsizei bufSize, GLsizei * length, GLchar * label); -typedef void (GLAD_API_PTR *PFNGLGETOBJECTPTRLABELPROC)(const void * ptr, GLsizei bufSize, GLsizei * length, GLchar * label); -typedef void (GLAD_API_PTR *PFNGLGETPIXELMAPFVPROC)(GLenum map, GLfloat * values); -typedef void (GLAD_API_PTR *PFNGLGETPIXELMAPUIVPROC)(GLenum map, GLuint * values); -typedef void (GLAD_API_PTR *PFNGLGETPIXELMAPUSVPROC)(GLenum map, GLushort * values); -typedef void (GLAD_API_PTR *PFNGLGETPOINTERVPROC)(GLenum pname, void ** params); -typedef void (GLAD_API_PTR *PFNGLGETPOLYGONSTIPPLEPROC)(GLubyte * mask); -typedef void (GLAD_API_PTR *PFNGLGETPROGRAMINFOLOGPROC)(GLuint program, GLsizei bufSize, GLsizei * length, GLchar * infoLog); -typedef void (GLAD_API_PTR *PFNGLGETPROGRAMIVPROC)(GLuint program, GLenum pname, GLint * params); -typedef void (GLAD_API_PTR *PFNGLGETQUERYOBJECTI64VPROC)(GLuint id, GLenum pname, GLint64 * params); -typedef void (GLAD_API_PTR *PFNGLGETQUERYOBJECTIVPROC)(GLuint id, GLenum pname, GLint * params); -typedef void (GLAD_API_PTR *PFNGLGETQUERYOBJECTUI64VPROC)(GLuint id, GLenum pname, GLuint64 * params); -typedef void (GLAD_API_PTR *PFNGLGETQUERYOBJECTUIVPROC)(GLuint id, GLenum pname, GLuint * params); -typedef void (GLAD_API_PTR *PFNGLGETQUERYIVPROC)(GLenum target, GLenum pname, GLint * params); -typedef void (GLAD_API_PTR *PFNGLGETRENDERBUFFERPARAMETERIVPROC)(GLenum target, GLenum pname, GLint * params); -typedef void (GLAD_API_PTR *PFNGLGETSAMPLERPARAMETERIIVPROC)(GLuint sampler, GLenum pname, GLint * params); -typedef void (GLAD_API_PTR *PFNGLGETSAMPLERPARAMETERIUIVPROC)(GLuint sampler, GLenum pname, GLuint * params); -typedef void (GLAD_API_PTR *PFNGLGETSAMPLERPARAMETERFVPROC)(GLuint sampler, GLenum pname, GLfloat * params); -typedef void (GLAD_API_PTR *PFNGLGETSAMPLERPARAMETERIVPROC)(GLuint sampler, GLenum pname, GLint * params); -typedef void (GLAD_API_PTR *PFNGLGETSHADERINFOLOGPROC)(GLuint shader, GLsizei bufSize, GLsizei * length, GLchar * infoLog); -typedef void (GLAD_API_PTR *PFNGLGETSHADERSOURCEPROC)(GLuint shader, GLsizei bufSize, GLsizei * length, GLchar * source); -typedef void (GLAD_API_PTR *PFNGLGETSHADERIVPROC)(GLuint shader, GLenum pname, GLint * params); -typedef const GLubyte * (GLAD_API_PTR *PFNGLGETSTRINGPROC)(GLenum name); -typedef const GLubyte * (GLAD_API_PTR *PFNGLGETSTRINGIPROC)(GLenum name, GLuint index); -typedef void (GLAD_API_PTR *PFNGLGETSYNCIVPROC)(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei * length, GLint * values); -typedef void (GLAD_API_PTR *PFNGLGETTEXENVFVPROC)(GLenum target, GLenum pname, GLfloat * params); -typedef void (GLAD_API_PTR *PFNGLGETTEXENVIVPROC)(GLenum target, GLenum pname, GLint * params); -typedef void (GLAD_API_PTR *PFNGLGETTEXGENDVPROC)(GLenum coord, GLenum pname, GLdouble * params); -typedef void (GLAD_API_PTR *PFNGLGETTEXGENFVPROC)(GLenum coord, GLenum pname, GLfloat * params); -typedef void (GLAD_API_PTR *PFNGLGETTEXGENIVPROC)(GLenum coord, GLenum pname, GLint * params); -typedef void (GLAD_API_PTR *PFNGLGETTEXIMAGEPROC)(GLenum target, GLint level, GLenum format, GLenum type, void * pixels); -typedef void (GLAD_API_PTR *PFNGLGETTEXLEVELPARAMETERFVPROC)(GLenum target, GLint level, GLenum pname, GLfloat * params); -typedef void (GLAD_API_PTR *PFNGLGETTEXLEVELPARAMETERIVPROC)(GLenum target, GLint level, GLenum pname, GLint * params); -typedef void (GLAD_API_PTR *PFNGLGETTEXPARAMETERIIVPROC)(GLenum target, GLenum pname, GLint * params); -typedef void (GLAD_API_PTR *PFNGLGETTEXPARAMETERIUIVPROC)(GLenum target, GLenum pname, GLuint * params); -typedef void (GLAD_API_PTR *PFNGLGETTEXPARAMETERFVPROC)(GLenum target, GLenum pname, GLfloat * params); -typedef void (GLAD_API_PTR *PFNGLGETTEXPARAMETERIVPROC)(GLenum target, GLenum pname, GLint * params); -typedef void (GLAD_API_PTR *PFNGLGETTRANSFORMFEEDBACKVARYINGPROC)(GLuint program, GLuint index, GLsizei bufSize, GLsizei * length, GLsizei * size, GLenum * type, GLchar * name); -typedef GLuint (GLAD_API_PTR *PFNGLGETUNIFORMBLOCKINDEXPROC)(GLuint program, const GLchar * uniformBlockName); -typedef void (GLAD_API_PTR *PFNGLGETUNIFORMINDICESPROC)(GLuint program, GLsizei uniformCount, const GLchar *const* uniformNames, GLuint * uniformIndices); -typedef GLint (GLAD_API_PTR *PFNGLGETUNIFORMLOCATIONPROC)(GLuint program, const GLchar * name); -typedef void (GLAD_API_PTR *PFNGLGETUNIFORMFVPROC)(GLuint program, GLint location, GLfloat * params); -typedef void (GLAD_API_PTR *PFNGLGETUNIFORMIVPROC)(GLuint program, GLint location, GLint * params); -typedef void (GLAD_API_PTR *PFNGLGETUNIFORMUIVPROC)(GLuint program, GLint location, GLuint * params); -typedef void (GLAD_API_PTR *PFNGLGETVERTEXATTRIBIIVPROC)(GLuint index, GLenum pname, GLint * params); -typedef void (GLAD_API_PTR *PFNGLGETVERTEXATTRIBIUIVPROC)(GLuint index, GLenum pname, GLuint * params); -typedef void (GLAD_API_PTR *PFNGLGETVERTEXATTRIBPOINTERVPROC)(GLuint index, GLenum pname, void ** pointer); -typedef void (GLAD_API_PTR *PFNGLGETVERTEXATTRIBDVPROC)(GLuint index, GLenum pname, GLdouble * params); -typedef void (GLAD_API_PTR *PFNGLGETVERTEXATTRIBFVPROC)(GLuint index, GLenum pname, GLfloat * params); -typedef void (GLAD_API_PTR *PFNGLGETVERTEXATTRIBIVPROC)(GLuint index, GLenum pname, GLint * params); -typedef void (GLAD_API_PTR *PFNGLGETNCOLORTABLEARBPROC)(GLenum target, GLenum format, GLenum type, GLsizei bufSize, void * table); -typedef void (GLAD_API_PTR *PFNGLGETNCOMPRESSEDTEXIMAGEARBPROC)(GLenum target, GLint lod, GLsizei bufSize, void * img); -typedef void (GLAD_API_PTR *PFNGLGETNCONVOLUTIONFILTERARBPROC)(GLenum target, GLenum format, GLenum type, GLsizei bufSize, void * image); -typedef void (GLAD_API_PTR *PFNGLGETNHISTOGRAMARBPROC)(GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, void * values); -typedef void (GLAD_API_PTR *PFNGLGETNMAPDVARBPROC)(GLenum target, GLenum query, GLsizei bufSize, GLdouble * v); -typedef void (GLAD_API_PTR *PFNGLGETNMAPFVARBPROC)(GLenum target, GLenum query, GLsizei bufSize, GLfloat * v); -typedef void (GLAD_API_PTR *PFNGLGETNMAPIVARBPROC)(GLenum target, GLenum query, GLsizei bufSize, GLint * v); -typedef void (GLAD_API_PTR *PFNGLGETNMINMAXARBPROC)(GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, void * values); -typedef void (GLAD_API_PTR *PFNGLGETNPIXELMAPFVARBPROC)(GLenum map, GLsizei bufSize, GLfloat * values); -typedef void (GLAD_API_PTR *PFNGLGETNPIXELMAPUIVARBPROC)(GLenum map, GLsizei bufSize, GLuint * values); -typedef void (GLAD_API_PTR *PFNGLGETNPIXELMAPUSVARBPROC)(GLenum map, GLsizei bufSize, GLushort * values); -typedef void (GLAD_API_PTR *PFNGLGETNPOLYGONSTIPPLEARBPROC)(GLsizei bufSize, GLubyte * pattern); -typedef void (GLAD_API_PTR *PFNGLGETNSEPARABLEFILTERARBPROC)(GLenum target, GLenum format, GLenum type, GLsizei rowBufSize, void * row, GLsizei columnBufSize, void * column, void * span); -typedef void (GLAD_API_PTR *PFNGLGETNTEXIMAGEARBPROC)(GLenum target, GLint level, GLenum format, GLenum type, GLsizei bufSize, void * img); -typedef void (GLAD_API_PTR *PFNGLGETNUNIFORMDVARBPROC)(GLuint program, GLint location, GLsizei bufSize, GLdouble * params); -typedef void (GLAD_API_PTR *PFNGLGETNUNIFORMFVARBPROC)(GLuint program, GLint location, GLsizei bufSize, GLfloat * params); -typedef void (GLAD_API_PTR *PFNGLGETNUNIFORMIVARBPROC)(GLuint program, GLint location, GLsizei bufSize, GLint * params); -typedef void (GLAD_API_PTR *PFNGLGETNUNIFORMUIVARBPROC)(GLuint program, GLint location, GLsizei bufSize, GLuint * params); -typedef void (GLAD_API_PTR *PFNGLHINTPROC)(GLenum target, GLenum mode); -typedef void (GLAD_API_PTR *PFNGLINDEXMASKPROC)(GLuint mask); -typedef void (GLAD_API_PTR *PFNGLINDEXPOINTERPROC)(GLenum type, GLsizei stride, const void * pointer); -typedef void (GLAD_API_PTR *PFNGLINDEXDPROC)(GLdouble c); -typedef void (GLAD_API_PTR *PFNGLINDEXDVPROC)(const GLdouble * c); -typedef void (GLAD_API_PTR *PFNGLINDEXFPROC)(GLfloat c); -typedef void (GLAD_API_PTR *PFNGLINDEXFVPROC)(const GLfloat * c); -typedef void (GLAD_API_PTR *PFNGLINDEXIPROC)(GLint c); -typedef void (GLAD_API_PTR *PFNGLINDEXIVPROC)(const GLint * c); -typedef void (GLAD_API_PTR *PFNGLINDEXSPROC)(GLshort c); -typedef void (GLAD_API_PTR *PFNGLINDEXSVPROC)(const GLshort * c); -typedef void (GLAD_API_PTR *PFNGLINDEXUBPROC)(GLubyte c); -typedef void (GLAD_API_PTR *PFNGLINDEXUBVPROC)(const GLubyte * c); +typedef void (GLAD_API_PTR *PFNGLGETINTEGER64I_VPROC)(GLenum target, GLuint index, GLint64 * data); +typedef void (GLAD_API_PTR *PFNGLGETINTEGER64VPROC)(GLenum pname, GLint64 * data); +typedef void (GLAD_API_PTR *PFNGLGETINTEGERI_VPROC)(GLenum target, GLuint index, GLint * data); +typedef void (GLAD_API_PTR *PFNGLGETINTEGERVPROC)(GLenum pname, GLint * data); +typedef void (GLAD_API_PTR *PFNGLGETLIGHTFVPROC)(GLenum light, GLenum pname, GLfloat * params); +typedef void (GLAD_API_PTR *PFNGLGETLIGHTIVPROC)(GLenum light, GLenum pname, GLint * params); +typedef void (GLAD_API_PTR *PFNGLGETMAPDVPROC)(GLenum target, GLenum query, GLdouble * v); +typedef void (GLAD_API_PTR *PFNGLGETMAPFVPROC)(GLenum target, GLenum query, GLfloat * v); +typedef void (GLAD_API_PTR *PFNGLGETMAPIVPROC)(GLenum target, GLenum query, GLint * v); +typedef void (GLAD_API_PTR *PFNGLGETMATERIALFVPROC)(GLenum face, GLenum pname, GLfloat * params); +typedef void (GLAD_API_PTR *PFNGLGETMATERIALIVPROC)(GLenum face, GLenum pname, GLint * params); +typedef void (GLAD_API_PTR *PFNGLGETMULTISAMPLEFVPROC)(GLenum pname, GLuint index, GLfloat * val); +typedef void (GLAD_API_PTR *PFNGLGETOBJECTLABELPROC)(GLenum identifier, GLuint name, GLsizei bufSize, GLsizei * length, GLchar * label); +typedef void (GLAD_API_PTR *PFNGLGETOBJECTPTRLABELPROC)(const void * ptr, GLsizei bufSize, GLsizei * length, GLchar * label); +typedef void (GLAD_API_PTR *PFNGLGETPIXELMAPFVPROC)(GLenum map, GLfloat * values); +typedef void (GLAD_API_PTR *PFNGLGETPIXELMAPUIVPROC)(GLenum map, GLuint * values); +typedef void (GLAD_API_PTR *PFNGLGETPIXELMAPUSVPROC)(GLenum map, GLushort * values); +typedef void (GLAD_API_PTR *PFNGLGETPOINTERVPROC)(GLenum pname, void ** params); +typedef void (GLAD_API_PTR *PFNGLGETPOLYGONSTIPPLEPROC)(GLubyte * mask); +typedef void (GLAD_API_PTR *PFNGLGETPROGRAMINFOLOGPROC)(GLuint program, GLsizei bufSize, GLsizei * length, GLchar * infoLog); +typedef void (GLAD_API_PTR *PFNGLGETPROGRAMIVPROC)(GLuint program, GLenum pname, GLint * params); +typedef void (GLAD_API_PTR *PFNGLGETQUERYOBJECTI64VPROC)(GLuint id, GLenum pname, GLint64 * params); +typedef void (GLAD_API_PTR *PFNGLGETQUERYOBJECTIVPROC)(GLuint id, GLenum pname, GLint * params); +typedef void (GLAD_API_PTR *PFNGLGETQUERYOBJECTUI64VPROC)(GLuint id, GLenum pname, GLuint64 * params); +typedef void (GLAD_API_PTR *PFNGLGETQUERYOBJECTUIVPROC)(GLuint id, GLenum pname, GLuint * params); +typedef void (GLAD_API_PTR *PFNGLGETQUERYIVPROC)(GLenum target, GLenum pname, GLint * params); +typedef void (GLAD_API_PTR *PFNGLGETRENDERBUFFERPARAMETERIVPROC)(GLenum target, GLenum pname, GLint * params); +typedef void (GLAD_API_PTR *PFNGLGETSAMPLERPARAMETERIIVPROC)(GLuint sampler, GLenum pname, GLint * params); +typedef void (GLAD_API_PTR *PFNGLGETSAMPLERPARAMETERIUIVPROC)(GLuint sampler, GLenum pname, GLuint * params); +typedef void (GLAD_API_PTR *PFNGLGETSAMPLERPARAMETERFVPROC)(GLuint sampler, GLenum pname, GLfloat * params); +typedef void (GLAD_API_PTR *PFNGLGETSAMPLERPARAMETERIVPROC)(GLuint sampler, GLenum pname, GLint * params); +typedef void (GLAD_API_PTR *PFNGLGETSHADERINFOLOGPROC)(GLuint shader, GLsizei bufSize, GLsizei * length, GLchar * infoLog); +typedef void (GLAD_API_PTR *PFNGLGETSHADERSOURCEPROC)(GLuint shader, GLsizei bufSize, GLsizei * length, GLchar * source); +typedef void (GLAD_API_PTR *PFNGLGETSHADERIVPROC)(GLuint shader, GLenum pname, GLint * params); +typedef const GLubyte * (GLAD_API_PTR *PFNGLGETSTRINGPROC)(GLenum name); +typedef const GLubyte * (GLAD_API_PTR *PFNGLGETSTRINGIPROC)(GLenum name, GLuint index); +typedef void (GLAD_API_PTR *PFNGLGETSYNCIVPROC)(GLsync sync, GLenum pname, GLsizei count, GLsizei * length, GLint * values); +typedef void (GLAD_API_PTR *PFNGLGETTEXENVFVPROC)(GLenum target, GLenum pname, GLfloat * params); +typedef void (GLAD_API_PTR *PFNGLGETTEXENVIVPROC)(GLenum target, GLenum pname, GLint * params); +typedef void (GLAD_API_PTR *PFNGLGETTEXGENDVPROC)(GLenum coord, GLenum pname, GLdouble * params); +typedef void (GLAD_API_PTR *PFNGLGETTEXGENFVPROC)(GLenum coord, GLenum pname, GLfloat * params); +typedef void (GLAD_API_PTR *PFNGLGETTEXGENIVPROC)(GLenum coord, GLenum pname, GLint * params); +typedef void (GLAD_API_PTR *PFNGLGETTEXIMAGEPROC)(GLenum target, GLint level, GLenum format, GLenum type, void * pixels); +typedef void (GLAD_API_PTR *PFNGLGETTEXLEVELPARAMETERFVPROC)(GLenum target, GLint level, GLenum pname, GLfloat * params); +typedef void (GLAD_API_PTR *PFNGLGETTEXLEVELPARAMETERIVPROC)(GLenum target, GLint level, GLenum pname, GLint * params); +typedef void (GLAD_API_PTR *PFNGLGETTEXPARAMETERIIVPROC)(GLenum target, GLenum pname, GLint * params); +typedef void (GLAD_API_PTR *PFNGLGETTEXPARAMETERIUIVPROC)(GLenum target, GLenum pname, GLuint * params); +typedef void (GLAD_API_PTR *PFNGLGETTEXPARAMETERFVPROC)(GLenum target, GLenum pname, GLfloat * params); +typedef void (GLAD_API_PTR *PFNGLGETTEXPARAMETERIVPROC)(GLenum target, GLenum pname, GLint * params); +typedef void (GLAD_API_PTR *PFNGLGETTRANSFORMFEEDBACKVARYINGPROC)(GLuint program, GLuint index, GLsizei bufSize, GLsizei * length, GLsizei * size, GLenum * type, GLchar * name); +typedef GLuint (GLAD_API_PTR *PFNGLGETUNIFORMBLOCKINDEXPROC)(GLuint program, const GLchar * uniformBlockName); +typedef void (GLAD_API_PTR *PFNGLGETUNIFORMINDICESPROC)(GLuint program, GLsizei uniformCount, const GLchar *const* uniformNames, GLuint * uniformIndices); +typedef GLint (GLAD_API_PTR *PFNGLGETUNIFORMLOCATIONPROC)(GLuint program, const GLchar * name); +typedef void (GLAD_API_PTR *PFNGLGETUNIFORMFVPROC)(GLuint program, GLint location, GLfloat * params); +typedef void (GLAD_API_PTR *PFNGLGETUNIFORMIVPROC)(GLuint program, GLint location, GLint * params); +typedef void (GLAD_API_PTR *PFNGLGETUNIFORMUIVPROC)(GLuint program, GLint location, GLuint * params); +typedef void (GLAD_API_PTR *PFNGLGETVERTEXATTRIBIIVPROC)(GLuint index, GLenum pname, GLint * params); +typedef void (GLAD_API_PTR *PFNGLGETVERTEXATTRIBIUIVPROC)(GLuint index, GLenum pname, GLuint * params); +typedef void (GLAD_API_PTR *PFNGLGETVERTEXATTRIBPOINTERVPROC)(GLuint index, GLenum pname, void ** pointer); +typedef void (GLAD_API_PTR *PFNGLGETVERTEXATTRIBDVPROC)(GLuint index, GLenum pname, GLdouble * params); +typedef void (GLAD_API_PTR *PFNGLGETVERTEXATTRIBFVPROC)(GLuint index, GLenum pname, GLfloat * params); +typedef void (GLAD_API_PTR *PFNGLGETVERTEXATTRIBIVPROC)(GLuint index, GLenum pname, GLint * params); +typedef void (GLAD_API_PTR *PFNGLGETNCOLORTABLEARBPROC)(GLenum target, GLenum format, GLenum type, GLsizei bufSize, void * table); +typedef void (GLAD_API_PTR *PFNGLGETNCOMPRESSEDTEXIMAGEARBPROC)(GLenum target, GLint lod, GLsizei bufSize, void * img); +typedef void (GLAD_API_PTR *PFNGLGETNCONVOLUTIONFILTERARBPROC)(GLenum target, GLenum format, GLenum type, GLsizei bufSize, void * image); +typedef void (GLAD_API_PTR *PFNGLGETNHISTOGRAMARBPROC)(GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, void * values); +typedef void (GLAD_API_PTR *PFNGLGETNMAPDVARBPROC)(GLenum target, GLenum query, GLsizei bufSize, GLdouble * v); +typedef void (GLAD_API_PTR *PFNGLGETNMAPFVARBPROC)(GLenum target, GLenum query, GLsizei bufSize, GLfloat * v); +typedef void (GLAD_API_PTR *PFNGLGETNMAPIVARBPROC)(GLenum target, GLenum query, GLsizei bufSize, GLint * v); +typedef void (GLAD_API_PTR *PFNGLGETNMINMAXARBPROC)(GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, void * values); +typedef void (GLAD_API_PTR *PFNGLGETNPIXELMAPFVARBPROC)(GLenum map, GLsizei bufSize, GLfloat * values); +typedef void (GLAD_API_PTR *PFNGLGETNPIXELMAPUIVARBPROC)(GLenum map, GLsizei bufSize, GLuint * values); +typedef void (GLAD_API_PTR *PFNGLGETNPIXELMAPUSVARBPROC)(GLenum map, GLsizei bufSize, GLushort * values); +typedef void (GLAD_API_PTR *PFNGLGETNPOLYGONSTIPPLEARBPROC)(GLsizei bufSize, GLubyte * pattern); +typedef void (GLAD_API_PTR *PFNGLGETNSEPARABLEFILTERARBPROC)(GLenum target, GLenum format, GLenum type, GLsizei rowBufSize, void * row, GLsizei columnBufSize, void * column, void * span); +typedef void (GLAD_API_PTR *PFNGLGETNTEXIMAGEARBPROC)(GLenum target, GLint level, GLenum format, GLenum type, GLsizei bufSize, void * img); +typedef void (GLAD_API_PTR *PFNGLGETNUNIFORMDVARBPROC)(GLuint program, GLint location, GLsizei bufSize, GLdouble * params); +typedef void (GLAD_API_PTR *PFNGLGETNUNIFORMFVARBPROC)(GLuint program, GLint location, GLsizei bufSize, GLfloat * params); +typedef void (GLAD_API_PTR *PFNGLGETNUNIFORMIVARBPROC)(GLuint program, GLint location, GLsizei bufSize, GLint * params); +typedef void (GLAD_API_PTR *PFNGLGETNUNIFORMUIVARBPROC)(GLuint program, GLint location, GLsizei bufSize, GLuint * params); +typedef void (GLAD_API_PTR *PFNGLHINTPROC)(GLenum target, GLenum mode); +typedef void (GLAD_API_PTR *PFNGLINDEXMASKPROC)(GLuint mask); +typedef void (GLAD_API_PTR *PFNGLINDEXPOINTERPROC)(GLenum type, GLsizei stride, const void * pointer); +typedef void (GLAD_API_PTR *PFNGLINDEXDPROC)(GLdouble c); +typedef void (GLAD_API_PTR *PFNGLINDEXDVPROC)(const GLdouble * c); +typedef void (GLAD_API_PTR *PFNGLINDEXFPROC)(GLfloat c); +typedef void (GLAD_API_PTR *PFNGLINDEXFVPROC)(const GLfloat * c); +typedef void (GLAD_API_PTR *PFNGLINDEXIPROC)(GLint c); +typedef void (GLAD_API_PTR *PFNGLINDEXIVPROC)(const GLint * c); +typedef void (GLAD_API_PTR *PFNGLINDEXSPROC)(GLshort c); +typedef void (GLAD_API_PTR *PFNGLINDEXSVPROC)(const GLshort * c); +typedef void (GLAD_API_PTR *PFNGLINDEXUBPROC)(GLubyte c); +typedef void (GLAD_API_PTR *PFNGLINDEXUBVPROC)(const GLubyte * c); typedef void (GLAD_API_PTR *PFNGLINITNAMESPROC)(void); -typedef void (GLAD_API_PTR *PFNGLINTERLEAVEDARRAYSPROC)(GLenum format, GLsizei stride, const void * pointer); -typedef GLboolean (GLAD_API_PTR *PFNGLISBUFFERPROC)(GLuint buffer); -typedef GLboolean (GLAD_API_PTR *PFNGLISENABLEDPROC)(GLenum cap); -typedef GLboolean (GLAD_API_PTR *PFNGLISENABLEDIPROC)(GLenum target, GLuint index); -typedef GLboolean (GLAD_API_PTR *PFNGLISFRAMEBUFFERPROC)(GLuint framebuffer); -typedef GLboolean (GLAD_API_PTR *PFNGLISLISTPROC)(GLuint list); -typedef GLboolean (GLAD_API_PTR *PFNGLISPROGRAMPROC)(GLuint program); -typedef GLboolean (GLAD_API_PTR *PFNGLISQUERYPROC)(GLuint id); -typedef GLboolean (GLAD_API_PTR *PFNGLISRENDERBUFFERPROC)(GLuint renderbuffer); -typedef GLboolean (GLAD_API_PTR *PFNGLISSAMPLERPROC)(GLuint sampler); -typedef GLboolean (GLAD_API_PTR *PFNGLISSHADERPROC)(GLuint shader); -typedef GLboolean (GLAD_API_PTR *PFNGLISSYNCPROC)(GLsync sync); -typedef GLboolean (GLAD_API_PTR *PFNGLISTEXTUREPROC)(GLuint texture); -typedef GLboolean (GLAD_API_PTR *PFNGLISVERTEXARRAYPROC)(GLuint array); -typedef void (GLAD_API_PTR *PFNGLLIGHTMODELFPROC)(GLenum pname, GLfloat param); -typedef void (GLAD_API_PTR *PFNGLLIGHTMODELFVPROC)(GLenum pname, const GLfloat * params); -typedef void (GLAD_API_PTR *PFNGLLIGHTMODELIPROC)(GLenum pname, GLint param); -typedef void (GLAD_API_PTR *PFNGLLIGHTMODELIVPROC)(GLenum pname, const GLint * params); -typedef void (GLAD_API_PTR *PFNGLLIGHTFPROC)(GLenum light, GLenum pname, GLfloat param); -typedef void (GLAD_API_PTR *PFNGLLIGHTFVPROC)(GLenum light, GLenum pname, const GLfloat * params); -typedef void (GLAD_API_PTR *PFNGLLIGHTIPROC)(GLenum light, GLenum pname, GLint param); -typedef void (GLAD_API_PTR *PFNGLLIGHTIVPROC)(GLenum light, GLenum pname, const GLint * params); -typedef void (GLAD_API_PTR *PFNGLLINESTIPPLEPROC)(GLint factor, GLushort pattern); -typedef void (GLAD_API_PTR *PFNGLLINEWIDTHPROC)(GLfloat width); -typedef void (GLAD_API_PTR *PFNGLLINKPROGRAMPROC)(GLuint program); -typedef void (GLAD_API_PTR *PFNGLLISTBASEPROC)(GLuint base); +typedef void (GLAD_API_PTR *PFNGLINTERLEAVEDARRAYSPROC)(GLenum format, GLsizei stride, const void * pointer); +typedef GLboolean (GLAD_API_PTR *PFNGLISBUFFERPROC)(GLuint buffer); +typedef GLboolean (GLAD_API_PTR *PFNGLISENABLEDPROC)(GLenum cap); +typedef GLboolean (GLAD_API_PTR *PFNGLISENABLEDIPROC)(GLenum target, GLuint index); +typedef GLboolean (GLAD_API_PTR *PFNGLISFRAMEBUFFERPROC)(GLuint framebuffer); +typedef GLboolean (GLAD_API_PTR *PFNGLISLISTPROC)(GLuint list); +typedef GLboolean (GLAD_API_PTR *PFNGLISPROGRAMPROC)(GLuint program); +typedef GLboolean (GLAD_API_PTR *PFNGLISQUERYPROC)(GLuint id); +typedef GLboolean (GLAD_API_PTR *PFNGLISRENDERBUFFERPROC)(GLuint renderbuffer); +typedef GLboolean (GLAD_API_PTR *PFNGLISSAMPLERPROC)(GLuint sampler); +typedef GLboolean (GLAD_API_PTR *PFNGLISSHADERPROC)(GLuint shader); +typedef GLboolean (GLAD_API_PTR *PFNGLISSYNCPROC)(GLsync sync); +typedef GLboolean (GLAD_API_PTR *PFNGLISTEXTUREPROC)(GLuint texture); +typedef GLboolean (GLAD_API_PTR *PFNGLISVERTEXARRAYPROC)(GLuint array); +typedef void (GLAD_API_PTR *PFNGLLIGHTMODELFPROC)(GLenum pname, GLfloat param); +typedef void (GLAD_API_PTR *PFNGLLIGHTMODELFVPROC)(GLenum pname, const GLfloat * params); +typedef void (GLAD_API_PTR *PFNGLLIGHTMODELIPROC)(GLenum pname, GLint param); +typedef void (GLAD_API_PTR *PFNGLLIGHTMODELIVPROC)(GLenum pname, const GLint * params); +typedef void (GLAD_API_PTR *PFNGLLIGHTFPROC)(GLenum light, GLenum pname, GLfloat param); +typedef void (GLAD_API_PTR *PFNGLLIGHTFVPROC)(GLenum light, GLenum pname, const GLfloat * params); +typedef void (GLAD_API_PTR *PFNGLLIGHTIPROC)(GLenum light, GLenum pname, GLint param); +typedef void (GLAD_API_PTR *PFNGLLIGHTIVPROC)(GLenum light, GLenum pname, const GLint * params); +typedef void (GLAD_API_PTR *PFNGLLINESTIPPLEPROC)(GLint factor, GLushort pattern); +typedef void (GLAD_API_PTR *PFNGLLINEWIDTHPROC)(GLfloat width); +typedef void (GLAD_API_PTR *PFNGLLINKPROGRAMPROC)(GLuint program); +typedef void (GLAD_API_PTR *PFNGLLISTBASEPROC)(GLuint base); typedef void (GLAD_API_PTR *PFNGLLOADIDENTITYPROC)(void); -typedef void (GLAD_API_PTR *PFNGLLOADMATRIXDPROC)(const GLdouble * m); -typedef void (GLAD_API_PTR *PFNGLLOADMATRIXFPROC)(const GLfloat * m); -typedef void (GLAD_API_PTR *PFNGLLOADNAMEPROC)(GLuint name); -typedef void (GLAD_API_PTR *PFNGLLOADTRANSPOSEMATRIXDPROC)(const GLdouble * m); -typedef void (GLAD_API_PTR *PFNGLLOADTRANSPOSEMATRIXFPROC)(const GLfloat * m); -typedef void (GLAD_API_PTR *PFNGLLOGICOPPROC)(GLenum opcode); -typedef void (GLAD_API_PTR *PFNGLMAP1DPROC)(GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble * points); -typedef void (GLAD_API_PTR *PFNGLMAP1FPROC)(GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat * points); -typedef void (GLAD_API_PTR *PFNGLMAP2DPROC)(GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble * points); -typedef void (GLAD_API_PTR *PFNGLMAP2FPROC)(GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat * points); -typedef void * (GLAD_API_PTR *PFNGLMAPBUFFERPROC)(GLenum target, GLenum access); -typedef void * (GLAD_API_PTR *PFNGLMAPBUFFERRANGEPROC)(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access); -typedef void (GLAD_API_PTR *PFNGLMAPGRID1DPROC)(GLint un, GLdouble u1, GLdouble u2); -typedef void (GLAD_API_PTR *PFNGLMAPGRID1FPROC)(GLint un, GLfloat u1, GLfloat u2); -typedef void (GLAD_API_PTR *PFNGLMAPGRID2DPROC)(GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2); -typedef void (GLAD_API_PTR *PFNGLMAPGRID2FPROC)(GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2); -typedef void (GLAD_API_PTR *PFNGLMATERIALFPROC)(GLenum face, GLenum pname, GLfloat param); -typedef void (GLAD_API_PTR *PFNGLMATERIALFVPROC)(GLenum face, GLenum pname, const GLfloat * params); -typedef void (GLAD_API_PTR *PFNGLMATERIALIPROC)(GLenum face, GLenum pname, GLint param); -typedef void (GLAD_API_PTR *PFNGLMATERIALIVPROC)(GLenum face, GLenum pname, const GLint * params); -typedef void (GLAD_API_PTR *PFNGLMATRIXMODEPROC)(GLenum mode); -typedef void (GLAD_API_PTR *PFNGLMULTMATRIXDPROC)(const GLdouble * m); -typedef void (GLAD_API_PTR *PFNGLMULTMATRIXFPROC)(const GLfloat * m); -typedef void (GLAD_API_PTR *PFNGLMULTTRANSPOSEMATRIXDPROC)(const GLdouble * m); -typedef void (GLAD_API_PTR *PFNGLMULTTRANSPOSEMATRIXFPROC)(const GLfloat * m); -typedef void (GLAD_API_PTR *PFNGLMULTIDRAWARRAYSPROC)(GLenum mode, const GLint * first, const GLsizei * count, GLsizei drawcount); -typedef void (GLAD_API_PTR *PFNGLMULTIDRAWELEMENTSPROC)(GLenum mode, const GLsizei * count, GLenum type, const void *const* indices, GLsizei drawcount); -typedef void (GLAD_API_PTR *PFNGLMULTIDRAWELEMENTSBASEVERTEXPROC)(GLenum mode, const GLsizei * count, GLenum type, const void *const* indices, GLsizei drawcount, const GLint * basevertex); -typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD1DPROC)(GLenum target, GLdouble s); -typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD1DVPROC)(GLenum target, const GLdouble * v); -typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD1FPROC)(GLenum target, GLfloat s); -typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD1FVPROC)(GLenum target, const GLfloat * v); -typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD1IPROC)(GLenum target, GLint s); -typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD1IVPROC)(GLenum target, const GLint * v); -typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD1SPROC)(GLenum target, GLshort s); -typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD1SVPROC)(GLenum target, const GLshort * v); -typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD2DPROC)(GLenum target, GLdouble s, GLdouble t); -typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD2DVPROC)(GLenum target, const GLdouble * v); -typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD2FPROC)(GLenum target, GLfloat s, GLfloat t); -typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD2FVPROC)(GLenum target, const GLfloat * v); -typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD2IPROC)(GLenum target, GLint s, GLint t); -typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD2IVPROC)(GLenum target, const GLint * v); -typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD2SPROC)(GLenum target, GLshort s, GLshort t); -typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD2SVPROC)(GLenum target, const GLshort * v); -typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD3DPROC)(GLenum target, GLdouble s, GLdouble t, GLdouble r); -typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD3DVPROC)(GLenum target, const GLdouble * v); -typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD3FPROC)(GLenum target, GLfloat s, GLfloat t, GLfloat r); -typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD3FVPROC)(GLenum target, const GLfloat * v); -typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD3IPROC)(GLenum target, GLint s, GLint t, GLint r); -typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD3IVPROC)(GLenum target, const GLint * v); -typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD3SPROC)(GLenum target, GLshort s, GLshort t, GLshort r); -typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD3SVPROC)(GLenum target, const GLshort * v); -typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD4DPROC)(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); -typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD4DVPROC)(GLenum target, const GLdouble * v); -typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD4FPROC)(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); -typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD4FVPROC)(GLenum target, const GLfloat * v); -typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD4IPROC)(GLenum target, GLint s, GLint t, GLint r, GLint q); -typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD4IVPROC)(GLenum target, const GLint * v); -typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD4SPROC)(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q); -typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD4SVPROC)(GLenum target, const GLshort * v); -typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORDP1UIPROC)(GLenum texture, GLenum type, GLuint coords); -typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORDP1UIVPROC)(GLenum texture, GLenum type, const GLuint * coords); -typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORDP2UIPROC)(GLenum texture, GLenum type, GLuint coords); -typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORDP2UIVPROC)(GLenum texture, GLenum type, const GLuint * coords); -typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORDP3UIPROC)(GLenum texture, GLenum type, GLuint coords); -typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORDP3UIVPROC)(GLenum texture, GLenum type, const GLuint * coords); -typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORDP4UIPROC)(GLenum texture, GLenum type, GLuint coords); -typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORDP4UIVPROC)(GLenum texture, GLenum type, const GLuint * coords); -typedef void (GLAD_API_PTR *PFNGLNEWLISTPROC)(GLuint list, GLenum mode); -typedef void (GLAD_API_PTR *PFNGLNORMAL3BPROC)(GLbyte nx, GLbyte ny, GLbyte nz); -typedef void (GLAD_API_PTR *PFNGLNORMAL3BVPROC)(const GLbyte * v); -typedef void (GLAD_API_PTR *PFNGLNORMAL3DPROC)(GLdouble nx, GLdouble ny, GLdouble nz); -typedef void (GLAD_API_PTR *PFNGLNORMAL3DVPROC)(const GLdouble * v); -typedef void (GLAD_API_PTR *PFNGLNORMAL3FPROC)(GLfloat nx, GLfloat ny, GLfloat nz); -typedef void (GLAD_API_PTR *PFNGLNORMAL3FVPROC)(const GLfloat * v); -typedef void (GLAD_API_PTR *PFNGLNORMAL3IPROC)(GLint nx, GLint ny, GLint nz); -typedef void (GLAD_API_PTR *PFNGLNORMAL3IVPROC)(const GLint * v); -typedef void (GLAD_API_PTR *PFNGLNORMAL3SPROC)(GLshort nx, GLshort ny, GLshort nz); -typedef void (GLAD_API_PTR *PFNGLNORMAL3SVPROC)(const GLshort * v); -typedef void (GLAD_API_PTR *PFNGLNORMALP3UIPROC)(GLenum type, GLuint coords); -typedef void (GLAD_API_PTR *PFNGLNORMALP3UIVPROC)(GLenum type, const GLuint * coords); -typedef void (GLAD_API_PTR *PFNGLNORMALPOINTERPROC)(GLenum type, GLsizei stride, const void * pointer); -typedef void (GLAD_API_PTR *PFNGLOBJECTLABELPROC)(GLenum identifier, GLuint name, GLsizei length, const GLchar * label); -typedef void (GLAD_API_PTR *PFNGLOBJECTPTRLABELPROC)(const void * ptr, GLsizei length, const GLchar * label); -typedef void (GLAD_API_PTR *PFNGLORTHOPROC)(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar); -typedef void (GLAD_API_PTR *PFNGLPASSTHROUGHPROC)(GLfloat token); -typedef void (GLAD_API_PTR *PFNGLPIXELMAPFVPROC)(GLenum map, GLsizei mapsize, const GLfloat * values); -typedef void (GLAD_API_PTR *PFNGLPIXELMAPUIVPROC)(GLenum map, GLsizei mapsize, const GLuint * values); -typedef void (GLAD_API_PTR *PFNGLPIXELMAPUSVPROC)(GLenum map, GLsizei mapsize, const GLushort * values); -typedef void (GLAD_API_PTR *PFNGLPIXELSTOREFPROC)(GLenum pname, GLfloat param); -typedef void (GLAD_API_PTR *PFNGLPIXELSTOREIPROC)(GLenum pname, GLint param); -typedef void (GLAD_API_PTR *PFNGLPIXELTRANSFERFPROC)(GLenum pname, GLfloat param); -typedef void (GLAD_API_PTR *PFNGLPIXELTRANSFERIPROC)(GLenum pname, GLint param); -typedef void (GLAD_API_PTR *PFNGLPIXELZOOMPROC)(GLfloat xfactor, GLfloat yfactor); -typedef void (GLAD_API_PTR *PFNGLPOINTPARAMETERFPROC)(GLenum pname, GLfloat param); -typedef void (GLAD_API_PTR *PFNGLPOINTPARAMETERFVPROC)(GLenum pname, const GLfloat * params); -typedef void (GLAD_API_PTR *PFNGLPOINTPARAMETERIPROC)(GLenum pname, GLint param); -typedef void (GLAD_API_PTR *PFNGLPOINTPARAMETERIVPROC)(GLenum pname, const GLint * params); -typedef void (GLAD_API_PTR *PFNGLPOINTSIZEPROC)(GLfloat size); -typedef void (GLAD_API_PTR *PFNGLPOLYGONMODEPROC)(GLenum face, GLenum mode); -typedef void (GLAD_API_PTR *PFNGLPOLYGONOFFSETPROC)(GLfloat factor, GLfloat units); -typedef void (GLAD_API_PTR *PFNGLPOLYGONSTIPPLEPROC)(const GLubyte * mask); +typedef void (GLAD_API_PTR *PFNGLLOADMATRIXDPROC)(const GLdouble * m); +typedef void (GLAD_API_PTR *PFNGLLOADMATRIXFPROC)(const GLfloat * m); +typedef void (GLAD_API_PTR *PFNGLLOADNAMEPROC)(GLuint name); +typedef void (GLAD_API_PTR *PFNGLLOADTRANSPOSEMATRIXDPROC)(const GLdouble * m); +typedef void (GLAD_API_PTR *PFNGLLOADTRANSPOSEMATRIXFPROC)(const GLfloat * m); +typedef void (GLAD_API_PTR *PFNGLLOGICOPPROC)(GLenum opcode); +typedef void (GLAD_API_PTR *PFNGLMAP1DPROC)(GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble * points); +typedef void (GLAD_API_PTR *PFNGLMAP1FPROC)(GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat * points); +typedef void (GLAD_API_PTR *PFNGLMAP2DPROC)(GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble * points); +typedef void (GLAD_API_PTR *PFNGLMAP2FPROC)(GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat * points); +typedef void * (GLAD_API_PTR *PFNGLMAPBUFFERPROC)(GLenum target, GLenum access); +typedef void * (GLAD_API_PTR *PFNGLMAPBUFFERRANGEPROC)(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access); +typedef void (GLAD_API_PTR *PFNGLMAPGRID1DPROC)(GLint un, GLdouble u1, GLdouble u2); +typedef void (GLAD_API_PTR *PFNGLMAPGRID1FPROC)(GLint un, GLfloat u1, GLfloat u2); +typedef void (GLAD_API_PTR *PFNGLMAPGRID2DPROC)(GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2); +typedef void (GLAD_API_PTR *PFNGLMAPGRID2FPROC)(GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2); +typedef void (GLAD_API_PTR *PFNGLMATERIALFPROC)(GLenum face, GLenum pname, GLfloat param); +typedef void (GLAD_API_PTR *PFNGLMATERIALFVPROC)(GLenum face, GLenum pname, const GLfloat * params); +typedef void (GLAD_API_PTR *PFNGLMATERIALIPROC)(GLenum face, GLenum pname, GLint param); +typedef void (GLAD_API_PTR *PFNGLMATERIALIVPROC)(GLenum face, GLenum pname, const GLint * params); +typedef void (GLAD_API_PTR *PFNGLMATRIXMODEPROC)(GLenum mode); +typedef void (GLAD_API_PTR *PFNGLMULTMATRIXDPROC)(const GLdouble * m); +typedef void (GLAD_API_PTR *PFNGLMULTMATRIXFPROC)(const GLfloat * m); +typedef void (GLAD_API_PTR *PFNGLMULTTRANSPOSEMATRIXDPROC)(const GLdouble * m); +typedef void (GLAD_API_PTR *PFNGLMULTTRANSPOSEMATRIXFPROC)(const GLfloat * m); +typedef void (GLAD_API_PTR *PFNGLMULTIDRAWARRAYSPROC)(GLenum mode, const GLint * first, const GLsizei * count, GLsizei drawcount); +typedef void (GLAD_API_PTR *PFNGLMULTIDRAWELEMENTSPROC)(GLenum mode, const GLsizei * count, GLenum type, const void *const* indices, GLsizei drawcount); +typedef void (GLAD_API_PTR *PFNGLMULTIDRAWELEMENTSBASEVERTEXPROC)(GLenum mode, const GLsizei * count, GLenum type, const void *const* indices, GLsizei drawcount, const GLint * basevertex); +typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD1DPROC)(GLenum target, GLdouble s); +typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD1DVPROC)(GLenum target, const GLdouble * v); +typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD1FPROC)(GLenum target, GLfloat s); +typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD1FVPROC)(GLenum target, const GLfloat * v); +typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD1IPROC)(GLenum target, GLint s); +typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD1IVPROC)(GLenum target, const GLint * v); +typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD1SPROC)(GLenum target, GLshort s); +typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD1SVPROC)(GLenum target, const GLshort * v); +typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD2DPROC)(GLenum target, GLdouble s, GLdouble t); +typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD2DVPROC)(GLenum target, const GLdouble * v); +typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD2FPROC)(GLenum target, GLfloat s, GLfloat t); +typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD2FVPROC)(GLenum target, const GLfloat * v); +typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD2IPROC)(GLenum target, GLint s, GLint t); +typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD2IVPROC)(GLenum target, const GLint * v); +typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD2SPROC)(GLenum target, GLshort s, GLshort t); +typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD2SVPROC)(GLenum target, const GLshort * v); +typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD3DPROC)(GLenum target, GLdouble s, GLdouble t, GLdouble r); +typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD3DVPROC)(GLenum target, const GLdouble * v); +typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD3FPROC)(GLenum target, GLfloat s, GLfloat t, GLfloat r); +typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD3FVPROC)(GLenum target, const GLfloat * v); +typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD3IPROC)(GLenum target, GLint s, GLint t, GLint r); +typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD3IVPROC)(GLenum target, const GLint * v); +typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD3SPROC)(GLenum target, GLshort s, GLshort t, GLshort r); +typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD3SVPROC)(GLenum target, const GLshort * v); +typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD4DPROC)(GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); +typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD4DVPROC)(GLenum target, const GLdouble * v); +typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD4FPROC)(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); +typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD4FVPROC)(GLenum target, const GLfloat * v); +typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD4IPROC)(GLenum target, GLint s, GLint t, GLint r, GLint q); +typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD4IVPROC)(GLenum target, const GLint * v); +typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD4SPROC)(GLenum target, GLshort s, GLshort t, GLshort r, GLshort q); +typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORD4SVPROC)(GLenum target, const GLshort * v); +typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORDP1UIPROC)(GLenum texture, GLenum type, GLuint coords); +typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORDP1UIVPROC)(GLenum texture, GLenum type, const GLuint * coords); +typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORDP2UIPROC)(GLenum texture, GLenum type, GLuint coords); +typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORDP2UIVPROC)(GLenum texture, GLenum type, const GLuint * coords); +typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORDP3UIPROC)(GLenum texture, GLenum type, GLuint coords); +typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORDP3UIVPROC)(GLenum texture, GLenum type, const GLuint * coords); +typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORDP4UIPROC)(GLenum texture, GLenum type, GLuint coords); +typedef void (GLAD_API_PTR *PFNGLMULTITEXCOORDP4UIVPROC)(GLenum texture, GLenum type, const GLuint * coords); +typedef void (GLAD_API_PTR *PFNGLNEWLISTPROC)(GLuint list, GLenum mode); +typedef void (GLAD_API_PTR *PFNGLNORMAL3BPROC)(GLbyte nx, GLbyte ny, GLbyte nz); +typedef void (GLAD_API_PTR *PFNGLNORMAL3BVPROC)(const GLbyte * v); +typedef void (GLAD_API_PTR *PFNGLNORMAL3DPROC)(GLdouble nx, GLdouble ny, GLdouble nz); +typedef void (GLAD_API_PTR *PFNGLNORMAL3DVPROC)(const GLdouble * v); +typedef void (GLAD_API_PTR *PFNGLNORMAL3FPROC)(GLfloat nx, GLfloat ny, GLfloat nz); +typedef void (GLAD_API_PTR *PFNGLNORMAL3FVPROC)(const GLfloat * v); +typedef void (GLAD_API_PTR *PFNGLNORMAL3IPROC)(GLint nx, GLint ny, GLint nz); +typedef void (GLAD_API_PTR *PFNGLNORMAL3IVPROC)(const GLint * v); +typedef void (GLAD_API_PTR *PFNGLNORMAL3SPROC)(GLshort nx, GLshort ny, GLshort nz); +typedef void (GLAD_API_PTR *PFNGLNORMAL3SVPROC)(const GLshort * v); +typedef void (GLAD_API_PTR *PFNGLNORMALP3UIPROC)(GLenum type, GLuint coords); +typedef void (GLAD_API_PTR *PFNGLNORMALP3UIVPROC)(GLenum type, const GLuint * coords); +typedef void (GLAD_API_PTR *PFNGLNORMALPOINTERPROC)(GLenum type, GLsizei stride, const void * pointer); +typedef void (GLAD_API_PTR *PFNGLOBJECTLABELPROC)(GLenum identifier, GLuint name, GLsizei length, const GLchar * label); +typedef void (GLAD_API_PTR *PFNGLOBJECTPTRLABELPROC)(const void * ptr, GLsizei length, const GLchar * label); +typedef void (GLAD_API_PTR *PFNGLORTHOPROC)(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar); +typedef void (GLAD_API_PTR *PFNGLPASSTHROUGHPROC)(GLfloat token); +typedef void (GLAD_API_PTR *PFNGLPIXELMAPFVPROC)(GLenum map, GLsizei mapsize, const GLfloat * values); +typedef void (GLAD_API_PTR *PFNGLPIXELMAPUIVPROC)(GLenum map, GLsizei mapsize, const GLuint * values); +typedef void (GLAD_API_PTR *PFNGLPIXELMAPUSVPROC)(GLenum map, GLsizei mapsize, const GLushort * values); +typedef void (GLAD_API_PTR *PFNGLPIXELSTOREFPROC)(GLenum pname, GLfloat param); +typedef void (GLAD_API_PTR *PFNGLPIXELSTOREIPROC)(GLenum pname, GLint param); +typedef void (GLAD_API_PTR *PFNGLPIXELTRANSFERFPROC)(GLenum pname, GLfloat param); +typedef void (GLAD_API_PTR *PFNGLPIXELTRANSFERIPROC)(GLenum pname, GLint param); +typedef void (GLAD_API_PTR *PFNGLPIXELZOOMPROC)(GLfloat xfactor, GLfloat yfactor); +typedef void (GLAD_API_PTR *PFNGLPOINTPARAMETERFPROC)(GLenum pname, GLfloat param); +typedef void (GLAD_API_PTR *PFNGLPOINTPARAMETERFVPROC)(GLenum pname, const GLfloat * params); +typedef void (GLAD_API_PTR *PFNGLPOINTPARAMETERIPROC)(GLenum pname, GLint param); +typedef void (GLAD_API_PTR *PFNGLPOINTPARAMETERIVPROC)(GLenum pname, const GLint * params); +typedef void (GLAD_API_PTR *PFNGLPOINTSIZEPROC)(GLfloat size); +typedef void (GLAD_API_PTR *PFNGLPOLYGONMODEPROC)(GLenum face, GLenum mode); +typedef void (GLAD_API_PTR *PFNGLPOLYGONOFFSETPROC)(GLfloat factor, GLfloat units); +typedef void (GLAD_API_PTR *PFNGLPOLYGONSTIPPLEPROC)(const GLubyte * mask); typedef void (GLAD_API_PTR *PFNGLPOPATTRIBPROC)(void); typedef void (GLAD_API_PTR *PFNGLPOPCLIENTATTRIBPROC)(void); typedef void (GLAD_API_PTR *PFNGLPOPDEBUGGROUPPROC)(void); typedef void (GLAD_API_PTR *PFNGLPOPMATRIXPROC)(void); typedef void (GLAD_API_PTR *PFNGLPOPNAMEPROC)(void); -typedef void (GLAD_API_PTR *PFNGLPRIMITIVERESTARTINDEXPROC)(GLuint index); -typedef void (GLAD_API_PTR *PFNGLPRIORITIZETEXTURESPROC)(GLsizei n, const GLuint * textures, const GLfloat * priorities); -typedef void (GLAD_API_PTR *PFNGLPROVOKINGVERTEXPROC)(GLenum mode); -typedef void (GLAD_API_PTR *PFNGLPUSHATTRIBPROC)(GLbitfield mask); -typedef void (GLAD_API_PTR *PFNGLPUSHCLIENTATTRIBPROC)(GLbitfield mask); -typedef void (GLAD_API_PTR *PFNGLPUSHDEBUGGROUPPROC)(GLenum source, GLuint id, GLsizei length, const GLchar * message); +typedef void (GLAD_API_PTR *PFNGLPRIMITIVERESTARTINDEXPROC)(GLuint index); +typedef void (GLAD_API_PTR *PFNGLPRIORITIZETEXTURESPROC)(GLsizei n, const GLuint * textures, const GLfloat * priorities); +typedef void (GLAD_API_PTR *PFNGLPROVOKINGVERTEXPROC)(GLenum mode); +typedef void (GLAD_API_PTR *PFNGLPUSHATTRIBPROC)(GLbitfield mask); +typedef void (GLAD_API_PTR *PFNGLPUSHCLIENTATTRIBPROC)(GLbitfield mask); +typedef void (GLAD_API_PTR *PFNGLPUSHDEBUGGROUPPROC)(GLenum source, GLuint id, GLsizei length, const GLchar * message); typedef void (GLAD_API_PTR *PFNGLPUSHMATRIXPROC)(void); -typedef void (GLAD_API_PTR *PFNGLPUSHNAMEPROC)(GLuint name); -typedef void (GLAD_API_PTR *PFNGLQUERYCOUNTERPROC)(GLuint id, GLenum target); -typedef void (GLAD_API_PTR *PFNGLRASTERPOS2DPROC)(GLdouble x, GLdouble y); -typedef void (GLAD_API_PTR *PFNGLRASTERPOS2DVPROC)(const GLdouble * v); -typedef void (GLAD_API_PTR *PFNGLRASTERPOS2FPROC)(GLfloat x, GLfloat y); -typedef void (GLAD_API_PTR *PFNGLRASTERPOS2FVPROC)(const GLfloat * v); -typedef void (GLAD_API_PTR *PFNGLRASTERPOS2IPROC)(GLint x, GLint y); -typedef void (GLAD_API_PTR *PFNGLRASTERPOS2IVPROC)(const GLint * v); -typedef void (GLAD_API_PTR *PFNGLRASTERPOS2SPROC)(GLshort x, GLshort y); -typedef void (GLAD_API_PTR *PFNGLRASTERPOS2SVPROC)(const GLshort * v); -typedef void (GLAD_API_PTR *PFNGLRASTERPOS3DPROC)(GLdouble x, GLdouble y, GLdouble z); -typedef void (GLAD_API_PTR *PFNGLRASTERPOS3DVPROC)(const GLdouble * v); -typedef void (GLAD_API_PTR *PFNGLRASTERPOS3FPROC)(GLfloat x, GLfloat y, GLfloat z); -typedef void (GLAD_API_PTR *PFNGLRASTERPOS3FVPROC)(const GLfloat * v); -typedef void (GLAD_API_PTR *PFNGLRASTERPOS3IPROC)(GLint x, GLint y, GLint z); -typedef void (GLAD_API_PTR *PFNGLRASTERPOS3IVPROC)(const GLint * v); -typedef void (GLAD_API_PTR *PFNGLRASTERPOS3SPROC)(GLshort x, GLshort y, GLshort z); -typedef void (GLAD_API_PTR *PFNGLRASTERPOS3SVPROC)(const GLshort * v); -typedef void (GLAD_API_PTR *PFNGLRASTERPOS4DPROC)(GLdouble x, GLdouble y, GLdouble z, GLdouble w); -typedef void (GLAD_API_PTR *PFNGLRASTERPOS4DVPROC)(const GLdouble * v); -typedef void (GLAD_API_PTR *PFNGLRASTERPOS4FPROC)(GLfloat x, GLfloat y, GLfloat z, GLfloat w); -typedef void (GLAD_API_PTR *PFNGLRASTERPOS4FVPROC)(const GLfloat * v); -typedef void (GLAD_API_PTR *PFNGLRASTERPOS4IPROC)(GLint x, GLint y, GLint z, GLint w); -typedef void (GLAD_API_PTR *PFNGLRASTERPOS4IVPROC)(const GLint * v); -typedef void (GLAD_API_PTR *PFNGLRASTERPOS4SPROC)(GLshort x, GLshort y, GLshort z, GLshort w); -typedef void (GLAD_API_PTR *PFNGLRASTERPOS4SVPROC)(const GLshort * v); -typedef void (GLAD_API_PTR *PFNGLREADBUFFERPROC)(GLenum src); -typedef void (GLAD_API_PTR *PFNGLREADPIXELSPROC)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void * pixels); -typedef void (GLAD_API_PTR *PFNGLREADNPIXELSPROC)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void * data); -typedef void (GLAD_API_PTR *PFNGLREADNPIXELSARBPROC)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void * data); -typedef void (GLAD_API_PTR *PFNGLRECTDPROC)(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2); -typedef void (GLAD_API_PTR *PFNGLRECTDVPROC)(const GLdouble * v1, const GLdouble * v2); -typedef void (GLAD_API_PTR *PFNGLRECTFPROC)(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2); -typedef void (GLAD_API_PTR *PFNGLRECTFVPROC)(const GLfloat * v1, const GLfloat * v2); -typedef void (GLAD_API_PTR *PFNGLRECTIPROC)(GLint x1, GLint y1, GLint x2, GLint y2); -typedef void (GLAD_API_PTR *PFNGLRECTIVPROC)(const GLint * v1, const GLint * v2); -typedef void (GLAD_API_PTR *PFNGLRECTSPROC)(GLshort x1, GLshort y1, GLshort x2, GLshort y2); -typedef void (GLAD_API_PTR *PFNGLRECTSVPROC)(const GLshort * v1, const GLshort * v2); -typedef GLint (GLAD_API_PTR *PFNGLRENDERMODEPROC)(GLenum mode); -typedef void (GLAD_API_PTR *PFNGLRENDERBUFFERSTORAGEPROC)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height); -typedef void (GLAD_API_PTR *PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC)(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); -typedef void (GLAD_API_PTR *PFNGLROTATEDPROC)(GLdouble angle, GLdouble x, GLdouble y, GLdouble z); -typedef void (GLAD_API_PTR *PFNGLROTATEFPROC)(GLfloat angle, GLfloat x, GLfloat y, GLfloat z); -typedef void (GLAD_API_PTR *PFNGLSAMPLECOVERAGEPROC)(GLfloat value, GLboolean invert); -typedef void (GLAD_API_PTR *PFNGLSAMPLECOVERAGEARBPROC)(GLfloat value, GLboolean invert); -typedef void (GLAD_API_PTR *PFNGLSAMPLEMASKIPROC)(GLuint maskNumber, GLbitfield mask); -typedef void (GLAD_API_PTR *PFNGLSAMPLERPARAMETERIIVPROC)(GLuint sampler, GLenum pname, const GLint * param); -typedef void (GLAD_API_PTR *PFNGLSAMPLERPARAMETERIUIVPROC)(GLuint sampler, GLenum pname, const GLuint * param); -typedef void (GLAD_API_PTR *PFNGLSAMPLERPARAMETERFPROC)(GLuint sampler, GLenum pname, GLfloat param); -typedef void (GLAD_API_PTR *PFNGLSAMPLERPARAMETERFVPROC)(GLuint sampler, GLenum pname, const GLfloat * param); -typedef void (GLAD_API_PTR *PFNGLSAMPLERPARAMETERIPROC)(GLuint sampler, GLenum pname, GLint param); -typedef void (GLAD_API_PTR *PFNGLSAMPLERPARAMETERIVPROC)(GLuint sampler, GLenum pname, const GLint * param); -typedef void (GLAD_API_PTR *PFNGLSCALEDPROC)(GLdouble x, GLdouble y, GLdouble z); -typedef void (GLAD_API_PTR *PFNGLSCALEFPROC)(GLfloat x, GLfloat y, GLfloat z); -typedef void (GLAD_API_PTR *PFNGLSCISSORPROC)(GLint x, GLint y, GLsizei width, GLsizei height); -typedef void (GLAD_API_PTR *PFNGLSECONDARYCOLOR3BPROC)(GLbyte red, GLbyte green, GLbyte blue); -typedef void (GLAD_API_PTR *PFNGLSECONDARYCOLOR3BVPROC)(const GLbyte * v); -typedef void (GLAD_API_PTR *PFNGLSECONDARYCOLOR3DPROC)(GLdouble red, GLdouble green, GLdouble blue); -typedef void (GLAD_API_PTR *PFNGLSECONDARYCOLOR3DVPROC)(const GLdouble * v); -typedef void (GLAD_API_PTR *PFNGLSECONDARYCOLOR3FPROC)(GLfloat red, GLfloat green, GLfloat blue); -typedef void (GLAD_API_PTR *PFNGLSECONDARYCOLOR3FVPROC)(const GLfloat * v); -typedef void (GLAD_API_PTR *PFNGLSECONDARYCOLOR3IPROC)(GLint red, GLint green, GLint blue); -typedef void (GLAD_API_PTR *PFNGLSECONDARYCOLOR3IVPROC)(const GLint * v); -typedef void (GLAD_API_PTR *PFNGLSECONDARYCOLOR3SPROC)(GLshort red, GLshort green, GLshort blue); -typedef void (GLAD_API_PTR *PFNGLSECONDARYCOLOR3SVPROC)(const GLshort * v); -typedef void (GLAD_API_PTR *PFNGLSECONDARYCOLOR3UBPROC)(GLubyte red, GLubyte green, GLubyte blue); -typedef void (GLAD_API_PTR *PFNGLSECONDARYCOLOR3UBVPROC)(const GLubyte * v); -typedef void (GLAD_API_PTR *PFNGLSECONDARYCOLOR3UIPROC)(GLuint red, GLuint green, GLuint blue); -typedef void (GLAD_API_PTR *PFNGLSECONDARYCOLOR3UIVPROC)(const GLuint * v); -typedef void (GLAD_API_PTR *PFNGLSECONDARYCOLOR3USPROC)(GLushort red, GLushort green, GLushort blue); -typedef void (GLAD_API_PTR *PFNGLSECONDARYCOLOR3USVPROC)(const GLushort * v); -typedef void (GLAD_API_PTR *PFNGLSECONDARYCOLORP3UIPROC)(GLenum type, GLuint color); -typedef void (GLAD_API_PTR *PFNGLSECONDARYCOLORP3UIVPROC)(GLenum type, const GLuint * color); -typedef void (GLAD_API_PTR *PFNGLSECONDARYCOLORPOINTERPROC)(GLint size, GLenum type, GLsizei stride, const void * pointer); -typedef void (GLAD_API_PTR *PFNGLSELECTBUFFERPROC)(GLsizei size, GLuint * buffer); -typedef void (GLAD_API_PTR *PFNGLSHADEMODELPROC)(GLenum mode); -typedef void (GLAD_API_PTR *PFNGLSHADERSOURCEPROC)(GLuint shader, GLsizei count, const GLchar *const* string, const GLint * length); -typedef void (GLAD_API_PTR *PFNGLSTENCILFUNCPROC)(GLenum func, GLint ref, GLuint mask); -typedef void (GLAD_API_PTR *PFNGLSTENCILFUNCSEPARATEPROC)(GLenum face, GLenum func, GLint ref, GLuint mask); -typedef void (GLAD_API_PTR *PFNGLSTENCILMASKPROC)(GLuint mask); -typedef void (GLAD_API_PTR *PFNGLSTENCILMASKSEPARATEPROC)(GLenum face, GLuint mask); -typedef void (GLAD_API_PTR *PFNGLSTENCILOPPROC)(GLenum fail, GLenum zfail, GLenum zpass); -typedef void (GLAD_API_PTR *PFNGLSTENCILOPSEPARATEPROC)(GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass); -typedef void (GLAD_API_PTR *PFNGLTEXBUFFERPROC)(GLenum target, GLenum internalformat, GLuint buffer); -typedef void (GLAD_API_PTR *PFNGLTEXCOORD1DPROC)(GLdouble s); -typedef void (GLAD_API_PTR *PFNGLTEXCOORD1DVPROC)(const GLdouble * v); -typedef void (GLAD_API_PTR *PFNGLTEXCOORD1FPROC)(GLfloat s); -typedef void (GLAD_API_PTR *PFNGLTEXCOORD1FVPROC)(const GLfloat * v); -typedef void (GLAD_API_PTR *PFNGLTEXCOORD1IPROC)(GLint s); -typedef void (GLAD_API_PTR *PFNGLTEXCOORD1IVPROC)(const GLint * v); -typedef void (GLAD_API_PTR *PFNGLTEXCOORD1SPROC)(GLshort s); -typedef void (GLAD_API_PTR *PFNGLTEXCOORD1SVPROC)(const GLshort * v); -typedef void (GLAD_API_PTR *PFNGLTEXCOORD2DPROC)(GLdouble s, GLdouble t); -typedef void (GLAD_API_PTR *PFNGLTEXCOORD2DVPROC)(const GLdouble * v); -typedef void (GLAD_API_PTR *PFNGLTEXCOORD2FPROC)(GLfloat s, GLfloat t); -typedef void (GLAD_API_PTR *PFNGLTEXCOORD2FVPROC)(const GLfloat * v); -typedef void (GLAD_API_PTR *PFNGLTEXCOORD2IPROC)(GLint s, GLint t); -typedef void (GLAD_API_PTR *PFNGLTEXCOORD2IVPROC)(const GLint * v); -typedef void (GLAD_API_PTR *PFNGLTEXCOORD2SPROC)(GLshort s, GLshort t); -typedef void (GLAD_API_PTR *PFNGLTEXCOORD2SVPROC)(const GLshort * v); -typedef void (GLAD_API_PTR *PFNGLTEXCOORD3DPROC)(GLdouble s, GLdouble t, GLdouble r); -typedef void (GLAD_API_PTR *PFNGLTEXCOORD3DVPROC)(const GLdouble * v); -typedef void (GLAD_API_PTR *PFNGLTEXCOORD3FPROC)(GLfloat s, GLfloat t, GLfloat r); -typedef void (GLAD_API_PTR *PFNGLTEXCOORD3FVPROC)(const GLfloat * v); -typedef void (GLAD_API_PTR *PFNGLTEXCOORD3IPROC)(GLint s, GLint t, GLint r); -typedef void (GLAD_API_PTR *PFNGLTEXCOORD3IVPROC)(const GLint * v); -typedef void (GLAD_API_PTR *PFNGLTEXCOORD3SPROC)(GLshort s, GLshort t, GLshort r); -typedef void (GLAD_API_PTR *PFNGLTEXCOORD3SVPROC)(const GLshort * v); -typedef void (GLAD_API_PTR *PFNGLTEXCOORD4DPROC)(GLdouble s, GLdouble t, GLdouble r, GLdouble q); -typedef void (GLAD_API_PTR *PFNGLTEXCOORD4DVPROC)(const GLdouble * v); -typedef void (GLAD_API_PTR *PFNGLTEXCOORD4FPROC)(GLfloat s, GLfloat t, GLfloat r, GLfloat q); -typedef void (GLAD_API_PTR *PFNGLTEXCOORD4FVPROC)(const GLfloat * v); -typedef void (GLAD_API_PTR *PFNGLTEXCOORD4IPROC)(GLint s, GLint t, GLint r, GLint q); -typedef void (GLAD_API_PTR *PFNGLTEXCOORD4IVPROC)(const GLint * v); -typedef void (GLAD_API_PTR *PFNGLTEXCOORD4SPROC)(GLshort s, GLshort t, GLshort r, GLshort q); -typedef void (GLAD_API_PTR *PFNGLTEXCOORD4SVPROC)(const GLshort * v); -typedef void (GLAD_API_PTR *PFNGLTEXCOORDP1UIPROC)(GLenum type, GLuint coords); -typedef void (GLAD_API_PTR *PFNGLTEXCOORDP1UIVPROC)(GLenum type, const GLuint * coords); -typedef void (GLAD_API_PTR *PFNGLTEXCOORDP2UIPROC)(GLenum type, GLuint coords); -typedef void (GLAD_API_PTR *PFNGLTEXCOORDP2UIVPROC)(GLenum type, const GLuint * coords); -typedef void (GLAD_API_PTR *PFNGLTEXCOORDP3UIPROC)(GLenum type, GLuint coords); -typedef void (GLAD_API_PTR *PFNGLTEXCOORDP3UIVPROC)(GLenum type, const GLuint * coords); -typedef void (GLAD_API_PTR *PFNGLTEXCOORDP4UIPROC)(GLenum type, GLuint coords); -typedef void (GLAD_API_PTR *PFNGLTEXCOORDP4UIVPROC)(GLenum type, const GLuint * coords); -typedef void (GLAD_API_PTR *PFNGLTEXCOORDPOINTERPROC)(GLint size, GLenum type, GLsizei stride, const void * pointer); -typedef void (GLAD_API_PTR *PFNGLTEXENVFPROC)(GLenum target, GLenum pname, GLfloat param); -typedef void (GLAD_API_PTR *PFNGLTEXENVFVPROC)(GLenum target, GLenum pname, const GLfloat * params); -typedef void (GLAD_API_PTR *PFNGLTEXENVIPROC)(GLenum target, GLenum pname, GLint param); -typedef void (GLAD_API_PTR *PFNGLTEXENVIVPROC)(GLenum target, GLenum pname, const GLint * params); -typedef void (GLAD_API_PTR *PFNGLTEXGENDPROC)(GLenum coord, GLenum pname, GLdouble param); -typedef void (GLAD_API_PTR *PFNGLTEXGENDVPROC)(GLenum coord, GLenum pname, const GLdouble * params); -typedef void (GLAD_API_PTR *PFNGLTEXGENFPROC)(GLenum coord, GLenum pname, GLfloat param); -typedef void (GLAD_API_PTR *PFNGLTEXGENFVPROC)(GLenum coord, GLenum pname, const GLfloat * params); -typedef void (GLAD_API_PTR *PFNGLTEXGENIPROC)(GLenum coord, GLenum pname, GLint param); -typedef void (GLAD_API_PTR *PFNGLTEXGENIVPROC)(GLenum coord, GLenum pname, const GLint * params); -typedef void (GLAD_API_PTR *PFNGLTEXIMAGE1DPROC)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const void * pixels); -typedef void (GLAD_API_PTR *PFNGLTEXIMAGE2DPROC)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void * pixels); -typedef void (GLAD_API_PTR *PFNGLTEXIMAGE2DMULTISAMPLEPROC)(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations); -typedef void (GLAD_API_PTR *PFNGLTEXIMAGE3DPROC)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void * pixels); -typedef void (GLAD_API_PTR *PFNGLTEXIMAGE3DMULTISAMPLEPROC)(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations); -typedef void (GLAD_API_PTR *PFNGLTEXPARAMETERIIVPROC)(GLenum target, GLenum pname, const GLint * params); -typedef void (GLAD_API_PTR *PFNGLTEXPARAMETERIUIVPROC)(GLenum target, GLenum pname, const GLuint * params); -typedef void (GLAD_API_PTR *PFNGLTEXPARAMETERFPROC)(GLenum target, GLenum pname, GLfloat param); -typedef void (GLAD_API_PTR *PFNGLTEXPARAMETERFVPROC)(GLenum target, GLenum pname, const GLfloat * params); -typedef void (GLAD_API_PTR *PFNGLTEXPARAMETERIPROC)(GLenum target, GLenum pname, GLint param); -typedef void (GLAD_API_PTR *PFNGLTEXPARAMETERIVPROC)(GLenum target, GLenum pname, const GLint * params); -typedef void (GLAD_API_PTR *PFNGLTEXSUBIMAGE1DPROC)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void * pixels); -typedef void (GLAD_API_PTR *PFNGLTEXSUBIMAGE2DPROC)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void * pixels); -typedef void (GLAD_API_PTR *PFNGLTEXSUBIMAGE3DPROC)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void * pixels); -typedef void (GLAD_API_PTR *PFNGLTRANSFORMFEEDBACKVARYINGSPROC)(GLuint program, GLsizei count, const GLchar *const* varyings, GLenum bufferMode); -typedef void (GLAD_API_PTR *PFNGLTRANSLATEDPROC)(GLdouble x, GLdouble y, GLdouble z); -typedef void (GLAD_API_PTR *PFNGLTRANSLATEFPROC)(GLfloat x, GLfloat y, GLfloat z); -typedef void (GLAD_API_PTR *PFNGLUNIFORM1FPROC)(GLint location, GLfloat v0); -typedef void (GLAD_API_PTR *PFNGLUNIFORM1FVPROC)(GLint location, GLsizei count, const GLfloat * value); -typedef void (GLAD_API_PTR *PFNGLUNIFORM1IPROC)(GLint location, GLint v0); -typedef void (GLAD_API_PTR *PFNGLUNIFORM1IVPROC)(GLint location, GLsizei count, const GLint * value); -typedef void (GLAD_API_PTR *PFNGLUNIFORM1UIPROC)(GLint location, GLuint v0); -typedef void (GLAD_API_PTR *PFNGLUNIFORM1UIVPROC)(GLint location, GLsizei count, const GLuint * value); -typedef void (GLAD_API_PTR *PFNGLUNIFORM2FPROC)(GLint location, GLfloat v0, GLfloat v1); -typedef void (GLAD_API_PTR *PFNGLUNIFORM2FVPROC)(GLint location, GLsizei count, const GLfloat * value); -typedef void (GLAD_API_PTR *PFNGLUNIFORM2IPROC)(GLint location, GLint v0, GLint v1); -typedef void (GLAD_API_PTR *PFNGLUNIFORM2IVPROC)(GLint location, GLsizei count, const GLint * value); -typedef void (GLAD_API_PTR *PFNGLUNIFORM2UIPROC)(GLint location, GLuint v0, GLuint v1); -typedef void (GLAD_API_PTR *PFNGLUNIFORM2UIVPROC)(GLint location, GLsizei count, const GLuint * value); -typedef void (GLAD_API_PTR *PFNGLUNIFORM3FPROC)(GLint location, GLfloat v0, GLfloat v1, GLfloat v2); -typedef void (GLAD_API_PTR *PFNGLUNIFORM3FVPROC)(GLint location, GLsizei count, const GLfloat * value); -typedef void (GLAD_API_PTR *PFNGLUNIFORM3IPROC)(GLint location, GLint v0, GLint v1, GLint v2); -typedef void (GLAD_API_PTR *PFNGLUNIFORM3IVPROC)(GLint location, GLsizei count, const GLint * value); -typedef void (GLAD_API_PTR *PFNGLUNIFORM3UIPROC)(GLint location, GLuint v0, GLuint v1, GLuint v2); -typedef void (GLAD_API_PTR *PFNGLUNIFORM3UIVPROC)(GLint location, GLsizei count, const GLuint * value); -typedef void (GLAD_API_PTR *PFNGLUNIFORM4FPROC)(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); -typedef void (GLAD_API_PTR *PFNGLUNIFORM4FVPROC)(GLint location, GLsizei count, const GLfloat * value); -typedef void (GLAD_API_PTR *PFNGLUNIFORM4IPROC)(GLint location, GLint v0, GLint v1, GLint v2, GLint v3); -typedef void (GLAD_API_PTR *PFNGLUNIFORM4IVPROC)(GLint location, GLsizei count, const GLint * value); -typedef void (GLAD_API_PTR *PFNGLUNIFORM4UIPROC)(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); -typedef void (GLAD_API_PTR *PFNGLUNIFORM4UIVPROC)(GLint location, GLsizei count, const GLuint * value); -typedef void (GLAD_API_PTR *PFNGLUNIFORMBLOCKBINDINGPROC)(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding); -typedef void (GLAD_API_PTR *PFNGLUNIFORMMATRIX2FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); -typedef void (GLAD_API_PTR *PFNGLUNIFORMMATRIX2X3FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); -typedef void (GLAD_API_PTR *PFNGLUNIFORMMATRIX2X4FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); -typedef void (GLAD_API_PTR *PFNGLUNIFORMMATRIX3FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); -typedef void (GLAD_API_PTR *PFNGLUNIFORMMATRIX3X2FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); -typedef void (GLAD_API_PTR *PFNGLUNIFORMMATRIX3X4FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); -typedef void (GLAD_API_PTR *PFNGLUNIFORMMATRIX4FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); -typedef void (GLAD_API_PTR *PFNGLUNIFORMMATRIX4X2FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); -typedef void (GLAD_API_PTR *PFNGLUNIFORMMATRIX4X3FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); -typedef GLboolean (GLAD_API_PTR *PFNGLUNMAPBUFFERPROC)(GLenum target); -typedef void (GLAD_API_PTR *PFNGLUSEPROGRAMPROC)(GLuint program); -typedef void (GLAD_API_PTR *PFNGLVALIDATEPROGRAMPROC)(GLuint program); -typedef void (GLAD_API_PTR *PFNGLVERTEX2DPROC)(GLdouble x, GLdouble y); -typedef void (GLAD_API_PTR *PFNGLVERTEX2DVPROC)(const GLdouble * v); -typedef void (GLAD_API_PTR *PFNGLVERTEX2FPROC)(GLfloat x, GLfloat y); -typedef void (GLAD_API_PTR *PFNGLVERTEX2FVPROC)(const GLfloat * v); -typedef void (GLAD_API_PTR *PFNGLVERTEX2IPROC)(GLint x, GLint y); -typedef void (GLAD_API_PTR *PFNGLVERTEX2IVPROC)(const GLint * v); -typedef void (GLAD_API_PTR *PFNGLVERTEX2SPROC)(GLshort x, GLshort y); -typedef void (GLAD_API_PTR *PFNGLVERTEX2SVPROC)(const GLshort * v); -typedef void (GLAD_API_PTR *PFNGLVERTEX3DPROC)(GLdouble x, GLdouble y, GLdouble z); -typedef void (GLAD_API_PTR *PFNGLVERTEX3DVPROC)(const GLdouble * v); -typedef void (GLAD_API_PTR *PFNGLVERTEX3FPROC)(GLfloat x, GLfloat y, GLfloat z); -typedef void (GLAD_API_PTR *PFNGLVERTEX3FVPROC)(const GLfloat * v); -typedef void (GLAD_API_PTR *PFNGLVERTEX3IPROC)(GLint x, GLint y, GLint z); -typedef void (GLAD_API_PTR *PFNGLVERTEX3IVPROC)(const GLint * v); -typedef void (GLAD_API_PTR *PFNGLVERTEX3SPROC)(GLshort x, GLshort y, GLshort z); -typedef void (GLAD_API_PTR *PFNGLVERTEX3SVPROC)(const GLshort * v); -typedef void (GLAD_API_PTR *PFNGLVERTEX4DPROC)(GLdouble x, GLdouble y, GLdouble z, GLdouble w); -typedef void (GLAD_API_PTR *PFNGLVERTEX4DVPROC)(const GLdouble * v); -typedef void (GLAD_API_PTR *PFNGLVERTEX4FPROC)(GLfloat x, GLfloat y, GLfloat z, GLfloat w); -typedef void (GLAD_API_PTR *PFNGLVERTEX4FVPROC)(const GLfloat * v); -typedef void (GLAD_API_PTR *PFNGLVERTEX4IPROC)(GLint x, GLint y, GLint z, GLint w); -typedef void (GLAD_API_PTR *PFNGLVERTEX4IVPROC)(const GLint * v); -typedef void (GLAD_API_PTR *PFNGLVERTEX4SPROC)(GLshort x, GLshort y, GLshort z, GLshort w); -typedef void (GLAD_API_PTR *PFNGLVERTEX4SVPROC)(const GLshort * v); -typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB1DPROC)(GLuint index, GLdouble x); -typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB1DVPROC)(GLuint index, const GLdouble * v); -typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB1FPROC)(GLuint index, GLfloat x); -typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB1FVPROC)(GLuint index, const GLfloat * v); -typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB1SPROC)(GLuint index, GLshort x); -typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB1SVPROC)(GLuint index, const GLshort * v); -typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB2DPROC)(GLuint index, GLdouble x, GLdouble y); -typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB2DVPROC)(GLuint index, const GLdouble * v); -typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB2FPROC)(GLuint index, GLfloat x, GLfloat y); -typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB2FVPROC)(GLuint index, const GLfloat * v); -typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB2SPROC)(GLuint index, GLshort x, GLshort y); -typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB2SVPROC)(GLuint index, const GLshort * v); -typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB3DPROC)(GLuint index, GLdouble x, GLdouble y, GLdouble z); -typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB3DVPROC)(GLuint index, const GLdouble * v); -typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB3FPROC)(GLuint index, GLfloat x, GLfloat y, GLfloat z); -typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB3FVPROC)(GLuint index, const GLfloat * v); -typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB3SPROC)(GLuint index, GLshort x, GLshort y, GLshort z); -typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB3SVPROC)(GLuint index, const GLshort * v); -typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB4NBVPROC)(GLuint index, const GLbyte * v); -typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB4NIVPROC)(GLuint index, const GLint * v); -typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB4NSVPROC)(GLuint index, const GLshort * v); -typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB4NUBPROC)(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); -typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB4NUBVPROC)(GLuint index, const GLubyte * v); -typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB4NUIVPROC)(GLuint index, const GLuint * v); -typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB4NUSVPROC)(GLuint index, const GLushort * v); -typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB4BVPROC)(GLuint index, const GLbyte * v); -typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB4DPROC)(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); -typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB4DVPROC)(GLuint index, const GLdouble * v); -typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB4FPROC)(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB4FVPROC)(GLuint index, const GLfloat * v); -typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB4IVPROC)(GLuint index, const GLint * v); -typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB4SPROC)(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); -typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB4SVPROC)(GLuint index, const GLshort * v); -typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB4UBVPROC)(GLuint index, const GLubyte * v); -typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB4UIVPROC)(GLuint index, const GLuint * v); -typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB4USVPROC)(GLuint index, const GLushort * v); -typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBDIVISORPROC)(GLuint index, GLuint divisor); -typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBI1IPROC)(GLuint index, GLint x); -typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBI1IVPROC)(GLuint index, const GLint * v); -typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBI1UIPROC)(GLuint index, GLuint x); -typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBI1UIVPROC)(GLuint index, const GLuint * v); -typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBI2IPROC)(GLuint index, GLint x, GLint y); -typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBI2IVPROC)(GLuint index, const GLint * v); -typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBI2UIPROC)(GLuint index, GLuint x, GLuint y); -typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBI2UIVPROC)(GLuint index, const GLuint * v); -typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBI3IPROC)(GLuint index, GLint x, GLint y, GLint z); -typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBI3IVPROC)(GLuint index, const GLint * v); -typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBI3UIPROC)(GLuint index, GLuint x, GLuint y, GLuint z); -typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBI3UIVPROC)(GLuint index, const GLuint * v); -typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBI4BVPROC)(GLuint index, const GLbyte * v); -typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBI4IPROC)(GLuint index, GLint x, GLint y, GLint z, GLint w); -typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBI4IVPROC)(GLuint index, const GLint * v); -typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBI4SVPROC)(GLuint index, const GLshort * v); -typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBI4UBVPROC)(GLuint index, const GLubyte * v); -typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBI4UIPROC)(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); -typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBI4UIVPROC)(GLuint index, const GLuint * v); -typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBI4USVPROC)(GLuint index, const GLushort * v); -typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBIPOINTERPROC)(GLuint index, GLint size, GLenum type, GLsizei stride, const void * pointer); -typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBP1UIPROC)(GLuint index, GLenum type, GLboolean normalized, GLuint value); -typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBP1UIVPROC)(GLuint index, GLenum type, GLboolean normalized, const GLuint * value); -typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBP2UIPROC)(GLuint index, GLenum type, GLboolean normalized, GLuint value); -typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBP2UIVPROC)(GLuint index, GLenum type, GLboolean normalized, const GLuint * value); -typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBP3UIPROC)(GLuint index, GLenum type, GLboolean normalized, GLuint value); -typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBP3UIVPROC)(GLuint index, GLenum type, GLboolean normalized, const GLuint * value); -typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBP4UIPROC)(GLuint index, GLenum type, GLboolean normalized, GLuint value); -typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBP4UIVPROC)(GLuint index, GLenum type, GLboolean normalized, const GLuint * value); -typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBPOINTERPROC)(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void * pointer); -typedef void (GLAD_API_PTR *PFNGLVERTEXP2UIPROC)(GLenum type, GLuint value); -typedef void (GLAD_API_PTR *PFNGLVERTEXP2UIVPROC)(GLenum type, const GLuint * value); -typedef void (GLAD_API_PTR *PFNGLVERTEXP3UIPROC)(GLenum type, GLuint value); -typedef void (GLAD_API_PTR *PFNGLVERTEXP3UIVPROC)(GLenum type, const GLuint * value); -typedef void (GLAD_API_PTR *PFNGLVERTEXP4UIPROC)(GLenum type, GLuint value); -typedef void (GLAD_API_PTR *PFNGLVERTEXP4UIVPROC)(GLenum type, const GLuint * value); -typedef void (GLAD_API_PTR *PFNGLVERTEXPOINTERPROC)(GLint size, GLenum type, GLsizei stride, const void * pointer); -typedef void (GLAD_API_PTR *PFNGLVIEWPORTPROC)(GLint x, GLint y, GLsizei width, GLsizei height); -typedef void (GLAD_API_PTR *PFNGLWAITSYNCPROC)(GLsync sync, GLbitfield flags, GLuint64 timeout); -typedef void (GLAD_API_PTR *PFNGLWINDOWPOS2DPROC)(GLdouble x, GLdouble y); -typedef void (GLAD_API_PTR *PFNGLWINDOWPOS2DVPROC)(const GLdouble * v); -typedef void (GLAD_API_PTR *PFNGLWINDOWPOS2FPROC)(GLfloat x, GLfloat y); -typedef void (GLAD_API_PTR *PFNGLWINDOWPOS2FVPROC)(const GLfloat * v); -typedef void (GLAD_API_PTR *PFNGLWINDOWPOS2IPROC)(GLint x, GLint y); -typedef void (GLAD_API_PTR *PFNGLWINDOWPOS2IVPROC)(const GLint * v); -typedef void (GLAD_API_PTR *PFNGLWINDOWPOS2SPROC)(GLshort x, GLshort y); -typedef void (GLAD_API_PTR *PFNGLWINDOWPOS2SVPROC)(const GLshort * v); -typedef void (GLAD_API_PTR *PFNGLWINDOWPOS3DPROC)(GLdouble x, GLdouble y, GLdouble z); -typedef void (GLAD_API_PTR *PFNGLWINDOWPOS3DVPROC)(const GLdouble * v); -typedef void (GLAD_API_PTR *PFNGLWINDOWPOS3FPROC)(GLfloat x, GLfloat y, GLfloat z); -typedef void (GLAD_API_PTR *PFNGLWINDOWPOS3FVPROC)(const GLfloat * v); -typedef void (GLAD_API_PTR *PFNGLWINDOWPOS3IPROC)(GLint x, GLint y, GLint z); -typedef void (GLAD_API_PTR *PFNGLWINDOWPOS3IVPROC)(const GLint * v); -typedef void (GLAD_API_PTR *PFNGLWINDOWPOS3SPROC)(GLshort x, GLshort y, GLshort z); -typedef void (GLAD_API_PTR *PFNGLWINDOWPOS3SVPROC)(const GLshort * v); +typedef void (GLAD_API_PTR *PFNGLPUSHNAMEPROC)(GLuint name); +typedef void (GLAD_API_PTR *PFNGLQUERYCOUNTERPROC)(GLuint id, GLenum target); +typedef void (GLAD_API_PTR *PFNGLRASTERPOS2DPROC)(GLdouble x, GLdouble y); +typedef void (GLAD_API_PTR *PFNGLRASTERPOS2DVPROC)(const GLdouble * v); +typedef void (GLAD_API_PTR *PFNGLRASTERPOS2FPROC)(GLfloat x, GLfloat y); +typedef void (GLAD_API_PTR *PFNGLRASTERPOS2FVPROC)(const GLfloat * v); +typedef void (GLAD_API_PTR *PFNGLRASTERPOS2IPROC)(GLint x, GLint y); +typedef void (GLAD_API_PTR *PFNGLRASTERPOS2IVPROC)(const GLint * v); +typedef void (GLAD_API_PTR *PFNGLRASTERPOS2SPROC)(GLshort x, GLshort y); +typedef void (GLAD_API_PTR *PFNGLRASTERPOS2SVPROC)(const GLshort * v); +typedef void (GLAD_API_PTR *PFNGLRASTERPOS3DPROC)(GLdouble x, GLdouble y, GLdouble z); +typedef void (GLAD_API_PTR *PFNGLRASTERPOS3DVPROC)(const GLdouble * v); +typedef void (GLAD_API_PTR *PFNGLRASTERPOS3FPROC)(GLfloat x, GLfloat y, GLfloat z); +typedef void (GLAD_API_PTR *PFNGLRASTERPOS3FVPROC)(const GLfloat * v); +typedef void (GLAD_API_PTR *PFNGLRASTERPOS3IPROC)(GLint x, GLint y, GLint z); +typedef void (GLAD_API_PTR *PFNGLRASTERPOS3IVPROC)(const GLint * v); +typedef void (GLAD_API_PTR *PFNGLRASTERPOS3SPROC)(GLshort x, GLshort y, GLshort z); +typedef void (GLAD_API_PTR *PFNGLRASTERPOS3SVPROC)(const GLshort * v); +typedef void (GLAD_API_PTR *PFNGLRASTERPOS4DPROC)(GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (GLAD_API_PTR *PFNGLRASTERPOS4DVPROC)(const GLdouble * v); +typedef void (GLAD_API_PTR *PFNGLRASTERPOS4FPROC)(GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (GLAD_API_PTR *PFNGLRASTERPOS4FVPROC)(const GLfloat * v); +typedef void (GLAD_API_PTR *PFNGLRASTERPOS4IPROC)(GLint x, GLint y, GLint z, GLint w); +typedef void (GLAD_API_PTR *PFNGLRASTERPOS4IVPROC)(const GLint * v); +typedef void (GLAD_API_PTR *PFNGLRASTERPOS4SPROC)(GLshort x, GLshort y, GLshort z, GLshort w); +typedef void (GLAD_API_PTR *PFNGLRASTERPOS4SVPROC)(const GLshort * v); +typedef void (GLAD_API_PTR *PFNGLREADBUFFERPROC)(GLenum src); +typedef void (GLAD_API_PTR *PFNGLREADPIXELSPROC)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void * pixels); +typedef void (GLAD_API_PTR *PFNGLREADNPIXELSARBPROC)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void * data); +typedef void (GLAD_API_PTR *PFNGLRECTDPROC)(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2); +typedef void (GLAD_API_PTR *PFNGLRECTDVPROC)(const GLdouble * v1, const GLdouble * v2); +typedef void (GLAD_API_PTR *PFNGLRECTFPROC)(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2); +typedef void (GLAD_API_PTR *PFNGLRECTFVPROC)(const GLfloat * v1, const GLfloat * v2); +typedef void (GLAD_API_PTR *PFNGLRECTIPROC)(GLint x1, GLint y1, GLint x2, GLint y2); +typedef void (GLAD_API_PTR *PFNGLRECTIVPROC)(const GLint * v1, const GLint * v2); +typedef void (GLAD_API_PTR *PFNGLRECTSPROC)(GLshort x1, GLshort y1, GLshort x2, GLshort y2); +typedef void (GLAD_API_PTR *PFNGLRECTSVPROC)(const GLshort * v1, const GLshort * v2); +typedef GLint (GLAD_API_PTR *PFNGLRENDERMODEPROC)(GLenum mode); +typedef void (GLAD_API_PTR *PFNGLRENDERBUFFERSTORAGEPROC)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (GLAD_API_PTR *PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC)(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (GLAD_API_PTR *PFNGLROTATEDPROC)(GLdouble angle, GLdouble x, GLdouble y, GLdouble z); +typedef void (GLAD_API_PTR *PFNGLROTATEFPROC)(GLfloat angle, GLfloat x, GLfloat y, GLfloat z); +typedef void (GLAD_API_PTR *PFNGLSAMPLECOVERAGEPROC)(GLfloat value, GLboolean invert); +typedef void (GLAD_API_PTR *PFNGLSAMPLECOVERAGEARBPROC)(GLfloat value, GLboolean invert); +typedef void (GLAD_API_PTR *PFNGLSAMPLEMASKIPROC)(GLuint maskNumber, GLbitfield mask); +typedef void (GLAD_API_PTR *PFNGLSAMPLERPARAMETERIIVPROC)(GLuint sampler, GLenum pname, const GLint * param); +typedef void (GLAD_API_PTR *PFNGLSAMPLERPARAMETERIUIVPROC)(GLuint sampler, GLenum pname, const GLuint * param); +typedef void (GLAD_API_PTR *PFNGLSAMPLERPARAMETERFPROC)(GLuint sampler, GLenum pname, GLfloat param); +typedef void (GLAD_API_PTR *PFNGLSAMPLERPARAMETERFVPROC)(GLuint sampler, GLenum pname, const GLfloat * param); +typedef void (GLAD_API_PTR *PFNGLSAMPLERPARAMETERIPROC)(GLuint sampler, GLenum pname, GLint param); +typedef void (GLAD_API_PTR *PFNGLSAMPLERPARAMETERIVPROC)(GLuint sampler, GLenum pname, const GLint * param); +typedef void (GLAD_API_PTR *PFNGLSCALEDPROC)(GLdouble x, GLdouble y, GLdouble z); +typedef void (GLAD_API_PTR *PFNGLSCALEFPROC)(GLfloat x, GLfloat y, GLfloat z); +typedef void (GLAD_API_PTR *PFNGLSCISSORPROC)(GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (GLAD_API_PTR *PFNGLSECONDARYCOLOR3BPROC)(GLbyte red, GLbyte green, GLbyte blue); +typedef void (GLAD_API_PTR *PFNGLSECONDARYCOLOR3BVPROC)(const GLbyte * v); +typedef void (GLAD_API_PTR *PFNGLSECONDARYCOLOR3DPROC)(GLdouble red, GLdouble green, GLdouble blue); +typedef void (GLAD_API_PTR *PFNGLSECONDARYCOLOR3DVPROC)(const GLdouble * v); +typedef void (GLAD_API_PTR *PFNGLSECONDARYCOLOR3FPROC)(GLfloat red, GLfloat green, GLfloat blue); +typedef void (GLAD_API_PTR *PFNGLSECONDARYCOLOR3FVPROC)(const GLfloat * v); +typedef void (GLAD_API_PTR *PFNGLSECONDARYCOLOR3IPROC)(GLint red, GLint green, GLint blue); +typedef void (GLAD_API_PTR *PFNGLSECONDARYCOLOR3IVPROC)(const GLint * v); +typedef void (GLAD_API_PTR *PFNGLSECONDARYCOLOR3SPROC)(GLshort red, GLshort green, GLshort blue); +typedef void (GLAD_API_PTR *PFNGLSECONDARYCOLOR3SVPROC)(const GLshort * v); +typedef void (GLAD_API_PTR *PFNGLSECONDARYCOLOR3UBPROC)(GLubyte red, GLubyte green, GLubyte blue); +typedef void (GLAD_API_PTR *PFNGLSECONDARYCOLOR3UBVPROC)(const GLubyte * v); +typedef void (GLAD_API_PTR *PFNGLSECONDARYCOLOR3UIPROC)(GLuint red, GLuint green, GLuint blue); +typedef void (GLAD_API_PTR *PFNGLSECONDARYCOLOR3UIVPROC)(const GLuint * v); +typedef void (GLAD_API_PTR *PFNGLSECONDARYCOLOR3USPROC)(GLushort red, GLushort green, GLushort blue); +typedef void (GLAD_API_PTR *PFNGLSECONDARYCOLOR3USVPROC)(const GLushort * v); +typedef void (GLAD_API_PTR *PFNGLSECONDARYCOLORP3UIPROC)(GLenum type, GLuint color); +typedef void (GLAD_API_PTR *PFNGLSECONDARYCOLORP3UIVPROC)(GLenum type, const GLuint * color); +typedef void (GLAD_API_PTR *PFNGLSECONDARYCOLORPOINTERPROC)(GLint size, GLenum type, GLsizei stride, const void * pointer); +typedef void (GLAD_API_PTR *PFNGLSELECTBUFFERPROC)(GLsizei size, GLuint * buffer); +typedef void (GLAD_API_PTR *PFNGLSHADEMODELPROC)(GLenum mode); +typedef void (GLAD_API_PTR *PFNGLSHADERSOURCEPROC)(GLuint shader, GLsizei count, const GLchar *const* string, const GLint * length); +typedef void (GLAD_API_PTR *PFNGLSTENCILFUNCPROC)(GLenum func, GLint ref, GLuint mask); +typedef void (GLAD_API_PTR *PFNGLSTENCILFUNCSEPARATEPROC)(GLenum face, GLenum func, GLint ref, GLuint mask); +typedef void (GLAD_API_PTR *PFNGLSTENCILMASKPROC)(GLuint mask); +typedef void (GLAD_API_PTR *PFNGLSTENCILMASKSEPARATEPROC)(GLenum face, GLuint mask); +typedef void (GLAD_API_PTR *PFNGLSTENCILOPPROC)(GLenum fail, GLenum zfail, GLenum zpass); +typedef void (GLAD_API_PTR *PFNGLSTENCILOPSEPARATEPROC)(GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass); +typedef void (GLAD_API_PTR *PFNGLTEXBUFFERPROC)(GLenum target, GLenum internalformat, GLuint buffer); +typedef void (GLAD_API_PTR *PFNGLTEXCOORD1DPROC)(GLdouble s); +typedef void (GLAD_API_PTR *PFNGLTEXCOORD1DVPROC)(const GLdouble * v); +typedef void (GLAD_API_PTR *PFNGLTEXCOORD1FPROC)(GLfloat s); +typedef void (GLAD_API_PTR *PFNGLTEXCOORD1FVPROC)(const GLfloat * v); +typedef void (GLAD_API_PTR *PFNGLTEXCOORD1IPROC)(GLint s); +typedef void (GLAD_API_PTR *PFNGLTEXCOORD1IVPROC)(const GLint * v); +typedef void (GLAD_API_PTR *PFNGLTEXCOORD1SPROC)(GLshort s); +typedef void (GLAD_API_PTR *PFNGLTEXCOORD1SVPROC)(const GLshort * v); +typedef void (GLAD_API_PTR *PFNGLTEXCOORD2DPROC)(GLdouble s, GLdouble t); +typedef void (GLAD_API_PTR *PFNGLTEXCOORD2DVPROC)(const GLdouble * v); +typedef void (GLAD_API_PTR *PFNGLTEXCOORD2FPROC)(GLfloat s, GLfloat t); +typedef void (GLAD_API_PTR *PFNGLTEXCOORD2FVPROC)(const GLfloat * v); +typedef void (GLAD_API_PTR *PFNGLTEXCOORD2IPROC)(GLint s, GLint t); +typedef void (GLAD_API_PTR *PFNGLTEXCOORD2IVPROC)(const GLint * v); +typedef void (GLAD_API_PTR *PFNGLTEXCOORD2SPROC)(GLshort s, GLshort t); +typedef void (GLAD_API_PTR *PFNGLTEXCOORD2SVPROC)(const GLshort * v); +typedef void (GLAD_API_PTR *PFNGLTEXCOORD3DPROC)(GLdouble s, GLdouble t, GLdouble r); +typedef void (GLAD_API_PTR *PFNGLTEXCOORD3DVPROC)(const GLdouble * v); +typedef void (GLAD_API_PTR *PFNGLTEXCOORD3FPROC)(GLfloat s, GLfloat t, GLfloat r); +typedef void (GLAD_API_PTR *PFNGLTEXCOORD3FVPROC)(const GLfloat * v); +typedef void (GLAD_API_PTR *PFNGLTEXCOORD3IPROC)(GLint s, GLint t, GLint r); +typedef void (GLAD_API_PTR *PFNGLTEXCOORD3IVPROC)(const GLint * v); +typedef void (GLAD_API_PTR *PFNGLTEXCOORD3SPROC)(GLshort s, GLshort t, GLshort r); +typedef void (GLAD_API_PTR *PFNGLTEXCOORD3SVPROC)(const GLshort * v); +typedef void (GLAD_API_PTR *PFNGLTEXCOORD4DPROC)(GLdouble s, GLdouble t, GLdouble r, GLdouble q); +typedef void (GLAD_API_PTR *PFNGLTEXCOORD4DVPROC)(const GLdouble * v); +typedef void (GLAD_API_PTR *PFNGLTEXCOORD4FPROC)(GLfloat s, GLfloat t, GLfloat r, GLfloat q); +typedef void (GLAD_API_PTR *PFNGLTEXCOORD4FVPROC)(const GLfloat * v); +typedef void (GLAD_API_PTR *PFNGLTEXCOORD4IPROC)(GLint s, GLint t, GLint r, GLint q); +typedef void (GLAD_API_PTR *PFNGLTEXCOORD4IVPROC)(const GLint * v); +typedef void (GLAD_API_PTR *PFNGLTEXCOORD4SPROC)(GLshort s, GLshort t, GLshort r, GLshort q); +typedef void (GLAD_API_PTR *PFNGLTEXCOORD4SVPROC)(const GLshort * v); +typedef void (GLAD_API_PTR *PFNGLTEXCOORDP1UIPROC)(GLenum type, GLuint coords); +typedef void (GLAD_API_PTR *PFNGLTEXCOORDP1UIVPROC)(GLenum type, const GLuint * coords); +typedef void (GLAD_API_PTR *PFNGLTEXCOORDP2UIPROC)(GLenum type, GLuint coords); +typedef void (GLAD_API_PTR *PFNGLTEXCOORDP2UIVPROC)(GLenum type, const GLuint * coords); +typedef void (GLAD_API_PTR *PFNGLTEXCOORDP3UIPROC)(GLenum type, GLuint coords); +typedef void (GLAD_API_PTR *PFNGLTEXCOORDP3UIVPROC)(GLenum type, const GLuint * coords); +typedef void (GLAD_API_PTR *PFNGLTEXCOORDP4UIPROC)(GLenum type, GLuint coords); +typedef void (GLAD_API_PTR *PFNGLTEXCOORDP4UIVPROC)(GLenum type, const GLuint * coords); +typedef void (GLAD_API_PTR *PFNGLTEXCOORDPOINTERPROC)(GLint size, GLenum type, GLsizei stride, const void * pointer); +typedef void (GLAD_API_PTR *PFNGLTEXENVFPROC)(GLenum target, GLenum pname, GLfloat param); +typedef void (GLAD_API_PTR *PFNGLTEXENVFVPROC)(GLenum target, GLenum pname, const GLfloat * params); +typedef void (GLAD_API_PTR *PFNGLTEXENVIPROC)(GLenum target, GLenum pname, GLint param); +typedef void (GLAD_API_PTR *PFNGLTEXENVIVPROC)(GLenum target, GLenum pname, const GLint * params); +typedef void (GLAD_API_PTR *PFNGLTEXGENDPROC)(GLenum coord, GLenum pname, GLdouble param); +typedef void (GLAD_API_PTR *PFNGLTEXGENDVPROC)(GLenum coord, GLenum pname, const GLdouble * params); +typedef void (GLAD_API_PTR *PFNGLTEXGENFPROC)(GLenum coord, GLenum pname, GLfloat param); +typedef void (GLAD_API_PTR *PFNGLTEXGENFVPROC)(GLenum coord, GLenum pname, const GLfloat * params); +typedef void (GLAD_API_PTR *PFNGLTEXGENIPROC)(GLenum coord, GLenum pname, GLint param); +typedef void (GLAD_API_PTR *PFNGLTEXGENIVPROC)(GLenum coord, GLenum pname, const GLint * params); +typedef void (GLAD_API_PTR *PFNGLTEXIMAGE1DPROC)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const void * pixels); +typedef void (GLAD_API_PTR *PFNGLTEXIMAGE2DPROC)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void * pixels); +typedef void (GLAD_API_PTR *PFNGLTEXIMAGE2DMULTISAMPLEPROC)(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations); +typedef void (GLAD_API_PTR *PFNGLTEXIMAGE3DPROC)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void * pixels); +typedef void (GLAD_API_PTR *PFNGLTEXIMAGE3DMULTISAMPLEPROC)(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations); +typedef void (GLAD_API_PTR *PFNGLTEXPARAMETERIIVPROC)(GLenum target, GLenum pname, const GLint * params); +typedef void (GLAD_API_PTR *PFNGLTEXPARAMETERIUIVPROC)(GLenum target, GLenum pname, const GLuint * params); +typedef void (GLAD_API_PTR *PFNGLTEXPARAMETERFPROC)(GLenum target, GLenum pname, GLfloat param); +typedef void (GLAD_API_PTR *PFNGLTEXPARAMETERFVPROC)(GLenum target, GLenum pname, const GLfloat * params); +typedef void (GLAD_API_PTR *PFNGLTEXPARAMETERIPROC)(GLenum target, GLenum pname, GLint param); +typedef void (GLAD_API_PTR *PFNGLTEXPARAMETERIVPROC)(GLenum target, GLenum pname, const GLint * params); +typedef void (GLAD_API_PTR *PFNGLTEXSUBIMAGE1DPROC)(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void * pixels); +typedef void (GLAD_API_PTR *PFNGLTEXSUBIMAGE2DPROC)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void * pixels); +typedef void (GLAD_API_PTR *PFNGLTEXSUBIMAGE3DPROC)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void * pixels); +typedef void (GLAD_API_PTR *PFNGLTRANSFORMFEEDBACKVARYINGSPROC)(GLuint program, GLsizei count, const GLchar *const* varyings, GLenum bufferMode); +typedef void (GLAD_API_PTR *PFNGLTRANSLATEDPROC)(GLdouble x, GLdouble y, GLdouble z); +typedef void (GLAD_API_PTR *PFNGLTRANSLATEFPROC)(GLfloat x, GLfloat y, GLfloat z); +typedef void (GLAD_API_PTR *PFNGLUNIFORM1FPROC)(GLint location, GLfloat v0); +typedef void (GLAD_API_PTR *PFNGLUNIFORM1FVPROC)(GLint location, GLsizei count, const GLfloat * value); +typedef void (GLAD_API_PTR *PFNGLUNIFORM1IPROC)(GLint location, GLint v0); +typedef void (GLAD_API_PTR *PFNGLUNIFORM1IVPROC)(GLint location, GLsizei count, const GLint * value); +typedef void (GLAD_API_PTR *PFNGLUNIFORM1UIPROC)(GLint location, GLuint v0); +typedef void (GLAD_API_PTR *PFNGLUNIFORM1UIVPROC)(GLint location, GLsizei count, const GLuint * value); +typedef void (GLAD_API_PTR *PFNGLUNIFORM2FPROC)(GLint location, GLfloat v0, GLfloat v1); +typedef void (GLAD_API_PTR *PFNGLUNIFORM2FVPROC)(GLint location, GLsizei count, const GLfloat * value); +typedef void (GLAD_API_PTR *PFNGLUNIFORM2IPROC)(GLint location, GLint v0, GLint v1); +typedef void (GLAD_API_PTR *PFNGLUNIFORM2IVPROC)(GLint location, GLsizei count, const GLint * value); +typedef void (GLAD_API_PTR *PFNGLUNIFORM2UIPROC)(GLint location, GLuint v0, GLuint v1); +typedef void (GLAD_API_PTR *PFNGLUNIFORM2UIVPROC)(GLint location, GLsizei count, const GLuint * value); +typedef void (GLAD_API_PTR *PFNGLUNIFORM3FPROC)(GLint location, GLfloat v0, GLfloat v1, GLfloat v2); +typedef void (GLAD_API_PTR *PFNGLUNIFORM3FVPROC)(GLint location, GLsizei count, const GLfloat * value); +typedef void (GLAD_API_PTR *PFNGLUNIFORM3IPROC)(GLint location, GLint v0, GLint v1, GLint v2); +typedef void (GLAD_API_PTR *PFNGLUNIFORM3IVPROC)(GLint location, GLsizei count, const GLint * value); +typedef void (GLAD_API_PTR *PFNGLUNIFORM3UIPROC)(GLint location, GLuint v0, GLuint v1, GLuint v2); +typedef void (GLAD_API_PTR *PFNGLUNIFORM3UIVPROC)(GLint location, GLsizei count, const GLuint * value); +typedef void (GLAD_API_PTR *PFNGLUNIFORM4FPROC)(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); +typedef void (GLAD_API_PTR *PFNGLUNIFORM4FVPROC)(GLint location, GLsizei count, const GLfloat * value); +typedef void (GLAD_API_PTR *PFNGLUNIFORM4IPROC)(GLint location, GLint v0, GLint v1, GLint v2, GLint v3); +typedef void (GLAD_API_PTR *PFNGLUNIFORM4IVPROC)(GLint location, GLsizei count, const GLint * value); +typedef void (GLAD_API_PTR *PFNGLUNIFORM4UIPROC)(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +typedef void (GLAD_API_PTR *PFNGLUNIFORM4UIVPROC)(GLint location, GLsizei count, const GLuint * value); +typedef void (GLAD_API_PTR *PFNGLUNIFORMBLOCKBINDINGPROC)(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding); +typedef void (GLAD_API_PTR *PFNGLUNIFORMMATRIX2FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); +typedef void (GLAD_API_PTR *PFNGLUNIFORMMATRIX2X3FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); +typedef void (GLAD_API_PTR *PFNGLUNIFORMMATRIX2X4FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); +typedef void (GLAD_API_PTR *PFNGLUNIFORMMATRIX3FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); +typedef void (GLAD_API_PTR *PFNGLUNIFORMMATRIX3X2FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); +typedef void (GLAD_API_PTR *PFNGLUNIFORMMATRIX3X4FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); +typedef void (GLAD_API_PTR *PFNGLUNIFORMMATRIX4FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); +typedef void (GLAD_API_PTR *PFNGLUNIFORMMATRIX4X2FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); +typedef void (GLAD_API_PTR *PFNGLUNIFORMMATRIX4X3FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); +typedef GLboolean (GLAD_API_PTR *PFNGLUNMAPBUFFERPROC)(GLenum target); +typedef void (GLAD_API_PTR *PFNGLUSEPROGRAMPROC)(GLuint program); +typedef void (GLAD_API_PTR *PFNGLVALIDATEPROGRAMPROC)(GLuint program); +typedef void (GLAD_API_PTR *PFNGLVERTEX2DPROC)(GLdouble x, GLdouble y); +typedef void (GLAD_API_PTR *PFNGLVERTEX2DVPROC)(const GLdouble * v); +typedef void (GLAD_API_PTR *PFNGLVERTEX2FPROC)(GLfloat x, GLfloat y); +typedef void (GLAD_API_PTR *PFNGLVERTEX2FVPROC)(const GLfloat * v); +typedef void (GLAD_API_PTR *PFNGLVERTEX2IPROC)(GLint x, GLint y); +typedef void (GLAD_API_PTR *PFNGLVERTEX2IVPROC)(const GLint * v); +typedef void (GLAD_API_PTR *PFNGLVERTEX2SPROC)(GLshort x, GLshort y); +typedef void (GLAD_API_PTR *PFNGLVERTEX2SVPROC)(const GLshort * v); +typedef void (GLAD_API_PTR *PFNGLVERTEX3DPROC)(GLdouble x, GLdouble y, GLdouble z); +typedef void (GLAD_API_PTR *PFNGLVERTEX3DVPROC)(const GLdouble * v); +typedef void (GLAD_API_PTR *PFNGLVERTEX3FPROC)(GLfloat x, GLfloat y, GLfloat z); +typedef void (GLAD_API_PTR *PFNGLVERTEX3FVPROC)(const GLfloat * v); +typedef void (GLAD_API_PTR *PFNGLVERTEX3IPROC)(GLint x, GLint y, GLint z); +typedef void (GLAD_API_PTR *PFNGLVERTEX3IVPROC)(const GLint * v); +typedef void (GLAD_API_PTR *PFNGLVERTEX3SPROC)(GLshort x, GLshort y, GLshort z); +typedef void (GLAD_API_PTR *PFNGLVERTEX3SVPROC)(const GLshort * v); +typedef void (GLAD_API_PTR *PFNGLVERTEX4DPROC)(GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (GLAD_API_PTR *PFNGLVERTEX4DVPROC)(const GLdouble * v); +typedef void (GLAD_API_PTR *PFNGLVERTEX4FPROC)(GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (GLAD_API_PTR *PFNGLVERTEX4FVPROC)(const GLfloat * v); +typedef void (GLAD_API_PTR *PFNGLVERTEX4IPROC)(GLint x, GLint y, GLint z, GLint w); +typedef void (GLAD_API_PTR *PFNGLVERTEX4IVPROC)(const GLint * v); +typedef void (GLAD_API_PTR *PFNGLVERTEX4SPROC)(GLshort x, GLshort y, GLshort z, GLshort w); +typedef void (GLAD_API_PTR *PFNGLVERTEX4SVPROC)(const GLshort * v); +typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB1DPROC)(GLuint index, GLdouble x); +typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB1DVPROC)(GLuint index, const GLdouble * v); +typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB1FPROC)(GLuint index, GLfloat x); +typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB1FVPROC)(GLuint index, const GLfloat * v); +typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB1SPROC)(GLuint index, GLshort x); +typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB1SVPROC)(GLuint index, const GLshort * v); +typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB2DPROC)(GLuint index, GLdouble x, GLdouble y); +typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB2DVPROC)(GLuint index, const GLdouble * v); +typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB2FPROC)(GLuint index, GLfloat x, GLfloat y); +typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB2FVPROC)(GLuint index, const GLfloat * v); +typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB2SPROC)(GLuint index, GLshort x, GLshort y); +typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB2SVPROC)(GLuint index, const GLshort * v); +typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB3DPROC)(GLuint index, GLdouble x, GLdouble y, GLdouble z); +typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB3DVPROC)(GLuint index, const GLdouble * v); +typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB3FPROC)(GLuint index, GLfloat x, GLfloat y, GLfloat z); +typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB3FVPROC)(GLuint index, const GLfloat * v); +typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB3SPROC)(GLuint index, GLshort x, GLshort y, GLshort z); +typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB3SVPROC)(GLuint index, const GLshort * v); +typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB4NBVPROC)(GLuint index, const GLbyte * v); +typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB4NIVPROC)(GLuint index, const GLint * v); +typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB4NSVPROC)(GLuint index, const GLshort * v); +typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB4NUBPROC)(GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w); +typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB4NUBVPROC)(GLuint index, const GLubyte * v); +typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB4NUIVPROC)(GLuint index, const GLuint * v); +typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB4NUSVPROC)(GLuint index, const GLushort * v); +typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB4BVPROC)(GLuint index, const GLbyte * v); +typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB4DPROC)(GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w); +typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB4DVPROC)(GLuint index, const GLdouble * v); +typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB4FPROC)(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB4FVPROC)(GLuint index, const GLfloat * v); +typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB4IVPROC)(GLuint index, const GLint * v); +typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB4SPROC)(GLuint index, GLshort x, GLshort y, GLshort z, GLshort w); +typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB4SVPROC)(GLuint index, const GLshort * v); +typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB4UBVPROC)(GLuint index, const GLubyte * v); +typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB4UIVPROC)(GLuint index, const GLuint * v); +typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB4USVPROC)(GLuint index, const GLushort * v); +typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBDIVISORPROC)(GLuint index, GLuint divisor); +typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBI1IPROC)(GLuint index, GLint x); +typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBI1IVPROC)(GLuint index, const GLint * v); +typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBI1UIPROC)(GLuint index, GLuint x); +typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBI1UIVPROC)(GLuint index, const GLuint * v); +typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBI2IPROC)(GLuint index, GLint x, GLint y); +typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBI2IVPROC)(GLuint index, const GLint * v); +typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBI2UIPROC)(GLuint index, GLuint x, GLuint y); +typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBI2UIVPROC)(GLuint index, const GLuint * v); +typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBI3IPROC)(GLuint index, GLint x, GLint y, GLint z); +typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBI3IVPROC)(GLuint index, const GLint * v); +typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBI3UIPROC)(GLuint index, GLuint x, GLuint y, GLuint z); +typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBI3UIVPROC)(GLuint index, const GLuint * v); +typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBI4BVPROC)(GLuint index, const GLbyte * v); +typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBI4IPROC)(GLuint index, GLint x, GLint y, GLint z, GLint w); +typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBI4IVPROC)(GLuint index, const GLint * v); +typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBI4SVPROC)(GLuint index, const GLshort * v); +typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBI4UBVPROC)(GLuint index, const GLubyte * v); +typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBI4UIPROC)(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); +typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBI4UIVPROC)(GLuint index, const GLuint * v); +typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBI4USVPROC)(GLuint index, const GLushort * v); +typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBIPOINTERPROC)(GLuint index, GLint size, GLenum type, GLsizei stride, const void * pointer); +typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBP1UIPROC)(GLuint index, GLenum type, GLboolean normalized, GLuint value); +typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBP1UIVPROC)(GLuint index, GLenum type, GLboolean normalized, const GLuint * value); +typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBP2UIPROC)(GLuint index, GLenum type, GLboolean normalized, GLuint value); +typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBP2UIVPROC)(GLuint index, GLenum type, GLboolean normalized, const GLuint * value); +typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBP3UIPROC)(GLuint index, GLenum type, GLboolean normalized, GLuint value); +typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBP3UIVPROC)(GLuint index, GLenum type, GLboolean normalized, const GLuint * value); +typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBP4UIPROC)(GLuint index, GLenum type, GLboolean normalized, GLuint value); +typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBP4UIVPROC)(GLuint index, GLenum type, GLboolean normalized, const GLuint * value); +typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBPOINTERPROC)(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void * pointer); +typedef void (GLAD_API_PTR *PFNGLVERTEXP2UIPROC)(GLenum type, GLuint value); +typedef void (GLAD_API_PTR *PFNGLVERTEXP2UIVPROC)(GLenum type, const GLuint * value); +typedef void (GLAD_API_PTR *PFNGLVERTEXP3UIPROC)(GLenum type, GLuint value); +typedef void (GLAD_API_PTR *PFNGLVERTEXP3UIVPROC)(GLenum type, const GLuint * value); +typedef void (GLAD_API_PTR *PFNGLVERTEXP4UIPROC)(GLenum type, GLuint value); +typedef void (GLAD_API_PTR *PFNGLVERTEXP4UIVPROC)(GLenum type, const GLuint * value); +typedef void (GLAD_API_PTR *PFNGLVERTEXPOINTERPROC)(GLint size, GLenum type, GLsizei stride, const void * pointer); +typedef void (GLAD_API_PTR *PFNGLVIEWPORTPROC)(GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (GLAD_API_PTR *PFNGLWAITSYNCPROC)(GLsync sync, GLbitfield flags, GLuint64 timeout); +typedef void (GLAD_API_PTR *PFNGLWINDOWPOS2DPROC)(GLdouble x, GLdouble y); +typedef void (GLAD_API_PTR *PFNGLWINDOWPOS2DVPROC)(const GLdouble * v); +typedef void (GLAD_API_PTR *PFNGLWINDOWPOS2FPROC)(GLfloat x, GLfloat y); +typedef void (GLAD_API_PTR *PFNGLWINDOWPOS2FVPROC)(const GLfloat * v); +typedef void (GLAD_API_PTR *PFNGLWINDOWPOS2IPROC)(GLint x, GLint y); +typedef void (GLAD_API_PTR *PFNGLWINDOWPOS2IVPROC)(const GLint * v); +typedef void (GLAD_API_PTR *PFNGLWINDOWPOS2SPROC)(GLshort x, GLshort y); +typedef void (GLAD_API_PTR *PFNGLWINDOWPOS2SVPROC)(const GLshort * v); +typedef void (GLAD_API_PTR *PFNGLWINDOWPOS3DPROC)(GLdouble x, GLdouble y, GLdouble z); +typedef void (GLAD_API_PTR *PFNGLWINDOWPOS3DVPROC)(const GLdouble * v); +typedef void (GLAD_API_PTR *PFNGLWINDOWPOS3FPROC)(GLfloat x, GLfloat y, GLfloat z); +typedef void (GLAD_API_PTR *PFNGLWINDOWPOS3FVPROC)(const GLfloat * v); +typedef void (GLAD_API_PTR *PFNGLWINDOWPOS3IPROC)(GLint x, GLint y, GLint z); +typedef void (GLAD_API_PTR *PFNGLWINDOWPOS3IVPROC)(const GLint * v); +typedef void (GLAD_API_PTR *PFNGLWINDOWPOS3SPROC)(GLshort x, GLshort y, GLshort z); +typedef void (GLAD_API_PTR *PFNGLWINDOWPOS3SVPROC)(const GLshort * v); GLAD_API_CALL PFNGLACCUMPROC glad_glAccum; #define glAccum glad_glAccum @@ -3270,8 +3622,6 @@ GLAD_API_CALL PFNGLREADBUFFERPROC glad_glReadBuffer; #define glReadBuffer glad_glReadBuffer GLAD_API_CALL PFNGLREADPIXELSPROC glad_glReadPixels; #define glReadPixels glad_glReadPixels -GLAD_API_CALL PFNGLREADNPIXELSPROC glad_glReadnPixels; -#define glReadnPixels glad_glReadnPixels GLAD_API_CALL PFNGLREADNPIXELSARBPROC glad_glReadnPixelsARB; #define glReadnPixelsARB glad_glReadnPixelsARB GLAD_API_CALL PFNGLRECTDPROC glad_glRectd; @@ -3826,15 +4176,1821 @@ GLAD_API_CALL PFNGLWINDOWPOS3SVPROC glad_glWindowPos3sv; #define glWindowPos3sv glad_glWindowPos3sv + + + GLAD_API_CALL int gladLoadGLUserPtr( GLADuserptrloadfunc load, void *userptr); GLAD_API_CALL int gladLoadGL( GLADloadfunc load); +#ifdef __cplusplus +} +#endif +#endif +/* Source */ +#ifdef GLAD_GL_IMPLEMENTATION +#include +#include +#include +#ifndef GLAD_IMPL_UTIL_C_ +#define GLAD_IMPL_UTIL_C_ + +#ifdef _MSC_VER +#define GLAD_IMPL_UTIL_SSCANF sscanf_s +#else +#define GLAD_IMPL_UTIL_SSCANF sscanf +#endif + +#endif /* GLAD_IMPL_UTIL_C_ */ #ifdef __cplusplus +extern "C" { +#endif + + + +int GLAD_GL_VERSION_1_0 = 0; +int GLAD_GL_VERSION_1_1 = 0; +int GLAD_GL_VERSION_1_2 = 0; +int GLAD_GL_VERSION_1_3 = 0; +int GLAD_GL_VERSION_1_4 = 0; +int GLAD_GL_VERSION_1_5 = 0; +int GLAD_GL_VERSION_2_0 = 0; +int GLAD_GL_VERSION_2_1 = 0; +int GLAD_GL_VERSION_3_0 = 0; +int GLAD_GL_VERSION_3_1 = 0; +int GLAD_GL_VERSION_3_2 = 0; +int GLAD_GL_VERSION_3_3 = 0; +int GLAD_GL_ARB_multisample = 0; +int GLAD_GL_ARB_robustness = 0; +int GLAD_GL_KHR_debug = 0; + + + +PFNGLACCUMPROC glad_glAccum = NULL; +PFNGLACTIVETEXTUREPROC glad_glActiveTexture = NULL; +PFNGLALPHAFUNCPROC glad_glAlphaFunc = NULL; +PFNGLARETEXTURESRESIDENTPROC glad_glAreTexturesResident = NULL; +PFNGLARRAYELEMENTPROC glad_glArrayElement = NULL; +PFNGLATTACHSHADERPROC glad_glAttachShader = NULL; +PFNGLBEGINPROC glad_glBegin = NULL; +PFNGLBEGINCONDITIONALRENDERPROC glad_glBeginConditionalRender = NULL; +PFNGLBEGINQUERYPROC glad_glBeginQuery = NULL; +PFNGLBEGINTRANSFORMFEEDBACKPROC glad_glBeginTransformFeedback = NULL; +PFNGLBINDATTRIBLOCATIONPROC glad_glBindAttribLocation = NULL; +PFNGLBINDBUFFERPROC glad_glBindBuffer = NULL; +PFNGLBINDBUFFERBASEPROC glad_glBindBufferBase = NULL; +PFNGLBINDBUFFERRANGEPROC glad_glBindBufferRange = NULL; +PFNGLBINDFRAGDATALOCATIONPROC glad_glBindFragDataLocation = NULL; +PFNGLBINDFRAGDATALOCATIONINDEXEDPROC glad_glBindFragDataLocationIndexed = NULL; +PFNGLBINDFRAMEBUFFERPROC glad_glBindFramebuffer = NULL; +PFNGLBINDRENDERBUFFERPROC glad_glBindRenderbuffer = NULL; +PFNGLBINDSAMPLERPROC glad_glBindSampler = NULL; +PFNGLBINDTEXTUREPROC glad_glBindTexture = NULL; +PFNGLBINDVERTEXARRAYPROC glad_glBindVertexArray = NULL; +PFNGLBITMAPPROC glad_glBitmap = NULL; +PFNGLBLENDCOLORPROC glad_glBlendColor = NULL; +PFNGLBLENDEQUATIONPROC glad_glBlendEquation = NULL; +PFNGLBLENDEQUATIONSEPARATEPROC glad_glBlendEquationSeparate = NULL; +PFNGLBLENDFUNCPROC glad_glBlendFunc = NULL; +PFNGLBLENDFUNCSEPARATEPROC glad_glBlendFuncSeparate = NULL; +PFNGLBLITFRAMEBUFFERPROC glad_glBlitFramebuffer = NULL; +PFNGLBUFFERDATAPROC glad_glBufferData = NULL; +PFNGLBUFFERSUBDATAPROC glad_glBufferSubData = NULL; +PFNGLCALLLISTPROC glad_glCallList = NULL; +PFNGLCALLLISTSPROC glad_glCallLists = NULL; +PFNGLCHECKFRAMEBUFFERSTATUSPROC glad_glCheckFramebufferStatus = NULL; +PFNGLCLAMPCOLORPROC glad_glClampColor = NULL; +PFNGLCLEARPROC glad_glClear = NULL; +PFNGLCLEARACCUMPROC glad_glClearAccum = NULL; +PFNGLCLEARBUFFERFIPROC glad_glClearBufferfi = NULL; +PFNGLCLEARBUFFERFVPROC glad_glClearBufferfv = NULL; +PFNGLCLEARBUFFERIVPROC glad_glClearBufferiv = NULL; +PFNGLCLEARBUFFERUIVPROC glad_glClearBufferuiv = NULL; +PFNGLCLEARCOLORPROC glad_glClearColor = NULL; +PFNGLCLEARDEPTHPROC glad_glClearDepth = NULL; +PFNGLCLEARINDEXPROC glad_glClearIndex = NULL; +PFNGLCLEARSTENCILPROC glad_glClearStencil = NULL; +PFNGLCLIENTACTIVETEXTUREPROC glad_glClientActiveTexture = NULL; +PFNGLCLIENTWAITSYNCPROC glad_glClientWaitSync = NULL; +PFNGLCLIPPLANEPROC glad_glClipPlane = NULL; +PFNGLCOLOR3BPROC glad_glColor3b = NULL; +PFNGLCOLOR3BVPROC glad_glColor3bv = NULL; +PFNGLCOLOR3DPROC glad_glColor3d = NULL; +PFNGLCOLOR3DVPROC glad_glColor3dv = NULL; +PFNGLCOLOR3FPROC glad_glColor3f = NULL; +PFNGLCOLOR3FVPROC glad_glColor3fv = NULL; +PFNGLCOLOR3IPROC glad_glColor3i = NULL; +PFNGLCOLOR3IVPROC glad_glColor3iv = NULL; +PFNGLCOLOR3SPROC glad_glColor3s = NULL; +PFNGLCOLOR3SVPROC glad_glColor3sv = NULL; +PFNGLCOLOR3UBPROC glad_glColor3ub = NULL; +PFNGLCOLOR3UBVPROC glad_glColor3ubv = NULL; +PFNGLCOLOR3UIPROC glad_glColor3ui = NULL; +PFNGLCOLOR3UIVPROC glad_glColor3uiv = NULL; +PFNGLCOLOR3USPROC glad_glColor3us = NULL; +PFNGLCOLOR3USVPROC glad_glColor3usv = NULL; +PFNGLCOLOR4BPROC glad_glColor4b = NULL; +PFNGLCOLOR4BVPROC glad_glColor4bv = NULL; +PFNGLCOLOR4DPROC glad_glColor4d = NULL; +PFNGLCOLOR4DVPROC glad_glColor4dv = NULL; +PFNGLCOLOR4FPROC glad_glColor4f = NULL; +PFNGLCOLOR4FVPROC glad_glColor4fv = NULL; +PFNGLCOLOR4IPROC glad_glColor4i = NULL; +PFNGLCOLOR4IVPROC glad_glColor4iv = NULL; +PFNGLCOLOR4SPROC glad_glColor4s = NULL; +PFNGLCOLOR4SVPROC glad_glColor4sv = NULL; +PFNGLCOLOR4UBPROC glad_glColor4ub = NULL; +PFNGLCOLOR4UBVPROC glad_glColor4ubv = NULL; +PFNGLCOLOR4UIPROC glad_glColor4ui = NULL; +PFNGLCOLOR4UIVPROC glad_glColor4uiv = NULL; +PFNGLCOLOR4USPROC glad_glColor4us = NULL; +PFNGLCOLOR4USVPROC glad_glColor4usv = NULL; +PFNGLCOLORMASKPROC glad_glColorMask = NULL; +PFNGLCOLORMASKIPROC glad_glColorMaski = NULL; +PFNGLCOLORMATERIALPROC glad_glColorMaterial = NULL; +PFNGLCOLORP3UIPROC glad_glColorP3ui = NULL; +PFNGLCOLORP3UIVPROC glad_glColorP3uiv = NULL; +PFNGLCOLORP4UIPROC glad_glColorP4ui = NULL; +PFNGLCOLORP4UIVPROC glad_glColorP4uiv = NULL; +PFNGLCOLORPOINTERPROC glad_glColorPointer = NULL; +PFNGLCOMPILESHADERPROC glad_glCompileShader = NULL; +PFNGLCOMPRESSEDTEXIMAGE1DPROC glad_glCompressedTexImage1D = NULL; +PFNGLCOMPRESSEDTEXIMAGE2DPROC glad_glCompressedTexImage2D = NULL; +PFNGLCOMPRESSEDTEXIMAGE3DPROC glad_glCompressedTexImage3D = NULL; +PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC glad_glCompressedTexSubImage1D = NULL; +PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC glad_glCompressedTexSubImage2D = NULL; +PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC glad_glCompressedTexSubImage3D = NULL; +PFNGLCOPYBUFFERSUBDATAPROC glad_glCopyBufferSubData = NULL; +PFNGLCOPYPIXELSPROC glad_glCopyPixels = NULL; +PFNGLCOPYTEXIMAGE1DPROC glad_glCopyTexImage1D = NULL; +PFNGLCOPYTEXIMAGE2DPROC glad_glCopyTexImage2D = NULL; +PFNGLCOPYTEXSUBIMAGE1DPROC glad_glCopyTexSubImage1D = NULL; +PFNGLCOPYTEXSUBIMAGE2DPROC glad_glCopyTexSubImage2D = NULL; +PFNGLCOPYTEXSUBIMAGE3DPROC glad_glCopyTexSubImage3D = NULL; +PFNGLCREATEPROGRAMPROC glad_glCreateProgram = NULL; +PFNGLCREATESHADERPROC glad_glCreateShader = NULL; +PFNGLCULLFACEPROC glad_glCullFace = NULL; +PFNGLDEBUGMESSAGECALLBACKPROC glad_glDebugMessageCallback = NULL; +PFNGLDEBUGMESSAGECONTROLPROC glad_glDebugMessageControl = NULL; +PFNGLDEBUGMESSAGEINSERTPROC glad_glDebugMessageInsert = NULL; +PFNGLDELETEBUFFERSPROC glad_glDeleteBuffers = NULL; +PFNGLDELETEFRAMEBUFFERSPROC glad_glDeleteFramebuffers = NULL; +PFNGLDELETELISTSPROC glad_glDeleteLists = NULL; +PFNGLDELETEPROGRAMPROC glad_glDeleteProgram = NULL; +PFNGLDELETEQUERIESPROC glad_glDeleteQueries = NULL; +PFNGLDELETERENDERBUFFERSPROC glad_glDeleteRenderbuffers = NULL; +PFNGLDELETESAMPLERSPROC glad_glDeleteSamplers = NULL; +PFNGLDELETESHADERPROC glad_glDeleteShader = NULL; +PFNGLDELETESYNCPROC glad_glDeleteSync = NULL; +PFNGLDELETETEXTURESPROC glad_glDeleteTextures = NULL; +PFNGLDELETEVERTEXARRAYSPROC glad_glDeleteVertexArrays = NULL; +PFNGLDEPTHFUNCPROC glad_glDepthFunc = NULL; +PFNGLDEPTHMASKPROC glad_glDepthMask = NULL; +PFNGLDEPTHRANGEPROC glad_glDepthRange = NULL; +PFNGLDETACHSHADERPROC glad_glDetachShader = NULL; +PFNGLDISABLEPROC glad_glDisable = NULL; +PFNGLDISABLECLIENTSTATEPROC glad_glDisableClientState = NULL; +PFNGLDISABLEVERTEXATTRIBARRAYPROC glad_glDisableVertexAttribArray = NULL; +PFNGLDISABLEIPROC glad_glDisablei = NULL; +PFNGLDRAWARRAYSPROC glad_glDrawArrays = NULL; +PFNGLDRAWARRAYSINSTANCEDPROC glad_glDrawArraysInstanced = NULL; +PFNGLDRAWBUFFERPROC glad_glDrawBuffer = NULL; +PFNGLDRAWBUFFERSPROC glad_glDrawBuffers = NULL; +PFNGLDRAWELEMENTSPROC glad_glDrawElements = NULL; +PFNGLDRAWELEMENTSBASEVERTEXPROC glad_glDrawElementsBaseVertex = NULL; +PFNGLDRAWELEMENTSINSTANCEDPROC glad_glDrawElementsInstanced = NULL; +PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC glad_glDrawElementsInstancedBaseVertex = NULL; +PFNGLDRAWPIXELSPROC glad_glDrawPixels = NULL; +PFNGLDRAWRANGEELEMENTSPROC glad_glDrawRangeElements = NULL; +PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC glad_glDrawRangeElementsBaseVertex = NULL; +PFNGLEDGEFLAGPROC glad_glEdgeFlag = NULL; +PFNGLEDGEFLAGPOINTERPROC glad_glEdgeFlagPointer = NULL; +PFNGLEDGEFLAGVPROC glad_glEdgeFlagv = NULL; +PFNGLENABLEPROC glad_glEnable = NULL; +PFNGLENABLECLIENTSTATEPROC glad_glEnableClientState = NULL; +PFNGLENABLEVERTEXATTRIBARRAYPROC glad_glEnableVertexAttribArray = NULL; +PFNGLENABLEIPROC glad_glEnablei = NULL; +PFNGLENDPROC glad_glEnd = NULL; +PFNGLENDCONDITIONALRENDERPROC glad_glEndConditionalRender = NULL; +PFNGLENDLISTPROC glad_glEndList = NULL; +PFNGLENDQUERYPROC glad_glEndQuery = NULL; +PFNGLENDTRANSFORMFEEDBACKPROC glad_glEndTransformFeedback = NULL; +PFNGLEVALCOORD1DPROC glad_glEvalCoord1d = NULL; +PFNGLEVALCOORD1DVPROC glad_glEvalCoord1dv = NULL; +PFNGLEVALCOORD1FPROC glad_glEvalCoord1f = NULL; +PFNGLEVALCOORD1FVPROC glad_glEvalCoord1fv = NULL; +PFNGLEVALCOORD2DPROC glad_glEvalCoord2d = NULL; +PFNGLEVALCOORD2DVPROC glad_glEvalCoord2dv = NULL; +PFNGLEVALCOORD2FPROC glad_glEvalCoord2f = NULL; +PFNGLEVALCOORD2FVPROC glad_glEvalCoord2fv = NULL; +PFNGLEVALMESH1PROC glad_glEvalMesh1 = NULL; +PFNGLEVALMESH2PROC glad_glEvalMesh2 = NULL; +PFNGLEVALPOINT1PROC glad_glEvalPoint1 = NULL; +PFNGLEVALPOINT2PROC glad_glEvalPoint2 = NULL; +PFNGLFEEDBACKBUFFERPROC glad_glFeedbackBuffer = NULL; +PFNGLFENCESYNCPROC glad_glFenceSync = NULL; +PFNGLFINISHPROC glad_glFinish = NULL; +PFNGLFLUSHPROC glad_glFlush = NULL; +PFNGLFLUSHMAPPEDBUFFERRANGEPROC glad_glFlushMappedBufferRange = NULL; +PFNGLFOGCOORDPOINTERPROC glad_glFogCoordPointer = NULL; +PFNGLFOGCOORDDPROC glad_glFogCoordd = NULL; +PFNGLFOGCOORDDVPROC glad_glFogCoorddv = NULL; +PFNGLFOGCOORDFPROC glad_glFogCoordf = NULL; +PFNGLFOGCOORDFVPROC glad_glFogCoordfv = NULL; +PFNGLFOGFPROC glad_glFogf = NULL; +PFNGLFOGFVPROC glad_glFogfv = NULL; +PFNGLFOGIPROC glad_glFogi = NULL; +PFNGLFOGIVPROC glad_glFogiv = NULL; +PFNGLFRAMEBUFFERRENDERBUFFERPROC glad_glFramebufferRenderbuffer = NULL; +PFNGLFRAMEBUFFERTEXTUREPROC glad_glFramebufferTexture = NULL; +PFNGLFRAMEBUFFERTEXTURE1DPROC glad_glFramebufferTexture1D = NULL; +PFNGLFRAMEBUFFERTEXTURE2DPROC glad_glFramebufferTexture2D = NULL; +PFNGLFRAMEBUFFERTEXTURE3DPROC glad_glFramebufferTexture3D = NULL; +PFNGLFRAMEBUFFERTEXTURELAYERPROC glad_glFramebufferTextureLayer = NULL; +PFNGLFRONTFACEPROC glad_glFrontFace = NULL; +PFNGLFRUSTUMPROC glad_glFrustum = NULL; +PFNGLGENBUFFERSPROC glad_glGenBuffers = NULL; +PFNGLGENFRAMEBUFFERSPROC glad_glGenFramebuffers = NULL; +PFNGLGENLISTSPROC glad_glGenLists = NULL; +PFNGLGENQUERIESPROC glad_glGenQueries = NULL; +PFNGLGENRENDERBUFFERSPROC glad_glGenRenderbuffers = NULL; +PFNGLGENSAMPLERSPROC glad_glGenSamplers = NULL; +PFNGLGENTEXTURESPROC glad_glGenTextures = NULL; +PFNGLGENVERTEXARRAYSPROC glad_glGenVertexArrays = NULL; +PFNGLGENERATEMIPMAPPROC glad_glGenerateMipmap = NULL; +PFNGLGETACTIVEATTRIBPROC glad_glGetActiveAttrib = NULL; +PFNGLGETACTIVEUNIFORMPROC glad_glGetActiveUniform = NULL; +PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC glad_glGetActiveUniformBlockName = NULL; +PFNGLGETACTIVEUNIFORMBLOCKIVPROC glad_glGetActiveUniformBlockiv = NULL; +PFNGLGETACTIVEUNIFORMNAMEPROC glad_glGetActiveUniformName = NULL; +PFNGLGETACTIVEUNIFORMSIVPROC glad_glGetActiveUniformsiv = NULL; +PFNGLGETATTACHEDSHADERSPROC glad_glGetAttachedShaders = NULL; +PFNGLGETATTRIBLOCATIONPROC glad_glGetAttribLocation = NULL; +PFNGLGETBOOLEANI_VPROC glad_glGetBooleani_v = NULL; +PFNGLGETBOOLEANVPROC glad_glGetBooleanv = NULL; +PFNGLGETBUFFERPARAMETERI64VPROC glad_glGetBufferParameteri64v = NULL; +PFNGLGETBUFFERPARAMETERIVPROC glad_glGetBufferParameteriv = NULL; +PFNGLGETBUFFERPOINTERVPROC glad_glGetBufferPointerv = NULL; +PFNGLGETBUFFERSUBDATAPROC glad_glGetBufferSubData = NULL; +PFNGLGETCLIPPLANEPROC glad_glGetClipPlane = NULL; +PFNGLGETCOMPRESSEDTEXIMAGEPROC glad_glGetCompressedTexImage = NULL; +PFNGLGETDEBUGMESSAGELOGPROC glad_glGetDebugMessageLog = NULL; +PFNGLGETDOUBLEVPROC glad_glGetDoublev = NULL; +PFNGLGETERRORPROC glad_glGetError = NULL; +PFNGLGETFLOATVPROC glad_glGetFloatv = NULL; +PFNGLGETFRAGDATAINDEXPROC glad_glGetFragDataIndex = NULL; +PFNGLGETFRAGDATALOCATIONPROC glad_glGetFragDataLocation = NULL; +PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC glad_glGetFramebufferAttachmentParameteriv = NULL; +PFNGLGETGRAPHICSRESETSTATUSARBPROC glad_glGetGraphicsResetStatusARB = NULL; +PFNGLGETINTEGER64I_VPROC glad_glGetInteger64i_v = NULL; +PFNGLGETINTEGER64VPROC glad_glGetInteger64v = NULL; +PFNGLGETINTEGERI_VPROC glad_glGetIntegeri_v = NULL; +PFNGLGETINTEGERVPROC glad_glGetIntegerv = NULL; +PFNGLGETLIGHTFVPROC glad_glGetLightfv = NULL; +PFNGLGETLIGHTIVPROC glad_glGetLightiv = NULL; +PFNGLGETMAPDVPROC glad_glGetMapdv = NULL; +PFNGLGETMAPFVPROC glad_glGetMapfv = NULL; +PFNGLGETMAPIVPROC glad_glGetMapiv = NULL; +PFNGLGETMATERIALFVPROC glad_glGetMaterialfv = NULL; +PFNGLGETMATERIALIVPROC glad_glGetMaterialiv = NULL; +PFNGLGETMULTISAMPLEFVPROC glad_glGetMultisamplefv = NULL; +PFNGLGETOBJECTLABELPROC glad_glGetObjectLabel = NULL; +PFNGLGETOBJECTPTRLABELPROC glad_glGetObjectPtrLabel = NULL; +PFNGLGETPIXELMAPFVPROC glad_glGetPixelMapfv = NULL; +PFNGLGETPIXELMAPUIVPROC glad_glGetPixelMapuiv = NULL; +PFNGLGETPIXELMAPUSVPROC glad_glGetPixelMapusv = NULL; +PFNGLGETPOINTERVPROC glad_glGetPointerv = NULL; +PFNGLGETPOLYGONSTIPPLEPROC glad_glGetPolygonStipple = NULL; +PFNGLGETPROGRAMINFOLOGPROC glad_glGetProgramInfoLog = NULL; +PFNGLGETPROGRAMIVPROC glad_glGetProgramiv = NULL; +PFNGLGETQUERYOBJECTI64VPROC glad_glGetQueryObjecti64v = NULL; +PFNGLGETQUERYOBJECTIVPROC glad_glGetQueryObjectiv = NULL; +PFNGLGETQUERYOBJECTUI64VPROC glad_glGetQueryObjectui64v = NULL; +PFNGLGETQUERYOBJECTUIVPROC glad_glGetQueryObjectuiv = NULL; +PFNGLGETQUERYIVPROC glad_glGetQueryiv = NULL; +PFNGLGETRENDERBUFFERPARAMETERIVPROC glad_glGetRenderbufferParameteriv = NULL; +PFNGLGETSAMPLERPARAMETERIIVPROC glad_glGetSamplerParameterIiv = NULL; +PFNGLGETSAMPLERPARAMETERIUIVPROC glad_glGetSamplerParameterIuiv = NULL; +PFNGLGETSAMPLERPARAMETERFVPROC glad_glGetSamplerParameterfv = NULL; +PFNGLGETSAMPLERPARAMETERIVPROC glad_glGetSamplerParameteriv = NULL; +PFNGLGETSHADERINFOLOGPROC glad_glGetShaderInfoLog = NULL; +PFNGLGETSHADERSOURCEPROC glad_glGetShaderSource = NULL; +PFNGLGETSHADERIVPROC glad_glGetShaderiv = NULL; +PFNGLGETSTRINGPROC glad_glGetString = NULL; +PFNGLGETSTRINGIPROC glad_glGetStringi = NULL; +PFNGLGETSYNCIVPROC glad_glGetSynciv = NULL; +PFNGLGETTEXENVFVPROC glad_glGetTexEnvfv = NULL; +PFNGLGETTEXENVIVPROC glad_glGetTexEnviv = NULL; +PFNGLGETTEXGENDVPROC glad_glGetTexGendv = NULL; +PFNGLGETTEXGENFVPROC glad_glGetTexGenfv = NULL; +PFNGLGETTEXGENIVPROC glad_glGetTexGeniv = NULL; +PFNGLGETTEXIMAGEPROC glad_glGetTexImage = NULL; +PFNGLGETTEXLEVELPARAMETERFVPROC glad_glGetTexLevelParameterfv = NULL; +PFNGLGETTEXLEVELPARAMETERIVPROC glad_glGetTexLevelParameteriv = NULL; +PFNGLGETTEXPARAMETERIIVPROC glad_glGetTexParameterIiv = NULL; +PFNGLGETTEXPARAMETERIUIVPROC glad_glGetTexParameterIuiv = NULL; +PFNGLGETTEXPARAMETERFVPROC glad_glGetTexParameterfv = NULL; +PFNGLGETTEXPARAMETERIVPROC glad_glGetTexParameteriv = NULL; +PFNGLGETTRANSFORMFEEDBACKVARYINGPROC glad_glGetTransformFeedbackVarying = NULL; +PFNGLGETUNIFORMBLOCKINDEXPROC glad_glGetUniformBlockIndex = NULL; +PFNGLGETUNIFORMINDICESPROC glad_glGetUniformIndices = NULL; +PFNGLGETUNIFORMLOCATIONPROC glad_glGetUniformLocation = NULL; +PFNGLGETUNIFORMFVPROC glad_glGetUniformfv = NULL; +PFNGLGETUNIFORMIVPROC glad_glGetUniformiv = NULL; +PFNGLGETUNIFORMUIVPROC glad_glGetUniformuiv = NULL; +PFNGLGETVERTEXATTRIBIIVPROC glad_glGetVertexAttribIiv = NULL; +PFNGLGETVERTEXATTRIBIUIVPROC glad_glGetVertexAttribIuiv = NULL; +PFNGLGETVERTEXATTRIBPOINTERVPROC glad_glGetVertexAttribPointerv = NULL; +PFNGLGETVERTEXATTRIBDVPROC glad_glGetVertexAttribdv = NULL; +PFNGLGETVERTEXATTRIBFVPROC glad_glGetVertexAttribfv = NULL; +PFNGLGETVERTEXATTRIBIVPROC glad_glGetVertexAttribiv = NULL; +PFNGLGETNCOLORTABLEARBPROC glad_glGetnColorTableARB = NULL; +PFNGLGETNCOMPRESSEDTEXIMAGEARBPROC glad_glGetnCompressedTexImageARB = NULL; +PFNGLGETNCONVOLUTIONFILTERARBPROC glad_glGetnConvolutionFilterARB = NULL; +PFNGLGETNHISTOGRAMARBPROC glad_glGetnHistogramARB = NULL; +PFNGLGETNMAPDVARBPROC glad_glGetnMapdvARB = NULL; +PFNGLGETNMAPFVARBPROC glad_glGetnMapfvARB = NULL; +PFNGLGETNMAPIVARBPROC glad_glGetnMapivARB = NULL; +PFNGLGETNMINMAXARBPROC glad_glGetnMinmaxARB = NULL; +PFNGLGETNPIXELMAPFVARBPROC glad_glGetnPixelMapfvARB = NULL; +PFNGLGETNPIXELMAPUIVARBPROC glad_glGetnPixelMapuivARB = NULL; +PFNGLGETNPIXELMAPUSVARBPROC glad_glGetnPixelMapusvARB = NULL; +PFNGLGETNPOLYGONSTIPPLEARBPROC glad_glGetnPolygonStippleARB = NULL; +PFNGLGETNSEPARABLEFILTERARBPROC glad_glGetnSeparableFilterARB = NULL; +PFNGLGETNTEXIMAGEARBPROC glad_glGetnTexImageARB = NULL; +PFNGLGETNUNIFORMDVARBPROC glad_glGetnUniformdvARB = NULL; +PFNGLGETNUNIFORMFVARBPROC glad_glGetnUniformfvARB = NULL; +PFNGLGETNUNIFORMIVARBPROC glad_glGetnUniformivARB = NULL; +PFNGLGETNUNIFORMUIVARBPROC glad_glGetnUniformuivARB = NULL; +PFNGLHINTPROC glad_glHint = NULL; +PFNGLINDEXMASKPROC glad_glIndexMask = NULL; +PFNGLINDEXPOINTERPROC glad_glIndexPointer = NULL; +PFNGLINDEXDPROC glad_glIndexd = NULL; +PFNGLINDEXDVPROC glad_glIndexdv = NULL; +PFNGLINDEXFPROC glad_glIndexf = NULL; +PFNGLINDEXFVPROC glad_glIndexfv = NULL; +PFNGLINDEXIPROC glad_glIndexi = NULL; +PFNGLINDEXIVPROC glad_glIndexiv = NULL; +PFNGLINDEXSPROC glad_glIndexs = NULL; +PFNGLINDEXSVPROC glad_glIndexsv = NULL; +PFNGLINDEXUBPROC glad_glIndexub = NULL; +PFNGLINDEXUBVPROC glad_glIndexubv = NULL; +PFNGLINITNAMESPROC glad_glInitNames = NULL; +PFNGLINTERLEAVEDARRAYSPROC glad_glInterleavedArrays = NULL; +PFNGLISBUFFERPROC glad_glIsBuffer = NULL; +PFNGLISENABLEDPROC glad_glIsEnabled = NULL; +PFNGLISENABLEDIPROC glad_glIsEnabledi = NULL; +PFNGLISFRAMEBUFFERPROC glad_glIsFramebuffer = NULL; +PFNGLISLISTPROC glad_glIsList = NULL; +PFNGLISPROGRAMPROC glad_glIsProgram = NULL; +PFNGLISQUERYPROC glad_glIsQuery = NULL; +PFNGLISRENDERBUFFERPROC glad_glIsRenderbuffer = NULL; +PFNGLISSAMPLERPROC glad_glIsSampler = NULL; +PFNGLISSHADERPROC glad_glIsShader = NULL; +PFNGLISSYNCPROC glad_glIsSync = NULL; +PFNGLISTEXTUREPROC glad_glIsTexture = NULL; +PFNGLISVERTEXARRAYPROC glad_glIsVertexArray = NULL; +PFNGLLIGHTMODELFPROC glad_glLightModelf = NULL; +PFNGLLIGHTMODELFVPROC glad_glLightModelfv = NULL; +PFNGLLIGHTMODELIPROC glad_glLightModeli = NULL; +PFNGLLIGHTMODELIVPROC glad_glLightModeliv = NULL; +PFNGLLIGHTFPROC glad_glLightf = NULL; +PFNGLLIGHTFVPROC glad_glLightfv = NULL; +PFNGLLIGHTIPROC glad_glLighti = NULL; +PFNGLLIGHTIVPROC glad_glLightiv = NULL; +PFNGLLINESTIPPLEPROC glad_glLineStipple = NULL; +PFNGLLINEWIDTHPROC glad_glLineWidth = NULL; +PFNGLLINKPROGRAMPROC glad_glLinkProgram = NULL; +PFNGLLISTBASEPROC glad_glListBase = NULL; +PFNGLLOADIDENTITYPROC glad_glLoadIdentity = NULL; +PFNGLLOADMATRIXDPROC glad_glLoadMatrixd = NULL; +PFNGLLOADMATRIXFPROC glad_glLoadMatrixf = NULL; +PFNGLLOADNAMEPROC glad_glLoadName = NULL; +PFNGLLOADTRANSPOSEMATRIXDPROC glad_glLoadTransposeMatrixd = NULL; +PFNGLLOADTRANSPOSEMATRIXFPROC glad_glLoadTransposeMatrixf = NULL; +PFNGLLOGICOPPROC glad_glLogicOp = NULL; +PFNGLMAP1DPROC glad_glMap1d = NULL; +PFNGLMAP1FPROC glad_glMap1f = NULL; +PFNGLMAP2DPROC glad_glMap2d = NULL; +PFNGLMAP2FPROC glad_glMap2f = NULL; +PFNGLMAPBUFFERPROC glad_glMapBuffer = NULL; +PFNGLMAPBUFFERRANGEPROC glad_glMapBufferRange = NULL; +PFNGLMAPGRID1DPROC glad_glMapGrid1d = NULL; +PFNGLMAPGRID1FPROC glad_glMapGrid1f = NULL; +PFNGLMAPGRID2DPROC glad_glMapGrid2d = NULL; +PFNGLMAPGRID2FPROC glad_glMapGrid2f = NULL; +PFNGLMATERIALFPROC glad_glMaterialf = NULL; +PFNGLMATERIALFVPROC glad_glMaterialfv = NULL; +PFNGLMATERIALIPROC glad_glMateriali = NULL; +PFNGLMATERIALIVPROC glad_glMaterialiv = NULL; +PFNGLMATRIXMODEPROC glad_glMatrixMode = NULL; +PFNGLMULTMATRIXDPROC glad_glMultMatrixd = NULL; +PFNGLMULTMATRIXFPROC glad_glMultMatrixf = NULL; +PFNGLMULTTRANSPOSEMATRIXDPROC glad_glMultTransposeMatrixd = NULL; +PFNGLMULTTRANSPOSEMATRIXFPROC glad_glMultTransposeMatrixf = NULL; +PFNGLMULTIDRAWARRAYSPROC glad_glMultiDrawArrays = NULL; +PFNGLMULTIDRAWELEMENTSPROC glad_glMultiDrawElements = NULL; +PFNGLMULTIDRAWELEMENTSBASEVERTEXPROC glad_glMultiDrawElementsBaseVertex = NULL; +PFNGLMULTITEXCOORD1DPROC glad_glMultiTexCoord1d = NULL; +PFNGLMULTITEXCOORD1DVPROC glad_glMultiTexCoord1dv = NULL; +PFNGLMULTITEXCOORD1FPROC glad_glMultiTexCoord1f = NULL; +PFNGLMULTITEXCOORD1FVPROC glad_glMultiTexCoord1fv = NULL; +PFNGLMULTITEXCOORD1IPROC glad_glMultiTexCoord1i = NULL; +PFNGLMULTITEXCOORD1IVPROC glad_glMultiTexCoord1iv = NULL; +PFNGLMULTITEXCOORD1SPROC glad_glMultiTexCoord1s = NULL; +PFNGLMULTITEXCOORD1SVPROC glad_glMultiTexCoord1sv = NULL; +PFNGLMULTITEXCOORD2DPROC glad_glMultiTexCoord2d = NULL; +PFNGLMULTITEXCOORD2DVPROC glad_glMultiTexCoord2dv = NULL; +PFNGLMULTITEXCOORD2FPROC glad_glMultiTexCoord2f = NULL; +PFNGLMULTITEXCOORD2FVPROC glad_glMultiTexCoord2fv = NULL; +PFNGLMULTITEXCOORD2IPROC glad_glMultiTexCoord2i = NULL; +PFNGLMULTITEXCOORD2IVPROC glad_glMultiTexCoord2iv = NULL; +PFNGLMULTITEXCOORD2SPROC glad_glMultiTexCoord2s = NULL; +PFNGLMULTITEXCOORD2SVPROC glad_glMultiTexCoord2sv = NULL; +PFNGLMULTITEXCOORD3DPROC glad_glMultiTexCoord3d = NULL; +PFNGLMULTITEXCOORD3DVPROC glad_glMultiTexCoord3dv = NULL; +PFNGLMULTITEXCOORD3FPROC glad_glMultiTexCoord3f = NULL; +PFNGLMULTITEXCOORD3FVPROC glad_glMultiTexCoord3fv = NULL; +PFNGLMULTITEXCOORD3IPROC glad_glMultiTexCoord3i = NULL; +PFNGLMULTITEXCOORD3IVPROC glad_glMultiTexCoord3iv = NULL; +PFNGLMULTITEXCOORD3SPROC glad_glMultiTexCoord3s = NULL; +PFNGLMULTITEXCOORD3SVPROC glad_glMultiTexCoord3sv = NULL; +PFNGLMULTITEXCOORD4DPROC glad_glMultiTexCoord4d = NULL; +PFNGLMULTITEXCOORD4DVPROC glad_glMultiTexCoord4dv = NULL; +PFNGLMULTITEXCOORD4FPROC glad_glMultiTexCoord4f = NULL; +PFNGLMULTITEXCOORD4FVPROC glad_glMultiTexCoord4fv = NULL; +PFNGLMULTITEXCOORD4IPROC glad_glMultiTexCoord4i = NULL; +PFNGLMULTITEXCOORD4IVPROC glad_glMultiTexCoord4iv = NULL; +PFNGLMULTITEXCOORD4SPROC glad_glMultiTexCoord4s = NULL; +PFNGLMULTITEXCOORD4SVPROC glad_glMultiTexCoord4sv = NULL; +PFNGLMULTITEXCOORDP1UIPROC glad_glMultiTexCoordP1ui = NULL; +PFNGLMULTITEXCOORDP1UIVPROC glad_glMultiTexCoordP1uiv = NULL; +PFNGLMULTITEXCOORDP2UIPROC glad_glMultiTexCoordP2ui = NULL; +PFNGLMULTITEXCOORDP2UIVPROC glad_glMultiTexCoordP2uiv = NULL; +PFNGLMULTITEXCOORDP3UIPROC glad_glMultiTexCoordP3ui = NULL; +PFNGLMULTITEXCOORDP3UIVPROC glad_glMultiTexCoordP3uiv = NULL; +PFNGLMULTITEXCOORDP4UIPROC glad_glMultiTexCoordP4ui = NULL; +PFNGLMULTITEXCOORDP4UIVPROC glad_glMultiTexCoordP4uiv = NULL; +PFNGLNEWLISTPROC glad_glNewList = NULL; +PFNGLNORMAL3BPROC glad_glNormal3b = NULL; +PFNGLNORMAL3BVPROC glad_glNormal3bv = NULL; +PFNGLNORMAL3DPROC glad_glNormal3d = NULL; +PFNGLNORMAL3DVPROC glad_glNormal3dv = NULL; +PFNGLNORMAL3FPROC glad_glNormal3f = NULL; +PFNGLNORMAL3FVPROC glad_glNormal3fv = NULL; +PFNGLNORMAL3IPROC glad_glNormal3i = NULL; +PFNGLNORMAL3IVPROC glad_glNormal3iv = NULL; +PFNGLNORMAL3SPROC glad_glNormal3s = NULL; +PFNGLNORMAL3SVPROC glad_glNormal3sv = NULL; +PFNGLNORMALP3UIPROC glad_glNormalP3ui = NULL; +PFNGLNORMALP3UIVPROC glad_glNormalP3uiv = NULL; +PFNGLNORMALPOINTERPROC glad_glNormalPointer = NULL; +PFNGLOBJECTLABELPROC glad_glObjectLabel = NULL; +PFNGLOBJECTPTRLABELPROC glad_glObjectPtrLabel = NULL; +PFNGLORTHOPROC glad_glOrtho = NULL; +PFNGLPASSTHROUGHPROC glad_glPassThrough = NULL; +PFNGLPIXELMAPFVPROC glad_glPixelMapfv = NULL; +PFNGLPIXELMAPUIVPROC glad_glPixelMapuiv = NULL; +PFNGLPIXELMAPUSVPROC glad_glPixelMapusv = NULL; +PFNGLPIXELSTOREFPROC glad_glPixelStoref = NULL; +PFNGLPIXELSTOREIPROC glad_glPixelStorei = NULL; +PFNGLPIXELTRANSFERFPROC glad_glPixelTransferf = NULL; +PFNGLPIXELTRANSFERIPROC glad_glPixelTransferi = NULL; +PFNGLPIXELZOOMPROC glad_glPixelZoom = NULL; +PFNGLPOINTPARAMETERFPROC glad_glPointParameterf = NULL; +PFNGLPOINTPARAMETERFVPROC glad_glPointParameterfv = NULL; +PFNGLPOINTPARAMETERIPROC glad_glPointParameteri = NULL; +PFNGLPOINTPARAMETERIVPROC glad_glPointParameteriv = NULL; +PFNGLPOINTSIZEPROC glad_glPointSize = NULL; +PFNGLPOLYGONMODEPROC glad_glPolygonMode = NULL; +PFNGLPOLYGONOFFSETPROC glad_glPolygonOffset = NULL; +PFNGLPOLYGONSTIPPLEPROC glad_glPolygonStipple = NULL; +PFNGLPOPATTRIBPROC glad_glPopAttrib = NULL; +PFNGLPOPCLIENTATTRIBPROC glad_glPopClientAttrib = NULL; +PFNGLPOPDEBUGGROUPPROC glad_glPopDebugGroup = NULL; +PFNGLPOPMATRIXPROC glad_glPopMatrix = NULL; +PFNGLPOPNAMEPROC glad_glPopName = NULL; +PFNGLPRIMITIVERESTARTINDEXPROC glad_glPrimitiveRestartIndex = NULL; +PFNGLPRIORITIZETEXTURESPROC glad_glPrioritizeTextures = NULL; +PFNGLPROVOKINGVERTEXPROC glad_glProvokingVertex = NULL; +PFNGLPUSHATTRIBPROC glad_glPushAttrib = NULL; +PFNGLPUSHCLIENTATTRIBPROC glad_glPushClientAttrib = NULL; +PFNGLPUSHDEBUGGROUPPROC glad_glPushDebugGroup = NULL; +PFNGLPUSHMATRIXPROC glad_glPushMatrix = NULL; +PFNGLPUSHNAMEPROC glad_glPushName = NULL; +PFNGLQUERYCOUNTERPROC glad_glQueryCounter = NULL; +PFNGLRASTERPOS2DPROC glad_glRasterPos2d = NULL; +PFNGLRASTERPOS2DVPROC glad_glRasterPos2dv = NULL; +PFNGLRASTERPOS2FPROC glad_glRasterPos2f = NULL; +PFNGLRASTERPOS2FVPROC glad_glRasterPos2fv = NULL; +PFNGLRASTERPOS2IPROC glad_glRasterPos2i = NULL; +PFNGLRASTERPOS2IVPROC glad_glRasterPos2iv = NULL; +PFNGLRASTERPOS2SPROC glad_glRasterPos2s = NULL; +PFNGLRASTERPOS2SVPROC glad_glRasterPos2sv = NULL; +PFNGLRASTERPOS3DPROC glad_glRasterPos3d = NULL; +PFNGLRASTERPOS3DVPROC glad_glRasterPos3dv = NULL; +PFNGLRASTERPOS3FPROC glad_glRasterPos3f = NULL; +PFNGLRASTERPOS3FVPROC glad_glRasterPos3fv = NULL; +PFNGLRASTERPOS3IPROC glad_glRasterPos3i = NULL; +PFNGLRASTERPOS3IVPROC glad_glRasterPos3iv = NULL; +PFNGLRASTERPOS3SPROC glad_glRasterPos3s = NULL; +PFNGLRASTERPOS3SVPROC glad_glRasterPos3sv = NULL; +PFNGLRASTERPOS4DPROC glad_glRasterPos4d = NULL; +PFNGLRASTERPOS4DVPROC glad_glRasterPos4dv = NULL; +PFNGLRASTERPOS4FPROC glad_glRasterPos4f = NULL; +PFNGLRASTERPOS4FVPROC glad_glRasterPos4fv = NULL; +PFNGLRASTERPOS4IPROC glad_glRasterPos4i = NULL; +PFNGLRASTERPOS4IVPROC glad_glRasterPos4iv = NULL; +PFNGLRASTERPOS4SPROC glad_glRasterPos4s = NULL; +PFNGLRASTERPOS4SVPROC glad_glRasterPos4sv = NULL; +PFNGLREADBUFFERPROC glad_glReadBuffer = NULL; +PFNGLREADPIXELSPROC glad_glReadPixels = NULL; +PFNGLREADNPIXELSARBPROC glad_glReadnPixelsARB = NULL; +PFNGLRECTDPROC glad_glRectd = NULL; +PFNGLRECTDVPROC glad_glRectdv = NULL; +PFNGLRECTFPROC glad_glRectf = NULL; +PFNGLRECTFVPROC glad_glRectfv = NULL; +PFNGLRECTIPROC glad_glRecti = NULL; +PFNGLRECTIVPROC glad_glRectiv = NULL; +PFNGLRECTSPROC glad_glRects = NULL; +PFNGLRECTSVPROC glad_glRectsv = NULL; +PFNGLRENDERMODEPROC glad_glRenderMode = NULL; +PFNGLRENDERBUFFERSTORAGEPROC glad_glRenderbufferStorage = NULL; +PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC glad_glRenderbufferStorageMultisample = NULL; +PFNGLROTATEDPROC glad_glRotated = NULL; +PFNGLROTATEFPROC glad_glRotatef = NULL; +PFNGLSAMPLECOVERAGEPROC glad_glSampleCoverage = NULL; +PFNGLSAMPLECOVERAGEARBPROC glad_glSampleCoverageARB = NULL; +PFNGLSAMPLEMASKIPROC glad_glSampleMaski = NULL; +PFNGLSAMPLERPARAMETERIIVPROC glad_glSamplerParameterIiv = NULL; +PFNGLSAMPLERPARAMETERIUIVPROC glad_glSamplerParameterIuiv = NULL; +PFNGLSAMPLERPARAMETERFPROC glad_glSamplerParameterf = NULL; +PFNGLSAMPLERPARAMETERFVPROC glad_glSamplerParameterfv = NULL; +PFNGLSAMPLERPARAMETERIPROC glad_glSamplerParameteri = NULL; +PFNGLSAMPLERPARAMETERIVPROC glad_glSamplerParameteriv = NULL; +PFNGLSCALEDPROC glad_glScaled = NULL; +PFNGLSCALEFPROC glad_glScalef = NULL; +PFNGLSCISSORPROC glad_glScissor = NULL; +PFNGLSECONDARYCOLOR3BPROC glad_glSecondaryColor3b = NULL; +PFNGLSECONDARYCOLOR3BVPROC glad_glSecondaryColor3bv = NULL; +PFNGLSECONDARYCOLOR3DPROC glad_glSecondaryColor3d = NULL; +PFNGLSECONDARYCOLOR3DVPROC glad_glSecondaryColor3dv = NULL; +PFNGLSECONDARYCOLOR3FPROC glad_glSecondaryColor3f = NULL; +PFNGLSECONDARYCOLOR3FVPROC glad_glSecondaryColor3fv = NULL; +PFNGLSECONDARYCOLOR3IPROC glad_glSecondaryColor3i = NULL; +PFNGLSECONDARYCOLOR3IVPROC glad_glSecondaryColor3iv = NULL; +PFNGLSECONDARYCOLOR3SPROC glad_glSecondaryColor3s = NULL; +PFNGLSECONDARYCOLOR3SVPROC glad_glSecondaryColor3sv = NULL; +PFNGLSECONDARYCOLOR3UBPROC glad_glSecondaryColor3ub = NULL; +PFNGLSECONDARYCOLOR3UBVPROC glad_glSecondaryColor3ubv = NULL; +PFNGLSECONDARYCOLOR3UIPROC glad_glSecondaryColor3ui = NULL; +PFNGLSECONDARYCOLOR3UIVPROC glad_glSecondaryColor3uiv = NULL; +PFNGLSECONDARYCOLOR3USPROC glad_glSecondaryColor3us = NULL; +PFNGLSECONDARYCOLOR3USVPROC glad_glSecondaryColor3usv = NULL; +PFNGLSECONDARYCOLORP3UIPROC glad_glSecondaryColorP3ui = NULL; +PFNGLSECONDARYCOLORP3UIVPROC glad_glSecondaryColorP3uiv = NULL; +PFNGLSECONDARYCOLORPOINTERPROC glad_glSecondaryColorPointer = NULL; +PFNGLSELECTBUFFERPROC glad_glSelectBuffer = NULL; +PFNGLSHADEMODELPROC glad_glShadeModel = NULL; +PFNGLSHADERSOURCEPROC glad_glShaderSource = NULL; +PFNGLSTENCILFUNCPROC glad_glStencilFunc = NULL; +PFNGLSTENCILFUNCSEPARATEPROC glad_glStencilFuncSeparate = NULL; +PFNGLSTENCILMASKPROC glad_glStencilMask = NULL; +PFNGLSTENCILMASKSEPARATEPROC glad_glStencilMaskSeparate = NULL; +PFNGLSTENCILOPPROC glad_glStencilOp = NULL; +PFNGLSTENCILOPSEPARATEPROC glad_glStencilOpSeparate = NULL; +PFNGLTEXBUFFERPROC glad_glTexBuffer = NULL; +PFNGLTEXCOORD1DPROC glad_glTexCoord1d = NULL; +PFNGLTEXCOORD1DVPROC glad_glTexCoord1dv = NULL; +PFNGLTEXCOORD1FPROC glad_glTexCoord1f = NULL; +PFNGLTEXCOORD1FVPROC glad_glTexCoord1fv = NULL; +PFNGLTEXCOORD1IPROC glad_glTexCoord1i = NULL; +PFNGLTEXCOORD1IVPROC glad_glTexCoord1iv = NULL; +PFNGLTEXCOORD1SPROC glad_glTexCoord1s = NULL; +PFNGLTEXCOORD1SVPROC glad_glTexCoord1sv = NULL; +PFNGLTEXCOORD2DPROC glad_glTexCoord2d = NULL; +PFNGLTEXCOORD2DVPROC glad_glTexCoord2dv = NULL; +PFNGLTEXCOORD2FPROC glad_glTexCoord2f = NULL; +PFNGLTEXCOORD2FVPROC glad_glTexCoord2fv = NULL; +PFNGLTEXCOORD2IPROC glad_glTexCoord2i = NULL; +PFNGLTEXCOORD2IVPROC glad_glTexCoord2iv = NULL; +PFNGLTEXCOORD2SPROC glad_glTexCoord2s = NULL; +PFNGLTEXCOORD2SVPROC glad_glTexCoord2sv = NULL; +PFNGLTEXCOORD3DPROC glad_glTexCoord3d = NULL; +PFNGLTEXCOORD3DVPROC glad_glTexCoord3dv = NULL; +PFNGLTEXCOORD3FPROC glad_glTexCoord3f = NULL; +PFNGLTEXCOORD3FVPROC glad_glTexCoord3fv = NULL; +PFNGLTEXCOORD3IPROC glad_glTexCoord3i = NULL; +PFNGLTEXCOORD3IVPROC glad_glTexCoord3iv = NULL; +PFNGLTEXCOORD3SPROC glad_glTexCoord3s = NULL; +PFNGLTEXCOORD3SVPROC glad_glTexCoord3sv = NULL; +PFNGLTEXCOORD4DPROC glad_glTexCoord4d = NULL; +PFNGLTEXCOORD4DVPROC glad_glTexCoord4dv = NULL; +PFNGLTEXCOORD4FPROC glad_glTexCoord4f = NULL; +PFNGLTEXCOORD4FVPROC glad_glTexCoord4fv = NULL; +PFNGLTEXCOORD4IPROC glad_glTexCoord4i = NULL; +PFNGLTEXCOORD4IVPROC glad_glTexCoord4iv = NULL; +PFNGLTEXCOORD4SPROC glad_glTexCoord4s = NULL; +PFNGLTEXCOORD4SVPROC glad_glTexCoord4sv = NULL; +PFNGLTEXCOORDP1UIPROC glad_glTexCoordP1ui = NULL; +PFNGLTEXCOORDP1UIVPROC glad_glTexCoordP1uiv = NULL; +PFNGLTEXCOORDP2UIPROC glad_glTexCoordP2ui = NULL; +PFNGLTEXCOORDP2UIVPROC glad_glTexCoordP2uiv = NULL; +PFNGLTEXCOORDP3UIPROC glad_glTexCoordP3ui = NULL; +PFNGLTEXCOORDP3UIVPROC glad_glTexCoordP3uiv = NULL; +PFNGLTEXCOORDP4UIPROC glad_glTexCoordP4ui = NULL; +PFNGLTEXCOORDP4UIVPROC glad_glTexCoordP4uiv = NULL; +PFNGLTEXCOORDPOINTERPROC glad_glTexCoordPointer = NULL; +PFNGLTEXENVFPROC glad_glTexEnvf = NULL; +PFNGLTEXENVFVPROC glad_glTexEnvfv = NULL; +PFNGLTEXENVIPROC glad_glTexEnvi = NULL; +PFNGLTEXENVIVPROC glad_glTexEnviv = NULL; +PFNGLTEXGENDPROC glad_glTexGend = NULL; +PFNGLTEXGENDVPROC glad_glTexGendv = NULL; +PFNGLTEXGENFPROC glad_glTexGenf = NULL; +PFNGLTEXGENFVPROC glad_glTexGenfv = NULL; +PFNGLTEXGENIPROC glad_glTexGeni = NULL; +PFNGLTEXGENIVPROC glad_glTexGeniv = NULL; +PFNGLTEXIMAGE1DPROC glad_glTexImage1D = NULL; +PFNGLTEXIMAGE2DPROC glad_glTexImage2D = NULL; +PFNGLTEXIMAGE2DMULTISAMPLEPROC glad_glTexImage2DMultisample = NULL; +PFNGLTEXIMAGE3DPROC glad_glTexImage3D = NULL; +PFNGLTEXIMAGE3DMULTISAMPLEPROC glad_glTexImage3DMultisample = NULL; +PFNGLTEXPARAMETERIIVPROC glad_glTexParameterIiv = NULL; +PFNGLTEXPARAMETERIUIVPROC glad_glTexParameterIuiv = NULL; +PFNGLTEXPARAMETERFPROC glad_glTexParameterf = NULL; +PFNGLTEXPARAMETERFVPROC glad_glTexParameterfv = NULL; +PFNGLTEXPARAMETERIPROC glad_glTexParameteri = NULL; +PFNGLTEXPARAMETERIVPROC glad_glTexParameteriv = NULL; +PFNGLTEXSUBIMAGE1DPROC glad_glTexSubImage1D = NULL; +PFNGLTEXSUBIMAGE2DPROC glad_glTexSubImage2D = NULL; +PFNGLTEXSUBIMAGE3DPROC glad_glTexSubImage3D = NULL; +PFNGLTRANSFORMFEEDBACKVARYINGSPROC glad_glTransformFeedbackVaryings = NULL; +PFNGLTRANSLATEDPROC glad_glTranslated = NULL; +PFNGLTRANSLATEFPROC glad_glTranslatef = NULL; +PFNGLUNIFORM1FPROC glad_glUniform1f = NULL; +PFNGLUNIFORM1FVPROC glad_glUniform1fv = NULL; +PFNGLUNIFORM1IPROC glad_glUniform1i = NULL; +PFNGLUNIFORM1IVPROC glad_glUniform1iv = NULL; +PFNGLUNIFORM1UIPROC glad_glUniform1ui = NULL; +PFNGLUNIFORM1UIVPROC glad_glUniform1uiv = NULL; +PFNGLUNIFORM2FPROC glad_glUniform2f = NULL; +PFNGLUNIFORM2FVPROC glad_glUniform2fv = NULL; +PFNGLUNIFORM2IPROC glad_glUniform2i = NULL; +PFNGLUNIFORM2IVPROC glad_glUniform2iv = NULL; +PFNGLUNIFORM2UIPROC glad_glUniform2ui = NULL; +PFNGLUNIFORM2UIVPROC glad_glUniform2uiv = NULL; +PFNGLUNIFORM3FPROC glad_glUniform3f = NULL; +PFNGLUNIFORM3FVPROC glad_glUniform3fv = NULL; +PFNGLUNIFORM3IPROC glad_glUniform3i = NULL; +PFNGLUNIFORM3IVPROC glad_glUniform3iv = NULL; +PFNGLUNIFORM3UIPROC glad_glUniform3ui = NULL; +PFNGLUNIFORM3UIVPROC glad_glUniform3uiv = NULL; +PFNGLUNIFORM4FPROC glad_glUniform4f = NULL; +PFNGLUNIFORM4FVPROC glad_glUniform4fv = NULL; +PFNGLUNIFORM4IPROC glad_glUniform4i = NULL; +PFNGLUNIFORM4IVPROC glad_glUniform4iv = NULL; +PFNGLUNIFORM4UIPROC glad_glUniform4ui = NULL; +PFNGLUNIFORM4UIVPROC glad_glUniform4uiv = NULL; +PFNGLUNIFORMBLOCKBINDINGPROC glad_glUniformBlockBinding = NULL; +PFNGLUNIFORMMATRIX2FVPROC glad_glUniformMatrix2fv = NULL; +PFNGLUNIFORMMATRIX2X3FVPROC glad_glUniformMatrix2x3fv = NULL; +PFNGLUNIFORMMATRIX2X4FVPROC glad_glUniformMatrix2x4fv = NULL; +PFNGLUNIFORMMATRIX3FVPROC glad_glUniformMatrix3fv = NULL; +PFNGLUNIFORMMATRIX3X2FVPROC glad_glUniformMatrix3x2fv = NULL; +PFNGLUNIFORMMATRIX3X4FVPROC glad_glUniformMatrix3x4fv = NULL; +PFNGLUNIFORMMATRIX4FVPROC glad_glUniformMatrix4fv = NULL; +PFNGLUNIFORMMATRIX4X2FVPROC glad_glUniformMatrix4x2fv = NULL; +PFNGLUNIFORMMATRIX4X3FVPROC glad_glUniformMatrix4x3fv = NULL; +PFNGLUNMAPBUFFERPROC glad_glUnmapBuffer = NULL; +PFNGLUSEPROGRAMPROC glad_glUseProgram = NULL; +PFNGLVALIDATEPROGRAMPROC glad_glValidateProgram = NULL; +PFNGLVERTEX2DPROC glad_glVertex2d = NULL; +PFNGLVERTEX2DVPROC glad_glVertex2dv = NULL; +PFNGLVERTEX2FPROC glad_glVertex2f = NULL; +PFNGLVERTEX2FVPROC glad_glVertex2fv = NULL; +PFNGLVERTEX2IPROC glad_glVertex2i = NULL; +PFNGLVERTEX2IVPROC glad_glVertex2iv = NULL; +PFNGLVERTEX2SPROC glad_glVertex2s = NULL; +PFNGLVERTEX2SVPROC glad_glVertex2sv = NULL; +PFNGLVERTEX3DPROC glad_glVertex3d = NULL; +PFNGLVERTEX3DVPROC glad_glVertex3dv = NULL; +PFNGLVERTEX3FPROC glad_glVertex3f = NULL; +PFNGLVERTEX3FVPROC glad_glVertex3fv = NULL; +PFNGLVERTEX3IPROC glad_glVertex3i = NULL; +PFNGLVERTEX3IVPROC glad_glVertex3iv = NULL; +PFNGLVERTEX3SPROC glad_glVertex3s = NULL; +PFNGLVERTEX3SVPROC glad_glVertex3sv = NULL; +PFNGLVERTEX4DPROC glad_glVertex4d = NULL; +PFNGLVERTEX4DVPROC glad_glVertex4dv = NULL; +PFNGLVERTEX4FPROC glad_glVertex4f = NULL; +PFNGLVERTEX4FVPROC glad_glVertex4fv = NULL; +PFNGLVERTEX4IPROC glad_glVertex4i = NULL; +PFNGLVERTEX4IVPROC glad_glVertex4iv = NULL; +PFNGLVERTEX4SPROC glad_glVertex4s = NULL; +PFNGLVERTEX4SVPROC glad_glVertex4sv = NULL; +PFNGLVERTEXATTRIB1DPROC glad_glVertexAttrib1d = NULL; +PFNGLVERTEXATTRIB1DVPROC glad_glVertexAttrib1dv = NULL; +PFNGLVERTEXATTRIB1FPROC glad_glVertexAttrib1f = NULL; +PFNGLVERTEXATTRIB1FVPROC glad_glVertexAttrib1fv = NULL; +PFNGLVERTEXATTRIB1SPROC glad_glVertexAttrib1s = NULL; +PFNGLVERTEXATTRIB1SVPROC glad_glVertexAttrib1sv = NULL; +PFNGLVERTEXATTRIB2DPROC glad_glVertexAttrib2d = NULL; +PFNGLVERTEXATTRIB2DVPROC glad_glVertexAttrib2dv = NULL; +PFNGLVERTEXATTRIB2FPROC glad_glVertexAttrib2f = NULL; +PFNGLVERTEXATTRIB2FVPROC glad_glVertexAttrib2fv = NULL; +PFNGLVERTEXATTRIB2SPROC glad_glVertexAttrib2s = NULL; +PFNGLVERTEXATTRIB2SVPROC glad_glVertexAttrib2sv = NULL; +PFNGLVERTEXATTRIB3DPROC glad_glVertexAttrib3d = NULL; +PFNGLVERTEXATTRIB3DVPROC glad_glVertexAttrib3dv = NULL; +PFNGLVERTEXATTRIB3FPROC glad_glVertexAttrib3f = NULL; +PFNGLVERTEXATTRIB3FVPROC glad_glVertexAttrib3fv = NULL; +PFNGLVERTEXATTRIB3SPROC glad_glVertexAttrib3s = NULL; +PFNGLVERTEXATTRIB3SVPROC glad_glVertexAttrib3sv = NULL; +PFNGLVERTEXATTRIB4NBVPROC glad_glVertexAttrib4Nbv = NULL; +PFNGLVERTEXATTRIB4NIVPROC glad_glVertexAttrib4Niv = NULL; +PFNGLVERTEXATTRIB4NSVPROC glad_glVertexAttrib4Nsv = NULL; +PFNGLVERTEXATTRIB4NUBPROC glad_glVertexAttrib4Nub = NULL; +PFNGLVERTEXATTRIB4NUBVPROC glad_glVertexAttrib4Nubv = NULL; +PFNGLVERTEXATTRIB4NUIVPROC glad_glVertexAttrib4Nuiv = NULL; +PFNGLVERTEXATTRIB4NUSVPROC glad_glVertexAttrib4Nusv = NULL; +PFNGLVERTEXATTRIB4BVPROC glad_glVertexAttrib4bv = NULL; +PFNGLVERTEXATTRIB4DPROC glad_glVertexAttrib4d = NULL; +PFNGLVERTEXATTRIB4DVPROC glad_glVertexAttrib4dv = NULL; +PFNGLVERTEXATTRIB4FPROC glad_glVertexAttrib4f = NULL; +PFNGLVERTEXATTRIB4FVPROC glad_glVertexAttrib4fv = NULL; +PFNGLVERTEXATTRIB4IVPROC glad_glVertexAttrib4iv = NULL; +PFNGLVERTEXATTRIB4SPROC glad_glVertexAttrib4s = NULL; +PFNGLVERTEXATTRIB4SVPROC glad_glVertexAttrib4sv = NULL; +PFNGLVERTEXATTRIB4UBVPROC glad_glVertexAttrib4ubv = NULL; +PFNGLVERTEXATTRIB4UIVPROC glad_glVertexAttrib4uiv = NULL; +PFNGLVERTEXATTRIB4USVPROC glad_glVertexAttrib4usv = NULL; +PFNGLVERTEXATTRIBDIVISORPROC glad_glVertexAttribDivisor = NULL; +PFNGLVERTEXATTRIBI1IPROC glad_glVertexAttribI1i = NULL; +PFNGLVERTEXATTRIBI1IVPROC glad_glVertexAttribI1iv = NULL; +PFNGLVERTEXATTRIBI1UIPROC glad_glVertexAttribI1ui = NULL; +PFNGLVERTEXATTRIBI1UIVPROC glad_glVertexAttribI1uiv = NULL; +PFNGLVERTEXATTRIBI2IPROC glad_glVertexAttribI2i = NULL; +PFNGLVERTEXATTRIBI2IVPROC glad_glVertexAttribI2iv = NULL; +PFNGLVERTEXATTRIBI2UIPROC glad_glVertexAttribI2ui = NULL; +PFNGLVERTEXATTRIBI2UIVPROC glad_glVertexAttribI2uiv = NULL; +PFNGLVERTEXATTRIBI3IPROC glad_glVertexAttribI3i = NULL; +PFNGLVERTEXATTRIBI3IVPROC glad_glVertexAttribI3iv = NULL; +PFNGLVERTEXATTRIBI3UIPROC glad_glVertexAttribI3ui = NULL; +PFNGLVERTEXATTRIBI3UIVPROC glad_glVertexAttribI3uiv = NULL; +PFNGLVERTEXATTRIBI4BVPROC glad_glVertexAttribI4bv = NULL; +PFNGLVERTEXATTRIBI4IPROC glad_glVertexAttribI4i = NULL; +PFNGLVERTEXATTRIBI4IVPROC glad_glVertexAttribI4iv = NULL; +PFNGLVERTEXATTRIBI4SVPROC glad_glVertexAttribI4sv = NULL; +PFNGLVERTEXATTRIBI4UBVPROC glad_glVertexAttribI4ubv = NULL; +PFNGLVERTEXATTRIBI4UIPROC glad_glVertexAttribI4ui = NULL; +PFNGLVERTEXATTRIBI4UIVPROC glad_glVertexAttribI4uiv = NULL; +PFNGLVERTEXATTRIBI4USVPROC glad_glVertexAttribI4usv = NULL; +PFNGLVERTEXATTRIBIPOINTERPROC glad_glVertexAttribIPointer = NULL; +PFNGLVERTEXATTRIBP1UIPROC glad_glVertexAttribP1ui = NULL; +PFNGLVERTEXATTRIBP1UIVPROC glad_glVertexAttribP1uiv = NULL; +PFNGLVERTEXATTRIBP2UIPROC glad_glVertexAttribP2ui = NULL; +PFNGLVERTEXATTRIBP2UIVPROC glad_glVertexAttribP2uiv = NULL; +PFNGLVERTEXATTRIBP3UIPROC glad_glVertexAttribP3ui = NULL; +PFNGLVERTEXATTRIBP3UIVPROC glad_glVertexAttribP3uiv = NULL; +PFNGLVERTEXATTRIBP4UIPROC glad_glVertexAttribP4ui = NULL; +PFNGLVERTEXATTRIBP4UIVPROC glad_glVertexAttribP4uiv = NULL; +PFNGLVERTEXATTRIBPOINTERPROC glad_glVertexAttribPointer = NULL; +PFNGLVERTEXP2UIPROC glad_glVertexP2ui = NULL; +PFNGLVERTEXP2UIVPROC glad_glVertexP2uiv = NULL; +PFNGLVERTEXP3UIPROC glad_glVertexP3ui = NULL; +PFNGLVERTEXP3UIVPROC glad_glVertexP3uiv = NULL; +PFNGLVERTEXP4UIPROC glad_glVertexP4ui = NULL; +PFNGLVERTEXP4UIVPROC glad_glVertexP4uiv = NULL; +PFNGLVERTEXPOINTERPROC glad_glVertexPointer = NULL; +PFNGLVIEWPORTPROC glad_glViewport = NULL; +PFNGLWAITSYNCPROC glad_glWaitSync = NULL; +PFNGLWINDOWPOS2DPROC glad_glWindowPos2d = NULL; +PFNGLWINDOWPOS2DVPROC glad_glWindowPos2dv = NULL; +PFNGLWINDOWPOS2FPROC glad_glWindowPos2f = NULL; +PFNGLWINDOWPOS2FVPROC glad_glWindowPos2fv = NULL; +PFNGLWINDOWPOS2IPROC glad_glWindowPos2i = NULL; +PFNGLWINDOWPOS2IVPROC glad_glWindowPos2iv = NULL; +PFNGLWINDOWPOS2SPROC glad_glWindowPos2s = NULL; +PFNGLWINDOWPOS2SVPROC glad_glWindowPos2sv = NULL; +PFNGLWINDOWPOS3DPROC glad_glWindowPos3d = NULL; +PFNGLWINDOWPOS3DVPROC glad_glWindowPos3dv = NULL; +PFNGLWINDOWPOS3FPROC glad_glWindowPos3f = NULL; +PFNGLWINDOWPOS3FVPROC glad_glWindowPos3fv = NULL; +PFNGLWINDOWPOS3IPROC glad_glWindowPos3i = NULL; +PFNGLWINDOWPOS3IVPROC glad_glWindowPos3iv = NULL; +PFNGLWINDOWPOS3SPROC glad_glWindowPos3s = NULL; +PFNGLWINDOWPOS3SVPROC glad_glWindowPos3sv = NULL; + + +static void glad_gl_load_GL_VERSION_1_0( GLADuserptrloadfunc load, void* userptr) { + if(!GLAD_GL_VERSION_1_0) return; + glad_glAccum = (PFNGLACCUMPROC) load(userptr, "glAccum"); + glad_glAlphaFunc = (PFNGLALPHAFUNCPROC) load(userptr, "glAlphaFunc"); + glad_glBegin = (PFNGLBEGINPROC) load(userptr, "glBegin"); + glad_glBitmap = (PFNGLBITMAPPROC) load(userptr, "glBitmap"); + glad_glBlendFunc = (PFNGLBLENDFUNCPROC) load(userptr, "glBlendFunc"); + glad_glCallList = (PFNGLCALLLISTPROC) load(userptr, "glCallList"); + glad_glCallLists = (PFNGLCALLLISTSPROC) load(userptr, "glCallLists"); + glad_glClear = (PFNGLCLEARPROC) load(userptr, "glClear"); + glad_glClearAccum = (PFNGLCLEARACCUMPROC) load(userptr, "glClearAccum"); + glad_glClearColor = (PFNGLCLEARCOLORPROC) load(userptr, "glClearColor"); + glad_glClearDepth = (PFNGLCLEARDEPTHPROC) load(userptr, "glClearDepth"); + glad_glClearIndex = (PFNGLCLEARINDEXPROC) load(userptr, "glClearIndex"); + glad_glClearStencil = (PFNGLCLEARSTENCILPROC) load(userptr, "glClearStencil"); + glad_glClipPlane = (PFNGLCLIPPLANEPROC) load(userptr, "glClipPlane"); + glad_glColor3b = (PFNGLCOLOR3BPROC) load(userptr, "glColor3b"); + glad_glColor3bv = (PFNGLCOLOR3BVPROC) load(userptr, "glColor3bv"); + glad_glColor3d = (PFNGLCOLOR3DPROC) load(userptr, "glColor3d"); + glad_glColor3dv = (PFNGLCOLOR3DVPROC) load(userptr, "glColor3dv"); + glad_glColor3f = (PFNGLCOLOR3FPROC) load(userptr, "glColor3f"); + glad_glColor3fv = (PFNGLCOLOR3FVPROC) load(userptr, "glColor3fv"); + glad_glColor3i = (PFNGLCOLOR3IPROC) load(userptr, "glColor3i"); + glad_glColor3iv = (PFNGLCOLOR3IVPROC) load(userptr, "glColor3iv"); + glad_glColor3s = (PFNGLCOLOR3SPROC) load(userptr, "glColor3s"); + glad_glColor3sv = (PFNGLCOLOR3SVPROC) load(userptr, "glColor3sv"); + glad_glColor3ub = (PFNGLCOLOR3UBPROC) load(userptr, "glColor3ub"); + glad_glColor3ubv = (PFNGLCOLOR3UBVPROC) load(userptr, "glColor3ubv"); + glad_glColor3ui = (PFNGLCOLOR3UIPROC) load(userptr, "glColor3ui"); + glad_glColor3uiv = (PFNGLCOLOR3UIVPROC) load(userptr, "glColor3uiv"); + glad_glColor3us = (PFNGLCOLOR3USPROC) load(userptr, "glColor3us"); + glad_glColor3usv = (PFNGLCOLOR3USVPROC) load(userptr, "glColor3usv"); + glad_glColor4b = (PFNGLCOLOR4BPROC) load(userptr, "glColor4b"); + glad_glColor4bv = (PFNGLCOLOR4BVPROC) load(userptr, "glColor4bv"); + glad_glColor4d = (PFNGLCOLOR4DPROC) load(userptr, "glColor4d"); + glad_glColor4dv = (PFNGLCOLOR4DVPROC) load(userptr, "glColor4dv"); + glad_glColor4f = (PFNGLCOLOR4FPROC) load(userptr, "glColor4f"); + glad_glColor4fv = (PFNGLCOLOR4FVPROC) load(userptr, "glColor4fv"); + glad_glColor4i = (PFNGLCOLOR4IPROC) load(userptr, "glColor4i"); + glad_glColor4iv = (PFNGLCOLOR4IVPROC) load(userptr, "glColor4iv"); + glad_glColor4s = (PFNGLCOLOR4SPROC) load(userptr, "glColor4s"); + glad_glColor4sv = (PFNGLCOLOR4SVPROC) load(userptr, "glColor4sv"); + glad_glColor4ub = (PFNGLCOLOR4UBPROC) load(userptr, "glColor4ub"); + glad_glColor4ubv = (PFNGLCOLOR4UBVPROC) load(userptr, "glColor4ubv"); + glad_glColor4ui = (PFNGLCOLOR4UIPROC) load(userptr, "glColor4ui"); + glad_glColor4uiv = (PFNGLCOLOR4UIVPROC) load(userptr, "glColor4uiv"); + glad_glColor4us = (PFNGLCOLOR4USPROC) load(userptr, "glColor4us"); + glad_glColor4usv = (PFNGLCOLOR4USVPROC) load(userptr, "glColor4usv"); + glad_glColorMask = (PFNGLCOLORMASKPROC) load(userptr, "glColorMask"); + glad_glColorMaterial = (PFNGLCOLORMATERIALPROC) load(userptr, "glColorMaterial"); + glad_glCopyPixels = (PFNGLCOPYPIXELSPROC) load(userptr, "glCopyPixels"); + glad_glCullFace = (PFNGLCULLFACEPROC) load(userptr, "glCullFace"); + glad_glDeleteLists = (PFNGLDELETELISTSPROC) load(userptr, "glDeleteLists"); + glad_glDepthFunc = (PFNGLDEPTHFUNCPROC) load(userptr, "glDepthFunc"); + glad_glDepthMask = (PFNGLDEPTHMASKPROC) load(userptr, "glDepthMask"); + glad_glDepthRange = (PFNGLDEPTHRANGEPROC) load(userptr, "glDepthRange"); + glad_glDisable = (PFNGLDISABLEPROC) load(userptr, "glDisable"); + glad_glDrawBuffer = (PFNGLDRAWBUFFERPROC) load(userptr, "glDrawBuffer"); + glad_glDrawPixels = (PFNGLDRAWPIXELSPROC) load(userptr, "glDrawPixels"); + glad_glEdgeFlag = (PFNGLEDGEFLAGPROC) load(userptr, "glEdgeFlag"); + glad_glEdgeFlagv = (PFNGLEDGEFLAGVPROC) load(userptr, "glEdgeFlagv"); + glad_glEnable = (PFNGLENABLEPROC) load(userptr, "glEnable"); + glad_glEnd = (PFNGLENDPROC) load(userptr, "glEnd"); + glad_glEndList = (PFNGLENDLISTPROC) load(userptr, "glEndList"); + glad_glEvalCoord1d = (PFNGLEVALCOORD1DPROC) load(userptr, "glEvalCoord1d"); + glad_glEvalCoord1dv = (PFNGLEVALCOORD1DVPROC) load(userptr, "glEvalCoord1dv"); + glad_glEvalCoord1f = (PFNGLEVALCOORD1FPROC) load(userptr, "glEvalCoord1f"); + glad_glEvalCoord1fv = (PFNGLEVALCOORD1FVPROC) load(userptr, "glEvalCoord1fv"); + glad_glEvalCoord2d = (PFNGLEVALCOORD2DPROC) load(userptr, "glEvalCoord2d"); + glad_glEvalCoord2dv = (PFNGLEVALCOORD2DVPROC) load(userptr, "glEvalCoord2dv"); + glad_glEvalCoord2f = (PFNGLEVALCOORD2FPROC) load(userptr, "glEvalCoord2f"); + glad_glEvalCoord2fv = (PFNGLEVALCOORD2FVPROC) load(userptr, "glEvalCoord2fv"); + glad_glEvalMesh1 = (PFNGLEVALMESH1PROC) load(userptr, "glEvalMesh1"); + glad_glEvalMesh2 = (PFNGLEVALMESH2PROC) load(userptr, "glEvalMesh2"); + glad_glEvalPoint1 = (PFNGLEVALPOINT1PROC) load(userptr, "glEvalPoint1"); + glad_glEvalPoint2 = (PFNGLEVALPOINT2PROC) load(userptr, "glEvalPoint2"); + glad_glFeedbackBuffer = (PFNGLFEEDBACKBUFFERPROC) load(userptr, "glFeedbackBuffer"); + glad_glFinish = (PFNGLFINISHPROC) load(userptr, "glFinish"); + glad_glFlush = (PFNGLFLUSHPROC) load(userptr, "glFlush"); + glad_glFogf = (PFNGLFOGFPROC) load(userptr, "glFogf"); + glad_glFogfv = (PFNGLFOGFVPROC) load(userptr, "glFogfv"); + glad_glFogi = (PFNGLFOGIPROC) load(userptr, "glFogi"); + glad_glFogiv = (PFNGLFOGIVPROC) load(userptr, "glFogiv"); + glad_glFrontFace = (PFNGLFRONTFACEPROC) load(userptr, "glFrontFace"); + glad_glFrustum = (PFNGLFRUSTUMPROC) load(userptr, "glFrustum"); + glad_glGenLists = (PFNGLGENLISTSPROC) load(userptr, "glGenLists"); + glad_glGetBooleanv = (PFNGLGETBOOLEANVPROC) load(userptr, "glGetBooleanv"); + glad_glGetClipPlane = (PFNGLGETCLIPPLANEPROC) load(userptr, "glGetClipPlane"); + glad_glGetDoublev = (PFNGLGETDOUBLEVPROC) load(userptr, "glGetDoublev"); + glad_glGetError = (PFNGLGETERRORPROC) load(userptr, "glGetError"); + glad_glGetFloatv = (PFNGLGETFLOATVPROC) load(userptr, "glGetFloatv"); + glad_glGetIntegerv = (PFNGLGETINTEGERVPROC) load(userptr, "glGetIntegerv"); + glad_glGetLightfv = (PFNGLGETLIGHTFVPROC) load(userptr, "glGetLightfv"); + glad_glGetLightiv = (PFNGLGETLIGHTIVPROC) load(userptr, "glGetLightiv"); + glad_glGetMapdv = (PFNGLGETMAPDVPROC) load(userptr, "glGetMapdv"); + glad_glGetMapfv = (PFNGLGETMAPFVPROC) load(userptr, "glGetMapfv"); + glad_glGetMapiv = (PFNGLGETMAPIVPROC) load(userptr, "glGetMapiv"); + glad_glGetMaterialfv = (PFNGLGETMATERIALFVPROC) load(userptr, "glGetMaterialfv"); + glad_glGetMaterialiv = (PFNGLGETMATERIALIVPROC) load(userptr, "glGetMaterialiv"); + glad_glGetPixelMapfv = (PFNGLGETPIXELMAPFVPROC) load(userptr, "glGetPixelMapfv"); + glad_glGetPixelMapuiv = (PFNGLGETPIXELMAPUIVPROC) load(userptr, "glGetPixelMapuiv"); + glad_glGetPixelMapusv = (PFNGLGETPIXELMAPUSVPROC) load(userptr, "glGetPixelMapusv"); + glad_glGetPolygonStipple = (PFNGLGETPOLYGONSTIPPLEPROC) load(userptr, "glGetPolygonStipple"); + glad_glGetString = (PFNGLGETSTRINGPROC) load(userptr, "glGetString"); + glad_glGetTexEnvfv = (PFNGLGETTEXENVFVPROC) load(userptr, "glGetTexEnvfv"); + glad_glGetTexEnviv = (PFNGLGETTEXENVIVPROC) load(userptr, "glGetTexEnviv"); + glad_glGetTexGendv = (PFNGLGETTEXGENDVPROC) load(userptr, "glGetTexGendv"); + glad_glGetTexGenfv = (PFNGLGETTEXGENFVPROC) load(userptr, "glGetTexGenfv"); + glad_glGetTexGeniv = (PFNGLGETTEXGENIVPROC) load(userptr, "glGetTexGeniv"); + glad_glGetTexImage = (PFNGLGETTEXIMAGEPROC) load(userptr, "glGetTexImage"); + glad_glGetTexLevelParameterfv = (PFNGLGETTEXLEVELPARAMETERFVPROC) load(userptr, "glGetTexLevelParameterfv"); + glad_glGetTexLevelParameteriv = (PFNGLGETTEXLEVELPARAMETERIVPROC) load(userptr, "glGetTexLevelParameteriv"); + glad_glGetTexParameterfv = (PFNGLGETTEXPARAMETERFVPROC) load(userptr, "glGetTexParameterfv"); + glad_glGetTexParameteriv = (PFNGLGETTEXPARAMETERIVPROC) load(userptr, "glGetTexParameteriv"); + glad_glHint = (PFNGLHINTPROC) load(userptr, "glHint"); + glad_glIndexMask = (PFNGLINDEXMASKPROC) load(userptr, "glIndexMask"); + glad_glIndexd = (PFNGLINDEXDPROC) load(userptr, "glIndexd"); + glad_glIndexdv = (PFNGLINDEXDVPROC) load(userptr, "glIndexdv"); + glad_glIndexf = (PFNGLINDEXFPROC) load(userptr, "glIndexf"); + glad_glIndexfv = (PFNGLINDEXFVPROC) load(userptr, "glIndexfv"); + glad_glIndexi = (PFNGLINDEXIPROC) load(userptr, "glIndexi"); + glad_glIndexiv = (PFNGLINDEXIVPROC) load(userptr, "glIndexiv"); + glad_glIndexs = (PFNGLINDEXSPROC) load(userptr, "glIndexs"); + glad_glIndexsv = (PFNGLINDEXSVPROC) load(userptr, "glIndexsv"); + glad_glInitNames = (PFNGLINITNAMESPROC) load(userptr, "glInitNames"); + glad_glIsEnabled = (PFNGLISENABLEDPROC) load(userptr, "glIsEnabled"); + glad_glIsList = (PFNGLISLISTPROC) load(userptr, "glIsList"); + glad_glLightModelf = (PFNGLLIGHTMODELFPROC) load(userptr, "glLightModelf"); + glad_glLightModelfv = (PFNGLLIGHTMODELFVPROC) load(userptr, "glLightModelfv"); + glad_glLightModeli = (PFNGLLIGHTMODELIPROC) load(userptr, "glLightModeli"); + glad_glLightModeliv = (PFNGLLIGHTMODELIVPROC) load(userptr, "glLightModeliv"); + glad_glLightf = (PFNGLLIGHTFPROC) load(userptr, "glLightf"); + glad_glLightfv = (PFNGLLIGHTFVPROC) load(userptr, "glLightfv"); + glad_glLighti = (PFNGLLIGHTIPROC) load(userptr, "glLighti"); + glad_glLightiv = (PFNGLLIGHTIVPROC) load(userptr, "glLightiv"); + glad_glLineStipple = (PFNGLLINESTIPPLEPROC) load(userptr, "glLineStipple"); + glad_glLineWidth = (PFNGLLINEWIDTHPROC) load(userptr, "glLineWidth"); + glad_glListBase = (PFNGLLISTBASEPROC) load(userptr, "glListBase"); + glad_glLoadIdentity = (PFNGLLOADIDENTITYPROC) load(userptr, "glLoadIdentity"); + glad_glLoadMatrixd = (PFNGLLOADMATRIXDPROC) load(userptr, "glLoadMatrixd"); + glad_glLoadMatrixf = (PFNGLLOADMATRIXFPROC) load(userptr, "glLoadMatrixf"); + glad_glLoadName = (PFNGLLOADNAMEPROC) load(userptr, "glLoadName"); + glad_glLogicOp = (PFNGLLOGICOPPROC) load(userptr, "glLogicOp"); + glad_glMap1d = (PFNGLMAP1DPROC) load(userptr, "glMap1d"); + glad_glMap1f = (PFNGLMAP1FPROC) load(userptr, "glMap1f"); + glad_glMap2d = (PFNGLMAP2DPROC) load(userptr, "glMap2d"); + glad_glMap2f = (PFNGLMAP2FPROC) load(userptr, "glMap2f"); + glad_glMapGrid1d = (PFNGLMAPGRID1DPROC) load(userptr, "glMapGrid1d"); + glad_glMapGrid1f = (PFNGLMAPGRID1FPROC) load(userptr, "glMapGrid1f"); + glad_glMapGrid2d = (PFNGLMAPGRID2DPROC) load(userptr, "glMapGrid2d"); + glad_glMapGrid2f = (PFNGLMAPGRID2FPROC) load(userptr, "glMapGrid2f"); + glad_glMaterialf = (PFNGLMATERIALFPROC) load(userptr, "glMaterialf"); + glad_glMaterialfv = (PFNGLMATERIALFVPROC) load(userptr, "glMaterialfv"); + glad_glMateriali = (PFNGLMATERIALIPROC) load(userptr, "glMateriali"); + glad_glMaterialiv = (PFNGLMATERIALIVPROC) load(userptr, "glMaterialiv"); + glad_glMatrixMode = (PFNGLMATRIXMODEPROC) load(userptr, "glMatrixMode"); + glad_glMultMatrixd = (PFNGLMULTMATRIXDPROC) load(userptr, "glMultMatrixd"); + glad_glMultMatrixf = (PFNGLMULTMATRIXFPROC) load(userptr, "glMultMatrixf"); + glad_glNewList = (PFNGLNEWLISTPROC) load(userptr, "glNewList"); + glad_glNormal3b = (PFNGLNORMAL3BPROC) load(userptr, "glNormal3b"); + glad_glNormal3bv = (PFNGLNORMAL3BVPROC) load(userptr, "glNormal3bv"); + glad_glNormal3d = (PFNGLNORMAL3DPROC) load(userptr, "glNormal3d"); + glad_glNormal3dv = (PFNGLNORMAL3DVPROC) load(userptr, "glNormal3dv"); + glad_glNormal3f = (PFNGLNORMAL3FPROC) load(userptr, "glNormal3f"); + glad_glNormal3fv = (PFNGLNORMAL3FVPROC) load(userptr, "glNormal3fv"); + glad_glNormal3i = (PFNGLNORMAL3IPROC) load(userptr, "glNormal3i"); + glad_glNormal3iv = (PFNGLNORMAL3IVPROC) load(userptr, "glNormal3iv"); + glad_glNormal3s = (PFNGLNORMAL3SPROC) load(userptr, "glNormal3s"); + glad_glNormal3sv = (PFNGLNORMAL3SVPROC) load(userptr, "glNormal3sv"); + glad_glOrtho = (PFNGLORTHOPROC) load(userptr, "glOrtho"); + glad_glPassThrough = (PFNGLPASSTHROUGHPROC) load(userptr, "glPassThrough"); + glad_glPixelMapfv = (PFNGLPIXELMAPFVPROC) load(userptr, "glPixelMapfv"); + glad_glPixelMapuiv = (PFNGLPIXELMAPUIVPROC) load(userptr, "glPixelMapuiv"); + glad_glPixelMapusv = (PFNGLPIXELMAPUSVPROC) load(userptr, "glPixelMapusv"); + glad_glPixelStoref = (PFNGLPIXELSTOREFPROC) load(userptr, "glPixelStoref"); + glad_glPixelStorei = (PFNGLPIXELSTOREIPROC) load(userptr, "glPixelStorei"); + glad_glPixelTransferf = (PFNGLPIXELTRANSFERFPROC) load(userptr, "glPixelTransferf"); + glad_glPixelTransferi = (PFNGLPIXELTRANSFERIPROC) load(userptr, "glPixelTransferi"); + glad_glPixelZoom = (PFNGLPIXELZOOMPROC) load(userptr, "glPixelZoom"); + glad_glPointSize = (PFNGLPOINTSIZEPROC) load(userptr, "glPointSize"); + glad_glPolygonMode = (PFNGLPOLYGONMODEPROC) load(userptr, "glPolygonMode"); + glad_glPolygonStipple = (PFNGLPOLYGONSTIPPLEPROC) load(userptr, "glPolygonStipple"); + glad_glPopAttrib = (PFNGLPOPATTRIBPROC) load(userptr, "glPopAttrib"); + glad_glPopMatrix = (PFNGLPOPMATRIXPROC) load(userptr, "glPopMatrix"); + glad_glPopName = (PFNGLPOPNAMEPROC) load(userptr, "glPopName"); + glad_glPushAttrib = (PFNGLPUSHATTRIBPROC) load(userptr, "glPushAttrib"); + glad_glPushMatrix = (PFNGLPUSHMATRIXPROC) load(userptr, "glPushMatrix"); + glad_glPushName = (PFNGLPUSHNAMEPROC) load(userptr, "glPushName"); + glad_glRasterPos2d = (PFNGLRASTERPOS2DPROC) load(userptr, "glRasterPos2d"); + glad_glRasterPos2dv = (PFNGLRASTERPOS2DVPROC) load(userptr, "glRasterPos2dv"); + glad_glRasterPos2f = (PFNGLRASTERPOS2FPROC) load(userptr, "glRasterPos2f"); + glad_glRasterPos2fv = (PFNGLRASTERPOS2FVPROC) load(userptr, "glRasterPos2fv"); + glad_glRasterPos2i = (PFNGLRASTERPOS2IPROC) load(userptr, "glRasterPos2i"); + glad_glRasterPos2iv = (PFNGLRASTERPOS2IVPROC) load(userptr, "glRasterPos2iv"); + glad_glRasterPos2s = (PFNGLRASTERPOS2SPROC) load(userptr, "glRasterPos2s"); + glad_glRasterPos2sv = (PFNGLRASTERPOS2SVPROC) load(userptr, "glRasterPos2sv"); + glad_glRasterPos3d = (PFNGLRASTERPOS3DPROC) load(userptr, "glRasterPos3d"); + glad_glRasterPos3dv = (PFNGLRASTERPOS3DVPROC) load(userptr, "glRasterPos3dv"); + glad_glRasterPos3f = (PFNGLRASTERPOS3FPROC) load(userptr, "glRasterPos3f"); + glad_glRasterPos3fv = (PFNGLRASTERPOS3FVPROC) load(userptr, "glRasterPos3fv"); + glad_glRasterPos3i = (PFNGLRASTERPOS3IPROC) load(userptr, "glRasterPos3i"); + glad_glRasterPos3iv = (PFNGLRASTERPOS3IVPROC) load(userptr, "glRasterPos3iv"); + glad_glRasterPos3s = (PFNGLRASTERPOS3SPROC) load(userptr, "glRasterPos3s"); + glad_glRasterPos3sv = (PFNGLRASTERPOS3SVPROC) load(userptr, "glRasterPos3sv"); + glad_glRasterPos4d = (PFNGLRASTERPOS4DPROC) load(userptr, "glRasterPos4d"); + glad_glRasterPos4dv = (PFNGLRASTERPOS4DVPROC) load(userptr, "glRasterPos4dv"); + glad_glRasterPos4f = (PFNGLRASTERPOS4FPROC) load(userptr, "glRasterPos4f"); + glad_glRasterPos4fv = (PFNGLRASTERPOS4FVPROC) load(userptr, "glRasterPos4fv"); + glad_glRasterPos4i = (PFNGLRASTERPOS4IPROC) load(userptr, "glRasterPos4i"); + glad_glRasterPos4iv = (PFNGLRASTERPOS4IVPROC) load(userptr, "glRasterPos4iv"); + glad_glRasterPos4s = (PFNGLRASTERPOS4SPROC) load(userptr, "glRasterPos4s"); + glad_glRasterPos4sv = (PFNGLRASTERPOS4SVPROC) load(userptr, "glRasterPos4sv"); + glad_glReadBuffer = (PFNGLREADBUFFERPROC) load(userptr, "glReadBuffer"); + glad_glReadPixels = (PFNGLREADPIXELSPROC) load(userptr, "glReadPixels"); + glad_glRectd = (PFNGLRECTDPROC) load(userptr, "glRectd"); + glad_glRectdv = (PFNGLRECTDVPROC) load(userptr, "glRectdv"); + glad_glRectf = (PFNGLRECTFPROC) load(userptr, "glRectf"); + glad_glRectfv = (PFNGLRECTFVPROC) load(userptr, "glRectfv"); + glad_glRecti = (PFNGLRECTIPROC) load(userptr, "glRecti"); + glad_glRectiv = (PFNGLRECTIVPROC) load(userptr, "glRectiv"); + glad_glRects = (PFNGLRECTSPROC) load(userptr, "glRects"); + glad_glRectsv = (PFNGLRECTSVPROC) load(userptr, "glRectsv"); + glad_glRenderMode = (PFNGLRENDERMODEPROC) load(userptr, "glRenderMode"); + glad_glRotated = (PFNGLROTATEDPROC) load(userptr, "glRotated"); + glad_glRotatef = (PFNGLROTATEFPROC) load(userptr, "glRotatef"); + glad_glScaled = (PFNGLSCALEDPROC) load(userptr, "glScaled"); + glad_glScalef = (PFNGLSCALEFPROC) load(userptr, "glScalef"); + glad_glScissor = (PFNGLSCISSORPROC) load(userptr, "glScissor"); + glad_glSelectBuffer = (PFNGLSELECTBUFFERPROC) load(userptr, "glSelectBuffer"); + glad_glShadeModel = (PFNGLSHADEMODELPROC) load(userptr, "glShadeModel"); + glad_glStencilFunc = (PFNGLSTENCILFUNCPROC) load(userptr, "glStencilFunc"); + glad_glStencilMask = (PFNGLSTENCILMASKPROC) load(userptr, "glStencilMask"); + glad_glStencilOp = (PFNGLSTENCILOPPROC) load(userptr, "glStencilOp"); + glad_glTexCoord1d = (PFNGLTEXCOORD1DPROC) load(userptr, "glTexCoord1d"); + glad_glTexCoord1dv = (PFNGLTEXCOORD1DVPROC) load(userptr, "glTexCoord1dv"); + glad_glTexCoord1f = (PFNGLTEXCOORD1FPROC) load(userptr, "glTexCoord1f"); + glad_glTexCoord1fv = (PFNGLTEXCOORD1FVPROC) load(userptr, "glTexCoord1fv"); + glad_glTexCoord1i = (PFNGLTEXCOORD1IPROC) load(userptr, "glTexCoord1i"); + glad_glTexCoord1iv = (PFNGLTEXCOORD1IVPROC) load(userptr, "glTexCoord1iv"); + glad_glTexCoord1s = (PFNGLTEXCOORD1SPROC) load(userptr, "glTexCoord1s"); + glad_glTexCoord1sv = (PFNGLTEXCOORD1SVPROC) load(userptr, "glTexCoord1sv"); + glad_glTexCoord2d = (PFNGLTEXCOORD2DPROC) load(userptr, "glTexCoord2d"); + glad_glTexCoord2dv = (PFNGLTEXCOORD2DVPROC) load(userptr, "glTexCoord2dv"); + glad_glTexCoord2f = (PFNGLTEXCOORD2FPROC) load(userptr, "glTexCoord2f"); + glad_glTexCoord2fv = (PFNGLTEXCOORD2FVPROC) load(userptr, "glTexCoord2fv"); + glad_glTexCoord2i = (PFNGLTEXCOORD2IPROC) load(userptr, "glTexCoord2i"); + glad_glTexCoord2iv = (PFNGLTEXCOORD2IVPROC) load(userptr, "glTexCoord2iv"); + glad_glTexCoord2s = (PFNGLTEXCOORD2SPROC) load(userptr, "glTexCoord2s"); + glad_glTexCoord2sv = (PFNGLTEXCOORD2SVPROC) load(userptr, "glTexCoord2sv"); + glad_glTexCoord3d = (PFNGLTEXCOORD3DPROC) load(userptr, "glTexCoord3d"); + glad_glTexCoord3dv = (PFNGLTEXCOORD3DVPROC) load(userptr, "glTexCoord3dv"); + glad_glTexCoord3f = (PFNGLTEXCOORD3FPROC) load(userptr, "glTexCoord3f"); + glad_glTexCoord3fv = (PFNGLTEXCOORD3FVPROC) load(userptr, "glTexCoord3fv"); + glad_glTexCoord3i = (PFNGLTEXCOORD3IPROC) load(userptr, "glTexCoord3i"); + glad_glTexCoord3iv = (PFNGLTEXCOORD3IVPROC) load(userptr, "glTexCoord3iv"); + glad_glTexCoord3s = (PFNGLTEXCOORD3SPROC) load(userptr, "glTexCoord3s"); + glad_glTexCoord3sv = (PFNGLTEXCOORD3SVPROC) load(userptr, "glTexCoord3sv"); + glad_glTexCoord4d = (PFNGLTEXCOORD4DPROC) load(userptr, "glTexCoord4d"); + glad_glTexCoord4dv = (PFNGLTEXCOORD4DVPROC) load(userptr, "glTexCoord4dv"); + glad_glTexCoord4f = (PFNGLTEXCOORD4FPROC) load(userptr, "glTexCoord4f"); + glad_glTexCoord4fv = (PFNGLTEXCOORD4FVPROC) load(userptr, "glTexCoord4fv"); + glad_glTexCoord4i = (PFNGLTEXCOORD4IPROC) load(userptr, "glTexCoord4i"); + glad_glTexCoord4iv = (PFNGLTEXCOORD4IVPROC) load(userptr, "glTexCoord4iv"); + glad_glTexCoord4s = (PFNGLTEXCOORD4SPROC) load(userptr, "glTexCoord4s"); + glad_glTexCoord4sv = (PFNGLTEXCOORD4SVPROC) load(userptr, "glTexCoord4sv"); + glad_glTexEnvf = (PFNGLTEXENVFPROC) load(userptr, "glTexEnvf"); + glad_glTexEnvfv = (PFNGLTEXENVFVPROC) load(userptr, "glTexEnvfv"); + glad_glTexEnvi = (PFNGLTEXENVIPROC) load(userptr, "glTexEnvi"); + glad_glTexEnviv = (PFNGLTEXENVIVPROC) load(userptr, "glTexEnviv"); + glad_glTexGend = (PFNGLTEXGENDPROC) load(userptr, "glTexGend"); + glad_glTexGendv = (PFNGLTEXGENDVPROC) load(userptr, "glTexGendv"); + glad_glTexGenf = (PFNGLTEXGENFPROC) load(userptr, "glTexGenf"); + glad_glTexGenfv = (PFNGLTEXGENFVPROC) load(userptr, "glTexGenfv"); + glad_glTexGeni = (PFNGLTEXGENIPROC) load(userptr, "glTexGeni"); + glad_glTexGeniv = (PFNGLTEXGENIVPROC) load(userptr, "glTexGeniv"); + glad_glTexImage1D = (PFNGLTEXIMAGE1DPROC) load(userptr, "glTexImage1D"); + glad_glTexImage2D = (PFNGLTEXIMAGE2DPROC) load(userptr, "glTexImage2D"); + glad_glTexParameterf = (PFNGLTEXPARAMETERFPROC) load(userptr, "glTexParameterf"); + glad_glTexParameterfv = (PFNGLTEXPARAMETERFVPROC) load(userptr, "glTexParameterfv"); + glad_glTexParameteri = (PFNGLTEXPARAMETERIPROC) load(userptr, "glTexParameteri"); + glad_glTexParameteriv = (PFNGLTEXPARAMETERIVPROC) load(userptr, "glTexParameteriv"); + glad_glTranslated = (PFNGLTRANSLATEDPROC) load(userptr, "glTranslated"); + glad_glTranslatef = (PFNGLTRANSLATEFPROC) load(userptr, "glTranslatef"); + glad_glVertex2d = (PFNGLVERTEX2DPROC) load(userptr, "glVertex2d"); + glad_glVertex2dv = (PFNGLVERTEX2DVPROC) load(userptr, "glVertex2dv"); + glad_glVertex2f = (PFNGLVERTEX2FPROC) load(userptr, "glVertex2f"); + glad_glVertex2fv = (PFNGLVERTEX2FVPROC) load(userptr, "glVertex2fv"); + glad_glVertex2i = (PFNGLVERTEX2IPROC) load(userptr, "glVertex2i"); + glad_glVertex2iv = (PFNGLVERTEX2IVPROC) load(userptr, "glVertex2iv"); + glad_glVertex2s = (PFNGLVERTEX2SPROC) load(userptr, "glVertex2s"); + glad_glVertex2sv = (PFNGLVERTEX2SVPROC) load(userptr, "glVertex2sv"); + glad_glVertex3d = (PFNGLVERTEX3DPROC) load(userptr, "glVertex3d"); + glad_glVertex3dv = (PFNGLVERTEX3DVPROC) load(userptr, "glVertex3dv"); + glad_glVertex3f = (PFNGLVERTEX3FPROC) load(userptr, "glVertex3f"); + glad_glVertex3fv = (PFNGLVERTEX3FVPROC) load(userptr, "glVertex3fv"); + glad_glVertex3i = (PFNGLVERTEX3IPROC) load(userptr, "glVertex3i"); + glad_glVertex3iv = (PFNGLVERTEX3IVPROC) load(userptr, "glVertex3iv"); + glad_glVertex3s = (PFNGLVERTEX3SPROC) load(userptr, "glVertex3s"); + glad_glVertex3sv = (PFNGLVERTEX3SVPROC) load(userptr, "glVertex3sv"); + glad_glVertex4d = (PFNGLVERTEX4DPROC) load(userptr, "glVertex4d"); + glad_glVertex4dv = (PFNGLVERTEX4DVPROC) load(userptr, "glVertex4dv"); + glad_glVertex4f = (PFNGLVERTEX4FPROC) load(userptr, "glVertex4f"); + glad_glVertex4fv = (PFNGLVERTEX4FVPROC) load(userptr, "glVertex4fv"); + glad_glVertex4i = (PFNGLVERTEX4IPROC) load(userptr, "glVertex4i"); + glad_glVertex4iv = (PFNGLVERTEX4IVPROC) load(userptr, "glVertex4iv"); + glad_glVertex4s = (PFNGLVERTEX4SPROC) load(userptr, "glVertex4s"); + glad_glVertex4sv = (PFNGLVERTEX4SVPROC) load(userptr, "glVertex4sv"); + glad_glViewport = (PFNGLVIEWPORTPROC) load(userptr, "glViewport"); +} +static void glad_gl_load_GL_VERSION_1_1( GLADuserptrloadfunc load, void* userptr) { + if(!GLAD_GL_VERSION_1_1) return; + glad_glAreTexturesResident = (PFNGLARETEXTURESRESIDENTPROC) load(userptr, "glAreTexturesResident"); + glad_glArrayElement = (PFNGLARRAYELEMENTPROC) load(userptr, "glArrayElement"); + glad_glBindTexture = (PFNGLBINDTEXTUREPROC) load(userptr, "glBindTexture"); + glad_glColorPointer = (PFNGLCOLORPOINTERPROC) load(userptr, "glColorPointer"); + glad_glCopyTexImage1D = (PFNGLCOPYTEXIMAGE1DPROC) load(userptr, "glCopyTexImage1D"); + glad_glCopyTexImage2D = (PFNGLCOPYTEXIMAGE2DPROC) load(userptr, "glCopyTexImage2D"); + glad_glCopyTexSubImage1D = (PFNGLCOPYTEXSUBIMAGE1DPROC) load(userptr, "glCopyTexSubImage1D"); + glad_glCopyTexSubImage2D = (PFNGLCOPYTEXSUBIMAGE2DPROC) load(userptr, "glCopyTexSubImage2D"); + glad_glDeleteTextures = (PFNGLDELETETEXTURESPROC) load(userptr, "glDeleteTextures"); + glad_glDisableClientState = (PFNGLDISABLECLIENTSTATEPROC) load(userptr, "glDisableClientState"); + glad_glDrawArrays = (PFNGLDRAWARRAYSPROC) load(userptr, "glDrawArrays"); + glad_glDrawElements = (PFNGLDRAWELEMENTSPROC) load(userptr, "glDrawElements"); + glad_glEdgeFlagPointer = (PFNGLEDGEFLAGPOINTERPROC) load(userptr, "glEdgeFlagPointer"); + glad_glEnableClientState = (PFNGLENABLECLIENTSTATEPROC) load(userptr, "glEnableClientState"); + glad_glGenTextures = (PFNGLGENTEXTURESPROC) load(userptr, "glGenTextures"); + glad_glGetPointerv = (PFNGLGETPOINTERVPROC) load(userptr, "glGetPointerv"); + glad_glIndexPointer = (PFNGLINDEXPOINTERPROC) load(userptr, "glIndexPointer"); + glad_glIndexub = (PFNGLINDEXUBPROC) load(userptr, "glIndexub"); + glad_glIndexubv = (PFNGLINDEXUBVPROC) load(userptr, "glIndexubv"); + glad_glInterleavedArrays = (PFNGLINTERLEAVEDARRAYSPROC) load(userptr, "glInterleavedArrays"); + glad_glIsTexture = (PFNGLISTEXTUREPROC) load(userptr, "glIsTexture"); + glad_glNormalPointer = (PFNGLNORMALPOINTERPROC) load(userptr, "glNormalPointer"); + glad_glPolygonOffset = (PFNGLPOLYGONOFFSETPROC) load(userptr, "glPolygonOffset"); + glad_glPopClientAttrib = (PFNGLPOPCLIENTATTRIBPROC) load(userptr, "glPopClientAttrib"); + glad_glPrioritizeTextures = (PFNGLPRIORITIZETEXTURESPROC) load(userptr, "glPrioritizeTextures"); + glad_glPushClientAttrib = (PFNGLPUSHCLIENTATTRIBPROC) load(userptr, "glPushClientAttrib"); + glad_glTexCoordPointer = (PFNGLTEXCOORDPOINTERPROC) load(userptr, "glTexCoordPointer"); + glad_glTexSubImage1D = (PFNGLTEXSUBIMAGE1DPROC) load(userptr, "glTexSubImage1D"); + glad_glTexSubImage2D = (PFNGLTEXSUBIMAGE2DPROC) load(userptr, "glTexSubImage2D"); + glad_glVertexPointer = (PFNGLVERTEXPOINTERPROC) load(userptr, "glVertexPointer"); +} +static void glad_gl_load_GL_VERSION_1_2( GLADuserptrloadfunc load, void* userptr) { + if(!GLAD_GL_VERSION_1_2) return; + glad_glCopyTexSubImage3D = (PFNGLCOPYTEXSUBIMAGE3DPROC) load(userptr, "glCopyTexSubImage3D"); + glad_glDrawRangeElements = (PFNGLDRAWRANGEELEMENTSPROC) load(userptr, "glDrawRangeElements"); + glad_glTexImage3D = (PFNGLTEXIMAGE3DPROC) load(userptr, "glTexImage3D"); + glad_glTexSubImage3D = (PFNGLTEXSUBIMAGE3DPROC) load(userptr, "glTexSubImage3D"); +} +static void glad_gl_load_GL_VERSION_1_3( GLADuserptrloadfunc load, void* userptr) { + if(!GLAD_GL_VERSION_1_3) return; + glad_glActiveTexture = (PFNGLACTIVETEXTUREPROC) load(userptr, "glActiveTexture"); + glad_glClientActiveTexture = (PFNGLCLIENTACTIVETEXTUREPROC) load(userptr, "glClientActiveTexture"); + glad_glCompressedTexImage1D = (PFNGLCOMPRESSEDTEXIMAGE1DPROC) load(userptr, "glCompressedTexImage1D"); + glad_glCompressedTexImage2D = (PFNGLCOMPRESSEDTEXIMAGE2DPROC) load(userptr, "glCompressedTexImage2D"); + glad_glCompressedTexImage3D = (PFNGLCOMPRESSEDTEXIMAGE3DPROC) load(userptr, "glCompressedTexImage3D"); + glad_glCompressedTexSubImage1D = (PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC) load(userptr, "glCompressedTexSubImage1D"); + glad_glCompressedTexSubImage2D = (PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC) load(userptr, "glCompressedTexSubImage2D"); + glad_glCompressedTexSubImage3D = (PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC) load(userptr, "glCompressedTexSubImage3D"); + glad_glGetCompressedTexImage = (PFNGLGETCOMPRESSEDTEXIMAGEPROC) load(userptr, "glGetCompressedTexImage"); + glad_glLoadTransposeMatrixd = (PFNGLLOADTRANSPOSEMATRIXDPROC) load(userptr, "glLoadTransposeMatrixd"); + glad_glLoadTransposeMatrixf = (PFNGLLOADTRANSPOSEMATRIXFPROC) load(userptr, "glLoadTransposeMatrixf"); + glad_glMultTransposeMatrixd = (PFNGLMULTTRANSPOSEMATRIXDPROC) load(userptr, "glMultTransposeMatrixd"); + glad_glMultTransposeMatrixf = (PFNGLMULTTRANSPOSEMATRIXFPROC) load(userptr, "glMultTransposeMatrixf"); + glad_glMultiTexCoord1d = (PFNGLMULTITEXCOORD1DPROC) load(userptr, "glMultiTexCoord1d"); + glad_glMultiTexCoord1dv = (PFNGLMULTITEXCOORD1DVPROC) load(userptr, "glMultiTexCoord1dv"); + glad_glMultiTexCoord1f = (PFNGLMULTITEXCOORD1FPROC) load(userptr, "glMultiTexCoord1f"); + glad_glMultiTexCoord1fv = (PFNGLMULTITEXCOORD1FVPROC) load(userptr, "glMultiTexCoord1fv"); + glad_glMultiTexCoord1i = (PFNGLMULTITEXCOORD1IPROC) load(userptr, "glMultiTexCoord1i"); + glad_glMultiTexCoord1iv = (PFNGLMULTITEXCOORD1IVPROC) load(userptr, "glMultiTexCoord1iv"); + glad_glMultiTexCoord1s = (PFNGLMULTITEXCOORD1SPROC) load(userptr, "glMultiTexCoord1s"); + glad_glMultiTexCoord1sv = (PFNGLMULTITEXCOORD1SVPROC) load(userptr, "glMultiTexCoord1sv"); + glad_glMultiTexCoord2d = (PFNGLMULTITEXCOORD2DPROC) load(userptr, "glMultiTexCoord2d"); + glad_glMultiTexCoord2dv = (PFNGLMULTITEXCOORD2DVPROC) load(userptr, "glMultiTexCoord2dv"); + glad_glMultiTexCoord2f = (PFNGLMULTITEXCOORD2FPROC) load(userptr, "glMultiTexCoord2f"); + glad_glMultiTexCoord2fv = (PFNGLMULTITEXCOORD2FVPROC) load(userptr, "glMultiTexCoord2fv"); + glad_glMultiTexCoord2i = (PFNGLMULTITEXCOORD2IPROC) load(userptr, "glMultiTexCoord2i"); + glad_glMultiTexCoord2iv = (PFNGLMULTITEXCOORD2IVPROC) load(userptr, "glMultiTexCoord2iv"); + glad_glMultiTexCoord2s = (PFNGLMULTITEXCOORD2SPROC) load(userptr, "glMultiTexCoord2s"); + glad_glMultiTexCoord2sv = (PFNGLMULTITEXCOORD2SVPROC) load(userptr, "glMultiTexCoord2sv"); + glad_glMultiTexCoord3d = (PFNGLMULTITEXCOORD3DPROC) load(userptr, "glMultiTexCoord3d"); + glad_glMultiTexCoord3dv = (PFNGLMULTITEXCOORD3DVPROC) load(userptr, "glMultiTexCoord3dv"); + glad_glMultiTexCoord3f = (PFNGLMULTITEXCOORD3FPROC) load(userptr, "glMultiTexCoord3f"); + glad_glMultiTexCoord3fv = (PFNGLMULTITEXCOORD3FVPROC) load(userptr, "glMultiTexCoord3fv"); + glad_glMultiTexCoord3i = (PFNGLMULTITEXCOORD3IPROC) load(userptr, "glMultiTexCoord3i"); + glad_glMultiTexCoord3iv = (PFNGLMULTITEXCOORD3IVPROC) load(userptr, "glMultiTexCoord3iv"); + glad_glMultiTexCoord3s = (PFNGLMULTITEXCOORD3SPROC) load(userptr, "glMultiTexCoord3s"); + glad_glMultiTexCoord3sv = (PFNGLMULTITEXCOORD3SVPROC) load(userptr, "glMultiTexCoord3sv"); + glad_glMultiTexCoord4d = (PFNGLMULTITEXCOORD4DPROC) load(userptr, "glMultiTexCoord4d"); + glad_glMultiTexCoord4dv = (PFNGLMULTITEXCOORD4DVPROC) load(userptr, "glMultiTexCoord4dv"); + glad_glMultiTexCoord4f = (PFNGLMULTITEXCOORD4FPROC) load(userptr, "glMultiTexCoord4f"); + glad_glMultiTexCoord4fv = (PFNGLMULTITEXCOORD4FVPROC) load(userptr, "glMultiTexCoord4fv"); + glad_glMultiTexCoord4i = (PFNGLMULTITEXCOORD4IPROC) load(userptr, "glMultiTexCoord4i"); + glad_glMultiTexCoord4iv = (PFNGLMULTITEXCOORD4IVPROC) load(userptr, "glMultiTexCoord4iv"); + glad_glMultiTexCoord4s = (PFNGLMULTITEXCOORD4SPROC) load(userptr, "glMultiTexCoord4s"); + glad_glMultiTexCoord4sv = (PFNGLMULTITEXCOORD4SVPROC) load(userptr, "glMultiTexCoord4sv"); + glad_glSampleCoverage = (PFNGLSAMPLECOVERAGEPROC) load(userptr, "glSampleCoverage"); +} +static void glad_gl_load_GL_VERSION_1_4( GLADuserptrloadfunc load, void* userptr) { + if(!GLAD_GL_VERSION_1_4) return; + glad_glBlendColor = (PFNGLBLENDCOLORPROC) load(userptr, "glBlendColor"); + glad_glBlendEquation = (PFNGLBLENDEQUATIONPROC) load(userptr, "glBlendEquation"); + glad_glBlendFuncSeparate = (PFNGLBLENDFUNCSEPARATEPROC) load(userptr, "glBlendFuncSeparate"); + glad_glFogCoordPointer = (PFNGLFOGCOORDPOINTERPROC) load(userptr, "glFogCoordPointer"); + glad_glFogCoordd = (PFNGLFOGCOORDDPROC) load(userptr, "glFogCoordd"); + glad_glFogCoorddv = (PFNGLFOGCOORDDVPROC) load(userptr, "glFogCoorddv"); + glad_glFogCoordf = (PFNGLFOGCOORDFPROC) load(userptr, "glFogCoordf"); + glad_glFogCoordfv = (PFNGLFOGCOORDFVPROC) load(userptr, "glFogCoordfv"); + glad_glMultiDrawArrays = (PFNGLMULTIDRAWARRAYSPROC) load(userptr, "glMultiDrawArrays"); + glad_glMultiDrawElements = (PFNGLMULTIDRAWELEMENTSPROC) load(userptr, "glMultiDrawElements"); + glad_glPointParameterf = (PFNGLPOINTPARAMETERFPROC) load(userptr, "glPointParameterf"); + glad_glPointParameterfv = (PFNGLPOINTPARAMETERFVPROC) load(userptr, "glPointParameterfv"); + glad_glPointParameteri = (PFNGLPOINTPARAMETERIPROC) load(userptr, "glPointParameteri"); + glad_glPointParameteriv = (PFNGLPOINTPARAMETERIVPROC) load(userptr, "glPointParameteriv"); + glad_glSecondaryColor3b = (PFNGLSECONDARYCOLOR3BPROC) load(userptr, "glSecondaryColor3b"); + glad_glSecondaryColor3bv = (PFNGLSECONDARYCOLOR3BVPROC) load(userptr, "glSecondaryColor3bv"); + glad_glSecondaryColor3d = (PFNGLSECONDARYCOLOR3DPROC) load(userptr, "glSecondaryColor3d"); + glad_glSecondaryColor3dv = (PFNGLSECONDARYCOLOR3DVPROC) load(userptr, "glSecondaryColor3dv"); + glad_glSecondaryColor3f = (PFNGLSECONDARYCOLOR3FPROC) load(userptr, "glSecondaryColor3f"); + glad_glSecondaryColor3fv = (PFNGLSECONDARYCOLOR3FVPROC) load(userptr, "glSecondaryColor3fv"); + glad_glSecondaryColor3i = (PFNGLSECONDARYCOLOR3IPROC) load(userptr, "glSecondaryColor3i"); + glad_glSecondaryColor3iv = (PFNGLSECONDARYCOLOR3IVPROC) load(userptr, "glSecondaryColor3iv"); + glad_glSecondaryColor3s = (PFNGLSECONDARYCOLOR3SPROC) load(userptr, "glSecondaryColor3s"); + glad_glSecondaryColor3sv = (PFNGLSECONDARYCOLOR3SVPROC) load(userptr, "glSecondaryColor3sv"); + glad_glSecondaryColor3ub = (PFNGLSECONDARYCOLOR3UBPROC) load(userptr, "glSecondaryColor3ub"); + glad_glSecondaryColor3ubv = (PFNGLSECONDARYCOLOR3UBVPROC) load(userptr, "glSecondaryColor3ubv"); + glad_glSecondaryColor3ui = (PFNGLSECONDARYCOLOR3UIPROC) load(userptr, "glSecondaryColor3ui"); + glad_glSecondaryColor3uiv = (PFNGLSECONDARYCOLOR3UIVPROC) load(userptr, "glSecondaryColor3uiv"); + glad_glSecondaryColor3us = (PFNGLSECONDARYCOLOR3USPROC) load(userptr, "glSecondaryColor3us"); + glad_glSecondaryColor3usv = (PFNGLSECONDARYCOLOR3USVPROC) load(userptr, "glSecondaryColor3usv"); + glad_glSecondaryColorPointer = (PFNGLSECONDARYCOLORPOINTERPROC) load(userptr, "glSecondaryColorPointer"); + glad_glWindowPos2d = (PFNGLWINDOWPOS2DPROC) load(userptr, "glWindowPos2d"); + glad_glWindowPos2dv = (PFNGLWINDOWPOS2DVPROC) load(userptr, "glWindowPos2dv"); + glad_glWindowPos2f = (PFNGLWINDOWPOS2FPROC) load(userptr, "glWindowPos2f"); + glad_glWindowPos2fv = (PFNGLWINDOWPOS2FVPROC) load(userptr, "glWindowPos2fv"); + glad_glWindowPos2i = (PFNGLWINDOWPOS2IPROC) load(userptr, "glWindowPos2i"); + glad_glWindowPos2iv = (PFNGLWINDOWPOS2IVPROC) load(userptr, "glWindowPos2iv"); + glad_glWindowPos2s = (PFNGLWINDOWPOS2SPROC) load(userptr, "glWindowPos2s"); + glad_glWindowPos2sv = (PFNGLWINDOWPOS2SVPROC) load(userptr, "glWindowPos2sv"); + glad_glWindowPos3d = (PFNGLWINDOWPOS3DPROC) load(userptr, "glWindowPos3d"); + glad_glWindowPos3dv = (PFNGLWINDOWPOS3DVPROC) load(userptr, "glWindowPos3dv"); + glad_glWindowPos3f = (PFNGLWINDOWPOS3FPROC) load(userptr, "glWindowPos3f"); + glad_glWindowPos3fv = (PFNGLWINDOWPOS3FVPROC) load(userptr, "glWindowPos3fv"); + glad_glWindowPos3i = (PFNGLWINDOWPOS3IPROC) load(userptr, "glWindowPos3i"); + glad_glWindowPos3iv = (PFNGLWINDOWPOS3IVPROC) load(userptr, "glWindowPos3iv"); + glad_glWindowPos3s = (PFNGLWINDOWPOS3SPROC) load(userptr, "glWindowPos3s"); + glad_glWindowPos3sv = (PFNGLWINDOWPOS3SVPROC) load(userptr, "glWindowPos3sv"); +} +static void glad_gl_load_GL_VERSION_1_5( GLADuserptrloadfunc load, void* userptr) { + if(!GLAD_GL_VERSION_1_5) return; + glad_glBeginQuery = (PFNGLBEGINQUERYPROC) load(userptr, "glBeginQuery"); + glad_glBindBuffer = (PFNGLBINDBUFFERPROC) load(userptr, "glBindBuffer"); + glad_glBufferData = (PFNGLBUFFERDATAPROC) load(userptr, "glBufferData"); + glad_glBufferSubData = (PFNGLBUFFERSUBDATAPROC) load(userptr, "glBufferSubData"); + glad_glDeleteBuffers = (PFNGLDELETEBUFFERSPROC) load(userptr, "glDeleteBuffers"); + glad_glDeleteQueries = (PFNGLDELETEQUERIESPROC) load(userptr, "glDeleteQueries"); + glad_glEndQuery = (PFNGLENDQUERYPROC) load(userptr, "glEndQuery"); + glad_glGenBuffers = (PFNGLGENBUFFERSPROC) load(userptr, "glGenBuffers"); + glad_glGenQueries = (PFNGLGENQUERIESPROC) load(userptr, "glGenQueries"); + glad_glGetBufferParameteriv = (PFNGLGETBUFFERPARAMETERIVPROC) load(userptr, "glGetBufferParameteriv"); + glad_glGetBufferPointerv = (PFNGLGETBUFFERPOINTERVPROC) load(userptr, "glGetBufferPointerv"); + glad_glGetBufferSubData = (PFNGLGETBUFFERSUBDATAPROC) load(userptr, "glGetBufferSubData"); + glad_glGetQueryObjectiv = (PFNGLGETQUERYOBJECTIVPROC) load(userptr, "glGetQueryObjectiv"); + glad_glGetQueryObjectuiv = (PFNGLGETQUERYOBJECTUIVPROC) load(userptr, "glGetQueryObjectuiv"); + glad_glGetQueryiv = (PFNGLGETQUERYIVPROC) load(userptr, "glGetQueryiv"); + glad_glIsBuffer = (PFNGLISBUFFERPROC) load(userptr, "glIsBuffer"); + glad_glIsQuery = (PFNGLISQUERYPROC) load(userptr, "glIsQuery"); + glad_glMapBuffer = (PFNGLMAPBUFFERPROC) load(userptr, "glMapBuffer"); + glad_glUnmapBuffer = (PFNGLUNMAPBUFFERPROC) load(userptr, "glUnmapBuffer"); +} +static void glad_gl_load_GL_VERSION_2_0( GLADuserptrloadfunc load, void* userptr) { + if(!GLAD_GL_VERSION_2_0) return; + glad_glAttachShader = (PFNGLATTACHSHADERPROC) load(userptr, "glAttachShader"); + glad_glBindAttribLocation = (PFNGLBINDATTRIBLOCATIONPROC) load(userptr, "glBindAttribLocation"); + glad_glBlendEquationSeparate = (PFNGLBLENDEQUATIONSEPARATEPROC) load(userptr, "glBlendEquationSeparate"); + glad_glCompileShader = (PFNGLCOMPILESHADERPROC) load(userptr, "glCompileShader"); + glad_glCreateProgram = (PFNGLCREATEPROGRAMPROC) load(userptr, "glCreateProgram"); + glad_glCreateShader = (PFNGLCREATESHADERPROC) load(userptr, "glCreateShader"); + glad_glDeleteProgram = (PFNGLDELETEPROGRAMPROC) load(userptr, "glDeleteProgram"); + glad_glDeleteShader = (PFNGLDELETESHADERPROC) load(userptr, "glDeleteShader"); + glad_glDetachShader = (PFNGLDETACHSHADERPROC) load(userptr, "glDetachShader"); + glad_glDisableVertexAttribArray = (PFNGLDISABLEVERTEXATTRIBARRAYPROC) load(userptr, "glDisableVertexAttribArray"); + glad_glDrawBuffers = (PFNGLDRAWBUFFERSPROC) load(userptr, "glDrawBuffers"); + glad_glEnableVertexAttribArray = (PFNGLENABLEVERTEXATTRIBARRAYPROC) load(userptr, "glEnableVertexAttribArray"); + glad_glGetActiveAttrib = (PFNGLGETACTIVEATTRIBPROC) load(userptr, "glGetActiveAttrib"); + glad_glGetActiveUniform = (PFNGLGETACTIVEUNIFORMPROC) load(userptr, "glGetActiveUniform"); + glad_glGetAttachedShaders = (PFNGLGETATTACHEDSHADERSPROC) load(userptr, "glGetAttachedShaders"); + glad_glGetAttribLocation = (PFNGLGETATTRIBLOCATIONPROC) load(userptr, "glGetAttribLocation"); + glad_glGetProgramInfoLog = (PFNGLGETPROGRAMINFOLOGPROC) load(userptr, "glGetProgramInfoLog"); + glad_glGetProgramiv = (PFNGLGETPROGRAMIVPROC) load(userptr, "glGetProgramiv"); + glad_glGetShaderInfoLog = (PFNGLGETSHADERINFOLOGPROC) load(userptr, "glGetShaderInfoLog"); + glad_glGetShaderSource = (PFNGLGETSHADERSOURCEPROC) load(userptr, "glGetShaderSource"); + glad_glGetShaderiv = (PFNGLGETSHADERIVPROC) load(userptr, "glGetShaderiv"); + glad_glGetUniformLocation = (PFNGLGETUNIFORMLOCATIONPROC) load(userptr, "glGetUniformLocation"); + glad_glGetUniformfv = (PFNGLGETUNIFORMFVPROC) load(userptr, "glGetUniformfv"); + glad_glGetUniformiv = (PFNGLGETUNIFORMIVPROC) load(userptr, "glGetUniformiv"); + glad_glGetVertexAttribPointerv = (PFNGLGETVERTEXATTRIBPOINTERVPROC) load(userptr, "glGetVertexAttribPointerv"); + glad_glGetVertexAttribdv = (PFNGLGETVERTEXATTRIBDVPROC) load(userptr, "glGetVertexAttribdv"); + glad_glGetVertexAttribfv = (PFNGLGETVERTEXATTRIBFVPROC) load(userptr, "glGetVertexAttribfv"); + glad_glGetVertexAttribiv = (PFNGLGETVERTEXATTRIBIVPROC) load(userptr, "glGetVertexAttribiv"); + glad_glIsProgram = (PFNGLISPROGRAMPROC) load(userptr, "glIsProgram"); + glad_glIsShader = (PFNGLISSHADERPROC) load(userptr, "glIsShader"); + glad_glLinkProgram = (PFNGLLINKPROGRAMPROC) load(userptr, "glLinkProgram"); + glad_glShaderSource = (PFNGLSHADERSOURCEPROC) load(userptr, "glShaderSource"); + glad_glStencilFuncSeparate = (PFNGLSTENCILFUNCSEPARATEPROC) load(userptr, "glStencilFuncSeparate"); + glad_glStencilMaskSeparate = (PFNGLSTENCILMASKSEPARATEPROC) load(userptr, "glStencilMaskSeparate"); + glad_glStencilOpSeparate = (PFNGLSTENCILOPSEPARATEPROC) load(userptr, "glStencilOpSeparate"); + glad_glUniform1f = (PFNGLUNIFORM1FPROC) load(userptr, "glUniform1f"); + glad_glUniform1fv = (PFNGLUNIFORM1FVPROC) load(userptr, "glUniform1fv"); + glad_glUniform1i = (PFNGLUNIFORM1IPROC) load(userptr, "glUniform1i"); + glad_glUniform1iv = (PFNGLUNIFORM1IVPROC) load(userptr, "glUniform1iv"); + glad_glUniform2f = (PFNGLUNIFORM2FPROC) load(userptr, "glUniform2f"); + glad_glUniform2fv = (PFNGLUNIFORM2FVPROC) load(userptr, "glUniform2fv"); + glad_glUniform2i = (PFNGLUNIFORM2IPROC) load(userptr, "glUniform2i"); + glad_glUniform2iv = (PFNGLUNIFORM2IVPROC) load(userptr, "glUniform2iv"); + glad_glUniform3f = (PFNGLUNIFORM3FPROC) load(userptr, "glUniform3f"); + glad_glUniform3fv = (PFNGLUNIFORM3FVPROC) load(userptr, "glUniform3fv"); + glad_glUniform3i = (PFNGLUNIFORM3IPROC) load(userptr, "glUniform3i"); + glad_glUniform3iv = (PFNGLUNIFORM3IVPROC) load(userptr, "glUniform3iv"); + glad_glUniform4f = (PFNGLUNIFORM4FPROC) load(userptr, "glUniform4f"); + glad_glUniform4fv = (PFNGLUNIFORM4FVPROC) load(userptr, "glUniform4fv"); + glad_glUniform4i = (PFNGLUNIFORM4IPROC) load(userptr, "glUniform4i"); + glad_glUniform4iv = (PFNGLUNIFORM4IVPROC) load(userptr, "glUniform4iv"); + glad_glUniformMatrix2fv = (PFNGLUNIFORMMATRIX2FVPROC) load(userptr, "glUniformMatrix2fv"); + glad_glUniformMatrix3fv = (PFNGLUNIFORMMATRIX3FVPROC) load(userptr, "glUniformMatrix3fv"); + glad_glUniformMatrix4fv = (PFNGLUNIFORMMATRIX4FVPROC) load(userptr, "glUniformMatrix4fv"); + glad_glUseProgram = (PFNGLUSEPROGRAMPROC) load(userptr, "glUseProgram"); + glad_glValidateProgram = (PFNGLVALIDATEPROGRAMPROC) load(userptr, "glValidateProgram"); + glad_glVertexAttrib1d = (PFNGLVERTEXATTRIB1DPROC) load(userptr, "glVertexAttrib1d"); + glad_glVertexAttrib1dv = (PFNGLVERTEXATTRIB1DVPROC) load(userptr, "glVertexAttrib1dv"); + glad_glVertexAttrib1f = (PFNGLVERTEXATTRIB1FPROC) load(userptr, "glVertexAttrib1f"); + glad_glVertexAttrib1fv = (PFNGLVERTEXATTRIB1FVPROC) load(userptr, "glVertexAttrib1fv"); + glad_glVertexAttrib1s = (PFNGLVERTEXATTRIB1SPROC) load(userptr, "glVertexAttrib1s"); + glad_glVertexAttrib1sv = (PFNGLVERTEXATTRIB1SVPROC) load(userptr, "glVertexAttrib1sv"); + glad_glVertexAttrib2d = (PFNGLVERTEXATTRIB2DPROC) load(userptr, "glVertexAttrib2d"); + glad_glVertexAttrib2dv = (PFNGLVERTEXATTRIB2DVPROC) load(userptr, "glVertexAttrib2dv"); + glad_glVertexAttrib2f = (PFNGLVERTEXATTRIB2FPROC) load(userptr, "glVertexAttrib2f"); + glad_glVertexAttrib2fv = (PFNGLVERTEXATTRIB2FVPROC) load(userptr, "glVertexAttrib2fv"); + glad_glVertexAttrib2s = (PFNGLVERTEXATTRIB2SPROC) load(userptr, "glVertexAttrib2s"); + glad_glVertexAttrib2sv = (PFNGLVERTEXATTRIB2SVPROC) load(userptr, "glVertexAttrib2sv"); + glad_glVertexAttrib3d = (PFNGLVERTEXATTRIB3DPROC) load(userptr, "glVertexAttrib3d"); + glad_glVertexAttrib3dv = (PFNGLVERTEXATTRIB3DVPROC) load(userptr, "glVertexAttrib3dv"); + glad_glVertexAttrib3f = (PFNGLVERTEXATTRIB3FPROC) load(userptr, "glVertexAttrib3f"); + glad_glVertexAttrib3fv = (PFNGLVERTEXATTRIB3FVPROC) load(userptr, "glVertexAttrib3fv"); + glad_glVertexAttrib3s = (PFNGLVERTEXATTRIB3SPROC) load(userptr, "glVertexAttrib3s"); + glad_glVertexAttrib3sv = (PFNGLVERTEXATTRIB3SVPROC) load(userptr, "glVertexAttrib3sv"); + glad_glVertexAttrib4Nbv = (PFNGLVERTEXATTRIB4NBVPROC) load(userptr, "glVertexAttrib4Nbv"); + glad_glVertexAttrib4Niv = (PFNGLVERTEXATTRIB4NIVPROC) load(userptr, "glVertexAttrib4Niv"); + glad_glVertexAttrib4Nsv = (PFNGLVERTEXATTRIB4NSVPROC) load(userptr, "glVertexAttrib4Nsv"); + glad_glVertexAttrib4Nub = (PFNGLVERTEXATTRIB4NUBPROC) load(userptr, "glVertexAttrib4Nub"); + glad_glVertexAttrib4Nubv = (PFNGLVERTEXATTRIB4NUBVPROC) load(userptr, "glVertexAttrib4Nubv"); + glad_glVertexAttrib4Nuiv = (PFNGLVERTEXATTRIB4NUIVPROC) load(userptr, "glVertexAttrib4Nuiv"); + glad_glVertexAttrib4Nusv = (PFNGLVERTEXATTRIB4NUSVPROC) load(userptr, "glVertexAttrib4Nusv"); + glad_glVertexAttrib4bv = (PFNGLVERTEXATTRIB4BVPROC) load(userptr, "glVertexAttrib4bv"); + glad_glVertexAttrib4d = (PFNGLVERTEXATTRIB4DPROC) load(userptr, "glVertexAttrib4d"); + glad_glVertexAttrib4dv = (PFNGLVERTEXATTRIB4DVPROC) load(userptr, "glVertexAttrib4dv"); + glad_glVertexAttrib4f = (PFNGLVERTEXATTRIB4FPROC) load(userptr, "glVertexAttrib4f"); + glad_glVertexAttrib4fv = (PFNGLVERTEXATTRIB4FVPROC) load(userptr, "glVertexAttrib4fv"); + glad_glVertexAttrib4iv = (PFNGLVERTEXATTRIB4IVPROC) load(userptr, "glVertexAttrib4iv"); + glad_glVertexAttrib4s = (PFNGLVERTEXATTRIB4SPROC) load(userptr, "glVertexAttrib4s"); + glad_glVertexAttrib4sv = (PFNGLVERTEXATTRIB4SVPROC) load(userptr, "glVertexAttrib4sv"); + glad_glVertexAttrib4ubv = (PFNGLVERTEXATTRIB4UBVPROC) load(userptr, "glVertexAttrib4ubv"); + glad_glVertexAttrib4uiv = (PFNGLVERTEXATTRIB4UIVPROC) load(userptr, "glVertexAttrib4uiv"); + glad_glVertexAttrib4usv = (PFNGLVERTEXATTRIB4USVPROC) load(userptr, "glVertexAttrib4usv"); + glad_glVertexAttribPointer = (PFNGLVERTEXATTRIBPOINTERPROC) load(userptr, "glVertexAttribPointer"); +} +static void glad_gl_load_GL_VERSION_2_1( GLADuserptrloadfunc load, void* userptr) { + if(!GLAD_GL_VERSION_2_1) return; + glad_glUniformMatrix2x3fv = (PFNGLUNIFORMMATRIX2X3FVPROC) load(userptr, "glUniformMatrix2x3fv"); + glad_glUniformMatrix2x4fv = (PFNGLUNIFORMMATRIX2X4FVPROC) load(userptr, "glUniformMatrix2x4fv"); + glad_glUniformMatrix3x2fv = (PFNGLUNIFORMMATRIX3X2FVPROC) load(userptr, "glUniformMatrix3x2fv"); + glad_glUniformMatrix3x4fv = (PFNGLUNIFORMMATRIX3X4FVPROC) load(userptr, "glUniformMatrix3x4fv"); + glad_glUniformMatrix4x2fv = (PFNGLUNIFORMMATRIX4X2FVPROC) load(userptr, "glUniformMatrix4x2fv"); + glad_glUniformMatrix4x3fv = (PFNGLUNIFORMMATRIX4X3FVPROC) load(userptr, "glUniformMatrix4x3fv"); +} +static void glad_gl_load_GL_VERSION_3_0( GLADuserptrloadfunc load, void* userptr) { + if(!GLAD_GL_VERSION_3_0) return; + glad_glBeginConditionalRender = (PFNGLBEGINCONDITIONALRENDERPROC) load(userptr, "glBeginConditionalRender"); + glad_glBeginTransformFeedback = (PFNGLBEGINTRANSFORMFEEDBACKPROC) load(userptr, "glBeginTransformFeedback"); + glad_glBindBufferBase = (PFNGLBINDBUFFERBASEPROC) load(userptr, "glBindBufferBase"); + glad_glBindBufferRange = (PFNGLBINDBUFFERRANGEPROC) load(userptr, "glBindBufferRange"); + glad_glBindFragDataLocation = (PFNGLBINDFRAGDATALOCATIONPROC) load(userptr, "glBindFragDataLocation"); + glad_glBindFramebuffer = (PFNGLBINDFRAMEBUFFERPROC) load(userptr, "glBindFramebuffer"); + glad_glBindRenderbuffer = (PFNGLBINDRENDERBUFFERPROC) load(userptr, "glBindRenderbuffer"); + glad_glBindVertexArray = (PFNGLBINDVERTEXARRAYPROC) load(userptr, "glBindVertexArray"); + glad_glBlitFramebuffer = (PFNGLBLITFRAMEBUFFERPROC) load(userptr, "glBlitFramebuffer"); + glad_glCheckFramebufferStatus = (PFNGLCHECKFRAMEBUFFERSTATUSPROC) load(userptr, "glCheckFramebufferStatus"); + glad_glClampColor = (PFNGLCLAMPCOLORPROC) load(userptr, "glClampColor"); + glad_glClearBufferfi = (PFNGLCLEARBUFFERFIPROC) load(userptr, "glClearBufferfi"); + glad_glClearBufferfv = (PFNGLCLEARBUFFERFVPROC) load(userptr, "glClearBufferfv"); + glad_glClearBufferiv = (PFNGLCLEARBUFFERIVPROC) load(userptr, "glClearBufferiv"); + glad_glClearBufferuiv = (PFNGLCLEARBUFFERUIVPROC) load(userptr, "glClearBufferuiv"); + glad_glColorMaski = (PFNGLCOLORMASKIPROC) load(userptr, "glColorMaski"); + glad_glDeleteFramebuffers = (PFNGLDELETEFRAMEBUFFERSPROC) load(userptr, "glDeleteFramebuffers"); + glad_glDeleteRenderbuffers = (PFNGLDELETERENDERBUFFERSPROC) load(userptr, "glDeleteRenderbuffers"); + glad_glDeleteVertexArrays = (PFNGLDELETEVERTEXARRAYSPROC) load(userptr, "glDeleteVertexArrays"); + glad_glDisablei = (PFNGLDISABLEIPROC) load(userptr, "glDisablei"); + glad_glEnablei = (PFNGLENABLEIPROC) load(userptr, "glEnablei"); + glad_glEndConditionalRender = (PFNGLENDCONDITIONALRENDERPROC) load(userptr, "glEndConditionalRender"); + glad_glEndTransformFeedback = (PFNGLENDTRANSFORMFEEDBACKPROC) load(userptr, "glEndTransformFeedback"); + glad_glFlushMappedBufferRange = (PFNGLFLUSHMAPPEDBUFFERRANGEPROC) load(userptr, "glFlushMappedBufferRange"); + glad_glFramebufferRenderbuffer = (PFNGLFRAMEBUFFERRENDERBUFFERPROC) load(userptr, "glFramebufferRenderbuffer"); + glad_glFramebufferTexture1D = (PFNGLFRAMEBUFFERTEXTURE1DPROC) load(userptr, "glFramebufferTexture1D"); + glad_glFramebufferTexture2D = (PFNGLFRAMEBUFFERTEXTURE2DPROC) load(userptr, "glFramebufferTexture2D"); + glad_glFramebufferTexture3D = (PFNGLFRAMEBUFFERTEXTURE3DPROC) load(userptr, "glFramebufferTexture3D"); + glad_glFramebufferTextureLayer = (PFNGLFRAMEBUFFERTEXTURELAYERPROC) load(userptr, "glFramebufferTextureLayer"); + glad_glGenFramebuffers = (PFNGLGENFRAMEBUFFERSPROC) load(userptr, "glGenFramebuffers"); + glad_glGenRenderbuffers = (PFNGLGENRENDERBUFFERSPROC) load(userptr, "glGenRenderbuffers"); + glad_glGenVertexArrays = (PFNGLGENVERTEXARRAYSPROC) load(userptr, "glGenVertexArrays"); + glad_glGenerateMipmap = (PFNGLGENERATEMIPMAPPROC) load(userptr, "glGenerateMipmap"); + glad_glGetBooleani_v = (PFNGLGETBOOLEANI_VPROC) load(userptr, "glGetBooleani_v"); + glad_glGetFragDataLocation = (PFNGLGETFRAGDATALOCATIONPROC) load(userptr, "glGetFragDataLocation"); + glad_glGetFramebufferAttachmentParameteriv = (PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC) load(userptr, "glGetFramebufferAttachmentParameteriv"); + glad_glGetIntegeri_v = (PFNGLGETINTEGERI_VPROC) load(userptr, "glGetIntegeri_v"); + glad_glGetRenderbufferParameteriv = (PFNGLGETRENDERBUFFERPARAMETERIVPROC) load(userptr, "glGetRenderbufferParameteriv"); + glad_glGetStringi = (PFNGLGETSTRINGIPROC) load(userptr, "glGetStringi"); + glad_glGetTexParameterIiv = (PFNGLGETTEXPARAMETERIIVPROC) load(userptr, "glGetTexParameterIiv"); + glad_glGetTexParameterIuiv = (PFNGLGETTEXPARAMETERIUIVPROC) load(userptr, "glGetTexParameterIuiv"); + glad_glGetTransformFeedbackVarying = (PFNGLGETTRANSFORMFEEDBACKVARYINGPROC) load(userptr, "glGetTransformFeedbackVarying"); + glad_glGetUniformuiv = (PFNGLGETUNIFORMUIVPROC) load(userptr, "glGetUniformuiv"); + glad_glGetVertexAttribIiv = (PFNGLGETVERTEXATTRIBIIVPROC) load(userptr, "glGetVertexAttribIiv"); + glad_glGetVertexAttribIuiv = (PFNGLGETVERTEXATTRIBIUIVPROC) load(userptr, "glGetVertexAttribIuiv"); + glad_glIsEnabledi = (PFNGLISENABLEDIPROC) load(userptr, "glIsEnabledi"); + glad_glIsFramebuffer = (PFNGLISFRAMEBUFFERPROC) load(userptr, "glIsFramebuffer"); + glad_glIsRenderbuffer = (PFNGLISRENDERBUFFERPROC) load(userptr, "glIsRenderbuffer"); + glad_glIsVertexArray = (PFNGLISVERTEXARRAYPROC) load(userptr, "glIsVertexArray"); + glad_glMapBufferRange = (PFNGLMAPBUFFERRANGEPROC) load(userptr, "glMapBufferRange"); + glad_glRenderbufferStorage = (PFNGLRENDERBUFFERSTORAGEPROC) load(userptr, "glRenderbufferStorage"); + glad_glRenderbufferStorageMultisample = (PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC) load(userptr, "glRenderbufferStorageMultisample"); + glad_glTexParameterIiv = (PFNGLTEXPARAMETERIIVPROC) load(userptr, "glTexParameterIiv"); + glad_glTexParameterIuiv = (PFNGLTEXPARAMETERIUIVPROC) load(userptr, "glTexParameterIuiv"); + glad_glTransformFeedbackVaryings = (PFNGLTRANSFORMFEEDBACKVARYINGSPROC) load(userptr, "glTransformFeedbackVaryings"); + glad_glUniform1ui = (PFNGLUNIFORM1UIPROC) load(userptr, "glUniform1ui"); + glad_glUniform1uiv = (PFNGLUNIFORM1UIVPROC) load(userptr, "glUniform1uiv"); + glad_glUniform2ui = (PFNGLUNIFORM2UIPROC) load(userptr, "glUniform2ui"); + glad_glUniform2uiv = (PFNGLUNIFORM2UIVPROC) load(userptr, "glUniform2uiv"); + glad_glUniform3ui = (PFNGLUNIFORM3UIPROC) load(userptr, "glUniform3ui"); + glad_glUniform3uiv = (PFNGLUNIFORM3UIVPROC) load(userptr, "glUniform3uiv"); + glad_glUniform4ui = (PFNGLUNIFORM4UIPROC) load(userptr, "glUniform4ui"); + glad_glUniform4uiv = (PFNGLUNIFORM4UIVPROC) load(userptr, "glUniform4uiv"); + glad_glVertexAttribI1i = (PFNGLVERTEXATTRIBI1IPROC) load(userptr, "glVertexAttribI1i"); + glad_glVertexAttribI1iv = (PFNGLVERTEXATTRIBI1IVPROC) load(userptr, "glVertexAttribI1iv"); + glad_glVertexAttribI1ui = (PFNGLVERTEXATTRIBI1UIPROC) load(userptr, "glVertexAttribI1ui"); + glad_glVertexAttribI1uiv = (PFNGLVERTEXATTRIBI1UIVPROC) load(userptr, "glVertexAttribI1uiv"); + glad_glVertexAttribI2i = (PFNGLVERTEXATTRIBI2IPROC) load(userptr, "glVertexAttribI2i"); + glad_glVertexAttribI2iv = (PFNGLVERTEXATTRIBI2IVPROC) load(userptr, "glVertexAttribI2iv"); + glad_glVertexAttribI2ui = (PFNGLVERTEXATTRIBI2UIPROC) load(userptr, "glVertexAttribI2ui"); + glad_glVertexAttribI2uiv = (PFNGLVERTEXATTRIBI2UIVPROC) load(userptr, "glVertexAttribI2uiv"); + glad_glVertexAttribI3i = (PFNGLVERTEXATTRIBI3IPROC) load(userptr, "glVertexAttribI3i"); + glad_glVertexAttribI3iv = (PFNGLVERTEXATTRIBI3IVPROC) load(userptr, "glVertexAttribI3iv"); + glad_glVertexAttribI3ui = (PFNGLVERTEXATTRIBI3UIPROC) load(userptr, "glVertexAttribI3ui"); + glad_glVertexAttribI3uiv = (PFNGLVERTEXATTRIBI3UIVPROC) load(userptr, "glVertexAttribI3uiv"); + glad_glVertexAttribI4bv = (PFNGLVERTEXATTRIBI4BVPROC) load(userptr, "glVertexAttribI4bv"); + glad_glVertexAttribI4i = (PFNGLVERTEXATTRIBI4IPROC) load(userptr, "glVertexAttribI4i"); + glad_glVertexAttribI4iv = (PFNGLVERTEXATTRIBI4IVPROC) load(userptr, "glVertexAttribI4iv"); + glad_glVertexAttribI4sv = (PFNGLVERTEXATTRIBI4SVPROC) load(userptr, "glVertexAttribI4sv"); + glad_glVertexAttribI4ubv = (PFNGLVERTEXATTRIBI4UBVPROC) load(userptr, "glVertexAttribI4ubv"); + glad_glVertexAttribI4ui = (PFNGLVERTEXATTRIBI4UIPROC) load(userptr, "glVertexAttribI4ui"); + glad_glVertexAttribI4uiv = (PFNGLVERTEXATTRIBI4UIVPROC) load(userptr, "glVertexAttribI4uiv"); + glad_glVertexAttribI4usv = (PFNGLVERTEXATTRIBI4USVPROC) load(userptr, "glVertexAttribI4usv"); + glad_glVertexAttribIPointer = (PFNGLVERTEXATTRIBIPOINTERPROC) load(userptr, "glVertexAttribIPointer"); } +static void glad_gl_load_GL_VERSION_3_1( GLADuserptrloadfunc load, void* userptr) { + if(!GLAD_GL_VERSION_3_1) return; + glad_glBindBufferBase = (PFNGLBINDBUFFERBASEPROC) load(userptr, "glBindBufferBase"); + glad_glBindBufferRange = (PFNGLBINDBUFFERRANGEPROC) load(userptr, "glBindBufferRange"); + glad_glCopyBufferSubData = (PFNGLCOPYBUFFERSUBDATAPROC) load(userptr, "glCopyBufferSubData"); + glad_glDrawArraysInstanced = (PFNGLDRAWARRAYSINSTANCEDPROC) load(userptr, "glDrawArraysInstanced"); + glad_glDrawElementsInstanced = (PFNGLDRAWELEMENTSINSTANCEDPROC) load(userptr, "glDrawElementsInstanced"); + glad_glGetActiveUniformBlockName = (PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC) load(userptr, "glGetActiveUniformBlockName"); + glad_glGetActiveUniformBlockiv = (PFNGLGETACTIVEUNIFORMBLOCKIVPROC) load(userptr, "glGetActiveUniformBlockiv"); + glad_glGetActiveUniformName = (PFNGLGETACTIVEUNIFORMNAMEPROC) load(userptr, "glGetActiveUniformName"); + glad_glGetActiveUniformsiv = (PFNGLGETACTIVEUNIFORMSIVPROC) load(userptr, "glGetActiveUniformsiv"); + glad_glGetIntegeri_v = (PFNGLGETINTEGERI_VPROC) load(userptr, "glGetIntegeri_v"); + glad_glGetUniformBlockIndex = (PFNGLGETUNIFORMBLOCKINDEXPROC) load(userptr, "glGetUniformBlockIndex"); + glad_glGetUniformIndices = (PFNGLGETUNIFORMINDICESPROC) load(userptr, "glGetUniformIndices"); + glad_glPrimitiveRestartIndex = (PFNGLPRIMITIVERESTARTINDEXPROC) load(userptr, "glPrimitiveRestartIndex"); + glad_glTexBuffer = (PFNGLTEXBUFFERPROC) load(userptr, "glTexBuffer"); + glad_glUniformBlockBinding = (PFNGLUNIFORMBLOCKBINDINGPROC) load(userptr, "glUniformBlockBinding"); +} +static void glad_gl_load_GL_VERSION_3_2( GLADuserptrloadfunc load, void* userptr) { + if(!GLAD_GL_VERSION_3_2) return; + glad_glClientWaitSync = (PFNGLCLIENTWAITSYNCPROC) load(userptr, "glClientWaitSync"); + glad_glDeleteSync = (PFNGLDELETESYNCPROC) load(userptr, "glDeleteSync"); + glad_glDrawElementsBaseVertex = (PFNGLDRAWELEMENTSBASEVERTEXPROC) load(userptr, "glDrawElementsBaseVertex"); + glad_glDrawElementsInstancedBaseVertex = (PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC) load(userptr, "glDrawElementsInstancedBaseVertex"); + glad_glDrawRangeElementsBaseVertex = (PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC) load(userptr, "glDrawRangeElementsBaseVertex"); + glad_glFenceSync = (PFNGLFENCESYNCPROC) load(userptr, "glFenceSync"); + glad_glFramebufferTexture = (PFNGLFRAMEBUFFERTEXTUREPROC) load(userptr, "glFramebufferTexture"); + glad_glGetBufferParameteri64v = (PFNGLGETBUFFERPARAMETERI64VPROC) load(userptr, "glGetBufferParameteri64v"); + glad_glGetInteger64i_v = (PFNGLGETINTEGER64I_VPROC) load(userptr, "glGetInteger64i_v"); + glad_glGetInteger64v = (PFNGLGETINTEGER64VPROC) load(userptr, "glGetInteger64v"); + glad_glGetMultisamplefv = (PFNGLGETMULTISAMPLEFVPROC) load(userptr, "glGetMultisamplefv"); + glad_glGetSynciv = (PFNGLGETSYNCIVPROC) load(userptr, "glGetSynciv"); + glad_glIsSync = (PFNGLISSYNCPROC) load(userptr, "glIsSync"); + glad_glMultiDrawElementsBaseVertex = (PFNGLMULTIDRAWELEMENTSBASEVERTEXPROC) load(userptr, "glMultiDrawElementsBaseVertex"); + glad_glProvokingVertex = (PFNGLPROVOKINGVERTEXPROC) load(userptr, "glProvokingVertex"); + glad_glSampleMaski = (PFNGLSAMPLEMASKIPROC) load(userptr, "glSampleMaski"); + glad_glTexImage2DMultisample = (PFNGLTEXIMAGE2DMULTISAMPLEPROC) load(userptr, "glTexImage2DMultisample"); + glad_glTexImage3DMultisample = (PFNGLTEXIMAGE3DMULTISAMPLEPROC) load(userptr, "glTexImage3DMultisample"); + glad_glWaitSync = (PFNGLWAITSYNCPROC) load(userptr, "glWaitSync"); +} +static void glad_gl_load_GL_VERSION_3_3( GLADuserptrloadfunc load, void* userptr) { + if(!GLAD_GL_VERSION_3_3) return; + glad_glBindFragDataLocationIndexed = (PFNGLBINDFRAGDATALOCATIONINDEXEDPROC) load(userptr, "glBindFragDataLocationIndexed"); + glad_glBindSampler = (PFNGLBINDSAMPLERPROC) load(userptr, "glBindSampler"); + glad_glColorP3ui = (PFNGLCOLORP3UIPROC) load(userptr, "glColorP3ui"); + glad_glColorP3uiv = (PFNGLCOLORP3UIVPROC) load(userptr, "glColorP3uiv"); + glad_glColorP4ui = (PFNGLCOLORP4UIPROC) load(userptr, "glColorP4ui"); + glad_glColorP4uiv = (PFNGLCOLORP4UIVPROC) load(userptr, "glColorP4uiv"); + glad_glDeleteSamplers = (PFNGLDELETESAMPLERSPROC) load(userptr, "glDeleteSamplers"); + glad_glGenSamplers = (PFNGLGENSAMPLERSPROC) load(userptr, "glGenSamplers"); + glad_glGetFragDataIndex = (PFNGLGETFRAGDATAINDEXPROC) load(userptr, "glGetFragDataIndex"); + glad_glGetQueryObjecti64v = (PFNGLGETQUERYOBJECTI64VPROC) load(userptr, "glGetQueryObjecti64v"); + glad_glGetQueryObjectui64v = (PFNGLGETQUERYOBJECTUI64VPROC) load(userptr, "glGetQueryObjectui64v"); + glad_glGetSamplerParameterIiv = (PFNGLGETSAMPLERPARAMETERIIVPROC) load(userptr, "glGetSamplerParameterIiv"); + glad_glGetSamplerParameterIuiv = (PFNGLGETSAMPLERPARAMETERIUIVPROC) load(userptr, "glGetSamplerParameterIuiv"); + glad_glGetSamplerParameterfv = (PFNGLGETSAMPLERPARAMETERFVPROC) load(userptr, "glGetSamplerParameterfv"); + glad_glGetSamplerParameteriv = (PFNGLGETSAMPLERPARAMETERIVPROC) load(userptr, "glGetSamplerParameteriv"); + glad_glIsSampler = (PFNGLISSAMPLERPROC) load(userptr, "glIsSampler"); + glad_glMultiTexCoordP1ui = (PFNGLMULTITEXCOORDP1UIPROC) load(userptr, "glMultiTexCoordP1ui"); + glad_glMultiTexCoordP1uiv = (PFNGLMULTITEXCOORDP1UIVPROC) load(userptr, "glMultiTexCoordP1uiv"); + glad_glMultiTexCoordP2ui = (PFNGLMULTITEXCOORDP2UIPROC) load(userptr, "glMultiTexCoordP2ui"); + glad_glMultiTexCoordP2uiv = (PFNGLMULTITEXCOORDP2UIVPROC) load(userptr, "glMultiTexCoordP2uiv"); + glad_glMultiTexCoordP3ui = (PFNGLMULTITEXCOORDP3UIPROC) load(userptr, "glMultiTexCoordP3ui"); + glad_glMultiTexCoordP3uiv = (PFNGLMULTITEXCOORDP3UIVPROC) load(userptr, "glMultiTexCoordP3uiv"); + glad_glMultiTexCoordP4ui = (PFNGLMULTITEXCOORDP4UIPROC) load(userptr, "glMultiTexCoordP4ui"); + glad_glMultiTexCoordP4uiv = (PFNGLMULTITEXCOORDP4UIVPROC) load(userptr, "glMultiTexCoordP4uiv"); + glad_glNormalP3ui = (PFNGLNORMALP3UIPROC) load(userptr, "glNormalP3ui"); + glad_glNormalP3uiv = (PFNGLNORMALP3UIVPROC) load(userptr, "glNormalP3uiv"); + glad_glQueryCounter = (PFNGLQUERYCOUNTERPROC) load(userptr, "glQueryCounter"); + glad_glSamplerParameterIiv = (PFNGLSAMPLERPARAMETERIIVPROC) load(userptr, "glSamplerParameterIiv"); + glad_glSamplerParameterIuiv = (PFNGLSAMPLERPARAMETERIUIVPROC) load(userptr, "glSamplerParameterIuiv"); + glad_glSamplerParameterf = (PFNGLSAMPLERPARAMETERFPROC) load(userptr, "glSamplerParameterf"); + glad_glSamplerParameterfv = (PFNGLSAMPLERPARAMETERFVPROC) load(userptr, "glSamplerParameterfv"); + glad_glSamplerParameteri = (PFNGLSAMPLERPARAMETERIPROC) load(userptr, "glSamplerParameteri"); + glad_glSamplerParameteriv = (PFNGLSAMPLERPARAMETERIVPROC) load(userptr, "glSamplerParameteriv"); + glad_glSecondaryColorP3ui = (PFNGLSECONDARYCOLORP3UIPROC) load(userptr, "glSecondaryColorP3ui"); + glad_glSecondaryColorP3uiv = (PFNGLSECONDARYCOLORP3UIVPROC) load(userptr, "glSecondaryColorP3uiv"); + glad_glTexCoordP1ui = (PFNGLTEXCOORDP1UIPROC) load(userptr, "glTexCoordP1ui"); + glad_glTexCoordP1uiv = (PFNGLTEXCOORDP1UIVPROC) load(userptr, "glTexCoordP1uiv"); + glad_glTexCoordP2ui = (PFNGLTEXCOORDP2UIPROC) load(userptr, "glTexCoordP2ui"); + glad_glTexCoordP2uiv = (PFNGLTEXCOORDP2UIVPROC) load(userptr, "glTexCoordP2uiv"); + glad_glTexCoordP3ui = (PFNGLTEXCOORDP3UIPROC) load(userptr, "glTexCoordP3ui"); + glad_glTexCoordP3uiv = (PFNGLTEXCOORDP3UIVPROC) load(userptr, "glTexCoordP3uiv"); + glad_glTexCoordP4ui = (PFNGLTEXCOORDP4UIPROC) load(userptr, "glTexCoordP4ui"); + glad_glTexCoordP4uiv = (PFNGLTEXCOORDP4UIVPROC) load(userptr, "glTexCoordP4uiv"); + glad_glVertexAttribDivisor = (PFNGLVERTEXATTRIBDIVISORPROC) load(userptr, "glVertexAttribDivisor"); + glad_glVertexAttribP1ui = (PFNGLVERTEXATTRIBP1UIPROC) load(userptr, "glVertexAttribP1ui"); + glad_glVertexAttribP1uiv = (PFNGLVERTEXATTRIBP1UIVPROC) load(userptr, "glVertexAttribP1uiv"); + glad_glVertexAttribP2ui = (PFNGLVERTEXATTRIBP2UIPROC) load(userptr, "glVertexAttribP2ui"); + glad_glVertexAttribP2uiv = (PFNGLVERTEXATTRIBP2UIVPROC) load(userptr, "glVertexAttribP2uiv"); + glad_glVertexAttribP3ui = (PFNGLVERTEXATTRIBP3UIPROC) load(userptr, "glVertexAttribP3ui"); + glad_glVertexAttribP3uiv = (PFNGLVERTEXATTRIBP3UIVPROC) load(userptr, "glVertexAttribP3uiv"); + glad_glVertexAttribP4ui = (PFNGLVERTEXATTRIBP4UIPROC) load(userptr, "glVertexAttribP4ui"); + glad_glVertexAttribP4uiv = (PFNGLVERTEXATTRIBP4UIVPROC) load(userptr, "glVertexAttribP4uiv"); + glad_glVertexP2ui = (PFNGLVERTEXP2UIPROC) load(userptr, "glVertexP2ui"); + glad_glVertexP2uiv = (PFNGLVERTEXP2UIVPROC) load(userptr, "glVertexP2uiv"); + glad_glVertexP3ui = (PFNGLVERTEXP3UIPROC) load(userptr, "glVertexP3ui"); + glad_glVertexP3uiv = (PFNGLVERTEXP3UIVPROC) load(userptr, "glVertexP3uiv"); + glad_glVertexP4ui = (PFNGLVERTEXP4UIPROC) load(userptr, "glVertexP4ui"); + glad_glVertexP4uiv = (PFNGLVERTEXP4UIVPROC) load(userptr, "glVertexP4uiv"); +} +static void glad_gl_load_GL_ARB_multisample( GLADuserptrloadfunc load, void* userptr) { + if(!GLAD_GL_ARB_multisample) return; + glad_glSampleCoverageARB = (PFNGLSAMPLECOVERAGEARBPROC) load(userptr, "glSampleCoverageARB"); +} +static void glad_gl_load_GL_ARB_robustness( GLADuserptrloadfunc load, void* userptr) { + if(!GLAD_GL_ARB_robustness) return; + glad_glGetGraphicsResetStatusARB = (PFNGLGETGRAPHICSRESETSTATUSARBPROC) load(userptr, "glGetGraphicsResetStatusARB"); + glad_glGetnColorTableARB = (PFNGLGETNCOLORTABLEARBPROC) load(userptr, "glGetnColorTableARB"); + glad_glGetnCompressedTexImageARB = (PFNGLGETNCOMPRESSEDTEXIMAGEARBPROC) load(userptr, "glGetnCompressedTexImageARB"); + glad_glGetnConvolutionFilterARB = (PFNGLGETNCONVOLUTIONFILTERARBPROC) load(userptr, "glGetnConvolutionFilterARB"); + glad_glGetnHistogramARB = (PFNGLGETNHISTOGRAMARBPROC) load(userptr, "glGetnHistogramARB"); + glad_glGetnMapdvARB = (PFNGLGETNMAPDVARBPROC) load(userptr, "glGetnMapdvARB"); + glad_glGetnMapfvARB = (PFNGLGETNMAPFVARBPROC) load(userptr, "glGetnMapfvARB"); + glad_glGetnMapivARB = (PFNGLGETNMAPIVARBPROC) load(userptr, "glGetnMapivARB"); + glad_glGetnMinmaxARB = (PFNGLGETNMINMAXARBPROC) load(userptr, "glGetnMinmaxARB"); + glad_glGetnPixelMapfvARB = (PFNGLGETNPIXELMAPFVARBPROC) load(userptr, "glGetnPixelMapfvARB"); + glad_glGetnPixelMapuivARB = (PFNGLGETNPIXELMAPUIVARBPROC) load(userptr, "glGetnPixelMapuivARB"); + glad_glGetnPixelMapusvARB = (PFNGLGETNPIXELMAPUSVARBPROC) load(userptr, "glGetnPixelMapusvARB"); + glad_glGetnPolygonStippleARB = (PFNGLGETNPOLYGONSTIPPLEARBPROC) load(userptr, "glGetnPolygonStippleARB"); + glad_glGetnSeparableFilterARB = (PFNGLGETNSEPARABLEFILTERARBPROC) load(userptr, "glGetnSeparableFilterARB"); + glad_glGetnTexImageARB = (PFNGLGETNTEXIMAGEARBPROC) load(userptr, "glGetnTexImageARB"); + glad_glGetnUniformdvARB = (PFNGLGETNUNIFORMDVARBPROC) load(userptr, "glGetnUniformdvARB"); + glad_glGetnUniformfvARB = (PFNGLGETNUNIFORMFVARBPROC) load(userptr, "glGetnUniformfvARB"); + glad_glGetnUniformivARB = (PFNGLGETNUNIFORMIVARBPROC) load(userptr, "glGetnUniformivARB"); + glad_glGetnUniformuivARB = (PFNGLGETNUNIFORMUIVARBPROC) load(userptr, "glGetnUniformuivARB"); + glad_glReadnPixelsARB = (PFNGLREADNPIXELSARBPROC) load(userptr, "glReadnPixelsARB"); +} +static void glad_gl_load_GL_KHR_debug( GLADuserptrloadfunc load, void* userptr) { + if(!GLAD_GL_KHR_debug) return; + glad_glDebugMessageCallback = (PFNGLDEBUGMESSAGECALLBACKPROC) load(userptr, "glDebugMessageCallback"); + glad_glDebugMessageControl = (PFNGLDEBUGMESSAGECONTROLPROC) load(userptr, "glDebugMessageControl"); + glad_glDebugMessageInsert = (PFNGLDEBUGMESSAGEINSERTPROC) load(userptr, "glDebugMessageInsert"); + glad_glGetDebugMessageLog = (PFNGLGETDEBUGMESSAGELOGPROC) load(userptr, "glGetDebugMessageLog"); + glad_glGetObjectLabel = (PFNGLGETOBJECTLABELPROC) load(userptr, "glGetObjectLabel"); + glad_glGetObjectPtrLabel = (PFNGLGETOBJECTPTRLABELPROC) load(userptr, "glGetObjectPtrLabel"); + glad_glGetPointerv = (PFNGLGETPOINTERVPROC) load(userptr, "glGetPointerv"); + glad_glObjectLabel = (PFNGLOBJECTLABELPROC) load(userptr, "glObjectLabel"); + glad_glObjectPtrLabel = (PFNGLOBJECTPTRLABELPROC) load(userptr, "glObjectPtrLabel"); + glad_glPopDebugGroup = (PFNGLPOPDEBUGGROUPPROC) load(userptr, "glPopDebugGroup"); + glad_glPushDebugGroup = (PFNGLPUSHDEBUGGROUPPROC) load(userptr, "glPushDebugGroup"); +} + + + +#if defined(GL_ES_VERSION_3_0) || defined(GL_VERSION_3_0) +#define GLAD_GL_IS_SOME_NEW_VERSION 1 +#else +#define GLAD_GL_IS_SOME_NEW_VERSION 0 +#endif + +static int glad_gl_get_extensions( int version, const char **out_exts, unsigned int *out_num_exts_i, char ***out_exts_i) { +#if GLAD_GL_IS_SOME_NEW_VERSION + if(GLAD_VERSION_MAJOR(version) < 3) { +#else + (void) version; + (void) out_num_exts_i; + (void) out_exts_i; #endif + if (glad_glGetString == NULL) { + return 0; + } + *out_exts = (const char *)glad_glGetString(GL_EXTENSIONS); +#if GLAD_GL_IS_SOME_NEW_VERSION + } else { + unsigned int index = 0; + unsigned int num_exts_i = 0; + char **exts_i = NULL; + if (glad_glGetStringi == NULL || glad_glGetIntegerv == NULL) { + return 0; + } + glad_glGetIntegerv(GL_NUM_EXTENSIONS, (int*) &num_exts_i); + if (num_exts_i > 0) { + exts_i = (char **) malloc(num_exts_i * (sizeof *exts_i)); + } + if (exts_i == NULL) { + return 0; + } + for(index = 0; index < num_exts_i; index++) { + const char *gl_str_tmp = (const char*) glad_glGetStringi(GL_EXTENSIONS, index); + size_t len = strlen(gl_str_tmp) + 1; + + char *local_str = (char*) malloc(len * sizeof(char)); + if(local_str != NULL) { + memcpy(local_str, gl_str_tmp, len * sizeof(char)); + } + + exts_i[index] = local_str; + } + + *out_num_exts_i = num_exts_i; + *out_exts_i = exts_i; + } +#endif + return 1; +} +static void glad_gl_free_extensions(char **exts_i, unsigned int num_exts_i) { + if (exts_i != NULL) { + unsigned int index; + for(index = 0; index < num_exts_i; index++) { + free((void *) (exts_i[index])); + } + free((void *)exts_i); + exts_i = NULL; + } +} +static int glad_gl_has_extension(int version, const char *exts, unsigned int num_exts_i, char **exts_i, const char *ext) { + if(GLAD_VERSION_MAJOR(version) < 3 || !GLAD_GL_IS_SOME_NEW_VERSION) { + const char *extensions; + const char *loc; + const char *terminator; + extensions = exts; + if(extensions == NULL || ext == NULL) { + return 0; + } + while(1) { + loc = strstr(extensions, ext); + if(loc == NULL) { + return 0; + } + terminator = loc + strlen(ext); + if((loc == extensions || *(loc - 1) == ' ') && + (*terminator == ' ' || *terminator == '\0')) { + return 1; + } + extensions = terminator; + } + } else { + unsigned int index; + for(index = 0; index < num_exts_i; index++) { + const char *e = exts_i[index]; + if(strcmp(e, ext) == 0) { + return 1; + } + } + } + return 0; +} + +static GLADapiproc glad_gl_get_proc_from_userptr(void *userptr, const char* name) { + return (GLAD_GNUC_EXTENSION (GLADapiproc (*)(const char *name)) userptr)(name); +} + +static int glad_gl_find_extensions_gl( int version) { + const char *exts = NULL; + unsigned int num_exts_i = 0; + char **exts_i = NULL; + if (!glad_gl_get_extensions(version, &exts, &num_exts_i, &exts_i)) return 0; + + GLAD_GL_ARB_multisample = glad_gl_has_extension(version, exts, num_exts_i, exts_i, "GL_ARB_multisample"); + GLAD_GL_ARB_robustness = glad_gl_has_extension(version, exts, num_exts_i, exts_i, "GL_ARB_robustness"); + GLAD_GL_KHR_debug = glad_gl_has_extension(version, exts, num_exts_i, exts_i, "GL_KHR_debug"); + + glad_gl_free_extensions(exts_i, num_exts_i); + + return 1; +} + +static int glad_gl_find_core_gl(void) { + int i; + const char* version; + const char* prefixes[] = { + "OpenGL ES-CM ", + "OpenGL ES-CL ", + "OpenGL ES ", + "OpenGL SC ", + NULL + }; + int major = 0; + int minor = 0; + version = (const char*) glad_glGetString(GL_VERSION); + if (!version) return 0; + for (i = 0; prefixes[i]; i++) { + const size_t length = strlen(prefixes[i]); + if (strncmp(version, prefixes[i], length) == 0) { + version += length; + break; + } + } + + GLAD_IMPL_UTIL_SSCANF(version, "%d.%d", &major, &minor); + + GLAD_GL_VERSION_1_0 = (major == 1 && minor >= 0) || major > 1; + GLAD_GL_VERSION_1_1 = (major == 1 && minor >= 1) || major > 1; + GLAD_GL_VERSION_1_2 = (major == 1 && minor >= 2) || major > 1; + GLAD_GL_VERSION_1_3 = (major == 1 && minor >= 3) || major > 1; + GLAD_GL_VERSION_1_4 = (major == 1 && minor >= 4) || major > 1; + GLAD_GL_VERSION_1_5 = (major == 1 && minor >= 5) || major > 1; + GLAD_GL_VERSION_2_0 = (major == 2 && minor >= 0) || major > 2; + GLAD_GL_VERSION_2_1 = (major == 2 && minor >= 1) || major > 2; + GLAD_GL_VERSION_3_0 = (major == 3 && minor >= 0) || major > 3; + GLAD_GL_VERSION_3_1 = (major == 3 && minor >= 1) || major > 3; + GLAD_GL_VERSION_3_2 = (major == 3 && minor >= 2) || major > 3; + GLAD_GL_VERSION_3_3 = (major == 3 && minor >= 3) || major > 3; + + return GLAD_MAKE_VERSION(major, minor); +} + +int gladLoadGLUserPtr( GLADuserptrloadfunc load, void *userptr) { + int version; + + glad_glGetString = (PFNGLGETSTRINGPROC) load(userptr, "glGetString"); + if(glad_glGetString == NULL) return 0; + if(glad_glGetString(GL_VERSION) == NULL) return 0; + version = glad_gl_find_core_gl(); + + glad_gl_load_GL_VERSION_1_0(load, userptr); + glad_gl_load_GL_VERSION_1_1(load, userptr); + glad_gl_load_GL_VERSION_1_2(load, userptr); + glad_gl_load_GL_VERSION_1_3(load, userptr); + glad_gl_load_GL_VERSION_1_4(load, userptr); + glad_gl_load_GL_VERSION_1_5(load, userptr); + glad_gl_load_GL_VERSION_2_0(load, userptr); + glad_gl_load_GL_VERSION_2_1(load, userptr); + glad_gl_load_GL_VERSION_3_0(load, userptr); + glad_gl_load_GL_VERSION_3_1(load, userptr); + glad_gl_load_GL_VERSION_3_2(load, userptr); + glad_gl_load_GL_VERSION_3_3(load, userptr); + + if (!glad_gl_find_extensions_gl(version)) return 0; + glad_gl_load_GL_ARB_multisample(load, userptr); + glad_gl_load_GL_ARB_robustness(load, userptr); + glad_gl_load_GL_KHR_debug(load, userptr); + + + + return version; +} + + +int gladLoadGL( GLADloadfunc load) { + return gladLoadGLUserPtr( glad_gl_get_proc_from_userptr, GLAD_GNUC_EXTENSION (void*) load); +} + + + + + + +#ifdef __cplusplus +} #endif + +#endif /* GLAD_GL_IMPLEMENTATION */ + diff --git a/thirdparty/glfw/deps/glad/gles2.h b/thirdparty/glfw/deps/glad/gles2.h new file mode 100644 index 000000000..d67f11078 --- /dev/null +++ b/thirdparty/glfw/deps/glad/gles2.h @@ -0,0 +1,1805 @@ +/** + * Loader generated by glad 2.0.0-beta on Tue Aug 24 22:51:42 2021 + * + * Generator: C/C++ + * Specification: gl + * Extensions: 0 + * + * APIs: + * - gles2=2.0 + * + * Options: + * - ALIAS = False + * - DEBUG = False + * - HEADER_ONLY = True + * - LOADER = False + * - MX = False + * - MX_GLOBAL = False + * - ON_DEMAND = False + * + * Commandline: + * --api='gles2=2.0' --extensions='' c --header-only + * + * Online: + * http://glad.sh/#api=gles2%3D2.0&extensions=&generator=c&options=HEADER_ONLY + * + */ + +#ifndef GLAD_GLES2_H_ +#define GLAD_GLES2_H_ + +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wreserved-id-macro" +#endif +#ifdef __gl2_h_ + #error OpenGL ES 2 header already included (API: gles2), remove previous include! +#endif +#define __gl2_h_ 1 +#ifdef __gl3_h_ + #error OpenGL ES 3 header already included (API: gles2), remove previous include! +#endif +#define __gl3_h_ 1 +#ifdef __clang__ +#pragma clang diagnostic pop +#endif + +#define GLAD_GLES2 +#define GLAD_OPTION_GLES2_HEADER_ONLY + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef GLAD_PLATFORM_H_ +#define GLAD_PLATFORM_H_ + +#ifndef GLAD_PLATFORM_WIN32 + #if defined(_WIN32) || defined(__WIN32__) || defined(WIN32) || defined(__MINGW32__) + #define GLAD_PLATFORM_WIN32 1 + #else + #define GLAD_PLATFORM_WIN32 0 + #endif +#endif + +#ifndef GLAD_PLATFORM_APPLE + #ifdef __APPLE__ + #define GLAD_PLATFORM_APPLE 1 + #else + #define GLAD_PLATFORM_APPLE 0 + #endif +#endif + +#ifndef GLAD_PLATFORM_EMSCRIPTEN + #ifdef __EMSCRIPTEN__ + #define GLAD_PLATFORM_EMSCRIPTEN 1 + #else + #define GLAD_PLATFORM_EMSCRIPTEN 0 + #endif +#endif + +#ifndef GLAD_PLATFORM_UWP + #if defined(_MSC_VER) && !defined(GLAD_INTERNAL_HAVE_WINAPIFAMILY) + #ifdef __has_include + #if __has_include() + #define GLAD_INTERNAL_HAVE_WINAPIFAMILY 1 + #endif + #elif _MSC_VER >= 1700 && !_USING_V110_SDK71_ + #define GLAD_INTERNAL_HAVE_WINAPIFAMILY 1 + #endif + #endif + + #ifdef GLAD_INTERNAL_HAVE_WINAPIFAMILY + #include + #if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) && WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) + #define GLAD_PLATFORM_UWP 1 + #endif + #endif + + #ifndef GLAD_PLATFORM_UWP + #define GLAD_PLATFORM_UWP 0 + #endif +#endif + +#ifdef __GNUC__ + #define GLAD_GNUC_EXTENSION __extension__ +#else + #define GLAD_GNUC_EXTENSION +#endif + +#ifndef GLAD_API_CALL + #if defined(GLAD_API_CALL_EXPORT) + #if GLAD_PLATFORM_WIN32 || defined(__CYGWIN__) + #if defined(GLAD_API_CALL_EXPORT_BUILD) + #if defined(__GNUC__) + #define GLAD_API_CALL __attribute__ ((dllexport)) extern + #else + #define GLAD_API_CALL __declspec(dllexport) extern + #endif + #else + #if defined(__GNUC__) + #define GLAD_API_CALL __attribute__ ((dllimport)) extern + #else + #define GLAD_API_CALL __declspec(dllimport) extern + #endif + #endif + #elif defined(__GNUC__) && defined(GLAD_API_CALL_EXPORT_BUILD) + #define GLAD_API_CALL __attribute__ ((visibility ("default"))) extern + #else + #define GLAD_API_CALL extern + #endif + #else + #define GLAD_API_CALL extern + #endif +#endif + +#ifdef APIENTRY + #define GLAD_API_PTR APIENTRY +#elif GLAD_PLATFORM_WIN32 + #define GLAD_API_PTR __stdcall +#else + #define GLAD_API_PTR +#endif + +#ifndef GLAPI +#define GLAPI GLAD_API_CALL +#endif + +#ifndef GLAPIENTRY +#define GLAPIENTRY GLAD_API_PTR +#endif + +#define GLAD_MAKE_VERSION(major, minor) (major * 10000 + minor) +#define GLAD_VERSION_MAJOR(version) (version / 10000) +#define GLAD_VERSION_MINOR(version) (version % 10000) + +#define GLAD_GENERATOR_VERSION "2.0.0-beta" + +typedef void (*GLADapiproc)(void); + +typedef GLADapiproc (*GLADloadfunc)(const char *name); +typedef GLADapiproc (*GLADuserptrloadfunc)(void *userptr, const char *name); + +typedef void (*GLADprecallback)(const char *name, GLADapiproc apiproc, int len_args, ...); +typedef void (*GLADpostcallback)(void *ret, const char *name, GLADapiproc apiproc, int len_args, ...); + +#endif /* GLAD_PLATFORM_H_ */ + +#define GL_ACTIVE_ATTRIBUTES 0x8B89 +#define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH 0x8B8A +#define GL_ACTIVE_TEXTURE 0x84E0 +#define GL_ACTIVE_UNIFORMS 0x8B86 +#define GL_ACTIVE_UNIFORM_MAX_LENGTH 0x8B87 +#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E +#define GL_ALIASED_POINT_SIZE_RANGE 0x846D +#define GL_ALPHA 0x1906 +#define GL_ALPHA_BITS 0x0D55 +#define GL_ALWAYS 0x0207 +#define GL_ARRAY_BUFFER 0x8892 +#define GL_ARRAY_BUFFER_BINDING 0x8894 +#define GL_ATTACHED_SHADERS 0x8B85 +#define GL_BACK 0x0405 +#define GL_BLEND 0x0BE2 +#define GL_BLEND_COLOR 0x8005 +#define GL_BLEND_DST_ALPHA 0x80CA +#define GL_BLEND_DST_RGB 0x80C8 +#define GL_BLEND_EQUATION 0x8009 +#define GL_BLEND_EQUATION_ALPHA 0x883D +#define GL_BLEND_EQUATION_RGB 0x8009 +#define GL_BLEND_SRC_ALPHA 0x80CB +#define GL_BLEND_SRC_RGB 0x80C9 +#define GL_BLUE_BITS 0x0D54 +#define GL_BOOL 0x8B56 +#define GL_BOOL_VEC2 0x8B57 +#define GL_BOOL_VEC3 0x8B58 +#define GL_BOOL_VEC4 0x8B59 +#define GL_BUFFER_SIZE 0x8764 +#define GL_BUFFER_USAGE 0x8765 +#define GL_BYTE 0x1400 +#define GL_CCW 0x0901 +#define GL_CLAMP_TO_EDGE 0x812F +#define GL_COLOR_ATTACHMENT0 0x8CE0 +#define GL_COLOR_BUFFER_BIT 0x00004000 +#define GL_COLOR_CLEAR_VALUE 0x0C22 +#define GL_COLOR_WRITEMASK 0x0C23 +#define GL_COMPILE_STATUS 0x8B81 +#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3 +#define GL_CONSTANT_ALPHA 0x8003 +#define GL_CONSTANT_COLOR 0x8001 +#define GL_CULL_FACE 0x0B44 +#define GL_CULL_FACE_MODE 0x0B45 +#define GL_CURRENT_PROGRAM 0x8B8D +#define GL_CURRENT_VERTEX_ATTRIB 0x8626 +#define GL_CW 0x0900 +#define GL_DECR 0x1E03 +#define GL_DECR_WRAP 0x8508 +#define GL_DELETE_STATUS 0x8B80 +#define GL_DEPTH_ATTACHMENT 0x8D00 +#define GL_DEPTH_BITS 0x0D56 +#define GL_DEPTH_BUFFER_BIT 0x00000100 +#define GL_DEPTH_CLEAR_VALUE 0x0B73 +#define GL_DEPTH_COMPONENT 0x1902 +#define GL_DEPTH_COMPONENT16 0x81A5 +#define GL_DEPTH_FUNC 0x0B74 +#define GL_DEPTH_RANGE 0x0B70 +#define GL_DEPTH_TEST 0x0B71 +#define GL_DEPTH_WRITEMASK 0x0B72 +#define GL_DITHER 0x0BD0 +#define GL_DONT_CARE 0x1100 +#define GL_DST_ALPHA 0x0304 +#define GL_DST_COLOR 0x0306 +#define GL_DYNAMIC_DRAW 0x88E8 +#define GL_ELEMENT_ARRAY_BUFFER 0x8893 +#define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895 +#define GL_EQUAL 0x0202 +#define GL_EXTENSIONS 0x1F03 +#define GL_FALSE 0 +#define GL_FASTEST 0x1101 +#define GL_FIXED 0x140C +#define GL_FLOAT 0x1406 +#define GL_FLOAT_MAT2 0x8B5A +#define GL_FLOAT_MAT3 0x8B5B +#define GL_FLOAT_MAT4 0x8B5C +#define GL_FLOAT_VEC2 0x8B50 +#define GL_FLOAT_VEC3 0x8B51 +#define GL_FLOAT_VEC4 0x8B52 +#define GL_FRAGMENT_SHADER 0x8B30 +#define GL_FRAMEBUFFER 0x8D40 +#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME 0x8CD1 +#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE 0x8CD0 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE 0x8CD3 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL 0x8CD2 +#define GL_FRAMEBUFFER_BINDING 0x8CA6 +#define GL_FRAMEBUFFER_COMPLETE 0x8CD5 +#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT 0x8CD6 +#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS 0x8CD9 +#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT 0x8CD7 +#define GL_FRAMEBUFFER_UNSUPPORTED 0x8CDD +#define GL_FRONT 0x0404 +#define GL_FRONT_AND_BACK 0x0408 +#define GL_FRONT_FACE 0x0B46 +#define GL_FUNC_ADD 0x8006 +#define GL_FUNC_REVERSE_SUBTRACT 0x800B +#define GL_FUNC_SUBTRACT 0x800A +#define GL_GENERATE_MIPMAP_HINT 0x8192 +#define GL_GEQUAL 0x0206 +#define GL_GREATER 0x0204 +#define GL_GREEN_BITS 0x0D53 +#define GL_HIGH_FLOAT 0x8DF2 +#define GL_HIGH_INT 0x8DF5 +#define GL_IMPLEMENTATION_COLOR_READ_FORMAT 0x8B9B +#define GL_IMPLEMENTATION_COLOR_READ_TYPE 0x8B9A +#define GL_INCR 0x1E02 +#define GL_INCR_WRAP 0x8507 +#define GL_INFO_LOG_LENGTH 0x8B84 +#define GL_INT 0x1404 +#define GL_INT_VEC2 0x8B53 +#define GL_INT_VEC3 0x8B54 +#define GL_INT_VEC4 0x8B55 +#define GL_INVALID_ENUM 0x0500 +#define GL_INVALID_FRAMEBUFFER_OPERATION 0x0506 +#define GL_INVALID_OPERATION 0x0502 +#define GL_INVALID_VALUE 0x0501 +#define GL_INVERT 0x150A +#define GL_KEEP 0x1E00 +#define GL_LEQUAL 0x0203 +#define GL_LESS 0x0201 +#define GL_LINEAR 0x2601 +#define GL_LINEAR_MIPMAP_LINEAR 0x2703 +#define GL_LINEAR_MIPMAP_NEAREST 0x2701 +#define GL_LINES 0x0001 +#define GL_LINE_LOOP 0x0002 +#define GL_LINE_STRIP 0x0003 +#define GL_LINE_WIDTH 0x0B21 +#define GL_LINK_STATUS 0x8B82 +#define GL_LOW_FLOAT 0x8DF0 +#define GL_LOW_INT 0x8DF3 +#define GL_LUMINANCE 0x1909 +#define GL_LUMINANCE_ALPHA 0x190A +#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 0x8B4D +#define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C +#define GL_MAX_FRAGMENT_UNIFORM_VECTORS 0x8DFD +#define GL_MAX_RENDERBUFFER_SIZE 0x84E8 +#define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872 +#define GL_MAX_TEXTURE_SIZE 0x0D33 +#define GL_MAX_VARYING_VECTORS 0x8DFC +#define GL_MAX_VERTEX_ATTRIBS 0x8869 +#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 0x8B4C +#define GL_MAX_VERTEX_UNIFORM_VECTORS 0x8DFB +#define GL_MAX_VIEWPORT_DIMS 0x0D3A +#define GL_MEDIUM_FLOAT 0x8DF1 +#define GL_MEDIUM_INT 0x8DF4 +#define GL_MIRRORED_REPEAT 0x8370 +#define GL_NEAREST 0x2600 +#define GL_NEAREST_MIPMAP_LINEAR 0x2702 +#define GL_NEAREST_MIPMAP_NEAREST 0x2700 +#define GL_NEVER 0x0200 +#define GL_NICEST 0x1102 +#define GL_NONE 0 +#define GL_NOTEQUAL 0x0205 +#define GL_NO_ERROR 0 +#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2 +#define GL_NUM_SHADER_BINARY_FORMATS 0x8DF9 +#define GL_ONE 1 +#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004 +#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002 +#define GL_ONE_MINUS_DST_ALPHA 0x0305 +#define GL_ONE_MINUS_DST_COLOR 0x0307 +#define GL_ONE_MINUS_SRC_ALPHA 0x0303 +#define GL_ONE_MINUS_SRC_COLOR 0x0301 +#define GL_OUT_OF_MEMORY 0x0505 +#define GL_PACK_ALIGNMENT 0x0D05 +#define GL_POINTS 0x0000 +#define GL_POLYGON_OFFSET_FACTOR 0x8038 +#define GL_POLYGON_OFFSET_FILL 0x8037 +#define GL_POLYGON_OFFSET_UNITS 0x2A00 +#define GL_RED_BITS 0x0D52 +#define GL_RENDERBUFFER 0x8D41 +#define GL_RENDERBUFFER_ALPHA_SIZE 0x8D53 +#define GL_RENDERBUFFER_BINDING 0x8CA7 +#define GL_RENDERBUFFER_BLUE_SIZE 0x8D52 +#define GL_RENDERBUFFER_DEPTH_SIZE 0x8D54 +#define GL_RENDERBUFFER_GREEN_SIZE 0x8D51 +#define GL_RENDERBUFFER_HEIGHT 0x8D43 +#define GL_RENDERBUFFER_INTERNAL_FORMAT 0x8D44 +#define GL_RENDERBUFFER_RED_SIZE 0x8D50 +#define GL_RENDERBUFFER_STENCIL_SIZE 0x8D55 +#define GL_RENDERBUFFER_WIDTH 0x8D42 +#define GL_RENDERER 0x1F01 +#define GL_REPEAT 0x2901 +#define GL_REPLACE 0x1E01 +#define GL_RGB 0x1907 +#define GL_RGB565 0x8D62 +#define GL_RGB5_A1 0x8057 +#define GL_RGBA 0x1908 +#define GL_RGBA4 0x8056 +#define GL_SAMPLER_2D 0x8B5E +#define GL_SAMPLER_CUBE 0x8B60 +#define GL_SAMPLES 0x80A9 +#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E +#define GL_SAMPLE_BUFFERS 0x80A8 +#define GL_SAMPLE_COVERAGE 0x80A0 +#define GL_SAMPLE_COVERAGE_INVERT 0x80AB +#define GL_SAMPLE_COVERAGE_VALUE 0x80AA +#define GL_SCISSOR_BOX 0x0C10 +#define GL_SCISSOR_TEST 0x0C11 +#define GL_SHADER_BINARY_FORMATS 0x8DF8 +#define GL_SHADER_COMPILER 0x8DFA +#define GL_SHADER_SOURCE_LENGTH 0x8B88 +#define GL_SHADER_TYPE 0x8B4F +#define GL_SHADING_LANGUAGE_VERSION 0x8B8C +#define GL_SHORT 0x1402 +#define GL_SRC_ALPHA 0x0302 +#define GL_SRC_ALPHA_SATURATE 0x0308 +#define GL_SRC_COLOR 0x0300 +#define GL_STATIC_DRAW 0x88E4 +#define GL_STENCIL_ATTACHMENT 0x8D20 +#define GL_STENCIL_BACK_FAIL 0x8801 +#define GL_STENCIL_BACK_FUNC 0x8800 +#define GL_STENCIL_BACK_PASS_DEPTH_FAIL 0x8802 +#define GL_STENCIL_BACK_PASS_DEPTH_PASS 0x8803 +#define GL_STENCIL_BACK_REF 0x8CA3 +#define GL_STENCIL_BACK_VALUE_MASK 0x8CA4 +#define GL_STENCIL_BACK_WRITEMASK 0x8CA5 +#define GL_STENCIL_BITS 0x0D57 +#define GL_STENCIL_BUFFER_BIT 0x00000400 +#define GL_STENCIL_CLEAR_VALUE 0x0B91 +#define GL_STENCIL_FAIL 0x0B94 +#define GL_STENCIL_FUNC 0x0B92 +#define GL_STENCIL_INDEX8 0x8D48 +#define GL_STENCIL_PASS_DEPTH_FAIL 0x0B95 +#define GL_STENCIL_PASS_DEPTH_PASS 0x0B96 +#define GL_STENCIL_REF 0x0B97 +#define GL_STENCIL_TEST 0x0B90 +#define GL_STENCIL_VALUE_MASK 0x0B93 +#define GL_STENCIL_WRITEMASK 0x0B98 +#define GL_STREAM_DRAW 0x88E0 +#define GL_SUBPIXEL_BITS 0x0D50 +#define GL_TEXTURE 0x1702 +#define GL_TEXTURE0 0x84C0 +#define GL_TEXTURE1 0x84C1 +#define GL_TEXTURE10 0x84CA +#define GL_TEXTURE11 0x84CB +#define GL_TEXTURE12 0x84CC +#define GL_TEXTURE13 0x84CD +#define GL_TEXTURE14 0x84CE +#define GL_TEXTURE15 0x84CF +#define GL_TEXTURE16 0x84D0 +#define GL_TEXTURE17 0x84D1 +#define GL_TEXTURE18 0x84D2 +#define GL_TEXTURE19 0x84D3 +#define GL_TEXTURE2 0x84C2 +#define GL_TEXTURE20 0x84D4 +#define GL_TEXTURE21 0x84D5 +#define GL_TEXTURE22 0x84D6 +#define GL_TEXTURE23 0x84D7 +#define GL_TEXTURE24 0x84D8 +#define GL_TEXTURE25 0x84D9 +#define GL_TEXTURE26 0x84DA +#define GL_TEXTURE27 0x84DB +#define GL_TEXTURE28 0x84DC +#define GL_TEXTURE29 0x84DD +#define GL_TEXTURE3 0x84C3 +#define GL_TEXTURE30 0x84DE +#define GL_TEXTURE31 0x84DF +#define GL_TEXTURE4 0x84C4 +#define GL_TEXTURE5 0x84C5 +#define GL_TEXTURE6 0x84C6 +#define GL_TEXTURE7 0x84C7 +#define GL_TEXTURE8 0x84C8 +#define GL_TEXTURE9 0x84C9 +#define GL_TEXTURE_2D 0x0DE1 +#define GL_TEXTURE_BINDING_2D 0x8069 +#define GL_TEXTURE_BINDING_CUBE_MAP 0x8514 +#define GL_TEXTURE_CUBE_MAP 0x8513 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A +#define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519 +#define GL_TEXTURE_MAG_FILTER 0x2800 +#define GL_TEXTURE_MIN_FILTER 0x2801 +#define GL_TEXTURE_WRAP_S 0x2802 +#define GL_TEXTURE_WRAP_T 0x2803 +#define GL_TRIANGLES 0x0004 +#define GL_TRIANGLE_FAN 0x0006 +#define GL_TRIANGLE_STRIP 0x0005 +#define GL_TRUE 1 +#define GL_UNPACK_ALIGNMENT 0x0CF5 +#define GL_UNSIGNED_BYTE 0x1401 +#define GL_UNSIGNED_INT 0x1405 +#define GL_UNSIGNED_SHORT 0x1403 +#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033 +#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034 +#define GL_UNSIGNED_SHORT_5_6_5 0x8363 +#define GL_VALIDATE_STATUS 0x8B83 +#define GL_VENDOR 0x1F00 +#define GL_VERSION 0x1F02 +#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0x889F +#define GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622 +#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A +#define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645 +#define GL_VERTEX_ATTRIB_ARRAY_SIZE 0x8623 +#define GL_VERTEX_ATTRIB_ARRAY_STRIDE 0x8624 +#define GL_VERTEX_ATTRIB_ARRAY_TYPE 0x8625 +#define GL_VERTEX_SHADER 0x8B31 +#define GL_VIEWPORT 0x0BA2 +#define GL_ZERO 0 + + +#ifndef __khrplatform_h_ +#define __khrplatform_h_ + +/* +** Copyright (c) 2008-2018 The Khronos Group Inc. +** +** Permission is hereby granted, free of charge, to any person obtaining a +** copy of this software and/or associated documentation files (the +** "Materials"), to deal in the Materials without restriction, including +** without limitation the rights to use, copy, modify, merge, publish, +** distribute, sublicense, and/or sell copies of the Materials, and to +** permit persons to whom the Materials are furnished to do so, subject to +** the following conditions: +** +** The above copyright notice and this permission notice shall be included +** in all copies or substantial portions of the Materials. +** +** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. +*/ + +/* Khronos platform-specific types and definitions. + * + * The master copy of khrplatform.h is maintained in the Khronos EGL + * Registry repository at https://github.com/KhronosGroup/EGL-Registry + * The last semantic modification to khrplatform.h was at commit ID: + * 67a3e0864c2d75ea5287b9f3d2eb74a745936692 + * + * Adopters may modify this file to suit their platform. Adopters are + * encouraged to submit platform specific modifications to the Khronos + * group so that they can be included in future versions of this file. + * Please submit changes by filing pull requests or issues on + * the EGL Registry repository linked above. + * + * + * See the Implementer's Guidelines for information about where this file + * should be located on your system and for more details of its use: + * http://www.khronos.org/registry/implementers_guide.pdf + * + * This file should be included as + * #include + * by Khronos client API header files that use its types and defines. + * + * The types in khrplatform.h should only be used to define API-specific types. + * + * Types defined in khrplatform.h: + * khronos_int8_t signed 8 bit + * khronos_uint8_t unsigned 8 bit + * khronos_int16_t signed 16 bit + * khronos_uint16_t unsigned 16 bit + * khronos_int32_t signed 32 bit + * khronos_uint32_t unsigned 32 bit + * khronos_int64_t signed 64 bit + * khronos_uint64_t unsigned 64 bit + * khronos_intptr_t signed same number of bits as a pointer + * khronos_uintptr_t unsigned same number of bits as a pointer + * khronos_ssize_t signed size + * khronos_usize_t unsigned size + * khronos_float_t signed 32 bit floating point + * khronos_time_ns_t unsigned 64 bit time in nanoseconds + * khronos_utime_nanoseconds_t unsigned time interval or absolute time in + * nanoseconds + * khronos_stime_nanoseconds_t signed time interval in nanoseconds + * khronos_boolean_enum_t enumerated boolean type. This should + * only be used as a base type when a client API's boolean type is + * an enum. Client APIs which use an integer or other type for + * booleans cannot use this as the base type for their boolean. + * + * Tokens defined in khrplatform.h: + * + * KHRONOS_FALSE, KHRONOS_TRUE Enumerated boolean false/true values. + * + * KHRONOS_SUPPORT_INT64 is 1 if 64 bit integers are supported; otherwise 0. + * KHRONOS_SUPPORT_FLOAT is 1 if floats are supported; otherwise 0. + * + * Calling convention macros defined in this file: + * KHRONOS_APICALL + * KHRONOS_GLAD_API_PTR + * KHRONOS_APIATTRIBUTES + * + * These may be used in function prototypes as: + * + * KHRONOS_APICALL void KHRONOS_GLAD_API_PTR funcname( + * int arg1, + * int arg2) KHRONOS_APIATTRIBUTES; + */ + +#if defined(__SCITECH_SNAP__) && !defined(KHRONOS_STATIC) +# define KHRONOS_STATIC 1 +#endif + +/*------------------------------------------------------------------------- + * Definition of KHRONOS_APICALL + *------------------------------------------------------------------------- + * This precedes the return type of the function in the function prototype. + */ +#if defined(KHRONOS_STATIC) + /* If the preprocessor constant KHRONOS_STATIC is defined, make the + * header compatible with static linking. */ +# define KHRONOS_APICALL +#elif defined(_WIN32) +# define KHRONOS_APICALL __declspec(dllimport) +#elif defined (__SYMBIAN32__) +# define KHRONOS_APICALL IMPORT_C +#elif defined(__ANDROID__) +# define KHRONOS_APICALL __attribute__((visibility("default"))) +#else +# define KHRONOS_APICALL +#endif + +/*------------------------------------------------------------------------- + * Definition of KHRONOS_GLAD_API_PTR + *------------------------------------------------------------------------- + * This follows the return type of the function and precedes the function + * name in the function prototype. + */ +#if defined(_WIN32) && !defined(_WIN32_WCE) && !defined(__SCITECH_SNAP__) + /* Win32 but not WinCE */ +# define KHRONOS_GLAD_API_PTR __stdcall +#else +# define KHRONOS_GLAD_API_PTR +#endif + +/*------------------------------------------------------------------------- + * Definition of KHRONOS_APIATTRIBUTES + *------------------------------------------------------------------------- + * This follows the closing parenthesis of the function prototype arguments. + */ +#if defined (__ARMCC_2__) +#define KHRONOS_APIATTRIBUTES __softfp +#else +#define KHRONOS_APIATTRIBUTES +#endif + +/*------------------------------------------------------------------------- + * basic type definitions + *-----------------------------------------------------------------------*/ +#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__GNUC__) || defined(__SCO__) || defined(__USLC__) + + +/* + * Using + */ +#include +typedef int32_t khronos_int32_t; +typedef uint32_t khronos_uint32_t; +typedef int64_t khronos_int64_t; +typedef uint64_t khronos_uint64_t; +#define KHRONOS_SUPPORT_INT64 1 +#define KHRONOS_SUPPORT_FLOAT 1 + +#elif defined(__VMS ) || defined(__sgi) + +/* + * Using + */ +#include +typedef int32_t khronos_int32_t; +typedef uint32_t khronos_uint32_t; +typedef int64_t khronos_int64_t; +typedef uint64_t khronos_uint64_t; +#define KHRONOS_SUPPORT_INT64 1 +#define KHRONOS_SUPPORT_FLOAT 1 + +#elif defined(_WIN32) && !defined(__SCITECH_SNAP__) + +/* + * Win32 + */ +typedef __int32 khronos_int32_t; +typedef unsigned __int32 khronos_uint32_t; +typedef __int64 khronos_int64_t; +typedef unsigned __int64 khronos_uint64_t; +#define KHRONOS_SUPPORT_INT64 1 +#define KHRONOS_SUPPORT_FLOAT 1 + +#elif defined(__sun__) || defined(__digital__) + +/* + * Sun or Digital + */ +typedef int khronos_int32_t; +typedef unsigned int khronos_uint32_t; +#if defined(__arch64__) || defined(_LP64) +typedef long int khronos_int64_t; +typedef unsigned long int khronos_uint64_t; +#else +typedef long long int khronos_int64_t; +typedef unsigned long long int khronos_uint64_t; +#endif /* __arch64__ */ +#define KHRONOS_SUPPORT_INT64 1 +#define KHRONOS_SUPPORT_FLOAT 1 + +#elif 0 + +/* + * Hypothetical platform with no float or int64 support + */ +typedef int khronos_int32_t; +typedef unsigned int khronos_uint32_t; +#define KHRONOS_SUPPORT_INT64 0 +#define KHRONOS_SUPPORT_FLOAT 0 + +#else + +/* + * Generic fallback + */ +#include +typedef int32_t khronos_int32_t; +typedef uint32_t khronos_uint32_t; +typedef int64_t khronos_int64_t; +typedef uint64_t khronos_uint64_t; +#define KHRONOS_SUPPORT_INT64 1 +#define KHRONOS_SUPPORT_FLOAT 1 + +#endif + + +/* + * Types that are (so far) the same on all platforms + */ +typedef signed char khronos_int8_t; +typedef unsigned char khronos_uint8_t; +typedef signed short int khronos_int16_t; +typedef unsigned short int khronos_uint16_t; + +/* + * Types that differ between LLP64 and LP64 architectures - in LLP64, + * pointers are 64 bits, but 'long' is still 32 bits. Win64 appears + * to be the only LLP64 architecture in current use. + */ +#ifdef _WIN64 +typedef signed long long int khronos_intptr_t; +typedef unsigned long long int khronos_uintptr_t; +typedef signed long long int khronos_ssize_t; +typedef unsigned long long int khronos_usize_t; +#else +typedef signed long int khronos_intptr_t; +typedef unsigned long int khronos_uintptr_t; +typedef signed long int khronos_ssize_t; +typedef unsigned long int khronos_usize_t; +#endif + +#if KHRONOS_SUPPORT_FLOAT +/* + * Float type + */ +typedef float khronos_float_t; +#endif + +#if KHRONOS_SUPPORT_INT64 +/* Time types + * + * These types can be used to represent a time interval in nanoseconds or + * an absolute Unadjusted System Time. Unadjusted System Time is the number + * of nanoseconds since some arbitrary system event (e.g. since the last + * time the system booted). The Unadjusted System Time is an unsigned + * 64 bit value that wraps back to 0 every 584 years. Time intervals + * may be either signed or unsigned. + */ +typedef khronos_uint64_t khronos_utime_nanoseconds_t; +typedef khronos_int64_t khronos_stime_nanoseconds_t; +#endif + +/* + * Dummy value used to pad enum types to 32 bits. + */ +#ifndef KHRONOS_MAX_ENUM +#define KHRONOS_MAX_ENUM 0x7FFFFFFF +#endif + +/* + * Enumerated boolean type + * + * Values other than zero should be considered to be true. Therefore + * comparisons should not be made against KHRONOS_TRUE. + */ +typedef enum { + KHRONOS_FALSE = 0, + KHRONOS_TRUE = 1, + KHRONOS_BOOLEAN_ENUM_FORCE_SIZE = KHRONOS_MAX_ENUM +} khronos_boolean_enum_t; + +#endif /* __khrplatform_h_ */ + +typedef unsigned int GLenum; + +typedef unsigned char GLboolean; + +typedef unsigned int GLbitfield; + +typedef void GLvoid; + +typedef khronos_int8_t GLbyte; + +typedef khronos_uint8_t GLubyte; + +typedef khronos_int16_t GLshort; + +typedef khronos_uint16_t GLushort; + +typedef int GLint; + +typedef unsigned int GLuint; + +typedef khronos_int32_t GLclampx; + +typedef int GLsizei; + +typedef khronos_float_t GLfloat; + +typedef khronos_float_t GLclampf; + +typedef double GLdouble; + +typedef double GLclampd; + +typedef void *GLeglClientBufferEXT; + +typedef void *GLeglImageOES; + +typedef char GLchar; + +typedef char GLcharARB; + +#ifdef __APPLE__ +typedef void *GLhandleARB; +#else +typedef unsigned int GLhandleARB; +#endif + +typedef khronos_uint16_t GLhalf; + +typedef khronos_uint16_t GLhalfARB; + +typedef khronos_int32_t GLfixed; + +#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ > 1060) +typedef khronos_intptr_t GLintptr; +#else +typedef khronos_intptr_t GLintptr; +#endif + +#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ > 1060) +typedef khronos_intptr_t GLintptrARB; +#else +typedef khronos_intptr_t GLintptrARB; +#endif + +#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ > 1060) +typedef khronos_ssize_t GLsizeiptr; +#else +typedef khronos_ssize_t GLsizeiptr; +#endif + +#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ > 1060) +typedef khronos_ssize_t GLsizeiptrARB; +#else +typedef khronos_ssize_t GLsizeiptrARB; +#endif + +typedef khronos_int64_t GLint64; + +typedef khronos_int64_t GLint64EXT; + +typedef khronos_uint64_t GLuint64; + +typedef khronos_uint64_t GLuint64EXT; + +typedef struct __GLsync *GLsync; + +struct _cl_context; + +struct _cl_event; + +typedef void (GLAD_API_PTR *GLDEBUGPROC)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam); + +typedef void (GLAD_API_PTR *GLDEBUGPROCARB)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam); + +typedef void (GLAD_API_PTR *GLDEBUGPROCKHR)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam); + +typedef void (GLAD_API_PTR *GLDEBUGPROCAMD)(GLuint id,GLenum category,GLenum severity,GLsizei length,const GLchar *message,void *userParam); + +typedef unsigned short GLhalfNV; + +typedef GLintptr GLvdpauSurfaceNV; + +typedef void (GLAD_API_PTR *GLVULKANPROCNV)(void); + + + +#define GL_ES_VERSION_2_0 1 +GLAD_API_CALL int GLAD_GL_ES_VERSION_2_0; + + +typedef void (GLAD_API_PTR *PFNGLACTIVETEXTUREPROC)(GLenum texture); +typedef void (GLAD_API_PTR *PFNGLATTACHSHADERPROC)(GLuint program, GLuint shader); +typedef void (GLAD_API_PTR *PFNGLBINDATTRIBLOCATIONPROC)(GLuint program, GLuint index, const GLchar * name); +typedef void (GLAD_API_PTR *PFNGLBINDBUFFERPROC)(GLenum target, GLuint buffer); +typedef void (GLAD_API_PTR *PFNGLBINDFRAMEBUFFERPROC)(GLenum target, GLuint framebuffer); +typedef void (GLAD_API_PTR *PFNGLBINDRENDERBUFFERPROC)(GLenum target, GLuint renderbuffer); +typedef void (GLAD_API_PTR *PFNGLBINDTEXTUREPROC)(GLenum target, GLuint texture); +typedef void (GLAD_API_PTR *PFNGLBLENDCOLORPROC)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); +typedef void (GLAD_API_PTR *PFNGLBLENDEQUATIONPROC)(GLenum mode); +typedef void (GLAD_API_PTR *PFNGLBLENDEQUATIONSEPARATEPROC)(GLenum modeRGB, GLenum modeAlpha); +typedef void (GLAD_API_PTR *PFNGLBLENDFUNCPROC)(GLenum sfactor, GLenum dfactor); +typedef void (GLAD_API_PTR *PFNGLBLENDFUNCSEPARATEPROC)(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); +typedef void (GLAD_API_PTR *PFNGLBUFFERDATAPROC)(GLenum target, GLsizeiptr size, const void * data, GLenum usage); +typedef void (GLAD_API_PTR *PFNGLBUFFERSUBDATAPROC)(GLenum target, GLintptr offset, GLsizeiptr size, const void * data); +typedef GLenum (GLAD_API_PTR *PFNGLCHECKFRAMEBUFFERSTATUSPROC)(GLenum target); +typedef void (GLAD_API_PTR *PFNGLCLEARPROC)(GLbitfield mask); +typedef void (GLAD_API_PTR *PFNGLCLEARCOLORPROC)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); +typedef void (GLAD_API_PTR *PFNGLCLEARDEPTHFPROC)(GLfloat d); +typedef void (GLAD_API_PTR *PFNGLCLEARSTENCILPROC)(GLint s); +typedef void (GLAD_API_PTR *PFNGLCOLORMASKPROC)(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); +typedef void (GLAD_API_PTR *PFNGLCOMPILESHADERPROC)(GLuint shader); +typedef void (GLAD_API_PTR *PFNGLCOMPRESSEDTEXIMAGE2DPROC)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void * data); +typedef void (GLAD_API_PTR *PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void * data); +typedef void (GLAD_API_PTR *PFNGLCOPYTEXIMAGE2DPROC)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); +typedef void (GLAD_API_PTR *PFNGLCOPYTEXSUBIMAGE2DPROC)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); +typedef GLuint (GLAD_API_PTR *PFNGLCREATEPROGRAMPROC)(void); +typedef GLuint (GLAD_API_PTR *PFNGLCREATESHADERPROC)(GLenum type); +typedef void (GLAD_API_PTR *PFNGLCULLFACEPROC)(GLenum mode); +typedef void (GLAD_API_PTR *PFNGLDELETEBUFFERSPROC)(GLsizei n, const GLuint * buffers); +typedef void (GLAD_API_PTR *PFNGLDELETEFRAMEBUFFERSPROC)(GLsizei n, const GLuint * framebuffers); +typedef void (GLAD_API_PTR *PFNGLDELETEPROGRAMPROC)(GLuint program); +typedef void (GLAD_API_PTR *PFNGLDELETERENDERBUFFERSPROC)(GLsizei n, const GLuint * renderbuffers); +typedef void (GLAD_API_PTR *PFNGLDELETESHADERPROC)(GLuint shader); +typedef void (GLAD_API_PTR *PFNGLDELETETEXTURESPROC)(GLsizei n, const GLuint * textures); +typedef void (GLAD_API_PTR *PFNGLDEPTHFUNCPROC)(GLenum func); +typedef void (GLAD_API_PTR *PFNGLDEPTHMASKPROC)(GLboolean flag); +typedef void (GLAD_API_PTR *PFNGLDEPTHRANGEFPROC)(GLfloat n, GLfloat f); +typedef void (GLAD_API_PTR *PFNGLDETACHSHADERPROC)(GLuint program, GLuint shader); +typedef void (GLAD_API_PTR *PFNGLDISABLEPROC)(GLenum cap); +typedef void (GLAD_API_PTR *PFNGLDISABLEVERTEXATTRIBARRAYPROC)(GLuint index); +typedef void (GLAD_API_PTR *PFNGLDRAWARRAYSPROC)(GLenum mode, GLint first, GLsizei count); +typedef void (GLAD_API_PTR *PFNGLDRAWELEMENTSPROC)(GLenum mode, GLsizei count, GLenum type, const void * indices); +typedef void (GLAD_API_PTR *PFNGLENABLEPROC)(GLenum cap); +typedef void (GLAD_API_PTR *PFNGLENABLEVERTEXATTRIBARRAYPROC)(GLuint index); +typedef void (GLAD_API_PTR *PFNGLFINISHPROC)(void); +typedef void (GLAD_API_PTR *PFNGLFLUSHPROC)(void); +typedef void (GLAD_API_PTR *PFNGLFRAMEBUFFERRENDERBUFFERPROC)(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); +typedef void (GLAD_API_PTR *PFNGLFRAMEBUFFERTEXTURE2DPROC)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +typedef void (GLAD_API_PTR *PFNGLFRONTFACEPROC)(GLenum mode); +typedef void (GLAD_API_PTR *PFNGLGENBUFFERSPROC)(GLsizei n, GLuint * buffers); +typedef void (GLAD_API_PTR *PFNGLGENFRAMEBUFFERSPROC)(GLsizei n, GLuint * framebuffers); +typedef void (GLAD_API_PTR *PFNGLGENRENDERBUFFERSPROC)(GLsizei n, GLuint * renderbuffers); +typedef void (GLAD_API_PTR *PFNGLGENTEXTURESPROC)(GLsizei n, GLuint * textures); +typedef void (GLAD_API_PTR *PFNGLGENERATEMIPMAPPROC)(GLenum target); +typedef void (GLAD_API_PTR *PFNGLGETACTIVEATTRIBPROC)(GLuint program, GLuint index, GLsizei bufSize, GLsizei * length, GLint * size, GLenum * type, GLchar * name); +typedef void (GLAD_API_PTR *PFNGLGETACTIVEUNIFORMPROC)(GLuint program, GLuint index, GLsizei bufSize, GLsizei * length, GLint * size, GLenum * type, GLchar * name); +typedef void (GLAD_API_PTR *PFNGLGETATTACHEDSHADERSPROC)(GLuint program, GLsizei maxCount, GLsizei * count, GLuint * shaders); +typedef GLint (GLAD_API_PTR *PFNGLGETATTRIBLOCATIONPROC)(GLuint program, const GLchar * name); +typedef void (GLAD_API_PTR *PFNGLGETBOOLEANVPROC)(GLenum pname, GLboolean * data); +typedef void (GLAD_API_PTR *PFNGLGETBUFFERPARAMETERIVPROC)(GLenum target, GLenum pname, GLint * params); +typedef GLenum (GLAD_API_PTR *PFNGLGETERRORPROC)(void); +typedef void (GLAD_API_PTR *PFNGLGETFLOATVPROC)(GLenum pname, GLfloat * data); +typedef void (GLAD_API_PTR *PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC)(GLenum target, GLenum attachment, GLenum pname, GLint * params); +typedef void (GLAD_API_PTR *PFNGLGETINTEGERVPROC)(GLenum pname, GLint * data); +typedef void (GLAD_API_PTR *PFNGLGETPROGRAMINFOLOGPROC)(GLuint program, GLsizei bufSize, GLsizei * length, GLchar * infoLog); +typedef void (GLAD_API_PTR *PFNGLGETPROGRAMIVPROC)(GLuint program, GLenum pname, GLint * params); +typedef void (GLAD_API_PTR *PFNGLGETRENDERBUFFERPARAMETERIVPROC)(GLenum target, GLenum pname, GLint * params); +typedef void (GLAD_API_PTR *PFNGLGETSHADERINFOLOGPROC)(GLuint shader, GLsizei bufSize, GLsizei * length, GLchar * infoLog); +typedef void (GLAD_API_PTR *PFNGLGETSHADERPRECISIONFORMATPROC)(GLenum shadertype, GLenum precisiontype, GLint * range, GLint * precision); +typedef void (GLAD_API_PTR *PFNGLGETSHADERSOURCEPROC)(GLuint shader, GLsizei bufSize, GLsizei * length, GLchar * source); +typedef void (GLAD_API_PTR *PFNGLGETSHADERIVPROC)(GLuint shader, GLenum pname, GLint * params); +typedef const GLubyte * (GLAD_API_PTR *PFNGLGETSTRINGPROC)(GLenum name); +typedef void (GLAD_API_PTR *PFNGLGETTEXPARAMETERFVPROC)(GLenum target, GLenum pname, GLfloat * params); +typedef void (GLAD_API_PTR *PFNGLGETTEXPARAMETERIVPROC)(GLenum target, GLenum pname, GLint * params); +typedef GLint (GLAD_API_PTR *PFNGLGETUNIFORMLOCATIONPROC)(GLuint program, const GLchar * name); +typedef void (GLAD_API_PTR *PFNGLGETUNIFORMFVPROC)(GLuint program, GLint location, GLfloat * params); +typedef void (GLAD_API_PTR *PFNGLGETUNIFORMIVPROC)(GLuint program, GLint location, GLint * params); +typedef void (GLAD_API_PTR *PFNGLGETVERTEXATTRIBPOINTERVPROC)(GLuint index, GLenum pname, void ** pointer); +typedef void (GLAD_API_PTR *PFNGLGETVERTEXATTRIBFVPROC)(GLuint index, GLenum pname, GLfloat * params); +typedef void (GLAD_API_PTR *PFNGLGETVERTEXATTRIBIVPROC)(GLuint index, GLenum pname, GLint * params); +typedef void (GLAD_API_PTR *PFNGLHINTPROC)(GLenum target, GLenum mode); +typedef GLboolean (GLAD_API_PTR *PFNGLISBUFFERPROC)(GLuint buffer); +typedef GLboolean (GLAD_API_PTR *PFNGLISENABLEDPROC)(GLenum cap); +typedef GLboolean (GLAD_API_PTR *PFNGLISFRAMEBUFFERPROC)(GLuint framebuffer); +typedef GLboolean (GLAD_API_PTR *PFNGLISPROGRAMPROC)(GLuint program); +typedef GLboolean (GLAD_API_PTR *PFNGLISRENDERBUFFERPROC)(GLuint renderbuffer); +typedef GLboolean (GLAD_API_PTR *PFNGLISSHADERPROC)(GLuint shader); +typedef GLboolean (GLAD_API_PTR *PFNGLISTEXTUREPROC)(GLuint texture); +typedef void (GLAD_API_PTR *PFNGLLINEWIDTHPROC)(GLfloat width); +typedef void (GLAD_API_PTR *PFNGLLINKPROGRAMPROC)(GLuint program); +typedef void (GLAD_API_PTR *PFNGLPIXELSTOREIPROC)(GLenum pname, GLint param); +typedef void (GLAD_API_PTR *PFNGLPOLYGONOFFSETPROC)(GLfloat factor, GLfloat units); +typedef void (GLAD_API_PTR *PFNGLREADPIXELSPROC)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void * pixels); +typedef void (GLAD_API_PTR *PFNGLRELEASESHADERCOMPILERPROC)(void); +typedef void (GLAD_API_PTR *PFNGLRENDERBUFFERSTORAGEPROC)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (GLAD_API_PTR *PFNGLSAMPLECOVERAGEPROC)(GLfloat value, GLboolean invert); +typedef void (GLAD_API_PTR *PFNGLSCISSORPROC)(GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (GLAD_API_PTR *PFNGLSHADERBINARYPROC)(GLsizei count, const GLuint * shaders, GLenum binaryFormat, const void * binary, GLsizei length); +typedef void (GLAD_API_PTR *PFNGLSHADERSOURCEPROC)(GLuint shader, GLsizei count, const GLchar *const* string, const GLint * length); +typedef void (GLAD_API_PTR *PFNGLSTENCILFUNCPROC)(GLenum func, GLint ref, GLuint mask); +typedef void (GLAD_API_PTR *PFNGLSTENCILFUNCSEPARATEPROC)(GLenum face, GLenum func, GLint ref, GLuint mask); +typedef void (GLAD_API_PTR *PFNGLSTENCILMASKPROC)(GLuint mask); +typedef void (GLAD_API_PTR *PFNGLSTENCILMASKSEPARATEPROC)(GLenum face, GLuint mask); +typedef void (GLAD_API_PTR *PFNGLSTENCILOPPROC)(GLenum fail, GLenum zfail, GLenum zpass); +typedef void (GLAD_API_PTR *PFNGLSTENCILOPSEPARATEPROC)(GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass); +typedef void (GLAD_API_PTR *PFNGLTEXIMAGE2DPROC)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void * pixels); +typedef void (GLAD_API_PTR *PFNGLTEXPARAMETERFPROC)(GLenum target, GLenum pname, GLfloat param); +typedef void (GLAD_API_PTR *PFNGLTEXPARAMETERFVPROC)(GLenum target, GLenum pname, const GLfloat * params); +typedef void (GLAD_API_PTR *PFNGLTEXPARAMETERIPROC)(GLenum target, GLenum pname, GLint param); +typedef void (GLAD_API_PTR *PFNGLTEXPARAMETERIVPROC)(GLenum target, GLenum pname, const GLint * params); +typedef void (GLAD_API_PTR *PFNGLTEXSUBIMAGE2DPROC)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void * pixels); +typedef void (GLAD_API_PTR *PFNGLUNIFORM1FPROC)(GLint location, GLfloat v0); +typedef void (GLAD_API_PTR *PFNGLUNIFORM1FVPROC)(GLint location, GLsizei count, const GLfloat * value); +typedef void (GLAD_API_PTR *PFNGLUNIFORM1IPROC)(GLint location, GLint v0); +typedef void (GLAD_API_PTR *PFNGLUNIFORM1IVPROC)(GLint location, GLsizei count, const GLint * value); +typedef void (GLAD_API_PTR *PFNGLUNIFORM2FPROC)(GLint location, GLfloat v0, GLfloat v1); +typedef void (GLAD_API_PTR *PFNGLUNIFORM2FVPROC)(GLint location, GLsizei count, const GLfloat * value); +typedef void (GLAD_API_PTR *PFNGLUNIFORM2IPROC)(GLint location, GLint v0, GLint v1); +typedef void (GLAD_API_PTR *PFNGLUNIFORM2IVPROC)(GLint location, GLsizei count, const GLint * value); +typedef void (GLAD_API_PTR *PFNGLUNIFORM3FPROC)(GLint location, GLfloat v0, GLfloat v1, GLfloat v2); +typedef void (GLAD_API_PTR *PFNGLUNIFORM3FVPROC)(GLint location, GLsizei count, const GLfloat * value); +typedef void (GLAD_API_PTR *PFNGLUNIFORM3IPROC)(GLint location, GLint v0, GLint v1, GLint v2); +typedef void (GLAD_API_PTR *PFNGLUNIFORM3IVPROC)(GLint location, GLsizei count, const GLint * value); +typedef void (GLAD_API_PTR *PFNGLUNIFORM4FPROC)(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); +typedef void (GLAD_API_PTR *PFNGLUNIFORM4FVPROC)(GLint location, GLsizei count, const GLfloat * value); +typedef void (GLAD_API_PTR *PFNGLUNIFORM4IPROC)(GLint location, GLint v0, GLint v1, GLint v2, GLint v3); +typedef void (GLAD_API_PTR *PFNGLUNIFORM4IVPROC)(GLint location, GLsizei count, const GLint * value); +typedef void (GLAD_API_PTR *PFNGLUNIFORMMATRIX2FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); +typedef void (GLAD_API_PTR *PFNGLUNIFORMMATRIX3FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); +typedef void (GLAD_API_PTR *PFNGLUNIFORMMATRIX4FVPROC)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); +typedef void (GLAD_API_PTR *PFNGLUSEPROGRAMPROC)(GLuint program); +typedef void (GLAD_API_PTR *PFNGLVALIDATEPROGRAMPROC)(GLuint program); +typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB1FPROC)(GLuint index, GLfloat x); +typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB1FVPROC)(GLuint index, const GLfloat * v); +typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB2FPROC)(GLuint index, GLfloat x, GLfloat y); +typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB2FVPROC)(GLuint index, const GLfloat * v); +typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB3FPROC)(GLuint index, GLfloat x, GLfloat y, GLfloat z); +typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB3FVPROC)(GLuint index, const GLfloat * v); +typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB4FPROC)(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIB4FVPROC)(GLuint index, const GLfloat * v); +typedef void (GLAD_API_PTR *PFNGLVERTEXATTRIBPOINTERPROC)(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void * pointer); +typedef void (GLAD_API_PTR *PFNGLVIEWPORTPROC)(GLint x, GLint y, GLsizei width, GLsizei height); + +GLAD_API_CALL PFNGLACTIVETEXTUREPROC glad_glActiveTexture; +#define glActiveTexture glad_glActiveTexture +GLAD_API_CALL PFNGLATTACHSHADERPROC glad_glAttachShader; +#define glAttachShader glad_glAttachShader +GLAD_API_CALL PFNGLBINDATTRIBLOCATIONPROC glad_glBindAttribLocation; +#define glBindAttribLocation glad_glBindAttribLocation +GLAD_API_CALL PFNGLBINDBUFFERPROC glad_glBindBuffer; +#define glBindBuffer glad_glBindBuffer +GLAD_API_CALL PFNGLBINDFRAMEBUFFERPROC glad_glBindFramebuffer; +#define glBindFramebuffer glad_glBindFramebuffer +GLAD_API_CALL PFNGLBINDRENDERBUFFERPROC glad_glBindRenderbuffer; +#define glBindRenderbuffer glad_glBindRenderbuffer +GLAD_API_CALL PFNGLBINDTEXTUREPROC glad_glBindTexture; +#define glBindTexture glad_glBindTexture +GLAD_API_CALL PFNGLBLENDCOLORPROC glad_glBlendColor; +#define glBlendColor glad_glBlendColor +GLAD_API_CALL PFNGLBLENDEQUATIONPROC glad_glBlendEquation; +#define glBlendEquation glad_glBlendEquation +GLAD_API_CALL PFNGLBLENDEQUATIONSEPARATEPROC glad_glBlendEquationSeparate; +#define glBlendEquationSeparate glad_glBlendEquationSeparate +GLAD_API_CALL PFNGLBLENDFUNCPROC glad_glBlendFunc; +#define glBlendFunc glad_glBlendFunc +GLAD_API_CALL PFNGLBLENDFUNCSEPARATEPROC glad_glBlendFuncSeparate; +#define glBlendFuncSeparate glad_glBlendFuncSeparate +GLAD_API_CALL PFNGLBUFFERDATAPROC glad_glBufferData; +#define glBufferData glad_glBufferData +GLAD_API_CALL PFNGLBUFFERSUBDATAPROC glad_glBufferSubData; +#define glBufferSubData glad_glBufferSubData +GLAD_API_CALL PFNGLCHECKFRAMEBUFFERSTATUSPROC glad_glCheckFramebufferStatus; +#define glCheckFramebufferStatus glad_glCheckFramebufferStatus +GLAD_API_CALL PFNGLCLEARPROC glad_glClear; +#define glClear glad_glClear +GLAD_API_CALL PFNGLCLEARCOLORPROC glad_glClearColor; +#define glClearColor glad_glClearColor +GLAD_API_CALL PFNGLCLEARDEPTHFPROC glad_glClearDepthf; +#define glClearDepthf glad_glClearDepthf +GLAD_API_CALL PFNGLCLEARSTENCILPROC glad_glClearStencil; +#define glClearStencil glad_glClearStencil +GLAD_API_CALL PFNGLCOLORMASKPROC glad_glColorMask; +#define glColorMask glad_glColorMask +GLAD_API_CALL PFNGLCOMPILESHADERPROC glad_glCompileShader; +#define glCompileShader glad_glCompileShader +GLAD_API_CALL PFNGLCOMPRESSEDTEXIMAGE2DPROC glad_glCompressedTexImage2D; +#define glCompressedTexImage2D glad_glCompressedTexImage2D +GLAD_API_CALL PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC glad_glCompressedTexSubImage2D; +#define glCompressedTexSubImage2D glad_glCompressedTexSubImage2D +GLAD_API_CALL PFNGLCOPYTEXIMAGE2DPROC glad_glCopyTexImage2D; +#define glCopyTexImage2D glad_glCopyTexImage2D +GLAD_API_CALL PFNGLCOPYTEXSUBIMAGE2DPROC glad_glCopyTexSubImage2D; +#define glCopyTexSubImage2D glad_glCopyTexSubImage2D +GLAD_API_CALL PFNGLCREATEPROGRAMPROC glad_glCreateProgram; +#define glCreateProgram glad_glCreateProgram +GLAD_API_CALL PFNGLCREATESHADERPROC glad_glCreateShader; +#define glCreateShader glad_glCreateShader +GLAD_API_CALL PFNGLCULLFACEPROC glad_glCullFace; +#define glCullFace glad_glCullFace +GLAD_API_CALL PFNGLDELETEBUFFERSPROC glad_glDeleteBuffers; +#define glDeleteBuffers glad_glDeleteBuffers +GLAD_API_CALL PFNGLDELETEFRAMEBUFFERSPROC glad_glDeleteFramebuffers; +#define glDeleteFramebuffers glad_glDeleteFramebuffers +GLAD_API_CALL PFNGLDELETEPROGRAMPROC glad_glDeleteProgram; +#define glDeleteProgram glad_glDeleteProgram +GLAD_API_CALL PFNGLDELETERENDERBUFFERSPROC glad_glDeleteRenderbuffers; +#define glDeleteRenderbuffers glad_glDeleteRenderbuffers +GLAD_API_CALL PFNGLDELETESHADERPROC glad_glDeleteShader; +#define glDeleteShader glad_glDeleteShader +GLAD_API_CALL PFNGLDELETETEXTURESPROC glad_glDeleteTextures; +#define glDeleteTextures glad_glDeleteTextures +GLAD_API_CALL PFNGLDEPTHFUNCPROC glad_glDepthFunc; +#define glDepthFunc glad_glDepthFunc +GLAD_API_CALL PFNGLDEPTHMASKPROC glad_glDepthMask; +#define glDepthMask glad_glDepthMask +GLAD_API_CALL PFNGLDEPTHRANGEFPROC glad_glDepthRangef; +#define glDepthRangef glad_glDepthRangef +GLAD_API_CALL PFNGLDETACHSHADERPROC glad_glDetachShader; +#define glDetachShader glad_glDetachShader +GLAD_API_CALL PFNGLDISABLEPROC glad_glDisable; +#define glDisable glad_glDisable +GLAD_API_CALL PFNGLDISABLEVERTEXATTRIBARRAYPROC glad_glDisableVertexAttribArray; +#define glDisableVertexAttribArray glad_glDisableVertexAttribArray +GLAD_API_CALL PFNGLDRAWARRAYSPROC glad_glDrawArrays; +#define glDrawArrays glad_glDrawArrays +GLAD_API_CALL PFNGLDRAWELEMENTSPROC glad_glDrawElements; +#define glDrawElements glad_glDrawElements +GLAD_API_CALL PFNGLENABLEPROC glad_glEnable; +#define glEnable glad_glEnable +GLAD_API_CALL PFNGLENABLEVERTEXATTRIBARRAYPROC glad_glEnableVertexAttribArray; +#define glEnableVertexAttribArray glad_glEnableVertexAttribArray +GLAD_API_CALL PFNGLFINISHPROC glad_glFinish; +#define glFinish glad_glFinish +GLAD_API_CALL PFNGLFLUSHPROC glad_glFlush; +#define glFlush glad_glFlush +GLAD_API_CALL PFNGLFRAMEBUFFERRENDERBUFFERPROC glad_glFramebufferRenderbuffer; +#define glFramebufferRenderbuffer glad_glFramebufferRenderbuffer +GLAD_API_CALL PFNGLFRAMEBUFFERTEXTURE2DPROC glad_glFramebufferTexture2D; +#define glFramebufferTexture2D glad_glFramebufferTexture2D +GLAD_API_CALL PFNGLFRONTFACEPROC glad_glFrontFace; +#define glFrontFace glad_glFrontFace +GLAD_API_CALL PFNGLGENBUFFERSPROC glad_glGenBuffers; +#define glGenBuffers glad_glGenBuffers +GLAD_API_CALL PFNGLGENFRAMEBUFFERSPROC glad_glGenFramebuffers; +#define glGenFramebuffers glad_glGenFramebuffers +GLAD_API_CALL PFNGLGENRENDERBUFFERSPROC glad_glGenRenderbuffers; +#define glGenRenderbuffers glad_glGenRenderbuffers +GLAD_API_CALL PFNGLGENTEXTURESPROC glad_glGenTextures; +#define glGenTextures glad_glGenTextures +GLAD_API_CALL PFNGLGENERATEMIPMAPPROC glad_glGenerateMipmap; +#define glGenerateMipmap glad_glGenerateMipmap +GLAD_API_CALL PFNGLGETACTIVEATTRIBPROC glad_glGetActiveAttrib; +#define glGetActiveAttrib glad_glGetActiveAttrib +GLAD_API_CALL PFNGLGETACTIVEUNIFORMPROC glad_glGetActiveUniform; +#define glGetActiveUniform glad_glGetActiveUniform +GLAD_API_CALL PFNGLGETATTACHEDSHADERSPROC glad_glGetAttachedShaders; +#define glGetAttachedShaders glad_glGetAttachedShaders +GLAD_API_CALL PFNGLGETATTRIBLOCATIONPROC glad_glGetAttribLocation; +#define glGetAttribLocation glad_glGetAttribLocation +GLAD_API_CALL PFNGLGETBOOLEANVPROC glad_glGetBooleanv; +#define glGetBooleanv glad_glGetBooleanv +GLAD_API_CALL PFNGLGETBUFFERPARAMETERIVPROC glad_glGetBufferParameteriv; +#define glGetBufferParameteriv glad_glGetBufferParameteriv +GLAD_API_CALL PFNGLGETERRORPROC glad_glGetError; +#define glGetError glad_glGetError +GLAD_API_CALL PFNGLGETFLOATVPROC glad_glGetFloatv; +#define glGetFloatv glad_glGetFloatv +GLAD_API_CALL PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC glad_glGetFramebufferAttachmentParameteriv; +#define glGetFramebufferAttachmentParameteriv glad_glGetFramebufferAttachmentParameteriv +GLAD_API_CALL PFNGLGETINTEGERVPROC glad_glGetIntegerv; +#define glGetIntegerv glad_glGetIntegerv +GLAD_API_CALL PFNGLGETPROGRAMINFOLOGPROC glad_glGetProgramInfoLog; +#define glGetProgramInfoLog glad_glGetProgramInfoLog +GLAD_API_CALL PFNGLGETPROGRAMIVPROC glad_glGetProgramiv; +#define glGetProgramiv glad_glGetProgramiv +GLAD_API_CALL PFNGLGETRENDERBUFFERPARAMETERIVPROC glad_glGetRenderbufferParameteriv; +#define glGetRenderbufferParameteriv glad_glGetRenderbufferParameteriv +GLAD_API_CALL PFNGLGETSHADERINFOLOGPROC glad_glGetShaderInfoLog; +#define glGetShaderInfoLog glad_glGetShaderInfoLog +GLAD_API_CALL PFNGLGETSHADERPRECISIONFORMATPROC glad_glGetShaderPrecisionFormat; +#define glGetShaderPrecisionFormat glad_glGetShaderPrecisionFormat +GLAD_API_CALL PFNGLGETSHADERSOURCEPROC glad_glGetShaderSource; +#define glGetShaderSource glad_glGetShaderSource +GLAD_API_CALL PFNGLGETSHADERIVPROC glad_glGetShaderiv; +#define glGetShaderiv glad_glGetShaderiv +GLAD_API_CALL PFNGLGETSTRINGPROC glad_glGetString; +#define glGetString glad_glGetString +GLAD_API_CALL PFNGLGETTEXPARAMETERFVPROC glad_glGetTexParameterfv; +#define glGetTexParameterfv glad_glGetTexParameterfv +GLAD_API_CALL PFNGLGETTEXPARAMETERIVPROC glad_glGetTexParameteriv; +#define glGetTexParameteriv glad_glGetTexParameteriv +GLAD_API_CALL PFNGLGETUNIFORMLOCATIONPROC glad_glGetUniformLocation; +#define glGetUniformLocation glad_glGetUniformLocation +GLAD_API_CALL PFNGLGETUNIFORMFVPROC glad_glGetUniformfv; +#define glGetUniformfv glad_glGetUniformfv +GLAD_API_CALL PFNGLGETUNIFORMIVPROC glad_glGetUniformiv; +#define glGetUniformiv glad_glGetUniformiv +GLAD_API_CALL PFNGLGETVERTEXATTRIBPOINTERVPROC glad_glGetVertexAttribPointerv; +#define glGetVertexAttribPointerv glad_glGetVertexAttribPointerv +GLAD_API_CALL PFNGLGETVERTEXATTRIBFVPROC glad_glGetVertexAttribfv; +#define glGetVertexAttribfv glad_glGetVertexAttribfv +GLAD_API_CALL PFNGLGETVERTEXATTRIBIVPROC glad_glGetVertexAttribiv; +#define glGetVertexAttribiv glad_glGetVertexAttribiv +GLAD_API_CALL PFNGLHINTPROC glad_glHint; +#define glHint glad_glHint +GLAD_API_CALL PFNGLISBUFFERPROC glad_glIsBuffer; +#define glIsBuffer glad_glIsBuffer +GLAD_API_CALL PFNGLISENABLEDPROC glad_glIsEnabled; +#define glIsEnabled glad_glIsEnabled +GLAD_API_CALL PFNGLISFRAMEBUFFERPROC glad_glIsFramebuffer; +#define glIsFramebuffer glad_glIsFramebuffer +GLAD_API_CALL PFNGLISPROGRAMPROC glad_glIsProgram; +#define glIsProgram glad_glIsProgram +GLAD_API_CALL PFNGLISRENDERBUFFERPROC glad_glIsRenderbuffer; +#define glIsRenderbuffer glad_glIsRenderbuffer +GLAD_API_CALL PFNGLISSHADERPROC glad_glIsShader; +#define glIsShader glad_glIsShader +GLAD_API_CALL PFNGLISTEXTUREPROC glad_glIsTexture; +#define glIsTexture glad_glIsTexture +GLAD_API_CALL PFNGLLINEWIDTHPROC glad_glLineWidth; +#define glLineWidth glad_glLineWidth +GLAD_API_CALL PFNGLLINKPROGRAMPROC glad_glLinkProgram; +#define glLinkProgram glad_glLinkProgram +GLAD_API_CALL PFNGLPIXELSTOREIPROC glad_glPixelStorei; +#define glPixelStorei glad_glPixelStorei +GLAD_API_CALL PFNGLPOLYGONOFFSETPROC glad_glPolygonOffset; +#define glPolygonOffset glad_glPolygonOffset +GLAD_API_CALL PFNGLREADPIXELSPROC glad_glReadPixels; +#define glReadPixels glad_glReadPixels +GLAD_API_CALL PFNGLRELEASESHADERCOMPILERPROC glad_glReleaseShaderCompiler; +#define glReleaseShaderCompiler glad_glReleaseShaderCompiler +GLAD_API_CALL PFNGLRENDERBUFFERSTORAGEPROC glad_glRenderbufferStorage; +#define glRenderbufferStorage glad_glRenderbufferStorage +GLAD_API_CALL PFNGLSAMPLECOVERAGEPROC glad_glSampleCoverage; +#define glSampleCoverage glad_glSampleCoverage +GLAD_API_CALL PFNGLSCISSORPROC glad_glScissor; +#define glScissor glad_glScissor +GLAD_API_CALL PFNGLSHADERBINARYPROC glad_glShaderBinary; +#define glShaderBinary glad_glShaderBinary +GLAD_API_CALL PFNGLSHADERSOURCEPROC glad_glShaderSource; +#define glShaderSource glad_glShaderSource +GLAD_API_CALL PFNGLSTENCILFUNCPROC glad_glStencilFunc; +#define glStencilFunc glad_glStencilFunc +GLAD_API_CALL PFNGLSTENCILFUNCSEPARATEPROC glad_glStencilFuncSeparate; +#define glStencilFuncSeparate glad_glStencilFuncSeparate +GLAD_API_CALL PFNGLSTENCILMASKPROC glad_glStencilMask; +#define glStencilMask glad_glStencilMask +GLAD_API_CALL PFNGLSTENCILMASKSEPARATEPROC glad_glStencilMaskSeparate; +#define glStencilMaskSeparate glad_glStencilMaskSeparate +GLAD_API_CALL PFNGLSTENCILOPPROC glad_glStencilOp; +#define glStencilOp glad_glStencilOp +GLAD_API_CALL PFNGLSTENCILOPSEPARATEPROC glad_glStencilOpSeparate; +#define glStencilOpSeparate glad_glStencilOpSeparate +GLAD_API_CALL PFNGLTEXIMAGE2DPROC glad_glTexImage2D; +#define glTexImage2D glad_glTexImage2D +GLAD_API_CALL PFNGLTEXPARAMETERFPROC glad_glTexParameterf; +#define glTexParameterf glad_glTexParameterf +GLAD_API_CALL PFNGLTEXPARAMETERFVPROC glad_glTexParameterfv; +#define glTexParameterfv glad_glTexParameterfv +GLAD_API_CALL PFNGLTEXPARAMETERIPROC glad_glTexParameteri; +#define glTexParameteri glad_glTexParameteri +GLAD_API_CALL PFNGLTEXPARAMETERIVPROC glad_glTexParameteriv; +#define glTexParameteriv glad_glTexParameteriv +GLAD_API_CALL PFNGLTEXSUBIMAGE2DPROC glad_glTexSubImage2D; +#define glTexSubImage2D glad_glTexSubImage2D +GLAD_API_CALL PFNGLUNIFORM1FPROC glad_glUniform1f; +#define glUniform1f glad_glUniform1f +GLAD_API_CALL PFNGLUNIFORM1FVPROC glad_glUniform1fv; +#define glUniform1fv glad_glUniform1fv +GLAD_API_CALL PFNGLUNIFORM1IPROC glad_glUniform1i; +#define glUniform1i glad_glUniform1i +GLAD_API_CALL PFNGLUNIFORM1IVPROC glad_glUniform1iv; +#define glUniform1iv glad_glUniform1iv +GLAD_API_CALL PFNGLUNIFORM2FPROC glad_glUniform2f; +#define glUniform2f glad_glUniform2f +GLAD_API_CALL PFNGLUNIFORM2FVPROC glad_glUniform2fv; +#define glUniform2fv glad_glUniform2fv +GLAD_API_CALL PFNGLUNIFORM2IPROC glad_glUniform2i; +#define glUniform2i glad_glUniform2i +GLAD_API_CALL PFNGLUNIFORM2IVPROC glad_glUniform2iv; +#define glUniform2iv glad_glUniform2iv +GLAD_API_CALL PFNGLUNIFORM3FPROC glad_glUniform3f; +#define glUniform3f glad_glUniform3f +GLAD_API_CALL PFNGLUNIFORM3FVPROC glad_glUniform3fv; +#define glUniform3fv glad_glUniform3fv +GLAD_API_CALL PFNGLUNIFORM3IPROC glad_glUniform3i; +#define glUniform3i glad_glUniform3i +GLAD_API_CALL PFNGLUNIFORM3IVPROC glad_glUniform3iv; +#define glUniform3iv glad_glUniform3iv +GLAD_API_CALL PFNGLUNIFORM4FPROC glad_glUniform4f; +#define glUniform4f glad_glUniform4f +GLAD_API_CALL PFNGLUNIFORM4FVPROC glad_glUniform4fv; +#define glUniform4fv glad_glUniform4fv +GLAD_API_CALL PFNGLUNIFORM4IPROC glad_glUniform4i; +#define glUniform4i glad_glUniform4i +GLAD_API_CALL PFNGLUNIFORM4IVPROC glad_glUniform4iv; +#define glUniform4iv glad_glUniform4iv +GLAD_API_CALL PFNGLUNIFORMMATRIX2FVPROC glad_glUniformMatrix2fv; +#define glUniformMatrix2fv glad_glUniformMatrix2fv +GLAD_API_CALL PFNGLUNIFORMMATRIX3FVPROC glad_glUniformMatrix3fv; +#define glUniformMatrix3fv glad_glUniformMatrix3fv +GLAD_API_CALL PFNGLUNIFORMMATRIX4FVPROC glad_glUniformMatrix4fv; +#define glUniformMatrix4fv glad_glUniformMatrix4fv +GLAD_API_CALL PFNGLUSEPROGRAMPROC glad_glUseProgram; +#define glUseProgram glad_glUseProgram +GLAD_API_CALL PFNGLVALIDATEPROGRAMPROC glad_glValidateProgram; +#define glValidateProgram glad_glValidateProgram +GLAD_API_CALL PFNGLVERTEXATTRIB1FPROC glad_glVertexAttrib1f; +#define glVertexAttrib1f glad_glVertexAttrib1f +GLAD_API_CALL PFNGLVERTEXATTRIB1FVPROC glad_glVertexAttrib1fv; +#define glVertexAttrib1fv glad_glVertexAttrib1fv +GLAD_API_CALL PFNGLVERTEXATTRIB2FPROC glad_glVertexAttrib2f; +#define glVertexAttrib2f glad_glVertexAttrib2f +GLAD_API_CALL PFNGLVERTEXATTRIB2FVPROC glad_glVertexAttrib2fv; +#define glVertexAttrib2fv glad_glVertexAttrib2fv +GLAD_API_CALL PFNGLVERTEXATTRIB3FPROC glad_glVertexAttrib3f; +#define glVertexAttrib3f glad_glVertexAttrib3f +GLAD_API_CALL PFNGLVERTEXATTRIB3FVPROC glad_glVertexAttrib3fv; +#define glVertexAttrib3fv glad_glVertexAttrib3fv +GLAD_API_CALL PFNGLVERTEXATTRIB4FPROC glad_glVertexAttrib4f; +#define glVertexAttrib4f glad_glVertexAttrib4f +GLAD_API_CALL PFNGLVERTEXATTRIB4FVPROC glad_glVertexAttrib4fv; +#define glVertexAttrib4fv glad_glVertexAttrib4fv +GLAD_API_CALL PFNGLVERTEXATTRIBPOINTERPROC glad_glVertexAttribPointer; +#define glVertexAttribPointer glad_glVertexAttribPointer +GLAD_API_CALL PFNGLVIEWPORTPROC glad_glViewport; +#define glViewport glad_glViewport + + + + + +GLAD_API_CALL int gladLoadGLES2UserPtr( GLADuserptrloadfunc load, void *userptr); +GLAD_API_CALL int gladLoadGLES2( GLADloadfunc load); + + + +#ifdef __cplusplus +} +#endif +#endif + +/* Source */ +#ifdef GLAD_GLES2_IMPLEMENTATION +#include +#include +#include + +#ifndef GLAD_IMPL_UTIL_C_ +#define GLAD_IMPL_UTIL_C_ + +#ifdef _MSC_VER +#define GLAD_IMPL_UTIL_SSCANF sscanf_s +#else +#define GLAD_IMPL_UTIL_SSCANF sscanf +#endif + +#endif /* GLAD_IMPL_UTIL_C_ */ + +#ifdef __cplusplus +extern "C" { +#endif + + + +int GLAD_GL_ES_VERSION_2_0 = 0; + + + +PFNGLACTIVETEXTUREPROC glad_glActiveTexture = NULL; +PFNGLATTACHSHADERPROC glad_glAttachShader = NULL; +PFNGLBINDATTRIBLOCATIONPROC glad_glBindAttribLocation = NULL; +PFNGLBINDBUFFERPROC glad_glBindBuffer = NULL; +PFNGLBINDFRAMEBUFFERPROC glad_glBindFramebuffer = NULL; +PFNGLBINDRENDERBUFFERPROC glad_glBindRenderbuffer = NULL; +PFNGLBINDTEXTUREPROC glad_glBindTexture = NULL; +PFNGLBLENDCOLORPROC glad_glBlendColor = NULL; +PFNGLBLENDEQUATIONPROC glad_glBlendEquation = NULL; +PFNGLBLENDEQUATIONSEPARATEPROC glad_glBlendEquationSeparate = NULL; +PFNGLBLENDFUNCPROC glad_glBlendFunc = NULL; +PFNGLBLENDFUNCSEPARATEPROC glad_glBlendFuncSeparate = NULL; +PFNGLBUFFERDATAPROC glad_glBufferData = NULL; +PFNGLBUFFERSUBDATAPROC glad_glBufferSubData = NULL; +PFNGLCHECKFRAMEBUFFERSTATUSPROC glad_glCheckFramebufferStatus = NULL; +PFNGLCLEARPROC glad_glClear = NULL; +PFNGLCLEARCOLORPROC glad_glClearColor = NULL; +PFNGLCLEARDEPTHFPROC glad_glClearDepthf = NULL; +PFNGLCLEARSTENCILPROC glad_glClearStencil = NULL; +PFNGLCOLORMASKPROC glad_glColorMask = NULL; +PFNGLCOMPILESHADERPROC glad_glCompileShader = NULL; +PFNGLCOMPRESSEDTEXIMAGE2DPROC glad_glCompressedTexImage2D = NULL; +PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC glad_glCompressedTexSubImage2D = NULL; +PFNGLCOPYTEXIMAGE2DPROC glad_glCopyTexImage2D = NULL; +PFNGLCOPYTEXSUBIMAGE2DPROC glad_glCopyTexSubImage2D = NULL; +PFNGLCREATEPROGRAMPROC glad_glCreateProgram = NULL; +PFNGLCREATESHADERPROC glad_glCreateShader = NULL; +PFNGLCULLFACEPROC glad_glCullFace = NULL; +PFNGLDELETEBUFFERSPROC glad_glDeleteBuffers = NULL; +PFNGLDELETEFRAMEBUFFERSPROC glad_glDeleteFramebuffers = NULL; +PFNGLDELETEPROGRAMPROC glad_glDeleteProgram = NULL; +PFNGLDELETERENDERBUFFERSPROC glad_glDeleteRenderbuffers = NULL; +PFNGLDELETESHADERPROC glad_glDeleteShader = NULL; +PFNGLDELETETEXTURESPROC glad_glDeleteTextures = NULL; +PFNGLDEPTHFUNCPROC glad_glDepthFunc = NULL; +PFNGLDEPTHMASKPROC glad_glDepthMask = NULL; +PFNGLDEPTHRANGEFPROC glad_glDepthRangef = NULL; +PFNGLDETACHSHADERPROC glad_glDetachShader = NULL; +PFNGLDISABLEPROC glad_glDisable = NULL; +PFNGLDISABLEVERTEXATTRIBARRAYPROC glad_glDisableVertexAttribArray = NULL; +PFNGLDRAWARRAYSPROC glad_glDrawArrays = NULL; +PFNGLDRAWELEMENTSPROC glad_glDrawElements = NULL; +PFNGLENABLEPROC glad_glEnable = NULL; +PFNGLENABLEVERTEXATTRIBARRAYPROC glad_glEnableVertexAttribArray = NULL; +PFNGLFINISHPROC glad_glFinish = NULL; +PFNGLFLUSHPROC glad_glFlush = NULL; +PFNGLFRAMEBUFFERRENDERBUFFERPROC glad_glFramebufferRenderbuffer = NULL; +PFNGLFRAMEBUFFERTEXTURE2DPROC glad_glFramebufferTexture2D = NULL; +PFNGLFRONTFACEPROC glad_glFrontFace = NULL; +PFNGLGENBUFFERSPROC glad_glGenBuffers = NULL; +PFNGLGENFRAMEBUFFERSPROC glad_glGenFramebuffers = NULL; +PFNGLGENRENDERBUFFERSPROC glad_glGenRenderbuffers = NULL; +PFNGLGENTEXTURESPROC glad_glGenTextures = NULL; +PFNGLGENERATEMIPMAPPROC glad_glGenerateMipmap = NULL; +PFNGLGETACTIVEATTRIBPROC glad_glGetActiveAttrib = NULL; +PFNGLGETACTIVEUNIFORMPROC glad_glGetActiveUniform = NULL; +PFNGLGETATTACHEDSHADERSPROC glad_glGetAttachedShaders = NULL; +PFNGLGETATTRIBLOCATIONPROC glad_glGetAttribLocation = NULL; +PFNGLGETBOOLEANVPROC glad_glGetBooleanv = NULL; +PFNGLGETBUFFERPARAMETERIVPROC glad_glGetBufferParameteriv = NULL; +PFNGLGETERRORPROC glad_glGetError = NULL; +PFNGLGETFLOATVPROC glad_glGetFloatv = NULL; +PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC glad_glGetFramebufferAttachmentParameteriv = NULL; +PFNGLGETINTEGERVPROC glad_glGetIntegerv = NULL; +PFNGLGETPROGRAMINFOLOGPROC glad_glGetProgramInfoLog = NULL; +PFNGLGETPROGRAMIVPROC glad_glGetProgramiv = NULL; +PFNGLGETRENDERBUFFERPARAMETERIVPROC glad_glGetRenderbufferParameteriv = NULL; +PFNGLGETSHADERINFOLOGPROC glad_glGetShaderInfoLog = NULL; +PFNGLGETSHADERPRECISIONFORMATPROC glad_glGetShaderPrecisionFormat = NULL; +PFNGLGETSHADERSOURCEPROC glad_glGetShaderSource = NULL; +PFNGLGETSHADERIVPROC glad_glGetShaderiv = NULL; +PFNGLGETSTRINGPROC glad_glGetString = NULL; +PFNGLGETTEXPARAMETERFVPROC glad_glGetTexParameterfv = NULL; +PFNGLGETTEXPARAMETERIVPROC glad_glGetTexParameteriv = NULL; +PFNGLGETUNIFORMLOCATIONPROC glad_glGetUniformLocation = NULL; +PFNGLGETUNIFORMFVPROC glad_glGetUniformfv = NULL; +PFNGLGETUNIFORMIVPROC glad_glGetUniformiv = NULL; +PFNGLGETVERTEXATTRIBPOINTERVPROC glad_glGetVertexAttribPointerv = NULL; +PFNGLGETVERTEXATTRIBFVPROC glad_glGetVertexAttribfv = NULL; +PFNGLGETVERTEXATTRIBIVPROC glad_glGetVertexAttribiv = NULL; +PFNGLHINTPROC glad_glHint = NULL; +PFNGLISBUFFERPROC glad_glIsBuffer = NULL; +PFNGLISENABLEDPROC glad_glIsEnabled = NULL; +PFNGLISFRAMEBUFFERPROC glad_glIsFramebuffer = NULL; +PFNGLISPROGRAMPROC glad_glIsProgram = NULL; +PFNGLISRENDERBUFFERPROC glad_glIsRenderbuffer = NULL; +PFNGLISSHADERPROC glad_glIsShader = NULL; +PFNGLISTEXTUREPROC glad_glIsTexture = NULL; +PFNGLLINEWIDTHPROC glad_glLineWidth = NULL; +PFNGLLINKPROGRAMPROC glad_glLinkProgram = NULL; +PFNGLPIXELSTOREIPROC glad_glPixelStorei = NULL; +PFNGLPOLYGONOFFSETPROC glad_glPolygonOffset = NULL; +PFNGLREADPIXELSPROC glad_glReadPixels = NULL; +PFNGLRELEASESHADERCOMPILERPROC glad_glReleaseShaderCompiler = NULL; +PFNGLRENDERBUFFERSTORAGEPROC glad_glRenderbufferStorage = NULL; +PFNGLSAMPLECOVERAGEPROC glad_glSampleCoverage = NULL; +PFNGLSCISSORPROC glad_glScissor = NULL; +PFNGLSHADERBINARYPROC glad_glShaderBinary = NULL; +PFNGLSHADERSOURCEPROC glad_glShaderSource = NULL; +PFNGLSTENCILFUNCPROC glad_glStencilFunc = NULL; +PFNGLSTENCILFUNCSEPARATEPROC glad_glStencilFuncSeparate = NULL; +PFNGLSTENCILMASKPROC glad_glStencilMask = NULL; +PFNGLSTENCILMASKSEPARATEPROC glad_glStencilMaskSeparate = NULL; +PFNGLSTENCILOPPROC glad_glStencilOp = NULL; +PFNGLSTENCILOPSEPARATEPROC glad_glStencilOpSeparate = NULL; +PFNGLTEXIMAGE2DPROC glad_glTexImage2D = NULL; +PFNGLTEXPARAMETERFPROC glad_glTexParameterf = NULL; +PFNGLTEXPARAMETERFVPROC glad_glTexParameterfv = NULL; +PFNGLTEXPARAMETERIPROC glad_glTexParameteri = NULL; +PFNGLTEXPARAMETERIVPROC glad_glTexParameteriv = NULL; +PFNGLTEXSUBIMAGE2DPROC glad_glTexSubImage2D = NULL; +PFNGLUNIFORM1FPROC glad_glUniform1f = NULL; +PFNGLUNIFORM1FVPROC glad_glUniform1fv = NULL; +PFNGLUNIFORM1IPROC glad_glUniform1i = NULL; +PFNGLUNIFORM1IVPROC glad_glUniform1iv = NULL; +PFNGLUNIFORM2FPROC glad_glUniform2f = NULL; +PFNGLUNIFORM2FVPROC glad_glUniform2fv = NULL; +PFNGLUNIFORM2IPROC glad_glUniform2i = NULL; +PFNGLUNIFORM2IVPROC glad_glUniform2iv = NULL; +PFNGLUNIFORM3FPROC glad_glUniform3f = NULL; +PFNGLUNIFORM3FVPROC glad_glUniform3fv = NULL; +PFNGLUNIFORM3IPROC glad_glUniform3i = NULL; +PFNGLUNIFORM3IVPROC glad_glUniform3iv = NULL; +PFNGLUNIFORM4FPROC glad_glUniform4f = NULL; +PFNGLUNIFORM4FVPROC glad_glUniform4fv = NULL; +PFNGLUNIFORM4IPROC glad_glUniform4i = NULL; +PFNGLUNIFORM4IVPROC glad_glUniform4iv = NULL; +PFNGLUNIFORMMATRIX2FVPROC glad_glUniformMatrix2fv = NULL; +PFNGLUNIFORMMATRIX3FVPROC glad_glUniformMatrix3fv = NULL; +PFNGLUNIFORMMATRIX4FVPROC glad_glUniformMatrix4fv = NULL; +PFNGLUSEPROGRAMPROC glad_glUseProgram = NULL; +PFNGLVALIDATEPROGRAMPROC glad_glValidateProgram = NULL; +PFNGLVERTEXATTRIB1FPROC glad_glVertexAttrib1f = NULL; +PFNGLVERTEXATTRIB1FVPROC glad_glVertexAttrib1fv = NULL; +PFNGLVERTEXATTRIB2FPROC glad_glVertexAttrib2f = NULL; +PFNGLVERTEXATTRIB2FVPROC glad_glVertexAttrib2fv = NULL; +PFNGLVERTEXATTRIB3FPROC glad_glVertexAttrib3f = NULL; +PFNGLVERTEXATTRIB3FVPROC glad_glVertexAttrib3fv = NULL; +PFNGLVERTEXATTRIB4FPROC glad_glVertexAttrib4f = NULL; +PFNGLVERTEXATTRIB4FVPROC glad_glVertexAttrib4fv = NULL; +PFNGLVERTEXATTRIBPOINTERPROC glad_glVertexAttribPointer = NULL; +PFNGLVIEWPORTPROC glad_glViewport = NULL; + + +static void glad_gl_load_GL_ES_VERSION_2_0( GLADuserptrloadfunc load, void* userptr) { + if(!GLAD_GL_ES_VERSION_2_0) return; + glad_glActiveTexture = (PFNGLACTIVETEXTUREPROC) load(userptr, "glActiveTexture"); + glad_glAttachShader = (PFNGLATTACHSHADERPROC) load(userptr, "glAttachShader"); + glad_glBindAttribLocation = (PFNGLBINDATTRIBLOCATIONPROC) load(userptr, "glBindAttribLocation"); + glad_glBindBuffer = (PFNGLBINDBUFFERPROC) load(userptr, "glBindBuffer"); + glad_glBindFramebuffer = (PFNGLBINDFRAMEBUFFERPROC) load(userptr, "glBindFramebuffer"); + glad_glBindRenderbuffer = (PFNGLBINDRENDERBUFFERPROC) load(userptr, "glBindRenderbuffer"); + glad_glBindTexture = (PFNGLBINDTEXTUREPROC) load(userptr, "glBindTexture"); + glad_glBlendColor = (PFNGLBLENDCOLORPROC) load(userptr, "glBlendColor"); + glad_glBlendEquation = (PFNGLBLENDEQUATIONPROC) load(userptr, "glBlendEquation"); + glad_glBlendEquationSeparate = (PFNGLBLENDEQUATIONSEPARATEPROC) load(userptr, "glBlendEquationSeparate"); + glad_glBlendFunc = (PFNGLBLENDFUNCPROC) load(userptr, "glBlendFunc"); + glad_glBlendFuncSeparate = (PFNGLBLENDFUNCSEPARATEPROC) load(userptr, "glBlendFuncSeparate"); + glad_glBufferData = (PFNGLBUFFERDATAPROC) load(userptr, "glBufferData"); + glad_glBufferSubData = (PFNGLBUFFERSUBDATAPROC) load(userptr, "glBufferSubData"); + glad_glCheckFramebufferStatus = (PFNGLCHECKFRAMEBUFFERSTATUSPROC) load(userptr, "glCheckFramebufferStatus"); + glad_glClear = (PFNGLCLEARPROC) load(userptr, "glClear"); + glad_glClearColor = (PFNGLCLEARCOLORPROC) load(userptr, "glClearColor"); + glad_glClearDepthf = (PFNGLCLEARDEPTHFPROC) load(userptr, "glClearDepthf"); + glad_glClearStencil = (PFNGLCLEARSTENCILPROC) load(userptr, "glClearStencil"); + glad_glColorMask = (PFNGLCOLORMASKPROC) load(userptr, "glColorMask"); + glad_glCompileShader = (PFNGLCOMPILESHADERPROC) load(userptr, "glCompileShader"); + glad_glCompressedTexImage2D = (PFNGLCOMPRESSEDTEXIMAGE2DPROC) load(userptr, "glCompressedTexImage2D"); + glad_glCompressedTexSubImage2D = (PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC) load(userptr, "glCompressedTexSubImage2D"); + glad_glCopyTexImage2D = (PFNGLCOPYTEXIMAGE2DPROC) load(userptr, "glCopyTexImage2D"); + glad_glCopyTexSubImage2D = (PFNGLCOPYTEXSUBIMAGE2DPROC) load(userptr, "glCopyTexSubImage2D"); + glad_glCreateProgram = (PFNGLCREATEPROGRAMPROC) load(userptr, "glCreateProgram"); + glad_glCreateShader = (PFNGLCREATESHADERPROC) load(userptr, "glCreateShader"); + glad_glCullFace = (PFNGLCULLFACEPROC) load(userptr, "glCullFace"); + glad_glDeleteBuffers = (PFNGLDELETEBUFFERSPROC) load(userptr, "glDeleteBuffers"); + glad_glDeleteFramebuffers = (PFNGLDELETEFRAMEBUFFERSPROC) load(userptr, "glDeleteFramebuffers"); + glad_glDeleteProgram = (PFNGLDELETEPROGRAMPROC) load(userptr, "glDeleteProgram"); + glad_glDeleteRenderbuffers = (PFNGLDELETERENDERBUFFERSPROC) load(userptr, "glDeleteRenderbuffers"); + glad_glDeleteShader = (PFNGLDELETESHADERPROC) load(userptr, "glDeleteShader"); + glad_glDeleteTextures = (PFNGLDELETETEXTURESPROC) load(userptr, "glDeleteTextures"); + glad_glDepthFunc = (PFNGLDEPTHFUNCPROC) load(userptr, "glDepthFunc"); + glad_glDepthMask = (PFNGLDEPTHMASKPROC) load(userptr, "glDepthMask"); + glad_glDepthRangef = (PFNGLDEPTHRANGEFPROC) load(userptr, "glDepthRangef"); + glad_glDetachShader = (PFNGLDETACHSHADERPROC) load(userptr, "glDetachShader"); + glad_glDisable = (PFNGLDISABLEPROC) load(userptr, "glDisable"); + glad_glDisableVertexAttribArray = (PFNGLDISABLEVERTEXATTRIBARRAYPROC) load(userptr, "glDisableVertexAttribArray"); + glad_glDrawArrays = (PFNGLDRAWARRAYSPROC) load(userptr, "glDrawArrays"); + glad_glDrawElements = (PFNGLDRAWELEMENTSPROC) load(userptr, "glDrawElements"); + glad_glEnable = (PFNGLENABLEPROC) load(userptr, "glEnable"); + glad_glEnableVertexAttribArray = (PFNGLENABLEVERTEXATTRIBARRAYPROC) load(userptr, "glEnableVertexAttribArray"); + glad_glFinish = (PFNGLFINISHPROC) load(userptr, "glFinish"); + glad_glFlush = (PFNGLFLUSHPROC) load(userptr, "glFlush"); + glad_glFramebufferRenderbuffer = (PFNGLFRAMEBUFFERRENDERBUFFERPROC) load(userptr, "glFramebufferRenderbuffer"); + glad_glFramebufferTexture2D = (PFNGLFRAMEBUFFERTEXTURE2DPROC) load(userptr, "glFramebufferTexture2D"); + glad_glFrontFace = (PFNGLFRONTFACEPROC) load(userptr, "glFrontFace"); + glad_glGenBuffers = (PFNGLGENBUFFERSPROC) load(userptr, "glGenBuffers"); + glad_glGenFramebuffers = (PFNGLGENFRAMEBUFFERSPROC) load(userptr, "glGenFramebuffers"); + glad_glGenRenderbuffers = (PFNGLGENRENDERBUFFERSPROC) load(userptr, "glGenRenderbuffers"); + glad_glGenTextures = (PFNGLGENTEXTURESPROC) load(userptr, "glGenTextures"); + glad_glGenerateMipmap = (PFNGLGENERATEMIPMAPPROC) load(userptr, "glGenerateMipmap"); + glad_glGetActiveAttrib = (PFNGLGETACTIVEATTRIBPROC) load(userptr, "glGetActiveAttrib"); + glad_glGetActiveUniform = (PFNGLGETACTIVEUNIFORMPROC) load(userptr, "glGetActiveUniform"); + glad_glGetAttachedShaders = (PFNGLGETATTACHEDSHADERSPROC) load(userptr, "glGetAttachedShaders"); + glad_glGetAttribLocation = (PFNGLGETATTRIBLOCATIONPROC) load(userptr, "glGetAttribLocation"); + glad_glGetBooleanv = (PFNGLGETBOOLEANVPROC) load(userptr, "glGetBooleanv"); + glad_glGetBufferParameteriv = (PFNGLGETBUFFERPARAMETERIVPROC) load(userptr, "glGetBufferParameteriv"); + glad_glGetError = (PFNGLGETERRORPROC) load(userptr, "glGetError"); + glad_glGetFloatv = (PFNGLGETFLOATVPROC) load(userptr, "glGetFloatv"); + glad_glGetFramebufferAttachmentParameteriv = (PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC) load(userptr, "glGetFramebufferAttachmentParameteriv"); + glad_glGetIntegerv = (PFNGLGETINTEGERVPROC) load(userptr, "glGetIntegerv"); + glad_glGetProgramInfoLog = (PFNGLGETPROGRAMINFOLOGPROC) load(userptr, "glGetProgramInfoLog"); + glad_glGetProgramiv = (PFNGLGETPROGRAMIVPROC) load(userptr, "glGetProgramiv"); + glad_glGetRenderbufferParameteriv = (PFNGLGETRENDERBUFFERPARAMETERIVPROC) load(userptr, "glGetRenderbufferParameteriv"); + glad_glGetShaderInfoLog = (PFNGLGETSHADERINFOLOGPROC) load(userptr, "glGetShaderInfoLog"); + glad_glGetShaderPrecisionFormat = (PFNGLGETSHADERPRECISIONFORMATPROC) load(userptr, "glGetShaderPrecisionFormat"); + glad_glGetShaderSource = (PFNGLGETSHADERSOURCEPROC) load(userptr, "glGetShaderSource"); + glad_glGetShaderiv = (PFNGLGETSHADERIVPROC) load(userptr, "glGetShaderiv"); + glad_glGetString = (PFNGLGETSTRINGPROC) load(userptr, "glGetString"); + glad_glGetTexParameterfv = (PFNGLGETTEXPARAMETERFVPROC) load(userptr, "glGetTexParameterfv"); + glad_glGetTexParameteriv = (PFNGLGETTEXPARAMETERIVPROC) load(userptr, "glGetTexParameteriv"); + glad_glGetUniformLocation = (PFNGLGETUNIFORMLOCATIONPROC) load(userptr, "glGetUniformLocation"); + glad_glGetUniformfv = (PFNGLGETUNIFORMFVPROC) load(userptr, "glGetUniformfv"); + glad_glGetUniformiv = (PFNGLGETUNIFORMIVPROC) load(userptr, "glGetUniformiv"); + glad_glGetVertexAttribPointerv = (PFNGLGETVERTEXATTRIBPOINTERVPROC) load(userptr, "glGetVertexAttribPointerv"); + glad_glGetVertexAttribfv = (PFNGLGETVERTEXATTRIBFVPROC) load(userptr, "glGetVertexAttribfv"); + glad_glGetVertexAttribiv = (PFNGLGETVERTEXATTRIBIVPROC) load(userptr, "glGetVertexAttribiv"); + glad_glHint = (PFNGLHINTPROC) load(userptr, "glHint"); + glad_glIsBuffer = (PFNGLISBUFFERPROC) load(userptr, "glIsBuffer"); + glad_glIsEnabled = (PFNGLISENABLEDPROC) load(userptr, "glIsEnabled"); + glad_glIsFramebuffer = (PFNGLISFRAMEBUFFERPROC) load(userptr, "glIsFramebuffer"); + glad_glIsProgram = (PFNGLISPROGRAMPROC) load(userptr, "glIsProgram"); + glad_glIsRenderbuffer = (PFNGLISRENDERBUFFERPROC) load(userptr, "glIsRenderbuffer"); + glad_glIsShader = (PFNGLISSHADERPROC) load(userptr, "glIsShader"); + glad_glIsTexture = (PFNGLISTEXTUREPROC) load(userptr, "glIsTexture"); + glad_glLineWidth = (PFNGLLINEWIDTHPROC) load(userptr, "glLineWidth"); + glad_glLinkProgram = (PFNGLLINKPROGRAMPROC) load(userptr, "glLinkProgram"); + glad_glPixelStorei = (PFNGLPIXELSTOREIPROC) load(userptr, "glPixelStorei"); + glad_glPolygonOffset = (PFNGLPOLYGONOFFSETPROC) load(userptr, "glPolygonOffset"); + glad_glReadPixels = (PFNGLREADPIXELSPROC) load(userptr, "glReadPixels"); + glad_glReleaseShaderCompiler = (PFNGLRELEASESHADERCOMPILERPROC) load(userptr, "glReleaseShaderCompiler"); + glad_glRenderbufferStorage = (PFNGLRENDERBUFFERSTORAGEPROC) load(userptr, "glRenderbufferStorage"); + glad_glSampleCoverage = (PFNGLSAMPLECOVERAGEPROC) load(userptr, "glSampleCoverage"); + glad_glScissor = (PFNGLSCISSORPROC) load(userptr, "glScissor"); + glad_glShaderBinary = (PFNGLSHADERBINARYPROC) load(userptr, "glShaderBinary"); + glad_glShaderSource = (PFNGLSHADERSOURCEPROC) load(userptr, "glShaderSource"); + glad_glStencilFunc = (PFNGLSTENCILFUNCPROC) load(userptr, "glStencilFunc"); + glad_glStencilFuncSeparate = (PFNGLSTENCILFUNCSEPARATEPROC) load(userptr, "glStencilFuncSeparate"); + glad_glStencilMask = (PFNGLSTENCILMASKPROC) load(userptr, "glStencilMask"); + glad_glStencilMaskSeparate = (PFNGLSTENCILMASKSEPARATEPROC) load(userptr, "glStencilMaskSeparate"); + glad_glStencilOp = (PFNGLSTENCILOPPROC) load(userptr, "glStencilOp"); + glad_glStencilOpSeparate = (PFNGLSTENCILOPSEPARATEPROC) load(userptr, "glStencilOpSeparate"); + glad_glTexImage2D = (PFNGLTEXIMAGE2DPROC) load(userptr, "glTexImage2D"); + glad_glTexParameterf = (PFNGLTEXPARAMETERFPROC) load(userptr, "glTexParameterf"); + glad_glTexParameterfv = (PFNGLTEXPARAMETERFVPROC) load(userptr, "glTexParameterfv"); + glad_glTexParameteri = (PFNGLTEXPARAMETERIPROC) load(userptr, "glTexParameteri"); + glad_glTexParameteriv = (PFNGLTEXPARAMETERIVPROC) load(userptr, "glTexParameteriv"); + glad_glTexSubImage2D = (PFNGLTEXSUBIMAGE2DPROC) load(userptr, "glTexSubImage2D"); + glad_glUniform1f = (PFNGLUNIFORM1FPROC) load(userptr, "glUniform1f"); + glad_glUniform1fv = (PFNGLUNIFORM1FVPROC) load(userptr, "glUniform1fv"); + glad_glUniform1i = (PFNGLUNIFORM1IPROC) load(userptr, "glUniform1i"); + glad_glUniform1iv = (PFNGLUNIFORM1IVPROC) load(userptr, "glUniform1iv"); + glad_glUniform2f = (PFNGLUNIFORM2FPROC) load(userptr, "glUniform2f"); + glad_glUniform2fv = (PFNGLUNIFORM2FVPROC) load(userptr, "glUniform2fv"); + glad_glUniform2i = (PFNGLUNIFORM2IPROC) load(userptr, "glUniform2i"); + glad_glUniform2iv = (PFNGLUNIFORM2IVPROC) load(userptr, "glUniform2iv"); + glad_glUniform3f = (PFNGLUNIFORM3FPROC) load(userptr, "glUniform3f"); + glad_glUniform3fv = (PFNGLUNIFORM3FVPROC) load(userptr, "glUniform3fv"); + glad_glUniform3i = (PFNGLUNIFORM3IPROC) load(userptr, "glUniform3i"); + glad_glUniform3iv = (PFNGLUNIFORM3IVPROC) load(userptr, "glUniform3iv"); + glad_glUniform4f = (PFNGLUNIFORM4FPROC) load(userptr, "glUniform4f"); + glad_glUniform4fv = (PFNGLUNIFORM4FVPROC) load(userptr, "glUniform4fv"); + glad_glUniform4i = (PFNGLUNIFORM4IPROC) load(userptr, "glUniform4i"); + glad_glUniform4iv = (PFNGLUNIFORM4IVPROC) load(userptr, "glUniform4iv"); + glad_glUniformMatrix2fv = (PFNGLUNIFORMMATRIX2FVPROC) load(userptr, "glUniformMatrix2fv"); + glad_glUniformMatrix3fv = (PFNGLUNIFORMMATRIX3FVPROC) load(userptr, "glUniformMatrix3fv"); + glad_glUniformMatrix4fv = (PFNGLUNIFORMMATRIX4FVPROC) load(userptr, "glUniformMatrix4fv"); + glad_glUseProgram = (PFNGLUSEPROGRAMPROC) load(userptr, "glUseProgram"); + glad_glValidateProgram = (PFNGLVALIDATEPROGRAMPROC) load(userptr, "glValidateProgram"); + glad_glVertexAttrib1f = (PFNGLVERTEXATTRIB1FPROC) load(userptr, "glVertexAttrib1f"); + glad_glVertexAttrib1fv = (PFNGLVERTEXATTRIB1FVPROC) load(userptr, "glVertexAttrib1fv"); + glad_glVertexAttrib2f = (PFNGLVERTEXATTRIB2FPROC) load(userptr, "glVertexAttrib2f"); + glad_glVertexAttrib2fv = (PFNGLVERTEXATTRIB2FVPROC) load(userptr, "glVertexAttrib2fv"); + glad_glVertexAttrib3f = (PFNGLVERTEXATTRIB3FPROC) load(userptr, "glVertexAttrib3f"); + glad_glVertexAttrib3fv = (PFNGLVERTEXATTRIB3FVPROC) load(userptr, "glVertexAttrib3fv"); + glad_glVertexAttrib4f = (PFNGLVERTEXATTRIB4FPROC) load(userptr, "glVertexAttrib4f"); + glad_glVertexAttrib4fv = (PFNGLVERTEXATTRIB4FVPROC) load(userptr, "glVertexAttrib4fv"); + glad_glVertexAttribPointer = (PFNGLVERTEXATTRIBPOINTERPROC) load(userptr, "glVertexAttribPointer"); + glad_glViewport = (PFNGLVIEWPORTPROC) load(userptr, "glViewport"); +} + + + +#if defined(GL_ES_VERSION_3_0) || defined(GL_VERSION_3_0) +#define GLAD_GL_IS_SOME_NEW_VERSION 1 +#else +#define GLAD_GL_IS_SOME_NEW_VERSION 0 +#endif + +static int glad_gl_get_extensions( int version, const char **out_exts, unsigned int *out_num_exts_i, char ***out_exts_i) { +#if GLAD_GL_IS_SOME_NEW_VERSION + if(GLAD_VERSION_MAJOR(version) < 3) { +#else + (void) version; + (void) out_num_exts_i; + (void) out_exts_i; +#endif + if (glad_glGetString == NULL) { + return 0; + } + *out_exts = (const char *)glad_glGetString(GL_EXTENSIONS); +#if GLAD_GL_IS_SOME_NEW_VERSION + } else { + unsigned int index = 0; + unsigned int num_exts_i = 0; + char **exts_i = NULL; + if (glad_glGetStringi == NULL || glad_glGetIntegerv == NULL) { + return 0; + } + glad_glGetIntegerv(GL_NUM_EXTENSIONS, (int*) &num_exts_i); + if (num_exts_i > 0) { + exts_i = (char **) malloc(num_exts_i * (sizeof *exts_i)); + } + if (exts_i == NULL) { + return 0; + } + for(index = 0; index < num_exts_i; index++) { + const char *gl_str_tmp = (const char*) glad_glGetStringi(GL_EXTENSIONS, index); + size_t len = strlen(gl_str_tmp) + 1; + + char *local_str = (char*) malloc(len * sizeof(char)); + if(local_str != NULL) { + memcpy(local_str, gl_str_tmp, len * sizeof(char)); + } + + exts_i[index] = local_str; + } + + *out_num_exts_i = num_exts_i; + *out_exts_i = exts_i; + } +#endif + return 1; +} +static void glad_gl_free_extensions(char **exts_i, unsigned int num_exts_i) { + if (exts_i != NULL) { + unsigned int index; + for(index = 0; index < num_exts_i; index++) { + free((void *) (exts_i[index])); + } + free((void *)exts_i); + exts_i = NULL; + } +} +static int glad_gl_has_extension(int version, const char *exts, unsigned int num_exts_i, char **exts_i, const char *ext) { + if(GLAD_VERSION_MAJOR(version) < 3 || !GLAD_GL_IS_SOME_NEW_VERSION) { + const char *extensions; + const char *loc; + const char *terminator; + extensions = exts; + if(extensions == NULL || ext == NULL) { + return 0; + } + while(1) { + loc = strstr(extensions, ext); + if(loc == NULL) { + return 0; + } + terminator = loc + strlen(ext); + if((loc == extensions || *(loc - 1) == ' ') && + (*terminator == ' ' || *terminator == '\0')) { + return 1; + } + extensions = terminator; + } + } else { + unsigned int index; + for(index = 0; index < num_exts_i; index++) { + const char *e = exts_i[index]; + if(strcmp(e, ext) == 0) { + return 1; + } + } + } + return 0; +} + +static GLADapiproc glad_gl_get_proc_from_userptr(void *userptr, const char* name) { + return (GLAD_GNUC_EXTENSION (GLADapiproc (*)(const char *name)) userptr)(name); +} + +static int glad_gl_find_extensions_gles2( int version) { + const char *exts = NULL; + unsigned int num_exts_i = 0; + char **exts_i = NULL; + if (!glad_gl_get_extensions(version, &exts, &num_exts_i, &exts_i)) return 0; + + (void) glad_gl_has_extension; + + glad_gl_free_extensions(exts_i, num_exts_i); + + return 1; +} + +static int glad_gl_find_core_gles2(void) { + int i; + const char* version; + const char* prefixes[] = { + "OpenGL ES-CM ", + "OpenGL ES-CL ", + "OpenGL ES ", + "OpenGL SC ", + NULL + }; + int major = 0; + int minor = 0; + version = (const char*) glad_glGetString(GL_VERSION); + if (!version) return 0; + for (i = 0; prefixes[i]; i++) { + const size_t length = strlen(prefixes[i]); + if (strncmp(version, prefixes[i], length) == 0) { + version += length; + break; + } + } + + GLAD_IMPL_UTIL_SSCANF(version, "%d.%d", &major, &minor); + + GLAD_GL_ES_VERSION_2_0 = (major == 2 && minor >= 0) || major > 2; + + return GLAD_MAKE_VERSION(major, minor); +} + +int gladLoadGLES2UserPtr( GLADuserptrloadfunc load, void *userptr) { + int version; + + glad_glGetString = (PFNGLGETSTRINGPROC) load(userptr, "glGetString"); + if(glad_glGetString == NULL) return 0; + if(glad_glGetString(GL_VERSION) == NULL) return 0; + version = glad_gl_find_core_gles2(); + + glad_gl_load_GL_ES_VERSION_2_0(load, userptr); + + if (!glad_gl_find_extensions_gles2(version)) return 0; + + + + return version; +} + + +int gladLoadGLES2( GLADloadfunc load) { + return gladLoadGLES2UserPtr( glad_gl_get_proc_from_userptr, GLAD_GNUC_EXTENSION (void*) load); +} + + + + + + +#ifdef __cplusplus +} +#endif + +#endif /* GLAD_GLES2_IMPLEMENTATION */ + diff --git a/thirdparty/glfw/deps/glad/vulkan.h b/thirdparty/glfw/deps/glad/vulkan.h index 39288ee04..469ffe5e0 100644 --- a/thirdparty/glfw/deps/glad/vulkan.h +++ b/thirdparty/glfw/deps/glad/vulkan.h @@ -1,5 +1,5 @@ /** - * Loader generated by glad 2.0.0-beta on Wed Jul 13 21:24:58 2022 + * Loader generated by glad 2.0.0-beta on Thu Jul 7 20:52:04 2022 * * Generator: C/C++ * Specification: vk @@ -11,17 +11,17 @@ * Options: * - ALIAS = False * - DEBUG = False - * - HEADER_ONLY = False + * - HEADER_ONLY = True * - LOADER = False * - MX = False * - MX_GLOBAL = False * - ON_DEMAND = False * * Commandline: - * --api='vulkan=1.3' --extensions='VK_EXT_debug_report,VK_KHR_portability_enumeration,VK_KHR_surface,VK_KHR_swapchain' c + * --api='vulkan=1.3' --extensions='VK_EXT_debug_report,VK_KHR_portability_enumeration,VK_KHR_surface,VK_KHR_swapchain' c --header-only * * Online: - * http://glad.sh/#api=vulkan%3D1.3&extensions=VK_EXT_debug_report%2CVK_KHR_portability_enumeration%2CVK_KHR_surface%2CVK_KHR_swapchain&generator=c&options= + * http://glad.sh/#api=vulkan%3D1.3&extensions=VK_EXT_debug_report%2CVK_KHR_portability_enumeration%2CVK_KHR_surface%2CVK_KHR_swapchain&generator=c&options=HEADER_ONLY * */ @@ -40,6 +40,7 @@ #define GLAD_VULKAN +#define GLAD_OPTION_VULKAN_HEADER_ONLY #ifdef __cplusplus extern "C" { @@ -189,7 +190,90 @@ typedef void (*GLADpostcallback)(void *ret, const char *name, GLADapiproc apipro #define VK_WHOLE_SIZE (~0ULL) -#include "vk_platform.h" +/* */ +/* File: vk_platform.h */ +/* */ +/* +** Copyright 2014-2022 The Khronos Group Inc. +** +** SPDX-License-Identifier: Apache-2.0 +*/ + + +#ifndef VK_PLATFORM_H_ +#define VK_PLATFORM_H_ + +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +/* +*************************************************************************************************** +* Platform-specific directives and type declarations +*************************************************************************************************** +*/ + +/* Platform-specific calling convention macros. + * + * Platforms should define these so that Vulkan clients call Vulkan commands + * with the same calling conventions that the Vulkan implementation expects. + * + * VKAPI_ATTR - Placed before the return type in function declarations. + * Useful for C++11 and GCC/Clang-style function attribute syntax. + * VKAPI_CALL - Placed after the return type in function declarations. + * Useful for MSVC-style calling convention syntax. + * VKAPI_PTR - Placed between the '(' and '*' in function pointer types. + * + * Function declaration: VKAPI_ATTR void VKAPI_CALL vkCommand(void); + * Function pointer type: typedef void (VKAPI_PTR *PFN_vkCommand)(void); + */ +#if defined(_WIN32) + /* On Windows, Vulkan commands use the stdcall convention */ + #define VKAPI_ATTR + #define VKAPI_CALL __stdcall + #define VKAPI_PTR VKAPI_CALL +#elif defined(__ANDROID__) && defined(__ARM_ARCH) && __ARM_ARCH < 7 + #error "Vulkan is not supported for the 'armeabi' NDK ABI" +#elif defined(__ANDROID__) && defined(__ARM_ARCH) && __ARM_ARCH >= 7 && defined(__ARM_32BIT_STATE) + /* On Android 32-bit ARM targets, Vulkan functions use the "hardfloat" */ + /* calling convention, i.e. float parameters are passed in registers. This */ + /* is true even if the rest of the application passes floats on the stack, */ + /* as it does by default when compiling for the armeabi-v7a NDK ABI. */ + #define VKAPI_ATTR __attribute__((pcs("aapcs-vfp"))) + #define VKAPI_CALL + #define VKAPI_PTR VKAPI_ATTR +#else + /* On other platforms, use the default calling convention */ + #define VKAPI_ATTR + #define VKAPI_CALL + #define VKAPI_PTR +#endif + +#if !defined(VK_NO_STDDEF_H) + #include +#endif /* !defined(VK_NO_STDDEF_H) */ + +#if !defined(VK_NO_STDINT_H) + #if defined(_MSC_VER) && (_MSC_VER < 1600) + typedef signed __int8 int8_t; + typedef unsigned __int8 uint8_t; + typedef signed __int16 int16_t; + typedef unsigned __int16 uint16_t; + typedef signed __int32 int32_t; + typedef unsigned __int32 uint32_t; + typedef signed __int64 int64_t; + typedef unsigned __int64 uint64_t; + #else + #include + #endif +#endif /* !defined(VK_NO_STDINT_H) */ + +#ifdef __cplusplus +} /* extern "C" */ +#endif /* __cplusplus */ + +#endif /* DEPRECATED: This define is deprecated. VK_MAKE_API_VERSION should be used instead. */ #define VK_MAKE_VERSION(major, minor, patch) \ ((((uint32_t)(major)) << 22) | (((uint32_t)(minor)) << 12) | ((uint32_t)(patch))) @@ -5506,3 +5590,741 @@ GLAD_API_CALL int gladLoadVulkan( VkPhysicalDevice physical_device, GLADloadfunc } #endif #endif + +/* Source */ +#ifdef GLAD_VULKAN_IMPLEMENTATION +#include +#include +#include + +#ifndef GLAD_IMPL_UTIL_C_ +#define GLAD_IMPL_UTIL_C_ + +#ifdef _MSC_VER +#define GLAD_IMPL_UTIL_SSCANF sscanf_s +#else +#define GLAD_IMPL_UTIL_SSCANF sscanf +#endif + +#endif /* GLAD_IMPL_UTIL_C_ */ + +#ifdef __cplusplus +extern "C" { +#endif + + + +int GLAD_VK_VERSION_1_0 = 0; +int GLAD_VK_VERSION_1_1 = 0; +int GLAD_VK_VERSION_1_2 = 0; +int GLAD_VK_VERSION_1_3 = 0; +int GLAD_VK_EXT_debug_report = 0; +int GLAD_VK_KHR_portability_enumeration = 0; +int GLAD_VK_KHR_surface = 0; +int GLAD_VK_KHR_swapchain = 0; + + + +PFN_vkAcquireNextImage2KHR glad_vkAcquireNextImage2KHR = NULL; +PFN_vkAcquireNextImageKHR glad_vkAcquireNextImageKHR = NULL; +PFN_vkAllocateCommandBuffers glad_vkAllocateCommandBuffers = NULL; +PFN_vkAllocateDescriptorSets glad_vkAllocateDescriptorSets = NULL; +PFN_vkAllocateMemory glad_vkAllocateMemory = NULL; +PFN_vkBeginCommandBuffer glad_vkBeginCommandBuffer = NULL; +PFN_vkBindBufferMemory glad_vkBindBufferMemory = NULL; +PFN_vkBindBufferMemory2 glad_vkBindBufferMemory2 = NULL; +PFN_vkBindImageMemory glad_vkBindImageMemory = NULL; +PFN_vkBindImageMemory2 glad_vkBindImageMemory2 = NULL; +PFN_vkCmdBeginQuery glad_vkCmdBeginQuery = NULL; +PFN_vkCmdBeginRenderPass glad_vkCmdBeginRenderPass = NULL; +PFN_vkCmdBeginRenderPass2 glad_vkCmdBeginRenderPass2 = NULL; +PFN_vkCmdBeginRendering glad_vkCmdBeginRendering = NULL; +PFN_vkCmdBindDescriptorSets glad_vkCmdBindDescriptorSets = NULL; +PFN_vkCmdBindIndexBuffer glad_vkCmdBindIndexBuffer = NULL; +PFN_vkCmdBindPipeline glad_vkCmdBindPipeline = NULL; +PFN_vkCmdBindVertexBuffers glad_vkCmdBindVertexBuffers = NULL; +PFN_vkCmdBindVertexBuffers2 glad_vkCmdBindVertexBuffers2 = NULL; +PFN_vkCmdBlitImage glad_vkCmdBlitImage = NULL; +PFN_vkCmdBlitImage2 glad_vkCmdBlitImage2 = NULL; +PFN_vkCmdClearAttachments glad_vkCmdClearAttachments = NULL; +PFN_vkCmdClearColorImage glad_vkCmdClearColorImage = NULL; +PFN_vkCmdClearDepthStencilImage glad_vkCmdClearDepthStencilImage = NULL; +PFN_vkCmdCopyBuffer glad_vkCmdCopyBuffer = NULL; +PFN_vkCmdCopyBuffer2 glad_vkCmdCopyBuffer2 = NULL; +PFN_vkCmdCopyBufferToImage glad_vkCmdCopyBufferToImage = NULL; +PFN_vkCmdCopyBufferToImage2 glad_vkCmdCopyBufferToImage2 = NULL; +PFN_vkCmdCopyImage glad_vkCmdCopyImage = NULL; +PFN_vkCmdCopyImage2 glad_vkCmdCopyImage2 = NULL; +PFN_vkCmdCopyImageToBuffer glad_vkCmdCopyImageToBuffer = NULL; +PFN_vkCmdCopyImageToBuffer2 glad_vkCmdCopyImageToBuffer2 = NULL; +PFN_vkCmdCopyQueryPoolResults glad_vkCmdCopyQueryPoolResults = NULL; +PFN_vkCmdDispatch glad_vkCmdDispatch = NULL; +PFN_vkCmdDispatchBase glad_vkCmdDispatchBase = NULL; +PFN_vkCmdDispatchIndirect glad_vkCmdDispatchIndirect = NULL; +PFN_vkCmdDraw glad_vkCmdDraw = NULL; +PFN_vkCmdDrawIndexed glad_vkCmdDrawIndexed = NULL; +PFN_vkCmdDrawIndexedIndirect glad_vkCmdDrawIndexedIndirect = NULL; +PFN_vkCmdDrawIndexedIndirectCount glad_vkCmdDrawIndexedIndirectCount = NULL; +PFN_vkCmdDrawIndirect glad_vkCmdDrawIndirect = NULL; +PFN_vkCmdDrawIndirectCount glad_vkCmdDrawIndirectCount = NULL; +PFN_vkCmdEndQuery glad_vkCmdEndQuery = NULL; +PFN_vkCmdEndRenderPass glad_vkCmdEndRenderPass = NULL; +PFN_vkCmdEndRenderPass2 glad_vkCmdEndRenderPass2 = NULL; +PFN_vkCmdEndRendering glad_vkCmdEndRendering = NULL; +PFN_vkCmdExecuteCommands glad_vkCmdExecuteCommands = NULL; +PFN_vkCmdFillBuffer glad_vkCmdFillBuffer = NULL; +PFN_vkCmdNextSubpass glad_vkCmdNextSubpass = NULL; +PFN_vkCmdNextSubpass2 glad_vkCmdNextSubpass2 = NULL; +PFN_vkCmdPipelineBarrier glad_vkCmdPipelineBarrier = NULL; +PFN_vkCmdPipelineBarrier2 glad_vkCmdPipelineBarrier2 = NULL; +PFN_vkCmdPushConstants glad_vkCmdPushConstants = NULL; +PFN_vkCmdResetEvent glad_vkCmdResetEvent = NULL; +PFN_vkCmdResetEvent2 glad_vkCmdResetEvent2 = NULL; +PFN_vkCmdResetQueryPool glad_vkCmdResetQueryPool = NULL; +PFN_vkCmdResolveImage glad_vkCmdResolveImage = NULL; +PFN_vkCmdResolveImage2 glad_vkCmdResolveImage2 = NULL; +PFN_vkCmdSetBlendConstants glad_vkCmdSetBlendConstants = NULL; +PFN_vkCmdSetCullMode glad_vkCmdSetCullMode = NULL; +PFN_vkCmdSetDepthBias glad_vkCmdSetDepthBias = NULL; +PFN_vkCmdSetDepthBiasEnable glad_vkCmdSetDepthBiasEnable = NULL; +PFN_vkCmdSetDepthBounds glad_vkCmdSetDepthBounds = NULL; +PFN_vkCmdSetDepthBoundsTestEnable glad_vkCmdSetDepthBoundsTestEnable = NULL; +PFN_vkCmdSetDepthCompareOp glad_vkCmdSetDepthCompareOp = NULL; +PFN_vkCmdSetDepthTestEnable glad_vkCmdSetDepthTestEnable = NULL; +PFN_vkCmdSetDepthWriteEnable glad_vkCmdSetDepthWriteEnable = NULL; +PFN_vkCmdSetDeviceMask glad_vkCmdSetDeviceMask = NULL; +PFN_vkCmdSetEvent glad_vkCmdSetEvent = NULL; +PFN_vkCmdSetEvent2 glad_vkCmdSetEvent2 = NULL; +PFN_vkCmdSetFrontFace glad_vkCmdSetFrontFace = NULL; +PFN_vkCmdSetLineWidth glad_vkCmdSetLineWidth = NULL; +PFN_vkCmdSetPrimitiveRestartEnable glad_vkCmdSetPrimitiveRestartEnable = NULL; +PFN_vkCmdSetPrimitiveTopology glad_vkCmdSetPrimitiveTopology = NULL; +PFN_vkCmdSetRasterizerDiscardEnable glad_vkCmdSetRasterizerDiscardEnable = NULL; +PFN_vkCmdSetScissor glad_vkCmdSetScissor = NULL; +PFN_vkCmdSetScissorWithCount glad_vkCmdSetScissorWithCount = NULL; +PFN_vkCmdSetStencilCompareMask glad_vkCmdSetStencilCompareMask = NULL; +PFN_vkCmdSetStencilOp glad_vkCmdSetStencilOp = NULL; +PFN_vkCmdSetStencilReference glad_vkCmdSetStencilReference = NULL; +PFN_vkCmdSetStencilTestEnable glad_vkCmdSetStencilTestEnable = NULL; +PFN_vkCmdSetStencilWriteMask glad_vkCmdSetStencilWriteMask = NULL; +PFN_vkCmdSetViewport glad_vkCmdSetViewport = NULL; +PFN_vkCmdSetViewportWithCount glad_vkCmdSetViewportWithCount = NULL; +PFN_vkCmdUpdateBuffer glad_vkCmdUpdateBuffer = NULL; +PFN_vkCmdWaitEvents glad_vkCmdWaitEvents = NULL; +PFN_vkCmdWaitEvents2 glad_vkCmdWaitEvents2 = NULL; +PFN_vkCmdWriteTimestamp glad_vkCmdWriteTimestamp = NULL; +PFN_vkCmdWriteTimestamp2 glad_vkCmdWriteTimestamp2 = NULL; +PFN_vkCreateBuffer glad_vkCreateBuffer = NULL; +PFN_vkCreateBufferView glad_vkCreateBufferView = NULL; +PFN_vkCreateCommandPool glad_vkCreateCommandPool = NULL; +PFN_vkCreateComputePipelines glad_vkCreateComputePipelines = NULL; +PFN_vkCreateDebugReportCallbackEXT glad_vkCreateDebugReportCallbackEXT = NULL; +PFN_vkCreateDescriptorPool glad_vkCreateDescriptorPool = NULL; +PFN_vkCreateDescriptorSetLayout glad_vkCreateDescriptorSetLayout = NULL; +PFN_vkCreateDescriptorUpdateTemplate glad_vkCreateDescriptorUpdateTemplate = NULL; +PFN_vkCreateDevice glad_vkCreateDevice = NULL; +PFN_vkCreateEvent glad_vkCreateEvent = NULL; +PFN_vkCreateFence glad_vkCreateFence = NULL; +PFN_vkCreateFramebuffer glad_vkCreateFramebuffer = NULL; +PFN_vkCreateGraphicsPipelines glad_vkCreateGraphicsPipelines = NULL; +PFN_vkCreateImage glad_vkCreateImage = NULL; +PFN_vkCreateImageView glad_vkCreateImageView = NULL; +PFN_vkCreateInstance glad_vkCreateInstance = NULL; +PFN_vkCreatePipelineCache glad_vkCreatePipelineCache = NULL; +PFN_vkCreatePipelineLayout glad_vkCreatePipelineLayout = NULL; +PFN_vkCreatePrivateDataSlot glad_vkCreatePrivateDataSlot = NULL; +PFN_vkCreateQueryPool glad_vkCreateQueryPool = NULL; +PFN_vkCreateRenderPass glad_vkCreateRenderPass = NULL; +PFN_vkCreateRenderPass2 glad_vkCreateRenderPass2 = NULL; +PFN_vkCreateSampler glad_vkCreateSampler = NULL; +PFN_vkCreateSamplerYcbcrConversion glad_vkCreateSamplerYcbcrConversion = NULL; +PFN_vkCreateSemaphore glad_vkCreateSemaphore = NULL; +PFN_vkCreateShaderModule glad_vkCreateShaderModule = NULL; +PFN_vkCreateSwapchainKHR glad_vkCreateSwapchainKHR = NULL; +PFN_vkDebugReportMessageEXT glad_vkDebugReportMessageEXT = NULL; +PFN_vkDestroyBuffer glad_vkDestroyBuffer = NULL; +PFN_vkDestroyBufferView glad_vkDestroyBufferView = NULL; +PFN_vkDestroyCommandPool glad_vkDestroyCommandPool = NULL; +PFN_vkDestroyDebugReportCallbackEXT glad_vkDestroyDebugReportCallbackEXT = NULL; +PFN_vkDestroyDescriptorPool glad_vkDestroyDescriptorPool = NULL; +PFN_vkDestroyDescriptorSetLayout glad_vkDestroyDescriptorSetLayout = NULL; +PFN_vkDestroyDescriptorUpdateTemplate glad_vkDestroyDescriptorUpdateTemplate = NULL; +PFN_vkDestroyDevice glad_vkDestroyDevice = NULL; +PFN_vkDestroyEvent glad_vkDestroyEvent = NULL; +PFN_vkDestroyFence glad_vkDestroyFence = NULL; +PFN_vkDestroyFramebuffer glad_vkDestroyFramebuffer = NULL; +PFN_vkDestroyImage glad_vkDestroyImage = NULL; +PFN_vkDestroyImageView glad_vkDestroyImageView = NULL; +PFN_vkDestroyInstance glad_vkDestroyInstance = NULL; +PFN_vkDestroyPipeline glad_vkDestroyPipeline = NULL; +PFN_vkDestroyPipelineCache glad_vkDestroyPipelineCache = NULL; +PFN_vkDestroyPipelineLayout glad_vkDestroyPipelineLayout = NULL; +PFN_vkDestroyPrivateDataSlot glad_vkDestroyPrivateDataSlot = NULL; +PFN_vkDestroyQueryPool glad_vkDestroyQueryPool = NULL; +PFN_vkDestroyRenderPass glad_vkDestroyRenderPass = NULL; +PFN_vkDestroySampler glad_vkDestroySampler = NULL; +PFN_vkDestroySamplerYcbcrConversion glad_vkDestroySamplerYcbcrConversion = NULL; +PFN_vkDestroySemaphore glad_vkDestroySemaphore = NULL; +PFN_vkDestroyShaderModule glad_vkDestroyShaderModule = NULL; +PFN_vkDestroySurfaceKHR glad_vkDestroySurfaceKHR = NULL; +PFN_vkDestroySwapchainKHR glad_vkDestroySwapchainKHR = NULL; +PFN_vkDeviceWaitIdle glad_vkDeviceWaitIdle = NULL; +PFN_vkEndCommandBuffer glad_vkEndCommandBuffer = NULL; +PFN_vkEnumerateDeviceExtensionProperties glad_vkEnumerateDeviceExtensionProperties = NULL; +PFN_vkEnumerateDeviceLayerProperties glad_vkEnumerateDeviceLayerProperties = NULL; +PFN_vkEnumerateInstanceExtensionProperties glad_vkEnumerateInstanceExtensionProperties = NULL; +PFN_vkEnumerateInstanceLayerProperties glad_vkEnumerateInstanceLayerProperties = NULL; +PFN_vkEnumerateInstanceVersion glad_vkEnumerateInstanceVersion = NULL; +PFN_vkEnumeratePhysicalDeviceGroups glad_vkEnumeratePhysicalDeviceGroups = NULL; +PFN_vkEnumeratePhysicalDevices glad_vkEnumeratePhysicalDevices = NULL; +PFN_vkFlushMappedMemoryRanges glad_vkFlushMappedMemoryRanges = NULL; +PFN_vkFreeCommandBuffers glad_vkFreeCommandBuffers = NULL; +PFN_vkFreeDescriptorSets glad_vkFreeDescriptorSets = NULL; +PFN_vkFreeMemory glad_vkFreeMemory = NULL; +PFN_vkGetBufferDeviceAddress glad_vkGetBufferDeviceAddress = NULL; +PFN_vkGetBufferMemoryRequirements glad_vkGetBufferMemoryRequirements = NULL; +PFN_vkGetBufferMemoryRequirements2 glad_vkGetBufferMemoryRequirements2 = NULL; +PFN_vkGetBufferOpaqueCaptureAddress glad_vkGetBufferOpaqueCaptureAddress = NULL; +PFN_vkGetDescriptorSetLayoutSupport glad_vkGetDescriptorSetLayoutSupport = NULL; +PFN_vkGetDeviceBufferMemoryRequirements glad_vkGetDeviceBufferMemoryRequirements = NULL; +PFN_vkGetDeviceGroupPeerMemoryFeatures glad_vkGetDeviceGroupPeerMemoryFeatures = NULL; +PFN_vkGetDeviceGroupPresentCapabilitiesKHR glad_vkGetDeviceGroupPresentCapabilitiesKHR = NULL; +PFN_vkGetDeviceGroupSurfacePresentModesKHR glad_vkGetDeviceGroupSurfacePresentModesKHR = NULL; +PFN_vkGetDeviceImageMemoryRequirements glad_vkGetDeviceImageMemoryRequirements = NULL; +PFN_vkGetDeviceImageSparseMemoryRequirements glad_vkGetDeviceImageSparseMemoryRequirements = NULL; +PFN_vkGetDeviceMemoryCommitment glad_vkGetDeviceMemoryCommitment = NULL; +PFN_vkGetDeviceMemoryOpaqueCaptureAddress glad_vkGetDeviceMemoryOpaqueCaptureAddress = NULL; +PFN_vkGetDeviceProcAddr glad_vkGetDeviceProcAddr = NULL; +PFN_vkGetDeviceQueue glad_vkGetDeviceQueue = NULL; +PFN_vkGetDeviceQueue2 glad_vkGetDeviceQueue2 = NULL; +PFN_vkGetEventStatus glad_vkGetEventStatus = NULL; +PFN_vkGetFenceStatus glad_vkGetFenceStatus = NULL; +PFN_vkGetImageMemoryRequirements glad_vkGetImageMemoryRequirements = NULL; +PFN_vkGetImageMemoryRequirements2 glad_vkGetImageMemoryRequirements2 = NULL; +PFN_vkGetImageSparseMemoryRequirements glad_vkGetImageSparseMemoryRequirements = NULL; +PFN_vkGetImageSparseMemoryRequirements2 glad_vkGetImageSparseMemoryRequirements2 = NULL; +PFN_vkGetImageSubresourceLayout glad_vkGetImageSubresourceLayout = NULL; +PFN_vkGetInstanceProcAddr glad_vkGetInstanceProcAddr = NULL; +PFN_vkGetPhysicalDeviceExternalBufferProperties glad_vkGetPhysicalDeviceExternalBufferProperties = NULL; +PFN_vkGetPhysicalDeviceExternalFenceProperties glad_vkGetPhysicalDeviceExternalFenceProperties = NULL; +PFN_vkGetPhysicalDeviceExternalSemaphoreProperties glad_vkGetPhysicalDeviceExternalSemaphoreProperties = NULL; +PFN_vkGetPhysicalDeviceFeatures glad_vkGetPhysicalDeviceFeatures = NULL; +PFN_vkGetPhysicalDeviceFeatures2 glad_vkGetPhysicalDeviceFeatures2 = NULL; +PFN_vkGetPhysicalDeviceFormatProperties glad_vkGetPhysicalDeviceFormatProperties = NULL; +PFN_vkGetPhysicalDeviceFormatProperties2 glad_vkGetPhysicalDeviceFormatProperties2 = NULL; +PFN_vkGetPhysicalDeviceImageFormatProperties glad_vkGetPhysicalDeviceImageFormatProperties = NULL; +PFN_vkGetPhysicalDeviceImageFormatProperties2 glad_vkGetPhysicalDeviceImageFormatProperties2 = NULL; +PFN_vkGetPhysicalDeviceMemoryProperties glad_vkGetPhysicalDeviceMemoryProperties = NULL; +PFN_vkGetPhysicalDeviceMemoryProperties2 glad_vkGetPhysicalDeviceMemoryProperties2 = NULL; +PFN_vkGetPhysicalDevicePresentRectanglesKHR glad_vkGetPhysicalDevicePresentRectanglesKHR = NULL; +PFN_vkGetPhysicalDeviceProperties glad_vkGetPhysicalDeviceProperties = NULL; +PFN_vkGetPhysicalDeviceProperties2 glad_vkGetPhysicalDeviceProperties2 = NULL; +PFN_vkGetPhysicalDeviceQueueFamilyProperties glad_vkGetPhysicalDeviceQueueFamilyProperties = NULL; +PFN_vkGetPhysicalDeviceQueueFamilyProperties2 glad_vkGetPhysicalDeviceQueueFamilyProperties2 = NULL; +PFN_vkGetPhysicalDeviceSparseImageFormatProperties glad_vkGetPhysicalDeviceSparseImageFormatProperties = NULL; +PFN_vkGetPhysicalDeviceSparseImageFormatProperties2 glad_vkGetPhysicalDeviceSparseImageFormatProperties2 = NULL; +PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR glad_vkGetPhysicalDeviceSurfaceCapabilitiesKHR = NULL; +PFN_vkGetPhysicalDeviceSurfaceFormatsKHR glad_vkGetPhysicalDeviceSurfaceFormatsKHR = NULL; +PFN_vkGetPhysicalDeviceSurfacePresentModesKHR glad_vkGetPhysicalDeviceSurfacePresentModesKHR = NULL; +PFN_vkGetPhysicalDeviceSurfaceSupportKHR glad_vkGetPhysicalDeviceSurfaceSupportKHR = NULL; +PFN_vkGetPhysicalDeviceToolProperties glad_vkGetPhysicalDeviceToolProperties = NULL; +PFN_vkGetPipelineCacheData glad_vkGetPipelineCacheData = NULL; +PFN_vkGetPrivateData glad_vkGetPrivateData = NULL; +PFN_vkGetQueryPoolResults glad_vkGetQueryPoolResults = NULL; +PFN_vkGetRenderAreaGranularity glad_vkGetRenderAreaGranularity = NULL; +PFN_vkGetSemaphoreCounterValue glad_vkGetSemaphoreCounterValue = NULL; +PFN_vkGetSwapchainImagesKHR glad_vkGetSwapchainImagesKHR = NULL; +PFN_vkInvalidateMappedMemoryRanges glad_vkInvalidateMappedMemoryRanges = NULL; +PFN_vkMapMemory glad_vkMapMemory = NULL; +PFN_vkMergePipelineCaches glad_vkMergePipelineCaches = NULL; +PFN_vkQueueBindSparse glad_vkQueueBindSparse = NULL; +PFN_vkQueuePresentKHR glad_vkQueuePresentKHR = NULL; +PFN_vkQueueSubmit glad_vkQueueSubmit = NULL; +PFN_vkQueueSubmit2 glad_vkQueueSubmit2 = NULL; +PFN_vkQueueWaitIdle glad_vkQueueWaitIdle = NULL; +PFN_vkResetCommandBuffer glad_vkResetCommandBuffer = NULL; +PFN_vkResetCommandPool glad_vkResetCommandPool = NULL; +PFN_vkResetDescriptorPool glad_vkResetDescriptorPool = NULL; +PFN_vkResetEvent glad_vkResetEvent = NULL; +PFN_vkResetFences glad_vkResetFences = NULL; +PFN_vkResetQueryPool glad_vkResetQueryPool = NULL; +PFN_vkSetEvent glad_vkSetEvent = NULL; +PFN_vkSetPrivateData glad_vkSetPrivateData = NULL; +PFN_vkSignalSemaphore glad_vkSignalSemaphore = NULL; +PFN_vkTrimCommandPool glad_vkTrimCommandPool = NULL; +PFN_vkUnmapMemory glad_vkUnmapMemory = NULL; +PFN_vkUpdateDescriptorSetWithTemplate glad_vkUpdateDescriptorSetWithTemplate = NULL; +PFN_vkUpdateDescriptorSets glad_vkUpdateDescriptorSets = NULL; +PFN_vkWaitForFences glad_vkWaitForFences = NULL; +PFN_vkWaitSemaphores glad_vkWaitSemaphores = NULL; + + +static void glad_vk_load_VK_VERSION_1_0( GLADuserptrloadfunc load, void* userptr) { + if(!GLAD_VK_VERSION_1_0) return; + glad_vkAllocateCommandBuffers = (PFN_vkAllocateCommandBuffers) load(userptr, "vkAllocateCommandBuffers"); + glad_vkAllocateDescriptorSets = (PFN_vkAllocateDescriptorSets) load(userptr, "vkAllocateDescriptorSets"); + glad_vkAllocateMemory = (PFN_vkAllocateMemory) load(userptr, "vkAllocateMemory"); + glad_vkBeginCommandBuffer = (PFN_vkBeginCommandBuffer) load(userptr, "vkBeginCommandBuffer"); + glad_vkBindBufferMemory = (PFN_vkBindBufferMemory) load(userptr, "vkBindBufferMemory"); + glad_vkBindImageMemory = (PFN_vkBindImageMemory) load(userptr, "vkBindImageMemory"); + glad_vkCmdBeginQuery = (PFN_vkCmdBeginQuery) load(userptr, "vkCmdBeginQuery"); + glad_vkCmdBeginRenderPass = (PFN_vkCmdBeginRenderPass) load(userptr, "vkCmdBeginRenderPass"); + glad_vkCmdBindDescriptorSets = (PFN_vkCmdBindDescriptorSets) load(userptr, "vkCmdBindDescriptorSets"); + glad_vkCmdBindIndexBuffer = (PFN_vkCmdBindIndexBuffer) load(userptr, "vkCmdBindIndexBuffer"); + glad_vkCmdBindPipeline = (PFN_vkCmdBindPipeline) load(userptr, "vkCmdBindPipeline"); + glad_vkCmdBindVertexBuffers = (PFN_vkCmdBindVertexBuffers) load(userptr, "vkCmdBindVertexBuffers"); + glad_vkCmdBlitImage = (PFN_vkCmdBlitImage) load(userptr, "vkCmdBlitImage"); + glad_vkCmdClearAttachments = (PFN_vkCmdClearAttachments) load(userptr, "vkCmdClearAttachments"); + glad_vkCmdClearColorImage = (PFN_vkCmdClearColorImage) load(userptr, "vkCmdClearColorImage"); + glad_vkCmdClearDepthStencilImage = (PFN_vkCmdClearDepthStencilImage) load(userptr, "vkCmdClearDepthStencilImage"); + glad_vkCmdCopyBuffer = (PFN_vkCmdCopyBuffer) load(userptr, "vkCmdCopyBuffer"); + glad_vkCmdCopyBufferToImage = (PFN_vkCmdCopyBufferToImage) load(userptr, "vkCmdCopyBufferToImage"); + glad_vkCmdCopyImage = (PFN_vkCmdCopyImage) load(userptr, "vkCmdCopyImage"); + glad_vkCmdCopyImageToBuffer = (PFN_vkCmdCopyImageToBuffer) load(userptr, "vkCmdCopyImageToBuffer"); + glad_vkCmdCopyQueryPoolResults = (PFN_vkCmdCopyQueryPoolResults) load(userptr, "vkCmdCopyQueryPoolResults"); + glad_vkCmdDispatch = (PFN_vkCmdDispatch) load(userptr, "vkCmdDispatch"); + glad_vkCmdDispatchIndirect = (PFN_vkCmdDispatchIndirect) load(userptr, "vkCmdDispatchIndirect"); + glad_vkCmdDraw = (PFN_vkCmdDraw) load(userptr, "vkCmdDraw"); + glad_vkCmdDrawIndexed = (PFN_vkCmdDrawIndexed) load(userptr, "vkCmdDrawIndexed"); + glad_vkCmdDrawIndexedIndirect = (PFN_vkCmdDrawIndexedIndirect) load(userptr, "vkCmdDrawIndexedIndirect"); + glad_vkCmdDrawIndirect = (PFN_vkCmdDrawIndirect) load(userptr, "vkCmdDrawIndirect"); + glad_vkCmdEndQuery = (PFN_vkCmdEndQuery) load(userptr, "vkCmdEndQuery"); + glad_vkCmdEndRenderPass = (PFN_vkCmdEndRenderPass) load(userptr, "vkCmdEndRenderPass"); + glad_vkCmdExecuteCommands = (PFN_vkCmdExecuteCommands) load(userptr, "vkCmdExecuteCommands"); + glad_vkCmdFillBuffer = (PFN_vkCmdFillBuffer) load(userptr, "vkCmdFillBuffer"); + glad_vkCmdNextSubpass = (PFN_vkCmdNextSubpass) load(userptr, "vkCmdNextSubpass"); + glad_vkCmdPipelineBarrier = (PFN_vkCmdPipelineBarrier) load(userptr, "vkCmdPipelineBarrier"); + glad_vkCmdPushConstants = (PFN_vkCmdPushConstants) load(userptr, "vkCmdPushConstants"); + glad_vkCmdResetEvent = (PFN_vkCmdResetEvent) load(userptr, "vkCmdResetEvent"); + glad_vkCmdResetQueryPool = (PFN_vkCmdResetQueryPool) load(userptr, "vkCmdResetQueryPool"); + glad_vkCmdResolveImage = (PFN_vkCmdResolveImage) load(userptr, "vkCmdResolveImage"); + glad_vkCmdSetBlendConstants = (PFN_vkCmdSetBlendConstants) load(userptr, "vkCmdSetBlendConstants"); + glad_vkCmdSetDepthBias = (PFN_vkCmdSetDepthBias) load(userptr, "vkCmdSetDepthBias"); + glad_vkCmdSetDepthBounds = (PFN_vkCmdSetDepthBounds) load(userptr, "vkCmdSetDepthBounds"); + glad_vkCmdSetEvent = (PFN_vkCmdSetEvent) load(userptr, "vkCmdSetEvent"); + glad_vkCmdSetLineWidth = (PFN_vkCmdSetLineWidth) load(userptr, "vkCmdSetLineWidth"); + glad_vkCmdSetScissor = (PFN_vkCmdSetScissor) load(userptr, "vkCmdSetScissor"); + glad_vkCmdSetStencilCompareMask = (PFN_vkCmdSetStencilCompareMask) load(userptr, "vkCmdSetStencilCompareMask"); + glad_vkCmdSetStencilReference = (PFN_vkCmdSetStencilReference) load(userptr, "vkCmdSetStencilReference"); + glad_vkCmdSetStencilWriteMask = (PFN_vkCmdSetStencilWriteMask) load(userptr, "vkCmdSetStencilWriteMask"); + glad_vkCmdSetViewport = (PFN_vkCmdSetViewport) load(userptr, "vkCmdSetViewport"); + glad_vkCmdUpdateBuffer = (PFN_vkCmdUpdateBuffer) load(userptr, "vkCmdUpdateBuffer"); + glad_vkCmdWaitEvents = (PFN_vkCmdWaitEvents) load(userptr, "vkCmdWaitEvents"); + glad_vkCmdWriteTimestamp = (PFN_vkCmdWriteTimestamp) load(userptr, "vkCmdWriteTimestamp"); + glad_vkCreateBuffer = (PFN_vkCreateBuffer) load(userptr, "vkCreateBuffer"); + glad_vkCreateBufferView = (PFN_vkCreateBufferView) load(userptr, "vkCreateBufferView"); + glad_vkCreateCommandPool = (PFN_vkCreateCommandPool) load(userptr, "vkCreateCommandPool"); + glad_vkCreateComputePipelines = (PFN_vkCreateComputePipelines) load(userptr, "vkCreateComputePipelines"); + glad_vkCreateDescriptorPool = (PFN_vkCreateDescriptorPool) load(userptr, "vkCreateDescriptorPool"); + glad_vkCreateDescriptorSetLayout = (PFN_vkCreateDescriptorSetLayout) load(userptr, "vkCreateDescriptorSetLayout"); + glad_vkCreateDevice = (PFN_vkCreateDevice) load(userptr, "vkCreateDevice"); + glad_vkCreateEvent = (PFN_vkCreateEvent) load(userptr, "vkCreateEvent"); + glad_vkCreateFence = (PFN_vkCreateFence) load(userptr, "vkCreateFence"); + glad_vkCreateFramebuffer = (PFN_vkCreateFramebuffer) load(userptr, "vkCreateFramebuffer"); + glad_vkCreateGraphicsPipelines = (PFN_vkCreateGraphicsPipelines) load(userptr, "vkCreateGraphicsPipelines"); + glad_vkCreateImage = (PFN_vkCreateImage) load(userptr, "vkCreateImage"); + glad_vkCreateImageView = (PFN_vkCreateImageView) load(userptr, "vkCreateImageView"); + glad_vkCreateInstance = (PFN_vkCreateInstance) load(userptr, "vkCreateInstance"); + glad_vkCreatePipelineCache = (PFN_vkCreatePipelineCache) load(userptr, "vkCreatePipelineCache"); + glad_vkCreatePipelineLayout = (PFN_vkCreatePipelineLayout) load(userptr, "vkCreatePipelineLayout"); + glad_vkCreateQueryPool = (PFN_vkCreateQueryPool) load(userptr, "vkCreateQueryPool"); + glad_vkCreateRenderPass = (PFN_vkCreateRenderPass) load(userptr, "vkCreateRenderPass"); + glad_vkCreateSampler = (PFN_vkCreateSampler) load(userptr, "vkCreateSampler"); + glad_vkCreateSemaphore = (PFN_vkCreateSemaphore) load(userptr, "vkCreateSemaphore"); + glad_vkCreateShaderModule = (PFN_vkCreateShaderModule) load(userptr, "vkCreateShaderModule"); + glad_vkDestroyBuffer = (PFN_vkDestroyBuffer) load(userptr, "vkDestroyBuffer"); + glad_vkDestroyBufferView = (PFN_vkDestroyBufferView) load(userptr, "vkDestroyBufferView"); + glad_vkDestroyCommandPool = (PFN_vkDestroyCommandPool) load(userptr, "vkDestroyCommandPool"); + glad_vkDestroyDescriptorPool = (PFN_vkDestroyDescriptorPool) load(userptr, "vkDestroyDescriptorPool"); + glad_vkDestroyDescriptorSetLayout = (PFN_vkDestroyDescriptorSetLayout) load(userptr, "vkDestroyDescriptorSetLayout"); + glad_vkDestroyDevice = (PFN_vkDestroyDevice) load(userptr, "vkDestroyDevice"); + glad_vkDestroyEvent = (PFN_vkDestroyEvent) load(userptr, "vkDestroyEvent"); + glad_vkDestroyFence = (PFN_vkDestroyFence) load(userptr, "vkDestroyFence"); + glad_vkDestroyFramebuffer = (PFN_vkDestroyFramebuffer) load(userptr, "vkDestroyFramebuffer"); + glad_vkDestroyImage = (PFN_vkDestroyImage) load(userptr, "vkDestroyImage"); + glad_vkDestroyImageView = (PFN_vkDestroyImageView) load(userptr, "vkDestroyImageView"); + glad_vkDestroyInstance = (PFN_vkDestroyInstance) load(userptr, "vkDestroyInstance"); + glad_vkDestroyPipeline = (PFN_vkDestroyPipeline) load(userptr, "vkDestroyPipeline"); + glad_vkDestroyPipelineCache = (PFN_vkDestroyPipelineCache) load(userptr, "vkDestroyPipelineCache"); + glad_vkDestroyPipelineLayout = (PFN_vkDestroyPipelineLayout) load(userptr, "vkDestroyPipelineLayout"); + glad_vkDestroyQueryPool = (PFN_vkDestroyQueryPool) load(userptr, "vkDestroyQueryPool"); + glad_vkDestroyRenderPass = (PFN_vkDestroyRenderPass) load(userptr, "vkDestroyRenderPass"); + glad_vkDestroySampler = (PFN_vkDestroySampler) load(userptr, "vkDestroySampler"); + glad_vkDestroySemaphore = (PFN_vkDestroySemaphore) load(userptr, "vkDestroySemaphore"); + glad_vkDestroyShaderModule = (PFN_vkDestroyShaderModule) load(userptr, "vkDestroyShaderModule"); + glad_vkDeviceWaitIdle = (PFN_vkDeviceWaitIdle) load(userptr, "vkDeviceWaitIdle"); + glad_vkEndCommandBuffer = (PFN_vkEndCommandBuffer) load(userptr, "vkEndCommandBuffer"); + glad_vkEnumerateDeviceExtensionProperties = (PFN_vkEnumerateDeviceExtensionProperties) load(userptr, "vkEnumerateDeviceExtensionProperties"); + glad_vkEnumerateDeviceLayerProperties = (PFN_vkEnumerateDeviceLayerProperties) load(userptr, "vkEnumerateDeviceLayerProperties"); + glad_vkEnumerateInstanceExtensionProperties = (PFN_vkEnumerateInstanceExtensionProperties) load(userptr, "vkEnumerateInstanceExtensionProperties"); + glad_vkEnumerateInstanceLayerProperties = (PFN_vkEnumerateInstanceLayerProperties) load(userptr, "vkEnumerateInstanceLayerProperties"); + glad_vkEnumeratePhysicalDevices = (PFN_vkEnumeratePhysicalDevices) load(userptr, "vkEnumeratePhysicalDevices"); + glad_vkFlushMappedMemoryRanges = (PFN_vkFlushMappedMemoryRanges) load(userptr, "vkFlushMappedMemoryRanges"); + glad_vkFreeCommandBuffers = (PFN_vkFreeCommandBuffers) load(userptr, "vkFreeCommandBuffers"); + glad_vkFreeDescriptorSets = (PFN_vkFreeDescriptorSets) load(userptr, "vkFreeDescriptorSets"); + glad_vkFreeMemory = (PFN_vkFreeMemory) load(userptr, "vkFreeMemory"); + glad_vkGetBufferMemoryRequirements = (PFN_vkGetBufferMemoryRequirements) load(userptr, "vkGetBufferMemoryRequirements"); + glad_vkGetDeviceMemoryCommitment = (PFN_vkGetDeviceMemoryCommitment) load(userptr, "vkGetDeviceMemoryCommitment"); + glad_vkGetDeviceProcAddr = (PFN_vkGetDeviceProcAddr) load(userptr, "vkGetDeviceProcAddr"); + glad_vkGetDeviceQueue = (PFN_vkGetDeviceQueue) load(userptr, "vkGetDeviceQueue"); + glad_vkGetEventStatus = (PFN_vkGetEventStatus) load(userptr, "vkGetEventStatus"); + glad_vkGetFenceStatus = (PFN_vkGetFenceStatus) load(userptr, "vkGetFenceStatus"); + glad_vkGetImageMemoryRequirements = (PFN_vkGetImageMemoryRequirements) load(userptr, "vkGetImageMemoryRequirements"); + glad_vkGetImageSparseMemoryRequirements = (PFN_vkGetImageSparseMemoryRequirements) load(userptr, "vkGetImageSparseMemoryRequirements"); + glad_vkGetImageSubresourceLayout = (PFN_vkGetImageSubresourceLayout) load(userptr, "vkGetImageSubresourceLayout"); + glad_vkGetInstanceProcAddr = (PFN_vkGetInstanceProcAddr) load(userptr, "vkGetInstanceProcAddr"); + glad_vkGetPhysicalDeviceFeatures = (PFN_vkGetPhysicalDeviceFeatures) load(userptr, "vkGetPhysicalDeviceFeatures"); + glad_vkGetPhysicalDeviceFormatProperties = (PFN_vkGetPhysicalDeviceFormatProperties) load(userptr, "vkGetPhysicalDeviceFormatProperties"); + glad_vkGetPhysicalDeviceImageFormatProperties = (PFN_vkGetPhysicalDeviceImageFormatProperties) load(userptr, "vkGetPhysicalDeviceImageFormatProperties"); + glad_vkGetPhysicalDeviceMemoryProperties = (PFN_vkGetPhysicalDeviceMemoryProperties) load(userptr, "vkGetPhysicalDeviceMemoryProperties"); + glad_vkGetPhysicalDeviceProperties = (PFN_vkGetPhysicalDeviceProperties) load(userptr, "vkGetPhysicalDeviceProperties"); + glad_vkGetPhysicalDeviceQueueFamilyProperties = (PFN_vkGetPhysicalDeviceQueueFamilyProperties) load(userptr, "vkGetPhysicalDeviceQueueFamilyProperties"); + glad_vkGetPhysicalDeviceSparseImageFormatProperties = (PFN_vkGetPhysicalDeviceSparseImageFormatProperties) load(userptr, "vkGetPhysicalDeviceSparseImageFormatProperties"); + glad_vkGetPipelineCacheData = (PFN_vkGetPipelineCacheData) load(userptr, "vkGetPipelineCacheData"); + glad_vkGetQueryPoolResults = (PFN_vkGetQueryPoolResults) load(userptr, "vkGetQueryPoolResults"); + glad_vkGetRenderAreaGranularity = (PFN_vkGetRenderAreaGranularity) load(userptr, "vkGetRenderAreaGranularity"); + glad_vkInvalidateMappedMemoryRanges = (PFN_vkInvalidateMappedMemoryRanges) load(userptr, "vkInvalidateMappedMemoryRanges"); + glad_vkMapMemory = (PFN_vkMapMemory) load(userptr, "vkMapMemory"); + glad_vkMergePipelineCaches = (PFN_vkMergePipelineCaches) load(userptr, "vkMergePipelineCaches"); + glad_vkQueueBindSparse = (PFN_vkQueueBindSparse) load(userptr, "vkQueueBindSparse"); + glad_vkQueueSubmit = (PFN_vkQueueSubmit) load(userptr, "vkQueueSubmit"); + glad_vkQueueWaitIdle = (PFN_vkQueueWaitIdle) load(userptr, "vkQueueWaitIdle"); + glad_vkResetCommandBuffer = (PFN_vkResetCommandBuffer) load(userptr, "vkResetCommandBuffer"); + glad_vkResetCommandPool = (PFN_vkResetCommandPool) load(userptr, "vkResetCommandPool"); + glad_vkResetDescriptorPool = (PFN_vkResetDescriptorPool) load(userptr, "vkResetDescriptorPool"); + glad_vkResetEvent = (PFN_vkResetEvent) load(userptr, "vkResetEvent"); + glad_vkResetFences = (PFN_vkResetFences) load(userptr, "vkResetFences"); + glad_vkSetEvent = (PFN_vkSetEvent) load(userptr, "vkSetEvent"); + glad_vkUnmapMemory = (PFN_vkUnmapMemory) load(userptr, "vkUnmapMemory"); + glad_vkUpdateDescriptorSets = (PFN_vkUpdateDescriptorSets) load(userptr, "vkUpdateDescriptorSets"); + glad_vkWaitForFences = (PFN_vkWaitForFences) load(userptr, "vkWaitForFences"); +} +static void glad_vk_load_VK_VERSION_1_1( GLADuserptrloadfunc load, void* userptr) { + if(!GLAD_VK_VERSION_1_1) return; + glad_vkBindBufferMemory2 = (PFN_vkBindBufferMemory2) load(userptr, "vkBindBufferMemory2"); + glad_vkBindImageMemory2 = (PFN_vkBindImageMemory2) load(userptr, "vkBindImageMemory2"); + glad_vkCmdDispatchBase = (PFN_vkCmdDispatchBase) load(userptr, "vkCmdDispatchBase"); + glad_vkCmdSetDeviceMask = (PFN_vkCmdSetDeviceMask) load(userptr, "vkCmdSetDeviceMask"); + glad_vkCreateDescriptorUpdateTemplate = (PFN_vkCreateDescriptorUpdateTemplate) load(userptr, "vkCreateDescriptorUpdateTemplate"); + glad_vkCreateSamplerYcbcrConversion = (PFN_vkCreateSamplerYcbcrConversion) load(userptr, "vkCreateSamplerYcbcrConversion"); + glad_vkDestroyDescriptorUpdateTemplate = (PFN_vkDestroyDescriptorUpdateTemplate) load(userptr, "vkDestroyDescriptorUpdateTemplate"); + glad_vkDestroySamplerYcbcrConversion = (PFN_vkDestroySamplerYcbcrConversion) load(userptr, "vkDestroySamplerYcbcrConversion"); + glad_vkEnumerateInstanceVersion = (PFN_vkEnumerateInstanceVersion) load(userptr, "vkEnumerateInstanceVersion"); + glad_vkEnumeratePhysicalDeviceGroups = (PFN_vkEnumeratePhysicalDeviceGroups) load(userptr, "vkEnumeratePhysicalDeviceGroups"); + glad_vkGetBufferMemoryRequirements2 = (PFN_vkGetBufferMemoryRequirements2) load(userptr, "vkGetBufferMemoryRequirements2"); + glad_vkGetDescriptorSetLayoutSupport = (PFN_vkGetDescriptorSetLayoutSupport) load(userptr, "vkGetDescriptorSetLayoutSupport"); + glad_vkGetDeviceGroupPeerMemoryFeatures = (PFN_vkGetDeviceGroupPeerMemoryFeatures) load(userptr, "vkGetDeviceGroupPeerMemoryFeatures"); + glad_vkGetDeviceQueue2 = (PFN_vkGetDeviceQueue2) load(userptr, "vkGetDeviceQueue2"); + glad_vkGetImageMemoryRequirements2 = (PFN_vkGetImageMemoryRequirements2) load(userptr, "vkGetImageMemoryRequirements2"); + glad_vkGetImageSparseMemoryRequirements2 = (PFN_vkGetImageSparseMemoryRequirements2) load(userptr, "vkGetImageSparseMemoryRequirements2"); + glad_vkGetPhysicalDeviceExternalBufferProperties = (PFN_vkGetPhysicalDeviceExternalBufferProperties) load(userptr, "vkGetPhysicalDeviceExternalBufferProperties"); + glad_vkGetPhysicalDeviceExternalFenceProperties = (PFN_vkGetPhysicalDeviceExternalFenceProperties) load(userptr, "vkGetPhysicalDeviceExternalFenceProperties"); + glad_vkGetPhysicalDeviceExternalSemaphoreProperties = (PFN_vkGetPhysicalDeviceExternalSemaphoreProperties) load(userptr, "vkGetPhysicalDeviceExternalSemaphoreProperties"); + glad_vkGetPhysicalDeviceFeatures2 = (PFN_vkGetPhysicalDeviceFeatures2) load(userptr, "vkGetPhysicalDeviceFeatures2"); + glad_vkGetPhysicalDeviceFormatProperties2 = (PFN_vkGetPhysicalDeviceFormatProperties2) load(userptr, "vkGetPhysicalDeviceFormatProperties2"); + glad_vkGetPhysicalDeviceImageFormatProperties2 = (PFN_vkGetPhysicalDeviceImageFormatProperties2) load(userptr, "vkGetPhysicalDeviceImageFormatProperties2"); + glad_vkGetPhysicalDeviceMemoryProperties2 = (PFN_vkGetPhysicalDeviceMemoryProperties2) load(userptr, "vkGetPhysicalDeviceMemoryProperties2"); + glad_vkGetPhysicalDeviceProperties2 = (PFN_vkGetPhysicalDeviceProperties2) load(userptr, "vkGetPhysicalDeviceProperties2"); + glad_vkGetPhysicalDeviceQueueFamilyProperties2 = (PFN_vkGetPhysicalDeviceQueueFamilyProperties2) load(userptr, "vkGetPhysicalDeviceQueueFamilyProperties2"); + glad_vkGetPhysicalDeviceSparseImageFormatProperties2 = (PFN_vkGetPhysicalDeviceSparseImageFormatProperties2) load(userptr, "vkGetPhysicalDeviceSparseImageFormatProperties2"); + glad_vkTrimCommandPool = (PFN_vkTrimCommandPool) load(userptr, "vkTrimCommandPool"); + glad_vkUpdateDescriptorSetWithTemplate = (PFN_vkUpdateDescriptorSetWithTemplate) load(userptr, "vkUpdateDescriptorSetWithTemplate"); +} +static void glad_vk_load_VK_VERSION_1_2( GLADuserptrloadfunc load, void* userptr) { + if(!GLAD_VK_VERSION_1_2) return; + glad_vkCmdBeginRenderPass2 = (PFN_vkCmdBeginRenderPass2) load(userptr, "vkCmdBeginRenderPass2"); + glad_vkCmdDrawIndexedIndirectCount = (PFN_vkCmdDrawIndexedIndirectCount) load(userptr, "vkCmdDrawIndexedIndirectCount"); + glad_vkCmdDrawIndirectCount = (PFN_vkCmdDrawIndirectCount) load(userptr, "vkCmdDrawIndirectCount"); + glad_vkCmdEndRenderPass2 = (PFN_vkCmdEndRenderPass2) load(userptr, "vkCmdEndRenderPass2"); + glad_vkCmdNextSubpass2 = (PFN_vkCmdNextSubpass2) load(userptr, "vkCmdNextSubpass2"); + glad_vkCreateRenderPass2 = (PFN_vkCreateRenderPass2) load(userptr, "vkCreateRenderPass2"); + glad_vkGetBufferDeviceAddress = (PFN_vkGetBufferDeviceAddress) load(userptr, "vkGetBufferDeviceAddress"); + glad_vkGetBufferOpaqueCaptureAddress = (PFN_vkGetBufferOpaqueCaptureAddress) load(userptr, "vkGetBufferOpaqueCaptureAddress"); + glad_vkGetDeviceMemoryOpaqueCaptureAddress = (PFN_vkGetDeviceMemoryOpaqueCaptureAddress) load(userptr, "vkGetDeviceMemoryOpaqueCaptureAddress"); + glad_vkGetSemaphoreCounterValue = (PFN_vkGetSemaphoreCounterValue) load(userptr, "vkGetSemaphoreCounterValue"); + glad_vkResetQueryPool = (PFN_vkResetQueryPool) load(userptr, "vkResetQueryPool"); + glad_vkSignalSemaphore = (PFN_vkSignalSemaphore) load(userptr, "vkSignalSemaphore"); + glad_vkWaitSemaphores = (PFN_vkWaitSemaphores) load(userptr, "vkWaitSemaphores"); +} +static void glad_vk_load_VK_VERSION_1_3( GLADuserptrloadfunc load, void* userptr) { + if(!GLAD_VK_VERSION_1_3) return; + glad_vkCmdBeginRendering = (PFN_vkCmdBeginRendering) load(userptr, "vkCmdBeginRendering"); + glad_vkCmdBindVertexBuffers2 = (PFN_vkCmdBindVertexBuffers2) load(userptr, "vkCmdBindVertexBuffers2"); + glad_vkCmdBlitImage2 = (PFN_vkCmdBlitImage2) load(userptr, "vkCmdBlitImage2"); + glad_vkCmdCopyBuffer2 = (PFN_vkCmdCopyBuffer2) load(userptr, "vkCmdCopyBuffer2"); + glad_vkCmdCopyBufferToImage2 = (PFN_vkCmdCopyBufferToImage2) load(userptr, "vkCmdCopyBufferToImage2"); + glad_vkCmdCopyImage2 = (PFN_vkCmdCopyImage2) load(userptr, "vkCmdCopyImage2"); + glad_vkCmdCopyImageToBuffer2 = (PFN_vkCmdCopyImageToBuffer2) load(userptr, "vkCmdCopyImageToBuffer2"); + glad_vkCmdEndRendering = (PFN_vkCmdEndRendering) load(userptr, "vkCmdEndRendering"); + glad_vkCmdPipelineBarrier2 = (PFN_vkCmdPipelineBarrier2) load(userptr, "vkCmdPipelineBarrier2"); + glad_vkCmdResetEvent2 = (PFN_vkCmdResetEvent2) load(userptr, "vkCmdResetEvent2"); + glad_vkCmdResolveImage2 = (PFN_vkCmdResolveImage2) load(userptr, "vkCmdResolveImage2"); + glad_vkCmdSetCullMode = (PFN_vkCmdSetCullMode) load(userptr, "vkCmdSetCullMode"); + glad_vkCmdSetDepthBiasEnable = (PFN_vkCmdSetDepthBiasEnable) load(userptr, "vkCmdSetDepthBiasEnable"); + glad_vkCmdSetDepthBoundsTestEnable = (PFN_vkCmdSetDepthBoundsTestEnable) load(userptr, "vkCmdSetDepthBoundsTestEnable"); + glad_vkCmdSetDepthCompareOp = (PFN_vkCmdSetDepthCompareOp) load(userptr, "vkCmdSetDepthCompareOp"); + glad_vkCmdSetDepthTestEnable = (PFN_vkCmdSetDepthTestEnable) load(userptr, "vkCmdSetDepthTestEnable"); + glad_vkCmdSetDepthWriteEnable = (PFN_vkCmdSetDepthWriteEnable) load(userptr, "vkCmdSetDepthWriteEnable"); + glad_vkCmdSetEvent2 = (PFN_vkCmdSetEvent2) load(userptr, "vkCmdSetEvent2"); + glad_vkCmdSetFrontFace = (PFN_vkCmdSetFrontFace) load(userptr, "vkCmdSetFrontFace"); + glad_vkCmdSetPrimitiveRestartEnable = (PFN_vkCmdSetPrimitiveRestartEnable) load(userptr, "vkCmdSetPrimitiveRestartEnable"); + glad_vkCmdSetPrimitiveTopology = (PFN_vkCmdSetPrimitiveTopology) load(userptr, "vkCmdSetPrimitiveTopology"); + glad_vkCmdSetRasterizerDiscardEnable = (PFN_vkCmdSetRasterizerDiscardEnable) load(userptr, "vkCmdSetRasterizerDiscardEnable"); + glad_vkCmdSetScissorWithCount = (PFN_vkCmdSetScissorWithCount) load(userptr, "vkCmdSetScissorWithCount"); + glad_vkCmdSetStencilOp = (PFN_vkCmdSetStencilOp) load(userptr, "vkCmdSetStencilOp"); + glad_vkCmdSetStencilTestEnable = (PFN_vkCmdSetStencilTestEnable) load(userptr, "vkCmdSetStencilTestEnable"); + glad_vkCmdSetViewportWithCount = (PFN_vkCmdSetViewportWithCount) load(userptr, "vkCmdSetViewportWithCount"); + glad_vkCmdWaitEvents2 = (PFN_vkCmdWaitEvents2) load(userptr, "vkCmdWaitEvents2"); + glad_vkCmdWriteTimestamp2 = (PFN_vkCmdWriteTimestamp2) load(userptr, "vkCmdWriteTimestamp2"); + glad_vkCreatePrivateDataSlot = (PFN_vkCreatePrivateDataSlot) load(userptr, "vkCreatePrivateDataSlot"); + glad_vkDestroyPrivateDataSlot = (PFN_vkDestroyPrivateDataSlot) load(userptr, "vkDestroyPrivateDataSlot"); + glad_vkGetDeviceBufferMemoryRequirements = (PFN_vkGetDeviceBufferMemoryRequirements) load(userptr, "vkGetDeviceBufferMemoryRequirements"); + glad_vkGetDeviceImageMemoryRequirements = (PFN_vkGetDeviceImageMemoryRequirements) load(userptr, "vkGetDeviceImageMemoryRequirements"); + glad_vkGetDeviceImageSparseMemoryRequirements = (PFN_vkGetDeviceImageSparseMemoryRequirements) load(userptr, "vkGetDeviceImageSparseMemoryRequirements"); + glad_vkGetPhysicalDeviceToolProperties = (PFN_vkGetPhysicalDeviceToolProperties) load(userptr, "vkGetPhysicalDeviceToolProperties"); + glad_vkGetPrivateData = (PFN_vkGetPrivateData) load(userptr, "vkGetPrivateData"); + glad_vkQueueSubmit2 = (PFN_vkQueueSubmit2) load(userptr, "vkQueueSubmit2"); + glad_vkSetPrivateData = (PFN_vkSetPrivateData) load(userptr, "vkSetPrivateData"); +} +static void glad_vk_load_VK_EXT_debug_report( GLADuserptrloadfunc load, void* userptr) { + if(!GLAD_VK_EXT_debug_report) return; + glad_vkCreateDebugReportCallbackEXT = (PFN_vkCreateDebugReportCallbackEXT) load(userptr, "vkCreateDebugReportCallbackEXT"); + glad_vkDebugReportMessageEXT = (PFN_vkDebugReportMessageEXT) load(userptr, "vkDebugReportMessageEXT"); + glad_vkDestroyDebugReportCallbackEXT = (PFN_vkDestroyDebugReportCallbackEXT) load(userptr, "vkDestroyDebugReportCallbackEXT"); +} +static void glad_vk_load_VK_KHR_surface( GLADuserptrloadfunc load, void* userptr) { + if(!GLAD_VK_KHR_surface) return; + glad_vkDestroySurfaceKHR = (PFN_vkDestroySurfaceKHR) load(userptr, "vkDestroySurfaceKHR"); + glad_vkGetPhysicalDeviceSurfaceCapabilitiesKHR = (PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR) load(userptr, "vkGetPhysicalDeviceSurfaceCapabilitiesKHR"); + glad_vkGetPhysicalDeviceSurfaceFormatsKHR = (PFN_vkGetPhysicalDeviceSurfaceFormatsKHR) load(userptr, "vkGetPhysicalDeviceSurfaceFormatsKHR"); + glad_vkGetPhysicalDeviceSurfacePresentModesKHR = (PFN_vkGetPhysicalDeviceSurfacePresentModesKHR) load(userptr, "vkGetPhysicalDeviceSurfacePresentModesKHR"); + glad_vkGetPhysicalDeviceSurfaceSupportKHR = (PFN_vkGetPhysicalDeviceSurfaceSupportKHR) load(userptr, "vkGetPhysicalDeviceSurfaceSupportKHR"); +} +static void glad_vk_load_VK_KHR_swapchain( GLADuserptrloadfunc load, void* userptr) { + if(!GLAD_VK_KHR_swapchain) return; + glad_vkAcquireNextImage2KHR = (PFN_vkAcquireNextImage2KHR) load(userptr, "vkAcquireNextImage2KHR"); + glad_vkAcquireNextImageKHR = (PFN_vkAcquireNextImageKHR) load(userptr, "vkAcquireNextImageKHR"); + glad_vkCreateSwapchainKHR = (PFN_vkCreateSwapchainKHR) load(userptr, "vkCreateSwapchainKHR"); + glad_vkDestroySwapchainKHR = (PFN_vkDestroySwapchainKHR) load(userptr, "vkDestroySwapchainKHR"); + glad_vkGetDeviceGroupPresentCapabilitiesKHR = (PFN_vkGetDeviceGroupPresentCapabilitiesKHR) load(userptr, "vkGetDeviceGroupPresentCapabilitiesKHR"); + glad_vkGetDeviceGroupSurfacePresentModesKHR = (PFN_vkGetDeviceGroupSurfacePresentModesKHR) load(userptr, "vkGetDeviceGroupSurfacePresentModesKHR"); + glad_vkGetPhysicalDevicePresentRectanglesKHR = (PFN_vkGetPhysicalDevicePresentRectanglesKHR) load(userptr, "vkGetPhysicalDevicePresentRectanglesKHR"); + glad_vkGetSwapchainImagesKHR = (PFN_vkGetSwapchainImagesKHR) load(userptr, "vkGetSwapchainImagesKHR"); + glad_vkQueuePresentKHR = (PFN_vkQueuePresentKHR) load(userptr, "vkQueuePresentKHR"); +} + + + +static int glad_vk_get_extensions( VkPhysicalDevice physical_device, uint32_t *out_extension_count, char ***out_extensions) { + uint32_t i; + uint32_t instance_extension_count = 0; + uint32_t device_extension_count = 0; + uint32_t max_extension_count = 0; + uint32_t total_extension_count = 0; + char **extensions = NULL; + VkExtensionProperties *ext_properties = NULL; + VkResult result; + + if (glad_vkEnumerateInstanceExtensionProperties == NULL || (physical_device != NULL && glad_vkEnumerateDeviceExtensionProperties == NULL)) { + return 0; + } + + result = glad_vkEnumerateInstanceExtensionProperties(NULL, &instance_extension_count, NULL); + if (result != VK_SUCCESS) { + return 0; + } + + if (physical_device != NULL) { + result = glad_vkEnumerateDeviceExtensionProperties(physical_device, NULL, &device_extension_count, NULL); + if (result != VK_SUCCESS) { + return 0; + } + } + + total_extension_count = instance_extension_count + device_extension_count; + if (total_extension_count <= 0) { + return 0; + } + + max_extension_count = instance_extension_count > device_extension_count + ? instance_extension_count : device_extension_count; + + ext_properties = (VkExtensionProperties*) malloc(max_extension_count * sizeof(VkExtensionProperties)); + if (ext_properties == NULL) { + goto glad_vk_get_extensions_error; + } + + result = glad_vkEnumerateInstanceExtensionProperties(NULL, &instance_extension_count, ext_properties); + if (result != VK_SUCCESS) { + goto glad_vk_get_extensions_error; + } + + extensions = (char**) calloc(total_extension_count, sizeof(char*)); + if (extensions == NULL) { + goto glad_vk_get_extensions_error; + } + + for (i = 0; i < instance_extension_count; ++i) { + VkExtensionProperties ext = ext_properties[i]; + + size_t extension_name_length = strlen(ext.extensionName) + 1; + extensions[i] = (char*) malloc(extension_name_length * sizeof(char)); + if (extensions[i] == NULL) { + goto glad_vk_get_extensions_error; + } + memcpy(extensions[i], ext.extensionName, extension_name_length * sizeof(char)); + } + + if (physical_device != NULL) { + result = glad_vkEnumerateDeviceExtensionProperties(physical_device, NULL, &device_extension_count, ext_properties); + if (result != VK_SUCCESS) { + goto glad_vk_get_extensions_error; + } + + for (i = 0; i < device_extension_count; ++i) { + VkExtensionProperties ext = ext_properties[i]; + + size_t extension_name_length = strlen(ext.extensionName) + 1; + extensions[instance_extension_count + i] = (char*) malloc(extension_name_length * sizeof(char)); + if (extensions[instance_extension_count + i] == NULL) { + goto glad_vk_get_extensions_error; + } + memcpy(extensions[instance_extension_count + i], ext.extensionName, extension_name_length * sizeof(char)); + } + } + + free((void*) ext_properties); + + *out_extension_count = total_extension_count; + *out_extensions = extensions; + + return 1; + +glad_vk_get_extensions_error: + free((void*) ext_properties); + if (extensions != NULL) { + for (i = 0; i < total_extension_count; ++i) { + free((void*) extensions[i]); + } + free(extensions); + } + return 0; +} + +static void glad_vk_free_extensions(uint32_t extension_count, char **extensions) { + uint32_t i; + + for(i = 0; i < extension_count ; ++i) { + free((void*) (extensions[i])); + } + + free((void*) extensions); +} + +static int glad_vk_has_extension(const char *name, uint32_t extension_count, char **extensions) { + uint32_t i; + + for (i = 0; i < extension_count; ++i) { + if(extensions[i] != NULL && strcmp(name, extensions[i]) == 0) { + return 1; + } + } + + return 0; +} + +static GLADapiproc glad_vk_get_proc_from_userptr(void *userptr, const char* name) { + return (GLAD_GNUC_EXTENSION (GLADapiproc (*)(const char *name)) userptr)(name); +} + +static int glad_vk_find_extensions_vulkan( VkPhysicalDevice physical_device) { + uint32_t extension_count = 0; + char **extensions = NULL; + if (!glad_vk_get_extensions(physical_device, &extension_count, &extensions)) return 0; + + GLAD_VK_EXT_debug_report = glad_vk_has_extension("VK_EXT_debug_report", extension_count, extensions); + GLAD_VK_KHR_portability_enumeration = glad_vk_has_extension("VK_KHR_portability_enumeration", extension_count, extensions); + GLAD_VK_KHR_surface = glad_vk_has_extension("VK_KHR_surface", extension_count, extensions); + GLAD_VK_KHR_swapchain = glad_vk_has_extension("VK_KHR_swapchain", extension_count, extensions); + + (void) glad_vk_has_extension; + + glad_vk_free_extensions(extension_count, extensions); + + return 1; +} + +static int glad_vk_find_core_vulkan( VkPhysicalDevice physical_device) { + int major = 1; + int minor = 0; + +#ifdef VK_VERSION_1_1 + if (glad_vkEnumerateInstanceVersion != NULL) { + uint32_t version; + VkResult result; + + result = glad_vkEnumerateInstanceVersion(&version); + if (result == VK_SUCCESS) { + major = (int) VK_VERSION_MAJOR(version); + minor = (int) VK_VERSION_MINOR(version); + } + } +#endif + + if (physical_device != NULL && glad_vkGetPhysicalDeviceProperties != NULL) { + VkPhysicalDeviceProperties properties; + glad_vkGetPhysicalDeviceProperties(physical_device, &properties); + + major = (int) VK_VERSION_MAJOR(properties.apiVersion); + minor = (int) VK_VERSION_MINOR(properties.apiVersion); + } + + GLAD_VK_VERSION_1_0 = (major == 1 && minor >= 0) || major > 1; + GLAD_VK_VERSION_1_1 = (major == 1 && minor >= 1) || major > 1; + GLAD_VK_VERSION_1_2 = (major == 1 && minor >= 2) || major > 1; + GLAD_VK_VERSION_1_3 = (major == 1 && minor >= 3) || major > 1; + + return GLAD_MAKE_VERSION(major, minor); +} + +int gladLoadVulkanUserPtr( VkPhysicalDevice physical_device, GLADuserptrloadfunc load, void *userptr) { + int version; + +#ifdef VK_VERSION_1_1 + glad_vkEnumerateInstanceVersion = (PFN_vkEnumerateInstanceVersion) load(userptr, "vkEnumerateInstanceVersion"); +#endif + version = glad_vk_find_core_vulkan( physical_device); + if (!version) { + return 0; + } + + glad_vk_load_VK_VERSION_1_0(load, userptr); + glad_vk_load_VK_VERSION_1_1(load, userptr); + glad_vk_load_VK_VERSION_1_2(load, userptr); + glad_vk_load_VK_VERSION_1_3(load, userptr); + + if (!glad_vk_find_extensions_vulkan( physical_device)) return 0; + glad_vk_load_VK_EXT_debug_report(load, userptr); + glad_vk_load_VK_KHR_surface(load, userptr); + glad_vk_load_VK_KHR_swapchain(load, userptr); + + + return version; +} + + +int gladLoadVulkan( VkPhysicalDevice physical_device, GLADloadfunc load) { + return gladLoadVulkanUserPtr( physical_device, glad_vk_get_proc_from_userptr, GLAD_GNUC_EXTENSION (void*) load); +} + + + + + + +#ifdef __cplusplus +} +#endif + +#endif /* GLAD_VULKAN_IMPLEMENTATION */ + diff --git a/thirdparty/glfw/deps/linmath.h b/thirdparty/glfw/deps/linmath.h index 0ab7a414b..5c8026565 100644 --- a/thirdparty/glfw/deps/linmath.h +++ b/thirdparty/glfw/deps/linmath.h @@ -1,70 +1,96 @@ #ifndef LINMATH_H #define LINMATH_H +#include #include +#include -#ifdef _MSC_VER -#define inline __inline +/* 2021-03-21 Camilla Löwy + * - Replaced double constants with float equivalents + */ + +#ifdef LINMATH_NO_INLINE +#define LINMATH_H_FUNC static +#else +#define LINMATH_H_FUNC static inline #endif #define LINMATH_H_DEFINE_VEC(n) \ typedef float vec##n[n]; \ -static inline void vec##n##_add(vec##n r, vec##n const a, vec##n const b) \ +LINMATH_H_FUNC void vec##n##_add(vec##n r, vec##n const a, vec##n const b) \ { \ int i; \ for(i=0; ib[i] ? a[i] : b[i]; \ +} \ +LINMATH_H_FUNC void vec##n##_dup(vec##n r, vec##n const src) \ +{ \ + int i; \ + for(i=0; i 1e-4) { - mat4x4 T, C, S = {{0}}; - vec3_norm(u, u); + mat4x4 T; mat4x4_from_vec3_mul_outer(T, u, u); - S[1][2] = u[0]; - S[2][1] = -u[0]; - S[2][0] = u[1]; - S[0][2] = -u[1]; - S[0][1] = u[2]; - S[1][0] = -u[2]; - + mat4x4 S = { + { 0, u[2], -u[1], 0}, + {-u[2], 0, u[0], 0}, + { u[1], -u[0], 0, 0}, + { 0, 0, 0, 0} + }; mat4x4_scale(S, S, s); + mat4x4 C; mat4x4_identity(C); mat4x4_sub(C, C, T); @@ -214,13 +237,13 @@ static inline void mat4x4_rotate(mat4x4 R, mat4x4 M, float x, float y, float z, mat4x4_add(T, T, C); mat4x4_add(T, T, S); - T[3][3] = 1.; + T[3][3] = 1.f; mat4x4_mul(R, M, T); } else { mat4x4_dup(R, M); } } -static inline void mat4x4_rotate_X(mat4x4 Q, mat4x4 M, float angle) +LINMATH_H_FUNC void mat4x4_rotate_X(mat4x4 Q, mat4x4 const M, float angle) { float s = sinf(angle); float c = cosf(angle); @@ -232,7 +255,7 @@ static inline void mat4x4_rotate_X(mat4x4 Q, mat4x4 M, float angle) }; mat4x4_mul(Q, M, R); } -static inline void mat4x4_rotate_Y(mat4x4 Q, mat4x4 M, float angle) +LINMATH_H_FUNC void mat4x4_rotate_Y(mat4x4 Q, mat4x4 const M, float angle) { float s = sinf(angle); float c = cosf(angle); @@ -244,7 +267,7 @@ static inline void mat4x4_rotate_Y(mat4x4 Q, mat4x4 M, float angle) }; mat4x4_mul(Q, M, R); } -static inline void mat4x4_rotate_Z(mat4x4 Q, mat4x4 M, float angle) +LINMATH_H_FUNC void mat4x4_rotate_Z(mat4x4 Q, mat4x4 const M, float angle) { float s = sinf(angle); float c = cosf(angle); @@ -256,9 +279,8 @@ static inline void mat4x4_rotate_Z(mat4x4 Q, mat4x4 M, float angle) }; mat4x4_mul(Q, M, R); } -static inline void mat4x4_invert(mat4x4 T, mat4x4 M) +LINMATH_H_FUNC void mat4x4_invert(mat4x4 T, mat4x4 const M) { - float idet; float s[6]; float c[6]; s[0] = M[0][0]*M[1][1] - M[1][0]*M[0][1]; @@ -274,10 +296,10 @@ static inline void mat4x4_invert(mat4x4 T, mat4x4 M) c[3] = M[2][1]*M[3][2] - M[3][1]*M[2][2]; c[4] = M[2][1]*M[3][3] - M[3][1]*M[2][3]; c[5] = M[2][2]*M[3][3] - M[3][2]*M[2][3]; - + /* Assumes it is invertible */ - idet = 1.0f/( s[0]*c[5]-s[1]*c[4]+s[2]*c[3]+s[3]*c[2]-s[4]*c[1]+s[5]*c[0] ); - + float idet = 1.0f/( s[0]*c[5]-s[1]*c[4]+s[2]*c[3]+s[3]*c[2]-s[4]*c[1]+s[5]*c[0] ); + T[0][0] = ( M[1][1] * c[5] - M[1][2] * c[4] + M[1][3] * c[3]) * idet; T[0][1] = (-M[0][1] * c[5] + M[0][2] * c[4] - M[0][3] * c[3]) * idet; T[0][2] = ( M[3][1] * s[5] - M[3][2] * s[4] + M[3][3] * s[3]) * idet; @@ -298,23 +320,22 @@ static inline void mat4x4_invert(mat4x4 T, mat4x4 M) T[3][2] = (-M[3][0] * s[3] + M[3][1] * s[1] - M[3][2] * s[0]) * idet; T[3][3] = ( M[2][0] * s[3] - M[2][1] * s[1] + M[2][2] * s[0]) * idet; } -static inline void mat4x4_orthonormalize(mat4x4 R, mat4x4 M) +LINMATH_H_FUNC void mat4x4_orthonormalize(mat4x4 R, mat4x4 const M) { - float s = 1.; + mat4x4_dup(R, M); + float s = 1.f; vec3 h; - mat4x4_dup(R, M); vec3_norm(R[2], R[2]); - + s = vec3_mul_inner(R[1], R[2]); vec3_scale(h, R[2], s); vec3_sub(R[1], R[1], h); - vec3_norm(R[2], R[2]); + vec3_norm(R[1], R[1]); - s = vec3_mul_inner(R[1], R[2]); + s = vec3_mul_inner(R[0], R[2]); vec3_scale(h, R[2], s); - vec3_sub(R[1], R[1], h); - vec3_norm(R[1], R[1]); + vec3_sub(R[0], R[0], h); s = vec3_mul_inner(R[0], R[1]); vec3_scale(h, R[1], s); @@ -322,11 +343,11 @@ static inline void mat4x4_orthonormalize(mat4x4 R, mat4x4 M) vec3_norm(R[0], R[0]); } -static inline void mat4x4_frustum(mat4x4 M, float l, float r, float b, float t, float n, float f) +LINMATH_H_FUNC void mat4x4_frustum(mat4x4 M, float l, float r, float b, float t, float n, float f) { M[0][0] = 2.f*n/(r-l); M[0][1] = M[0][2] = M[0][3] = 0.f; - + M[1][1] = 2.f*n/(t-b); M[1][0] = M[1][2] = M[1][3] = 0.f; @@ -334,11 +355,11 @@ static inline void mat4x4_frustum(mat4x4 M, float l, float r, float b, float t, M[2][1] = (t+b)/(t-b); M[2][2] = -(f+n)/(f-n); M[2][3] = -1.f; - + M[3][2] = -2.f*(f*n)/(f-n); M[3][0] = M[3][1] = M[3][3] = 0.f; } -static inline void mat4x4_ortho(mat4x4 M, float l, float r, float b, float t, float n, float f) +LINMATH_H_FUNC void mat4x4_ortho(mat4x4 M, float l, float r, float b, float t, float n, float f) { M[0][0] = 2.f/(r-l); M[0][1] = M[0][2] = M[0][3] = 0.f; @@ -348,17 +369,17 @@ static inline void mat4x4_ortho(mat4x4 M, float l, float r, float b, float t, fl M[2][2] = -2.f/(f-n); M[2][0] = M[2][1] = M[2][3] = 0.f; - + M[3][0] = -(r+l)/(r-l); M[3][1] = -(t+b)/(t-b); M[3][2] = -(f+n)/(f-n); M[3][3] = 1.f; } -static inline void mat4x4_perspective(mat4x4 m, float y_fov, float aspect, float n, float f) +LINMATH_H_FUNC void mat4x4_perspective(mat4x4 m, float y_fov, float aspect, float n, float f) { /* NOTE: Degrees are an unhandy unit to work with. * linmath.h uses radians for everything! */ - float const a = 1.f / (float) tan(y_fov / 2.f); + float const a = 1.f / tanf(y_fov / 2.f); m[0][0] = a / aspect; m[0][1] = 0.f; @@ -380,7 +401,7 @@ static inline void mat4x4_perspective(mat4x4 m, float y_fov, float aspect, float m[3][2] = -((2.f * f * n) / (f - n)); m[3][3] = 0.f; } -static inline void mat4x4_look_at(mat4x4 m, vec3 eye, vec3 center, vec3 up) +LINMATH_H_FUNC void mat4x4_look_at(mat4x4 m, vec3 const eye, vec3 const center, vec3 const up) { /* Adapted from Android's OpenGL Matrix.java. */ /* See the OpenGL GLUT documentation for gluLookAt for a description */ @@ -389,15 +410,14 @@ static inline void mat4x4_look_at(mat4x4 m, vec3 eye, vec3 center, vec3 up) /* TODO: The negation of of can be spared by swapping the order of * operands in the following cross products in the right way. */ vec3 f; + vec3_sub(f, center, eye); + vec3_norm(f, f); + vec3 s; - vec3 t; - - vec3_sub(f, center, eye); - vec3_norm(f, f); - vec3_mul_cross(s, f, up); vec3_norm(s, s); + vec3 t; vec3_mul_cross(t, s, f); m[0][0] = s[0]; @@ -424,24 +444,18 @@ static inline void mat4x4_look_at(mat4x4 m, vec3 eye, vec3 center, vec3 up) } typedef float quat[4]; -static inline void quat_identity(quat q) +#define quat_add vec4_add +#define quat_sub vec4_sub +#define quat_norm vec4_norm +#define quat_scale vec4_scale +#define quat_mul_inner vec4_mul_inner + +LINMATH_H_FUNC void quat_identity(quat q) { q[0] = q[1] = q[2] = 0.f; q[3] = 1.f; } -static inline void quat_add(quat r, quat a, quat b) -{ - int i; - for(i=0; i<4; ++i) - r[i] = a[i] + b[i]; -} -static inline void quat_sub(quat r, quat a, quat b) -{ - int i; - for(i=0; i<4; ++i) - r[i] = a[i] - b[i]; -} -static inline void quat_mul(quat r, quat p, quat q) +LINMATH_H_FUNC void quat_mul(quat r, quat const p, quat const q) { vec3 w; vec3_mul_cross(r, p, q); @@ -451,56 +465,42 @@ static inline void quat_mul(quat r, quat p, quat q) vec3_add(r, r, w); r[3] = p[3]*q[3] - vec3_mul_inner(p, q); } -static inline void quat_scale(quat r, quat v, float s) -{ - int i; - for(i=0; i<4; ++i) - r[i] = v[i] * s; -} -static inline float quat_inner_product(quat a, quat b) -{ - float p = 0.f; - int i; - for(i=0; i<4; ++i) - p += b[i]*a[i]; - return p; -} -static inline void quat_conj(quat r, quat q) +LINMATH_H_FUNC void quat_conj(quat r, quat const q) { int i; for(i=0; i<3; ++i) r[i] = -q[i]; r[3] = q[3]; } -static inline void quat_rotate(quat r, float angle, vec3 axis) { - int i; - vec3 v; - vec3_scale(v, axis, sinf(angle / 2)); - for(i=0; i<3; ++i) - r[i] = v[i]; - r[3] = cosf(angle / 2); +LINMATH_H_FUNC void quat_rotate(quat r, float angle, vec3 const axis) { + vec3 axis_norm; + vec3_norm(axis_norm, axis); + float s = sinf(angle / 2); + float c = cosf(angle / 2); + vec3_scale(r, axis_norm, s); + r[3] = c; } -#define quat_norm vec4_norm -static inline void quat_mul_vec3(vec3 r, quat q, vec3 v) +LINMATH_H_FUNC void quat_mul_vec3(vec3 r, quat const q, vec3 const v) { /* * Method by Fabian 'ryg' Giessen (of Farbrausch) t = 2 * cross(q.xyz, v) v' = v + q.w * t + cross(q.xyz, t) */ - vec3 t = {q[0], q[1], q[2]}; + vec3 t; + vec3 q_xyz = {q[0], q[1], q[2]}; vec3 u = {q[0], q[1], q[2]}; - vec3_mul_cross(t, t, v); + vec3_mul_cross(t, q_xyz, v); vec3_scale(t, t, 2); - vec3_mul_cross(u, u, t); + vec3_mul_cross(u, q_xyz, t); vec3_scale(t, t, q[3]); vec3_add(r, v, t); vec3_add(r, r, u); } -static inline void mat4x4_from_quat(mat4x4 M, quat q) +LINMATH_H_FUNC void mat4x4_from_quat(mat4x4 M, quat const q) { float a = q[3]; float b = q[0]; @@ -510,7 +510,7 @@ static inline void mat4x4_from_quat(mat4x4 M, quat q) float b2 = b*b; float c2 = c*c; float d2 = d*d; - + M[0][0] = a2 + b2 - c2 - d2; M[0][1] = 2.f*(b*c + a*d); M[0][2] = 2.f*(b*d - a*c); @@ -530,18 +530,21 @@ static inline void mat4x4_from_quat(mat4x4 M, quat q) M[3][3] = 1.f; } -static inline void mat4x4o_mul_quat(mat4x4 R, mat4x4 M, quat q) +LINMATH_H_FUNC void mat4x4o_mul_quat(mat4x4 R, mat4x4 const M, quat const q) { -/* XXX: The way this is written only works for othogonal matrices. */ +/* XXX: The way this is written only works for orthogonal matrices. */ /* TODO: Take care of non-orthogonal case. */ quat_mul_vec3(R[0], q, M[0]); quat_mul_vec3(R[1], q, M[1]); quat_mul_vec3(R[2], q, M[2]); R[3][0] = R[3][1] = R[3][2] = 0.f; - R[3][3] = 1.f; + R[0][3] = M[0][3]; + R[1][3] = M[1][3]; + R[2][3] = M[2][3]; + R[3][3] = M[3][3]; // typically 1.0, but here we make it general } -static inline void quat_from_mat4x4(quat q, mat4x4 M) +LINMATH_H_FUNC void quat_from_mat4x4(quat q, mat4x4 const M) { float r=0.f; int i; @@ -557,7 +560,7 @@ static inline void quat_from_mat4x4(quat q, mat4x4 M) p = &perm[i]; } - r = (float) sqrt(1.f + M[p[0]][p[0]] - M[p[1]][p[1]] - M[p[2]][p[2]] ); + r = sqrtf(1.f + M[p[0]][p[0]] - M[p[1]][p[1]] - M[p[2]][p[2]] ); if(r < 1e-6) { q[0] = 1.f; @@ -571,4 +574,33 @@ static inline void quat_from_mat4x4(quat q, mat4x4 M) q[3] = (M[p[2]][p[1]] - M[p[1]][p[2]])/(2.f*r); } +LINMATH_H_FUNC void mat4x4_arcball(mat4x4 R, mat4x4 const M, vec2 const _a, vec2 const _b, float s) +{ + vec2 a; memcpy(a, _a, sizeof(a)); + vec2 b; memcpy(b, _b, sizeof(b)); + + float z_a = 0.f; + float z_b = 0.f; + + if(vec2_len(a) < 1.f) { + z_a = sqrtf(1.f - vec2_mul_inner(a, a)); + } else { + vec2_norm(a, a); + } + + if(vec2_len(b) < 1.f) { + z_b = sqrtf(1.f - vec2_mul_inner(b, b)); + } else { + vec2_norm(b, b); + } + + vec3 a_ = {a[0], a[1], z_a}; + vec3 b_ = {b[0], b[1], z_b}; + + vec3 c_; + vec3_mul_cross(c_, a_, b_); + + float const angle = acos(vec3_mul_inner(a_, b_)) * s; + mat4x4_rotate(R, M, c_[0], c_[1], c_[2], angle); +} #endif diff --git a/thirdparty/glfw/deps/nuklear.h b/thirdparty/glfw/deps/nuklear.h index 6c873535b..f2eb9dfa2 100644 --- a/thirdparty/glfw/deps/nuklear.h +++ b/thirdparty/glfw/deps/nuklear.h @@ -105,6 +105,8 @@ /// NK_INCLUDE_COMMAND_USERDATA | Defining this adds a userdata pointer into each command. Can be useful for example if you want to provide custom shaders depending on the used widget. Can be combined with the style structures. /// NK_BUTTON_TRIGGER_ON_RELEASE | Different platforms require button clicks occurring either on buttons being pressed (up to down) or released (down to up). By default this library will react on buttons being pressed, but if you define this it will only trigger if a button is released. /// NK_ZERO_COMMAND_MEMORY | Defining this will zero out memory for each drawing command added to a drawing queue (inside nk_command_buffer_push). Zeroing command memory is very useful for fast checking (using memcmp) if command buffers are equal and avoid drawing frames when nothing on screen has changed since previous frame. +/// NK_UINT_DRAW_INDEX | Defining this will set the size of vertex index elements when using NK_VERTEX_BUFFER_OUTPUT to 32bit instead of the default of 16bit +/// NK_KEYSTATE_BASED_INPUT | Define this if your backend uses key state for each frame rather than key press/release events /// /// !!! WARNING /// The following flags will pull in the standard C library: @@ -122,6 +124,7 @@ /// - NK_INCLUDE_DEFAULT_FONT /// - NK_INCLUDE_STANDARD_VARARGS /// - NK_INCLUDE_COMMAND_USERDATA +/// - NK_UINT_DRAW_INDEX /// /// ### Constants /// Define | Description @@ -301,6 +304,7 @@ extern "C" { #define NK_CLAMP(i,v,x) (NK_MAX(NK_MIN(v,x), i)) #ifdef NK_INCLUDE_STANDARD_VARARGS + #include /* valist, va_start, va_end, ... */ #if defined(_MSC_VER) && (_MSC_VER >= 1600) /* VS 2010 and above */ #include #define NK_PRINTF_FORMAT_STRING _Printf_format_string_ @@ -314,7 +318,6 @@ extern "C" { #define NK_PRINTF_VARARG_FUNC(fmtargnumber) #define NK_PRINTF_VALIST_FUNC(fmtargnumber) #endif - #include /* valist, va_start, va_end, ... */ #endif /* @@ -336,7 +339,7 @@ extern "C" { #define NK_POINTER_TYPE uintptr_t #else #ifndef NK_INT8 - #define NK_INT8 char + #define NK_INT8 signed char #endif #ifndef NK_UINT8 #define NK_UINT8 unsigned char @@ -1084,6 +1087,12 @@ NK_API void nk_input_end(struct nk_context*); /// /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c /// // fill configuration +/// struct your_vertex +/// { +/// float pos[2]; // important to keep it to 2 floats +/// float uv[2]; +/// unsigned char col[4]; +/// }; /// struct nk_convert_config cfg = {}; /// static const struct nk_draw_vertex_layout_element vertex_layout[] = { /// {NK_VERTEX_POSITION, NK_FORMAT_FLOAT, NK_OFFSETOF(struct your_vertex, pos)}, @@ -1209,7 +1218,7 @@ NK_API const struct nk_command* nk__next(struct nk_context*, const struct nk_com /// /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c /// nk_flags nk_convert(struct nk_context *ctx, struct nk_buffer *cmds, -// struct nk_buffer *vertices, struct nk_buffer *elements, const struct nk_convert_config*); +/// struct nk_buffer *vertices, struct nk_buffer *elements, const struct nk_convert_config*); /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /// /// Parameter | Description @@ -1394,6 +1403,7 @@ NK_API const struct nk_draw_command* nk__draw_next(const struct nk_draw_command* /// nk_window_get_content_region_max | Returns the upper rectangle position of the currently visible and non-clipped space inside the currently processed window /// nk_window_get_content_region_size | Returns the size of the currently visible and non-clipped space inside the currently processed window /// nk_window_get_canvas | Returns the draw command buffer. Can be used to draw custom widgets +/// nk_window_get_scroll | Gets the scroll offset of the current window /// nk_window_has_focus | Returns if the currently processed window is currently active /// nk_window_is_collapsed | Returns if the window with given name is currently minimized/collapsed /// nk_window_is_closed | Returns if the currently processed window was closed @@ -1407,6 +1417,7 @@ NK_API const struct nk_draw_command* nk__draw_next(const struct nk_draw_command* /// nk_window_set_position | Updates position of the currently process window /// nk_window_set_size | Updates the size of the currently processed window /// nk_window_set_focus | Set the currently processed window as active window +/// nk_window_set_scroll | Sets the scroll offset of the current window // /// nk_window_close | Closes the window with given window name which deletes the window at the end of the frame /// nk_window_collapse | Collapses the window with given window name @@ -1427,7 +1438,7 @@ NK_API const struct nk_draw_command* nk__draw_next(const struct nk_draw_command* /// NK_WINDOW_TITLE | Forces a header at the top at the window showing the title /// NK_WINDOW_SCROLL_AUTO_HIDE | Automatically hides the window scrollbar if no user interaction: also requires delta time in `nk_context` to be set each frame /// NK_WINDOW_BACKGROUND | Always keep window in the background -/// NK_WINDOW_SCALE_LEFT | Puts window scaler in the left-ottom corner instead right-bottom +/// NK_WINDOW_SCALE_LEFT | Puts window scaler in the left-bottom corner instead right-bottom /// NK_WINDOW_NO_INPUT | Prevents window of scaling, moving or getting focus /// /// #### nk_collapse_states @@ -1506,7 +1517,7 @@ NK_API void nk_end(struct nk_context *ctx); /// Finds and returns a window from passed name /// /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c -/// void nk_end(struct nk_context *ctx); +/// struct nk_window *nk_window_find(struct nk_context *ctx, const char *name); /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /// /// Parameter | Description @@ -1710,6 +1721,22 @@ NK_API struct nk_vec2 nk_window_get_content_region_size(struct nk_context*); /// drawing canvas. Can be used to do custom drawing. */ NK_API struct nk_command_buffer* nk_window_get_canvas(struct nk_context*); +/*/// #### nk_window_get_scroll +/// Gets the scroll offset for the current window +/// !!! WARNING +/// Only call this function between calls `nk_begin_xxx` and `nk_end` +/// +/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// void nk_window_get_scroll(struct nk_context *ctx, nk_uint *offset_x, nk_uint *offset_y); +/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// +/// Parameter | Description +/// -------------|----------------------------------------------------------- +/// __ctx__ | Must point to an previously initialized `nk_context` struct +/// __offset_x__ | A pointer to the x offset output (or NULL to ignore) +/// __offset_y__ | A pointer to the y offset output (or NULL to ignore) +*/ +NK_API void nk_window_get_scroll(struct nk_context*, nk_uint *offset_x, nk_uint *offset_y); /*/// #### nk_window_has_focus /// Returns if the currently processed window is currently active /// !!! WARNING @@ -1876,6 +1903,22 @@ NK_API void nk_window_set_size(struct nk_context*, const char *name, struct nk_v /// __name__ | Identifier of the window to set focus on */ NK_API void nk_window_set_focus(struct nk_context*, const char *name); +/*/// #### nk_window_set_scroll +/// Sets the scroll offset for the current window +/// !!! WARNING +/// Only call this function between calls `nk_begin_xxx` and `nk_end` +/// +/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// void nk_window_set_scroll(struct nk_context *ctx, nk_uint offset_x, nk_uint offset_y); +/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// +/// Parameter | Description +/// -------------|----------------------------------------------------------- +/// __ctx__ | Must point to an previously initialized `nk_context` struct +/// __offset_x__ | The x offset to scroll to +/// __offset_y__ | The y offset to scroll to +*/ +NK_API void nk_window_set_scroll(struct nk_context*, nk_uint offset_x, nk_uint offset_y); /*/// #### nk_window_close /// Closes a window and marks it for being freed at the end of the frame /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c @@ -2588,7 +2631,7 @@ NK_API struct nk_rect nk_layout_space_rect_to_local(struct nk_context*, struct n /// case ...: /// // [...] /// } -// nk_clear(&ctx); +/// nk_clear(&ctx); /// } /// nk_free(&ctx); /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -2601,6 +2644,8 @@ NK_API struct nk_rect nk_layout_space_rect_to_local(struct nk_context*, struct n /// nk_group_scrolled_offset_begin | Start a new group with manual separated handling of scrollbar x- and y-offset /// nk_group_scrolled_begin | Start a new group with manual scrollbar handling /// nk_group_scrolled_end | Ends a group with manual scrollbar handling. Should only be called if nk_group_begin returned non-zero +/// nk_group_get_scroll | Gets the scroll offset for the given group +/// nk_group_set_scroll | Sets the scroll offset for the given group */ /*/// #### nk_group_begin /// Starts a new widget group. Requires a previous layouting function to specify a pos/size. @@ -2690,11 +2735,39 @@ NK_API int nk_group_scrolled_begin(struct nk_context*, struct nk_scroll *off, co /// __ctx__ | Must point to an previously initialized `nk_context` struct */ NK_API void nk_group_scrolled_end(struct nk_context*); +/*/// #### nk_group_get_scroll +/// Gets the scroll position of the given group. +/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// void nk_group_get_scroll(struct nk_context*, const char *id, nk_uint *x_offset, nk_uint *y_offset); +/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// +/// Parameter | Description +/// -------------|----------------------------------------------------------- +/// __ctx__ | Must point to an previously initialized `nk_context` struct +/// __id__ | The id of the group to get the scroll position of +/// __x_offset__ | A pointer to the x offset output (or NULL to ignore) +/// __y_offset__ | A pointer to the y offset output (or NULL to ignore) +*/ +NK_API void nk_group_get_scroll(struct nk_context*, const char *id, nk_uint *x_offset, nk_uint *y_offset); +/*/// #### nk_group_set_scroll +/// Sets the scroll position of the given group. +/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~c +/// void nk_group_set_scroll(struct nk_context*, const char *id, nk_uint x_offset, nk_uint y_offset); +/// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/// +/// Parameter | Description +/// -------------|----------------------------------------------------------- +/// __ctx__ | Must point to an previously initialized `nk_context` struct +/// __id__ | The id of the group to scroll +/// __x_offset__ | The x offset to scroll to +/// __y_offset__ | The y offset to scroll to +*/ +NK_API void nk_group_set_scroll(struct nk_context*, const char *id, nk_uint x_offset, nk_uint y_offset); /* ============================================================================= * * TREE * - * ============================================================================= + * ============================================================================= /// ### Tree /// Trees represent two different concept. First the concept of a collapsable /// UI section that can be either in a hidden or visibile state. They allow the UI @@ -3187,7 +3260,7 @@ NK_API int nk_color_pick(struct nk_context*, struct nk_colorf*, enum nk_color_fo /// case ...: /// // [...] /// } -// nk_clear(&ctx); +/// nk_clear(&ctx); /// } /// nk_free(&ctx); /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -3395,6 +3468,8 @@ NK_API void nk_plot_function(struct nk_context*, enum nk_chart_type, void *userd NK_API int nk_popup_begin(struct nk_context*, enum nk_popup_type, const char*, nk_flags, struct nk_rect bounds); NK_API void nk_popup_close(struct nk_context*); NK_API void nk_popup_end(struct nk_context*); +NK_API void nk_popup_get_scroll(struct nk_context*, nk_uint *offset_x, nk_uint *offset_y); +NK_API void nk_popup_set_scroll(struct nk_context*, nk_uint offset_x, nk_uint offset_y); /* ============================================================================= * * COMBOBOX @@ -4588,7 +4663,11 @@ NK_API int nk_input_is_key_down(const struct nk_input*, enum nk_keys); In fact it is probably more powerful than needed but allows even more crazy things than this library provides by default. */ +#ifdef NK_UINT_DRAW_INDEX +typedef nk_uint nk_draw_index; +#else typedef nk_ushort nk_draw_index; +#endif enum nk_draw_list_stroke { NK_STROKE_OPEN = nk_false, /* build up path has no connection back to the beginning */ @@ -5603,7 +5682,6 @@ template struct nk_alignof{struct Big {T x; char c;}; enum { #endif /* NK_NUKLEAR_H_ */ - #ifdef NK_IMPLEMENTATION #ifndef NK_INTERNAL_H @@ -6007,15 +6085,18 @@ nk_sin(float x) NK_LIB float nk_cos(float x) { - NK_STORAGE const float a0 = +1.00238601909309722f; - NK_STORAGE const float a1 = -3.81919947353040024e-2f; - NK_STORAGE const float a2 = -3.94382342128062756e-1f; - NK_STORAGE const float a3 = -1.18134036025221444e-1f; - NK_STORAGE const float a4 = +1.07123798512170878e-1f; - NK_STORAGE const float a5 = -1.86637164165180873e-2f; - NK_STORAGE const float a6 = +9.90140908664079833e-4f; - NK_STORAGE const float a7 = -5.23022132118824778e-14f; - return a0 + x*(a1 + x*(a2 + x*(a3 + x*(a4 + x*(a5 + x*(a6 + x*a7)))))); + /* New implementation. Also generated using lolremez. */ + /* Old version significantly deviated from expected results. */ + NK_STORAGE const float a0 = 9.9995999154986614e-1f; + NK_STORAGE const float a1 = 1.2548995793001028e-3f; + NK_STORAGE const float a2 = -5.0648546280678015e-1f; + NK_STORAGE const float a3 = 1.2942246466519995e-2f; + NK_STORAGE const float a4 = 2.8668384702547972e-2f; + NK_STORAGE const float a5 = 7.3726485210586547e-3f; + NK_STORAGE const float a6 = -3.8510875386947414e-3f; + NK_STORAGE const float a7 = 4.7196604604366623e-4f; + NK_STORAGE const float a8 = -1.8776444013090451e-5f; + return a0 + x*(a1 + x*(a2 + x*(a3 + x*(a4 + x*(a5 + x*(a6 + x*(a7 + x*a8))))))); } NK_LIB nk_uint nk_round_up_pow2(nk_uint v) @@ -7151,23 +7232,29 @@ nk_murmur_hash(const void * key, int len, nk_hash seed) { /* 32-Bit MurmurHash3: https://code.google.com/p/smhasher/wiki/MurmurHash3*/ #define NK_ROTL(x,r) ((x) << (r) | ((x) >> (32 - r))) - union {const nk_uint *i; const nk_byte *b;} conv = {0}; + + nk_uint h1 = seed; + nk_uint k1; const nk_byte *data = (const nk_byte*)key; + const nk_byte *keyptr = data; + nk_byte *k1ptr; + const int bsize = sizeof(k1); const int nblocks = len/4; - nk_uint h1 = seed; + const nk_uint c1 = 0xcc9e2d51; const nk_uint c2 = 0x1b873593; const nk_byte *tail; - const nk_uint *blocks; - nk_uint k1; int i; /* body */ if (!key) return 0; - conv.b = (data + nblocks*4); - blocks = (const nk_uint*)conv.i; - for (i = -nblocks; i; ++i) { - k1 = blocks[i]; + for (i = 0; i < nblocks; ++i, keyptr += bsize) { + k1ptr = (nk_byte*)&k1; + k1ptr[0] = keyptr[0]; + k1ptr[1] = keyptr[1]; + k1ptr[2] = keyptr[2]; + k1ptr[3] = keyptr[3]; + k1 *= c1; k1 = NK_ROTL(k1,15); k1 *= c2; @@ -7181,15 +7268,15 @@ nk_murmur_hash(const void * key, int len, nk_hash seed) tail = (const nk_byte*)(data + nblocks*4); k1 = 0; switch (len & 3) { - case 3: k1 ^= (nk_uint)(tail[2] << 16); /* fallthrough */ - case 2: k1 ^= (nk_uint)(tail[1] << 8u); /* fallthrough */ - case 1: k1 ^= tail[0]; + case 3: k1 ^= (nk_uint)(tail[2] << 16); /* fallthrough */ + case 2: k1 ^= (nk_uint)(tail[1] << 8u); /* fallthrough */ + case 1: k1 ^= tail[0]; k1 *= c1; k1 = NK_ROTL(k1,15); k1 *= c2; h1 ^= k1; break; - default: break; + default: break; } /* finalization */ @@ -9356,7 +9443,7 @@ nk_draw_list_alloc_vertices(struct nk_draw_list *list, nk_size count) * backend (OpenGL, DirectX, ...). For example in OpenGL for `glDrawElements` * instead of specifing `GL_UNSIGNED_SHORT` you have to define `GL_UNSIGNED_INT`. * Sorry for the inconvenience. */ - NK_ASSERT((sizeof(nk_draw_index) == 2 && list->vertex_count < NK_USHORT_MAX && + if(sizeof(nk_draw_index)==2) NK_ASSERT((list->vertex_count < NK_USHORT_MAX && "To many verticies for 16-bit vertex indicies. Please read comment above on how to solve this problem")); return vtx; } @@ -12809,6 +12896,9 @@ nk_font_bake(struct nk_font_baker *baker, void *image_memory, int width, int hei dst_font->ascent = ((float)unscaled_ascent * font_scale); dst_font->descent = ((float)unscaled_descent * font_scale); dst_font->glyph_offset = glyph_n; + // Need to zero this, or it will carry over from a previous + // bake, and cause a segfault when accessing glyphs[]. + dst_font->glyph_count = 0; } /* fill own baked font glyph array */ @@ -13903,8 +13993,12 @@ nk_input_key(struct nk_context *ctx, enum nk_keys key, int down) NK_ASSERT(ctx); if (!ctx) return; in = &ctx->input; +#ifdef NK_KEYSTATE_BASED_INPUT if (in->keyboard.keys[key].down != down) in->keyboard.keys[key].clicked++; +#else + in->keyboard.keys[key].clicked++; +#endif in->keyboard.keys[key].down = down; } NK_API void @@ -15788,7 +15882,7 @@ nk_panel_end(struct nk_context *ctx) nk_fill_rect(out, empty_space, 0, style->window.background); /* fill right empty space */ - empty_space.x = layout->bounds.x + layout->bounds.w - layout->border; + empty_space.x = layout->bounds.x + layout->bounds.w; empty_space.y = layout->bounds.y; empty_space.w = panel_padding.x + layout->border; empty_space.h = layout->bounds.h; @@ -15797,11 +15891,11 @@ nk_panel_end(struct nk_context *ctx) nk_fill_rect(out, empty_space, 0, style->window.background); /* fill bottom empty space */ - if (*layout->offset_x != 0 && !(layout->flags & NK_WINDOW_NO_SCROLLBAR)) { + if (layout->footer_height > 0) { empty_space.x = window->bounds.x; empty_space.y = layout->bounds.y + layout->bounds.h; empty_space.w = window->bounds.w; - empty_space.h = scrollbar_size.y; + empty_space.h = layout->footer_height; nk_fill_rect(out, empty_space, 0, style->window.background); } } @@ -16175,8 +16269,8 @@ nk_begin_titled(struct nk_context *ctx, const char *name, const char *title, { struct nk_window *win; struct nk_style *style; - nk_hash title_hash; - int title_len; + nk_hash name_hash; + int name_len; int ret = 0; NK_ASSERT(ctx); @@ -16189,12 +16283,12 @@ nk_begin_titled(struct nk_context *ctx, const char *name, const char *title, /* find or create window */ style = &ctx->style; - title_len = (int)nk_strlen(name); - title_hash = nk_murmur_hash(name, (int)title_len, NK_WINDOW_TITLE); - win = nk_find_window(ctx, title_hash, name); + name_len = (int)nk_strlen(name); + name_hash = nk_murmur_hash(name, (int)name_len, NK_WINDOW_TITLE); + win = nk_find_window(ctx, name_hash, name); if (!win) { /* create new window */ - nk_size name_length = (nk_size)nk_strlen(name); + nk_size name_length = (nk_size)name_len; win = (struct nk_window*)nk_create_window(ctx); NK_ASSERT(win); if (!win) return 0; @@ -16206,7 +16300,7 @@ nk_begin_titled(struct nk_context *ctx, const char *name, const char *title, win->flags = flags; win->bounds = bounds; - win->name = title_hash; + win->name = name_hash; name_length = NK_MIN(name_length, NK_WINDOW_MAX_NAME-1); NK_MEMCPY(win->name_string, name, name_length); win->name_string[name_length] = 0; @@ -16434,6 +16528,20 @@ nk_window_get_panel(struct nk_context *ctx) if (!ctx || !ctx->current) return 0; return ctx->current->layout; } +NK_API void +nk_window_get_scroll(struct nk_context *ctx, nk_uint *offset_x, nk_uint *offset_y) +{ + struct nk_window *win; + NK_ASSERT(ctx); + NK_ASSERT(ctx->current); + if (!ctx || !ctx->current) + return ; + win = ctx->current; + if (offset_x) + *offset_x = win->scrollbar.x; + if (offset_y) + *offset_y = win->scrollbar.y; +} NK_API int nk_window_has_focus(const struct nk_context *ctx) { @@ -16600,6 +16708,18 @@ nk_window_set_size(struct nk_context *ctx, win->bounds.h = size.y; } NK_API void +nk_window_set_scroll(struct nk_context *ctx, nk_uint offset_x, nk_uint offset_y) +{ + struct nk_window *win; + NK_ASSERT(ctx); + NK_ASSERT(ctx->current); + if (!ctx || !ctx->current) + return; + win = ctx->current; + win->scrollbar.x = offset_x; + win->scrollbar.y = offset_y; +} +NK_API void nk_window_collapse(struct nk_context *ctx, const char *name, enum nk_collapse_states c) { @@ -16673,7 +16793,6 @@ nk_window_set_focus(struct nk_context *ctx, const char *name) - /* =============================================================== * * POPUP @@ -16807,7 +16926,11 @@ nk_nonblock_begin(struct nk_context *ctx, } else { /* close the popup if user pressed outside or in the header */ int pressed, in_body, in_header; +#ifdef NK_BUTTON_TRIGGER_ON_RELEASE + pressed = nk_input_is_mouse_released(&ctx->input, NK_BUTTON_LEFT); +#else pressed = nk_input_is_mouse_pressed(&ctx->input, NK_BUTTON_LEFT); +#endif in_body = nk_input_is_mouse_hovering_rect(&ctx->input, body); in_header = nk_input_is_mouse_hovering_rect(&ctx->input, header); if (pressed && (!in_body || in_header)) @@ -16898,7 +17021,38 @@ nk_popup_end(struct nk_context *ctx) ctx->current = win; nk_push_scissor(&win->buffer, win->layout->clip); } +NK_API void +nk_popup_get_scroll(struct nk_context *ctx, nk_uint *offset_x, nk_uint *offset_y) +{ + struct nk_window *popup; + NK_ASSERT(ctx); + NK_ASSERT(ctx->current); + NK_ASSERT(ctx->current->layout); + if (!ctx || !ctx->current || !ctx->current->layout) + return; + + popup = ctx->current; + if (offset_x) + *offset_x = popup->scrollbar.x; + if (offset_y) + *offset_y = popup->scrollbar.y; +} +NK_API void +nk_popup_set_scroll(struct nk_context *ctx, nk_uint offset_x, nk_uint offset_y) +{ + struct nk_window *popup; + + NK_ASSERT(ctx); + NK_ASSERT(ctx->current); + NK_ASSERT(ctx->current->layout); + if (!ctx || !ctx->current || !ctx->current->layout) + return; + + popup = ctx->current; + popup->scrollbar.x = offset_x; + popup->scrollbar.y = offset_y; +} @@ -18025,22 +18179,25 @@ nk_layout_widget_space(struct nk_rect *bounds, const struct nk_context *ctx, panel_space = nk_layout_row_calculate_usable_space(&ctx->style, layout->type, layout->bounds.w, layout->row.columns); + #define NK_FRAC(x) (x - (int)x) /* will be used to remove fookin gaps */ /* calculate the width of one item inside the current layout space */ switch (layout->row.type) { case NK_LAYOUT_DYNAMIC_FIXED: { /* scaling fixed size widgets item width */ - item_width = NK_MAX(1.0f,panel_space) / (float)layout->row.columns; - item_offset = (float)layout->row.index * item_width; + float w = NK_MAX(1.0f,panel_space) / (float)layout->row.columns; + item_offset = (float)layout->row.index * w; + item_width = w + NK_FRAC(item_offset); item_spacing = (float)layout->row.index * spacing.x; } break; case NK_LAYOUT_DYNAMIC_ROW: { /* scaling single ratio widget width */ - item_width = layout->row.item_width * panel_space; + float w = layout->row.item_width * panel_space; item_offset = layout->row.item_offset; + item_width = w + NK_FRAC(item_offset); item_spacing = 0; if (modify) { - layout->row.item_offset += item_width + spacing.x; + layout->row.item_offset += w + spacing.x; layout->row.filled += layout->row.item_width; layout->row.index = 0; } @@ -18051,23 +18208,24 @@ nk_layout_widget_space(struct nk_rect *bounds, const struct nk_context *ctx, bounds->x -= (float)*layout->offset_x; bounds->y = layout->at_y + (layout->row.height * layout->row.item.y); bounds->y -= (float)*layout->offset_y; - bounds->w = layout->bounds.w * layout->row.item.w; - bounds->h = layout->row.height * layout->row.item.h; + bounds->w = layout->bounds.w * layout->row.item.w + NK_FRAC(bounds->x); + bounds->h = layout->row.height * layout->row.item.h + NK_FRAC(bounds->y); return; } case NK_LAYOUT_DYNAMIC: { /* scaling arrays of panel width ratios for every widget */ - float ratio; + float ratio, w; NK_ASSERT(layout->row.ratio); ratio = (layout->row.ratio[layout->row.index] < 0) ? layout->row.item_width : layout->row.ratio[layout->row.index]; + w = (ratio * panel_space); item_spacing = (float)layout->row.index * spacing.x; - item_width = (ratio * panel_space); item_offset = layout->row.item_offset; + item_width = w + NK_FRAC(item_offset); if (modify) { - layout->row.item_offset += item_width; + layout->row.item_offset += w; layout->row.filled += ratio; } } break; @@ -18105,13 +18263,16 @@ nk_layout_widget_space(struct nk_rect *bounds, const struct nk_context *ctx, } break; case NK_LAYOUT_TEMPLATE: { /* stretchy row layout with combined dynamic/static widget width*/ + float w; NK_ASSERT(layout->row.index < layout->row.columns); NK_ASSERT(layout->row.index < NK_MAX_LAYOUT_ROW_TEMPLATE_COLUMNS); - item_width = layout->row.templates[layout->row.index]; + w = layout->row.templates[layout->row.index]; item_offset = layout->row.item_offset; + item_width = w + NK_FRAC(item_offset); item_spacing = (float)layout->row.index * spacing.x; - if (modify) layout->row.item_offset += item_width; + if (modify) layout->row.item_offset += w; } break; + #undef NK_FRAC default: NK_ASSERT(0); break; }; @@ -18687,7 +18848,74 @@ nk_group_end(struct nk_context *ctx) { nk_group_scrolled_end(ctx); } +NK_API void +nk_group_get_scroll(struct nk_context *ctx, const char *id, nk_uint *x_offset, nk_uint *y_offset) +{ + int id_len; + nk_hash id_hash; + struct nk_window *win; + nk_uint *x_offset_ptr; + nk_uint *y_offset_ptr; + + NK_ASSERT(ctx); + NK_ASSERT(id); + NK_ASSERT(ctx->current); + NK_ASSERT(ctx->current->layout); + if (!ctx || !ctx->current || !ctx->current->layout || !id) + return; + + /* find persistent group scrollbar value */ + win = ctx->current; + id_len = (int)nk_strlen(id); + id_hash = nk_murmur_hash(id, (int)id_len, NK_PANEL_GROUP); + x_offset_ptr = nk_find_value(win, id_hash); + if (!x_offset_ptr) { + x_offset_ptr = nk_add_value(ctx, win, id_hash, 0); + y_offset_ptr = nk_add_value(ctx, win, id_hash+1, 0); + + NK_ASSERT(x_offset_ptr); + NK_ASSERT(y_offset_ptr); + if (!x_offset_ptr || !y_offset_ptr) return; + *x_offset_ptr = *y_offset_ptr = 0; + } else y_offset_ptr = nk_find_value(win, id_hash+1); + if (x_offset) + *x_offset = *x_offset_ptr; + if (y_offset) + *y_offset = *y_offset_ptr; +} +NK_API void +nk_group_set_scroll(struct nk_context *ctx, const char *id, nk_uint x_offset, nk_uint y_offset) +{ + int id_len; + nk_hash id_hash; + struct nk_window *win; + nk_uint *x_offset_ptr; + nk_uint *y_offset_ptr; + + NK_ASSERT(ctx); + NK_ASSERT(id); + NK_ASSERT(ctx->current); + NK_ASSERT(ctx->current->layout); + if (!ctx || !ctx->current || !ctx->current->layout || !id) + return; + /* find persistent group scrollbar value */ + win = ctx->current; + id_len = (int)nk_strlen(id); + id_hash = nk_murmur_hash(id, (int)id_len, NK_PANEL_GROUP); + x_offset_ptr = nk_find_value(win, id_hash); + if (!x_offset_ptr) { + x_offset_ptr = nk_add_value(ctx, win, id_hash, 0); + y_offset_ptr = nk_add_value(ctx, win, id_hash+1, 0); + + NK_ASSERT(x_offset_ptr); + NK_ASSERT(y_offset_ptr); + if (!x_offset_ptr || !y_offset_ptr) return; + *x_offset_ptr = *y_offset_ptr = 0; + } else y_offset_ptr = nk_find_value(win, id_hash+1); + *x_offset_ptr = x_offset; + *y_offset_ptr = y_offset; +} @@ -21179,6 +21407,7 @@ nk_scrollbar_behavior(nk_flags *state, struct nk_input *in, { nk_flags ws = 0; int left_mouse_down; + int left_mouse_clicked; int left_mouse_click_in_cursor; float scroll_delta; @@ -21186,13 +21415,14 @@ nk_scrollbar_behavior(nk_flags *state, struct nk_input *in, if (!in) return scroll_offset; left_mouse_down = in->mouse.buttons[NK_BUTTON_LEFT].down; + left_mouse_clicked = in->mouse.buttons[NK_BUTTON_LEFT].clicked; left_mouse_click_in_cursor = nk_input_has_mouse_click_down_in_rect(in, NK_BUTTON_LEFT, *cursor, nk_true); if (nk_input_is_mouse_hovering_rect(in, *scroll)) *state = NK_WIDGET_STATE_HOVERED; scroll_delta = (o == NK_VERTICAL) ? in->mouse.scroll_delta.y: in->mouse.scroll_delta.x; - if (left_mouse_down && left_mouse_click_in_cursor) { + if (left_mouse_down && left_mouse_click_in_cursor && !left_mouse_clicked) { /* update cursor by mouse dragging */ float pixel, delta; *state = NK_WIDGET_STATE_ACTIVE; @@ -25243,172 +25473,182 @@ nk_tooltipfv(struct nk_context *ctx, const char *fmt, va_list args) /// - [yy]: Minor version with non-breaking API and library changes /// - [zz]: Bug fix version with no direct changes to API /// -/// - 2018/04/01 (4.00.1) - Fixed calling `nk_convert` multiple time per single frame +/// - 2019/09/20 (4.01.3) - Fixed a bug wherein combobox cannot be closed by clicking the header +/// when NK_BUTTON_TRIGGER_ON_RELEASE is defined. +/// - 2019/09/10 (4.01.2) - Fixed the nk_cos function, which deviated significantly. +/// - 2019/09/08 (4.01.1) - Fixed a bug wherein re-baking of fonts caused a segmentation +/// fault due to dst_font->glyph_count not being zeroed on subsequent +/// bakes of the same set of fonts. +/// - 2019/06/23 (4.01.0) - Added nk_***_get_scroll and nk_***_set_scroll for groups, windows, and popups. +/// - 2019/06/12 (4.00.3) - Fix panel background drawing bug. +/// - 2018/10/31 (4.00.2) - Added NK_KEYSTATE_BASED_INPUT to "fix" state based backends +/// like GLFW without breaking key repeat behavior on event based. +/// - 2018/04/01 (4.00.1) - Fixed calling `nk_convert` multiple time per single frame. /// - 2018/04/01 (4.00.0) - BREAKING CHANGE: nk_draw_list_clear no longer tries to -/// clear provided buffers. So make sure to either free -/// or clear each passed buffer after calling nk_convert. -/// - 2018/02/23 (3.00.6) - Fixed slider dragging behavior -/// - 2018/01/31 (3.00.5) - Fixed overcalculation of cursor data in font baking process -/// - 2018/01/31 (3.00.4) - Removed name collision with stb_truetype -/// - 2018/01/28 (3.00.3) - Fixed panel window border drawing bug -/// - 2018/01/12 (3.00.2) - Added `nk_group_begin_titled` for separed group identifier and title -/// - 2018/01/07 (3.00.1) - Started to change documentation style +/// clear provided buffers. So make sure to either free +/// or clear each passed buffer after calling nk_convert. +/// - 2018/02/23 (3.00.6) - Fixed slider dragging behavior. +/// - 2018/01/31 (3.00.5) - Fixed overcalculation of cursor data in font baking process. +/// - 2018/01/31 (3.00.4) - Removed name collision with stb_truetype. +/// - 2018/01/28 (3.00.3) - Fixed panel window border drawing bug. +/// - 2018/01/12 (3.00.2) - Added `nk_group_begin_titled` for separed group identifier and title. +/// - 2018/01/07 (3.00.1) - Started to change documentation style. /// - 2018/01/05 (3.00.0) - BREAKING CHANGE: The previous color picker API was broken /// because of conversions between float and byte color representation. /// Color pickers now use floating point values to represent /// HSV values. To get back the old behavior I added some additional /// color conversion functions to cast between nk_color and /// nk_colorf. -/// - 2017/12/23 (2.00.7) - Fixed small warning -/// - 2017/12/23 (2.00.7) - Fixed nk_edit_buffer behavior if activated to allow input -/// - 2017/12/23 (2.00.7) - Fixed modifyable progressbar dragging visuals and input behavior -/// - 2017/12/04 (2.00.6) - Added formated string tooltip widget -/// - 2017/11/18 (2.00.5) - Fixed window becoming hidden with flag NK_WINDOW_NO_INPUT -/// - 2017/11/15 (2.00.4) - Fixed font merging -/// - 2017/11/07 (2.00.3) - Fixed window size and position modifier functions -/// - 2017/09/14 (2.00.2) - Fixed nk_edit_buffer and nk_edit_focus behavior -/// - 2017/09/14 (2.00.1) - Fixed window closing behavior +/// - 2017/12/23 (2.00.7) - Fixed small warning. +/// - 2017/12/23 (2.00.7) - Fixed `nk_edit_buffer` behavior if activated to allow input. +/// - 2017/12/23 (2.00.7) - Fixed modifyable progressbar dragging visuals and input behavior. +/// - 2017/12/04 (2.00.6) - Added formated string tooltip widget. +/// - 2017/11/18 (2.00.5) - Fixed window becoming hidden with flag `NK_WINDOW_NO_INPUT`. +/// - 2017/11/15 (2.00.4) - Fixed font merging. +/// - 2017/11/07 (2.00.3) - Fixed window size and position modifier functions. +/// - 2017/09/14 (2.00.2) - Fixed `nk_edit_buffer` and `nk_edit_focus` behavior. +/// - 2017/09/14 (2.00.1) - Fixed window closing behavior. /// - 2017/09/14 (2.00.0) - BREAKING CHANGE: Modifing window position and size funtions now /// require the name of the window and must happen outside the window /// building process (between function call nk_begin and nk_end). -/// - 2017/09/11 (1.40.9) - Fixed window background flag if background window is declared last -/// - 2017/08/27 (1.40.8) - Fixed `nk_item_is_any_active` for hidden windows -/// - 2017/08/27 (1.40.7) - Fixed window background flag +/// - 2017/09/11 (1.40.9) - Fixed window background flag if background window is declared last. +/// - 2017/08/27 (1.40.8) - Fixed `nk_item_is_any_active` for hidden windows. +/// - 2017/08/27 (1.40.7) - Fixed window background flag. /// - 2017/07/07 (1.40.6) - Fixed missing clipping rect check for hovering/clicked -/// query for widgets +/// query for widgets. /// - 2017/07/07 (1.40.5) - Fixed drawing bug for vertex output for lines and stroked -/// and filled rectangles +/// and filled rectangles. /// - 2017/07/07 (1.40.4) - Fixed bug in nk_convert trying to add windows that are in /// process of being destroyed. /// - 2017/07/07 (1.40.3) - Fixed table internal bug caused by storing table size in /// window instead of directly in table. -/// - 2017/06/30 (1.40.2) - Removed unneeded semicolon in C++ NK_ALIGNOF macro -/// - 2017/06/30 (1.40.1) - Fixed drawing lines smaller or equal zero +/// - 2017/06/30 (1.40.2) - Removed unneeded semicolon in C++ NK_ALIGNOF macro. +/// - 2017/06/30 (1.40.1) - Fixed drawing lines smaller or equal zero. /// - 2017/06/08 (1.40.0) - Removed the breaking part of last commit. Auto layout now only -/// comes in effect if you pass in zero was row height argument +/// comes in effect if you pass in zero was row height argument. /// - 2017/06/08 (1.40.0) - BREAKING CHANGE: while not directly API breaking it will change /// how layouting works. From now there will be an internal minimum /// row height derived from font height. If you need a row smaller than /// that you can directly set it by `nk_layout_set_min_row_height` and /// reset the value back by calling `nk_layout_reset_min_row_height. -/// - 2017/06/08 (1.39.1) - Fixed property text edit handling bug caused by past `nk_widget` fix -/// - 2017/06/08 (1.39.0) - Added function to retrieve window space without calling a nk_layout_xxx function -/// - 2017/06/06 (1.38.5) - Fixed `nk_convert` return flag for command buffer -/// - 2017/05/23 (1.38.4) - Fixed activation behavior for widgets partially clipped -/// - 2017/05/10 (1.38.3) - Fixed wrong min window size mouse scaling over boundries -/// - 2017/05/09 (1.38.2) - Fixed vertical scrollbar drawing with not enough space -/// - 2017/05/09 (1.38.1) - Fixed scaler dragging behavior if window size hits minimum size -/// - 2017/05/06 (1.38.0) - Added platform double-click support -/// - 2017/04/20 (1.37.1) - Fixed key repeat found inside glfw demo backends -/// - 2017/04/20 (1.37.0) - Extended properties with selection and clipbard support -/// - 2017/04/20 (1.36.2) - Fixed #405 overlapping rows with zero padding and spacing -/// - 2017/04/09 (1.36.1) - Fixed #403 with another widget float error -/// - 2017/04/09 (1.36.0) - Added window `NK_WINDOW_NO_INPUT` and `NK_WINDOW_NOT_INTERACTIVE` flags -/// - 2017/04/09 (1.35.3) - Fixed buffer heap corruption -/// - 2017/03/25 (1.35.2) - Fixed popup overlapping for `NK_WINDOW_BACKGROUND` windows -/// - 2017/03/25 (1.35.1) - Fixed windows closing behavior -/// - 2017/03/18 (1.35.0) - Added horizontal scroll requested in #377 -/// - 2017/03/18 (1.34.3) - Fixed long window header titles -/// - 2017/03/04 (1.34.2) - Fixed text edit filtering -/// - 2017/03/04 (1.34.1) - Fixed group closable flag -/// - 2017/02/25 (1.34.0) - Added custom draw command for better language binding support -/// - 2017/01/24 (1.33.0) - Added programatic way of remove edit focus -/// - 2017/01/24 (1.32.3) - Fixed wrong define for basic type definitions for windows -/// - 2017/01/21 (1.32.2) - Fixed input capture from hidden or closed windows -/// - 2017/01/21 (1.32.1) - Fixed slider behavior and drawing -/// - 2017/01/13 (1.32.0) - Added flag to put scaler into the bottom left corner +/// - 2017/06/08 (1.39.1) - Fixed property text edit handling bug caused by past `nk_widget` fix. +/// - 2017/06/08 (1.39.0) - Added function to retrieve window space without calling a `nk_layout_xxx` function. +/// - 2017/06/06 (1.38.5) - Fixed `nk_convert` return flag for command buffer. +/// - 2017/05/23 (1.38.4) - Fixed activation behavior for widgets partially clipped. +/// - 2017/05/10 (1.38.3) - Fixed wrong min window size mouse scaling over boundries. +/// - 2017/05/09 (1.38.2) - Fixed vertical scrollbar drawing with not enough space. +/// - 2017/05/09 (1.38.1) - Fixed scaler dragging behavior if window size hits minimum size. +/// - 2017/05/06 (1.38.0) - Added platform double-click support. +/// - 2017/04/20 (1.37.1) - Fixed key repeat found inside glfw demo backends. +/// - 2017/04/20 (1.37.0) - Extended properties with selection and clipboard support. +/// - 2017/04/20 (1.36.2) - Fixed #405 overlapping rows with zero padding and spacing. +/// - 2017/04/09 (1.36.1) - Fixed #403 with another widget float error. +/// - 2017/04/09 (1.36.0) - Added window `NK_WINDOW_NO_INPUT` and `NK_WINDOW_NOT_INTERACTIVE` flags. +/// - 2017/04/09 (1.35.3) - Fixed buffer heap corruption. +/// - 2017/03/25 (1.35.2) - Fixed popup overlapping for `NK_WINDOW_BACKGROUND` windows. +/// - 2017/03/25 (1.35.1) - Fixed windows closing behavior. +/// - 2017/03/18 (1.35.0) - Added horizontal scroll requested in #377. +/// - 2017/03/18 (1.34.3) - Fixed long window header titles. +/// - 2017/03/04 (1.34.2) - Fixed text edit filtering. +/// - 2017/03/04 (1.34.1) - Fixed group closable flag. +/// - 2017/02/25 (1.34.0) - Added custom draw command for better language binding support. +/// - 2017/01/24 (1.33.0) - Added programatic way of remove edit focus. +/// - 2017/01/24 (1.32.3) - Fixed wrong define for basic type definitions for windows. +/// - 2017/01/21 (1.32.2) - Fixed input capture from hidden or closed windows. +/// - 2017/01/21 (1.32.1) - Fixed slider behavior and drawing. +/// - 2017/01/13 (1.32.0) - Added flag to put scaler into the bottom left corner. /// - 2017/01/13 (1.31.0) - Added additional row layouting method to combine both /// dynamic and static widgets. -/// - 2016/12/31 (1.30.0) - Extended scrollbar offset from 16-bit to 32-bit -/// - 2016/12/31 (1.29.2)- Fixed closing window bug of minimized windows -/// - 2016/12/03 (1.29.1)- Fixed wrapped text with no seperator and C89 error -/// - 2016/12/03 (1.29.0) - Changed text wrapping to process words not characters -/// - 2016/11/22 (1.28.6)- Fixed window minimized closing bug -/// - 2016/11/19 (1.28.5)- Fixed abstract combo box closing behavior -/// - 2016/11/19 (1.28.4)- Fixed tooltip flickering -/// - 2016/11/19 (1.28.3)- Fixed memory leak caused by popup repeated closing -/// - 2016/11/18 (1.28.2)- Fixed memory leak caused by popup panel allocation -/// - 2016/11/10 (1.28.1)- Fixed some warnings and C++ error -/// - 2016/11/10 (1.28.0)- Added additional `nk_button` versions which allows to directly +/// - 2016/12/31 (1.30.0) - Extended scrollbar offset from 16-bit to 32-bit. +/// - 2016/12/31 (1.29.2) - Fixed closing window bug of minimized windows. +/// - 2016/12/03 (1.29.1) - Fixed wrapped text with no seperator and C89 error. +/// - 2016/12/03 (1.29.0) - Changed text wrapping to process words not characters. +/// - 2016/11/22 (1.28.6) - Fixed window minimized closing bug. +/// - 2016/11/19 (1.28.5) - Fixed abstract combo box closing behavior. +/// - 2016/11/19 (1.28.4) - Fixed tooltip flickering. +/// - 2016/11/19 (1.28.3) - Fixed memory leak caused by popup repeated closing. +/// - 2016/11/18 (1.28.2) - Fixed memory leak caused by popup panel allocation. +/// - 2016/11/10 (1.28.1) - Fixed some warnings and C++ error. +/// - 2016/11/10 (1.28.0) - Added additional `nk_button` versions which allows to directly /// pass in a style struct to change buttons visual. -/// - 2016/11/10 (1.27.0)- Added additional 'nk_tree' versions to support external state +/// - 2016/11/10 (1.27.0) - Added additional `nk_tree` versions to support external state /// storage. Just like last the `nk_group` commit the main /// advantage is that you optionally can minimize nuklears runtime /// memory consumption or handle hash collisions. -/// - 2016/11/09 (1.26.0)- Added additional `nk_group` version to support external scrollbar +/// - 2016/11/09 (1.26.0) - Added additional `nk_group` version to support external scrollbar /// offset storage. Main advantage is that you can externalize /// the memory management for the offset. It could also be helpful /// if you have a hash collision in `nk_group_begin` but really /// want the name. In addition I added `nk_list_view` which allows /// to draw big lists inside a group without actually having to /// commit the whole list to nuklear (issue #269). -/// - 2016/10/30 (1.25.1)- Fixed clipping rectangle bug inside `nk_draw_list` -/// - 2016/10/29 (1.25.0)- Pulled `nk_panel` memory management into nuklear and out of +/// - 2016/10/30 (1.25.1) - Fixed clipping rectangle bug inside `nk_draw_list`. +/// - 2016/10/29 (1.25.0) - Pulled `nk_panel` memory management into nuklear and out of /// the hands of the user. From now on users don't have to care /// about panels unless they care about some information. If you /// still need the panel just call `nk_window_get_panel`. -/// - 2016/10/21 (1.24.0)- Changed widget border drawing to stroked rectangle from filled +/// - 2016/10/21 (1.24.0) - Changed widget border drawing to stroked rectangle from filled /// rectangle for less overdraw and widget background transparency. -/// - 2016/10/18 (1.23.0)- Added `nk_edit_focus` for manually edit widget focus control -/// - 2016/09/29 (1.22.7)- Fixed deduction of basic type in non `` compilation -/// - 2016/09/29 (1.22.6)- Fixed edit widget UTF-8 text cursor drawing bug -/// - 2016/09/28 (1.22.5)- Fixed edit widget UTF-8 text appending/inserting/removing -/// - 2016/09/28 (1.22.4)- Fixed drawing bug inside edit widgets which offset all text +/// - 2016/10/18 (1.23.0) - Added `nk_edit_focus` for manually edit widget focus control. +/// - 2016/09/29 (1.22.7) - Fixed deduction of basic type in non `` compilation. +/// - 2016/09/29 (1.22.6) - Fixed edit widget UTF-8 text cursor drawing bug. +/// - 2016/09/28 (1.22.5) - Fixed edit widget UTF-8 text appending/inserting/removing. +/// - 2016/09/28 (1.22.4) - Fixed drawing bug inside edit widgets which offset all text /// text in every edit widget if one of them is scrolled. -/// - 2016/09/28 (1.22.3)- Fixed small bug in edit widgets if not active. The wrong +/// - 2016/09/28 (1.22.3) - Fixed small bug in edit widgets if not active. The wrong /// text length is passed. It should have been in bytes but /// was passed as glyphes. -/// - 2016/09/20 (1.22.2)- Fixed color button size calculation -/// - 2016/09/20 (1.22.1)- Fixed some `nk_vsnprintf` behavior bugs and removed -/// `` again from `NK_INCLUDE_STANDARD_VARARGS`. -/// - 2016/09/18 (1.22.0)- C89 does not support vsnprintf only C99 and newer as well +/// - 2016/09/20 (1.22.2) - Fixed color button size calculation. +/// - 2016/09/20 (1.22.1) - Fixed some `nk_vsnprintf` behavior bugs and removed `` +/// again from `NK_INCLUDE_STANDARD_VARARGS`. +/// - 2016/09/18 (1.22.0) - C89 does not support vsnprintf only C99 and newer as well /// as C++11 and newer. In addition to use vsnprintf you have /// to include . So just defining `NK_INCLUDE_STD_VAR_ARGS` /// is not enough. That behavior is now fixed. By default if /// both varargs as well as stdio is selected I try to use /// vsnprintf if not possible I will revert to vsprintf. If /// varargs but not stdio was defined I will use my own function. -/// - 2016/09/15 (1.21.2)- Fixed panel `close` behavior for deeper panel levels -/// - 2016/09/15 (1.21.1)- Fixed C++ errors and wrong argument to `nk_panel_get_xxxx` +/// - 2016/09/15 (1.21.2) - Fixed panel `close` behavior for deeper panel levels. +/// - 2016/09/15 (1.21.1) - Fixed C++ errors and wrong argument to `nk_panel_get_xxxx`. /// - 2016/09/13 (1.21.0) - !BREAKING! Fixed nonblocking popup behavior in menu, combo, /// and contextual which prevented closing in y-direction if /// popup did not reach max height. /// In addition the height parameter was changed into vec2 /// for width and height to have more control over the popup size. -/// - 2016/09/13 (1.20.3) - Cleaned up and extended type selection -/// - 2016/09/13 (1.20.2)- Fixed slider behavior hopefully for the last time. This time +/// - 2016/09/13 (1.20.3) - Cleaned up and extended type selection. +/// - 2016/09/13 (1.20.2) - Fixed slider behavior hopefully for the last time. This time /// all calculation are correct so no more hackery. -/// - 2016/09/13 (1.20.1)- Internal change to divide window/panel flags into panel flags and types. +/// - 2016/09/13 (1.20.1) - Internal change to divide window/panel flags into panel flags and types. /// Suprisinly spend years in C and still happened to confuse types /// with flags. Probably something to take note. -/// - 2016/09/08 (1.20.0)- Added additional helper function to make it easier to just +/// - 2016/09/08 (1.20.0) - Added additional helper function to make it easier to just /// take the produced buffers from `nk_convert` and unplug the /// iteration process from `nk_context`. So now you can /// just use the vertex,element and command buffer + two pointer /// inside the command buffer retrieved by calls `nk__draw_begin` /// and `nk__draw_end` and macro `nk_draw_foreach_bounded`. -/// - 2016/09/08 (1.19.0)- Added additional asserts to make sure every `nk_xxx_begin` call +/// - 2016/09/08 (1.19.0) - Added additional asserts to make sure every `nk_xxx_begin` call /// for windows, popups, combobox, menu and contextual is guarded by /// `if` condition and does not produce false drawing output. -/// - 2016/09/08 (1.18.0)- Changed confusing name for `NK_SYMBOL_RECT_FILLED`, `NK_SYMBOL_RECT` +/// - 2016/09/08 (1.18.0) - Changed confusing name for `NK_SYMBOL_RECT_FILLED`, `NK_SYMBOL_RECT` /// to hopefully easier to understand `NK_SYMBOL_RECT_FILLED` and /// `NK_SYMBOL_RECT_OUTLINE`. -/// - 2016/09/08 (1.17.0)- Changed confusing name for `NK_SYMBOL_CIRLCE_FILLED`, `NK_SYMBOL_CIRCLE` +/// - 2016/09/08 (1.17.0) - Changed confusing name for `NK_SYMBOL_CIRLCE_FILLED`, `NK_SYMBOL_CIRCLE` /// to hopefully easier to understand `NK_SYMBOL_CIRCLE_FILLED` and /// `NK_SYMBOL_CIRCLE_OUTLINE`. -/// - 2016/09/08 (1.16.0)- Added additional checks to select correct types if `NK_INCLUDE_FIXED_TYPES` +/// - 2016/09/08 (1.16.0) - Added additional checks to select correct types if `NK_INCLUDE_FIXED_TYPES` /// is not defined by supporting the biggest compiler GCC, clang and MSVC. -/// - 2016/09/07 (1.15.3)- Fixed `NK_INCLUDE_COMMAND_USERDATA` define to not cause an error -/// - 2016/09/04 (1.15.2)- Fixed wrong combobox height calculation -/// - 2016/09/03 (1.15.1)- Fixed gaps inside combo boxes in OpenGL +/// - 2016/09/07 (1.15.3) - Fixed `NK_INCLUDE_COMMAND_USERDATA` define to not cause an error. +/// - 2016/09/04 (1.15.2) - Fixed wrong combobox height calculation. +/// - 2016/09/03 (1.15.1) - Fixed gaps inside combo boxes in OpenGL. /// - 2016/09/02 (1.15.0) - Changed nuklear to not have any default vertex layout and /// instead made it user provided. The range of types to convert /// to is quite limited at the moment, but I would be more than /// happy to accept PRs to add additional. -/// - 2016/08/30 (1.14.2) - Removed unused variables -/// - 2016/08/30 (1.14.1) - Fixed C++ build errors -/// - 2016/08/30 (1.14.0) - Removed mouse dragging from SDL demo since it does not work correctly -/// - 2016/08/30 (1.13.4) - Tweaked some default styling variables +/// - 2016/08/30 (1.14.2) - Removed unused variables. +/// - 2016/08/30 (1.14.1) - Fixed C++ build errors. +/// - 2016/08/30 (1.14.0) - Removed mouse dragging from SDL demo since it does not work correctly. +/// - 2016/08/30 (1.13.4) - Tweaked some default styling variables. /// - 2016/08/30 (1.13.3) - Hopefully fixed drawing bug in slider, in general I would /// refrain from using slider with a big number of steps. /// - 2016/08/30 (1.13.2) - Fixed close and minimize button which would fire even if the @@ -25418,36 +25658,36 @@ nk_tooltipfv(struct nk_context *ctx, const char *fmt, va_list args) /// - 2016/08/30 (1.13.0) - Removed `NK_WINDOW_DYNAMIC` flag from public API since /// it is bugged and causes issues in window selection. /// - 2016/08/30 (1.12.0) - Removed scaler size. The size of the scaler is now -/// determined by the scrollbar size -/// - 2016/08/30 (1.11.2) - Fixed some drawing bugs caused by changes from 1.11 -/// - 2016/08/30 (1.11.1) - Fixed overlapping minimized window selection +/// determined by the scrollbar size. +/// - 2016/08/30 (1.11.2) - Fixed some drawing bugs caused by changes from 1.11.0. +/// - 2016/08/30 (1.11.1) - Fixed overlapping minimized window selection. /// - 2016/08/30 (1.11.0) - Removed some internal complexity and overly complex code /// handling panel padding and panel border. -/// - 2016/08/29 (1.10.0) - Added additional height parameter to `nk_combobox_xxx` -/// - 2016/08/29 (1.10.0) - Fixed drawing bug in dynamic popups -/// - 2016/08/29 (1.10.0) - Added experimental mouse scrolling to popups, menus and comboboxes +/// - 2016/08/29 (1.10.0) - Added additional height parameter to `nk_combobox_xxx`. +/// - 2016/08/29 (1.10.0) - Fixed drawing bug in dynamic popups. +/// - 2016/08/29 (1.10.0) - Added experimental mouse scrolling to popups, menus and comboboxes. /// - 2016/08/26 (1.10.0) - Added window name string prepresentation to account for -/// hash collisions. Currently limited to NK_WINDOW_MAX_NAME +/// hash collisions. Currently limited to `NK_WINDOW_MAX_NAME` /// which in term can be redefined if not big enough. -/// - 2016/08/26 (1.10.0) - Added stacks for temporary style/UI changes in code +/// - 2016/08/26 (1.10.0) - Added stacks for temporary style/UI changes in code. /// - 2016/08/25 (1.10.0) - Changed `nk_input_is_key_pressed` and 'nk_input_is_key_released' /// to account for key press and release happening in one frame. -/// - 2016/08/25 (1.10.0) - Added additional nk_edit flag to directly jump to the end on activate -/// - 2016/08/17 (1.09.6)- Removed invalid check for value zero in nk_propertyx -/// - 2016/08/16 (1.09.5)- Fixed ROM mode for deeper levels of popup windows parents. -/// - 2016/08/15 (1.09.4)- Editbox are now still active if enter was pressed with flag +/// - 2016/08/25 (1.10.0) - Added additional nk_edit flag to directly jump to the end on activate. +/// - 2016/08/17 (1.09.6) - Removed invalid check for value zero in `nk_propertyx`. +/// - 2016/08/16 (1.09.5) - Fixed ROM mode for deeper levels of popup windows parents. +/// - 2016/08/15 (1.09.4) - Editbox are now still active if enter was pressed with flag /// `NK_EDIT_SIG_ENTER`. Main reasoning is to be able to keep /// typing after commiting. -/// - 2016/08/15 (1.09.4)- Removed redundant code -/// - 2016/08/15 (1.09.4)- Fixed negative numbers in `nk_strtoi` and remove unused variable -/// - 2016/08/15 (1.09.3)- Fixed `NK_WINDOW_BACKGROUND` flag behavior to select a background +/// - 2016/08/15 (1.09.4) - Removed redundant code. +/// - 2016/08/15 (1.09.4) - Fixed negative numbers in `nk_strtoi` and remove unused variable. +/// - 2016/08/15 (1.09.3) - Fixed `NK_WINDOW_BACKGROUND` flag behavior to select a background /// window only as selected by hovering and not by clicking. -/// - 2016/08/14 (1.09.2)- Fixed a bug in font atlas which caused wrong loading +/// - 2016/08/14 (1.09.2) - Fixed a bug in font atlas which caused wrong loading /// of glyphes for font with multiple ranges. -/// - 2016/08/12 (1.09.1)- Added additional function to check if window is currently +/// - 2016/08/12 (1.09.1) - Added additional function to check if window is currently /// hidden and therefore not visible. -/// - 2016/08/12 (1.09.1)- nk_window_is_closed now queries the correct flag `NK_WINDOW_CLOSED` -/// instead of the old flag `NK_WINDOW_HIDDEN` +/// - 2016/08/12 (1.09.1) - nk_window_is_closed now queries the correct flag `NK_WINDOW_CLOSED` +/// instead of the old flag `NK_WINDOW_HIDDEN`. /// - 2016/08/09 (1.09.0) - Added additional double version to nk_property and changed /// the underlying implementation to not cast to float and instead /// work directly on the given values. @@ -25457,8 +25697,8 @@ nk_tooltipfv(struct nk_context *ctx, const char *fmt, va_list args) /// - 2016/08/09 (1.08.0) - Added additional define to overwrite library internal /// string to floating point number conversion for additional /// precision. -/// - 2016/08/08 (1.07.2)- Fixed compiling error without define NK_INCLUDE_FIXED_TYPE -/// - 2016/08/08 (1.07.1)- Fixed possible floating point error inside `nk_widget` leading +/// - 2016/08/08 (1.07.2) - Fixed compiling error without define `NK_INCLUDE_FIXED_TYPE`. +/// - 2016/08/08 (1.07.1) - Fixed possible floating point error inside `nk_widget` leading /// to wrong wiget width calculation which results in widgets falsly /// becomming tagged as not inside window and cannot be accessed. /// - 2016/08/08 (1.07.0) - Nuklear now differentiates between hiding a window (NK_WINDOW_HIDDEN) and @@ -25469,31 +25709,31 @@ nk_tooltipfv(struct nk_context *ctx, const char *fmt, va_list args) /// remain. /// - 2016/08/08 (1.06.0) - Added `nk_edit_string_zero_terminated` as a second option to /// `nk_edit_string` which takes, edits and outputs a '\0' terminated string. -/// - 2016/08/08 (1.05.4)- Fixed scrollbar auto hiding behavior -/// - 2016/08/08 (1.05.3)- Fixed wrong panel padding selection in `nk_layout_widget_space` -/// - 2016/08/07 (1.05.2)- Fixed old bug in dynamic immediate mode layout API, calculating +/// - 2016/08/08 (1.05.4) - Fixed scrollbar auto hiding behavior. +/// - 2016/08/08 (1.05.3) - Fixed wrong panel padding selection in `nk_layout_widget_space`. +/// - 2016/08/07 (1.05.2) - Fixed old bug in dynamic immediate mode layout API, calculating /// wrong item spacing and panel width. -///- 2016/08/07 (1.05.1)- Hopefully finally fixed combobox popup drawing bug -///- 2016/08/07 (1.05.0) - Split varargs away from NK_INCLUDE_STANDARD_IO into own -/// define NK_INCLUDE_STANDARD_VARARGS to allow more fine +/// - 2016/08/07 (1.05.1) - Hopefully finally fixed combobox popup drawing bug. +/// - 2016/08/07 (1.05.0) - Split varargs away from `NK_INCLUDE_STANDARD_IO` into own +/// define `NK_INCLUDE_STANDARD_VARARGS` to allow more fine /// grained controlled over library includes. -/// - 2016/08/06 (1.04.5)- Changed memset calls to NK_MEMSET -/// - 2016/08/04 (1.04.4)- Fixed fast window scaling behavior -/// - 2016/08/04 (1.04.3)- Fixed window scaling, movement bug which appears if you +/// - 2016/08/06 (1.04.5) - Changed memset calls to `NK_MEMSET`. +/// - 2016/08/04 (1.04.4) - Fixed fast window scaling behavior. +/// - 2016/08/04 (1.04.3) - Fixed window scaling, movement bug which appears if you /// move/scale a window and another window is behind it. /// If you are fast enough then the window behind gets activated /// and the operation is blocked. I now require activating /// by hovering only if mouse is not pressed. -/// - 2016/08/04 (1.04.2)- Fixed changing fonts -/// - 2016/08/03 (1.04.1)- Fixed `NK_WINDOW_BACKGROUND` behavior -/// - 2016/08/03 (1.04.0) - Added color parameter to `nk_draw_image` +/// - 2016/08/04 (1.04.2) - Fixed changing fonts. +/// - 2016/08/03 (1.04.1) - Fixed `NK_WINDOW_BACKGROUND` behavior. +/// - 2016/08/03 (1.04.0) - Added color parameter to `nk_draw_image`. /// - 2016/08/03 (1.04.0) - Added additional window padding style attributes for -/// sub windows (combo, menu, ...) -/// - 2016/08/03 (1.04.0) - Added functions to show/hide software cursor +/// sub windows (combo, menu, ...). +/// - 2016/08/03 (1.04.0) - Added functions to show/hide software cursor. /// - 2016/08/03 (1.04.0) - Added `NK_WINDOW_BACKGROUND` flag to force a window -/// to be always in the background of the screen -/// - 2016/08/03 (1.03.2)- Removed invalid assert macro for NK_RGB color picker -/// - 2016/08/01 (1.03.1)- Added helper macros into header include guard +/// to be always in the background of the screen. +/// - 2016/08/03 (1.03.2) - Removed invalid assert macro for NK_RGB color picker. +/// - 2016/08/01 (1.03.1) - Added helper macros into header include guard. /// - 2016/07/29 (1.03.0) - Moved the window/table pool into the header part to /// simplify memory management by removing the need to /// allocate the pool. @@ -25501,16 +25741,15 @@ nk_tooltipfv(struct nk_context *ctx, const char *fmt, va_list args) /// will hide the window scrollbar after NK_SCROLLBAR_HIDING_TIMEOUT /// seconds without window interaction. To make it work /// you have to also set a delta time inside the `nk_context`. -/// - 2016/07/25 (1.01.1) - Fixed small panel and panel border drawing bugs -/// - 2016/07/15 (1.01.0) - Added software cursor to `nk_style` and `nk_context` -/// - 2016/07/15 (1.01.0) - Added const correctness to `nk_buffer_push' data argument +/// - 2016/07/25 (1.01.1) - Fixed small panel and panel border drawing bugs. +/// - 2016/07/15 (1.01.0) - Added software cursor to `nk_style` and `nk_context`. +/// - 2016/07/15 (1.01.0) - Added const correctness to `nk_buffer_push' data argument. /// - 2016/07/15 (1.01.0) - Removed internal font baking API and simplified /// font atlas memory management by converting pointer /// arrays for fonts and font configurations to lists. /// - 2016/07/15 (1.00.0) - Changed button API to use context dependend button /// behavior instead of passing it for every function call. /// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - /// ## Gallery /// ![Figure [blue]: Feature overview with blue color styling](https://cloud.githubusercontent.com/assets/8057201/13538240/acd96876-e249-11e5-9547-5ac0b19667a0.png) /// ![Figure [red]: Feature overview with red color styling](https://cloud.githubusercontent.com/assets/8057201/13538243/b04acd4c-e249-11e5-8fd2-ad7744a5b446.png) diff --git a/thirdparty/glfw/deps/nuklear_glfw_gl2.h b/thirdparty/glfw/deps/nuklear_glfw_gl2.h index 61acc29c6..a959b14a5 100644 --- a/thirdparty/glfw/deps/nuklear_glfw_gl2.h +++ b/thirdparty/glfw/deps/nuklear_glfw_gl2.h @@ -230,7 +230,7 @@ nk_glfw3_mouse_button_callback(GLFWwindow* window, int button, int action, int m } NK_INTERN void -nk_glfw3_clipbard_paste(nk_handle usr, struct nk_text_edit *edit) +nk_glfw3_clipboard_paste(nk_handle usr, struct nk_text_edit *edit) { const char *text = glfwGetClipboardString(glfw.win); if (text) nk_textedit_paste(edit, text, nk_strlen(text)); @@ -238,7 +238,7 @@ nk_glfw3_clipbard_paste(nk_handle usr, struct nk_text_edit *edit) } NK_INTERN void -nk_glfw3_clipbard_copy(nk_handle usr, const char *text, int len) +nk_glfw3_clipboard_copy(nk_handle usr, const char *text, int len) { char *str = 0; (void)usr; @@ -261,8 +261,8 @@ nk_glfw3_init(GLFWwindow *win, enum nk_glfw_init_state init_state) glfwSetMouseButtonCallback(win, nk_glfw3_mouse_button_callback); } nk_init_default(&glfw.ctx, 0); - glfw.ctx.clip.copy = nk_glfw3_clipbard_copy; - glfw.ctx.clip.paste = nk_glfw3_clipbard_paste; + glfw.ctx.clip.copy = nk_glfw3_clipboard_copy; + glfw.ctx.clip.paste = nk_glfw3_clipboard_paste; glfw.ctx.clip.userdata = nk_handle_ptr(0); nk_buffer_init_default(&glfw.ogl.cmds); diff --git a/thirdparty/glfw/deps/wayland/fractional-scale-v1.xml b/thirdparty/glfw/deps/wayland/fractional-scale-v1.xml new file mode 100644 index 000000000..350bfc01e --- /dev/null +++ b/thirdparty/glfw/deps/wayland/fractional-scale-v1.xml @@ -0,0 +1,102 @@ + + + + Copyright © 2022 Kenny Levinsen + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice (including the next + paragraph) shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + + + + This protocol allows a compositor to suggest for surfaces to render at + fractional scales. + + A client can submit scaled content by utilizing wp_viewport. This is done by + creating a wp_viewport object for the surface and setting the destination + rectangle to the surface size before the scale factor is applied. + + The buffer size is calculated by multiplying the surface size by the + intended scale. + + The wl_surface buffer scale should remain set to 1. + + If a surface has a surface-local size of 100 px by 50 px and wishes to + submit buffers with a scale of 1.5, then a buffer of 150px by 75 px should + be used and the wp_viewport destination rectangle should be 100 px by 50 px. + + For toplevel surfaces, the size is rounded halfway away from zero. The + rounding algorithm for subsurface position and size is not defined. + + + + + A global interface for requesting surfaces to use fractional scales. + + + + + Informs the server that the client will not be using this protocol + object anymore. This does not affect any other objects, + wp_fractional_scale_v1 objects included. + + + + + + + + + + Create an add-on object for the the wl_surface to let the compositor + request fractional scales. If the given wl_surface already has a + wp_fractional_scale_v1 object associated, the fractional_scale_exists + protocol error is raised. + + + + + + + + + An additional interface to a wl_surface object which allows the compositor + to inform the client of the preferred scale. + + + + + Destroy the fractional scale object. When this object is destroyed, + preferred_scale events will no longer be sent. + + + + + + Notification of a new preferred scale for this surface that the + compositor suggests that the client should use. + + The sent scale is the numerator of a fraction with a denominator of 120. + + + + + diff --git a/thirdparty/glfw/deps/wayland/idle-inhibit-unstable-v1.xml b/thirdparty/glfw/deps/wayland/idle-inhibit-unstable-v1.xml new file mode 100644 index 000000000..9c06cdcba --- /dev/null +++ b/thirdparty/glfw/deps/wayland/idle-inhibit-unstable-v1.xml @@ -0,0 +1,83 @@ + + + + + Copyright © 2015 Samsung Electronics Co., Ltd + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice (including the next + paragraph) shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + + + + + This interface permits inhibiting the idle behavior such as screen + blanking, locking, and screensaving. The client binds the idle manager + globally, then creates idle-inhibitor objects for each surface. + + Warning! The protocol described in this file is experimental and + backward incompatible changes may be made. Backward compatible changes + may be added together with the corresponding interface version bump. + Backward incompatible changes are done by bumping the version number in + the protocol and interface names and resetting the interface version. + Once the protocol is to be declared stable, the 'z' prefix and the + version number in the protocol and interface names are removed and the + interface version number is reset. + + + + + Destroy the inhibit manager. + + + + + + Create a new inhibitor object associated with the given surface. + + + + + + + + + + An idle inhibitor prevents the output that the associated surface is + visible on from being set to a state where it is not visually usable due + to lack of user interaction (e.g. blanked, dimmed, locked, set to power + save, etc.) Any screensaver processes are also blocked from displaying. + + If the surface is destroyed, unmapped, becomes occluded, loses + visibility, or otherwise becomes not visually relevant for the user, the + idle inhibitor will not be honored by the compositor; if the surface + subsequently regains visibility the inhibitor takes effect once again. + Likewise, the inhibitor isn't honored if the system was already idled at + the time the inhibitor was established, although if the system later + de-idles and re-idles the inhibitor will take effect. + + + + + Remove the inhibitor effect from the associated wl_surface. + + + + + diff --git a/thirdparty/glfw/deps/wayland/pointer-constraints-unstable-v1.xml b/thirdparty/glfw/deps/wayland/pointer-constraints-unstable-v1.xml new file mode 100644 index 000000000..efd64b660 --- /dev/null +++ b/thirdparty/glfw/deps/wayland/pointer-constraints-unstable-v1.xml @@ -0,0 +1,339 @@ + + + + + Copyright © 2014 Jonas Ådahl + Copyright © 2015 Red Hat Inc. + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice (including the next + paragraph) shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + + + + This protocol specifies a set of interfaces used for adding constraints to + the motion of a pointer. Possible constraints include confining pointer + motions to a given region, or locking it to its current position. + + In order to constrain the pointer, a client must first bind the global + interface "wp_pointer_constraints" which, if a compositor supports pointer + constraints, is exposed by the registry. Using the bound global object, the + client uses the request that corresponds to the type of constraint it wants + to make. See wp_pointer_constraints for more details. + + Warning! The protocol described in this file is experimental and backward + incompatible changes may be made. Backward compatible changes may be added + together with the corresponding interface version bump. Backward + incompatible changes are done by bumping the version number in the protocol + and interface names and resetting the interface version. Once the protocol + is to be declared stable, the 'z' prefix and the version number in the + protocol and interface names are removed and the interface version number is + reset. + + + + + The global interface exposing pointer constraining functionality. It + exposes two requests: lock_pointer for locking the pointer to its + position, and confine_pointer for locking the pointer to a region. + + The lock_pointer and confine_pointer requests create the objects + wp_locked_pointer and wp_confined_pointer respectively, and the client can + use these objects to interact with the lock. + + For any surface, only one lock or confinement may be active across all + wl_pointer objects of the same seat. If a lock or confinement is requested + when another lock or confinement is active or requested on the same surface + and with any of the wl_pointer objects of the same seat, an + 'already_constrained' error will be raised. + + + + + These errors can be emitted in response to wp_pointer_constraints + requests. + + + + + + + These values represent different lifetime semantics. They are passed + as arguments to the factory requests to specify how the constraint + lifetimes should be managed. + + + + A oneshot pointer constraint will never reactivate once it has been + deactivated. See the corresponding deactivation event + (wp_locked_pointer.unlocked and wp_confined_pointer.unconfined) for + details. + + + + + A persistent pointer constraint may again reactivate once it has + been deactivated. See the corresponding deactivation event + (wp_locked_pointer.unlocked and wp_confined_pointer.unconfined) for + details. + + + + + + + Used by the client to notify the server that it will no longer use this + pointer constraints object. + + + + + + The lock_pointer request lets the client request to disable movements of + the virtual pointer (i.e. the cursor), effectively locking the pointer + to a position. This request may not take effect immediately; in the + future, when the compositor deems implementation-specific constraints + are satisfied, the pointer lock will be activated and the compositor + sends a locked event. + + The protocol provides no guarantee that the constraints are ever + satisfied, and does not require the compositor to send an error if the + constraints cannot ever be satisfied. It is thus possible to request a + lock that will never activate. + + There may not be another pointer constraint of any kind requested or + active on the surface for any of the wl_pointer objects of the seat of + the passed pointer when requesting a lock. If there is, an error will be + raised. See general pointer lock documentation for more details. + + The intersection of the region passed with this request and the input + region of the surface is used to determine where the pointer must be + in order for the lock to activate. It is up to the compositor whether to + warp the pointer or require some kind of user interaction for the lock + to activate. If the region is null the surface input region is used. + + A surface may receive pointer focus without the lock being activated. + + The request creates a new object wp_locked_pointer which is used to + interact with the lock as well as receive updates about its state. See + the the description of wp_locked_pointer for further information. + + Note that while a pointer is locked, the wl_pointer objects of the + corresponding seat will not emit any wl_pointer.motion events, but + relative motion events will still be emitted via wp_relative_pointer + objects of the same seat. wl_pointer.axis and wl_pointer.button events + are unaffected. + + + + + + + + + + + The confine_pointer request lets the client request to confine the + pointer cursor to a given region. This request may not take effect + immediately; in the future, when the compositor deems implementation- + specific constraints are satisfied, the pointer confinement will be + activated and the compositor sends a confined event. + + The intersection of the region passed with this request and the input + region of the surface is used to determine where the pointer must be + in order for the confinement to activate. It is up to the compositor + whether to warp the pointer or require some kind of user interaction for + the confinement to activate. If the region is null the surface input + region is used. + + The request will create a new object wp_confined_pointer which is used + to interact with the confinement as well as receive updates about its + state. See the the description of wp_confined_pointer for further + information. + + + + + + + + + + + + The wp_locked_pointer interface represents a locked pointer state. + + While the lock of this object is active, the wl_pointer objects of the + associated seat will not emit any wl_pointer.motion events. + + This object will send the event 'locked' when the lock is activated. + Whenever the lock is activated, it is guaranteed that the locked surface + will already have received pointer focus and that the pointer will be + within the region passed to the request creating this object. + + To unlock the pointer, send the destroy request. This will also destroy + the wp_locked_pointer object. + + If the compositor decides to unlock the pointer the unlocked event is + sent. See wp_locked_pointer.unlock for details. + + When unlocking, the compositor may warp the cursor position to the set + cursor position hint. If it does, it will not result in any relative + motion events emitted via wp_relative_pointer. + + If the surface the lock was requested on is destroyed and the lock is not + yet activated, the wp_locked_pointer object is now defunct and must be + destroyed. + + + + + Destroy the locked pointer object. If applicable, the compositor will + unlock the pointer. + + + + + + Set the cursor position hint relative to the top left corner of the + surface. + + If the client is drawing its own cursor, it should update the position + hint to the position of its own cursor. A compositor may use this + information to warp the pointer upon unlock in order to avoid pointer + jumps. + + The cursor position hint is double buffered. The new hint will only take + effect when the associated surface gets it pending state applied. See + wl_surface.commit for details. + + + + + + + + Set a new region used to lock the pointer. + + The new lock region is double-buffered. The new lock region will + only take effect when the associated surface gets its pending state + applied. See wl_surface.commit for details. + + For details about the lock region, see wp_locked_pointer. + + + + + + + Notification that the pointer lock of the seat's pointer is activated. + + + + + + Notification that the pointer lock of the seat's pointer is no longer + active. If this is a oneshot pointer lock (see + wp_pointer_constraints.lifetime) this object is now defunct and should + be destroyed. If this is a persistent pointer lock (see + wp_pointer_constraints.lifetime) this pointer lock may again + reactivate in the future. + + + + + + + The wp_confined_pointer interface represents a confined pointer state. + + This object will send the event 'confined' when the confinement is + activated. Whenever the confinement is activated, it is guaranteed that + the surface the pointer is confined to will already have received pointer + focus and that the pointer will be within the region passed to the request + creating this object. It is up to the compositor to decide whether this + requires some user interaction and if the pointer will warp to within the + passed region if outside. + + To unconfine the pointer, send the destroy request. This will also destroy + the wp_confined_pointer object. + + If the compositor decides to unconfine the pointer the unconfined event is + sent. The wp_confined_pointer object is at this point defunct and should + be destroyed. + + + + + Destroy the confined pointer object. If applicable, the compositor will + unconfine the pointer. + + + + + + Set a new region used to confine the pointer. + + The new confine region is double-buffered. The new confine region will + only take effect when the associated surface gets its pending state + applied. See wl_surface.commit for details. + + If the confinement is active when the new confinement region is applied + and the pointer ends up outside of newly applied region, the pointer may + warped to a position within the new confinement region. If warped, a + wl_pointer.motion event will be emitted, but no + wp_relative_pointer.relative_motion event. + + The compositor may also, instead of using the new region, unconfine the + pointer. + + For details about the confine region, see wp_confined_pointer. + + + + + + + Notification that the pointer confinement of the seat's pointer is + activated. + + + + + + Notification that the pointer confinement of the seat's pointer is no + longer active. If this is a oneshot pointer confinement (see + wp_pointer_constraints.lifetime) this object is now defunct and should + be destroyed. If this is a persistent pointer confinement (see + wp_pointer_constraints.lifetime) this pointer confinement may again + reactivate in the future. + + + + + diff --git a/thirdparty/glfw/deps/wayland/relative-pointer-unstable-v1.xml b/thirdparty/glfw/deps/wayland/relative-pointer-unstable-v1.xml new file mode 100644 index 000000000..ca6f81d12 --- /dev/null +++ b/thirdparty/glfw/deps/wayland/relative-pointer-unstable-v1.xml @@ -0,0 +1,136 @@ + + + + + Copyright © 2014 Jonas Ådahl + Copyright © 2015 Red Hat Inc. + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice (including the next + paragraph) shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + + + + This protocol specifies a set of interfaces used for making clients able to + receive relative pointer events not obstructed by barriers (such as the + monitor edge or other pointer barriers). + + To start receiving relative pointer events, a client must first bind the + global interface "wp_relative_pointer_manager" which, if a compositor + supports relative pointer motion events, is exposed by the registry. After + having created the relative pointer manager proxy object, the client uses + it to create the actual relative pointer object using the + "get_relative_pointer" request given a wl_pointer. The relative pointer + motion events will then, when applicable, be transmitted via the proxy of + the newly created relative pointer object. See the documentation of the + relative pointer interface for more details. + + Warning! The protocol described in this file is experimental and backward + incompatible changes may be made. Backward compatible changes may be added + together with the corresponding interface version bump. Backward + incompatible changes are done by bumping the version number in the protocol + and interface names and resetting the interface version. Once the protocol + is to be declared stable, the 'z' prefix and the version number in the + protocol and interface names are removed and the interface version number is + reset. + + + + + A global interface used for getting the relative pointer object for a + given pointer. + + + + + Used by the client to notify the server that it will no longer use this + relative pointer manager object. + + + + + + Create a relative pointer interface given a wl_pointer object. See the + wp_relative_pointer interface for more details. + + + + + + + + + A wp_relative_pointer object is an extension to the wl_pointer interface + used for emitting relative pointer events. It shares the same focus as + wl_pointer objects of the same seat and will only emit events when it has + focus. + + + + + + + + + Relative x/y pointer motion from the pointer of the seat associated with + this object. + + A relative motion is in the same dimension as regular wl_pointer motion + events, except they do not represent an absolute position. For example, + moving a pointer from (x, y) to (x', y') would have the equivalent + relative motion (x' - x, y' - y). If a pointer motion caused the + absolute pointer position to be clipped by for example the edge of the + monitor, the relative motion is unaffected by the clipping and will + represent the unclipped motion. + + This event also contains non-accelerated motion deltas. The + non-accelerated delta is, when applicable, the regular pointer motion + delta as it was before having applied motion acceleration and other + transformations such as normalization. + + Note that the non-accelerated delta does not represent 'raw' events as + they were read from some device. Pointer motion acceleration is device- + and configuration-specific and non-accelerated deltas and accelerated + deltas may have the same value on some devices. + + Relative motions are not coupled to wl_pointer.motion events, and can be + sent in combination with such events, but also independently. There may + also be scenarios where wl_pointer.motion is sent, but there is no + relative motion. The order of an absolute and relative motion event + originating from the same physical motion is not guaranteed. + + If the client needs button events or focus state, it can receive them + from a wl_pointer object of the same seat that the wp_relative_pointer + object is associated with. + + + + + + + + + + + diff --git a/thirdparty/glfw/deps/wayland/viewporter.xml b/thirdparty/glfw/deps/wayland/viewporter.xml new file mode 100644 index 000000000..d1048d1f3 --- /dev/null +++ b/thirdparty/glfw/deps/wayland/viewporter.xml @@ -0,0 +1,180 @@ + + + + + Copyright © 2013-2016 Collabora, Ltd. + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice (including the next + paragraph) shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + + + + + The global interface exposing surface cropping and scaling + capabilities is used to instantiate an interface extension for a + wl_surface object. This extended interface will then allow + cropping and scaling the surface contents, effectively + disconnecting the direct relationship between the buffer and the + surface size. + + + + + Informs the server that the client will not be using this + protocol object anymore. This does not affect any other objects, + wp_viewport objects included. + + + + + + + + + + Instantiate an interface extension for the given wl_surface to + crop and scale its content. If the given wl_surface already has + a wp_viewport object associated, the viewport_exists + protocol error is raised. + + + + + + + + + An additional interface to a wl_surface object, which allows the + client to specify the cropping and scaling of the surface + contents. + + This interface works with two concepts: the source rectangle (src_x, + src_y, src_width, src_height), and the destination size (dst_width, + dst_height). The contents of the source rectangle are scaled to the + destination size, and content outside the source rectangle is ignored. + This state is double-buffered, and is applied on the next + wl_surface.commit. + + The two parts of crop and scale state are independent: the source + rectangle, and the destination size. Initially both are unset, that + is, no scaling is applied. The whole of the current wl_buffer is + used as the source, and the surface size is as defined in + wl_surface.attach. + + If the destination size is set, it causes the surface size to become + dst_width, dst_height. The source (rectangle) is scaled to exactly + this size. This overrides whatever the attached wl_buffer size is, + unless the wl_buffer is NULL. If the wl_buffer is NULL, the surface + has no content and therefore no size. Otherwise, the size is always + at least 1x1 in surface local coordinates. + + If the source rectangle is set, it defines what area of the wl_buffer is + taken as the source. If the source rectangle is set and the destination + size is not set, then src_width and src_height must be integers, and the + surface size becomes the source rectangle size. This results in cropping + without scaling. If src_width or src_height are not integers and + destination size is not set, the bad_size protocol error is raised when + the surface state is applied. + + The coordinate transformations from buffer pixel coordinates up to + the surface-local coordinates happen in the following order: + 1. buffer_transform (wl_surface.set_buffer_transform) + 2. buffer_scale (wl_surface.set_buffer_scale) + 3. crop and scale (wp_viewport.set*) + This means, that the source rectangle coordinates of crop and scale + are given in the coordinates after the buffer transform and scale, + i.e. in the coordinates that would be the surface-local coordinates + if the crop and scale was not applied. + + If src_x or src_y are negative, the bad_value protocol error is raised. + Otherwise, if the source rectangle is partially or completely outside of + the non-NULL wl_buffer, then the out_of_buffer protocol error is raised + when the surface state is applied. A NULL wl_buffer does not raise the + out_of_buffer error. + + If the wl_surface associated with the wp_viewport is destroyed, + all wp_viewport requests except 'destroy' raise the protocol error + no_surface. + + If the wp_viewport object is destroyed, the crop and scale + state is removed from the wl_surface. The change will be applied + on the next wl_surface.commit. + + + + + The associated wl_surface's crop and scale state is removed. + The change is applied on the next wl_surface.commit. + + + + + + + + + + + + + Set the source rectangle of the associated wl_surface. See + wp_viewport for the description, and relation to the wl_buffer + size. + + If all of x, y, width and height are -1.0, the source rectangle is + unset instead. Any other set of values where width or height are zero + or negative, or x or y are negative, raise the bad_value protocol + error. + + The crop and scale state is double-buffered state, and will be + applied on the next wl_surface.commit. + + + + + + + + + + Set the destination size of the associated wl_surface. See + wp_viewport for the description, and relation to the wl_buffer + size. + + If width is -1 and height is -1, the destination size is unset + instead. Any other pair of values for width and height that + contains zero or negative values raises the bad_value protocol + error. + + The crop and scale state is double-buffered state, and will be + applied on the next wl_surface.commit. + + + + + + + diff --git a/thirdparty/glfw/deps/wayland/wayland.xml b/thirdparty/glfw/deps/wayland/wayland.xml new file mode 100644 index 000000000..10e039d6e --- /dev/null +++ b/thirdparty/glfw/deps/wayland/wayland.xml @@ -0,0 +1,3151 @@ + + + + + Copyright © 2008-2011 Kristian Høgsberg + Copyright © 2010-2011 Intel Corporation + Copyright © 2012-2013 Collabora, Ltd. + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation files + (the "Software"), to deal in the Software without restriction, + including without limitation the rights to use, copy, modify, merge, + publish, distribute, sublicense, and/or sell copies of the Software, + and to permit persons to whom the Software is furnished to do so, + subject to the following conditions: + + The above copyright notice and this permission notice (including the + next paragraph) shall be included in all copies or substantial + portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS + BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN + ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. + + + + + The core global object. This is a special singleton object. It + is used for internal Wayland protocol features. + + + + + The sync request asks the server to emit the 'done' event + on the returned wl_callback object. Since requests are + handled in-order and events are delivered in-order, this can + be used as a barrier to ensure all previous requests and the + resulting events have been handled. + + The object returned by this request will be destroyed by the + compositor after the callback is fired and as such the client must not + attempt to use it after that point. + + The callback_data passed in the callback is the event serial. + + + + + + + This request creates a registry object that allows the client + to list and bind the global objects available from the + compositor. + + It should be noted that the server side resources consumed in + response to a get_registry request can only be released when the + client disconnects, not when the client side proxy is destroyed. + Therefore, clients should invoke get_registry as infrequently as + possible to avoid wasting memory. + + + + + + + The error event is sent out when a fatal (non-recoverable) + error has occurred. The object_id argument is the object + where the error occurred, most often in response to a request + to that object. The code identifies the error and is defined + by the object interface. As such, each interface defines its + own set of error codes. The message is a brief description + of the error, for (debugging) convenience. + + + + + + + + + These errors are global and can be emitted in response to any + server request. + + + + + + + + + + This event is used internally by the object ID management + logic. When a client deletes an object that it had created, + the server will send this event to acknowledge that it has + seen the delete request. When the client receives this event, + it will know that it can safely reuse the object ID. + + + + + + + + The singleton global registry object. The server has a number of + global objects that are available to all clients. These objects + typically represent an actual object in the server (for example, + an input device) or they are singleton objects that provide + extension functionality. + + When a client creates a registry object, the registry object + will emit a global event for each global currently in the + registry. Globals come and go as a result of device or + monitor hotplugs, reconfiguration or other events, and the + registry will send out global and global_remove events to + keep the client up to date with the changes. To mark the end + of the initial burst of events, the client can use the + wl_display.sync request immediately after calling + wl_display.get_registry. + + A client can bind to a global object by using the bind + request. This creates a client-side handle that lets the object + emit events to the client and lets the client invoke requests on + the object. + + + + + Binds a new, client-created object to the server using the + specified name as the identifier. + + + + + + + + Notify the client of global objects. + + The event notifies the client that a global object with + the given name is now available, and it implements the + given version of the given interface. + + + + + + + + + Notify the client of removed global objects. + + This event notifies the client that the global identified + by name is no longer available. If the client bound to + the global using the bind request, the client should now + destroy that object. + + The object remains valid and requests to the object will be + ignored until the client destroys it, to avoid races between + the global going away and a client sending a request to it. + + + + + + + + Clients can handle the 'done' event to get notified when + the related request is done. + + Note, because wl_callback objects are created from multiple independent + factory interfaces, the wl_callback interface is frozen at version 1. + + + + + Notify the client when the related request is done. + + + + + + + + A compositor. This object is a singleton global. The + compositor is in charge of combining the contents of multiple + surfaces into one displayable output. + + + + + Ask the compositor to create a new surface. + + + + + + + Ask the compositor to create a new region. + + + + + + + + The wl_shm_pool object encapsulates a piece of memory shared + between the compositor and client. Through the wl_shm_pool + object, the client can allocate shared memory wl_buffer objects. + All objects created through the same pool share the same + underlying mapped memory. Reusing the mapped memory avoids the + setup/teardown overhead and is useful when interactively resizing + a surface or for many small buffers. + + + + + Create a wl_buffer object from the pool. + + The buffer is created offset bytes into the pool and has + width and height as specified. The stride argument specifies + the number of bytes from the beginning of one row to the beginning + of the next. The format is the pixel format of the buffer and + must be one of those advertised through the wl_shm.format event. + + A buffer will keep a reference to the pool it was created from + so it is valid to destroy the pool immediately after creating + a buffer from it. + + + + + + + + + + + + Destroy the shared memory pool. + + The mmapped memory will be released when all + buffers that have been created from this pool + are gone. + + + + + + This request will cause the server to remap the backing memory + for the pool from the file descriptor passed when the pool was + created, but using the new size. This request can only be + used to make the pool bigger. + + This request only changes the amount of bytes that are mmapped + by the server and does not touch the file corresponding to the + file descriptor passed at creation time. It is the client's + responsibility to ensure that the file is at least as big as + the new pool size. + + + + + + + + A singleton global object that provides support for shared + memory. + + Clients can create wl_shm_pool objects using the create_pool + request. + + On binding the wl_shm object one or more format events + are emitted to inform clients about the valid pixel formats + that can be used for buffers. + + + + + These errors can be emitted in response to wl_shm requests. + + + + + + + + + This describes the memory layout of an individual pixel. + + All renderers should support argb8888 and xrgb8888 but any other + formats are optional and may not be supported by the particular + renderer in use. + + The drm format codes match the macros defined in drm_fourcc.h, except + argb8888 and xrgb8888. The formats actually supported by the compositor + will be reported by the format event. + + For all wl_shm formats and unless specified in another protocol + extension, pre-multiplied alpha is used for pixel values. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Create a new wl_shm_pool object. + + The pool can be used to create shared memory based buffer + objects. The server will mmap size bytes of the passed file + descriptor, to use as backing memory for the pool. + + + + + + + + + Informs the client about a valid pixel format that + can be used for buffers. Known formats include + argb8888 and xrgb8888. + + + + + + + + A buffer provides the content for a wl_surface. Buffers are + created through factory interfaces such as wl_shm, wp_linux_buffer_params + (from the linux-dmabuf protocol extension) or similar. It has a width and + a height and can be attached to a wl_surface, but the mechanism by which a + client provides and updates the contents is defined by the buffer factory + interface. + + If the buffer uses a format that has an alpha channel, the alpha channel + is assumed to be premultiplied in the color channels unless otherwise + specified. + + Note, because wl_buffer objects are created from multiple independent + factory interfaces, the wl_buffer interface is frozen at version 1. + + + + + Destroy a buffer. If and how you need to release the backing + storage is defined by the buffer factory interface. + + For possible side-effects to a surface, see wl_surface.attach. + + + + + + Sent when this wl_buffer is no longer used by the compositor. + The client is now free to reuse or destroy this buffer and its + backing storage. + + If a client receives a release event before the frame callback + requested in the same wl_surface.commit that attaches this + wl_buffer to a surface, then the client is immediately free to + reuse the buffer and its backing storage, and does not need a + second buffer for the next surface content update. Typically + this is possible, when the compositor maintains a copy of the + wl_surface contents, e.g. as a GL texture. This is an important + optimization for GL(ES) compositors with wl_shm clients. + + + + + + + A wl_data_offer represents a piece of data offered for transfer + by another client (the source client). It is used by the + copy-and-paste and drag-and-drop mechanisms. The offer + describes the different mime types that the data can be + converted to and provides the mechanism for transferring the + data directly from the source client. + + + + + + + + + + + + Indicate that the client can accept the given mime type, or + NULL for not accepted. + + For objects of version 2 or older, this request is used by the + client to give feedback whether the client can receive the given + mime type, or NULL if none is accepted; the feedback does not + determine whether the drag-and-drop operation succeeds or not. + + For objects of version 3 or newer, this request determines the + final result of the drag-and-drop operation. If the end result + is that no mime types were accepted, the drag-and-drop operation + will be cancelled and the corresponding drag source will receive + wl_data_source.cancelled. Clients may still use this event in + conjunction with wl_data_source.action for feedback. + + + + + + + + To transfer the offered data, the client issues this request + and indicates the mime type it wants to receive. The transfer + happens through the passed file descriptor (typically created + with the pipe system call). The source client writes the data + in the mime type representation requested and then closes the + file descriptor. + + The receiving client reads from the read end of the pipe until + EOF and then closes its end, at which point the transfer is + complete. + + This request may happen multiple times for different mime types, + both before and after wl_data_device.drop. Drag-and-drop destination + clients may preemptively fetch data or examine it more closely to + determine acceptance. + + + + + + + + Destroy the data offer. + + + + + + Sent immediately after creating the wl_data_offer object. One + event per offered mime type. + + + + + + + + + Notifies the compositor that the drag destination successfully + finished the drag-and-drop operation. + + Upon receiving this request, the compositor will emit + wl_data_source.dnd_finished on the drag source client. + + It is a client error to perform other requests than + wl_data_offer.destroy after this one. It is also an error to perform + this request after a NULL mime type has been set in + wl_data_offer.accept or no action was received through + wl_data_offer.action. + + If wl_data_offer.finish request is received for a non drag and drop + operation, the invalid_finish protocol error is raised. + + + + + + Sets the actions that the destination side client supports for + this operation. This request may trigger the emission of + wl_data_source.action and wl_data_offer.action events if the compositor + needs to change the selected action. + + This request can be called multiple times throughout the + drag-and-drop operation, typically in response to wl_data_device.enter + or wl_data_device.motion events. + + This request determines the final result of the drag-and-drop + operation. If the end result is that no action is accepted, + the drag source will receive wl_data_source.cancelled. + + The dnd_actions argument must contain only values expressed in the + wl_data_device_manager.dnd_actions enum, and the preferred_action + argument must only contain one of those values set, otherwise it + will result in a protocol error. + + While managing an "ask" action, the destination drag-and-drop client + may perform further wl_data_offer.receive requests, and is expected + to perform one last wl_data_offer.set_actions request with a preferred + action other than "ask" (and optionally wl_data_offer.accept) before + requesting wl_data_offer.finish, in order to convey the action selected + by the user. If the preferred action is not in the + wl_data_offer.source_actions mask, an error will be raised. + + If the "ask" action is dismissed (e.g. user cancellation), the client + is expected to perform wl_data_offer.destroy right away. + + This request can only be made on drag-and-drop offers, a protocol error + will be raised otherwise. + + + + + + + + This event indicates the actions offered by the data source. It + will be sent immediately after creating the wl_data_offer object, + or anytime the source side changes its offered actions through + wl_data_source.set_actions. + + + + + + + This event indicates the action selected by the compositor after + matching the source/destination side actions. Only one action (or + none) will be offered here. + + This event can be emitted multiple times during the drag-and-drop + operation in response to destination side action changes through + wl_data_offer.set_actions. + + This event will no longer be emitted after wl_data_device.drop + happened on the drag-and-drop destination, the client must + honor the last action received, or the last preferred one set + through wl_data_offer.set_actions when handling an "ask" action. + + Compositors may also change the selected action on the fly, mainly + in response to keyboard modifier changes during the drag-and-drop + operation. + + The most recent action received is always the valid one. Prior to + receiving wl_data_device.drop, the chosen action may change (e.g. + due to keyboard modifiers being pressed). At the time of receiving + wl_data_device.drop the drag-and-drop destination must honor the + last action received. + + Action changes may still happen after wl_data_device.drop, + especially on "ask" actions, where the drag-and-drop destination + may choose another action afterwards. Action changes happening + at this stage are always the result of inter-client negotiation, the + compositor shall no longer be able to induce a different action. + + Upon "ask" actions, it is expected that the drag-and-drop destination + may potentially choose a different action and/or mime type, + based on wl_data_offer.source_actions and finally chosen by the + user (e.g. popping up a menu with the available options). The + final wl_data_offer.set_actions and wl_data_offer.accept requests + must happen before the call to wl_data_offer.finish. + + + + + + + + The wl_data_source object is the source side of a wl_data_offer. + It is created by the source client in a data transfer and + provides a way to describe the offered data and a way to respond + to requests to transfer the data. + + + + + + + + + + This request adds a mime type to the set of mime types + advertised to targets. Can be called several times to offer + multiple types. + + + + + + + Destroy the data source. + + + + + + Sent when a target accepts pointer_focus or motion events. If + a target does not accept any of the offered types, type is NULL. + + Used for feedback during drag-and-drop. + + + + + + + Request for data from the client. Send the data as the + specified mime type over the passed file descriptor, then + close it. + + + + + + + + This data source is no longer valid. There are several reasons why + this could happen: + + - The data source has been replaced by another data source. + - The drag-and-drop operation was performed, but the drop destination + did not accept any of the mime types offered through + wl_data_source.target. + - The drag-and-drop operation was performed, but the drop destination + did not select any of the actions present in the mask offered through + wl_data_source.action. + - The drag-and-drop operation was performed but didn't happen over a + surface. + - The compositor cancelled the drag-and-drop operation (e.g. compositor + dependent timeouts to avoid stale drag-and-drop transfers). + + The client should clean up and destroy this data source. + + For objects of version 2 or older, wl_data_source.cancelled will + only be emitted if the data source was replaced by another data + source. + + + + + + + + Sets the actions that the source side client supports for this + operation. This request may trigger wl_data_source.action and + wl_data_offer.action events if the compositor needs to change the + selected action. + + The dnd_actions argument must contain only values expressed in the + wl_data_device_manager.dnd_actions enum, otherwise it will result + in a protocol error. + + This request must be made once only, and can only be made on sources + used in drag-and-drop, so it must be performed before + wl_data_device.start_drag. Attempting to use the source other than + for drag-and-drop will raise a protocol error. + + + + + + + The user performed the drop action. This event does not indicate + acceptance, wl_data_source.cancelled may still be emitted afterwards + if the drop destination does not accept any mime type. + + However, this event might however not be received if the compositor + cancelled the drag-and-drop operation before this event could happen. + + Note that the data_source may still be used in the future and should + not be destroyed here. + + + + + + The drop destination finished interoperating with this data + source, so the client is now free to destroy this data source and + free all associated data. + + If the action used to perform the operation was "move", the + source can now delete the transferred data. + + + + + + This event indicates the action selected by the compositor after + matching the source/destination side actions. Only one action (or + none) will be offered here. + + This event can be emitted multiple times during the drag-and-drop + operation, mainly in response to destination side changes through + wl_data_offer.set_actions, and as the data device enters/leaves + surfaces. + + It is only possible to receive this event after + wl_data_source.dnd_drop_performed if the drag-and-drop operation + ended in an "ask" action, in which case the final wl_data_source.action + event will happen immediately before wl_data_source.dnd_finished. + + Compositors may also change the selected action on the fly, mainly + in response to keyboard modifier changes during the drag-and-drop + operation. + + The most recent action received is always the valid one. The chosen + action may change alongside negotiation (e.g. an "ask" action can turn + into a "move" operation), so the effects of the final action must + always be applied in wl_data_offer.dnd_finished. + + Clients can trigger cursor surface changes from this point, so + they reflect the current action. + + + + + + + + There is one wl_data_device per seat which can be obtained + from the global wl_data_device_manager singleton. + + A wl_data_device provides access to inter-client data transfer + mechanisms such as copy-and-paste and drag-and-drop. + + + + + + + + + This request asks the compositor to start a drag-and-drop + operation on behalf of the client. + + The source argument is the data source that provides the data + for the eventual data transfer. If source is NULL, enter, leave + and motion events are sent only to the client that initiated the + drag and the client is expected to handle the data passing + internally. If source is destroyed, the drag-and-drop session will be + cancelled. + + The origin surface is the surface where the drag originates and + the client must have an active implicit grab that matches the + serial. + + The icon surface is an optional (can be NULL) surface that + provides an icon to be moved around with the cursor. Initially, + the top-left corner of the icon surface is placed at the cursor + hotspot, but subsequent wl_surface.attach request can move the + relative position. Attach requests must be confirmed with + wl_surface.commit as usual. The icon surface is given the role of + a drag-and-drop icon. If the icon surface already has another role, + it raises a protocol error. + + The input region is ignored for wl_surfaces with the role of a + drag-and-drop icon. + + + + + + + + + + This request asks the compositor to set the selection + to the data from the source on behalf of the client. + + To unset the selection, set the source to NULL. + + + + + + + + The data_offer event introduces a new wl_data_offer object, + which will subsequently be used in either the + data_device.enter event (for drag-and-drop) or the + data_device.selection event (for selections). Immediately + following the data_device.data_offer event, the new data_offer + object will send out data_offer.offer events to describe the + mime types it offers. + + + + + + + This event is sent when an active drag-and-drop pointer enters + a surface owned by the client. The position of the pointer at + enter time is provided by the x and y arguments, in surface-local + coordinates. + + + + + + + + + + + This event is sent when the drag-and-drop pointer leaves the + surface and the session ends. The client must destroy the + wl_data_offer introduced at enter time at this point. + + + + + + This event is sent when the drag-and-drop pointer moves within + the currently focused surface. The new position of the pointer + is provided by the x and y arguments, in surface-local + coordinates. + + + + + + + + + The event is sent when a drag-and-drop operation is ended + because the implicit grab is removed. + + The drag-and-drop destination is expected to honor the last action + received through wl_data_offer.action, if the resulting action is + "copy" or "move", the destination can still perform + wl_data_offer.receive requests, and is expected to end all + transfers with a wl_data_offer.finish request. + + If the resulting action is "ask", the action will not be considered + final. The drag-and-drop destination is expected to perform one last + wl_data_offer.set_actions request, or wl_data_offer.destroy in order + to cancel the operation. + + + + + + The selection event is sent out to notify the client of a new + wl_data_offer for the selection for this device. The + data_device.data_offer and the data_offer.offer events are + sent out immediately before this event to introduce the data + offer object. The selection event is sent to a client + immediately before receiving keyboard focus and when a new + selection is set while the client has keyboard focus. The + data_offer is valid until a new data_offer or NULL is received + or until the client loses keyboard focus. Switching surface with + keyboard focus within the same client doesn't mean a new selection + will be sent. The client must destroy the previous selection + data_offer, if any, upon receiving this event. + + + + + + + + + This request destroys the data device. + + + + + + + The wl_data_device_manager is a singleton global object that + provides access to inter-client data transfer mechanisms such as + copy-and-paste and drag-and-drop. These mechanisms are tied to + a wl_seat and this interface lets a client get a wl_data_device + corresponding to a wl_seat. + + Depending on the version bound, the objects created from the bound + wl_data_device_manager object will have different requirements for + functioning properly. See wl_data_source.set_actions, + wl_data_offer.accept and wl_data_offer.finish for details. + + + + + Create a new data source. + + + + + + + Create a new data device for a given seat. + + + + + + + + + + This is a bitmask of the available/preferred actions in a + drag-and-drop operation. + + In the compositor, the selected action is a result of matching the + actions offered by the source and destination sides. "action" events + with a "none" action will be sent to both source and destination if + there is no match. All further checks will effectively happen on + (source actions ∩ destination actions). + + In addition, compositors may also pick different actions in + reaction to key modifiers being pressed. One common design that + is used in major toolkits (and the behavior recommended for + compositors) is: + + - If no modifiers are pressed, the first match (in bit order) + will be used. + - Pressing Shift selects "move", if enabled in the mask. + - Pressing Control selects "copy", if enabled in the mask. + + Behavior beyond that is considered implementation-dependent. + Compositors may for example bind other modifiers (like Alt/Meta) + or drags initiated with other buttons than BTN_LEFT to specific + actions (e.g. "ask"). + + + + + + + + + + + This interface is implemented by servers that provide + desktop-style user interfaces. + + It allows clients to associate a wl_shell_surface with + a basic surface. + + Note! This protocol is deprecated and not intended for production use. + For desktop-style user interfaces, use xdg_shell. Compositors and clients + should not implement this interface. + + + + + + + + + Create a shell surface for an existing surface. This gives + the wl_surface the role of a shell surface. If the wl_surface + already has another role, it raises a protocol error. + + Only one shell surface can be associated with a given surface. + + + + + + + + + An interface that may be implemented by a wl_surface, for + implementations that provide a desktop-style user interface. + + It provides requests to treat surfaces like toplevel, fullscreen + or popup windows, move, resize or maximize them, associate + metadata like title and class, etc. + + On the server side the object is automatically destroyed when + the related wl_surface is destroyed. On the client side, + wl_shell_surface_destroy() must be called before destroying + the wl_surface object. + + + + + A client must respond to a ping event with a pong request or + the client may be deemed unresponsive. + + + + + + + Start a pointer-driven move of the surface. + + This request must be used in response to a button press event. + The server may ignore move requests depending on the state of + the surface (e.g. fullscreen or maximized). + + + + + + + + These values are used to indicate which edge of a surface + is being dragged in a resize operation. The server may + use this information to adapt its behavior, e.g. choose + an appropriate cursor image. + + + + + + + + + + + + + + + Start a pointer-driven resizing of the surface. + + This request must be used in response to a button press event. + The server may ignore resize requests depending on the state of + the surface (e.g. fullscreen or maximized). + + + + + + + + + Map the surface as a toplevel surface. + + A toplevel surface is not fullscreen, maximized or transient. + + + + + + These flags specify details of the expected behaviour + of transient surfaces. Used in the set_transient request. + + + + + + + Map the surface relative to an existing surface. + + The x and y arguments specify the location of the upper left + corner of the surface relative to the upper left corner of the + parent surface, in surface-local coordinates. + + The flags argument controls details of the transient behaviour. + + + + + + + + + + Hints to indicate to the compositor how to deal with a conflict + between the dimensions of the surface and the dimensions of the + output. The compositor is free to ignore this parameter. + + + + + + + + + + Map the surface as a fullscreen surface. + + If an output parameter is given then the surface will be made + fullscreen on that output. If the client does not specify the + output then the compositor will apply its policy - usually + choosing the output on which the surface has the biggest surface + area. + + The client may specify a method to resolve a size conflict + between the output size and the surface size - this is provided + through the method parameter. + + The framerate parameter is used only when the method is set + to "driver", to indicate the preferred framerate. A value of 0 + indicates that the client does not care about framerate. The + framerate is specified in mHz, that is framerate of 60000 is 60Hz. + + A method of "scale" or "driver" implies a scaling operation of + the surface, either via a direct scaling operation or a change of + the output mode. This will override any kind of output scaling, so + that mapping a surface with a buffer size equal to the mode can + fill the screen independent of buffer_scale. + + A method of "fill" means we don't scale up the buffer, however + any output scale is applied. This means that you may run into + an edge case where the application maps a buffer with the same + size of the output mode but buffer_scale 1 (thus making a + surface larger than the output). In this case it is allowed to + downscale the results to fit the screen. + + The compositor must reply to this request with a configure event + with the dimensions for the output on which the surface will + be made fullscreen. + + + + + + + + + Map the surface as a popup. + + A popup surface is a transient surface with an added pointer + grab. + + An existing implicit grab will be changed to owner-events mode, + and the popup grab will continue after the implicit grab ends + (i.e. releasing the mouse button does not cause the popup to + be unmapped). + + The popup grab continues until the window is destroyed or a + mouse button is pressed in any other client's window. A click + in any of the client's surfaces is reported as normal, however, + clicks in other clients' surfaces will be discarded and trigger + the callback. + + The x and y arguments specify the location of the upper left + corner of the surface relative to the upper left corner of the + parent surface, in surface-local coordinates. + + + + + + + + + + + + Map the surface as a maximized surface. + + If an output parameter is given then the surface will be + maximized on that output. If the client does not specify the + output then the compositor will apply its policy - usually + choosing the output on which the surface has the biggest surface + area. + + The compositor will reply with a configure event telling + the expected new surface size. The operation is completed + on the next buffer attach to this surface. + + A maximized surface typically fills the entire output it is + bound to, except for desktop elements such as panels. This is + the main difference between a maximized shell surface and a + fullscreen shell surface. + + The details depend on the compositor implementation. + + + + + + + Set a short title for the surface. + + This string may be used to identify the surface in a task bar, + window list, or other user interface elements provided by the + compositor. + + The string must be encoded in UTF-8. + + + + + + + Set a class for the surface. + + The surface class identifies the general class of applications + to which the surface belongs. A common convention is to use the + file name (or the full path if it is a non-standard location) of + the application's .desktop file as the class. + + + + + + + Ping a client to check if it is receiving events and sending + requests. A client is expected to reply with a pong request. + + + + + + + The configure event asks the client to resize its surface. + + The size is a hint, in the sense that the client is free to + ignore it if it doesn't resize, pick a smaller size (to + satisfy aspect ratio or resize in steps of NxM pixels). + + The edges parameter provides a hint about how the surface + was resized. The client may use this information to decide + how to adjust its content to the new size (e.g. a scrolling + area might adjust its content position to leave the viewable + content unmoved). + + The client is free to dismiss all but the last configure + event it received. + + The width and height arguments specify the size of the window + in surface-local coordinates. + + + + + + + + + The popup_done event is sent out when a popup grab is broken, + that is, when the user clicks a surface that doesn't belong + to the client owning the popup surface. + + + + + + + A surface is a rectangular area that may be displayed on zero + or more outputs, and shown any number of times at the compositor's + discretion. They can present wl_buffers, receive user input, and + define a local coordinate system. + + The size of a surface (and relative positions on it) is described + in surface-local coordinates, which may differ from the buffer + coordinates of the pixel content, in case a buffer_transform + or a buffer_scale is used. + + A surface without a "role" is fairly useless: a compositor does + not know where, when or how to present it. The role is the + purpose of a wl_surface. Examples of roles are a cursor for a + pointer (as set by wl_pointer.set_cursor), a drag icon + (wl_data_device.start_drag), a sub-surface + (wl_subcompositor.get_subsurface), and a window as defined by a + shell protocol (e.g. wl_shell.get_shell_surface). + + A surface can have only one role at a time. Initially a + wl_surface does not have a role. Once a wl_surface is given a + role, it is set permanently for the whole lifetime of the + wl_surface object. Giving the current role again is allowed, + unless explicitly forbidden by the relevant interface + specification. + + Surface roles are given by requests in other interfaces such as + wl_pointer.set_cursor. The request should explicitly mention + that this request gives a role to a wl_surface. Often, this + request also creates a new protocol object that represents the + role and adds additional functionality to wl_surface. When a + client wants to destroy a wl_surface, they must destroy this role + object before the wl_surface, otherwise a defunct_role_object error is + sent. + + Destroying the role object does not remove the role from the + wl_surface, but it may stop the wl_surface from "playing the role". + For instance, if a wl_subsurface object is destroyed, the wl_surface + it was created for will be unmapped and forget its position and + z-order. It is allowed to create a wl_subsurface for the same + wl_surface again, but it is not allowed to use the wl_surface as + a cursor (cursor is a different role than sub-surface, and role + switching is not allowed). + + + + + These errors can be emitted in response to wl_surface requests. + + + + + + + + + + + Deletes the surface and invalidates its object ID. + + + + + + Set a buffer as the content of this surface. + + The new size of the surface is calculated based on the buffer + size transformed by the inverse buffer_transform and the + inverse buffer_scale. This means that at commit time the supplied + buffer size must be an integer multiple of the buffer_scale. If + that's not the case, an invalid_size error is sent. + + The x and y arguments specify the location of the new pending + buffer's upper left corner, relative to the current buffer's upper + left corner, in surface-local coordinates. In other words, the + x and y, combined with the new surface size define in which + directions the surface's size changes. Setting anything other than 0 + as x and y arguments is discouraged, and should instead be replaced + with using the separate wl_surface.offset request. + + When the bound wl_surface version is 5 or higher, passing any + non-zero x or y is a protocol violation, and will result in an + 'invalid_offset' error being raised. The x and y arguments are ignored + and do not change the pending state. To achieve equivalent semantics, + use wl_surface.offset. + + Surface contents are double-buffered state, see wl_surface.commit. + + The initial surface contents are void; there is no content. + wl_surface.attach assigns the given wl_buffer as the pending + wl_buffer. wl_surface.commit makes the pending wl_buffer the new + surface contents, and the size of the surface becomes the size + calculated from the wl_buffer, as described above. After commit, + there is no pending buffer until the next attach. + + Committing a pending wl_buffer allows the compositor to read the + pixels in the wl_buffer. The compositor may access the pixels at + any time after the wl_surface.commit request. When the compositor + will not access the pixels anymore, it will send the + wl_buffer.release event. Only after receiving wl_buffer.release, + the client may reuse the wl_buffer. A wl_buffer that has been + attached and then replaced by another attach instead of committed + will not receive a release event, and is not used by the + compositor. + + If a pending wl_buffer has been committed to more than one wl_surface, + the delivery of wl_buffer.release events becomes undefined. A well + behaved client should not rely on wl_buffer.release events in this + case. Alternatively, a client could create multiple wl_buffer objects + from the same backing storage or use wp_linux_buffer_release. + + Destroying the wl_buffer after wl_buffer.release does not change + the surface contents. Destroying the wl_buffer before wl_buffer.release + is allowed as long as the underlying buffer storage isn't re-used (this + can happen e.g. on client process termination). However, if the client + destroys the wl_buffer before receiving the wl_buffer.release event and + mutates the underlying buffer storage, the surface contents become + undefined immediately. + + If wl_surface.attach is sent with a NULL wl_buffer, the + following wl_surface.commit will remove the surface content. + + + + + + + + + This request is used to describe the regions where the pending + buffer is different from the current surface contents, and where + the surface therefore needs to be repainted. The compositor + ignores the parts of the damage that fall outside of the surface. + + Damage is double-buffered state, see wl_surface.commit. + + The damage rectangle is specified in surface-local coordinates, + where x and y specify the upper left corner of the damage rectangle. + + The initial value for pending damage is empty: no damage. + wl_surface.damage adds pending damage: the new pending damage + is the union of old pending damage and the given rectangle. + + wl_surface.commit assigns pending damage as the current damage, + and clears pending damage. The server will clear the current + damage as it repaints the surface. + + Note! New clients should not use this request. Instead damage can be + posted with wl_surface.damage_buffer which uses buffer coordinates + instead of surface coordinates. + + + + + + + + + + Request a notification when it is a good time to start drawing a new + frame, by creating a frame callback. This is useful for throttling + redrawing operations, and driving animations. + + When a client is animating on a wl_surface, it can use the 'frame' + request to get notified when it is a good time to draw and commit the + next frame of animation. If the client commits an update earlier than + that, it is likely that some updates will not make it to the display, + and the client is wasting resources by drawing too often. + + The frame request will take effect on the next wl_surface.commit. + The notification will only be posted for one frame unless + requested again. For a wl_surface, the notifications are posted in + the order the frame requests were committed. + + The server must send the notifications so that a client + will not send excessive updates, while still allowing + the highest possible update rate for clients that wait for the reply + before drawing again. The server should give some time for the client + to draw and commit after sending the frame callback events to let it + hit the next output refresh. + + A server should avoid signaling the frame callbacks if the + surface is not visible in any way, e.g. the surface is off-screen, + or completely obscured by other opaque surfaces. + + The object returned by this request will be destroyed by the + compositor after the callback is fired and as such the client must not + attempt to use it after that point. + + The callback_data passed in the callback is the current time, in + milliseconds, with an undefined base. + + + + + + + This request sets the region of the surface that contains + opaque content. + + The opaque region is an optimization hint for the compositor + that lets it optimize the redrawing of content behind opaque + regions. Setting an opaque region is not required for correct + behaviour, but marking transparent content as opaque will result + in repaint artifacts. + + The opaque region is specified in surface-local coordinates. + + The compositor ignores the parts of the opaque region that fall + outside of the surface. + + Opaque region is double-buffered state, see wl_surface.commit. + + wl_surface.set_opaque_region changes the pending opaque region. + wl_surface.commit copies the pending region to the current region. + Otherwise, the pending and current regions are never changed. + + The initial value for an opaque region is empty. Setting the pending + opaque region has copy semantics, and the wl_region object can be + destroyed immediately. A NULL wl_region causes the pending opaque + region to be set to empty. + + + + + + + This request sets the region of the surface that can receive + pointer and touch events. + + Input events happening outside of this region will try the next + surface in the server surface stack. The compositor ignores the + parts of the input region that fall outside of the surface. + + The input region is specified in surface-local coordinates. + + Input region is double-buffered state, see wl_surface.commit. + + wl_surface.set_input_region changes the pending input region. + wl_surface.commit copies the pending region to the current region. + Otherwise the pending and current regions are never changed, + except cursor and icon surfaces are special cases, see + wl_pointer.set_cursor and wl_data_device.start_drag. + + The initial value for an input region is infinite. That means the + whole surface will accept input. Setting the pending input region + has copy semantics, and the wl_region object can be destroyed + immediately. A NULL wl_region causes the input region to be set + to infinite. + + + + + + + Surface state (input, opaque, and damage regions, attached buffers, + etc.) is double-buffered. Protocol requests modify the pending state, + as opposed to the current state in use by the compositor. A commit + request atomically applies all pending state, replacing the current + state. After commit, the new pending state is as documented for each + related request. + + On commit, a pending wl_buffer is applied first, and all other state + second. This means that all coordinates in double-buffered state are + relative to the new wl_buffer coming into use, except for + wl_surface.attach itself. If there is no pending wl_buffer, the + coordinates are relative to the current surface contents. + + All requests that need a commit to become effective are documented + to affect double-buffered state. + + Other interfaces may add further double-buffered surface state. + + + + + + This is emitted whenever a surface's creation, movement, or resizing + results in some part of it being within the scanout region of an + output. + + Note that a surface may be overlapping with zero or more outputs. + + + + + + + This is emitted whenever a surface's creation, movement, or resizing + results in it no longer having any part of it within the scanout region + of an output. + + Clients should not use the number of outputs the surface is on for frame + throttling purposes. The surface might be hidden even if no leave event + has been sent, and the compositor might expect new surface content + updates even if no enter event has been sent. The frame event should be + used instead. + + + + + + + + + This request sets an optional transformation on how the compositor + interprets the contents of the buffer attached to the surface. The + accepted values for the transform parameter are the values for + wl_output.transform. + + Buffer transform is double-buffered state, see wl_surface.commit. + + A newly created surface has its buffer transformation set to normal. + + wl_surface.set_buffer_transform changes the pending buffer + transformation. wl_surface.commit copies the pending buffer + transformation to the current one. Otherwise, the pending and current + values are never changed. + + The purpose of this request is to allow clients to render content + according to the output transform, thus permitting the compositor to + use certain optimizations even if the display is rotated. Using + hardware overlays and scanning out a client buffer for fullscreen + surfaces are examples of such optimizations. Those optimizations are + highly dependent on the compositor implementation, so the use of this + request should be considered on a case-by-case basis. + + Note that if the transform value includes 90 or 270 degree rotation, + the width of the buffer will become the surface height and the height + of the buffer will become the surface width. + + If transform is not one of the values from the + wl_output.transform enum the invalid_transform protocol error + is raised. + + + + + + + + + This request sets an optional scaling factor on how the compositor + interprets the contents of the buffer attached to the window. + + Buffer scale is double-buffered state, see wl_surface.commit. + + A newly created surface has its buffer scale set to 1. + + wl_surface.set_buffer_scale changes the pending buffer scale. + wl_surface.commit copies the pending buffer scale to the current one. + Otherwise, the pending and current values are never changed. + + The purpose of this request is to allow clients to supply higher + resolution buffer data for use on high resolution outputs. It is + intended that you pick the same buffer scale as the scale of the + output that the surface is displayed on. This means the compositor + can avoid scaling when rendering the surface on that output. + + Note that if the scale is larger than 1, then you have to attach + a buffer that is larger (by a factor of scale in each dimension) + than the desired surface size. + + If scale is not positive the invalid_scale protocol error is + raised. + + + + + + + + This request is used to describe the regions where the pending + buffer is different from the current surface contents, and where + the surface therefore needs to be repainted. The compositor + ignores the parts of the damage that fall outside of the surface. + + Damage is double-buffered state, see wl_surface.commit. + + The damage rectangle is specified in buffer coordinates, + where x and y specify the upper left corner of the damage rectangle. + + The initial value for pending damage is empty: no damage. + wl_surface.damage_buffer adds pending damage: the new pending + damage is the union of old pending damage and the given rectangle. + + wl_surface.commit assigns pending damage as the current damage, + and clears pending damage. The server will clear the current + damage as it repaints the surface. + + This request differs from wl_surface.damage in only one way - it + takes damage in buffer coordinates instead of surface-local + coordinates. While this generally is more intuitive than surface + coordinates, it is especially desirable when using wp_viewport + or when a drawing library (like EGL) is unaware of buffer scale + and buffer transform. + + Note: Because buffer transformation changes and damage requests may + be interleaved in the protocol stream, it is impossible to determine + the actual mapping between surface and buffer damage until + wl_surface.commit time. Therefore, compositors wishing to take both + kinds of damage into account will have to accumulate damage from the + two requests separately and only transform from one to the other + after receiving the wl_surface.commit. + + + + + + + + + + + + The x and y arguments specify the location of the new pending + buffer's upper left corner, relative to the current buffer's upper + left corner, in surface-local coordinates. In other words, the + x and y, combined with the new surface size define in which + directions the surface's size changes. + + Surface location offset is double-buffered state, see + wl_surface.commit. + + This request is semantically equivalent to and the replaces the x and y + arguments in the wl_surface.attach request in wl_surface versions prior + to 5. See wl_surface.attach for details. + + + + + + + + + + This event indicates the preferred buffer scale for this surface. It is + sent whenever the compositor's preference changes. + + It is intended that scaling aware clients use this event to scale their + content and use wl_surface.set_buffer_scale to indicate the scale they + have rendered with. This allows clients to supply a higher detail + buffer. + + + + + + + This event indicates the preferred buffer transform for this surface. + It is sent whenever the compositor's preference changes. + + It is intended that transform aware clients use this event to apply the + transform to their content and use wl_surface.set_buffer_transform to + indicate the transform they have rendered with. + + + + + + + + A seat is a group of keyboards, pointer and touch devices. This + object is published as a global during start up, or when such a + device is hot plugged. A seat typically has a pointer and + maintains a keyboard focus and a pointer focus. + + + + + This is a bitmask of capabilities this seat has; if a member is + set, then it is present on the seat. + + + + + + + + + These errors can be emitted in response to wl_seat requests. + + + + + + + This is emitted whenever a seat gains or loses the pointer, + keyboard or touch capabilities. The argument is a capability + enum containing the complete set of capabilities this seat has. + + When the pointer capability is added, a client may create a + wl_pointer object using the wl_seat.get_pointer request. This object + will receive pointer events until the capability is removed in the + future. + + When the pointer capability is removed, a client should destroy the + wl_pointer objects associated with the seat where the capability was + removed, using the wl_pointer.release request. No further pointer + events will be received on these objects. + + In some compositors, if a seat regains the pointer capability and a + client has a previously obtained wl_pointer object of version 4 or + less, that object may start sending pointer events again. This + behavior is considered a misinterpretation of the intended behavior + and must not be relied upon by the client. wl_pointer objects of + version 5 or later must not send events if created before the most + recent event notifying the client of an added pointer capability. + + The above behavior also applies to wl_keyboard and wl_touch with the + keyboard and touch capabilities, respectively. + + + + + + + The ID provided will be initialized to the wl_pointer interface + for this seat. + + This request only takes effect if the seat has the pointer + capability, or has had the pointer capability in the past. + It is a protocol violation to issue this request on a seat that has + never had the pointer capability. The missing_capability error will + be sent in this case. + + + + + + + The ID provided will be initialized to the wl_keyboard interface + for this seat. + + This request only takes effect if the seat has the keyboard + capability, or has had the keyboard capability in the past. + It is a protocol violation to issue this request on a seat that has + never had the keyboard capability. The missing_capability error will + be sent in this case. + + + + + + + The ID provided will be initialized to the wl_touch interface + for this seat. + + This request only takes effect if the seat has the touch + capability, or has had the touch capability in the past. + It is a protocol violation to issue this request on a seat that has + never had the touch capability. The missing_capability error will + be sent in this case. + + + + + + + + + In a multi-seat configuration the seat name can be used by clients to + help identify which physical devices the seat represents. + + The seat name is a UTF-8 string with no convention defined for its + contents. Each name is unique among all wl_seat globals. The name is + only guaranteed to be unique for the current compositor instance. + + The same seat names are used for all clients. Thus, the name can be + shared across processes to refer to a specific wl_seat global. + + The name event is sent after binding to the seat global. This event is + only sent once per seat object, and the name does not change over the + lifetime of the wl_seat global. + + Compositors may re-use the same seat name if the wl_seat global is + destroyed and re-created later. + + + + + + + + + Using this request a client can tell the server that it is not going to + use the seat object anymore. + + + + + + + + The wl_pointer interface represents one or more input devices, + such as mice, which control the pointer location and pointer_focus + of a seat. + + The wl_pointer interface generates motion, enter and leave + events for the surfaces that the pointer is located over, + and button and axis events for button presses, button releases + and scrolling. + + + + + + + + + Set the pointer surface, i.e., the surface that contains the + pointer image (cursor). This request gives the surface the role + of a cursor. If the surface already has another role, it raises + a protocol error. + + The cursor actually changes only if the pointer + focus for this device is one of the requesting client's surfaces + or the surface parameter is the current pointer surface. If + there was a previous surface set with this request it is + replaced. If surface is NULL, the pointer image is hidden. + + The parameters hotspot_x and hotspot_y define the position of + the pointer surface relative to the pointer location. Its + top-left corner is always at (x, y) - (hotspot_x, hotspot_y), + where (x, y) are the coordinates of the pointer location, in + surface-local coordinates. + + On surface.attach requests to the pointer surface, hotspot_x + and hotspot_y are decremented by the x and y parameters + passed to the request. Attach must be confirmed by + wl_surface.commit as usual. + + The hotspot can also be updated by passing the currently set + pointer surface to this request with new values for hotspot_x + and hotspot_y. + + The input region is ignored for wl_surfaces with the role of + a cursor. When the use as a cursor ends, the wl_surface is + unmapped. + + The serial parameter must match the latest wl_pointer.enter + serial number sent to the client. Otherwise the request will be + ignored. + + + + + + + + + + Notification that this seat's pointer is focused on a certain + surface. + + When a seat's focus enters a surface, the pointer image + is undefined and a client should respond to this event by setting + an appropriate pointer image with the set_cursor request. + + + + + + + + + + Notification that this seat's pointer is no longer focused on + a certain surface. + + The leave notification is sent before the enter notification + for the new focus. + + + + + + + + Notification of pointer location change. The arguments + surface_x and surface_y are the location relative to the + focused surface. + + + + + + + + + Describes the physical state of a button that produced the button + event. + + + + + + + + Mouse button click and release notifications. + + The location of the click is given by the last motion or + enter event. + The time argument is a timestamp with millisecond + granularity, with an undefined base. + + The button is a button code as defined in the Linux kernel's + linux/input-event-codes.h header file, e.g. BTN_LEFT. + + Any 16-bit button code value is reserved for future additions to the + kernel's event code list. All other button codes above 0xFFFF are + currently undefined but may be used in future versions of this + protocol. + + + + + + + + + + Describes the axis types of scroll events. + + + + + + + + Scroll and other axis notifications. + + For scroll events (vertical and horizontal scroll axes), the + value parameter is the length of a vector along the specified + axis in a coordinate space identical to those of motion events, + representing a relative movement along the specified axis. + + For devices that support movements non-parallel to axes multiple + axis events will be emitted. + + When applicable, for example for touch pads, the server can + choose to emit scroll events where the motion vector is + equivalent to a motion event vector. + + When applicable, a client can transform its content relative to the + scroll distance. + + + + + + + + + + + Using this request a client can tell the server that it is not going to + use the pointer object anymore. + + This request destroys the pointer proxy object, so clients must not call + wl_pointer_destroy() after using this request. + + + + + + + + Indicates the end of a set of events that logically belong together. + A client is expected to accumulate the data in all events within the + frame before proceeding. + + All wl_pointer events before a wl_pointer.frame event belong + logically together. For example, in a diagonal scroll motion the + compositor will send an optional wl_pointer.axis_source event, two + wl_pointer.axis events (horizontal and vertical) and finally a + wl_pointer.frame event. The client may use this information to + calculate a diagonal vector for scrolling. + + When multiple wl_pointer.axis events occur within the same frame, + the motion vector is the combined motion of all events. + When a wl_pointer.axis and a wl_pointer.axis_stop event occur within + the same frame, this indicates that axis movement in one axis has + stopped but continues in the other axis. + When multiple wl_pointer.axis_stop events occur within the same + frame, this indicates that these axes stopped in the same instance. + + A wl_pointer.frame event is sent for every logical event group, + even if the group only contains a single wl_pointer event. + Specifically, a client may get a sequence: motion, frame, button, + frame, axis, frame, axis_stop, frame. + + The wl_pointer.enter and wl_pointer.leave events are logical events + generated by the compositor and not the hardware. These events are + also grouped by a wl_pointer.frame. When a pointer moves from one + surface to another, a compositor should group the + wl_pointer.leave event within the same wl_pointer.frame. + However, a client must not rely on wl_pointer.leave and + wl_pointer.enter being in the same wl_pointer.frame. + Compositor-specific policies may require the wl_pointer.leave and + wl_pointer.enter event being split across multiple wl_pointer.frame + groups. + + + + + + Describes the source types for axis events. This indicates to the + client how an axis event was physically generated; a client may + adjust the user interface accordingly. For example, scroll events + from a "finger" source may be in a smooth coordinate space with + kinetic scrolling whereas a "wheel" source may be in discrete steps + of a number of lines. + + The "continuous" axis source is a device generating events in a + continuous coordinate space, but using something other than a + finger. One example for this source is button-based scrolling where + the vertical motion of a device is converted to scroll events while + a button is held down. + + The "wheel tilt" axis source indicates that the actual device is a + wheel but the scroll event is not caused by a rotation but a + (usually sideways) tilt of the wheel. + + + + + + + + + + Source information for scroll and other axes. + + This event does not occur on its own. It is sent before a + wl_pointer.frame event and carries the source information for + all events within that frame. + + The source specifies how this event was generated. If the source is + wl_pointer.axis_source.finger, a wl_pointer.axis_stop event will be + sent when the user lifts the finger off the device. + + If the source is wl_pointer.axis_source.wheel, + wl_pointer.axis_source.wheel_tilt or + wl_pointer.axis_source.continuous, a wl_pointer.axis_stop event may + or may not be sent. Whether a compositor sends an axis_stop event + for these sources is hardware-specific and implementation-dependent; + clients must not rely on receiving an axis_stop event for these + scroll sources and should treat scroll sequences from these scroll + sources as unterminated by default. + + This event is optional. If the source is unknown for a particular + axis event sequence, no event is sent. + Only one wl_pointer.axis_source event is permitted per frame. + + The order of wl_pointer.axis_discrete and wl_pointer.axis_source is + not guaranteed. + + + + + + + Stop notification for scroll and other axes. + + For some wl_pointer.axis_source types, a wl_pointer.axis_stop event + is sent to notify a client that the axis sequence has terminated. + This enables the client to implement kinetic scrolling. + See the wl_pointer.axis_source documentation for information on when + this event may be generated. + + Any wl_pointer.axis events with the same axis_source after this + event should be considered as the start of a new axis motion. + + The timestamp is to be interpreted identical to the timestamp in the + wl_pointer.axis event. The timestamp value may be the same as a + preceding wl_pointer.axis event. + + + + + + + + Discrete step information for scroll and other axes. + + This event carries the axis value of the wl_pointer.axis event in + discrete steps (e.g. mouse wheel clicks). + + This event is deprecated with wl_pointer version 8 - this event is not + sent to clients supporting version 8 or later. + + This event does not occur on its own, it is coupled with a + wl_pointer.axis event that represents this axis value on a + continuous scale. The protocol guarantees that each axis_discrete + event is always followed by exactly one axis event with the same + axis number within the same wl_pointer.frame. Note that the protocol + allows for other events to occur between the axis_discrete and + its coupled axis event, including other axis_discrete or axis + events. A wl_pointer.frame must not contain more than one axis_discrete + event per axis type. + + This event is optional; continuous scrolling devices + like two-finger scrolling on touchpads do not have discrete + steps and do not generate this event. + + The discrete value carries the directional information. e.g. a value + of -2 is two steps towards the negative direction of this axis. + + The axis number is identical to the axis number in the associated + axis event. + + The order of wl_pointer.axis_discrete and wl_pointer.axis_source is + not guaranteed. + + + + + + + + Discrete high-resolution scroll information. + + This event carries high-resolution wheel scroll information, + with each multiple of 120 representing one logical scroll step + (a wheel detent). For example, an axis_value120 of 30 is one quarter of + a logical scroll step in the positive direction, a value120 of + -240 are two logical scroll steps in the negative direction within the + same hardware event. + Clients that rely on discrete scrolling should accumulate the + value120 to multiples of 120 before processing the event. + + The value120 must not be zero. + + This event replaces the wl_pointer.axis_discrete event in clients + supporting wl_pointer version 8 or later. + + Where a wl_pointer.axis_source event occurs in the same + wl_pointer.frame, the axis source applies to this event. + + The order of wl_pointer.axis_value120 and wl_pointer.axis_source is + not guaranteed. + + + + + + + + + + This specifies the direction of the physical motion that caused a + wl_pointer.axis event, relative to the wl_pointer.axis direction. + + + + + + + + Relative directional information of the entity causing the axis + motion. + + For a wl_pointer.axis event, the wl_pointer.axis_relative_direction + event specifies the movement direction of the entity causing the + wl_pointer.axis event. For example: + - if a user's fingers on a touchpad move down and this + causes a wl_pointer.axis vertical_scroll down event, the physical + direction is 'identical' + - if a user's fingers on a touchpad move down and this causes a + wl_pointer.axis vertical_scroll up scroll up event ('natural + scrolling'), the physical direction is 'inverted'. + + A client may use this information to adjust scroll motion of + components. Specifically, enabling natural scrolling causes the + content to change direction compared to traditional scrolling. + Some widgets like volume control sliders should usually match the + physical direction regardless of whether natural scrolling is + active. This event enables clients to match the scroll direction of + a widget to the physical direction. + + This event does not occur on its own, it is coupled with a + wl_pointer.axis event that represents this axis value. + The protocol guarantees that each axis_relative_direction event is + always followed by exactly one axis event with the same + axis number within the same wl_pointer.frame. Note that the protocol + allows for other events to occur between the axis_relative_direction + and its coupled axis event. + + The axis number is identical to the axis number in the associated + axis event. + + The order of wl_pointer.axis_relative_direction, + wl_pointer.axis_discrete and wl_pointer.axis_source is not + guaranteed. + + + + + + + + + The wl_keyboard interface represents one or more keyboards + associated with a seat. + + + + + This specifies the format of the keymap provided to the + client with the wl_keyboard.keymap event. + + + + + + + + This event provides a file descriptor to the client which can be + memory-mapped in read-only mode to provide a keyboard mapping + description. + + From version 7 onwards, the fd must be mapped with MAP_PRIVATE by + the recipient, as MAP_SHARED may fail. + + + + + + + + + Notification that this seat's keyboard focus is on a certain + surface. + + The compositor must send the wl_keyboard.modifiers event after this + event. + + + + + + + + + Notification that this seat's keyboard focus is no longer on + a certain surface. + + The leave notification is sent before the enter notification + for the new focus. + + After this event client must assume that all keys, including modifiers, + are lifted and also it must stop key repeating if there's some going on. + + + + + + + + Describes the physical state of a key that produced the key event. + + + + + + + + A key was pressed or released. + The time argument is a timestamp with millisecond + granularity, with an undefined base. + + The key is a platform-specific key code that can be interpreted + by feeding it to the keyboard mapping (see the keymap event). + + If this event produces a change in modifiers, then the resulting + wl_keyboard.modifiers event must be sent after this event. + + + + + + + + + + Notifies clients that the modifier and/or group state has + changed, and it should update its local state. + + + + + + + + + + + + + + + + + + + Informs the client about the keyboard's repeat rate and delay. + + This event is sent as soon as the wl_keyboard object has been created, + and is guaranteed to be received by the client before any key press + event. + + Negative values for either rate or delay are illegal. A rate of zero + will disable any repeating (regardless of the value of delay). + + This event can be sent later on as well with a new value if necessary, + so clients should continue listening for the event past the creation + of wl_keyboard. + + + + + + + + + The wl_touch interface represents a touchscreen + associated with a seat. + + Touch interactions can consist of one or more contacts. + For each contact, a series of events is generated, starting + with a down event, followed by zero or more motion events, + and ending with an up event. Events relating to the same + contact point can be identified by the ID of the sequence. + + + + + A new touch point has appeared on the surface. This touch point is + assigned a unique ID. Future events from this touch point reference + this ID. The ID ceases to be valid after a touch up event and may be + reused in the future. + + + + + + + + + + + + The touch point has disappeared. No further events will be sent for + this touch point and the touch point's ID is released and may be + reused in a future touch down event. + + + + + + + + + A touch point has changed coordinates. + + + + + + + + + + Indicates the end of a set of events that logically belong together. + A client is expected to accumulate the data in all events within the + frame before proceeding. + + A wl_touch.frame terminates at least one event but otherwise no + guarantee is provided about the set of events within a frame. A client + must assume that any state not updated in a frame is unchanged from the + previously known state. + + + + + + Sent if the compositor decides the touch stream is a global + gesture. No further events are sent to the clients from that + particular gesture. Touch cancellation applies to all touch points + currently active on this client's surface. The client is + responsible for finalizing the touch points, future touch points on + this surface may reuse the touch point ID. + + + + + + + + + + + + + + Sent when a touchpoint has changed its shape. + + This event does not occur on its own. It is sent before a + wl_touch.frame event and carries the new shape information for + any previously reported, or new touch points of that frame. + + Other events describing the touch point such as wl_touch.down, + wl_touch.motion or wl_touch.orientation may be sent within the + same wl_touch.frame. A client should treat these events as a single + logical touch point update. The order of wl_touch.shape, + wl_touch.orientation and wl_touch.motion is not guaranteed. + A wl_touch.down event is guaranteed to occur before the first + wl_touch.shape event for this touch ID but both events may occur within + the same wl_touch.frame. + + A touchpoint shape is approximated by an ellipse through the major and + minor axis length. The major axis length describes the longer diameter + of the ellipse, while the minor axis length describes the shorter + diameter. Major and minor are orthogonal and both are specified in + surface-local coordinates. The center of the ellipse is always at the + touchpoint location as reported by wl_touch.down or wl_touch.move. + + This event is only sent by the compositor if the touch device supports + shape reports. The client has to make reasonable assumptions about the + shape if it did not receive this event. + + + + + + + + + Sent when a touchpoint has changed its orientation. + + This event does not occur on its own. It is sent before a + wl_touch.frame event and carries the new shape information for + any previously reported, or new touch points of that frame. + + Other events describing the touch point such as wl_touch.down, + wl_touch.motion or wl_touch.shape may be sent within the + same wl_touch.frame. A client should treat these events as a single + logical touch point update. The order of wl_touch.shape, + wl_touch.orientation and wl_touch.motion is not guaranteed. + A wl_touch.down event is guaranteed to occur before the first + wl_touch.orientation event for this touch ID but both events may occur + within the same wl_touch.frame. + + The orientation describes the clockwise angle of a touchpoint's major + axis to the positive surface y-axis and is normalized to the -180 to + +180 degree range. The granularity of orientation depends on the touch + device, some devices only support binary rotation values between 0 and + 90 degrees. + + This event is only sent by the compositor if the touch device supports + orientation reports. + + + + + + + + + An output describes part of the compositor geometry. The + compositor works in the 'compositor coordinate system' and an + output corresponds to a rectangular area in that space that is + actually visible. This typically corresponds to a monitor that + displays part of the compositor space. This object is published + as global during start up, or when a monitor is hotplugged. + + + + + This enumeration describes how the physical + pixels on an output are laid out. + + + + + + + + + + + + This describes the transform that a compositor will apply to a + surface to compensate for the rotation or mirroring of an + output device. + + The flipped values correspond to an initial flip around a + vertical axis followed by rotation. + + The purpose is mainly to allow clients to render accordingly and + tell the compositor, so that for fullscreen surfaces, the + compositor will still be able to scan out directly from client + surfaces. + + + + + + + + + + + + + + The geometry event describes geometric properties of the output. + The event is sent when binding to the output object and whenever + any of the properties change. + + The physical size can be set to zero if it doesn't make sense for this + output (e.g. for projectors or virtual outputs). + + The geometry event will be followed by a done event (starting from + version 2). + + Note: wl_output only advertises partial information about the output + position and identification. Some compositors, for instance those not + implementing a desktop-style output layout or those exposing virtual + outputs, might fake this information. Instead of using x and y, clients + should use xdg_output.logical_position. Instead of using make and model, + clients should use name and description. + + + + + + + + + + + + + + These flags describe properties of an output mode. + They are used in the flags bitfield of the mode event. + + + + + + + + The mode event describes an available mode for the output. + + The event is sent when binding to the output object and there + will always be one mode, the current mode. The event is sent + again if an output changes mode, for the mode that is now + current. In other words, the current mode is always the last + mode that was received with the current flag set. + + Non-current modes are deprecated. A compositor can decide to only + advertise the current mode and never send other modes. Clients + should not rely on non-current modes. + + The size of a mode is given in physical hardware units of + the output device. This is not necessarily the same as + the output size in the global compositor space. For instance, + the output may be scaled, as described in wl_output.scale, + or transformed, as described in wl_output.transform. Clients + willing to retrieve the output size in the global compositor + space should use xdg_output.logical_size instead. + + The vertical refresh rate can be set to zero if it doesn't make + sense for this output (e.g. for virtual outputs). + + The mode event will be followed by a done event (starting from + version 2). + + Clients should not use the refresh rate to schedule frames. Instead, + they should use the wl_surface.frame event or the presentation-time + protocol. + + Note: this information is not always meaningful for all outputs. Some + compositors, such as those exposing virtual outputs, might fake the + refresh rate or the size. + + + + + + + + + + + + This event is sent after all other properties have been + sent after binding to the output object and after any + other property changes done after that. This allows + changes to the output properties to be seen as + atomic, even if they happen via multiple events. + + + + + + This event contains scaling geometry information + that is not in the geometry event. It may be sent after + binding the output object or if the output scale changes + later. If it is not sent, the client should assume a + scale of 1. + + A scale larger than 1 means that the compositor will + automatically scale surface buffers by this amount + when rendering. This is used for very high resolution + displays where applications rendering at the native + resolution would be too small to be legible. + + It is intended that scaling aware clients track the + current output of a surface, and if it is on a scaled + output it should use wl_surface.set_buffer_scale with + the scale of the output. That way the compositor can + avoid scaling the surface, and the client can supply + a higher detail image. + + The scale event will be followed by a done event. + + + + + + + + + Using this request a client can tell the server that it is not going to + use the output object anymore. + + + + + + + + Many compositors will assign user-friendly names to their outputs, show + them to the user, allow the user to refer to an output, etc. The client + may wish to know this name as well to offer the user similar behaviors. + + The name is a UTF-8 string with no convention defined for its contents. + Each name is unique among all wl_output globals. The name is only + guaranteed to be unique for the compositor instance. + + The same output name is used for all clients for a given wl_output + global. Thus, the name can be shared across processes to refer to a + specific wl_output global. + + The name is not guaranteed to be persistent across sessions, thus cannot + be used to reliably identify an output in e.g. configuration files. + + Examples of names include 'HDMI-A-1', 'WL-1', 'X11-1', etc. However, do + not assume that the name is a reflection of an underlying DRM connector, + X11 connection, etc. + + The name event is sent after binding the output object. This event is + only sent once per output object, and the name does not change over the + lifetime of the wl_output global. + + Compositors may re-use the same output name if the wl_output global is + destroyed and re-created later. Compositors should avoid re-using the + same name if possible. + + The name event will be followed by a done event. + + + + + + + Many compositors can produce human-readable descriptions of their + outputs. The client may wish to know this description as well, e.g. for + output selection purposes. + + The description is a UTF-8 string with no convention defined for its + contents. The description is not guaranteed to be unique among all + wl_output globals. Examples might include 'Foocorp 11" Display' or + 'Virtual X11 output via :1'. + + The description event is sent after binding the output object and + whenever the description changes. The description is optional, and may + not be sent at all. + + The description event will be followed by a done event. + + + + + + + + A region object describes an area. + + Region objects are used to describe the opaque and input + regions of a surface. + + + + + Destroy the region. This will invalidate the object ID. + + + + + + Add the specified rectangle to the region. + + + + + + + + + + Subtract the specified rectangle from the region. + + + + + + + + + + + The global interface exposing sub-surface compositing capabilities. + A wl_surface, that has sub-surfaces associated, is called the + parent surface. Sub-surfaces can be arbitrarily nested and create + a tree of sub-surfaces. + + The root surface in a tree of sub-surfaces is the main + surface. The main surface cannot be a sub-surface, because + sub-surfaces must always have a parent. + + A main surface with its sub-surfaces forms a (compound) window. + For window management purposes, this set of wl_surface objects is + to be considered as a single window, and it should also behave as + such. + + The aim of sub-surfaces is to offload some of the compositing work + within a window from clients to the compositor. A prime example is + a video player with decorations and video in separate wl_surface + objects. This should allow the compositor to pass YUV video buffer + processing to dedicated overlay hardware when possible. + + + + + Informs the server that the client will not be using this + protocol object anymore. This does not affect any other + objects, wl_subsurface objects included. + + + + + + + + + + + Create a sub-surface interface for the given surface, and + associate it with the given parent surface. This turns a + plain wl_surface into a sub-surface. + + The to-be sub-surface must not already have another role, and it + must not have an existing wl_subsurface object. Otherwise the + bad_surface protocol error is raised. + + Adding sub-surfaces to a parent is a double-buffered operation on the + parent (see wl_surface.commit). The effect of adding a sub-surface + becomes visible on the next time the state of the parent surface is + applied. + + The parent surface must not be one of the child surface's descendants, + and the parent must be different from the child surface, otherwise the + bad_parent protocol error is raised. + + This request modifies the behaviour of wl_surface.commit request on + the sub-surface, see the documentation on wl_subsurface interface. + + + + + + + + + + An additional interface to a wl_surface object, which has been + made a sub-surface. A sub-surface has one parent surface. A + sub-surface's size and position are not limited to that of the parent. + Particularly, a sub-surface is not automatically clipped to its + parent's area. + + A sub-surface becomes mapped, when a non-NULL wl_buffer is applied + and the parent surface is mapped. The order of which one happens + first is irrelevant. A sub-surface is hidden if the parent becomes + hidden, or if a NULL wl_buffer is applied. These rules apply + recursively through the tree of surfaces. + + The behaviour of a wl_surface.commit request on a sub-surface + depends on the sub-surface's mode. The possible modes are + synchronized and desynchronized, see methods + wl_subsurface.set_sync and wl_subsurface.set_desync. Synchronized + mode caches the wl_surface state to be applied when the parent's + state gets applied, and desynchronized mode applies the pending + wl_surface state directly. A sub-surface is initially in the + synchronized mode. + + Sub-surfaces also have another kind of state, which is managed by + wl_subsurface requests, as opposed to wl_surface requests. This + state includes the sub-surface position relative to the parent + surface (wl_subsurface.set_position), and the stacking order of + the parent and its sub-surfaces (wl_subsurface.place_above and + .place_below). This state is applied when the parent surface's + wl_surface state is applied, regardless of the sub-surface's mode. + As the exception, set_sync and set_desync are effective immediately. + + The main surface can be thought to be always in desynchronized mode, + since it does not have a parent in the sub-surfaces sense. + + Even if a sub-surface is in desynchronized mode, it will behave as + in synchronized mode, if its parent surface behaves as in + synchronized mode. This rule is applied recursively throughout the + tree of surfaces. This means, that one can set a sub-surface into + synchronized mode, and then assume that all its child and grand-child + sub-surfaces are synchronized, too, without explicitly setting them. + + Destroying a sub-surface takes effect immediately. If you need to + synchronize the removal of a sub-surface to the parent surface update, + unmap the sub-surface first by attaching a NULL wl_buffer, update parent, + and then destroy the sub-surface. + + If the parent wl_surface object is destroyed, the sub-surface is + unmapped. + + + + + The sub-surface interface is removed from the wl_surface object + that was turned into a sub-surface with a + wl_subcompositor.get_subsurface request. The wl_surface's association + to the parent is deleted. The wl_surface is unmapped immediately. + + + + + + + + + + This schedules a sub-surface position change. + The sub-surface will be moved so that its origin (top left + corner pixel) will be at the location x, y of the parent surface + coordinate system. The coordinates are not restricted to the parent + surface area. Negative values are allowed. + + The scheduled coordinates will take effect whenever the state of the + parent surface is applied. When this happens depends on whether the + parent surface is in synchronized mode or not. See + wl_subsurface.set_sync and wl_subsurface.set_desync for details. + + If more than one set_position request is invoked by the client before + the commit of the parent surface, the position of a new request always + replaces the scheduled position from any previous request. + + The initial position is 0, 0. + + + + + + + + This sub-surface is taken from the stack, and put back just + above the reference surface, changing the z-order of the sub-surfaces. + The reference surface must be one of the sibling surfaces, or the + parent surface. Using any other surface, including this sub-surface, + will cause a protocol error. + + The z-order is double-buffered. Requests are handled in order and + applied immediately to a pending state. The final pending state is + copied to the active state the next time the state of the parent + surface is applied. When this happens depends on whether the parent + surface is in synchronized mode or not. See wl_subsurface.set_sync and + wl_subsurface.set_desync for details. + + A new sub-surface is initially added as the top-most in the stack + of its siblings and parent. + + + + + + + The sub-surface is placed just below the reference surface. + See wl_subsurface.place_above. + + + + + + + Change the commit behaviour of the sub-surface to synchronized + mode, also described as the parent dependent mode. + + In synchronized mode, wl_surface.commit on a sub-surface will + accumulate the committed state in a cache, but the state will + not be applied and hence will not change the compositor output. + The cached state is applied to the sub-surface immediately after + the parent surface's state is applied. This ensures atomic + updates of the parent and all its synchronized sub-surfaces. + Applying the cached state will invalidate the cache, so further + parent surface commits do not (re-)apply old state. + + See wl_subsurface for the recursive effect of this mode. + + + + + + Change the commit behaviour of the sub-surface to desynchronized + mode, also described as independent or freely running mode. + + In desynchronized mode, wl_surface.commit on a sub-surface will + apply the pending state directly, without caching, as happens + normally with a wl_surface. Calling wl_surface.commit on the + parent surface has no effect on the sub-surface's wl_surface + state. This mode allows a sub-surface to be updated on its own. + + If cached state exists when wl_surface.commit is called in + desynchronized mode, the pending state is added to the cached + state, and applied as a whole. This invalidates the cache. + + Note: even if a sub-surface is set to desynchronized, a parent + sub-surface may override it to behave as synchronized. For details, + see wl_subsurface. + + If a surface's parent surface behaves as desynchronized, then + the cached state is applied on set_desync. + + + + + diff --git a/thirdparty/glfw/deps/wayland/xdg-activation-v1.xml b/thirdparty/glfw/deps/wayland/xdg-activation-v1.xml new file mode 100644 index 000000000..9adcc274e --- /dev/null +++ b/thirdparty/glfw/deps/wayland/xdg-activation-v1.xml @@ -0,0 +1,200 @@ + + + + + Copyright © 2020 Aleix Pol Gonzalez <aleixpol@kde.org> + Copyright © 2020 Carlos Garnacho <carlosg@gnome.org> + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice (including the next + paragraph) shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + + + + The way for a client to pass focus to another toplevel is as follows. + + The client that intends to activate another toplevel uses the + xdg_activation_v1.get_activation_token request to get an activation token. + This token is then forwarded to the client, which is supposed to activate + one of its surfaces, through a separate band of communication. + + One established way of doing this is through the XDG_ACTIVATION_TOKEN + environment variable of a newly launched child process. The child process + should unset the environment variable again right after reading it out in + order to avoid propagating it to other child processes. + + Another established way exists for Applications implementing the D-Bus + interface org.freedesktop.Application, which should get their token under + activation-token on their platform_data. + + In general activation tokens may be transferred across clients through + means not described in this protocol. + + The client to be activated will then pass the token + it received to the xdg_activation_v1.activate request. The compositor can + then use this token to decide how to react to the activation request. + + The token the activating client gets may be ineffective either already at + the time it receives it, for example if it was not focused, for focus + stealing prevention. The activating client will have no way to discover + the validity of the token, and may still forward it to the to be activated + client. + + The created activation token may optionally get information attached to it + that can be used by the compositor to identify the application that we + intend to activate. This can for example be used to display a visual hint + about what application is being started. + + Warning! The protocol described in this file is currently in the testing + phase. Backward compatible changes may be added together with the + corresponding interface version bump. Backward incompatible changes can + only be done by creating a new major version of the extension. + + + + + A global interface used for informing the compositor about applications + being activated or started, or for applications to request to be + activated. + + + + + Notify the compositor that the xdg_activation object will no longer be + used. + + The child objects created via this interface are unaffected and should + be destroyed separately. + + + + + + Creates an xdg_activation_token_v1 object that will provide + the initiating client with a unique token for this activation. This + token should be offered to the clients to be activated. + + + + + + + + Requests surface activation. It's up to the compositor to display + this information as desired, for example by placing the surface above + the rest. + + The compositor may know who requested this by checking the activation + token and might decide not to follow through with the activation if it's + considered unwanted. + + Compositors can ignore unknown activation tokens when an invalid + token is passed. + + + + + + + + + An object for setting up a token and receiving a token handle that can + be passed as an activation token to another client. + + The object is created using the xdg_activation_v1.get_activation_token + request. This object should then be populated with the app_id, surface + and serial information and committed. The compositor shall then issue a + done event with the token. In case the request's parameters are invalid, + the compositor will provide an invalid token. + + + + + + + + + Provides information about the seat and serial event that requested the + token. + + The serial can come from an input or focus event. For instance, if a + click triggers the launch of a third-party client, the launcher client + should send a set_serial request with the serial and seat from the + wl_pointer.button event. + + Some compositors might refuse to activate toplevels when the token + doesn't have a valid and recent enough event serial. + + Must be sent before commit. This information is optional. + + + + + + + + The requesting client can specify an app_id to associate the token + being created with it. + + Must be sent before commit. This information is optional. + + + + + + + This request sets the surface requesting the activation. Note, this is + different from the surface that will be activated. + + Some compositors might refuse to activate toplevels when the token + doesn't have a requesting surface. + + Must be sent before commit. This information is optional. + + + + + + + Requests an activation token based on the different parameters that + have been offered through set_serial, set_surface and set_app_id. + + + + + + The 'done' event contains the unique token of this activation request + and notifies that the provider is done. + + + + + + + Notify the compositor that the xdg_activation_token_v1 object will no + longer be used. The received token stays valid. + + + + diff --git a/thirdparty/glfw/deps/wayland/xdg-decoration-unstable-v1.xml b/thirdparty/glfw/deps/wayland/xdg-decoration-unstable-v1.xml new file mode 100644 index 000000000..e5967751d --- /dev/null +++ b/thirdparty/glfw/deps/wayland/xdg-decoration-unstable-v1.xml @@ -0,0 +1,156 @@ + + + + Copyright © 2018 Simon Ser + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice (including the next + paragraph) shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + + + + + This interface allows a compositor to announce support for server-side + decorations. + + A window decoration is a set of window controls as deemed appropriate by + the party managing them, such as user interface components used to move, + resize and change a window's state. + + A client can use this protocol to request being decorated by a supporting + compositor. + + If compositor and client do not negotiate the use of a server-side + decoration using this protocol, clients continue to self-decorate as they + see fit. + + Warning! The protocol described in this file is experimental and + backward incompatible changes may be made. Backward compatible changes + may be added together with the corresponding interface version bump. + Backward incompatible changes are done by bumping the version number in + the protocol and interface names and resetting the interface version. + Once the protocol is to be declared stable, the 'z' prefix and the + version number in the protocol and interface names are removed and the + interface version number is reset. + + + + + Destroy the decoration manager. This doesn't destroy objects created + with the manager. + + + + + + Create a new decoration object associated with the given toplevel. + + Creating an xdg_toplevel_decoration from an xdg_toplevel which has a + buffer attached or committed is a client error, and any attempts by a + client to attach or manipulate a buffer prior to the first + xdg_toplevel_decoration.configure event must also be treated as + errors. + + + + + + + + + The decoration object allows the compositor to toggle server-side window + decorations for a toplevel surface. The client can request to switch to + another mode. + + The xdg_toplevel_decoration object must be destroyed before its + xdg_toplevel. + + + + + + + + + + + Switch back to a mode without any server-side decorations at the next + commit. + + + + + + These values describe window decoration modes. + + + + + + + + Set the toplevel surface decoration mode. This informs the compositor + that the client prefers the provided decoration mode. + + After requesting a decoration mode, the compositor will respond by + emitting an xdg_surface.configure event. The client should then update + its content, drawing it without decorations if the received mode is + server-side decorations. The client must also acknowledge the configure + when committing the new content (see xdg_surface.ack_configure). + + The compositor can decide not to use the client's mode and enforce a + different mode instead. + + Clients whose decoration mode depend on the xdg_toplevel state may send + a set_mode request in response to an xdg_surface.configure event and wait + for the next xdg_surface.configure event to prevent unwanted state. + Such clients are responsible for preventing configure loops and must + make sure not to send multiple successive set_mode requests with the + same decoration mode. + + + + + + + Unset the toplevel surface decoration mode. This informs the compositor + that the client doesn't prefer a particular decoration mode. + + This request has the same semantics as set_mode. + + + + + + The configure event asks the client to change its decoration mode. The + configured state should not be applied immediately. Clients must send an + ack_configure in response to this event. See xdg_surface.configure and + xdg_surface.ack_configure for details. + + A configure event can be sent at any time. The specified mode must be + obeyed by the client. + + + + + diff --git a/thirdparty/glfw/deps/wayland/xdg-shell.xml b/thirdparty/glfw/deps/wayland/xdg-shell.xml new file mode 100644 index 000000000..777eaa749 --- /dev/null +++ b/thirdparty/glfw/deps/wayland/xdg-shell.xml @@ -0,0 +1,1370 @@ + + + + + Copyright © 2008-2013 Kristian Høgsberg + Copyright © 2013 Rafael Antognolli + Copyright © 2013 Jasper St. Pierre + Copyright © 2010-2013 Intel Corporation + Copyright © 2015-2017 Samsung Electronics Co., Ltd + Copyright © 2015-2017 Red Hat Inc. + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice (including the next + paragraph) shall be included in all copies or substantial portions of the + Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + + + + + The xdg_wm_base interface is exposed as a global object enabling clients + to turn their wl_surfaces into windows in a desktop environment. It + defines the basic functionality needed for clients and the compositor to + create windows that can be dragged, resized, maximized, etc, as well as + creating transient windows such as popup menus. + + + + + + + + + + + + + + + Destroy this xdg_wm_base object. + + Destroying a bound xdg_wm_base object while there are surfaces + still alive created by this xdg_wm_base object instance is illegal + and will result in a defunct_surfaces error. + + + + + + Create a positioner object. A positioner object is used to position + surfaces relative to some parent surface. See the interface description + and xdg_surface.get_popup for details. + + + + + + + This creates an xdg_surface for the given surface. While xdg_surface + itself is not a role, the corresponding surface may only be assigned + a role extending xdg_surface, such as xdg_toplevel or xdg_popup. It is + illegal to create an xdg_surface for a wl_surface which already has an + assigned role and this will result in a role error. + + This creates an xdg_surface for the given surface. An xdg_surface is + used as basis to define a role to a given surface, such as xdg_toplevel + or xdg_popup. It also manages functionality shared between xdg_surface + based surface roles. + + See the documentation of xdg_surface for more details about what an + xdg_surface is and how it is used. + + + + + + + + A client must respond to a ping event with a pong request or + the client may be deemed unresponsive. See xdg_wm_base.ping + and xdg_wm_base.error.unresponsive. + + + + + + + The ping event asks the client if it's still alive. Pass the + serial specified in the event back to the compositor by sending + a "pong" request back with the specified serial. See xdg_wm_base.pong. + + Compositors can use this to determine if the client is still + alive. It's unspecified what will happen if the client doesn't + respond to the ping request, or in what timeframe. Clients should + try to respond in a reasonable amount of time. The “unresponsive” + error is provided for compositors that wish to disconnect unresponsive + clients. + + A compositor is free to ping in any way it wants, but a client must + always respond to any xdg_wm_base object it created. + + + + + + + + The xdg_positioner provides a collection of rules for the placement of a + child surface relative to a parent surface. Rules can be defined to ensure + the child surface remains within the visible area's borders, and to + specify how the child surface changes its position, such as sliding along + an axis, or flipping around a rectangle. These positioner-created rules are + constrained by the requirement that a child surface must intersect with or + be at least partially adjacent to its parent surface. + + See the various requests for details about possible rules. + + At the time of the request, the compositor makes a copy of the rules + specified by the xdg_positioner. Thus, after the request is complete the + xdg_positioner object can be destroyed or reused; further changes to the + object will have no effect on previous usages. + + For an xdg_positioner object to be considered complete, it must have a + non-zero size set by set_size, and a non-zero anchor rectangle set by + set_anchor_rect. Passing an incomplete xdg_positioner object when + positioning a surface raises an invalid_positioner error. + + + + + + + + + Notify the compositor that the xdg_positioner will no longer be used. + + + + + + Set the size of the surface that is to be positioned with the positioner + object. The size is in surface-local coordinates and corresponds to the + window geometry. See xdg_surface.set_window_geometry. + + If a zero or negative size is set the invalid_input error is raised. + + + + + + + + Specify the anchor rectangle within the parent surface that the child + surface will be placed relative to. The rectangle is relative to the + window geometry as defined by xdg_surface.set_window_geometry of the + parent surface. + + When the xdg_positioner object is used to position a child surface, the + anchor rectangle may not extend outside the window geometry of the + positioned child's parent surface. + + If a negative size is set the invalid_input error is raised. + + + + + + + + + + + + + + + + + + + + + + Defines the anchor point for the anchor rectangle. The specified anchor + is used derive an anchor point that the child surface will be + positioned relative to. If a corner anchor is set (e.g. 'top_left' or + 'bottom_right'), the anchor point will be at the specified corner; + otherwise, the derived anchor point will be centered on the specified + edge, or in the center of the anchor rectangle if no edge is specified. + + + + + + + + + + + + + + + + + + + Defines in what direction a surface should be positioned, relative to + the anchor point of the parent surface. If a corner gravity is + specified (e.g. 'bottom_right' or 'top_left'), then the child surface + will be placed towards the specified gravity; otherwise, the child + surface will be centered over the anchor point on any axis that had no + gravity specified. If the gravity is not in the ‘gravity’ enum, an + invalid_input error is raised. + + + + + + + The constraint adjustment value define ways the compositor will adjust + the position of the surface, if the unadjusted position would result + in the surface being partly constrained. + + Whether a surface is considered 'constrained' is left to the compositor + to determine. For example, the surface may be partly outside the + compositor's defined 'work area', thus necessitating the child surface's + position be adjusted until it is entirely inside the work area. + + The adjustments can be combined, according to a defined precedence: 1) + Flip, 2) Slide, 3) Resize. + + + + Don't alter the surface position even if it is constrained on some + axis, for example partially outside the edge of an output. + + + + + Slide the surface along the x axis until it is no longer constrained. + + First try to slide towards the direction of the gravity on the x axis + until either the edge in the opposite direction of the gravity is + unconstrained or the edge in the direction of the gravity is + constrained. + + Then try to slide towards the opposite direction of the gravity on the + x axis until either the edge in the direction of the gravity is + unconstrained or the edge in the opposite direction of the gravity is + constrained. + + + + + Slide the surface along the y axis until it is no longer constrained. + + First try to slide towards the direction of the gravity on the y axis + until either the edge in the opposite direction of the gravity is + unconstrained or the edge in the direction of the gravity is + constrained. + + Then try to slide towards the opposite direction of the gravity on the + y axis until either the edge in the direction of the gravity is + unconstrained or the edge in the opposite direction of the gravity is + constrained. + + + + + Invert the anchor and gravity on the x axis if the surface is + constrained on the x axis. For example, if the left edge of the + surface is constrained, the gravity is 'left' and the anchor is + 'left', change the gravity to 'right' and the anchor to 'right'. + + If the adjusted position also ends up being constrained, the resulting + position of the flip_x adjustment will be the one before the + adjustment. + + + + + Invert the anchor and gravity on the y axis if the surface is + constrained on the y axis. For example, if the bottom edge of the + surface is constrained, the gravity is 'bottom' and the anchor is + 'bottom', change the gravity to 'top' and the anchor to 'top'. + + The adjusted position is calculated given the original anchor + rectangle and offset, but with the new flipped anchor and gravity + values. + + If the adjusted position also ends up being constrained, the resulting + position of the flip_y adjustment will be the one before the + adjustment. + + + + + Resize the surface horizontally so that it is completely + unconstrained. + + + + + Resize the surface vertically so that it is completely unconstrained. + + + + + + + Specify how the window should be positioned if the originally intended + position caused the surface to be constrained, meaning at least + partially outside positioning boundaries set by the compositor. The + adjustment is set by constructing a bitmask describing the adjustment to + be made when the surface is constrained on that axis. + + If no bit for one axis is set, the compositor will assume that the child + surface should not change its position on that axis when constrained. + + If more than one bit for one axis is set, the order of how adjustments + are applied is specified in the corresponding adjustment descriptions. + + The default adjustment is none. + + + + + + + Specify the surface position offset relative to the position of the + anchor on the anchor rectangle and the anchor on the surface. For + example if the anchor of the anchor rectangle is at (x, y), the surface + has the gravity bottom|right, and the offset is (ox, oy), the calculated + surface position will be (x + ox, y + oy). The offset position of the + surface is the one used for constraint testing. See + set_constraint_adjustment. + + An example use case is placing a popup menu on top of a user interface + element, while aligning the user interface element of the parent surface + with some user interface element placed somewhere in the popup surface. + + + + + + + + + + When set reactive, the surface is reconstrained if the conditions used + for constraining changed, e.g. the parent window moved. + + If the conditions changed and the popup was reconstrained, an + xdg_popup.configure event is sent with updated geometry, followed by an + xdg_surface.configure event. + + + + + + Set the parent window geometry the compositor should use when + positioning the popup. The compositor may use this information to + determine the future state the popup should be constrained using. If + this doesn't match the dimension of the parent the popup is eventually + positioned against, the behavior is undefined. + + The arguments are given in the surface-local coordinate space. + + + + + + + + Set the serial of an xdg_surface.configure event this positioner will be + used in response to. The compositor may use this information together + with set_parent_size to determine what future state the popup should be + constrained using. + + + + + + + + An interface that may be implemented by a wl_surface, for + implementations that provide a desktop-style user interface. + + It provides a base set of functionality required to construct user + interface elements requiring management by the compositor, such as + toplevel windows, menus, etc. The types of functionality are split into + xdg_surface roles. + + Creating an xdg_surface does not set the role for a wl_surface. In order + to map an xdg_surface, the client must create a role-specific object + using, e.g., get_toplevel, get_popup. The wl_surface for any given + xdg_surface can have at most one role, and may not be assigned any role + not based on xdg_surface. + + A role must be assigned before any other requests are made to the + xdg_surface object. + + The client must call wl_surface.commit on the corresponding wl_surface + for the xdg_surface state to take effect. + + Creating an xdg_surface from a wl_surface which has a buffer attached or + committed is a client error, and any attempts by a client to attach or + manipulate a buffer prior to the first xdg_surface.configure call must + also be treated as errors. + + After creating a role-specific object and setting it up, the client must + perform an initial commit without any buffer attached. The compositor + will reply with initial wl_surface state such as + wl_surface.preferred_buffer_scale followed by an xdg_surface.configure + event. The client must acknowledge it and is then allowed to attach a + buffer to map the surface. + + Mapping an xdg_surface-based role surface is defined as making it + possible for the surface to be shown by the compositor. Note that + a mapped surface is not guaranteed to be visible once it is mapped. + + For an xdg_surface to be mapped by the compositor, the following + conditions must be met: + (1) the client has assigned an xdg_surface-based role to the surface + (2) the client has set and committed the xdg_surface state and the + role-dependent state to the surface + (3) the client has committed a buffer to the surface + + A newly-unmapped surface is considered to have met condition (1) out + of the 3 required conditions for mapping a surface if its role surface + has not been destroyed, i.e. the client must perform the initial commit + again before attaching a buffer. + + + + + + + + + + + + + + Destroy the xdg_surface object. An xdg_surface must only be destroyed + after its role object has been destroyed, otherwise + a defunct_role_object error is raised. + + + + + + This creates an xdg_toplevel object for the given xdg_surface and gives + the associated wl_surface the xdg_toplevel role. + + See the documentation of xdg_toplevel for more details about what an + xdg_toplevel is and how it is used. + + + + + + + This creates an xdg_popup object for the given xdg_surface and gives + the associated wl_surface the xdg_popup role. + + If null is passed as a parent, a parent surface must be specified using + some other protocol, before committing the initial state. + + See the documentation of xdg_popup for more details about what an + xdg_popup is and how it is used. + + + + + + + + + The window geometry of a surface is its "visible bounds" from the + user's perspective. Client-side decorations often have invisible + portions like drop-shadows which should be ignored for the + purposes of aligning, placing and constraining windows. + + The window geometry is double buffered, and will be applied at the + time wl_surface.commit of the corresponding wl_surface is called. + + When maintaining a position, the compositor should treat the (x, y) + coordinate of the window geometry as the top left corner of the window. + A client changing the (x, y) window geometry coordinate should in + general not alter the position of the window. + + Once the window geometry of the surface is set, it is not possible to + unset it, and it will remain the same until set_window_geometry is + called again, even if a new subsurface or buffer is attached. + + If never set, the value is the full bounds of the surface, + including any subsurfaces. This updates dynamically on every + commit. This unset is meant for extremely simple clients. + + The arguments are given in the surface-local coordinate space of + the wl_surface associated with this xdg_surface, and may extend outside + of the wl_surface itself to mark parts of the subsurface tree as part of + the window geometry. + + When applied, the effective window geometry will be the set window + geometry clamped to the bounding rectangle of the combined + geometry of the surface of the xdg_surface and the associated + subsurfaces. + + The effective geometry will not be recalculated unless a new call to + set_window_geometry is done and the new pending surface state is + subsequently applied. + + The width and height of the effective window geometry must be + greater than zero. Setting an invalid size will raise an + invalid_size error. + + + + + + + + + + When a configure event is received, if a client commits the + surface in response to the configure event, then the client + must make an ack_configure request sometime before the commit + request, passing along the serial of the configure event. + + For instance, for toplevel surfaces the compositor might use this + information to move a surface to the top left only when the client has + drawn itself for the maximized or fullscreen state. + + If the client receives multiple configure events before it + can respond to one, it only has to ack the last configure event. + Acking a configure event that was never sent raises an invalid_serial + error. + + A client is not required to commit immediately after sending + an ack_configure request - it may even ack_configure several times + before its next surface commit. + + A client may send multiple ack_configure requests before committing, but + only the last request sent before a commit indicates which configure + event the client really is responding to. + + Sending an ack_configure request consumes the serial number sent with + the request, as well as serial numbers sent by all configure events + sent on this xdg_surface prior to the configure event referenced by + the committed serial. + + It is an error to issue multiple ack_configure requests referencing a + serial from the same configure event, or to issue an ack_configure + request referencing a serial from a configure event issued before the + event identified by the last ack_configure request for the same + xdg_surface. Doing so will raise an invalid_serial error. + + + + + + + The configure event marks the end of a configure sequence. A configure + sequence is a set of one or more events configuring the state of the + xdg_surface, including the final xdg_surface.configure event. + + Where applicable, xdg_surface surface roles will during a configure + sequence extend this event as a latched state sent as events before the + xdg_surface.configure event. Such events should be considered to make up + a set of atomically applied configuration states, where the + xdg_surface.configure commits the accumulated state. + + Clients should arrange their surface for the new states, and then send + an ack_configure request with the serial sent in this configure event at + some point before committing the new surface. + + If the client receives multiple configure events before it can respond + to one, it is free to discard all but the last event it received. + + + + + + + + + This interface defines an xdg_surface role which allows a surface to, + among other things, set window-like properties such as maximize, + fullscreen, and minimize, set application-specific metadata like title and + id, and well as trigger user interactive operations such as interactive + resize and move. + + Unmapping an xdg_toplevel means that the surface cannot be shown + by the compositor until it is explicitly mapped again. + All active operations (e.g., move, resize) are canceled and all + attributes (e.g. title, state, stacking, ...) are discarded for + an xdg_toplevel surface when it is unmapped. The xdg_toplevel returns to + the state it had right after xdg_surface.get_toplevel. The client + can re-map the toplevel by perfoming a commit without any buffer + attached, waiting for a configure event and handling it as usual (see + xdg_surface description). + + Attaching a null buffer to a toplevel unmaps the surface. + + + + + This request destroys the role surface and unmaps the surface; + see "Unmapping" behavior in interface section for details. + + + + + + + + + + + + Set the "parent" of this surface. This surface should be stacked + above the parent surface and all other ancestor surfaces. + + Parent surfaces should be set on dialogs, toolboxes, or other + "auxiliary" surfaces, so that the parent is raised when the dialog + is raised. + + Setting a null parent for a child surface unsets its parent. Setting + a null parent for a surface which currently has no parent is a no-op. + + Only mapped surfaces can have child surfaces. Setting a parent which + is not mapped is equivalent to setting a null parent. If a surface + becomes unmapped, its children's parent is set to the parent of + the now-unmapped surface. If the now-unmapped surface has no parent, + its children's parent is unset. If the now-unmapped surface becomes + mapped again, its parent-child relationship is not restored. + + The parent toplevel must not be one of the child toplevel's + descendants, and the parent must be different from the child toplevel, + otherwise the invalid_parent protocol error is raised. + + + + + + + Set a short title for the surface. + + This string may be used to identify the surface in a task bar, + window list, or other user interface elements provided by the + compositor. + + The string must be encoded in UTF-8. + + + + + + + Set an application identifier for the surface. + + The app ID identifies the general class of applications to which + the surface belongs. The compositor can use this to group multiple + surfaces together, or to determine how to launch a new application. + + For D-Bus activatable applications, the app ID is used as the D-Bus + service name. + + The compositor shell will try to group application surfaces together + by their app ID. As a best practice, it is suggested to select app + ID's that match the basename of the application's .desktop file. + For example, "org.freedesktop.FooViewer" where the .desktop file is + "org.freedesktop.FooViewer.desktop". + + Like other properties, a set_app_id request can be sent after the + xdg_toplevel has been mapped to update the property. + + See the desktop-entry specification [0] for more details on + application identifiers and how they relate to well-known D-Bus + names and .desktop files. + + [0] https://standards.freedesktop.org/desktop-entry-spec/ + + + + + + + Clients implementing client-side decorations might want to show + a context menu when right-clicking on the decorations, giving the + user a menu that they can use to maximize or minimize the window. + + This request asks the compositor to pop up such a window menu at + the given position, relative to the local surface coordinates of + the parent surface. There are no guarantees as to what menu items + the window menu contains, or even if a window menu will be drawn + at all. + + This request must be used in response to some sort of user action + like a button press, key press, or touch down event. + + + + + + + + + + Start an interactive, user-driven move of the surface. + + This request must be used in response to some sort of user action + like a button press, key press, or touch down event. The passed + serial is used to determine the type of interactive move (touch, + pointer, etc). + + The server may ignore move requests depending on the state of + the surface (e.g. fullscreen or maximized), or if the passed serial + is no longer valid. + + If triggered, the surface will lose the focus of the device + (wl_pointer, wl_touch, etc) used for the move. It is up to the + compositor to visually indicate that the move is taking place, such as + updating a pointer cursor, during the move. There is no guarantee + that the device focus will return when the move is completed. + + + + + + + + These values are used to indicate which edge of a surface + is being dragged in a resize operation. + + + + + + + + + + + + + + + Start a user-driven, interactive resize of the surface. + + This request must be used in response to some sort of user action + like a button press, key press, or touch down event. The passed + serial is used to determine the type of interactive resize (touch, + pointer, etc). + + The server may ignore resize requests depending on the state of + the surface (e.g. fullscreen or maximized). + + If triggered, the client will receive configure events with the + "resize" state enum value and the expected sizes. See the "resize" + enum value for more details about what is required. The client + must also acknowledge configure events using "ack_configure". After + the resize is completed, the client will receive another "configure" + event without the resize state. + + If triggered, the surface also will lose the focus of the device + (wl_pointer, wl_touch, etc) used for the resize. It is up to the + compositor to visually indicate that the resize is taking place, + such as updating a pointer cursor, during the resize. There is no + guarantee that the device focus will return when the resize is + completed. + + The edges parameter specifies how the surface should be resized, and + is one of the values of the resize_edge enum. Values not matching + a variant of the enum will cause the invalid_resize_edge protocol error. + The compositor may use this information to update the surface position + for example when dragging the top left corner. The compositor may also + use this information to adapt its behavior, e.g. choose an appropriate + cursor image. + + + + + + + + + The different state values used on the surface. This is designed for + state values like maximized, fullscreen. It is paired with the + configure event to ensure that both the client and the compositor + setting the state can be synchronized. + + States set in this way are double-buffered. They will get applied on + the next commit. + + + + The surface is maximized. The window geometry specified in the configure + event must be obeyed by the client, or the xdg_wm_base.invalid_surface_state + error is raised. + + The client should draw without shadow or other + decoration outside of the window geometry. + + + + + The surface is fullscreen. The window geometry specified in the + configure event is a maximum; the client cannot resize beyond it. For + a surface to cover the whole fullscreened area, the geometry + dimensions must be obeyed by the client. For more details, see + xdg_toplevel.set_fullscreen. + + + + + The surface is being resized. The window geometry specified in the + configure event is a maximum; the client cannot resize beyond it. + Clients that have aspect ratio or cell sizing configuration can use + a smaller size, however. + + + + + Client window decorations should be painted as if the window is + active. Do not assume this means that the window actually has + keyboard or pointer focus. + + + + + The window is currently in a tiled layout and the left edge is + considered to be adjacent to another part of the tiling grid. + + + + + The window is currently in a tiled layout and the right edge is + considered to be adjacent to another part of the tiling grid. + + + + + The window is currently in a tiled layout and the top edge is + considered to be adjacent to another part of the tiling grid. + + + + + The window is currently in a tiled layout and the bottom edge is + considered to be adjacent to another part of the tiling grid. + + + + + The surface is currently not ordinarily being repainted; for + example because its content is occluded by another window, or its + outputs are switched off due to screen locking. + + + + + + + Set a maximum size for the window. + + The client can specify a maximum size so that the compositor does + not try to configure the window beyond this size. + + The width and height arguments are in window geometry coordinates. + See xdg_surface.set_window_geometry. + + Values set in this way are double-buffered. They will get applied + on the next commit. + + The compositor can use this information to allow or disallow + different states like maximize or fullscreen and draw accurate + animations. + + Similarly, a tiling window manager may use this information to + place and resize client windows in a more effective way. + + The client should not rely on the compositor to obey the maximum + size. The compositor may decide to ignore the values set by the + client and request a larger size. + + If never set, or a value of zero in the request, means that the + client has no expected maximum size in the given dimension. + As a result, a client wishing to reset the maximum size + to an unspecified state can use zero for width and height in the + request. + + Requesting a maximum size to be smaller than the minimum size of + a surface is illegal and will result in an invalid_size error. + + The width and height must be greater than or equal to zero. Using + strictly negative values for width or height will result in a + invalid_size error. + + + + + + + + Set a minimum size for the window. + + The client can specify a minimum size so that the compositor does + not try to configure the window below this size. + + The width and height arguments are in window geometry coordinates. + See xdg_surface.set_window_geometry. + + Values set in this way are double-buffered. They will get applied + on the next commit. + + The compositor can use this information to allow or disallow + different states like maximize or fullscreen and draw accurate + animations. + + Similarly, a tiling window manager may use this information to + place and resize client windows in a more effective way. + + The client should not rely on the compositor to obey the minimum + size. The compositor may decide to ignore the values set by the + client and request a smaller size. + + If never set, or a value of zero in the request, means that the + client has no expected minimum size in the given dimension. + As a result, a client wishing to reset the minimum size + to an unspecified state can use zero for width and height in the + request. + + Requesting a minimum size to be larger than the maximum size of + a surface is illegal and will result in an invalid_size error. + + The width and height must be greater than or equal to zero. Using + strictly negative values for width and height will result in a + invalid_size error. + + + + + + + + Maximize the surface. + + After requesting that the surface should be maximized, the compositor + will respond by emitting a configure event. Whether this configure + actually sets the window maximized is subject to compositor policies. + The client must then update its content, drawing in the configured + state. The client must also acknowledge the configure when committing + the new content (see ack_configure). + + It is up to the compositor to decide how and where to maximize the + surface, for example which output and what region of the screen should + be used. + + If the surface was already maximized, the compositor will still emit + a configure event with the "maximized" state. + + If the surface is in a fullscreen state, this request has no direct + effect. It may alter the state the surface is returned to when + unmaximized unless overridden by the compositor. + + + + + + Unmaximize the surface. + + After requesting that the surface should be unmaximized, the compositor + will respond by emitting a configure event. Whether this actually + un-maximizes the window is subject to compositor policies. + If available and applicable, the compositor will include the window + geometry dimensions the window had prior to being maximized in the + configure event. The client must then update its content, drawing it in + the configured state. The client must also acknowledge the configure + when committing the new content (see ack_configure). + + It is up to the compositor to position the surface after it was + unmaximized; usually the position the surface had before maximizing, if + applicable. + + If the surface was already not maximized, the compositor will still + emit a configure event without the "maximized" state. + + If the surface is in a fullscreen state, this request has no direct + effect. It may alter the state the surface is returned to when + unmaximized unless overridden by the compositor. + + + + + + Make the surface fullscreen. + + After requesting that the surface should be fullscreened, the + compositor will respond by emitting a configure event. Whether the + client is actually put into a fullscreen state is subject to compositor + policies. The client must also acknowledge the configure when + committing the new content (see ack_configure). + + The output passed by the request indicates the client's preference as + to which display it should be set fullscreen on. If this value is NULL, + it's up to the compositor to choose which display will be used to map + this surface. + + If the surface doesn't cover the whole output, the compositor will + position the surface in the center of the output and compensate with + with border fill covering the rest of the output. The content of the + border fill is undefined, but should be assumed to be in some way that + attempts to blend into the surrounding area (e.g. solid black). + + If the fullscreened surface is not opaque, the compositor must make + sure that other screen content not part of the same surface tree (made + up of subsurfaces, popups or similarly coupled surfaces) are not + visible below the fullscreened surface. + + + + + + + Make the surface no longer fullscreen. + + After requesting that the surface should be unfullscreened, the + compositor will respond by emitting a configure event. + Whether this actually removes the fullscreen state of the client is + subject to compositor policies. + + Making a surface unfullscreen sets states for the surface based on the following: + * the state(s) it may have had before becoming fullscreen + * any state(s) decided by the compositor + * any state(s) requested by the client while the surface was fullscreen + + The compositor may include the previous window geometry dimensions in + the configure event, if applicable. + + The client must also acknowledge the configure when committing the new + content (see ack_configure). + + + + + + Request that the compositor minimize your surface. There is no + way to know if the surface is currently minimized, nor is there + any way to unset minimization on this surface. + + If you are looking to throttle redrawing when minimized, please + instead use the wl_surface.frame event for this, as this will + also work with live previews on windows in Alt-Tab, Expose or + similar compositor features. + + + + + + This configure event asks the client to resize its toplevel surface or + to change its state. The configured state should not be applied + immediately. See xdg_surface.configure for details. + + The width and height arguments specify a hint to the window + about how its surface should be resized in window geometry + coordinates. See set_window_geometry. + + If the width or height arguments are zero, it means the client + should decide its own window dimension. This may happen when the + compositor needs to configure the state of the surface but doesn't + have any information about any previous or expected dimension. + + The states listed in the event specify how the width/height + arguments should be interpreted, and possibly how it should be + drawn. + + Clients must send an ack_configure in response to this event. See + xdg_surface.configure and xdg_surface.ack_configure for details. + + + + + + + + + The close event is sent by the compositor when the user + wants the surface to be closed. This should be equivalent to + the user clicking the close button in client-side decorations, + if your application has any. + + This is only a request that the user intends to close the + window. The client may choose to ignore this request, or show + a dialog to ask the user to save their data, etc. + + + + + + + + The configure_bounds event may be sent prior to a xdg_toplevel.configure + event to communicate the bounds a window geometry size is recommended + to constrain to. + + The passed width and height are in surface coordinate space. If width + and height are 0, it means bounds is unknown and equivalent to as if no + configure_bounds event was ever sent for this surface. + + The bounds can for example correspond to the size of a monitor excluding + any panels or other shell components, so that a surface isn't created in + a way that it cannot fit. + + The bounds may change at any point, and in such a case, a new + xdg_toplevel.configure_bounds will be sent, followed by + xdg_toplevel.configure and xdg_surface.configure. + + + + + + + + + + + + + + + + + This event advertises the capabilities supported by the compositor. If + a capability isn't supported, clients should hide or disable the UI + elements that expose this functionality. For instance, if the + compositor doesn't advertise support for minimized toplevels, a button + triggering the set_minimized request should not be displayed. + + The compositor will ignore requests it doesn't support. For instance, + a compositor which doesn't advertise support for minimized will ignore + set_minimized requests. + + Compositors must send this event once before the first + xdg_surface.configure event. When the capabilities change, compositors + must send this event again and then send an xdg_surface.configure + event. + + The configured state should not be applied immediately. See + xdg_surface.configure for details. + + The capabilities are sent as an array of 32-bit unsigned integers in + native endianness. + + + + + + + + A popup surface is a short-lived, temporary surface. It can be used to + implement for example menus, popovers, tooltips and other similar user + interface concepts. + + A popup can be made to take an explicit grab. See xdg_popup.grab for + details. + + When the popup is dismissed, a popup_done event will be sent out, and at + the same time the surface will be unmapped. See the xdg_popup.popup_done + event for details. + + Explicitly destroying the xdg_popup object will also dismiss the popup and + unmap the surface. Clients that want to dismiss the popup when another + surface of their own is clicked should dismiss the popup using the destroy + request. + + A newly created xdg_popup will be stacked on top of all previously created + xdg_popup surfaces associated with the same xdg_toplevel. + + The parent of an xdg_popup must be mapped (see the xdg_surface + description) before the xdg_popup itself. + + The client must call wl_surface.commit on the corresponding wl_surface + for the xdg_popup state to take effect. + + + + + + + + + This destroys the popup. Explicitly destroying the xdg_popup + object will also dismiss the popup, and unmap the surface. + + If this xdg_popup is not the "topmost" popup, the + xdg_wm_base.not_the_topmost_popup protocol error will be sent. + + + + + + This request makes the created popup take an explicit grab. An explicit + grab will be dismissed when the user dismisses the popup, or when the + client destroys the xdg_popup. This can be done by the user clicking + outside the surface, using the keyboard, or even locking the screen + through closing the lid or a timeout. + + If the compositor denies the grab, the popup will be immediately + dismissed. + + This request must be used in response to some sort of user action like a + button press, key press, or touch down event. The serial number of the + event should be passed as 'serial'. + + The parent of a grabbing popup must either be an xdg_toplevel surface or + another xdg_popup with an explicit grab. If the parent is another + xdg_popup it means that the popups are nested, with this popup now being + the topmost popup. + + Nested popups must be destroyed in the reverse order they were created + in, e.g. the only popup you are allowed to destroy at all times is the + topmost one. + + When compositors choose to dismiss a popup, they may dismiss every + nested grabbing popup as well. When a compositor dismisses popups, it + will follow the same dismissing order as required from the client. + + If the topmost grabbing popup is destroyed, the grab will be returned to + the parent of the popup, if that parent previously had an explicit grab. + + If the parent is a grabbing popup which has already been dismissed, this + popup will be immediately dismissed. If the parent is a popup that did + not take an explicit grab, an error will be raised. + + During a popup grab, the client owning the grab will receive pointer + and touch events for all their surfaces as normal (similar to an + "owner-events" grab in X11 parlance), while the top most grabbing popup + will always have keyboard focus. + + + + + + + + This event asks the popup surface to configure itself given the + configuration. The configured state should not be applied immediately. + See xdg_surface.configure for details. + + The x and y arguments represent the position the popup was placed at + given the xdg_positioner rule, relative to the upper left corner of the + window geometry of the parent surface. + + For version 2 or older, the configure event for an xdg_popup is only + ever sent once for the initial configuration. Starting with version 3, + it may be sent again if the popup is setup with an xdg_positioner with + set_reactive requested, or in response to xdg_popup.reposition requests. + + + + + + + + + + The popup_done event is sent out when a popup is dismissed by the + compositor. The client should destroy the xdg_popup object at this + point. + + + + + + + + Reposition an already-mapped popup. The popup will be placed given the + details in the passed xdg_positioner object, and a + xdg_popup.repositioned followed by xdg_popup.configure and + xdg_surface.configure will be emitted in response. Any parameters set + by the previous positioner will be discarded. + + The passed token will be sent in the corresponding + xdg_popup.repositioned event. The new popup position will not take + effect until the corresponding configure event is acknowledged by the + client. See xdg_popup.repositioned for details. The token itself is + opaque, and has no other special meaning. + + If multiple reposition requests are sent, the compositor may skip all + but the last one. + + If the popup is repositioned in response to a configure event for its + parent, the client should send an xdg_positioner.set_parent_configure + and possibly an xdg_positioner.set_parent_size request to allow the + compositor to properly constrain the popup. + + If the popup is repositioned together with a parent that is being + resized, but not in response to a configure event, the client should + send an xdg_positioner.set_parent_size request. + + + + + + + + The repositioned event is sent as part of a popup configuration + sequence, together with xdg_popup.configure and lastly + xdg_surface.configure to notify the completion of a reposition request. + + The repositioned event is to notify about the completion of a + xdg_popup.reposition request. The token argument is the token passed + in the xdg_popup.reposition request. + + Immediately after this event is emitted, xdg_popup.configure and + xdg_surface.configure will be sent with the updated size and position, + as well as a new configure serial. + + The client should optionally update the content of the popup, but must + acknowledge the new popup configuration for the new position to take + effect. See xdg_surface.ack_configure for details. + + + + + + diff --git a/thirdparty/glfw/docs/CMakeLists.txt b/thirdparty/glfw/docs/CMakeLists.txt index 2347858ec..50522173a 100644 --- a/thirdparty/glfw/docs/CMakeLists.txt +++ b/thirdparty/glfw/docs/CMakeLists.txt @@ -1,34 +1,57 @@ # NOTE: The order of this list determines the order of items in the Guides # (i.e. Pages) list in the generated documentation -set(GLFW_DOXYGEN_SOURCES - "include/GLFW/glfw3.h" - "include/GLFW/glfw3native.h" - "docs/main.dox" - "docs/news.dox" - "docs/quick.dox" - "docs/moving.dox" - "docs/compile.dox" - "docs/build.dox" - "docs/intro.dox" - "docs/context.dox" - "docs/monitor.dox" - "docs/window.dox" - "docs/input.dox" - "docs/vulkan.dox" - "docs/compat.dox" - "docs/internal.dox") +set(source_files + main.md + news.md + quick.md + moving.md + compile.md + build.md + intro.md + context.md + monitor.md + window.md + input.md + vulkan.md + compat.md + internal.md) + +set(extra_files DoxygenLayout.xml header.html footer.html extra.css spaces.svg) + +set(header_paths + "${GLFW_SOURCE_DIR}/include/GLFW/glfw3.h" + "${GLFW_SOURCE_DIR}/include/GLFW/glfw3native.h") # Format the source list into a Doxyfile INPUT value that Doxygen can parse -foreach(path IN LISTS GLFW_DOXYGEN_SOURCES) - set(GLFW_DOXYGEN_INPUT "${GLFW_DOXYGEN_INPUT} \\\n\"${GLFW_SOURCE_DIR}/${path}\"") +foreach(path IN LISTS header_paths) + string(APPEND GLFW_DOXYGEN_INPUT " \\\n\"${path}\"") endforeach() +foreach(file IN LISTS source_files) + string(APPEND GLFW_DOXYGEN_INPUT " \\\n\"${CMAKE_CURRENT_SOURCE_DIR}/${file}\"") +endforeach() + +set(DOXYGEN_SKIP_DOT TRUE) +find_package(Doxygen) -configure_file(Doxyfile.in Doxyfile @ONLY) +if (NOT DOXYGEN_FOUND OR DOXYGEN_VERSION VERSION_LESS "1.9.8") + message(STATUS "Documentation generation requires Doxygen 1.9.8 or later") +else() + configure_file(Doxyfile.in Doxyfile @ONLY) + add_custom_command(OUTPUT "html/index.html" + COMMAND "${DOXYGEN_EXECUTABLE}" + WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" + MAIN_DEPENDENCY Doxyfile + DEPENDS ${header_paths} ${source_files} ${extra_files} + COMMENT "Generating HTML documentation" + VERBATIM) -add_custom_target(docs ALL "${DOXYGEN_EXECUTABLE}" - WORKING_DIRECTORY "${GLFW_BINARY_DIR}/docs" - COMMENT "Generating HTML documentation" VERBATIM) + add_custom_target(docs ALL SOURCES "html/index.html") + set_target_properties(docs PROPERTIES FOLDER "GLFW3") -set_target_properties(docs PROPERTIES FOLDER "GLFW3") + if (GLFW_INSTALL) + install(DIRECTORY "${GLFW_BINARY_DIR}/docs/html" + DESTINATION "${CMAKE_INSTALL_DOCDIR}") + endif() +endif() diff --git a/thirdparty/glfw/docs/CONTRIBUTING.md b/thirdparty/glfw/docs/CONTRIBUTING.md index 050c1bedc..73ba01e38 100644 --- a/thirdparty/glfw/docs/CONTRIBUTING.md +++ b/thirdparty/glfw/docs/CONTRIBUTING.md @@ -23,13 +23,12 @@ Questions about how to use GLFW should be asked either in the [support section](https://discourse.glfw.org/c/support) of the forum, under the [Stack Overflow tag](https://stackoverflow.com/questions/tagged/glfw) or [Game Development tag](https://gamedev.stackexchange.com/questions/tagged/glfw) on -Stack Exchange or in the IRC channel `#glfw` on -[Libera.Chat](https://libera.chat/). +Stack Exchange. Questions about the design or implementation of GLFW or about future plans should be asked in the [dev section](https://discourse.glfw.org/c/dev) of the -forum or in the IRC channel. Please don't open a GitHub issue to discuss design -questions without first checking with a maintainer. +forum. Please don't open a GitHub issue to discuss design questions without +first checking with a maintainer. ## Reporting a bug @@ -327,7 +326,7 @@ a thousand line one, if that is the appropriate size for the fix. In addition to the code, a complete bug fix includes: - Change log entry in `README.md`, describing the incorrect behavior -- Credits entries for all authors of the bug fix +- Credits entries in `CONTRIBUTORS.md` for all authors of the bug fix Bug fixes will not be rejected because they don't include all the above parts, but please keep in mind that maintainer time is finite and that there are many @@ -358,11 +357,11 @@ feature. In addition to the code, a complete feature includes: - Change log entry in `README.md`, listing all new symbols -- News page entry, briefly describing the feature -- Guide documentation, with minimal examples, in the relevant guide +- News page entry in `docs/news.md`, briefly describing the feature +- Guide documentation, with minimal examples, in the relevant guide in the `docs` folder - Reference documentation, with all applicable tags - Cross-references and mentions in appropriate places -- Credits entries for all authors of the feature +- Credits entries in `CONTRIBUTORS.md` for all authors of the feature If the feature requires platform-specific code, at minimum stubs must be added for the new platform function to all supported and experimental platforms. @@ -374,7 +373,7 @@ If it adds a new monitor property, support for it must be added to If it adds a new OpenGL, OpenGL ES or Vulkan option or extension, support for it must be added to `tests/glfwinfo.c` and the behavior of the library when -the extension is missing documented in `docs/compat.dox`. +the extension is missing documented in `docs/compat.md`. If you haven't already, read the excellent article [How to Write a Git Commit Message](https://chris.beams.io/posts/git-commit/). diff --git a/thirdparty/glfw/docs/Doxyfile.in b/thirdparty/glfw/docs/Doxyfile.in index 482b02854..067619c7d 100644 --- a/thirdparty/glfw/docs/Doxyfile.in +++ b/thirdparty/glfw/docs/Doxyfile.in @@ -1,110 +1,151 @@ -# Doxyfile 1.8.3.1 +# Doxyfile 1.9.7 # This file describes the settings to be used by the documentation system # doxygen (www.doxygen.org) for a project. # -# All text after a hash (#) is considered a comment and will be ignored. +# All text after a double hash (##) is considered a comment and is placed in +# front of the TAG it is preceding. +# +# All text after a single hash (#) is considered a comment and will be ignored. # The format is: -# TAG = value [value, ...] -# For lists items can also be appended using: -# TAG += value [value, ...] -# Values that contain spaces should be placed between quotes (" "). +# TAG = value [value, ...] +# For lists, items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (\" \"). +# +# Note: +# +# Use doxygen to compare the used configuration file with the template +# configuration file: +# doxygen -x [configFile] +# Use doxygen to compare the used configuration file with the template +# configuration file without replacing the environment variables or CMake type +# replacement variables: +# doxygen -x_noenv [configFile] #--------------------------------------------------------------------------- # Project related configuration options #--------------------------------------------------------------------------- -# This tag specifies the encoding used for all characters in the config file -# that follow. The default is UTF-8 which is also the encoding used for all +# This tag specifies the encoding used for all characters in the configuration +# file that follow. The default is UTF-8 which is also the encoding used for all # text before the first occurrence of this tag. Doxygen uses libiconv (or the # iconv built into libc) for the transcoding. See -# http://www.gnu.org/software/libiconv for the list of possible encodings. +# https://www.gnu.org/software/libiconv/ for the list of possible encodings. +# The default value is: UTF-8. DOXYFILE_ENCODING = UTF-8 -# The PROJECT_NAME tag is a single word (or sequence of words) that should -# identify the project. Note that if you do not use Doxywizard you need -# to put quotes around the project name if it contains spaces. +# The PROJECT_NAME tag is a single word (or a sequence of words surrounded by +# double-quotes, unless you are using Doxywizard) that should identify the +# project for which the documentation is generated. This name is used in the +# title of most generated pages and in a few other places. +# The default value is: My Project. PROJECT_NAME = "GLFW" -# The PROJECT_NUMBER tag can be used to enter a project or revision number. -# This could be handy for archiving the generated documentation or -# if some version control system is used. +# The PROJECT_NUMBER tag can be used to enter a project or revision number. This +# could be handy for archiving the generated documentation or if some version +# control system is used. PROJECT_NUMBER = @GLFW_VERSION@ # Using the PROJECT_BRIEF tag one can provide an optional one line description -# for a project that appears at the top of each page and should give viewer -# a quick idea about the purpose of the project. Keep the description short. +# for a project that appears at the top of each page and should give viewer a +# quick idea about the purpose of the project. Keep the description short. PROJECT_BRIEF = "A multi-platform library for OpenGL, window and input" -# With the PROJECT_LOGO tag one can specify an logo or icon that is -# included in the documentation. The maximum height of the logo should not -# exceed 55 pixels and the maximum width should not exceed 200 pixels. -# Doxygen will copy the logo to the output directory. +# With the PROJECT_LOGO tag one can specify a logo or an icon that is included +# in the documentation. The maximum height of the logo should not exceed 55 +# pixels and the maximum width should not exceed 200 pixels. Doxygen will copy +# the logo to the output directory. PROJECT_LOGO = -# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) -# base path where the generated documentation will be put. -# If a relative path is entered, it will be relative to the location -# where doxygen was started. If left blank the current directory will be used. +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path +# into which the generated documentation will be written. If a relative path is +# entered, it will be relative to the location where doxygen was started. If +# left blank the current directory will be used. OUTPUT_DIRECTORY = "@GLFW_BINARY_DIR@/docs" -# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create -# 4096 sub-directories (in 2 levels) under the output directory of each output -# format and will distribute the generated files over these directories. -# Enabling this option can be useful when feeding doxygen a huge amount of -# source files, where putting all generated files in the same directory would -# otherwise cause performance problems for the file system. +# If the CREATE_SUBDIRS tag is set to YES then doxygen will create up to 4096 +# sub-directories (in 2 levels) under the output directory of each output format +# and will distribute the generated files over these directories. Enabling this +# option can be useful when feeding doxygen a huge amount of source files, where +# putting all generated files in the same directory would otherwise causes +# performance problems for the file system. Adapt CREATE_SUBDIRS_LEVEL to +# control the number of sub-directories. +# The default value is: NO. CREATE_SUBDIRS = NO +# Controls the number of sub-directories that will be created when +# CREATE_SUBDIRS tag is set to YES. Level 0 represents 16 directories, and every +# level increment doubles the number of directories, resulting in 4096 +# directories at level 8 which is the default and also the maximum value. The +# sub-directories are organized in 2 levels, the first level always has a fixed +# number of 16 directories. +# Minimum value: 0, maximum value: 8, default value: 8. +# This tag requires that the tag CREATE_SUBDIRS is set to YES. + +CREATE_SUBDIRS_LEVEL = 8 + +# If the ALLOW_UNICODE_NAMES tag is set to YES, doxygen will allow non-ASCII +# characters to appear in the names of generated files. If set to NO, non-ASCII +# characters will be escaped, for example _xE3_x81_x84 will be used for Unicode +# U+3044. +# The default value is: NO. + +ALLOW_UNICODE_NAMES = NO + # The OUTPUT_LANGUAGE tag is used to specify the language in which all # documentation generated by doxygen is written. Doxygen will use this # information to generate all constant output in the proper language. -# The default language is English, other supported languages are: -# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, -# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German, -# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English -# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, -# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrillic, Slovak, -# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese. +# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Bulgarian, +# Catalan, Chinese, Chinese-Traditional, Croatian, Czech, Danish, Dutch, English +# (United States), Esperanto, Farsi (Persian), Finnish, French, German, Greek, +# Hindi, Hungarian, Indonesian, Italian, Japanese, Japanese-en (Japanese with +# English messages), Korean, Korean-en (Korean with English messages), Latvian, +# Lithuanian, Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, +# Romanian, Russian, Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, +# Swedish, Turkish, Ukrainian and Vietnamese. +# The default value is: English. OUTPUT_LANGUAGE = English -# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will -# include brief member descriptions after the members that are listed in -# the file and class documentation (similar to JavaDoc). -# Set to NO to disable this. +# If the BRIEF_MEMBER_DESC tag is set to YES, doxygen will include brief member +# descriptions after the members that are listed in the file and class +# documentation (similar to Javadoc). Set to NO to disable this. +# The default value is: YES. BRIEF_MEMBER_DESC = YES -# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend -# the brief description of a member or function before the detailed description. -# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# If the REPEAT_BRIEF tag is set to YES, doxygen will prepend the brief +# description of a member or function before the detailed description +# +# Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the # brief descriptions will be completely suppressed. +# The default value is: YES. REPEAT_BRIEF = NO -# This tag implements a quasi-intelligent brief description abbreviator -# that is used to form the text in various listings. Each string -# in this list, if found as the leading text of the brief description, will be -# stripped from the text and the result after processing the whole list, is -# used as the annotated text. Otherwise, the brief description is used as-is. -# If left blank, the following values are used ("$name" is automatically -# replaced with the name of the entity): "The $name class" "The $name widget" -# "The $name file" "is" "provides" "specifies" "contains" -# "represents" "a" "an" "the" +# This tag implements a quasi-intelligent brief description abbreviator that is +# used to form the text in various listings. Each string in this list, if found +# as the leading text of the brief description, will be stripped from the text +# and the result, after processing the whole list, is used as the annotated +# text. Otherwise, the brief description is used as-is. If left blank, the +# following values are used ($name is automatically replaced with the name of +# the entity):The $name class, The $name widget, The $name file, is, provides, +# specifies, contains, represents, a, an and the. ABBREVIATE_BRIEF = # If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then -# Doxygen will generate a detailed section even if there is only a brief +# doxygen will generate a detailed section even if there is only a brief # description. +# The default value is: NO. ALWAYS_DETAILED_SEC = YES @@ -112,88 +153,125 @@ ALWAYS_DETAILED_SEC = YES # inherited members of a class in the documentation of that class as if those # members were ordinary class members. Constructors, destructors and assignment # operators of the base classes will not be shown. +# The default value is: NO. INLINE_INHERITED_MEMB = NO -# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full -# path before files name in the file list and in the header files. If set -# to NO the shortest path that makes the file name unique will be used. +# If the FULL_PATH_NAMES tag is set to YES, doxygen will prepend the full path +# before files name in the file list and in the header files. If set to NO the +# shortest path that makes the file name unique will be used +# The default value is: YES. FULL_PATH_NAMES = NO -# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag -# can be used to strip a user-defined part of the path. Stripping is -# only done if one of the specified strings matches the left-hand part of -# the path. The tag can be used to show relative paths in the file list. -# If left blank the directory from which doxygen is run is used as the -# path to strip. Note that you specify absolute paths here, but also -# relative paths, which will be relative from the directory where doxygen is -# started. +# The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path. +# Stripping is only done if one of the specified strings matches the left-hand +# part of the path. The tag can be used to show relative paths in the file list. +# If left blank the directory from which doxygen is run is used as the path to +# strip. +# +# Note that you can specify absolute paths here, but also relative paths, which +# will be relative from the directory where doxygen is started. +# This tag requires that the tag FULL_PATH_NAMES is set to YES. STRIP_FROM_PATH = -# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of -# the path mentioned in the documentation of a class, which tells -# the reader which header file to include in order to use a class. -# If left blank only the name of the header file containing the class -# definition is used. Otherwise one should specify the include paths that -# are normally passed to the compiler using the -I flag. +# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the +# path mentioned in the documentation of a class, which tells the reader which +# header file to include in order to use a class. If left blank only the name of +# the header file containing the class definition is used. Otherwise one should +# specify the list of include paths that are normally passed to the compiler +# using the -I flag. STRIP_FROM_INC_PATH = -# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter -# (but less readable) file names. This can be useful if your file system -# doesn't support long names like on DOS, Mac, or CD-ROM. +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but +# less readable) file names. This can be useful is your file systems doesn't +# support long names like on DOS, Mac, or CD-ROM. +# The default value is: NO. SHORT_NAMES = NO -# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen -# will interpret the first line (until the first dot) of a JavaDoc-style -# comment as the brief description. If set to NO, the JavaDoc -# comments will behave just like regular Qt-style comments -# (thus requiring an explicit @brief command for a brief description.) +# If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the +# first line (until the first dot) of a Javadoc-style comment as the brief +# description. If set to NO, the Javadoc-style will behave just like regular Qt- +# style comments (thus requiring an explicit @brief command for a brief +# description.) +# The default value is: NO. JAVADOC_AUTOBRIEF = NO -# If the QT_AUTOBRIEF tag is set to YES then Doxygen will -# interpret the first line (until the first dot) of a Qt-style -# comment as the brief description. If set to NO, the comments -# will behave just like regular Qt-style comments (thus requiring -# an explicit \brief command for a brief description.) +# If the JAVADOC_BANNER tag is set to YES then doxygen will interpret a line +# such as +# /*************** +# as being the beginning of a Javadoc-style comment "banner". If set to NO, the +# Javadoc-style will behave just like regular comments and it will not be +# interpreted by doxygen. +# The default value is: NO. + +JAVADOC_BANNER = NO + +# If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first +# line (until the first dot) of a Qt-style comment as the brief description. If +# set to NO, the Qt-style will behave just like regular Qt-style comments (thus +# requiring an explicit \brief command for a brief description.) +# The default value is: NO. QT_AUTOBRIEF = NO -# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen -# treat a multi-line C++ special comment block (i.e. a block of //! or /// -# comments) as a brief description. This used to be the default behaviour. -# The new default is to treat a multi-line C++ comment block as a detailed -# description. Set this tag to YES if you prefer the old behaviour instead. +# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make doxygen treat a +# multi-line C++ special comment block (i.e. a block of //! or /// comments) as +# a brief description. This used to be the default behavior. The new default is +# to treat a multi-line C++ comment block as a detailed description. Set this +# tag to YES if you prefer the old behavior instead. +# +# Note that setting this tag to YES also means that rational rose comments are +# not recognized any more. +# The default value is: NO. MULTILINE_CPP_IS_BRIEF = NO -# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented -# member inherits the documentation from any documented member that it -# re-implements. +# By default Python docstrings are displayed as preformatted text and doxygen's +# special commands cannot be used. By setting PYTHON_DOCSTRING to NO the +# doxygen's special commands can be used and the contents of the docstring +# documentation blocks is shown as doxygen documentation. +# The default value is: YES. + +PYTHON_DOCSTRING = YES + +# If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the +# documentation from any documented member that it re-implements. +# The default value is: YES. INHERIT_DOCS = YES -# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce -# a new page for each member. If set to NO, the documentation of a member will -# be part of the file/class/namespace that contains it. +# If the SEPARATE_MEMBER_PAGES tag is set to YES then doxygen will produce a new +# page for each member. If set to NO, the documentation of a member will be part +# of the file/class/namespace that contains it. +# The default value is: NO. SEPARATE_MEMBER_PAGES = NO -# The TAB_SIZE tag can be used to set the number of spaces in a tab. -# Doxygen uses this value to replace tabs by spaces in code fragments. +# The TAB_SIZE tag can be used to set the number of spaces in a tab. Doxygen +# uses this value to replace tabs by spaces in code fragments. +# Minimum value: 1, maximum value: 16, default value: 4. TAB_SIZE = 8 -# This tag can be used to specify a number of aliases that acts -# as commands in the documentation. An alias has the form "name=value". -# For example adding "sideeffect=\par Side Effects:\n" will allow you to -# put the command \sideeffect (or @sideeffect) in the documentation, which -# will result in a user-defined paragraph with heading "Side Effects:". -# You can put \n's in the value part of an alias to insert newlines. +# This tag can be used to specify a number of aliases that act as commands in +# the documentation. An alias has the form: +# name=value +# For example adding +# "sideeffect=@par Side Effects:^^" +# will allow you to put the command \sideeffect (or @sideeffect) in the +# documentation, which will result in a user-defined paragraph with heading +# "Side Effects:". Note that you cannot put \n's in the value part of an alias +# to insert newlines (in the resulting output). You can put ^^ in the value part +# of an alias to insert a newline as if a physical newline was in the original +# file. When you need a literal { or } or , in the value part of an alias you +# have to escape them by means of a backslash (\), this can lead to conflicts +# with the commands \{ and \} for these it is advised to use the version @{ and +# @} or use a double escape (\\{ and \\}) ALIASES = "thread_safety=@par Thread safety^^" \ "pointer_lifetime=@par Pointer lifetime^^" \ @@ -208,483 +286,716 @@ ALIASES = "thread_safety=@par Thread safety^^" \ "macos=__macOS:__" \ "linux=__Linux:__" -# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C -# sources only. Doxygen will then generate output that is more tailored for C. -# For instance, some of the names that are used will be different. The list -# of all members will be omitted, etc. +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources +# only. Doxygen will then generate output that is more tailored for C. For +# instance, some of the names that are used will be different. The list of all +# members will be omitted, etc. +# The default value is: NO. OPTIMIZE_OUTPUT_FOR_C = YES -# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java -# sources only. Doxygen will then generate output that is more tailored for -# Java. For instance, namespaces will be presented as packages, qualified -# scopes will look different, etc. +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or +# Python sources only. Doxygen will then generate output that is more tailored +# for that language. For instance, namespaces will be presented as packages, +# qualified scopes will look different, etc. +# The default value is: NO. OPTIMIZE_OUTPUT_JAVA = NO # Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran -# sources only. Doxygen will then generate output that is more tailored for -# Fortran. +# sources. Doxygen will then generate output that is tailored for Fortran. +# The default value is: NO. OPTIMIZE_FOR_FORTRAN = NO # Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL -# sources. Doxygen will then generate output that is tailored for -# VHDL. +# sources. Doxygen will then generate output that is tailored for VHDL. +# The default value is: NO. OPTIMIZE_OUTPUT_VHDL = NO +# Set the OPTIMIZE_OUTPUT_SLICE tag to YES if your project consists of Slice +# sources only. Doxygen will then generate output that is more tailored for that +# language. For instance, namespaces will be presented as modules, types will be +# separated into more groups, etc. +# The default value is: NO. + +OPTIMIZE_OUTPUT_SLICE = NO + # Doxygen selects the parser to use depending on the extension of the files it # parses. With this tag you can assign which parser to use for a given # extension. Doxygen has a built-in mapping, but you can override or extend it -# using this tag. The format is ext=language, where ext is a file extension, -# and language is one of the parsers supported by doxygen: IDL, Java, -# Javascript, CSharp, C, C++, D, PHP, Objective-C, Python, Fortran, VHDL, C, -# C++. For instance to make doxygen treat .inc files as Fortran files (default -# is PHP), and .f files as C (default is Fortran), use: inc=Fortran f=C. Note -# that for custom extensions you also need to set FILE_PATTERNS otherwise the -# files are not read by doxygen. +# using this tag. The format is ext=language, where ext is a file extension, and +# language is one of the parsers supported by doxygen: IDL, Java, JavaScript, +# Csharp (C#), C, C++, Lex, D, PHP, md (Markdown), Objective-C, Python, Slice, +# VHDL, Fortran (fixed format Fortran: FortranFixed, free formatted Fortran: +# FortranFree, unknown formatted Fortran: Fortran. In the later case the parser +# tries to guess whether the code is fixed or free formatted code, this is the +# default for Fortran type files). For instance to make doxygen treat .inc files +# as Fortran files (default is PHP), and .f files as C (default is Fortran), +# use: inc=Fortran f=C. +# +# Note: For files without extension you can use no_extension as a placeholder. +# +# Note that for custom extensions you also need to set FILE_PATTERNS otherwise +# the files are not read by doxygen. When specifying no_extension you should add +# * to the FILE_PATTERNS. +# +# Note see also the list of default file extension mappings. EXTENSION_MAPPING = -# If MARKDOWN_SUPPORT is enabled (the default) then doxygen pre-processes all -# comments according to the Markdown format, which allows for more readable -# documentation. See http://daringfireball.net/projects/markdown/ for details. -# The output of markdown processing is further processed by doxygen, so you -# can mix doxygen, HTML, and XML commands with Markdown formatting. -# Disable only in case of backward compatibilities issues. +# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments +# according to the Markdown format, which allows for more readable +# documentation. See https://daringfireball.net/projects/markdown/ for details. +# The output of markdown processing is further processed by doxygen, so you can +# mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in +# case of backward compatibilities issues. +# The default value is: YES. MARKDOWN_SUPPORT = YES -# When enabled doxygen tries to link words that correspond to documented classes, -# or namespaces to their corresponding documentation. Such a link can be -# prevented in individual cases by putting a % sign in front of the word or +# When the TOC_INCLUDE_HEADINGS tag is set to a non-zero value, all headings up +# to that level are automatically included in the table of contents, even if +# they do not have an id attribute. +# Note: This feature currently applies only to Markdown headings. +# Minimum value: 0, maximum value: 99, default value: 5. +# This tag requires that the tag MARKDOWN_SUPPORT is set to YES. + +TOC_INCLUDE_HEADINGS = 5 + +# The MARKDOWN_ID_STYLE tag can be used to specify the algorithm used to +# generate identifiers for the Markdown headings. Note: Every identifier is +# unique. +# Possible values are: DOXYGEN Use a fixed 'autotoc_md' string followed by a +# sequence number starting at 0. and GITHUB Use the lower case version of title +# with any whitespace replaced by '-' and punctations characters removed.. +# The default value is: DOXYGEN. +# This tag requires that the tag MARKDOWN_SUPPORT is set to YES. + +MARKDOWN_ID_STYLE = DOXYGEN + +# When enabled doxygen tries to link words that correspond to documented +# classes, or namespaces to their corresponding documentation. Such a link can +# be prevented in individual cases by putting a % sign in front of the word or # globally by setting AUTOLINK_SUPPORT to NO. +# The default value is: YES. AUTOLINK_SUPPORT = YES # If you use STL classes (i.e. std::string, std::vector, etc.) but do not want -# to include (a tag file for) the STL sources as input, then you should -# set this tag to YES in order to let doxygen match functions declarations and -# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. -# func(std::string) {}). This also makes the inheritance and collaboration +# to include (a tag file for) the STL sources as input, then you should set this +# tag to YES in order to let doxygen match functions declarations and +# definitions whose arguments contain STL classes (e.g. func(std::string); +# versus func(std::string) {}). This also make the inheritance and collaboration # diagrams that involve STL classes more complete and accurate. +# The default value is: NO. BUILTIN_STL_SUPPORT = NO # If you use Microsoft's C++/CLI language, you should set this option to YES to # enable parsing support. +# The default value is: NO. CPP_CLI_SUPPORT = NO -# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. -# Doxygen will parse them like normal C++ but will assume all classes use public -# instead of private inheritance when no explicit protection keyword is present. +# Set the SIP_SUPPORT tag to YES if your project consists of sip (see: +# https://www.riverbankcomputing.com/software/sip/intro) sources only. Doxygen +# will parse them like normal C++ but will assume all classes use public instead +# of private inheritance when no explicit protection keyword is present. +# The default value is: NO. SIP_SUPPORT = NO # For Microsoft's IDL there are propget and propput attributes to indicate -# getter and setter methods for a property. Setting this option to YES (the -# default) will make doxygen replace the get and set methods by a property in -# the documentation. This will only work if the methods are indeed getting or -# setting a simple type. If this is not the case, or you want to show the -# methods anyway, you should set this option to NO. +# getter and setter methods for a property. Setting this option to YES will make +# doxygen to replace the get and set methods by a property in the documentation. +# This will only work if the methods are indeed getting or setting a simple +# type. If this is not the case, or you want to show the methods anyway, you +# should set this option to NO. +# The default value is: YES. -IDL_PROPERTY_SUPPORT = NO +IDL_PROPERTY_SUPPORT = YES # If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC -# tag is set to YES, then doxygen will reuse the documentation of the first +# tag is set to YES then doxygen will reuse the documentation of the first # member in the group (if any) for the other members of the group. By default # all members of a group must be documented explicitly. +# The default value is: NO. DISTRIBUTE_GROUP_DOC = NO -# Set the SUBGROUPING tag to YES (the default) to allow class member groups of -# the same type (for instance a group of public functions) to be put as a -# subgroup of that type (e.g. under the Public Functions section). Set it to -# NO to prevent subgrouping. Alternatively, this can be done per class using -# the \nosubgrouping command. +# If one adds a struct or class to a group and this option is enabled, then also +# any nested class or struct is added to the same group. By default this option +# is disabled and one has to add nested compounds explicitly via \ingroup. +# The default value is: NO. + +GROUP_NESTED_COMPOUNDS = NO + +# Set the SUBGROUPING tag to YES to allow class member groups of the same type +# (for instance a group of public functions) to be put as a subgroup of that +# type (e.g. under the Public Functions section). Set it to NO to prevent +# subgrouping. Alternatively, this can be done per class using the +# \nosubgrouping command. +# The default value is: YES. SUBGROUPING = YES -# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and -# unions are shown inside the group in which they are included (e.g. using -# @ingroup) instead of on a separate page (for HTML and Man pages) or -# section (for LaTeX and RTF). +# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and unions +# are shown inside the group in which they are included (e.g. using \ingroup) +# instead of on a separate page (for HTML and Man pages) or section (for LaTeX +# and RTF). +# +# Note that this feature does not work in combination with +# SEPARATE_MEMBER_PAGES. +# The default value is: NO. INLINE_GROUPED_CLASSES = NO -# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and -# unions with only public data fields will be shown inline in the documentation -# of the scope in which they are defined (i.e. file, namespace, or group -# documentation), provided this scope is documented. If set to NO (the default), -# structs, classes, and unions are shown on a separate page (for HTML and Man -# pages) or section (for LaTeX and RTF). +# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions +# with only public data fields or simple typedef fields will be shown inline in +# the documentation of the scope in which they are defined (i.e. file, +# namespace, or group documentation), provided this scope is documented. If set +# to NO, structs, classes, and unions are shown on a separate page (for HTML and +# Man pages) or section (for LaTeX and RTF). +# The default value is: NO. INLINE_SIMPLE_STRUCTS = NO -# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum -# is documented as struct, union, or enum with the name of the typedef. So +# When TYPEDEF_HIDES_STRUCT tag is enabled, a typedef of a struct, union, or +# enum is documented as struct, union, or enum with the name of the typedef. So # typedef struct TypeS {} TypeT, will appear in the documentation as a struct # with name TypeT. When disabled the typedef will appear as a member of a file, -# namespace, or class. And the struct will be named TypeS. This can typically -# be useful for C code in case the coding convention dictates that all compound +# namespace, or class. And the struct will be named TypeS. This can typically be +# useful for C code in case the coding convention dictates that all compound # types are typedef'ed and only the typedef is referenced, never the tag name. +# The default value is: NO. TYPEDEF_HIDES_STRUCT = NO -# Similar to the SYMBOL_CACHE_SIZE the size of the symbol lookup cache can be -# set using LOOKUP_CACHE_SIZE. This cache is used to resolve symbols given -# their name and scope. Since this can be an expensive process and often the -# same symbol appear multiple times in the code, doxygen keeps a cache of -# pre-resolved symbols. If the cache is too small doxygen will become slower. -# If the cache is too large, memory is wasted. The cache size is given by this -# formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range is 0..9, the default is 0, -# corresponding to a cache size of 2^16 = 65536 symbols. +# The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This +# cache is used to resolve symbols given their name and scope. Since this can be +# an expensive process and often the same symbol appears multiple times in the +# code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small +# doxygen will become slower. If the cache is too large, memory is wasted. The +# cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range +# is 0..9, the default is 0, corresponding to a cache size of 2^16=65536 +# symbols. At the end of a run doxygen will report the cache usage and suggest +# the optimal cache size from a speed point of view. +# Minimum value: 0, maximum value: 9, default value: 0. LOOKUP_CACHE_SIZE = 0 +# The NUM_PROC_THREADS specifies the number of threads doxygen is allowed to use +# during processing. When set to 0 doxygen will based this on the number of +# cores available in the system. You can set it explicitly to a value larger +# than 0 to get more control over the balance between CPU load and processing +# speed. At this moment only the input processing can be done using multiple +# threads. Since this is still an experimental feature the default is set to 1, +# which effectively disables parallel processing. Please report any issues you +# encounter. Generating dot graphs in parallel is controlled by the +# DOT_NUM_THREADS setting. +# Minimum value: 0, maximum value: 32, default value: 1. + +NUM_PROC_THREADS = 1 + +# If the TIMESTAMP tag is set different from NO then each generated page will +# contain the date or date and time when the page was generated. Setting this to +# NO can help when comparing the output of multiple runs. +# Possible values are: YES, NO, DATETIME and DATE. +# The default value is: NO. + +TIMESTAMP = NO + #--------------------------------------------------------------------------- # Build related configuration options #--------------------------------------------------------------------------- -# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in -# documentation are documented, even if no documentation was available. -# Private class members and static file members will be hidden unless -# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES +# If the EXTRACT_ALL tag is set to YES, doxygen will assume all entities in +# documentation are documented, even if no documentation was available. Private +# class members and static file members will be hidden unless the +# EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES. +# Note: This will also disable the warnings about undocumented members that are +# normally produced when WARNINGS is set to YES. +# The default value is: NO. EXTRACT_ALL = YES -# If the EXTRACT_PRIVATE tag is set to YES all private members of a class -# will be included in the documentation. +# If the EXTRACT_PRIVATE tag is set to YES, all private members of a class will +# be included in the documentation. +# The default value is: NO. EXTRACT_PRIVATE = NO -# If the EXTRACT_PACKAGE tag is set to YES all members with package or internal +# If the EXTRACT_PRIV_VIRTUAL tag is set to YES, documented private virtual +# methods of a class will be included in the documentation. +# The default value is: NO. + +EXTRACT_PRIV_VIRTUAL = NO + +# If the EXTRACT_PACKAGE tag is set to YES, all members with package or internal # scope will be included in the documentation. +# The default value is: NO. EXTRACT_PACKAGE = NO -# If the EXTRACT_STATIC tag is set to YES all static members of a file -# will be included in the documentation. +# If the EXTRACT_STATIC tag is set to YES, all static members of a file will be +# included in the documentation. +# The default value is: NO. EXTRACT_STATIC = NO -# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) -# defined locally in source files will be included in the documentation. -# If set to NO only classes defined in header files are included. +# If the EXTRACT_LOCAL_CLASSES tag is set to YES, classes (and structs) defined +# locally in source files will be included in the documentation. If set to NO, +# only classes defined in header files are included. Does not have any effect +# for Java sources. +# The default value is: YES. EXTRACT_LOCAL_CLASSES = YES -# This flag is only useful for Objective-C code. When set to YES local -# methods, which are defined in the implementation section but not in -# the interface are included in the documentation. -# If set to NO (the default) only methods in the interface are included. +# This flag is only useful for Objective-C code. If set to YES, local methods, +# which are defined in the implementation section but not in the interface are +# included in the documentation. If set to NO, only methods in the interface are +# included. +# The default value is: NO. EXTRACT_LOCAL_METHODS = NO # If this flag is set to YES, the members of anonymous namespaces will be # extracted and appear in the documentation as a namespace called -# 'anonymous_namespace{file}', where file will be replaced with the base -# name of the file that contains the anonymous namespace. By default -# anonymous namespaces are hidden. +# 'anonymous_namespace{file}', where file will be replaced with the base name of +# the file that contains the anonymous namespace. By default anonymous namespace +# are hidden. +# The default value is: NO. EXTRACT_ANON_NSPACES = NO -# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all -# undocumented members of documented classes, files or namespaces. -# If set to NO (the default) these members will be included in the -# various overviews, but no documentation section is generated. -# This option has no effect if EXTRACT_ALL is enabled. +# If this flag is set to YES, the name of an unnamed parameter in a declaration +# will be determined by the corresponding definition. By default unnamed +# parameters remain unnamed in the output. +# The default value is: YES. + +RESOLVE_UNNAMED_PARAMS = YES + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all +# undocumented members inside documented classes or files. If set to NO these +# members will be included in the various overviews, but no documentation +# section is generated. This option has no effect if EXTRACT_ALL is enabled. +# The default value is: NO. HIDE_UNDOC_MEMBERS = NO -# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all -# undocumented classes that are normally visible in the class hierarchy. -# If set to NO (the default) these classes will be included in the various -# overviews. This option has no effect if EXTRACT_ALL is enabled. +# If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. If set +# to NO, these classes will be included in the various overviews. This option +# will also hide undocumented C++ concepts if enabled. This option has no effect +# if EXTRACT_ALL is enabled. +# The default value is: NO. HIDE_UNDOC_CLASSES = NO -# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all -# friend (class|struct|union) declarations. -# If set to NO (the default) these declarations will be included in the +# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend +# declarations. If set to NO, these declarations will be included in the # documentation. +# The default value is: NO. HIDE_FRIEND_COMPOUNDS = NO -# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any -# documentation blocks found inside the body of a function. -# If set to NO (the default) these blocks will be appended to the -# function's detailed documentation block. +# If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any +# documentation blocks found inside the body of a function. If set to NO, these +# blocks will be appended to the function's detailed documentation block. +# The default value is: NO. HIDE_IN_BODY_DOCS = NO -# The INTERNAL_DOCS tag determines if documentation -# that is typed after a \internal command is included. If the tag is set -# to NO (the default) then the documentation will be excluded. -# Set it to YES to include the internal documentation. +# The INTERNAL_DOCS tag determines if documentation that is typed after a +# \internal command is included. If the tag is set to NO then the documentation +# will be excluded. Set it to YES to include the internal documentation. +# The default value is: NO. INTERNAL_DOCS = NO -# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate -# file names in lower-case letters. If set to YES upper-case letters are also -# allowed. This is useful if you have classes or files whose names only differ -# in case and if your file system supports case sensitive file names. Windows -# and Mac users are advised to set this option to NO. +# With the correct setting of option CASE_SENSE_NAMES doxygen will better be +# able to match the capabilities of the underlying filesystem. In case the +# filesystem is case sensitive (i.e. it supports files in the same directory +# whose names only differ in casing), the option must be set to YES to properly +# deal with such files in case they appear in the input. For filesystems that +# are not case sensitive the option should be set to NO to properly deal with +# output files written for symbols that only differ in casing, such as for two +# classes, one named CLASS and the other named Class, and to also support +# references to files without having to specify the exact matching casing. On +# Windows (including Cygwin) and MacOS, users should typically set this option +# to NO, whereas on Linux or other Unix flavors it should typically be set to +# YES. +# Possible values are: SYSTEM, NO and YES. +# The default value is: SYSTEM. + +CASE_SENSE_NAMES = SYSTEM + +# If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with +# their full class and namespace scopes in the documentation. If set to YES, the +# scope will be hidden. +# The default value is: NO. -CASE_SENSE_NAMES = YES +HIDE_SCOPE_NAMES = NO -# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen -# will show members with their full class and namespace scopes in the -# documentation. If set to YES the scope will be hidden. +# If the HIDE_COMPOUND_REFERENCE tag is set to NO (default) then doxygen will +# append additional text to a page's title, such as Class Reference. If set to +# YES the compound reference will be hidden. +# The default value is: NO. -HIDE_SCOPE_NAMES = NO +HIDE_COMPOUND_REFERENCE= NO + +# If the SHOW_HEADERFILE tag is set to YES then the documentation for a class +# will show which file needs to be included to use the class. +# The default value is: YES. -# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen -# will put a list of the files that are included by a file in the documentation -# of that file. +SHOW_HEADERFILE = NO + +# If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of +# the files that are included by a file in the documentation of that file. +# The default value is: YES. SHOW_INCLUDE_FILES = NO -# If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen -# will list include files with double quotes in the documentation -# rather than with sharp brackets. +# If the SHOW_GROUPED_MEMB_INC tag is set to YES then Doxygen will add for each +# grouped member an include statement to the documentation, telling the reader +# which file to include in order to use the member. +# The default value is: NO. + +SHOW_GROUPED_MEMB_INC = NO + +# If the FORCE_LOCAL_INCLUDES tag is set to YES then doxygen will list include +# files with double quotes in the documentation rather than with sharp brackets. +# The default value is: NO. FORCE_LOCAL_INCLUDES = NO -# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] -# is inserted in the documentation for inline members. +# If the INLINE_INFO tag is set to YES then a tag [inline] is inserted in the +# documentation for inline members. +# The default value is: YES. INLINE_INFO = YES -# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen -# will sort the (detailed) documentation of file and class members -# alphabetically by member name. If set to NO the members will appear in -# declaration order. +# If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the +# (detailed) documentation of file and class members alphabetically by member +# name. If set to NO, the members will appear in declaration order. +# The default value is: YES. SORT_MEMBER_DOCS = NO -# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the -# brief documentation of file, namespace and class members alphabetically -# by member name. If set to NO (the default) the members will appear in -# declaration order. +# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief +# descriptions of file, namespace and class members alphabetically by member +# name. If set to NO, the members will appear in declaration order. Note that +# this will also influence the order of the classes in the class list. +# The default value is: NO. SORT_BRIEF_DOCS = NO -# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen -# will sort the (brief and detailed) documentation of class members so that -# constructors and destructors are listed first. If set to NO (the default) -# the constructors will appear in the respective orders defined by -# SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. -# This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO -# and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO. +# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the +# (brief and detailed) documentation of class members so that constructors and +# destructors are listed first. If set to NO the constructors will appear in the +# respective orders defined by SORT_BRIEF_DOCS and SORT_MEMBER_DOCS. +# Note: If SORT_BRIEF_DOCS is set to NO this option is ignored for sorting brief +# member documentation. +# Note: If SORT_MEMBER_DOCS is set to NO this option is ignored for sorting +# detailed member documentation. +# The default value is: NO. SORT_MEMBERS_CTORS_1ST = NO -# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the -# hierarchy of group names into alphabetical order. If set to NO (the default) -# the group names will appear in their defined order. +# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy +# of group names into alphabetical order. If set to NO the group names will +# appear in their defined order. +# The default value is: NO. SORT_GROUP_NAMES = YES -# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be -# sorted by fully-qualified names, including namespaces. If set to -# NO (the default), the class list will be sorted only by class name, -# not including the namespace part. +# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be sorted by +# fully-qualified names, including namespaces. If set to NO, the class list will +# be sorted only by class name, not including the namespace part. # Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. -# Note: This option applies only to the class list, not to the -# alphabetical list. +# Note: This option applies only to the class list, not to the alphabetical +# list. +# The default value is: NO. SORT_BY_SCOPE_NAME = NO -# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to -# do proper type resolution of all parameters of a function it will reject a -# match between the prototype and the implementation of a member function even -# if there is only one candidate or it is obvious which candidate to choose -# by doing a simple string match. By disabling STRICT_PROTO_MATCHING doxygen -# will still accept a match between prototype and implementation in such cases. +# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper +# type resolution of all parameters of a function it will reject a match between +# the prototype and the implementation of a member function even if there is +# only one candidate or it is obvious which candidate to choose by doing a +# simple string match. By disabling STRICT_PROTO_MATCHING doxygen will still +# accept a match between prototype and implementation in such cases. +# The default value is: NO. STRICT_PROTO_MATCHING = NO -# The GENERATE_TODOLIST tag can be used to enable (YES) or -# disable (NO) the todo list. This list is created by putting \todo -# commands in the documentation. +# The GENERATE_TODOLIST tag can be used to enable (YES) or disable (NO) the todo +# list. This list is created by putting \todo commands in the documentation. +# The default value is: YES. GENERATE_TODOLIST = YES -# The GENERATE_TESTLIST tag can be used to enable (YES) or -# disable (NO) the test list. This list is created by putting \test -# commands in the documentation. +# The GENERATE_TESTLIST tag can be used to enable (YES) or disable (NO) the test +# list. This list is created by putting \test commands in the documentation. +# The default value is: YES. GENERATE_TESTLIST = YES -# The GENERATE_BUGLIST tag can be used to enable (YES) or -# disable (NO) the bug list. This list is created by putting \bug -# commands in the documentation. +# The GENERATE_BUGLIST tag can be used to enable (YES) or disable (NO) the bug +# list. This list is created by putting \bug commands in the documentation. +# The default value is: YES. GENERATE_BUGLIST = YES -# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or -# disable (NO) the deprecated list. This list is created by putting -# \deprecated commands in the documentation. +# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or disable (NO) +# the deprecated list. This list is created by putting \deprecated commands in +# the documentation. +# The default value is: YES. GENERATE_DEPRECATEDLIST= YES -# The ENABLED_SECTIONS tag can be used to enable conditional -# documentation sections, marked by \if section-label ... \endif -# and \cond section-label ... \endcond blocks. +# The ENABLED_SECTIONS tag can be used to enable conditional documentation +# sections, marked by \if ... \endif and \cond +# ... \endcond blocks. ENABLED_SECTIONS = -# The MAX_INITIALIZER_LINES tag determines the maximum number of lines -# the initial value of a variable or macro consists of for it to appear in -# the documentation. If the initializer consists of more lines than specified -# here it will be hidden. Use a value of 0 to hide initializers completely. -# The appearance of the initializer of individual variables and macros in the -# documentation can be controlled using \showinitializer or \hideinitializer -# command in the documentation regardless of this setting. +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the +# initial value of a variable or macro / define can have for it to appear in the +# documentation. If the initializer consists of more lines than specified here +# it will be hidden. Use a value of 0 to hide initializers completely. The +# appearance of the value of individual variables and macros / defines can be +# controlled using \showinitializer or \hideinitializer command in the +# documentation regardless of this setting. +# Minimum value: 0, maximum value: 10000, default value: 30. MAX_INITIALIZER_LINES = 30 -# Set the SHOW_USED_FILES tag to NO to disable the list of files generated -# at the bottom of the documentation of classes and structs. If set to YES the +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated at +# the bottom of the documentation of classes and structs. If set to YES, the # list will mention the files that were used to generate the documentation. +# The default value is: YES. SHOW_USED_FILES = YES -# Set the SHOW_FILES tag to NO to disable the generation of the Files page. -# This will remove the Files entry from the Quick Index and from the -# Folder Tree View (if specified). The default is YES. +# Set the SHOW_FILES tag to NO to disable the generation of the Files page. This +# will remove the Files entry from the Quick Index and from the Folder Tree View +# (if specified). +# The default value is: YES. SHOW_FILES = YES -# Set the SHOW_NAMESPACES tag to NO to disable the generation of the -# Namespaces page. -# This will remove the Namespaces entry from the Quick Index -# and from the Folder Tree View (if specified). The default is YES. +# Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces +# page. This will remove the Namespaces entry from the Quick Index and from the +# Folder Tree View (if specified). +# The default value is: YES. SHOW_NAMESPACES = NO # The FILE_VERSION_FILTER tag can be used to specify a program or script that # doxygen should invoke to get the current version for each file (typically from # the version control system). Doxygen will invoke the program by executing (via -# popen()) the command , where is the value of -# the FILE_VERSION_FILTER tag, and is the name of an input file -# provided by doxygen. Whatever the program writes to standard output -# is used as the file version. See the manual for examples. +# popen()) the command command input-file, where command is the value of the +# FILE_VERSION_FILTER tag, and input-file is the name of an input file provided +# by doxygen. Whatever the program writes to standard output is used as the file +# version. For an example see the documentation. FILE_VERSION_FILTER = # The LAYOUT_FILE tag can be used to specify a layout file which will be parsed # by doxygen. The layout file controls the global structure of the generated # output files in an output format independent way. To create the layout file -# that represents doxygen's defaults, run doxygen with the -l option. -# You can optionally specify a file name after the option, if omitted -# DoxygenLayout.xml will be used as the name of the layout file. +# that represents doxygen's defaults, run doxygen with the -l option. You can +# optionally specify a file name after the option, if omitted DoxygenLayout.xml +# will be used as the name of the layout file. See also section "Changing the +# layout of pages" for information. +# +# Note that if you run doxygen from a directory containing a file called +# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE +# tag is left empty. LAYOUT_FILE = "@GLFW_SOURCE_DIR@/docs/DoxygenLayout.xml" -# The CITE_BIB_FILES tag can be used to specify one or more bib files -# containing the references data. This must be a list of .bib files. The -# .bib extension is automatically appended if omitted. Using this command -# requires the bibtex tool to be installed. See also -# http://en.wikipedia.org/wiki/BibTeX for more info. For LaTeX the style -# of the bibliography can be controlled using LATEX_BIB_STYLE. To use this -# feature you need bibtex and perl available in the search path. Do not use -# file names with spaces, bibtex cannot handle them. +# The CITE_BIB_FILES tag can be used to specify one or more bib files containing +# the reference definitions. This must be a list of .bib files. The .bib +# extension is automatically appended if omitted. This requires the bibtex tool +# to be installed. See also https://en.wikipedia.org/wiki/BibTeX for more info. +# For LaTeX the style of the bibliography can be controlled using +# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the +# search path. See also \cite for info how to create references. CITE_BIB_FILES = #--------------------------------------------------------------------------- -# configuration options related to warning and progress messages +# Configuration options related to warning and progress messages #--------------------------------------------------------------------------- -# The QUIET tag can be used to turn on/off the messages that are generated -# by doxygen. Possible values are YES and NO. If left blank NO is used. +# The QUIET tag can be used to turn on/off the messages that are generated to +# standard output by doxygen. If QUIET is set to YES this implies that the +# messages are off. +# The default value is: NO. QUIET = YES # The WARNINGS tag can be used to turn on/off the warning messages that are -# generated by doxygen. Possible values are YES and NO. If left blank -# NO is used. +# generated to standard error (stderr) by doxygen. If WARNINGS is set to YES +# this implies that the warnings are on. +# +# Tip: Turn warnings on while writing the documentation. +# The default value is: YES. WARNINGS = YES -# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings -# for undocumented members. If EXTRACT_ALL is set to YES then this flag will -# automatically be disabled. +# If the WARN_IF_UNDOCUMENTED tag is set to YES then doxygen will generate +# warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag +# will automatically be disabled. +# The default value is: YES. WARN_IF_UNDOCUMENTED = YES -# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for -# potential errors in the documentation, such as not documenting some -# parameters in a documented function, or documenting parameters that -# don't exist or using markup commands wrongly. +# If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for +# potential errors in the documentation, such as documenting some parameters in +# a documented function twice, or documenting parameters that don't exist or +# using markup commands wrongly. +# The default value is: YES. WARN_IF_DOC_ERROR = YES -# The WARN_NO_PARAMDOC option can be enabled to get warnings for -# functions that are documented, but have no documentation for their parameters -# or return value. If set to NO (the default) doxygen will only warn about -# wrong or incomplete parameter documentation, but not about the absence of -# documentation. +# If WARN_IF_INCOMPLETE_DOC is set to YES, doxygen will warn about incomplete +# function parameter documentation. If set to NO, doxygen will accept that some +# parameters have no documentation without warning. +# The default value is: YES. + +WARN_IF_INCOMPLETE_DOC = YES + +# This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that +# are documented, but have no documentation for their parameters or return +# value. If set to NO, doxygen will only warn about wrong parameter +# documentation, but not about the absence of documentation. If EXTRACT_ALL is +# set to YES then this flag will automatically be disabled. See also +# WARN_IF_INCOMPLETE_DOC +# The default value is: NO. WARN_NO_PARAMDOC = YES -# The WARN_FORMAT tag determines the format of the warning messages that -# doxygen can produce. The string should contain the $file, $line, and $text -# tags, which will be replaced by the file and line number from which the -# warning originated and the warning text. Optionally the format may contain -# $version, which will be replaced by the version of the file (if it could -# be obtained via FILE_VERSION_FILTER) +# If WARN_IF_UNDOC_ENUM_VAL option is set to YES, doxygen will warn about +# undocumented enumeration values. If set to NO, doxygen will accept +# undocumented enumeration values. If EXTRACT_ALL is set to YES then this flag +# will automatically be disabled. +# The default value is: NO. + +WARN_IF_UNDOC_ENUM_VAL = NO + +# If the WARN_AS_ERROR tag is set to YES then doxygen will immediately stop when +# a warning is encountered. If the WARN_AS_ERROR tag is set to FAIL_ON_WARNINGS +# then doxygen will continue running as if WARN_AS_ERROR tag is set to NO, but +# at the end of the doxygen process doxygen will return with a non-zero status. +# If the WARN_AS_ERROR tag is set to FAIL_ON_WARNINGS_PRINT then doxygen behaves +# like FAIL_ON_WARNINGS but in case no WARN_LOGFILE is defined doxygen will not +# write the warning messages in between other messages but write them at the end +# of a run, in case a WARN_LOGFILE is defined the warning messages will be +# besides being in the defined file also be shown at the end of a run, unless +# the WARN_LOGFILE is defined as - i.e. standard output (stdout) in that case +# the behavior will remain as with the setting FAIL_ON_WARNINGS. +# Possible values are: NO, YES, FAIL_ON_WARNINGS and FAIL_ON_WARNINGS_PRINT. +# The default value is: NO. + +WARN_AS_ERROR = NO + +# The WARN_FORMAT tag determines the format of the warning messages that doxygen +# can produce. The string should contain the $file, $line, and $text tags, which +# will be replaced by the file and line number from which the warning originated +# and the warning text. Optionally the format may contain $version, which will +# be replaced by the version of the file (if it could be obtained via +# FILE_VERSION_FILTER) +# See also: WARN_LINE_FORMAT +# The default value is: $file:$line: $text. WARN_FORMAT = "$file:$line: $text" -# The WARN_LOGFILE tag can be used to specify a file to which warning -# and error messages should be written. If left blank the output is written -# to stderr. +# In the $text part of the WARN_FORMAT command it is possible that a reference +# to a more specific place is given. To make it easier to jump to this place +# (outside of doxygen) the user can define a custom "cut" / "paste" string. +# Example: +# WARN_LINE_FORMAT = "'vi $file +$line'" +# See also: WARN_FORMAT +# The default value is: at line $line of file $file. + +WARN_LINE_FORMAT = "at line $line of file $file" + +# The WARN_LOGFILE tag can be used to specify a file to which warning and error +# messages should be written. If left blank the output is written to standard +# error (stderr). In case the file specified cannot be opened for writing the +# warning and error messages are written to standard error. When as file - is +# specified the warning and error messages are written to standard output +# (stdout). WARN_LOGFILE = "@GLFW_BINARY_DIR@/docs/warnings.txt" #--------------------------------------------------------------------------- -# configuration options related to the input files +# Configuration options related to the input files #--------------------------------------------------------------------------- -# The INPUT tag can be used to specify the files and/or directories that contain -# documented source files. You may enter file names like "myfile.cpp" or -# directories like "/usr/src/myproject". Separate the files or directories -# with spaces. +# The INPUT tag is used to specify the files and/or directories that contain +# documented source files. You may enter file names like myfile.cpp or +# directories like /usr/src/myproject. Separate the files or directories with +# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING +# Note: If this tag is empty the current directory is searched. INPUT = @GLFW_DOXYGEN_INPUT@ # This tag can be used to specify the character encoding of the source files -# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is -# also the default input encoding. Doxygen uses libiconv (or the iconv built -# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for -# the list of possible encodings. +# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses +# libiconv (or the iconv built into libc) for the transcoding. See the libiconv +# documentation (see: +# https://www.gnu.org/software/libiconv/) for the list of possible encodings. +# See also: INPUT_FILE_ENCODING +# The default value is: UTF-8. INPUT_ENCODING = UTF-8 +# This tag can be used to specify the character encoding of the source files +# that doxygen parses The INPUT_FILE_ENCODING tag can be used to specify +# character encoding on a per file pattern basis. Doxygen will compare the file +# name with each pattern and apply the encoding instead of the default +# INPUT_ENCODING) if there is a match. The character encodings are a list of the +# form: pattern=encoding (like *.php=ISO-8859-1). See cfg_input_encoding +# "INPUT_ENCODING" for further information on supported encodings. + +INPUT_FILE_ENCODING = + # If the value of the INPUT tag contains directories, you can use the -# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp -# and *.h) to filter out the source-files in the directories. If left -# blank the following patterns are tested: -# *.c *.cc *.cxx *.cpp *.c++ *.d *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh -# *.hxx *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.dox *.py -# *.f90 *.f *.for *.vhd *.vhdl +# FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and +# *.h) to filter out the source-files in the directories. +# +# Note that for custom extensions or not directly supported extensions you also +# need to set EXTENSION_MAPPING for the extension otherwise the files are not +# read by doxygen. +# +# Note the list of default checked file patterns might differ from the list of +# default file extension mappings. +# +# If left blank the following patterns are tested:*.c, *.cc, *.cxx, *.cpp, +# *.c++, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, +# *.hh, *.hxx, *.hpp, *.h++, *.l, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, +# *.inc, *.m, *.markdown, *.md, *.mm, *.dox (to be provided as doxygen C +# comment), *.py, *.pyw, *.f90, *.f95, *.f03, *.f08, *.f18, *.f, *.for, *.vhd, +# *.vhdl, *.ucf, *.qsf and *.ice. FILE_PATTERNS = *.h *.dox -# The RECURSIVE tag can be used to turn specify whether or not subdirectories -# should be searched for input files as well. Possible values are YES and NO. -# If left blank NO is used. +# The RECURSIVE tag can be used to specify whether or not subdirectories should +# be searched for input files as well. +# The default value is: NO. RECURSIVE = NO # The EXCLUDE tag can be used to specify files and/or directories that should be # excluded from the INPUT source files. This way you can easily exclude a # subdirectory from a directory tree whose root is specified with the INPUT tag. +# # Note that relative paths are relative to the directory from which doxygen is # run. @@ -693,14 +1004,16 @@ EXCLUDE = # The EXCLUDE_SYMLINKS tag can be used to select whether or not files or # directories that are symbolic links (a Unix file system feature) are excluded # from the input. +# The default value is: NO. EXCLUDE_SYMLINKS = NO # If the value of the INPUT tag contains directories, you can use the # EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude -# certain files from those directories. Note that the wildcards are matched -# against the file with absolute path, so to exclude all test directories -# for example use the pattern */test/* +# certain files from those directories. +# +# Note that the wildcards are matched against the file with absolute path, so to +# exclude all test directories for example use the pattern */test/* EXCLUDE_PATTERNS = @@ -708,795 +1021,1233 @@ EXCLUDE_PATTERNS = # (namespaces, classes, functions, etc.) that should be excluded from the # output. The symbol name can be a fully qualified name, a word, or if the # wildcard * is used, a substring. Examples: ANamespace, AClass, -# AClass::ANamespace, ANamespace::*Test +# ANamespace::AClass, ANamespace::*Test EXCLUDE_SYMBOLS = APIENTRY GLFWAPI -# The EXAMPLE_PATH tag can be used to specify one or more files or -# directories that contain example code fragments that are included (see -# the \include command). +# The EXAMPLE_PATH tag can be used to specify one or more files or directories +# that contain example code fragments that are included (see the \include +# command). EXAMPLE_PATH = "@GLFW_SOURCE_DIR@/examples" # If the value of the EXAMPLE_PATH tag contains directories, you can use the -# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp -# and *.h) to filter out the source-files in the directories. If left -# blank all files are included. +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and +# *.h) to filter out the source-files in the directories. If left blank all +# files are included. EXAMPLE_PATTERNS = # If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be -# searched for input files to be used with the \include or \dontinclude -# commands irrespective of the value of the RECURSIVE tag. -# Possible values are YES and NO. If left blank NO is used. +# searched for input files to be used with the \include or \dontinclude commands +# irrespective of the value of the RECURSIVE tag. +# The default value is: NO. EXAMPLE_RECURSIVE = NO -# The IMAGE_PATH tag can be used to specify one or more files or -# directories that contain image that are included in the documentation (see -# the \image command). +# The IMAGE_PATH tag can be used to specify one or more files or directories +# that contain images that are to be included in the documentation (see the +# \image command). IMAGE_PATH = # The INPUT_FILTER tag can be used to specify a program that doxygen should # invoke to filter for each input file. Doxygen will invoke the filter program -# by executing (via popen()) the command , where -# is the value of the INPUT_FILTER tag, and is the name of an -# input file. Doxygen will then use the output that the filter program writes -# to standard output. -# If FILTER_PATTERNS is specified, this tag will be -# ignored. +# by executing (via popen()) the command: +# +# +# +# where is the value of the INPUT_FILTER tag, and is the +# name of an input file. Doxygen will then use the output that the filter +# program writes to standard output. If FILTER_PATTERNS is specified, this tag +# will be ignored. +# +# Note that the filter must not add or remove lines; it is applied before the +# code is scanned, but not when the output code is generated. If lines are added +# or removed, the anchors will not be placed correctly. +# +# Note that doxygen will use the data processed and written to standard output +# for further processing, therefore nothing else, like debug statements or used +# commands (so in case of a Windows batch file always use @echo OFF), should be +# written to standard output. +# +# Note that for custom extensions or not directly supported extensions you also +# need to set EXTENSION_MAPPING for the extension otherwise the files are not +# properly processed by doxygen. INPUT_FILTER = # The FILTER_PATTERNS tag can be used to specify filters on a per file pattern -# basis. -# Doxygen will compare the file name with each pattern and apply the -# filter if there is a match. -# The filters are a list of the form: -# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further -# info on how filters are used. If FILTER_PATTERNS is empty or if -# non of the patterns match the file name, INPUT_FILTER is applied. +# basis. Doxygen will compare the file name with each pattern and apply the +# filter if there is a match. The filters are a list of the form: pattern=filter +# (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how +# filters are used. If the FILTER_PATTERNS tag is empty or if none of the +# patterns match the file name, INPUT_FILTER is applied. +# +# Note that for custom extensions or not directly supported extensions you also +# need to set EXTENSION_MAPPING for the extension otherwise the files are not +# properly processed by doxygen. FILTER_PATTERNS = # If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using -# INPUT_FILTER) will be used to filter the input files when producing source -# files to browse (i.e. when SOURCE_BROWSER is set to YES). +# INPUT_FILTER) will also be used to filter the input files that are used for +# producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES). +# The default value is: NO. FILTER_SOURCE_FILES = NO # The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file -# pattern. A pattern will override the setting for FILTER_PATTERN (if any) -# and it is also possible to disable source filtering for a specific pattern -# using *.ext= (so without naming a filter). This option only has effect when -# FILTER_SOURCE_FILES is enabled. +# pattern. A pattern will override the setting for FILTER_PATTERN (if any) and +# it is also possible to disable source filtering for a specific pattern using +# *.ext= (so without naming a filter). +# This tag requires that the tag FILTER_SOURCE_FILES is set to YES. FILTER_SOURCE_PATTERNS = -# If the USE_MD_FILE_AS_MAINPAGE tag refers to the name of a markdown file that -# is part of the input, its contents will be placed on the main page (index.html). -# This can be useful if you have a project on for instance GitHub and want reuse -# the introduction page also for the doxygen output. +# If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that +# is part of the input, its contents will be placed on the main page +# (index.html). This can be useful if you have a project on for instance GitHub +# and want to reuse the introduction page also for the doxygen output. USE_MDFILE_AS_MAINPAGE = +# The Fortran standard specifies that for fixed formatted Fortran code all +# characters from position 72 are to be considered as comment. A common +# extension is to allow longer lines before the automatic comment starts. The +# setting FORTRAN_COMMENT_AFTER will also make it possible that longer lines can +# be processed before the automatic comment starts. +# Minimum value: 7, maximum value: 10000, default value: 72. + +FORTRAN_COMMENT_AFTER = 72 + #--------------------------------------------------------------------------- -# configuration options related to source browsing +# Configuration options related to source browsing #--------------------------------------------------------------------------- -# If the SOURCE_BROWSER tag is set to YES then a list of source files will -# be generated. Documented entities will be cross-referenced with these sources. -# Note: To get rid of all source code in the generated output, make sure also -# VERBATIM_HEADERS is set to NO. +# If the SOURCE_BROWSER tag is set to YES then a list of source files will be +# generated. Documented entities will be cross-referenced with these sources. +# +# Note: To get rid of all source code in the generated output, make sure that +# also VERBATIM_HEADERS is set to NO. +# The default value is: NO. SOURCE_BROWSER = NO -# Setting the INLINE_SOURCES tag to YES will include the body -# of functions and classes directly in the documentation. +# Setting the INLINE_SOURCES tag to YES will include the body of functions, +# classes and enums directly into the documentation. +# The default value is: NO. INLINE_SOURCES = NO -# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct -# doxygen to hide any special comment blocks from generated source code -# fragments. Normal C, C++ and Fortran comments will always remain visible. +# Setting the STRIP_CODE_COMMENTS tag to YES will instruct doxygen to hide any +# special comment blocks from generated source code fragments. Normal C, C++ and +# Fortran comments will always remain visible. +# The default value is: YES. STRIP_CODE_COMMENTS = YES -# If the REFERENCED_BY_RELATION tag is set to YES -# then for each documented function all documented -# functions referencing it will be listed. +# If the REFERENCED_BY_RELATION tag is set to YES then for each documented +# entity all documented functions referencing it will be listed. +# The default value is: NO. REFERENCED_BY_RELATION = NO -# If the REFERENCES_RELATION tag is set to YES -# then for each documented function all documented entities -# called/used by that function will be listed. +# If the REFERENCES_RELATION tag is set to YES then for each documented function +# all documented entities called/used by that function will be listed. +# The default value is: NO. REFERENCES_RELATION = NO -# If the REFERENCES_LINK_SOURCE tag is set to YES (the default) -# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from -# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will -# link to the source code. -# Otherwise they will link to the documentation. +# If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set +# to YES then the hyperlinks from functions in REFERENCES_RELATION and +# REFERENCED_BY_RELATION lists will link to the source code. Otherwise they will +# link to the documentation. +# The default value is: YES. REFERENCES_LINK_SOURCE = YES -# If the USE_HTAGS tag is set to YES then the references to source code -# will point to the HTML generated by the htags(1) tool instead of doxygen -# built-in source browser. The htags tool is part of GNU's global source -# tagging system (see http://www.gnu.org/software/global/global.html). You -# will need version 4.8.6 or higher. +# If SOURCE_TOOLTIPS is enabled (the default) then hovering a hyperlink in the +# source code will show a tooltip with additional information such as prototype, +# brief description and links to the definition and documentation. Since this +# will make the HTML file larger and loading of large files a bit slower, you +# can opt to disable this feature. +# The default value is: YES. +# This tag requires that the tag SOURCE_BROWSER is set to YES. + +SOURCE_TOOLTIPS = YES + +# If the USE_HTAGS tag is set to YES then the references to source code will +# point to the HTML generated by the htags(1) tool instead of doxygen built-in +# source browser. The htags tool is part of GNU's global source tagging system +# (see https://www.gnu.org/software/global/global.html). You will need version +# 4.8.6 or higher. +# +# To use it do the following: +# - Install the latest version of global +# - Enable SOURCE_BROWSER and USE_HTAGS in the configuration file +# - Make sure the INPUT points to the root of the source tree +# - Run doxygen as normal +# +# Doxygen will invoke htags (and that will in turn invoke gtags), so these +# tools must be available from the command line (i.e. in the search path). +# +# The result: instead of the source browser generated by doxygen, the links to +# source code will now point to the output of htags. +# The default value is: NO. +# This tag requires that the tag SOURCE_BROWSER is set to YES. USE_HTAGS = NO -# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen -# will generate a verbatim copy of the header file for each class for -# which an include is specified. Set to NO to disable this. +# If the VERBATIM_HEADERS tag is set the YES then doxygen will generate a +# verbatim copy of the header file for each class for which an include is +# specified. Set to NO to disable this. +# See also: Section \class. +# The default value is: YES. VERBATIM_HEADERS = YES #--------------------------------------------------------------------------- -# configuration options related to the alphabetical class index +# Configuration options related to the alphabetical class index #--------------------------------------------------------------------------- -# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index -# of all compounds will be generated. Enable this if the project -# contains a lot of classes, structs, unions or interfaces. +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index of all +# compounds will be generated. Enable this if the project contains a lot of +# classes, structs, unions or interfaces. +# The default value is: YES. ALPHABETICAL_INDEX = YES -# In case all classes in a project start with a common prefix, all -# classes will be put under the same header in the alphabetical index. -# The IGNORE_PREFIX tag can be used to specify one or more prefixes that -# should be ignored while generating the index headers. +# The IGNORE_PREFIX tag can be used to specify a prefix (or a list of prefixes) +# that should be ignored while generating the index headers. The IGNORE_PREFIX +# tag works for classes, function and member names. The entity will be placed in +# the alphabetical list under the first letter of the entity name that remains +# after removing the prefix. +# This tag requires that the tag ALPHABETICAL_INDEX is set to YES. IGNORE_PREFIX = glfw GLFW_ #--------------------------------------------------------------------------- -# configuration options related to the HTML output +# Configuration options related to the HTML output #--------------------------------------------------------------------------- -# If the GENERATE_HTML tag is set to YES (the default) Doxygen will -# generate HTML output. +# If the GENERATE_HTML tag is set to YES, doxygen will generate HTML output +# The default value is: YES. GENERATE_HTML = YES -# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `html' will be used as the default path. +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a +# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of +# it. +# The default directory is: html. +# This tag requires that the tag GENERATE_HTML is set to YES. HTML_OUTPUT = html -# The HTML_FILE_EXTENSION tag can be used to specify the file extension for -# each generated HTML page (for example: .htm,.php,.asp). If it is left blank -# doxygen will generate files with .html extension. +# The HTML_FILE_EXTENSION tag can be used to specify the file extension for each +# generated HTML page (for example: .htm, .php, .asp). +# The default value is: .html. +# This tag requires that the tag GENERATE_HTML is set to YES. HTML_FILE_EXTENSION = .html -# The HTML_HEADER tag can be used to specify a personal HTML header for -# each generated HTML page. If it is left blank doxygen will generate a -# standard header. Note that when using a custom header you are responsible -# for the proper inclusion of any scripts and style sheets that doxygen -# needs, which is dependent on the configuration options used. -# It is advised to generate a default header using "doxygen -w html -# header.html footer.html stylesheet.css YourConfigFile" and then modify -# that header. Note that the header is subject to change so you typically -# have to redo this when upgrading to a newer version of doxygen or when -# changing the value of configuration settings such as GENERATE_TREEVIEW! +# The HTML_HEADER tag can be used to specify a user-defined HTML header file for +# each generated HTML page. If the tag is left blank doxygen will generate a +# standard header. +# +# To get valid HTML the header file that includes any scripts and style sheets +# that doxygen needs, which is dependent on the configuration options used (e.g. +# the setting GENERATE_TREEVIEW). It is highly recommended to start with a +# default header using +# doxygen -w html new_header.html new_footer.html new_stylesheet.css +# YourConfigFile +# and then modify the file new_header.html. See also section "Doxygen usage" +# for information on how to generate the default header that doxygen normally +# uses. +# Note: The header is subject to change so you typically have to regenerate the +# default header when upgrading to a newer version of doxygen. For a description +# of the possible markers and block names see the documentation. +# This tag requires that the tag GENERATE_HTML is set to YES. HTML_HEADER = "@GLFW_SOURCE_DIR@/docs/header.html" -# The HTML_FOOTER tag can be used to specify a personal HTML footer for -# each generated HTML page. If it is left blank doxygen will generate a -# standard footer. +# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each +# generated HTML page. If the tag is left blank doxygen will generate a standard +# footer. See HTML_HEADER for more information on how to generate a default +# footer and what special commands can be used inside the footer. See also +# section "Doxygen usage" for information on how to generate the default footer +# that doxygen normally uses. +# This tag requires that the tag GENERATE_HTML is set to YES. HTML_FOOTER = "@GLFW_SOURCE_DIR@/docs/footer.html" -# The HTML_STYLESHEET tag can be used to specify a user-defined cascading -# style sheet that is used by each HTML page. It can be used to -# fine-tune the look of the HTML output. If left blank doxygen will -# generate a default style sheet. Note that it is recommended to use -# HTML_EXTRA_STYLESHEET instead of this one, as it is more robust and this -# tag will in the future become obsolete. +# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style +# sheet that is used by each HTML page. It can be used to fine-tune the look of +# the HTML output. If left blank doxygen will generate a default style sheet. +# See also section "Doxygen usage" for information on how to generate the style +# sheet that doxygen normally uses. +# Note: It is recommended to use HTML_EXTRA_STYLESHEET instead of this tag, as +# it is more robust and this tag (HTML_STYLESHEET) will in the future become +# obsolete. +# This tag requires that the tag GENERATE_HTML is set to YES. HTML_STYLESHEET = -# The HTML_EXTRA_STYLESHEET tag can be used to specify an additional -# user-defined cascading style sheet that is included after the standard -# style sheets created by doxygen. Using this option one can overrule -# certain style aspects. This is preferred over using HTML_STYLESHEET -# since it does not replace the standard style sheet and is therefor more -# robust against future updates. Doxygen will copy the style sheet file to -# the output directory. +# The HTML_EXTRA_STYLESHEET tag can be used to specify additional user-defined +# cascading style sheets that are included after the standard style sheets +# created by doxygen. Using this option one can overrule certain style aspects. +# This is preferred over using HTML_STYLESHEET since it does not replace the +# standard style sheet and is therefore more robust against future updates. +# Doxygen will copy the style sheet files to the output directory. +# Note: The order of the extra style sheet files is of importance (e.g. the last +# style sheet in the list overrules the setting of the previous ones in the +# list). +# Note: Since the styling of scrollbars can currently not be overruled in +# Webkit/Chromium, the styling will be left out of the default doxygen.css if +# one or more extra stylesheets have been specified. So if scrollbar +# customization is desired it has to be added explicitly. For an example see the +# documentation. +# This tag requires that the tag GENERATE_HTML is set to YES. HTML_EXTRA_STYLESHEET = "@GLFW_SOURCE_DIR@/docs/extra.css" # The HTML_EXTRA_FILES tag can be used to specify one or more extra images or # other source files which should be copied to the HTML output directory. Note # that these files will be copied to the base HTML output directory. Use the -# $relpath$ marker in the HTML_HEADER and/or HTML_FOOTER files to load these -# files. In the HTML_STYLESHEET file, use the file name only. Also note that -# the files will be copied as-is; there are no commands or markers available. +# $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these +# files. In the HTML_STYLESHEET file, use the file name only. Also note that the +# files will be copied as-is; there are no commands or markers available. +# This tag requires that the tag GENERATE_HTML is set to YES. HTML_EXTRA_FILES = "@GLFW_SOURCE_DIR@/docs/spaces.svg" -# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. -# Doxygen will adjust the colors in the style sheet and background images -# according to this color. Hue is specified as an angle on a colorwheel, -# see http://en.wikipedia.org/wiki/Hue for more information. -# For instance the value 0 represents red, 60 is yellow, 120 is green, -# 180 is cyan, 240 is blue, 300 purple, and 360 is red again. -# The allowed range is 0 to 359. +# The HTML_COLORSTYLE tag can be used to specify if the generated HTML output +# should be rendered with a dark or light theme. +# Possible values are: LIGHT always generate light mode output, DARK always +# generate dark mode output, AUTO_LIGHT automatically set the mode according to +# the user preference, use light mode if no preference is set (the default), +# AUTO_DARK automatically set the mode according to the user preference, use +# dark mode if no preference is set and TOGGLE allow to user to switch between +# light and dark mode via a button. +# The default value is: AUTO_LIGHT. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE = LIGHT + +# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen +# will adjust the colors in the style sheet and background images according to +# this color. Hue is specified as an angle on a color-wheel, see +# https://en.wikipedia.org/wiki/Hue for more information. For instance the value +# 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300 +# purple, and 360 is red again. +# Minimum value: 0, maximum value: 359, default value: 220. +# This tag requires that the tag GENERATE_HTML is set to YES. HTML_COLORSTYLE_HUE = 220 -# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of -# the colors in the HTML output. For a value of 0 the output will use -# grayscales only. A value of 255 will produce the most vivid colors. +# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors +# in the HTML output. For a value of 0 the output will use gray-scales only. A +# value of 255 will produce the most vivid colors. +# Minimum value: 0, maximum value: 255, default value: 100. +# This tag requires that the tag GENERATE_HTML is set to YES. HTML_COLORSTYLE_SAT = 100 -# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to -# the luminance component of the colors in the HTML output. Values below -# 100 gradually make the output lighter, whereas values above 100 make -# the output darker. The value divided by 100 is the actual gamma applied, -# so 80 represents a gamma of 0.8, The value 220 represents a gamma of 2.2, -# and 100 does not change the gamma. +# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the +# luminance component of the colors in the HTML output. Values below 100 +# gradually make the output lighter, whereas values above 100 make the output +# darker. The value divided by 100 is the actual gamma applied, so 80 represents +# a gamma of 0.8, The value 220 represents a gamma of 2.2, and 100 does not +# change the gamma. +# Minimum value: 40, maximum value: 240, default value: 80. +# This tag requires that the tag GENERATE_HTML is set to YES. HTML_COLORSTYLE_GAMMA = 80 -# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML -# page will contain the date and time when the page was generated. Setting -# this to NO can help when comparing the output of multiple runs. +# If the HTML_DYNAMIC_MENUS tag is set to YES then the generated HTML +# documentation will contain a main index with vertical navigation menus that +# are dynamically created via JavaScript. If disabled, the navigation index will +# consists of multiple levels of tabs that are statically embedded in every HTML +# page. Disable this option to support browsers that do not have JavaScript, +# like the Qt help browser. +# The default value is: YES. +# This tag requires that the tag GENERATE_HTML is set to YES. -HTML_TIMESTAMP = YES +HTML_DYNAMIC_MENUS = YES # If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML # documentation will contain sections that can be hidden and shown after the # page has loaded. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. HTML_DYNAMIC_SECTIONS = NO -# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of -# entries shown in the various tree structured indices initially; the user -# can expand and collapse entries dynamically later on. Doxygen will expand -# the tree to such a level that at most the specified number of entries are -# visible (unless a fully collapsed tree already exceeds this amount). -# So setting the number of entries 1 will produce a full collapsed tree by -# default. 0 is a special value representing an infinite number of entries -# and will result in a full expanded tree by default. +# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries +# shown in the various tree structured indices initially; the user can expand +# and collapse entries dynamically later on. Doxygen will expand the tree to +# such a level that at most the specified number of entries are visible (unless +# a fully collapsed tree already exceeds this amount). So setting the number of +# entries 1 will produce a full collapsed tree by default. 0 is a special value +# representing an infinite number of entries and will result in a full expanded +# tree by default. +# Minimum value: 0, maximum value: 9999, default value: 100. +# This tag requires that the tag GENERATE_HTML is set to YES. HTML_INDEX_NUM_ENTRIES = 100 -# If the GENERATE_DOCSET tag is set to YES, additional index files -# will be generated that can be used as input for Apple's Xcode 3 -# integrated development environment, introduced with OSX 10.5 (Leopard). -# To create a documentation set, doxygen will generate a Makefile in the -# HTML output directory. Running make will produce the docset in that -# directory and running "make install" will install the docset in -# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find -# it at startup. -# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html -# for more information. +# If the GENERATE_DOCSET tag is set to YES, additional index files will be +# generated that can be used as input for Apple's Xcode 3 integrated development +# environment (see: +# https://developer.apple.com/xcode/), introduced with OSX 10.5 (Leopard). To +# create a documentation set, doxygen will generate a Makefile in the HTML +# output directory. Running make will produce the docset in that directory and +# running make install will install the docset in +# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at +# startup. See https://developer.apple.com/library/archive/featuredarticles/Doxy +# genXcode/_index.html for more information. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. GENERATE_DOCSET = NO -# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the -# feed. A documentation feed provides an umbrella under which multiple -# documentation sets from a single provider (such as a company or product suite) -# can be grouped. +# This tag determines the name of the docset feed. A documentation feed provides +# an umbrella under which multiple documentation sets from a single provider +# (such as a company or product suite) can be grouped. +# The default value is: Doxygen generated docs. +# This tag requires that the tag GENERATE_DOCSET is set to YES. DOCSET_FEEDNAME = "Doxygen generated docs" -# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that -# should uniquely identify the documentation set bundle. This should be a -# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen -# will append .docset to the name. +# This tag determines the URL of the docset feed. A documentation feed provides +# an umbrella under which multiple documentation sets from a single provider +# (such as a company or product suite) can be grouped. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_FEEDURL = + +# This tag specifies a string that should uniquely identify the documentation +# set bundle. This should be a reverse domain-name style string, e.g. +# com.mycompany.MyDocSet. Doxygen will append .docset to the name. +# The default value is: org.doxygen.Project. +# This tag requires that the tag GENERATE_DOCSET is set to YES. DOCSET_BUNDLE_ID = org.doxygen.Project -# When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely -# identify the documentation publisher. This should be a reverse domain-name -# style string, e.g. com.mycompany.MyDocSet.documentation. +# The DOCSET_PUBLISHER_ID tag specifies a string that should uniquely identify +# the documentation publisher. This should be a reverse domain-name style +# string, e.g. com.mycompany.MyDocSet.documentation. +# The default value is: org.doxygen.Publisher. +# This tag requires that the tag GENERATE_DOCSET is set to YES. DOCSET_PUBLISHER_ID = org.doxygen.Publisher -# The GENERATE_PUBLISHER_NAME tag identifies the documentation publisher. +# The DOCSET_PUBLISHER_NAME tag identifies the documentation publisher. +# The default value is: Publisher. +# This tag requires that the tag GENERATE_DOCSET is set to YES. DOCSET_PUBLISHER_NAME = Publisher -# If the GENERATE_HTMLHELP tag is set to YES, additional index files -# will be generated that can be used as input for tools like the -# Microsoft HTML help workshop to generate a compiled HTML help file (.chm) -# of the generated HTML documentation. +# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three +# additional HTML index files: index.hhp, index.hhc, and index.hhk. The +# index.hhp is a project file that can be read by Microsoft's HTML Help Workshop +# on Windows. In the beginning of 2021 Microsoft took the original page, with +# a.o. the download links, offline the HTML help workshop was already many years +# in maintenance mode). You can download the HTML help workshop from the web +# archives at Installation executable (see: +# http://web.archive.org/web/20160201063255/http://download.microsoft.com/downlo +# ad/0/A/9/0A939EF6-E31C-430F-A3DF-DFAE7960D564/htmlhelp.exe). +# +# The HTML Help Workshop contains a compiler that can convert all HTML output +# generated by doxygen into a single compiled HTML file (.chm). Compiled HTML +# files are now used as the Windows 98 help format, and will replace the old +# Windows help format (.hlp) on all Windows platforms in the future. Compressed +# HTML files also contain an index, a table of contents, and you can search for +# words in the documentation. The HTML workshop also contains a viewer for +# compressed HTML files. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. GENERATE_HTMLHELP = NO -# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can -# be used to specify the file name of the resulting .chm file. You -# can add a path in front of the file if the result should not be +# The CHM_FILE tag can be used to specify the file name of the resulting .chm +# file. You can add a path in front of the file if the result should not be # written to the html output directory. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. CHM_FILE = -# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can -# be used to specify the location (absolute path including file name) of -# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run -# the HTML help compiler on the generated index.hhp. +# The HHC_LOCATION tag can be used to specify the location (absolute path +# including file name) of the HTML help compiler (hhc.exe). If non-empty, +# doxygen will try to run the HTML help compiler on the generated index.hhp. +# The file has to be specified with full path. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. HHC_LOCATION = -# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag -# controls if a separate .chi index file is generated (YES) or that -# it should be included in the master .chm file (NO). +# The GENERATE_CHI flag controls if a separate .chi index file is generated +# (YES) or that it should be included in the main .chm file (NO). +# The default value is: NO. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. GENERATE_CHI = NO -# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING -# is used to encode HtmlHelp index (hhk), content (hhc) and project file -# content. +# The CHM_INDEX_ENCODING is used to encode HtmlHelp index (hhk), content (hhc) +# and project file content. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. CHM_INDEX_ENCODING = -# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag -# controls whether a binary table of contents is generated (YES) or a -# normal table of contents (NO) in the .chm file. +# The BINARY_TOC flag controls whether a binary table of contents is generated +# (YES) or a normal table of contents (NO) in the .chm file. Furthermore it +# enables the Previous and Next buttons. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. BINARY_TOC = NO -# The TOC_EXPAND flag can be set to YES to add extra items for group members -# to the contents of the HTML help documentation and to the tree view. +# The TOC_EXPAND flag can be set to YES to add extra items for group members to +# the table of contents of the HTML help documentation and to the tree view. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. TOC_EXPAND = NO +# The SITEMAP_URL tag is used to specify the full URL of the place where the +# generated documentation will be placed on the server by the user during the +# deployment of the documentation. The generated sitemap is called sitemap.xml +# and placed on the directory specified by HTML_OUTPUT. In case no SITEMAP_URL +# is specified no sitemap is generated. For information about the sitemap +# protocol see https://www.sitemaps.org +# This tag requires that the tag GENERATE_HTML is set to YES. + +SITEMAP_URL = + # If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and -# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated -# that can be used as input for Qt's qhelpgenerator to generate a -# Qt Compressed Help (.qch) of the generated HTML documentation. +# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that +# can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help +# (.qch) of the generated HTML documentation. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. GENERATE_QHP = NO -# If the QHG_LOCATION tag is specified, the QCH_FILE tag can -# be used to specify the file name of the resulting .qch file. -# The path specified is relative to the HTML output folder. +# If the QHG_LOCATION tag is specified, the QCH_FILE tag can be used to specify +# the file name of the resulting .qch file. The path specified is relative to +# the HTML output folder. +# This tag requires that the tag GENERATE_QHP is set to YES. QCH_FILE = -# The QHP_NAMESPACE tag specifies the namespace to use when generating -# Qt Help Project output. For more information please see -# http://doc.trolltech.com/qthelpproject.html#namespace +# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help +# Project output. For more information please see Qt Help Project / Namespace +# (see: +# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#namespace). +# The default value is: org.doxygen.Project. +# This tag requires that the tag GENERATE_QHP is set to YES. QHP_NAMESPACE = org.doxygen.Project -# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating -# Qt Help Project output. For more information please see -# http://doc.trolltech.com/qthelpproject.html#virtual-folders +# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt +# Help Project output. For more information please see Qt Help Project / Virtual +# Folders (see: +# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#virtual-folders). +# The default value is: doc. +# This tag requires that the tag GENERATE_QHP is set to YES. QHP_VIRTUAL_FOLDER = doc -# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to -# add. For more information please see -# http://doc.trolltech.com/qthelpproject.html#custom-filters +# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom +# filter to add. For more information please see Qt Help Project / Custom +# Filters (see: +# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom-filters). +# This tag requires that the tag GENERATE_QHP is set to YES. QHP_CUST_FILTER_NAME = -# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the -# custom filter to add. For more information please see -# -# Qt Help Project / Custom Filters. +# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the +# custom filter to add. For more information please see Qt Help Project / Custom +# Filters (see: +# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom-filters). +# This tag requires that the tag GENERATE_QHP is set to YES. QHP_CUST_FILTER_ATTRS = # The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this -# project's -# filter section matches. -# -# Qt Help Project / Filter Attributes. +# project's filter section matches. Qt Help Project / Filter Attributes (see: +# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#filter-attributes). +# This tag requires that the tag GENERATE_QHP is set to YES. QHP_SECT_FILTER_ATTRS = -# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can -# be used to specify the location of Qt's qhelpgenerator. -# If non-empty doxygen will try to run qhelpgenerator on the generated -# .qhp file. +# The QHG_LOCATION tag can be used to specify the location (absolute path +# including file name) of Qt's qhelpgenerator. If non-empty doxygen will try to +# run qhelpgenerator on the generated .qhp file. +# This tag requires that the tag GENERATE_QHP is set to YES. QHG_LOCATION = -# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files -# will be generated, which together with the HTML files, form an Eclipse help -# plugin. To install this plugin and make it available under the help contents -# menu in Eclipse, the contents of the directory containing the HTML and XML -# files needs to be copied into the plugins directory of eclipse. The name of -# the directory within the plugins directory should be the same as -# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before -# the help appears. +# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be +# generated, together with the HTML files, they form an Eclipse help plugin. To +# install this plugin and make it available under the help contents menu in +# Eclipse, the contents of the directory containing the HTML and XML files needs +# to be copied into the plugins directory of eclipse. The name of the directory +# within the plugins directory should be the same as the ECLIPSE_DOC_ID value. +# After copying Eclipse needs to be restarted before the help appears. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. GENERATE_ECLIPSEHELP = NO -# A unique identifier for the eclipse help plugin. When installing the plugin -# the directory name containing the HTML and XML files should also have -# this name. +# A unique identifier for the Eclipse help plugin. When installing the plugin +# the directory name containing the HTML and XML files should also have this +# name. Each documentation set should have its own identifier. +# The default value is: org.doxygen.Project. +# This tag requires that the tag GENERATE_ECLIPSEHELP is set to YES. ECLIPSE_DOC_ID = org.doxygen.Project -# The DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) -# at top of each HTML page. The value NO (the default) enables the index and -# the value YES disables it. Since the tabs have the same information as the -# navigation tree you can set this option to NO if you already set -# GENERATE_TREEVIEW to YES. +# If you want full control over the layout of the generated HTML pages it might +# be necessary to disable the index and replace it with your own. The +# DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) at top +# of each HTML page. A value of NO enables the index and the value YES disables +# it. Since the tabs in the index contain the same information as the navigation +# tree, you can set this option to YES if you also set GENERATE_TREEVIEW to YES. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. DISABLE_INDEX = NO # The GENERATE_TREEVIEW tag is used to specify whether a tree-like index -# structure should be generated to display hierarchical information. -# If the tag value is set to YES, a side panel will be generated -# containing a tree-like index structure (just like the one that -# is generated for HTML Help). For this to work a browser that supports -# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser). -# Windows users are probably better off using the HTML help feature. -# Since the tree basically has the same information as the tab index you -# could consider to set DISABLE_INDEX to NO when enabling this option. +# structure should be generated to display hierarchical information. If the tag +# value is set to YES, a side panel will be generated containing a tree-like +# index structure (just like the one that is generated for HTML Help). For this +# to work a browser that supports JavaScript, DHTML, CSS and frames is required +# (i.e. any modern browser). Windows users are probably better off using the +# HTML help feature. Via custom style sheets (see HTML_EXTRA_STYLESHEET) one can +# further fine tune the look of the index (see "Fine-tuning the output"). As an +# example, the default style sheet generated by doxygen has an example that +# shows how to put an image at the root of the tree instead of the PROJECT_NAME. +# Since the tree basically has the same information as the tab index, you could +# consider setting DISABLE_INDEX to YES when enabling this option. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. GENERATE_TREEVIEW = NO -# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values -# (range [0,1..20]) that doxygen will group on one line in the generated HTML -# documentation. Note that a value of 0 will completely suppress the enum -# values from appearing in the overview section. +# When both GENERATE_TREEVIEW and DISABLE_INDEX are set to YES, then the +# FULL_SIDEBAR option determines if the side bar is limited to only the treeview +# area (value NO) or if it should extend to the full height of the window (value +# YES). Setting this to YES gives a layout similar to +# https://docs.readthedocs.io with more room for contents, but less room for the +# project logo, title, and description. If either GENERATE_TREEVIEW or +# DISABLE_INDEX is set to NO, this option has no effect. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +FULL_SIDEBAR = NO + +# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that +# doxygen will group on one line in the generated HTML documentation. +# +# Note that a value of 0 will completely suppress the enum values from appearing +# in the overview section. +# Minimum value: 0, maximum value: 20, default value: 4. +# This tag requires that the tag GENERATE_HTML is set to YES. ENUM_VALUES_PER_LINE = 4 -# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be -# used to set the initial width (in pixels) of the frame in which the tree -# is shown. +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be used +# to set the initial width (in pixels) of the frame in which the tree is shown. +# Minimum value: 0, maximum value: 1500, default value: 250. +# This tag requires that the tag GENERATE_HTML is set to YES. -TREEVIEW_WIDTH = 300 +TREEVIEW_WIDTH = 250 -# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open -# links to external symbols imported via tag files in a separate window. +# If the EXT_LINKS_IN_WINDOW option is set to YES, doxygen will open links to +# external symbols imported via tag files in a separate window. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. EXT_LINKS_IN_WINDOW = NO -# Use this tag to change the font size of Latex formulas included -# as images in the HTML documentation. The default is 10. Note that -# when you change the font size after a successful doxygen run you need -# to manually remove any form_*.png images from the HTML output directory -# to force them to be regenerated. +# If the OBFUSCATE_EMAILS tag is set to YES, doxygen will obfuscate email +# addresses. +# The default value is: YES. +# This tag requires that the tag GENERATE_HTML is set to YES. + +OBFUSCATE_EMAILS = YES + +# If the HTML_FORMULA_FORMAT option is set to svg, doxygen will use the pdf2svg +# tool (see https://github.com/dawbarton/pdf2svg) or inkscape (see +# https://inkscape.org) to generate formulas as SVG images instead of PNGs for +# the HTML output. These images will generally look nicer at scaled resolutions. +# Possible values are: png (the default) and svg (looks nicer but requires the +# pdf2svg or inkscape tool). +# The default value is: png. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_FORMULA_FORMAT = png + +# Use this tag to change the font size of LaTeX formulas included as images in +# the HTML documentation. When you change the font size after a successful +# doxygen run you need to manually remove any form_*.png images from the HTML +# output directory to force them to be regenerated. +# Minimum value: 8, maximum value: 50, default value: 10. +# This tag requires that the tag GENERATE_HTML is set to YES. FORMULA_FONTSIZE = 10 -# Use the FORMULA_TRANPARENT tag to determine whether or not the images -# generated for formulas are transparent PNGs. Transparent PNGs are -# not supported properly for IE 6.0, but are supported on all modern browsers. -# Note that when changing this option you need to delete any form_*.png files -# in the HTML output before the changes have effect. +# The FORMULA_MACROFILE can contain LaTeX \newcommand and \renewcommand commands +# to create new LaTeX commands to be used in formulas as building blocks. See +# the section "Including formulas" for details. -FORMULA_TRANSPARENT = YES +FORMULA_MACROFILE = -# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax -# (see http://www.mathjax.org) which uses client side Javascript for the -# rendering instead of using prerendered bitmaps. Use this if you do not -# have LaTeX installed or if you want to formulas look prettier in the HTML -# output. When enabled you may also need to install MathJax separately and -# configure the path to it using the MATHJAX_RELPATH option. +# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see +# https://www.mathjax.org) which uses client side JavaScript for the rendering +# instead of using pre-rendered bitmaps. Use this if you do not have LaTeX +# installed or if you want to formulas look prettier in the HTML output. When +# enabled you may also need to install MathJax separately and configure the path +# to it using the MATHJAX_RELPATH option. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. USE_MATHJAX = NO -# When MathJax is enabled you can set the default output format to be used for -# thA MathJax output. Supported types are HTML-CSS, NativeMML (i.e. MathML) and -# SVG. The default value is HTML-CSS, which is slower, but has the best -# compatibility. +# With MATHJAX_VERSION it is possible to specify the MathJax version to be used. +# Note that the different versions of MathJax have different requirements with +# regards to the different settings, so it is possible that also other MathJax +# settings have to be changed when switching between the different MathJax +# versions. +# Possible values are: MathJax_2 and MathJax_3. +# The default value is: MathJax_2. +# This tag requires that the tag USE_MATHJAX is set to YES. -MATHJAX_FORMAT = HTML-CSS +MATHJAX_VERSION = MathJax_2 -# When MathJax is enabled you need to specify the location relative to the -# HTML output directory using the MATHJAX_RELPATH option. The destination -# directory should contain the MathJax.js script. For instance, if the mathjax -# directory is located at the same level as the HTML output directory, then -# MATHJAX_RELPATH should be ../mathjax. The default value points to -# the MathJax Content Delivery Network so you can quickly see the result without -# installing MathJax. -# However, it is strongly recommended to install a local -# copy of MathJax from http://www.mathjax.org before deployment. +# When MathJax is enabled you can set the default output format to be used for +# the MathJax output. For more details about the output format see MathJax +# version 2 (see: +# http://docs.mathjax.org/en/v2.7-latest/output.html) and MathJax version 3 +# (see: +# http://docs.mathjax.org/en/latest/web/components/output.html). +# Possible values are: HTML-CSS (which is slower, but has the best +# compatibility. This is the name for Mathjax version 2, for MathJax version 3 +# this will be translated into chtml), NativeMML (i.e. MathML. Only supported +# for NathJax 2. For MathJax version 3 chtml will be used instead.), chtml (This +# is the name for Mathjax version 3, for MathJax version 2 this will be +# translated into HTML-CSS) and SVG. +# The default value is: HTML-CSS. +# This tag requires that the tag USE_MATHJAX is set to YES. -MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest +MATHJAX_FORMAT = HTML-CSS -# The MATHJAX_EXTENSIONS tag can be used to specify one or MathJax extension -# names that should be enabled during MathJax rendering. +# When MathJax is enabled you need to specify the location relative to the HTML +# output directory using the MATHJAX_RELPATH option. The destination directory +# should contain the MathJax.js script. For instance, if the mathjax directory +# is located at the same level as the HTML output directory, then +# MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax +# Content Delivery Network so you can quickly see the result without installing +# MathJax. However, it is strongly recommended to install a local copy of +# MathJax from https://www.mathjax.org before deployment. The default value is: +# - in case of MathJax version 2: https://cdn.jsdelivr.net/npm/mathjax@2 +# - in case of MathJax version 3: https://cdn.jsdelivr.net/npm/mathjax@3 +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_RELPATH = + +# The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax +# extension names that should be enabled during MathJax rendering. For example +# for MathJax version 2 (see +# https://docs.mathjax.org/en/v2.7-latest/tex.html#tex-and-latex-extensions): +# MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols +# For example for MathJax version 3 (see +# http://docs.mathjax.org/en/latest/input/tex/extensions/index.html): +# MATHJAX_EXTENSIONS = ams +# This tag requires that the tag USE_MATHJAX is set to YES. MATHJAX_EXTENSIONS = -# When the SEARCHENGINE tag is enabled doxygen will generate a search box -# for the HTML output. The underlying search engine uses javascript -# and DHTML and should work on any modern browser. Note that when using -# HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets -# (GENERATE_DOCSET) there is already a search function so this one should -# typically be disabled. For large projects the javascript based search engine -# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution. +# The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces +# of code that will be used on startup of the MathJax code. See the MathJax site +# (see: +# http://docs.mathjax.org/en/v2.7-latest/output.html) for more details. For an +# example see the documentation. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_CODEFILE = + +# When the SEARCHENGINE tag is enabled doxygen will generate a search box for +# the HTML output. The underlying search engine uses javascript and DHTML and +# should work on any modern browser. Note that when using HTML help +# (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET) +# there is already a search function so this one should typically be disabled. +# For large projects the javascript based search engine can be slow, then +# enabling SERVER_BASED_SEARCH may provide a better solution. It is possible to +# search using the keyboard; to jump to the search box use + S +# (what the is depends on the OS and browser, but it is typically +# , /