diff --git a/.github/workflows/create-test-plan.py b/.github/workflows/create-test-plan.py index 522ea54a..4751383b 100755 --- a/.github/workflows/create-test-plan.py +++ b/.github/workflows/create-test-plan.py @@ -95,7 +95,6 @@ class JobSpec: msvc_project: Optional[str] = None msvc_arch: Optional[MsvcArch] = None clang_cl: bool = False - uwp: bool = False gdk: bool = False vita_gles: Optional[VitaGLES] = None @@ -112,7 +111,6 @@ JOB_SPECS = { "msvc-clang-x86": JobSpec(name="Windows (MSVC, clang-cl x86)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-clang-cl-x86", msvc_arch=MsvcArch.X86, clang_cl=True, ), "msvc-arm32": JobSpec(name="Windows (MSVC, ARM)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-VC-arm32", msvc_arch=MsvcArch.Arm32, ), "msvc-arm64": JobSpec(name="Windows (MSVC, ARM64)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-VC-arm64", msvc_arch=MsvcArch.Arm64, ), - "msvc-uwp-x64": JobSpec(name="UWP (MSVC, x64)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-VC-UWP", msvc_arch=MsvcArch.X64, msvc_project="VisualC-WinRT/SDL-UWP.sln", uwp=True, ), "msvc-gdk-x64": JobSpec(name="GDK (MSVC, x64)", os=JobOs.WindowsLatest, platform=SdlPlatform.Msvc, artifact="SDL-VC-GDK", msvc_arch=MsvcArch.X64, msvc_project="VisualC-GDK/SDL.sln", gdk=True, no_cmake=True, ), "ubuntu-20.04": JobSpec(name="Ubuntu 20.04", os=JobOs.Ubuntu20_04, platform=SdlPlatform.Linux, artifact="SDL-ubuntu20.04", ), "ubuntu-22.04": JobSpec(name="Ubuntu 22.04", os=JobOs.Ubuntu22_04, platform=SdlPlatform.Linux, artifact="SDL-ubuntu22.04", ), @@ -358,10 +356,9 @@ def spec_to_job(spec: JobSpec, key: str, trackmem_symbol_names: bool) -> JobDeta "-DCMAKE_EXE_LINKER_FLAGS=-DEBUG", "-DCMAKE_SHARED_LINKER_FLAGS=-DEBUG", )) - if spec.uwp: - job.cmake_arguments.append("'-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded$<$:Debug>DLL'") - else: - job.cmake_arguments.append("'-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded$<$:Debug>'") + + job.cmake_arguments.append("'-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded$<$:Debug>'") + if spec.clang_cl: job.cmake_arguments.extend(( "-DCMAKE_C_COMPILER=clang-cl", @@ -398,14 +395,7 @@ def spec_to_job(spec: JobSpec, key: str, trackmem_symbol_names: bool) -> JobDeta case MsvcArch.Arm64: job.msvc_vcvars = "x64_arm64" job.run_tests = False - if spec.uwp: - job.build_tests = False - job.cmake_arguments.extend(( - "-DCMAKE_SYSTEM_NAME=WindowsStore", - "-DCMAKE_SYSTEM_VERSION=10.0", - )) - job.msvc_project_flags.append("-p:WindowsTargetPlatformVersion=10.0.17763.0") - elif spec.gdk: + if spec.gdk: job.setup_gdk_folder = "VisualC-GDK" else: match spec.msvc_arch: diff --git a/Android.mk b/Android.mk index 31bc23bc..b352cb31 100644 --- a/Android.mk +++ b/Android.mk @@ -30,8 +30,8 @@ LOCAL_SRC_FILES := \ $(wildcard $(LOCAL_PATH)/src/core/*.c) \ $(wildcard $(LOCAL_PATH)/src/core/android/*.c) \ $(wildcard $(LOCAL_PATH)/src/cpuinfo/*.c) \ - $(LOCAL_PATH)/src/dialog/SDL_dialog_utils.c \ - $(LOCAL_PATH)/src/dialog/android/SDL_androiddialog.c \ + $(LOCAL_PATH)/src/dialog/SDL_dialog_utils.c \ + $(LOCAL_PATH)/src/dialog/android/SDL_androiddialog.c \ $(wildcard $(LOCAL_PATH)/src/dynapi/*.c) \ $(wildcard $(LOCAL_PATH)/src/events/*.c) \ $(wildcard $(LOCAL_PATH)/src/file/*.c) \ @@ -46,6 +46,7 @@ LOCAL_SRC_FILES := \ $(wildcard $(LOCAL_PATH)/src/joystick/android/*.c) \ $(wildcard $(LOCAL_PATH)/src/joystick/dummy/*.c) \ $(wildcard $(LOCAL_PATH)/src/joystick/hidapi/*.c) \ + $(wildcard $(LOCAL_PATH)/src/joystick/steam/*.c) \ $(wildcard $(LOCAL_PATH)/src/joystick/virtual/*.c) \ $(wildcard $(LOCAL_PATH)/src/loadso/dlopen/*.c) \ $(wildcard $(LOCAL_PATH)/src/locale/*.c) \ @@ -56,6 +57,8 @@ LOCAL_SRC_FILES := \ $(wildcard $(LOCAL_PATH)/src/misc/android/*.c) \ $(wildcard $(LOCAL_PATH)/src/power/*.c) \ $(wildcard $(LOCAL_PATH)/src/power/android/*.c) \ + $(wildcard $(LOCAL_PATH)/src/process/*.c) \ + $(wildcard $(LOCAL_PATH)/src/process/dummy/*.c) \ $(wildcard $(LOCAL_PATH)/src/filesystem/*.c) \ $(wildcard $(LOCAL_PATH)/src/filesystem/android/*.c) \ $(wildcard $(LOCAL_PATH)/src/filesystem/posix/*.c) \ @@ -65,6 +68,8 @@ LOCAL_SRC_FILES := \ $(wildcard $(LOCAL_PATH)/src/render/*.c) \ $(wildcard $(LOCAL_PATH)/src/render/*/*.c) \ $(wildcard $(LOCAL_PATH)/src/stdlib/*.c) \ + $(wildcard $(LOCAL_PATH)/src/storage/*.c) \ + $(wildcard $(LOCAL_PATH)/src/storage/generic/*.c) \ $(wildcard $(LOCAL_PATH)/src/thread/*.c) \ $(wildcard $(LOCAL_PATH)/src/thread/pthread/*.c) \ $(wildcard $(LOCAL_PATH)/src/time/*.c) \ @@ -96,7 +101,7 @@ LOCAL_CXXFLAGS += -std=gnu++11 LOCAL_LDLIBS := -ldl -lGLESv1_CM -lGLESv2 -lOpenSLES -llog -landroid -LOCAL_LDFLAGS := -Wl,--no-undefined -Wl,--version-script=$(LOCAL_PATH)/src/dynapi/SDL_dynapi.sym +LOCAL_LDFLAGS := -Wl,--no-undefined -Wl,--no-undefined-version -Wl,--version-script=$(LOCAL_PATH)/src/dynapi/SDL_dynapi.sym ifeq ($(NDK_DEBUG),1) cmd-strip := diff --git a/CMakeLists.txt b/CMakeLists.txt index 05411c9a..01cc9746 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -361,7 +361,7 @@ cmake_dependent_option(SDL_STATIC "Build a static version of the library" ${SDL_ option(SDL_TEST_LIBRARY "Build the SDL3_test library" ON) dep_option(SDL_TESTS "Build the test directory" OFF SDL_TEST_LIBRARY OFF) -dep_option(SDL_INSTALL_TESTS "Install test-cases" OFF "NOT SDL_DISABLE_INSTALL;NOT SDL_FRAMEWORK;NOT WINDOWS_STORE" OFF) +dep_option(SDL_INSTALL_TESTS "Install test-cases" OFF "NOT SDL_DISABLE_INSTALL;NOT SDL_FRAMEWORK" OFF) dep_option(SDL_TESTS_LINK_SHARED "link tests to shared SDL library" "${SDL_SHARED}" "SDL_SHARED;SDL_STATIC" "${SDL_SHARED}") set(SDL_TESTS_TIMEOUT_MULTIPLIER "1" CACHE STRING "Timeout multiplier to account for really slow machines") @@ -428,11 +428,6 @@ if (LIBC_IS_GLIBC AND CMAKE_SIZEOF_VOID_P EQUAL 4) sdl_compile_definitions(PRIVATE "_TIME_BITS=64") endif() -if(WINDOWS_STORE) - sdl_compile_definitions(PRIVATE "SDL_BUILDING_WINRT=1" "WINAPI_FAMILY=WINAPI_FAMILY_APP") - sdl_compile_options(PRIVATE "$<$:/ZW>" "$<$:-EHsc>") -endif() - check_linker_supports_version_file(HAVE_WL_VERSION_SCRIPT) if(HAVE_WL_VERSION_SCRIPT) sdl_shared_link_options("-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/src/dynapi/SDL_dynapi.sym") @@ -979,7 +974,7 @@ if(SDL_LIBC) pow powf putenv realloc rindex round roundf scalbn scalbnf setenv sin sinf sqr sqrt sqrtf sscanf strchr - strcmp strlcat strlcpy strlen strncmp strnlen + strcmp strlcat strlcpy strlen strncmp strnlen strpbrk strrchr strstr strnstr strtod strtok_r strtol strtoll strtoul strtoull tan tanf trunc truncf unsetenv @@ -1833,15 +1828,6 @@ elseif(WINDOWS) sdl_glob_sources("${SDL3_SOURCE_DIR}/src/core/windows/*.c") sdl_glob_sources("${SDL3_SOURCE_DIR}/src/main/windows/*.c") - if(WINDOWS_STORE) - enable_language(CXX) - sdl_glob_sources( - "${SDL3_SOURCE_DIR}/src/core/winrt/*.c" - "${SDL3_SOURCE_DIR}/src/core/winrt/*.cpp" - "${SDL3_SOURCE_DIR}/src/main/winrt/*.cpp" - ) - endif() - if(TARGET SDL3-shared AND MSVC AND NOT SDL_LIBC) # Prevent codegen that would use the VC runtime libraries. target_compile_options(SDL3-shared PRIVATE $<$:/GS-> $<$:/Gs1048576>) @@ -1850,11 +1836,8 @@ elseif(WINDOWS) endif() endif() - if(WINDOWS_STORE) - sdl_glob_sources("${SDL3_SOURCE_DIR}/src/misc/winrt/*.cpp") - else() - sdl_glob_sources("${SDL3_SOURCE_DIR}/src/misc/windows/*.c") - endif() + sdl_glob_sources("${SDL3_SOURCE_DIR}/src/misc/windows/*.c") + set(HAVE_SDL_MISC TRUE) # Check for DirectX @@ -1875,7 +1858,7 @@ elseif(WINDOWS) check_include_file(ddraw.h HAVE_DDRAW_H) check_include_file(dsound.h HAVE_DSOUND_H) check_include_file(dinput.h HAVE_DINPUT_H) - if(WINDOWS_STORE OR SDL_CPU_ARM32) + if(SDL_CPU_ARM32) # !!! FIXME: this should probably check if we're !(x86 or x86-64) instead of arm. set(HAVE_DINPUT_H 0) endif() check_include_file(dxgi.h HAVE_DXGI_H) @@ -1932,7 +1915,7 @@ elseif(WINDOWS) ) if(SDL_AUDIO) - if(HAVE_DSOUND_H AND NOT WINDOWS_STORE) + if(HAVE_DSOUND_H) set(SDL_AUDIO_DRIVER_DSOUND 1) sdl_glob_sources("${SDL3_SOURCE_DIR}/src/audio/directsound/*.c") set(HAVE_SDL_AUDIO TRUE) @@ -1942,27 +1925,15 @@ elseif(WINDOWS) set(SDL_AUDIO_DRIVER_WASAPI 1) set(HAVE_WASAPI TRUE) sdl_glob_sources("${SDL3_SOURCE_DIR}/src/audio/wasapi/*.c") - if(WINDOWS_STORE) - sdl_sources("${SDL3_SOURCE_DIR}/src/audio/wasapi/SDL_wasapi_winrt.cpp") - endif() set(HAVE_SDL_AUDIO TRUE) endif() endif() if(SDL_VIDEO) - if(WINDOWS_STORE) - set(SDL_VIDEO_DRIVER_WINRT 1) - sdl_glob_sources( - "${SDL3_SOURCE_DIR}/src/video/winrt/*.c" - "${SDL3_SOURCE_DIR}/src/video/winrt/*.cpp" - "${SDL3_SOURCE_DIR}/src/render/direct3d11/*.cpp" - ) - else() - set(SDL_VIDEO_DRIVER_WINDOWS 1) - sdl_glob_sources("${SDL3_SOURCE_DIR}/src/video/windows/*.c") - endif() + set(SDL_VIDEO_DRIVER_WINDOWS 1) + sdl_glob_sources("${SDL3_SOURCE_DIR}/src/video/windows/*.c") - if(SDL_RENDER_D3D AND HAVE_D3D9_H AND NOT WINDOWS_STORE) + if(SDL_RENDER_D3D AND HAVE_D3D9_H) set(SDL_VIDEO_RENDER_D3D 1) set(HAVE_RENDER_D3D TRUE) endif() @@ -1970,7 +1941,7 @@ elseif(WINDOWS) set(SDL_VIDEO_RENDER_D3D11 1) set(HAVE_RENDER_D3D11 TRUE) endif() - if(SDL_RENDER_D3D12 AND NOT WINDOWS_STORE) + if(SDL_RENDER_D3D12) set(SDL_VIDEO_RENDER_D3D12 1) set(HAVE_RENDER_D3D12 TRUE) endif() @@ -1980,60 +1951,36 @@ elseif(WINDOWS) set(SDL_THREAD_GENERIC_COND_SUFFIX 1) set(SDL_THREAD_GENERIC_RWLOCK_SUFFIX 1) set(SDL_THREAD_WINDOWS 1) - if(WINDOWS_STORE) - sdl_sources( - "${SDL3_SOURCE_DIR}/src/thread/stdcpp/SDL_syscond.cpp" - "${SDL3_SOURCE_DIR}/src/thread/stdcpp/SDL_sysmutex.cpp" - "${SDL3_SOURCE_DIR}/src/thread/stdcpp/SDL_sysrwlock.cpp" - "${SDL3_SOURCE_DIR}/src/thread/stdcpp/SDL_systhread.cpp" - "${SDL3_SOURCE_DIR}/src/thread/generic/SDL_syssem.c" - ) - else() - sdl_sources( - "${SDL3_SOURCE_DIR}/src/thread/generic/SDL_syscond.c" - "${SDL3_SOURCE_DIR}/src/thread/generic/SDL_sysrwlock.c" - "${SDL3_SOURCE_DIR}/src/thread/windows/SDL_syscond_cv.c" - "${SDL3_SOURCE_DIR}/src/thread/windows/SDL_sysmutex.c" - "${SDL3_SOURCE_DIR}/src/thread/windows/SDL_sysrwlock_srw.c" - "${SDL3_SOURCE_DIR}/src/thread/windows/SDL_syssem.c" - "${SDL3_SOURCE_DIR}/src/thread/windows/SDL_systhread.c" - "${SDL3_SOURCE_DIR}/src/thread/windows/SDL_systls.c" - ) - endif() + sdl_sources( + "${SDL3_SOURCE_DIR}/src/thread/generic/SDL_syscond.c" + "${SDL3_SOURCE_DIR}/src/thread/generic/SDL_sysrwlock.c" + "${SDL3_SOURCE_DIR}/src/thread/windows/SDL_syscond_cv.c" + "${SDL3_SOURCE_DIR}/src/thread/windows/SDL_sysmutex.c" + "${SDL3_SOURCE_DIR}/src/thread/windows/SDL_sysrwlock_srw.c" + "${SDL3_SOURCE_DIR}/src/thread/windows/SDL_syssem.c" + "${SDL3_SOURCE_DIR}/src/thread/windows/SDL_systhread.c" + "${SDL3_SOURCE_DIR}/src/thread/windows/SDL_systls.c" + ) set(HAVE_SDL_THREADS TRUE) - if(SDL_SENSOR AND HAVE_SENSORSAPI_H AND NOT WINDOWS_STORE) + if(SDL_SENSOR AND HAVE_SENSORSAPI_H) set(SDL_SENSOR_WINDOWS 1) set(HAVE_SDL_SENSORS TRUE) sdl_glob_sources("${SDL3_SOURCE_DIR}/src/sensor/windows/*.c") endif() if(SDL_POWER) - if(WINDOWS_STORE) - set(SDL_POWER_WINRT 1) - sdl_sources("${SDL3_SOURCE_DIR}/src/power/winrt/SDL_syspower.cpp") - else() - set(SDL_POWER_WINDOWS 1) - sdl_sources("${SDL3_SOURCE_DIR}/src/power/windows/SDL_syspower.c") - set(HAVE_SDL_POWER TRUE) - endif() + set(SDL_POWER_WINDOWS 1) + sdl_sources("${SDL3_SOURCE_DIR}/src/power/windows/SDL_syspower.c") + set(HAVE_SDL_POWER TRUE) endif() - if(WINDOWS_STORE) - sdl_glob_sources("${SDL3_SOURCE_DIR}/src/locale/winrt/*.c") - else() - sdl_glob_sources("${SDL3_SOURCE_DIR}/src/locale/windows/*.c") - endif() + sdl_glob_sources("${SDL3_SOURCE_DIR}/src/locale/windows/*.c") set(HAVE_SDL_LOCALE TRUE) set(SDL_FILESYSTEM_WINDOWS 1) - if(WINDOWS_STORE) - sdl_glob_sources("${SDL3_SOURCE_DIR}/src/filesystem/winrt/*.cpp") - sdl_sources("${SDL3_SOURCE_DIR}/src/filesystem/windows/SDL_sysfsops.c") - else() - sdl_glob_sources("${SDL3_SOURCE_DIR}/src/filesystem/windows/*.c") - endif() + sdl_glob_sources("${SDL3_SOURCE_DIR}/src/filesystem/windows/*.c") set(HAVE_SDL_FILESYSTEM TRUE) set(SDL_FSOPS_WINDOWS 1) @@ -2041,27 +1988,12 @@ elseif(WINDOWS) set(SDL_STORAGE_GENERIC 1) sdl_glob_sources("${SDL3_SOURCE_DIR}/src/storage/generic/*.c") - if(NOT WINDOWS_STORE) - set(SDL_STORAGE_STEAM 1) - sdl_glob_sources("${SDL3_SOURCE_DIR}/src/storage/steam/*.c") - endif() + set(SDL_STORAGE_STEAM 1) + sdl_glob_sources("${SDL3_SOURCE_DIR}/src/storage/steam/*.c") set(HAVE_SDL_STORAGE 1) # Libraries for Win32 native and MinGW - if(NOT WINDOWS_STORE) - sdl_link_dependency(base LIBS kernel32 user32 gdi32 winmm imm32 ole32 oleaut32 version uuid advapi32 setupapi shell32) - endif() - - if(WINDOWS_STORE) - sdl_link_dependency(windows - LIBS - vccorlib$<$:d>.lib - msvcrt$<$:d>.lib - LINK_OPTIONS - /nodefaultlib:vccorlib$<$:d> - /nodefaultlib:msvcrt$<$:d> - ) - endif() + sdl_link_dependency(base LIBS kernel32 user32 gdi32 winmm imm32 ole32 oleaut32 version uuid advapi32 setupapi shell32) set(SDL_TIME_WINDOWS 1) sdl_glob_sources("${SDL3_SOURCE_DIR}/src/time/windows/*.c") @@ -2078,7 +2010,7 @@ elseif(WINDOWS) sdl_glob_sources("${SDL3_SOURCE_DIR}/src/core/windows/*.c") if(SDL_VIDEO) - if(SDL_OPENGL AND NOT WINDOWS_STORE) + if(SDL_OPENGL) set(SDL_VIDEO_OPENGL 1) set(SDL_VIDEO_OPENGL_WGL 1) set(SDL_VIDEO_RENDER_OGL 1) @@ -2109,18 +2041,14 @@ elseif(WINDOWS) if(SDL_JOYSTICK) sdl_glob_sources("${SDL3_SOURCE_DIR}/src/joystick/windows/*.c") - if(NOT WINDOWS_STORE) - set(SDL_JOYSTICK_RAWINPUT 1) - endif() + set(SDL_JOYSTICK_RAWINPUT 1) if(HAVE_DINPUT_H) set(SDL_JOYSTICK_DINPUT 1) sdl_link_dependency(joystick LIBS dinput8) endif() if(HAVE_XINPUT_H) - if(NOT WINDOWS_STORE) - set(SDL_JOYSTICK_XINPUT 1) - set(HAVE_XINPUT TRUE) - endif() + set(SDL_JOYSTICK_XINPUT 1) + set(HAVE_XINPUT TRUE) endif() if(HAVE_WINDOWS_GAMING_INPUT_H) set(SDL_JOYSTICK_WGI 1) @@ -2132,7 +2060,7 @@ elseif(WINDOWS) set(HAVE_SDL_JOYSTICK TRUE) if(SDL_HAPTIC) - if(HAVE_DINPUT_H AND NOT WINDOWS_STORE) + if(HAVE_DINPUT_H) sdl_glob_sources("${SDL3_SOURCE_DIR}/src/haptic/windows/*.c") set(SDL_HAPTIC_DINPUT 1) set(HAVE_SDL_HAPTIC TRUE) @@ -2141,7 +2069,7 @@ elseif(WINDOWS) endif() if(SDL_CAMERA) - if(HAVE_MFAPI_H AND NOT WINDOWS_STORE) + if(HAVE_MFAPI_H) set(HAVE_CAMERA TRUE) set(SDL_CAMERA_DRIVER_MEDIAFOUNDATION 1) sdl_glob_sources("${SDL3_SOURCE_DIR}/src/camera/mediafoundation/*.c") @@ -2922,7 +2850,7 @@ if (SDL_DIALOG) elseif(HAIKU) sdl_sources(${SDL3_SOURCE_DIR}/src/dialog/haiku/SDL_haikudialog.cc) set(HAVE_SDL_DIALOG TRUE) - elseif(WINDOWS AND NOT WINDOWS_STORE) + elseif(WINDOWS) sdl_sources(${SDL3_SOURCE_DIR}/src/dialog/windows/SDL_windowsdialog.c) set(HAVE_SDL_DIALOG TRUE) elseif(MACOS) @@ -2932,6 +2860,55 @@ if (SDL_DIALOG) endif() endif() +sdl_sources("${SDL3_SOURCE_DIR}/src/process/SDL_process.c") +if(WINDOWS) + sdl_glob_sources("${SDL3_SOURCE_DIR}/src/process/windows/*.c") + set(SDL_PROCESS_WINDOWS 1) + set(HAVE_SDL_PROCESS TRUE) +else() + check_c_source_compiles(" +#include +#include + +int main(void) +{ + int pipes[2]; + int pid; + + const char * args[] = { + \"/bin/false\", + NULL + }; + + const char * env[] = { NULL }; + + pipe(pipes); + + posix_spawnattr_t attr; + posix_spawn_file_actions_t fa; + + posix_spawnattr_init(&attr); + posix_spawn_file_actions_init(&fa); + + posix_spawn_file_actions_addclose(&fa, pipes[0]); + posix_spawn_file_actions_adddup2(&fa, pipes[1], STDOUT_FILENO); + + posix_spawn(&pid, args[0], &fa, &attr, (char * const *) args, (char * const *) env); + posix_spawnp(&pid, args[0], &fa, &attr, (char * const *) args, (char * const *) env); + + posix_spawn_file_actions_destroy(&fa); + posix_spawnattr_destroy(&attr); + + return 0; +} +" HAVE_POSIX_SPAWN) + if(HAVE_POSIX_SPAWN) + sdl_glob_sources("${SDL3_SOURCE_DIR}/src/process/posix/*.c") + set(SDL_PROCESS_POSIX 1) + set(HAVE_SDL_PROCESS TRUE) + endif() +endif() + # Platform-independent options if(SDL_VIDEO) @@ -3021,6 +2998,10 @@ if(NOT HAVE_SDL_DIALOG) set(SDL_DIALOG_DUMMY 1) sdl_sources(${SDL3_SOURCE_DIR}/src/dialog/dummy/SDL_dummydialog.c) endif() +if(NOT HAVE_SDL_PROCESS) + set(SDL_PROCESS_DUMMY 1) + sdl_glob_sources(${SDL3_SOURCE_DIR}/src/process/dummy/*.c) +endif() if(NOT HAVE_CAMERA) set(SDL_CAMERA_DRIVER_DUMMY 1) sdl_glob_sources("${SDL3_SOURCE_DIR}/src/camera/dummy/*.c") @@ -3316,7 +3297,7 @@ if(SDL_SHARED) ) endif() if(NOT SDL_LIBC) - if(MSVC AND (NOT MSVC_CLANG AND NOT WINDOWS_STORE)) + if(MSVC AND NOT MSVC_CLANG) # Don't try to link with the default set of libraries. # Note: The clang toolset for Visual Studio does not support /NODEFAULTLIB. target_link_options(SDL3-shared PRIVATE "/NODEFAULTLIB") diff --git a/VisualC-GDK/SDL/SDL.vcxproj b/VisualC-GDK/SDL/SDL.vcxproj index fa470003..c6ab1416 100644 --- a/VisualC-GDK/SDL/SDL.vcxproj +++ b/VisualC-GDK/SDL/SDL.vcxproj @@ -364,6 +364,8 @@ + + @@ -754,6 +756,9 @@ + + + CompileAsCpp @@ -765,6 +770,9 @@ + + + @@ -781,6 +789,8 @@ + + diff --git a/VisualC-GDK/SDL/SDL.vcxproj.filters b/VisualC-GDK/SDL/SDL.vcxproj.filters index 61caf6d2..017b9baf 100644 --- a/VisualC-GDK/SDL/SDL.vcxproj.filters +++ b/VisualC-GDK/SDL/SDL.vcxproj.filters @@ -126,6 +126,9 @@ + + + @@ -283,6 +286,8 @@ + + diff --git a/VisualC-GDK/tests/testgdk/src/testgdk.cpp b/VisualC-GDK/tests/testgdk/src/testgdk.cpp index 46301b2c..b3aa9ec8 100644 --- a/VisualC-GDK/tests/testgdk/src/testgdk.cpp +++ b/VisualC-GDK/tests/testgdk/src/testgdk.cpp @@ -35,8 +35,8 @@ extern "C" { static SDLTest_CommonState *state; static int num_sprites; static SDL_Texture **sprites; -static SDL_bool cycle_color; -static SDL_bool cycle_alpha; +static bool cycle_color; +static bool cycle_alpha; static int cycle_direction = 1; static int current_alpha = 0; static int current_color = 0; @@ -193,7 +193,7 @@ LoadSprite(const char *file) for (i = 0; i < state->num_windows; ++i) { /* This does the SDL_LoadBMP step repeatedly, but that's OK for test code. */ - sprites[i] = LoadTexture(state->renderers[i], file, SDL_TRUE, &sprite_w, &sprite_h); + sprites[i] = LoadTexture(state->renderers[i], file, true, &sprite_w, &sprite_h); if (!sprites[i]) { return -1; } @@ -371,10 +371,10 @@ main(int argc, char *argv[]) } } } else if (SDL_strcasecmp(argv[i], "--cyclecolor") == 0) { - cycle_color = SDL_TRUE; + cycle_color = true; consumed = 1; } else if (SDL_strcasecmp(argv[i], "--cyclealpha") == 0) { - cycle_alpha = SDL_TRUE; + cycle_alpha = true; consumed = 1; } else if (SDL_isdigit(*argv[i])) { num_sprites = SDL_atoi(argv[i]); diff --git a/VisualC-WinRT/SDL-UWP.sln b/VisualC-WinRT/SDL-UWP.sln deleted file mode 100644 index 86bd92de..00000000 --- a/VisualC-WinRT/SDL-UWP.sln +++ /dev/null @@ -1,69 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.33027.164 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDL3-UWP", "SDL-UWP.vcxproj", "{89E9B32E-A86A-47C3-A948-D2B1622925CE}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testdraw", "testdraw\testdraw.vcxproj", "{95943BBE-F378-4068-A3FD-DAE1B8309B6E}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|ARM = Debug|ARM - Debug|ARM64 = Debug|ARM64 - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 - Release|ARM = Release|ARM - Release|ARM64 = Release|ARM64 - Release|x64 = Release|x64 - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {89E9B32E-A86A-47C3-A948-D2B1622925CE}.Debug|ARM.ActiveCfg = Debug|ARM - {89E9B32E-A86A-47C3-A948-D2B1622925CE}.Debug|ARM.Build.0 = Debug|ARM - {89E9B32E-A86A-47C3-A948-D2B1622925CE}.Debug|ARM64.ActiveCfg = Debug|ARM64 - {89E9B32E-A86A-47C3-A948-D2B1622925CE}.Debug|ARM64.Build.0 = Debug|ARM64 - {89E9B32E-A86A-47C3-A948-D2B1622925CE}.Debug|x64.ActiveCfg = Debug|x64 - {89E9B32E-A86A-47C3-A948-D2B1622925CE}.Debug|x64.Build.0 = Debug|x64 - {89E9B32E-A86A-47C3-A948-D2B1622925CE}.Debug|x86.ActiveCfg = Debug|Win32 - {89E9B32E-A86A-47C3-A948-D2B1622925CE}.Debug|x86.Build.0 = Debug|Win32 - {89E9B32E-A86A-47C3-A948-D2B1622925CE}.Release|ARM.ActiveCfg = Release|ARM - {89E9B32E-A86A-47C3-A948-D2B1622925CE}.Release|ARM.Build.0 = Release|ARM - {89E9B32E-A86A-47C3-A948-D2B1622925CE}.Release|ARM64.ActiveCfg = Release|ARM64 - {89E9B32E-A86A-47C3-A948-D2B1622925CE}.Release|ARM64.Build.0 = Release|ARM64 - {89E9B32E-A86A-47C3-A948-D2B1622925CE}.Release|x64.ActiveCfg = Release|x64 - {89E9B32E-A86A-47C3-A948-D2B1622925CE}.Release|x64.Build.0 = Release|x64 - {89E9B32E-A86A-47C3-A948-D2B1622925CE}.Release|x86.ActiveCfg = Release|Win32 - {89E9B32E-A86A-47C3-A948-D2B1622925CE}.Release|x86.Build.0 = Release|Win32 - {95943BBE-F378-4068-A3FD-DAE1B8309B6E}.Debug|ARM.ActiveCfg = Debug|ARM - {95943BBE-F378-4068-A3FD-DAE1B8309B6E}.Debug|ARM.Build.0 = Debug|ARM - {95943BBE-F378-4068-A3FD-DAE1B8309B6E}.Debug|ARM.Deploy.0 = Debug|ARM - {95943BBE-F378-4068-A3FD-DAE1B8309B6E}.Debug|ARM64.ActiveCfg = Debug|ARM64 - {95943BBE-F378-4068-A3FD-DAE1B8309B6E}.Debug|ARM64.Build.0 = Debug|ARM64 - {95943BBE-F378-4068-A3FD-DAE1B8309B6E}.Debug|ARM64.Deploy.0 = Debug|ARM64 - {95943BBE-F378-4068-A3FD-DAE1B8309B6E}.Debug|x64.ActiveCfg = Debug|x64 - {95943BBE-F378-4068-A3FD-DAE1B8309B6E}.Debug|x64.Build.0 = Debug|x64 - {95943BBE-F378-4068-A3FD-DAE1B8309B6E}.Debug|x64.Deploy.0 = Debug|x64 - {95943BBE-F378-4068-A3FD-DAE1B8309B6E}.Debug|x86.ActiveCfg = Debug|Win32 - {95943BBE-F378-4068-A3FD-DAE1B8309B6E}.Debug|x86.Build.0 = Debug|Win32 - {95943BBE-F378-4068-A3FD-DAE1B8309B6E}.Debug|x86.Deploy.0 = Debug|Win32 - {95943BBE-F378-4068-A3FD-DAE1B8309B6E}.Release|ARM.ActiveCfg = Release|ARM - {95943BBE-F378-4068-A3FD-DAE1B8309B6E}.Release|ARM.Build.0 = Release|ARM - {95943BBE-F378-4068-A3FD-DAE1B8309B6E}.Release|ARM.Deploy.0 = Release|ARM - {95943BBE-F378-4068-A3FD-DAE1B8309B6E}.Release|ARM64.ActiveCfg = Release|ARM64 - {95943BBE-F378-4068-A3FD-DAE1B8309B6E}.Release|ARM64.Build.0 = Release|ARM64 - {95943BBE-F378-4068-A3FD-DAE1B8309B6E}.Release|ARM64.Deploy.0 = Release|ARM64 - {95943BBE-F378-4068-A3FD-DAE1B8309B6E}.Release|x64.ActiveCfg = Release|x64 - {95943BBE-F378-4068-A3FD-DAE1B8309B6E}.Release|x64.Build.0 = Release|x64 - {95943BBE-F378-4068-A3FD-DAE1B8309B6E}.Release|x64.Deploy.0 = Release|x64 - {95943BBE-F378-4068-A3FD-DAE1B8309B6E}.Release|x86.ActiveCfg = Release|Win32 - {95943BBE-F378-4068-A3FD-DAE1B8309B6E}.Release|x86.Build.0 = Release|Win32 - {95943BBE-F378-4068-A3FD-DAE1B8309B6E}.Release|x86.Deploy.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {30680F51-7BB9-41D0-A0D6-BC44A1557D87} - EndGlobalSection -EndGlobal diff --git a/VisualC-WinRT/SDL-UWP.vcxproj b/VisualC-WinRT/SDL-UWP.vcxproj deleted file mode 100644 index a7147715..00000000 --- a/VisualC-WinRT/SDL-UWP.vcxproj +++ /dev/null @@ -1,932 +0,0 @@ - - - - - Debug - ARM64 - - - Debug - ARM - - - Debug - Win32 - - - Debug - x64 - - - Release - ARM - - - Release - ARM64 - - - Release - Win32 - - - Release - x64 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - true - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - - - Create - Create - Create - Create - Create - Create - Create - Create - - - Create - $(IntDir)$(TargetName)_cpp.pch - Create - $(IntDir)$(TargetName)_cpp.pch - Create - $(IntDir)$(TargetName)_cpp.pch - Create - $(IntDir)$(TargetName)_cpp.pch - Create - $(IntDir)$(TargetName)_cpp.pch - Create - $(IntDir)$(TargetName)_cpp.pch - Create - $(IntDir)$(TargetName)_cpp.pch - Create - $(IntDir)$(TargetName)_cpp.pch - true - true - true - true - true - true - true - true - - - - - - - - true - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - - - true - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - - - true - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - - - - NotUsing - NotUsing - NotUsing - NotUsing - NotUsing - NotUsing - NotUsing - NotUsing - - - - - - - - - - - - - - - - true - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - true - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - - - - true - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - - - - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - true - true - true - true - true - true - true - true - - - - true - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - NotUsing - - - - - - - - - - - - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - true - true - true - true - true - true - true - true - - - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - true - true - true - true - true - true - true - true - - - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - true - true - true - true - true - true - true - true - - - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - true - true - true - true - true - true - true - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - true - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - - - true - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - - - true - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - - - true - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - - - true - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - - - true - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - - - true - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - - - true - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - $(IntDir)$(TargetName)_cpp.pch - - - - - - - {89e9b32e-a86a-47c3-a948-d2b1622925ce} - DynamicLibrary - SDL3-UWP - SDL3 - en-US - 14.0 - true - Windows Store - 8.2 - 10.0.16299.0 - 10.0.16299.0 - 10.0 - - - - DynamicLibrary - true - v142 - - - DynamicLibrary - true - v142 - - - DynamicLibrary - true - v142 - - - DynamicLibrary - true - v142 - - - DynamicLibrary - false - true - v142 - - - DynamicLibrary - false - true - v142 - - - DynamicLibrary - false - true - v142 - - - DynamicLibrary - false - true - v142 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - false - false - SDL3 - $(SolutionDir)/../src;$(IncludePath) - - - false - false - SDL3 - $(SolutionDir)/../src;$(IncludePath) - - - false - false - SDL3 - $(SolutionDir)/../src;$(IncludePath) - - - false - false - SDL3 - $(SolutionDir)/../src;$(IncludePath) - - - false - false - SDL3 - $(SolutionDir)/../src;$(IncludePath) - - - false - false - SDL3 - $(SolutionDir)/../src;$(IncludePath) - - - false - false - SDL3 - $(SolutionDir)/../src;$(IncludePath) - - - false - false - SDL3 - $(SolutionDir)/../src;$(IncludePath) - - - - Use - false - $(ProjectDir)\..\include;$(ProjectDir)\..\include\build_config;%(AdditionalIncludeDirectories) - DLL_EXPORT;_CRT_SECURE_NO_WARNINGS;SDL_BUILDING_WINRT=1;%(PreprocessorDefinitions) - SDL_internal.h - - - Console - false - false - /nodefaultlib:vccorlibd /nodefaultlib:msvcrtd vccorlibd.lib msvcrtd.lib %(AdditionalOptions) - - - - - Use - false - $(ProjectDir)\..\include;$(ProjectDir)\..\include\build_config;%(AdditionalIncludeDirectories) - DLL_EXPORT;_CRT_SECURE_NO_WARNINGS;SDL_BUILDING_WINRT=1;%(PreprocessorDefinitions) - SDL_internal.h - - - Console - false - false - /nodefaultlib:vccorlib /nodefaultlib:msvcrt vccorlib.lib msvcrt.lib %(AdditionalOptions) - - - - - Use - false - $(ProjectDir)\..\include;$(ProjectDir)\..\include\build_config;%(AdditionalIncludeDirectories) - DLL_EXPORT;_CRT_SECURE_NO_WARNINGS;SDL_BUILDING_WINRT=1;%(PreprocessorDefinitions) - SDL_internal.h - - - Console - false - false - /nodefaultlib:vccorlibd /nodefaultlib:msvcrtd vccorlibd.lib msvcrtd.lib %(AdditionalOptions) - - - - - Use - false - $(ProjectDir)\..\include;$(ProjectDir)\..\include\build_config;%(AdditionalIncludeDirectories) - DLL_EXPORT;_CRT_SECURE_NO_WARNINGS;SDL_BUILDING_WINRT=1;%(PreprocessorDefinitions) - SDL_internal.h - - - Console - false - false - /nodefaultlib:vccorlib /nodefaultlib:msvcrt vccorlib.lib msvcrt.lib %(AdditionalOptions) - - - - - Use - false - $(ProjectDir)\..\include;$(ProjectDir)\..\include\build_config;%(AdditionalIncludeDirectories) - DLL_EXPORT;_CRT_SECURE_NO_WARNINGS;SDL_BUILDING_WINRT=1;%(PreprocessorDefinitions) - SDL_internal.h - - - Console - false - false - /nodefaultlib:vccorlibd /nodefaultlib:msvcrtd vccorlibd.lib msvcrtd.lib %(AdditionalOptions) - - - - - Use - false - $(ProjectDir)\..\include;$(ProjectDir)\..\include\build_config;%(AdditionalIncludeDirectories) - DLL_EXPORT;_CRT_SECURE_NO_WARNINGS;SDL_BUILDING_WINRT=1;%(PreprocessorDefinitions) - SDL_internal.h - - - Console - false - false - /nodefaultlib:vccorlib /nodefaultlib:msvcrt vccorlib.lib msvcrt.lib %(AdditionalOptions) - - - - - Use - false - $(ProjectDir)\..\include;$(ProjectDir)\..\include\build_config;%(AdditionalIncludeDirectories) - DLL_EXPORT;_CRT_SECURE_NO_WARNINGS;SDL_BUILDING_WINRT=1;%(PreprocessorDefinitions) - SDL_internal.h - - - Console - false - false - /nodefaultlib:vccorlibd /nodefaultlib:msvcrtd vccorlibd.lib msvcrtd.lib %(AdditionalOptions) - - - - - Use - false - $(ProjectDir)\..\include;$(ProjectDir)\..\include\build_config;%(AdditionalIncludeDirectories) - DLL_EXPORT;_CRT_SECURE_NO_WARNINGS;SDL_BUILDING_WINRT=1;%(PreprocessorDefinitions) - SDL_internal.h - - - Console - false - false - /nodefaultlib:vccorlib /nodefaultlib:msvcrt vccorlib.lib msvcrt.lib %(AdditionalOptions) - - - - - $(TreatWarningsAsError) - - - - - - - diff --git a/VisualC-WinRT/SDL-UWP.vcxproj.filters b/VisualC-WinRT/SDL-UWP.vcxproj.filters deleted file mode 100644 index e57ee717..00000000 --- a/VisualC-WinRT/SDL-UWP.vcxproj.filters +++ /dev/null @@ -1,979 +0,0 @@ - - - - - {fa0ff2df-c3d6-498a-96f1-1f88e7ce0da3} - - - {68e1b30b-19ed-4612-93e4-6260c5a979e5} - - - {00004a2523fc69c7128c60648c860000} - - - {0000318d975e0a2867ab1d5727bf0000} - - - {00009e5236c2ac679fe0bc30beb90000} - - - {000031d805439b865ff4550d2f620000} - - - {00004389761f0ae646deb5a3d65f0000} - - - {0000bc587ef6c558d75ce2e620cb0000} - - - {0000948771d0040a6a55997a7f1e0000} - - - {0000012051ca8361c8e1013aee1d0000} - - - {0000c99bfadbbcb05a474a8472910000} - - - {00006680a11742e2b280c6453be80000} - - - - - Header Files - - - API Headers - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - camera - - - camera - - - filesystem - - - Header Files - - - Header Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - main - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Header Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Header Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - camera\dummy - - - camera - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - dialog - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - filesystem - - - filesystem\windows - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - main\generic - - - main - - - Source Files - - - main\winrt - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - time - - - time\windows - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Header Files - - - - - - Source Files - - - Source Files - - - Source Files - - - stdlib - - - Source Files - - - Source Files - - - diff --git a/VisualC-WinRT/testdraw/Assets/LockScreenLogo.scale-200.png b/VisualC-WinRT/testdraw/Assets/LockScreenLogo.scale-200.png deleted file mode 100644 index 735f57ad..00000000 Binary files a/VisualC-WinRT/testdraw/Assets/LockScreenLogo.scale-200.png and /dev/null differ diff --git a/VisualC-WinRT/testdraw/Assets/SplashScreen.scale-200.png b/VisualC-WinRT/testdraw/Assets/SplashScreen.scale-200.png deleted file mode 100644 index 023e7f1f..00000000 Binary files a/VisualC-WinRT/testdraw/Assets/SplashScreen.scale-200.png and /dev/null differ diff --git a/VisualC-WinRT/testdraw/Assets/Square150x150Logo.scale-200.png b/VisualC-WinRT/testdraw/Assets/Square150x150Logo.scale-200.png deleted file mode 100644 index af49fec1..00000000 Binary files a/VisualC-WinRT/testdraw/Assets/Square150x150Logo.scale-200.png and /dev/null differ diff --git a/VisualC-WinRT/testdraw/Assets/Square44x44Logo.scale-200.png b/VisualC-WinRT/testdraw/Assets/Square44x44Logo.scale-200.png deleted file mode 100644 index ce342a2e..00000000 Binary files a/VisualC-WinRT/testdraw/Assets/Square44x44Logo.scale-200.png and /dev/null differ diff --git a/VisualC-WinRT/testdraw/Assets/Square44x44Logo.targetsize-24_altform-unplated.png b/VisualC-WinRT/testdraw/Assets/Square44x44Logo.targetsize-24_altform-unplated.png deleted file mode 100644 index f6c02ce9..00000000 Binary files a/VisualC-WinRT/testdraw/Assets/Square44x44Logo.targetsize-24_altform-unplated.png and /dev/null differ diff --git a/VisualC-WinRT/testdraw/Assets/StoreLogo.png b/VisualC-WinRT/testdraw/Assets/StoreLogo.png deleted file mode 100644 index 7385b56c..00000000 Binary files a/VisualC-WinRT/testdraw/Assets/StoreLogo.png and /dev/null differ diff --git a/VisualC-WinRT/testdraw/Assets/Wide310x150Logo.scale-200.png b/VisualC-WinRT/testdraw/Assets/Wide310x150Logo.scale-200.png deleted file mode 100644 index 288995b3..00000000 Binary files a/VisualC-WinRT/testdraw/Assets/Wide310x150Logo.scale-200.png and /dev/null differ diff --git a/VisualC-WinRT/testdraw/Package.appxmanifest b/VisualC-WinRT/testdraw/Package.appxmanifest deleted file mode 100644 index 05a4c575..00000000 --- a/VisualC-WinRT/testdraw/Package.appxmanifest +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - - - - - testdraw - Daniel - Assets\StoreLogo.png - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/VisualC-WinRT/testdraw/testdraw.vcxproj b/VisualC-WinRT/testdraw/testdraw.vcxproj deleted file mode 100644 index 86d985db..00000000 --- a/VisualC-WinRT/testdraw/testdraw.vcxproj +++ /dev/null @@ -1,335 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - Debug - ARM - - - Release - ARM - - - Debug - ARM64 - - - Release - ARM64 - - - - {95943bbe-f378-4068-a3fd-dae1b8309b6e} - DirectXApp - testdraw - en-US - 14.0 - true - Windows Store - 10.0.19041.0 - 10.0.17763.0 - 10.0 - false - - - - Application - true - v142 - - - Application - true - v142 - - - Application - true - v142 - true - - - Application - true - v142 - - - Application - false - true - v142 - true - - - Application - false - true - v142 - true - - - Application - false - true - v142 - true - - - Application - false - true - v142 - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - d2d1.lib; d3d11.lib; dxgi.lib; windowscodecs.lib; dwrite.lib; %(AdditionalDependencies) - %(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store\arm; $(VCInstallDir)\lib\arm - /nodefaultlib:vccorlibd /nodefaultlib:msvcrtd vccorlibd.lib msvcrtd.lib %(AdditionalOptions) - - - pch.h - $(IntDir)pch.pch - $(ProjectDir);$(IntermediateOutputPath);..\..\include - /bigobj %(AdditionalOptions) - 4453;28204 - _DEBUG;%(PreprocessorDefinitions) - false - NotUsing - - - - - d2d1.lib; d3d11.lib; dxgi.lib; windowscodecs.lib; dwrite.lib; %(AdditionalDependencies) - %(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store\arm; $(VCInstallDir)\lib\arm - /nodefaultlib:vccorlib /nodefaultlib:msvcrt vccorlib.lib msvcrt.lib %(AdditionalOptions) - - - pch.h - $(IntDir)pch.pch - $(ProjectDir);$(IntermediateOutputPath);..\..\include - /bigobj %(AdditionalOptions) - 4453;28204 - NDEBUG;%(PreprocessorDefinitions) - false - NotUsing - - - - - d2d1.lib; d3d11.lib; dxgi.lib; windowscodecs.lib; dwrite.lib; %(AdditionalDependencies) - %(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store\arm64; $(VCInstallDir)\lib\arm64 - /nodefaultlib:vccorlibd /nodefaultlib:msvcrtd vccorlibd.lib msvcrtd.lib %(AdditionalOptions) - - - pch.h - $(IntDir)pch.pch - $(ProjectDir);$(IntermediateOutputPath);..\..\include - /bigobj %(AdditionalOptions) - 4453;28204 - _DEBUG;%(PreprocessorDefinitions) - false - NotUsing - - - - - d2d1.lib; d3d11.lib; dxgi.lib; windowscodecs.lib; dwrite.lib; %(AdditionalDependencies) - %(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store\arm64; $(VCInstallDir)\lib\arm64 - /nodefaultlib:vccorlib /nodefaultlib:msvcrt vccorlib.lib msvcrt.lib %(AdditionalOptions) - - - pch.h - $(IntDir)pch.pch - $(ProjectDir);$(IntermediateOutputPath);..\..\include - /bigobj %(AdditionalOptions) - 4453;28204 - NDEBUG;%(PreprocessorDefinitions) - false - NotUsing - - - - - d2d1.lib; d3d11.lib; dxgi.lib; windowscodecs.lib; dwrite.lib; %(AdditionalDependencies) - %(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store; $(VCInstallDir)\lib - /nodefaultlib:vccorlibd /nodefaultlib:msvcrtd vccorlibd.lib msvcrtd.lib %(AdditionalOptions) - - - pch.h - $(IntDir)pch.pch - $(ProjectDir);$(IntermediateOutputPath);..\..\include - /bigobj %(AdditionalOptions) - 4453;28204 - _DEBUG;%(PreprocessorDefinitions) - false - NotUsing - - - - - d2d1.lib; d3d11.lib; dxgi.lib; windowscodecs.lib; dwrite.lib; %(AdditionalDependencies) - %(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store; $(VCInstallDir)\lib - /nodefaultlib:vccorlib /nodefaultlib:msvcrt vccorlib.lib msvcrt.lib %(AdditionalOptions) - - - pch.h - $(IntDir)pch.pch - $(ProjectDir);$(IntermediateOutputPath);..\..\include - /bigobj %(AdditionalOptions) - 4453;28204 - NDEBUG;%(PreprocessorDefinitions) - false - NotUsing - - - - - d2d1.lib; d3d11.lib; dxgi.lib; windowscodecs.lib; dwrite.lib; %(AdditionalDependencies) - %(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store\amd64; $(VCInstallDir)\lib\amd64 - /nodefaultlib:vccorlibd /nodefaultlib:msvcrtd vccorlibd.lib msvcrtd.lib %(AdditionalOptions) - - - pch.h - $(IntDir)pch.pch - $(ProjectDir);$(IntermediateOutputPath);..\..\include - /bigobj %(AdditionalOptions) - 4453;28204 - _DEBUG;%(PreprocessorDefinitions) - false - NotUsing - - - - - d2d1.lib; d3d11.lib; dxgi.lib; windowscodecs.lib; dwrite.lib; %(AdditionalDependencies) - %(AdditionalLibraryDirectories); $(VCInstallDir)\lib\store\amd64; $(VCInstallDir)\lib\amd64 - /nodefaultlib:vccorlib /nodefaultlib:msvcrt vccorlib.lib msvcrt.lib %(AdditionalOptions) - - - pch.h - $(IntDir)pch.pch - $(ProjectDir);$(IntermediateOutputPath);..\..\include - /bigobj %(AdditionalOptions) - 4453;28204 - NDEBUG;%(PreprocessorDefinitions) - false - NotUsing - - - - - $(TreatWarningsAsError) - - - - - - - - - - - - - - Designer - - - - - {89e9b32e-a86a-47c3-a948-d2b1622925ce} - - - - - - - - - - - - - - - true - true - true - true - true - true - true - true - - - false - false - false - false - false - false - false - false - - - - - - - - - - - - - - - diff --git a/VisualC-WinRT/testdraw/testdraw.vcxproj.filters b/VisualC-WinRT/testdraw/testdraw.vcxproj.filters deleted file mode 100644 index 2640e2a4..00000000 --- a/VisualC-WinRT/testdraw/testdraw.vcxproj.filters +++ /dev/null @@ -1,85 +0,0 @@ - - - - - 95943bbe-f378-4068-a3fd-dae1b8309b6e - - - dad3d573-ab33-428d-ae70-6098066c27e7 - bmp;fbx;gif;jpg;jpeg;tga;tiff;tif;png - - - e4caa635-e149-44c2-8915-48ffa6ac48f7 - - - Assets - - - Assets - - - Assets - - - Assets - - - Assets - - - Assets - - - - - Assets - - - - - - - - Content - - - Content - - - Common - - - Common - - - Common - - - Common - - - Common - - - Common - - - Common - - - Common - - - Common - - - Common - - - - - - - - - diff --git a/VisualC/SDL/SDL.vcxproj b/VisualC/SDL/SDL.vcxproj index e1cbf90b..27883a0c 100644 --- a/VisualC/SDL/SDL.vcxproj +++ b/VisualC/SDL/SDL.vcxproj @@ -284,6 +284,7 @@ + @@ -615,12 +616,17 @@ + + + + + diff --git a/VisualC/SDL/SDL.vcxproj.filters b/VisualC/SDL/SDL.vcxproj.filters index f7794e85..34f05bb4 100644 --- a/VisualC/SDL/SDL.vcxproj.filters +++ b/VisualC/SDL/SDL.vcxproj.filters @@ -198,6 +198,7 @@ {0000d7fda065b13b0ca4ab262c380000} + {098fbef9-d8a0-4b3b-b57b-d157d395335d} @@ -347,6 +348,9 @@ API Headers + + API Headers + API Headers @@ -909,6 +913,7 @@ video\offscreen + API Headers @@ -1488,6 +1493,15 @@ render\direct3d11 + + render\gpu + + + render\gpu + + + render\gpu + render\opengl @@ -1527,10 +1541,16 @@ power - power\windows + + process + + + process\windows + + render\direct3d12 diff --git a/Xcode/SDL/SDL.xcodeproj/project.pbxproj b/Xcode/SDL/SDL.xcodeproj/project.pbxproj index e478bb82..23cf854b 100644 --- a/Xcode/SDL/SDL.xcodeproj/project.pbxproj +++ b/Xcode/SDL/SDL.xcodeproj/project.pbxproj @@ -44,6 +44,7 @@ 000095FA1BDE436CF3AF0000 /* SDL_time.c in Sources */ = {isa = PBXBuildFile; fileRef = 0000641A9BAC11AB3FBE0000 /* SDL_time.c */; }; 000098E9DAA43EF6FF7F0000 /* SDL_camera.c in Sources */ = {isa = PBXBuildFile; fileRef = 0000035D38C3899C7EFD0000 /* SDL_camera.c */; }; 0000A4DA2F45A31DC4F00000 /* SDL_sysmain_callbacks.m in Sources */ = {isa = PBXBuildFile; fileRef = 0000BB287BA0A0178C1A0000 /* SDL_sysmain_callbacks.m */; platformFilters = (ios, maccatalyst, macos, tvos, watchos, ); }; + 0000D5B526B85DE7AB1C0000 /* SDL_cocoapen.m in Sources */ = {isa = PBXBuildFile; fileRef = 0000CCA310B73A7B59910000 /* SDL_cocoapen.m */; }; 007317A40858DECD00B2BC32 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0073179D0858DECD00B2BC32 /* Cocoa.framework */; platformFilters = (macos, ); }; 007317A60858DECD00B2BC32 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0073179F0858DECD00B2BC32 /* IOKit.framework */; platformFilters = (ios, maccatalyst, macos, ); }; 00CFA89D106B4BA100758660 /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 00CFA89C106B4BA100758660 /* ForceFeedback.framework */; platformFilters = (macos, ); }; @@ -445,11 +446,22 @@ F3990E062A788303000D8759 /* SDL_hidapi_ios.h in Headers */ = {isa = PBXBuildFile; fileRef = F3990E032A788303000D8759 /* SDL_hidapi_ios.h */; }; F3990E072A78833C000D8759 /* hid.m in Sources */ = {isa = PBXBuildFile; fileRef = A75FDAA523E2792500529352 /* hid.m */; }; F3A4909E2554D38600E92A8B /* SDL_hidapi_ps5.c in Sources */ = {isa = PBXBuildFile; fileRef = F3A4909D2554D38500E92A8B /* SDL_hidapi_ps5.c */; }; + F3A9AE982C8A13C100AAC390 /* SDL_gpu_util.h in Headers */ = {isa = PBXBuildFile; fileRef = F3A9AE922C8A13C100AAC390 /* SDL_gpu_util.h */; }; + F3A9AE992C8A13C100AAC390 /* SDL_render_gpu.c in Sources */ = {isa = PBXBuildFile; fileRef = F3A9AE932C8A13C100AAC390 /* SDL_render_gpu.c */; }; + F3A9AE9A2C8A13C100AAC390 /* SDL_shaders_gpu.c in Sources */ = {isa = PBXBuildFile; fileRef = F3A9AE942C8A13C100AAC390 /* SDL_shaders_gpu.c */; }; + F3A9AE9B2C8A13C100AAC390 /* SDL_pipeline_gpu.h in Headers */ = {isa = PBXBuildFile; fileRef = F3A9AE952C8A13C100AAC390 /* SDL_pipeline_gpu.h */; }; + F3A9AE9C2C8A13C100AAC390 /* SDL_pipeline_gpu.c in Sources */ = {isa = PBXBuildFile; fileRef = F3A9AE962C8A13C100AAC390 /* SDL_pipeline_gpu.c */; }; + F3A9AE9D2C8A13C100AAC390 /* SDL_shaders_gpu.h in Headers */ = {isa = PBXBuildFile; fileRef = F3A9AE972C8A13C100AAC390 /* SDL_shaders_gpu.h */; }; F3B38CCF296E2E52005DA6D3 /* SDL_main_impl.h in Headers */ = {isa = PBXBuildFile; fileRef = F3B38CCA296E2E52005DA6D3 /* SDL_main_impl.h */; settings = {ATTRIBUTES = (Public, ); }; }; F3B38CD3296E2E52005DA6D3 /* SDL_platform_defines.h in Headers */ = {isa = PBXBuildFile; fileRef = F3B38CCB296E2E52005DA6D3 /* SDL_platform_defines.h */; settings = {ATTRIBUTES = (Public, ); }; }; F3B38CD7296E2E52005DA6D3 /* SDL_init.h in Headers */ = {isa = PBXBuildFile; fileRef = F3B38CCC296E2E52005DA6D3 /* SDL_init.h */; settings = {ATTRIBUTES = (Public, ); }; }; F3B38CDB296E2E52005DA6D3 /* SDL_oldnames.h in Headers */ = {isa = PBXBuildFile; fileRef = F3B38CCD296E2E52005DA6D3 /* SDL_oldnames.h */; settings = {ATTRIBUTES = (Public, ); }; }; F3B38CDF296E2E52005DA6D3 /* SDL_intrin.h in Headers */ = {isa = PBXBuildFile; fileRef = F3B38CCE296E2E52005DA6D3 /* SDL_intrin.h */; settings = {ATTRIBUTES = (Public, ); }; }; + F3B439482C93595900792030 /* SDL_process.h in Headers */ = {isa = PBXBuildFile; fileRef = F3B439472C93595900792030 /* SDL_process.h */; settings = {ATTRIBUTES = (Public, ); }; }; + F3B439512C935C2400792030 /* SDL_dummyprocess.c in Sources */ = {isa = PBXBuildFile; fileRef = F3B439502C935C2400792030 /* SDL_dummyprocess.c */; }; + F3B439532C935C2C00792030 /* SDL_posixprocess.c in Sources */ = {isa = PBXBuildFile; fileRef = F3B439522C935C2C00792030 /* SDL_posixprocess.c */; }; + F3B439562C937DAB00792030 /* SDL_process.c in Sources */ = {isa = PBXBuildFile; fileRef = F3B439542C937DAB00792030 /* SDL_process.c */; }; + F3B439572C937DAB00792030 /* SDL_sysprocess.h in Headers */ = {isa = PBXBuildFile; fileRef = F3B439552C937DAB00792030 /* SDL_sysprocess.h */; }; F3C2CB222C5DDDB2004D7998 /* SDL_categories_c.h in Headers */ = {isa = PBXBuildFile; fileRef = F3C2CB202C5DDDB2004D7998 /* SDL_categories_c.h */; }; F3C2CB232C5DDDB2004D7998 /* SDL_categories.c in Sources */ = {isa = PBXBuildFile; fileRef = F3C2CB212C5DDDB2004D7998 /* SDL_categories.c */; }; F3D60A8328C16A1900788A3A /* SDL_hidapi_wii.c in Sources */ = {isa = PBXBuildFile; fileRef = F3D60A8228C16A1800788A3A /* SDL_hidapi_wii.c */; }; @@ -533,8 +545,6 @@ F3FA5A242B59ACE000FEAD97 /* yuv_rgb_lsx.h in Headers */ = {isa = PBXBuildFile; fileRef = F3FA5A1B2B59ACE000FEAD97 /* yuv_rgb_lsx.h */; }; F3FA5A252B59ACE000FEAD97 /* yuv_rgb_common.h in Headers */ = {isa = PBXBuildFile; fileRef = F3FA5A1C2B59ACE000FEAD97 /* yuv_rgb_common.h */; }; FA73671D19A540EF004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73671C19A540EF004122E4 /* CoreVideo.framework */; platformFilters = (ios, maccatalyst, macos, tvos, watchos, ); }; - 0000E5D7110DFF81FF660000 /* SDL_cocoapen.h in Headers */ = {isa = PBXBuildFile; fileRef = 00002F2F5496FA184A0F0000 /* SDL_cocoapen.h */; }; - 0000D5B526B85DE7AB1C0000 /* SDL_cocoapen.m in Sources */ = {isa = PBXBuildFile; fileRef = 0000CCA310B73A7B59910000 /* SDL_cocoapen.m */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -563,6 +573,7 @@ /* Begin PBXFileReference section */ 0000035D38C3899C7EFD0000 /* SDL_camera.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_camera.c; sourceTree = ""; }; 00002B010DB1A70931C20000 /* SDL_filesystem.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_filesystem.c; sourceTree = ""; }; + 00002F2F5496FA184A0F0000 /* SDL_cocoapen.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_cocoapen.h; sourceTree = ""; }; 00003260407E1002EAC10000 /* SDL_main_callbacks.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_main_callbacks.h; sourceTree = ""; }; 00003F472C51CE7DF6160000 /* SDL_systime.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_systime.c; sourceTree = ""; }; 00005BD74B46358B33A20000 /* SDL_camera_dummy.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_camera_dummy.c; sourceTree = ""; }; @@ -575,6 +586,7 @@ 00009366FB9FBBD54C390000 /* SDL_main_callbacks.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_main_callbacks.c; sourceTree = ""; }; 0000B6ADCD88CAD6610F0000 /* SDL_hashtable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_hashtable.h; sourceTree = ""; }; 0000BB287BA0A0178C1A0000 /* SDL_sysmain_callbacks.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDL_sysmain_callbacks.m; sourceTree = ""; }; + 0000CCA310B73A7B59910000 /* SDL_cocoapen.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDL_cocoapen.m; sourceTree = ""; }; 0000F4E6AA3EF99DA3C80000 /* SDL_sysfsops.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_sysfsops.c; sourceTree = ""; }; 0000F6C6A072ED4E3D660000 /* SDL_dialog_utils.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_dialog_utils.c; sourceTree = ""; }; 0073179D0858DECD00B2BC32 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; }; @@ -1004,12 +1016,23 @@ F3990E022A788303000D8759 /* SDL_hidapi_mac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_hidapi_mac.h; sourceTree = ""; }; F3990E032A788303000D8759 /* SDL_hidapi_ios.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_hidapi_ios.h; sourceTree = ""; }; F3A4909D2554D38500E92A8B /* SDL_hidapi_ps5.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_hidapi_ps5.c; sourceTree = ""; }; + F3A9AE922C8A13C100AAC390 /* SDL_gpu_util.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_gpu_util.h; sourceTree = ""; }; + F3A9AE932C8A13C100AAC390 /* SDL_render_gpu.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_render_gpu.c; sourceTree = ""; }; + F3A9AE942C8A13C100AAC390 /* SDL_shaders_gpu.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_shaders_gpu.c; sourceTree = ""; }; + F3A9AE952C8A13C100AAC390 /* SDL_pipeline_gpu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_pipeline_gpu.h; sourceTree = ""; }; + F3A9AE962C8A13C100AAC390 /* SDL_pipeline_gpu.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_pipeline_gpu.c; sourceTree = ""; }; + F3A9AE972C8A13C100AAC390 /* SDL_shaders_gpu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_shaders_gpu.h; sourceTree = ""; }; F3ADAB8D2576F0B300A6B1D9 /* SDL_sysurl.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDL_sysurl.m; sourceTree = ""; }; F3B38CCA296E2E52005DA6D3 /* SDL_main_impl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_main_impl.h; path = SDL3/SDL_main_impl.h; sourceTree = ""; }; F3B38CCB296E2E52005DA6D3 /* SDL_platform_defines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_platform_defines.h; path = SDL3/SDL_platform_defines.h; sourceTree = ""; }; F3B38CCC296E2E52005DA6D3 /* SDL_init.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_init.h; path = SDL3/SDL_init.h; sourceTree = ""; }; F3B38CCD296E2E52005DA6D3 /* SDL_oldnames.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_oldnames.h; path = SDL3/SDL_oldnames.h; sourceTree = ""; }; F3B38CCE296E2E52005DA6D3 /* SDL_intrin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_intrin.h; path = SDL3/SDL_intrin.h; sourceTree = ""; }; + F3B439472C93595900792030 /* SDL_process.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_process.h; path = SDL3/SDL_process.h; sourceTree = ""; }; + F3B439502C935C2400792030 /* SDL_dummyprocess.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_dummyprocess.c; sourceTree = ""; }; + F3B439522C935C2C00792030 /* SDL_posixprocess.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_posixprocess.c; sourceTree = ""; }; + F3B439542C937DAB00792030 /* SDL_process.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_process.c; sourceTree = ""; }; + F3B439552C937DAB00792030 /* SDL_sysprocess.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_sysprocess.h; sourceTree = ""; }; F3C2CB202C5DDDB2004D7998 /* SDL_categories_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_categories_c.h; sourceTree = ""; }; F3C2CB212C5DDDB2004D7998 /* SDL_categories.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_categories.c; sourceTree = ""; }; F3D60A8228C16A1800788A3A /* SDL_hidapi_wii.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_hidapi_wii.c; sourceTree = ""; }; @@ -1096,8 +1119,6 @@ F59C710600D5CB5801000001 /* SDL.info */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = SDL.info; sourceTree = ""; }; F5A2EF3900C6A39A01000001 /* BUGS.txt */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; name = BUGS.txt; path = ../../BUGS.txt; sourceTree = SOURCE_ROOT; }; FA73671C19A540EF004122E4 /* CoreVideo.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreVideo.framework; path = System/Library/Frameworks/CoreVideo.framework; sourceTree = SDKROOT; }; - 00002F2F5496FA184A0F0000 /* SDL_cocoapen.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_cocoapen.h; path = SDL_cocoapen.h; sourceTree = ""; }; - 0000CCA310B73A7B59910000 /* SDL_cocoapen.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SDL_cocoapen.m; path = SDL_cocoapen.m; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -1254,6 +1275,7 @@ F3B38CCB296E2E52005DA6D3 /* SDL_platform_defines.h */, F3F7D8AB2933074900816151 /* SDL_platform.h */, F3F7D8DB2933074D00816151 /* SDL_power.h */, + F3B439472C93595900792030 /* SDL_process.h */, F3E5A6EC2AD5E10800293D83 /* SDL_properties.h */, F3F7D8E22933074D00816151 /* SDL_rect.h */, F3F7D8DE2933074D00816151 /* SDL_render.h */, @@ -1327,6 +1349,7 @@ 000082EF09C89B62BD840000 /* main */, 5616CA47252BB278005D5928 /* misc */, A7D8A7DF23E2513F00DCD162 /* power */, + F3B439492C93597500792030 /* process */, A7D8A8DA23E2514000DCD162 /* render */, A7D8A57623E2513D00DCD162 /* sensor */, A7D8A8D223E2514000DCD162 /* stdlib */, @@ -2093,6 +2116,7 @@ A7D8A8DA23E2514000DCD162 /* render */ = { isa = PBXGroup; children = ( + F3A9AE912C8A139C00AAC390 /* gpu */, A7D8A8DD23E2514000DCD162 /* metal */, A7D8A90C23E2514000DCD162 /* opengl */, A7D8A90323E2514000DCD162 /* opengles2 */, @@ -2335,6 +2359,19 @@ path = dummy; sourceTree = ""; }; + F3A9AE912C8A139C00AAC390 /* gpu */ = { + isa = PBXGroup; + children = ( + F3A9AE922C8A13C100AAC390 /* SDL_gpu_util.h */, + F3A9AE962C8A13C100AAC390 /* SDL_pipeline_gpu.c */, + F3A9AE952C8A13C100AAC390 /* SDL_pipeline_gpu.h */, + F3A9AE932C8A13C100AAC390 /* SDL_render_gpu.c */, + F3A9AE942C8A13C100AAC390 /* SDL_shaders_gpu.c */, + F3A9AE972C8A13C100AAC390 /* SDL_shaders_gpu.h */, + ); + path = gpu; + sourceTree = ""; + }; F3ADAB8C2576F08500A6B1D9 /* ios */ = { isa = PBXGroup; children = ( @@ -2343,6 +2380,33 @@ path = ios; sourceTree = ""; }; + F3B439492C93597500792030 /* process */ = { + isa = PBXGroup; + children = ( + F3B4394A2C93599900792030 /* dummy */, + F3B4394B2C9359A500792030 /* posix */, + F3B439542C937DAB00792030 /* SDL_process.c */, + F3B439552C937DAB00792030 /* SDL_sysprocess.h */, + ); + path = process; + sourceTree = ""; + }; + F3B4394A2C93599900792030 /* dummy */ = { + isa = PBXGroup; + children = ( + F3B439502C935C2400792030 /* SDL_dummyprocess.c */, + ); + path = dummy; + sourceTree = ""; + }; + F3B4394B2C9359A500792030 /* posix */ = { + isa = PBXGroup; + children = ( + F3B439522C935C2C00792030 /* SDL_posixprocess.c */, + ); + path = posix; + sourceTree = ""; + }; F59C70FC00D5CB5801000001 /* pkg-support */ = { isa = PBXGroup; children = ( @@ -2376,6 +2440,7 @@ F3F7D9C52933074E00816151 /* SDL_assert.h in Headers */, A7D8B61723E2514300DCD162 /* SDL_assert_c.h in Headers */, F3F7D9292933074E00816151 /* SDL_atomic.h in Headers */, + F3A9AE9D2C8A13C100AAC390 /* SDL_shaders_gpu.h in Headers */, F3F7D8ED2933074E00816151 /* SDL_audio.h in Headers */, A7D8B7A023E2514400DCD162 /* SDL_audio_c.h in Headers */, F32DDACF2AB795A30041EAA5 /* SDL_audio_channel_converters.h in Headers */, @@ -2416,6 +2481,7 @@ F3F7D9B92933074E00816151 /* SDL_cpuinfo.h in Headers */, A7D8B98023E2514400DCD162 /* SDL_d3dmath.h in Headers */, A7D8B8A223E2514400DCD162 /* SDL_diskaudio.h in Headers */, + F3B439482C93595900792030 /* SDL_process.h in Headers */, A7D8BB3F23E2514500DCD162 /* SDL_displayevents_c.h in Headers */, A7D8BA1923E2514400DCD162 /* SDL_draw.h in Headers */, F3C2CB222C5DDDB2004D7998 /* SDL_categories_c.h in Headers */, @@ -2430,6 +2496,7 @@ A7D8AB1C23E2514100DCD162 /* SDL_dynapi_procs.h in Headers */, E4F7981C2AD8D85500669F54 /* SDL_dynapi_unsupported.h in Headers */, F3F7D9252933074E00816151 /* SDL_egl.h in Headers */, + F3A9AE982C8A13C100AAC390 /* SDL_gpu_util.h in Headers */, A7D8ABD923E2514100DCD162 /* SDL_egl_c.h in Headers */, F3F7D93D2933074E00816151 /* SDL_endian.h in Headers */, F3F7D9352933074E00816151 /* SDL_error.h in Headers */, @@ -2545,6 +2612,7 @@ A7D8AC3F23E2514100DCD162 /* SDL_sysvideo.h in Headers */, F3F7D9792933074E00816151 /* SDL_thread.h in Headers */, A7D8B3EC23E2514300DCD162 /* SDL_thread_c.h in Headers */, + F3B439572C937DAB00792030 /* SDL_sysprocess.h in Headers */, E4F257912C81903800FCEAFC /* Metal_Blit.h in Headers */, F3F7D90D2933074E00816151 /* SDL_timer.h in Headers */, A7D8AB3123E2514100DCD162 /* SDL_timer_c.h in Headers */, @@ -2603,6 +2671,7 @@ A7D8B26023E2514200DCD162 /* vulkan.h in Headers */, A7D8B2B423E2514200DCD162 /* vulkan_android.h in Headers */, A7D8B2A823E2514200DCD162 /* vulkan_core.h in Headers */, + F3A9AE9B2C8A13C100AAC390 /* SDL_pipeline_gpu.h in Headers */, E41D20152BA9577D003073FA /* SDL_storage.h in Headers */, F37E18522BA50E760098C111 /* SDL_dialog.h in Headers */, A7D8B27223E2514200DCD162 /* vulkan_fuchsia.h in Headers */, @@ -2752,6 +2821,7 @@ A7D8B41C23E2514300DCD162 /* SDL_systls.c in Sources */, 9846B07C287A9020000C35C8 /* SDL_hidapi_shield.c in Sources */, F31013C72C24E98200FBE946 /* SDL_keymap.c in Sources */, + F3A9AE992C8A13C100AAC390 /* SDL_render_gpu.c in Sources */, A7D8BBD923E2574800DCD162 /* SDL_uikitmessagebox.m in Sources */, F32DDAD42AB795A30041EAA5 /* SDL_audioresample.c in Sources */, F3FA5A212B59ACE000FEAD97 /* yuv_rgb_std.c in Sources */, @@ -2771,6 +2841,7 @@ A7D8B9F523E2514400DCD162 /* SDL_rotate.c in Sources */, A7D8BBE323E2574800DCD162 /* SDL_uikitvideo.m in Sources */, 5616CA4E252BB2A6005D5928 /* SDL_sysurl.m in Sources */, + F3B439562C937DAB00792030 /* SDL_process.c in Sources */, A7D8A97523E2514000DCD162 /* SDL_coremotionsensor.m in Sources */, F382071D284F362F004DD584 /* SDL_guid.c in Sources */, A7D8BB8D23E2514500DCD162 /* SDL_touch.c in Sources */, @@ -2808,6 +2879,7 @@ A7D8ADF223E2514100DCD162 /* SDL_blit_A.c in Sources */, A7D8BBDD23E2574800DCD162 /* SDL_uikitmodes.m in Sources */, A7D8BA3723E2514400DCD162 /* SDL_d3dmath.c in Sources */, + F3A9AE9C2C8A13C100AAC390 /* SDL_pipeline_gpu.c in Sources */, 75E0915A241EA924004729E1 /* SDL_virtualjoystick.c in Sources */, A7D8ABEB23E2514100DCD162 /* SDL_nullvideo.c in Sources */, F3990E072A78833C000D8759 /* hid.m in Sources */, @@ -2832,6 +2904,7 @@ A7D8BA8B23E2514400DCD162 /* s_sin.c in Sources */, F3F528CE2C29E1C300E6CC26 /* s_modf.c in Sources */, A7D8BBEB23E2574800DCD162 /* SDL_uikitwindow.m in Sources */, + F3B439532C935C2C00792030 /* SDL_posixprocess.c in Sources */, F395BF6525633B2400942BFF /* SDL_crc32.c in Sources */, A7D8B5E723E2514300DCD162 /* SDL_power.c in Sources */, A7D8AED623E2514100DCD162 /* SDL_cocoakeyboard.m in Sources */, @@ -2875,12 +2948,14 @@ A7D8BADF23E2514500DCD162 /* e_fmod.c in Sources */, A7D8B5CF23E2514300DCD162 /* SDL_syspower.m in Sources */, A7D8BAEB23E2514500DCD162 /* e_log10.c in Sources */, + F3B439512C935C2400792030 /* SDL_dummyprocess.c in Sources */, A7D8B76423E2514300DCD162 /* SDL_mixer.c in Sources */, A7D8BB5723E2514500DCD162 /* SDL_events.c in Sources */, A7D8ADE623E2514100DCD162 /* SDL_blit_0.c in Sources */, A7D8BB0923E2514500DCD162 /* k_tan.c in Sources */, A7D8B8A823E2514400DCD162 /* SDL_diskaudio.c in Sources */, 56A2373329F9C113003CCA5F /* SDL_sysrwlock.c in Sources */, + F3A9AE9A2C8A13C100AAC390 /* SDL_shaders_gpu.c in Sources */, 566E26CF246274CC00718109 /* SDL_syslocale.m in Sources */, A7D8AFC023E2514200DCD162 /* SDL_egl.c in Sources */, A7D8AC3323E2514100DCD162 /* SDL_RLEaccel.c in Sources */, diff --git a/android-project/app/proguard-rules.pro b/android-project/app/proguard-rules.pro index 21049255..fc0a4f5c 100644 --- a/android-project/app/proguard-rules.pro +++ b/android-project/app/proguard-rules.pro @@ -35,9 +35,9 @@ void manualBackButton(); int messageboxShowMessageBox(int, java.lang.String, java.lang.String, int[], int[], java.lang.String[], int[]); void minimizeWindow(); - int openURL(java.lang.String); + boolean openURL(java.lang.String); void requestPermission(java.lang.String, int); - int showToast(java.lang.String, int, int, int, int); + boolean showToast(java.lang.String, int, int, int, int); boolean sendMessage(int, int); boolean setActivityTitle(java.lang.String); boolean setCustomCursor(int); diff --git a/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java b/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java index c6da70f5..efcbd634 100644 --- a/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java +++ b/android-project/app/src/main/java/org/libsdl/app/SDLActivity.java @@ -88,7 +88,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh | InputDevice.SOURCE_CLASS_POSITION | InputDevice.SOURCE_CLASS_TRACKBALL); - if (s2 != 0) cls += "Some_Unkown"; + if (s2 != 0) cls += "Some_Unknown"; s2 = s_copy & InputDevice.SOURCE_ANY; // keep source only, no class; @@ -162,7 +162,7 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh if (s == FLAG_TAINTED) src += " FLAG_TAINTED"; s2 &= ~FLAG_TAINTED; - if (s2 != 0) src += " Some_Unkown"; + if (s2 != 0) src += " Some_Unknown"; Log.v(TAG, prefix + "int=" + s_copy + " CLASS={" + cls + " } source(s):" + src); } diff --git a/build-scripts/SDL_migration.cocci b/build-scripts/SDL_migration.cocci index b60a9c44..0483a40b 100644 --- a/build-scripts/SDL_migration.cocci +++ b/build-scripts/SDL_migration.cocci @@ -851,7 +851,7 @@ typedef SDL_ControllerTouchpadEvent, SDL_GamepadTouchpadEvent; @@ @@ - SDL_CONTROLLER_AXIS_MAX -+ SDL_GAMEPAD_AXIS_MAX ++ SDL_GAMEPAD_AXIS_COUNT @@ @@ - SDL_CONTROLLER_AXIS_RIGHTX @@ -931,7 +931,7 @@ typedef SDL_ControllerTouchpadEvent, SDL_GamepadTouchpadEvent; @@ @@ - SDL_CONTROLLER_BUTTON_MAX -+ SDL_GAMEPAD_BUTTON_MAX ++ SDL_GAMEPAD_BUTTON_COUNT @@ @@ - SDL_CONTROLLER_BUTTON_MISC1 @@ -2907,12 +2907,37 @@ expression e1, e2, e3, e4; @@ @@ - SDL_AtomicCAS -+ SDL_AtomicCompareAndSwap ++ SDL_CompareAndSwapAtomicInt + (...) +@@ +@@ +- SDL_AtomicSet ++ SDL_SetAtomicInt + (...) +@@ +@@ +- SDL_AtomicGet ++ SDL_GetAtomicInt + (...) +@@ +@@ +- SDL_AtomicAdd ++ SDL_AddAtomicInt (...) @@ @@ - SDL_AtomicCASPtr -+ SDL_AtomicCompareAndSwapPointer ++ SDL_CompareAndSwapAtomicPointer + (...) +@@ +@@ +- SDL_AtomicSetPtr ++ SDL_SetAtomicPointer + (...) +@@ +@@ +- SDL_AtomicGetPtr ++ SDL_GetAtomicPointer (...) @@ @@ @@ -3117,11 +3142,6 @@ typedef SDL_Colour, SDL_Color; + SDL_Color @@ @@ -- SDL_WinRTGetFSPathUTF8 -+ SDL_GetWinRTFSPath - (...) -@@ -@@ - SDL_iPhoneSetAnimationCallback + SDL_SetiOSAnimationCallback (...) @@ -3527,11 +3547,6 @@ typedef SDL_Colour, SDL_Color; (...) @@ @@ -- SDL_WinRTGetDeviceFamily -+ SDL_GetWinRTDeviceFamily - (...) -@@ -@@ - SDL_LinuxSetThreadPriority + SDL_SetLinuxThreadPriority (...) @@ -3596,16 +3611,6 @@ typedef SDL_JoystickGUID, SDL_GUID; + SDL_HINT_MOUSE_EMULATE_WARP_WITH_RELATIVE @@ @@ -- SDL_AtomicSetPtr -+ SDL_AtomicSetPointer - (...) -@@ -@@ -- SDL_AtomicGetPtr -+ SDL_AtomicGetPointer - (...) -@@ -@@ - SDL_DelEventWatch + SDL_RemoveEventWatch (...) @@ -3624,10 +3629,18 @@ typedef SDL_JoystickGUID, SDL_GUID; - SDL_size_add_overflow + SDL_size_add_check_overflow (...) +@@ +@@ +- SDL_PRESSED ++ SDL_TRUE +@@ +@@ +- SDL_RELEASED ++ SDL_FALSE // This should be the last rule in the file, since it works on SDL3 functions and previous rules may have renamed old functions. @ bool_return_type @ -identifier func =~ "^(SDL_AddEventWatch|SDL_AddHintCallback|SDL_AddSurfaceAlternateImage|SDL_AddVulkanRenderSemaphores|SDL_BindAudioStream|SDL_BindAudioStreams|SDL_BlitSurface|SDL_BlitSurface9Grid|SDL_BlitSurfaceScaled|SDL_BlitSurfaceTiled|SDL_BlitSurfaceTiledWithScale|SDL_BlitSurfaceUnchecked|SDL_BlitSurfaceUncheckedScaled|SDL_CaptureMouse|SDL_ClearAudioStream|SDL_ClearClipboardData|SDL_ClearComposition|SDL_ClearError|SDL_ClearProperty|SDL_ClearSurface|SDL_CloseIO|SDL_CloseStorage|SDL_ConvertAudioSamples|SDL_ConvertEventToRenderCoordinates|SDL_ConvertPixels|SDL_ConvertPixelsAndColorspace|SDL_CopyFile|SDL_CopyProperties|SDL_CopyStorageFile|SDL_CreateDirectory|SDL_CreateStorageDirectory|SDL_CreateWindowAndRenderer|SDL_DateTimeToTime|SDL_DestroyWindowSurface|SDL_DetachVirtualJoystick|SDL_DisableScreenSaver|SDL_EnableScreenSaver|SDL_EnumerateDirectory|SDL_EnumerateProperties|SDL_EnumerateStorageDirectory|SDL_FillSurfaceRect|SDL_FillSurfaceRects|SDL_FlashWindow|SDL_FlipSurface|SDL_FlushAudioStream|SDL_FlushRenderer|SDL_GL_DestroyContext|SDL_GL_GetAttribute|SDL_GL_GetSwapInterval|SDL_GL_LoadLibrary|SDL_GL_MakeCurrent|SDL_GL_SetAttribute|SDL_GL_SetSwapInterval|SDL_GL_SwapWindow|SDL_GetAudioDeviceFormat|SDL_GetAudioStreamFormat|SDL_GetCameraFormat|SDL_GetClosestFullscreenDisplayMode|SDL_GetCurrentRenderOutputSize|SDL_GetCurrentTime|SDL_GetDXGIOutputInfo|SDL_GetDateTimeLocalePreferences|SDL_GetDisplayBounds|SDL_GetDisplayUsableBounds|SDL_GetGDKDefaultUser|SDL_GetGDKTaskQueue|SDL_GetGamepadSensorData|SDL_GetGamepadTouchpadFinger|SDL_GetHapticEffectStatus|SDL_GetJoystickBall|SDL_GetMasksForPixelFormat|SDL_GetPathInfo|SDL_GetRectUnion|SDL_GetRectUnionFloat|SDL_GetRenderClipRect|SDL_GetRenderColorScale|SDL_GetRenderDrawBlendMode|SDL_GetRenderDrawColor|SDL_GetRenderDrawColorFloat|SDL_GetRenderLogicalPresentation|SDL_GetRenderLogicalPresentationRect|SDL_GetRenderOutputSize|SDL_GetRenderSafeArea|SDL_GetRenderScale|SDL_GetRenderVSync|SDL_GetRenderViewport|SDL_GetSensorData|SDL_GetStorageFileSize|SDL_GetStoragePathInfo|SDL_GetSurfaceAlphaMod|SDL_GetSurfaceBlendMode|SDL_GetSurfaceClipRect|SDL_GetSurfaceColorKey|SDL_GetSurfaceColorMod|SDL_GetTextInputArea|SDL_GetTextureAlphaMod|SDL_GetTextureAlphaModFloat|SDL_GetTextureBlendMode|SDL_GetTextureColorMod|SDL_GetTextureColorModFloat|SDL_GetTextureScaleMode|SDL_GetTextureSize|SDL_GetWindowAspectRatio|SDL_GetWindowBordersSize|SDL_GetWindowMaximumSize|SDL_GetWindowMinimumSize|SDL_GetWindowPosition|SDL_GetWindowRelativeMouseMode|SDL_GetWindowSafeArea|SDL_GetWindowSize|SDL_GetWindowSizeInPixels|SDL_GetWindowSurfaceVSync|SDL_HideCursor|SDL_HideWindow|SDL_Init|SDL_InitHapticRumble|SDL_InitSubSystem|SDL_LoadWAV|SDL_LoadWAV_IO|SDL_LockAudioStream|SDL_LockProperties|SDL_LockSurface|SDL_LockTexture|SDL_LockTextureToSurface|SDL_MaximizeWindow|SDL_MinimizeWindow|SDL_MixAudio|SDL_OpenURL|SDL_OutOfMemory|SDL_PauseAudioDevice|SDL_PauseAudioStreamDevice|SDL_PauseHaptic|SDL_PlayHapticRumble|SDL_PremultiplyAlpha|SDL_PremultiplySurfaceAlpha|SDL_PushEvent|SDL_PutAudioStreamData|SDL_RaiseWindow|SDL_ReadStorageFile|SDL_ReadSurfacePixel|SDL_ReadSurfacePixelFloat|SDL_RegisterApp|SDL_ReloadGamepadMappings|SDL_RemovePath|SDL_RemoveStoragePath|SDL_RemoveTimer|SDL_RenamePath|SDL_RenameStoragePath|SDL_RenderClear|SDL_RenderCoordinatesFromWindow|SDL_RenderCoordinatesToWindow|SDL_RenderFillRect|SDL_RenderFillRects|SDL_RenderGeometry|SDL_RenderGeometryRaw|SDL_RenderLine|SDL_RenderLines|SDL_RenderPoint|SDL_RenderPoints|SDL_RenderPresent|SDL_RenderRect|SDL_RenderRects|SDL_RenderTexture|SDL_RenderTexture9Grid|SDL_RenderTextureRotated|SDL_RenderTextureTiled|SDL_RequestAndroidPermission|SDL_RestoreWindow|SDL_ResumeAudioDevice|SDL_ResumeAudioStreamDevice|SDL_ResumeHaptic|SDL_RumbleGamepad|SDL_RumbleGamepadTriggers|SDL_RumbleJoystick|SDL_RumbleJoystickTriggers|SDL_RunHapticEffect|SDL_SaveBMP|SDL_SaveBMP_IO|SDL_SendAndroidMessage|SDL_SendGamepadEffect|SDL_SendJoystickEffect|SDL_SendJoystickVirtualSensorData|SDL_SetAppMetadata|SDL_SetAppMetadataProperty|SDL_SetAudioDeviceGain|SDL_SetAudioPostmixCallback|SDL_SetAudioStreamFormat|SDL_SetAudioStreamFrequencyRatio|SDL_SetAudioStreamGain|SDL_SetAudioStreamGetCallback|SDL_SetAudioStreamInputChannelMap|SDL_SetAudioStreamOutputChannelMap|SDL_SetAudioStreamPutCallback|SDL_SetBooleanProperty|SDL_SetClipboardData|SDL_SetClipboardText|SDL_SetCursor|SDL_SetFloatProperty|SDL_SetGamepadLED|SDL_SetGamepadMapping|SDL_SetGamepadPlayerIndex|SDL_SetGamepadSensorEnabled|SDL_SetHapticAutocenter|SDL_SetHapticGain|SDL_SetJoystickLED|SDL_SetJoystickPlayerIndex|SDL_SetJoystickVirtualAxis|SDL_SetJoystickVirtualBall|SDL_SetJoystickVirtualButton|SDL_SetJoystickVirtualHat|SDL_SetJoystickVirtualTouchpad|SDL_SetLinuxThreadPriority|SDL_SetLinuxThreadPriorityAndPolicy|SDL_SetLogPriorityPrefix|SDL_SetMemoryFunctions|SDL_SetNumberProperty|SDL_SetPaletteColors|SDL_SetPointerProperty|SDL_SetPointerPropertyWithCleanup|SDL_SetPrimarySelectionText|SDL_SetRenderClipRect|SDL_SetRenderColorScale|SDL_SetRenderDrawBlendMode|SDL_SetRenderDrawColor|SDL_SetRenderDrawColorFloat|SDL_SetRenderLogicalPresentation|SDL_SetRenderScale|SDL_SetRenderTarget|SDL_SetRenderVSync|SDL_SetRenderViewport|SDL_SetScancodeName|SDL_SetStringProperty|SDL_SetSurfaceAlphaMod|SDL_SetSurfaceBlendMode|SDL_SetSurfaceColorKey|SDL_SetSurfaceColorMod|SDL_SetSurfaceColorspace|SDL_SetSurfacePalette|SDL_SetSurfaceRLE|SDL_SetTLS|SDL_SetTextInputArea|SDL_SetTextureAlphaMod|SDL_SetTextureAlphaModFloat|SDL_SetTextureBlendMode|SDL_SetTextureColorMod|SDL_SetTextureColorModFloat|SDL_SetTextureScaleMode|SDL_SetThreadPriority|SDL_SetWindowAlwaysOnTop|SDL_SetWindowAspectRatio|SDL_SetWindowBordered|SDL_SetWindowFocusable|SDL_SetWindowFullscreen|SDL_SetWindowFullscreenMode|SDL_SetWindowHitTest|SDL_SetWindowIcon|SDL_SetWindowKeyboardGrab|SDL_SetWindowMaximumSize|SDL_SetWindowMinimumSize|SDL_SetWindowModalFor|SDL_SetWindowMouseGrab|SDL_SetWindowMouseRect|SDL_SetWindowOpacity|SDL_SetWindowPosition|SDL_SetWindowRelativeMouseMode|SDL_SetWindowResizable|SDL_SetWindowShape|SDL_SetWindowSize|SDL_SetWindowSurfaceVSync|SDL_SetWindowTitle|SDL_SetiOSAnimationCallback|SDL_ShowAndroidToast|SDL_ShowCursor|SDL_ShowMessageBox|SDL_ShowSimpleMessageBox|SDL_ShowWindow|SDL_ShowWindowSystemMenu|SDL_StartTextInput|SDL_StartTextInputWithProperties|SDL_StopHapticEffect|SDL_StopHapticEffects|SDL_StopHapticRumble|SDL_StopTextInput|SDL_SyncWindow|SDL_TimeToDateTime|SDL_TryLockMutex|SDL_TryLockRWLockForReading|SDL_TryLockRWLockForWriting|SDL_TryWaitSemaphore|SDL_UnlockAudioStream|SDL_UpdateHapticEffect|SDL_UpdateNVTexture|SDL_UpdateTexture|SDL_UpdateWindowSurface|SDL_UpdateWindowSurfaceRects|SDL_UpdateYUVTexture|SDL_Vulkan_CreateSurface|SDL_Vulkan_LoadLibrary|SDL_WaitConditionTimeout|SDL_WaitSemaphoreTimeout|SDL_WarpMouseGlobal|SDL_WriteStorageFile|SDL_WriteSurfacePixel|SDL_WriteSurfacePixelFloat|SDL_size_mul_check_overflow|SDL_size_add_check_overflow)$"; +identifier func =~ "^(SDL_AddEventWatch|SDL_AddHintCallback|SDL_AddSurfaceAlternateImage|SDL_AddVulkanRenderSemaphores|SDL_BindAudioStream|SDL_BindAudioStreams|SDL_BlitSurface|SDL_BlitSurface9Grid|SDL_BlitSurfaceScaled|SDL_BlitSurfaceTiled|SDL_BlitSurfaceTiledWithScale|SDL_BlitSurfaceUnchecked|SDL_BlitSurfaceUncheckedScaled|SDL_CaptureMouse|SDL_ClearAudioStream|SDL_ClearClipboardData|SDL_ClearComposition|SDL_ClearError|SDL_ClearProperty|SDL_ClearSurface|SDL_CloseIO|SDL_CloseStorage|SDL_ConvertAudioSamples|SDL_ConvertEventToRenderCoordinates|SDL_ConvertPixels|SDL_ConvertPixelsAndColorspace|SDL_CopyFile|SDL_CopyProperties|SDL_CopyStorageFile|SDL_CreateDirectory|SDL_CreateStorageDirectory|SDL_CreateWindowAndRenderer|SDL_DateTimeToTime|SDL_DestroyWindowSurface|SDL_DetachVirtualJoystick|SDL_DisableScreenSaver|SDL_EnableScreenSaver|SDL_EnumerateDirectory|SDL_EnumerateProperties|SDL_EnumerateStorageDirectory|SDL_FillSurfaceRect|SDL_FillSurfaceRects|SDL_FlashWindow|SDL_FlipSurface|SDL_FlushAudioStream|SDL_FlushRenderer|SDL_GL_DestroyContext|SDL_GL_GetAttribute|SDL_GL_GetSwapInterval|SDL_GL_LoadLibrary|SDL_GL_MakeCurrent|SDL_GL_SetAttribute|SDL_GL_SetSwapInterval|SDL_GL_SwapWindow|SDL_GetAudioDeviceFormat|SDL_GetAudioStreamFormat|SDL_GetCameraFormat|SDL_GetClosestFullscreenDisplayMode|SDL_GetCurrentRenderOutputSize|SDL_GetCurrentTime|SDL_GetDXGIOutputInfo|SDL_GetDateTimeLocalePreferences|SDL_GetDisplayBounds|SDL_GetDisplayUsableBounds|SDL_GetGDKDefaultUser|SDL_GetGDKTaskQueue|SDL_GetGamepadSensorData|SDL_GetGamepadTouchpadFinger|SDL_GetHapticEffectStatus|SDL_GetJoystickBall|SDL_GetMasksForPixelFormat|SDL_GetPathInfo|SDL_GetRectUnion|SDL_GetRectUnionFloat|SDL_GetRenderClipRect|SDL_GetRenderColorScale|SDL_GetRenderDrawBlendMode|SDL_GetRenderDrawColor|SDL_GetRenderDrawColorFloat|SDL_GetRenderLogicalPresentation|SDL_GetRenderLogicalPresentationRect|SDL_GetRenderOutputSize|SDL_GetRenderSafeArea|SDL_GetRenderScale|SDL_GetRenderVSync|SDL_GetRenderViewport|SDL_GetSensorData|SDL_GetStorageFileSize|SDL_GetStoragePathInfo|SDL_GetSurfaceAlphaMod|SDL_GetSurfaceBlendMode|SDL_GetSurfaceClipRect|SDL_GetSurfaceColorKey|SDL_GetSurfaceColorMod|SDL_GetTextInputArea|SDL_GetTextureAlphaMod|SDL_GetTextureAlphaModFloat|SDL_GetTextureBlendMode|SDL_GetTextureColorMod|SDL_GetTextureColorModFloat|SDL_GetTextureScaleMode|SDL_GetTextureSize|SDL_GetWindowAspectRatio|SDL_GetWindowBordersSize|SDL_GetWindowMaximumSize|SDL_GetWindowMinimumSize|SDL_GetWindowPosition|SDL_GetWindowRelativeMouseMode|SDL_GetWindowSafeArea|SDL_GetWindowSize|SDL_GetWindowSizeInPixels|SDL_GetWindowSurfaceVSync|SDL_HideCursor|SDL_HideWindow|SDL_Init|SDL_InitHapticRumble|SDL_InitSubSystem|SDL_LoadWAV|SDL_LoadWAV_IO|SDL_LockAudioStream|SDL_LockProperties|SDL_LockSurface|SDL_LockTexture|SDL_LockTextureToSurface|SDL_MaximizeWindow|SDL_MinimizeWindow|SDL_MixAudio|SDL_OpenURL|SDL_OutOfMemory|SDL_PauseAudioDevice|SDL_PauseAudioStreamDevice|SDL_PauseHaptic|SDL_PlayHapticRumble|SDL_PremultiplyAlpha|SDL_PremultiplySurfaceAlpha|SDL_PushEvent|SDL_PutAudioStreamData|SDL_RaiseWindow|SDL_ReadStorageFile|SDL_ReadSurfacePixel|SDL_ReadSurfacePixelFloat|SDL_RegisterApp|SDL_ReloadGamepadMappings|SDL_RemovePath|SDL_RemoveStoragePath|SDL_RemoveTimer|SDL_RenamePath|SDL_RenameStoragePath|SDL_RenderClear|SDL_RenderCoordinatesFromWindow|SDL_RenderCoordinatesToWindow|SDL_RenderFillRect|SDL_RenderFillRects|SDL_RenderGeometry|SDL_RenderGeometryRaw|SDL_RenderLine|SDL_RenderLines|SDL_RenderPoint|SDL_RenderPoints|SDL_RenderPresent|SDL_RenderRect|SDL_RenderRects|SDL_RenderTexture|SDL_RenderTexture9Grid|SDL_RenderTextureRotated|SDL_RenderTextureTiled|SDL_RequestAndroidPermission|SDL_RestoreWindow|SDL_ResumeAudioDevice|SDL_ResumeAudioStreamDevice|SDL_ResumeHaptic|SDL_RumbleGamepad|SDL_RumbleGamepadTriggers|SDL_RumbleJoystick|SDL_RumbleJoystickTriggers|SDL_RunHapticEffect|SDL_SaveBMP|SDL_SaveBMP_IO|SDL_SendAndroidMessage|SDL_SendGamepadEffect|SDL_SendJoystickEffect|SDL_SendJoystickVirtualSensorData|SDL_SetAppMetadata|SDL_SetAppMetadataProperty|SDL_SetAudioDeviceGain|SDL_SetAudioPostmixCallback|SDL_SetAudioStreamFormat|SDL_SetAudioStreamFrequencyRatio|SDL_SetAudioStreamGain|SDL_SetAudioStreamGetCallback|SDL_SetAudioStreamInputChannelMap|SDL_SetAudioStreamOutputChannelMap|SDL_SetAudioStreamPutCallback|SDL_SetBooleanProperty|SDL_SetClipboardData|SDL_SetClipboardText|SDL_SetCursor|SDL_SetFloatProperty|SDL_SetGamepadLED|SDL_SetGamepadMapping|SDL_SetGamepadPlayerIndex|SDL_SetGamepadSensorEnabled|SDL_SetHapticAutocenter|SDL_SetHapticGain|SDL_SetJoystickLED|SDL_SetJoystickPlayerIndex|SDL_SetJoystickVirtualAxis|SDL_SetJoystickVirtualBall|SDL_SetJoystickVirtualButton|SDL_SetJoystickVirtualHat|SDL_SetJoystickVirtualTouchpad|SDL_SetLinuxThreadPriority|SDL_SetLinuxThreadPriorityAndPolicy|SDL_SetLogPriorityPrefix|SDL_SetMemoryFunctions|SDL_SetNumberProperty|SDL_SetPaletteColors|SDL_SetPointerProperty|SDL_SetPointerPropertyWithCleanup|SDL_SetPrimarySelectionText|SDL_SetRenderClipRect|SDL_SetRenderColorScale|SDL_SetRenderDrawBlendMode|SDL_SetRenderDrawColor|SDL_SetRenderDrawColorFloat|SDL_SetRenderLogicalPresentation|SDL_SetRenderScale|SDL_SetRenderTarget|SDL_SetRenderVSync|SDL_SetRenderViewport|SDL_SetScancodeName|SDL_SetStringProperty|SDL_SetSurfaceAlphaMod|SDL_SetSurfaceBlendMode|SDL_SetSurfaceColorKey|SDL_SetSurfaceColorMod|SDL_SetSurfaceColorspace|SDL_SetSurfacePalette|SDL_SetSurfaceRLE|SDL_SetTLS|SDL_SetTextInputArea|SDL_SetTextureAlphaMod|SDL_SetTextureAlphaModFloat|SDL_SetTextureBlendMode|SDL_SetTextureColorMod|SDL_SetTextureColorModFloat|SDL_SetTextureScaleMode|SDL_SetThreadPriority|SDL_SetWindowAlwaysOnTop|SDL_SetWindowAspectRatio|SDL_SetWindowBordered|SDL_SetWindowFocusable|SDL_SetWindowFullscreen|SDL_SetWindowFullscreenMode|SDL_SetWindowHitTest|SDL_SetWindowIcon|SDL_SetWindowKeyboardGrab|SDL_SetWindowMaximumSize|SDL_SetWindowMinimumSize|SDL_SetWindowModalFor|SDL_SetWindowMouseGrab|SDL_SetWindowMouseRect|SDL_SetWindowOpacity|SDL_SetWindowPosition|SDL_SetWindowRelativeMouseMode|SDL_SetWindowResizable|SDL_SetWindowShape|SDL_SetWindowSize|SDL_SetWindowSurfaceVSync|SDL_SetWindowTitle|SDL_SetiOSAnimationCallback|SDL_ShowAndroidToast|SDL_ShowCursor|SDL_ShowMessageBox|SDL_ShowSimpleMessageBox|SDL_ShowWindow|SDL_ShowWindowSystemMenu|SDL_StartTextInput|SDL_StartTextInputWithProperties|SDL_StopHapticEffect|SDL_StopHapticEffects|SDL_StopHapticRumble|SDL_StopTextInput|SDL_SyncWindow|SDL_TimeToDateTime|SDL_TryLockMutex|SDL_TryLockRWLockForReading|SDL_TryLockRWLockForWriting|SDL_TryWaitSemaphore|SDL_UnlockAudioStream|SDL_UpdateHapticEffect|SDL_UpdateNVTexture|SDL_UpdateTexture|SDL_UpdateWindowSurface|SDL_UpdateWindowSurfaceRects|SDL_UpdateYUVTexture|SDL_Vulkan_CreateSurface|SDL_Vulkan_LoadLibrary|SDL_WaitConditionTimeout|SDL_WaitSemaphoreTimeout|SDL_WarpMouseGlobal|SDL_WriteStorageFile|SDL_WriteSurfacePixel|SDL_WriteSurfacePixelFloat|SDL_size_mul_check_overflow|SDL_size_add_check_overflow|TTF_GlyphMetrics|TTF_GlyphMetrics32|TTF_Init|TTF_MeasureText|TTF_MeasureUNICODE|TTF_MeasureUTF8|TTF_SetFontDirection|TTF_SetFontLanguage|TTF_SetFontScriptName|TTF_SetFontSDF|TTF_SetFontSize|TTF_SetFontSizeDPI|TTF_SizeText|TTF_SizeUNICODE|TTF_SizeUTF8|IMG_SaveAVIF|IMG_SaveAVIF_IO|IMG_SaveJPG|IMG_SaveJPG_IO|IMG_SavePNG|IMG_SavePNG_IO|Mix_FadeInMusic|Mix_FadeInMusicPos|Mix_GroupChannels|Mix_ModMusicJumpToOrder|Mix_OpenAudio|Mix_PlayMusic|Mix_SetMusicCMD|Mix_SetMusicPosition|Mix_SetSoundFonts|Mix_StartTrack)$"; @@ ( func( @@ -3653,3 +3666,36 @@ identifier func =~ "^(SDL_AddEventWatch|SDL_AddHintCallback|SDL_AddSurfaceAltern ) - == -1 ) +@@ +@@ +- SDL_NUM_LOG_PRIORITIES ++ SDL_LOG_PRIORITY_COUNT +@@ +@@ +- SDL_MESSAGEBOX_COLOR_MAX ++ SDL_MESSAGEBOX_COLOR_COUNT +@@ +@@ +- SDL_NUM_SYSTEM_CURSORS ++ SDL_SYSTEM_CURSOR_COUNT +@@ +@@ +- SDL_NUM_SCANCODES ++ SDL_SCANCODE_COUNT +@@ +@@ +- SDL_GetCPUCount ++ SDL_GetNumLogicalCPUCores + (...) +@@ +@@ +- SDL_bool ++ bool +@@ +@@ +- SDL_TRUE ++ true +@@ +@@ +- SDL_FALSE ++ false diff --git a/build-scripts/add-source-to-projects.pl b/build-scripts/add-source-to-projects.pl index 6d703dc3..5ba0a697 100755 --- a/build-scripts/add-source-to-projects.pl +++ b/build-scripts/add-source-to-projects.pl @@ -591,7 +591,6 @@ foreach (@ARGV) { process_xcode($arg, 'Xcode/SDL/SDL.xcodeproj/project.pbxproj'); process_visualstudio($arg, 'VisualC/SDL/SDL.vcxproj'); process_visualstudio($arg, 'VisualC-GDK/SDL/SDL.vcxproj'); - process_visualstudio($arg, 'VisualC-WinRT/SDL-UWP.vcxproj'); } print("Done. Please run `git diff` and make sure this looks okay!\n"); diff --git a/build-scripts/build-release.py b/build-scripts/build-release.py index fa33c604..92479258 100755 --- a/build-scripts/build-release.py +++ b/build-scripts/build-release.py @@ -179,7 +179,7 @@ class Releaser: continue mod_type, file_paths = line.split(maxsplit=1) assert current_time is not None - for file_path in file_paths.split(): + for file_path in file_paths.split("\t"): if file_path in set_paths and file_path not in path_times: path_times[file_path] = current_time assert set(path_times.keys()) == set_paths @@ -264,7 +264,7 @@ class Releaser: self.artifacts[f"src-tar-{comp}"] = tar_path def create_xcframework(self, configuration: str="Release") -> None: - dmg_in = self.root / f"Xcode/SDL/build/SDL3.dmg" + dmg_in = self.root / f"Xcode/SDL/build/{self.project}.dmg" dmg_in.unlink(missing_ok=True) self.executer.run(["xcodebuild", "-project", str(self.root / "Xcode/SDL/SDL.xcodeproj"), "-target", "SDL3.dmg", "-configuration", configuration]) if self.dry: diff --git a/build-scripts/clang-format-src.sh b/build-scripts/clang-format-src.sh index 4519053e..bc0defc7 100755 --- a/build-scripts/clang-format-src.sh +++ b/build-scripts/clang-format-src.sh @@ -19,6 +19,7 @@ git checkout \ stdlib/SDL_qsort.c \ stdlib/SDL_strtokr.c \ video/khronos \ + video/x11/edid.h \ video/x11/edid-parse.c \ video/x11/xsettings-client.* \ video/yuv2rgb diff --git a/build-scripts/rename_api.py b/build-scripts/rename_api.py index 7686d072..605ffa0f 100755 --- a/build-scripts/rename_api.py +++ b/build-scripts/rename_api.py @@ -57,7 +57,7 @@ def main(): i += 2 regex = create_regex_from_replacements(replacements) - for dir in ["src", "test", "include", "docs", "cmake/test"]: + for dir in ["src", "test", "examples", "include", "docs", "cmake/test"]: replace_symbols_in_path(SDL_ROOT / dir, regex, replacements) # Replace the symbols in documentation diff --git a/build-scripts/rename_macros.py b/build-scripts/rename_macros.py index 913b10e5..ba386cd4 100755 --- a/build-scripts/rename_macros.py +++ b/build-scripts/rename_macros.py @@ -129,7 +129,6 @@ RENAMED_MACROS = { "__VITA__": "SDL_PLATFORM_VITA", "__3DS__": "SDL_PLATFORM_3DS", # "__unix__": "SDL_PLATFORM_UNIX, - "__WINRT__": "SDL_PLATFORM_WINRT", "__XBOXSERIES__": "SDL_PLATFORM_XBOXSERIES", "__XBOXONE__": "SDL_PLATFORM_XBOXONE", "__WINDOWS__": "SDL_PLATFORM_WINDOWS", @@ -145,6 +144,7 @@ DEPRECATED_PLATFORM_MACROS = { "__NACL__", "__PNACL__", "__WINDOWS__", + "__WINRT__", "SDL_ALTIVEC_BLITTERS", "SDL_ARM_NEON_BLITTERS", "SDL_ARM_SIMD_BLITTERS", diff --git a/build-scripts/rename_types.py b/build-scripts/rename_types.py new file mode 100755 index 00000000..137b4096 --- /dev/null +++ b/build-scripts/rename_types.py @@ -0,0 +1,80 @@ +#!/usr/bin/env python3 +# +# This script renames symbols in the specified paths + +import argparse +import os +import pathlib +import re +import sys + + +def main(): + if len(args.args) < 1: + print("Usage: %s files_or_directories ..." % sys.argv[0]) + exit(1) + + replacements = { + "SDL_bool": "bool", + "SDL_TRUE": "true", + "SDL_FALSE": "false", + } + entries = args.args[0:] + + regex = create_regex_from_replacements(replacements) + + for entry in entries: + path = pathlib.Path(entry) + if not path.exists(): + print("%s doesn't exist, skipping" % entry) + continue + + replace_symbols_in_path(path, regex, replacements) + +def create_regex_from_replacements(replacements): + return re.compile(r"\b(%s)\b" % "|".join(map(re.escape, replacements.keys()))) + +def replace_symbols_in_file(file, regex, replacements): + try: + with file.open("r", encoding="UTF-8", newline="") as rfp: + original = rfp.read() + contents = regex.sub(lambda mo: replacements[mo.string[mo.start():mo.end()]], original) + if contents != original: + with file.open("w", encoding="UTF-8", newline="") as wfp: + wfp.write(contents) + except UnicodeDecodeError: + print("%s is not text, skipping" % file) + except Exception as err: + print("%s" % err) + + +def replace_symbols_in_dir(path, regex, replacements): + for entry in path.glob("*"): + if entry.is_dir(): + replace_symbols_in_dir(entry, regex, replacements) + else: + print("Processing %s" % entry) + replace_symbols_in_file(entry, regex, replacements) + + +def replace_symbols_in_path(path, regex, replacements): + if path.is_dir(): + replace_symbols_in_dir(path, regex, replacements) + else: + replace_symbols_in_file(path, regex, replacements) + + +if __name__ == "__main__": + + parser = argparse.ArgumentParser(fromfile_prefix_chars='@') + parser.add_argument("args", nargs="*") + args = parser.parse_args() + + try: + main() + except Exception as e: + print(e) + exit(-1) + + exit(0) + diff --git a/build-scripts/setup-gdk-desktop.py b/build-scripts/setup-gdk-desktop.py old mode 100644 new mode 100755 diff --git a/cmake/PreseedEmscriptenCache.cmake b/cmake/PreseedEmscriptenCache.cmake index 261e7ea6..5a34ab5a 100644 --- a/cmake/PreseedEmscriptenCache.cmake +++ b/cmake/PreseedEmscriptenCache.cmake @@ -98,6 +98,7 @@ if(EMSCRIPTEN) set(LIBC_HAS_STRNCMP "1" CACHE INTERNAL "Have symbol strncmp") set(LIBC_HAS_STRNLEN "1" CACHE INTERNAL "Have symbol strnlen") set(LIBC_HAS_STRNSTR "" CACHE INTERNAL "Have symbol strnstr") + set(LIBC_HAS_STRPBRK "1" CACHE INTERNAL "Have symbol strpbrk") set(LIBC_HAS_STRRCHR "1" CACHE INTERNAL "Have symbol strrchr") set(LIBC_HAS_STRSTR "1" CACHE INTERNAL "Have symbol strstr") set(LIBC_HAS_STRTOD "1" CACHE INTERNAL "Have symbol strtod") diff --git a/cmake/PreseedMSVCCache.cmake b/cmake/PreseedMSVCCache.cmake index 76d3fa4b..17495aa4 100644 --- a/cmake/PreseedMSVCCache.cmake +++ b/cmake/PreseedMSVCCache.cmake @@ -111,6 +111,7 @@ if(MSVC) set(LIBC_HAS_STRNCMP "1" CACHE INTERNAL "Have symbol strncmp") set(LIBC_HAS_STRNLEN "1" CACHE INTERNAL "Have symbol strnlen") set(LIBC_HAS_STRNSTR "" CACHE INTERNAL "Have symbol strnstr") + set(LIBC_HAS_STRPBRK "1" CACHE INTERNAL "Have symbol strpbrk") set(LIBC_HAS_STRRCHR "1" CACHE INTERNAL "Have symbol strrchr") set(LIBC_HAS_STRSTR "1" CACHE INTERNAL "Have symbol strstr") set(LIBC_HAS_STRTOD "1" CACHE INTERNAL "Have symbol strtod") diff --git a/cmake/sdl3.pc.in b/cmake/sdl3.pc.in index bfc2afff..38566f57 100644 --- a/cmake/sdl3.pc.in +++ b/cmake/sdl3.pc.in @@ -1,7 +1,7 @@ prefix=@SDL_PKGCONFIG_PREFIX@ exec_prefix=${prefix} -libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@ -includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@ +libdir=@LIBDIR_FOR_PKG_CONFIG@ +includedir=@INCLUDEDIR_FOR_PKG_CONFIG@ Name: sdl3 Description: Simple DirectMedia Layer is a cross-platform multimedia library designed to provide low level access to audio, keyboard, mouse, joystick, 3D hardware via OpenGL, and 2D video framebuffer. diff --git a/cmake/sdltargets.cmake b/cmake/sdltargets.cmake index d11061c9..781ca01c 100644 --- a/cmake/sdltargets.cmake +++ b/cmake/sdltargets.cmake @@ -346,6 +346,17 @@ function(configure_sdl3_pc) string(REGEX REPLACE "[/]+$" "" SDL_PATH_PREFIX_RELATIVE_TO_PKGCONFIG "${SDL_PATH_PREFIX_RELATIVE_TO_PKGCONFIG}") set(SDL_PKGCONFIG_PREFIX "\${pcfiledir}/${SDL_PATH_PREFIX_RELATIVE_TO_PKGCONFIG}") + if(IS_ABSOLUTE "${CMAKE_INSTALL_INCLUDEDIR}") + set(INCLUDEDIR_FOR_PKG_CONFIG "${CMAKE_INSTALL_INCLUDEDIR}") + else() + set(INCLUDEDIR_FOR_PKG_CONFIG "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}") + endif() + if(IS_ABSOLUTE "${CMAKE_INSTALL_LIBDIR}") + set(LIBDIR_FOR_PKG_CONFIG "${CMAKE_INSTALL_LIBDIR}") + else() + set(LIBDIR_FOR_PKG_CONFIG "\${prefix}/${CMAKE_INSTALL_LIBDIR}") + endif() + configure_file("${SDL3_SOURCE_DIR}/cmake/sdl3.pc.in" "${SDL3_BINARY_DIR}/sdl3.pc" @ONLY) endfunction() diff --git a/cmake/test/CMakeLists.txt b/cmake/test/CMakeLists.txt index faa79e65..e3766f0e 100644 --- a/cmake/test/CMakeLists.txt +++ b/cmake/test/CMakeLists.txt @@ -21,12 +21,6 @@ endif() message(STATUS "CMAKE_SYSTEM_NAME= ${CMAKE_SYSTEM_NAME}") message(STATUS "CMAKE_SYSTEM_PROCESSOR= ${CMAKE_SYSTEM_PROCESSOR}") -if(WINDOWS_STORE) - enable_language(CXX) - add_compile_options("$<$:/ZW>") - set_source_files_properties(ain_cli.c main_gui.c PROPERTIES LANGUAGE CXX) -endif() - include(GenerateExportHeader) if(ANDROID) diff --git a/docs/README-documentation-rules.md b/docs/README-documentation-rules.md index 4506dc0b..ae705378 100644 --- a/docs/README-documentation-rules.md +++ b/docs/README-documentation-rules.md @@ -64,6 +64,10 @@ Note the `/**` at the start of the comment. That's a "Doxygen-style" comment, and wikiheaders will treat this differently than a comment with one `*`, as this signifies that this is not just a comment, but _documentation_. +These comments _must_ start in the first column of the line, or wikiheaders +will ignore them, even with the "/**" start (we should improve the script +someday to handle this, but currently this is a requirement). + We do _not_ parse every magic Doxygen tag, and we don't parse them in `@param` format. The goal here was to mostly coexist with people that might want to run Doxygen on the SDL headers, not to build Doxygen from scratch. That diff --git a/docs/README-dynapi.md b/docs/README-dynapi.md index 60a29498..9c137dbf 100644 --- a/docs/README-dynapi.md +++ b/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 -SDL_bool SDL_Init(SDL_InitFlags flags) +bool SDL_Init(SDL_InitFlags flags) { return jump_table.SDL_Init(flags); } @@ -49,7 +49,7 @@ SDL_Init() that you've been calling all this time. But at startup, it looks more like this: ```c -SDL_bool SDL_Init_DEFAULT(SDL_InitFlags flags) +bool SDL_Init_DEFAULT(SDL_InitFlags flags) { SDL_InitDynamicAPI(); return jump_table.SDL_Init(flags); diff --git a/docs/README-ios.md b/docs/README-ios.md index cce35b58..06e2375a 100644 --- a/docs/README-ios.md +++ b/docs/README-ios.md @@ -139,7 +139,7 @@ void SDL_StartTextInput() void SDL_StopTextInput() -- disables text events and hides the onscreen keyboard. -SDL_bool SDL_TextInputActive() +bool SDL_TextInputActive() -- returns whether or not text events are enabled (and the onscreen keyboard is visible) @@ -225,7 +225,7 @@ Game Center Game Center integration might require that you break up your main loop in order to yield control back to the system. In other words, instead of running an endless main loop, you run each frame in a callback function, using: - SDL_bool SDL_SetiOSAnimationCallback(SDL_Window * window, int interval, SDL_iOSAnimationCallback callback, void *callbackParam); + bool SDL_SetiOSAnimationCallback(SDL_Window * window, int interval, SDL_iOSAnimationCallback callback, void *callbackParam); This will set up the given function to be called back on the animation callback, and then you have to return from main() to let the Cocoa event loop run. diff --git a/docs/README-migration.md b/docs/README-migration.md index 52276c7d..7e402ba3 100644 --- a/docs/README-migration.md +++ b/docs/README-migration.md @@ -6,7 +6,7 @@ Details on API changes are organized by SDL 2.0 header below. The file with your main() function should include , as that is no longer included in SDL.h. -Functions that previously returned a negative error code now return SDL_bool. +Functions that previously returned a negative error code now return bool. Code that used to look like this: ```c @@ -86,11 +86,14 @@ The following structures have been renamed: - SDL_atomic_t => SDL_AtomicInt The following functions have been renamed: -* SDL_AtomicCAS() => SDL_AtomicCompareAndSwap() -* SDL_AtomicCASPtr() => SDL_AtomicCompareAndSwapPointer() -* SDL_AtomicGetPtr() => SDL_AtomicGetPointer() +* SDL_AtomicAdd() => SDL_AddAtomicInt() +* SDL_AtomicCAS() => SDL_CompareAndSwapAtomicInt() +* SDL_AtomicCASPtr() => SDL_CompareAndSwapAtomicPointer() +* SDL_AtomicGet() => SDL_GetAtomicInt() +* SDL_AtomicGetPtr() => SDL_GetAtomicPointer() * SDL_AtomicLock() => SDL_LockSpinlock() -* SDL_AtomicSetPtr() => SDL_AtomicSetPointer() +* SDL_AtomicSet() => SDL_SetAtomicInt() +* SDL_AtomicSetPtr() => SDL_SetAtomicPointer() * SDL_AtomicTryLock() => SDL_TryLockSpinlock() * SDL_AtomicUnlock() => SDL_UnlockSpinlock() @@ -223,7 +226,7 @@ SDL_FreeWAV has been removed and calls can be replaced with SDL_free. SDL_LoadWAV() is a proper function now and no longer a macro (but offers the same functionality otherwise). -SDL_LoadWAV_IO() and SDL_LoadWAV() return an SDL_bool now, like most of SDL. They no longer return a pointer to an SDL_AudioSpec. +SDL_LoadWAV_IO() and SDL_LoadWAV() return an bool now, like most of SDL. They no longer return a pointer to an SDL_AudioSpec. SDL_AudioCVT interface has been removed, the SDL_AudioStream interface (for audio supplied in pieces) or the new SDL_ConvertAudioSamples() function (for converting a complete audio buffer in one call) can be used instead. @@ -280,13 +283,13 @@ In SDL2, SDL_AUDIODEVICEREMOVED events would fire for open devices with the `whi The following functions have been renamed: * SDL_AudioStreamAvailable() => SDL_GetAudioStreamAvailable() -* SDL_AudioStreamClear() => SDL_ClearAudioStream(), returns SDL_bool -* SDL_AudioStreamFlush() => SDL_FlushAudioStream(), returns SDL_bool +* SDL_AudioStreamClear() => SDL_ClearAudioStream(), returns bool +* SDL_AudioStreamFlush() => SDL_FlushAudioStream(), returns bool * SDL_AudioStreamGet() => SDL_GetAudioStreamData() -* SDL_AudioStreamPut() => SDL_PutAudioStreamData(), returns SDL_bool +* SDL_AudioStreamPut() => SDL_PutAudioStreamData(), returns bool * SDL_FreeAudioStream() => SDL_DestroyAudioStream() -* SDL_LoadWAV_RW() => SDL_LoadWAV_IO(), returns SDL_bool -* SDL_MixAudioFormat() => SDL_MixAudio(), returns SDL_bool +* SDL_LoadWAV_RW() => SDL_LoadWAV_IO(), returns bool +* SDL_MixAudioFormat() => SDL_MixAudio(), returns bool * SDL_NewAudioStream() => SDL_CreateAudioStream() @@ -341,6 +344,7 @@ SDL_HasRDTSC() has been removed; there is no replacement. Don't use the RDTSC op SDL_SIMDAlloc(), SDL_SIMDRealloc(), and SDL_SIMDFree() have been removed. You can use SDL_aligned_alloc() and SDL_aligned_free() with SDL_GetSIMDAlignment() to get the same functionality. The following functions have been renamed: +* SDL_GetCPUCount() => SDL_GetNumLogicalCPUCores() * SDL_SIMDGetAlignment() => SDL_GetSIMDAlignment() ## SDL_endian.h @@ -360,6 +364,8 @@ The following functions have been removed: ## SDL_events.h +SDL_PRESSED and SDL_RELEASED have been removed. For the most part you can replace uses of these with true and false respectively. Events which had a field `state` to represent these values have had those fields changed to bool `down`, e.g. `event.key.state` is now `event.key.down`. + The timestamp member of the SDL_Event structure now represents nanoseconds, and is populated with SDL_GetTicksNS() The timestamp_us member of the sensor events has been renamed sensor_timestamp and now represents nanoseconds. This value is filled in from the hardware, if available, and may not be synchronized with values returned from SDL_GetTicksNS(). @@ -411,7 +417,7 @@ SDL_AddEventWatch() now returns SDL_FALSE_ if it fails because it ran out of mem SDL_RegisterEvents() now returns 0 if it couldn't allocate any user events. -SDL_EventFilter functions now return SDL_bool. +SDL_EventFilter functions now return bool. The following symbols have been renamed: * SDL_APP_DIDENTERBACKGROUND => SDL_EVENT_DID_ENTER_BACKGROUND @@ -505,15 +511,15 @@ The gamepad face buttons have been renamed from A/B/X/Y to North/South/East/West #define CONFIRM_BUTTON SDL_GAMEPAD_BUTTON_SOUTH #define CANCEL_BUTTON SDL_GAMEPAD_BUTTON_EAST -SDL_bool flipped_buttons; +bool flipped_buttons; void InitMappedButtons(SDL_Gamepad *gamepad) { if (!GetFlippedButtonSetting(&flipped_buttons)) { if (SDL_GetGamepadButtonLabel(gamepad, SDL_GAMEPAD_BUTTON_SOUTH) == SDL_GAMEPAD_BUTTON_LABEL_B) { - flipped_buttons = SDL_TRUE; + flipped_buttons = true; } else { - flipped_buttons = SDL_FALSE; + flipped_buttons = false; } } } @@ -571,7 +577,7 @@ SDL_CONTROLLER_TYPE_VIRTUAL has been removed, so virtual controllers can emulate SDL_CONTROLLER_TYPE_AMAZON_LUNA has been removed, and can be replaced with this code: ```c -SDL_bool SDL_IsJoystickAmazonLunaController(Uint16 vendor_id, Uint16 product_id) +bool SDL_IsJoystickAmazonLunaController(Uint16 vendor_id, Uint16 product_id) { return ((vendor_id == 0x1949 && product_id == 0x0419) || (vendor_id == 0x0171 && product_id == 0x0419)); @@ -580,7 +586,7 @@ SDL_bool SDL_IsJoystickAmazonLunaController(Uint16 vendor_id, Uint16 product_id) SDL_CONTROLLER_TYPE_GOOGLE_STADIA has been removed, and can be replaced with this code: ```c -SDL_bool SDL_IsJoystickGoogleStadiaController(Uint16 vendor_id, Uint16 product_id) +bool SDL_IsJoystickGoogleStadiaController(Uint16 vendor_id, Uint16 product_id) { return (vendor_id == 0x18d1 && product_id == 0x9400); } @@ -588,7 +594,7 @@ SDL_bool SDL_IsJoystickGoogleStadiaController(Uint16 vendor_id, Uint16 product_i SDL_CONTROLLER_TYPE_NVIDIA_SHIELD has been removed, and can be replaced with this code: ```c -SDL_bool SDL_IsJoystickNVIDIASHIELDController(Uint16 vendor_id, Uint16 product_id) +bool SDL_IsJoystickNVIDIASHIELDController(Uint16 vendor_id, Uint16 product_id) { return (vendor_id == 0x0955 && (product_id == 0x7210 || product_id == 0x7214)); } @@ -596,6 +602,8 @@ SDL_bool SDL_IsJoystickNVIDIASHIELDController(Uint16 vendor_id, Uint16 product_i The inputType and outputType fields of SDL_GamepadBinding have been renamed input_type and output_type. +SDL_GetGamepadTouchpadFinger() takes a pointer to bool for the finger state instead of a pointer to Uint8. + The following enums have been renamed: * SDL_GameControllerAxis => SDL_GamepadAxis * SDL_GameControllerBindType => SDL_GamepadBindingType @@ -626,13 +634,13 @@ The following functions have been renamed: * SDL_GameControllerGetPlayerIndex() => SDL_GetGamepadPlayerIndex() * SDL_GameControllerGetProduct() => SDL_GetGamepadProduct() * SDL_GameControllerGetProductVersion() => SDL_GetGamepadProductVersion() -* SDL_GameControllerGetSensorData() => SDL_GetGamepadSensorData(), returns SDL_bool +* SDL_GameControllerGetSensorData() => SDL_GetGamepadSensorData(), returns bool * SDL_GameControllerGetSensorDataRate() => SDL_GetGamepadSensorDataRate() * SDL_GameControllerGetSerial() => SDL_GetGamepadSerial() * SDL_GameControllerGetSteamHandle() => SDL_GetGamepadSteamHandle() * SDL_GameControllerGetStringForAxis() => SDL_GetGamepadStringForAxis() * SDL_GameControllerGetStringForButton() => SDL_GetGamepadStringForButton() -* SDL_GameControllerGetTouchpadFinger() => SDL_GetGamepadTouchpadFinger(), returns SDL_bool +* SDL_GameControllerGetTouchpadFinger() => SDL_GetGamepadTouchpadFinger(), returns bool * SDL_GameControllerGetType() => SDL_GetGamepadType() * SDL_GameControllerGetVendor() => SDL_GetGamepadVendor() * SDL_GameControllerHasAxis() => SDL_GamepadHasAxis() @@ -644,12 +652,12 @@ The following functions have been renamed: * SDL_GameControllerName() => SDL_GetGamepadName() * SDL_GameControllerOpen() => SDL_OpenGamepad() * SDL_GameControllerPath() => SDL_GetGamepadPath() -* SDL_GameControllerRumble() => SDL_RumbleGamepad(), returns SDL_bool -* SDL_GameControllerRumbleTriggers() => SDL_RumbleGamepadTriggers(), returns SDL_bool -* SDL_GameControllerSendEffect() => SDL_SendGamepadEffect(), returns SDL_bool -* SDL_GameControllerSetLED() => SDL_SetGamepadLED(), returns SDL_bool -* SDL_GameControllerSetPlayerIndex() => SDL_SetGamepadPlayerIndex(), returns SDL_bool -* SDL_GameControllerSetSensorEnabled() => SDL_SetGamepadSensorEnabled(), returns SDL_bool +* SDL_GameControllerRumble() => SDL_RumbleGamepad(), returns bool +* SDL_GameControllerRumbleTriggers() => SDL_RumbleGamepadTriggers(), returns bool +* SDL_GameControllerSendEffect() => SDL_SendGamepadEffect(), returns bool +* SDL_GameControllerSetLED() => SDL_SetGamepadLED(), returns bool +* SDL_GameControllerSetPlayerIndex() => SDL_SetGamepadPlayerIndex(), returns bool +* SDL_GameControllerSetSensorEnabled() => SDL_SetGamepadSensorEnabled(), returns bool * SDL_GameControllerUpdate() => SDL_UpdateGamepads() * SDL_IsGameController() => SDL_IsGamepad() @@ -671,7 +679,7 @@ The following symbols have been renamed: * SDL_CONTROLLER_AXIS_INVALID => SDL_GAMEPAD_AXIS_INVALID * SDL_CONTROLLER_AXIS_LEFTX => SDL_GAMEPAD_AXIS_LEFTX * SDL_CONTROLLER_AXIS_LEFTY => SDL_GAMEPAD_AXIS_LEFTY -* SDL_CONTROLLER_AXIS_MAX => SDL_GAMEPAD_AXIS_MAX +* SDL_CONTROLLER_AXIS_MAX => SDL_GAMEPAD_AXIS_COUNT * SDL_CONTROLLER_AXIS_RIGHTX => SDL_GAMEPAD_AXIS_RIGHTX * SDL_CONTROLLER_AXIS_RIGHTY => SDL_GAMEPAD_AXIS_RIGHTY * SDL_CONTROLLER_AXIS_TRIGGERLEFT => SDL_GAMEPAD_AXIS_LEFT_TRIGGER @@ -691,7 +699,7 @@ The following symbols have been renamed: * SDL_CONTROLLER_BUTTON_INVALID => SDL_GAMEPAD_BUTTON_INVALID * SDL_CONTROLLER_BUTTON_LEFTSHOULDER => SDL_GAMEPAD_BUTTON_LEFT_SHOULDER * SDL_CONTROLLER_BUTTON_LEFTSTICK => SDL_GAMEPAD_BUTTON_LEFT_STICK -* SDL_CONTROLLER_BUTTON_MAX => SDL_GAMEPAD_BUTTON_MAX +* SDL_CONTROLLER_BUTTON_MAX => SDL_GAMEPAD_BUTTON_COUNT * SDL_CONTROLLER_BUTTON_MISC1 => SDL_GAMEPAD_BUTTON_MISC1 * SDL_CONTROLLER_BUTTON_PADDLE1 => SDL_GAMEPAD_BUTTON_RIGHT_PADDLE1 * SDL_CONTROLLER_BUTTON_PADDLE2 => SDL_GAMEPAD_BUTTON_LEFT_PADDLE1 @@ -752,12 +760,12 @@ Rather than iterating over haptic devices using device index, there is a new fun } ``` -SDL_GetHapticEffectStatus() now returns SDL_bool instead of an int result. You should call SDL_GetHapticFeatures() to make sure effect status is supported before calling this function. +SDL_GetHapticEffectStatus() now returns bool instead of an int result. You should call SDL_GetHapticFeatures() to make sure effect status is supported before calling this function. The following functions have been renamed: * SDL_HapticClose() => SDL_CloseHaptic() * SDL_HapticDestroyEffect() => SDL_DestroyHapticEffect() -* SDL_HapticGetEffectStatus() => SDL_GetHapticEffectStatus(), returns SDL_bool +* SDL_HapticGetEffectStatus() => SDL_GetHapticEffectStatus(), returns bool * SDL_HapticNewEffect() => SDL_CreateHapticEffect() * SDL_HapticNumAxes() => SDL_GetNumHapticAxes() * SDL_HapticNumEffects() => SDL_GetMaxHapticEffects() @@ -765,18 +773,18 @@ The following functions have been renamed: * SDL_HapticOpen() => SDL_OpenHaptic() * SDL_HapticOpenFromJoystick() => SDL_OpenHapticFromJoystick() * SDL_HapticOpenFromMouse() => SDL_OpenHapticFromMouse() -* SDL_HapticPause() => SDL_PauseHaptic(), returns SDL_bool +* SDL_HapticPause() => SDL_PauseHaptic(), returns bool * SDL_HapticQuery() => SDL_GetHapticFeatures() -* SDL_HapticRumbleInit() => SDL_InitHapticRumble(), returns SDL_bool -* SDL_HapticRumblePlay() => SDL_PlayHapticRumble(), returns SDL_bool -* SDL_HapticRumbleStop() => SDL_StopHapticRumble(), returns SDL_bool -* SDL_HapticRunEffect() => SDL_RunHapticEffect(), returns SDL_bool -* SDL_HapticSetAutocenter() => SDL_SetHapticAutocenter(), returns SDL_bool -* SDL_HapticSetGain() => SDL_SetHapticGain(), returns SDL_bool -* SDL_HapticStopAll() => SDL_StopHapticEffects(), returns SDL_bool -* SDL_HapticStopEffect() => SDL_StopHapticEffect(), returns SDL_bool -* SDL_HapticUnpause() => SDL_ResumeHaptic(), returns SDL_bool -* SDL_HapticUpdateEffect() => SDL_UpdateHapticEffect(), returns SDL_bool +* SDL_HapticRumbleInit() => SDL_InitHapticRumble(), returns bool +* SDL_HapticRumblePlay() => SDL_PlayHapticRumble(), returns bool +* SDL_HapticRumbleStop() => SDL_StopHapticRumble(), returns bool +* SDL_HapticRunEffect() => SDL_RunHapticEffect(), returns bool +* SDL_HapticSetAutocenter() => SDL_SetHapticAutocenter(), returns bool +* SDL_HapticSetGain() => SDL_SetHapticGain(), returns bool +* SDL_HapticStopAll() => SDL_StopHapticEffects(), returns bool +* SDL_HapticStopEffect() => SDL_StopHapticEffect(), returns bool +* SDL_HapticUnpause() => SDL_ResumeHaptic(), returns bool +* SDL_HapticUpdateEffect() => SDL_UpdateHapticEffect(), returns bool * SDL_JoystickIsHaptic() => SDL_IsJoystickHaptic() * SDL_MouseIsHaptic() => SDL_IsMouseHaptic() @@ -835,7 +843,10 @@ The following hints have been removed: * SDL_HINT_VIDEO_X11_XVIDMODE - Xvidmode no longer supported by the X11 backend * SDL_HINT_WINDOWS_DISABLE_THREAD_NAMING - SDL now properly handles the 0x406D1388 Exception if no debugger intercepts it, preventing its propagation. * SDL_HINT_WINDOWS_FORCE_MUTEX_CRITICAL_SECTIONS - Slim Reader/Writer Locks are always used if available -* SDL_HINT_WINDOWS_NO_CLOSE_ON_ALT_F4 - replaced with SDL_HINT_WINDOWS_CLOSE_ON_ALT_F4, defaulting to SDL_TRUE +* SDL_HINT_WINDOWS_NO_CLOSE_ON_ALT_F4 - replaced with SDL_HINT_WINDOWS_CLOSE_ON_ALT_F4, defaulting to true +* SDL_HINT_WINRT_HANDLE_BACK_BUTTON - WinRT support was removed in SDL3. +* SDL_HINT_WINRT_PRIVACY_POLICY_LABEL - WinRT support was removed in SDL3. +* SDL_HINT_WINRT_PRIVACY_POLICY_URL - WinRT support was removed in SDL3. * SDL_HINT_XINPUT_USE_OLD_JOYSTICK_MAPPING * SDL_HINT_AUDIO_DEVICE_APP_NAME - replaced by either using the appname param to SDL_SetAppMetadata() or setting SDL_PROP_APP_METADATA_NAME_STRING with SDL_SetAppMetadataProperty() @@ -887,6 +898,7 @@ The following symbols have been renamed: The following symbols have been removed: * SDL_INIT_NOPARACHUTE * SDL_INIT_EVERYTHING - you should only initialize the subsystems you are using +* SDL_INIT_TIMER - no longer needed before calling SDL_AddTimer() ## SDL_joystick.h @@ -920,18 +932,18 @@ The functions SDL_GetJoysticks(), SDL_GetJoystickNameForID(), SDL_GetJoystickPat SDL_AttachVirtualJoystick() now returns the joystick instance ID instead of a device index, and returns 0 if there was an error. -SDL_VirtualJoystickDesc no longer takes a struct version; if we need to extend this in the future, we'll make a second struct and a second SDL_AttachVirtualJoystickEx-style function that uses it. Just zero the struct and don't set a version. +SDL_VirtualJoystickDesc version should not be set to SDL_VIRTUAL_JOYSTICK_DESC_VERSION, instead the structure should be initialized using SDL_INIT_INTERFACE(). The following functions have been renamed: * SDL_JoystickAttachVirtualEx() => SDL_AttachVirtualJoystick() * SDL_JoystickClose() => SDL_CloseJoystick() -* SDL_JoystickDetachVirtual() => SDL_DetachVirtualJoystick(), returns SDL_bool +* SDL_JoystickDetachVirtual() => SDL_DetachVirtualJoystick(), returns bool * SDL_JoystickFromInstanceID() => SDL_GetJoystickFromID() * SDL_JoystickFromPlayerIndex() => SDL_GetJoystickFromPlayerIndex() * SDL_JoystickGetAttached() => SDL_JoystickConnected() * SDL_JoystickGetAxis() => SDL_GetJoystickAxis() * SDL_JoystickGetAxisInitialState() => SDL_GetJoystickAxisInitialState() -* SDL_JoystickGetBall() => SDL_GetJoystickBall(), returns SDL_bool +* SDL_JoystickGetBall() => SDL_GetJoystickBall(), returns bool * SDL_JoystickGetButton() => SDL_GetJoystickButton() * SDL_JoystickGetFirmwareVersion() => SDL_GetJoystickFirmwareVersion() * SDL_JoystickGetGUID() => SDL_GetJoystickGUID() @@ -952,14 +964,14 @@ The following functions have been renamed: * SDL_JoystickNumHats() => SDL_GetNumJoystickHats() * SDL_JoystickOpen() => SDL_OpenJoystick() * SDL_JoystickPath() => SDL_GetJoystickPath() -* SDL_JoystickRumble() => SDL_RumbleJoystick(), returns SDL_bool -* SDL_JoystickRumbleTriggers() => SDL_RumbleJoystickTriggers(), returns SDL_bool -* SDL_JoystickSendEffect() => SDL_SendJoystickEffect(), returns SDL_bool -* SDL_JoystickSetLED() => SDL_SetJoystickLED(), returns SDL_bool -* SDL_JoystickSetPlayerIndex() => SDL_SetJoystickPlayerIndex(), returns SDL_bool -* SDL_JoystickSetVirtualAxis() => SDL_SetJoystickVirtualAxis(), returns SDL_bool -* SDL_JoystickSetVirtualButton() => SDL_SetJoystickVirtualButton(), returns SDL_bool -* SDL_JoystickSetVirtualHat() => SDL_SetJoystickVirtualHat(), returns SDL_bool +* SDL_JoystickRumble() => SDL_RumbleJoystick(), returns bool +* SDL_JoystickRumbleTriggers() => SDL_RumbleJoystickTriggers(), returns bool +* SDL_JoystickSendEffect() => SDL_SendJoystickEffect(), returns bool +* SDL_JoystickSetLED() => SDL_SetJoystickLED(), returns bool +* SDL_JoystickSetPlayerIndex() => SDL_SetJoystickPlayerIndex(), returns bool +* SDL_JoystickSetVirtualAxis() => SDL_SetJoystickVirtualAxis(), returns bool +* SDL_JoystickSetVirtualButton() => SDL_SetJoystickVirtualButton(), returns bool +* SDL_JoystickSetVirtualHat() => SDL_SetJoystickVirtualHat(), returns bool * SDL_JoystickUpdate() => SDL_UpdateJoysticks() The following symbols have been renamed: @@ -983,7 +995,7 @@ The following functions have been removed: * SDL_JoystickNameForIndex() - replaced with SDL_GetJoystickNameForID() * SDL_JoystickPathForIndex() - replaced with SDL_GetJoystickPathForID() * SDL_NumJoysticks() - replaced with SDL_GetJoysticks() -* SDL_VIRTUAL_JOYSTICK_DESC_VERSION - no longer needed, version info has been removed from SDL_VirtualJoystickDesc. +* SDL_VIRTUAL_JOYSTICK_DESC_VERSION - no longer needed The following symbols have been removed: * SDL_JOYBALLMOTION @@ -999,6 +1011,8 @@ The text input state hase been changed to be window-specific. SDL_StartTextInput SDL_GetDefaultKeyFromScancode(), SDL_GetKeyFromScancode(), and SDL_GetScancodeFromKey() take an SDL_Keymod parameter and use that to provide the correct result based on keyboard modifier state. +SDL_GetKeyboardState() returns a pointer to bool instead of Uint8. + The following functions have been renamed: * SDL_IsScreenKeyboardShown() => SDL_ScreenKeyboardShown() * SDL_IsTextInputActive() => SDL_TextInputActive() @@ -1107,6 +1121,9 @@ The following functions have been renamed: * SDL_LogSetOutputFunction() => SDL_SetLogOutputFunction() * SDL_LogSetPriority() => SDL_SetLogPriority() +The following symbols have been renamed: +* SDL_NUM_LOG_PRIORITIES => SDL_LOG_PRIORITY_COUNT + ## SDL_main.h SDL3 doesn't have a static libSDLmain to link against anymore. @@ -1118,15 +1135,21 @@ Using it is really simple: Just `#include ` in the source file Several platform-specific entry point functions have been removed as unnecessary. If for some reason you explicitly need them, here are easy replacements: ```c -#define SDL_WinRTRunApp(MAIN_FUNC, RESERVED) SDL_RunApp(0, NULL, MAIN_FUNC, RESERVED) #define SDL_UIKitRunApp(ARGC, ARGV, MAIN_FUNC) SDL_RunApp(ARGC, ARGV, MAIN_FUNC, NULL) #define SDL_GDKRunApp(MAIN_FUNC, RESERVED) SDL_RunApp(0, NULL, MAIN_FUNC, RESERVED) ``` +The following functions have been removed: +* SDL_WinRTRunApp() - WinRT support was removed in SDL3. + + ## SDL_messagebox.h The buttonid field of SDL_MessageBoxButtonData has been renamed buttonID. +The following symbols have been renamed: +* SDL_MESSAGEBOX_COLOR_MAX => SDL_MESSAGEBOX_COLOR_COUNT + ## SDL_metal.h SDL_Metal_GetDrawableSize() has been removed. SDL_GetWindowSizeInPixels() can be used in its place. @@ -1147,6 +1170,7 @@ The following functions have been removed: * SDL_GetRelativeMouseMode() - replaced with SDL_GetWindowRelativeMouseMode() The following symbols have been renamed: +* SDL_NUM_SYSTEM_CURSORS => SDL_SYSTEM_CURSOR_COUNT * SDL_SYSTEM_CURSOR_ARROW => SDL_SYSTEM_CURSOR_DEFAULT * SDL_SYSTEM_CURSOR_HAND => SDL_SYSTEM_CURSOR_POINTER * SDL_SYSTEM_CURSOR_IBEAM => SDL_SYSTEM_CURSOR_TEXT @@ -1162,24 +1186,24 @@ The following symbols have been renamed: SDL_MUTEX_MAXWAIT has been removed; it suggested there was a maximum timeout one could outlive, instead of an infinite wait. Instead, pass a -1 to functions that accepted this symbol. -SDL_MUTEX_TIMEDOUT has been removed, the wait functions return SDL_TRUE if the operation succeeded or SDL_FALSE if they timed out. +SDL_MUTEX_TIMEDOUT has been removed, the wait functions return true if the operation succeeded or false if they timed out. SDL_LockMutex(), SDL_UnlockMutex(), SDL_WaitSemaphore(), SDL_SignalSemaphore(), SDL_WaitCondition(), SDL_SignalCondition(), and SDL_BroadcastCondition() now return void; if the object is valid (including being a NULL pointer, which returns immediately), these functions never fail. If the object is invalid or the caller does something illegal, like unlock another thread's mutex, this is considered undefined behavior. -SDL_TryWaitSemaphore(), SDL_WaitSemaphoreTimeout(), and SDL_WaitConditionTimeout() now return SDL_TRUE if the operation succeeded or SDL_FALSE if they timed out. +SDL_TryWaitSemaphore(), SDL_WaitSemaphoreTimeout(), and SDL_WaitConditionTimeout() now return true if the operation succeeded or false if they timed out. The following functions have been renamed: * SDL_CondBroadcast() => SDL_BroadcastCondition() * SDL_CondSignal() => SDL_SignalCondition() * SDL_CondWait() => SDL_WaitCondition() -* SDL_CondWaitTimeout() => SDL_WaitConditionTimeout(), returns SDL_bool +* SDL_CondWaitTimeout() => SDL_WaitConditionTimeout(), returns bool * SDL_CreateCond() => SDL_CreateCondition() * SDL_DestroyCond() => SDL_DestroyCondition() * SDL_SemPost() => SDL_SignalSemaphore() -* SDL_SemTryWait() => SDL_TryWaitSemaphore(), returns SDL_bool +* SDL_SemTryWait() => SDL_TryWaitSemaphore(), returns bool * SDL_SemValue() => SDL_GetSemaphoreValue() * SDL_SemWait() => SDL_WaitSemaphore() -* SDL_SemWaitTimeout() => SDL_WaitSemaphoreTimeout(), returns SDL_bool +* SDL_SemWaitTimeout() => SDL_WaitSemaphoreTimeout(), returns bool The following symbols have been renamed: * SDL_cond => SDL_Condition @@ -1219,7 +1243,7 @@ The following functions have been renamed: * SDL_AllocPalette() => SDL_CreatePalette() * SDL_FreePalette() => SDL_DestroyPalette() * SDL_MasksToPixelFormatEnum() => SDL_GetPixelFormatForMasks() -* SDL_PixelFormatEnumToMasks() => SDL_GetMasksForPixelFormat(), returns SDL_bool +* SDL_PixelFormatEnumToMasks() => SDL_GetMasksForPixelFormat(), returns bool The following symbols have been renamed: * SDL_PIXELFORMAT_BGR444 => SDL_PIXELFORMAT_XBGR4444 @@ -1275,7 +1299,6 @@ The following platform preprocessor macros have been renamed: | `__VITA__` | `SDL_PLATFORM_VITA` | | `__WIN32__` | `SDL_PLATFORM_WIN32` | | `__WINGDK__` | `SDL_PLATFORM_WINGDK` | -| `__WINRT__` | `SDL_PLATFORM_WINRT` | | `__XBOXONE__` | `SDL_PLATFORM_XBOXONE` | | `__XBOXSERIES__` | `SDL_PLATFORM_XBOXSERIES` | @@ -1288,6 +1311,8 @@ The following platform preprocessor macros have been removed: * `__NACL__` * `__PNACL__` * `__WINDOWS__` +* `__WINRT__` + ## SDL_quit.h @@ -1318,8 +1343,8 @@ The following functions have been renamed: * SDL_IntersectRectAndLine() => SDL_GetRectAndLineIntersection() * SDL_PointInFRect() => SDL_PointInRectFloat() * SDL_RectEquals() => SDL_RectsEqual() -* SDL_UnionFRect() => SDL_GetRectUnionFloat(), returns SDL_bool -* SDL_UnionRect() => SDL_GetRectUnion(), returns SDL_bool +* SDL_UnionFRect() => SDL_GetRectUnionFloat(), returns bool +* SDL_UnionRect() => SDL_GetRectUnion(), returns bool ## SDL_render.h @@ -1365,42 +1390,42 @@ SDL_Vertex has been changed to use floating point colors, in the range of [0..1] SDL_RenderReadPixels() returns a surface instead of filling in preallocated memory. The following functions have been renamed: -* SDL_GetRendererOutputSize() => SDL_GetCurrentRenderOutputSize(), returns SDL_bool -* SDL_RenderCopy() => SDL_RenderTexture(), returns SDL_bool -* SDL_RenderCopyEx() => SDL_RenderTextureRotated(), returns SDL_bool -* SDL_RenderCopyExF() => SDL_RenderTextureRotated(), returns SDL_bool -* SDL_RenderCopyF() => SDL_RenderTexture(), returns SDL_bool -* SDL_RenderDrawLine() => SDL_RenderLine(), returns SDL_bool -* SDL_RenderDrawLineF() => SDL_RenderLine(), returns SDL_bool -* SDL_RenderDrawLines() => SDL_RenderLines(), returns SDL_bool -* SDL_RenderDrawLinesF() => SDL_RenderLines(), returns SDL_bool -* SDL_RenderDrawPoint() => SDL_RenderPoint(), returns SDL_bool -* SDL_RenderDrawPointF() => SDL_RenderPoint(), returns SDL_bool -* SDL_RenderDrawPoints() => SDL_RenderPoints(), returns SDL_bool -* SDL_RenderDrawPointsF() => SDL_RenderPoints(), returns SDL_bool -* SDL_RenderDrawRect() => SDL_RenderRect(), returns SDL_bool -* SDL_RenderDrawRectF() => SDL_RenderRect(), returns SDL_bool -* SDL_RenderDrawRects() => SDL_RenderRects(), returns SDL_bool -* SDL_RenderDrawRectsF() => SDL_RenderRects(), returns SDL_bool -* SDL_RenderFillRectF() => SDL_RenderFillRect(), returns SDL_bool -* SDL_RenderFillRectsF() => SDL_RenderFillRects(), returns SDL_bool -* SDL_RenderFlush() => SDL_FlushRenderer(), returns SDL_bool -* SDL_RenderGetClipRect() => SDL_GetRenderClipRect(), returns SDL_bool +* SDL_GetRendererOutputSize() => SDL_GetCurrentRenderOutputSize(), returns bool +* SDL_RenderCopy() => SDL_RenderTexture(), returns bool +* SDL_RenderCopyEx() => SDL_RenderTextureRotated(), returns bool +* SDL_RenderCopyExF() => SDL_RenderTextureRotated(), returns bool +* SDL_RenderCopyF() => SDL_RenderTexture(), returns bool +* SDL_RenderDrawLine() => SDL_RenderLine(), returns bool +* SDL_RenderDrawLineF() => SDL_RenderLine(), returns bool +* SDL_RenderDrawLines() => SDL_RenderLines(), returns bool +* SDL_RenderDrawLinesF() => SDL_RenderLines(), returns bool +* SDL_RenderDrawPoint() => SDL_RenderPoint(), returns bool +* SDL_RenderDrawPointF() => SDL_RenderPoint(), returns bool +* SDL_RenderDrawPoints() => SDL_RenderPoints(), returns bool +* SDL_RenderDrawPointsF() => SDL_RenderPoints(), returns bool +* SDL_RenderDrawRect() => SDL_RenderRect(), returns bool +* SDL_RenderDrawRectF() => SDL_RenderRect(), returns bool +* SDL_RenderDrawRects() => SDL_RenderRects(), returns bool +* SDL_RenderDrawRectsF() => SDL_RenderRects(), returns bool +* SDL_RenderFillRectF() => SDL_RenderFillRect(), returns bool +* SDL_RenderFillRectsF() => SDL_RenderFillRects(), returns bool +* SDL_RenderFlush() => SDL_FlushRenderer(), returns bool +* SDL_RenderGetClipRect() => SDL_GetRenderClipRect(), returns bool * SDL_RenderGetIntegerScale() => SDL_GetRenderIntegerScale() -* SDL_RenderGetLogicalSize() => SDL_GetRenderLogicalPresentation(), returns SDL_bool +* SDL_RenderGetLogicalSize() => SDL_GetRenderLogicalPresentation(), returns bool * SDL_RenderGetMetalCommandEncoder() => SDL_GetRenderMetalCommandEncoder() * SDL_RenderGetMetalLayer() => SDL_GetRenderMetalLayer() -* SDL_RenderGetScale() => SDL_GetRenderScale(), returns SDL_bool -* SDL_RenderGetViewport() => SDL_GetRenderViewport(), returns SDL_bool +* SDL_RenderGetScale() => SDL_GetRenderScale(), returns bool +* SDL_RenderGetViewport() => SDL_GetRenderViewport(), returns bool * SDL_RenderGetWindow() => SDL_GetRenderWindow() * SDL_RenderIsClipEnabled() => SDL_RenderClipEnabled() -* SDL_RenderLogicalToWindow() => SDL_RenderCoordinatesToWindow(), returns SDL_bool -* SDL_RenderSetClipRect() => SDL_SetRenderClipRect(), returns SDL_bool -* SDL_RenderSetLogicalSize() => SDL_SetRenderLogicalPresentation(), returns SDL_bool -* SDL_RenderSetScale() => SDL_SetRenderScale(), returns SDL_bool -* SDL_RenderSetVSync() => SDL_SetRenderVSync(), returns SDL_bool -* SDL_RenderSetViewport() => SDL_SetRenderViewport(), returns SDL_bool -* SDL_RenderWindowToLogical() => SDL_RenderCoordinatesFromWindow(), returns SDL_bool +* SDL_RenderLogicalToWindow() => SDL_RenderCoordinatesToWindow(), returns bool +* SDL_RenderSetClipRect() => SDL_SetRenderClipRect(), returns bool +* SDL_RenderSetLogicalSize() => SDL_SetRenderLogicalPresentation(), returns bool +* SDL_RenderSetScale() => SDL_SetRenderScale(), returns bool +* SDL_RenderSetVSync() => SDL_SetRenderVSync(), returns bool +* SDL_RenderSetViewport() => SDL_SetRenderViewport(), returns bool +* SDL_RenderWindowToLogical() => SDL_RenderCoordinatesFromWindow(), returns bool The following functions have been removed: * SDL_GL_BindTexture() - use SDL_GetTextureProperties() to get the OpenGL texture ID and bind the texture directly @@ -1489,7 +1514,7 @@ You can implement this in your own code easily: typedef struct IOStreamStdioFPData { FILE *fp; - SDL_bool autoclose; + bool autoclose; } IOStreamStdioFPData; static Sint64 SDLCALL stdio_seek(void *userdata, Sint64 offset, int whence) @@ -1544,20 +1569,20 @@ static size_t SDLCALL stdio_write(void *userdata, const void *ptr, size_t size, return bytes; } -static SDL_bool SDLCALL stdio_close(void *userdata) +static bool SDLCALL stdio_close(void *userdata) { IOStreamStdioData *rwopsdata = (IOStreamStdioData *) userdata; - SDL_bool status = SDL_TRUE; + bool status = true; if (rwopsdata->autoclose) { if (fclose(rwopsdata->fp) != 0) { SDL_SetError("Couldn't close stream"); - status = SDL_FALSE; + status = false; } } return status; } -SDL_IOStream *SDL_RWFromFP(FILE *fp, SDL_bool autoclose) +SDL_IOStream *SDL_RWFromFP(FILE *fp, bool autoclose) { SDL_IOStreamInterface iface; IOStreamStdioFPData *rwopsdata; @@ -1568,7 +1593,7 @@ SDL_IOStream *SDL_RWFromFP(FILE *fp, SDL_bool autoclose) return NULL; } - SDL_zero(iface); + SDL_INIT_INTERFACE(&iface); /* There's no stdio_size because SDL_GetIOSize emulates it the same way we'd do it for stdio anyhow. */ iface.seek = stdio_seek; iface.read = stdio_read; @@ -1591,13 +1616,13 @@ The internal `FILE *` is available through a standard SDL_IOStream property, for On Apple platforms, SDL_RWFromFile (now called SDL_IOFromFile) no longer tries to read from inside the app bundle's resource directory, instead now using the specified path unchanged. One can use SDL_GetBasePath() to find the resource directory on these platforms. -The functions SDL_ReadU8(), SDL_ReadU16LE(), SDL_ReadU16BE(), SDL_ReadU32LE(), SDL_ReadU32BE(), SDL_ReadU64LE(), and SDL_ReadU64BE() now return SDL_TRUE if the read succeeded and SDL_FALSE if it didn't, and store the data in a pointer passed in as a parameter. +The functions SDL_ReadU8(), SDL_ReadU16LE(), SDL_ReadU16BE(), SDL_ReadU32LE(), SDL_ReadU32BE(), SDL_ReadU64LE(), and SDL_ReadU64BE() now return true if the read succeeded and false if it didn't, and store the data in a pointer passed in as a parameter. The following functions have been renamed: * SDL_RWFromConstMem() => SDL_IOFromConstMem() * SDL_RWFromFile() => SDL_IOFromFile() * SDL_RWFromMem() => SDL_IOFromMem() -* SDL_RWclose() => SDL_CloseIO(), returns SDL_bool +* SDL_RWclose() => SDL_CloseIO(), returns bool * SDL_RWread() => SDL_ReadIO() * SDL_RWseek() => SDL_SeekIO() * SDL_RWsize() => SDL_GetIOSize() @@ -1637,6 +1662,7 @@ The following symbols have been removed: * SDL_SCANCODE_APP2 The following symbols have been renamed: +* SDL_NUM_SCANCODES => SDL_SCANCODE_COUNT * SDL_SCANCODE_AUDIOFASTFORWARD => SDL_SCANCODE_MEDIA_FAST_FORWARD * SDL_SCANCODE_AUDIOMUTE => SDL_SCANCODE_MUTE * SDL_SCANCODE_AUDIONEXT => SDL_SCANCODE_MEDIA_NEXT_TRACK @@ -1678,7 +1704,7 @@ Removed SDL_SensorGetDataWithTimestamp(), if you want timestamps for the sensor The following functions have been renamed: * SDL_SensorClose() => SDL_CloseSensor() * SDL_SensorFromInstanceID() => SDL_GetSensorFromID() -* SDL_SensorGetData() => SDL_GetSensorData(), returns SDL_bool +* SDL_SensorGetData() => SDL_GetSensorData(), returns bool * SDL_SensorGetInstanceID() => SDL_GetSensorID() * SDL_SensorGetName() => SDL_GetSensorName() * SDL_SensorGetNonPortableType() => SDL_GetSensorNonPortableType() @@ -1704,7 +1730,7 @@ This header has been removed and a simplified version of this API has been added The standard C headers like stdio.h and stdlib.h are no longer included, you should include them directly in your project if you use non-SDL C runtime functions. M_PI is no longer defined in SDL_stdinc.h, you can use the new symbols SDL_PI_D (double) and SDL_PI_F (float) instead. -SDL_bool is now defined as bool, and is 1 byte instead of the size of an int. +bool is now defined as bool, and is 1 byte instead of the size of an int. SDL3 attempts to apply consistency to case-insensitive string functions. In SDL2, things like SDL_strcasecmp() would usually only work on English letters, and depending on the user's locale, possibly not even those. In SDL3, consistency is applied: @@ -1719,17 +1745,26 @@ SDL3 attempts to apply consistency to case-insensitive string functions. In SDL2 Please note that the case-folding technique used by SDL3 will not produce correct results for the "Turkish 'I'"; this one letter is a surprisingly hard problem in the Unicode world, and since these functions do not specify the human language in use, we have chosen to ignore this problem. +SDL_strtoll(), SDL_strtoull(), SDL_lltoa(), and SDL_ulltoa() use long long values instead of 64-bit values, to match their C runtime counterparts. + +SDL_setenv() is not thread-safe and has been renamed SDL_setenv_unsafe(). + The following macros have been removed: * SDL_TABLESIZE() - use SDL_arraysize() instead The following functions have been renamed: -* SDL_size_add_overflow() => SDL_size_add_check_overflow(), returns SDL_bool -* SDL_size_mul_overflow() => SDL_size_mul_check_overflow(), returns SDL_bool +* SDL_size_add_overflow() => SDL_size_add_check_overflow(), returns bool +* SDL_size_mul_overflow() => SDL_size_mul_check_overflow(), returns bool * SDL_strtokr() => SDL_strtok_r() The following functions have been removed: * SDL_memcpy4() +The following symbols have been renamed: +* SDL_FALSE => false +* SDL_TRUE => true +* SDL_bool => bool + ## SDL_surface.h SDL_Surface has been simplified and internal details are no longer in the public structure. @@ -1797,34 +1832,34 @@ But if you're migrating your code which uses masks, you probably have a format i SDL_BlitSurface() and SDL_BlitSurfaceScaled() now have a const `dstrect` parameter and do not fill it in with the final destination rectangle. -SDL_BlitSurfaceScaled() and SDL_BlitSurfaceUncheckedScaled() now take a scale paramater. +SDL_BlitSurfaceScaled() and SDL_BlitSurfaceUncheckedScaled() now take a scale parameter. -SDL_SoftStretch() now takes a scale paramater. +SDL_SoftStretch() now takes a scale parameter. SDL_PixelFormat is used instead of Uint32 for API functions that refer to pixel format by enumerated value. -SDL_SetSurfaceColorKey() takes an SDL_bool to enable and disable colorkey. RLE acceleration isn't controlled by the parameter, you should use SDL_SetSurfaceRLE() to change that separately. +SDL_SetSurfaceColorKey() takes an bool to enable and disable colorkey. RLE acceleration isn't controlled by the parameter, you should use SDL_SetSurfaceRLE() to change that separately. -SDL_SetSurfaceRLE() takes an SDL_bool to enable and disable RLE acceleration. +SDL_SetSurfaceRLE() takes an bool to enable and disable RLE acceleration. The following functions have been renamed: -* SDL_BlitScaled() => SDL_BlitSurfaceScaled(), returns SDL_bool +* SDL_BlitScaled() => SDL_BlitSurfaceScaled(), returns bool * SDL_ConvertSurfaceFormat() => SDL_ConvertSurface() -* SDL_FillRect() => SDL_FillSurfaceRect(), returns SDL_bool -* SDL_FillRects() => SDL_FillSurfaceRects(), returns SDL_bool +* SDL_FillRect() => SDL_FillSurfaceRect(), returns bool +* SDL_FillRects() => SDL_FillSurfaceRects(), returns bool * SDL_FreeSurface() => SDL_DestroySurface() -* SDL_GetClipRect() => SDL_GetSurfaceClipRect(), returns SDL_bool -* SDL_GetColorKey() => SDL_GetSurfaceColorKey(), returns SDL_bool +* SDL_GetClipRect() => SDL_GetSurfaceClipRect(), returns bool +* SDL_GetColorKey() => SDL_GetSurfaceColorKey(), returns bool * SDL_HasColorKey() => SDL_SurfaceHasColorKey() * SDL_HasSurfaceRLE() => SDL_SurfaceHasRLE() * SDL_LoadBMP_RW() => SDL_LoadBMP_IO() -* SDL_LowerBlit() => SDL_BlitSurfaceUnchecked(), returns SDL_bool -* SDL_LowerBlitScaled() => SDL_BlitSurfaceUncheckedScaled(), returns SDL_bool -* SDL_SaveBMP_RW() => SDL_SaveBMP_IO(), returns SDL_bool +* SDL_LowerBlit() => SDL_BlitSurfaceUnchecked(), returns bool +* SDL_LowerBlitScaled() => SDL_BlitSurfaceUncheckedScaled(), returns bool +* SDL_SaveBMP_RW() => SDL_SaveBMP_IO(), returns bool * SDL_SetClipRect() => SDL_SetSurfaceClipRect() -* SDL_SetColorKey() => SDL_SetSurfaceColorKey(), returns SDL_bool -* SDL_UpperBlit() => SDL_BlitSurface(), returns SDL_bool -* SDL_UpperBlitScaled() => SDL_BlitSurfaceScaled(), returns SDL_bool +* SDL_SetColorKey() => SDL_SetSurfaceColorKey(), returns bool +* SDL_UpperBlit() => SDL_BlitSurface(), returns bool +* SDL_UpperBlitScaled() => SDL_BlitSurfaceScaled(), returns bool The following symbols have been removed: * SDL_SWSURFACE @@ -1850,10 +1885,12 @@ SDL_RequestAndroidPermission is no longer a blocking call; the caller now provid SDL_iPhoneSetAnimationCallback() and SDL_iPhoneSetEventPump() have been renamed to SDL_SetiOSAnimationCallback() and SDL_SetiOSEventPump(), respectively. SDL2 has had macros to provide this new name with the old symbol since the introduction of the iPad, but now the correctly-named symbol is the only option. The following functions have been removed: +* SDL_GetWinRTFSPathUNICODE() - WinRT support was removed in SDL3. +* SDL_GetWinRTFSPathUTF8() - WinRT support was removed in SDL3. * SDL_RenderGetD3D11Device() - replaced with the "SDL.renderer.d3d11.device" property * SDL_RenderGetD3D12Device() - replaced with the "SDL.renderer.d3d12.device" property * SDL_RenderGetD3D9Device() - replaced with the "SDL.renderer.d3d9.device" property -* SDL_GetWinRTFSPathUNICODE() - Use SDL_GetWinRTFSPath() and SDL_iconv_string to convert from UTF-8 to UTF-16. +* SDL_WinRTGetDeviceFamily() - WinRT support was removed in SDL3. The following functions have been renamed: * SDL_AndroidBackButton() => SDL_SendAndroidBackButton() @@ -1862,23 +1899,21 @@ The following functions have been renamed: * SDL_AndroidGetExternalStorageState() => SDL_GetAndroidExternalStorageState() * SDL_AndroidGetInternalStoragePath() => SDL_GetAndroidInternalStoragePath() * SDL_AndroidGetJNIEnv() => SDL_GetAndroidJNIEnv() -* SDL_AndroidRequestPermission() => SDL_RequestAndroidPermission(), returns SDL_bool +* SDL_AndroidRequestPermission() => SDL_RequestAndroidPermission(), returns bool * SDL_AndroidRequestPermissionCallback() => SDL_RequestAndroidPermissionCallback() -* SDL_AndroidSendMessage() => SDL_SendAndroidMessage(), returns SDL_bool -* SDL_AndroidShowToast() => SDL_ShowAndroidToast(), returns SDL_bool -* SDL_DXGIGetOutputInfo() => SDL_GetDXGIOutputInfo(), returns SDL_bool +* SDL_AndroidSendMessage() => SDL_SendAndroidMessage(), returns bool +* SDL_AndroidShowToast() => SDL_ShowAndroidToast(), returns bool +* SDL_DXGIGetOutputInfo() => SDL_GetDXGIOutputInfo(), returns bool * SDL_Direct3D9GetAdapterIndex() => SDL_GetDirect3D9AdapterIndex() -* SDL_GDKGetDefaultUser() => SDL_GetGDKDefaultUser(), returns SDL_bool -* SDL_GDKGetTaskQueue() => SDL_GetGDKTaskQueue(), returns SDL_bool -* SDL_LinuxSetThreadPriority() => SDL_SetLinuxThreadPriority(), returns SDL_bool -* SDL_LinuxSetThreadPriorityAndPolicy() => SDL_SetLinuxThreadPriorityAndPolicy(), returns SDL_bool +* SDL_GDKGetDefaultUser() => SDL_GetGDKDefaultUser(), returns bool +* SDL_GDKGetTaskQueue() => SDL_GetGDKTaskQueue(), returns bool +* SDL_LinuxSetThreadPriority() => SDL_SetLinuxThreadPriority(), returns bool +* SDL_LinuxSetThreadPriorityAndPolicy() => SDL_SetLinuxThreadPriorityAndPolicy(), returns bool * SDL_OnApplicationDidBecomeActive() => SDL_OnApplicationDidEnterForeground() * SDL_OnApplicationWillResignActive() => SDL_OnApplicationWillEnterBackground() -* SDL_WinRTGetDeviceFamily() => SDL_GetWinRTDeviceFamily() -* SDL_GetWinRTFSPathUTF8() => SDL_GetWinRTFSPath() -* SDL_iOSSetAnimationCallback() => SDL_SetiOSAnimationCallback(), returns SDL_bool +* SDL_iOSSetAnimationCallback() => SDL_SetiOSAnimationCallback(), returns bool * SDL_iOSSetEventPump() => SDL_SetiOSEventPump() -* SDL_iPhoneSetAnimationCallback() => SDL_SetiOSAnimationCallback(), returns SDL_bool +* SDL_iPhoneSetAnimationCallback() => SDL_SetiOSAnimationCallback(), returns bool * SDL_iPhoneSetEventPump() => SDL_SetiOSEventPump() ## SDL_syswm.h @@ -1986,7 +2021,7 @@ SDL_GetTLS() and SDL_SetTLS() take a pointer to a TLS ID, and will automatically The following functions have been renamed: * SDL_TLSCleanup() => SDL_CleanupTLS() * SDL_TLSGet() => SDL_GetTLS() -* SDL_TLSSet() => SDL_SetTLS(), returns SDL_bool +* SDL_TLSSet() => SDL_SetTLS(), returns bool * SDL_ThreadID() => SDL_GetCurrentThreadID() The following functions have been removed: @@ -2139,7 +2174,7 @@ SDL_GL_GetProcAddress() and SDL_EGL_GetProcAddress() now return `SDL_FunctionPoi SDL_GL_DeleteContext() has been renamed to SDL_GL_DestroyContext to match SDL naming conventions (and glX/EGL!). -SDL_GL_GetSwapInterval() takes the interval as an output parameter and returns SDL_TRUE if the function succeeds or SDL_FALSE if there was an error. +SDL_GL_GetSwapInterval() takes the interval as an output parameter and returns true if the function succeeds or false if there was an error. SDL_GL_GetDrawableSize() has been removed. SDL_GetWindowSizeInPixels() can be used in its place. @@ -2150,8 +2185,8 @@ SDL_WindowFlags is used instead of Uint32 for API functions that refer to window SDL_GetWindowOpacity() directly returns the opacity instead of using an out parameter. The following functions have been renamed: -* SDL_GL_DeleteContext() => SDL_GL_DestroyContext(), returns SDL_bool -* SDL_GetClosestDisplayMode() => SDL_GetClosestFullscreenDisplayMode(), returns SDL_bool +* SDL_GL_DeleteContext() => SDL_GL_DestroyContext(), returns bool +* SDL_GetClosestDisplayMode() => SDL_GetClosestFullscreenDisplayMode(), returns bool * SDL_GetDisplayOrientation() => SDL_GetCurrentDisplayOrientation() * SDL_GetPointDisplayIndex() => SDL_GetDisplayForPoint() * SDL_GetRectDisplayIndex() => SDL_GetDisplayForRect() @@ -2159,7 +2194,7 @@ The following functions have been renamed: * SDL_GetWindowDisplayMode() => SDL_GetWindowFullscreenMode() * SDL_HasWindowSurface() => SDL_WindowHasSurface() * SDL_IsScreenSaverEnabled() => SDL_ScreenSaverEnabled() -* SDL_SetWindowDisplayMode() => SDL_SetWindowFullscreenMode(), returns SDL_bool +* SDL_SetWindowDisplayMode() => SDL_SetWindowFullscreenMode(), returns bool The following functions have been removed: * SDL_GetClosestFullscreenDisplayMode() @@ -2173,6 +2208,7 @@ The following functions have been removed: * SDL_SetWindowData() - use SDL_GetWindowProperties() instead * SDL_CreateWindowFrom() - use SDL_CreateWindowWithProperties() with the properties that allow you to wrap an existing window * SDL_SetWindowInputFocus() - use SDL_RaiseWindow() instead +* SDL_SetWindowModalFor() - use SDL_SetWindowParent() with SDL_SetWindowModal() instead The SDL_Window id type is named SDL_WindowID diff --git a/docs/README-porting.md b/docs/README-porting.md index db6b6141..ada1d67c 100644 --- a/docs/README-porting.md +++ b/docs/README-porting.md @@ -5,7 +5,7 @@ Porting The first thing you have to do when porting to a new platform, is look at include/SDL_platform.h and create an entry there for your operating system. -The standard format is "__PLATFORM__", where PLATFORM is the name of the OS. +The standard format is "SDL_PLATFORM_X", where X is the name of the OS. Ideally SDL_platform_defines.h will be able to auto-detect the system it's building on based on C preprocessor symbols. diff --git a/docs/README-vita.md b/docs/README-vita.md index 0a11cf80..c222a14c 100644 --- a/docs/README-vita.md +++ b/docs/README-vita.md @@ -21,13 +21,13 @@ Notes ----- * gles1/gles2 support and renderers are disabled by default and can be enabled by configuring with `-DVIDEO_VITA_PVR=ON` These renderers support 720p and 1080i resolutions. These can be specified with: - `SDL_setenv("VITA_RESOLUTION", "720", 1);` and `SDL_setenv("VITA_RESOLUTION", "1080", 1);` + `SDL_SetHint(SDL_HINT_VITA_RESOLUTION, "720");` and `SDL_SetHint(SDL_HINT_VITA_RESOLUTION, "1080");` * Desktop GL 1.X and 2.X support and renderers are also disabled by default and also can be enabled with `-DVIDEO_VITA_PVR=ON` as long as gl4es4vita is present in your SDK. - They support the same resolutions as the gles1/gles2 backends and require specifying `SDL_setenv("VITA_PVR_OGL", "1", 1);` + They support the same resolutions as the gles1/gles2 backends and require specifying `SDL_SetHint(SDL_HINT_VITA_PVR_OPENGL, "1");` anytime before video subsystem initialization. * gles2 support via PIB is disabled by default and can be enabled by configuring with `-DVIDEO_VITA_PIB=ON` * By default SDL emits mouse events for touch events on every touchscreen. Vita has two touchscreens, so it's recommended to use `SDL_SetHint(SDL_HINT_TOUCH_MOUSE_EVENTS, "0");` and handle touch events instead. Individual touchscreens can be disabled with: - `SDL_setenv("VITA_DISABLE_TOUCH_FRONT", "1", 1);` and `SDL_setenv("VITA_DISABLE_TOUCH_BACK", "1", 1);` + `SDL_SetHint(SDL_HINT_VITA_ENABLE_FRONT_TOUCH, "0");` and `SDL_SetHint(SDL_HINT_VITA_ENABLE_BACK_TOUCH, "0");` * Support for L2/R2/R3/R3 buttons, haptic feedback and gamepad led only available on PSTV, or when using external ds4 gamepad on vita. diff --git a/docs/README-wayland.md b/docs/README-wayland.md index ec3a24de..7b4330a5 100644 --- a/docs/README-wayland.md +++ b/docs/README-wayland.md @@ -61,7 +61,7 @@ having SDL handle input and rendering, it needs to create a custom, roleless sur toplevel window. This is done by using `SDL_CreateWindowWithProperties()` and setting the -`SDL_PROP_WINDOW_CREATE_WAYLAND_SURFACE_ROLE_CUSTOM_BOOLEAN` property to `SDL_TRUE`. Once the window has been +`SDL_PROP_WINDOW_CREATE_WAYLAND_SURFACE_ROLE_CUSTOM_BOOLEAN` property to `true`. Once the window has been successfully created, the `wl_display` and `wl_surface` objects can then be retrieved from the `SDL_PROP_WINDOW_WAYLAND_DISPLAY_POINTER` and `SDL_PROP_WINDOW_WAYLAND_SURFACE_POINTER` properties respectively. @@ -69,10 +69,10 @@ Surfaces don't receive any size change notifications, so if an application chang that the surface size has changed by calling SDL_SetWindowSize() with the new dimensions. Custom surfaces will automatically handle scaling internally if the window was created with the -`SDL_PROP_WINDOW_CREATE_HIGH_PIXEL_DENSITY_BOOLEAN` property set to `SDL_TRUE`. In this case, applications should +`SDL_PROP_WINDOW_CREATE_HIGH_PIXEL_DENSITY_BOOLEAN` property set to `true`. In this case, applications should not manually attach viewports or change the surface scale value, as SDL will handle this internally. Calls to `SDL_SetWindowSize()` should use the logical size of the window, and `SDL_GetWindowSizeInPixels()` should be used to -query the size of the backbuffer surface in pixels. If this property is not set or is `SDL_FALSE`, applications can +query the size of the backbuffer surface in pixels. If this property is not set or is `false`, applications can attach their own viewports or change the surface scale manually, and the SDL backend will not interfere or change any values internally. In this case, calls to `SDL_SetWindowSize()` should pass the requested surface size in pixels, not the logical window size, as no scaling calculations will be done internally. @@ -101,7 +101,7 @@ SDL receives no notification regarding size changes on external surfaces or topl needs to be resized, SDL must be informed by calling SDL_SetWindowSize() with the new dimensions. If desired, SDL can automatically handle the scaling for the surface by setting the -`SDL_PROP_WINDOW_CREATE_HIGH_PIXEL_DENSITY_BOOLEAN` property to `SDL_TRUE`, however, if the surface being imported +`SDL_PROP_WINDOW_CREATE_HIGH_PIXEL_DENSITY_BOOLEAN` property to `true`, however, if the surface being imported already has, or will have, a viewport/fractional scale manager attached to it by the application or an external toolkit, a protocol violation will result. Avoid setting this property if importing surfaces from toolkits such as Qt or GTK. @@ -176,7 +176,7 @@ int main(int argc, char *argv[]) */ props = SDL_CreateProperties(); SDL_SetPointerProperty(props, SDL_PROP_WINDOW_CREATE_WAYLAND_WL_SURFACE_POINTER, surface); - SDL_SetBooleanProperty(props, SDL_PROP_WINDOW_CREATE_OPENGL_BOOLEAN, SDL_TRUE); + SDL_SetBooleanProperty(props, SDL_PROP_WINDOW_CREATE_OPENGL_BOOLEAN, true); SDL_SetNumberProperty(props, SDL_PROP_WINDOW_CREATE_WIDTH_NUMBER, 640); SDL_SetNumberProperty(props, SDL_PROP_WINDOW_CREATE_HEIGHT_NUMBER, 480); sdlWindow = SDL_CreateWindowWithProperties(props); diff --git a/docs/README-windows.md b/docs/README-windows.md index daf80647..ced972ee 100644 --- a/docs/README-windows.md +++ b/docs/README-windows.md @@ -1,5 +1,11 @@ # Windows +## Old systems + +WinRT, Windows Phone, and UWP are no longer supported. + +All desktop Windows versions, back to Windows XP, are still supported. + ## LLVM and Intel C++ compiler support SDL will build with the Visual Studio project files with LLVM-based compilers, such as the Intel oneAPI C++ diff --git a/docs/README-winrt.md b/docs/README-winrt.md deleted file mode 100644 index 45ce80a4..00000000 --- a/docs/README-winrt.md +++ /dev/null @@ -1,483 +0,0 @@ -WinRT -===== - -This port allows SDL applications to run on Microsoft's platforms that require -use of "Windows Runtime", aka. "WinRT", APIs. Microsoft may, in some cases, -refer to them as either "Windows Store", or for Windows 10, "UWP" apps. - -In the past, SDL has supported Windows RT 8.x, Windows Phone, etc, but in -modern times this port is focused on UWP apps, which run on Windows 10, -and modern Xbox consoles. - - -Requirements ------------- - -* Microsoft Visual C++ (aka Visual Studio) 2019. - - Free, "Community" or "Express" editions may be used, so long as they - include support for either "Windows Store" or "Windows Phone" apps. - "Express" versions marked as supporting "Windows Desktop" development - typically do not include support for creating WinRT apps, to note. - (The "Community" editions of Visual C++ do, however, support both - desktop/Win32 and WinRT development). -* A valid Microsoft account - This requirement is not imposed by SDL, but - rather by Microsoft's Visual C++ toolchain. This is required to launch or - debug apps. - - -Status ------- - -Here is a rough list of what works, and what doesn't: - -* What works: - * compilation via Visual C++ 2019. - * compile-time platform detection for SDL programs. The C/C++ #define, - `SDL_PLATFORM_WINRT`, will be set to 1 (by SDL) when compiling for WinRT. - * GPU-accelerated 2D rendering, via SDL_Renderer. - * OpenGL ES 2, via the ANGLE library (included separately from SDL) - * software rendering, via either SDL_Surface (optionally in conjunction with - SDL_GetWindowSurface() and SDL_UpdateWindowSurface()) or via the - SDL_Renderer APIs - * threads - * timers (via SDL_GetTicks(), SDL_AddTimer(), SDL_GetPerformanceCounter(), - SDL_GetPerformanceFrequency(), etc.) - * file I/O via SDL_IOStream - * mouse input (unsupported on Windows Phone) - * audio, via SDL's WASAPI backend (if you want to record, your app must - have "Microphone" capabilities enabled in its manifest, and the user must - not have blocked access. Otherwise, recording devices will fail to work, - presenting as a device disconnect shortly after opening it.) - * .DLL file loading. Libraries *MUST* be packaged inside applications. Loading - anything outside of the app is not supported. - * system path retrieval via SDL's filesystem APIs - * game controllers. Support is provided via the SDL_Joystick and - SDL_Gamepad APIs, and is backed by Microsoft's XInput API. Please - note, however, that Windows limits game-controller support in UWP apps to, - "Xbox compatible controllers" (many controllers that work in Win32 apps, - do not work in UWP, due to restrictions in UWP itself.) - * multi-touch input - * app events. SDL_APP_WILLENTER* and SDL_APP_DIDENTER* events get sent out as - appropriate. - * window events - * using Direct3D 11.x APIs outside of SDL. Non-XAML / Direct3D-only apps can - choose to render content directly via Direct3D, using SDL to manage the - internal WinRT window, as well as input and audio. (Use - the window properties to get the WinRT 'CoreWindow', and pass it into - IDXGIFactory2::CreateSwapChainForCoreWindow() as appropriate.) - -* What partially works: - * keyboard input. Most of WinRT's documented virtual keys are supported, as - well as many keys with documented hardware scancodes. Converting - SDL_Scancodes to or from SDL_Keycodes may not work, due to missing APIs - (MapVirtualKey()) in Microsoft's Windows Store / UWP APIs. - * SDL_main. WinRT uses a different signature for each app's main() function - and requires it to be implemented in C++, so SDL_main.h must be #include'd - in a C++ source file, that also must be compiled with /ZW. - -* What doesn't work: - * compilation with anything other than Visual C++ - * programmatically-created custom cursors. These don't appear to be supported - by WinRT. Different OS-provided cursors can, however, be created via - SDL_CreateSystemCursor() (unsupported on Windows Phone) - * SDL_WarpMouseInWindow() or SDL_WarpMouseGlobal(). This are not currently - supported by WinRT itself. - * joysticks and game controllers that either are not supported by - Microsoft's XInput API, or are not supported within UWP apps (many - controllers that work in Win32, do not work in UWP, due to restrictions in - UWP itself). - * turning off VSync when rendering on Windows Phone. Attempts to turn VSync - off on Windows Phone result either in Direct3D not drawing anything, or it - forcing VSync back on. As such, vsync will always get turned-on on Windows - Phone. This limitation is not present in non-Phone WinRT (such as Windows 8.x), - where turning off VSync appears to work. - * probably anything else that's not listed as supported - - - -Setup, High-Level Steps ------------------------ - -The steps for setting up a project for an SDL/WinRT app looks like the -following, at a high-level: - -1. create a new Visual C++ project using Microsoft's template for a, - "Direct3D App". -2. remove most of the files from the project. -3. make your app's project directly reference SDL/WinRT's own Visual C++ - project file, via use of Visual C++'s "References" dialog. This will setup - the linker, and will copy SDL's .dll files to your app's final output. -4. adjust your app's build settings, at minimum, telling it where to find SDL's - header files. -5. add files that contains a WinRT-appropriate main function, along with some - data to make sure mouse-cursor-hiding (via SDL_ShowCursor(SDL_DISABLE) calls) - work properly. -6. add SDL-specific app code. -7. build and run your app. - - -Setup, Detailed Steps ---------------------- - -### 1. Create a new project ### - -Create a new project using one of Visual C++'s templates for a plain, non-XAML, -"Direct3D App" (XAML support for SDL/WinRT is not yet ready for use). If you -don't see one of these templates, in Visual C++'s 'New Project' dialog, try -using the textbox titled, 'Search Installed Templates' to look for one. - - -### 2. Remove unneeded files from the project ### - -In the new project, delete any file that has one of the following extensions: - -- .cpp -- .h -- .hlsl - -When you are done, you should be left with a few files, each of which will be a -necessary part of your app's project. These files will consist of: - -- an .appxmanifest file, which contains metadata on your WinRT app. This is - similar to an Info.plist file on iOS, or an AndroidManifest.xml on Android. -- a few .png files, one of which is a splash screen (displayed when your app - launches), others are app icons. -- a .pfx file, used for code signing purposes. - - -### 3. Add references to SDL's project files ### - -SDL/WinRT can be built in multiple variations, spanning across three different -CPU architectures (x86, x64, and ARM) and two different configurations -(Debug and Release). WinRT and Visual C++ do not currently provide a means -for combining multiple variations of one library into a single file. -Furthermore, it does not provide an easy means for copying pre-built .dll files -into your app's final output (via Post-Build steps, for example). It does, -however, provide a system whereby an app can reference the MSVC projects of -libraries such that, when the app is built: - -1. each library gets built for the appropriate CPU architecture(s) and WinRT - platform(s). -2. each library's output, such as .dll files, get copied to the app's build - output. - -To set this up for SDL/WinRT, you'll need to run through the following steps: - -1. open up the Solution Explorer inside Visual C++ (under the "View" menu, then - "Solution Explorer") -2. right click on your app's solution. -3. navigate to "Add", then to "Existing Project..." -4. find SDL/WinRT's Visual C++ project file and open it, in the `VisualC-WinRT` - directory. -5. once the project has been added, right-click on your app's project and - select, "References..." -6. click on the button titled, "Add New Reference..." -7. check the box next to SDL -8. click OK to close the dialog -9. SDL will now show up in the list of references. Click OK to close that - dialog. - -Your project is now linked to SDL's project, insofar that when the app is -built, SDL will be built as well, with its build output getting included with -your app. - - -### 4. Adjust Your App's Build Settings ### - -Some build settings need to be changed in your app's project. This guide will -outline the following: - -- making sure that the compiler knows where to find SDL's header files -- **Optional for C++, but NECESSARY for compiling C code:** telling the - compiler not to use Microsoft's C++ extensions for WinRT development. -- **Optional:** telling the compiler not generate errors due to missing - precompiled header files. - -To change these settings: - -1. right-click on the project -2. choose "Properties" -3. in the drop-down box next to "Configuration", choose, "All Configurations" -4. in the drop-down box next to "Platform", choose, "All Platforms" -5. in the left-hand list, expand the "C/C++" section - **Note:** If you don't see this section, you may have to add a .c or .cpp - Source file to the Project first. -6. select "General" -7. edit the "Additional Include Directories" setting, and add a path to SDL's - "include" directory -8. **Optional: to enable compilation of C code:** change the setting for - "Consume Windows Runtime Extension" from "Yes (/ZW)" to "No". If you're - working with a completely C++ based project, this step can usually be - omitted. -9. **Optional: to disable precompiled headers (which can produce - 'stdafx.h'-related build errors, if setup incorrectly:** in the left-hand - list, select "Precompiled Headers", then change the setting for "Precompiled - Header" from "Use (/Yu)" to "Not Using Precompiled Headers". -10. close the dialog, saving settings, by clicking the "OK" button - - -### 5. Add a WinRT-appropriate main function, and a blank-cursor image, to the app. ### - -A few files should be included directly in your app's MSVC project, specifically: -1. a WinRT-appropriate main function (which is different than main() functions on - other platforms) -2. a Win32-style cursor resource, used by SDL_ShowCursor() to hide the mouse cursor - (if and when the app needs to do so). *If this cursor resource is not - included, mouse-position reporting may fail if and when the cursor is - hidden, due to possible bugs/design-oddities in Windows itself.* - -To include these files for C/C++ projects: - -1. right-click on your project (again, in Visual C++'s Solution Explorer), - navigate to "Add", then choose "Existing Item...". -2. navigate to the directory containing SDL's source code, then into its - subdirectory, 'src/main/winrt/'. Select, then add, the following files: - - `SDL3-WinRTResources.rc` - - `SDL3-WinRTResource_BlankCursor.cur` -3. For the next step you need a C++ source file. - - If your standard main() function is implemented in a **C++** source file, - use that file. - - If your standard main() function is implemented in a **plain C** source file, - create an empty .cpp source file (e.g. `main.cpp`) that only contains the line - `#include ` and use that file instead. -4. Right click on the C++ source file from step 3 (as listed in your project), - then click on "Properties...". -5. in the drop-down box next to "Configuration", choose, "All Configurations" -6. in the drop-down box next to "Platform", choose, "All Platforms" -7. in the left-hand list, click on "C/C++" -8. change the setting for "Consume Windows Runtime Extension" to "Yes (/ZW)". -9. click the OK button. This will close the dialog. - -**NOTE: C++/CX compilation is currently required in at least one file of your -app's project. This is to make sure that Visual C++'s linker builds a 'Windows -Metadata' file (.winmd) for your app. Not doing so can lead to build errors.** - -For non-C++ projects, you will need to call SDL_RunApp from your language's -main function, and generate SDL3-WinRTResources.res manually by using `rc` via -the Developer Command Prompt and including it as a within the -first block in your Visual Studio project file. - -### 6. Add app code and assets ### - -At this point, you can add in SDL-specific source code. Be sure to include a -C-style main function (ie: `int main(int argc, char *argv[])`). From there you -should be able to create a single `SDL_Window` (WinRT apps can only have one -window, at present), as well as an `SDL_Renderer`. Direct3D will be used to -draw content. Events are received via SDL's usual event functions -(`SDL_PollEvent`, etc.) If you have a set of existing source files and assets, -you can start adding them to the project now. If not, or if you would like to -make sure that you're setup correctly, some short and simple sample code is -provided below. - - -#### 6.A. ... when creating a new app #### - -If you are creating a new app (rather than porting an existing SDL-based app), -or if you would just like a simple app to test SDL/WinRT with before trying to -get existing code working, some working SDL/WinRT code is provided below. To -set this up: - -1. right click on your app's project -2. select Add, then New Item. An "Add New Item" dialog will show up. -3. from the left-hand list, choose "Visual C++" -4. from the middle/main list, choose "C++ File (.cpp)" -5. near the bottom of the dialog, next to "Name:", type in a name for your -source file, such as, "main.cpp". -6. click on the Add button. This will close the dialog, add the new file to -your project, and open the file in Visual C++'s text editor. -7. Copy and paste the following code into the new file, then save it. - -```c -#include -#include - -int main(int argc, char **argv) -{ - SDL_Window *window = NULL; - SDL_Renderer *renderer = NULL; - SDL_Event evt; - SDL_bool keep_going = SDL_TRUE; - - if (!SDL_Init(SDL_INIT_VIDEO)) { - return 1; - } else if (!SDL_CreateWindowAndRenderer("Hello SDL", 0, 0, SDL_WINDOW_FULLSCREEN, &window, &renderer)) { - return 1; - } - - while (keep_going) { - while (SDL_PollEvent(&evt)) { - if ((evt.type == SDL_EVENT_KEY_DOWN) && (evt.key.keysym.sym == SDLK_ESCAPE)) { - keep_going = SDL_FALSE; - } - } - - SDL_SetRenderDrawColor(renderer, 0, 255, 0, 255); - SDL_RenderClear(renderer); - SDL_RenderPresent(renderer); - } - - SDL_Quit(); - return 0; -} -``` - -#### 6.B. Adding code and assets #### - -If you have existing code and assets that you'd like to add, you should be able -to add them now. The process for adding a set of files is as such. - -1. right click on the app's project -2. select Add, then click on "New Item..." -3. open any source, header, or asset files as appropriate. Support for C and -C++ is available. - -Do note that WinRT only supports a subset of the APIs that are available to -Win32-based apps. Many portions of the Win32 API and the C runtime are not -available. - -A list of unsupported C APIs can be found at - - -General information on using the C runtime in WinRT can be found at - - -A list of supported Win32 APIs for WinRT apps can be found at -. To note, -the list of supported Win32 APIs for Windows Phone 8.0 is different. -That list can be found at - - - -### 7. Build and run your app ### - -Your app project should now be setup, and you should be ready to build your app. -To run it on the local machine, open the Debug menu and choose "Start -Debugging". This will build your app, then run your app full-screen. To switch -out of your app, press the Windows key. Alternatively, you can choose to run -your app in a window. To do this, before building and running your app, find -the drop-down menu in Visual C++'s toolbar that says, "Local Machine". Expand -this by clicking on the arrow on the right side of the list, then click on -Simulator. Once you do that, any time you build and run the app, the app will -launch in window, rather than full-screen. - - -#### 7.A. Running apps on older, ARM-based, "Windows RT" devices #### - -**These instructions do not include Windows Phone, despite Windows Phone -typically running on ARM processors.** They are specifically for devices -that use the "Windows RT" operating system, which was a modified version of -Windows 8.x that ran primarily on ARM-based tablet computers. - -To build and run the app on ARM-based, "Windows RT" devices, you'll need to: - -- install Microsoft's "Remote Debugger" on the device. Visual C++ installs and - debugs ARM-based apps via IP networks. -- change a few options on the development machine, both to make sure it builds - for ARM (rather than x86 or x64), and to make sure it knows how to find the - Windows RT device (on the network). - -Microsoft's Remote Debugger can be found at -. Please note -that separate versions of this debugger exist for different versions of Visual -C++, one each for MSVC 2015, 2013, and 2012. - -To setup Visual C++ to launch your app on an ARM device: - -1. make sure the Remote Debugger is running on your ARM device, and that it's on - the same IP network as your development machine. -2. from Visual C++'s toolbar, find a drop-down menu that says, "Win32". Click - it, then change the value to "ARM". -3. make sure Visual C++ knows the hostname or IP address of the ARM device. To - do this: - 1. open the app project's properties - 2. select "Debugging" - 3. next to "Machine Name", enter the hostname or IP address of the ARM - device - 4. if, and only if, you've turned off authentication in the Remote Debugger, - then change the setting for "Require Authentication" to No - 5. click "OK" -4. build and run the app (from Visual C++). The first time you do this, a - prompt will show up on the ARM device, asking for a Microsoft Account. You - do, unfortunately, need to log in here, and will need to follow the - subsequent registration steps in order to launch the app. After you do so, - if the app didn't already launch, try relaunching it again from within Visual - C++. - - -Troubleshooting ---------------- - -#### Build fails with message, "error LNK2038: mismatch detected for 'vccorlib_lib_should_be_specified_before_msvcrt_lib_to_linker'" - -Try adding the following to your linker flags. In MSVC, this can be done by -right-clicking on the app project, navigating to Configuration Properties -> -Linker -> Command Line, then adding them to the Additional Options -section. - -* For Release builds / MSVC-Configurations, add: - - /nodefaultlib:vccorlib /nodefaultlib:msvcrt vccorlib.lib msvcrt.lib - -* For Debug builds / MSVC-Configurations, add: - - /nodefaultlib:vccorlibd /nodefaultlib:msvcrtd vccorlibd.lib msvcrtd.lib - - -#### Mouse-motion events fail to get sent, or SDL_GetMouseState() fails to return updated values - -This may be caused by a bug in Windows itself, whereby hiding the mouse -cursor can cause mouse-position reporting to fail. - -SDL provides a workaround for this, but it requires that an app links to a -set of Win32-style cursor image-resource files. A copy of suitable resource -files can be found in `src/main/winrt/`. Adding them to an app's Visual C++ -project file should be sufficient to get the app to use them. - - -#### SDL's Visual Studio project file fails to open, with message, "The system can't find the file specified." - -This can be caused for any one of a few reasons, which Visual Studio can -report, but won't always do so in an up-front manner. - -To help determine why this error comes up: - -1. open a copy of Visual Studio without opening a project file. This can be - accomplished via Windows' Start Menu, among other means. -2. show Visual Studio's Output window. This can be done by going to VS' - menu bar, then to View, and then to Output. -3. try opening the SDL project file directly by going to VS' menu bar, then - to File, then to Open, then to Project/Solution. When a File-Open dialog - appears, open the SDL project (such as the one in SDL's source code, in its - directory, VisualC-WinRT/UWP_VS2015/). -4. after attempting to open SDL's Visual Studio project file, additional error - information will be output to the Output window. - -If Visual Studio reports (via its Output window) that the project: - -"could not be loaded because it's missing install components. To fix this launch Visual Studio setup with the following selections: -Microsoft.VisualStudio.ComponentGroup.UWP.VC" - -... then you will need to re-launch Visual Studio's installer, and make sure that -the workflow for "Universal Windows Platform development" is checked, and that its -optional component, "C++ Universal Windows Platform tools" is also checked. While -you are there, if you are planning on targeting UWP / Windows 10, also make sure -that you check the optional component, "Windows 10 SDK (10.0.10240.0)". After -making sure these items are checked as-appropriate, install them. - -Once you install these components, try re-launching Visual Studio, and re-opening -the SDL project file. If you still get the error dialog, try using the Output -window, again, seeing what Visual Studio says about it. - - -#### Game controllers / joysticks aren't working! - -Windows only permits certain game controllers and joysticks to work within -WinRT / UWP apps. Even if a game controller or joystick works in a Win32 -app, that device is not guaranteed to work inside a WinRT / UWP app. - -According to Microsoft, "Xbox compatible controllers" should work inside -UWP apps, potentially with more working in the future. This includes, but -may not be limited to, Microsoft-made Xbox controllers and USB adapters. -(Source: https://social.msdn.microsoft.com/Forums/en-US/9064838b-e8c3-4c18-8a83-19bf0dfe150d/xinput-fails-to-detect-game-controllers?forum=wpdevelop) - - diff --git a/docs/README.md b/docs/README.md index a94fdd3c..812d3ce6 100644 --- a/docs/README.md +++ b/docs/README.md @@ -48,7 +48,6 @@ More documentation and FAQs are available online at [the wiki](http://wiki.libsd - [Raspberry Pi](README-raspberrypi.md) - [RISC OS](README-riscos.md) - [Windows GDK](README-gdk.md) -- [Windows UWP](README-winrt.md) - [Windows](README-windows.md) If you need help with the library, or just want to discuss SDL related diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index acbd1d11..e3527d08 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -23,12 +23,6 @@ if(NOT (MSVC AND SDL_CPU_ARM64)) find_package(OpenGL) endif() -if(WINDOWS_STORE) - cmake_minimum_required(VERSION 3.19) - # CMP0112: Target file component generator expressions do not add target dependencies. - cmake_policy(SET CMP0112 NEW) -endif() - set(SDL_EXAMPLE_EXECUTABLES) if(CMAKE_RUNTIME_OUTPUT_DIRECTORY) @@ -62,15 +56,6 @@ add_custom_target(copy-sdl-example-resources DEPENDS "${RESOURCE_FILES_BINDIR}" ) -if(WINDOWS_STORE) - add_library(sdl_example_main_callbacks_uwp OBJECT ${CMAKE_CURRENT_SOURCE_DIR}/../test/main.cpp) - target_link_libraries(sdl_example_main_callbacks_uwp PRIVATE SDL3::Headers) - target_compile_options(sdl_example_main_callbacks_uwp PRIVATE "/ZW") - target_compile_definitions(sdl_example_main_callbacks_uwp PRIVATE "SDL_MAIN_USE_CALLBACKS") - - set_source_files_properties(${RESOURCE_FILES} PROPERTIES VS_DEPLOYENT_LOCATION "Assets") -endif() - macro(add_sdl_example_executable TARGET) cmake_parse_arguments(AST "BUILD_DEPENDENT" "" "SOURCES;DATAFILES" ${ARGN}) if(AST_UNPARSED_ARGUMENTS) @@ -80,28 +65,6 @@ macro(add_sdl_example_executable TARGET) message(FATAL_ERROR "add_sdl_example_executable needs at least one source") endif() set(EXTRA_SOURCES "") - if(WINDOWS_STORE) - set(uwp_bindir "${CMAKE_CURRENT_BINARY_DIR}/${TARGET}.dir") - if(NOT IS_DIRECTORY "${uwp_bindir}") - execute_process(COMMAND "${CMAKE_COMMAND}" -E make_directory "${uwp_bindir}") - endif() - string(REGEX REPLACE "[_]" "" SAFE_TARGET "${TARGET}") - file(GENERATE OUTPUT "${uwp_bindir}/${TARGET}.appxmanifest" - INPUT "${CMAKE_CURRENT_SOURCE_DIR}/../test/uwp/Package.appxmanifest.in" - TARGET "${TARGET}" - ) - set_property(SOURCE "${uwp_bindir}/${TARGET}.appxmanifest" PROPERTY VS_DEPLOYMENT_CONTENT 1) - - list(APPEND EXTRA_SOURCES "$") - - list(APPEND EXTRA_SOURCES - "${uwp_bindir}/${TARGET}.appxmanifest" - "${CMAKE_CURRENT_SOURCE_DIR}/../test/uwp/logo-50x50.png" - "${CMAKE_CURRENT_SOURCE_DIR}/../test/uwp/square-44x44.png" - "${CMAKE_CURRENT_SOURCE_DIR}/../test/uwp/square-150x150.png" - "${CMAKE_CURRENT_SOURCE_DIR}/../test/uwp/splash-620x300.png" - ) - endif() if(AST_DATAFILES) list(APPEND EXTRA_SOURCES ${DATAFILES}) endif() @@ -122,17 +85,6 @@ macro(add_sdl_example_executable TARGET) COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different ${AST_DATAFILES} $/sdl-${TARGET} WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" ) - elseif(WINDOWS_STORE) - # MSVC does build the dependent targets (or POST_BUILD commands) when building an application - # after starting to debug. By copying the resources in a custom target, the files can be copied afterwards. - # FIXME: find out proper way to add assets to UWP package - cmake_minimum_required(VERSION 3.19) - add_custom_target(zzz-resources-copy-${TARGET} - COMMAND ${CMAKE_COMMAND} -E make_directory "$/AppX" - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${AST_DATAFILES} "$/AppX" - WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" - ) - add_dependencies(${TARGET} zzz-resources-copy-${TARGET}) else() add_dependencies(${TARGET} copy-sdl-example-resources) endif() @@ -156,20 +108,7 @@ macro(add_sdl_example_executable TARGET) endif() elseif(PSP) target_link_libraries(${TARGET} PRIVATE GL) - endif() - if(WINDOWS_STORE) - target_compile_definitions(${TARGET} PRIVATE "SDL_MAIN_NOIMPL") - set_property(TARGET ${TARGET} PROPERTY WIN32_EXECUTABLE TRUE) - set_property(TARGET ${TARGET} PROPERTY RUNTIME_OUTPUT_DIRECTORY "${uwp_bindir}") - target_link_options(${TARGET} PRIVATE - -nodefaultlib:vccorlib$<$:d> - -nodefaultlib:msvcrt$<$:d> - vccorlib$<$:d>.lib - msvcrt$<$:d>.lib - ) - endif() - - if(EMSCRIPTEN) + elseif(EMSCRIPTEN) set_property(TARGET ${TARGET} PROPERTY SUFFIX ".html") endif() diff --git a/examples/game/01-snake/snake.c b/examples/game/01-snake/snake.c index 65ef58c6..3015b5df 100644 --- a/examples/game/01-snake/snake.c +++ b/examples/game/01-snake/snake.c @@ -94,7 +94,7 @@ static int are_cells_full_(SnakeContext *ctx) static void new_food_pos_(SnakeContext *ctx) { - while (SDL_TRUE) { + while (true) { const char x = (char) SDL_rand(SNAKE_GAME_WIDTH); const char y = (char) SDL_rand(SNAKE_GAME_HEIGHT); if (snake_cell_at(ctx, x, y) == SNAKE_CELL_NOTHING) { @@ -283,7 +283,7 @@ SDL_AppResult SDL_AppIterate(void *appstate) SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[]) { - if (!SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER)) { + if (!SDL_Init(SDL_INIT_VIDEO)) { return SDL_APP_FAILURE; } diff --git a/examples/highlight-plugin.lua b/examples/highlight-plugin.lua index 2c9fd79a..9598ec91 100644 --- a/examples/highlight-plugin.lua +++ b/examples/highlight-plugin.lua @@ -44,7 +44,9 @@ function syntaxUpdate(desc) -- SDL keywords start with SDL_ -- if this pattern applies to the token, we return the URL -- if we return nothing, the token is outputted as is - if string.find(token, "SDL_")==1 then + if ( (token == "Uint8") or (token == "Uint16") or (token == "Uint32") or (token == "Uint64") or + (token == "Sint8") or (token == "Sint16") or (token == "Sint32") or (token == "Sint64") or + (string.find(token, "SDL_") == 1) ) then return getURL(token) end diff --git a/include/SDL3/SDL.h b/include/SDL3/SDL.h index c9633941..3698f636 100644 --- a/include/SDL3/SDL.h +++ b/include/SDL3/SDL.h @@ -65,6 +65,7 @@ #include #include #include +#include #include #include #include diff --git a/include/SDL3/SDL_assert.h b/include/SDL3/SDL_assert.h index f5f798e2..ada27001 100644 --- a/include/SDL3/SDL_assert.h +++ b/include/SDL3/SDL_assert.h @@ -220,7 +220,7 @@ typedef enum SDL_AssertState */ typedef struct SDL_AssertData { - SDL_bool always_ignore; /**< SDL_TRUE if app should always continue when assertion is triggered. */ + bool always_ignore; /**< true if app should always continue when assertion is triggered. */ unsigned int trigger_count; /**< Number of times this assertion has been triggered. */ const char *condition; /**< A string of this assert's test code. */ const char *filename; /**< The source file where this assert lives. */ diff --git a/include/SDL3/SDL_atomic.h b/include/SDL3/SDL_atomic.h index f159bcd2..0a9fa045 100644 --- a/include/SDL3/SDL_atomic.h +++ b/include/SDL3/SDL_atomic.h @@ -88,15 +88,14 @@ typedef int SDL_SpinLock; * doing. Please be careful using any sort of spinlock!*** * * \param lock a pointer to a lock variable. - * \returns SDL_TRUE if the lock succeeded, SDL_FALSE if the lock is already - * held. + * \returns true if the lock succeeded, false if the lock is already held. * * \since This function is available since SDL 3.0.0. * * \sa SDL_LockSpinlock * \sa SDL_UnlockSpinlock */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_TryLockSpinlock(SDL_SpinLock *lock); +extern SDL_DECLSPEC bool SDLCALL SDL_TryLockSpinlock(SDL_SpinLock *lock); /** * Lock a spin lock by setting it to a non-zero value. @@ -303,9 +302,10 @@ typedef void (*SDL_KernelMemoryBarrierFunc)(); * A type representing an atomic integer value. * * This can be used to manage a value that is synchronized across multiple - * CPUs without a race condition; when an app sets a value with SDL_AtomicSet - * all other threads, regardless of the CPU it is running on, will see that - * value when retrieved with SDL_AtomicGet, regardless of CPU caches, etc. + * CPUs without a race condition; when an app sets a value with + * SDL_SetAtomicInt all other threads, regardless of the CPU it is running on, + * will see that value when retrieved with SDL_GetAtomicInt, regardless of CPU + * caches, etc. * * This is also useful for atomic compare-and-swap operations: a thread can * change the value as long as its current value matches expectations. When @@ -316,14 +316,14 @@ typedef void (*SDL_KernelMemoryBarrierFunc)(); * this!). * * This is a struct so people don't accidentally use numeric operations on it - * directly. You have to use SDL_Atomic* functions. + * directly. You have to use SDL atomic functions. * * \since This struct is available since SDL 3.0.0. * - * \sa SDL_AtomicCompareAndSwap - * \sa SDL_AtomicGet - * \sa SDL_AtomicSet - * \sa SDL_AtomicAdd + * \sa SDL_CompareAndSwapAtomicInt + * \sa SDL_GetAtomicInt + * \sa SDL_SetAtomicInt + * \sa SDL_AddAtomicInt */ typedef struct SDL_AtomicInt { int value; } SDL_AtomicInt; @@ -336,15 +336,16 @@ typedef struct SDL_AtomicInt { int value; } SDL_AtomicInt; * \param a a pointer to an SDL_AtomicInt variable to be modified. * \param oldval the old value. * \param newval the new value. - * \returns SDL_TRUE if the atomic variable was set, SDL_FALSE otherwise. + * \returns true if the atomic variable was set, false otherwise. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.0.0. * - * \sa SDL_AtomicCompareAndSwapPointer + * \sa SDL_GetAtomicInt + * \sa SDL_SetAtomicInt */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_AtomicCompareAndSwap(SDL_AtomicInt *a, int oldval, int newval); +extern SDL_DECLSPEC bool SDLCALL SDL_CompareAndSwapAtomicInt(SDL_AtomicInt *a, int oldval, int newval); /** * Set an atomic variable to a value. @@ -362,9 +363,9 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_AtomicCompareAndSwap(SDL_AtomicInt *a, * * \since This function is available since SDL 3.0.0. * - * \sa SDL_AtomicGet + * \sa SDL_GetAtomicInt */ -extern SDL_DECLSPEC int SDLCALL SDL_AtomicSet(SDL_AtomicInt *a, int v); +extern SDL_DECLSPEC int SDLCALL SDL_SetAtomicInt(SDL_AtomicInt *a, int v); /** * Get the value of an atomic variable. @@ -379,9 +380,9 @@ extern SDL_DECLSPEC int SDLCALL SDL_AtomicSet(SDL_AtomicInt *a, int v); * * \since This function is available since SDL 3.0.0. * - * \sa SDL_AtomicSet + * \sa SDL_SetAtomicInt */ -extern SDL_DECLSPEC int SDLCALL SDL_AtomicGet(SDL_AtomicInt *a); +extern SDL_DECLSPEC int SDLCALL SDL_GetAtomicInt(SDL_AtomicInt *a); /** * Add to an atomic variable. @@ -402,7 +403,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_AtomicGet(SDL_AtomicInt *a); * \sa SDL_AtomicDecRef * \sa SDL_AtomicIncRef */ -extern SDL_DECLSPEC int SDLCALL SDL_AtomicAdd(SDL_AtomicInt *a, int v); +extern SDL_DECLSPEC int SDLCALL SDL_AddAtomicInt(SDL_AtomicInt *a, int v); #ifndef SDL_AtomicIncRef @@ -418,7 +419,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_AtomicAdd(SDL_AtomicInt *a, int v); * * \sa SDL_AtomicDecRef */ -#define SDL_AtomicIncRef(a) SDL_AtomicAdd(a, 1) +#define SDL_AtomicIncRef(a) SDL_AddAtomicInt(a, 1) #endif #ifndef SDL_AtomicDecRef @@ -429,16 +430,102 @@ extern SDL_DECLSPEC int SDLCALL SDL_AtomicAdd(SDL_AtomicInt *a, int v); * ***Note: If you don't know what this macro is for, you shouldn't use it!*** * * \param a a pointer to an SDL_AtomicInt to increment. - * \returns SDL_TRUE if the variable reached zero after decrementing, - * SDL_FALSE otherwise. + * \returns true if the variable reached zero after decrementing, false + * otherwise. * * \since This macro is available since SDL 3.0.0. * * \sa SDL_AtomicIncRef */ -#define SDL_AtomicDecRef(a) (SDL_AtomicAdd(a, -1) == 1) +#define SDL_AtomicDecRef(a) (SDL_AddAtomicInt(a, -1) == 1) #endif +/** + * A type representing an atomic unsigned 32-bit value. + * + * This can be used to manage a value that is synchronized across multiple + * CPUs without a race condition; when an app sets a value with + * SDL_SetAtomicU32 all other threads, regardless of the CPU it is running on, + * will see that value when retrieved with SDL_GetAtomicU32, regardless of CPU + * caches, etc. + * + * This is also useful for atomic compare-and-swap operations: a thread can + * change the value as long as its current value matches expectations. When + * done in a loop, one can guarantee data consistency across threads without a + * lock (but the usual warnings apply: if you don't know what you're doing, or + * you don't do it carefully, you can confidently cause any number of + * disasters with this, so in most cases, you _should_ use a mutex instead of + * this!). + * + * This is a struct so people don't accidentally use numeric operations on it + * directly. You have to use SDL atomic functions. + * + * \since This struct is available since SDL 3.0.0. + * + * \sa SDL_CompareAndSwapAtomicU32 + * \sa SDL_GetAtomicU32 + * \sa SDL_SetAtomicU32 + * \sa SDL_AddAtomicU32 + */ +typedef struct SDL_AtomicU32 { Uint32 value; } SDL_AtomicU32; + +/** + * Set an atomic variable to a new value if it is currently an old value. + * + * ***Note: If you don't know what this function is for, you shouldn't use + * it!*** + * + * \param a a pointer to an SDL_AtomicU32 variable to be modified. + * \param oldval the old value. + * \param newval the new value. + * \returns true if the atomic variable was set, false otherwise. + * + * \threadsafety It is safe to call this function from any thread. + * + * \since This function is available since SDL 3.0.0. + * + * \sa SDL_GetAtomicU32 + * \sa SDL_SetAtomicU32 + */ +extern SDL_DECLSPEC bool SDLCALL SDL_CompareAndSwapAtomicU32(SDL_AtomicU32 *a, Uint32 oldval, Uint32 newval); + +/** + * Set an atomic variable to a value. + * + * This function also acts as a full memory barrier. + * + * ***Note: If you don't know what this function is for, you shouldn't use + * it!*** + * + * \param a a pointer to an SDL_AtomicU32 variable to be modified. + * \param v the desired value. + * \returns the previous value of the atomic variable. + * + * \threadsafety It is safe to call this function from any thread. + * + * \since This function is available since SDL 3.0.0. + * + * \sa SDL_GetAtomicU32 + */ +extern SDL_DECLSPEC Uint32 SDLCALL SDL_SetAtomicU32(SDL_AtomicU32 *a, Uint32 v); + +/** + * Get the value of an atomic variable. + * + * ***Note: If you don't know what this function is for, you shouldn't use + * it!*** + * + * \param a a pointer to an SDL_AtomicU32 variable. + * \returns the current value of an atomic variable. + * + * \threadsafety It is safe to call this function from any thread. + * + * \since This function is available since SDL 3.0.0. + * + * \sa SDL_SetAtomicU32 + */ +extern SDL_DECLSPEC Uint32 SDLCALL SDL_GetAtomicU32(SDL_AtomicU32 *a); + /** * Set a pointer to a new value if it is currently an old value. * @@ -448,17 +535,17 @@ extern SDL_DECLSPEC int SDLCALL SDL_AtomicAdd(SDL_AtomicInt *a, int v); * \param a a pointer to a pointer. * \param oldval the old pointer value. * \param newval the new pointer value. - * \returns SDL_TRUE if the pointer was set, SDL_FALSE otherwise. + * \returns true if the pointer was set, false otherwise. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.0.0. * - * \sa SDL_AtomicCompareAndSwap - * \sa SDL_AtomicGetPointer - * \sa SDL_AtomicSetPointer + * \sa SDL_CompareAndSwapAtomicInt + * \sa SDL_GetAtomicPointer + * \sa SDL_SetAtomicPointer */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_AtomicCompareAndSwapPointer(void **a, void *oldval, void *newval); +extern SDL_DECLSPEC bool SDLCALL SDL_CompareAndSwapAtomicPointer(void **a, void *oldval, void *newval); /** * Set a pointer to a value atomically. @@ -474,10 +561,10 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_AtomicCompareAndSwapPointer(void **a, v * * \since This function is available since SDL 3.0.0. * - * \sa SDL_AtomicCompareAndSwapPointer - * \sa SDL_AtomicGetPointer + * \sa SDL_CompareAndSwapAtomicPointer + * \sa SDL_GetAtomicPointer */ -extern SDL_DECLSPEC void * SDLCALL SDL_AtomicSetPointer(void **a, void *v); +extern SDL_DECLSPEC void * SDLCALL SDL_SetAtomicPointer(void **a, void *v); /** * Get the value of a pointer atomically. @@ -492,10 +579,10 @@ extern SDL_DECLSPEC void * SDLCALL SDL_AtomicSetPointer(void **a, void *v); * * \since This function is available since SDL 3.0.0. * - * \sa SDL_AtomicCompareAndSwapPointer - * \sa SDL_AtomicSetPointer + * \sa SDL_CompareAndSwapAtomicPointer + * \sa SDL_SetAtomicPointer */ -extern SDL_DECLSPEC void * SDLCALL SDL_AtomicGetPointer(void **a); +extern SDL_DECLSPEC void * SDLCALL SDL_GetAtomicPointer(void **a); /* Ends C function definitions when using C++ */ #ifdef __cplusplus diff --git a/include/SDL3/SDL_audio.h b/include/SDL3/SDL_audio.h index 37e7f06d..7ac0d5be 100644 --- a/include/SDL3/SDL_audio.h +++ b/include/SDL3/SDL_audio.h @@ -94,7 +94,6 @@ #include #include #include -#include #include /* Set up for C function definitions, even when using C++ */ @@ -142,19 +141,20 @@ typedef enum SDL_AudioFormat /* SDL_DEFINE_AUDIO_FORMAT(1, 1, 0, 32), */ SDL_AUDIO_F32LE = 0x8120u, /**< 32-bit floating point samples */ /* SDL_DEFINE_AUDIO_FORMAT(1, 0, 1, 32), */ - SDL_AUDIO_F32BE = 0x9120u /**< As above, but big-endian byte order */ + SDL_AUDIO_F32BE = 0x9120u, /**< As above, but big-endian byte order */ /* SDL_DEFINE_AUDIO_FORMAT(1, 1, 1, 32), */ -} SDL_AudioFormat; -#if SDL_BYTEORDER == SDL_LIL_ENDIAN -#define SDL_AUDIO_S16 SDL_AUDIO_S16LE -#define SDL_AUDIO_S32 SDL_AUDIO_S32LE -#define SDL_AUDIO_F32 SDL_AUDIO_F32LE -#else -#define SDL_AUDIO_S16 SDL_AUDIO_S16BE -#define SDL_AUDIO_S32 SDL_AUDIO_S32BE -#define SDL_AUDIO_F32 SDL_AUDIO_F32BE -#endif + /* These represent the current system's byteorder. */ + #if SDL_BYTEORDER == SDL_LIL_ENDIAN + SDL_AUDIO_S16 = SDL_AUDIO_S16LE, + SDL_AUDIO_S32 = SDL_AUDIO_S32LE, + SDL_AUDIO_F32 = SDL_AUDIO_F32LE + #else + SDL_AUDIO_S16 = SDL_AUDIO_S16BE, + SDL_AUDIO_S32 = SDL_AUDIO_S32BE, + SDL_AUDIO_F32 = SDL_AUDIO_F32BE + #endif +} SDL_AudioFormat; /** @@ -532,14 +532,14 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetAudioDeviceName(SDL_AudioDeviceI * \param spec on return, will be filled with device details. * \param sample_frames pointer to store device buffer size, in sample frames. * Can be NULL. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetAudioDeviceFormat(SDL_AudioDeviceID devid, SDL_AudioSpec *spec, int *sample_frames); +extern SDL_DECLSPEC bool SDLCALL SDL_GetAudioDeviceFormat(SDL_AudioDeviceID devid, SDL_AudioSpec *spec, int *sample_frames); /** * Get the current channel map of an audio device. @@ -659,8 +659,8 @@ extern SDL_DECLSPEC SDL_AudioDeviceID SDLCALL SDL_OpenAudioDevice(SDL_AudioDevic * created through SDL_OpenAudioDevice() can be. * * \param dev a device opened by SDL_OpenAudioDevice(). - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \threadsafety It is safe to call this function from any thread. * @@ -669,7 +669,7 @@ extern SDL_DECLSPEC SDL_AudioDeviceID SDLCALL SDL_OpenAudioDevice(SDL_AudioDevic * \sa SDL_ResumeAudioDevice * \sa SDL_AudioDevicePaused */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_PauseAudioDevice(SDL_AudioDeviceID dev); +extern SDL_DECLSPEC bool SDLCALL SDL_PauseAudioDevice(SDL_AudioDeviceID dev); /** * Use this function to unpause audio playback on a specified device. @@ -687,8 +687,8 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_PauseAudioDevice(SDL_AudioDeviceID dev) * created through SDL_OpenAudioDevice() can be. * * \param dev a device opened by SDL_OpenAudioDevice(). - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \threadsafety It is safe to call this function from any thread. * @@ -697,7 +697,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_PauseAudioDevice(SDL_AudioDeviceID dev) * \sa SDL_AudioDevicePaused * \sa SDL_PauseAudioDevice */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ResumeAudioDevice(SDL_AudioDeviceID dev); +extern SDL_DECLSPEC bool SDLCALL SDL_ResumeAudioDevice(SDL_AudioDeviceID dev); /** * Use this function to query if an audio device is paused. @@ -710,7 +710,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ResumeAudioDevice(SDL_AudioDeviceID dev * IDs will report themselves as unpaused here. * * \param dev a device opened by SDL_OpenAudioDevice(). - * \returns SDL_TRUE if device is valid and paused, SDL_FALSE otherwise. + * \returns true if device is valid and paused, false otherwise. * * \threadsafety It is safe to call this function from any thread. * @@ -719,7 +719,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ResumeAudioDevice(SDL_AudioDeviceID dev * \sa SDL_PauseAudioDevice * \sa SDL_ResumeAudioDevice */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_AudioDevicePaused(SDL_AudioDeviceID dev); +extern SDL_DECLSPEC bool SDLCALL SDL_AudioDevicePaused(SDL_AudioDeviceID dev); /** * Get the gain of an audio device. @@ -753,8 +753,8 @@ extern SDL_DECLSPEC float SDLCALL SDL_GetAudioDeviceGain(SDL_AudioDeviceID devid * Audio devices default to a gain of 1.0f (no change in output). * * Physical devices may not have their gain changed, only logical devices, and - * this function will always return -1 when used on physical devices. While it - * might seem attractive to adjust several logical devices at once in this + * this function will always return false when used on physical devices. While + * it might seem attractive to adjust several logical devices at once in this * way, it would allow an app or library to interfere with another portion of * the program's otherwise-isolated devices. * @@ -767,8 +767,8 @@ extern SDL_DECLSPEC float SDLCALL SDL_GetAudioDeviceGain(SDL_AudioDeviceID devid * * \param devid the audio device on which to change gain. * \param gain the gain. 1.0f is no change, 0.0f is silence. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \threadsafety It is safe to call this function from any thread, as it holds * a stream-specific mutex while running. @@ -777,7 +777,7 @@ extern SDL_DECLSPEC float SDLCALL SDL_GetAudioDeviceGain(SDL_AudioDeviceID devid * * \sa SDL_GetAudioDeviceGain */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetAudioDeviceGain(SDL_AudioDeviceID devid, float gain); +extern SDL_DECLSPEC bool SDLCALL SDL_SetAudioDeviceGain(SDL_AudioDeviceID devid, float gain); /** * Close a previously-opened audio device. @@ -824,8 +824,8 @@ extern SDL_DECLSPEC void SDLCALL SDL_CloseAudioDevice(SDL_AudioDeviceID devid); * \param devid an audio device to bind a stream to. * \param streams an array of audio streams to bind. * \param num_streams number streams listed in the `streams` array. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \threadsafety It is safe to call this function from any thread. * @@ -835,7 +835,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_CloseAudioDevice(SDL_AudioDeviceID devid); * \sa SDL_UnbindAudioStream * \sa SDL_GetAudioStreamDevice */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_BindAudioStreams(SDL_AudioDeviceID devid, SDL_AudioStream **streams, int num_streams); +extern SDL_DECLSPEC bool SDLCALL SDL_BindAudioStreams(SDL_AudioDeviceID devid, SDL_AudioStream **streams, int num_streams); /** * Bind a single audio stream to an audio device. @@ -845,8 +845,8 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_BindAudioStreams(SDL_AudioDeviceID devi * * \param devid an audio device to bind a stream to. * \param stream an audio stream to bind to a device. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \threadsafety It is safe to call this function from any thread. * @@ -856,7 +856,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_BindAudioStreams(SDL_AudioDeviceID devi * \sa SDL_UnbindAudioStream * \sa SDL_GetAudioStreamDevice */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_BindAudioStream(SDL_AudioDeviceID devid, SDL_AudioStream *stream); +extern SDL_DECLSPEC bool SDLCALL SDL_BindAudioStream(SDL_AudioDeviceID devid, SDL_AudioStream *stream); /** * Unbind a list of audio streams from their audio devices. @@ -953,8 +953,8 @@ extern SDL_DECLSPEC SDL_PropertiesID SDLCALL SDL_GetAudioStreamProperties(SDL_Au * \param stream the SDL_AudioStream to query. * \param src_spec where to store the input audio format; ignored if NULL. * \param dst_spec where to store the output audio format; ignored if NULL. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \threadsafety It is safe to call this function from any thread, as it holds * a stream-specific mutex while running. @@ -963,7 +963,7 @@ extern SDL_DECLSPEC SDL_PropertiesID SDLCALL SDL_GetAudioStreamProperties(SDL_Au * * \sa SDL_SetAudioStreamFormat */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetAudioStreamFormat(SDL_AudioStream *stream, SDL_AudioSpec *src_spec, SDL_AudioSpec *dst_spec); +extern SDL_DECLSPEC bool SDLCALL SDL_GetAudioStreamFormat(SDL_AudioStream *stream, SDL_AudioSpec *src_spec, SDL_AudioSpec *dst_spec); /** * Change the input and output formats of an audio stream. @@ -983,8 +983,8 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetAudioStreamFormat(SDL_AudioStream *s * changed. * \param dst_spec the new format of the audio output; if NULL, it is not * changed. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \threadsafety It is safe to call this function from any thread, as it holds * a stream-specific mutex while running. @@ -994,7 +994,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetAudioStreamFormat(SDL_AudioStream *s * \sa SDL_GetAudioStreamFormat * \sa SDL_SetAudioStreamFrequencyRatio */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetAudioStreamFormat(SDL_AudioStream *stream, const SDL_AudioSpec *src_spec, const SDL_AudioSpec *dst_spec); +extern SDL_DECLSPEC bool SDLCALL SDL_SetAudioStreamFormat(SDL_AudioStream *stream, const SDL_AudioSpec *src_spec, const SDL_AudioSpec *dst_spec); /** * Get the frequency ratio of an audio stream. @@ -1027,8 +1027,8 @@ extern SDL_DECLSPEC float SDLCALL SDL_GetAudioStreamFrequencyRatio(SDL_AudioStre * \param stream the stream the frequency ratio is being changed. * \param ratio the frequency ratio. 1.0 is normal speed. Must be between 0.01 * and 100. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \threadsafety It is safe to call this function from any thread, as it holds * a stream-specific mutex while running. @@ -1038,7 +1038,7 @@ extern SDL_DECLSPEC float SDLCALL SDL_GetAudioStreamFrequencyRatio(SDL_AudioStre * \sa SDL_GetAudioStreamFrequencyRatio * \sa SDL_SetAudioStreamFormat */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetAudioStreamFrequencyRatio(SDL_AudioStream *stream, float ratio); +extern SDL_DECLSPEC bool SDLCALL SDL_SetAudioStreamFrequencyRatio(SDL_AudioStream *stream, float ratio); /** * Get the gain of an audio stream. @@ -1074,8 +1074,8 @@ extern SDL_DECLSPEC float SDLCALL SDL_GetAudioStreamGain(SDL_AudioStream *stream * * \param stream the stream on which the gain is being changed. * \param gain the gain. 1.0f is no change, 0.0f is silence. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \threadsafety It is safe to call this function from any thread, as it holds * a stream-specific mutex while running. @@ -1084,7 +1084,7 @@ extern SDL_DECLSPEC float SDLCALL SDL_GetAudioStreamGain(SDL_AudioStream *stream * * \sa SDL_GetAudioStreamGain */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetAudioStreamGain(SDL_AudioStream *stream, float gain); +extern SDL_DECLSPEC bool SDLCALL SDL_SetAudioStreamGain(SDL_AudioStream *stream, float gain); /** * Get the current input channel map of an audio stream. @@ -1171,8 +1171,8 @@ extern SDL_DECLSPEC int * SDLCALL SDL_GetAudioStreamOutputChannelMap(SDL_AudioSt * \param stream the SDL_AudioStream to change. * \param chmap the new channel map, NULL to reset to default. * \param count The number of channels in the map. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \threadsafety It is safe to call this function from any thread, as it holds * a stream-specific mutex while running. Don't change the @@ -1183,7 +1183,7 @@ extern SDL_DECLSPEC int * SDLCALL SDL_GetAudioStreamOutputChannelMap(SDL_AudioSt * * \sa SDL_SetAudioStreamInputChannelMap */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetAudioStreamInputChannelMap(SDL_AudioStream *stream, const int *chmap, int count); +extern SDL_DECLSPEC bool SDLCALL SDL_SetAudioStreamInputChannelMap(SDL_AudioStream *stream, const int *chmap, int count); /** * Set the current output channel map of an audio stream. @@ -1218,8 +1218,8 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetAudioStreamInputChannelMap(SDL_Audio * \param stream the SDL_AudioStream to change. * \param chmap the new channel map, NULL to reset to default. * \param count The number of channels in the map. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \threadsafety It is safe to call this function from any thread, as it holds * a stream-specific mutex while running. Don't change the @@ -1230,7 +1230,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetAudioStreamInputChannelMap(SDL_Audio * * \sa SDL_SetAudioStreamInputChannelMap */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetAudioStreamOutputChannelMap(SDL_AudioStream *stream, const int *chmap, int count); +extern SDL_DECLSPEC bool SDLCALL SDL_SetAudioStreamOutputChannelMap(SDL_AudioStream *stream, const int *chmap, int count); /** * Add data to the stream. @@ -1246,8 +1246,8 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetAudioStreamOutputChannelMap(SDL_Audi * \param stream the stream the audio data is being added to. * \param buf a pointer to the audio data to add. * \param len the number of bytes to write to the stream. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \threadsafety It is safe to call this function from any thread, but if the * stream has a callback set, the caller might need to manage @@ -1260,7 +1260,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetAudioStreamOutputChannelMap(SDL_Audi * \sa SDL_GetAudioStreamData * \sa SDL_GetAudioStreamQueued */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_PutAudioStreamData(SDL_AudioStream *stream, const void *buf, int len); +extern SDL_DECLSPEC bool SDLCALL SDL_PutAudioStreamData(SDL_AudioStream *stream, const void *buf, int len); /** * Get converted/resampled data from the stream. @@ -1361,8 +1361,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetAudioStreamQueued(SDL_AudioStream *stream * input, so the complete output becomes available. * * \param stream the audio stream to flush. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \threadsafety It is safe to call this function from any thread. * @@ -1370,7 +1370,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetAudioStreamQueued(SDL_AudioStream *stream * * \sa SDL_PutAudioStreamData */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_FlushAudioStream(SDL_AudioStream *stream); +extern SDL_DECLSPEC bool SDLCALL SDL_FlushAudioStream(SDL_AudioStream *stream); /** * Clear any pending data in the stream. @@ -1379,8 +1379,8 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_FlushAudioStream(SDL_AudioStream *strea * stream until more is added. * * \param stream the audio stream to clear. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \threadsafety It is safe to call this function from any thread. * @@ -1391,7 +1391,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_FlushAudioStream(SDL_AudioStream *strea * \sa SDL_GetAudioStreamQueued * \sa SDL_PutAudioStreamData */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ClearAudioStream(SDL_AudioStream *stream); +extern SDL_DECLSPEC bool SDLCALL SDL_ClearAudioStream(SDL_AudioStream *stream); /** * Use this function to pause audio playback on the audio device associated @@ -1406,8 +1406,8 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ClearAudioStream(SDL_AudioStream *strea * loading, etc. * * \param stream the audio stream associated with the audio device to pause. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \threadsafety It is safe to call this function from any thread. * @@ -1415,7 +1415,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ClearAudioStream(SDL_AudioStream *strea * * \sa SDL_ResumeAudioStreamDevice */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_PauseAudioStreamDevice(SDL_AudioStream *stream); +extern SDL_DECLSPEC bool SDLCALL SDL_PauseAudioStreamDevice(SDL_AudioStream *stream); /** * Use this function to unpause audio playback on the audio device associated @@ -1426,8 +1426,8 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_PauseAudioStreamDevice(SDL_AudioStream * to progress again, and audio can be generated. * * \param stream the audio stream associated with the audio device to resume. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \threadsafety It is safe to call this function from any thread. * @@ -1435,7 +1435,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_PauseAudioStreamDevice(SDL_AudioStream * * \sa SDL_PauseAudioStreamDevice */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ResumeAudioStreamDevice(SDL_AudioStream *stream); +extern SDL_DECLSPEC bool SDLCALL SDL_ResumeAudioStreamDevice(SDL_AudioStream *stream); /** * Lock an audio stream for serialized access. @@ -1454,8 +1454,8 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ResumeAudioStreamDevice(SDL_AudioStream * all the same attributes (recursive locks are allowed, etc). * * \param stream the audio stream to lock. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \threadsafety It is safe to call this function from any thread. * @@ -1463,7 +1463,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ResumeAudioStreamDevice(SDL_AudioStream * * \sa SDL_UnlockAudioStream */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_LockAudioStream(SDL_AudioStream *stream); +extern SDL_DECLSPEC bool SDLCALL SDL_LockAudioStream(SDL_AudioStream *stream); /** @@ -1472,8 +1472,8 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_LockAudioStream(SDL_AudioStream *stream * This unlocks an audio stream after a call to SDL_LockAudioStream. * * \param stream the audio stream to unlock. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \threadsafety You should only call this from the same thread that * previously called SDL_LockAudioStream. @@ -1482,7 +1482,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_LockAudioStream(SDL_AudioStream *stream * * \sa SDL_LockAudioStream */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_UnlockAudioStream(SDL_AudioStream *stream); +extern SDL_DECLSPEC bool SDLCALL SDL_UnlockAudioStream(SDL_AudioStream *stream); /** * A callback that fires when data passes through an SDL_AudioStream. @@ -1561,8 +1561,8 @@ typedef void (SDLCALL *SDL_AudioStreamCallback)(void *userdata, SDL_AudioStream * from the stream. * \param userdata an opaque pointer provided to the callback for its own * personal use. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. This only fails if `stream` is NULL. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. This only fails if `stream` is NULL. * * \threadsafety It is safe to call this function from any thread. * @@ -1570,7 +1570,7 @@ typedef void (SDLCALL *SDL_AudioStreamCallback)(void *userdata, SDL_AudioStream * * \sa SDL_SetAudioStreamPutCallback */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetAudioStreamGetCallback(SDL_AudioStream *stream, SDL_AudioStreamCallback callback, void *userdata); +extern SDL_DECLSPEC bool SDLCALL SDL_SetAudioStreamGetCallback(SDL_AudioStream *stream, SDL_AudioStreamCallback callback, void *userdata); /** * Set a callback that runs when data is added to an audio stream. @@ -1610,8 +1610,8 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetAudioStreamGetCallback(SDL_AudioStre * stream. * \param userdata an opaque pointer provided to the callback for its own * personal use. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. This only fails if `stream` is NULL. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. This only fails if `stream` is NULL. * * \threadsafety It is safe to call this function from any thread. * @@ -1619,7 +1619,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetAudioStreamGetCallback(SDL_AudioStre * * \sa SDL_SetAudioStreamGetCallback */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetAudioStreamPutCallback(SDL_AudioStream *stream, SDL_AudioStreamCallback callback, void *userdata); +extern SDL_DECLSPEC bool SDLCALL SDL_SetAudioStreamPutCallback(SDL_AudioStream *stream, SDL_AudioStreamCallback callback, void *userdata); /** @@ -1788,14 +1788,14 @@ typedef void (SDLCALL *SDL_AudioPostmixCallback)(void *userdata, const SDL_Audio * \param devid the ID of an opened audio device. * \param callback a callback function to be called. Can be NULL. * \param userdata app-controlled pointer passed to callback. Can be NULL. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetAudioPostmixCallback(SDL_AudioDeviceID devid, SDL_AudioPostmixCallback callback, void *userdata); +extern SDL_DECLSPEC bool SDLCALL SDL_SetAudioPostmixCallback(SDL_AudioDeviceID devid, SDL_AudioPostmixCallback callback, void *userdata); /** @@ -1850,19 +1850,19 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetAudioPostmixCallback(SDL_AudioDevice * ``` * * \param src the data source for the WAVE data. - * \param closeio if SDL_TRUE, calls SDL_CloseIO() on `src` before returning, - * even in the case of an error. + * \param closeio if true, calls SDL_CloseIO() on `src` before returning, even + * in the case of an error. * \param spec a pointer to an SDL_AudioSpec that will be set to the WAVE * data's format details on successful return. * \param audio_buf a pointer filled with the audio data, allocated by the * function. * \param audio_len a pointer filled with the length of the audio data buffer * in bytes. - * \returns SDL_TRUE on success. `audio_buf` will be filled with a pointer to - * an allocated buffer containing the audio data, and `audio_len` is + * \returns true on success. `audio_buf` will be filled with a pointer to an + * allocated buffer containing the audio data, and `audio_len` is * filled with the length of that audio buffer in bytes. * - * This function returns SDL_FALSE if the .WAV file cannot be opened, + * This function returns false if the .WAV file cannot be opened, * uses an unknown data format, or is corrupt; call SDL_GetError() * for more information. * @@ -1876,7 +1876,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetAudioPostmixCallback(SDL_AudioDevice * \sa SDL_free * \sa SDL_LoadWAV */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_LoadWAV_IO(SDL_IOStream *src, SDL_bool closeio, SDL_AudioSpec *spec, Uint8 **audio_buf, Uint32 *audio_len); +extern SDL_DECLSPEC bool SDLCALL SDL_LoadWAV_IO(SDL_IOStream *src, bool closeio, SDL_AudioSpec *spec, Uint8 **audio_buf, Uint32 *audio_len); /** * Loads a WAV from a file path. @@ -1884,7 +1884,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_LoadWAV_IO(SDL_IOStream *src, SDL_bool * This is a convenience function that is effectively the same as: * * ```c - * SDL_LoadWAV_IO(SDL_IOFromFile(path, "rb"), SDL_TRUE, spec, audio_buf, audio_len); + * SDL_LoadWAV_IO(SDL_IOFromFile(path, "rb"), true, spec, audio_buf, audio_len); * ``` * * \param path the file path of the WAV file to open. @@ -1894,11 +1894,11 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_LoadWAV_IO(SDL_IOStream *src, SDL_bool * function. * \param audio_len a pointer filled with the length of the audio data buffer * in bytes. - * \returns SDL_TRUE on success. `audio_buf` will be filled with a pointer to - * an allocated buffer containing the audio data, and `audio_len` is + * \returns true on success. `audio_buf` will be filled with a pointer to an + * allocated buffer containing the audio data, and `audio_len` is * filled with the length of that audio buffer in bytes. * - * This function returns SDL_FALSE if the .WAV file cannot be opened, + * This function returns false if the .WAV file cannot be opened, * uses an unknown data format, or is corrupt; call SDL_GetError() * for more information. * @@ -1912,7 +1912,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_LoadWAV_IO(SDL_IOStream *src, SDL_bool * \sa SDL_free * \sa SDL_LoadWAV_IO */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_LoadWAV(const char *path, SDL_AudioSpec *spec, Uint8 **audio_buf, Uint32 *audio_len); +extern SDL_DECLSPEC bool SDLCALL SDL_LoadWAV(const char *path, SDL_AudioSpec *spec, Uint8 **audio_buf, Uint32 *audio_len); /** * Mix audio data in a specified format. @@ -1941,14 +1941,14 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_LoadWAV(const char *path, SDL_AudioSpec * \param len the length of the audio buffer in bytes. * \param volume ranges from 0.0 - 1.0, and should be set to 1.0 for full * audio volume. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_MixAudio(Uint8 *dst, const Uint8 *src, SDL_AudioFormat format, Uint32 len, float volume); +extern SDL_DECLSPEC bool SDLCALL SDL_MixAudio(Uint8 *dst, const Uint8 *src, SDL_AudioFormat format, Uint32 len, float volume); /** * Convert some audio data of one format to another format. @@ -1971,14 +1971,14 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_MixAudio(Uint8 *dst, const Uint8 *src, * which should be freed with SDL_free(). On error, it will be * NULL. * \param dst_len will be filled with the len of dst_data. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ConvertAudioSamples(const SDL_AudioSpec *src_spec, const Uint8 *src_data, int src_len, const SDL_AudioSpec *dst_spec, Uint8 **dst_data, int *dst_len); +extern SDL_DECLSPEC bool SDLCALL SDL_ConvertAudioSamples(const SDL_AudioSpec *src_spec, const Uint8 *src_data, int src_len, const SDL_AudioSpec *dst_spec, Uint8 **dst_data, int *dst_len); /** * Get the human readable name of an audio format. diff --git a/include/SDL3/SDL_begin_code.h b/include/SDL3/SDL_begin_code.h index f418c610..acf99284 100644 --- a/include/SDL3/SDL_begin_code.h +++ b/include/SDL3/SDL_begin_code.h @@ -53,7 +53,7 @@ /* Some compilers use a special export keyword */ #ifndef SDL_DECLSPEC -# if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINRT) || defined(SDL_PLATFORM_CYGWIN) || defined(SDL_PLATFORM_GDK) +# if defined(SDL_PLATFORM_WINDOWS) # ifdef DLL_EXPORT # define SDL_DECLSPEC __declspec(dllexport) # else @@ -70,7 +70,7 @@ /* By default SDL uses the C calling convention */ #ifndef SDLCALL -#if (defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINRT) || defined(SDL_PLATFORM_GDK)) && !defined(__GNUC__) +#if defined(SDL_PLATFORM_WINDOWS) && !defined(__GNUC__) #define SDLCALL __cdecl #else #define SDLCALL diff --git a/include/SDL3/SDL_bits.h b/include/SDL3/SDL_bits.h index 72be0827..15548bc6 100644 --- a/include/SDL3/SDL_bits.h +++ b/include/SDL3/SDL_bits.h @@ -120,8 +120,7 @@ SDL_FORCE_INLINE int SDL_MostSignificantBitIndex32(Uint32 x) * Determine if a unsigned 32-bit value has exactly one bit set. * * If there are no bits set (`x` is zero), or more than one bit set, this - * returns SDL_FALSE. If any one bit is exclusively set, this returns - * SDL_TRUE. + * returns false. If any one bit is exclusively set, this returns true. * * Note that this is a forced-inline function in a header, and not a public * API function available in the SDL library (which is to say, the code is @@ -129,18 +128,18 @@ SDL_FORCE_INLINE int SDL_MostSignificantBitIndex32(Uint32 x) * be able to find this function inside SDL itself). * * \param x the 32-bit value to examine. - * \returns SDL_TRUE if exactly one bit is set in `x`, SDL_FALSE otherwise. + * \returns true if exactly one bit is set in `x`, false otherwise. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.0.0. */ -SDL_FORCE_INLINE SDL_bool SDL_HasExactlyOneBitSet32(Uint32 x) +SDL_FORCE_INLINE bool SDL_HasExactlyOneBitSet32(Uint32 x) { if (x && !(x & (x - 1))) { - return SDL_TRUE; + return true; } - return SDL_FALSE; + return false; } /* Ends C function definitions when using C++ */ diff --git a/include/SDL3/SDL_camera.h b/include/SDL3/SDL_camera.h index 3d4c57e9..db2eb694 100644 --- a/include/SDL3/SDL_camera.h +++ b/include/SDL3/SDL_camera.h @@ -33,8 +33,11 @@ #ifndef SDL_camera_h_ #define SDL_camera_h_ +#include #include -#include +#include +#include +#include #include /* Set up for C function definitions, even when using C++ */ @@ -366,15 +369,15 @@ extern SDL_DECLSPEC SDL_PropertiesID SDLCALL SDL_GetCameraProperties(SDL_Camera * be converting to this format behind the scenes. * * If the system is waiting for the user to approve access to the camera, as - * some platforms require, this will return SDL_FALSE, but this isn't - * necessarily a fatal error; you should either wait for an + * some platforms require, this will return false, but this isn't necessarily + * a fatal error; you should either wait for an * SDL_EVENT_CAMERA_DEVICE_APPROVED (or SDL_EVENT_CAMERA_DEVICE_DENIED) event, * or poll SDL_IsCameraApproved() occasionally until it returns non-zero. * * \param camera opened camera device. * \param spec the SDL_CameraSpec to be initialized by this function. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \threadsafety It is safe to call this function from any thread. * @@ -382,7 +385,7 @@ extern SDL_DECLSPEC SDL_PropertiesID SDLCALL SDL_GetCameraProperties(SDL_Camera * * \sa SDL_OpenCamera */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetCameraFormat(SDL_Camera *camera, SDL_CameraSpec *spec); +extern SDL_DECLSPEC bool SDLCALL SDL_GetCameraFormat(SDL_Camera *camera, SDL_CameraSpec *spec); /** * Acquire a frame. diff --git a/include/SDL3/SDL_clipboard.h b/include/SDL3/SDL_clipboard.h index 4d4ae322..0ec724ac 100644 --- a/include/SDL3/SDL_clipboard.h +++ b/include/SDL3/SDL_clipboard.h @@ -46,15 +46,15 @@ extern "C" { * Put UTF-8 text into the clipboard. * * \param text the text to store in the clipboard. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_GetClipboardText * \sa SDL_HasClipboardText */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetClipboardText(const char *text); +extern SDL_DECLSPEC bool SDLCALL SDL_SetClipboardText(const char *text); /** * Get UTF-8 text from the clipboard. @@ -76,28 +76,28 @@ extern SDL_DECLSPEC char * SDLCALL SDL_GetClipboardText(void); /** * Query whether the clipboard exists and contains a non-empty text string. * - * \returns SDL_TRUE if the clipboard has text, or SDL_FALSE if it does not. + * \returns true if the clipboard has text, or false if it does not. * * \since This function is available since SDL 3.0.0. * * \sa SDL_GetClipboardText * \sa SDL_SetClipboardText */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_HasClipboardText(void); +extern SDL_DECLSPEC bool SDLCALL SDL_HasClipboardText(void); /** * Put UTF-8 text into the primary selection. * * \param text the text to store in the primary selection. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_GetPrimarySelectionText * \sa SDL_HasPrimarySelectionText */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetPrimarySelectionText(const char *text); +extern SDL_DECLSPEC bool SDLCALL SDL_SetPrimarySelectionText(const char *text); /** * Get UTF-8 text from the primary selection. @@ -120,15 +120,14 @@ extern SDL_DECLSPEC char * SDLCALL SDL_GetPrimarySelectionText(void); * Query whether the primary selection exists and contains a non-empty text * string. * - * \returns SDL_TRUE if the primary selection has text, or SDL_FALSE if it - * does not. + * \returns true if the primary selection has text, or false if it does not. * * \since This function is available since SDL 3.0.0. * * \sa SDL_GetPrimarySelectionText * \sa SDL_SetPrimarySelectionText */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_HasPrimarySelectionText(void); +extern SDL_DECLSPEC bool SDLCALL SDL_HasPrimarySelectionText(void); /** * Callback function that will be called when data for the specified mime-type @@ -185,8 +184,8 @@ typedef void (SDLCALL *SDL_ClipboardCleanupCallback)(void *userdata); * \param userdata an opaque pointer that will be forwarded to the callbacks. * \param mime_types a list of mime-types that are being offered. * \param num_mime_types the number of mime-types in the mime_types list. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * @@ -194,19 +193,19 @@ typedef void (SDLCALL *SDL_ClipboardCleanupCallback)(void *userdata); * \sa SDL_GetClipboardData * \sa SDL_HasClipboardData */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetClipboardData(SDL_ClipboardDataCallback callback, SDL_ClipboardCleanupCallback cleanup, void *userdata, const char **mime_types, size_t num_mime_types); +extern SDL_DECLSPEC bool SDLCALL SDL_SetClipboardData(SDL_ClipboardDataCallback callback, SDL_ClipboardCleanupCallback cleanup, void *userdata, const char **mime_types, size_t num_mime_types); /** * Clear the clipboard data. * - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_SetClipboardData */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ClearClipboardData(void); +extern SDL_DECLSPEC bool SDLCALL SDL_ClearClipboardData(void); /** * Get the data from clipboard for a given mime type. @@ -231,15 +230,15 @@ extern SDL_DECLSPEC void * SDLCALL SDL_GetClipboardData(const char *mime_type, s * Query whether there is data in the clipboard for the provided mime type. * * \param mime_type the mime type to check for data for. - * \returns SDL_TRUE if there exists data in clipboard for the provided mime - * type, SDL_FALSE if it does not. + * \returns true if there exists data in clipboard for the provided mime type, + * false if it does not. * * \since This function is available since SDL 3.0.0. * * \sa SDL_SetClipboardData * \sa SDL_GetClipboardData */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_HasClipboardData(const char *mime_type); +extern SDL_DECLSPEC bool SDLCALL SDL_HasClipboardData(const char *mime_type); /* Ends C function definitions when using C++ */ #ifdef __cplusplus diff --git a/include/SDL3/SDL_cpuinfo.h b/include/SDL3/SDL_cpuinfo.h index e7ced26d..ef4a90c6 100644 --- a/include/SDL3/SDL_cpuinfo.h +++ b/include/SDL3/SDL_cpuinfo.h @@ -54,7 +54,7 @@ extern "C" { #define SDL_CACHELINE_SIZE 128 /** - * Get the number of CPU cores available. + * Get the number of logical CPU cores available. * * \returns the total number of logical CPU cores. On CPUs that include * technologies such as hyperthreading, the number of logical cores @@ -62,7 +62,7 @@ extern "C" { * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC int SDLCALL SDL_GetCPUCount(void); +extern SDL_DECLSPEC int SDLCALL SDL_GetNumLogicalCPUCores(void); /** * Determine the L1 cache line size of the CPU. @@ -82,29 +82,29 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetCPUCacheLineSize(void); * This always returns false on CPUs that aren't using PowerPC instruction * sets. * - * \returns SDL_TRUE if the CPU has AltiVec features or SDL_FALSE if not. + * \returns true if the CPU has AltiVec features or false if not. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_HasAltiVec(void); +extern SDL_DECLSPEC bool SDLCALL SDL_HasAltiVec(void); /** * Determine whether the CPU has MMX features. * * This always returns false on CPUs that aren't using Intel instruction sets. * - * \returns SDL_TRUE if the CPU has MMX features or SDL_FALSE if not. + * \returns true if the CPU has MMX features or false if not. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_HasMMX(void); +extern SDL_DECLSPEC bool SDLCALL SDL_HasMMX(void); /** * Determine whether the CPU has SSE features. * * This always returns false on CPUs that aren't using Intel instruction sets. * - * \returns SDL_TRUE if the CPU has SSE features or SDL_FALSE if not. + * \returns true if the CPU has SSE features or false if not. * * \since This function is available since SDL 3.0.0. * @@ -113,14 +113,14 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_HasMMX(void); * \sa SDL_HasSSE41 * \sa SDL_HasSSE42 */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_HasSSE(void); +extern SDL_DECLSPEC bool SDLCALL SDL_HasSSE(void); /** * Determine whether the CPU has SSE2 features. * * This always returns false on CPUs that aren't using Intel instruction sets. * - * \returns SDL_TRUE if the CPU has SSE2 features or SDL_FALSE if not. + * \returns true if the CPU has SSE2 features or false if not. * * \since This function is available since SDL 3.0.0. * @@ -129,14 +129,14 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_HasSSE(void); * \sa SDL_HasSSE41 * \sa SDL_HasSSE42 */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_HasSSE2(void); +extern SDL_DECLSPEC bool SDLCALL SDL_HasSSE2(void); /** * Determine whether the CPU has SSE3 features. * * This always returns false on CPUs that aren't using Intel instruction sets. * - * \returns SDL_TRUE if the CPU has SSE3 features or SDL_FALSE if not. + * \returns true if the CPU has SSE3 features or false if not. * * \since This function is available since SDL 3.0.0. * @@ -145,14 +145,14 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_HasSSE2(void); * \sa SDL_HasSSE41 * \sa SDL_HasSSE42 */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_HasSSE3(void); +extern SDL_DECLSPEC bool SDLCALL SDL_HasSSE3(void); /** * Determine whether the CPU has SSE4.1 features. * * This always returns false on CPUs that aren't using Intel instruction sets. * - * \returns SDL_TRUE if the CPU has SSE4.1 features or SDL_FALSE if not. + * \returns true if the CPU has SSE4.1 features or false if not. * * \since This function is available since SDL 3.0.0. * @@ -161,14 +161,14 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_HasSSE3(void); * \sa SDL_HasSSE3 * \sa SDL_HasSSE42 */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_HasSSE41(void); +extern SDL_DECLSPEC bool SDLCALL SDL_HasSSE41(void); /** * Determine whether the CPU has SSE4.2 features. * * This always returns false on CPUs that aren't using Intel instruction sets. * - * \returns SDL_TRUE if the CPU has SSE4.2 features or SDL_FALSE if not. + * \returns true if the CPU has SSE4.2 features or false if not. * * \since This function is available since SDL 3.0.0. * @@ -177,49 +177,49 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_HasSSE41(void); * \sa SDL_HasSSE3 * \sa SDL_HasSSE41 */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_HasSSE42(void); +extern SDL_DECLSPEC bool SDLCALL SDL_HasSSE42(void); /** * Determine whether the CPU has AVX features. * * This always returns false on CPUs that aren't using Intel instruction sets. * - * \returns SDL_TRUE if the CPU has AVX features or SDL_FALSE if not. + * \returns true if the CPU has AVX features or false if not. * * \since This function is available since SDL 3.0.0. * * \sa SDL_HasAVX2 * \sa SDL_HasAVX512F */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_HasAVX(void); +extern SDL_DECLSPEC bool SDLCALL SDL_HasAVX(void); /** * Determine whether the CPU has AVX2 features. * * This always returns false on CPUs that aren't using Intel instruction sets. * - * \returns SDL_TRUE if the CPU has AVX2 features or SDL_FALSE if not. + * \returns true if the CPU has AVX2 features or false if not. * * \since This function is available since SDL 3.0.0. * * \sa SDL_HasAVX * \sa SDL_HasAVX512F */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_HasAVX2(void); +extern SDL_DECLSPEC bool SDLCALL SDL_HasAVX2(void); /** * Determine whether the CPU has AVX-512F (foundation) features. * * This always returns false on CPUs that aren't using Intel instruction sets. * - * \returns SDL_TRUE if the CPU has AVX-512F features or SDL_FALSE if not. + * \returns true if the CPU has AVX-512F features or false if not. * * \since This function is available since SDL 3.0.0. * * \sa SDL_HasAVX * \sa SDL_HasAVX2 */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_HasAVX512F(void); +extern SDL_DECLSPEC bool SDLCALL SDL_HasAVX512F(void); /** * Determine whether the CPU has ARM SIMD (ARMv6) features. @@ -228,24 +228,24 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_HasAVX512F(void); * * This always returns false on CPUs that aren't using ARM instruction sets. * - * \returns SDL_TRUE if the CPU has ARM SIMD features or SDL_FALSE if not. + * \returns true if the CPU has ARM SIMD features or false if not. * * \since This function is available since SDL 3.0.0. * * \sa SDL_HasNEON */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_HasARMSIMD(void); +extern SDL_DECLSPEC bool SDLCALL SDL_HasARMSIMD(void); /** * Determine whether the CPU has NEON (ARM SIMD) features. * * This always returns false on CPUs that aren't using ARM instruction sets. * - * \returns SDL_TRUE if the CPU has ARM NEON features or SDL_FALSE if not. + * \returns true if the CPU has ARM NEON features or false if not. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_HasNEON(void); +extern SDL_DECLSPEC bool SDLCALL SDL_HasNEON(void); /** * Determine whether the CPU has LSX (LOONGARCH SIMD) features. @@ -253,12 +253,11 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_HasNEON(void); * This always returns false on CPUs that aren't using LOONGARCH instruction * sets. * - * \returns SDL_TRUE if the CPU has LOONGARCH LSX features or SDL_FALSE if - * not. + * \returns true if the CPU has LOONGARCH LSX features or false if not. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_HasLSX(void); +extern SDL_DECLSPEC bool SDLCALL SDL_HasLSX(void); /** * Determine whether the CPU has LASX (LOONGARCH SIMD) features. @@ -266,12 +265,11 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_HasLSX(void); * This always returns false on CPUs that aren't using LOONGARCH instruction * sets. * - * \returns SDL_TRUE if the CPU has LOONGARCH LASX features or SDL_FALSE if - * not. + * \returns true if the CPU has LOONGARCH LASX features or false if not. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_HasLASX(void); +extern SDL_DECLSPEC bool SDLCALL SDL_HasLASX(void); /** * Get the amount of RAM configured in the system. diff --git a/include/SDL3/SDL_dialog.h b/include/SDL3/SDL_dialog.h index 8a198a84..11343c83 100644 --- a/include/SDL3/SDL_dialog.h +++ b/include/SDL3/SDL_dialog.h @@ -28,6 +28,7 @@ #ifndef SDL_dialog_h_ #define SDL_dialog_h_ +#include #include #include @@ -150,7 +151,7 @@ typedef void (SDLCALL *SDL_DialogFileCallback)(void *userdata, const char * cons * \sa SDL_ShowSaveFileDialog * \sa SDL_ShowOpenFolderDialog */ -extern SDL_DECLSPEC void SDLCALL SDL_ShowOpenFileDialog(SDL_DialogFileCallback callback, void *userdata, SDL_Window *window, const SDL_DialogFileFilter *filters, int nfilters, const char *default_location, SDL_bool allow_many); +extern SDL_DECLSPEC void SDLCALL SDL_ShowOpenFileDialog(SDL_DialogFileCallback callback, void *userdata, SDL_Window *window, const SDL_DialogFileFilter *filters, int nfilters, const char *default_location, bool allow_many); /** * Displays a dialog that lets the user choose a new or existing file on their @@ -253,7 +254,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_ShowSaveFileDialog(SDL_DialogFileCallback c * \sa SDL_ShowOpenFileDialog * \sa SDL_ShowSaveFileDialog */ -extern SDL_DECLSPEC void SDLCALL SDL_ShowOpenFolderDialog(SDL_DialogFileCallback callback, void *userdata, SDL_Window *window, const char *default_location, SDL_bool allow_many); +extern SDL_DECLSPEC void SDLCALL SDL_ShowOpenFolderDialog(SDL_DialogFileCallback callback, void *userdata, SDL_Window *window, const char *default_location, bool allow_many); /* Ends C function definitions when using C++ */ #ifdef __cplusplus @@ -261,4 +262,4 @@ extern SDL_DECLSPEC void SDLCALL SDL_ShowOpenFolderDialog(SDL_DialogFileCallback #endif #include -#endif /* SDL_joystick_h_ */ +#endif /* SDL_dialog_h_ */ diff --git a/include/SDL3/SDL_error.h b/include/SDL3/SDL_error.h index a98823f9..ed79fc2d 100644 --- a/include/SDL3/SDL_error.h +++ b/include/SDL3/SDL_error.h @@ -44,8 +44,8 @@ extern "C" { * * Calling this function will replace any previous error message that was set. * - * This function always returns -1, since SDL frequently uses -1 to signify an - * failing result, leading to this idiom: + * This function always returns false, since SDL frequently uses false to + * signify a failing result, leading to this idiom: * * ```c * if (error_code) { @@ -56,25 +56,25 @@ extern "C" { * \param fmt a printf()-style message format string. * \param ... additional parameters matching % tokens in the `fmt` string, if * any. - * \returns SDL_FALSE. + * \returns false. * * \since This function is available since SDL 3.0.0. * * \sa SDL_ClearError * \sa SDL_GetError */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(1); +extern SDL_DECLSPEC bool SDLCALL SDL_SetError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(1); /** * Set an error indicating that memory allocation failed. * * This function does not do any memory allocation. * - * \returns SDL_FALSE. + * \returns false. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_OutOfMemory(void); +extern SDL_DECLSPEC bool SDLCALL SDL_OutOfMemory(void); /** * Retrieve a message about the last error that occurred on the current @@ -114,14 +114,14 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetError(void); /** * Clear any previous error message for this thread. * - * \returns SDL_TRUE. + * \returns true. * * \since This function is available since SDL 3.0.0. * * \sa SDL_GetError * \sa SDL_SetError */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ClearError(void); +extern SDL_DECLSPEC bool SDLCALL SDL_ClearError(void); /** * \name Internal error functions diff --git a/include/SDL3/SDL_events.h b/include/SDL3/SDL_events.h index fbe2bb06..e8fddab8 100644 --- a/include/SDL3/SDL_events.h +++ b/include/SDL3/SDL_events.h @@ -28,17 +28,21 @@ #ifndef SDL_events_h_ #define SDL_events_h_ +#include #include +#include #include #include #include #include +#include #include #include -#include +#include +#include +#include #include #include -#include #include /* Set up for C function definitions, even when using C++ */ @@ -48,25 +52,6 @@ extern "C" { /* General keyboard/mouse/pen state definitions */ -/** - * A value that signifies a button is no longer pressed. - * - * \since This macro is available since SDL 3.0.0. - * - * \sa SDL_PRESSED - */ -#define SDL_RELEASED 0 - -/** - * A value that signifies a button has been pressed down. - * - * \since This macro is available since SDL 3.0.0. - * - * \sa SDL_RELEASED - */ -#define SDL_PRESSED 1 - - /** * The types of events that can be delivered. * @@ -342,8 +327,8 @@ typedef struct SDL_KeyboardEvent SDL_Keycode key; /**< SDL virtual key code */ SDL_Keymod mod; /**< current key modifiers */ Uint16 raw; /**< The platform dependent scancode for this event */ - Uint8 state; /**< SDL_PRESSED or SDL_RELEASED */ - Uint8 repeat; /**< Non-zero if this is a key repeat */ + bool down; /**< true if the key is pressed */ + bool repeat; /**< true if this is a key repeat */ } SDL_KeyboardEvent; /** @@ -380,7 +365,10 @@ typedef struct SDL_TextEditingCandidatesEvent const char * const *candidates; /**< The list of candidates, or NULL if there are no candidates available */ Sint32 num_candidates; /**< The number of strings in `candidates` */ Sint32 selected_candidate; /**< The index of the selected candidate, or -1 if no candidate is selected */ - SDL_bool horizontal; /**< SDL_TRUE if the list is horizontal, SDL_FALSE if it's vertical */ + bool horizontal; /**< true if the list is horizontal, false if it's vertical */ + Uint8 padding1; + Uint8 padding2; + Uint8 padding3; } SDL_TextEditingCandidatesEvent; /** @@ -448,7 +436,7 @@ typedef struct SDL_MouseButtonEvent SDL_WindowID windowID; /**< The window with mouse focus, if any */ SDL_MouseID which; /**< The mouse instance id, SDL_TOUCH_MOUSEID */ Uint8 button; /**< The mouse button index */ - Uint8 state; /**< SDL_PRESSED or SDL_RELEASED */ + bool down; /**< true if the button is pressed */ Uint8 clicks; /**< 1 for single-click, 2 for double-click, etc. */ Uint8 padding; float x; /**< X coordinate, relative to window */ @@ -547,7 +535,7 @@ typedef struct SDL_JoyButtonEvent Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */ SDL_JoystickID which; /**< The joystick instance id */ Uint8 button; /**< The joystick button index */ - Uint8 state; /**< SDL_PRESSED or SDL_RELEASED */ + bool down; /**< true if the button is pressed */ Uint8 padding1; Uint8 padding2; } SDL_JoyButtonEvent; @@ -612,7 +600,7 @@ typedef struct SDL_GamepadButtonEvent Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */ SDL_JoystickID which; /**< The joystick instance id */ Uint8 button; /**< The gamepad button (SDL_GamepadButton) */ - Uint8 state; /**< SDL_PRESSED or SDL_RELEASED */ + bool down; /**< true if the button is pressed */ Uint8 padding1; Uint8 padding2; } SDL_GamepadButtonEvent; @@ -676,7 +664,7 @@ typedef struct SDL_AudioDeviceEvent Uint32 reserved; Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */ SDL_AudioDeviceID which; /**< SDL_AudioDeviceID for the device being added or removed or changing */ - Uint8 recording; /**< zero if a playback device, non-zero if a recording device. */ + bool recording; /**< false if a playback device, true if a recording device. */ Uint8 padding1; Uint8 padding2; Uint8 padding3; @@ -780,8 +768,8 @@ typedef struct SDL_PenTouchEvent SDL_PenInputFlags pen_state; /**< Complete pen input state at time of event */ float x; /**< X position of pen on tablet */ float y; /**< Y position of pen on tablet */ - Uint8 eraser; /**< Non-zero if eraser end is used (not all pens support this). */ - Uint8 state; /**< SDL_PRESSED (pen is touching) or SDL_RELEASED (pen is lifted off) */ + bool eraser; /**< true if eraser end is used (not all pens support this). */ + bool down; /**< true if the pen is touching or false if the pen is lifted off */ } SDL_PenTouchEvent; /** @@ -803,7 +791,7 @@ typedef struct SDL_PenButtonEvent float x; /**< X position of pen on tablet */ float y; /**< Y position of pen on tablet */ Uint8 button; /**< The pen button index (first button is 1). */ - Uint8 state; /**< SDL_PRESSED or SDL_RELEASED */ + bool down; /**< true if the button is pressed */ } SDL_PenButtonEvent; /** @@ -1001,11 +989,17 @@ SDL_COMPILE_TIME_ASSERT(SDL_Event, sizeof(SDL_Event) == sizeof(((SDL_Event *)NUL extern SDL_DECLSPEC void SDLCALL SDL_PumpEvents(void); /* @{ */ + +/** + * The type of action to request from SDL_PeepEvents(). + * + * \since This enum is available since SDL 3.0.0. + */ typedef enum SDL_EventAction { - SDL_ADDEVENT, - SDL_PEEKEVENT, - SDL_GETEVENT + SDL_ADDEVENT, /**< Add events to the back of the queue. */ + SDL_PEEKEVENT, /**< Check but don't remove events from the queue front. */ + SDL_GETEVENT /**< Retrieve/remove events from the front of the queue. */ } SDL_EventAction; /** @@ -1058,14 +1052,14 @@ extern SDL_DECLSPEC int SDLCALL SDL_PeepEvents(SDL_Event *events, int numevents, * instead. * * \param type the type of event to be queried; see SDL_EventType for details. - * \returns SDL_TRUE if events matching `type` are present, or SDL_FALSE if - * events matching `type` are not present. + * \returns true if events matching `type` are present, or false if events + * matching `type` are not present. * * \since This function is available since SDL 3.0.0. * * \sa SDL_HasEvents */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_HasEvent(Uint32 type); +extern SDL_DECLSPEC bool SDLCALL SDL_HasEvent(Uint32 type); /** @@ -1077,14 +1071,14 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_HasEvent(Uint32 type); * SDL_EventType for details. * \param maxType the high end of event type to be queried, inclusive; see * SDL_EventType for details. - * \returns SDL_TRUE if events with type >= `minType` and <= `maxType` are - * present, or SDL_FALSE if not. + * \returns true if events with type >= `minType` and <= `maxType` are + * present, or false if not. * * \since This function is available since SDL 3.0.0. * * \sa SDL_HasEvents */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_HasEvents(Uint32 minType, Uint32 maxType); +extern SDL_DECLSPEC bool SDLCALL SDL_HasEvents(Uint32 minType, Uint32 maxType); /** * Clear events of a specific type from the event queue. @@ -1171,8 +1165,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_FlushEvents(Uint32 minType, Uint32 maxType) * * \param event the SDL_Event structure to be filled with the next event from * the queue, or NULL. - * \returns SDL_TRUE if this got an event or SDL_FALSE if there are none - * available. + * \returns true if this got an event or false if there are none available. * * \since This function is available since SDL 3.0.0. * @@ -1180,7 +1173,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_FlushEvents(Uint32 minType, Uint32 maxType) * \sa SDL_WaitEvent * \sa SDL_WaitEventTimeout */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_PollEvent(SDL_Event *event); +extern SDL_DECLSPEC bool SDLCALL SDL_PollEvent(SDL_Event *event); /** * Wait indefinitely for the next available event. @@ -1193,8 +1186,8 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_PollEvent(SDL_Event *event); * * \param event the SDL_Event structure to be filled in with the next event * from the queue, or NULL. - * \returns SDL_TRUE on success or SDL_FALSE if there was an error while - * waiting for events; call SDL_GetError() for more information. + * \returns true on success or false if there was an error while waiting for + * events; call SDL_GetError() for more information. * * \since This function is available since SDL 3.0.0. * @@ -1202,7 +1195,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_PollEvent(SDL_Event *event); * \sa SDL_PushEvent * \sa SDL_WaitEventTimeout */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_WaitEvent(SDL_Event *event); +extern SDL_DECLSPEC bool SDLCALL SDL_WaitEvent(SDL_Event *event); /** * Wait until the specified timeout (in milliseconds) for the next available @@ -1221,8 +1214,8 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_WaitEvent(SDL_Event *event); * from the queue, or NULL. * \param timeoutMS the maximum number of milliseconds to wait for the next * available event. - * \returns SDL_TRUE if this got an event or SDL_FALSE if the timeout elapsed - * without any events available. + * \returns true if this got an event or false if the timeout elapsed without + * any events available. * * \since This function is available since SDL 3.0.0. * @@ -1230,7 +1223,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_WaitEvent(SDL_Event *event); * \sa SDL_PushEvent * \sa SDL_WaitEvent */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_WaitEventTimeout(SDL_Event *event, Sint32 timeoutMS); +extern SDL_DECLSPEC bool SDLCALL SDL_WaitEventTimeout(SDL_Event *event, Sint32 timeoutMS); /** * Add an event to the event queue. @@ -1254,9 +1247,9 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_WaitEventTimeout(SDL_Event *event, Sint * its own custom event types. * * \param event the SDL_Event to be added to the queue. - * \returns SDL_TRUE on success, SDL_FALSE if the event was filtered or on - * failure; call SDL_GetError() for more information. A common reason - * for error is the event queue being full. + * \returns true on success, false if the event was filtered or on failure; + * call SDL_GetError() for more information. A common reason for + * error is the event queue being full. * * \since This function is available since SDL 3.0.0. * @@ -1264,7 +1257,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_WaitEventTimeout(SDL_Event *event, Sint * \sa SDL_PollEvent * \sa SDL_RegisterEvents */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_PushEvent(SDL_Event *event); +extern SDL_DECLSPEC bool SDLCALL SDL_PushEvent(SDL_Event *event); /** * A function pointer used for callbacks that watch the event queue. @@ -1272,9 +1265,9 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_PushEvent(SDL_Event *event); * \param userdata what was passed as `userdata` to SDL_SetEventFilter() or * SDL_AddEventWatch, etc. * \param event the event that triggered the callback. - * \returns SDL_TRUE to permit event to be added to the queue, and SDL_FALSE - * to disallow it. When used with SDL_AddEventWatch, the return value - * is ignored. + * \returns true to permit event to be added to the queue, and false to + * disallow it. When used with SDL_AddEventWatch, the return value is + * ignored. * * \threadsafety SDL may call this callback at any time from any thread; the * application is responsible for locking resources the callback @@ -1285,16 +1278,16 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_PushEvent(SDL_Event *event); * \sa SDL_SetEventFilter * \sa SDL_AddEventWatch */ -typedef SDL_bool (SDLCALL *SDL_EventFilter)(void *userdata, SDL_Event *event); +typedef bool (SDLCALL *SDL_EventFilter)(void *userdata, SDL_Event *event); /** * Set up a filter to process all events before they change internal state and * are posted to the internal event queue. * - * If the filter function returns SDL_TRUE when called, then the event will be - * added to the internal queue. If it returns SDL_FALSE, then the event will - * be dropped from the queue, but the internal state will still be updated. - * This allows selective filtering of dynamically arriving events. + * If the filter function returns true when called, then the event will be + * added to the internal queue. If it returns false, then the event will be + * dropped from the queue, but the internal state will still be updated. This + * allows selective filtering of dynamically arriving events. * * **WARNING**: Be very careful of what you do in the event filter function, * as it may run in a different thread! @@ -1344,13 +1337,13 @@ extern SDL_DECLSPEC void SDLCALL SDL_SetEventFilter(SDL_EventFilter filter, void * \param filter the current callback function will be stored here. * \param userdata the pointer that is passed to the current event filter will * be stored here. - * \returns SDL_TRUE on success or SDL_FALSE if there is no event filter set. + * \returns true on success or false if there is no event filter set. * * \since This function is available since SDL 3.0.0. * * \sa SDL_SetEventFilter */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetEventFilter(SDL_EventFilter *filter, void **userdata); +extern SDL_DECLSPEC bool SDLCALL SDL_GetEventFilter(SDL_EventFilter *filter, void **userdata); /** * Add a callback to be triggered when an event is added to the event queue. @@ -1372,8 +1365,8 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetEventFilter(SDL_EventFilter *filter, * * \param filter an SDL_EventFilter function to call when an event happens. * \param userdata a pointer that is passed to `filter`. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \threadsafety It is safe to call this function from any thread. * @@ -1382,7 +1375,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetEventFilter(SDL_EventFilter *filter, * \sa SDL_RemoveEventWatch * \sa SDL_SetEventFilter */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_AddEventWatch(SDL_EventFilter filter, void *userdata); +extern SDL_DECLSPEC bool SDLCALL SDL_AddEventWatch(SDL_EventFilter filter, void *userdata); /** * Remove an event watch callback added with SDL_AddEventWatch(). @@ -1401,7 +1394,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_RemoveEventWatch(SDL_EventFilter filter, vo /** * Run a specific filter function on the current event queue, removing any - * events for which the filter returns SDL_FALSE. + * events for which the filter returns false. * * See SDL_SetEventFilter() for more information. Unlike SDL_SetEventFilter(), * this function does not change the filter permanently, it only uses the @@ -1427,19 +1420,19 @@ extern SDL_DECLSPEC void SDLCALL SDL_FilterEvents(SDL_EventFilter filter, void * * * \sa SDL_EventEnabled */ -extern SDL_DECLSPEC void SDLCALL SDL_SetEventEnabled(Uint32 type, SDL_bool enabled); +extern SDL_DECLSPEC void SDLCALL SDL_SetEventEnabled(Uint32 type, bool enabled); /** * Query the state of processing events by type. * * \param type the type of event; see SDL_EventType for details. - * \returns SDL_TRUE if the event is being processed, SDL_FALSE otherwise. + * \returns true if the event is being processed, false otherwise. * * \since This function is available since SDL 3.0.0. * * \sa SDL_SetEventEnabled */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_EventEnabled(Uint32 type); +extern SDL_DECLSPEC bool SDLCALL SDL_EventEnabled(Uint32 type); /** * Allocate a set of user-defined events, and return the beginning event diff --git a/include/SDL3/SDL_filesystem.h b/include/SDL3/SDL_filesystem.h index 5faa244b..58d86efe 100644 --- a/include/SDL3/SDL_filesystem.h +++ b/include/SDL3/SDL_filesystem.h @@ -143,19 +143,19 @@ extern SDL_DECLSPEC char * SDLCALL SDL_GetPrefPath(const char *org, const char * * * The folders supported per platform are: * - * | | Windows | WinRT/UWP |macOS/iOS | tvOS | Unix (XDG) | Haiku | Emscripten | - * | ----------- | ------- | --------- |--------- | ---- | ---------- | ----- | ---------- | - * | HOME | X | X | X | | X | X | X | - * | DESKTOP | X | X | X | | X | X | | - * | DOCUMENTS | X | X | X | | X | | | - * | DOWNLOADS | Vista+ | X | X | | X | | | - * | MUSIC | X | X | X | | X | | | - * | PICTURES | X | X | X | | X | | | - * | PUBLICSHARE | | | X | | X | | | - * | SAVEDGAMES | Vista+ | | | | | | | - * | SCREENSHOTS | Vista+ | X | | | | | | - * | TEMPLATES | X | X | X | | X | | | - * | VIDEOS | X | X | X* | | X | | | + * | | Windows | macOS/iOS | tvOS | Unix (XDG) | Haiku | Emscripten | + * | ----------- | ------- | --------- | ---- | ---------- | ----- | ---------- | + * | HOME | X | X | | X | X | X | + * | DESKTOP | X | X | | X | X | | + * | DOCUMENTS | X | X | | X | | | + * | DOWNLOADS | Vista+ | X | | X | | | + * | MUSIC | X | X | | X | | | + * | PICTURES | X | X | | X | | | + * | PUBLICSHARE | | X | | X | | | + * | SAVEDGAMES | Vista+ | | | | | | + * | SCREENSHOTS | Vista+ | | | | | | + * | TEMPLATES | X | X | | X | | | + * | VIDEOS | X | X* | | X | | | * * Note that on macOS/iOS, the Videos folder is called "Movies". * @@ -165,44 +165,30 @@ extern SDL_DECLSPEC char * SDLCALL SDL_GetPrefPath(const char *org, const char * */ typedef enum SDL_Folder { - /** The folder which contains all of the current user's data, preferences, - and documents. It usually contains most of the other folders. If a - requested folder does not exist, the home folder can be considered a safe - fallback to store a user's documents. */ - SDL_FOLDER_HOME, - /** The folder of files that are displayed on the desktop. Note that the - existence of a desktop folder does not guarantee that the system does - show icons on its desktop; certain GNU/Linux distros with a graphical - environment may not have desktop icons. */ - SDL_FOLDER_DESKTOP, - /** User document files, possibly application-specific. This is a good - place to save a user's projects. */ - SDL_FOLDER_DOCUMENTS, - /** Standard folder for user files downloaded from the internet. */ - SDL_FOLDER_DOWNLOADS, - /** Music files that can be played using a standard music player (mp3, - ogg...). */ - SDL_FOLDER_MUSIC, - /** Image files that can be displayed using a standard viewer (png, - jpg...). */ - SDL_FOLDER_PICTURES, - /** Files that are meant to be shared with other users on the same - computer. */ - SDL_FOLDER_PUBLICSHARE, - /** Save files for games. */ - SDL_FOLDER_SAVEDGAMES, - /** Application screenshots. */ - SDL_FOLDER_SCREENSHOTS, - /** Template files to be used when the user requests the desktop environment - to create a new file in a certain folder, such as "New Text File.txt". - Any file in the Templates folder can be used as a starting point for a - new file. */ - SDL_FOLDER_TEMPLATES, - /** Video files that can be played using a standard video player (mp4, - webm...). */ - SDL_FOLDER_VIDEOS, - /** total number of types in this enum, not a folder type by itself. */ - SDL_FOLDER_TOTAL + SDL_FOLDER_HOME, /**< The folder which contains all of the current user's data, preferences, and documents. It usually contains most of the other folders. If a requested folder does not exist, the home folder can be considered a safe fallback to store a user's documents. */ + + SDL_FOLDER_DESKTOP, /**< The folder of files that are displayed on the desktop. Note that the existence of a desktop folder does not guarantee that the system does show icons on its desktop; certain GNU/Linux distros with a graphical environment may not have desktop icons. */ + + SDL_FOLDER_DOCUMENTS, /**< User document files, possibly application-specific. This is a good place to save a user's projects. */ + + SDL_FOLDER_DOWNLOADS, /**< Standard folder for user files downloaded from the internet. */ + + SDL_FOLDER_MUSIC, /**< Music files that can be played using a standard music player (mp3, ogg...). */ + + SDL_FOLDER_PICTURES, /**< Image files that can be displayed using a standard viewer (png, jpg...). */ + + SDL_FOLDER_PUBLICSHARE, /**< Files that are meant to be shared with other users on the same computer. */ + + SDL_FOLDER_SAVEDGAMES, /**< Save files for games. */ + + SDL_FOLDER_SCREENSHOTS, /**< Application screenshots. */ + + SDL_FOLDER_TEMPLATES, /**< Template files to be used when the user requests the desktop environment to create a new file in a certain folder, such as "New Text File.txt". Any file in the Templates folder can be used as a starting point for a new file. */ + + SDL_FOLDER_VIDEOS, /**< Video files that can be played using a standard video player (mp4, webm...). */ + + SDL_FOLDER_COUNT /**< Total number of types in this enum, not a folder type by itself. */ + } SDL_Folder; /** @@ -243,11 +229,11 @@ typedef enum SDL_PathType typedef struct SDL_PathInfo { - SDL_PathType type; /* the path type */ - Uint64 size; /* the file size in bytes */ - SDL_Time create_time; /* the time when the path was created */ - SDL_Time modify_time; /* the last time the path was modified */ - SDL_Time access_time; /* the last time the path was read */ + SDL_PathType type; /**< the path type */ + Uint64 size; /**< the file size in bytes */ + SDL_Time create_time; /**< the time when the path was created */ + SDL_Time modify_time; /**< the last time the path was modified */ + SDL_Time access_time; /**< the last time the path was read */ } SDL_PathInfo; /** @@ -266,12 +252,12 @@ typedef Uint32 SDL_GlobFlags; * Create a directory. * * \param path the path of the directory to create. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_CreateDirectory(const char *path); +extern SDL_DECLSPEC bool SDLCALL SDL_CreateDirectory(const char *path); /* Callback for directory enumeration. Return 1 to keep enumerating, 0 to stop enumerating (no error), -1 to stop enumerating and @@ -289,47 +275,47 @@ typedef int (SDLCALL *SDL_EnumerateDirectoryCallback)(void *userdata, const char * \param path the path of the directory to enumerate. * \param callback a function that is called for each entry in the directory. * \param userdata a pointer that is passed to `callback`. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_EnumerateDirectory(const char *path, SDL_EnumerateDirectoryCallback callback, void *userdata); +extern SDL_DECLSPEC bool SDLCALL SDL_EnumerateDirectory(const char *path, SDL_EnumerateDirectoryCallback callback, void *userdata); /** * Remove a file or an empty directory. * * \param path the path of the directory to enumerate. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_RemovePath(const char *path); +extern SDL_DECLSPEC bool SDLCALL SDL_RemovePath(const char *path); /** * Rename a file or directory. * * \param oldpath the old path. * \param newpath the new path. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_RenamePath(const char *oldpath, const char *newpath); +extern SDL_DECLSPEC bool SDLCALL SDL_RenamePath(const char *oldpath, const char *newpath); /** * Copy a file. * * \param oldpath the old path. * \param newpath the new path. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_CopyFile(const char *oldpath, const char *newpath); +extern SDL_DECLSPEC bool SDLCALL SDL_CopyFile(const char *oldpath, const char *newpath); /** * Get information about a filesystem path. @@ -337,12 +323,12 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_CopyFile(const char *oldpath, const cha * \param path the path to query. * \param info a pointer filled in with information about the path, or NULL to * check for the existence of a file. - * \returns SDL_TRUE on success or SDL_FALSE if the file doesn't exist, or - * another failure; call SDL_GetError() for more information. + * \returns true on success or false if the file doesn't exist, or another + * failure; call SDL_GetError() for more information. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetPathInfo(const char *path, SDL_PathInfo *info); +extern SDL_DECLSPEC bool SDLCALL SDL_GetPathInfo(const char *path, SDL_PathInfo *info); /** * Enumerate a directory tree, filtered by pattern, and return a list. diff --git a/include/SDL3/SDL_gamepad.h b/include/SDL3/SDL_gamepad.h index 3d2d726d..a919097a 100644 --- a/include/SDL3/SDL_gamepad.h +++ b/include/SDL3/SDL_gamepad.h @@ -58,9 +58,11 @@ #include #include -#include -#include +#include #include +#include +#include +#include #include #include @@ -98,7 +100,7 @@ typedef enum SDL_GamepadType SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_JOYCON_LEFT, SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_JOYCON_RIGHT, SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_JOYCON_PAIR, - SDL_GAMEPAD_TYPE_MAX + SDL_GAMEPAD_TYPE_COUNT } SDL_GamepadType; /** @@ -153,7 +155,7 @@ typedef enum SDL_GamepadButton SDL_GAMEPAD_BUTTON_MISC4, /* Additional button */ SDL_GAMEPAD_BUTTON_MISC5, /* Additional button */ SDL_GAMEPAD_BUTTON_MISC6, /* Additional button */ - SDL_GAMEPAD_BUTTON_MAX + SDL_GAMEPAD_BUTTON_COUNT } SDL_GamepadButton; /** @@ -203,7 +205,7 @@ typedef enum SDL_GamepadAxis SDL_GAMEPAD_AXIS_RIGHTY, SDL_GAMEPAD_AXIS_LEFT_TRIGGER, SDL_GAMEPAD_AXIS_RIGHT_TRIGGER, - SDL_GAMEPAD_AXIS_MAX + SDL_GAMEPAD_AXIS_COUNT } SDL_GamepadAxis; /** @@ -330,8 +332,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_AddGamepadMapping(const char *mapping); * constrained environment. * * \param src the data stream for the mappings to be added. - * \param closeio if SDL_TRUE, calls SDL_CloseIO() on `src` before returning, - * even in the case of an error. + * \param closeio if true, calls SDL_CloseIO() on `src` before returning, even + * in the case of an error. * \returns the number of mappings added or -1 on failure; call SDL_GetError() * for more information. * @@ -344,7 +346,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_AddGamepadMapping(const char *mapping); * \sa SDL_GetGamepadMapping * \sa SDL_GetGamepadMappingForGUID */ -extern SDL_DECLSPEC int SDLCALL SDL_AddGamepadMappingsFromIO(SDL_IOStream *src, SDL_bool closeio); +extern SDL_DECLSPEC int SDLCALL SDL_AddGamepadMappingsFromIO(SDL_IOStream *src, bool closeio); /** * Load a set of gamepad mappings from a file. @@ -379,12 +381,12 @@ extern SDL_DECLSPEC int SDLCALL SDL_AddGamepadMappingsFromFile(const char *file) * * This will generate gamepad events as needed if device mappings change. * - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ReloadGamepadMappings(void); +extern SDL_DECLSPEC bool SDLCALL SDL_ReloadGamepadMappings(void); /** * Get the current gamepad mappings. @@ -442,26 +444,26 @@ extern SDL_DECLSPEC char * SDLCALL SDL_GetGamepadMapping(SDL_Gamepad *gamepad); * \param instance_id the joystick instance ID. * \param mapping the mapping to use for this device, or NULL to clear the * mapping. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_AddGamepadMapping * \sa SDL_GetGamepadMapping */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetGamepadMapping(SDL_JoystickID instance_id, const char *mapping); +extern SDL_DECLSPEC bool SDLCALL SDL_SetGamepadMapping(SDL_JoystickID instance_id, const char *mapping); /** * Return whether a gamepad is currently connected. * - * \returns SDL_TRUE if a gamepad is connected, SDL_FALSE otherwise. + * \returns true if a gamepad is connected, false otherwise. * * \since This function is available since SDL 3.0.0. * * \sa SDL_GetGamepads */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_HasGamepad(void); +extern SDL_DECLSPEC bool SDLCALL SDL_HasGamepad(void); /** * Get a list of currently connected gamepads. @@ -483,15 +485,15 @@ extern SDL_DECLSPEC SDL_JoystickID * SDLCALL SDL_GetGamepads(int *count); * Check if the given joystick is supported by the gamepad interface. * * \param instance_id the joystick instance ID. - * \returns SDL_TRUE if the given joystick is supported by the gamepad - * interface, SDL_FALSE if it isn't or it's an invalid index. + * \returns true if the given joystick is supported by the gamepad interface, + * false if it isn't or it's an invalid index. * * \since This function is available since SDL 3.0.0. * * \sa SDL_GetJoysticks * \sa SDL_OpenGamepad */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_IsGamepad(SDL_JoystickID instance_id); +extern SDL_DECLSPEC bool SDLCALL SDL_IsGamepad(SDL_JoystickID instance_id); /** * Get the implementation dependent name of a gamepad. @@ -813,14 +815,14 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetGamepadPlayerIndex(SDL_Gamepad *gamepad); * \param gamepad the gamepad object to adjust. * \param player_index player index to assign to this gamepad, or -1 to clear * the player index and turn off player LEDs. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_GetGamepadPlayerIndex */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetGamepadPlayerIndex(SDL_Gamepad *gamepad, int player_index); +extern SDL_DECLSPEC bool SDLCALL SDL_SetGamepadPlayerIndex(SDL_Gamepad *gamepad, int player_index); /** * Get the USB vendor ID of an opened gamepad, if available. @@ -938,12 +940,12 @@ extern SDL_DECLSPEC SDL_PowerState SDLCALL SDL_GetGamepadPowerInfo(SDL_Gamepad * * * \param gamepad a gamepad identifier previously returned by * SDL_OpenGamepad(). - * \returns SDL_TRUE if the gamepad has been opened and is currently - * connected, or SDL_FALSE if not. + * \returns true if the gamepad has been opened and is currently connected, or + * false if not. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GamepadConnected(SDL_Gamepad *gamepad); +extern SDL_DECLSPEC bool SDLCALL SDL_GamepadConnected(SDL_Gamepad *gamepad); /** * Get the underlying joystick from a gamepad. @@ -978,7 +980,7 @@ extern SDL_DECLSPEC SDL_Joystick * SDLCALL SDL_GetGamepadJoystick(SDL_Gamepad *g * \sa SDL_GamepadEventsEnabled * \sa SDL_UpdateGamepads */ -extern SDL_DECLSPEC void SDLCALL SDL_SetGamepadEventsEnabled(SDL_bool enabled); +extern SDL_DECLSPEC void SDLCALL SDL_SetGamepadEventsEnabled(bool enabled); /** * Query the state of gamepad event processing. @@ -986,14 +988,13 @@ extern SDL_DECLSPEC void SDLCALL SDL_SetGamepadEventsEnabled(SDL_bool enabled); * If gamepad events are disabled, you must call SDL_UpdateGamepads() yourself * and check the state of the gamepad when you want gamepad information. * - * \returns SDL_TRUE if gamepad events are being processed, SDL_FALSE - * otherwise. + * \returns true if gamepad events are being processed, false otherwise. * * \since This function is available since SDL 3.0.0. * * \sa SDL_SetGamepadEventsEnabled */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GamepadEventsEnabled(void); +extern SDL_DECLSPEC bool SDLCALL SDL_GamepadEventsEnabled(void); /** * Get the SDL joystick layer bindings for a gamepad. @@ -1096,14 +1097,14 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetGamepadStringForAxis(SDL_Gamepad * * \param gamepad a gamepad. * \param axis an axis enum value (an SDL_GamepadAxis value). - * \returns SDL_TRUE if the gamepad has this axis, SDL_FALSE otherwise. + * \returns true if the gamepad has this axis, false otherwise. * * \since This function is available since SDL 3.0.0. * * \sa SDL_GamepadHasButton * \sa SDL_GetGamepadAxis */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GamepadHasAxis(SDL_Gamepad *gamepad, SDL_GamepadAxis axis); +extern SDL_DECLSPEC bool SDLCALL SDL_GamepadHasAxis(SDL_Gamepad *gamepad, SDL_GamepadAxis axis); /** * Get the current state of an axis control on a gamepad. @@ -1169,28 +1170,27 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetGamepadStringForButton(SDL_Gamep * * \param gamepad a gamepad. * \param button a button enum value (an SDL_GamepadButton value). - * \returns SDL_TRUE if the gamepad has this button, SDL_FALSE otherwise. + * \returns true if the gamepad has this button, false otherwise. * * \since This function is available since SDL 3.0.0. * * \sa SDL_GamepadHasAxis */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GamepadHasButton(SDL_Gamepad *gamepad, SDL_GamepadButton button); +extern SDL_DECLSPEC bool SDLCALL SDL_GamepadHasButton(SDL_Gamepad *gamepad, SDL_GamepadButton button); /** * Get the current state of a button on a gamepad. * * \param gamepad a gamepad. * \param button a button index (one of the SDL_GamepadButton values). - * \returns 1 for pressed state or 0 for not pressed state or failure; call - * SDL_GetError() for more information. + * \returns true if the button is pressed, false otherwise. * * \since This function is available since SDL 3.0.0. * * \sa SDL_GamepadHasButton * \sa SDL_GetGamepadAxis */ -extern SDL_DECLSPEC Uint8 SDLCALL SDL_GetGamepadButton(SDL_Gamepad *gamepad, SDL_GamepadButton button); +extern SDL_DECLSPEC bool SDLCALL SDL_GetGamepadButton(SDL_Gamepad *gamepad, SDL_GamepadButton button); /** * Get the label of a button on a gamepad. @@ -1251,27 +1251,28 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetNumGamepadTouchpadFingers(SDL_Gamepad *ga * \param gamepad a gamepad. * \param touchpad a touchpad. * \param finger a finger. - * \param state filled with state. - * \param x filled with x position, normalized 0 to 1, with the origin in the - * upper left. - * \param y filled with y position, normalized 0 to 1, with the origin in the - * upper left. - * \param pressure filled with pressure value. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \param down a pointer filled with true if the finger is down, false + * otherwise, may be NULL. + * \param x a pointer filled with the x position, normalized 0 to 1, with the + * origin in the upper left, may be NULL. + * \param y a pointer filled with the y position, normalized 0 to 1, with the + * origin in the upper left, may be NULL. + * \param pressure a pointer filled with pressure value, may be NULL. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_GetNumGamepadTouchpadFingers */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetGamepadTouchpadFinger(SDL_Gamepad *gamepad, int touchpad, int finger, Uint8 *state, float *x, float *y, float *pressure); +extern SDL_DECLSPEC bool SDLCALL SDL_GetGamepadTouchpadFinger(SDL_Gamepad *gamepad, int touchpad, int finger, bool *down, float *x, float *y, float *pressure); /** * Return whether a gamepad has a particular sensor. * * \param gamepad the gamepad to query. * \param type the type of sensor to query. - * \returns SDL_TRUE if the sensor exists, SDL_FALSE otherwise. + * \returns true if the sensor exists, false otherwise. * * \since This function is available since SDL 3.0.0. * @@ -1279,7 +1280,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetGamepadTouchpadFinger(SDL_Gamepad *g * \sa SDL_GetGamepadSensorDataRate * \sa SDL_SetGamepadSensorEnabled */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GamepadHasSensor(SDL_Gamepad *gamepad, SDL_SensorType type); +extern SDL_DECLSPEC bool SDLCALL SDL_GamepadHasSensor(SDL_Gamepad *gamepad, SDL_SensorType type); /** * Set whether data reporting for a gamepad sensor is enabled. @@ -1287,28 +1288,28 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GamepadHasSensor(SDL_Gamepad *gamepad, * \param gamepad the gamepad to update. * \param type the type of sensor to enable/disable. * \param enabled whether data reporting should be enabled. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_GamepadHasSensor * \sa SDL_GamepadSensorEnabled */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetGamepadSensorEnabled(SDL_Gamepad *gamepad, SDL_SensorType type, SDL_bool enabled); +extern SDL_DECLSPEC bool SDLCALL SDL_SetGamepadSensorEnabled(SDL_Gamepad *gamepad, SDL_SensorType type, bool enabled); /** * Query whether sensor data reporting is enabled for a gamepad. * * \param gamepad the gamepad to query. * \param type the type of sensor to query. - * \returns SDL_TRUE if the sensor is enabled, SDL_FALSE otherwise. + * \returns true if the sensor is enabled, false otherwise. * * \since This function is available since SDL 3.0.0. * * \sa SDL_SetGamepadSensorEnabled */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GamepadSensorEnabled(SDL_Gamepad *gamepad, SDL_SensorType type); +extern SDL_DECLSPEC bool SDLCALL SDL_GamepadSensorEnabled(SDL_Gamepad *gamepad, SDL_SensorType type); /** * Get the data rate (number of events per second) of a gamepad sensor. @@ -1331,12 +1332,12 @@ extern SDL_DECLSPEC float SDLCALL SDL_GetGamepadSensorDataRate(SDL_Gamepad *game * \param type the type of sensor to query. * \param data a pointer filled with the current sensor state. * \param num_values the number of values to write to data. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetGamepadSensorData(SDL_Gamepad *gamepad, SDL_SensorType type, float *data, int num_values); +extern SDL_DECLSPEC bool SDLCALL SDL_GetGamepadSensorData(SDL_Gamepad *gamepad, SDL_SensorType type, float *data, int num_values); /** * Start a rumble effect on a gamepad. @@ -1353,12 +1354,12 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetGamepadSensorData(SDL_Gamepad *gamep * \param high_frequency_rumble the intensity of the high frequency (right) * rumble motor, from 0 to 0xFFFF. * \param duration_ms the duration of the rumble effect, in milliseconds. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_RumbleGamepad(SDL_Gamepad *gamepad, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms); +extern SDL_DECLSPEC bool SDLCALL SDL_RumbleGamepad(SDL_Gamepad *gamepad, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms); /** * Start a rumble effect in the gamepad's triggers. @@ -1379,14 +1380,14 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_RumbleGamepad(SDL_Gamepad *gamepad, Uin * \param right_rumble the intensity of the right trigger rumble motor, from 0 * to 0xFFFF. * \param duration_ms the duration of the rumble effect, in milliseconds. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_RumbleGamepad */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_RumbleGamepadTriggers(SDL_Gamepad *gamepad, Uint16 left_rumble, Uint16 right_rumble, Uint32 duration_ms); +extern SDL_DECLSPEC bool SDLCALL SDL_RumbleGamepadTriggers(SDL_Gamepad *gamepad, Uint16 left_rumble, Uint16 right_rumble, Uint32 duration_ms); /** * Update a gamepad's LED color. @@ -1401,12 +1402,12 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_RumbleGamepadTriggers(SDL_Gamepad *game * \param red the intensity of the red LED. * \param green the intensity of the green LED. * \param blue the intensity of the blue LED. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetGamepadLED(SDL_Gamepad *gamepad, Uint8 red, Uint8 green, Uint8 blue); +extern SDL_DECLSPEC bool SDLCALL SDL_SetGamepadLED(SDL_Gamepad *gamepad, Uint8 red, Uint8 green, Uint8 blue); /** * Send a gamepad specific effect packet. @@ -1414,12 +1415,12 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetGamepadLED(SDL_Gamepad *gamepad, Uin * \param gamepad the gamepad to affect. * \param data the data to send to the gamepad. * \param size the size of the data to send to the gamepad. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SendGamepadEffect(SDL_Gamepad *gamepad, const void *data, int size); +extern SDL_DECLSPEC bool SDLCALL SDL_SendGamepadEffect(SDL_Gamepad *gamepad, const void *data, int size); /** * Close a gamepad previously opened with SDL_OpenGamepad(). diff --git a/include/SDL3/SDL_gpu.h b/include/SDL3/SDL_gpu.h index 7033ee11..ad496855 100644 --- a/include/SDL3/SDL_gpu.h +++ b/include/SDL3/SDL_gpu.h @@ -44,119 +44,349 @@ extern "C" { /* Type Declarations */ +/** + * An opaque handle representing the SDL_GPU context. + * + * \since This struct is available since SDL 3.0.0 + */ typedef struct SDL_GPUDevice SDL_GPUDevice; + +/** + * An opaque handle representing a buffer. + * + * Used for vertices, indices, indirect draw commands, and general compute + * data. + * + * \since This struct is available since SDL 3.0.0 + * + * \sa SDL_CreateGPUBuffer + * \sa SDL_SetGPUBufferName + * \sa SDL_UploadToGPUBuffer + * \sa SDL_DownloadFromGPUBuffer + * \sa SDL_CopyGPUBufferToBuffer + * \sa SDL_BindGPUVertexBuffers + * \sa SDL_BindGPUIndexBuffer + * \sa SDL_BindGPUVertexStorageBuffers + * \sa SDL_BindGPUFragmentStorageBuffers + * \sa SDL_DrawGPUPrimitivesIndirect + * \sa SDL_DrawGPUIndexedPrimitivesIndirect + * \sa SDL_BindGPUComputeStorageBuffers + * \sa SDL_DispatchGPUComputeIndirect + * \sa SDL_ReleaseGPUBuffer + */ typedef struct SDL_GPUBuffer SDL_GPUBuffer; + +/** + * An opaque handle representing a transfer buffer. + * + * Used for transferring data to and from the device. + * + * \since This struct is available since SDL 3.0.0 + * + * \sa SDL_CreateGPUTransferBuffer + * \sa SDL_MapGPUTransferBuffer + * \sa SDL_UnmapGPUTransferBuffer + * \sa SDL_UploadToGPUBuffer + * \sa SDL_UploadToGPUTexture + * \sa SDL_DownloadFromGPUBuffer + * \sa SDL_DownloadFromGPUTexture + * \sa SDL_ReleaseGPUTransferBuffer + */ typedef struct SDL_GPUTransferBuffer SDL_GPUTransferBuffer; + +/** + * An opaque handle representing a texture. + * + * \since This struct is available since SDL 3.0.0 + * + * \sa SDL_CreateGPUTexture + * \sa SDL_SetGPUTextureName + * \sa SDL_UploadToGPUTexture + * \sa SDL_DownloadFromGPUTexture + * \sa SDL_CopyGPUTextureToTexture + * \sa SDL_BindGPUVertexSamplers + * \sa SDL_BindGPUVertexStorageTextures + * \sa SDL_BindGPUFragmentSamplers + * \sa SDL_BindGPUFragmentStorageTextures + * \sa SDL_BindGPUComputeStorageTextures + * \sa SDL_GenerateMipmapsForGPUTexture + * \sa SDL_BlitGPUTexture + * \sa SDL_ReleaseGPUTexture + */ typedef struct SDL_GPUTexture SDL_GPUTexture; + +/** + * An opaque handle representing a sampler. + * + * \since This struct is available since SDL 3.0.0 + * + * \sa SDL_CreateGPUSampler + * \sa SDL_BindGPUVertexSamplers + * \sa SDL_BindGPUFragmentSamplers + * \sa SDL_ReleaseGPUSampler + */ typedef struct SDL_GPUSampler SDL_GPUSampler; + +/** + * An opaque handle representing a compiled shader object. + * + * \since This struct is available since SDL 3.0.0 + * + * \sa SDL_CreateGPUShader + * \sa SDL_CreateGPUGraphicsPipeline + * \sa SDL_ReleaseGPUShader + */ typedef struct SDL_GPUShader SDL_GPUShader; + +/** + * An opaque handle representing a compute pipeline. + * + * Used during compute passes. + * + * \since This struct is available since SDL 3.0.0 + * + * \sa SDL_CreateGPUComputePipeline + * \sa SDL_BindGPUComputePipeline + * \sa SDL_ReleaseGPUComputePipeline + */ typedef struct SDL_GPUComputePipeline SDL_GPUComputePipeline; + +/** + * An opaque handle representing a graphics pipeline. + * + * Used during render passes. + * + * \since This struct is available since SDL 3.0.0 + * + * \sa SDL_CreateGPUGraphicsPipeline + * \sa SDL_BindGPUGraphicsPipeline + * \sa SDL_ReleaseGPUGraphicsPipeline + */ typedef struct SDL_GPUGraphicsPipeline SDL_GPUGraphicsPipeline; + +/** + * An opaque handle representing a command buffer. + * + * Most state is managed via command buffers. When setting state using a + * command buffer, that state is local to the command buffer. + * + * Commands only begin execution on the GPU once SDL_SubmitGPUCommandBuffer is + * called. Once the command buffer is submitted, it is no longer valid to use + * it. + * + * Command buffers are executed in submission order. If you submit command + * buffer A and then command buffer B all commands in A will begin executing + * before any command in B begins executing. + * + * In multi-threading scenarios, you should acquire and submit a command + * buffer on the same thread. As long as you satisfy this requirement, all + * functionality related to command buffers is thread-safe. + * + * \since This struct is available since SDL 3.0.0 + * + * \sa SDL_AcquireGPUCommandBuffer + * \sa SDL_SubmitGPUCommandBuffer + * \sa SDL_SubmitGPUCommandBufferAndAcquireFence + */ typedef struct SDL_GPUCommandBuffer SDL_GPUCommandBuffer; + +/** + * An opaque handle representing a render pass. + * + * This handle is transient and should not be held or referenced after + * SDL_EndGPURenderPass is called. + * + * \since This struct is available since SDL 3.0.0 + * + * \sa SDL_BeginGPURenderPass + * \sa SDL_EndGPURenderPass + */ typedef struct SDL_GPURenderPass SDL_GPURenderPass; + +/** + * An opaque handle representing a compute pass. + * + * This handle is transient and should not be held or referenced after + * SDL_EndGPUComputePass is called. + * + * \since This struct is available since SDL 3.0.0 + * + * \sa SDL_BeginGPUComputePass + * \sa SDL_EndGPUComputePass + */ typedef struct SDL_GPUComputePass SDL_GPUComputePass; + +/** + * An opaque handle representing a copy pass. + * + * This handle is transient and should not be held or referenced after + * SDL_EndGPUCopyPass is called. + * + * \since This struct is available since SDL 3.0.0 + * + * \sa SDL_BeginGPUCopyPass + * \sa SDL_EndGPUCopyPass + */ typedef struct SDL_GPUCopyPass SDL_GPUCopyPass; + +/** + * An opaque handle representing a fence. + * + * \since This struct is available since SDL 3.0.0 + * + * \sa SDL_SubmitGPUCommandBufferAndAcquireFence + * \sa SDL_QueryGPUFence + * \sa SDL_WaitForGPUFences + * \sa SDL_ReleaseGPUFence + */ typedef struct SDL_GPUFence SDL_GPUFence; +/** + * Specifies the primitive topology of a graphics pipeline. + * + * \since This enum is available since SDL 3.0.0 + * + * \sa SDL_CreateGPUGraphicsPipeline + */ typedef enum SDL_GPUPrimitiveType { - SDL_GPU_PRIMITIVETYPE_POINTLIST, - SDL_GPU_PRIMITIVETYPE_LINELIST, - SDL_GPU_PRIMITIVETYPE_LINESTRIP, - SDL_GPU_PRIMITIVETYPE_TRIANGLELIST, - SDL_GPU_PRIMITIVETYPE_TRIANGLESTRIP + SDL_GPU_PRIMITIVETYPE_TRIANGLELIST, /**< A series of separate triangles. */ + SDL_GPU_PRIMITIVETYPE_TRIANGLESTRIP, /**< A series of connected triangles. */ + SDL_GPU_PRIMITIVETYPE_LINELIST, /**< A series of separate lines. */ + SDL_GPU_PRIMITIVETYPE_LINESTRIP, /**< A series of connected lines. */ + SDL_GPU_PRIMITIVETYPE_POINTLIST /**< A series of separate points. */ } SDL_GPUPrimitiveType; +/** + * Specifies how the contents of a texture attached to a render pass are + * treated at the beginning of the render pass. + * + * \since This enum is available since SDL 3.0.0 + * + * \sa SDL_BeginGPURenderPass + */ typedef enum SDL_GPULoadOp { - SDL_GPU_LOADOP_LOAD, - SDL_GPU_LOADOP_CLEAR, - SDL_GPU_LOADOP_DONT_CARE + SDL_GPU_LOADOP_LOAD, /**< The previous contents of the texture will be preserved. */ + SDL_GPU_LOADOP_CLEAR, /**< The contents of the texture will be cleared to a color. */ + SDL_GPU_LOADOP_DONT_CARE /**< The previous contents of the texture need not be preserved. The contents will be undefined. */ } SDL_GPULoadOp; +/** + * Specifies how the contents of a texture attached to a render pass are + * treated at the end of the render pass. + * + * \since This enum is available since SDL 3.0.0 + * + * \sa SDL_BeginGPURenderPass + */ typedef enum SDL_GPUStoreOp { - SDL_GPU_STOREOP_STORE, - SDL_GPU_STOREOP_DONT_CARE + SDL_GPU_STOREOP_STORE, /**< The contents generated during the render pass will be written to memory. */ + SDL_GPU_STOREOP_DONT_CARE, /**< The contents generated during the render pass are not needed and may be discarded. The contents will be undefined. */ + SDL_GPU_STOREOP_RESOLVE, /**< The multisample contents generated during the render pass will be resolved to a non-multisample texture. The contents in the multisample texture may then be discarded and will be undefined. */ + SDL_GPU_STOREOP_RESOLVE_AND_STORE /**< The multisample contents generated during the render pass will be resolved to a non-multisample texture. The contents in the multisample texture will be written to memory. */ } SDL_GPUStoreOp; +/** + * Specifies the size of elements in an index buffer. + * + * \since This enum is available since SDL 3.0.0 + * + * \sa SDL_CreateGPUGraphicsPipeline + */ typedef enum SDL_GPUIndexElementSize { - SDL_GPU_INDEXELEMENTSIZE_16BIT, - SDL_GPU_INDEXELEMENTSIZE_32BIT + SDL_GPU_INDEXELEMENTSIZE_16BIT, /**< The index elements are 16-bit. */ + SDL_GPU_INDEXELEMENTSIZE_32BIT /**< The index elements are 32-bit. */ } SDL_GPUIndexElementSize; -/* Texture format support varies depending on driver, hardware, and usage flags. - * In general, you should use SDL_GPUTextureSupportsFormat to query if a format - * is supported before using it. However, there are a few guaranteed formats. +/** + * Specifies the pixel format of a texture. + * + * Texture format support varies depending on driver, hardware, and usage + * flags. In general, you should use SDL_GPUTextureSupportsFormat to query if + * a format is supported before using it. However, there are a few guaranteed + * formats. * * For SAMPLER usage, the following formats are universally supported: - * - R8G8B8A8_UNORM - * - B8G8R8A8_UNORM - * - R8_UNORM - * - R8_SNORM - * - R8G8_UNORM - * - R8G8_SNORM - * - R8G8B8A8_SNORM - * - R16_FLOAT - * - R16G16_FLOAT - * - R16G16B16A16_FLOAT - * - R32_FLOAT - * - R32G32_FLOAT - * - R32G32B32A32_FLOAT - * - R11G11B10_UFLOAT - * - R8G8B8A8_UNORM_SRGB - * - B8G8R8A8_UNORM_SRGB - * - D16_UNORM + * + * - R8G8B8A8_UNORM + * - B8G8R8A8_UNORM + * - R8_UNORM + * - R8_SNORM + * - R8G8_UNORM + * - R8G8_SNORM + * - R8G8B8A8_SNORM + * - R16_FLOAT + * - R16G16_FLOAT + * - R16G16B16A16_FLOAT + * - R32_FLOAT + * - R32G32_FLOAT + * - R32G32B32A32_FLOAT + * - R11G11B10_UFLOAT + * - R8G8B8A8_UNORM_SRGB + * - B8G8R8A8_UNORM_SRGB + * - D16_UNORM * * For COLOR_TARGET usage, the following formats are universally supported: - * - R8G8B8A8_UNORM - * - B8G8R8A8_UNORM - * - R8_UNORM - * - R16_FLOAT - * - R16G16_FLOAT - * - R16G16B16A16_FLOAT - * - R32_FLOAT - * - R32G32_FLOAT - * - R32G32B32A32_FLOAT - * - R8_UINT - * - R8G8_UINT - * - R8G8B8A8_UINT - * - R16_UINT - * - R16G16_UINT - * - R16G16B16A16_UINT - * - R8_INT - * - R8G8_INT - * - R8G8B8A8_INT - * - R16_INT - * - R16G16_INT - * - R16G16B16A16_INT - * - R8G8B8A8_UNORM_SRGB - * - B8G8R8A8_UNORM_SRGB + * + * - R8G8B8A8_UNORM + * - B8G8R8A8_UNORM + * - R8_UNORM + * - R16_FLOAT + * - R16G16_FLOAT + * - R16G16B16A16_FLOAT + * - R32_FLOAT + * - R32G32_FLOAT + * - R32G32B32A32_FLOAT + * - R8_UINT + * - R8G8_UINT + * - R8G8B8A8_UINT + * - R16_UINT + * - R16G16_UINT + * - R16G16B16A16_UINT + * - R8_INT + * - R8G8_INT + * - R8G8B8A8_INT + * - R16_INT + * - R16G16_INT + * - R16G16B16A16_INT + * - R8G8B8A8_UNORM_SRGB + * - B8G8R8A8_UNORM_SRGB * * For STORAGE usages, the following formats are universally supported: - * - R8G8B8A8_UNORM - * - R8G8B8A8_SNORM - * - R16G16B16A16_FLOAT - * - R32_FLOAT - * - R32G32_FLOAT - * - R32G32B32A32_FLOAT - * - R8G8B8A8_UINT - * - R16G16B16A16_UINT - * - R8G8B8A8_INT - * - R16G16B16A16_INT * - * For DEPTH_STENCIL_TARGET usage, the following formats are universally supported: - * - D16_UNORM - * - Either (but not necessarily both!) D24_UNORM or D32_SFLOAT - * - Either (but not necessarily both!) D24_UNORM_S8_UINT or D32_SFLOAT_S8_UINT + * - R8G8B8A8_UNORM + * - R8G8B8A8_SNORM + * - R16G16B16A16_FLOAT + * - R32_FLOAT + * - R32G32_FLOAT + * - R32G32B32A32_FLOAT + * - R8G8B8A8_UINT + * - R16G16B16A16_UINT + * - R8G8B8A8_INT + * - R16G16B16A16_INT * - * Unless D16_UNORM is sufficient for your purposes, always check which - * of D24/D32 is supported before creating a depth-stencil texture! + * For DEPTH_STENCIL_TARGET usage, the following formats are universally + * supported: + * + * - D16_UNORM + * - Either (but not necessarily both!) D24_UNORM or D32_SFLOAT + * - Either (but not necessarily both!) D24_UNORM_S8_UINT or + * D32_SFLOAT_S8_UINT + * + * Unless D16_UNORM is sufficient for your purposes, always check which of + * D24/D32 is supported before creating a depth-stencil texture! + * + * \since This enum is available since SDL 3.0.0 + * + * \sa SDL_CreateGPUTexture + * \sa SDL_GPUTextureSupportsFormat */ typedef enum SDL_GPUTextureFormat { - SDL_GPU_TEXTUREFORMAT_INVALID = -1, + SDL_GPU_TEXTUREFORMAT_INVALID, /* Unsigned Normalized Float Color Formats */ SDL_GPU_TEXTUREFORMAT_A8_UNORM, @@ -228,31 +458,68 @@ typedef enum SDL_GPUTextureFormat SDL_GPU_TEXTUREFORMAT_D32_FLOAT_S8_UINT } SDL_GPUTextureFormat; +/** + * Specifies how a texture is intended to be used by the client. + * + * A texture must have at least one usage flag. Note that some usage flag + * combinations are invalid. + * + * \since This enum is available since SDL 3.0.0 + * + * \sa SDL_CreateGPUTexture + */ typedef Uint32 SDL_GPUTextureUsageFlags; -#define SDL_GPU_TEXTUREUSAGE_SAMPLER (1u << 0) /**< texture supports sampling */ -#define SDL_GPU_TEXTUREUSAGE_COLOR_TARGET (1u << 1) /**< texture is a color render target */ -#define SDL_GPU_TEXTUREUSAGE_DEPTH_STENCIL_TARGET (1u << 2) /**< texture is a depth stencil target */ -#define SDL_GPU_TEXTUREUSAGE_GRAPHICS_STORAGE_READ (1u << 3) /**< texture supports storage reads in graphics stages */ -#define SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_READ (1u << 4) /**< texture supports storage reads in the compute stage */ -#define SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_WRITE (1u << 5) /**< texture supports storage writes in the compute stage */ +#define SDL_GPU_TEXTUREUSAGE_SAMPLER (1u << 0) /**< Texture supports sampling. */ +#define SDL_GPU_TEXTUREUSAGE_COLOR_TARGET (1u << 1) /**< Texture is a color render target. */ +#define SDL_GPU_TEXTUREUSAGE_DEPTH_STENCIL_TARGET (1u << 2) /**< Texture is a depth stencil target. */ +#define SDL_GPU_TEXTUREUSAGE_GRAPHICS_STORAGE_READ (1u << 3) /**< Texture supports storage reads in graphics stages. */ +#define SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_READ (1u << 4) /**< Texture supports storage reads in the compute stage. */ +#define SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_WRITE (1u << 5) /**< Texture supports storage writes in the compute stage. */ +/** + * Specifies the type of a texture. + * + * \since This enum is available since SDL 3.0.0 + * + * \sa SDL_CreateGPUTexture + */ typedef enum SDL_GPUTextureType { - SDL_GPU_TEXTURETYPE_2D, - SDL_GPU_TEXTURETYPE_2D_ARRAY, - SDL_GPU_TEXTURETYPE_3D, - SDL_GPU_TEXTURETYPE_CUBE + SDL_GPU_TEXTURETYPE_2D, /**< The texture is a 2-dimensional image. */ + SDL_GPU_TEXTURETYPE_2D_ARRAY, /**< The texture is a 2-dimensional array image. */ + SDL_GPU_TEXTURETYPE_3D, /**< The texture is a 3-dimensional image. */ + SDL_GPU_TEXTURETYPE_CUBE, /**< The texture is a cube image. */ + SDL_GPU_TEXTURETYPE_CUBE_ARRAY /**< The texture is a cube array image. */ } SDL_GPUTextureType; +/** + * Specifies the sample count of a texture. + * + * Used in multisampling. Note that this value only applies when the texture + * is used as a render target. + * + * \since This enum is available since SDL 3.0.0 + * + * \sa SDL_CreateGPUTexture + * \sa SDL_GPUTextureSupportsSampleCount + */ typedef enum SDL_GPUSampleCount { - SDL_GPU_SAMPLECOUNT_1, - SDL_GPU_SAMPLECOUNT_2, - SDL_GPU_SAMPLECOUNT_4, - SDL_GPU_SAMPLECOUNT_8 + SDL_GPU_SAMPLECOUNT_1, /**< No multisampling. */ + SDL_GPU_SAMPLECOUNT_2, /**< MSAA 2x */ + SDL_GPU_SAMPLECOUNT_4, /**< MSAA 4x */ + SDL_GPU_SAMPLECOUNT_8 /**< MSAA 8x */ } SDL_GPUSampleCount; + +/** + * Specifies the face of a cube map. + * + * Can be passed in as the layer field in texture-related structs. + * + * \since This enum is available since SDL 3.0.0 + */ typedef enum SDL_GPUCubeMapFace { SDL_GPU_CUBEMAPFACE_POSITIVEX, @@ -263,38 +530,84 @@ typedef enum SDL_GPUCubeMapFace SDL_GPU_CUBEMAPFACE_NEGATIVEZ } SDL_GPUCubeMapFace; +/** + * Specifies how a buffer is intended to be used by the client. + * + * A buffer must have at least one usage flag. Note that some usage flag + * combinations are invalid. + * + * \since This enum is available since SDL 3.0.0 + * + * \sa SDL_CreateGPUBuffer + */ typedef Uint32 SDL_GPUBufferUsageFlags; -#define SDL_GPU_BUFFERUSAGE_VERTEX (1u << 0) /**< buffer is a vertex buffer */ -#define SDL_GPU_BUFFERUSAGE_INDEX (1u << 1) /**< buffer is an index buffer */ -#define SDL_GPU_BUFFERUSAGE_INDIRECT (1u << 2) /**< buffer is an indirect buffer */ -#define SDL_GPU_BUFFERUSAGE_GRAPHICS_STORAGE_READ (1u << 3) /**< buffer supports storage reads in graphics stages */ -#define SDL_GPU_BUFFERUSAGE_COMPUTE_STORAGE_READ (1u << 4) /**< buffer supports storage reads in the compute stage */ -#define SDL_GPU_BUFFERUSAGE_COMPUTE_STORAGE_WRITE (1u << 5) /**< buffer supports storage writes in the compute stage */ +#define SDL_GPU_BUFFERUSAGE_VERTEX (1u << 0) /**< Buffer is a vertex buffer. */ +#define SDL_GPU_BUFFERUSAGE_INDEX (1u << 1) /**< Buffer is an index buffer. */ +#define SDL_GPU_BUFFERUSAGE_INDIRECT (1u << 2) /**< Buffer is an indirect buffer. */ +#define SDL_GPU_BUFFERUSAGE_GRAPHICS_STORAGE_READ (1u << 3) /**< Buffer supports storage reads in graphics stages. */ +#define SDL_GPU_BUFFERUSAGE_COMPUTE_STORAGE_READ (1u << 4) /**< Buffer supports storage reads in the compute stage. */ +#define SDL_GPU_BUFFERUSAGE_COMPUTE_STORAGE_WRITE (1u << 5) /**< Buffer supports storage writes in the compute stage. */ +/** + * Specifies how a transfer buffer is intended to be used by the client. + * + * Note that mapping and copying FROM an upload transfer buffer or TO a + * download transfer buffer is undefined behavior. + * + * \since This enum is available since SDL 3.0.0 + * + * \sa SDL_CreateGPUTransferBuffer + */ typedef enum SDL_GPUTransferBufferUsage { SDL_GPU_TRANSFERBUFFERUSAGE_UPLOAD, SDL_GPU_TRANSFERBUFFERUSAGE_DOWNLOAD } SDL_GPUTransferBufferUsage; +/** + * Specifies which stage a shader program corresponds to. + * + * \since This enum is available since SDL 3.0.0 + * + * \sa SDL_CreateGPUShader + */ typedef enum SDL_GPUShaderStage { SDL_GPU_SHADERSTAGE_VERTEX, SDL_GPU_SHADERSTAGE_FRAGMENT } SDL_GPUShaderStage; +/** + * Specifies the format of shader code. + * + * Each format corresponds to a specific backend that accepts it. + * + * \since This datatype is available since SDL 3.0.0 + * + * \sa SDL_CreateGPUShader + */ typedef Uint32 SDL_GPUShaderFormat; -#define SDL_GPU_SHADERFORMAT_PRIVATE (1u << 0) /**< shaders for NDA'd platforms */ -#define SDL_GPU_SHADERFORMAT_SPIRV (1u << 1) /**< SPIR-V shaders for Vulkan */ -#define SDL_GPU_SHADERFORMAT_DXBC (1u << 2) /**< DXBC SM5_0 shaders for D3D11 */ -#define SDL_GPU_SHADERFORMAT_DXIL (1u << 3) /**< DXIL shaders for D3D12 */ -#define SDL_GPU_SHADERFORMAT_MSL (1u << 4) /**< MSL shaders for Metal */ -#define SDL_GPU_SHADERFORMAT_METALLIB (1u << 5) /**< precompiled metallib shaders for Metal */ +#define SDL_GPU_SHADERFORMAT_INVALID 0 +#define SDL_GPU_SHADERFORMAT_PRIVATE (1u << 0) /**< Shaders for NDA'd platforms. */ +#define SDL_GPU_SHADERFORMAT_SPIRV (1u << 1) /**< SPIR-V shaders for Vulkan. */ +#define SDL_GPU_SHADERFORMAT_DXBC (1u << 2) /**< DXBC SM5_0 shaders for D3D11. */ +#define SDL_GPU_SHADERFORMAT_DXIL (1u << 3) /**< DXIL shaders for D3D12. */ +#define SDL_GPU_SHADERFORMAT_MSL (1u << 4) /**< MSL shaders for Metal. */ +#define SDL_GPU_SHADERFORMAT_METALLIB (1u << 5) /**< Precompiled metallib shaders for Metal. */ +/** + * Specifies the format of a vertex attribute. + * + * \since This enum is available since SDL 3.0.0 + * + * \sa SDL_CreateGPUGraphicsPipeline + */ typedef enum SDL_GPUVertexElementFormat { + SDL_GPU_VERTEXELEMENTFORMAT_INVALID, + /* 32-bit Signed Integers */ SDL_GPU_VERTEXELEMENTFORMAT_INT, SDL_GPU_VERTEXELEMENTFORMAT_INT2, @@ -350,81 +663,158 @@ typedef enum SDL_GPUVertexElementFormat SDL_GPU_VERTEXELEMENTFORMAT_HALF4 } SDL_GPUVertexElementFormat; +/** + * Specifies the rate at which vertex attributes are pulled from buffers. + * + * \since This enum is available since SDL 3.0.0 + * + * \sa SDL_CreateGPUGraphicsPipeline + */ typedef enum SDL_GPUVertexInputRate { - SDL_GPU_VERTEXINPUTRATE_VERTEX = 0, - SDL_GPU_VERTEXINPUTRATE_INSTANCE = 1 + SDL_GPU_VERTEXINPUTRATE_VERTEX, /**< Attribute addressing is a function of the vertex index. */ + SDL_GPU_VERTEXINPUTRATE_INSTANCE /**< Attribute addressing is a function of the instance index. */ } SDL_GPUVertexInputRate; +/** + * Specifies the fill mode of the graphics pipeline. + * + * \since This enum is available since SDL 3.0.0 + * + * \sa SDL_CreateGPUGraphicsPipeline + */ typedef enum SDL_GPUFillMode { - SDL_GPU_FILLMODE_FILL, - SDL_GPU_FILLMODE_LINE + SDL_GPU_FILLMODE_FILL, /**< Polygons will be rendered via rasterization. */ + SDL_GPU_FILLMODE_LINE /**< Polygon edges will be drawn as line segments. */ } SDL_GPUFillMode; +/** + * Specifies the facing direction in which triangle faces will be culled. + * + * \since This enum is available since SDL 3.0.0 + * + * \sa SDL_CreateGPUGraphicsPipeline + */ typedef enum SDL_GPUCullMode { - SDL_GPU_CULLMODE_NONE, - SDL_GPU_CULLMODE_FRONT, - SDL_GPU_CULLMODE_BACK + SDL_GPU_CULLMODE_NONE, /**< No triangles are culled. */ + SDL_GPU_CULLMODE_FRONT, /**< Front-facing triangles are culled. */ + SDL_GPU_CULLMODE_BACK /**< Back-facing triangles are culled. */ } SDL_GPUCullMode; +/** + * Specifies the vertex winding that will cause a triangle to be determined to + * be front-facing. + * + * \since This enum is available since SDL 3.0.0 + * + * \sa SDL_CreateGPUGraphicsPipeline + */ typedef enum SDL_GPUFrontFace { - SDL_GPU_FRONTFACE_COUNTER_CLOCKWISE, - SDL_GPU_FRONTFACE_CLOCKWISE + SDL_GPU_FRONTFACE_COUNTER_CLOCKWISE, /**< A triangle with counter-clockwise vertex winding will be considered front-facing. */ + SDL_GPU_FRONTFACE_CLOCKWISE /**< A triangle with clockwise vertex winding will be considered front-facing. */ } SDL_GPUFrontFace; +/** + * Specifies a comparison operator for depth, stencil and sampler operations. + * + * \since This enum is available since SDL 3.0.0 + * + * \sa SDL_CreateGPUGraphicsPipeline + */ typedef enum SDL_GPUCompareOp { - SDL_GPU_COMPAREOP_NEVER, - SDL_GPU_COMPAREOP_LESS, - SDL_GPU_COMPAREOP_EQUAL, - SDL_GPU_COMPAREOP_LESS_OR_EQUAL, - SDL_GPU_COMPAREOP_GREATER, - SDL_GPU_COMPAREOP_NOT_EQUAL, - SDL_GPU_COMPAREOP_GREATER_OR_EQUAL, - SDL_GPU_COMPAREOP_ALWAYS + SDL_GPU_COMPAREOP_INVALID, + SDL_GPU_COMPAREOP_NEVER, /**< The comparison always evaluates false. */ + SDL_GPU_COMPAREOP_LESS, /**< The comparison evaluates reference < test. */ + SDL_GPU_COMPAREOP_EQUAL, /**< The comparison evaluates reference == test. */ + SDL_GPU_COMPAREOP_LESS_OR_EQUAL, /**< The comparison evaluates reference <= test. */ + SDL_GPU_COMPAREOP_GREATER, /**< The comparison evaluates reference > test. */ + SDL_GPU_COMPAREOP_NOT_EQUAL, /**< The comparison evaluates reference != test. */ + SDL_GPU_COMPAREOP_GREATER_OR_EQUAL, /**< The comparison evalutes reference >= test. */ + SDL_GPU_COMPAREOP_ALWAYS /**< The comparison always evaluates true. */ } SDL_GPUCompareOp; +/** + * Specifies what happens to a stored stencil value if stencil tests fail or + * pass. + * + * \since This enum is available since SDL 3.0.0 + * + * \sa SDL_CreateGPUGraphicsPipeline + */ typedef enum SDL_GPUStencilOp { - SDL_GPU_STENCILOP_KEEP, - SDL_GPU_STENCILOP_ZERO, - SDL_GPU_STENCILOP_REPLACE, - SDL_GPU_STENCILOP_INCREMENT_AND_CLAMP, - SDL_GPU_STENCILOP_DECREMENT_AND_CLAMP, - SDL_GPU_STENCILOP_INVERT, - SDL_GPU_STENCILOP_INCREMENT_AND_WRAP, - SDL_GPU_STENCILOP_DECREMENT_AND_WRAP + SDL_GPU_STENCILOP_INVALID, + SDL_GPU_STENCILOP_KEEP, /**< Keeps the current value. */ + SDL_GPU_STENCILOP_ZERO, /**< Sets the value to 0. */ + SDL_GPU_STENCILOP_REPLACE, /**< Sets the value to reference. */ + SDL_GPU_STENCILOP_INCREMENT_AND_CLAMP, /**< Increments the current value and clamps to the maximum value. */ + SDL_GPU_STENCILOP_DECREMENT_AND_CLAMP, /**< Decrements the current value and clamps to 0. */ + SDL_GPU_STENCILOP_INVERT, /**< Bitwise-inverts the current value. */ + SDL_GPU_STENCILOP_INCREMENT_AND_WRAP, /**< Increments the current value and wraps back to 0. */ + SDL_GPU_STENCILOP_DECREMENT_AND_WRAP /**< Decrements the current value and wraps to the maximum value. */ } SDL_GPUStencilOp; +/** + * Specifies the operator to be used when pixels in a render target are + * blended with existing pixels in the texture. + * + * The source color is the value written by the fragment shader. The + * destination color is the value currently existing in the texture. + * + * \since This enum is available since SDL 3.0.0 + * + * \sa SDL_CreateGPUGraphicsPipeline + */ typedef enum SDL_GPUBlendOp { - SDL_GPU_BLENDOP_ADD, - SDL_GPU_BLENDOP_SUBTRACT, - SDL_GPU_BLENDOP_REVERSE_SUBTRACT, - SDL_GPU_BLENDOP_MIN, - SDL_GPU_BLENDOP_MAX + SDL_GPU_BLENDOP_INVALID, + SDL_GPU_BLENDOP_ADD, /**< (source * source_factor) + (destination * destination_factor) */ + SDL_GPU_BLENDOP_SUBTRACT, /**< (source * source_factor) - (destination * destination_factor) */ + SDL_GPU_BLENDOP_REVERSE_SUBTRACT, /**< (destination * destination_factor) - (source * source_factor) */ + SDL_GPU_BLENDOP_MIN, /**< min(source, destination) */ + SDL_GPU_BLENDOP_MAX /**< max(source, destination) */ } SDL_GPUBlendOp; +/** + * Specifies a blending factor to be used when pixels in a render target are + * blended with existing pixels in the texture. + * + * The source color is the value written by the fragment shader. The + * destination color is the value currently existing in the texture. + * + * \since This enum is available since SDL 3.0.0 + * + * \sa SDL_CreateGPUGraphicsPipeline + */ typedef enum SDL_GPUBlendFactor { - SDL_GPU_BLENDFACTOR_ZERO, - SDL_GPU_BLENDFACTOR_ONE, - SDL_GPU_BLENDFACTOR_SRC_COLOR, - SDL_GPU_BLENDFACTOR_ONE_MINUS_SRC_COLOR, - SDL_GPU_BLENDFACTOR_DST_COLOR, - SDL_GPU_BLENDFACTOR_ONE_MINUS_DST_COLOR, - SDL_GPU_BLENDFACTOR_SRC_ALPHA, - SDL_GPU_BLENDFACTOR_ONE_MINUS_SRC_ALPHA, - SDL_GPU_BLENDFACTOR_DST_ALPHA, - SDL_GPU_BLENDFACTOR_ONE_MINUS_DST_ALPHA, - SDL_GPU_BLENDFACTOR_CONSTANT_COLOR, - SDL_GPU_BLENDFACTOR_ONE_MINUS_CONSTANT_COLOR, - SDL_GPU_BLENDFACTOR_SRC_ALPHA_SATURATE + SDL_GPU_BLENDFACTOR_INVALID, + SDL_GPU_BLENDFACTOR_ZERO, /**< 0 */ + SDL_GPU_BLENDFACTOR_ONE, /**< 1 */ + SDL_GPU_BLENDFACTOR_SRC_COLOR, /**< source color */ + SDL_GPU_BLENDFACTOR_ONE_MINUS_SRC_COLOR, /**< 1 - source color */ + SDL_GPU_BLENDFACTOR_DST_COLOR, /**< destination color */ + SDL_GPU_BLENDFACTOR_ONE_MINUS_DST_COLOR, /**< 1 - destination color */ + SDL_GPU_BLENDFACTOR_SRC_ALPHA, /**< source alpha */ + SDL_GPU_BLENDFACTOR_ONE_MINUS_SRC_ALPHA, /**< 1 - source alpha */ + SDL_GPU_BLENDFACTOR_DST_ALPHA, /**< destination alpha */ + SDL_GPU_BLENDFACTOR_ONE_MINUS_DST_ALPHA, /**< 1 - destination alpha */ + SDL_GPU_BLENDFACTOR_CONSTANT_COLOR, /**< blend constant */ + SDL_GPU_BLENDFACTOR_ONE_MINUS_CONSTANT_COLOR, /**< 1 - blend constant */ + SDL_GPU_BLENDFACTOR_SRC_ALPHA_SATURATE /**< min(source alpha, 1 - destination alpha) */ } SDL_GPUBlendFactor; +/** + * Specifies which color components are written in a graphics pipeline. + * + * \since This enum is available since SDL 3.0.0 + * + * \sa SDL_CreateGPUGraphicsPipeline + */ typedef Uint8 SDL_GPUColorComponentFlags; #define SDL_GPU_COLORCOMPONENT_R (1u << 0) /**< the red component */ @@ -432,40 +822,77 @@ typedef Uint8 SDL_GPUColorComponentFlags; #define SDL_GPU_COLORCOMPONENT_B (1u << 2) /**< the blue component */ #define SDL_GPU_COLORCOMPONENT_A (1u << 3) /**< the alpha component */ +/** + * Specifies a filter operation used by a sampler. + * + * \since This enum is available since SDL 3.0.0 + * + * \sa SDL_CreateGPUSampler + */ typedef enum SDL_GPUFilter { - SDL_GPU_FILTER_NEAREST, - SDL_GPU_FILTER_LINEAR + SDL_GPU_FILTER_NEAREST, /**< Point filtering. */ + SDL_GPU_FILTER_LINEAR /**< Linear filtering. */ } SDL_GPUFilter; +/** + * Specifies a mipmap mode used by a sampler. + * + * \since This enum is available since SDL 3.0.0 + * + * \sa SDL_CreateGPUSampler + */ typedef enum SDL_GPUSamplerMipmapMode { - SDL_GPU_SAMPLERMIPMAPMODE_NEAREST, - SDL_GPU_SAMPLERMIPMAPMODE_LINEAR + SDL_GPU_SAMPLERMIPMAPMODE_NEAREST, /**< Point filtering. */ + SDL_GPU_SAMPLERMIPMAPMODE_LINEAR /**< Linear filtering. */ } SDL_GPUSamplerMipmapMode; +/** + * Specifies behavior of texture sampling when the coordinates exceed the 0-1 + * range. + * + * \since This enum is available since SDL 3.0.0 + * + * \sa SDL_CreateGPUSampler + */ typedef enum SDL_GPUSamplerAddressMode { - SDL_GPU_SAMPLERADDRESSMODE_REPEAT, - SDL_GPU_SAMPLERADDRESSMODE_MIRRORED_REPEAT, - SDL_GPU_SAMPLERADDRESSMODE_CLAMP_TO_EDGE + SDL_GPU_SAMPLERADDRESSMODE_REPEAT, /**< Specifies that the coordinates will wrap around. */ + SDL_GPU_SAMPLERADDRESSMODE_MIRRORED_REPEAT, /**< Specifies that the coordinates will wrap around mirrored. */ + SDL_GPU_SAMPLERADDRESSMODE_CLAMP_TO_EDGE /**< Specifies that the coordinates will clamp to the 0-1 range. */ } SDL_GPUSamplerAddressMode; -/* - * VSYNC: - * Waits for vblank before presenting. - * If there is a pending image to present, the new image is enqueued for presentation. - * Disallows tearing at the cost of visual latency. - * When using this present mode, AcquireSwapchainTexture will block if too many frames are in flight. - * IMMEDIATE: - * Immediately presents. - * Lowest latency option, but tearing may occur. - * When using this mode, AcquireSwapchainTexture will return NULL if too many frames are in flight. - * MAILBOX: - * Waits for vblank before presenting. No tearing is possible. - * If there is a pending image to present, the pending image is replaced by the new image. - * Similar to VSYNC, but with reduced visual latency. - * When using this mode, AcquireSwapchainTexture will return NULL if too many frames are in flight. +/** + * Specifies the timing that will be used to present swapchain textures to the + * OS. + * + * Note that this value affects the behavior of + * SDL_AcquireGPUSwapchainTexture. VSYNC mode will always be supported. + * IMMEDIATE and MAILBOX modes may not be supported on certain systems. + * + * It is recommended to query SDL_WindowSupportsGPUPresentMode after claiming + * the window if you wish to change the present mode to IMMEDIATE or MAILBOX. + * + * - VSYNC: Waits for vblank before presenting. No tearing is possible. If + * there is a pending image to present, the new image is enqueued for + * presentation. Disallows tearing at the cost of visual latency. When using + * this present mode, AcquireSwapchainTexture will block if too many frames + * are in flight. + * - IMMEDIATE: Immediately presents. Lowest latency option, but tearing may + * occur. When using this mode, AcquireSwapchainTexture will return NULL if + * too many frames are in flight. + * - MAILBOX: Waits for vblank before presenting. No tearing is possible. If + * there is a pending image to present, the pending image is replaced by the + * new image. Similar to VSYNC, but with reduced visual latency. When using + * this mode, AcquireSwapchainTexture will return NULL if too many frames + * are in flight. + * + * \since This enum is available since SDL 3.0.0 + * + * \sa SDL_SetGPUSwapchainParameters + * \sa SDL_WindowSupportsGPUPresentMode + * \sa SDL_AcquireGPUSwapchainTexture */ typedef enum SDL_GPUPresentMode { @@ -474,15 +901,30 @@ typedef enum SDL_GPUPresentMode SDL_GPU_PRESENTMODE_MAILBOX } SDL_GPUPresentMode; -/* - * SDR: - * B8G8R8A8 or R8G8B8A8 swapchain. Pixel values are in nonlinear sRGB encoding. Blends raw pixel values. - * SDR_LINEAR: - * B8G8R8A8_SRGB or R8G8B8A8_SRGB swapchain. Pixel values are in nonlinear sRGB encoding. Blends in linear space. - * HDR_EXTENDED_LINEAR: - * R16G16B16A16_SFLOAT swapchain. Pixel values are in extended linear encoding. Blends in linear space. - * HDR10_ST2048: - * A2R10G10B10 or A2B10G10R10 swapchain. Pixel values are in PQ ST2048 encoding. Blends raw pixel values. (TODO: verify this) +/** + * Specifies the texture format and colorspace of the swapchain textures. + * + * SDR will always be supported. Other compositions may not be supported on + * certain systems. + * + * It is recommended to query SDL_WindowSupportsGPUSwapchainComposition after + * claiming the window if you wish to change the swapchain composition from + * SDR. + * + * - SDR: B8G8R8A8 or R8G8B8A8 swapchain. Pixel values are in nonlinear sRGB + * encoding. + * - SDR_LINEAR: B8G8R8A8_SRGB or R8G8B8A8_SRGB swapchain. Pixel values are in + * nonlinear sRGB encoding. + * - HDR_EXTENDED_LINEAR: R16G16B16A16_SFLOAT swapchain. Pixel values are in + * extended linear encoding. + * - HDR10_ST2048: A2R10G10B10 or A2B10G10R10 swapchain. Pixel values are in + * PQ ST2048 encoding. + * + * \since This enum is available since SDL 3.0.0 + * + * \sa SDL_SetGPUSwapchainParameters + * \sa SDL_WindowSupportsGPUSwapchainComposition + * \sa SDL_AcquireGPUSwapchainTexture */ typedef enum SDL_GPUSwapchainComposition { @@ -492,216 +934,379 @@ typedef enum SDL_GPUSwapchainComposition SDL_GPU_SWAPCHAINCOMPOSITION_HDR10_ST2048 } SDL_GPUSwapchainComposition; -typedef enum SDL_GPUDriver -{ - SDL_GPU_DRIVER_INVALID = -1, - SDL_GPU_DRIVER_PRIVATE, /* NDA'd platforms */ - SDL_GPU_DRIVER_VULKAN, - SDL_GPU_DRIVER_D3D11, - SDL_GPU_DRIVER_D3D12, - SDL_GPU_DRIVER_METAL -} SDL_GPUDriver; - /* Structures */ -typedef struct SDL_GPUDepthStencilValue -{ - float depth; - Uint8 stencil; -} SDL_GPUDepthStencilValue; - +/** + * A structure specifying a viewport. + * + * \since This struct is available since SDL 3.0.0 + * + * \sa SDL_SetGPUViewport + */ typedef struct SDL_GPUViewport { - float x; - float y; - float w; - float h; - float minDepth; - float maxDepth; + float x; /**< The left offset of the viewport. */ + float y; /**< The top offset of the viewport. */ + float w; /**< The width of the viewport. */ + float h; /**< The height of the viewport. */ + float min_depth; /**< The minimum depth of the viewport. */ + float max_depth; /**< The maximum depth of the viewport. */ } SDL_GPUViewport; +/** + * A structure specifying parameters related to transferring data to or from a + * texture. + * + * \since This struct is available since SDL 3.0.0 + * + * \sa SDL_UploadToGPUTexture + * \sa SDL_DownloadFromGPUTexture + */ typedef struct SDL_GPUTextureTransferInfo { - SDL_GPUTransferBuffer *transferBuffer; - Uint32 offset; /* starting location of the image data */ - Uint32 imagePitch; /* number of pixels from one row to the next */ - Uint32 imageHeight; /* number of rows from one layer/depth-slice to the next */ + SDL_GPUTransferBuffer *transfer_buffer; /**< The transfer buffer used in the transfer operation. */ + Uint32 offset; /**< The starting byte of the image data in the transfer buffer. */ + Uint32 pixels_per_row; /**< The number of pixels from one row to the next. */ + Uint32 rows_per_layer; /**< The number of rows from one layer/depth-slice to the next. */ } SDL_GPUTextureTransferInfo; +/** + * A structure specifying a location in a transfer buffer. + * + * Used when transferring buffer data to or from a transfer buffer. + * + * \since This struct is available since SDL 3.0.0 + * + * \sa SDL_UploadToGPUBuffer + * \sa SDL_DownloadFromGPUBuffer + */ typedef struct SDL_GPUTransferBufferLocation { - SDL_GPUTransferBuffer *transferBuffer; - Uint32 offset; + SDL_GPUTransferBuffer *transfer_buffer; /**< The transfer buffer used in the transfer operation. */ + Uint32 offset; /**< The starting byte of the buffer data in the transfer buffer. */ } SDL_GPUTransferBufferLocation; +/** + * A structure specifying a location in a texture. + * + * Used when copying data from one texture to another. + * + * \since This struct is available since SDL 3.0.0 + * + * \sa SDL_CopyGPUTextureToTexture + */ typedef struct SDL_GPUTextureLocation { - SDL_GPUTexture *texture; - Uint32 mipLevel; - Uint32 layer; - Uint32 x; - Uint32 y; - Uint32 z; + SDL_GPUTexture *texture; /**< The texture used in the copy operation. */ + Uint32 mip_level; /**< The mip level index of the location. */ + Uint32 layer; /**< The layer index of the location. */ + Uint32 x; /**< The left offset of the location. */ + Uint32 y; /**< The top offset of the location. */ + Uint32 z; /**< The front offset of the location. */ } SDL_GPUTextureLocation; +/** + * A structure specifying a region of a texture. + * + * Used when transferring data to or from a texture. + * + * \since This struct is available since SDL 3.0.0 + * + * \sa SDL_UploadToGPUTexture + * \sa SDL_DownloadFromGPUTexture + */ typedef struct SDL_GPUTextureRegion { - SDL_GPUTexture *texture; - Uint32 mipLevel; - Uint32 layer; - Uint32 x; - Uint32 y; - Uint32 z; - Uint32 w; - Uint32 h; - Uint32 d; + SDL_GPUTexture *texture; /**< The texture used in the copy operation. */ + Uint32 mip_level; /**< The mip level index to transfer. */ + Uint32 layer; /**< The layer index to transfer. */ + Uint32 x; /**< The left offset of the region. */ + Uint32 y; /**< The top offset of the region. */ + Uint32 z; /**< The front offset of the region. */ + Uint32 w; /**< The width of the region. */ + Uint32 h; /**< The height of the region. */ + Uint32 d; /**< The depth of the region. */ } SDL_GPUTextureRegion; +/** + * A structure specifying a region of a texture used in the blit operation. + * + * \since This struct is available since SDL 3.0.0 + * + * \sa SDL_BlitGPUTexture + */ typedef struct SDL_GPUBlitRegion { - SDL_GPUTexture *texture; - Uint32 mipLevel; - Uint32 layerOrDepthPlane; - Uint32 x; - Uint32 y; - Uint32 w; - Uint32 h; + SDL_GPUTexture *texture; /**< The texture. */ + Uint32 mip_level; /**< The mip level index of the region. */ + Uint32 layer_or_depth_plane; /**< The layer index or depth plane of the region. This value is treated as a layer index on 2D array and cube textures, and as a depth plane on 3D textures. */ + Uint32 x; /**< The left offset of the region. */ + Uint32 y; /**< The top offset of the region. */ + Uint32 w; /**< The width of the region. */ + Uint32 h; /**< The height of the region. */ } SDL_GPUBlitRegion; +/** + * A structure specifying a location in a buffer. + * + * Used when copying data between buffers. + * + * \since This struct is available since SDL 3.0.0 + * + * \sa SDL_CopyGPUBufferToBuffer + */ typedef struct SDL_GPUBufferLocation { - SDL_GPUBuffer *buffer; - Uint32 offset; + SDL_GPUBuffer *buffer; /**< The buffer. */ + Uint32 offset; /**< The starting byte within the buffer. */ } SDL_GPUBufferLocation; +/** + * A structure specifying a region of a buffer. + * + * Used when transferring data to or from buffers. + * + * \since This struct is available since SDL 3.0.0 + * + * \sa SDL_UploadToGPUBuffer + * \sa SDL_DownloadFromGPUBuffer + */ typedef struct SDL_GPUBufferRegion { - SDL_GPUBuffer *buffer; - Uint32 offset; - Uint32 size; + SDL_GPUBuffer *buffer; /**< The buffer. */ + Uint32 offset; /**< The starting byte within the buffer. */ + Uint32 size; /**< The size in bytes of the region. */ } SDL_GPUBufferRegion; -/* Note that the `firstVertex` and `firstInstance` parameters are NOT compatible with - * built-in vertex/instance ID variables in shaders (for example, SV_VertexID). If - * your shader depends on these variables, the correlating draw call parameter MUST - * be 0. +/** + * A structure specifying the parameters of an indirect draw command. + * + * Note that the `first_vertex` and `first_instance` parameters are NOT + * compatible with built-in vertex/instance ID variables in shaders (for + * example, SV_VertexID). If your shader depends on these variables, the + * correlating draw call parameter MUST be 0. + * + * \since This struct is available since SDL 3.0.0 + * + * \sa SDL_DrawGPUPrimitivesIndirect */ typedef struct SDL_GPUIndirectDrawCommand { - Uint32 vertexCount; /* number of vertices to draw */ - Uint32 instanceCount; /* number of instances to draw */ - Uint32 firstVertex; /* index of the first vertex to draw */ - Uint32 firstInstance; /* ID of the first instance to draw */ + Uint32 num_vertices; /**< The number of vertices to draw. */ + Uint32 num_instances; /**< The number of instances to draw. */ + Uint32 first_vertex; /**< The index of the first vertex to draw. */ + Uint32 first_instance; /**< The ID of the first instance to draw. */ } SDL_GPUIndirectDrawCommand; +/** + * A structure specifying the parameters of an indexed indirect draw command. + * + * Note that the `first_vertex` and `first_instance` parameters are NOT + * compatible with built-in vertex/instance ID variables in shaders (for + * example, SV_VertexID). If your shader depends on these variables, the + * correlating draw call parameter MUST be 0. + * + * \since This struct is available since SDL 3.0.0 + * + * \sa SDL_DrawGPUIndexedPrimitivesIndirect + */ typedef struct SDL_GPUIndexedIndirectDrawCommand { - Uint32 indexCount; /* number of vertices to draw per instance */ - Uint32 instanceCount; /* number of instances to draw */ - Uint32 firstIndex; /* base index within the index buffer */ - Sint32 vertexOffset; /* value added to vertex index before indexing into the vertex buffer */ - Uint32 firstInstance; /* ID of the first instance to draw */ + Uint32 num_indices; /**< The number of indices to draw per instance. */ + Uint32 num_instances; /**< The number of instances to draw. */ + Uint32 first_index; /**< The base index within the index buffer. */ + Sint32 vertex_offset; /**< The value added to the vertex index before indexing into the vertex buffer. */ + Uint32 first_instance; /**< The ID of the first instance to draw. */ } SDL_GPUIndexedIndirectDrawCommand; +/** + * A structure specifying the parameters of an indexed dispatch command. + * + * \since This struct is available since SDL 3.0.0 + * + * \sa SDL_DispatchGPUComputeIndirect + */ typedef struct SDL_GPUIndirectDispatchCommand { - Uint32 groupCountX; - Uint32 groupCountY; - Uint32 groupCountZ; + Uint32 groupcount_x; /**< The number of local workgroups to dispatch in the X dimension. */ + Uint32 groupcount_y; /**< The number of local workgroups to dispatch in the Y dimension. */ + Uint32 groupcount_z; /**< The number of local workgroups to dispatch in the Z dimension. */ } SDL_GPUIndirectDispatchCommand; /* State structures */ +/** + * A structure specifying the parameters of a sampler. + * + * \since This function is available since SDL 3.0.0 + * + * \sa SDL_CreateGPUSampler + */ typedef struct SDL_GPUSamplerCreateInfo { - SDL_GPUFilter minFilter; - SDL_GPUFilter magFilter; - SDL_GPUSamplerMipmapMode mipmapMode; - SDL_GPUSamplerAddressMode addressModeU; - SDL_GPUSamplerAddressMode addressModeV; - SDL_GPUSamplerAddressMode addressModeW; - float mipLodBias; - SDL_bool anisotropyEnable; - float maxAnisotropy; - SDL_bool compareEnable; - SDL_GPUCompareOp compareOp; - float minLod; - float maxLod; + SDL_GPUFilter min_filter; /**< The minification filter to apply to lookups. */ + SDL_GPUFilter mag_filter; /**< The magnification filter to apply to lookups. */ + SDL_GPUSamplerMipmapMode mipmap_mode; /**< The mipmap filter to apply to lookups. */ + SDL_GPUSamplerAddressMode address_mode_u; /**< The addressing mode for U coordinates outside [0, 1). */ + SDL_GPUSamplerAddressMode address_mode_v; /**< The addressing mode for V coordinates outside [0, 1). */ + SDL_GPUSamplerAddressMode address_mode_w; /**< The addressing mode for W coordinates outside [0, 1). */ + float mip_lod_bias; /**< The bias to be added to mipmap LOD calculation. */ + float max_anisotropy; /**< The anisotropy value clamp used by the sampler. If enable_anisotropy is false, this is ignored. */ + SDL_GPUCompareOp compare_op; /**< The comparison operator to apply to fetched data before filtering. */ + float min_lod; /**< Clamps the minimum of the computed LOD value. */ + float max_lod; /**< Clamps the maximum of the computed LOD value. */ + bool enable_anisotropy; /**< true to enable anisotropic filtering. */ + bool enable_compare; /**< true to enable comparison against a reference value during lookups. */ + Uint8 padding1; + Uint8 padding2; - SDL_PropertiesID props; + SDL_PropertiesID props; /**< A properties ID for extensions. Should be 0 if no extensions are needed. */ } SDL_GPUSamplerCreateInfo; -typedef struct SDL_GPUVertexBinding +/** + * A structure specifying the parameters of vertex buffers used in a graphics + * pipeline. + * + * When you call SDL_BindGPUVertexBuffers, you specify the binding slots of + * the vertex buffers. For example if you called SDL_BindGPUVertexBuffers with + * a first_slot of 2 and num_bindings of 3, the binding slots 2, 3, 4 would be + * used by the vertex buffers you pass in. + * + * Vertex attributes are linked to buffers via the buffer_slot field of + * SDL_GPUVertexAttribute. For example, if an attribute has a buffer_slot of + * 0, then that attribute belongs to the vertex buffer bound at slot 0. + * + * \since This struct is available since SDL 3.0.0 + * + * \sa SDL_GPUVertexAttribute + * \sa SDL_GPUVertexInputState + */ +typedef struct SDL_GPUVertexBufferDescription { - Uint32 binding; - Uint32 stride; - SDL_GPUVertexInputRate inputRate; - Uint32 instanceStepRate; /* ignored unless inputRate is INSTANCE */ -} SDL_GPUVertexBinding; + Uint32 slot; /**< The binding slot of the vertex buffer. */ + Uint32 pitch; /**< The byte pitch between consecutive elements of the vertex buffer. */ + SDL_GPUVertexInputRate input_rate; /**< Whether attribute addressing is a function of the vertex index or instance index. */ + Uint32 instance_step_rate; /**< The number of instances to draw using the same per-instance data before advancing in the instance buffer by one element. Ignored unless input_rate is SDL_GPU_VERTEXINPUTRATE_INSTANCE */ +} SDL_GPUVertexBufferDescription; +/** + * A structure specifying a vertex attribute. + * + * All vertex attribute locations provided to an SDL_GPUVertexInputState must + * be unique. + * + * \since This struct is available since SDL 3.0.0 + * + * \sa SDL_GPUVertexBufferDescription + * \sa SDL_GPUVertexInputState + */ typedef struct SDL_GPUVertexAttribute { - Uint32 location; - Uint32 binding; - SDL_GPUVertexElementFormat format; - Uint32 offset; + Uint32 location; /**< The shader input location index. */ + Uint32 buffer_slot; /**< The binding slot of the associated vertex buffer. */ + SDL_GPUVertexElementFormat format; /**< The size and type of the attribute data. */ + Uint32 offset; /**< The byte offset of this attribute relative to the start of the vertex element. */ } SDL_GPUVertexAttribute; +/** + * A structure specifying the parameters of a graphics pipeline vertex input + * state. + * + * \since This struct is available since SDL 3.0.0 + * + * \sa SDL_GPUGraphicsPipelineCreateInfo + */ typedef struct SDL_GPUVertexInputState { - const SDL_GPUVertexBinding *vertexBindings; - Uint32 vertexBindingCount; - const SDL_GPUVertexAttribute *vertexAttributes; - Uint32 vertexAttributeCount; + const SDL_GPUVertexBufferDescription *vertex_buffer_descriptions; /**< A pointer to an array of vertex buffer descriptions. */ + Uint32 num_vertex_buffers; /**< The number of vertex buffer descriptions in the above array. */ + const SDL_GPUVertexAttribute *vertex_attributes; /**< A pointer to an array of vertex attribute descriptions. */ + Uint32 num_vertex_attributes; /**< The number of vertex attribute descriptions in the above array. */ } SDL_GPUVertexInputState; +/** + * A structure specifying the stencil operation state of a graphics pipeline. + * + * \since This struct is available since SDL 3.0.0 + * + * \sa SDL_GPUDepthStencilState + */ typedef struct SDL_GPUStencilOpState { - SDL_GPUStencilOp failOp; - SDL_GPUStencilOp passOp; - SDL_GPUStencilOp depthFailOp; - SDL_GPUCompareOp compareOp; + SDL_GPUStencilOp fail_op; /**< The action performed on samples that fail the stencil test. */ + SDL_GPUStencilOp pass_op; /**< The action performed on samples that pass the depth and stencil tests. */ + SDL_GPUStencilOp depth_fail_op; /**< The action performed on samples that pass the stencil test and fail the depth test. */ + SDL_GPUCompareOp compare_op; /**< The comparison operator used in the stencil test. */ } SDL_GPUStencilOpState; -typedef struct SDL_GPUColorAttachmentBlendState +/** + * A structure specifying the blend state of a color target. + * + * \since This struct is available since SDL 3.0.0 + * + * \sa SDL_GPUColorTargetDescription + */ +typedef struct SDL_GPUColorTargetBlendState { - SDL_bool blendEnable; - SDL_GPUBlendFactor srcColorBlendFactor; - SDL_GPUBlendFactor dstColorBlendFactor; - SDL_GPUBlendOp colorBlendOp; - SDL_GPUBlendFactor srcAlphaBlendFactor; - SDL_GPUBlendFactor dstAlphaBlendFactor; - SDL_GPUBlendOp alphaBlendOp; - SDL_GPUColorComponentFlags colorWriteMask; -} SDL_GPUColorAttachmentBlendState; + SDL_GPUBlendFactor src_color_blendfactor; /**< The value to be multiplied by the source RGB value. */ + SDL_GPUBlendFactor dst_color_blendfactor; /**< The value to be multiplied by the destination RGB value. */ + SDL_GPUBlendOp color_blend_op; /**< The blend operation for the RGB components. */ + SDL_GPUBlendFactor src_alpha_blendfactor; /**< The value to be multiplied by the source alpha. */ + SDL_GPUBlendFactor dst_alpha_blendfactor; /**< The value to be multiplied by the destination alpha. */ + SDL_GPUBlendOp alpha_blend_op; /**< The blend operation for the alpha component. */ + SDL_GPUColorComponentFlags color_write_mask; /**< A bitmask specifying which of the RGBA components are enabled for writing. Writes to all channels if enable_color_write_mask is false. */ + bool enable_blend; /**< Whether blending is enabled for the color target. */ + bool enable_color_write_mask; /**< Whether the color write mask is enabled. */ + Uint8 padding2; + Uint8 padding3; +} SDL_GPUColorTargetBlendState; + +/** + * A structure specifying code and metadata for creating a shader object. + * + * \since This struct is available since SDL 3.0.0 + * + * \sa SDL_CreateGPUShader + */ typedef struct SDL_GPUShaderCreateInfo { - size_t codeSize; - const Uint8 *code; - const char *entryPointName; - SDL_GPUShaderFormat format; - SDL_GPUShaderStage stage; - Uint32 samplerCount; - Uint32 storageTextureCount; - Uint32 storageBufferCount; - Uint32 uniformBufferCount; + size_t code_size; /**< The size in bytes of the code pointed to. */ + const Uint8 *code; /**< A pointer to shader code. */ + const char *entrypoint; /**< A pointer to a null-terminated UTF-8 string specifying the entry point function name for the shader. */ + SDL_GPUShaderFormat format; /**< The format of the shader code. */ + SDL_GPUShaderStage stage; /**< The stage the shader program corresponds to. */ + Uint32 num_samplers; /**< The number of samplers defined in the shader. */ + Uint32 num_storage_textures; /**< The number of storage textures defined in the shader. */ + Uint32 num_storage_buffers; /**< The number of storage buffers defined in the shader. */ + Uint32 num_uniform_buffers; /**< The number of uniform buffers defined in the shader. */ - SDL_PropertiesID props; + SDL_PropertiesID props; /**< A properties ID for extensions. Should be 0 if no extensions are needed. */ } SDL_GPUShaderCreateInfo; +/** + * A structure specifying the parameters of a texture. + * + * Usage flags can be bitwise OR'd together for combinations of usages. Note + * that certain usage combinations are invalid, for example SAMPLER and + * GRAPHICS_STORAGE. + * + * \since This struct is available since SDL 3.0.0 + * + * \sa SDL_CreateGPUTexture + */ typedef struct SDL_GPUTextureCreateInfo { - SDL_GPUTextureType type; - SDL_GPUTextureFormat format; - SDL_GPUTextureUsageFlags usageFlags; - Uint32 width; - Uint32 height; - Uint32 layerCountOrDepth; - Uint32 levelCount; - SDL_GPUSampleCount sampleCount; + SDL_GPUTextureType type; /**< The base dimensionality of the texture. */ + SDL_GPUTextureFormat format; /**< The pixel format of the texture. */ + SDL_GPUTextureUsageFlags usage; /**< How the texture is intended to be used by the client. */ + Uint32 width; /**< The width of the texture. */ + Uint32 height; /**< The height of the texture. */ + Uint32 layer_count_or_depth; /**< The layer count or depth of the texture. This value is treated as a layer count on 2D array textures, and as a depth value on 3D textures. */ + Uint32 num_levels; /**< The number of mip levels in the texture. */ + SDL_GPUSampleCount sample_count; /**< The number of samples per texel. Only applies if the texture is used as a render target. */ - SDL_PropertiesID props; + SDL_PropertiesID props; /**< A properties ID for extensions. Should be 0 if no extensions are needed. */ } SDL_GPUTextureCreateInfo; #define SDL_PROP_GPU_CREATETEXTURE_D3D12_CLEAR_R_FLOAT "SDL.gpu.createtexture.d3d12.clear.r" @@ -711,256 +1316,433 @@ typedef struct SDL_GPUTextureCreateInfo #define SDL_PROP_GPU_CREATETEXTURE_D3D12_CLEAR_DEPTH_FLOAT "SDL.gpu.createtexture.d3d12.clear.depth" #define SDL_PROP_GPU_CREATETEXTURE_D3D12_CLEAR_STENCIL_UINT8 "SDL.gpu.createtexture.d3d12.clear.stencil" +/** + * A structure specifying the parameters of a buffer. + * + * Usage flags can be bitwise OR'd together for combinations of usages. Note + * that certain combinations are invalid, for example VERTEX and INDEX. + * + * \since This struct is available since SDL 3.0.0 + * + * \sa SDL_CreateGPUBuffer + */ typedef struct SDL_GPUBufferCreateInfo { - SDL_GPUBufferUsageFlags usageFlags; - Uint32 sizeInBytes; + SDL_GPUBufferUsageFlags usage; /**< How the buffer is intended to be used by the client. */ + Uint32 size; /**< The size in bytes of the buffer. */ - SDL_PropertiesID props; + SDL_PropertiesID props; /**< A properties ID for extensions. Should be 0 if no extensions are needed. */ } SDL_GPUBufferCreateInfo; +/** + * A structure specifying the parameters of a transfer buffer. + * + * \since This struct is available since SDL 3.0.0 + * + * \sa SDL_CreateGPUTransferBuffer + */ typedef struct SDL_GPUTransferBufferCreateInfo { - SDL_GPUTransferBufferUsage usage; - Uint32 sizeInBytes; + SDL_GPUTransferBufferUsage usage; /**< How the transfer buffer is intended to be used by the client. */ + Uint32 size; /**< The size in bytes of the transfer buffer. */ - SDL_PropertiesID props; + SDL_PropertiesID props; /**< A properties ID for extensions. Should be 0 if no extensions are needed. */ } SDL_GPUTransferBufferCreateInfo; /* Pipeline state structures */ +/** + * A structure specifying the parameters of the graphics pipeline rasterizer + * state. + * + * \since This struct is available since SDL 3.0.0 + * + * \sa SDL_GPUGraphicsPipelineCreateInfo + */ typedef struct SDL_GPURasterizerState { - SDL_GPUFillMode fillMode; - SDL_GPUCullMode cullMode; - SDL_GPUFrontFace frontFace; - SDL_bool depthBiasEnable; - float depthBiasConstantFactor; - float depthBiasClamp; - float depthBiasSlopeFactor; + SDL_GPUFillMode fill_mode; /**< Whether polygons will be filled in or drawn as lines. */ + SDL_GPUCullMode cull_mode; /**< The facing direction in which triangles will be culled. */ + SDL_GPUFrontFace front_face; /**< The vertex winding that will cause a triangle to be determined as front-facing. */ + float depth_bias_constant_factor; /**< A scalar factor controlling the depth value added to each fragment. */ + float depth_bias_clamp; /**< The maximum depth bias of a fragment. */ + float depth_bias_slope_factor; /**< A scalar factor applied to a fragment's slope in depth calculations. */ + bool enable_depth_bias; /**< true to bias fragment depth values. */ + Uint8 padding1; + Uint8 padding2; + Uint8 padding3; } SDL_GPURasterizerState; +/** + * A structure specifying the parameters of the graphics pipeline multisample + * state. + * + * \since This struct is available since SDL 3.0.0 + * + * \sa SDL_GPUGraphicsPipelineCreateInfo + */ typedef struct SDL_GPUMultisampleState { - SDL_GPUSampleCount sampleCount; - Uint32 sampleMask; + SDL_GPUSampleCount sample_count; /**< The number of samples to be used in rasterization. */ + Uint32 sample_mask; /**< Determines which samples get updated in the render targets. Treated as 0xFFFFFFFF if enable_mask is false. */ + bool enable_mask; /**< Enables sample masking. */ + Uint8 padding1; + Uint8 padding2; + Uint8 padding3; } SDL_GPUMultisampleState; +/** + * A structure specifying the parameters of the graphics pipeline depth + * stencil state. + * + * \since This struct is available since SDL 3.0.0 + * + * \sa SDL_GPUGraphicsPipelineCreateInfo + */ typedef struct SDL_GPUDepthStencilState { - SDL_bool depthTestEnable; - SDL_bool depthWriteEnable; - SDL_GPUCompareOp compareOp; - SDL_bool stencilTestEnable; - SDL_GPUStencilOpState backStencilState; - SDL_GPUStencilOpState frontStencilState; - Uint8 compareMask; - Uint8 writeMask; - Uint8 reference; + SDL_GPUCompareOp compare_op; /**< The comparison operator used for depth testing. */ + SDL_GPUStencilOpState back_stencil_state; /**< The stencil op state for back-facing triangles. */ + SDL_GPUStencilOpState front_stencil_state; /**< The stencil op state for front-facing triangles. */ + Uint8 compare_mask; /**< Selects the bits of the stencil values participating in the stencil test. */ + Uint8 write_mask; /**< Selects the bits of the stencil values updated by the stencil test. */ + bool enable_depth_test; /**< true enables the depth test. */ + bool enable_depth_write; /**< true enables depth writes. Depth writes are always disabled when enable_depth_test is false. */ + bool enable_stencil_test; /**< true enables the stencil test. */ + Uint8 padding1; + Uint8 padding2; + Uint8 padding3; } SDL_GPUDepthStencilState; -typedef struct SDL_GPUColorAttachmentDescription +/** + * A structure specifying the parameters of color targets used in a graphics + * pipeline. + * + * \since This struct is available since SDL 3.0.0 + * + * \sa SDL_GPUGraphicsPipelineTargetInfo + */ +typedef struct SDL_GPUColorTargetDescription { - SDL_GPUTextureFormat format; - SDL_GPUColorAttachmentBlendState blendState; -} SDL_GPUColorAttachmentDescription; + SDL_GPUTextureFormat format; /**< The pixel format of the texture to be used as a color target. */ + SDL_GPUColorTargetBlendState blend_state; /**< The blend state to be used for the color target. */ +} SDL_GPUColorTargetDescription; -typedef struct SDL_GPUGraphicsPipelineAttachmentInfo +/** + * A structure specifying the descriptions of render targets used in a + * graphics pipeline. + * + * \since This struct is available since SDL 3.0.0 + * + * \sa SDL_GPUGraphicsPipelineCreateInfo + */ +typedef struct SDL_GPUGraphicsPipelineTargetInfo { - SDL_GPUColorAttachmentDescription *colorAttachmentDescriptions; - Uint32 colorAttachmentCount; - SDL_bool hasDepthStencilAttachment; - SDL_GPUTextureFormat depthStencilFormat; -} SDL_GPUGraphicsPipelineAttachmentInfo; + const SDL_GPUColorTargetDescription *color_target_descriptions; /**< A pointer to an array of color target descriptions. */ + Uint32 num_color_targets; /**< The number of color target descriptions in the above array. */ + SDL_GPUTextureFormat depth_stencil_format; /**< The pixel format of the depth-stencil target. Ignored if has_depth_stencil_target is false. */ + bool has_depth_stencil_target; /**< true specifies that the pipeline uses a depth-stencil target. */ + Uint8 padding1; + Uint8 padding2; + Uint8 padding3; +} SDL_GPUGraphicsPipelineTargetInfo; +/** + * A structure specifying the parameters of a graphics pipeline state. + * + * \since This struct is available since SDL 3.0.0 + * + * \sa SDL_CreateGPUGraphicsPipeline + */ typedef struct SDL_GPUGraphicsPipelineCreateInfo { - SDL_GPUShader *vertexShader; - SDL_GPUShader *fragmentShader; - SDL_GPUVertexInputState vertexInputState; - SDL_GPUPrimitiveType primitiveType; - SDL_GPURasterizerState rasterizerState; - SDL_GPUMultisampleState multisampleState; - SDL_GPUDepthStencilState depthStencilState; - SDL_GPUGraphicsPipelineAttachmentInfo attachmentInfo; - float blendConstants[4]; + SDL_GPUShader *vertex_shader; /**< The vertex shader used by the graphics pipeline. */ + SDL_GPUShader *fragment_shader; /**< The fragment shader used by the graphics pipeline. */ + SDL_GPUVertexInputState vertex_input_state; /**< The vertex layout of the graphics pipeline. */ + SDL_GPUPrimitiveType primitive_type; /**< The primitive topology of the graphics pipeline. */ + SDL_GPURasterizerState rasterizer_state; /**< The rasterizer state of the graphics pipeline. */ + SDL_GPUMultisampleState multisample_state; /**< The multisample state of the graphics pipeline. */ + SDL_GPUDepthStencilState depth_stencil_state; /**< The depth-stencil state of the graphics pipeline. */ + SDL_GPUGraphicsPipelineTargetInfo target_info; /**< Formats and blend modes for the render targets of the graphics pipeline. */ - SDL_PropertiesID props; + SDL_PropertiesID props; /**< A properties ID for extensions. Should be 0 if no extensions are needed. */ } SDL_GPUGraphicsPipelineCreateInfo; +/** + * A structure specifying the parameters of a compute pipeline state. + * + * \since This struct is available since SDL 3.0.0 + * + * \sa SDL_CreateGPUComputePipeline + */ typedef struct SDL_GPUComputePipelineCreateInfo { - size_t codeSize; - const Uint8 *code; - const char *entryPointName; - SDL_GPUShaderFormat format; - Uint32 readOnlyStorageTextureCount; - Uint32 readOnlyStorageBufferCount; - Uint32 writeOnlyStorageTextureCount; - Uint32 writeOnlyStorageBufferCount; - Uint32 uniformBufferCount; - Uint32 threadCountX; - Uint32 threadCountY; - Uint32 threadCountZ; + size_t code_size; /**< The size in bytes of the compute shader code pointed to. */ + const Uint8 *code; /**< A pointer to compute shader code. */ + const char *entrypoint; /**< A pointer to a null-terminated UTF-8 string specifying the entry point function name for the shader. */ + SDL_GPUShaderFormat format; /**< The format of the compute shader code. */ + Uint32 num_samplers; /**< The number of samplers defined in the shader. */ + Uint32 num_readonly_storage_textures; /**< The number of readonly storage textures defined in the shader. */ + Uint32 num_readonly_storage_buffers; /**< The number of readonly storage buffers defined in the shader. */ + Uint32 num_writeonly_storage_textures; /**< The number of writeonly storage textures defined in the shader. */ + Uint32 num_writeonly_storage_buffers; /**< The number of writeonly storage buffers defined in the shader. */ + Uint32 num_uniform_buffers; /**< The number of uniform buffers defined in the shader. */ + Uint32 threadcount_x; /**< The number of threads in the X dimension. This should match the value in the shader. */ + Uint32 threadcount_y; /**< The number of threads in the Y dimension. This should match the value in the shader. */ + Uint32 threadcount_z; /**< The number of threads in the Z dimension. This should match the value in the shader. */ - SDL_PropertiesID props; + SDL_PropertiesID props; /**< A properties ID for extensions. Should be 0 if no extensions are needed. */ } SDL_GPUComputePipelineCreateInfo; -typedef struct SDL_GPUColorAttachmentInfo +/** + * A structure specifying the parameters of a color target used by a render + * pass. + * + * The load_op field determines what is done with the texture at the beginning + * of the render pass. + * + * - LOAD: Loads the data currently in the texture. Not recommended for + * multisample textures as it requires significant memory bandwidth. + * - CLEAR: Clears the texture to a single color. + * - DONT_CARE: The driver will do whatever it wants with the texture memory. + * This is a good option if you know that every single pixel will be touched + * in the render pass. + * + * The store_op field determines what is done with the color results of the + * render pass. + * + * - STORE: Stores the results of the render pass in the texture. Not + * recommended for multisample textures as it requires significant memory + * bandwidth. + * - DONT_CARE: The driver will do whatever it wants with the texture memory. + * This is often a good option for depth/stencil textures. + * - RESOLVE: Resolves a multisample texture into resolve_texture, which must + * have a sample count of 1. Then the driver may discard the multisample + * texture memory. This is the most performant method of resolving a + * multisample target. + * - RESOLVE_AND_STORE: Resolves a multisample texture into the + * resolve_texture, which must have a sample count of 1. Then the driver + * stores the multisample texture's contents. Not recommended as it requires + * significant memory bandwidth. + * + * \since This struct is available since SDL 3.0.0 + * + * \sa SDL_BeginGPURenderPass + */ +typedef struct SDL_GPUColorTargetInfo { - /* The texture that will be used as a color attachment by a render pass. */ - SDL_GPUTexture *texture; - Uint32 mipLevel; - Uint32 layerOrDepthPlane; /* For 3D textures, you can bind an individual depth plane as an attachment. */ + SDL_GPUTexture *texture; /**< The texture that will be used as a color target by a render pass. */ + Uint32 mip_level; /**< The mip level to use as a color target. */ + Uint32 layer_or_depth_plane; /**< The layer index or depth plane to use as a color target. This value is treated as a layer index on 2D array and cube textures, and as a depth plane on 3D textures. */ + SDL_FColor clear_color; /**< The color to clear the color target to at the start of the render pass. Ignored if SDL_GPU_LOADOP_CLEAR is not used. */ + SDL_GPULoadOp load_op; /**< What is done with the contents of the color target at the beginning of the render pass. */ + SDL_GPUStoreOp store_op; /**< What is done with the results of the render pass. */ + SDL_GPUTexture *resolve_texture; /**< The texture that will receive the results of a multisample resolve operation. Ignored if a RESOLVE* store_op is not used. */ + Uint32 resolve_mip_level; /**< The mip level of the resolve texture to use for the resolve operation. Ignored if a RESOLVE* store_op is not used. */ + Uint32 resolve_layer; /**< The layer index of the resolve texture to use for the resolve operation. Ignored if a RESOLVE* store_op is not used. */ + bool cycle; /**< true cycles the texture if the texture is bound and load_op is not LOAD */ + bool cycle_resolve_texture; /**< true cycles the resolve texture if the resolve texture is bound. Ignored if a RESOLVE* store_op is not used. */ + Uint8 padding1; + Uint8 padding2; +} SDL_GPUColorTargetInfo; - /* Can be ignored by RenderPass if CLEAR is not used */ - SDL_FColor clearColor; - - /* Determines what is done with the texture at the beginning of the render pass. - * - * LOAD: - * Loads the data currently in the texture. - * - * CLEAR: - * Clears the texture to a single color. - * - * DONT_CARE: - * The driver will do whatever it wants with the texture memory. - * This is a good option if you know that every single pixel will be touched in the render pass. - */ - SDL_GPULoadOp loadOp; - - /* Determines what is done with the texture at the end of the render pass. - * - * STORE: - * Stores the results of the render pass in the texture. - * - * DONT_CARE: - * The driver will do whatever it wants with the texture memory. - * This is often a good option for depth/stencil textures. - */ - SDL_GPUStoreOp storeOp; - - /* if SDL_TRUE, cycles the texture if the texture is bound and loadOp is not LOAD */ - SDL_bool cycle; -} SDL_GPUColorAttachmentInfo; - -typedef struct SDL_GPUDepthStencilAttachmentInfo +/** + * A structure specifying the parameters of a depth-stencil target used by a + * render pass. + * + * The load_op field determines what is done with the depth contents of the + * texture at the beginning of the render pass. + * + * - LOAD: Loads the depth values currently in the texture. + * - CLEAR: Clears the texture to a single depth. + * - DONT_CARE: The driver will do whatever it wants with the memory. This is + * a good option if you know that every single pixel will be touched in the + * render pass. + * + * The store_op field determines what is done with the depth results of the + * render pass. + * + * - STORE: Stores the depth results in the texture. + * - DONT_CARE: The driver will do whatever it wants with the depth results. + * This is often a good option for depth/stencil textures that don't need to + * be reused again. + * + * The stencil_load_op field determines what is done with the stencil contents + * of the texture at the beginning of the render pass. + * + * - LOAD: Loads the stencil values currently in the texture. + * - CLEAR: Clears the stencil values to a single value. + * - DONT_CARE: The driver will do whatever it wants with the memory. This is + * a good option if you know that every single pixel will be touched in the + * render pass. + * + * The stencil_store_op field determines what is done with the stencil results + * of the render pass. + * + * - STORE: Stores the stencil results in the texture. + * - DONT_CARE: The driver will do whatever it wants with the stencil results. + * This is often a good option for depth/stencil textures that don't need to + * be reused again. + * + * Note that depth/stencil targets do not support multisample resolves. + * + * \since This struct is available since SDL 3.0.0 + * + * \sa SDL_BeginGPURenderPass + */ +typedef struct SDL_GPUDepthStencilTargetInfo { - /* The texture that will be used as the depth stencil attachment by a render pass. */ - SDL_GPUTexture *texture; - - /* Can be ignored by the render pass if CLEAR is not used */ - SDL_GPUDepthStencilValue depthStencilClearValue; - - /* Determines what is done with the depth values at the beginning of the render pass. - * - * LOAD: - * Loads the depth values currently in the texture. - * - * CLEAR: - * Clears the texture to a single depth. - * - * DONT_CARE: - * The driver will do whatever it wants with the memory. - * This is a good option if you know that every single pixel will be touched in the render pass. - */ - SDL_GPULoadOp loadOp; - - /* Determines what is done with the depth values at the end of the render pass. - * - * STORE: - * Stores the depth results in the texture. - * - * DONT_CARE: - * The driver will do whatever it wants with the texture memory. - * This is often a good option for depth/stencil textures. - */ - SDL_GPUStoreOp storeOp; - - /* Determines what is done with the stencil values at the beginning of the render pass. - * - * LOAD: - * Loads the stencil values currently in the texture. - * - * CLEAR: - * Clears the texture to a single stencil value. - * - * DONT_CARE: - * The driver will do whatever it wants with the memory. - * This is a good option if you know that every single pixel will be touched in the render pass. - */ - SDL_GPULoadOp stencilLoadOp; - - /* Determines what is done with the stencil values at the end of the render pass. - * - * STORE: - * Stores the stencil results in the texture. - * - * DONT_CARE: - * The driver will do whatever it wants with the texture memory. - * This is often a good option for depth/stencil textures. - */ - SDL_GPUStoreOp stencilStoreOp; - - /* if SDL_TRUE, cycles the texture if the texture is bound and any load ops are not LOAD */ - SDL_bool cycle; -} SDL_GPUDepthStencilAttachmentInfo; + SDL_GPUTexture *texture; /**< The texture that will be used as the depth stencil target by the render pass. */ + float clear_depth; /**< The value to clear the depth component to at the beginning of the render pass. Ignored if SDL_GPU_LOADOP_CLEAR is not used. */ + SDL_GPULoadOp load_op; /**< What is done with the depth contents at the beginning of the render pass. */ + SDL_GPUStoreOp store_op; /**< What is done with the depth results of the render pass. */ + SDL_GPULoadOp stencil_load_op; /**< What is done with the stencil contents at the beginning of the render pass. */ + SDL_GPUStoreOp stencil_store_op; /**< What is done with the stencil results of the render pass. */ + bool cycle; /**< true cycles the texture if the texture is bound and any load ops are not LOAD */ + Uint8 clear_stencil; /**< The value to clear the stencil component to at the beginning of the render pass. Ignored if SDL_GPU_LOADOP_CLEAR is not used. */ + Uint8 padding1; + Uint8 padding2; +} SDL_GPUDepthStencilTargetInfo; +/** + * A structure containing parameters for a blit command. + * + * \since This struct is available since SDL 3.0.0 + * + * \sa SDL_BlitGPUTexture + */ +typedef struct SDL_GPUBlitInfo { + SDL_GPUBlitRegion source; /**< The source region for the blit. */ + SDL_GPUBlitRegion destination; /**< The destination region for the blit. */ + SDL_GPULoadOp load_op; /**< What is done with the contents of the destination before the blit. */ + SDL_FColor clear_color; /**< The color to clear the destination region to before the blit. Ignored if load_op is not SDL_GPU_LOADOP_CLEAR. */ + SDL_FlipMode flip_mode; /**< The flip mode for the source region. */ + SDL_GPUFilter filter; /**< The filter mode used when blitting. */ + bool cycle; /**< true cycles the destination texture if it is already bound. */ + Uint8 padding1; + Uint8 padding2; + Uint8 padding3; +} SDL_GPUBlitInfo; /* Binding structs */ +/** + * A structure specifying parameters in a buffer binding call. + * + * \since This struct is available since SDL 3.0.0 + * + * \sa SDL_BindGPUVertexBuffers + * \sa SDL_BindGPUIndexBuffers + */ typedef struct SDL_GPUBufferBinding { - SDL_GPUBuffer *buffer; - Uint32 offset; + SDL_GPUBuffer *buffer; /**< The buffer to bind. Must have been created with SDL_GPU_BUFFERUSAGE_VERTEX for SDL_BindGPUVertexBuffers, or SDL_GPU_BUFFERUSAGE_INDEX for SDL_BindGPUIndexBuffers. */ + Uint32 offset; /**< The starting byte of the data to bind in the buffer. */ } SDL_GPUBufferBinding; +/** + * A structure specifying parameters in a sampler binding call. + * + * \since This struct is available since SDL 3.0.0 + * + * \sa SDL_BindGPUVertexSamplers + * \sa SDL_BindGPUFragmentSamplers + */ typedef struct SDL_GPUTextureSamplerBinding { - SDL_GPUTexture *texture; - SDL_GPUSampler *sampler; + SDL_GPUTexture *texture; /**< The texture to bind. Must have been created with SDL_GPU_TEXTUREUSAGE_SAMPLER. */ + SDL_GPUSampler *sampler; /**< The sampler to bind. */ } SDL_GPUTextureSamplerBinding; +/** + * A structure specifying parameters related to binding buffers in a compute + * pass. + * + * \since This struct is available since SDL 3.0.0 + * + * \sa SDL_BeginGPUComputePass + */ typedef struct SDL_GPUStorageBufferWriteOnlyBinding { - SDL_GPUBuffer *buffer; - - /* if SDL_TRUE, cycles the buffer if it is bound. */ - SDL_bool cycle; + SDL_GPUBuffer *buffer; /**< The buffer to bind. Must have been created with SDL_GPU_BUFFERUSAGE_COMPUTE_STORAGE_WRITE. */ + bool cycle; /**< true cycles the buffer if it is already bound. */ + Uint8 padding1; + Uint8 padding2; + Uint8 padding3; } SDL_GPUStorageBufferWriteOnlyBinding; +/** + * A structure specifying parameters related to binding textures in a compute + * pass. + * + * \since This struct is available since SDL 3.0.0 + * + * \sa SDL_BeginGPUComputePass + */ typedef struct SDL_GPUStorageTextureWriteOnlyBinding { - SDL_GPUTexture *texture; - Uint32 mipLevel; - Uint32 layer; - - /* if SDL_TRUE, cycles the texture if the texture is bound. */ - SDL_bool cycle; + SDL_GPUTexture *texture; /**< The texture to bind. Must have been created with SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_WRITE. */ + Uint32 mip_level; /**< The mip level index to bind. */ + Uint32 layer; /**< The layer index to bind. */ + bool cycle; /**< true cycles the texture if it is already bound. */ + Uint8 padding1; + Uint8 padding2; + Uint8 padding3; } SDL_GPUStorageTextureWriteOnlyBinding; /* Functions */ /* Device */ +/** + * Checks for GPU runtime support. + * + * \param format_flags a bitflag indicating which shader formats the app is + * able to provide. + * \param name the preferred GPU driver, or NULL to let SDL pick the optimal + * driver. + * \returns true if supported, false otherwise. + * + * \since This function is available since SDL 3.0.0. + * + * \sa SDL_CreateGPUDevice + */ +extern SDL_DECLSPEC bool SDLCALL SDL_GPUSupportsShaderFormats( + SDL_GPUShaderFormat format_flags, + const char *name); + +/** + * Checks for GPU runtime support. + * + * \param props the properties to use. + * \returns true if supported, false otherwise. + * + * \since This function is available since SDL 3.0.0. + * + * \sa SDL_CreateGPUDeviceWithProperties + */ +extern SDL_DECLSPEC bool SDLCALL SDL_GPUSupportsProperties( + SDL_PropertiesID props); + /** * Creates a GPU context. * - * \param formatFlags a bitflag indicating which shader formats the app is - * able to provide. - * \param debugMode enable debug mode properties and validations. + * \param format_flags a bitflag indicating which shader formats the app is + * able to provide. + * \param debug_mode enable debug mode properties and validations. * \param name the preferred GPU driver, or NULL to let SDL pick the optimal * driver. * \returns a GPU context on success or NULL on failure. * * \since This function is available since SDL 3.0.0. * - * \sa SDL_GetGPUDriver + * \sa SDL_GetGPUShaderFormats + * \sa SDL_GetGPUDeviceDriver * \sa SDL_DestroyGPUDevice + * \sa SDL_GPUSupportsShaderFormats */ extern SDL_DECLSPEC SDL_GPUDevice *SDLCALL SDL_CreateGPUDevice( - SDL_GPUShaderFormat formatFlags, - SDL_bool debugMode, + SDL_GPUShaderFormat format_flags, + bool debug_mode, const char *name); /** @@ -969,9 +1751,9 @@ extern SDL_DECLSPEC SDL_GPUDevice *SDLCALL SDL_CreateGPUDevice( * These are the supported properties: * * - `SDL_PROP_GPU_DEVICE_CREATE_DEBUGMODE_BOOL`: enable debug mode properties - * and validations, defaults to SDL_TRUE. + * and validations, defaults to true. * - `SDL_PROP_GPU_DEVICE_CREATE_PREFERLOWPOWER_BOOL`: enable to prefer energy - * efficiency over maximum GPU performance, defaults to SDL_FALSE. + * efficiency over maximum GPU performance, defaults to false. * - `SDL_PROP_GPU_DEVICE_CREATE_NAME_STRING`: the name of the GPU driver to * use, if a specific one is desired. * @@ -1000,8 +1782,10 @@ extern SDL_DECLSPEC SDL_GPUDevice *SDLCALL SDL_CreateGPUDevice( * * \since This function is available since SDL 3.0.0. * - * \sa SDL_GetGPUDriver + * \sa SDL_GetGPUShaderFormats + * \sa SDL_GetGPUDeviceDriver * \sa SDL_DestroyGPUDevice + * \sa SDL_GPUSupportsProperties */ extern SDL_DECLSPEC SDL_GPUDevice *SDLCALL SDL_CreateGPUDeviceWithProperties( SDL_PropertiesID props); @@ -1029,43 +1813,97 @@ extern SDL_DECLSPEC SDL_GPUDevice *SDLCALL SDL_CreateGPUDeviceWithProperties( extern SDL_DECLSPEC void SDLCALL SDL_DestroyGPUDevice(SDL_GPUDevice *device); /** - * Returns the backend used to create this GPU context. + * Get the number of GPU drivers compiled into SDL. + * + * \returns the number of built in GPU drivers. + * + * \since This function is available since SDL 3.0.0. + * + * \sa SDL_GetGPUDriver + */ +extern SDL_DECLSPEC int SDLCALL SDL_GetNumGPUDrivers(void); + +/** + * Get the name of a built in GPU driver. + * + * The GPU drivers are presented in the order in which they are normally + * checked during initialization. + * + * The names of drivers are all simple, low-ASCII identifiers, like "vulkan", + * "metal" or "direct3d12". These never have Unicode characters, and are not + * meant to be proper names. + * + * \param index the index of a GPU driver. + * \returns the name of the GPU driver with the given **index**. + * + * \since This function is available since SDL 3.0.0. + * + * \sa SDL_GetNumGPUDrivers + */ +extern SDL_DECLSPEC const char * SDLCALL SDL_GetGPUDriver(int index); + +/** + * Returns the name of the backend used to create this GPU context. * * \param device a GPU context to query. - * \returns an SDL_GPUDriver value, or SDL_GPU_DRIVER_INVALID on error. + * \returns the name of the device's driver, or NULL on error. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_GPUDriver SDLCALL SDL_GetGPUDriver(SDL_GPUDevice *device); +extern SDL_DECLSPEC const char * SDLCALL SDL_GetGPUDeviceDriver(SDL_GPUDevice *device); + +/** + * Returns the supported shader formats for this GPU context. + * + * \param device a GPU context to query. + * \returns a bitflag indicating which shader formats the driver is able to + * consume. + * + * \since This function is available since SDL 3.0.0. + */ +extern SDL_DECLSPEC SDL_GPUShaderFormat SDLCALL SDL_GetGPUShaderFormats(SDL_GPUDevice *device); /* State Creation */ /** * Creates a pipeline object to be used in a compute workflow. * - * Shader resource bindings must be authored to follow a particular order. For - * SPIR-V shaders, use the following resource sets: 0: Read-only storage - * textures, followed by read-only storage buffers 1: Write-only storage - * textures, followed by write-only storage buffers 2: Uniform buffers + * Shader resource bindings must be authored to follow a particular order + * depending on the shader format. * - * For DXBC Shader Model 5_0 shaders, use the following register order: For t - * registers: Read-only storage textures, followed by read-only storage - * buffers For u registers: Write-only storage textures, followed by - * write-only storage buffers For b registers: Uniform buffers + * For SPIR-V shaders, use the following resource sets: * - * For DXIL shaders, use the following register order: (t[n], space0): - * Read-only storage textures, followed by read-only storage buffers (u[n], - * space1): Write-only storage textures, followed by write-only storage - * buffers (b[n], space2): Uniform buffers + * - 0: Sampled textures, followed by read-only storage textures, followed by + * read-only storage buffers + * - 1: Write-only storage textures, followed by write-only storage buffers + * - 2: Uniform buffers * - * For MSL/metallib, use the following order: For [[buffer]]: Uniform buffers, - * followed by write-only storage buffers, followed by write-only storage - * buffers For [[texture]]: Read-only storage textures, followed by write-only - * storage textures + * For DXBC Shader Model 5_0 shaders, use the following register order: + * + * - t registers: Sampled textures, followed by read-only storage textures, + * followed by read-only storage buffers + * - u registers: Write-only storage textures, followed by write-only storage + * buffers + * - b registers: Uniform buffers + * + * For DXIL shaders, use the following register order: + * + * - (t[n], space0): Sampled textures, followed by read-only storage textures, + * followed by read-only storage buffers + * - (u[n], space1): Write-only storage textures, followed by write-only + * storage buffers + * - (b[n], space2): Uniform buffers + * + * For MSL/metallib, use the following order: + * + * - [[buffer]]: Uniform buffers, followed by write-only storage buffers, + * followed by write-only storage buffers + * - [[texture]]: Sampled textures, followed by read-only storage textures, + * followed by write-only storage textures * * \param device a GPU Context. - * \param computePipelineCreateInfo a struct describing the state of the - * requested compute pipeline. + * \param createinfo a struct describing the state of the compute pipeline to + * create. * \returns a compute pipeline object on success, or NULL on failure. * * \since This function is available since SDL 3.0.0. @@ -1075,14 +1913,14 @@ extern SDL_DECLSPEC SDL_GPUDriver SDLCALL SDL_GetGPUDriver(SDL_GPUDevice *device */ extern SDL_DECLSPEC SDL_GPUComputePipeline *SDLCALL SDL_CreateGPUComputePipeline( SDL_GPUDevice *device, - SDL_GPUComputePipelineCreateInfo *computePipelineCreateInfo); + const SDL_GPUComputePipelineCreateInfo *createinfo); /** * Creates a pipeline object to be used in a graphics workflow. * * \param device a GPU Context. - * \param pipelineCreateInfo a struct describing the state of the desired - * graphics pipeline. + * \param createinfo a struct describing the state of the graphics pipeline to + * create. * \returns a graphics pipeline object on success, or NULL on failure. * * \since This function is available since SDL 3.0.0. @@ -1093,15 +1931,14 @@ extern SDL_DECLSPEC SDL_GPUComputePipeline *SDLCALL SDL_CreateGPUComputePipeline */ extern SDL_DECLSPEC SDL_GPUGraphicsPipeline *SDLCALL SDL_CreateGPUGraphicsPipeline( SDL_GPUDevice *device, - SDL_GPUGraphicsPipelineCreateInfo *pipelineCreateInfo); + const SDL_GPUGraphicsPipelineCreateInfo *createinfo); /** * Creates a sampler object to be used when binding textures in a graphics * workflow. * * \param device a GPU Context. - * \param samplerCreateInfo a struct describing the state of the desired - * sampler. + * \param createinfo a struct describing the state of the sampler to create. * \returns a sampler object on success, or NULL on failure. * * \since This function is available since SDL 3.0.0. @@ -1112,7 +1949,7 @@ extern SDL_DECLSPEC SDL_GPUGraphicsPipeline *SDLCALL SDL_CreateGPUGraphicsPipeli */ extern SDL_DECLSPEC SDL_GPUSampler *SDLCALL SDL_CreateGPUSampler( SDL_GPUDevice *device, - SDL_GPUSamplerCreateInfo *samplerCreateInfo); + const SDL_GPUSamplerCreateInfo *createinfo); /** * Creates a shader to be used when creating a graphics pipeline. @@ -1120,36 +1957,57 @@ extern SDL_DECLSPEC SDL_GPUSampler *SDLCALL SDL_CreateGPUSampler( * Shader resource bindings must be authored to follow a particular order * depending on the shader format. * - * For SPIR-V shaders, use the following resource sets: For vertex shaders: 0: - * Sampled textures, followed by storage textures, followed by storage buffers - * 1: Uniform buffers For fragment shaders: 2: Sampled textures, followed by - * storage textures, followed by storage buffers 3: Uniform buffers + * For SPIR-V shaders, use the following resource sets: * - * For DXBC Shader Model 5_0 shaders, use the following register order: For t - * registers: Sampled textures, followed by storage textures, followed by - * storage buffers For s registers: Samplers with indices corresponding to the - * sampled textures For b registers: Uniform buffers + * For vertex shaders: * - * For DXIL shaders, use the following register order: For vertex shaders: - * (t[n], space0): Sampled textures, followed by storage textures, followed by - * storage buffers (s[n], space0): Samplers with indices corresponding to the - * sampled textures (b[n], space1): Uniform buffers For pixel shaders: (t[n], - * space2): Sampled textures, followed by storage textures, followed by - * storage buffers (s[n], space2): Samplers with indices corresponding to the - * sampled textures (b[n], space3): Uniform buffers + * - 0: Sampled textures, followed by storage textures, followed by storage + * buffers + * - 1: Uniform buffers * - * For MSL/metallib, use the following order: For [[texture]]: Sampled - * textures, followed by storage textures For [[sampler]]: Samplers with - * indices corresponding to the sampled textures For [[buffer]]: Uniform - * buffers, followed by storage buffers. Vertex buffer 0 is bound at - * [[buffer(30)]], vertex buffer 1 at [[buffer(29)]], and so on. Rather than - * manually authoring vertex buffer indices, use the [[stage_in]] attribute - * which will automatically use the vertex input information from the - * SDL_GPUPipeline. + * For fragment shaders: + * + * - 2: Sampled textures, followed by storage textures, followed by storage + * buffers + * - 3: Uniform buffers + * + * For DXBC Shader Model 5_0 shaders, use the following register order: + * + * - t registers: Sampled textures, followed by storage textures, followed by + * storage buffers + * - s registers: Samplers with indices corresponding to the sampled textures + * - b registers: Uniform buffers + * + * For DXIL shaders, use the following register order: + * + * For vertex shaders: + * + * - (t[n], space0): Sampled textures, followed by storage textures, followed + * by storage buffers + * - (s[n], space0): Samplers with indices corresponding to the sampled + * textures + * - (b[n], space1): Uniform buffers + * + * For pixel shaders: + * + * - (t[n], space2): Sampled textures, followed by storage textures, followed + * by storage buffers + * - (s[n], space2): Samplers with indices corresponding to the sampled + * textures + * - (b[n], space3): Uniform buffers + * + * For MSL/metallib, use the following order: + * + * - [[texture]]: Sampled textures, followed by storage textures + * - [[sampler]]: Samplers with indices corresponding to the sampled textures + * - [[buffer]]: Uniform buffers, followed by storage buffers. Vertex buffer 0 + * is bound at [[buffer(14)]], vertex buffer 1 at [[buffer(15)]], and so on. + * Rather than manually authoring vertex buffer indices, use the + * [[stage_in]] attribute which will automatically use the vertex input + * information from the SDL_GPUPipeline. * * \param device a GPU Context. - * \param shaderCreateInfo a struct describing the state of the desired - * shader. + * \param createinfo a struct describing the state of the shader to create. * \returns a shader object on success, or NULL on failure. * * \since This function is available since SDL 3.0.0. @@ -1159,7 +2017,7 @@ extern SDL_DECLSPEC SDL_GPUSampler *SDLCALL SDL_CreateGPUSampler( */ extern SDL_DECLSPEC SDL_GPUShader *SDLCALL SDL_CreateGPUShader( SDL_GPUDevice *device, - SDL_GPUShaderCreateInfo *shaderCreateInfo); + const SDL_GPUShaderCreateInfo *createinfo); /** * Creates a texture object to be used in graphics or compute workflows. @@ -1175,8 +2033,7 @@ extern SDL_DECLSPEC SDL_GPUShader *SDLCALL SDL_CreateGPUShader( * count. * * \param device a GPU Context. - * \param textureCreateInfo a struct describing the state of the texture to - * create. + * \param createinfo a struct describing the state of the texture to create. * \returns a texture object on success, or NULL on failure. * * \since This function is available since SDL 3.0.0. @@ -1194,7 +2051,7 @@ extern SDL_DECLSPEC SDL_GPUShader *SDLCALL SDL_CreateGPUShader( */ extern SDL_DECLSPEC SDL_GPUTexture *SDLCALL SDL_CreateGPUTexture( SDL_GPUDevice *device, - SDL_GPUTextureCreateInfo *textureCreateInfo); + const SDL_GPUTextureCreateInfo *createinfo); /** * Creates a buffer object to be used in graphics or compute workflows. @@ -1206,31 +2063,36 @@ extern SDL_DECLSPEC SDL_GPUTexture *SDLCALL SDL_CreateGPUTexture( * buffer cannot have both the VERTEX and INDEX flags. * * \param device a GPU Context. - * \param bufferCreateInfo a struct describing the state of the buffer to - * create. + * \param createinfo a struct describing the state of the buffer to create. * \returns a buffer object on success, or NULL on failure. * * \since This function is available since SDL 3.0.0. * + * \sa SDL_SetGPUBufferName * \sa SDL_UploadToGPUBuffer + * \sa SDL_DownloadFromGPUBuffer + * \sa SDL_CopyGPUBufferToBuffer * \sa SDL_BindGPUVertexBuffers * \sa SDL_BindGPUIndexBuffer * \sa SDL_BindGPUVertexStorageBuffers * \sa SDL_BindGPUFragmentStorageBuffers + * \sa SDL_DrawGPUPrimitivesIndirect + * \sa SDL_DrawGPUIndexedPrimitivesIndirect * \sa SDL_BindGPUComputeStorageBuffers + * \sa SDL_DispatchGPUComputeIndirect * \sa SDL_ReleaseGPUBuffer */ extern SDL_DECLSPEC SDL_GPUBuffer *SDLCALL SDL_CreateGPUBuffer( SDL_GPUDevice *device, - SDL_GPUBufferCreateInfo *bufferCreateInfo); + const SDL_GPUBufferCreateInfo *createinfo); /** * Creates a transfer buffer to be used when uploading to or downloading from * graphics resources. * * \param device a GPU Context. - * \param transferBufferCreateInfo a struct describing the state of the - * transfer buffer to create. + * \param createinfo a struct describing the state of the transfer buffer to + * create. * \returns a transfer buffer on success, or NULL on failure. * * \since This function is available since SDL 3.0.0. @@ -1243,7 +2105,7 @@ extern SDL_DECLSPEC SDL_GPUBuffer *SDLCALL SDL_CreateGPUBuffer( */ extern SDL_DECLSPEC SDL_GPUTransferBuffer *SDLCALL SDL_CreateGPUTransferBuffer( SDL_GPUDevice *device, - SDL_GPUTransferBufferCreateInfo *transferBufferCreateInfo); + const SDL_GPUTransferBufferCreateInfo *createinfo); /* Debug Naming */ @@ -1284,13 +2146,13 @@ extern SDL_DECLSPEC void SDLCALL SDL_SetGPUTextureName( * * Useful for debugging. * - * \param commandBuffer a command buffer. + * \param command_buffer a command buffer. * \param text a UTF-8 string constant to insert as the label. * * \since This function is available since SDL 3.0.0. */ extern SDL_DECLSPEC void SDLCALL SDL_InsertGPUDebugLabel( - SDL_GPUCommandBuffer *commandBuffer, + SDL_GPUCommandBuffer *command_buffer, const char *text); /** @@ -1307,7 +2169,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_InsertGPUDebugLabel( * pass rather than the command buffer. For best results, if you push a debug * group during a pass, always pop it in the same pass. * - * \param commandBuffer a command buffer. + * \param command_buffer a command buffer. * \param name a UTF-8 string constant that names the group. * * \since This function is available since SDL 3.0.0. @@ -1315,20 +2177,20 @@ extern SDL_DECLSPEC void SDLCALL SDL_InsertGPUDebugLabel( * \sa SDL_PopGPUDebugGroup */ extern SDL_DECLSPEC void SDLCALL SDL_PushGPUDebugGroup( - SDL_GPUCommandBuffer *commandBuffer, + SDL_GPUCommandBuffer *command_buffer, const char *name); /** * Ends the most-recently pushed debug group. * - * \param commandBuffer a command buffer. + * \param command_buffer a command buffer. * * \since This function is available since SDL 3.0.0. * * \sa SDL_PushGPUDebugGroup */ extern SDL_DECLSPEC void SDLCALL SDL_PopGPUDebugGroup( - SDL_GPUCommandBuffer *commandBuffer); + SDL_GPUCommandBuffer *command_buffer); /* Disposal */ @@ -1349,7 +2211,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_ReleaseGPUTexture( /** * Frees the given sampler as soon as it is safe to do so. * - * You must not reference the texture after calling this function. + * You must not reference the sampler after calling this function. * * \param device a GPU context. * \param sampler a sampler to be destroyed. @@ -1380,13 +2242,13 @@ extern SDL_DECLSPEC void SDLCALL SDL_ReleaseGPUBuffer( * You must not reference the transfer buffer after calling this function. * * \param device a GPU context. - * \param transferBuffer a transfer buffer to be destroyed. + * \param transfer_buffer a transfer buffer to be destroyed. * * \since This function is available since SDL 3.0.0. */ extern SDL_DECLSPEC void SDLCALL SDL_ReleaseGPUTransferBuffer( SDL_GPUDevice *device, - SDL_GPUTransferBuffer *transferBuffer); + SDL_GPUTransferBuffer *transfer_buffer); /** * Frees the given compute pipeline as soon as it is safe to do so. @@ -1394,13 +2256,13 @@ extern SDL_DECLSPEC void SDLCALL SDL_ReleaseGPUTransferBuffer( * You must not reference the compute pipeline after calling this function. * * \param device a GPU context. - * \param computePipeline a compute pipeline to be destroyed. + * \param compute_pipeline a compute pipeline to be destroyed. * * \since This function is available since SDL 3.0.0. */ extern SDL_DECLSPEC void SDLCALL SDL_ReleaseGPUComputePipeline( SDL_GPUDevice *device, - SDL_GPUComputePipeline *computePipeline); + SDL_GPUComputePipeline *compute_pipeline); /** * Frees the given shader as soon as it is safe to do so. @@ -1422,29 +2284,13 @@ extern SDL_DECLSPEC void SDLCALL SDL_ReleaseGPUShader( * You must not reference the graphics pipeline after calling this function. * * \param device a GPU context. - * \param graphicsPipeline a graphics pipeline to be destroyed. + * \param graphics_pipeline a graphics pipeline to be destroyed. * * \since This function is available since SDL 3.0.0. */ extern SDL_DECLSPEC void SDLCALL SDL_ReleaseGPUGraphicsPipeline( SDL_GPUDevice *device, - SDL_GPUGraphicsPipeline *graphicsPipeline); - -/* - * COMMAND BUFFERS - * - * Render state is managed via command buffers. - * When setting render state, that state is always local to the command buffer. - * - * Commands only begin execution on the GPU once Submit is called. - * Once the command buffer is submitted, it is no longer valid to use it. - * - * Command buffers are executed in submission order. If you submit command buffer A and then command buffer B - * all commands in A will begin executing before any command in B begins executing. - * - * In multi-threading scenarios, you should acquire and submit a command buffer on the same thread. - * As long as you satisfy this requirement, all functionality related to command buffers is thread-safe. - */ + SDL_GPUGraphicsPipeline *graphics_pipeline); /** * Acquire a command buffer. @@ -1490,54 +2336,54 @@ extern SDL_DECLSPEC SDL_GPUCommandBuffer *SDLCALL SDL_AcquireGPUCommandBuffer( * * Subsequent draw calls will use this uniform data. * - * \param commandBuffer a command buffer. - * \param slotIndex the vertex uniform slot to push data to. + * \param command_buffer a command buffer. + * \param slot_index the vertex uniform slot to push data to. * \param data client data to write. - * \param dataLengthInBytes the length of the data to write. + * \param length the length of the data to write. * * \since This function is available since SDL 3.0.0. */ extern SDL_DECLSPEC void SDLCALL SDL_PushGPUVertexUniformData( - SDL_GPUCommandBuffer *commandBuffer, - Uint32 slotIndex, + SDL_GPUCommandBuffer *command_buffer, + Uint32 slot_index, const void *data, - Uint32 dataLengthInBytes); + Uint32 length); /** * Pushes data to a fragment uniform slot on the command buffer. * * Subsequent draw calls will use this uniform data. * - * \param commandBuffer a command buffer. - * \param slotIndex the fragment uniform slot to push data to. + * \param command_buffer a command buffer. + * \param slot_index the fragment uniform slot to push data to. * \param data client data to write. - * \param dataLengthInBytes the length of the data to write. + * \param length the length of the data to write. * * \since This function is available since SDL 3.0.0. */ extern SDL_DECLSPEC void SDLCALL SDL_PushGPUFragmentUniformData( - SDL_GPUCommandBuffer *commandBuffer, - Uint32 slotIndex, + SDL_GPUCommandBuffer *command_buffer, + Uint32 slot_index, const void *data, - Uint32 dataLengthInBytes); + Uint32 length); /** * Pushes data to a uniform slot on the command buffer. * * Subsequent draw calls will use this uniform data. * - * \param commandBuffer a command buffer. - * \param slotIndex the uniform slot to push data to. + * \param command_buffer a command buffer. + * \param slot_index the uniform slot to push data to. * \param data client data to write. - * \param dataLengthInBytes the length of the data to write. + * \param length the length of the data to write. * * \since This function is available since SDL 3.0.0. */ extern SDL_DECLSPEC void SDLCALL SDL_PushGPUComputeUniformData( - SDL_GPUCommandBuffer *commandBuffer, - Uint32 slotIndex, + SDL_GPUCommandBuffer *command_buffer, + Uint32 slot_index, const void *data, - Uint32 dataLengthInBytes); + Uint32 length); /* * A NOTE ON CYCLING @@ -1554,16 +2400,16 @@ extern SDL_DECLSPEC void SDLCALL SDL_PushGPUComputeUniformData( * * All of the functions and structs that involve writing to a resource have a "cycle" bool. * GPUTransferBuffer, GPUBuffer, and GPUTexture all effectively function as ring buffers on internal resources. - * When cycle is SDL_TRUE, if the resource is bound, the cycle rotates to the next unbound internal resource, + * When cycle is true, if the resource is bound, the cycle rotates to the next unbound internal resource, * or if none are available, a new one is created. * This means you don't have to worry about complex state tracking and synchronization as long as cycling is correctly employed. * * For example: you can call MapTransferBuffer, write texture data, UnmapTransferBuffer, and then UploadToTexture. - * The next time you write texture data to the transfer buffer, if you set the cycle param to SDL_TRUE, you don't have + * The next time you write texture data to the transfer buffer, if you set the cycle param to true, you don't have * to worry about overwriting any data that is not yet uploaded. * * Another example: If you are using a texture in a render pass every frame, this can cause a data dependency between frames. - * If you set cycle to SDL_TRUE in the ColorAttachmentInfo struct, you can prevent this data dependency. + * If you set cycle to true in the SDL_GPUColorTargetInfo struct, you can prevent this data dependency. * * Cycling will never undefine already bound data. * When cycling, all data in the resource is considered to be undefined for subsequent commands until that data is written again. @@ -1591,14 +2437,14 @@ extern SDL_DECLSPEC void SDLCALL SDL_PushGPUComputeUniformData( * is called. You cannot begin another render pass, or begin a compute pass or * copy pass until you have ended the render pass. * - * \param commandBuffer a command buffer. - * \param colorAttachmentInfos an array of texture subresources with - * corresponding clear values and load/store ops. - * \param colorAttachmentCount the number of color attachments in the - * colorAttachmentInfos array. - * \param depthStencilAttachmentInfo a texture subresource with corresponding - * clear value and load/store ops, may be - * NULL. + * \param command_buffer a command buffer. + * \param color_target_infos an array of texture subresources with + * corresponding clear values and load/store ops. + * \param num_color_targets the number of color targets in the + * color_target_infos array. + * \param depth_stencil_target_info a texture subresource with corresponding + * clear value and load/store ops, may be + * NULL. * \returns a render pass handle. * * \since This function is available since SDL 3.0.0. @@ -1606,102 +2452,129 @@ extern SDL_DECLSPEC void SDLCALL SDL_PushGPUComputeUniformData( * \sa SDL_EndGPURenderPass */ extern SDL_DECLSPEC SDL_GPURenderPass *SDLCALL SDL_BeginGPURenderPass( - SDL_GPUCommandBuffer *commandBuffer, - SDL_GPUColorAttachmentInfo *colorAttachmentInfos, - Uint32 colorAttachmentCount, - SDL_GPUDepthStencilAttachmentInfo *depthStencilAttachmentInfo); + SDL_GPUCommandBuffer *command_buffer, + const SDL_GPUColorTargetInfo *color_target_infos, + Uint32 num_color_targets, + const SDL_GPUDepthStencilTargetInfo *depth_stencil_target_info); /** * Binds a graphics pipeline on a render pass to be used in rendering. * * A graphics pipeline must be bound before making any draw calls. * - * \param renderPass a render pass handle. - * \param graphicsPipeline the graphics pipeline to bind. + * \param render_pass a render pass handle. + * \param graphics_pipeline the graphics pipeline to bind. * * \since This function is available since SDL 3.0.0. */ extern SDL_DECLSPEC void SDLCALL SDL_BindGPUGraphicsPipeline( - SDL_GPURenderPass *renderPass, - SDL_GPUGraphicsPipeline *graphicsPipeline); + SDL_GPURenderPass *render_pass, + SDL_GPUGraphicsPipeline *graphics_pipeline); /** * Sets the current viewport state on a command buffer. * - * \param renderPass a render pass handle. + * \param render_pass a render pass handle. * \param viewport the viewport to set. * * \since This function is available since SDL 3.0.0. */ extern SDL_DECLSPEC void SDLCALL SDL_SetGPUViewport( - SDL_GPURenderPass *renderPass, - SDL_GPUViewport *viewport); + SDL_GPURenderPass *render_pass, + const SDL_GPUViewport *viewport); /** * Sets the current scissor state on a command buffer. * - * \param renderPass a render pass handle. + * \param render_pass a render pass handle. * \param scissor the scissor area to set. * * \since This function is available since SDL 3.0.0. */ extern SDL_DECLSPEC void SDLCALL SDL_SetGPUScissor( - SDL_GPURenderPass *renderPass, - SDL_Rect *scissor); + SDL_GPURenderPass *render_pass, + const SDL_Rect *scissor); + +/** + * Sets the current blend constants on a command buffer. + * + * \param render_pass a render pass handle. + * \param blend_constants the blend constant color. + * + * \since This function is available since SDL 3.0.0. + * + * \sa SDL_GPU_BLENDFACTOR_CONSTANT_COLOR + * \sa SDL_GPU_BLENDFACTOR_ONE_MINUS_CONSTANT_COLOR + */ +extern SDL_DECLSPEC void SDLCALL SDL_SetGPUBlendConstants( + SDL_GPURenderPass *render_pass, + SDL_FColor blend_constants); + +/** + * Sets the current stencil reference value on a command buffer. + * + * \param render_pass a render pass handle. + * \param reference the stencil reference value to set. + * + * \since This function is available since SDL 3.0.0. + */ +extern SDL_DECLSPEC void SDLCALL SDL_SetGPUStencilReference( + SDL_GPURenderPass *render_pass, + Uint8 reference); /** * Binds vertex buffers on a command buffer for use with subsequent draw * calls. * - * \param renderPass a render pass handle. - * \param firstBinding the starting bind point for the vertex buffers. - * \param pBindings an array of SDL_GPUBufferBinding structs containing vertex - * buffers and offset values. - * \param bindingCount the number of bindings in the pBindings array. + * \param render_pass a render pass handle. + * \param first_slot the vertex buffer slot to begin binding from. + * \param bindings an array of SDL_GPUBufferBinding structs containing vertex + * buffers and offset values. + * \param num_bindings the number of bindings in the bindings array. * * \since This function is available since SDL 3.0.0. */ extern SDL_DECLSPEC void SDLCALL SDL_BindGPUVertexBuffers( - SDL_GPURenderPass *renderPass, - Uint32 firstBinding, - SDL_GPUBufferBinding *pBindings, - Uint32 bindingCount); + SDL_GPURenderPass *render_pass, + Uint32 first_slot, + const SDL_GPUBufferBinding *bindings, + Uint32 num_bindings); /** * Binds an index buffer on a command buffer for use with subsequent draw * calls. * - * \param renderPass a render pass handle. - * \param pBinding a pointer to a struct containing an index buffer and - * offset. - * \param indexElementSize whether the index values in the buffer are 16- or - * 32-bit. + * \param render_pass a render pass handle. + * \param binding a pointer to a struct containing an index buffer and offset. + * \param index_element_size whether the index values in the buffer are 16- or + * 32-bit. * * \since This function is available since SDL 3.0.0. */ extern SDL_DECLSPEC void SDLCALL SDL_BindGPUIndexBuffer( - SDL_GPURenderPass *renderPass, - SDL_GPUBufferBinding *pBinding, - SDL_GPUIndexElementSize indexElementSize); + SDL_GPURenderPass *render_pass, + const SDL_GPUBufferBinding *binding, + SDL_GPUIndexElementSize index_element_size); /** * Binds texture-sampler pairs for use on the vertex shader. * * The textures must have been created with SDL_GPU_TEXTUREUSAGE_SAMPLER. * - * \param renderPass a render pass handle. - * \param firstSlot the vertex sampler slot to begin binding from. - * \param textureSamplerBindings an array of texture-sampler binding structs. - * \param bindingCount the number of texture-sampler pairs to bind from the + * \param render_pass a render pass handle. + * \param first_slot the vertex sampler slot to begin binding from. + * \param texture_sampler_bindings an array of texture-sampler binding + * structs. + * \param num_bindings the number of texture-sampler pairs to bind from the * array. * * \since This function is available since SDL 3.0.0. */ extern SDL_DECLSPEC void SDLCALL SDL_BindGPUVertexSamplers( - SDL_GPURenderPass *renderPass, - Uint32 firstSlot, - SDL_GPUTextureSamplerBinding *textureSamplerBindings, - Uint32 bindingCount); + SDL_GPURenderPass *render_pass, + Uint32 first_slot, + const SDL_GPUTextureSamplerBinding *texture_sampler_bindings, + Uint32 num_bindings); /** * Binds storage textures for use on the vertex shader. @@ -1709,18 +2582,18 @@ extern SDL_DECLSPEC void SDLCALL SDL_BindGPUVertexSamplers( * These textures must have been created with * SDL_GPU_TEXTUREUSAGE_GRAPHICS_STORAGE_READ. * - * \param renderPass a render pass handle. - * \param firstSlot the vertex storage texture slot to begin binding from. - * \param storageTextures an array of storage textures. - * \param bindingCount the number of storage texture to bind from the array. + * \param render_pass a render pass handle. + * \param first_slot the vertex storage texture slot to begin binding from. + * \param storage_textures an array of storage textures. + * \param num_bindings the number of storage texture to bind from the array. * * \since This function is available since SDL 3.0.0. */ extern SDL_DECLSPEC void SDLCALL SDL_BindGPUVertexStorageTextures( - SDL_GPURenderPass *renderPass, - Uint32 firstSlot, - SDL_GPUTexture **storageTextures, - Uint32 bindingCount); + SDL_GPURenderPass *render_pass, + Uint32 first_slot, + SDL_GPUTexture *const *storage_textures, + Uint32 num_bindings); /** * Binds storage buffers for use on the vertex shader. @@ -1728,37 +2601,38 @@ extern SDL_DECLSPEC void SDLCALL SDL_BindGPUVertexStorageTextures( * These buffers must have been created with * SDL_GPU_BUFFERUSAGE_GRAPHICS_STORAGE_READ. * - * \param renderPass a render pass handle. - * \param firstSlot the vertex storage buffer slot to begin binding from. - * \param storageBuffers an array of buffers. - * \param bindingCount the number of buffers to bind from the array. + * \param render_pass a render pass handle. + * \param first_slot the vertex storage buffer slot to begin binding from. + * \param storage_buffers an array of buffers. + * \param num_bindings the number of buffers to bind from the array. * * \since This function is available since SDL 3.0.0. */ extern SDL_DECLSPEC void SDLCALL SDL_BindGPUVertexStorageBuffers( - SDL_GPURenderPass *renderPass, - Uint32 firstSlot, - SDL_GPUBuffer **storageBuffers, - Uint32 bindingCount); + SDL_GPURenderPass *render_pass, + Uint32 first_slot, + SDL_GPUBuffer *const *storage_buffers, + Uint32 num_bindings); /** * Binds texture-sampler pairs for use on the fragment shader. * * The textures must have been created with SDL_GPU_TEXTUREUSAGE_SAMPLER. * - * \param renderPass a render pass handle. - * \param firstSlot the fragment sampler slot to begin binding from. - * \param textureSamplerBindings an array of texture-sampler binding structs. - * \param bindingCount the number of texture-sampler pairs to bind from the + * \param render_pass a render pass handle. + * \param first_slot the fragment sampler slot to begin binding from. + * \param texture_sampler_bindings an array of texture-sampler binding + * structs. + * \param num_bindings the number of texture-sampler pairs to bind from the * array. * * \since This function is available since SDL 3.0.0. */ extern SDL_DECLSPEC void SDLCALL SDL_BindGPUFragmentSamplers( - SDL_GPURenderPass *renderPass, - Uint32 firstSlot, - SDL_GPUTextureSamplerBinding *textureSamplerBindings, - Uint32 bindingCount); + SDL_GPURenderPass *render_pass, + Uint32 first_slot, + const SDL_GPUTextureSamplerBinding *texture_sampler_bindings, + Uint32 num_bindings); /** * Binds storage textures for use on the fragment shader. @@ -1766,18 +2640,18 @@ extern SDL_DECLSPEC void SDLCALL SDL_BindGPUFragmentSamplers( * These textures must have been created with * SDL_GPU_TEXTUREUSAGE_GRAPHICS_STORAGE_READ. * - * \param renderPass a render pass handle. - * \param firstSlot the fragment storage texture slot to begin binding from. - * \param storageTextures an array of storage textures. - * \param bindingCount the number of storage textures to bind from the array. + * \param render_pass a render pass handle. + * \param first_slot the fragment storage texture slot to begin binding from. + * \param storage_textures an array of storage textures. + * \param num_bindings the number of storage textures to bind from the array. * * \since This function is available since SDL 3.0.0. */ extern SDL_DECLSPEC void SDLCALL SDL_BindGPUFragmentStorageTextures( - SDL_GPURenderPass *renderPass, - Uint32 firstSlot, - SDL_GPUTexture **storageTextures, - Uint32 bindingCount); + SDL_GPURenderPass *render_pass, + Uint32 first_slot, + SDL_GPUTexture *const *storage_textures, + Uint32 num_bindings); /** * Binds storage buffers for use on the fragment shader. @@ -1785,18 +2659,18 @@ extern SDL_DECLSPEC void SDLCALL SDL_BindGPUFragmentStorageTextures( * These buffers must have been created with * SDL_GPU_BUFFERUSAGE_GRAPHICS_STORAGE_READ. * - * \param renderPass a render pass handle. - * \param firstSlot the fragment storage buffer slot to begin binding from. - * \param storageBuffers an array of storage buffers. - * \param bindingCount the number of storage buffers to bind from the array. + * \param render_pass a render pass handle. + * \param first_slot the fragment storage buffer slot to begin binding from. + * \param storage_buffers an array of storage buffers. + * \param num_bindings the number of storage buffers to bind from the array. * * \since This function is available since SDL 3.0.0. */ extern SDL_DECLSPEC void SDLCALL SDL_BindGPUFragmentStorageBuffers( - SDL_GPURenderPass *renderPass, - Uint32 firstSlot, - SDL_GPUBuffer **storageBuffers, - Uint32 bindingCount); + SDL_GPURenderPass *render_pass, + Uint32 first_slot, + SDL_GPUBuffer *const *storage_buffers, + Uint32 num_bindings); /* Drawing */ @@ -1806,100 +2680,97 @@ extern SDL_DECLSPEC void SDLCALL SDL_BindGPUFragmentStorageBuffers( * * You must not call this function before binding a graphics pipeline. * - * Note that the `firstVertex` and `firstInstance` parameters are NOT + * Note that the `first_vertex` and `first_instance` parameters are NOT * compatible with built-in vertex/instance ID variables in shaders (for * example, SV_VertexID). If your shader depends on these variables, the * correlating draw call parameter MUST be 0. * - * \param renderPass a render pass handle. - * \param indexCount the number of vertices to draw per instance. - * \param instanceCount the number of instances to draw. - * \param firstIndex the starting index within the index buffer. - * \param vertexOffset value added to vertex index before indexing into the - * vertex buffer. - * \param firstInstance the ID of the first instance to draw. + * \param render_pass a render pass handle. + * \param num_indices the number of indices to draw per instance. + * \param num_instances the number of instances to draw. + * \param first_index the starting index within the index buffer. + * \param vertex_offset value added to vertex index before indexing into the + * vertex buffer. + * \param first_instance the ID of the first instance to draw. * * \since This function is available since SDL 3.0.0. */ extern SDL_DECLSPEC void SDLCALL SDL_DrawGPUIndexedPrimitives( - SDL_GPURenderPass *renderPass, - Uint32 indexCount, - Uint32 instanceCount, - Uint32 firstIndex, - Sint32 vertexOffset, - Uint32 firstInstance); + SDL_GPURenderPass *render_pass, + Uint32 num_indices, + Uint32 num_instances, + Uint32 first_index, + Sint32 vertex_offset, + Uint32 first_instance); /** * Draws data using bound graphics state. * * You must not call this function before binding a graphics pipeline. * - * Note that the `firstVertex` and `firstInstance` parameters are NOT + * Note that the `first_vertex` and `first_instance` parameters are NOT * compatible with built-in vertex/instance ID variables in shaders (for * example, SV_VertexID). If your shader depends on these variables, the * correlating draw call parameter MUST be 0. * - * \param renderPass a render pass handle. - * \param vertexCount the number of vertices to draw. - * \param instanceCount the number of instances that will be drawn. - * \param firstVertex the index of the first vertex to draw. - * \param firstInstance the ID of the first instance to draw. + * \param render_pass a render pass handle. + * \param num_vertices the number of vertices to draw. + * \param num_instances the number of instances that will be drawn. + * \param first_vertex the index of the first vertex to draw. + * \param first_instance the ID of the first instance to draw. * * \since This function is available since SDL 3.0.0. */ extern SDL_DECLSPEC void SDLCALL SDL_DrawGPUPrimitives( - SDL_GPURenderPass *renderPass, - Uint32 vertexCount, - Uint32 instanceCount, - Uint32 firstVertex, - Uint32 firstInstance); + SDL_GPURenderPass *render_pass, + Uint32 num_vertices, + Uint32 num_instances, + Uint32 first_vertex, + Uint32 first_instance); /** * Draws data using bound graphics state and with draw parameters set from a * buffer. * - * The buffer layout should match the layout of SDL_GPUIndirectDrawCommand. - * You must not call this function before binding a graphics pipeline. + * The buffer must consist of tightly-packed draw parameter sets that each + * match the layout of SDL_GPUIndirectDrawCommand. You must not call this + * function before binding a graphics pipeline. * - * \param renderPass a render pass handle. + * \param render_pass a render pass handle. * \param buffer a buffer containing draw parameters. - * \param offsetInBytes the offset to start reading from the draw buffer. - * \param drawCount the number of draw parameter sets that should be read from - * the draw buffer. - * \param stride the byte stride between sets of draw parameters. + * \param offset the offset to start reading from the draw buffer. + * \param draw_count the number of draw parameter sets that should be read + * from the draw buffer. * * \since This function is available since SDL 3.0.0. */ extern SDL_DECLSPEC void SDLCALL SDL_DrawGPUPrimitivesIndirect( - SDL_GPURenderPass *renderPass, + SDL_GPURenderPass *render_pass, SDL_GPUBuffer *buffer, - Uint32 offsetInBytes, - Uint32 drawCount, - Uint32 stride); + Uint32 offset, + Uint32 draw_count); /** * Draws data using bound graphics state with an index buffer enabled and with * draw parameters set from a buffer. * - * The buffer layout should match the layout of - * SDL_GPUIndexedIndirectDrawCommand. You must not call this function before - * binding a graphics pipeline. + * The buffer must consist of tightly-packed draw parameter sets that each + * match the layout of SDL_GPUIndexedIndirectDrawCommand. You must not call + * this function before binding a graphics pipeline. * - * \param renderPass a render pass handle. + * \param render_pass a render pass handle. * \param buffer a buffer containing draw parameters. - * \param offsetInBytes the offset to start reading from the draw buffer. - * \param drawCount the number of draw parameter sets that should be read from - * the draw buffer. - * \param stride the byte stride between sets of draw parameters. + * \param offset the offset to start reading from the draw buffer. + * \param draw_count the number of draw parameter sets that should be read + * from the draw buffer. * * \since This function is available since SDL 3.0.0. */ extern SDL_DECLSPEC void SDLCALL SDL_DrawGPUIndexedPrimitivesIndirect( - SDL_GPURenderPass *renderPass, + SDL_GPURenderPass *render_pass, SDL_GPUBuffer *buffer, - Uint32 offsetInBytes, - Uint32 drawCount, - Uint32 stride); + Uint32 offset, + Uint32 draw_count); /** * Ends the given render pass. @@ -1907,12 +2778,12 @@ extern SDL_DECLSPEC void SDLCALL SDL_DrawGPUIndexedPrimitivesIndirect( * All bound graphics state on the render pass command buffer is unset. The * render pass handle is now invalid. * - * \param renderPass a render pass handle. + * \param render_pass a render pass handle. * * \since This function is available since SDL 3.0.0. */ extern SDL_DECLSPEC void SDLCALL SDL_EndGPURenderPass( - SDL_GPURenderPass *renderPass); + SDL_GPURenderPass *render_pass); /* Compute Pass */ @@ -1932,15 +2803,15 @@ extern SDL_DECLSPEC void SDLCALL SDL_EndGPURenderPass( * dispatch, you MUST end the current compute pass and begin a new one before * you can safely access the data. * - * \param commandBuffer a command buffer. - * \param storageTextureBindings an array of writeable storage texture binding - * structs. - * \param storageTextureBindingCount the number of storage textures to bind - * from the array. - * \param storageBufferBindings an array of writeable storage buffer binding - * structs. - * \param storageBufferBindingCount the number of storage buffers to bind from - * the array. + * \param command_buffer a command buffer. + * \param storage_texture_bindings an array of writeable storage texture + * binding structs. + * \param num_storage_texture_bindings the number of storage textures to bind + * from the array. + * \param storage_buffer_bindings an array of writeable storage buffer binding + * structs. + * \param num_storage_buffer_bindings the number of storage buffers to bind + * from the array. * \returns a compute pass handle. * * \since This function is available since SDL 3.0.0. @@ -1948,23 +2819,43 @@ extern SDL_DECLSPEC void SDLCALL SDL_EndGPURenderPass( * \sa SDL_EndGPUComputePass */ extern SDL_DECLSPEC SDL_GPUComputePass *SDLCALL SDL_BeginGPUComputePass( - SDL_GPUCommandBuffer *commandBuffer, - SDL_GPUStorageTextureWriteOnlyBinding *storageTextureBindings, - Uint32 storageTextureBindingCount, - SDL_GPUStorageBufferWriteOnlyBinding *storageBufferBindings, - Uint32 storageBufferBindingCount); + SDL_GPUCommandBuffer *command_buffer, + const SDL_GPUStorageTextureWriteOnlyBinding *storage_texture_bindings, + Uint32 num_storage_texture_bindings, + const SDL_GPUStorageBufferWriteOnlyBinding *storage_buffer_bindings, + Uint32 num_storage_buffer_bindings); /** * Binds a compute pipeline on a command buffer for use in compute dispatch. * - * \param computePass a compute pass handle. - * \param computePipeline a compute pipeline to bind. + * \param compute_pass a compute pass handle. + * \param compute_pipeline a compute pipeline to bind. * * \since This function is available since SDL 3.0.0. */ extern SDL_DECLSPEC void SDLCALL SDL_BindGPUComputePipeline( - SDL_GPUComputePass *computePass, - SDL_GPUComputePipeline *computePipeline); + SDL_GPUComputePass *compute_pass, + SDL_GPUComputePipeline *compute_pipeline); + +/** + * Binds texture-sampler pairs for use on the compute shader. + * + * The textures must have been created with SDL_GPU_TEXTUREUSAGE_SAMPLER. + * + * \param compute_pass a compute pass handle. + * \param first_slot the compute sampler slot to begin binding from. + * \param texture_sampler_bindings an array of texture-sampler binding + * structs. + * \param num_bindings the number of texture-sampler bindings to bind from the + * array. + * + * \since This function is available since SDL 3.0.0. + */ +extern SDL_DECLSPEC void SDLCALL SDL_BindGPUComputeSamplers( + SDL_GPUComputePass *compute_pass, + Uint32 first_slot, + const SDL_GPUTextureSamplerBinding *texture_sampler_bindings, + Uint32 num_bindings); /** * Binds storage textures as readonly for use on the compute pipeline. @@ -1972,18 +2863,18 @@ extern SDL_DECLSPEC void SDLCALL SDL_BindGPUComputePipeline( * These textures must have been created with * SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_READ. * - * \param computePass a compute pass handle. - * \param firstSlot the compute storage texture slot to begin binding from. - * \param storageTextures an array of storage textures. - * \param bindingCount the number of storage textures to bind from the array. + * \param compute_pass a compute pass handle. + * \param first_slot the compute storage texture slot to begin binding from. + * \param storage_textures an array of storage textures. + * \param num_bindings the number of storage textures to bind from the array. * * \since This function is available since SDL 3.0.0. */ extern SDL_DECLSPEC void SDLCALL SDL_BindGPUComputeStorageTextures( - SDL_GPUComputePass *computePass, - Uint32 firstSlot, - SDL_GPUTexture **storageTextures, - Uint32 bindingCount); + SDL_GPUComputePass *compute_pass, + Uint32 first_slot, + SDL_GPUTexture *const *storage_textures, + Uint32 num_bindings); /** * Binds storage buffers as readonly for use on the compute pipeline. @@ -1991,18 +2882,18 @@ extern SDL_DECLSPEC void SDLCALL SDL_BindGPUComputeStorageTextures( * These buffers must have been created with * SDL_GPU_BUFFERUSAGE_COMPUTE_STORAGE_READ. * - * \param computePass a compute pass handle. - * \param firstSlot the compute storage buffer slot to begin binding from. - * \param storageBuffers an array of storage buffer binding structs. - * \param bindingCount the number of storage buffers to bind from the array. + * \param compute_pass a compute pass handle. + * \param first_slot the compute storage buffer slot to begin binding from. + * \param storage_buffers an array of storage buffer binding structs. + * \param num_bindings the number of storage buffers to bind from the array. * * \since This function is available since SDL 3.0.0. */ extern SDL_DECLSPEC void SDLCALL SDL_BindGPUComputeStorageBuffers( - SDL_GPUComputePass *computePass, - Uint32 firstSlot, - SDL_GPUBuffer **storageBuffers, - Uint32 bindingCount); + SDL_GPUComputePass *compute_pass, + Uint32 first_slot, + SDL_GPUBuffer *const *storage_buffers, + Uint32 num_bindings); /** * Dispatches compute work. @@ -2014,21 +2905,21 @@ extern SDL_DECLSPEC void SDLCALL SDL_BindGPUComputeStorageBuffers( * guarantee of which order the writes will occur. If the write order matters, * you MUST end the compute pass and begin another one. * - * \param computePass a compute pass handle. - * \param groupCountX number of local workgroups to dispatch in the X - * dimension. - * \param groupCountY number of local workgroups to dispatch in the Y - * dimension. - * \param groupCountZ number of local workgroups to dispatch in the Z - * dimension. + * \param compute_pass a compute pass handle. + * \param groupcount_x number of local workgroups to dispatch in the X + * dimension. + * \param groupcount_y number of local workgroups to dispatch in the Y + * dimension. + * \param groupcount_z number of local workgroups to dispatch in the Z + * dimension. * * \since This function is available since SDL 3.0.0. */ extern SDL_DECLSPEC void SDLCALL SDL_DispatchGPUCompute( - SDL_GPUComputePass *computePass, - Uint32 groupCountX, - Uint32 groupCountY, - Uint32 groupCountZ); + SDL_GPUComputePass *compute_pass, + Uint32 groupcount_x, + Uint32 groupcount_y, + Uint32 groupcount_z); /** * Dispatches compute work with parameters set from a buffer. @@ -2042,16 +2933,16 @@ extern SDL_DECLSPEC void SDLCALL SDL_DispatchGPUCompute( * guarantee of which order the writes will occur. If the write order matters, * you MUST end the compute pass and begin another one. * - * \param computePass a compute pass handle. + * \param compute_pass a compute pass handle. * \param buffer a buffer containing dispatch parameters. - * \param offsetInBytes the offset to start reading from the dispatch buffer. + * \param offset the offset to start reading from the dispatch buffer. * * \since This function is available since SDL 3.0.0. */ extern SDL_DECLSPEC void SDLCALL SDL_DispatchGPUComputeIndirect( - SDL_GPUComputePass *computePass, + SDL_GPUComputePass *compute_pass, SDL_GPUBuffer *buffer, - Uint32 offsetInBytes); + Uint32 offset); /** * Ends the current compute pass. @@ -2059,12 +2950,12 @@ extern SDL_DECLSPEC void SDLCALL SDL_DispatchGPUComputeIndirect( * All bound compute state on the command buffer is unset. The compute pass * handle is now invalid. * - * \param computePass a compute pass handle. + * \param compute_pass a compute pass handle. * * \since This function is available since SDL 3.0.0. */ extern SDL_DECLSPEC void SDLCALL SDL_EndGPUComputePass( - SDL_GPUComputePass *computePass); + SDL_GPUComputePass *compute_pass); /* TransferBuffer Data */ @@ -2074,28 +2965,28 @@ extern SDL_DECLSPEC void SDLCALL SDL_EndGPUComputePass( * You must unmap the transfer buffer before encoding upload commands. * * \param device a GPU context. - * \param transferBuffer a transfer buffer. - * \param cycle if SDL_TRUE, cycles the transfer buffer if it is bound. + * \param transfer_buffer a transfer buffer. + * \param cycle if true, cycles the transfer buffer if it is already bound. * \returns the address of the mapped transfer buffer memory. * * \since This function is available since SDL 3.0.0. */ extern SDL_DECLSPEC void *SDLCALL SDL_MapGPUTransferBuffer( SDL_GPUDevice *device, - SDL_GPUTransferBuffer *transferBuffer, - SDL_bool cycle); + SDL_GPUTransferBuffer *transfer_buffer, + bool cycle); /** * Unmaps a previously mapped transfer buffer. * * \param device a GPU context. - * \param transferBuffer a previously mapped transfer buffer. + * \param transfer_buffer a previously mapped transfer buffer. * * \since This function is available since SDL 3.0.0. */ extern SDL_DECLSPEC void SDLCALL SDL_UnmapGPUTransferBuffer( SDL_GPUDevice *device, - SDL_GPUTransferBuffer *transferBuffer); + SDL_GPUTransferBuffer *transfer_buffer); /* Copy Pass */ @@ -2106,13 +2997,13 @@ extern SDL_DECLSPEC void SDLCALL SDL_UnmapGPUTransferBuffer( * inside a copy pass. You must not begin another copy pass, or a render pass * or compute pass before ending the copy pass. * - * \param commandBuffer a command buffer. + * \param command_buffer a command buffer. * \returns a copy pass handle. * * \since This function is available since SDL 3.0.0. */ extern SDL_DECLSPEC SDL_GPUCopyPass *SDLCALL SDL_BeginGPUCopyPass( - SDL_GPUCommandBuffer *commandBuffer); + SDL_GPUCommandBuffer *command_buffer); /** * Uploads data from a transfer buffer to a texture. @@ -2123,19 +3014,19 @@ extern SDL_DECLSPEC SDL_GPUCopyPass *SDLCALL SDL_BeginGPUCopyPass( * You must align the data in the transfer buffer to a multiple of the texel * size of the texture format. * - * \param copyPass a copy pass handle. + * \param copy_pass a copy pass handle. * \param source the source transfer buffer with image layout information. * \param destination the destination texture region. - * \param cycle if SDL_TRUE, cycles the texture if the texture is bound, - * otherwise overwrites the data. + * \param cycle if true, cycles the texture if the texture is bound, otherwise + * overwrites the data. * * \since This function is available since SDL 3.0.0. */ extern SDL_DECLSPEC void SDLCALL SDL_UploadToGPUTexture( - SDL_GPUCopyPass *copyPass, - SDL_GPUTextureTransferInfo *source, - SDL_GPUTextureRegion *destination, - SDL_bool cycle); + SDL_GPUCopyPass *copy_pass, + const SDL_GPUTextureTransferInfo *source, + const SDL_GPUTextureRegion *destination, + bool cycle); /* Uploads data from a TransferBuffer to a Buffer. */ @@ -2145,19 +3036,19 @@ extern SDL_DECLSPEC void SDLCALL SDL_UploadToGPUTexture( * The upload occurs on the GPU timeline. You may assume that the upload has * finished in subsequent commands. * - * \param copyPass a copy pass handle. + * \param copy_pass a copy pass handle. * \param source the source transfer buffer with offset. * \param destination the destination buffer with offset and size. - * \param cycle if SDL_TRUE, cycles the buffer if it is bound, otherwise + * \param cycle if true, cycles the buffer if it is already bound, otherwise * overwrites the data. * * \since This function is available since SDL 3.0.0. */ extern SDL_DECLSPEC void SDLCALL SDL_UploadToGPUBuffer( - SDL_GPUCopyPass *copyPass, - SDL_GPUTransferBufferLocation *source, - SDL_GPUBufferRegion *destination, - SDL_bool cycle); + SDL_GPUCopyPass *copy_pass, + const SDL_GPUTransferBufferLocation *source, + const SDL_GPUBufferRegion *destination, + bool cycle); /** * Performs a texture-to-texture copy. @@ -2165,25 +3056,25 @@ extern SDL_DECLSPEC void SDLCALL SDL_UploadToGPUBuffer( * This copy occurs on the GPU timeline. You may assume the copy has finished * in subsequent commands. * - * \param copyPass a copy pass handle. + * \param copy_pass a copy pass handle. * \param source a source texture region. * \param destination a destination texture region. * \param w the width of the region to copy. * \param h the height of the region to copy. * \param d the depth of the region to copy. - * \param cycle if SDL_TRUE, cycles the destination texture if the destination + * \param cycle if true, cycles the destination texture if the destination * texture is bound, otherwise overwrites the data. * * \since This function is available since SDL 3.0.0. */ extern SDL_DECLSPEC void SDLCALL SDL_CopyGPUTextureToTexture( - SDL_GPUCopyPass *copyPass, - SDL_GPUTextureLocation *source, - SDL_GPUTextureLocation *destination, + SDL_GPUCopyPass *copy_pass, + const SDL_GPUTextureLocation *source, + const SDL_GPUTextureLocation *destination, Uint32 w, Uint32 h, Uint32 d, - SDL_bool cycle); + bool cycle); /* Copies data from a buffer to a buffer. */ @@ -2193,21 +3084,21 @@ extern SDL_DECLSPEC void SDLCALL SDL_CopyGPUTextureToTexture( * This copy occurs on the GPU timeline. You may assume the copy has finished * in subsequent commands. * - * \param copyPass a copy pass handle. + * \param copy_pass a copy pass handle. * \param source the buffer and offset to copy from. * \param destination the buffer and offset to copy to. * \param size the length of the buffer to copy. - * \param cycle if SDL_TRUE, cycles the destination buffer if it is bound, + * \param cycle if true, cycles the destination buffer if it is already bound, * otherwise overwrites the data. * * \since This function is available since SDL 3.0.0. */ extern SDL_DECLSPEC void SDLCALL SDL_CopyGPUBufferToBuffer( - SDL_GPUCopyPass *copyPass, - SDL_GPUBufferLocation *source, - SDL_GPUBufferLocation *destination, + SDL_GPUCopyPass *copy_pass, + const SDL_GPUBufferLocation *source, + const SDL_GPUBufferLocation *destination, Uint32 size, - SDL_bool cycle); + bool cycle); /** * Copies data from a texture to a transfer buffer on the GPU timeline. @@ -2215,7 +3106,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_CopyGPUBufferToBuffer( * This data is not guaranteed to be copied until the command buffer fence is * signaled. * - * \param copyPass a copy pass handle. + * \param copy_pass a copy pass handle. * \param source the source texture region. * \param destination the destination transfer buffer with image layout * information. @@ -2223,9 +3114,9 @@ extern SDL_DECLSPEC void SDLCALL SDL_CopyGPUBufferToBuffer( * \since This function is available since SDL 3.0.0. */ extern SDL_DECLSPEC void SDLCALL SDL_DownloadFromGPUTexture( - SDL_GPUCopyPass *copyPass, - SDL_GPUTextureRegion *source, - SDL_GPUTextureTransferInfo *destination); + SDL_GPUCopyPass *copy_pass, + const SDL_GPUTextureRegion *source, + const SDL_GPUTextureTransferInfo *destination); /** * Copies data from a buffer to a transfer buffer on the GPU timeline. @@ -2233,39 +3124,39 @@ extern SDL_DECLSPEC void SDLCALL SDL_DownloadFromGPUTexture( * This data is not guaranteed to be copied until the command buffer fence is * signaled. * - * \param copyPass a copy pass handle. + * \param copy_pass a copy pass handle. * \param source the source buffer with offset and size. * \param destination the destination transfer buffer with offset. * * \since This function is available since SDL 3.0.0. */ extern SDL_DECLSPEC void SDLCALL SDL_DownloadFromGPUBuffer( - SDL_GPUCopyPass *copyPass, - SDL_GPUBufferRegion *source, - SDL_GPUTransferBufferLocation *destination); + SDL_GPUCopyPass *copy_pass, + const SDL_GPUBufferRegion *source, + const SDL_GPUTransferBufferLocation *destination); /** * Ends the current copy pass. * - * \param copyPass a copy pass handle. + * \param copy_pass a copy pass handle. * * \since This function is available since SDL 3.0.0. */ extern SDL_DECLSPEC void SDLCALL SDL_EndGPUCopyPass( - SDL_GPUCopyPass *copyPass); + SDL_GPUCopyPass *copy_pass); /** * Generates mipmaps for the given texture. * * This function must not be called inside of any pass. * - * \param commandBuffer a commandBuffer. + * \param command_buffer a command_buffer. * \param texture a texture with more than 1 mip level. * * \since This function is available since SDL 3.0.0. */ extern SDL_DECLSPEC void SDLCALL SDL_GenerateMipmapsForGPUTexture( - SDL_GPUCommandBuffer *commandBuffer, + SDL_GPUCommandBuffer *command_buffer, SDL_GPUTexture *texture); /** @@ -2273,23 +3164,14 @@ extern SDL_DECLSPEC void SDLCALL SDL_GenerateMipmapsForGPUTexture( * * This function must not be called inside of any pass. * - * \param commandBuffer a command buffer. - * \param source the texture region to copy from. - * \param destination the texture region to copy to. - * \param flipMode the flip mode for the source texture region. - * \param filterMode the filter mode that will be used when blitting. - * \param cycle if SDL_TRUE, cycles the destination texture if the destination - * texture is bound, otherwise overwrites the data. + * \param command_buffer a command buffer. + * \param info the blit info struct containing the blit parameters. * * \since This function is available since SDL 3.0.0. */ extern SDL_DECLSPEC void SDLCALL SDL_BlitGPUTexture( - SDL_GPUCommandBuffer *commandBuffer, - SDL_GPUBlitRegion *source, - SDL_GPUBlitRegion *destination, - SDL_FlipMode flipMode, - SDL_GPUFilter filterMode, - SDL_bool cycle); + SDL_GPUCommandBuffer *command_buffer, + const SDL_GPUBlitInfo *info); /* Submission/Presentation */ @@ -2300,17 +3182,17 @@ extern SDL_DECLSPEC void SDLCALL SDL_BlitGPUTexture( * * \param device a GPU context. * \param window an SDL_Window. - * \param swapchainComposition the swapchain composition to check. - * \returns SDL_TRUE if supported, SDL_FALSE if unsupported (or on error). + * \param swapchain_composition the swapchain composition to check. + * \returns true if supported, false if unsupported (or on error). * * \since This function is available since SDL 3.0.0. * * \sa SDL_ClaimWindowForGPUDevice */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_WindowSupportsGPUSwapchainComposition( +extern SDL_DECLSPEC bool SDLCALL SDL_WindowSupportsGPUSwapchainComposition( SDL_GPUDevice *device, SDL_Window *window, - SDL_GPUSwapchainComposition swapchainComposition); + SDL_GPUSwapchainComposition swapchain_composition); /** * Determines whether a presentation mode is supported by the window. @@ -2319,17 +3201,17 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_WindowSupportsGPUSwapchainComposition( * * \param device a GPU context. * \param window an SDL_Window. - * \param presentMode the presentation mode to check. - * \returns SDL_TRUE if supported, SDL_FALSE if unsupported (or on error). + * \param present_mode the presentation mode to check. + * \returns true if supported, false if unsupported (or on error). * * \since This function is available since SDL 3.0.0. * * \sa SDL_ClaimWindowForGPUDevice */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_WindowSupportsGPUPresentMode( +extern SDL_DECLSPEC bool SDLCALL SDL_WindowSupportsGPUPresentMode( SDL_GPUDevice *device, SDL_Window *window, - SDL_GPUPresentMode presentMode); + SDL_GPUPresentMode present_mode); /** * Claims a window, creating a swapchain structure for it. @@ -2339,11 +3221,12 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_WindowSupportsGPUPresentMode( * * The swapchain will be created with SDL_GPU_SWAPCHAINCOMPOSITION_SDR and * SDL_GPU_PRESENTMODE_VSYNC. If you want to have different swapchain - * parameters, you must call SetSwapchainParameters after claiming the window. + * parameters, you must call SDL_SetGPUSwapchainParameters after claiming the + * window. * * \param device a GPU context. * \param window an SDL_Window. - * \returns SDL_TRUE on success, otherwise SDL_FALSE. + * \returns true on success, otherwise false. * * \since This function is available since SDL 3.0.0. * @@ -2352,7 +3235,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_WindowSupportsGPUPresentMode( * \sa SDL_WindowSupportsGPUPresentMode * \sa SDL_WindowSupportsGPUSwapchainComposition */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ClaimWindowForGPUDevice( +extern SDL_DECLSPEC bool SDLCALL SDL_ClaimWindowForGPUDevice( SDL_GPUDevice *device, SDL_Window *window); @@ -2383,20 +3266,20 @@ extern SDL_DECLSPEC void SDLCALL SDL_ReleaseWindowFromGPUDevice( * * \param device a GPU context. * \param window an SDL_Window that has been claimed. - * \param swapchainComposition the desired composition of the swapchain. - * \param presentMode the desired present mode for the swapchain. - * \returns SDL_TRUE if successful, SDL_FALSE on error. + * \param swapchain_composition the desired composition of the swapchain. + * \param present_mode the desired present mode for the swapchain. + * \returns true if successful, false on error. * * \since This function is available since SDL 3.0.0. * * \sa SDL_WindowSupportsGPUPresentMode * \sa SDL_WindowSupportsGPUSwapchainComposition */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetGPUSwapchainParameters( +extern SDL_DECLSPEC bool SDLCALL SDL_SetGPUSwapchainParameters( SDL_GPUDevice *device, SDL_Window *window, - SDL_GPUSwapchainComposition swapchainComposition, - SDL_GPUPresentMode presentMode); + SDL_GPUSwapchainComposition swapchain_composition, + SDL_GPUPresentMode present_mode); /** * Obtains the texture format of the swapchain for the given window. @@ -2422,10 +3305,10 @@ extern SDL_DECLSPEC SDL_GPUTextureFormat SDLCALL SDL_GetGPUSwapchainTextureForma * and must not be freed by the user. You MUST NOT call this function from any * thread other than the one that created the window. * - * \param commandBuffer a command buffer. + * \param command_buffer a command buffer. * \param window a window that has been claimed. - * \param pWidth a pointer filled in with the swapchain width. - * \param pHeight a pointer filled in with the swapchain height. + * \param w a pointer filled in with the swapchain width. + * \param h a pointer filled in with the swapchain height. * \returns a swapchain texture. * * \since This function is available since SDL 3.0.0. @@ -2435,10 +3318,10 @@ extern SDL_DECLSPEC SDL_GPUTextureFormat SDLCALL SDL_GetGPUSwapchainTextureForma * \sa SDL_SubmitGPUCommandBufferAndAcquireFence */ extern SDL_DECLSPEC SDL_GPUTexture *SDLCALL SDL_AcquireGPUSwapchainTexture( - SDL_GPUCommandBuffer *commandBuffer, + SDL_GPUCommandBuffer *command_buffer, SDL_Window *window, - Uint32 *pWidth, - Uint32 *pHeight); + Uint32 *w, + Uint32 *h); /** * Submits a command buffer so its commands can be processed on the GPU. @@ -2450,7 +3333,7 @@ extern SDL_DECLSPEC SDL_GPUTexture *SDLCALL SDL_AcquireGPUSwapchainTexture( * All commands in the submission are guaranteed to begin executing before any * command in a subsequent submission begins executing. * - * \param commandBuffer a command buffer. + * \param command_buffer a command buffer. * * \since This function is available since SDL 3.0.0. * @@ -2459,7 +3342,7 @@ extern SDL_DECLSPEC SDL_GPUTexture *SDLCALL SDL_AcquireGPUSwapchainTexture( * \sa SDL_SubmitGPUCommandBufferAndAcquireFence */ extern SDL_DECLSPEC void SDLCALL SDL_SubmitGPUCommandBuffer( - SDL_GPUCommandBuffer *commandBuffer); + SDL_GPUCommandBuffer *command_buffer); /** * Submits a command buffer so its commands can be processed on the GPU, and @@ -2473,7 +3356,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_SubmitGPUCommandBuffer( * All commands in the submission are guaranteed to begin executing before any * command in a subsequent submission begins executing. * - * \param commandBuffer a command buffer. + * \param command_buffer a command buffer. * \returns a fence associated with the command buffer. * * \since This function is available since SDL 3.0.0. @@ -2484,7 +3367,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_SubmitGPUCommandBuffer( * \sa SDL_ReleaseGPUFence */ extern SDL_DECLSPEC SDL_GPUFence *SDLCALL SDL_SubmitGPUCommandBufferAndAcquireFence( - SDL_GPUCommandBuffer *commandBuffer); + SDL_GPUCommandBuffer *command_buffer); /** * Blocks the thread until the GPU is completely idle. @@ -2502,10 +3385,10 @@ extern SDL_DECLSPEC void SDLCALL SDL_WaitForGPUIdle( * Blocks the thread until the given fences are signaled. * * \param device a GPU context. - * \param waitAll if 0, wait for any fence to be signaled, if 1, wait for all - * fences to be signaled. - * \param pFences an array of fences to wait on. - * \param fenceCount the number of fences in the pFences array. + * \param wait_all if 0, wait for any fence to be signaled, if 1, wait for all + * fences to be signaled. + * \param fences an array of fences to wait on. + * \param num_fences the number of fences in the fences array. * * \since This function is available since SDL 3.0.0. * @@ -2514,22 +3397,22 @@ extern SDL_DECLSPEC void SDLCALL SDL_WaitForGPUIdle( */ extern SDL_DECLSPEC void SDLCALL SDL_WaitForGPUFences( SDL_GPUDevice *device, - SDL_bool waitAll, - SDL_GPUFence **pFences, - Uint32 fenceCount); + bool wait_all, + SDL_GPUFence *const *fences, + Uint32 num_fences); /** * Checks the status of a fence. * * \param device a GPU context. * \param fence a fence. - * \returns SDL_TRUE if the fence is signaled, SDL_FALSE if it is not. + * \returns true if the fence is signaled, false if it is not. * * \since This function is available since SDL 3.0.0. * * \sa SDL_SubmitGPUCommandBufferAndAcquireFence */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_QueryGPUFence( +extern SDL_DECLSPEC bool SDLCALL SDL_QueryGPUFence( SDL_GPUDevice *device, SDL_GPUFence *fence); @@ -2552,7 +3435,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_ReleaseGPUFence( /** * Obtains the texel block size for a texture format. * - * \param textureFormat the texture format you want to know the texel size of. + * \param format the texture format you want to know the texel size of. * \returns the texel block size of the texture format. * * \since This function is available since SDL 3.0.0. @@ -2560,7 +3443,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_ReleaseGPUFence( * \sa SDL_UploadToGPUTexture */ extern SDL_DECLSPEC Uint32 SDLCALL SDL_GPUTextureFormatTexelBlockSize( - SDL_GPUTextureFormat textureFormat); + SDL_GPUTextureFormat format); /** * Determines whether a texture format is supported for a given type and @@ -2574,7 +3457,7 @@ extern SDL_DECLSPEC Uint32 SDLCALL SDL_GPUTextureFormatTexelBlockSize( * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GPUTextureSupportsFormat( +extern SDL_DECLSPEC bool SDLCALL SDL_GPUTextureSupportsFormat( SDL_GPUDevice *device, SDL_GPUTextureFormat format, SDL_GPUTextureType type, @@ -2585,15 +3468,15 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GPUTextureSupportsFormat( * * \param device a GPU context. * \param format the texture format to check. - * \param sampleCount the sample count to check. + * \param sample_count the sample count to check. * \returns a hardware-specific version of min(preferred, possible). * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GPUTextureSupportsSampleCount( +extern SDL_DECLSPEC bool SDLCALL SDL_GPUTextureSupportsSampleCount( SDL_GPUDevice *device, SDL_GPUTextureFormat format, - SDL_GPUSampleCount sampleCount); + SDL_GPUSampleCount sample_count); #ifdef SDL_PLATFORM_GDK diff --git a/include/SDL3/SDL_guid.h b/include/SDL3/SDL_guid.h index 285b2376..d45a3c36 100644 --- a/include/SDL3/SDL_guid.h +++ b/include/SDL3/SDL_guid.h @@ -32,7 +32,6 @@ #define SDL_guid_h_ #include -#include #include /* Set up for C function definitions, even when using C++ */ diff --git a/include/SDL3/SDL_haptic.h b/include/SDL3/SDL_haptic.h index 95446fe2..58b5b1c9 100644 --- a/include/SDL3/SDL_haptic.h +++ b/include/SDL3/SDL_haptic.h @@ -66,7 +66,7 @@ * Complete example: * * ```c - * SDL_bool test_haptic(SDL_Joystick *joystick) + * bool test_haptic(SDL_Joystick *joystick) * { * SDL_Haptic *haptic; * SDL_HapticEffect effect; @@ -74,12 +74,12 @@ * * // Open the device * haptic = SDL_OpenHapticFromJoystick(joystick); - * if (haptic == NULL) return SDL_FALSE; // Most likely joystick isn't haptic + * if (haptic == NULL) return false; // Most likely joystick isn't haptic * * // See if it can do sine waves * if ((SDL_GetHapticFeatures(haptic) & SDL_HAPTIC_SINE)==0) { * SDL_CloseHaptic(haptic); // No sine effect - * return SDL_FALSE; + * return false; * } * * // Create the effect @@ -106,7 +106,7 @@ * // Close the device * SDL_CloseHaptic(haptic); * - * return SDL_TRUE; // Success + * return true; // Success * } * ``` * @@ -139,15 +139,14 @@ extern "C" { */ /** - * \typedef SDL_Haptic + * The haptic structure used to identify an SDL haptic. * - * The haptic structure used to identify an SDL haptic. + * \since This struct is available since SDL 3.0.0. * - * \sa SDL_OpenHaptic - * \sa SDL_OpenHapticFromJoystick - * \sa SDL_CloseHaptic + * \sa SDL_OpenHaptic + * \sa SDL_OpenHapticFromJoystick + * \sa SDL_CloseHaptic */ -struct SDL_Haptic; typedef struct SDL_Haptic SDL_Haptic; @@ -1025,13 +1024,13 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetHapticName(SDL_Haptic *haptic); /** * Query whether or not the current mouse has haptic capabilities. * - * \returns SDL_TRUE if the mouse is haptic or SDL_FALSE if it isn't. + * \returns true if the mouse is haptic or false if it isn't. * * \since This function is available since SDL 3.0.0. * * \sa SDL_OpenHapticFromMouse */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_IsMouseHaptic(void); +extern SDL_DECLSPEC bool SDLCALL SDL_IsMouseHaptic(void); /** * Try to open a haptic device from the current mouse. @@ -1050,13 +1049,13 @@ extern SDL_DECLSPEC SDL_Haptic * SDLCALL SDL_OpenHapticFromMouse(void); * Query if a joystick has haptic features. * * \param joystick the SDL_Joystick to test for haptic capabilities. - * \returns SDL_TRUE if the joystick is haptic or SDL_FALSE if it isn't. + * \returns true if the joystick is haptic or false if it isn't. * * \since This function is available since SDL 3.0.0. * * \sa SDL_OpenHapticFromJoystick */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_IsJoystickHaptic(SDL_Joystick *joystick); +extern SDL_DECLSPEC bool SDLCALL SDL_IsJoystickHaptic(SDL_Joystick *joystick); /** * Open a haptic device for use from a joystick device. @@ -1158,14 +1157,14 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetNumHapticAxes(SDL_Haptic *haptic); * * \param haptic the SDL_Haptic device to query. * \param effect the desired effect to query. - * \returns SDL_TRUE if the effect is supported or SDL_FALSE if it isn't. + * \returns true if the effect is supported or false if it isn't. * * \since This function is available since SDL 3.0.0. * * \sa SDL_CreateHapticEffect * \sa SDL_GetHapticFeatures */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_HapticEffectSupported(SDL_Haptic *haptic, const SDL_HapticEffect *effect); +extern SDL_DECLSPEC bool SDLCALL SDL_HapticEffectSupported(SDL_Haptic *haptic, const SDL_HapticEffect *effect); /** * Create a new haptic effect on a specified device. @@ -1196,15 +1195,15 @@ extern SDL_DECLSPEC int SDLCALL SDL_CreateHapticEffect(SDL_Haptic *haptic, const * \param effect the identifier of the effect to update. * \param data an SDL_HapticEffect structure containing the new effect * properties to use. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_CreateHapticEffect * \sa SDL_RunHapticEffect */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_UpdateHapticEffect(SDL_Haptic *haptic, int effect, const SDL_HapticEffect *data); +extern SDL_DECLSPEC bool SDLCALL SDL_UpdateHapticEffect(SDL_Haptic *haptic, int effect, const SDL_HapticEffect *data); /** * Run the haptic effect on its associated haptic device. @@ -1219,8 +1218,8 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_UpdateHapticEffect(SDL_Haptic *haptic, * \param effect the ID of the haptic effect to run. * \param iterations the number of iterations to run the effect; use * `SDL_HAPTIC_INFINITY` to repeat forever. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * @@ -1228,22 +1227,22 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_UpdateHapticEffect(SDL_Haptic *haptic, * \sa SDL_StopHapticEffect * \sa SDL_StopHapticEffects */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_RunHapticEffect(SDL_Haptic *haptic, int effect, Uint32 iterations); +extern SDL_DECLSPEC bool SDLCALL SDL_RunHapticEffect(SDL_Haptic *haptic, int effect, Uint32 iterations); /** * Stop the haptic effect on its associated haptic device. * * \param haptic the SDL_Haptic device to stop the effect on. * \param effect the ID of the haptic effect to stop. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_RunHapticEffect * \sa SDL_StopHapticEffects */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_StopHapticEffect(SDL_Haptic *haptic, int effect); +extern SDL_DECLSPEC bool SDLCALL SDL_StopHapticEffect(SDL_Haptic *haptic, int effect); /** * Destroy a haptic effect on the device. @@ -1267,14 +1266,14 @@ extern SDL_DECLSPEC void SDLCALL SDL_DestroyHapticEffect(SDL_Haptic *haptic, int * * \param haptic the SDL_Haptic device to query for the effect status on. * \param effect the ID of the haptic effect to query its status. - * \returns SDL_TRUE if it is playing, SDL_FALSE if it isn't playing or haptic - * status isn't supported. + * \returns true if it is playing, false if it isn't playing or haptic status + * isn't supported. * * \since This function is available since SDL 3.0.0. * * \sa SDL_GetHapticFeatures */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetHapticEffectStatus(SDL_Haptic *haptic, int effect); +extern SDL_DECLSPEC bool SDLCALL SDL_GetHapticEffectStatus(SDL_Haptic *haptic, int effect); /** * Set the global gain of the specified haptic device. @@ -1289,14 +1288,14 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetHapticEffectStatus(SDL_Haptic *hapti * \param haptic the SDL_Haptic device to set the gain on. * \param gain value to set the gain to, should be between 0 and 100 (0 - * 100). - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_GetHapticFeatures */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetHapticGain(SDL_Haptic *haptic, int gain); +extern SDL_DECLSPEC bool SDLCALL SDL_SetHapticGain(SDL_Haptic *haptic, int gain); /** * Set the global autocenter of the device. @@ -1308,14 +1307,14 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetHapticGain(SDL_Haptic *haptic, int g * * \param haptic the SDL_Haptic device to set autocentering on. * \param autocenter value to set autocenter to (0-100). - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_GetHapticFeatures */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetHapticAutocenter(SDL_Haptic *haptic, int autocenter); +extern SDL_DECLSPEC bool SDLCALL SDL_SetHapticAutocenter(SDL_Haptic *haptic, int autocenter); /** * Pause a haptic device. @@ -1327,14 +1326,14 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetHapticAutocenter(SDL_Haptic *haptic, * can cause all sorts of weird errors. * * \param haptic the SDL_Haptic device to pause. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_ResumeHaptic */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_PauseHaptic(SDL_Haptic *haptic); +extern SDL_DECLSPEC bool SDLCALL SDL_PauseHaptic(SDL_Haptic *haptic); /** * Resume a haptic device. @@ -1342,47 +1341,47 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_PauseHaptic(SDL_Haptic *haptic); * Call to unpause after SDL_PauseHaptic(). * * \param haptic the SDL_Haptic device to unpause. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_PauseHaptic */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ResumeHaptic(SDL_Haptic *haptic); +extern SDL_DECLSPEC bool SDLCALL SDL_ResumeHaptic(SDL_Haptic *haptic); /** * Stop all the currently playing effects on a haptic device. * * \param haptic the SDL_Haptic device to stop. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_RunHapticEffect * \sa SDL_StopHapticEffects */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_StopHapticEffects(SDL_Haptic *haptic); +extern SDL_DECLSPEC bool SDLCALL SDL_StopHapticEffects(SDL_Haptic *haptic); /** * Check whether rumble is supported on a haptic device. * * \param haptic haptic device to check for rumble support. - * \returns SDL_TRUE if the effect is supported or SDL_FALSE if it isn't. + * \returns true if the effect is supported or false if it isn't. * * \since This function is available since SDL 3.0.0. * * \sa SDL_InitHapticRumble */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_HapticRumbleSupported(SDL_Haptic *haptic); +extern SDL_DECLSPEC bool SDLCALL SDL_HapticRumbleSupported(SDL_Haptic *haptic); /** * Initialize a haptic device for simple rumble playback. * * \param haptic the haptic device to initialize for simple rumble playback. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * @@ -1390,7 +1389,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_HapticRumbleSupported(SDL_Haptic *hapti * \sa SDL_StopHapticRumble * \sa SDL_HapticRumbleSupported */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_InitHapticRumble(SDL_Haptic *haptic); +extern SDL_DECLSPEC bool SDLCALL SDL_InitHapticRumble(SDL_Haptic *haptic); /** * Run a simple rumble effect on a haptic device. @@ -1398,28 +1397,28 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_InitHapticRumble(SDL_Haptic *haptic); * \param haptic the haptic device to play the rumble effect on. * \param strength strength of the rumble to play as a 0-1 float value. * \param length length of the rumble to play in milliseconds. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_InitHapticRumble * \sa SDL_StopHapticRumble */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_PlayHapticRumble(SDL_Haptic *haptic, float strength, Uint32 length); +extern SDL_DECLSPEC bool SDLCALL SDL_PlayHapticRumble(SDL_Haptic *haptic, float strength, Uint32 length); /** * Stop the simple rumble on a haptic device. * * \param haptic the haptic device to stop the rumble effect on. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_PlayHapticRumble */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_StopHapticRumble(SDL_Haptic *haptic); +extern SDL_DECLSPEC bool SDLCALL SDL_StopHapticRumble(SDL_Haptic *haptic); /* Ends C function definitions when using C++ */ #ifdef __cplusplus diff --git a/include/SDL3/SDL_hidapi.h b/include/SDL3/SDL_hidapi.h index 66bea9da..730fdee4 100644 --- a/include/SDL3/SDL_hidapi.h +++ b/include/SDL3/SDL_hidapi.h @@ -537,11 +537,11 @@ extern SDL_DECLSPEC int SDLCALL SDL_hid_get_report_descriptor(SDL_hid_device *de /** * Start or stop a BLE scan on iOS and tvOS to pair Steam Controllers. * - * \param active SDL_TRUE to start the scan, SDL_FALSE to stop the scan. + * \param active true to start the scan, false to stop the scan. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC void SDLCALL SDL_hid_ble_scan(SDL_bool active); +extern SDL_DECLSPEC void SDLCALL SDL_hid_ble_scan(bool active); /* Ends C function definitions when using C++ */ #ifdef __cplusplus diff --git a/include/SDL3/SDL_hints.h b/include/SDL3/SDL_hints.h index 708c329d..20488592 100644 --- a/include/SDL3/SDL_hints.h +++ b/include/SDL3/SDL_hints.h @@ -1011,8 +1011,8 @@ extern "C" { * * By default, SDL will try all available GPU backends in a reasonable order * until it finds one that can work, but this hint allows the app or user to - * force a specific target, such as "d3d11" if, say, your hardware supports - * D3D12 but want to try using D3D11 instead. + * force a specific target, such as "direct3d11" if, say, your hardware + * supports D3D12 but want to try using D3D11 instead. * * This hint should be set before SDL_GPUSelectBackend() is called. * @@ -1730,8 +1730,8 @@ extern "C" { * - "0": HIDAPI driver is not used. * - "1": HIDAPI driver is used. * - * This driver doesn't work with the dolphinbar, so the default is SDL_FALSE - * for now. + * This driver doesn't work with the dolphinbar, so the default is false for + * now. * * This hint should be set before enumerating controllers. * @@ -2497,11 +2497,11 @@ extern "C" { * system while relative mode is active, in case the desired confinement state * became out-of-sync due to interference from other running programs. * - * The variable can be integers representing miliseconds between each refresh. - * A value of zero means SDL will not automatically refresh the confinement. - * The default value varies depending on the operating system, this variable - * might not have any effects on inapplicable platforms such as those without - * a cursor. + * The variable can be integers representing milliseconds between each + * refresh. A value of zero means SDL will not automatically refresh the + * confinement. The default value varies depending on the operating system, + * this variable might not have any effects on inapplicable platforms such as + * those without a cursor. * * This hint can be set anytime. * @@ -3938,119 +3938,6 @@ extern "C" { */ #define SDL_HINT_WINDOWS_ERASE_BACKGROUND_MODE "SDL_WINDOWS_ERASE_BACKGROUND_MODE" -/** - * A variable controlling whether back-button-press events on Windows Phone to - * be marked as handled. - * - * Windows Phone devices typically feature a Back button. When pressed, the OS - * will emit back-button-press events, which apps are expected to handle in an - * appropriate manner. If apps do not explicitly mark these events as - * 'Handled', then the OS will invoke its default behavior for unhandled - * back-button-press events, which on Windows Phone 8 and 8.1 is to terminate - * the app (and attempt to switch to the previous app, or to the device's home - * screen). - * - * Setting the SDL_HINT_WINRT_HANDLE_BACK_BUTTON hint to "1" will cause SDL to - * mark back-button-press events as Handled, if and when one is sent to the - * app. - * - * Internally, Windows Phone sends back button events as parameters to special - * back-button-press callback functions. Apps that need to respond to - * back-button-press events are expected to register one or more callback - * functions for such, shortly after being launched (during the app's - * initialization phase). After the back button is pressed, the OS will invoke - * these callbacks. If the app's callback(s) do not explicitly mark the event - * as handled by the time they return, or if the app never registers one of - * these callback, the OS will consider the event un-handled, and it will - * apply its default back button behavior (terminate the app). - * - * SDL registers its own back-button-press callback with the Windows Phone OS. - * This callback will emit a pair of SDL key-press events (SDL_EVENT_KEY_DOWN - * and SDL_EVENT_KEY_UP), each with a scancode of SDL_SCANCODE_AC_BACK, after - * which it will check the contents of the hint, - * SDL_HINT_WINRT_HANDLE_BACK_BUTTON. If the hint's value is set to "1", the - * back button event's Handled property will get set to 'true'. If the hint's - * value is set to something else, or if it is unset, SDL will leave the - * event's Handled property alone. (By default, the OS sets this property to - * 'false', to note.) - * - * SDL apps can either set SDL_HINT_WINRT_HANDLE_BACK_BUTTON well before a - * back button is pressed, or can set it in direct-response to a back button - * being pressed. - * - * In order to get notified when a back button is pressed, SDL apps should - * register a callback function with SDL_AddEventWatch(), and have it listen - * for SDL_EVENT_KEY_DOWN events that have a scancode of SDL_SCANCODE_AC_BACK. - * (Alternatively, SDL_EVENT_KEY_UP events can be listened-for. Listening for - * either event type is suitable.) Any value of - * SDL_HINT_WINRT_HANDLE_BACK_BUTTON set by such a callback, will be applied - * to the OS' current back-button-press event. - * - * More details on back button behavior in Windows Phone apps can be found at - * the following page, on Microsoft's developer site: - * http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj247550(v=vs.105).aspx - * - * \since This hint is available since SDL 3.0.0. - */ -#define SDL_HINT_WINRT_HANDLE_BACK_BUTTON "SDL_WINRT_HANDLE_BACK_BUTTON" - -/** - * A variable specifying the label text for a WinRT app's privacy policy link. - * - * Network-enabled WinRT apps must include a privacy policy. On Windows 8, - * 8.1, and RT, Microsoft mandates that this policy be available via the - * Windows Settings charm. SDL provides code to add a link there, with its - * label text being set via the optional hint, - * SDL_HINT_WINRT_PRIVACY_POLICY_LABEL. - * - * Please note that a privacy policy's contents are not set via this hint. A - * separate hint, SDL_HINT_WINRT_PRIVACY_POLICY_URL, is used to link to the - * actual text of the policy. - * - * The contents of this hint should be encoded as a UTF8 string. - * - * The default value is "Privacy Policy". - * - * For additional information on linking to a privacy policy, see the - * documentation for SDL_HINT_WINRT_PRIVACY_POLICY_URL. - * - * This hint should be set before SDL is initialized. - * - * \since This hint is available since SDL 3.0.0. - */ -#define SDL_HINT_WINRT_PRIVACY_POLICY_LABEL "SDL_WINRT_PRIVACY_POLICY_LABEL" - -/** - * A variable specifying the URL to a WinRT app's privacy policy. - * - * All network-enabled WinRT apps must make a privacy policy available to its - * users. On Windows 8, 8.1, and RT, Microsoft mandates that this policy be - * available in the Windows Settings charm, as accessed from within the app. - * SDL provides code to add a URL-based link there, which can point to the - * app's privacy policy. - * - * To setup a URL to an app's privacy policy, set - * SDL_HINT_WINRT_PRIVACY_POLICY_URL before calling any SDL_Init() functions. - * The contents of the hint should be a valid URL. For example, - * "http://www.example.com". - * - * The default value is "", which will prevent SDL from adding a privacy - * policy link to the Settings charm. This hint should only be set during app - * init. - * - * The label text of an app's "Privacy Policy" link may be customized via - * another hint, SDL_HINT_WINRT_PRIVACY_POLICY_LABEL. - * - * Please note that on Windows Phone, Microsoft does not provide standard UI - * for displaying a privacy policy link, and as such, - * SDL_HINT_WINRT_PRIVACY_POLICY_URL will not get used on that platform. - * Network-enabled phone apps should display their privacy policy through some - * other, in-app means. - * - * \since This hint is available since SDL 3.0.0. - */ -#define SDL_HINT_WINRT_PRIVACY_POLICY_URL "SDL_WINRT_PRIVACY_POLICY_URL" - /** * A variable controlling whether X11 windows are marked as override-redirect. * @@ -4092,7 +3979,7 @@ extern "C" { /** * Specify the XCB library to load for the X11 driver. * - * This defaults to "libX11-xcb.so" + * The default is platform-specific, often "libX11-xcb.so.1". * * This hint should be set before initializing the video subsystem. * @@ -4162,8 +4049,8 @@ typedef enum SDL_HintPriority * \param name the hint to set. * \param value the value of the hint variable. * \param priority the SDL_HintPriority level for the hint. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \threadsafety It is safe to call this function from any thread. * @@ -4173,7 +4060,7 @@ typedef enum SDL_HintPriority * \sa SDL_ResetHint * \sa SDL_SetHint */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetHintWithPriority(const char *name, const char *value, SDL_HintPriority priority); +extern SDL_DECLSPEC bool SDLCALL SDL_SetHintWithPriority(const char *name, const char *value, SDL_HintPriority priority); /** * Set a hint with normal priority. @@ -4184,8 +4071,8 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetHintWithPriority(const char *name, c * * \param name the hint to set. * \param value the value of the hint variable. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \threadsafety It is safe to call this function from any thread. * @@ -4195,7 +4082,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetHintWithPriority(const char *name, c * \sa SDL_ResetHint * \sa SDL_SetHintWithPriority */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetHint(const char *name, const char *value); +extern SDL_DECLSPEC bool SDLCALL SDL_SetHint(const char *name, const char *value); /** * Reset a hint to the default value. @@ -4205,8 +4092,8 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetHint(const char *name, const char *v * change. * * \param name the hint to set. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \threadsafety It is safe to call this function from any thread. * @@ -4215,7 +4102,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetHint(const char *name, const char *v * \sa SDL_SetHint * \sa SDL_ResetHints */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ResetHint(const char *name); +extern SDL_DECLSPEC bool SDLCALL SDL_ResetHint(const char *name); /** * Reset all hints to the default values. @@ -4267,7 +4154,7 @@ extern SDL_DECLSPEC const char *SDLCALL SDL_GetHint(const char *name); * \sa SDL_GetHint * \sa SDL_SetHint */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetHintBoolean(const char *name, SDL_bool default_value); +extern SDL_DECLSPEC bool SDLCALL SDL_GetHintBoolean(const char *name, bool default_value); /** * A callback used to send notifications of hint value changes. @@ -4300,8 +4187,8 @@ typedef void(SDLCALL *SDL_HintCallback)(void *userdata, const char *name, const * \param callback An SDL_HintCallback function that will be called when the * hint value changes. * \param userdata a pointer to pass to the callback function. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \threadsafety It is safe to call this function from any thread. * @@ -4309,7 +4196,7 @@ typedef void(SDLCALL *SDL_HintCallback)(void *userdata, const char *name, const * * \sa SDL_RemoveHintCallback */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_AddHintCallback(const char *name, SDL_HintCallback callback, void *userdata); +extern SDL_DECLSPEC bool SDLCALL SDL_AddHintCallback(const char *name, SDL_HintCallback callback, void *userdata); /** * Remove a function watching a particular hint. diff --git a/include/SDL3/SDL_init.h b/include/SDL3/SDL_init.h index d4d4c2a4..10706c37 100644 --- a/include/SDL3/SDL_init.h +++ b/include/SDL3/SDL_init.h @@ -57,7 +57,6 @@ extern "C" { */ typedef Uint32 SDL_InitFlags; -#define SDL_INIT_TIMER 0x00000001u #define SDL_INIT_AUDIO 0x00000010u /**< `SDL_INIT_AUDIO` implies `SDL_INIT_EVENTS` */ #define SDL_INIT_VIDEO 0x00000020u /**< `SDL_INIT_VIDEO` implies `SDL_INIT_EVENTS` */ #define SDL_INIT_JOYSTICK 0x00000200u /**< `SDL_INIT_JOYSTICK` implies `SDL_INIT_EVENTS`, should be initialized on the same thread as SDL_INIT_VIDEO on Windows if you don't set SDL_HINT_JOYSTICK_THREAD */ @@ -117,7 +116,6 @@ typedef void (SDLCALL *SDL_AppQuit_func)(void *appstate); * * `flags` may be any of the following OR'd together: * - * - `SDL_INIT_TIMER`: timer subsystem * - `SDL_INIT_AUDIO`: audio subsystem; automatically initializes the events * subsystem * - `SDL_INIT_VIDEO`: video subsystem; automatically initializes the events @@ -143,8 +141,8 @@ typedef void (SDLCALL *SDL_AppQuit_func)(void *appstate); * SDL_SetAppMetadataProperty(). * * \param flags subsystem initialization flags. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * @@ -155,7 +153,7 @@ typedef void (SDLCALL *SDL_AppQuit_func)(void *appstate); * \sa SDL_SetMainReady * \sa SDL_WasInit */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_Init(SDL_InitFlags flags); +extern SDL_DECLSPEC bool SDLCALL SDL_Init(SDL_InitFlags flags); /** * Compatibility function to initialize the SDL library. @@ -163,8 +161,8 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_Init(SDL_InitFlags flags); * This function and SDL_Init() are interchangeable. * * \param flags any of the flags used by SDL_Init(); see SDL_Init for details. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * @@ -172,7 +170,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_Init(SDL_InitFlags flags); * \sa SDL_Quit * \sa SDL_QuitSubSystem */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_InitSubSystem(SDL_InitFlags flags); +extern SDL_DECLSPEC bool SDLCALL SDL_InitSubSystem(SDL_InitFlags flags); /** * Shut down specific SDL subsystems. @@ -248,8 +246,8 @@ extern SDL_DECLSPEC void SDLCALL SDL_Quit(void); * hash, or whatever makes sense). * \param appidentifier A unique string in reverse-domain format that * identifies this app ("com.example.mygame2"). - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \threadsafety It is safe to call this function from any thread. * @@ -257,7 +255,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_Quit(void); * * \sa SDL_SetAppMetadataProperty */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetAppMetadata(const char *appname, const char *appversion, const char *appidentifier); +extern SDL_DECLSPEC bool SDLCALL SDL_SetAppMetadata(const char *appname, const char *appversion, const char *appidentifier); /** * Specify metadata about your app through a set of properties. @@ -310,8 +308,8 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetAppMetadata(const char *appname, con * * \param name the name of the metadata property to set. * \param value the value of the property, or NULL to remove that property. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \threadsafety It is safe to call this function from any thread. * @@ -320,7 +318,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetAppMetadata(const char *appname, con * \sa SDL_GetAppMetadataProperty * \sa SDL_SetAppMetadata */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetAppMetadataProperty(const char *name, const char *value); +extern SDL_DECLSPEC bool SDLCALL SDL_SetAppMetadataProperty(const char *name, const char *value); #define SDL_PROP_APP_METADATA_NAME_STRING "SDL.app.metadata.name" #define SDL_PROP_APP_METADATA_VERSION_STRING "SDL.app.metadata.version" diff --git a/include/SDL3/SDL_iostream.h b/include/SDL3/SDL_iostream.h index 4e4ea129..3bfdd34b 100644 --- a/include/SDL3/SDL_iostream.h +++ b/include/SDL3/SDL_iostream.h @@ -83,10 +83,17 @@ typedef enum SDL_IOWhence * already offers several common types of I/O streams, via functions like * SDL_IOFromFile() and SDL_IOFromMem(). * + * This structure should be initialized using SDL_INIT_INTERFACE() + * * \since This struct is available since SDL 3.0.0. + * + * \sa SDL_INIT_INTERFACE */ typedef struct SDL_IOStreamInterface { + /* The version of this interface */ + Uint32 version; + /** * Return the number of bytes in this SDL_IOStream * @@ -126,18 +133,38 @@ typedef struct SDL_IOStreamInterface */ size_t (SDLCALL *write)(void *userdata, const void *ptr, size_t size, SDL_IOStatus *status); + /** + * If the stream is buffering, make sure the data is written out. + * + * On failure, you should set `*status` to a value from the + * SDL_IOStatus enum. You do not have to explicitly set this on + * a successful flush. + * + * \return true if successful or false on write error when flushing data. + */ + bool (SDLCALL *flush)(void *userdata, SDL_IOStatus *status); + /** * Close and free any allocated resources. * * The SDL_IOStream is still destroyed even if this fails, so clean up anything * even if flushing to disk returns an error. * - * \return SDL_TRUE if successful or SDL_FALSE on write error when flushing data. + * \return true if successful or false on write error when flushing data. */ - SDL_bool (SDLCALL *close)(void *userdata); + bool (SDLCALL *close)(void *userdata); } SDL_IOStreamInterface; +/* Check the size of SDL_IOStreamInterface + * + * If this assert fails, either the compiler is padding to an unexpected size, + * or the interface has been updated and this should be updated to match and + * the code using this interface should be updated to handle the old version. + */ +SDL_COMPILE_TIME_ASSERT(SDL_IOStreamInterface_SIZE, + (sizeof(void *) == 4 && sizeof(SDL_IOStreamInterface) == 28) || + (sizeof(void *) == 8 && sizeof(SDL_IOStreamInterface) == 56)); /** * The read/write operation structure. @@ -217,6 +244,8 @@ typedef struct SDL_IOStream SDL_IOStream; * than your app, trying to use this pointer will almost certainly result in * a crash! This is mostly a problem on Windows; make sure you build SDL and * your app with the same compiler and settings to avoid it. + * - `SDL_PROP_IOSTREAM_FILE_DESCRIPTOR_NUMBER`: a file descriptor that this + * SDL_IOStream is using to access the filesystem. * - `SDL_PROP_IOSTREAM_ANDROID_AASSET_POINTER`: a pointer, that can be cast * to an Android NDK `AAsset *`, that this SDL_IOStream is using to access * the filesystem. If SDL used some other method to access the filesystem, @@ -231,6 +260,7 @@ typedef struct SDL_IOStream SDL_IOStream; * \since This function is available since SDL 3.0.0. * * \sa SDL_CloseIO + * \sa SDL_FlushIO * \sa SDL_ReadIO * \sa SDL_SeekIO * \sa SDL_TellIO @@ -240,6 +270,7 @@ extern SDL_DECLSPEC SDL_IOStream * SDLCALL SDL_IOFromFile(const char *file, cons #define SDL_PROP_IOSTREAM_WINDOWS_HANDLE_POINTER "SDL.iostream.windows.handle" #define SDL_PROP_IOSTREAM_STDIO_FILE_POINTER "SDL.iostream.stdio.file" +#define SDL_PROP_IOSTREAM_FILE_DESCRIPTOR_NUMBER "SDL.iostream.file_descriptor" #define SDL_PROP_IOSTREAM_ANDROID_AASSET_POINTER "SDL.iostream.android.aasset" /** @@ -266,6 +297,7 @@ extern SDL_DECLSPEC SDL_IOStream * SDLCALL SDL_IOFromFile(const char *file, cons * * \sa SDL_IOFromConstMem * \sa SDL_CloseIO + * \sa SDL_FlushIO * \sa SDL_ReadIO * \sa SDL_SeekIO * \sa SDL_TellIO @@ -347,20 +379,19 @@ extern SDL_DECLSPEC SDL_IOStream * SDLCALL SDL_IOFromDynamicMem(void); * read/write a common data source, you should use the built-in * implementations in SDL, like SDL_IOFromFile() or SDL_IOFromMem(), etc. * - * You must free the returned pointer with SDL_CloseIO(). - * * This function makes a copy of `iface` and the caller does not need to keep - * this data around after this call. + * it around after this call. * - * \param iface the function pointers that implement this SDL_IOStream. - * \param userdata the app-controlled pointer that is passed to iface's - * functions when called. + * \param iface the interface that implements this SDL_IOStream, initialized + * using SDL_INIT_INTERFACE(). + * \param userdata the pointer that will be passed to the interface functions. * \returns a pointer to the allocated memory on success or NULL on failure; * call SDL_GetError() for more information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_CloseIO + * \sa SDL_INIT_INTERFACE * \sa SDL_IOFromConstMem * \sa SDL_IOFromFile * \sa SDL_IOFromMem @@ -372,21 +403,21 @@ extern SDL_DECLSPEC SDL_IOStream * SDLCALL SDL_OpenIO(const SDL_IOStreamInterfac * * SDL_CloseIO() closes and cleans up the SDL_IOStream stream. It releases any * resources used by the stream and frees the SDL_IOStream itself. This - * returns SDL_TRUE on success, or SDL_FALSE if the stream failed to flush to - * its output (e.g. to disk). + * returns true on success, or false if the stream failed to flush to its + * output (e.g. to disk). * * Note that if this fails to flush the stream to disk, this function reports * an error, but the SDL_IOStream is still invalid once this function returns. * * \param context SDL_IOStream structure to close. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_OpenIO */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_CloseIO(SDL_IOStream *context); +extern SDL_DECLSPEC bool SDLCALL SDL_CloseIO(SDL_IOStream *context); /** * Get the properties associated with an SDL_IOStream. @@ -450,8 +481,8 @@ extern SDL_DECLSPEC Sint64 SDLCALL SDL_GetIOSize(SDL_IOStream *context); * negative. * \param whence any of `SDL_IO_SEEK_SET`, `SDL_IO_SEEK_CUR`, * `SDL_IO_SEEK_END`. - * \returns the final offset in the data stream after the seek or a negative - * error code on failure; call SDL_GetError() for more information. + * \returns the final offset in the data stream after the seek or -1 on + * failure; call SDL_GetError() for more information. * * \since This function is available since SDL 3.0.0. * @@ -524,6 +555,7 @@ extern SDL_DECLSPEC size_t SDLCALL SDL_ReadIO(SDL_IOStream *context, void *ptr, * \sa SDL_IOprintf * \sa SDL_ReadIO * \sa SDL_SeekIO + * \sa SDL_FlushIO * \sa SDL_GetIOStatus */ extern SDL_DECLSPEC size_t SDLCALL SDL_WriteIO(SDL_IOStream *context, const void *ptr, size_t size); @@ -565,6 +597,24 @@ extern SDL_DECLSPEC size_t SDLCALL SDL_IOprintf(SDL_IOStream *context, SDL_PRINT */ extern SDL_DECLSPEC size_t SDLCALL SDL_IOvprintf(SDL_IOStream *context, SDL_PRINTF_FORMAT_STRING const char *fmt, va_list ap) SDL_PRINTF_VARARG_FUNCV(2); +/** + * Flush any buffered data in the stream. + * + * This function makes sure that any buffered data is written to the stream. + * Normally this isn't necessary but if the stream is a pipe or socket it + * guarantees that any pending data is sent. + * + * \param context SDL_IOStream structure to flush. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. + * + * \since This function is available since SDL 3.0.0. + * + * \sa SDL_OpenIO + * \sa SDL_WriteIO + */ +extern SDL_DECLSPEC bool SDLCALL SDL_FlushIO(SDL_IOStream *context); + /** * Load all the data from an SDL data stream. * @@ -575,9 +625,10 @@ extern SDL_DECLSPEC size_t SDLCALL SDL_IOvprintf(SDL_IOStream *context, SDL_PRIN * The data should be freed with SDL_free(). * * \param src the SDL_IOStream to read all available data from. - * \param datasize if not NULL, will store the number of bytes read. - * \param closeio if SDL_TRUE, calls SDL_CloseIO() on `src` before returning, - * even in the case of an error. + * \param datasize a pointer filled in with the number of bytes read, may be + * NULL. + * \param closeio if true, calls SDL_CloseIO() on `src` before returning, even + * in the case of an error. * \returns the data or NULL on failure; call SDL_GetError() for more * information. * @@ -585,7 +636,7 @@ extern SDL_DECLSPEC size_t SDLCALL SDL_IOvprintf(SDL_IOStream *context, SDL_PRIN * * \sa SDL_LoadFile */ -extern SDL_DECLSPEC void * SDLCALL SDL_LoadFile_IO(SDL_IOStream *src, size_t *datasize, SDL_bool closeio); +extern SDL_DECLSPEC void * SDLCALL SDL_LoadFile_IO(SDL_IOStream *src, size_t *datasize, bool closeio); /** * Load all the data from a file path. @@ -619,24 +670,40 @@ extern SDL_DECLSPEC void * SDLCALL SDL_LoadFile(const char *file, size_t *datasi * * \param src the SDL_IOStream to read from. * \param value a pointer filled in with the data read. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ReadU8(SDL_IOStream *src, Uint8 *value); +extern SDL_DECLSPEC bool SDLCALL SDL_ReadU8(SDL_IOStream *src, Uint8 *value); /** * Use this function to read a signed byte from an SDL_IOStream. * * \param src the SDL_IOStream to read from. * \param value a pointer filled in with the data read. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() + * \returns true on success or false on failure; call SDL_GetError() for more + * information. + * + * \since This function is available since SDL 3.0.0. + */ +extern SDL_DECLSPEC bool SDLCALL SDL_ReadS8(SDL_IOStream *src, Sint8 *value); + +/** + * Use this function to read 16 bits of little-endian data from an + * SDL_IOStream and return in native format. + * + * SDL byteswaps the data only if necessary, so the data returned will be in + * the native byte order. + * + * \param src the stream from which to read data. + * \param value a pointer filled in with the data read. + * \returns true on successful write or false on failure; call SDL_GetError() * for more information. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ReadS8(SDL_IOStream *src, Sint8 *value); +extern SDL_DECLSPEC bool SDLCALL SDL_ReadU16LE(SDL_IOStream *src, Uint16 *value); /** * Use this function to read 16 bits of little-endian data from an @@ -647,28 +714,12 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ReadS8(SDL_IOStream *src, Sint8 *value) * * \param src the stream from which to read data. * \param value a pointer filled in with the data read. - * \returns SDL_TRUE on successful write or SDL_FALSE on failure; call - * SDL_GetError() for more information. + * \returns true on successful write or false on failure; call SDL_GetError() + * for more information. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ReadU16LE(SDL_IOStream *src, Uint16 *value); - -/** - * Use this function to read 16 bits of little-endian data from an - * SDL_IOStream and return in native format. - * - * SDL byteswaps the data only if necessary, so the data returned will be in - * the native byte order. - * - * \param src the stream from which to read data. - * \param value a pointer filled in with the data read. - * \returns SDL_TRUE on successful write or SDL_FALSE on failure; call - * SDL_GetError() for more information. - * - * \since This function is available since SDL 3.0.0. - */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ReadS16LE(SDL_IOStream *src, Sint16 *value); +extern SDL_DECLSPEC bool SDLCALL SDL_ReadS16LE(SDL_IOStream *src, Sint16 *value); /** * Use this function to read 16 bits of big-endian data from an SDL_IOStream @@ -679,12 +730,12 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ReadS16LE(SDL_IOStream *src, Sint16 *va * * \param src the stream from which to read data. * \param value a pointer filled in with the data read. - * \returns SDL_TRUE on successful write or SDL_FALSE on failure; call - * SDL_GetError() for more information. + * \returns true on successful write or false on failure; call SDL_GetError() + * for more information. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ReadU16BE(SDL_IOStream *src, Uint16 *value); +extern SDL_DECLSPEC bool SDLCALL SDL_ReadU16BE(SDL_IOStream *src, Uint16 *value); /** * Use this function to read 16 bits of big-endian data from an SDL_IOStream @@ -695,12 +746,12 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ReadU16BE(SDL_IOStream *src, Uint16 *va * * \param src the stream from which to read data. * \param value a pointer filled in with the data read. - * \returns SDL_TRUE on successful write or SDL_FALSE on failure; call - * SDL_GetError() for more information. + * \returns true on successful write or false on failure; call SDL_GetError() + * for more information. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ReadS16BE(SDL_IOStream *src, Sint16 *value); +extern SDL_DECLSPEC bool SDLCALL SDL_ReadS16BE(SDL_IOStream *src, Sint16 *value); /** * Use this function to read 32 bits of little-endian data from an @@ -711,12 +762,12 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ReadS16BE(SDL_IOStream *src, Sint16 *va * * \param src the stream from which to read data. * \param value a pointer filled in with the data read. - * \returns SDL_TRUE on successful write or SDL_FALSE on failure; call - * SDL_GetError() for more information. + * \returns true on successful write or false on failure; call SDL_GetError() + * for more information. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ReadU32LE(SDL_IOStream *src, Uint32 *value); +extern SDL_DECLSPEC bool SDLCALL SDL_ReadU32LE(SDL_IOStream *src, Uint32 *value); /** * Use this function to read 32 bits of little-endian data from an @@ -727,12 +778,12 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ReadU32LE(SDL_IOStream *src, Uint32 *va * * \param src the stream from which to read data. * \param value a pointer filled in with the data read. - * \returns SDL_TRUE on successful write or SDL_FALSE on failure; call - * SDL_GetError() for more information. + * \returns true on successful write or false on failure; call SDL_GetError() + * for more information. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ReadS32LE(SDL_IOStream *src, Sint32 *value); +extern SDL_DECLSPEC bool SDLCALL SDL_ReadS32LE(SDL_IOStream *src, Sint32 *value); /** * Use this function to read 32 bits of big-endian data from an SDL_IOStream @@ -743,12 +794,12 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ReadS32LE(SDL_IOStream *src, Sint32 *va * * \param src the stream from which to read data. * \param value a pointer filled in with the data read. - * \returns SDL_TRUE on successful write or SDL_FALSE on failure; call - * SDL_GetError() for more information. + * \returns true on successful write or false on failure; call SDL_GetError() + * for more information. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ReadU32BE(SDL_IOStream *src, Uint32 *value); +extern SDL_DECLSPEC bool SDLCALL SDL_ReadU32BE(SDL_IOStream *src, Uint32 *value); /** * Use this function to read 32 bits of big-endian data from an SDL_IOStream @@ -759,12 +810,12 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ReadU32BE(SDL_IOStream *src, Uint32 *va * * \param src the stream from which to read data. * \param value a pointer filled in with the data read. - * \returns SDL_TRUE on successful write or SDL_FALSE on failure; call - * SDL_GetError() for more information. + * \returns true on successful write or false on failure; call SDL_GetError() + * for more information. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ReadS32BE(SDL_IOStream *src, Sint32 *value); +extern SDL_DECLSPEC bool SDLCALL SDL_ReadS32BE(SDL_IOStream *src, Sint32 *value); /** * Use this function to read 64 bits of little-endian data from an @@ -775,12 +826,12 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ReadS32BE(SDL_IOStream *src, Sint32 *va * * \param src the stream from which to read data. * \param value a pointer filled in with the data read. - * \returns SDL_TRUE on successful write or SDL_FALSE on failure; call - * SDL_GetError() for more information. + * \returns true on successful write or false on failure; call SDL_GetError() + * for more information. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ReadU64LE(SDL_IOStream *src, Uint64 *value); +extern SDL_DECLSPEC bool SDLCALL SDL_ReadU64LE(SDL_IOStream *src, Uint64 *value); /** * Use this function to read 64 bits of little-endian data from an @@ -791,12 +842,12 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ReadU64LE(SDL_IOStream *src, Uint64 *va * * \param src the stream from which to read data. * \param value a pointer filled in with the data read. - * \returns SDL_TRUE on successful write or SDL_FALSE on failure; call - * SDL_GetError() for more information. + * \returns true on successful write or false on failure; call SDL_GetError() + * for more information. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ReadS64LE(SDL_IOStream *src, Sint64 *value); +extern SDL_DECLSPEC bool SDLCALL SDL_ReadS64LE(SDL_IOStream *src, Sint64 *value); /** * Use this function to read 64 bits of big-endian data from an SDL_IOStream @@ -807,12 +858,12 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ReadS64LE(SDL_IOStream *src, Sint64 *va * * \param src the stream from which to read data. * \param value a pointer filled in with the data read. - * \returns SDL_TRUE on successful write or SDL_FALSE on failure; call - * SDL_GetError() for more information. + * \returns true on successful write or false on failure; call SDL_GetError() + * for more information. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ReadU64BE(SDL_IOStream *src, Uint64 *value); +extern SDL_DECLSPEC bool SDLCALL SDL_ReadU64BE(SDL_IOStream *src, Uint64 *value); /** * Use this function to read 64 bits of big-endian data from an SDL_IOStream @@ -823,12 +874,12 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ReadU64BE(SDL_IOStream *src, Uint64 *va * * \param src the stream from which to read data. * \param value a pointer filled in with the data read. - * \returns SDL_TRUE on successful write or SDL_FALSE on failure; call - * SDL_GetError() for more information. + * \returns true on successful write or false on failure; call SDL_GetError() + * for more information. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ReadS64BE(SDL_IOStream *src, Sint64 *value); +extern SDL_DECLSPEC bool SDLCALL SDL_ReadS64BE(SDL_IOStream *src, Sint64 *value); /* @} *//* Read endian functions */ /** @@ -843,24 +894,24 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ReadS64BE(SDL_IOStream *src, Sint64 *va * * \param dst the SDL_IOStream to write to. * \param value the byte value to write. - * \returns SDL_TRUE on successful write or SDL_FALSE on failure; call - * SDL_GetError() for more information. + * \returns true on successful write or false on failure; call SDL_GetError() + * for more information. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_WriteU8(SDL_IOStream *dst, Uint8 value); +extern SDL_DECLSPEC bool SDLCALL SDL_WriteU8(SDL_IOStream *dst, Uint8 value); /** * Use this function to write a signed byte to an SDL_IOStream. * * \param dst the SDL_IOStream to write to. * \param value the byte value to write. - * \returns SDL_TRUE on successful write or SDL_FALSE on failure; call - * SDL_GetError() for more information. + * \returns true on successful write or false on failure; call SDL_GetError() + * for more information. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_WriteS8(SDL_IOStream *dst, Sint8 value); +extern SDL_DECLSPEC bool SDLCALL SDL_WriteS8(SDL_IOStream *dst, Sint8 value); /** * Use this function to write 16 bits in native format to an SDL_IOStream as @@ -872,12 +923,12 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_WriteS8(SDL_IOStream *dst, Sint8 value) * * \param dst the stream to which data will be written. * \param value the data to be written, in native format. - * \returns SDL_TRUE on successful write or SDL_FALSE on failure; call - * SDL_GetError() for more information. + * \returns true on successful write or false on failure; call SDL_GetError() + * for more information. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_WriteU16LE(SDL_IOStream *dst, Uint16 value); +extern SDL_DECLSPEC bool SDLCALL SDL_WriteU16LE(SDL_IOStream *dst, Uint16 value); /** * Use this function to write 16 bits in native format to an SDL_IOStream as @@ -889,12 +940,12 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_WriteU16LE(SDL_IOStream *dst, Uint16 va * * \param dst the stream to which data will be written. * \param value the data to be written, in native format. - * \returns SDL_TRUE on successful write or SDL_FALSE on failure; call - * SDL_GetError() for more information. + * \returns true on successful write or false on failure; call SDL_GetError() + * for more information. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_WriteS16LE(SDL_IOStream *dst, Sint16 value); +extern SDL_DECLSPEC bool SDLCALL SDL_WriteS16LE(SDL_IOStream *dst, Sint16 value); /** * Use this function to write 16 bits in native format to an SDL_IOStream as @@ -905,12 +956,12 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_WriteS16LE(SDL_IOStream *dst, Sint16 va * * \param dst the stream to which data will be written. * \param value the data to be written, in native format. - * \returns SDL_TRUE on successful write or SDL_FALSE on failure; call - * SDL_GetError() for more information. + * \returns true on successful write or false on failure; call SDL_GetError() + * for more information. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_WriteU16BE(SDL_IOStream *dst, Uint16 value); +extern SDL_DECLSPEC bool SDLCALL SDL_WriteU16BE(SDL_IOStream *dst, Uint16 value); /** * Use this function to write 16 bits in native format to an SDL_IOStream as @@ -921,12 +972,12 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_WriteU16BE(SDL_IOStream *dst, Uint16 va * * \param dst the stream to which data will be written. * \param value the data to be written, in native format. - * \returns SDL_TRUE on successful write or SDL_FALSE on failure; call - * SDL_GetError() for more information. + * \returns true on successful write or false on failure; call SDL_GetError() + * for more information. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_WriteS16BE(SDL_IOStream *dst, Sint16 value); +extern SDL_DECLSPEC bool SDLCALL SDL_WriteS16BE(SDL_IOStream *dst, Sint16 value); /** * Use this function to write 32 bits in native format to an SDL_IOStream as @@ -938,12 +989,12 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_WriteS16BE(SDL_IOStream *dst, Sint16 va * * \param dst the stream to which data will be written. * \param value the data to be written, in native format. - * \returns SDL_TRUE on successful write or SDL_FALSE on failure; call - * SDL_GetError() for more information. + * \returns true on successful write or false on failure; call SDL_GetError() + * for more information. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_WriteU32LE(SDL_IOStream *dst, Uint32 value); +extern SDL_DECLSPEC bool SDLCALL SDL_WriteU32LE(SDL_IOStream *dst, Uint32 value); /** * Use this function to write 32 bits in native format to an SDL_IOStream as @@ -955,12 +1006,12 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_WriteU32LE(SDL_IOStream *dst, Uint32 va * * \param dst the stream to which data will be written. * \param value the data to be written, in native format. - * \returns SDL_TRUE on successful write or SDL_FALSE on failure; call - * SDL_GetError() for more information. + * \returns true on successful write or false on failure; call SDL_GetError() + * for more information. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_WriteS32LE(SDL_IOStream *dst, Sint32 value); +extern SDL_DECLSPEC bool SDLCALL SDL_WriteS32LE(SDL_IOStream *dst, Sint32 value); /** * Use this function to write 32 bits in native format to an SDL_IOStream as @@ -971,12 +1022,12 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_WriteS32LE(SDL_IOStream *dst, Sint32 va * * \param dst the stream to which data will be written. * \param value the data to be written, in native format. - * \returns SDL_TRUE on successful write or SDL_FALSE on failure; call - * SDL_GetError() for more information. + * \returns true on successful write or false on failure; call SDL_GetError() + * for more information. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_WriteU32BE(SDL_IOStream *dst, Uint32 value); +extern SDL_DECLSPEC bool SDLCALL SDL_WriteU32BE(SDL_IOStream *dst, Uint32 value); /** * Use this function to write 32 bits in native format to an SDL_IOStream as @@ -987,12 +1038,12 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_WriteU32BE(SDL_IOStream *dst, Uint32 va * * \param dst the stream to which data will be written. * \param value the data to be written, in native format. - * \returns SDL_TRUE on successful write or SDL_FALSE on failure; call - * SDL_GetError() for more information. + * \returns true on successful write or false on failure; call SDL_GetError() + * for more information. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_WriteS32BE(SDL_IOStream *dst, Sint32 value); +extern SDL_DECLSPEC bool SDLCALL SDL_WriteS32BE(SDL_IOStream *dst, Sint32 value); /** * Use this function to write 64 bits in native format to an SDL_IOStream as @@ -1004,12 +1055,12 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_WriteS32BE(SDL_IOStream *dst, Sint32 va * * \param dst the stream to which data will be written. * \param value the data to be written, in native format. - * \returns SDL_TRUE on successful write or SDL_FALSE on failure; call - * SDL_GetError() for more information. + * \returns true on successful write or false on failure; call SDL_GetError() + * for more information. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_WriteU64LE(SDL_IOStream *dst, Uint64 value); +extern SDL_DECLSPEC bool SDLCALL SDL_WriteU64LE(SDL_IOStream *dst, Uint64 value); /** * Use this function to write 64 bits in native format to an SDL_IOStream as @@ -1021,12 +1072,12 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_WriteU64LE(SDL_IOStream *dst, Uint64 va * * \param dst the stream to which data will be written. * \param value the data to be written, in native format. - * \returns SDL_TRUE on successful write or SDL_FALSE on failure; call - * SDL_GetError() for more information. + * \returns true on successful write or false on failure; call SDL_GetError() + * for more information. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_WriteS64LE(SDL_IOStream *dst, Sint64 value); +extern SDL_DECLSPEC bool SDLCALL SDL_WriteS64LE(SDL_IOStream *dst, Sint64 value); /** * Use this function to write 64 bits in native format to an SDL_IOStream as @@ -1037,12 +1088,12 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_WriteS64LE(SDL_IOStream *dst, Sint64 va * * \param dst the stream to which data will be written. * \param value the data to be written, in native format. - * \returns SDL_TRUE on successful write or SDL_FALSE on failure; call - * SDL_GetError() for more information. + * \returns true on successful write or false on failure; call SDL_GetError() + * for more information. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_WriteU64BE(SDL_IOStream *dst, Uint64 value); +extern SDL_DECLSPEC bool SDLCALL SDL_WriteU64BE(SDL_IOStream *dst, Uint64 value); /** * Use this function to write 64 bits in native format to an SDL_IOStream as @@ -1053,12 +1104,12 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_WriteU64BE(SDL_IOStream *dst, Uint64 va * * \param dst the stream to which data will be written. * \param value the data to be written, in native format. - * \returns SDL_TRUE on successful write or SDL_FALSE on failure; call - * SDL_GetError() for more information. + * \returns true on successful write or false on failure; call SDL_GetError() + * for more information. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_WriteS64BE(SDL_IOStream *dst, Sint64 value); +extern SDL_DECLSPEC bool SDLCALL SDL_WriteS64BE(SDL_IOStream *dst, Sint64 value); /* @} *//* Write endian functions */ diff --git a/include/SDL3/SDL_joystick.h b/include/SDL3/SDL_joystick.h index 43bc1e98..66b466a1 100644 --- a/include/SDL3/SDL_joystick.h +++ b/include/SDL3/SDL_joystick.h @@ -120,7 +120,8 @@ typedef enum SDL_JoystickType SDL_JOYSTICK_TYPE_GUITAR, SDL_JOYSTICK_TYPE_DRUM_KIT, SDL_JOYSTICK_TYPE_ARCADE_PAD, - SDL_JOYSTICK_TYPE_THROTTLE + SDL_JOYSTICK_TYPE_THROTTLE, + SDL_JOYSTICK_TYPE_COUNT } SDL_JoystickType; /** @@ -189,13 +190,13 @@ extern SDL_DECLSPEC void SDLCALL SDL_UnlockJoysticks(void) SDL_RELEASE(SDL_joyst /** * Return whether a joystick is currently connected. * - * \returns SDL_TRUE if a joystick is connected, SDL_FALSE otherwise. + * \returns true if a joystick is connected, false otherwise. * * \since This function is available since SDL 3.0.0. * * \sa SDL_GetJoysticks */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_HasJoystick(void); +extern SDL_DECLSPEC bool SDLCALL SDL_HasJoystick(void); /** * Get a list of currently connected joysticks. @@ -414,16 +415,19 @@ typedef struct SDL_VirtualJoystickSensorDesc /** * The structure that describes a virtual joystick. * - * All elements of this structure are optional and can be left 0. + * This structure should be initialized using SDL_INIT_INTERFACE(). All + * elements of this structure are optional. * * \since This struct is available since SDL 3.0.0. * * \sa SDL_AttachVirtualJoystick + * \sa SDL_INIT_INTERFACE * \sa SDL_VirtualJoystickSensorDesc * \sa SDL_VirtualJoystickTouchpadDesc */ typedef struct SDL_VirtualJoystickDesc { + Uint32 version; /**< the version of this interface */ Uint16 type; /**< `SDL_JoystickType` */ Uint16 padding; /**< unused */ Uint16 vendor_id; /**< the USB vendor ID of this joystick */ @@ -446,18 +450,28 @@ typedef struct SDL_VirtualJoystickDesc void *userdata; /**< User data pointer passed to callbacks */ void (SDLCALL *Update)(void *userdata); /**< Called when the joystick state should be updated */ void (SDLCALL *SetPlayerIndex)(void *userdata, int player_index); /**< Called when the player index is set */ - SDL_bool (SDLCALL *Rumble)(void *userdata, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble); /**< Implements SDL_RumbleJoystick() */ - SDL_bool (SDLCALL *RumbleTriggers)(void *userdata, Uint16 left_rumble, Uint16 right_rumble); /**< Implements SDL_RumbleJoystickTriggers() */ - SDL_bool (SDLCALL *SetLED)(void *userdata, Uint8 red, Uint8 green, Uint8 blue); /**< Implements SDL_SetJoystickLED() */ - SDL_bool (SDLCALL *SendEffect)(void *userdata, const void *data, int size); /**< Implements SDL_SendJoystickEffect() */ - SDL_bool (SDLCALL *SetSensorsEnabled)(void *userdata, SDL_bool enabled); /**< Implements SDL_SetGamepadSensorEnabled() */ + bool (SDLCALL *Rumble)(void *userdata, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble); /**< Implements SDL_RumbleJoystick() */ + bool (SDLCALL *RumbleTriggers)(void *userdata, Uint16 left_rumble, Uint16 right_rumble); /**< Implements SDL_RumbleJoystickTriggers() */ + bool (SDLCALL *SetLED)(void *userdata, Uint8 red, Uint8 green, Uint8 blue); /**< Implements SDL_SetJoystickLED() */ + bool (SDLCALL *SendEffect)(void *userdata, const void *data, int size); /**< Implements SDL_SendJoystickEffect() */ + bool (SDLCALL *SetSensorsEnabled)(void *userdata, bool enabled); /**< Implements SDL_SetGamepadSensorEnabled() */ void (SDLCALL *Cleanup)(void *userdata); /**< Cleans up the userdata when the joystick is detached */ } SDL_VirtualJoystickDesc; +/* Check the size of SDL_VirtualJoystickDesc + * + * If this assert fails, either the compiler is padding to an unexpected size, + * or the interface has been updated and this should be updated to match and + * the code using this interface should be updated to handle the old version. + */ +SDL_COMPILE_TIME_ASSERT(SDL_VirtualJoystickDesc_SIZE, + (sizeof(void *) == 4 && sizeof(SDL_VirtualJoystickDesc) == 84) || + (sizeof(void *) == 8 && sizeof(SDL_VirtualJoystickDesc) == 136)); + /** * Attach a new virtual joystick. * - * \param desc joystick description. + * \param desc joystick description, initialized using SDL_INIT_INTERFACE(). * \returns the joystick instance ID, or 0 on failure; call SDL_GetError() for * more information. * @@ -472,24 +486,24 @@ extern SDL_DECLSPEC SDL_JoystickID SDLCALL SDL_AttachVirtualJoystick(const SDL_V * * \param instance_id the joystick instance ID, previously returned from * SDL_AttachVirtualJoystick(). - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_AttachVirtualJoystick */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_DetachVirtualJoystick(SDL_JoystickID instance_id); +extern SDL_DECLSPEC bool SDLCALL SDL_DetachVirtualJoystick(SDL_JoystickID instance_id); /** * Query whether or not a joystick is virtual. * * \param instance_id the joystick instance ID. - * \returns SDL_TRUE if the joystick is virtual, SDL_FALSE otherwise. + * \returns true if the joystick is virtual, false otherwise. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_IsJoystickVirtual(SDL_JoystickID instance_id); +extern SDL_DECLSPEC bool SDLCALL SDL_IsJoystickVirtual(SDL_JoystickID instance_id); /** * Set the state of an axis on an opened virtual joystick. @@ -507,12 +521,12 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_IsJoystickVirtual(SDL_JoystickID instan * \param joystick the virtual joystick on which to set state. * \param axis the index of the axis on the virtual joystick to update. * \param value the new value for the specified axis. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetJoystickVirtualAxis(SDL_Joystick *joystick, int axis, Sint16 value); +extern SDL_DECLSPEC bool SDLCALL SDL_SetJoystickVirtualAxis(SDL_Joystick *joystick, int axis, Sint16 value); /** * Generate ball motion on an opened virtual joystick. @@ -527,12 +541,12 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetJoystickVirtualAxis(SDL_Joystick *jo * \param ball the index of the ball on the virtual joystick to update. * \param xrel the relative motion on the X axis. * \param yrel the relative motion on the Y axis. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetJoystickVirtualBall(SDL_Joystick *joystick, int ball, Sint16 xrel, Sint16 yrel); +extern SDL_DECLSPEC bool SDLCALL SDL_SetJoystickVirtualBall(SDL_Joystick *joystick, int ball, Sint16 xrel, Sint16 yrel); /** * Set the state of a button on an opened virtual joystick. @@ -545,13 +559,13 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetJoystickVirtualBall(SDL_Joystick *jo * * \param joystick the virtual joystick on which to set state. * \param button the index of the button on the virtual joystick to update. - * \param value the new value for the specified button. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \param down true if the button is pressed, false otherwise. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetJoystickVirtualButton(SDL_Joystick *joystick, int button, Uint8 value); +extern SDL_DECLSPEC bool SDLCALL SDL_SetJoystickVirtualButton(SDL_Joystick *joystick, int button, bool down); /** * Set the state of a hat on an opened virtual joystick. @@ -565,12 +579,12 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetJoystickVirtualButton(SDL_Joystick * * \param joystick the virtual joystick on which to set state. * \param hat the index of the hat on the virtual joystick to update. * \param value the new value for the specified hat. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetJoystickVirtualHat(SDL_Joystick *joystick, int hat, Uint8 value); +extern SDL_DECLSPEC bool SDLCALL SDL_SetJoystickVirtualHat(SDL_Joystick *joystick, int hat, Uint8 value); /** * Set touchpad finger state on an opened virtual joystick. @@ -585,19 +599,18 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetJoystickVirtualHat(SDL_Joystick *joy * \param touchpad the index of the touchpad on the virtual joystick to * update. * \param finger the index of the finger on the touchpad to set. - * \param state `SDL_PRESSED` if the finger is pressed, `SDL_RELEASED` if the - * finger is released. + * \param down true if the finger is pressed, false if the finger is released. * \param x the x coordinate of the finger on the touchpad, normalized 0 to 1, * with the origin in the upper left. * \param y the y coordinate of the finger on the touchpad, normalized 0 to 1, * with the origin in the upper left. * \param pressure the pressure of the finger. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetJoystickVirtualTouchpad(SDL_Joystick *joystick, int touchpad, int finger, Uint8 state, float x, float y, float pressure); +extern SDL_DECLSPEC bool SDLCALL SDL_SetJoystickVirtualTouchpad(SDL_Joystick *joystick, int touchpad, int finger, bool down, float x, float y, float pressure); /** * Send a sensor update for an opened virtual joystick. @@ -614,12 +627,12 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetJoystickVirtualTouchpad(SDL_Joystick * the sensor reading. * \param data the data associated with the sensor reading. * \param num_values the number of values pointed to by `data`. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SendJoystickVirtualSensorData(SDL_Joystick *joystick, SDL_SensorType type, Uint64 sensor_timestamp, const float *data, int num_values); +extern SDL_DECLSPEC bool SDLCALL SDL_SendJoystickVirtualSensorData(SDL_Joystick *joystick, SDL_SensorType type, Uint64 sensor_timestamp, const float *data, int num_values); /** * Get the properties associated with a joystick. @@ -698,14 +711,14 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetJoystickPlayerIndex(SDL_Joystick *joystic * \param joystick the SDL_Joystick obtained from SDL_OpenJoystick(). * \param player_index player index to assign to this joystick, or -1 to clear * the player index and turn off player LEDs. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_GetJoystickPlayerIndex */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetJoystickPlayerIndex(SDL_Joystick *joystick, int player_index); +extern SDL_DECLSPEC bool SDLCALL SDL_SetJoystickPlayerIndex(SDL_Joystick *joystick, int player_index); /** * Get the implementation-dependent GUID for the joystick. @@ -827,12 +840,12 @@ extern SDL_DECLSPEC void SDLCALL SDL_GetJoystickGUIDInfo(SDL_GUID guid, Uint16 * * Get the status of a specified joystick. * * \param joystick the joystick to query. - * \returns SDL_TRUE if the joystick has been opened, SDL_FALSE if it has not; - * call SDL_GetError() for more information. + * \returns true if the joystick has been opened, false if it has not; call + * SDL_GetError() for more information. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_JoystickConnected(SDL_Joystick *joystick); +extern SDL_DECLSPEC bool SDLCALL SDL_JoystickConnected(SDL_Joystick *joystick); /** * Get the instance ID of an opened joystick. @@ -932,7 +945,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetNumJoystickButtons(SDL_Joystick *joystick * \sa SDL_JoystickEventsEnabled * \sa SDL_UpdateJoysticks */ -extern SDL_DECLSPEC void SDLCALL SDL_SetJoystickEventsEnabled(SDL_bool enabled); +extern SDL_DECLSPEC void SDLCALL SDL_SetJoystickEventsEnabled(bool enabled); /** * Query the state of joystick event processing. @@ -941,14 +954,13 @@ extern SDL_DECLSPEC void SDLCALL SDL_SetJoystickEventsEnabled(SDL_bool enabled); * yourself and check the state of the joystick when you want joystick * information. * - * \returns SDL_TRUE if joystick events are being processed, SDL_FALSE - * otherwise. + * \returns true if joystick events are being processed, false otherwise. * * \since This function is available since SDL 3.0.0. * * \sa SDL_SetJoystickEventsEnabled */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_JoystickEventsEnabled(void); +extern SDL_DECLSPEC bool SDLCALL SDL_JoystickEventsEnabled(void); /** * Update the current state of the open joysticks. @@ -994,11 +1006,11 @@ extern SDL_DECLSPEC Sint16 SDLCALL SDL_GetJoystickAxis(SDL_Joystick *joystick, i * \param joystick an SDL_Joystick structure containing joystick information. * \param axis the axis to query; the axis indices start at index 0. * \param state upon return, the initial value is supplied here. - * \returns SDL_TRUE if this axis has any initial value, or SDL_FALSE if not. + * \returns true if this axis has any initial value, or false if not. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetJoystickAxisInitialState(SDL_Joystick *joystick, int axis, Sint16 *state); +extern SDL_DECLSPEC bool SDLCALL SDL_GetJoystickAxisInitialState(SDL_Joystick *joystick, int axis, Sint16 *state); /** * Get the ball axis change since the last poll. @@ -1012,14 +1024,14 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetJoystickAxisInitialState(SDL_Joystic * \param ball the ball index to query; ball indices start at index 0. * \param dx stores the difference in the x axis position since the last poll. * \param dy stores the difference in the y axis position since the last poll. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_GetNumJoystickBalls */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetJoystickBall(SDL_Joystick *joystick, int ball, int *dx, int *dy); +extern SDL_DECLSPEC bool SDLCALL SDL_GetJoystickBall(SDL_Joystick *joystick, int ball, int *dx, int *dy); /** * Get the current state of a POV hat on a joystick. @@ -1052,13 +1064,13 @@ extern SDL_DECLSPEC Uint8 SDLCALL SDL_GetJoystickHat(SDL_Joystick *joystick, int * \param joystick an SDL_Joystick structure containing joystick information. * \param button the button index to get the state from; indices start at * index 0. - * \returns 1 if the specified button is pressed, 0 otherwise. + * \returns true if the button is pressed, false otherwise. * * \since This function is available since SDL 3.0.0. * * \sa SDL_GetNumJoystickButtons */ -extern SDL_DECLSPEC Uint8 SDLCALL SDL_GetJoystickButton(SDL_Joystick *joystick, int button); +extern SDL_DECLSPEC bool SDLCALL SDL_GetJoystickButton(SDL_Joystick *joystick, int button); /** * Start a rumble effect. @@ -1075,11 +1087,11 @@ extern SDL_DECLSPEC Uint8 SDLCALL SDL_GetJoystickButton(SDL_Joystick *joystick, * \param high_frequency_rumble the intensity of the high frequency (right) * rumble motor, from 0 to 0xFFFF. * \param duration_ms the duration of the rumble effect, in milliseconds. - * \returns SDL_TRUE, or SDL_FALSE if rumble isn't supported on this joystick. + * \returns true, or false if rumble isn't supported on this joystick. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_RumbleJoystick(SDL_Joystick *joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms); +extern SDL_DECLSPEC bool SDLCALL SDL_RumbleJoystick(SDL_Joystick *joystick, Uint16 low_frequency_rumble, Uint16 high_frequency_rumble, Uint32 duration_ms); /** * Start a rumble effect in the joystick's triggers. @@ -1101,14 +1113,14 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_RumbleJoystick(SDL_Joystick *joystick, * \param right_rumble the intensity of the right trigger rumble motor, from 0 * to 0xFFFF. * \param duration_ms the duration of the rumble effect, in milliseconds. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_RumbleJoystick */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_RumbleJoystickTriggers(SDL_Joystick *joystick, Uint16 left_rumble, Uint16 right_rumble, Uint32 duration_ms); +extern SDL_DECLSPEC bool SDLCALL SDL_RumbleJoystickTriggers(SDL_Joystick *joystick, Uint16 left_rumble, Uint16 right_rumble, Uint32 duration_ms); /** * Update a joystick's LED color. @@ -1123,12 +1135,12 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_RumbleJoystickTriggers(SDL_Joystick *jo * \param red the intensity of the red LED. * \param green the intensity of the green LED. * \param blue the intensity of the blue LED. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetJoystickLED(SDL_Joystick *joystick, Uint8 red, Uint8 green, Uint8 blue); +extern SDL_DECLSPEC bool SDLCALL SDL_SetJoystickLED(SDL_Joystick *joystick, Uint8 red, Uint8 green, Uint8 blue); /** * Send a joystick specific effect packet. @@ -1136,12 +1148,12 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetJoystickLED(SDL_Joystick *joystick, * \param joystick the joystick to affect. * \param data the data to send to the joystick. * \param size the size of the data to send to the joystick. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SendJoystickEffect(SDL_Joystick *joystick, const void *data, int size); +extern SDL_DECLSPEC bool SDLCALL SDL_SendJoystickEffect(SDL_Joystick *joystick, const void *data, int size); /** * Close a joystick previously opened with SDL_OpenJoystick(). diff --git a/include/SDL3/SDL_keyboard.h b/include/SDL3/SDL_keyboard.h index ec6c3f23..f6ab13bb 100644 --- a/include/SDL3/SDL_keyboard.h +++ b/include/SDL3/SDL_keyboard.h @@ -31,6 +31,9 @@ #include #include #include +#include +#include +#include #include #include @@ -56,13 +59,13 @@ typedef Uint32 SDL_KeyboardID; /** * Return whether a keyboard is currently connected. * - * \returns SDL_TRUE if a keyboard is connected, SDL_FALSE otherwise. + * \returns true if a keyboard is connected, false otherwise. * * \since This function is available since SDL 3.0.0. * * \sa SDL_GetKeyboards */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_HasKeyboard(void); +extern SDL_DECLSPEC bool SDLCALL SDL_HasKeyboard(void); /** * Get a list of currently connected keyboards. @@ -116,9 +119,9 @@ extern SDL_DECLSPEC SDL_Window * SDLCALL SDL_GetKeyboardFocus(void); * valid for the whole lifetime of the application and should not be freed by * the caller. * - * A array element with a value of 1 means that the key is pressed and a value - * of 0 means that it is not. Indexes into this array are obtained by using - * SDL_Scancode values. + * A array element with a value of true means that the key is pressed and a + * value of false means that it is not. Indexes into this array are obtained + * by using SDL_Scancode values. * * Use SDL_PumpEvents() to update the state array. * @@ -138,7 +141,7 @@ extern SDL_DECLSPEC SDL_Window * SDLCALL SDL_GetKeyboardFocus(void); * \sa SDL_PumpEvents * \sa SDL_ResetKeyboard */ -extern SDL_DECLSPEC const Uint8 * SDLCALL SDL_GetKeyboardState(int *numkeys); +extern SDL_DECLSPEC const bool * SDLCALL SDL_GetKeyboardState(int *numkeys); /** * Clear the state of the keyboard. @@ -189,13 +192,13 @@ extern SDL_DECLSPEC void SDLCALL SDL_SetModState(SDL_Keymod modstate); * * If you want to get the keycode as it would be delivered in key events, * including options specified in SDL_HINT_KEYCODE_OPTIONS, then you should - * pass `key_event` as SDL_TRUE. Otherwise this function simply translates the + * pass `key_event` as true. Otherwise this function simply translates the * scancode based on the given modifier state. * * \param scancode the desired SDL_Scancode to query. * \param modstate the modifier state to use when translating the scancode to * a keycode. - * \param key_event SDL_TRUE if the keycode will be used in key events. + * \param key_event true if the keycode will be used in key events. * \returns the SDL_Keycode that corresponds to the given SDL_Scancode. * * \since This function is available since SDL 3.0.0. @@ -203,7 +206,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_SetModState(SDL_Keymod modstate); * \sa SDL_GetKeyName * \sa SDL_GetScancodeFromKey */ -extern SDL_DECLSPEC SDL_Keycode SDLCALL SDL_GetKeyFromScancode(SDL_Scancode scancode, SDL_Keymod modstate, SDL_bool key_event); +extern SDL_DECLSPEC SDL_Keycode SDLCALL SDL_GetKeyFromScancode(SDL_Scancode scancode, SDL_Keymod modstate, bool key_event); /** * Get the scancode corresponding to the given key code according to the @@ -231,14 +234,14 @@ extern SDL_DECLSPEC SDL_Scancode SDLCALL SDL_GetScancodeFromKey(SDL_Keycode key, * \param name the name to use for the scancode, encoded as UTF-8. The string * is not copied, so the pointer given to this function must stay * valid while SDL is being used. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_GetScancodeName */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetScancodeName(SDL_Scancode scancode, const char *name); +extern SDL_DECLSPEC bool SDLCALL SDL_SetScancodeName(SDL_Scancode scancode, const char *name); /** * Get a human-readable name for a scancode. @@ -322,8 +325,8 @@ extern SDL_DECLSPEC SDL_Keycode SDLCALL SDL_GetKeyFromName(const char *name); * On some platforms using this function shows the screen keyboard. * * \param window the window to enable text input. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * @@ -332,7 +335,7 @@ extern SDL_DECLSPEC SDL_Keycode SDLCALL SDL_GetKeyFromName(const char *name); * \sa SDL_StopTextInput * \sa SDL_TextInputActive */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_StartTextInput(SDL_Window *window); +extern SDL_DECLSPEC bool SDLCALL SDL_StartTextInput(SDL_Window *window); /** * Text input type. @@ -400,11 +403,11 @@ typedef enum SDL_Capitalization * SDL_TEXTINPUT_TYPE_TEXT_NAME, and SDL_CAPITALIZE_NONE for e-mail * addresses, usernames, and passwords. * - `SDL_PROP_TEXTINPUT_AUTOCORRECT_BOOLEAN` - true to enable auto completion - * and auto correction, defaults to SDL_TRUE. + * and auto correction, defaults to true. * - `SDL_PROP_TEXTINPUT_MULTILINE_BOOLEAN` - true if multiple lines of text - * are allowed. This defaults to SDL_TRUE if SDL_HINT_RETURN_KEY_HIDES_IME - * is "0" or is not set, and defaults to SDL_FALSE if - * SDL_HINT_RETURN_KEY_HIDES_IME is "1". + * are allowed. This defaults to true if SDL_HINT_RETURN_KEY_HIDES_IME is + * "0" or is not set, and defaults to false if SDL_HINT_RETURN_KEY_HIDES_IME + * is "1". * * On Android you can directly specify the input type: * @@ -414,8 +417,8 @@ typedef enum SDL_Capitalization * * \param window the window to enable text input. * \param props the properties to use. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * @@ -424,7 +427,7 @@ typedef enum SDL_Capitalization * \sa SDL_StopTextInput * \sa SDL_TextInputActive */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_StartTextInputWithProperties(SDL_Window *window, SDL_PropertiesID props); +extern SDL_DECLSPEC bool SDLCALL SDL_StartTextInputWithProperties(SDL_Window *window, SDL_PropertiesID props); #define SDL_PROP_TEXTINPUT_TYPE_NUMBER "SDL.textinput.type" #define SDL_PROP_TEXTINPUT_CAPITALIZATION_NUMBER "SDL.textinput.capitalization" @@ -436,13 +439,13 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_StartTextInputWithProperties(SDL_Window * Check whether or not Unicode text input events are enabled for a window. * * \param window the window to check. - * \returns SDL_TRUE if text input events are enabled else SDL_FALSE. + * \returns true if text input events are enabled else false. * * \since This function is available since SDL 3.0.0. * * \sa SDL_StartTextInput */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_TextInputActive(SDL_Window *window); +extern SDL_DECLSPEC bool SDLCALL SDL_TextInputActive(SDL_Window *window); /** * Stop receiving any text input events in a window. @@ -451,28 +454,28 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_TextInputActive(SDL_Window *window); * it. * * \param window the window to disable text input. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_StartTextInput */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_StopTextInput(SDL_Window *window); +extern SDL_DECLSPEC bool SDLCALL SDL_StopTextInput(SDL_Window *window); /** * Dismiss the composition window/IME without disabling the subsystem. * * \param window the window to affect. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_StartTextInput * \sa SDL_StopTextInput */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ClearComposition(SDL_Window *window); +extern SDL_DECLSPEC bool SDLCALL SDL_ClearComposition(SDL_Window *window); /** * Set the area used to type Unicode text input. @@ -485,15 +488,15 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ClearComposition(SDL_Window *window); * coordinates, or NULL to clear it. * \param cursor the offset of the current cursor location relative to * `rect->x`, in window coordinates. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_GetTextInputArea * \sa SDL_StartTextInput */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetTextInputArea(SDL_Window *window, const SDL_Rect *rect, int cursor); +extern SDL_DECLSPEC bool SDLCALL SDL_SetTextInputArea(SDL_Window *window, const SDL_Rect *rect, int cursor); /** * Get the area used to type Unicode text input. @@ -505,39 +508,39 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetTextInputArea(SDL_Window *window, co * may be NULL. * \param cursor a pointer to the offset of the current cursor location * relative to `rect->x`, may be NULL. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_SetTextInputArea */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetTextInputArea(SDL_Window *window, SDL_Rect *rect, int *cursor); +extern SDL_DECLSPEC bool SDLCALL SDL_GetTextInputArea(SDL_Window *window, SDL_Rect *rect, int *cursor); /** * Check whether the platform has screen keyboard support. * - * \returns SDL_TRUE if the platform has some screen keyboard support or - * SDL_FALSE if not. + * \returns true if the platform has some screen keyboard support or false if + * not. * * \since This function is available since SDL 3.0.0. * * \sa SDL_StartTextInput * \sa SDL_ScreenKeyboardShown */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_HasScreenKeyboardSupport(void); +extern SDL_DECLSPEC bool SDLCALL SDL_HasScreenKeyboardSupport(void); /** * Check whether the screen keyboard is shown for given window. * * \param window the window for which screen keyboard should be queried. - * \returns SDL_TRUE if screen keyboard is shown or SDL_FALSE if not. + * \returns true if screen keyboard is shown or false if not. * * \since This function is available since SDL 3.0.0. * * \sa SDL_HasScreenKeyboardSupport */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ScreenKeyboardShown(SDL_Window *window); +extern SDL_DECLSPEC bool SDLCALL SDL_ScreenKeyboardShown(SDL_Window *window); /* Ends C function definitions when using C++ */ #ifdef __cplusplus diff --git a/include/SDL3/SDL_log.h b/include/SDL3/SDL_log.h index 2906cd3f..8feb9e0a 100644 --- a/include/SDL3/SDL_log.h +++ b/include/SDL3/SDL_log.h @@ -87,12 +87,11 @@ typedef enum SDL_LogCategory SDL_LOG_CATEGORY_AUDIO, SDL_LOG_CATEGORY_VIDEO, SDL_LOG_CATEGORY_RENDER, - SDL_LOG_CATEGORY_GPU, SDL_LOG_CATEGORY_INPUT, SDL_LOG_CATEGORY_TEST, + SDL_LOG_CATEGORY_GPU, /* Reserved for future SDL library use */ - SDL_LOG_CATEGORY_RESERVED1, SDL_LOG_CATEGORY_RESERVED2, SDL_LOG_CATEGORY_RESERVED3, SDL_LOG_CATEGORY_RESERVED4, @@ -121,13 +120,15 @@ typedef enum SDL_LogCategory */ typedef enum SDL_LogPriority { - SDL_LOG_PRIORITY_VERBOSE = 1, + SDL_LOG_PRIORITY_INVALID, + SDL_LOG_PRIORITY_TRACE, + SDL_LOG_PRIORITY_VERBOSE, SDL_LOG_PRIORITY_DEBUG, SDL_LOG_PRIORITY_INFO, SDL_LOG_PRIORITY_WARN, SDL_LOG_PRIORITY_ERROR, SDL_LOG_PRIORITY_CRITICAL, - SDL_NUM_LOG_PRIORITIES + SDL_LOG_PRIORITY_COUNT } SDL_LogPriority; @@ -136,6 +137,8 @@ typedef enum SDL_LogPriority * * \param priority the SDL_LogPriority to assign. * + * \threadsafety It is safe to call this function from any thread. + * * \since This function is available since SDL 3.0.0. * * \sa SDL_ResetLogPriorities @@ -149,14 +152,15 @@ extern SDL_DECLSPEC void SDLCALL SDL_SetLogPriorities(SDL_LogPriority priority); * \param category the category to assign a priority to. * \param priority the SDL_LogPriority to assign. * + * \threadsafety It is safe to call this function from any thread. + * * \since This function is available since SDL 3.0.0. * * \sa SDL_GetLogPriority * \sa SDL_ResetLogPriorities * \sa SDL_SetLogPriorities */ -extern SDL_DECLSPEC void SDLCALL SDL_SetLogPriority(int category, - SDL_LogPriority priority); +extern SDL_DECLSPEC void SDLCALL SDL_SetLogPriority(int category, SDL_LogPriority priority); /** * Get the priority of a particular log category. @@ -164,6 +168,8 @@ extern SDL_DECLSPEC void SDLCALL SDL_SetLogPriority(int category, * \param category the category to query. * \returns the SDL_LogPriority for the requested category. * + * \threadsafety It is safe to call this function from any thread. + * * \since This function is available since SDL 3.0.0. * * \sa SDL_SetLogPriority @@ -175,6 +181,8 @@ extern SDL_DECLSPEC SDL_LogPriority SDLCALL SDL_GetLogPriority(int category); * * This is called by SDL_Quit(). * + * \threadsafety It is safe to call this function from any thread. + * * \since This function is available since SDL 3.0.0. * * \sa SDL_SetLogPriorities @@ -192,15 +200,17 @@ extern SDL_DECLSPEC void SDLCALL SDL_ResetLogPriorities(void); * \param priority the SDL_LogPriority to modify. * \param prefix the prefix to use for that log priority, or NULL to use no * prefix. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. + * + * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.0.0. * * \sa SDL_SetLogPriorities * \sa SDL_SetLogPriority */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetLogPriorityPrefix(SDL_LogPriority priority, const char *prefix); +extern SDL_DECLSPEC bool SDLCALL SDL_SetLogPriorityPrefix(SDL_LogPriority priority, const char *prefix); /** * Log a message with SDL_LOG_CATEGORY_APPLICATION and SDL_LOG_PRIORITY_INFO. @@ -209,6 +219,8 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetLogPriorityPrefix(SDL_LogPriority pr * \param ... additional parameters matching % tokens in the `fmt` string, if * any. * + * \threadsafety It is safe to call this function from any thread. + * * \since This function is available since SDL 3.0.0. * * \sa SDL_LogCritical @@ -217,11 +229,37 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetLogPriorityPrefix(SDL_LogPriority pr * \sa SDL_LogInfo * \sa SDL_LogMessage * \sa SDL_LogMessageV + * \sa SDL_LogTrace * \sa SDL_LogVerbose * \sa SDL_LogWarn */ extern SDL_DECLSPEC void SDLCALL SDL_Log(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(1); +/** + * Log a message with SDL_LOG_PRIORITY_TRACE. + * + * \param category the category of the message. + * \param fmt a printf() style message format string. + * \param ... additional parameters matching % tokens in the **fmt** string, + * if any. + * + * \threadsafety It is safe to call this function from any thread. + * + * \since This function is available since SDL 3.0.0. + * + * \sa SDL_Log + * \sa SDL_LogCritical + * \sa SDL_LogDebug + * \sa SDL_LogError + * \sa SDL_LogInfo + * \sa SDL_LogMessage + * \sa SDL_LogMessageV + * \sa SDL_LogTrace + * \sa SDL_LogVerbose + * \sa SDL_LogWarn + */ +extern SDL_DECLSPEC void SDLCALL SDL_LogTrace(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2); + /** * Log a message with SDL_LOG_PRIORITY_VERBOSE. * @@ -230,6 +268,8 @@ extern SDL_DECLSPEC void SDLCALL SDL_Log(SDL_PRINTF_FORMAT_STRING const char *fm * \param ... additional parameters matching % tokens in the **fmt** string, * if any. * + * \threadsafety It is safe to call this function from any thread. + * * \since This function is available since SDL 3.0.0. * * \sa SDL_Log @@ -251,6 +291,8 @@ extern SDL_DECLSPEC void SDLCALL SDL_LogVerbose(int category, SDL_PRINTF_FORMAT_ * \param ... additional parameters matching % tokens in the **fmt** string, * if any. * + * \threadsafety It is safe to call this function from any thread. + * * \since This function is available since SDL 3.0.0. * * \sa SDL_Log @@ -259,6 +301,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_LogVerbose(int category, SDL_PRINTF_FORMAT_ * \sa SDL_LogInfo * \sa SDL_LogMessage * \sa SDL_LogMessageV + * \sa SDL_LogTrace * \sa SDL_LogVerbose * \sa SDL_LogWarn */ @@ -272,6 +315,8 @@ extern SDL_DECLSPEC void SDLCALL SDL_LogDebug(int category, SDL_PRINTF_FORMAT_ST * \param ... additional parameters matching % tokens in the **fmt** string, * if any. * + * \threadsafety It is safe to call this function from any thread. + * * \since This function is available since SDL 3.0.0. * * \sa SDL_Log @@ -280,6 +325,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_LogDebug(int category, SDL_PRINTF_FORMAT_ST * \sa SDL_LogError * \sa SDL_LogMessage * \sa SDL_LogMessageV + * \sa SDL_LogTrace * \sa SDL_LogVerbose * \sa SDL_LogWarn */ @@ -293,6 +339,8 @@ extern SDL_DECLSPEC void SDLCALL SDL_LogInfo(int category, SDL_PRINTF_FORMAT_STR * \param ... additional parameters matching % tokens in the **fmt** string, * if any. * + * \threadsafety It is safe to call this function from any thread. + * * \since This function is available since SDL 3.0.0. * * \sa SDL_Log @@ -302,6 +350,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_LogInfo(int category, SDL_PRINTF_FORMAT_STR * \sa SDL_LogInfo * \sa SDL_LogMessage * \sa SDL_LogMessageV + * \sa SDL_LogTrace * \sa SDL_LogVerbose */ extern SDL_DECLSPEC void SDLCALL SDL_LogWarn(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2); @@ -314,6 +363,8 @@ extern SDL_DECLSPEC void SDLCALL SDL_LogWarn(int category, SDL_PRINTF_FORMAT_STR * \param ... additional parameters matching % tokens in the **fmt** string, * if any. * + * \threadsafety It is safe to call this function from any thread. + * * \since This function is available since SDL 3.0.0. * * \sa SDL_Log @@ -322,6 +373,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_LogWarn(int category, SDL_PRINTF_FORMAT_STR * \sa SDL_LogInfo * \sa SDL_LogMessage * \sa SDL_LogMessageV + * \sa SDL_LogTrace * \sa SDL_LogVerbose * \sa SDL_LogWarn */ @@ -335,6 +387,8 @@ extern SDL_DECLSPEC void SDLCALL SDL_LogError(int category, SDL_PRINTF_FORMAT_ST * \param ... additional parameters matching % tokens in the **fmt** string, * if any. * + * \threadsafety It is safe to call this function from any thread. + * * \since This function is available since SDL 3.0.0. * * \sa SDL_Log @@ -343,6 +397,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_LogError(int category, SDL_PRINTF_FORMAT_ST * \sa SDL_LogInfo * \sa SDL_LogMessage * \sa SDL_LogMessageV + * \sa SDL_LogTrace * \sa SDL_LogVerbose * \sa SDL_LogWarn */ @@ -357,6 +412,8 @@ extern SDL_DECLSPEC void SDLCALL SDL_LogCritical(int category, SDL_PRINTF_FORMAT * \param ... additional parameters matching % tokens in the **fmt** string, * if any. * + * \threadsafety It is safe to call this function from any thread. + * * \since This function is available since SDL 3.0.0. * * \sa SDL_Log @@ -365,6 +422,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_LogCritical(int category, SDL_PRINTF_FORMAT * \sa SDL_LogError * \sa SDL_LogInfo * \sa SDL_LogMessageV + * \sa SDL_LogTrace * \sa SDL_LogVerbose * \sa SDL_LogWarn */ @@ -380,6 +438,8 @@ extern SDL_DECLSPEC void SDLCALL SDL_LogMessage(int category, * \param fmt a printf() style message format string. * \param ap a variable argument list. * + * \threadsafety It is safe to call this function from any thread. + * * \since This function is available since SDL 3.0.0. * * \sa SDL_Log @@ -388,6 +448,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_LogMessage(int category, * \sa SDL_LogError * \sa SDL_LogInfo * \sa SDL_LogMessage + * \sa SDL_LogTrace * \sa SDL_LogVerbose * \sa SDL_LogWarn */ @@ -398,7 +459,9 @@ extern SDL_DECLSPEC void SDLCALL SDL_LogMessageV(int category, /** * The prototype for the log output callback function. * - * This function is called by SDL when there is new text to be logged. + * This function is called by SDL when there is new text to be logged. A mutex + * is held so that this function is never called by more than one thread at + * once. * * \param userdata what was passed as `userdata` to * SDL_SetLogOutputFunction(). @@ -418,6 +481,8 @@ typedef void (SDLCALL *SDL_LogOutputFunction)(void *userdata, int category, SDL_ * \param userdata a pointer filled in with the pointer that is passed to * `callback`. * + * \threadsafety It is safe to call this function from any thread. + * * \since This function is available since SDL 3.0.0. * * \sa SDL_SetLogOutputFunction @@ -430,6 +495,8 @@ extern SDL_DECLSPEC void SDLCALL SDL_GetLogOutputFunction(SDL_LogOutputFunction * \param callback an SDL_LogOutputFunction to call instead of the default. * \param userdata a pointer that is passed to `callback`. * + * \threadsafety It is safe to call this function from any thread. + * * \since This function is available since SDL 3.0.0. * * \sa SDL_GetLogOutputFunction diff --git a/include/SDL3/SDL_main.h b/include/SDL3/SDL_main.h index 12e8ffdc..b5cad4c7 100644 --- a/include/SDL3/SDL_main.h +++ b/include/SDL3/SDL_main.h @@ -48,20 +48,6 @@ */ #define SDL_MAIN_AVAILABLE - #elif defined(SDL_PLATFORM_WINRT) - /* On WinRT, SDL provides a main function that initializes CoreApplication, - creating an instance of IFrameworkView in the process. - - Ideally, #include'ing SDL_main.h is enough to get a main() function working. - However, that requires the source file your main() is in to be compiled - as C++ *and* with the /ZW compiler flag. If that's not feasible, add an - otherwise empty .cpp file that only contains `#include ` - and build that with /ZW (still include SDL_main.h in your other file with main()!). - In XAML apps, instead the function SDL_RunApp() must be called with a pointer - to the Direct3D-hosted XAML control passed in as the "reserved" argument. - */ - #define SDL_MAIN_NEEDED - #elif defined(SDL_PLATFORM_GDK) /* On GDK, SDL provides a main function that initializes the game runtime. @@ -517,7 +503,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_RunApp(int argc, char *argv[], SDL_main_func extern SDL_DECLSPEC int SDLCALL SDL_EnterAppMainCallbacks(int argc, char *argv[], SDL_AppInit_func appinit, SDL_AppIterate_func appiter, SDL_AppEvent_func appevent, SDL_AppQuit_func appquit); -#if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK) +#if defined(SDL_PLATFORM_WINDOWS) /** * Register a win32 window class for SDL's use. @@ -538,12 +524,12 @@ extern SDL_DECLSPEC int SDLCALL SDL_EnterAppMainCallbacks(int argc, char *argv[] * what is specified here. * \param hInst the HINSTANCE to use in WNDCLASSEX::hInstance. If zero, SDL * will use `GetModuleHandle(NULL)` instead. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_RegisterApp(const char *name, Uint32 style, void *hInst); +extern SDL_DECLSPEC bool SDLCALL SDL_RegisterApp(const char *name, Uint32 style, void *hInst); /** * Deregister the win32 window class from an SDL_RegisterApp call. @@ -562,7 +548,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_RegisterApp(const char *name, Uint32 st */ extern SDL_DECLSPEC void SDLCALL SDL_UnregisterApp(void); -#endif /* defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK) */ +#endif /* defined(SDL_PLATFORM_WINDOWS) */ #ifdef SDL_PLATFORM_GDK @@ -584,14 +570,14 @@ extern SDL_DECLSPEC void SDLCALL SDL_GDKSuspendComplete(void); #if !defined(SDL_MAIN_HANDLED) && !defined(SDL_MAIN_NOIMPL) /* include header-only SDL_main implementations */ #if defined(SDL_MAIN_USE_CALLBACKS) \ - || defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK) || defined(SDL_PLATFORM_IOS) || defined(SDL_PLATFORM_TVOS) \ + || defined(SDL_PLATFORM_WINDOWS) || defined(SDL_PLATFORM_IOS) || defined(SDL_PLATFORM_TVOS) \ || defined(SDL_PLATFORM_3DS) || defined(SDL_PLATFORM_NGAGE) || defined(SDL_PLATFORM_PS2) || defined(SDL_PLATFORM_PSP) \ || defined(SDL_PLATFORM_EMSCRIPTEN) /* platforms which main (-equivalent) can be implemented in plain C */ #include - #elif defined(SDL_PLATFORM_WINRT) /* C++ platforms */ + #elif 0 /* C++ platforms (currently none, this used to be here for WinRT, but is left for future platforms that might arrive. */ #ifdef __cplusplus #include #else @@ -605,7 +591,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_GDKSuspendComplete(void); #endif /* __GNUC__ */ #endif /* __cplusplus */ - #endif /* C++ platforms like SDL_PLATFORM_WINRT etc */ + #endif /* C++ platforms */ #endif #endif /* SDL_main_h_ */ diff --git a/include/SDL3/SDL_main_impl.h b/include/SDL3/SDL_main_impl.h index ad122dfc..feca572b 100644 --- a/include/SDL3/SDL_main_impl.h +++ b/include/SDL3/SDL_main_impl.h @@ -67,7 +67,7 @@ /* set up the usual SDL_main stuff if we're not using callbacks or if we are but need the normal entry point. */ #if !defined(SDL_MAIN_USE_CALLBACKS) || defined(SDL_MAIN_CALLBACK_STANDARD) - #if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK) + #if defined(SDL_PLATFORM_WINDOWS) /* these defines/typedefs are needed for the WinMain() definition */ #ifndef WINAPI @@ -124,71 +124,7 @@ } /* extern "C" */ #endif - /* end of SDL_PLATFORM_WIN32 and SDL_PLATFORM_GDK impls */ - - #elif defined(SDL_PLATFORM_WINRT) - - /* WinRT main based on SDL_winrt_main_NonXAML.cpp, placed in the public domain by David Ludwig 3/13/14 */ - - #include - - /* At least one file in any SDL/WinRT app appears to require compilation - with C++/CX, otherwise a Windows Metadata file won't get created, and - an APPX0702 build error can appear shortly after linking. - - The following set of preprocessor code forces this file to be compiled - as C++/CX, which appears to cause Visual C++ 2012's build tools to - create this .winmd file, and will help allow builds of SDL/WinRT apps - to proceed without error. - - If other files in an app's project enable C++/CX compilation, then it might - be possible for the .cpp file including SDL_main.h to be compiled without /ZW, - for Visual C++'s build tools to create a winmd file, and for the app to - build without APPX0702 errors. In this case, if - SDL_WINRT_METADATA_FILE_AVAILABLE is defined as a C/C++ macro, then - the #error (to force C++/CX compilation) will be disabled. - - Please note that /ZW can be specified on a file-by-file basis. To do this, - right click on the file in Visual C++, click Properties, then change the - setting through the dialog that comes up. - */ - #ifndef SDL_WINRT_METADATA_FILE_AVAILABLE - #if !defined(__cplusplus) || (!defined(__cplusplus_winrt) && _MSVC_LANG < 202002L) - #error The C++ file that includes SDL_main.h must be compiled as C++ code with /ZW, otherwise build errors due to missing .winmd files can occur. - #endif - #endif - - /* Prevent MSVC++ from warning about threading models when defining our - custom WinMain. The threading model will instead be set via a direct - call to Windows::Foundation::Initialize (rather than via an attributed - function). - - To note, this warning (C4447) does not seem to come up unless this file - is compiled with C++/CX enabled (via the /ZW compiler flag). - */ - #ifdef _MSC_VER - #pragma warning(disable : 4447) - /* Make sure the function to initialize the Windows Runtime gets linked in. */ - #pragma comment(lib, "runtimeobject.lib") - #endif - - #ifdef __cplusplus - extern "C" { - #endif - int CALLBACK WinMain(HINSTANCE, HINSTANCE, LPSTR, int) - { - return SDL_RunApp(0, NULL, SDL_main, NULL); - } - #if _MSVC_LANG >= 202002L - int main(int argc, char** argv) { - return SDL_RunApp(argc, argv, SDL_main, NULL); - } - #endif - #ifdef __cplusplus - } /* extern "C" */ - #endif - - /* end of WinRT impl */ + /* end of SDL_PLATFORM_WINDOWS impls */ #elif defined(SDL_PLATFORM_NGAGE) /* same typedef as in ngage SDKs e32def.h */ diff --git a/include/SDL3/SDL_messagebox.h b/include/SDL3/SDL_messagebox.h index c626b228..ff22baf9 100644 --- a/include/SDL3/SDL_messagebox.h +++ b/include/SDL3/SDL_messagebox.h @@ -96,7 +96,7 @@ typedef enum SDL_MessageBoxColorType SDL_MESSAGEBOX_COLOR_BUTTON_BORDER, SDL_MESSAGEBOX_COLOR_BUTTON_BACKGROUND, SDL_MESSAGEBOX_COLOR_BUTTON_SELECTED, - SDL_MESSAGEBOX_COLOR_MAX /**< Size of the colors array of SDL_MessageBoxColorScheme. */ + SDL_MESSAGEBOX_COLOR_COUNT /**< Size of the colors array of SDL_MessageBoxColorScheme. */ } SDL_MessageBoxColorType; /** @@ -106,7 +106,7 @@ typedef enum SDL_MessageBoxColorType */ typedef struct SDL_MessageBoxColorScheme { - SDL_MessageBoxColor colors[SDL_MESSAGEBOX_COLOR_MAX]; + SDL_MessageBoxColor colors[SDL_MESSAGEBOX_COLOR_COUNT]; } SDL_MessageBoxColorScheme; /** @@ -154,14 +154,14 @@ typedef struct SDL_MessageBoxData * other options. * \param buttonid the pointer to which user id of hit button should be * copied. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_ShowSimpleMessageBox */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid); +extern SDL_DECLSPEC bool SDLCALL SDL_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid); /** * Display a simple modal message box. @@ -196,14 +196,14 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ShowMessageBox(const SDL_MessageBoxData * \param title uTF-8 title text. * \param message uTF-8 message text. * \param window the parent window, or NULL for no parent. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_ShowMessageBox */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ShowSimpleMessageBox(SDL_MessageBoxFlags flags, const char *title, const char *message, SDL_Window *window); +extern SDL_DECLSPEC bool SDLCALL SDL_ShowSimpleMessageBox(SDL_MessageBoxFlags flags, const char *title, const char *message, SDL_Window *window); /* Ends C function definitions when using C++ */ diff --git a/include/SDL3/SDL_misc.h b/include/SDL3/SDL_misc.h index 23317e01..2d5aa153 100644 --- a/include/SDL3/SDL_misc.h +++ b/include/SDL3/SDL_misc.h @@ -62,12 +62,12 @@ extern "C" { * * \param url a valid URL/URI to open. Use `file:///full/path/to/file` for * local files, if supported. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_OpenURL(const char *url); +extern SDL_DECLSPEC bool SDLCALL SDL_OpenURL(const char *url); /* Ends C function definitions when using C++ */ #ifdef __cplusplus diff --git a/include/SDL3/SDL_mouse.h b/include/SDL3/SDL_mouse.h index 90c85600..0da68b3c 100644 --- a/include/SDL3/SDL_mouse.h +++ b/include/SDL3/SDL_mouse.h @@ -30,6 +30,7 @@ #include #include +#include #include #include @@ -86,7 +87,7 @@ typedef enum SDL_SystemCursor SDL_SYSTEM_CURSOR_S_RESIZE, /**< Window resize bottom. May be NS_RESIZE. */ SDL_SYSTEM_CURSOR_SW_RESIZE, /**< Window resize bottom-left. May be NESW_RESIZE. */ SDL_SYSTEM_CURSOR_W_RESIZE, /**< Window resize left. May be EW_RESIZE. */ - SDL_NUM_SYSTEM_CURSORS + SDL_SYSTEM_CURSOR_COUNT } SDL_SystemCursor; /** @@ -136,13 +137,13 @@ typedef Uint32 SDL_MouseButtonFlags; /** * Return whether a mouse is currently connected. * - * \returns SDL_TRUE if a mouse is connected, SDL_FALSE otherwise. + * \returns true if a mouse is connected, false otherwise. * * \since This function is available since SDL 3.0.0. * * \sa SDL_GetMice */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_HasMouse(void); +extern SDL_DECLSPEC bool SDLCALL SDL_HasMouse(void); /** * Get a list of currently connected mice. @@ -295,14 +296,14 @@ extern SDL_DECLSPEC void SDLCALL SDL_WarpMouseInWindow(SDL_Window * window, * * \param x the x coordinate. * \param y the y coordinate. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_WarpMouseInWindow */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_WarpMouseGlobal(float x, float y); +extern SDL_DECLSPEC bool SDLCALL SDL_WarpMouseGlobal(float x, float y); /** * Set relative mouse mode for a window. @@ -315,28 +316,27 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_WarpMouseGlobal(float x, float y); * This function will flush any pending mouse motion for this window. * * \param window the window to change. - * \param enabled SDL_TRUE to enable relative mode, SDL_FALSE to disable. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \param enabled true to enable relative mode, false to disable. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_GetWindowRelativeMouseMode */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetWindowRelativeMouseMode(SDL_Window *window, SDL_bool enabled); +extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowRelativeMouseMode(SDL_Window *window, bool enabled); /** * Query whether relative mouse mode is enabled for a window. * * \param window the window to query. - * \returns SDL_TRUE if relative mode is enabled for a window or SDL_FALSE - * otherwise. + * \returns true if relative mode is enabled for a window or false otherwise. * * \since This function is available since SDL 3.0.0. * * \sa SDL_SetWindowRelativeMouseMode */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetWindowRelativeMouseMode(SDL_Window *window); +extern SDL_DECLSPEC bool SDLCALL SDL_GetWindowRelativeMouseMode(SDL_Window *window); /** * Capture the mouse and to track input outside an SDL window. @@ -374,15 +374,15 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetWindowRelativeMouseMode(SDL_Window * * app, you can disable auto capture by setting the * `SDL_HINT_MOUSE_AUTO_CAPTURE` hint to zero. * - * \param enabled SDL_TRUE to enable capturing, SDL_FALSE to disable. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \param enabled true to enable capturing, false to disable. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_GetGlobalMouseState */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_CaptureMouse(SDL_bool enabled); +extern SDL_DECLSPEC bool SDLCALL SDL_CaptureMouse(bool enabled); /** * Create a cursor using the specified bitmap data and mask (in MSB format). @@ -483,14 +483,14 @@ extern SDL_DECLSPEC SDL_Cursor * SDLCALL SDL_CreateSystemCursor(SDL_SystemCursor * this is desired for any reason. * * \param cursor a cursor to make active. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_GetCursor */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetCursor(SDL_Cursor *cursor); +extern SDL_DECLSPEC bool SDLCALL SDL_SetCursor(SDL_Cursor *cursor); /** * Get the active cursor. @@ -538,41 +538,41 @@ extern SDL_DECLSPEC void SDLCALL SDL_DestroyCursor(SDL_Cursor *cursor); /** * Show the cursor. * - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_CursorVisible * \sa SDL_HideCursor */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ShowCursor(void); +extern SDL_DECLSPEC bool SDLCALL SDL_ShowCursor(void); /** * Hide the cursor. * - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_CursorVisible * \sa SDL_ShowCursor */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_HideCursor(void); +extern SDL_DECLSPEC bool SDLCALL SDL_HideCursor(void); /** * Return whether the cursor is currently being shown. * - * \returns `SDL_TRUE` if the cursor is being shown, or `SDL_FALSE` if the - * cursor is hidden. + * \returns `true` if the cursor is being shown, or `false` if the cursor is + * hidden. * * \since This function is available since SDL 3.0.0. * * \sa SDL_HideCursor * \sa SDL_ShowCursor */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_CursorVisible(void); +extern SDL_DECLSPEC bool SDLCALL SDL_CursorVisible(void); /* Ends C function definitions when using C++ */ #ifdef __cplusplus diff --git a/include/SDL3/SDL_mutex.h b/include/SDL3/SDL_mutex.h index 3a7ce565..66625618 100644 --- a/include/SDL3/SDL_mutex.h +++ b/include/SDL3/SDL_mutex.h @@ -184,22 +184,22 @@ extern SDL_DECLSPEC void SDLCALL SDL_LockMutex(SDL_Mutex *mutex) SDL_ACQUIRE(mut * Try to lock a mutex without blocking. * * This works just like SDL_LockMutex(), but if the mutex is not available, - * this function returns SDL_FALSE immediately. + * this function returns false immediately. * * This technique is useful if you need exclusive access to a resource but * don't want to wait for it, and will return to it to try again later. * - * This function returns SDL_TRUE if passed a NULL mutex. + * This function returns true if passed a NULL mutex. * * \param mutex the mutex to try to lock. - * \returns SDL_TRUE on success, SDL_FALSE if the mutex would block. + * \returns true on success, false if the mutex would block. * * \since This function is available since SDL 3.0.0. * * \sa SDL_LockMutex * \sa SDL_UnlockMutex */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_TryLockMutex(SDL_Mutex *mutex) SDL_TRY_ACQUIRE(0, mutex); +extern SDL_DECLSPEC bool SDLCALL SDL_TryLockMutex(SDL_Mutex *mutex) SDL_TRY_ACQUIRE(0, mutex); /** * Unlock the mutex. @@ -379,7 +379,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_LockRWLockForWriting(SDL_RWLock *rwlock) SD * Try to lock a read/write lock _for reading_ without blocking. * * This works just like SDL_LockRWLockForReading(), but if the rwlock is not - * available, then this function returns SDL_FALSE immediately. + * available, then this function returns false immediately. * * This technique is useful if you need access to a resource but don't want to * wait for it, and will return to it to try again later. @@ -387,10 +387,10 @@ extern SDL_DECLSPEC void SDLCALL SDL_LockRWLockForWriting(SDL_RWLock *rwlock) SD * Trying to lock for read-only access can succeed if other threads are * holding read-only locks, as this won't prevent access. * - * This function returns SDL_TRUE if passed a NULL rwlock. + * This function returns true if passed a NULL rwlock. * * \param rwlock the rwlock to try to lock. - * \returns SDL_TRUE on success, SDL_FALSE if the lock would block. + * \returns true on success, false if the lock would block. * * \since This function is available since SDL 3.0.0. * @@ -398,13 +398,13 @@ extern SDL_DECLSPEC void SDLCALL SDL_LockRWLockForWriting(SDL_RWLock *rwlock) SD * \sa SDL_TryLockRWLockForWriting * \sa SDL_UnlockRWLock */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_TryLockRWLockForReading(SDL_RWLock *rwlock) SDL_TRY_ACQUIRE_SHARED(0, rwlock); +extern SDL_DECLSPEC bool SDLCALL SDL_TryLockRWLockForReading(SDL_RWLock *rwlock) SDL_TRY_ACQUIRE_SHARED(0, rwlock); /** * Try to lock a read/write lock _for writing_ without blocking. * * This works just like SDL_LockRWLockForWriting(), but if the rwlock is not - * available, then this function returns SDL_FALSE immediately. + * available, then this function returns false immediately. * * This technique is useful if you need exclusive access to a resource but * don't want to wait for it, and will return to it to try again later. @@ -417,10 +417,10 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_TryLockRWLockForReading(SDL_RWLock *rwl * read-only lock. Doing so results in undefined behavior. Unlock the * read-only lock before requesting a write lock. * - * This function returns SDL_TRUE if passed a NULL rwlock. + * This function returns true if passed a NULL rwlock. * * \param rwlock the rwlock to try to lock. - * \returns SDL_TRUE on success, SDL_FALSE if the lock would block. + * \returns true on success, false if the lock would block. * * \since This function is available since SDL 3.0.0. * @@ -428,7 +428,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_TryLockRWLockForReading(SDL_RWLock *rwl * \sa SDL_TryLockRWLockForReading * \sa SDL_UnlockRWLock */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_TryLockRWLockForWriting(SDL_RWLock *rwlock) SDL_TRY_ACQUIRE(0, rwlock); +extern SDL_DECLSPEC bool SDLCALL SDL_TryLockRWLockForWriting(SDL_RWLock *rwlock) SDL_TRY_ACQUIRE(0, rwlock); /** * Unlock the read/write lock. @@ -560,10 +560,10 @@ extern SDL_DECLSPEC void SDLCALL SDL_WaitSemaphore(SDL_Semaphore *sem); * This function checks to see if the semaphore pointed to by `sem` has a * positive value and atomically decrements the semaphore value if it does. If * the semaphore doesn't have a positive value, the function immediately - * returns SDL_FALSE. + * returns false. * * \param sem the semaphore to wait on. - * \returns SDL_TRUE if the wait succeeds, SDL_FALSE if the wait would block. + * \returns true if the wait succeeds, false if the wait would block. * * \since This function is available since SDL 3.0.0. * @@ -571,7 +571,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_WaitSemaphore(SDL_Semaphore *sem); * \sa SDL_WaitSemaphore * \sa SDL_WaitSemaphoreTimeout */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_TryWaitSemaphore(SDL_Semaphore *sem); +extern SDL_DECLSPEC bool SDLCALL SDL_TryWaitSemaphore(SDL_Semaphore *sem); /** * Wait until a semaphore has a positive value and then decrements it. @@ -583,7 +583,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_TryWaitSemaphore(SDL_Semaphore *sem); * \param sem the semaphore to wait on. * \param timeoutMS the length of the timeout, in milliseconds, or -1 to wait * indefinitely. - * \returns SDL_TRUE if the wait succeeds or SDL_FALSE if the wait times out. + * \returns true if the wait succeeds or false if the wait times out. * * \since This function is available since SDL 3.0.0. * @@ -591,7 +591,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_TryWaitSemaphore(SDL_Semaphore *sem); * \sa SDL_TryWaitSemaphore * \sa SDL_WaitSemaphore */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_WaitSemaphoreTimeout(SDL_Semaphore *sem, Sint32 timeoutMS); +extern SDL_DECLSPEC bool SDLCALL SDL_WaitSemaphoreTimeout(SDL_Semaphore *sem, Sint32 timeoutMS); /** * Atomically increment a semaphore's value and wake waiting threads. @@ -741,8 +741,8 @@ extern SDL_DECLSPEC void SDLCALL SDL_WaitCondition(SDL_Condition *cond, SDL_Mute * \param mutex the mutex used to coordinate thread access. * \param timeoutMS the maximum time to wait, in milliseconds, or -1 to wait * indefinitely. - * \returns SDL_TRUE if the condition variable is signaled, SDL_FALSE if the - * condition is not signaled in the allotted time. + * \returns true if the condition variable is signaled, false if the condition + * is not signaled in the allotted time. * * \threadsafety It is safe to call this function from any thread. * @@ -752,7 +752,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_WaitCondition(SDL_Condition *cond, SDL_Mute * \sa SDL_SignalCondition * \sa SDL_WaitCondition */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_WaitConditionTimeout(SDL_Condition *cond, +extern SDL_DECLSPEC bool SDLCALL SDL_WaitConditionTimeout(SDL_Condition *cond, SDL_Mutex *mutex, Sint32 timeoutMS); /* @} *//* Condition variable functions */ diff --git a/include/SDL3/SDL_oldnames.h b/include/SDL3/SDL_oldnames.h index 2795191c..82b4915a 100644 --- a/include/SDL3/SDL_oldnames.h +++ b/include/SDL3/SDL_oldnames.h @@ -38,11 +38,14 @@ #ifdef SDL_ENABLE_OLD_NAMES /* ##SDL_atomic.h */ -#define SDL_AtomicCAS SDL_AtomicCompareAndSwap -#define SDL_AtomicCASPtr SDL_AtomicCompareAndSwapPointer -#define SDL_AtomicGetPtr SDL_AtomicGetPointer +#define SDL_AtomicAdd SDL_AddAtomicInt +#define SDL_AtomicCAS SDL_CompareAndSwapAtomicInt +#define SDL_AtomicCASPtr SDL_CompareAndSwapAtomicPointer +#define SDL_AtomicGet SDL_GetAtomicInt +#define SDL_AtomicGetPtr SDL_GetAtomicPointer #define SDL_AtomicLock SDL_LockSpinlock -#define SDL_AtomicSetPtr SDL_AtomicSetPointer +#define SDL_AtomicSet SDL_SetAtomicInt +#define SDL_AtomicSetPtr SDL_SetAtomicPointer #define SDL_AtomicTryLock SDL_TryLockSpinlock #define SDL_AtomicUnlock SDL_UnlockSpinlock #define SDL_atomic_t SDL_AtomicInt @@ -74,6 +77,7 @@ #define SDL_NewAudioStream SDL_CreateAudioStream /* ##SDL_cpuinfo.h */ +#define SDL_GetCPUCount SDL_GetNumLogicalCPUCores #define SDL_SIMDGetAlignment SDL_GetSIMDAlignment /* ##SDL_endian.h */ @@ -419,9 +423,14 @@ #define SDL_LogSetAllPriority SDL_SetLogPriorities #define SDL_LogSetOutputFunction SDL_SetLogOutputFunction #define SDL_LogSetPriority SDL_SetLogPriority +#define SDL_NUM_LOG_PRIORITIES SDL_LOG_PRIORITY_COUNT + +/* ##SDL_messagebox.h */ +#define SDL_MESSAGEBOX_COLOR_MAX SDL_MESSAGEBOX_COLOR_COUNT /* ##SDL_mouse.h */ #define SDL_FreeCursor SDL_DestroyCursor +#define SDL_NUM_SYSTEM_CURSORS SDL_SYSTEM_CURSOR_COUNT #define SDL_SYSTEM_CURSOR_ARROW SDL_SYSTEM_CURSOR_DEFAULT #define SDL_SYSTEM_CURSOR_HAND SDL_SYSTEM_CURSOR_POINTER #define SDL_SYSTEM_CURSOR_IBEAM SDL_SYSTEM_CURSOR_TEXT @@ -558,6 +567,7 @@ #define SDL_WriteLE64 SDL_WriteU64LE /* ##SDL_scancode.h */ +#define SDL_NUM_SCANCODES SDL_SCANCODE_COUNT #define SDL_SCANCODE_AUDIOFASTFORWARD SDL_SCANCODE_MEDIA_FAST_FORWARD #define SDL_SCANCODE_AUDIOMUTE SDL_SCANCODE_MUTE #define SDL_SCANCODE_AUDIONEXT SDL_SCANCODE_MEDIA_NEXT_TRACK @@ -580,7 +590,10 @@ #define SDL_SensorUpdate SDL_UpdateSensors /* ##SDL_stdinc.h */ +#define SDL_FALSE false #define SDL_TABLESIZE SDL_arraysize +#define SDL_TRUE true +#define SDL_bool bool #define SDL_size_add_overflow SDL_size_add_check_overflow #define SDL_size_mul_overflow SDL_size_mul_check_overflow #define SDL_strtokr SDL_strtok_r @@ -625,8 +638,6 @@ #define SDL_LinuxSetThreadPriorityAndPolicy SDL_SetLinuxThreadPriorityAndPolicy #define SDL_OnApplicationDidBecomeActive SDL_OnApplicationDidEnterForeground #define SDL_OnApplicationWillResignActive SDL_OnApplicationWillEnterBackground -#define SDL_WinRTGetDeviceFamily SDL_GetWinRTDeviceFamily -#define SDL_GetWinRTFSPathUTF8 SDL_GetWinRTFSPath #define SDL_iOSSetAnimationCallback SDL_SetiOSAnimationCallback #define SDL_iOSSetEventPump SDL_SetiOSEventPump #define SDL_iPhoneSetAnimationCallback SDL_SetiOSAnimationCallback @@ -663,11 +674,14 @@ #elif !defined(SDL_DISABLE_OLD_NAMES) /* ##SDL_atomic.h */ -#define SDL_AtomicCAS SDL_AtomicCAS_renamed_SDL_AtomicCompareAndSwap -#define SDL_AtomicCASPtr SDL_AtomicCASPtr_renamed_SDL_AtomicCompareAndSwapPointer -#define SDL_AtomicGetPtr SDL_AtomicGetPtr_renamed_SDL_AtomicGetPointer +#define SDL_AtomicAdd SDL_AtomicAdd_renamed_SDL_AddAtomicInt +#define SDL_AtomicCAS SDL_AtomicCAS_renamed_SDL_CompareAndSwapAtomicInt +#define SDL_AtomicCASPtr SDL_AtomicCASPtr_renamed_SDL_CompareAndSwapAtomicPointer +#define SDL_AtomicGet SDL_AtomicGet_renamed_SDL_GetAtomicInt +#define SDL_AtomicGetPtr SDL_AtomicGetPtr_renamed_SDL_GetAtomicPointer #define SDL_AtomicLock SDL_AtomicLock_renamed_SDL_LockSpinlock -#define SDL_AtomicSetPtr SDL_AtomicSetPtr_renamed_SDL_AtomicSetPointer +#define SDL_AtomicSet SDL_AtomicSet_renamed_SDL_SetAtomicInt +#define SDL_AtomicSetPtr SDL_AtomicSetPtr_renamed_SDL_SetAtomicPointer #define SDL_AtomicTryLock SDL_AtomicTryLock_renamed_SDL_TryLockSpinlock #define SDL_AtomicUnlock SDL_AtomicUnlock_renamed_SDL_UnlockSpinlock #define SDL_atomic_t SDL_atomic_t_renamed_SDL_AtomicInt @@ -699,6 +713,7 @@ #define SDL_NewAudioStream SDL_NewAudioStream_renamed_SDL_CreateAudioStream /* ##SDL_cpuinfo.h */ +#define SDL_GetCPUCount SDL_GetCPUCount_renamed_SDL_GetNumLogicalCPUCores #define SDL_SIMDGetAlignment SDL_SIMDGetAlignment_renamed_SDL_GetSIMDAlignment /* ##SDL_endian.h */ @@ -1045,9 +1060,14 @@ #define SDL_LogSetAllPriority SDL_LogSetAllPriority_renamed_SDL_SetLogPriorities #define SDL_LogSetOutputFunction SDL_LogSetOutputFunction_renamed_SDL_SetLogOutputFunction #define SDL_LogSetPriority SDL_LogSetPriority_renamed_SDL_SetLogPriority +#define SDL_NUM_LOG_PRIORITIES SDL_NUM_LOG_PRIORITIES_renamed_SDL_LOG_PRIORITY_COUNT + +/* ##SDL_messagebox.h */ +#define SDL_MESSAGEBOX_COLOR_MAX SDL_MESSAGEBOX_COLOR_MAX_renamed_SDL_MESSAGEBOX_COLOR_COUNT /* ##SDL_mouse.h */ #define SDL_FreeCursor SDL_FreeCursor_renamed_SDL_DestroyCursor +#define SDL_NUM_SYSTEM_CURSORS SDL_NUM_SYSTEM_CURSORS_renamed_SDL_SYSTEM_CURSOR_COUNT #define SDL_SYSTEM_CURSOR_ARROW SDL_SYSTEM_CURSOR_ARROW_renamed_SDL_SYSTEM_CURSOR_DEFAULT #define SDL_SYSTEM_CURSOR_HAND SDL_SYSTEM_CURSOR_HAND_renamed_SDL_SYSTEM_CURSOR_POINTER #define SDL_SYSTEM_CURSOR_IBEAM SDL_SYSTEM_CURSOR_IBEAM_renamed_SDL_SYSTEM_CURSOR_TEXT @@ -1184,6 +1204,7 @@ #define SDL_WriteLE64 SDL_WriteLE64_renamed_SDL_WriteU64LE /* ##SDL_scancode.h */ +#define SDL_NUM_SCANCODES SDL_NUM_SCANCODES_renamed_SDL_SCANCODE_COUNT #define SDL_SCANCODE_AUDIOFASTFORWARD SDL_SCANCODE_AUDIOFASTFORWARD_renamed_SDL_SCANCODE_MEDIA_FAST_FORWARD #define SDL_SCANCODE_AUDIOMUTE SDL_SCANCODE_AUDIOMUTE_renamed_SDL_SCANCODE_MUTE #define SDL_SCANCODE_AUDIONEXT SDL_SCANCODE_AUDIONEXT_renamed_SDL_SCANCODE_MEDIA_NEXT_TRACK @@ -1206,7 +1227,10 @@ #define SDL_SensorUpdate SDL_SensorUpdate_renamed_SDL_UpdateSensors /* ##SDL_stdinc.h */ +#define SDL_FALSE SDL_FALSE_renamed_false #define SDL_TABLESIZE SDL_TABLESIZE_renamed_SDL_arraysize +#define SDL_TRUE SDL_TRUE_renamed_true +#define SDL_bool SDL_bool_renamed_bool #define SDL_size_add_overflow SDL_size_add_overflow_renamed_SDL_size_add_check_overflow #define SDL_size_mul_overflow SDL_size_mul_overflow_renamed_SDL_size_mul_check_overflow #define SDL_strtokr SDL_strtokr_renamed_SDL_strtok_r @@ -1251,8 +1275,6 @@ #define SDL_LinuxSetThreadPriorityAndPolicy SDL_LinuxSetThreadPriorityAndPolicy_renamed_SDL_SetLinuxThreadPriorityAndPolicy #define SDL_OnApplicationDidBecomeActive SDL_OnApplicationDidBecomeActive_renamed_SDL_OnApplicationDidEnterForeground #define SDL_OnApplicationWillResignActive SDL_OnApplicationWillResignActive_renamed_SDL_OnApplicationWillEnterBackground -#define SDL_WinRTGetDeviceFamily SDL_WinRTGetDeviceFamily_renamed_SDL_GetWinRTDeviceFamily -#define SDL_GetWinRTFSPathUTF8 SDL_GetWinRTFSPathUTF8_renamed_SDL_GetWinRTFSPath #define SDL_iOSSetAnimationCallback SDL_iOSSetAnimationCallback_renamed_SDL_SetiOSAnimationCallback #define SDL_iOSSetEventPump SDL_iOSSetEventPump_renamed_SDL_SetiOSEventPump #define SDL_iPhoneSetAnimationCallback SDL_iPhoneSetAnimationCallback_renamed_SDL_iOSSetAnimationCallback diff --git a/include/SDL3/SDL_pen.h b/include/SDL3/SDL_pen.h index b44c792b..e939cab2 100644 --- a/include/SDL3/SDL_pen.h +++ b/include/SDL3/SDL_pen.h @@ -39,7 +39,7 @@ #ifndef SDL_pen_h_ #define SDL_pen_h_ -#include +#include /* Set up for C function definitions, even when using C++ */ #ifdef __cplusplus @@ -101,7 +101,7 @@ typedef enum SDL_PenAxis SDL_PEN_AXIS_ROTATION, /**< Pen barrel rotation. Bidirectional: -180 to 179.9 (clockwise, 0 is facing up, -180.0 is facing down). */ SDL_PEN_AXIS_SLIDER, /**< Pen finger wheel or slider (e.g., Airbrush Pen). Unidirectional: 0 to 1.0 */ SDL_PEN_AXIS_TANGENTIAL_PRESSURE, /**< Pressure from squeezing the pen ("barrel pressure"). */ - SDL_PEN_NUM_AXES /**< Total known pen axis types in this version of SDL. This number may grow in future releases! */ + SDL_PEN_AXIS_COUNT /**< Total known pen axis types in this version of SDL. This number may grow in future releases! */ } SDL_PenAxis; /* Ends C function definitions when using C++ */ @@ -111,4 +111,3 @@ typedef enum SDL_PenAxis #endif /* SDL_pen_h_ */ -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/include/SDL3/SDL_pixels.h b/include/SDL3/SDL_pixels.h index 22813ff5..0c53a965 100644 --- a/include/SDL3/SDL_pixels.h +++ b/include/SDL3/SDL_pixels.h @@ -74,7 +74,11 @@ extern "C" { */ #define SDL_ALPHA_TRANSPARENT_FLOAT 0.0f -/** Pixel type. */ +/** + * Pixel type. + * + * \since This enum is available since SDL 3.0.0. + */ typedef enum SDL_PixelType { SDL_PIXELTYPE_UNKNOWN, @@ -93,7 +97,11 @@ typedef enum SDL_PixelType SDL_PIXELTYPE_INDEX2 } SDL_PixelType; -/** Bitmap pixel order, high bit -> low bit. */ +/** + * Bitmap pixel order, high bit -> low bit. + * + * \since This enum is available since SDL 3.0.0. + */ typedef enum SDL_BitmapOrder { SDL_BITMAPORDER_NONE, @@ -101,7 +109,11 @@ typedef enum SDL_BitmapOrder SDL_BITMAPORDER_1234 } SDL_BitmapOrder; -/** Packed component order, high bit -> low bit. */ +/** + * Packed component order, high bit -> low bit. + * + * \since This enum is available since SDL 3.0.0. + */ typedef enum SDL_PackedOrder { SDL_PACKEDORDER_NONE, @@ -115,7 +127,11 @@ typedef enum SDL_PackedOrder SDL_PACKEDORDER_BGRA } SDL_PackedOrder; -/** Array component order, low byte -> high byte. */ +/** + * Array component order, low byte -> high byte. + * + * \since This enum is available since SDL 3.0.0. + */ typedef enum SDL_ArrayOrder { SDL_ARRAYORDER_NONE, @@ -127,7 +143,11 @@ typedef enum SDL_ArrayOrder SDL_ARRAYORDER_ABGR } SDL_ArrayOrder; -/** Packed component layout. */ +/** + * Packed component layout. + * + * \since This enum is available since SDL 3.0.0. + */ typedef enum SDL_PackedLayout { SDL_PACKEDLAYOUT_NONE, @@ -760,8 +780,8 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetPixelFormatName(SDL_PixelFormat * \param Gmask a pointer filled in with the green mask for the format. * \param Bmask a pointer filled in with the blue mask for the format. * \param Amask a pointer filled in with the alpha mask for the format. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \threadsafety It is safe to call this function from any thread. * @@ -769,7 +789,7 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetPixelFormatName(SDL_PixelFormat * * \sa SDL_GetPixelFormatForMasks */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetMasksForPixelFormat(SDL_PixelFormat format, int *bpp, Uint32 *Rmask, Uint32 *Gmask, Uint32 *Bmask, Uint32 *Amask); +extern SDL_DECLSPEC bool SDLCALL SDL_GetMasksForPixelFormat(SDL_PixelFormat format, int *bpp, Uint32 *Rmask, Uint32 *Gmask, Uint32 *Bmask, Uint32 *Amask); /** * Convert a bpp value and RGBA masks to an enumerated pixel format. @@ -837,15 +857,15 @@ extern SDL_DECLSPEC SDL_Palette * SDLCALL SDL_CreatePalette(int ncolors); * \param colors an array of SDL_Color structures to copy into the palette. * \param firstcolor the index of the first palette entry to modify. * \param ncolors the number of entries to modify. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \threadsafety It is safe to call this function from any thread, as long as * the palette is not modified or destroyed in another thread. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetPaletteColors(SDL_Palette *palette, const SDL_Color *colors, int firstcolor, int ncolors); +extern SDL_DECLSPEC bool SDLCALL SDL_SetPaletteColors(SDL_Palette *palette, const SDL_Color *colors, int firstcolor, int ncolors); /** * Free a palette created with SDL_CreatePalette(). diff --git a/include/SDL3/SDL_platform_defines.h b/include/SDL3/SDL_platform_defines.h index e7f91cf9..4f878e3b 100644 --- a/include/SDL3/SDL_platform_defines.h +++ b/include/SDL3/SDL_platform_defines.h @@ -29,180 +29,451 @@ #define SDL_platform_defines_h_ #ifdef _AIX -#define SDL_PLATFORM_AIX 1 + +/** + * A preprocessor macro that is only defined if compiling for AIX. + * + * \since This macro is available since SDL 3.0.0. + */ +#define SDL_PLATFORM_AIX 1 #endif + #ifdef __HAIKU__ -#define SDL_PLATFORM_HAIKU 1 + +/** + * A preprocessor macro that is only defined if compiling for Haiku OS. + * + * \since This macro is available since SDL 3.0.0. + */ +#define SDL_PLATFORM_HAIKU 1 #endif + #if defined(bsdi) || defined(__bsdi) || defined(__bsdi__) -#define SDL_PLATFORM_BSDI 1 + +/** + * A preprocessor macro that is only defined if compiling for BSDi + * + * \since This macro is available since SDL 3.0.0. + */ +#define SDL_PLATFORM_BSDI 1 #endif + #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) + +/** + * A preprocessor macro that is only defined if compiling for FreeBSD. + * + * \since This macro is available since SDL 3.0.0. + */ #define SDL_PLATFORM_FREEBSD 1 #endif + #if defined(hpux) || defined(__hpux) || defined(__hpux__) -#define SDL_PLATFORM_HPUX 1 + +/** + * A preprocessor macro that is only defined if compiling for HP-UX. + * + * \since This macro is available since SDL 3.0.0. + */ +#define SDL_PLATFORM_HPUX 1 #endif + #if defined(sgi) || defined(__sgi) || defined(__sgi__) || defined(_SGI_SOURCE) -#define SDL_PLATFORM_IRIX 1 + +/** + * A preprocessor macro that is only defined if compiling for IRIX. + * + * \since This macro is available since SDL 3.0.0. + */ +#define SDL_PLATFORM_IRIX 1 #endif + #if (defined(linux) || defined(__linux) || defined(__linux__)) -#define SDL_PLATFORM_LINUX 1 + +/** + * A preprocessor macro that is only defined if compiling for Linux. + * + * Note that Android, although ostensibly a Linux-based system, will not + * define this. It defines SDL_PLATFORM_ANDROID instead. + * + * \since This macro is available since SDL 3.0.0. + */ +#define SDL_PLATFORM_LINUX 1 #endif + #if defined(ANDROID) || defined(__ANDROID__) -#undef SDL_PLATFORM_LINUX /* do we need to do this? */ -#define SDL_PLATFORM_ANDROID 1 + +/** + * A preprocessor macro that is only defined if compiling for Android. + * + * \since This macro is available since SDL 3.0.0. + */ +#define SDL_PLATFORM_ANDROID 1 +#undef SDL_PLATFORM_LINUX #endif + #ifdef __NGAGE__ + +/** + * A preprocessor macro that is only defined if compiling for Nokia N-Gage. + * + * \since This macro is available since SDL 3.0.0. + */ #define SDL_PLATFORM_NGAGE 1 #endif #if defined(__unix__) || defined(__unix) || defined(unix) -#define SDL_PLATFORM_UNIX 1 + +/** + * A preprocessor macro that is only defined if compiling for a Unix-like + * system. + * + * Other platforms, like Linux, might define this in addition to their primary + * define. + * + * \since This macro is available since SDL 3.0.0. + */ +#define SDL_PLATFORM_UNIX 1 #endif #ifdef __APPLE__ -#define SDL_PLATFORM_APPLE 1 + +/** + * A preprocessor macro that is only defined if compiling for Apple platforms. + * + * iOS, macOS, etc will additionally define a more specific platform macro. + * + * \since This macro is available since SDL 3.0.0. + * + * \sa SDL_PLATFORM_MACOS + * \sa SDL_PLATFORM_IOS + * \sa SDL_PLATFORM_TVOS + * \sa SDL_PLATFORM_VISIONOS + */ +#define SDL_PLATFORM_APPLE 1 + /* lets us know what version of macOS we're compiling on */ #include #ifndef __has_extension /* Older compilers don't support this */ -#define __has_extension(x) 0 -#include -#undef __has_extension + #define __has_extension(x) 0 + #include + #undef __has_extension #else -#include + #include #endif /* Fix building with older SDKs that don't define these - See this for more information: - https://stackoverflow.com/questions/12132933/preprocessor-macro-for-os-x-targets + See this for more information: + https://stackoverflow.com/questions/12132933/preprocessor-macro-for-os-x-targets */ #ifndef TARGET_OS_MACCATALYST -#define TARGET_OS_MACCATALYST 0 + #define TARGET_OS_MACCATALYST 0 #endif #ifndef TARGET_OS_IOS -#define TARGET_OS_IOS 0 + #define TARGET_OS_IOS 0 #endif #ifndef TARGET_OS_IPHONE -#define TARGET_OS_IPHONE 0 + #define TARGET_OS_IPHONE 0 #endif #ifndef TARGET_OS_TV -#define TARGET_OS_TV 0 + #define TARGET_OS_TV 0 #endif #ifndef TARGET_OS_SIMULATOR -#define TARGET_OS_SIMULATOR 0 + #define TARGET_OS_SIMULATOR 0 #endif #ifndef TARGET_OS_VISION -#define TARGET_OS_VISION 0 + #define TARGET_OS_VISION 0 #endif #if TARGET_OS_TV -#define SDL_PLATFORM_TVOS 1 + +/** + * A preprocessor macro that is only defined if compiling for tvOS. + * + * \since This macro is available since SDL 3.0.0. + * + * \sa SDL_PLATFORM_APPLE + */ +#define SDL_PLATFORM_TVOS 1 #endif + #if TARGET_OS_VISION + +/** + * A preprocessor macro that is only defined if compiling for VisionOS. + * + * \since This macro is available since SDL 3.0.0. + * + * \sa SDL_PLATFORM_APPLE + */ #define SDL_PLATFORM_VISIONOS 1 #endif + #if TARGET_OS_IPHONE -#define SDL_PLATFORM_IOS 1 + +/** + * A preprocessor macro that is only defined if compiling for iOS. + * + * \since This macro is available since SDL 3.0.0. + * + * \sa SDL_PLATFORM_APPLE + */ +#define SDL_PLATFORM_IOS 1 + #else -#define SDL_PLATFORM_MACOS 1 + +/** + * A preprocessor macro that is only defined if compiling for macOS. + * + * \since This macro is available since SDL 3.0.0. + * + * \sa SDL_PLATFORM_APPLE + */ +#define SDL_PLATFORM_MACOS 1 + #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 -# error SDL for macOS only supports deploying on 10.7 and above. + #error SDL for macOS only supports deploying on 10.7 and above. #endif /* MAC_OS_X_VERSION_MIN_REQUIRED < 1070 */ #endif /* TARGET_OS_IPHONE */ -#endif /* defined(SDL_PLATFORM_APPLE) */ +#endif /* defined(__APPLE__) */ #ifdef __EMSCRIPTEN__ + +/** + * A preprocessor macro that is only defined if compiling for Emscripten. + * + * \since This macro is available since SDL 3.0.0. + */ #define SDL_PLATFORM_EMSCRIPTEN 1 #endif + #ifdef __NetBSD__ + +/** + * A preprocessor macro that is only defined if compiling for NetBSD. + * + * \since This macro is available since SDL 3.0.0. + */ #define SDL_PLATFORM_NETBSD 1 #endif + #ifdef __OpenBSD__ -#define SDL_PLATFORM_OPENBSD 1 + +/** + * A preprocessor macro that is only defined if compiling for OpenBSD. + * + * \since This macro is available since SDL 3.0.0. + */ +#define SDL_PLATFORM_OPENBSD 1 #endif + #if defined(__OS2__) || defined(__EMX__) -#define SDL_PLATFORM_OS2 1 + +/** + * A preprocessor macro that is only defined if compiling for OS/2. + * + * \since This macro is available since SDL 3.0.0. + */ +#define SDL_PLATFORM_OS2 1 #endif + #if defined(osf) || defined(__osf) || defined(__osf__) || defined(_OSF_SOURCE) -#define SDL_PLATFORM_OSF 1 + +/** + * A preprocessor macro that is only defined if compiling for Tru64 (OSF/1). + * + * \since This macro is available since SDL 3.0.0. + */ +#define SDL_PLATFORM_OSF 1 #endif + #ifdef __QNXNTO__ + +/** + * A preprocessor macro that is only defined if compiling for QNX Neutrino. + * + * \since This macro is available since SDL 3.0.0. + */ #define SDL_PLATFORM_QNXNTO 1 #endif + #if defined(riscos) || defined(__riscos) || defined(__riscos__) + +/** + * A preprocessor macro that is only defined if compiling for RISC OS. + * + * \since This macro is available since SDL 3.0.0. + */ #define SDL_PLATFORM_RISCOS 1 #endif + #if defined(__sun) && defined(__SVR4) -#define SDL_PLATFORM_SOLARIS 1 + +/** + * A preprocessor macro that is only defined if compiling for SunOS/Solaris. + * + * \since This macro is available since SDL 3.0.0. + */ +#define SDL_PLATFORM_SOLARIS 1 #endif #if defined(__CYGWIN__) + +/** + * A preprocessor macro that is only defined if compiling for Cygwin. + * + * \since This macro is available since SDL 3.0.0. + */ #define SDL_PLATFORM_CYGWIN 1 #endif #if defined(_WIN32) || defined(SDL_PLATFORM_CYGWIN) -#define SDL_PLATFORM_WINDOWS 1 /* Win32 api and Windows-based OSs */ + +/** + * A preprocessor macro that is only defined if compiling for Windows. + * + * This also covers several other platforms, like Microsoft GDK, Xbox, WinRT, + * etc. Each will have their own more-specific platform macros, too. + * + * \since This macro is available since SDL 3.0.0. + * + * \sa SDL_PLATFORM_WIN32 + * \sa SDL_PLATFORM_XBOXONE + * \sa SDL_PLATFORM_XBOXSERIES + * \sa SDL_PLATFORM_WINGDK + * \sa SDL_PLATFORM_GDK + */ +#define SDL_PLATFORM_WINDOWS 1 /* Try to find out if we're compiling for WinRT, GDK or non-WinRT/GDK */ #if defined(_MSC_VER) && defined(__has_include) -#if __has_include() -#define HAVE_WINAPIFAMILY_H 1 -#else -#define HAVE_WINAPIFAMILY_H 0 -#endif + #if __has_include() + #define HAVE_WINAPIFAMILY_H 1 + #else + #define HAVE_WINAPIFAMILY_H 0 + #endif -/* If _USING_V110_SDK71_ is defined it means we are using the Windows XP toolset. */ + /* If _USING_V110_SDK71_ is defined it means we are using the Windows XP toolset. */ #elif defined(_MSC_VER) && (_MSC_VER >= 1700 && !_USING_V110_SDK71_) /* _MSC_VER == 1700 for Visual Studio 2012 */ -#define HAVE_WINAPIFAMILY_H 1 + #define HAVE_WINAPIFAMILY_H 1 #else -#define HAVE_WINAPIFAMILY_H 0 + #define HAVE_WINAPIFAMILY_H 0 #endif #if HAVE_WINAPIFAMILY_H -#include -#define WINAPI_FAMILY_WINRT (!WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) && WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)) + #include + #define WINAPI_FAMILY_WINRT (!WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) && WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)) #else -#define WINAPI_FAMILY_WINRT 0 + #define WINAPI_FAMILY_WINRT 0 #endif /* HAVE_WINAPIFAMILY_H */ #if HAVE_WINAPIFAMILY_H && HAVE_WINAPIFAMILY_H -#define SDL_WINAPI_FAMILY_PHONE (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) + #define SDL_WINAPI_FAMILY_PHONE (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) #else -#define SDL_WINAPI_FAMILY_PHONE 0 + #define SDL_WINAPI_FAMILY_PHONE 0 #endif #if WINAPI_FAMILY_WINRT -#define SDL_PLATFORM_WINRT 1 +#error Windows RT/UWP is no longer supported in SDL + #elif defined(_GAMING_DESKTOP) /* GDK project configuration always defines _GAMING_XXX */ + +/** + * A preprocessor macro that is only defined if compiling for Microsoft GDK + * for Windows. + * + * \since This macro is available since SDL 3.0.0. + */ #define SDL_PLATFORM_WINGDK 1 + #elif defined(_GAMING_XBOX_XBOXONE) -#define SDL_PLATFORM_XBOXONE 1 + +/** + * A preprocessor macro that is only defined if compiling for Xbox One. + * + * \since This macro is available since SDL 3.0.0. + */ +#define SDL_PLATFORM_XBOXONE 1 + #elif defined(_GAMING_XBOX_SCARLETT) + +/** + * A preprocessor macro that is only defined if compiling for Xbox Series. + * + * \since This macro is available since SDL 3.0.0. + */ #define SDL_PLATFORM_XBOXSERIES 1 + #else -#define SDL_PLATFORM_WIN32 1 + +/** + * A preprocessor macro that is only defined if compiling for desktop Windows. + * + * Despite the "32", this also covers 64-bit Windows; as an informal + * convention, its system layer tends to still be referred to as "the Win32 + * API." + * + * \since This macro is available since SDL 3.0.0. + */ +#define SDL_PLATFORM_WIN32 1 + #endif -#endif /* defined(WIN32) || defined(_WIN32) || defined(SDL_PLATFORM_CYGWIN) */ +#endif /* defined(_WIN32) || defined(SDL_PLATFORM_CYGWIN) */ + /* This is to support generic "any GDK" separate from a platform-specific GDK */ #if defined(SDL_PLATFORM_WINGDK) || defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES) -#define SDL_PLATFORM_GDK 1 + +/** + * A preprocessor macro that is only defined if compiling for Microsoft GDK on + * any platform. + * + * \since This macro is available since SDL 3.0.0. + */ +#define SDL_PLATFORM_GDK 1 #endif + #if defined(__PSP__) || defined(__psp__) -#define SDL_PLATFORM_PSP 1 + +/** + * A preprocessor macro that is only defined if compiling for Sony PSP. + * + * \since This macro is available since SDL 3.0.0. + */ +#define SDL_PLATFORM_PSP 1 #endif + #if defined(__PS2__) || defined(PS2) -#define SDL_PLATFORM_PS2 1 + +/** + * A preprocessor macro that is only defined if compiling for Sony PlayStation + * 2. + * + * \since This macro is available since SDL 3.0.0. + */ +#define SDL_PLATFORM_PS2 1 #endif #if defined(__vita__) || defined(__psp2__) -#define SDL_PLATFORM_VITA 1 + +/** + * A preprocessor macro that is only defined if compiling for Sony Vita. + * + * \since This macro is available since SDL 3.0.0. + */ +#define SDL_PLATFORM_VITA 1 #endif #ifdef __3DS__ + +/** + * A preprocessor macro that is only defined if compiling for Nintendo 3DS. + * + * \since This macro is available since SDL 3.0.0. + */ +#define SDL_PLATFORM_3DS 1 + #undef __3DS__ -#define SDL_PLATFORM_3DS 1 #endif #endif /* SDL_platform_defines_h_ */ diff --git a/include/SDL3/SDL_process.h b/include/SDL3/SDL_process.h new file mode 100644 index 00000000..9ca429fa --- /dev/null +++ b/include/SDL3/SDL_process.h @@ -0,0 +1,410 @@ +/* + 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. +*/ + +/** + * # CategoryProcess + * + * Process control support. + * + * These functions provide a cross-platform way to spawn and manage OS-level + * processes. + * + * You can create a new subprocess with SDL_CreateProcess() and optionally + * read and write to it using SDL_ReadProcess() or SDL_GetProcessInput() and + * SDL_GetProcessOutput(). If more advanced functionality like chaining input + * between processes is necessary, you can use + * SDL_CreateProcessWithProperties(). + * + * You can get the status of a created process with SDL_WaitProcess(), or + * terminate the process with SDL_KillProcess(). + * + * Don't forget to call SDL_DestroyProcess() to clean up, whether the process + * process was killed, terminated on its own, or is still running! + */ + +#ifndef SDL_process_h_ +#define SDL_process_h_ + +#include +#include +#include +#include + +#include +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct SDL_Process SDL_Process; + +/** + * Create a new process. + * + * The path to the executable is supplied in args[0]. args[1..N] are + * additional arguments passed on the command line of the new process, and the + * argument list should be terminated with a NULL, e.g.: + * + * ```c + * const char *args[] = { "myprogram", "argument", NULL }; + * ``` + * + * Setting pipe_stdio to true is equivalent to setting + * `SDL_PROP_PROCESS_CREATE_STDIN_NUMBER` and + * `SDL_PROP_PROCESS_CREATE_STDOUT_NUMBER` to `SDL_PROCESS_STDIO_APP`, and + * will allow the use of SDL_ReadProcess() or SDL_GetProcessInput() and + * SDL_GetProcessOutput(). + * + * See SDL_CreateProcessWithProperties() for more details. + * + * \param args the path and arguments for the new process. + * \param pipe_stdio true to create pipes to the process's standard input and + * from the process's standard output, false for the process + * to have no input and inherit the application's standard + * output. + * \returns the newly created and running process, or NULL if the process + * couldn't be created. + * + * \threadsafety It is safe to call this function from any thread. + * + * \since This function is available since SDL 3.0.0. + * + * \sa SDL_CreateProcessWithProperties + * \sa SDL_GetProcessProperties + * \sa SDL_ReadProcess + * \sa SDL_GetProcessInput + * \sa SDL_GetProcessOutput + * \sa SDL_KillProcess + * \sa SDL_WaitProcess + * \sa SDL_DestroyProcess + */ +extern SDL_DECLSPEC SDL_Process *SDLCALL SDL_CreateProcess(const char * const *args, bool pipe_stdio); + +/** + * Description of where standard I/O should be directed when creating a + * process. + * + * If a standard I/O stream is set to SDL_PROCESS_STDIO_INHERIT, it will go to + * the same place as the application's I/O stream. This is the default for + * standard output and standard error. + * + * If a standard I/O stream is set to SDL_PROCESS_STDIO_NULL, it is connected + * to `NUL:` on Windows and `/dev/null` on POSIX systems. This is the default + * for standard input. + * + * If a standard I/O stream is set to SDL_PROCESS_STDIO_APP, it is connected + * to a new SDL_IOStream that is available to the application. Standard input + * will be available as `SDL_PROP_PROCESS_STDIN_POINTER` and allows + * SDL_GetProcessInput(), standard output will be available as + * `SDL_PROP_PROCESS_STDOUT_POINTER` and allows SDL_ReadProcess() and + * SDL_GetProcessOutput(), and standard error will be available as + * `SDL_PROP_PROCESS_STDERR_POINTER` in the properties for the created + * process. + * + * If a standard I/O stream is set to SDL_PROCESS_STDIO_REDIRECT, it is + * connected to an existing SDL_IOStream provided by the application. Standard + * input is provided using `SDL_PROP_PROCESS_CREATE_STDIN_POINTER`, standard + * output is provided using `SDL_PROP_PROCESS_CREATE_STDOUT_POINTER`, and + * standard error is provided using `SDL_PROP_PROCESS_CREATE_STDERR_POINTER` + * in the creation properties. These existing streams should be closed by the + * application once the new process is created. + * + * In order to use an SDL_IOStream with SDL_PROCESS_STDIO_REDIRECT, it must + * have `SDL_PROP_IOSTREAM_WINDOWS_HANDLE_POINTER` or + * `SDL_PROP_IOSTREAM_FILE_DESCRIPTOR_NUMBER` set. This is true for streams + * representing files and process I/O. + * + * \since This enum is available since SDL 3.0.0. + * + * \sa SDL_CreateProcessWithProperties + * \sa SDL_GetProcessProperties + * \sa SDL_ReadProcess + * \sa SDL_GetProcessInput + * \sa SDL_GetProcessOutput + */ +typedef enum SDL_ProcessIO +{ + SDL_PROCESS_STDIO_INHERITED, /**< The I/O stream is inherited from the application. */ + SDL_PROCESS_STDIO_NULL, /**< The I/O stream is ignored. */ + SDL_PROCESS_STDIO_APP, /**< The I/O stream is connected to a new SDL_IOStream that the application can read or write */ + SDL_PROCESS_STDIO_REDIRECT, /**< The I/O stream is redirected to an existing SDL_IOStream. */ +} SDL_ProcessIO; + +/** + * Create a new process with the specified properties. + * + * These are the supported properties: + * + * - `SDL_PROP_PROCESS_CREATE_ARGS_POINTER`: an array of strings containing + * the program to run, any arguments, and a NULL pointer, e.g. const char + * *args[] = { "myprogram", "argument", NULL }. This is a required property. + * - `SDL_PROP_PROCESS_CREATE_ENVIRONMENT_POINTER`: an SDL_Environment + * pointer. If this property is set, it will be the entire environment for + * the process, otherwise the current environment is used. + * - `SDL_PROP_PROCESS_CREATE_STDIN_NUMBER`: an SDL_ProcessIO value describing + * where standard input for the process comes from, defaults to + * `SDL_PROCESS_STDIO_NULL`. + * - `SDL_PROP_PROCESS_CREATE_STDIN_POINTER`: an SDL_IOStream pointer used for + * standard input when `SDL_PROP_PROCESS_CREATE_STDIN_NUMBER` is set to + * `SDL_PROCESS_STDIO_REDIRECT`. + * - `SDL_PROP_PROCESS_CREATE_STDOUT_NUMBER`: an SDL_ProcessIO value + * describing where standard output for the process goes go, defaults to + * `SDL_PROCESS_STDIO_INHERITED`. + * - `SDL_PROP_PROCESS_CREATE_STDOUT_POINTER`: an SDL_IOStream pointer used + * for standard output when `SDL_PROP_PROCESS_CREATE_STDOUT_NUMBER` is set + * to `SDL_PROCESS_STDIO_REDIRECT`. + * - `SDL_PROP_PROCESS_CREATE_STDERR_NUMBER`: an SDL_ProcessIO value + * describing where standard error for the process goes go, defaults to + * `SDL_PROCESS_STDIO_INHERITED`. + * - `SDL_PROP_PROCESS_CREATE_STDERR_POINTER`: an SDL_IOStream pointer used + * for standard error when `SDL_PROP_PROCESS_CREATE_STDERR_NUMBER` is set to + * `SDL_PROCESS_STDIO_REDIRECT`. + * - `SDL_PROP_PROCESS_CREATE_STDERR_TO_STDOUT_BOOLEAN`: true if the error + * output of the process should be redirected into the standard output of + * the process. This property has no effect if + * `SDL_PROP_PROCESS_CREATE_STDERR_NUMBER` is set. + * - `SDL_PROP_PROCESS_CREATE_BACKGROUND_BOOLEAN`: true if the process should + * run in the background. In this case the default input and output is + * `SDL_PROCESS_STDIO_NULL` and the exitcode of the process is not + * available, and will always be 0. + * + * On POSIX platforms, wait() and waitpid(-1, ...) should not be called, and + * SIGCHLD should not be ignored or handled because those would prevent SDL + * from properly tracking the lifetime of the underlying process. You should + * use SDL_WaitProcess() instead. + * + * \param props the properties to use. + * \returns the newly created and running process, or NULL if the process + * couldn't be created. + * + * \threadsafety It is safe to call this function from any thread. + * + * \since This function is available since SDL 3.0.0. + * + * \sa SDL_CreateProcess + * \sa SDL_GetProcessProperties + * \sa SDL_ReadProcess + * \sa SDL_GetProcessInput + * \sa SDL_GetProcessOutput + * \sa SDL_KillProcess + * \sa SDL_WaitProcess + * \sa SDL_DestroyProcess + */ +extern SDL_DECLSPEC SDL_Process *SDLCALL SDL_CreateProcessWithProperties(SDL_PropertiesID props); + +#define SDL_PROP_PROCESS_CREATE_ARGS_POINTER "SDL.process.create.args" +#define SDL_PROP_PROCESS_CREATE_ENVIRONMENT_POINTER "SDL.process.create.environment" +#define SDL_PROP_PROCESS_CREATE_STDIN_NUMBER "SDL.process.create.stdin_option" +#define SDL_PROP_PROCESS_CREATE_STDIN_POINTER "SDL.process.create.stdin_source" +#define SDL_PROP_PROCESS_CREATE_STDOUT_NUMBER "SDL.process.create.stdout_option" +#define SDL_PROP_PROCESS_CREATE_STDOUT_POINTER "SDL.process.create.stdout_source" +#define SDL_PROP_PROCESS_CREATE_STDERR_NUMBER "SDL.process.create.stderr_option" +#define SDL_PROP_PROCESS_CREATE_STDERR_POINTER "SDL.process.create.stderr_source" +#define SDL_PROP_PROCESS_CREATE_STDERR_TO_STDOUT_BOOLEAN "SDL.process.create.stderr_to_stdout" +#define SDL_PROP_PROCESS_CREATE_BACKGROUND_BOOLEAN "SDL.process.create.background" + +/** + * Get the properties associated with a process. + * + * The following read-only properties are provided by SDL: + * + * - `SDL_PROP_PROCESS_PID_NUMBER`: the process ID of the process. + * - `SDL_PROP_PROCESS_STDIN_POINTER`: an SDL_IOStream that can be used to write input to the process, if it was created with `SDL_PROP_PROCESS_CREATE_STDIN_NUMBER` set to `SDL_PROCESS_STDIO_APP`. + * - `SDL_PROP_PROCESS_STDOUT_POINTER`: a non-blocking SDL_IOStream that can be used to read output from the process, if it was created with `SDL_PROP_PROCESS_CREATE_STDOUT_NUMBER` set to `SDL_PROCESS_STDIO_APP`. + * - `SDL_PROP_PROCESS_STDERR_POINTER`: a non-blocking SDL_IOStream that can be used to read error output from the process, if it was created with `SDL_PROP_PROCESS_CREATE_STDERR_NUMBER` set to `SDL_PROCESS_STDIO_APP`. + * - `SDL_PROP_PROCESS_BACKGROUND_BOOLEAN`: true if the process is running in the background. + * + * \param process the process to query. + * \returns a valid property ID on success or 0 on failure; call + * SDL_GetError() for more information. + * + * \sa SDL_CreateProcess + * \sa SDL_CreateProcessWithProperties + * + * \threadsafety It is safe to call this function from any thread. + * + * \since This function is available since SDL 3.0.0. + */ +extern SDL_DECLSPEC SDL_PropertiesID SDL_GetProcessProperties(SDL_Process *process); + +#define SDL_PROP_PROCESS_PID_NUMBER "SDL.process.pid" +#define SDL_PROP_PROCESS_STDIN_POINTER "SDL.process.stdin" +#define SDL_PROP_PROCESS_STDOUT_POINTER "SDL.process.stdout" +#define SDL_PROP_PROCESS_STDERR_POINTER "SDL.process.stderr" +#define SDL_PROP_PROCESS_BACKGROUND_BOOLEAN "SDL.process.background" + +/** + * Read all the output from a process. + * + * If a process was created with I/O enabled, you can use this function to + * read the output. This function blocks until the process is complete, + * capturing all output, and providing the process exit code. + * + * The data is allocated with a zero byte at the end (null terminated) for + * convenience. This extra byte is not included in the value reported via + * `datasize`. + * + * The data should be freed with SDL_free(). + * + * \param process The process to read. + * \param datasize a pointer filled in with the number of bytes read, may be + * NULL. + * \param exitcode a pointer filled in with the process exit code if the + * process has exited, may be NULL. + * \returns the data or NULL on failure; call SDL_GetError() for more + * information. + * + * \threadsafety This function is not thread safe. + * + * \since This function is available since SDL 3.0.0. + * + * \sa SDL_CreateProcess + * \sa SDL_CreateProcessWithProperties + * \sa SDL_DestroyProcess + */ +extern SDL_DECLSPEC void * SDLCALL SDL_ReadProcess(SDL_Process *process, size_t *datasize, int *exitcode); + +/** + * Get the SDL_IOStream associated with process standard input. + * + * The process must have been created with SDL_CreateProcess() and pipe_stdio + * set to true, or with SDL_CreateProcessWithProperties() and + * `SDL_PROP_PROCESS_CREATE_STDIN_NUMBER` set to `SDL_PROCESS_STDIO_APP`. + * + * Writing to this stream can return less data than expected if the process + * hasn't read its input. It may be blocked waiting for its output to be read, + * so if you may need to call SDL_GetOutputStream() and read the output in + * parallel with writing input. + * + * \param process The process to get the input stream for. + * \returns the input stream or NULL on failure; call SDL_GetError() for more + * information. + * + * \threadsafety It is safe to call this function from any thread. + * + * \since This function is available since SDL 3.0.0. + * + * \sa SDL_CreateProcess + * \sa SDL_CreateProcessWithProperties + * \sa SDL_GetProcessOutput + */ +extern SDL_DECLSPEC SDL_IOStream *SDLCALL SDL_GetProcessInput(SDL_Process *process); + +/** + * Get the SDL_IOStream associated with process standard output. + * + * The process must have been created with SDL_CreateProcess() and pipe_stdio + * set to true, or with SDL_CreateProcessWithProperties() and + * `SDL_PROP_PROCESS_CREATE_STDOUT_NUMBER` set to `SDL_PROCESS_STDIO_APP`. + * + * Reading from this stream can return 0 with SDL_GetIOStatus() returning + * SDL_IO_STATUS_NOT_READY if no output is available yet. + * + * \param process The process to get the output stream for. + * \returns the output stream or NULL on failure; call SDL_GetError() for more + * information. + * + * \threadsafety It is safe to call this function from any thread. + * + * \since This function is available since SDL 3.0.0. + * + * \sa SDL_CreateProcess + * \sa SDL_CreateProcessWithProperties + * \sa SDL_GetProcessInput + */ +extern SDL_DECLSPEC SDL_IOStream *SDLCALL SDL_GetProcessOutput(SDL_Process *process); + +/** + * Stop a process. + * + * \param process The process to stop. + * \param force true to terminate the process immediately, false to try to + * stop the process gracefully. In general you should try to stop + * the process gracefully first as terminating a process may + * leave it with half-written data or in some other unstable + * state. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. + * + * \threadsafety This function is not thread safe. + * + * \since This function is available since SDL 3.0.0. + * + * \sa SDL_CreateProcess + * \sa SDL_CreateProcessWithProperties + * \sa SDL_WaitProcess + * \sa SDL_DestroyProcess + */ +extern SDL_DECLSPEC bool SDLCALL SDL_KillProcess(SDL_Process *process, bool force); + +/** + * Wait for a process to finish. + * + * This can be called multiple times to get the status of a process. + * + * The exit code will be the exit code of the process if it terminates + * normally, a negative signal if it terminated due to a signal, or -255 + * otherwise. It will not be changed if the process is still running. + * + * \param process The process to wait for. + * \param block If true, block until the process finishes; otherwise, report + * on the process' status. + * \param exitcode a pointer filled in with the process exit code if the + * process has exited, may be NULL. + * \returns true if the process exited, false otherwise. + * + * \threadsafety This function is not thread safe. + * + * \since This function is available since SDL 3.0.0. + * + * \sa SDL_CreateProcess + * \sa SDL_CreateProcessWithProperties + * \sa SDL_KillProcess + * \sa SDL_DestroyProcess + */ +extern SDL_DECLSPEC bool SDLCALL SDL_WaitProcess(SDL_Process *process, bool block, int *exitcode); + +/** + * Destroy a previously created process object. + * + * Note that this does not stop the process, just destroys the SDL object used + * to track it. If you want to stop the process you should use + * SDL_KillProcess(). + * + * \param process The process object to destroy. + * + * \threadsafety This function is not thread safe. + * + * \since This function is available since SDL 3.0.0. + * + * \sa SDL_CreateProcess + * \sa SDL_CreateProcessWithProperties + * \sa SDL_KillProcess + */ +extern SDL_DECLSPEC void SDLCALL SDL_DestroyProcess(SDL_Process *process); + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include + +#endif /* SDL_process_h_ */ diff --git a/include/SDL3/SDL_properties.h b/include/SDL3/SDL_properties.h index c3a2c82a..393d473a 100644 --- a/include/SDL3/SDL_properties.h +++ b/include/SDL3/SDL_properties.h @@ -116,14 +116,14 @@ extern SDL_DECLSPEC SDL_PropertiesID SDLCALL SDL_CreateProperties(void); * * \param src the properties to copy. * \param dst the destination properties. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_CopyProperties(SDL_PropertiesID src, SDL_PropertiesID dst); +extern SDL_DECLSPEC bool SDLCALL SDL_CopyProperties(SDL_PropertiesID src, SDL_PropertiesID dst); /** * Lock a group of properties. @@ -138,8 +138,8 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_CopyProperties(SDL_PropertiesID src, SD * thread. * * \param props the properties to lock. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \threadsafety It is safe to call this function from any thread. * @@ -147,7 +147,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_CopyProperties(SDL_PropertiesID src, SD * * \sa SDL_UnlockProperties */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_LockProperties(SDL_PropertiesID props); +extern SDL_DECLSPEC bool SDLCALL SDL_LockProperties(SDL_PropertiesID props); /** * Unlock a group of properties. @@ -204,8 +204,8 @@ typedef void (SDLCALL *SDL_CleanupPropertyCallback)(void *userdata, void *value) * \param cleanup the function to call when this property is deleted, or NULL * if no cleanup is necessary. * \param userdata a pointer that is passed to the cleanup function. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \threadsafety It is safe to call this function from any thread. * @@ -215,7 +215,7 @@ typedef void (SDLCALL *SDL_CleanupPropertyCallback)(void *userdata, void *value) * \sa SDL_SetPointerProperty * \sa SDL_CleanupPropertyCallback */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetPointerPropertyWithCleanup(SDL_PropertiesID props, const char *name, void *value, SDL_CleanupPropertyCallback cleanup, void *userdata); +extern SDL_DECLSPEC bool SDLCALL SDL_SetPointerPropertyWithCleanup(SDL_PropertiesID props, const char *name, void *value, SDL_CleanupPropertyCallback cleanup, void *userdata); /** * Set a pointer property in a group of properties. @@ -223,8 +223,8 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetPointerPropertyWithCleanup(SDL_Prope * \param props the properties to modify. * \param name the name of the property to modify. * \param value the new value of the property, or NULL to delete the property. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \threadsafety It is safe to call this function from any thread. * @@ -238,7 +238,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetPointerPropertyWithCleanup(SDL_Prope * \sa SDL_SetPointerPropertyWithCleanup * \sa SDL_SetStringProperty */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetPointerProperty(SDL_PropertiesID props, const char *name, void *value); +extern SDL_DECLSPEC bool SDLCALL SDL_SetPointerProperty(SDL_PropertiesID props, const char *name, void *value); /** * Set a string property in a group of properties. @@ -249,8 +249,8 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetPointerProperty(SDL_PropertiesID pro * \param props the properties to modify. * \param name the name of the property to modify. * \param value the new value of the property, or NULL to delete the property. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \threadsafety It is safe to call this function from any thread. * @@ -258,7 +258,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetPointerProperty(SDL_PropertiesID pro * * \sa SDL_GetStringProperty */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetStringProperty(SDL_PropertiesID props, const char *name, const char *value); +extern SDL_DECLSPEC bool SDLCALL SDL_SetStringProperty(SDL_PropertiesID props, const char *name, const char *value); /** * Set an integer property in a group of properties. @@ -266,8 +266,8 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetStringProperty(SDL_PropertiesID prop * \param props the properties to modify. * \param name the name of the property to modify. * \param value the new value of the property. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \threadsafety It is safe to call this function from any thread. * @@ -275,7 +275,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetStringProperty(SDL_PropertiesID prop * * \sa SDL_GetNumberProperty */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetNumberProperty(SDL_PropertiesID props, const char *name, Sint64 value); +extern SDL_DECLSPEC bool SDLCALL SDL_SetNumberProperty(SDL_PropertiesID props, const char *name, Sint64 value); /** * Set a floating point property in a group of properties. @@ -283,8 +283,8 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetNumberProperty(SDL_PropertiesID prop * \param props the properties to modify. * \param name the name of the property to modify. * \param value the new value of the property. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \threadsafety It is safe to call this function from any thread. * @@ -292,7 +292,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetNumberProperty(SDL_PropertiesID prop * * \sa SDL_GetFloatProperty */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetFloatProperty(SDL_PropertiesID props, const char *name, float value); +extern SDL_DECLSPEC bool SDLCALL SDL_SetFloatProperty(SDL_PropertiesID props, const char *name, float value); /** * Set a boolean property in a group of properties. @@ -300,8 +300,8 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetFloatProperty(SDL_PropertiesID props * \param props the properties to modify. * \param name the name of the property to modify. * \param value the new value of the property. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \threadsafety It is safe to call this function from any thread. * @@ -309,14 +309,14 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetFloatProperty(SDL_PropertiesID props * * \sa SDL_GetBooleanProperty */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetBooleanProperty(SDL_PropertiesID props, const char *name, SDL_bool value); +extern SDL_DECLSPEC bool SDLCALL SDL_SetBooleanProperty(SDL_PropertiesID props, const char *name, bool value); /** * Return whether a property exists in a group of properties. * * \param props the properties to query. * \param name the name of the property to query. - * \returns SDL_TRUE if the property exists, or SDL_FALSE if it doesn't. + * \returns true if the property exists, or false if it doesn't. * * \threadsafety It is safe to call this function from any thread. * @@ -324,7 +324,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetBooleanProperty(SDL_PropertiesID pro * * \sa SDL_GetPropertyType */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_HasProperty(SDL_PropertiesID props, const char *name); +extern SDL_DECLSPEC bool SDLCALL SDL_HasProperty(SDL_PropertiesID props, const char *name); /** * Get the type of a property in a group of properties. @@ -463,21 +463,21 @@ extern SDL_DECLSPEC float SDLCALL SDL_GetFloatProperty(SDL_PropertiesID props, c * \sa SDL_HasProperty * \sa SDL_SetBooleanProperty */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetBooleanProperty(SDL_PropertiesID props, const char *name, SDL_bool default_value); +extern SDL_DECLSPEC bool SDLCALL SDL_GetBooleanProperty(SDL_PropertiesID props, const char *name, bool default_value); /** * Clear a property from a group of properties. * * \param props the properties to modify. * \param name the name of the property to clear. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ClearProperty(SDL_PropertiesID props, const char *name); +extern SDL_DECLSPEC bool SDLCALL SDL_ClearProperty(SDL_PropertiesID props, const char *name); /** * A callback used to enumerate all the properties in a group of properties. @@ -507,14 +507,14 @@ typedef void (SDLCALL *SDL_EnumeratePropertiesCallback)(void *userdata, SDL_Prop * \param props the properties to query. * \param callback the function to call for each property. * \param userdata a pointer that is passed to `callback`. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_EnumerateProperties(SDL_PropertiesID props, SDL_EnumeratePropertiesCallback callback, void *userdata); +extern SDL_DECLSPEC bool SDLCALL SDL_EnumerateProperties(SDL_PropertiesID props, SDL_EnumeratePropertiesCallback callback, void *userdata); /** * Destroy a group of properties. diff --git a/include/SDL3/SDL_rect.h b/include/SDL3/SDL_rect.h index ea97df9c..8f9eee4d 100644 --- a/include/SDL3/SDL_rect.h +++ b/include/SDL3/SDL_rect.h @@ -146,16 +146,16 @@ SDL_FORCE_INLINE void SDL_RectToFRect(const SDL_Rect *rect, SDL_FRect *frect) * * \param p the point to test. * \param r the rectangle to test. - * \returns SDL_TRUE if `p` is contained by `r`, SDL_FALSE otherwise. + * \returns true if `p` is contained by `r`, false otherwise. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.0.0. */ -SDL_FORCE_INLINE SDL_bool SDL_PointInRect(const SDL_Point *p, const SDL_Rect *r) +SDL_FORCE_INLINE bool SDL_PointInRect(const SDL_Point *p, const SDL_Rect *r) { return ( p && r && (p->x >= r->x) && (p->x < (r->x + r->w)) && - (p->y >= r->y) && (p->y < (r->y + r->h)) ) ? SDL_TRUE : SDL_FALSE; + (p->y >= r->y) && (p->y < (r->y + r->h)) ) ? true : false; } /** @@ -170,15 +170,15 @@ SDL_FORCE_INLINE SDL_bool SDL_PointInRect(const SDL_Point *p, const SDL_Rect *r) * be able to find this function inside SDL itself). * * \param r the rectangle to test. - * \returns SDL_TRUE if the rectangle is "empty", SDL_FALSE otherwise. + * \returns true if the rectangle is "empty", false otherwise. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.0.0. */ -SDL_FORCE_INLINE SDL_bool SDL_RectEmpty(const SDL_Rect *r) +SDL_FORCE_INLINE bool SDL_RectEmpty(const SDL_Rect *r) { - return ((!r) || (r->w <= 0) || (r->h <= 0)) ? SDL_TRUE : SDL_FALSE; + return ((!r) || (r->w <= 0) || (r->h <= 0)) ? true : false; } /** @@ -194,26 +194,26 @@ SDL_FORCE_INLINE SDL_bool SDL_RectEmpty(const SDL_Rect *r) * * \param a the first rectangle to test. * \param b the second rectangle to test. - * \returns SDL_TRUE if the rectangles are equal, SDL_FALSE otherwise. + * \returns true if the rectangles are equal, false otherwise. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.0.0. */ -SDL_FORCE_INLINE SDL_bool SDL_RectsEqual(const SDL_Rect *a, const SDL_Rect *b) +SDL_FORCE_INLINE bool SDL_RectsEqual(const SDL_Rect *a, const SDL_Rect *b) { return (a && b && (a->x == b->x) && (a->y == b->y) && - (a->w == b->w) && (a->h == b->h)) ? SDL_TRUE : SDL_FALSE; + (a->w == b->w) && (a->h == b->h)) ? true : false; } /** * Determine whether two rectangles intersect. * - * If either pointer is NULL the function will return SDL_FALSE. + * If either pointer is NULL the function will return false. * * \param A an SDL_Rect structure representing the first rectangle. * \param B an SDL_Rect structure representing the second rectangle. - * \returns SDL_TRUE if there is an intersection, SDL_FALSE otherwise. + * \returns true if there is an intersection, false otherwise. * * \threadsafety It is safe to call this function from any thread. * @@ -221,24 +221,24 @@ SDL_FORCE_INLINE SDL_bool SDL_RectsEqual(const SDL_Rect *a, const SDL_Rect *b) * * \sa SDL_GetRectIntersection */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_HasRectIntersection(const SDL_Rect *A, const SDL_Rect *B); +extern SDL_DECLSPEC bool SDLCALL SDL_HasRectIntersection(const SDL_Rect *A, const SDL_Rect *B); /** * Calculate the intersection of two rectangles. * - * If `result` is NULL then this function will return SDL_FALSE. + * If `result` is NULL then this function will return false. * * \param A an SDL_Rect structure representing the first rectangle. * \param B an SDL_Rect structure representing the second rectangle. * \param result an SDL_Rect structure filled in with the intersection of * rectangles `A` and `B`. - * \returns SDL_TRUE if there is an intersection, SDL_FALSE otherwise. + * \returns true if there is an intersection, false otherwise. * * \since This function is available since SDL 3.0.0. * * \sa SDL_HasRectIntersection */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetRectIntersection(const SDL_Rect *A, const SDL_Rect *B, SDL_Rect *result); +extern SDL_DECLSPEC bool SDLCALL SDL_GetRectIntersection(const SDL_Rect *A, const SDL_Rect *B, SDL_Rect *result); /** * Calculate the union of two rectangles. @@ -247,12 +247,12 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetRectIntersection(const SDL_Rect *A, * \param B an SDL_Rect structure representing the second rectangle. * \param result an SDL_Rect structure filled in with the union of rectangles * `A` and `B`. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetRectUnion(const SDL_Rect *A, const SDL_Rect *B, SDL_Rect *result); +extern SDL_DECLSPEC bool SDLCALL SDL_GetRectUnion(const SDL_Rect *A, const SDL_Rect *B, SDL_Rect *result); /** * Calculate a minimal rectangle enclosing a set of points. @@ -266,12 +266,12 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetRectUnion(const SDL_Rect *A, const S * \param clip an SDL_Rect used for clipping or NULL to enclose all points. * \param result an SDL_Rect structure filled in with the minimal enclosing * rectangle. - * \returns SDL_TRUE if any points were enclosed or SDL_FALSE if all the - * points were outside of the clipping rectangle. + * \returns true if any points were enclosed or false if all the points were + * outside of the clipping rectangle. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetRectEnclosingPoints(const SDL_Point *points, int count, const SDL_Rect *clip, SDL_Rect *result); +extern SDL_DECLSPEC bool SDLCALL SDL_GetRectEnclosingPoints(const SDL_Point *points, int count, const SDL_Rect *clip, SDL_Rect *result); /** * Calculate the intersection of a rectangle and line segment. @@ -287,11 +287,11 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetRectEnclosingPoints(const SDL_Point * \param Y1 a pointer to the starting Y-coordinate of the line. * \param X2 a pointer to the ending X-coordinate of the line. * \param Y2 a pointer to the ending Y-coordinate of the line. - * \returns SDL_TRUE if there is an intersection, SDL_FALSE otherwise. + * \returns true if there is an intersection, false otherwise. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetRectAndLineIntersection(const SDL_Rect *rect, int *X1, int *Y1, int *X2, int *Y2); +extern SDL_DECLSPEC bool SDLCALL SDL_GetRectAndLineIntersection(const SDL_Rect *rect, int *X1, int *Y1, int *X2, int *Y2); /* SDL_FRect versions... */ @@ -311,16 +311,16 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetRectAndLineIntersection(const SDL_Re * * \param p the point to test. * \param r the rectangle to test. - * \returns SDL_TRUE if `p` is contained by `r`, SDL_FALSE otherwise. + * \returns true if `p` is contained by `r`, false otherwise. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.0.0. */ -SDL_FORCE_INLINE SDL_bool SDL_PointInRectFloat(const SDL_FPoint *p, const SDL_FRect *r) +SDL_FORCE_INLINE bool SDL_PointInRectFloat(const SDL_FPoint *p, const SDL_FRect *r) { return ( p && r && (p->x >= r->x) && (p->x <= (r->x + r->w)) && - (p->y >= r->y) && (p->y <= (r->y + r->h)) ) ? SDL_TRUE : SDL_FALSE; + (p->y >= r->y) && (p->y <= (r->y + r->h)) ) ? true : false; } /** @@ -335,15 +335,15 @@ SDL_FORCE_INLINE SDL_bool SDL_PointInRectFloat(const SDL_FPoint *p, const SDL_FR * be able to find this function inside SDL itself). * * \param r the rectangle to test. - * \returns SDL_TRUE if the rectangle is "empty", SDL_FALSE otherwise. + * \returns true if the rectangle is "empty", false otherwise. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.0.0. */ -SDL_FORCE_INLINE SDL_bool SDL_RectEmptyFloat(const SDL_FRect *r) +SDL_FORCE_INLINE bool SDL_RectEmptyFloat(const SDL_FRect *r) { - return ((!r) || (r->w < 0.0f) || (r->h < 0.0f)) ? SDL_TRUE : SDL_FALSE; + return ((!r) || (r->w < 0.0f) || (r->h < 0.0f)) ? true : false; } /** @@ -363,7 +363,7 @@ SDL_FORCE_INLINE SDL_bool SDL_RectEmptyFloat(const SDL_FRect *r) * \param a the first rectangle to test. * \param b the second rectangle to test. * \param epsilon the epsilon value for comparison. - * \returns SDL_TRUE if the rectangles are equal, SDL_FALSE otherwise. + * \returns true if the rectangles are equal, false otherwise. * * \threadsafety It is safe to call this function from any thread. * @@ -371,14 +371,14 @@ SDL_FORCE_INLINE SDL_bool SDL_RectEmptyFloat(const SDL_FRect *r) * * \sa SDL_RectsEqualFloat */ -SDL_FORCE_INLINE SDL_bool SDL_RectsEqualEpsilon(const SDL_FRect *a, const SDL_FRect *b, const float epsilon) +SDL_FORCE_INLINE bool SDL_RectsEqualEpsilon(const SDL_FRect *a, const SDL_FRect *b, const float epsilon) { return (a && b && ((a == b) || ((SDL_fabsf(a->x - b->x) <= epsilon) && (SDL_fabsf(a->y - b->y) <= epsilon) && (SDL_fabsf(a->w - b->w) <= epsilon) && (SDL_fabsf(a->h - b->h) <= epsilon)))) - ? SDL_TRUE : SDL_FALSE; + ? true : false; } /** @@ -398,7 +398,7 @@ SDL_FORCE_INLINE SDL_bool SDL_RectsEqualEpsilon(const SDL_FRect *a, const SDL_FR * * \param a the first rectangle to test. * \param b the second rectangle to test. - * \returns SDL_TRUE if the rectangles are equal, SDL_FALSE otherwise. + * \returns true if the rectangles are equal, false otherwise. * * \threadsafety It is safe to call this function from any thread. * @@ -406,7 +406,7 @@ SDL_FORCE_INLINE SDL_bool SDL_RectsEqualEpsilon(const SDL_FRect *a, const SDL_FR * * \sa SDL_RectsEqualEpsilon */ -SDL_FORCE_INLINE SDL_bool SDL_RectsEqualFloat(const SDL_FRect *a, const SDL_FRect *b) +SDL_FORCE_INLINE bool SDL_RectsEqualFloat(const SDL_FRect *a, const SDL_FRect *b) { return SDL_RectsEqualEpsilon(a, b, SDL_FLT_EPSILON); } @@ -414,34 +414,34 @@ SDL_FORCE_INLINE SDL_bool SDL_RectsEqualFloat(const SDL_FRect *a, const SDL_FRec /** * Determine whether two rectangles intersect with float precision. * - * If either pointer is NULL the function will return SDL_FALSE. + * If either pointer is NULL the function will return false. * * \param A an SDL_FRect structure representing the first rectangle. * \param B an SDL_FRect structure representing the second rectangle. - * \returns SDL_TRUE if there is an intersection, SDL_FALSE otherwise. + * \returns true if there is an intersection, false otherwise. * * \since This function is available since SDL 3.0.0. * * \sa SDL_GetRectIntersection */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_HasRectIntersectionFloat(const SDL_FRect *A, const SDL_FRect *B); +extern SDL_DECLSPEC bool SDLCALL SDL_HasRectIntersectionFloat(const SDL_FRect *A, const SDL_FRect *B); /** * Calculate the intersection of two rectangles with float precision. * - * If `result` is NULL then this function will return SDL_FALSE. + * If `result` is NULL then this function will return false. * * \param A an SDL_FRect structure representing the first rectangle. * \param B an SDL_FRect structure representing the second rectangle. * \param result an SDL_FRect structure filled in with the intersection of * rectangles `A` and `B`. - * \returns SDL_TRUE if there is an intersection, SDL_FALSE otherwise. + * \returns true if there is an intersection, false otherwise. * * \since This function is available since SDL 3.0.0. * * \sa SDL_HasRectIntersectionFloat */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetRectIntersectionFloat(const SDL_FRect *A, const SDL_FRect *B, SDL_FRect *result); +extern SDL_DECLSPEC bool SDLCALL SDL_GetRectIntersectionFloat(const SDL_FRect *A, const SDL_FRect *B, SDL_FRect *result); /** * Calculate the union of two rectangles with float precision. @@ -450,12 +450,12 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetRectIntersectionFloat(const SDL_FRec * \param B an SDL_FRect structure representing the second rectangle. * \param result an SDL_FRect structure filled in with the union of rectangles * `A` and `B`. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetRectUnionFloat(const SDL_FRect *A, const SDL_FRect *B, SDL_FRect *result); +extern SDL_DECLSPEC bool SDLCALL SDL_GetRectUnionFloat(const SDL_FRect *A, const SDL_FRect *B, SDL_FRect *result); /** * Calculate a minimal rectangle enclosing a set of points with float @@ -470,12 +470,12 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetRectUnionFloat(const SDL_FRect *A, c * \param clip an SDL_FRect used for clipping or NULL to enclose all points. * \param result an SDL_FRect structure filled in with the minimal enclosing * rectangle. - * \returns SDL_TRUE if any points were enclosed or SDL_FALSE if all the - * points were outside of the clipping rectangle. + * \returns true if any points were enclosed or false if all the points were + * outside of the clipping rectangle. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetRectEnclosingPointsFloat(const SDL_FPoint *points, int count, const SDL_FRect *clip, SDL_FRect *result); +extern SDL_DECLSPEC bool SDLCALL SDL_GetRectEnclosingPointsFloat(const SDL_FPoint *points, int count, const SDL_FRect *clip, SDL_FRect *result); /** * Calculate the intersection of a rectangle and line segment with float @@ -492,11 +492,11 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetRectEnclosingPointsFloat(const SDL_F * \param Y1 a pointer to the starting Y-coordinate of the line. * \param X2 a pointer to the ending X-coordinate of the line. * \param Y2 a pointer to the ending Y-coordinate of the line. - * \returns SDL_TRUE if there is an intersection, SDL_FALSE otherwise. + * \returns true if there is an intersection, false otherwise. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetRectAndLineIntersectionFloat(const SDL_FRect *rect, float *X1, float *Y1, float *X2, float *Y2); +extern SDL_DECLSPEC bool SDLCALL SDL_GetRectAndLineIntersectionFloat(const SDL_FRect *rect, float *X1, float *Y1, float *X2, float *Y2); /* Ends C function definitions when using C++ */ #ifdef __cplusplus diff --git a/include/SDL3/SDL_render.h b/include/SDL3/SDL_render.h index 706308cf..f0fd8973 100644 --- a/include/SDL3/SDL_render.h +++ b/include/SDL3/SDL_render.h @@ -51,10 +51,13 @@ #define SDL_render_h_ #include +#include #include #include +#include #include #include +#include #include #include @@ -174,15 +177,15 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetRenderDriver(int index); * SDL_CreateWindow()). * \param window a pointer filled with the window, or NULL on error. * \param renderer a pointer filled with the renderer, or NULL on error. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_CreateRenderer * \sa SDL_CreateWindow */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_CreateWindowAndRenderer(const char *title, int width, int height, SDL_WindowFlags window_flags, SDL_Window **window, SDL_Renderer **renderer); +extern SDL_DECLSPEC bool SDLCALL SDL_CreateWindowAndRenderer(const char *title, int width, int height, SDL_WindowFlags window_flags, SDL_Window **window, SDL_Renderer **renderer); /** * Create a 2D rendering context for a window. @@ -444,14 +447,14 @@ extern SDL_DECLSPEC SDL_PropertiesID SDLCALL SDL_GetRendererProperties(SDL_Rende * \param renderer the rendering context. * \param w a pointer filled in with the width in pixels. * \param h a pointer filled in with the height in pixels. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_GetCurrentRenderOutputSize */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetRenderOutputSize(SDL_Renderer *renderer, int *w, int *h); +extern SDL_DECLSPEC bool SDLCALL SDL_GetRenderOutputSize(SDL_Renderer *renderer, int *w, int *h); /** * Get the current output size in pixels of a rendering context. @@ -464,18 +467,20 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetRenderOutputSize(SDL_Renderer *rende * \param renderer the rendering context. * \param w a pointer filled in with the current width. * \param h a pointer filled in with the current height. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_GetRenderOutputSize */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetCurrentRenderOutputSize(SDL_Renderer *renderer, int *w, int *h); +extern SDL_DECLSPEC bool SDLCALL SDL_GetCurrentRenderOutputSize(SDL_Renderer *renderer, int *w, int *h); /** * Create a texture for a rendering context. * + * The contents of a texture when first created are not defined. + * * \param renderer the rendering context. * \param format one of the enumerated values in SDL_PixelFormat. * \param access one of the enumerated values in SDL_TextureAccess. @@ -801,12 +806,12 @@ extern SDL_DECLSPEC SDL_Renderer * SDLCALL SDL_GetRendererFromTexture(SDL_Textur * argument can be NULL if you don't need this information. * \param h a pointer filled in with the height of the texture in pixels. This * argument can be NULL if you don't need this information. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetTextureSize(SDL_Texture *texture, float *w, float *h); +extern SDL_DECLSPEC bool SDLCALL SDL_GetTextureSize(SDL_Texture *texture, float *w, float *h); /** * Set an additional color value multiplied into render copy operations. @@ -818,14 +823,14 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetTextureSize(SDL_Texture *texture, fl * `srcC = srcC * (color / 255)` * * Color modulation is not always supported by the renderer; it will return - * SDL_FALSE if color modulation is not supported. + * false if color modulation is not supported. * * \param texture the texture to update. * \param r the red color value multiplied into copy operations. * \param g the green color value multiplied into copy operations. * \param b the blue color value multiplied into copy operations. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * @@ -833,7 +838,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetTextureSize(SDL_Texture *texture, fl * \sa SDL_SetTextureAlphaMod * \sa SDL_SetTextureColorModFloat */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetTextureColorMod(SDL_Texture *texture, Uint8 r, Uint8 g, Uint8 b); +extern SDL_DECLSPEC bool SDLCALL SDL_SetTextureColorMod(SDL_Texture *texture, Uint8 r, Uint8 g, Uint8 b); /** @@ -846,14 +851,14 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetTextureColorMod(SDL_Texture *texture * `srcC = srcC * color` * * Color modulation is not always supported by the renderer; it will return - * SDL_FALSE if color modulation is not supported. + * false if color modulation is not supported. * * \param texture the texture to update. * \param r the red color value multiplied into copy operations. * \param g the green color value multiplied into copy operations. * \param b the blue color value multiplied into copy operations. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * @@ -861,7 +866,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetTextureColorMod(SDL_Texture *texture * \sa SDL_SetTextureAlphaModFloat * \sa SDL_SetTextureColorMod */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetTextureColorModFloat(SDL_Texture *texture, float r, float g, float b); +extern SDL_DECLSPEC bool SDLCALL SDL_SetTextureColorModFloat(SDL_Texture *texture, float r, float g, float b); /** @@ -871,8 +876,8 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetTextureColorModFloat(SDL_Texture *te * \param r a pointer filled in with the current red color value. * \param g a pointer filled in with the current green color value. * \param b a pointer filled in with the current blue color value. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * @@ -880,7 +885,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetTextureColorModFloat(SDL_Texture *te * \sa SDL_GetTextureColorModFloat * \sa SDL_SetTextureColorMod */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetTextureColorMod(SDL_Texture *texture, Uint8 *r, Uint8 *g, Uint8 *b); +extern SDL_DECLSPEC bool SDLCALL SDL_GetTextureColorMod(SDL_Texture *texture, Uint8 *r, Uint8 *g, Uint8 *b); /** * Get the additional color value multiplied into render copy operations. @@ -889,8 +894,8 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetTextureColorMod(SDL_Texture *texture * \param r a pointer filled in with the current red color value. * \param g a pointer filled in with the current green color value. * \param b a pointer filled in with the current blue color value. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * @@ -898,7 +903,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetTextureColorMod(SDL_Texture *texture * \sa SDL_GetTextureColorMod * \sa SDL_SetTextureColorModFloat */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetTextureColorModFloat(SDL_Texture *texture, float *r, float *g, float *b); +extern SDL_DECLSPEC bool SDLCALL SDL_GetTextureColorModFloat(SDL_Texture *texture, float *r, float *g, float *b); /** * Set an additional alpha value multiplied into render copy operations. @@ -909,12 +914,12 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetTextureColorModFloat(SDL_Texture *te * `srcA = srcA * (alpha / 255)` * * Alpha modulation is not always supported by the renderer; it will return - * SDL_FALSE if alpha modulation is not supported. + * false if alpha modulation is not supported. * * \param texture the texture to update. * \param alpha the source alpha value multiplied into copy operations. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * @@ -922,7 +927,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetTextureColorModFloat(SDL_Texture *te * \sa SDL_SetTextureAlphaModFloat * \sa SDL_SetTextureColorMod */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetTextureAlphaMod(SDL_Texture *texture, Uint8 alpha); +extern SDL_DECLSPEC bool SDLCALL SDL_SetTextureAlphaMod(SDL_Texture *texture, Uint8 alpha); /** * Set an additional alpha value multiplied into render copy operations. @@ -933,12 +938,12 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetTextureAlphaMod(SDL_Texture *texture * `srcA = srcA * alpha` * * Alpha modulation is not always supported by the renderer; it will return - * SDL_FALSE if alpha modulation is not supported. + * false if alpha modulation is not supported. * * \param texture the texture to update. * \param alpha the source alpha value multiplied into copy operations. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * @@ -946,15 +951,15 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetTextureAlphaMod(SDL_Texture *texture * \sa SDL_SetTextureAlphaMod * \sa SDL_SetTextureColorModFloat */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetTextureAlphaModFloat(SDL_Texture *texture, float alpha); +extern SDL_DECLSPEC bool SDLCALL SDL_SetTextureAlphaModFloat(SDL_Texture *texture, float alpha); /** * Get the additional alpha value multiplied into render copy operations. * * \param texture the texture to query. * \param alpha a pointer filled in with the current alpha value. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * @@ -962,15 +967,15 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetTextureAlphaModFloat(SDL_Texture *te * \sa SDL_GetTextureColorMod * \sa SDL_SetTextureAlphaMod */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetTextureAlphaMod(SDL_Texture *texture, Uint8 *alpha); +extern SDL_DECLSPEC bool SDLCALL SDL_GetTextureAlphaMod(SDL_Texture *texture, Uint8 *alpha); /** * Get the additional alpha value multiplied into render copy operations. * * \param texture the texture to query. * \param alpha a pointer filled in with the current alpha value. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * @@ -978,38 +983,38 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetTextureAlphaMod(SDL_Texture *texture * \sa SDL_GetTextureColorModFloat * \sa SDL_SetTextureAlphaModFloat */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetTextureAlphaModFloat(SDL_Texture *texture, float *alpha); +extern SDL_DECLSPEC bool SDLCALL SDL_GetTextureAlphaModFloat(SDL_Texture *texture, float *alpha); /** * Set the blend mode for a texture, used by SDL_RenderTexture(). * * If the blend mode is not supported, the closest supported mode is chosen - * and this function returns -1. + * and this function returns false. * * \param texture the texture to update. * \param blendMode the SDL_BlendMode to use for texture blending. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_GetTextureBlendMode */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetTextureBlendMode(SDL_Texture *texture, SDL_BlendMode blendMode); +extern SDL_DECLSPEC bool SDLCALL SDL_SetTextureBlendMode(SDL_Texture *texture, SDL_BlendMode blendMode); /** * Get the blend mode used for texture copy operations. * * \param texture the texture to query. * \param blendMode a pointer filled in with the current SDL_BlendMode. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_SetTextureBlendMode */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetTextureBlendMode(SDL_Texture *texture, SDL_BlendMode *blendMode); +extern SDL_DECLSPEC bool SDLCALL SDL_GetTextureBlendMode(SDL_Texture *texture, SDL_BlendMode *blendMode); /** * Set the scale mode used for texture scale operations. @@ -1020,28 +1025,28 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetTextureBlendMode(SDL_Texture *textur * * \param texture the texture to update. * \param scaleMode the SDL_ScaleMode to use for texture scaling. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_GetTextureScaleMode */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetTextureScaleMode(SDL_Texture *texture, SDL_ScaleMode scaleMode); +extern SDL_DECLSPEC bool SDLCALL SDL_SetTextureScaleMode(SDL_Texture *texture, SDL_ScaleMode scaleMode); /** * Get the scale mode used for texture scale operations. * * \param texture the texture to query. * \param scaleMode a pointer filled in with the current scale mode. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_SetTextureScaleMode */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetTextureScaleMode(SDL_Texture *texture, SDL_ScaleMode *scaleMode); +extern SDL_DECLSPEC bool SDLCALL SDL_GetTextureScaleMode(SDL_Texture *texture, SDL_ScaleMode *scaleMode); /** * Update the given texture rectangle with new pixel data. @@ -1063,8 +1068,8 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetTextureScaleMode(SDL_Texture *textur * \param pixels the raw pixel data in the format of the texture. * \param pitch the number of bytes in a row of pixel data, including padding * between lines. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * @@ -1073,7 +1078,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetTextureScaleMode(SDL_Texture *textur * \sa SDL_UpdateNVTexture * \sa SDL_UpdateYUVTexture */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_UpdateTexture(SDL_Texture *texture, const SDL_Rect *rect, const void *pixels, int pitch); +extern SDL_DECLSPEC bool SDLCALL SDL_UpdateTexture(SDL_Texture *texture, const SDL_Rect *rect, const void *pixels, int pitch); /** * Update a rectangle within a planar YV12 or IYUV texture with new pixel @@ -1095,15 +1100,15 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_UpdateTexture(SDL_Texture *texture, con * \param Vplane the raw pixel data for the V plane. * \param Vpitch the number of bytes between rows of pixel data for the V * plane. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_UpdateNVTexture * \sa SDL_UpdateTexture */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_UpdateYUVTexture(SDL_Texture *texture, +extern SDL_DECLSPEC bool SDLCALL SDL_UpdateYUVTexture(SDL_Texture *texture, const SDL_Rect *rect, const Uint8 *Yplane, int Ypitch, const Uint8 *Uplane, int Upitch, @@ -1125,15 +1130,15 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_UpdateYUVTexture(SDL_Texture *texture, * \param UVplane the raw pixel data for the UV plane. * \param UVpitch the number of bytes between rows of pixel data for the UV * plane. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_UpdateTexture * \sa SDL_UpdateYUVTexture */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_UpdateNVTexture(SDL_Texture *texture, +extern SDL_DECLSPEC bool SDLCALL SDL_UpdateNVTexture(SDL_Texture *texture, const SDL_Rect *rect, const Uint8 *Yplane, int Ypitch, const Uint8 *UVplane, int UVpitch); @@ -1157,16 +1162,16 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_UpdateNVTexture(SDL_Texture *texture, * appropriately offset by the locked area. * \param pitch this is filled in with the pitch of the locked pixels; the * pitch is the length of one row in bytes. - * \returns SDL_TRUE on success or SDL_FALSE if the texture is not valid or - * was not created with `SDL_TEXTUREACCESS_STREAMING`; call - * SDL_GetError() for more information. + * \returns true on success or false if the texture is not valid or was not + * created with `SDL_TEXTUREACCESS_STREAMING`; call SDL_GetError() + * for more information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_LockTextureToSurface * \sa SDL_UnlockTexture */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_LockTexture(SDL_Texture *texture, +extern SDL_DECLSPEC bool SDLCALL SDL_LockTexture(SDL_Texture *texture, const SDL_Rect *rect, void **pixels, int *pitch); @@ -1194,15 +1199,15 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_LockTexture(SDL_Texture *texture, * NULL, the entire texture will be locked. * \param surface this is filled in with an SDL surface representing the * locked area. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_LockTexture * \sa SDL_UnlockTexture */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_LockTextureToSurface(SDL_Texture *texture, const SDL_Rect *rect, SDL_Surface **surface); +extern SDL_DECLSPEC bool SDLCALL SDL_LockTextureToSurface(SDL_Texture *texture, const SDL_Rect *rect, SDL_Surface **surface); /** * Unlock a texture, uploading the changes to video memory, if needed. @@ -1234,14 +1239,14 @@ extern SDL_DECLSPEC void SDLCALL SDL_UnlockTexture(SDL_Texture *texture); * \param texture the targeted texture, which must be created with the * `SDL_TEXTUREACCESS_TARGET` flag, or NULL to render to the * window instead of a texture. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_GetRenderTarget */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetRenderTarget(SDL_Renderer *renderer, SDL_Texture *texture); +extern SDL_DECLSPEC bool SDLCALL SDL_SetRenderTarget(SDL_Renderer *renderer, SDL_Texture *texture); /** * Get the current render target. @@ -1277,8 +1282,8 @@ extern SDL_DECLSPEC SDL_Texture * SDLCALL SDL_GetRenderTarget(SDL_Renderer *rend * \param h the height of the logical resolution. * \param mode the presentation mode used. * \param scale_mode the scale mode used. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * @@ -1286,7 +1291,7 @@ extern SDL_DECLSPEC SDL_Texture * SDLCALL SDL_GetRenderTarget(SDL_Renderer *rend * \sa SDL_GetRenderLogicalPresentation * \sa SDL_GetRenderLogicalPresentationRect */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetRenderLogicalPresentation(SDL_Renderer *renderer, int w, int h, SDL_RendererLogicalPresentation mode, SDL_ScaleMode scale_mode); +extern SDL_DECLSPEC bool SDLCALL SDL_SetRenderLogicalPresentation(SDL_Renderer *renderer, int w, int h, SDL_RendererLogicalPresentation mode, SDL_ScaleMode scale_mode); /** * Get device independent resolution and presentation mode for rendering. @@ -1299,14 +1304,14 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetRenderLogicalPresentation(SDL_Render * \param h an int to be filled with the height. * \param mode a pointer filled in with the presentation mode. * \param scale_mode a pointer filled in with the scale mode. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_SetRenderLogicalPresentation */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetRenderLogicalPresentation(SDL_Renderer *renderer, int *w, int *h, SDL_RendererLogicalPresentation *mode, SDL_ScaleMode *scale_mode); +extern SDL_DECLSPEC bool SDLCALL SDL_GetRenderLogicalPresentation(SDL_Renderer *renderer, int *w, int *h, SDL_RendererLogicalPresentation *mode, SDL_ScaleMode *scale_mode); /** * Get the final presentation rectangle for rendering. @@ -1319,14 +1324,14 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetRenderLogicalPresentation(SDL_Render * \param renderer the rendering context. * \param rect a pointer filled in with the final presentation rectangle, may * be NULL. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_SetRenderLogicalPresentation */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetRenderLogicalPresentationRect(SDL_Renderer *renderer, SDL_FRect *rect); +extern SDL_DECLSPEC bool SDLCALL SDL_GetRenderLogicalPresentationRect(SDL_Renderer *renderer, SDL_FRect *rect); /** * Get a point in render coordinates when given a point in window coordinates. @@ -1336,15 +1341,15 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetRenderLogicalPresentationRect(SDL_Re * \param window_y the y coordinate in window coordinates. * \param x a pointer filled with the x coordinate in render coordinates. * \param y a pointer filled with the y coordinate in render coordinates. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_SetRenderLogicalPresentation * \sa SDL_SetRenderScale */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_RenderCoordinatesFromWindow(SDL_Renderer *renderer, float window_x, float window_y, float *x, float *y); +extern SDL_DECLSPEC bool SDLCALL SDL_RenderCoordinatesFromWindow(SDL_Renderer *renderer, float window_x, float window_y, float *x, float *y); /** * Get a point in window coordinates when given a point in render coordinates. @@ -1356,15 +1361,15 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_RenderCoordinatesFromWindow(SDL_Rendere * coordinates. * \param window_y a pointer filled with the y coordinate in window * coordinates. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_SetRenderLogicalPresentation * \sa SDL_SetRenderScale */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_RenderCoordinatesToWindow(SDL_Renderer *renderer, float x, float y, float *window_x, float *window_y); +extern SDL_DECLSPEC bool SDLCALL SDL_RenderCoordinatesToWindow(SDL_Renderer *renderer, float x, float y, float *window_x, float *window_y); /** * Convert the coordinates in an event to render coordinates. @@ -1376,14 +1381,14 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_RenderCoordinatesToWindow(SDL_Renderer * * \param renderer the rendering context. * \param event the event to modify. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_RenderCoordinatesFromWindow */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ConvertEventToRenderCoordinates(SDL_Renderer *renderer, SDL_Event *event); +extern SDL_DECLSPEC bool SDLCALL SDL_ConvertEventToRenderCoordinates(SDL_Renderer *renderer, SDL_Event *event); /** * Set the drawing area for rendering on the current target. @@ -1391,30 +1396,30 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ConvertEventToRenderCoordinates(SDL_Ren * \param renderer the rendering context. * \param rect the SDL_Rect structure representing the drawing area, or NULL * to set the viewport to the entire target. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_GetRenderViewport * \sa SDL_RenderViewportSet */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetRenderViewport(SDL_Renderer *renderer, const SDL_Rect *rect); +extern SDL_DECLSPEC bool SDLCALL SDL_SetRenderViewport(SDL_Renderer *renderer, const SDL_Rect *rect); /** * Get the drawing area for the current target. * * \param renderer the rendering context. * \param rect an SDL_Rect structure filled in with the current drawing area. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_RenderViewportSet * \sa SDL_SetRenderViewport */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetRenderViewport(SDL_Renderer *renderer, SDL_Rect *rect); +extern SDL_DECLSPEC bool SDLCALL SDL_GetRenderViewport(SDL_Renderer *renderer, SDL_Rect *rect); /** * Return whether an explicit rectangle was set as the viewport. @@ -1424,15 +1429,15 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetRenderViewport(SDL_Renderer *rendere * viewport is always reset when changing rendering targets. * * \param renderer the rendering context. - * \returns SDL_TRUE if the viewport was set to a specific rectangle, or - * SDL_FALSE if it was set to NULL (the entire target). + * \returns true if the viewport was set to a specific rectangle, or false if + * it was set to NULL (the entire target). * * \since This function is available since SDL 3.0.0. * * \sa SDL_GetRenderViewport * \sa SDL_SetRenderViewport */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_RenderViewportSet(SDL_Renderer *renderer); +extern SDL_DECLSPEC bool SDLCALL SDL_RenderViewportSet(SDL_Renderer *renderer); /** * Get the safe area for rendering within the current viewport. @@ -1447,12 +1452,12 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_RenderViewportSet(SDL_Renderer *rendere * \param renderer the rendering context. * \param rect a pointer filled in with the area that is safe for interactive * content. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetRenderSafeArea(SDL_Renderer *renderer, SDL_Rect *rect); +extern SDL_DECLSPEC bool SDLCALL SDL_GetRenderSafeArea(SDL_Renderer *renderer, SDL_Rect *rect); /** * Set the clip rectangle for rendering on the specified target. @@ -1460,15 +1465,15 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetRenderSafeArea(SDL_Renderer *rendere * \param renderer the rendering context. * \param rect an SDL_Rect structure representing the clip area, relative to * the viewport, or NULL to disable clipping. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_GetRenderClipRect * \sa SDL_RenderClipEnabled */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetRenderClipRect(SDL_Renderer *renderer, const SDL_Rect *rect); +extern SDL_DECLSPEC bool SDLCALL SDL_SetRenderClipRect(SDL_Renderer *renderer, const SDL_Rect *rect); /** * Get the clip rectangle for the current target. @@ -1476,29 +1481,29 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetRenderClipRect(SDL_Renderer *rendere * \param renderer the rendering context. * \param rect an SDL_Rect structure filled in with the current clipping area * or an empty rectangle if clipping is disabled. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_RenderClipEnabled * \sa SDL_SetRenderClipRect */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetRenderClipRect(SDL_Renderer *renderer, SDL_Rect *rect); +extern SDL_DECLSPEC bool SDLCALL SDL_GetRenderClipRect(SDL_Renderer *renderer, SDL_Rect *rect); /** * Get whether clipping is enabled on the given renderer. * * \param renderer the rendering context. - * \returns SDL_TRUE if clipping is enabled or SDL_FALSE if not; call - * SDL_GetError() for more information. + * \returns true if clipping is enabled or false if not; call SDL_GetError() + * for more information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_GetRenderClipRect * \sa SDL_SetRenderClipRect */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_RenderClipEnabled(SDL_Renderer *renderer); +extern SDL_DECLSPEC bool SDLCALL SDL_RenderClipEnabled(SDL_Renderer *renderer); /** * Set the drawing scale for rendering on the current target. @@ -1514,14 +1519,14 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_RenderClipEnabled(SDL_Renderer *rendere * \param renderer the rendering context. * \param scaleX the horizontal scaling factor. * \param scaleY the vertical scaling factor. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_GetRenderScale */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetRenderScale(SDL_Renderer *renderer, float scaleX, float scaleY); +extern SDL_DECLSPEC bool SDLCALL SDL_SetRenderScale(SDL_Renderer *renderer, float scaleX, float scaleY); /** * Get the drawing scale for the current target. @@ -1529,14 +1534,14 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetRenderScale(SDL_Renderer *renderer, * \param renderer the rendering context. * \param scaleX a pointer filled in with the horizontal scaling factor. * \param scaleY a pointer filled in with the vertical scaling factor. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_SetRenderScale */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetRenderScale(SDL_Renderer *renderer, float *scaleX, float *scaleY); +extern SDL_DECLSPEC bool SDLCALL SDL_GetRenderScale(SDL_Renderer *renderer, float *scaleX, float *scaleY); /** * Set the color used for drawing operations. @@ -1551,15 +1556,15 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetRenderScale(SDL_Renderer *renderer, * \param a the alpha value used to draw on the rendering target; usually * `SDL_ALPHA_OPAQUE` (255). Use SDL_SetRenderDrawBlendMode to * specify how the alpha channel is used. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_GetRenderDrawColor * \sa SDL_SetRenderDrawColorFloat */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetRenderDrawColor(SDL_Renderer *renderer, Uint8 r, Uint8 g, Uint8 b, Uint8 a); +extern SDL_DECLSPEC bool SDLCALL SDL_SetRenderDrawColor(SDL_Renderer *renderer, Uint8 r, Uint8 g, Uint8 b, Uint8 a); /** * Set the color used for drawing operations (Rect, Line and Clear). @@ -1574,15 +1579,15 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetRenderDrawColor(SDL_Renderer *render * \param a the alpha value used to draw on the rendering target. Use * SDL_SetRenderDrawBlendMode to specify how the alpha channel is * used. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_GetRenderDrawColorFloat * \sa SDL_SetRenderDrawColor */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetRenderDrawColorFloat(SDL_Renderer *renderer, float r, float g, float b, float a); +extern SDL_DECLSPEC bool SDLCALL SDL_SetRenderDrawColorFloat(SDL_Renderer *renderer, float r, float g, float b, float a); /** * Get the color used for drawing operations (Rect, Line and Clear). @@ -1596,15 +1601,15 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetRenderDrawColorFloat(SDL_Renderer *r * rendering target. * \param a a pointer filled in with the alpha value used to draw on the * rendering target; usually `SDL_ALPHA_OPAQUE` (255). - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_GetRenderDrawColorFloat * \sa SDL_SetRenderDrawColor */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetRenderDrawColor(SDL_Renderer *renderer, Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a); +extern SDL_DECLSPEC bool SDLCALL SDL_GetRenderDrawColor(SDL_Renderer *renderer, Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a); /** * Get the color used for drawing operations (Rect, Line and Clear). @@ -1618,15 +1623,15 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetRenderDrawColor(SDL_Renderer *render * rendering target. * \param a a pointer filled in with the alpha value used to draw on the * rendering target. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_SetRenderDrawColorFloat * \sa SDL_GetRenderDrawColor */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetRenderDrawColorFloat(SDL_Renderer *renderer, float *r, float *g, float *b, float *a); +extern SDL_DECLSPEC bool SDLCALL SDL_GetRenderDrawColorFloat(SDL_Renderer *renderer, float *r, float *g, float *b, float *a); /** * Set the color scale used for render operations. @@ -1641,28 +1646,28 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetRenderDrawColorFloat(SDL_Renderer *r * * \param renderer the rendering context. * \param scale the color scale value. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_GetRenderColorScale */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetRenderColorScale(SDL_Renderer *renderer, float scale); +extern SDL_DECLSPEC bool SDLCALL SDL_SetRenderColorScale(SDL_Renderer *renderer, float scale); /** * Get the color scale used for render operations. * * \param renderer the rendering context. * \param scale a pointer filled in with the current color scale value. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_SetRenderColorScale */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetRenderColorScale(SDL_Renderer *renderer, float *scale); +extern SDL_DECLSPEC bool SDLCALL SDL_GetRenderColorScale(SDL_Renderer *renderer, float *scale); /** * Set the blend mode used for drawing operations (Fill and Line). @@ -1671,28 +1676,28 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetRenderColorScale(SDL_Renderer *rende * * \param renderer the rendering context. * \param blendMode the SDL_BlendMode to use for blending. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_GetRenderDrawBlendMode */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetRenderDrawBlendMode(SDL_Renderer *renderer, SDL_BlendMode blendMode); +extern SDL_DECLSPEC bool SDLCALL SDL_SetRenderDrawBlendMode(SDL_Renderer *renderer, SDL_BlendMode blendMode); /** * Get the blend mode used for drawing operations. * * \param renderer the rendering context. * \param blendMode a pointer filled in with the current SDL_BlendMode. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_SetRenderDrawBlendMode */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetRenderDrawBlendMode(SDL_Renderer *renderer, SDL_BlendMode *blendMode); +extern SDL_DECLSPEC bool SDLCALL SDL_GetRenderDrawBlendMode(SDL_Renderer *renderer, SDL_BlendMode *blendMode); /** * Clear the current rendering target with the drawing color. @@ -1703,14 +1708,14 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetRenderDrawBlendMode(SDL_Renderer *re * SDL_SetRenderDrawColor() when needed. * * \param renderer the rendering context. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_SetRenderDrawColor */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_RenderClear(SDL_Renderer *renderer); +extern SDL_DECLSPEC bool SDLCALL SDL_RenderClear(SDL_Renderer *renderer); /** * Draw a point on the current rendering target at subpixel precision. @@ -1718,14 +1723,14 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_RenderClear(SDL_Renderer *renderer); * \param renderer the renderer which should draw a point. * \param x the x coordinate of the point. * \param y the y coordinate of the point. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_RenderPoints */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_RenderPoint(SDL_Renderer *renderer, float x, float y); +extern SDL_DECLSPEC bool SDLCALL SDL_RenderPoint(SDL_Renderer *renderer, float x, float y); /** * Draw multiple points on the current rendering target at subpixel precision. @@ -1733,14 +1738,14 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_RenderPoint(SDL_Renderer *renderer, flo * \param renderer the renderer which should draw multiple points. * \param points the points to draw. * \param count the number of points to draw. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_RenderPoint */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_RenderPoints(SDL_Renderer *renderer, const SDL_FPoint *points, int count); +extern SDL_DECLSPEC bool SDLCALL SDL_RenderPoints(SDL_Renderer *renderer, const SDL_FPoint *points, int count); /** * Draw a line on the current rendering target at subpixel precision. @@ -1750,14 +1755,14 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_RenderPoints(SDL_Renderer *renderer, co * \param y1 the y coordinate of the start point. * \param x2 the x coordinate of the end point. * \param y2 the y coordinate of the end point. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_RenderLines */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_RenderLine(SDL_Renderer *renderer, float x1, float y1, float x2, float y2); +extern SDL_DECLSPEC bool SDLCALL SDL_RenderLine(SDL_Renderer *renderer, float x1, float y1, float x2, float y2); /** * Draw a series of connected lines on the current rendering target at @@ -1766,14 +1771,14 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_RenderLine(SDL_Renderer *renderer, floa * \param renderer the renderer which should draw multiple lines. * \param points the points along the lines. * \param count the number of points, drawing count-1 lines. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_RenderLine */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_RenderLines(SDL_Renderer *renderer, const SDL_FPoint *points, int count); +extern SDL_DECLSPEC bool SDLCALL SDL_RenderLines(SDL_Renderer *renderer, const SDL_FPoint *points, int count); /** * Draw a rectangle on the current rendering target at subpixel precision. @@ -1781,14 +1786,14 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_RenderLines(SDL_Renderer *renderer, con * \param renderer the renderer which should draw a rectangle. * \param rect a pointer to the destination rectangle, or NULL to outline the * entire rendering target. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_RenderRects */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_RenderRect(SDL_Renderer *renderer, const SDL_FRect *rect); +extern SDL_DECLSPEC bool SDLCALL SDL_RenderRect(SDL_Renderer *renderer, const SDL_FRect *rect); /** * Draw some number of rectangles on the current rendering target at subpixel @@ -1797,14 +1802,14 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_RenderRect(SDL_Renderer *renderer, cons * \param renderer the renderer which should draw multiple rectangles. * \param rects a pointer to an array of destination rectangles. * \param count the number of rectangles. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_RenderRect */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_RenderRects(SDL_Renderer *renderer, const SDL_FRect *rects, int count); +extern SDL_DECLSPEC bool SDLCALL SDL_RenderRects(SDL_Renderer *renderer, const SDL_FRect *rects, int count); /** * Fill a rectangle on the current rendering target with the drawing color at @@ -1813,14 +1818,14 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_RenderRects(SDL_Renderer *renderer, con * \param renderer the renderer which should fill a rectangle. * \param rect a pointer to the destination rectangle, or NULL for the entire * rendering target. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_RenderFillRects */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_RenderFillRect(SDL_Renderer *renderer, const SDL_FRect *rect); +extern SDL_DECLSPEC bool SDLCALL SDL_RenderFillRect(SDL_Renderer *renderer, const SDL_FRect *rect); /** * Fill some number of rectangles on the current rendering target with the @@ -1829,14 +1834,14 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_RenderFillRect(SDL_Renderer *renderer, * \param renderer the renderer which should fill multiple rectangles. * \param rects a pointer to an array of destination rectangles. * \param count the number of rectangles. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_RenderFillRect */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_RenderFillRects(SDL_Renderer *renderer, const SDL_FRect *rects, int count); +extern SDL_DECLSPEC bool SDLCALL SDL_RenderFillRects(SDL_Renderer *renderer, const SDL_FRect *rects, int count); /** * Copy a portion of the texture to the current rendering target at subpixel @@ -1848,15 +1853,15 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_RenderFillRects(SDL_Renderer *renderer, * texture. * \param dstrect a pointer to the destination rectangle, or NULL for the * entire rendering target. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_RenderTextureRotated * \sa SDL_RenderTextureTiled */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_RenderTexture(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_FRect *srcrect, const SDL_FRect *dstrect); +extern SDL_DECLSPEC bool SDLCALL SDL_RenderTexture(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_FRect *srcrect, const SDL_FRect *dstrect); /** * Copy a portion of the source texture to the current rendering target, with @@ -1875,14 +1880,14 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_RenderTexture(SDL_Renderer *renderer, S * around dstrect.w/2, dstrect.h/2). * \param flip an SDL_FlipMode value stating which flipping actions should be * performed on the texture. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_RenderTexture */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_RenderTextureRotated(SDL_Renderer *renderer, SDL_Texture *texture, +extern SDL_DECLSPEC bool SDLCALL SDL_RenderTextureRotated(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_FRect *srcrect, const SDL_FRect *dstrect, const double angle, const SDL_FPoint *center, const SDL_FlipMode flip); @@ -1903,14 +1908,14 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_RenderTextureRotated(SDL_Renderer *rend * 64x64 tiles. * \param dstrect a pointer to the destination rectangle, or NULL for the * entire rendering target. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_RenderTexture */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_RenderTextureTiled(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_FRect *srcrect, float scale, const SDL_FRect *dstrect); +extern SDL_DECLSPEC bool SDLCALL SDL_RenderTextureTiled(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_FRect *srcrect, float scale, const SDL_FRect *dstrect); /** * Perform a scaled copy using the 9-grid algorithm to the current rendering @@ -1935,14 +1940,14 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_RenderTextureTiled(SDL_Renderer *render * corner of `dstrect`, or 0.0f for an unscaled copy. * \param dstrect a pointer to the destination rectangle, or NULL for the * entire rendering target. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_RenderTexture */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_RenderTexture9Grid(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_FRect *srcrect, float left_width, float right_width, float top_height, float bottom_height, float scale, const SDL_FRect *dstrect); +extern SDL_DECLSPEC bool SDLCALL SDL_RenderTexture9Grid(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_FRect *srcrect, float left_width, float right_width, float top_height, float bottom_height, float scale, const SDL_FRect *dstrect); /** * Render a list of triangles, optionally using a texture and indices into the @@ -1957,14 +1962,14 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_RenderTexture9Grid(SDL_Renderer *render * array, if NULL all vertices will be rendered in sequential * order. * \param num_indices number of indices. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_RenderGeometryRaw */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_RenderGeometry(SDL_Renderer *renderer, +extern SDL_DECLSPEC bool SDLCALL SDL_RenderGeometry(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Vertex *vertices, int num_vertices, const int *indices, int num_indices); @@ -1987,14 +1992,14 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_RenderGeometry(SDL_Renderer *renderer, * if NULL all vertices will be rendered in sequential order. * \param num_indices number of indices. * \param size_indices index size: 1 (byte), 2 (short), 4 (int). - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_RenderGeometry */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_RenderGeometryRaw(SDL_Renderer *renderer, +extern SDL_DECLSPEC bool SDLCALL SDL_RenderGeometryRaw(SDL_Renderer *renderer, SDL_Texture *texture, const float *xy, int xy_stride, const SDL_FColor *color, int color_stride, @@ -2047,8 +2052,8 @@ extern SDL_DECLSPEC SDL_Surface * SDLCALL SDL_RenderReadPixels(SDL_Renderer *ren * do not have a concept of backbuffers. * * \param renderer the rendering context. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \threadsafety You may only call this function on the main thread. * @@ -2067,7 +2072,7 @@ extern SDL_DECLSPEC SDL_Surface * SDLCALL SDL_RenderReadPixels(SDL_Renderer *ren * \sa SDL_SetRenderDrawBlendMode * \sa SDL_SetRenderDrawColor */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_RenderPresent(SDL_Renderer *renderer); +extern SDL_DECLSPEC bool SDLCALL SDL_RenderPresent(SDL_Renderer *renderer); /** * Destroy the specified texture. @@ -2122,12 +2127,12 @@ extern SDL_DECLSPEC void SDLCALL SDL_DestroyRenderer(SDL_Renderer *renderer); * be prepared to make changes if specific state needs to be protected. * * \param renderer the rendering context. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_FlushRenderer(SDL_Renderer *renderer); +extern SDL_DECLSPEC bool SDLCALL SDL_FlushRenderer(SDL_Renderer *renderer); /** * Get the CAMetalLayer associated with the given Metal renderer. @@ -2187,15 +2192,15 @@ extern SDL_DECLSPEC void * SDLCALL SDL_GetRenderMetalCommandEncoder(SDL_Renderer * \param signal_semaphore a VkSempahore that SDL will signal when rendering * for the current frame is complete, or 0 if not * needed. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \threadsafety It is **NOT** safe to call this function from two threads at * once. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_AddVulkanRenderSemaphores(SDL_Renderer *renderer, Uint32 wait_stage_mask, Sint64 wait_semaphore, Sint64 signal_semaphore); +extern SDL_DECLSPEC bool SDLCALL SDL_AddVulkanRenderSemaphores(SDL_Renderer *renderer, Uint32 wait_stage_mask, Sint64 wait_semaphore, Sint64 signal_semaphore); /** * Toggle VSync of the given renderer. @@ -2211,14 +2216,14 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_AddVulkanRenderSemaphores(SDL_Renderer * * \param renderer the renderer to toggle. * \param vsync the vertical refresh sync interval. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_GetRenderVSync */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetRenderVSync(SDL_Renderer *renderer, int vsync); +extern SDL_DECLSPEC bool SDLCALL SDL_SetRenderVSync(SDL_Renderer *renderer, int vsync); #define SDL_RENDERER_VSYNC_DISABLED 0 #define SDL_RENDERER_VSYNC_ADAPTIVE (-1) @@ -2229,14 +2234,14 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetRenderVSync(SDL_Renderer *renderer, * \param renderer the renderer to toggle. * \param vsync an int filled with the current vertical refresh sync interval. * See SDL_SetRenderVSync() for the meaning of the value. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_SetRenderVSync */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetRenderVSync(SDL_Renderer *renderer, int *vsync); +extern SDL_DECLSPEC bool SDLCALL SDL_GetRenderVSync(SDL_Renderer *renderer, int *vsync); /* Ends C function definitions when using C++ */ #ifdef __cplusplus diff --git a/include/SDL3/SDL_scancode.h b/include/SDL3/SDL_scancode.h index ccf8bb5f..16fb2a82 100644 --- a/include/SDL3/SDL_scancode.h +++ b/include/SDL3/SDL_scancode.h @@ -417,8 +417,8 @@ typedef enum SDL_Scancode SDL_SCANCODE_RESERVED = 400, /**< 400-500 reserved for dynamic keycodes */ - SDL_NUM_SCANCODES = 512 /**< not a key, just marks the number of scancodes - for array bounds */ + SDL_SCANCODE_COUNT = 512 /**< not a key, just marks the number of scancodes for array bounds */ + } SDL_Scancode; #endif /* SDL_scancode_h_ */ diff --git a/include/SDL3/SDL_sensor.h b/include/SDL3/SDL_sensor.h index 3ae48566..2ad2fc02 100644 --- a/include/SDL3/SDL_sensor.h +++ b/include/SDL3/SDL_sensor.h @@ -23,6 +23,10 @@ * # CategorySensor * * SDL sensor management. + * + * In order to use these functions, SDL_Init() must have been called with the + * SDL_INIT_SENSOR flag. This causes SDL to scan the system for sensors, and + * load appropriate drivers. */ #ifndef SDL_sensor_h_ @@ -40,15 +44,6 @@ extern "C" { /* *INDENT-ON* */ #endif -/** - * SDL_sensor.h - * - * In order to use these functions, SDL_Init() must have been called - * with the SDL_INIT_SENSOR flag. This causes SDL to scan the system - * for sensors, and load appropriate drivers. - */ - -struct SDL_Sensor; typedef struct SDL_Sensor SDL_Sensor; /** @@ -277,12 +272,12 @@ extern SDL_DECLSPEC SDL_SensorID SDLCALL SDL_GetSensorID(SDL_Sensor *sensor); * \param sensor the SDL_Sensor object to query. * \param data a pointer filled with the current sensor state. * \param num_values the number of values to write to data. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetSensorData(SDL_Sensor *sensor, float *data, int num_values); +extern SDL_DECLSPEC bool SDLCALL SDL_GetSensorData(SDL_Sensor *sensor, float *data, int num_values); /** * Close a sensor previously opened with SDL_OpenSensor(). diff --git a/include/SDL3/SDL_stdinc.h b/include/SDL3/SDL_stdinc.h index 6fb09b1a..d958eb29 100644 --- a/include/SDL3/SDL_stdinc.h +++ b/include/SDL3/SDL_stdinc.h @@ -23,8 +23,10 @@ * # CategoryStdinc * * This is a general header that includes C language support. It implements a - * subset of the C runtime: these should all behave the same way as their C - * runtime equivalents, but with an SDL_ prefix. + * subset of the C runtime APIs, but with an `SDL_` prefix. For most common + * use cases, these should behave the same way as their C runtime equivalents, + * but they may differ in how or whether they handle certain edge cases. When + * in doubt, consult the documentation for details. */ #ifndef SDL_stdinc_h_ @@ -32,13 +34,27 @@ #include +/* Most everything except Visual Studio 2013 and earlier has stdbool.h now */ +#if defined(_MSC_VER) && (_MSC_VER < 1910) +#define SDL_DEFINE_STDBOOL +#endif + #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L #include #endif #include #ifndef __cplusplus +#ifdef SDL_DEFINE_STDBOOL +#ifndef __bool_true_false_are_defined +#define __bool_true_false_are_defined 1 +#define bool int8_t +#define false 0 +#define true 1 +#endif +#else #include #endif +#endif #include #include #include @@ -122,7 +138,76 @@ void *alloca(size_t); * -Wold-style-cast of GCC (and -Werror=old-style-cast in GCC 4.2 and above). */ /* @{ */ -#ifdef __cplusplus + +#ifdef SDL_WIKI_DOCUMENTATION_SECTION + +/** + * Handle a Reinterpret Cast properly whether using C or C++. + * + * If compiled as C++, this macro offers a proper C++ reinterpret_cast<>. + * + * If compiled as C, this macro does a normal C-style cast. + * + * This is helpful to avoid compiler warnings in C++. + * + * \param type the type to cast the expression to. + * \param expression the expression to cast to a different type. + * \returns `expression`, cast to `type`. + * + * \threadsafety It is safe to call this macro from any thread. + * + * \since This macro is available since SDL 3.0.0. + * + * \sa SDL_static_cast + * \sa SDL_const_cast + */ +#define SDL_reinterpret_cast(type, expression) reinterpret_cast(expression) /* or `((type)(expression))` in C */ + +/** + * Handle a Static Cast properly whether using C or C++. + * + * If compiled as C++, this macro offers a proper C++ static_cast<>. + * + * If compiled as C, this macro does a normal C-style cast. + * + * This is helpful to avoid compiler warnings in C++. + * + * \param type the type to cast the expression to. + * \param expression the expression to cast to a different type. + * \returns `expression`, cast to `type`. + * + * \threadsafety It is safe to call this macro from any thread. + * + * \since This macro is available since SDL 3.0.0. + * + * \sa SDL_reinterpret_cast + * \sa SDL_const_cast + */ +#define SDL_static_cast(type, expression) static_cast(expression) /* or `((type)(expression))` in C */ + +/** + * Handle a Const Cast properly whether using C or C++. + * + * If compiled as C++, this macro offers a proper C++ const_cast<>. + * + * If compiled as C, this macro does a normal C-style cast. + * + * This is helpful to avoid compiler warnings in C++. + * + * \param type the type to cast the expression to. + * \param expression the expression to cast to a different type. + * \returns `expression`, cast to `type`. + * + * \threadsafety It is safe to call this macro from any thread. + * + * \since This macro is available since SDL 3.0.0. + * + * \sa SDL_reinterpret_cast + * \sa SDL_static_cast + */ +#define SDL_const_cast(type, expression) const_cast(expression) /* or `((type)(expression))` in C */ + +#elif defined(__cplusplus) #define SDL_reinterpret_cast(type, expression) reinterpret_cast(expression) #define SDL_static_cast(type, expression) static_cast(expression) #define SDL_const_cast(type, expression) const_cast(expression) @@ -131,9 +216,23 @@ void *alloca(size_t); #define SDL_static_cast(type, expression) ((type)(expression)) #define SDL_const_cast(type, expression) ((type)(expression)) #endif + /* @} *//* Cast operators */ -/* Define a four character code as a Uint32 */ +/** + * Define a four character code as a Uint32. + * + * \param A the first ASCII character. + * \param B the second ASCII character. + * \param C the third ASCII character. + * \param D the fourth ASCII character. + * \returns the four characters converted into a Uint32, one character + * per-byte. + * + * \threadsafety It is safe to call this macro from any thread. + * + * \since This macro is available since SDL 3.0.0. + */ #define SDL_FOURCC(A, B, C, D) \ ((SDL_static_cast(Uint32, SDL_static_cast(Uint8, (A))) << 0) | \ (SDL_static_cast(Uint32, SDL_static_cast(Uint8, (B))) << 8) | \ @@ -187,34 +286,6 @@ void *alloca(size_t); */ /* @{ */ -/** - * A boolean false. - * - * \since This macro is available since SDL 3.0.0. - * - * \sa SDL_bool - */ -#define SDL_FALSE false - -/** - * A boolean true. - * - * \since This macro is available since SDL 3.0.0. - * - * \sa SDL_bool - */ -#define SDL_TRUE true - -/** - * A boolean type: true or false. - * - * \since This datatype is available since SDL 3.0.0. - * - * \sa SDL_TRUE - * \sa SDL_FALSE - */ -typedef bool SDL_bool; - /** * A signed 8-bit integer type. * @@ -336,7 +407,7 @@ typedef Sint64 SDL_Time; * should define these but this is not true all platforms. * (for example win32) */ #ifndef SDL_PRIs64 -#if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK) +#if defined(SDL_PLATFORM_WINDOWS) #define SDL_PRIs64 "I64d" #elif defined(PRIs64) #define SDL_PRIs64 PRIs64 @@ -347,7 +418,7 @@ typedef Sint64 SDL_Time; #endif #endif #ifndef SDL_PRIu64 -#if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK) +#if defined(SDL_PLATFORM_WINDOWS) #define SDL_PRIu64 "I64u" #elif defined(PRIu64) #define SDL_PRIu64 PRIu64 @@ -358,7 +429,7 @@ typedef Sint64 SDL_Time; #endif #endif #ifndef SDL_PRIx64 -#if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK) +#if defined(SDL_PLATFORM_WINDOWS) #define SDL_PRIx64 "I64x" #elif defined(PRIx64) #define SDL_PRIx64 PRIx64 @@ -369,7 +440,7 @@ typedef Sint64 SDL_Time; #endif #endif #ifndef SDL_PRIX64 -#if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK) +#if defined(SDL_PLATFORM_WINDOWS) #define SDL_PRIX64 "I64X" #elif defined(PRIX64) #define SDL_PRIX64 PRIX64 @@ -423,7 +494,7 @@ typedef Sint64 SDL_Time; #define SDL_SCANF_VARARG_FUNC( fmtargnumber ) #define SDL_SCANF_VARARG_FUNCV( fmtargnumber ) #define SDL_WPRINTF_VARARG_FUNC( fmtargnumber ) -#define SDL_WSCANF_VARARG_FUNC( fmtargnumber ) +#define SDL_WPRINTF_VARARG_FUNCV( fmtargnumber ) #else #if defined(_MSC_VER) && (_MSC_VER >= 1600) /* VS 2010 and above */ #include @@ -453,14 +524,14 @@ typedef Sint64 SDL_Time; #define SDL_SCANF_VARARG_FUNC( fmtargnumber ) __attribute__ (( format( __scanf__, fmtargnumber, fmtargnumber+1 ))) #define SDL_SCANF_VARARG_FUNCV( fmtargnumber ) __attribute__(( format( __scanf__, fmtargnumber, 0 ))) #define SDL_WPRINTF_VARARG_FUNC( fmtargnumber ) /* __attribute__ (( format( __wprintf__, fmtargnumber, fmtargnumber+1 ))) */ -#define SDL_WSCANF_VARARG_FUNC( fmtargnumber ) /* __attribute__ (( format( __wscanf__, fmtargnumber, fmtargnumber+1 ))) */ +#define SDL_WPRINTF_VARARG_FUNCV( fmtargnumber ) /* __attribute__ (( format( __wprintf__, 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 ) #define SDL_WPRINTF_VARARG_FUNC( fmtargnumber ) -#define SDL_WSCANF_VARARG_FUNC( fmtargnumber ) +#define SDL_WPRINTF_VARARG_FUNCV( fmtargnumber ) #endif #endif /* SDL_DISABLE_ANALYZE_MACROS */ @@ -485,15 +556,24 @@ typedef Sint64 SDL_Time; /** \cond */ #ifndef DOXYGEN_SHOULD_IGNORE_THIS -SDL_COMPILE_TIME_ASSERT(bool, sizeof(SDL_bool) == 1); -SDL_COMPILE_TIME_ASSERT(uint8, sizeof(Uint8) == 1); -SDL_COMPILE_TIME_ASSERT(sint8, sizeof(Sint8) == 1); -SDL_COMPILE_TIME_ASSERT(uint16, sizeof(Uint16) == 2); -SDL_COMPILE_TIME_ASSERT(sint16, sizeof(Sint16) == 2); -SDL_COMPILE_TIME_ASSERT(uint32, sizeof(Uint32) == 4); -SDL_COMPILE_TIME_ASSERT(sint32, sizeof(Sint32) == 4); -SDL_COMPILE_TIME_ASSERT(uint64, sizeof(Uint64) == 8); -SDL_COMPILE_TIME_ASSERT(sint64, sizeof(Sint64) == 8); +SDL_COMPILE_TIME_ASSERT(bool_size, sizeof(bool) == 1); +SDL_COMPILE_TIME_ASSERT(uint8_size, sizeof(Uint8) == 1); +SDL_COMPILE_TIME_ASSERT(sint8_size, sizeof(Sint8) == 1); +SDL_COMPILE_TIME_ASSERT(uint16_size, sizeof(Uint16) == 2); +SDL_COMPILE_TIME_ASSERT(sint16_size, sizeof(Sint16) == 2); +SDL_COMPILE_TIME_ASSERT(uint32_size, sizeof(Uint32) == 4); +SDL_COMPILE_TIME_ASSERT(sint32_size, sizeof(Sint32) == 4); +SDL_COMPILE_TIME_ASSERT(uint64_size, sizeof(Uint64) == 8); +SDL_COMPILE_TIME_ASSERT(sint64_size, sizeof(Sint64) == 8); +SDL_COMPILE_TIME_ASSERT(uint64_longlong, sizeof(Uint64) <= sizeof(unsigned long long)); +SDL_COMPILE_TIME_ASSERT(size_t_longlong, sizeof(size_t) <= sizeof(unsigned long long)); +typedef struct SDL_alignment_test +{ + Uint8 a; + void *b; +} SDL_alignment_test; +SDL_COMPILE_TIME_ASSERT(struct_alignment, sizeof(SDL_alignment_test) == (2 * sizeof(void *))); +SDL_COMPILE_TIME_ASSERT(two_s_complement, (int)~(int)0 == (int)(-1)); #endif /* DOXYGEN_SHOULD_IGNORE_THIS */ /** \endcond */ @@ -523,6 +603,51 @@ SDL_COMPILE_TIME_ASSERT(enum, sizeof(SDL_DUMMY_ENUM) == sizeof(int)); extern "C" { #endif +/** + * A macro to initialize an SDL interface. + * + * This macro will initialize an SDL interface structure and should be called + * before you fill out the fields with your implementation. + * + * You can use it like this: + * + * ```c + * SDL_IOStreamInterface iface; + * + * SDL_INIT_INTERFACE(&iface); + * + * // Fill in the interface function pointers with your implementation + * iface.seek = ... + * + * stream = SDL_OpenIO(&iface, NULL); + * ``` + * + * If you are using designated initializers, you can use the size of the + * interface as the version, e.g. + * + * ```c + * SDL_IOStreamInterface iface = { + * .version = sizeof(iface), + * .seek = ... + * }; + * stream = SDL_OpenIO(&iface, NULL); + * ``` + * + * \threadsafety It is safe to call this macro from any thread. + * + * \since This macro is available since SDL 3.0.0. + * + * \sa SDL_IOStreamInterface + * \sa SDL_StorageInterface + * \sa SDL_VirtualJoystickDesc + */ +#define SDL_INIT_INTERFACE(iface) \ + do { \ + SDL_zerop(iface); \ + (iface)->version = sizeof(*(iface)); \ + } while (0) + + #ifndef SDL_DISABLE_ALLOCA #define SDL_stack_alloc(type, count) (type*)alloca(sizeof(type)*(count)) #define SDL_stack_free(data) @@ -531,14 +656,184 @@ extern "C" { #define SDL_stack_free(data) SDL_free(data) #endif +/** + * Allocate uninitialized memory. + * + * The allocated memory returned by this function must be freed with + * SDL_free(). + * + * If `size` is 0, it will be set to 1. + * + * If you want to allocate memory aligned to a specific alignment, consider + * using SDL_aligned_alloc(). + * + * \param size the size to allocate. + * \returns a pointer to the allocated memory, or NULL if allocation failed. + * + * \threadsafety It is safe to call this function from any thread. + * + * \since This function is available since SDL 3.0.0. + * + * \sa SDL_free + * \sa SDL_calloc + * \sa SDL_realloc + * \sa SDL_aligned_alloc + */ extern SDL_DECLSPEC SDL_MALLOC void * SDLCALL SDL_malloc(size_t size); + +/** + * Allocate a zero-initialized array. + * + * The memory returned by this function must be freed with SDL_free(). + * + * If either of `nmemb` or `size` is 0, they will both be set to 1. + * + * \param nmemb the number of elements in the array. + * \param size the size of each element of the array. + * \returns a pointer to the allocated array, or NULL if allocation failed. + * + * \threadsafety It is safe to call this function from any thread. + * + * \since This function is available since SDL 3.0.0. + * + * \sa SDL_free + * \sa SDL_malloc + * \sa SDL_realloc + */ extern SDL_DECLSPEC SDL_MALLOC SDL_ALLOC_SIZE2(1, 2) void * SDLCALL SDL_calloc(size_t nmemb, size_t size); + +/** + * Change the size of allocated memory. + * + * The memory returned by this function must be freed with SDL_free(). + * + * If `size` is 0, it will be set to 1. Note that this is unlike some other C + * runtime `realloc` implementations, which may treat `realloc(mem, 0)` the + * same way as `free(mem)`. + * + * If `mem` is NULL, the behavior of this function is equivalent to + * SDL_malloc(). Otherwise, the function can have one of three possible + * outcomes: + * + * - If it returns the same pointer as `mem`, it means that `mem` was resized + * in place without freeing. + * - If it returns a different non-NULL pointer, it means that `mem` was freed + * and cannot be dereferenced anymore. + * - If it returns NULL (indicating failure), then `mem` will remain valid and + * must still be freed with SDL_free(). + * + * \param mem a pointer to allocated memory to reallocate, or NULL. + * \param size the new size of the memory. + * \returns a pointer to the newly allocated memory, or NULL if allocation + * failed. + * + * \threadsafety It is safe to call this function from any thread. + * + * \since This function is available since SDL 3.0.0. + * + * \sa SDL_free + * \sa SDL_malloc + * \sa SDL_calloc + */ extern SDL_DECLSPEC SDL_ALLOC_SIZE(2) void * SDLCALL SDL_realloc(void *mem, size_t size); + +/** + * Free allocated memory. + * + * The pointer is no longer valid after this call and cannot be dereferenced + * anymore. + * + * If `mem` is NULL, this function does nothing. + * + * \param mem a pointer to allocated memory, or NULL. + * + * \threadsafety It is safe to call this function from any thread. + * + * \since This function is available since SDL 3.0.0. + * + * \sa SDL_malloc + * \sa SDL_calloc + * \sa SDL_realloc + */ extern SDL_DECLSPEC void SDLCALL SDL_free(void *mem); +/** + * A callback used to implement SDL_malloc(). + * + * SDL will always ensure that the passed `size` is greater than 0. + * + * \param size the size to allocate. + * \returns a pointer to the allocated memory, or NULL if allocation failed. + * + * \threadsafety It should be safe to call this callback from any thread. + * + * \since This datatype is available since SDL 3.0.0. + * + * \sa SDL_malloc + * \sa SDL_GetOriginalMemoryFunctions + * \sa SDL_GetMemoryFunctions + * \sa SDL_SetMemoryFunctions + */ typedef void *(SDLCALL *SDL_malloc_func)(size_t size); + +/** + * A callback used to implement SDL_calloc(). + * + * SDL will always ensure that the passed `nmemb` and `size` are both greater + * than 0. + * + * \param nmemb the number of elements in the array. + * \param size the size of each element of the array. + * \returns a pointer to the allocated array, or NULL if allocation failed. + * + * \threadsafety It should be safe to call this callback from any thread. + * + * \since This datatype is available since SDL 3.0.0. + * + * \sa SDL_calloc + * \sa SDL_GetOriginalMemoryFunctions + * \sa SDL_GetMemoryFunctions + * \sa SDL_SetMemoryFunctions + */ typedef void *(SDLCALL *SDL_calloc_func)(size_t nmemb, size_t size); + +/** + * A callback used to implement SDL_realloc(). + * + * SDL will always ensure that the passed `size` is greater than 0. + * + * \param mem a pointer to allocated memory to reallocate, or NULL. + * \param size the new size of the memory. + * \returns a pointer to the newly allocated memory, or NULL if allocation + * failed. + * + * \threadsafety It should be safe to call this callback from any thread. + * + * \since This datatype is available since SDL 3.0.0. + * + * \sa SDL_realloc + * \sa SDL_GetOriginalMemoryFunctions + * \sa SDL_GetMemoryFunctions + * \sa SDL_SetMemoryFunctions + */ typedef void *(SDLCALL *SDL_realloc_func)(void *mem, size_t size); + +/** + * A callback used to implement SDL_free(). + * + * SDL will always ensure that the passed `mem` is a non-NULL pointer. + * + * \param mem a pointer to allocated memory. + * + * \threadsafety It should be safe to call this callback from any thread. + * + * \since This datatype is available since SDL 3.0.0. + * + * \sa SDL_free + * \sa SDL_GetOriginalMemoryFunctions + * \sa SDL_GetMemoryFunctions + * \sa SDL_SetMemoryFunctions + */ typedef void (SDLCALL *SDL_free_func)(void *mem); /** @@ -599,8 +894,8 @@ extern SDL_DECLSPEC void SDLCALL SDL_GetMemoryFunctions(SDL_malloc_func *malloc_ * \param calloc_func custom calloc function. * \param realloc_func custom realloc function. * \param free_func custom free function. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \threadsafety It is safe to call this function from any thread, but one * should not replace the memory functions once any allocations @@ -611,26 +906,26 @@ extern SDL_DECLSPEC void SDLCALL SDL_GetMemoryFunctions(SDL_malloc_func *malloc_ * \sa SDL_GetMemoryFunctions * \sa SDL_GetOriginalMemoryFunctions */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetMemoryFunctions(SDL_malloc_func malloc_func, +extern SDL_DECLSPEC bool SDLCALL SDL_SetMemoryFunctions(SDL_malloc_func malloc_func, SDL_calloc_func calloc_func, SDL_realloc_func realloc_func, SDL_free_func free_func); /** - * Allocate memory aligned to a specific value. - * - * If `alignment` is less than the size of `void *`, then it will be increased - * to match that. - * - * The returned memory address will be a multiple of the alignment value, and - * the amount of memory allocated will be a multiple of the alignment value. + * Allocate memory aligned to a specific alignment. * * The memory returned by this function must be freed with SDL_aligned_free(), - * and _not_ SDL_free. + * _not_ SDL_free(). * - * \param alignment the alignment requested. + * If `alignment` is less than the size of `void *`, it will be increased to + * match that. + * + * The returned memory address will be a multiple of the alignment value, and + * the size of the memory allocated will be a multiple of the alignment value. + * + * \param alignment the alignment of the memory. * \param size the size to allocate. - * \returns a pointer to the aligned memory. + * \returns a pointer to the aligned memory, or NULL if allocation failed. * * \threadsafety It is safe to call this function from any thread. * @@ -646,7 +941,9 @@ extern SDL_DECLSPEC SDL_MALLOC void * SDLCALL SDL_aligned_alloc(size_t alignment * The pointer is no longer valid after this call and cannot be dereferenced * anymore. * - * \param mem a pointer previously returned by SDL_aligned_alloc. + * If `mem` is NULL, this function does nothing. + * + * \param mem a pointer previously returned by SDL_aligned_alloc(), or NULL. * * \threadsafety It is safe to call this function from any thread. * @@ -667,9 +964,232 @@ extern SDL_DECLSPEC void SDLCALL SDL_aligned_free(void *mem); */ extern SDL_DECLSPEC int SDLCALL SDL_GetNumAllocations(void); +/** + * A thread-safe set of environment variables + * + * \since This struct is available since SDL 3.0.0. + * + * \sa SDL_GetEnvironment + * \sa SDL_CreateEnvironment + * \sa SDL_GetEnvironmentVariable + * \sa SDL_GetEnvironmentVariables + * \sa SDL_SetEnvironmentVariable + * \sa SDL_UnsetEnvironmentVariable + * \sa SDL_DestroyEnvironment + */ +typedef struct SDL_Environment SDL_Environment; + +/** + * Get the process environment. + * + * This is initialized at application start and is not affected by setenv() + * and unsetenv() calls after that point. Use SDL_SetEnvironmentVariable() and + * SDL_UnsetEnvironmentVariable() if you want to modify this environment, or + * SDL_setenv_unsafe() or SDL_unsetenv_unsafe() if you want changes to persist + * in the C runtime environment after SDL_Quit(). + * + * \returns a pointer to the environment for the process or NULL on failure; + * call SDL_GetError() for more information. + * + * \threadsafety It is safe to call this function from any thread. + * + * \since This function is available since SDL 3.0.0. + * + * \sa SDL_GetEnvironmentVariable + * \sa SDL_GetEnvironmentVariables + * \sa SDL_SetEnvironmentVariable + * \sa SDL_UnsetEnvironmentVariable + */ +extern SDL_DECLSPEC SDL_Environment * SDLCALL SDL_GetEnvironment(void); + +/** + * Create a set of environment variables + * + * \param populated true to initialize it from the C runtime environment, + * false to create an empty environment. + * \returns a pointer to the new environment or NULL on failure; call + * SDL_GetError() for more information. + * + * \threadsafety If `populated` is false, it is safe to call this function + * from any thread, otherwise it is safe if no other threads are + * calling setenv() or unsetenv() + * + * \since This function is available since SDL 3.0.0. + * + * \sa SDL_GetEnvironmentVariable + * \sa SDL_GetEnvironmentVariables + * \sa SDL_SetEnvironmentVariable + * \sa SDL_UnsetEnvironmentVariable + * \sa SDL_DestroyEnvironment + */ +extern SDL_DECLSPEC SDL_Environment * SDLCALL SDL_CreateEnvironment(bool populated); + +/** + * Get the value of a variable in the environment. + * + * \param env the environment to query. + * \param name the name of the variable to get. + * \returns a pointer to the value of the variable or NULL if it can't be + * found. + * + * \threadsafety It is safe to call this function from any thread. + * + * \since This function is available since SDL 3.0.0. + * + * \sa SDL_GetEnvironment + * \sa SDL_CreateEnvironment + * \sa SDL_GetEnvironmentVariables + * \sa SDL_SetEnvironmentVariable + * \sa SDL_UnsetEnvironmentVariable + */ +extern SDL_DECLSPEC const char * SDLCALL SDL_GetEnvironmentVariable(SDL_Environment *env, const char *name); + +/** + * Get all variables in the environment. + * + * \param env the environment to query. + * \returns a NULL terminated array of pointers to environment variables in + * the form "variable=value" or NULL on failure; call SDL_GetError() + * for more information. This is a single allocation that should be + * freed with SDL_free() when it is no longer needed. + * + * \threadsafety It is safe to call this function from any thread. + * + * \since This function is available since SDL 3.0.0. + * + * \sa SDL_GetEnvironment + * \sa SDL_CreateEnvironment + * \sa SDL_GetEnvironmentVariables + * \sa SDL_SetEnvironmentVariable + * \sa SDL_UnsetEnvironmentVariable + */ +extern SDL_DECLSPEC char ** SDLCALL SDL_GetEnvironmentVariables(SDL_Environment *env); + +/** + * Set the value of a variable in the environment. + * + * \param env the environment to modify. + * \param name the name of the variable to set. + * \param value the value of the variable to set. + * \param overwrite true to overwrite the variable if it exists, false to + * return success without setting the variable if it already + * exists. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. + * + * \threadsafety It is safe to call this function from any thread. + * + * \since This function is available since SDL 3.0.0. + * + * \sa SDL_GetEnvironment + * \sa SDL_CreateEnvironment + * \sa SDL_GetEnvironmentVariable + * \sa SDL_GetEnvironmentVariables + * \sa SDL_UnsetEnvironmentVariable + */ +extern SDL_DECLSPEC bool SDLCALL SDL_SetEnvironmentVariable(SDL_Environment *env, const char *name, const char *value, bool overwrite); + +/** + * Clear a variable from the environment. + * + * \param env the environment to modify. + * \param name the name of the variable to unset. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. + * + * \threadsafety It is safe to call this function from any thread. + * + * \since This function is available since SDL 3.0.0. + * + * \sa SDL_GetEnvironment + * \sa SDL_CreateEnvironment + * \sa SDL_GetEnvironmentVariable + * \sa SDL_GetEnvironmentVariables + * \sa SDL_SetEnvironmentVariable + * \sa SDL_UnsetEnvironmentVariable + */ +extern SDL_DECLSPEC bool SDLCALL SDL_UnsetEnvironmentVariable(SDL_Environment *env, const char *name); + +/** + * Destroy a set of environment variables. + * + * \param env the environment to destroy. + * + * \threadsafety It is safe to call this function from any thread, as long as + * the environment is no longer in use. + * + * \since This function is available since SDL 3.0.0. + * + * \sa SDL_CreateEnvironment + */ +extern SDL_DECLSPEC void SDLCALL SDL_DestroyEnvironment(SDL_Environment *env); + +/** + * Get the value of a variable in the environment. + * + * This function uses SDL's cached copy of the environment and is thread-safe. + * + * \param name the name of the variable to get. + * \returns a pointer to the value of the variable or NULL if it can't be + * found. + * + * \threadsafety It is safe to call this function from any thread. + * + * \since This function is available since SDL 3.0.0. + */ extern SDL_DECLSPEC const char * SDLCALL SDL_getenv(const char *name); -extern SDL_DECLSPEC int SDLCALL SDL_setenv(const char *name, const char *value, int overwrite); -extern SDL_DECLSPEC int SDLCALL SDL_unsetenv(const char *name); + +/** + * Get the value of a variable in the environment. + * + * This function bypasses SDL's cached copy of the environment and is not + * thread-safe. + * + * \param name the name of the variable to get. + * \returns a pointer to the value of the variable or NULL if it can't be + * found. + * + * \threadsafety This function is not thread safe, consider using SDL_getenv() + * instead. + * + * \since This function is available since SDL 3.0.0. + * + * \sa SDL_getenv + */ +extern SDL_DECLSPEC const char * SDLCALL SDL_getenv_unsafe(const char *name); + +/** + * Set the value of a variable in the environment. + * + * \param name the name of the variable to set. + * \param value the value of the variable to set. + * \param overwrite 1 to overwrite the variable if it exists, 0 to return + * success without setting the variable if it already exists. + * \returns 0 on success, -1 on error. + * + * \threadsafety This function is not thread safe, consider using + * SDL_SetEnvironmentVariable() instead. + * + * \since This function is available since SDL 3.0.0. + * + * \sa SDL_SetEnvironmentVariable + */ +extern SDL_DECLSPEC int SDLCALL SDL_setenv_unsafe(const char *name, const char *value, int overwrite); + +/** + * Clear a variable from the environment. + * + * \param name the name of the variable to unset. + * \returns 0 on success, -1 on error. + * + * \threadsafety This function is not thread safe, consider using + * SDL_UnsetEnvironmentVariable() instead. + * + * \since This function is available since SDL 3.0.0. + * + * \sa SDL_UnsetEnvironmentVariable + */ +extern SDL_DECLSPEC int SDLCALL SDL_unsetenv_unsafe(const char *name); typedef int (SDLCALL *SDL_CompareCallback)(const void *a, const void *b); extern SDL_DECLSPEC void SDLCALL SDL_qsort(void *base, size_t nmemb, size_t size, SDL_CompareCallback compare); @@ -925,6 +1445,24 @@ extern SDL_DECLSPEC int SDLCALL SDL_tolower(int x); extern SDL_DECLSPEC Uint16 SDLCALL SDL_crc16(Uint16 crc, const void *data, size_t len); extern SDL_DECLSPEC Uint32 SDLCALL SDL_crc32(Uint32 crc, const void *data, size_t len); +/** + * Copy non-overlapping memory. + * + * The memory regions must not overlap. If they do, use SDL_memmove() instead. + * + * \param dst The destination memory region. Must not be NULL, and must not + * overlap with `src`. + * \param src The source memory region. Must not be NULL, and must not overlap + * with `dst`. + * \param len The length in bytes of both `dst` and `src`. + * \returns `dst`. + * + * \threadsafety It is safe to call this function from any thread. + * + * \since This function is available since SDL 3.0.0. + * + * \sa SDL_memmove + */ extern SDL_DECLSPEC void * SDLCALL SDL_memcpy(SDL_OUT_BYTECAP(len) void *dst, SDL_IN_BYTECAP(len) const void *src, size_t len); /* Take advantage of compiler optimizations for memcpy */ @@ -939,6 +1477,23 @@ extern SDL_DECLSPEC void * SDLCALL SDL_memcpy(SDL_OUT_BYTECAP(len) void *dst, SD { SDL_COMPILE_TIME_ASSERT(SDL_copyp, sizeof (*(dst)) == sizeof (*(src))); } \ SDL_memcpy((dst), (src), sizeof(*(src))) +/** + * Copy memory. + * + * It is okay for the memory regions to overlap. If you are confident that the + * regions never overlap, using SDL_memcpy() may improve performance. + * + * \param dst The destination memory region. Must not be NULL. + * \param src The source memory region. Must not be NULL. + * \param len The length in bytes of both `dst` and `src`. + * \returns `dst`. + * + * \threadsafety It is safe to call this function from any thread. + * + * \since This function is available since SDL 3.0.0. + * + * \sa SDL_memcpy + */ extern SDL_DECLSPEC void * SDLCALL SDL_memmove(SDL_OUT_BYTECAP(len) void *dst, SDL_IN_BYTECAP(len) const void *src, size_t len); /* Take advantage of compiler optimizations for memmove */ @@ -968,8 +1523,63 @@ extern SDL_DECLSPEC int SDLCALL SDL_memcmp(const void *s1, const void *s2, size_ extern SDL_DECLSPEC size_t SDLCALL SDL_wcslen(const wchar_t *wstr); extern SDL_DECLSPEC size_t SDLCALL SDL_wcsnlen(const wchar_t *wstr, size_t maxlen); + +/** + * Copy a wide string. + * + * This function copies `maxlen` - 1 wide characters from `src` to `dst`, then + * appends a null terminator. + * + * `src` and `dst` must not overlap. + * + * If `maxlen` is 0, no wide characters are copied and no null terminator is + * written. + * + * \param dst The destination buffer. Must not be NULL, and must not overlap + * with `src`. + * \param src The null-terminated wide string to copy. Must not be NULL, and + * must not overlap with `dst`. + * \param maxlen The length (in wide characters) of the destination buffer. + * \returns The length (in wide characters, excluding the null terminator) of + * `src`. + * + * \threadsafety It is safe to call this function from any thread. + * + * \since This function is available since SDL 3.0.0. + * + * \sa SDL_wcslcat + */ extern SDL_DECLSPEC size_t SDLCALL SDL_wcslcpy(SDL_OUT_Z_CAP(maxlen) wchar_t *dst, const wchar_t *src, size_t maxlen); + +/** + * Concatenate wide strings. + * + * This function appends up to `maxlen` - SDL_wcslen(dst) - 1 wide characters + * from `src` to the end of the wide string in `dst`, then appends a null + * terminator. + * + * `src` and `dst` must not overlap. + * + * If `maxlen` - SDL_wcslen(dst) - 1 is less than or equal to 0, then `dst` is + * unmodified. + * + * \param dst The destination buffer already containing the first + * null-terminated wide string. Must not be NULL and must not + * overlap with `src`. + * \param src The second null-terminated wide string. Must not be NULL, and + * must not overlap with `dst`. + * \param maxlen The length (in wide characters) of the destination buffer. + * \returns The length (in wide characters, excluding the null terminator) of + * the string in `dst` plus the length of `src`. + * + * \threadsafety It is safe to call this function from any thread. + * + * \since This function is available since SDL 3.0.0. + * + * \sa SDL_wcslcpy + */ extern SDL_DECLSPEC size_t SDLCALL SDL_wcslcat(SDL_INOUT_Z_CAP(maxlen) wchar_t *dst, const wchar_t *src, size_t maxlen); + extern SDL_DECLSPEC wchar_t * SDLCALL SDL_wcsdup(const wchar_t *wstr); extern SDL_DECLSPEC wchar_t * SDLCALL SDL_wcsstr(const wchar_t *haystack, const wchar_t *needle); extern SDL_DECLSPEC wchar_t * SDLCALL SDL_wcsnstr(const wchar_t *haystack, const wchar_t *needle, size_t maxlen); @@ -1096,13 +1706,121 @@ extern SDL_DECLSPEC int SDLCALL SDL_wcscasecmp(const wchar_t *str1, const wchar_ */ extern SDL_DECLSPEC int SDLCALL SDL_wcsncasecmp(const wchar_t *str1, const wchar_t *str2, size_t maxlen); +/** + * Parse a `long` from a wide string. + * + * If `str` starts with whitespace, then those whitespace characters are + * skipped before attempting to parse the number. + * + * If the parsed number does not fit inside a `long`, the result is clamped to + * the minimum and maximum representable `long` values. + * + * \param str The null-terminated wide string to read. Must not be NULL. + * \param endp If not NULL, the address of the first invalid wide character + * (i.e. the next character after the parsed number) will be + * written to this pointer. + * \param base The base of the integer to read. Supported values are 0 and 2 + * to 36 inclusive. If 0, the base will be inferred from the + * number's prefix (0x for hexadecimal, 0 for octal, decimal + * otherwise). + * \returns The parsed `long`, or 0 if no number could be parsed. + * + * \threadsafety It is safe to call this function from any thread. + * + * \since This function is available since SDL 3.0.0. + * + * \sa SDL_strtol + */ extern SDL_DECLSPEC long SDLCALL SDL_wcstol(const wchar_t *str, wchar_t **endp, int base); extern SDL_DECLSPEC size_t SDLCALL SDL_strlen(const char *str); extern SDL_DECLSPEC size_t SDLCALL SDL_strnlen(const char *str, size_t maxlen); + +/** + * Copy a string. + * + * This function copies up to `maxlen` - 1 characters from `src` to `dst`, + * then appends a null terminator. + * + * If `maxlen` is 0, no characters are copied and no null terminator is + * written. + * + * If you want to copy an UTF-8 string but need to ensure that multi-byte + * sequences are not truncated, consider using SDL_utf8strlcpy(). + * + * \param dst The destination buffer. Must not be NULL, and must not overlap + * with `src`. + * \param src The null-terminated string to copy. Must not be NULL, and must + * not overlap with `dst`. + * \param maxlen The length (in characters) of the destination buffer. + * \returns The length (in characters, excluding the null terminator) of + * `src`. + * + * \threadsafety It is safe to call this function from any thread. + * + * \since This function is available since SDL 3.0.0. + * + * \sa SDL_strlcat + * \sa SDL_utf8strlcpy + */ extern SDL_DECLSPEC size_t SDLCALL SDL_strlcpy(SDL_OUT_Z_CAP(maxlen) char *dst, const char *src, size_t maxlen); + +/** + * Copy an UTF-8 string. + * + * This function copies up to `dst_bytes` - 1 bytes from `src` to `dst` while + * also ensuring that the string written to `dst` does not end in a truncated + * multi-byte sequence. Finally, it appends a null terminator. + * + * `src` and `dst` must not overlap. + * + * Note that unlike SDL_strlcpy(), this function returns the number of bytes + * written, not the length of `src`. + * + * \param dst The destination buffer. Must not be NULL, and must not overlap + * with `src`. + * \param src The null-terminated UTF-8 string to copy. Must not be NULL, and + * must not overlap with `dst`. + * \param dst_bytes The length (in bytes) of the destination buffer. Must not + * be 0. + * \returns The number of bytes written, excluding the null terminator. + * + * \threadsafety It is safe to call this function from any thread. + * + * \since This function is available since SDL 3.0.0. + * + * \sa SDL_strlcpy + */ extern SDL_DECLSPEC size_t SDLCALL SDL_utf8strlcpy(SDL_OUT_Z_CAP(dst_bytes) char *dst, const char *src, size_t dst_bytes); + +/** + * Concatenate strings. + * + * This function appends up to `maxlen` - SDL_strlen(dst) - 1 characters from + * `src` to the end of the string in `dst`, then appends a null terminator. + * + * `src` and `dst` must not overlap. + * + * If `maxlen` - SDL_strlen(dst) - 1 is less than or equal to 0, then `dst` is + * unmodified. + * + * \param dst The destination buffer already containing the first + * null-terminated string. Must not be NULL and must not overlap + * with `src`. + * \param src The second null-terminated string. Must not be NULL, and must + * not overlap with `dst`. + * \param maxlen The length (in characters) of the destination buffer. + * \returns The length (in characters, excluding the null terminator) of the + * string in `dst` plus the length of `src`. + * + * \threadsafety It is safe to call this function from any thread. + * + * \since This function is available since SDL 3.0.0. + * + * \sa SDL_strlcpy + */ extern SDL_DECLSPEC size_t SDLCALL SDL_strlcat(SDL_INOUT_Z_CAP(maxlen) char *dst, const char *src, size_t maxlen); + extern SDL_DECLSPEC SDL_MALLOC char * SDLCALL SDL_strdup(const char *str); extern SDL_DECLSPEC SDL_MALLOC char * SDLCALL SDL_strndup(const char *str, size_t maxlen); extern SDL_DECLSPEC char * SDLCALL SDL_strrev(char *str); @@ -1162,15 +1880,215 @@ extern SDL_DECLSPEC char * SDLCALL SDL_itoa(int value, char *str, int radix); extern SDL_DECLSPEC char * SDLCALL SDL_uitoa(unsigned int value, char *str, int radix); extern SDL_DECLSPEC char * SDLCALL SDL_ltoa(long value, char *str, int radix); extern SDL_DECLSPEC char * SDLCALL SDL_ultoa(unsigned long value, char *str, int radix); -extern SDL_DECLSPEC char * SDLCALL SDL_lltoa(Sint64 value, char *str, int radix); -extern SDL_DECLSPEC char * SDLCALL SDL_ulltoa(Uint64 value, char *str, int radix); +extern SDL_DECLSPEC char * SDLCALL SDL_lltoa(long long value, char *str, int radix); +extern SDL_DECLSPEC char * SDLCALL SDL_ulltoa(unsigned long long value, char *str, int radix); +/** + * Parse an `int` from a string. + * + * The result of calling `SDL_atoi(str)` is equivalent to + * `(int)SDL_strtol(str, NULL, 10)`. + * + * \param str The null-terminated string to read. Must not be NULL. + * \returns The parsed `int`. + * + * \threadsafety It is safe to call this function from any thread. + * + * \since This function is available since SDL 3.0.0. + * + * \sa SDL_atof + * \sa SDL_strtol + * \sa SDL_strtoul + * \sa SDL_strtoll + * \sa SDL_strtoull + * \sa SDL_strtod + * \sa SDL_itoa + */ extern SDL_DECLSPEC int SDLCALL SDL_atoi(const char *str); + +/** + * Parse a `double` from a string. + * + * The result of calling `SDL_atof(str)` is equivalent to `SDL_strtod(str, + * NULL)`. + * + * \param str The null-terminated string to read. Must not be NULL. + * \returns The parsed `double`. + * + * \threadsafety It is safe to call this function from any thread. + * + * \since This function is available since SDL 3.0.0. + * + * \sa SDL_atoi + * \sa SDL_strtol + * \sa SDL_strtoul + * \sa SDL_strtoll + * \sa SDL_strtoull + * \sa SDL_strtod + */ extern SDL_DECLSPEC double SDLCALL SDL_atof(const char *str); + +/** + * Parse a `long` from a string. + * + * If `str` starts with whitespace, then those whitespace characters are + * skipped before attempting to parse the number. + * + * If the parsed number does not fit inside a `long`, the result is clamped to + * the minimum and maximum representable `long` values. + * + * \param str The null-terminated string to read. Must not be NULL. + * \param endp If not NULL, the address of the first invalid character (i.e. + * the next character after the parsed number) will be written to + * this pointer. + * \param base The base of the integer to read. Supported values are 0 and 2 + * to 36 inclusive. If 0, the base will be inferred from the + * number's prefix (0x for hexadecimal, 0 for octal, decimal + * otherwise). + * \returns The parsed `long`, or 0 if no number could be parsed. + * + * \threadsafety It is safe to call this function from any thread. + * + * \since This function is available since SDL 3.0.0. + * + * \sa SDL_atoi + * \sa SDL_atof + * \sa SDL_strtoul + * \sa SDL_strtoll + * \sa SDL_strtoull + * \sa SDL_strtod + * \sa SDL_ltoa + * \sa SDL_wcstol + */ extern SDL_DECLSPEC long SDLCALL SDL_strtol(const char *str, char **endp, int base); + +/** + * Parse an `unsigned long` from a string. + * + * If `str` starts with whitespace, then those whitespace characters are + * skipped before attempting to parse the number. + * + * If the parsed number does not fit inside an `unsigned long`, the result is + * clamped to the maximum representable `unsigned long` value. + * + * \param str The null-terminated string to read. Must not be NULL. + * \param endp If not NULL, the address of the first invalid character (i.e. + * the next character after the parsed number) will be written to + * this pointer. + * \param base The base of the integer to read. Supported values are 0 and 2 + * to 36 inclusive. If 0, the base will be inferred from the + * number's prefix (0x for hexadecimal, 0 for octal, decimal + * otherwise). + * \returns The parsed `unsigned long`, or 0 if no number could be parsed. + * + * \threadsafety It is safe to call this function from any thread. + * + * \since This function is available since SDL 3.0.0. + * + * \sa SDL_atoi + * \sa SDL_atof + * \sa SDL_strtol + * \sa SDL_strtoll + * \sa SDL_strtoull + * \sa SDL_strtod + * \sa SDL_ultoa + */ extern SDL_DECLSPEC unsigned long SDLCALL SDL_strtoul(const char *str, char **endp, int base); -extern SDL_DECLSPEC Sint64 SDLCALL SDL_strtoll(const char *str, char **endp, int base); -extern SDL_DECLSPEC Uint64 SDLCALL SDL_strtoull(const char *str, char **endp, int base); + +/** + * Parse a `long long` from a string. + * + * If `str` starts with whitespace, then those whitespace characters are + * skipped before attempting to parse the number. + * + * If the parsed number does not fit inside a `long long`, the result is + * clamped to the minimum and maximum representable `long long` values. + * + * \param str The null-terminated string to read. Must not be NULL. + * \param endp If not NULL, the address of the first invalid character (i.e. + * the next character after the parsed number) will be written to + * this pointer. + * \param base The base of the integer to read. Supported values are 0 and 2 + * to 36 inclusive. If 0, the base will be inferred from the + * number's prefix (0x for hexadecimal, 0 for octal, decimal + * otherwise). + * \returns The parsed `long long`, or 0 if no number could be parsed. + * + * \threadsafety It is safe to call this function from any thread. + * + * \since This function is available since SDL 3.0.0. + * + * \sa SDL_atoi + * \sa SDL_atof + * \sa SDL_strtol + * \sa SDL_strtoul + * \sa SDL_strtoull + * \sa SDL_strtod + * \sa SDL_lltoa + */ +extern SDL_DECLSPEC long long SDLCALL SDL_strtoll(const char *str, char **endp, int base); + +/** + * Parse an `unsigned long long` from a string. + * + * If `str` starts with whitespace, then those whitespace characters are + * skipped before attempting to parse the number. + * + * If the parsed number does not fit inside an `unsigned long long`, the + * result is clamped to the maximum representable `unsigned long long` value. + * + * \param str The null-terminated string to read. Must not be NULL. + * \param endp If not NULL, the address of the first invalid character (i.e. + * the next character after the parsed number) will be written to + * this pointer. + * \param base The base of the integer to read. Supported values are 0 and 2 + * to 36 inclusive. If 0, the base will be inferred from the + * number's prefix (0x for hexadecimal, 0 for octal, decimal + * otherwise). + * \returns The parsed `unsigned long long`, or 0 if no number could be + * parsed. + * + * \threadsafety It is safe to call this function from any thread. + * + * \since This function is available since SDL 3.0.0. + * + * \sa SDL_atoi + * \sa SDL_atof + * \sa SDL_strtol + * \sa SDL_strtoll + * \sa SDL_strtoul + * \sa SDL_strtod + * \sa SDL_ulltoa + */ +extern SDL_DECLSPEC unsigned long long SDLCALL SDL_strtoull(const char *str, char **endp, int base); + +/** + * Parse a `double` from a string. + * + * This function makes fewer guarantees than the C runtime `strtod`: + * + * - Only decimal notation is guaranteed to be supported. The handling of + * scientific and hexadecimal notation is unspecified. + * - Whether or not INF and NAN can be parsed is unspecified. + * - The precision of the result is unspecified. + * + * \param str The null-terminated string to read. Must not be NULL. + * \param endp If not NULL, the address of the first invalid character (i.e. + * the next character after the parsed number) will be written to + * this pointer. + * \returns The parsed `double`, or 0 if no number could be parsed. + * + * \threadsafety It is safe to call this function from any thread. + * + * \since This function is available since SDL 3.0.0. + * + * \sa SDL_atoi + * \sa SDL_atof + * \sa SDL_strtol + * \sa SDL_strtoll + * \sa SDL_strtoul + * \sa SDL_strtoull + */ extern SDL_DECLSPEC double SDLCALL SDL_strtod(const char *str, char **endp); /** @@ -1291,6 +2209,24 @@ extern SDL_DECLSPEC int SDLCALL SDL_strcasecmp(const char *str1, const char *str */ extern SDL_DECLSPEC int SDLCALL SDL_strncasecmp(const char *str1, const char *str2, size_t maxlen); +/** + * Searches a string for the first occurence of any character contained in a + * breakset, and returns a pointer from the string to that character. + * + * \param str The null-terminated string to be searched. Must not be NULL, and + * must not overlap with `breakset`. + * \param breakset A null-terminated string containing the list of characters + * to look for. Must not be NULL, and must not overlap with + * `str`. + * \returns A pointer to the location, in str, of the first occurence of a + * character present in the breakset, or NULL if none is found. + * + * \threadsafety It is safe to call this function from any thread. + * + * \since This function is available since SDL 3.0.0. + */ +extern SDL_DECLSPEC char * SDLCALL SDL_strpbrk(const char *str, const char *breakset); + /** * The Unicode REPLACEMENT CHARACTER codepoint. * @@ -1382,10 +2318,10 @@ extern SDL_DECLSPEC char * SDLCALL SDL_UCS4ToUTF8(Uint32 codepoint, char *dst); extern SDL_DECLSPEC int SDLCALL SDL_sscanf(const char *text, SDL_SCANF_FORMAT_STRING const char *fmt, ...) SDL_SCANF_VARARG_FUNC(2); extern SDL_DECLSPEC int SDLCALL SDL_vsscanf(const char *text, SDL_SCANF_FORMAT_STRING const char *fmt, va_list ap) SDL_SCANF_VARARG_FUNCV(2); -extern SDL_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 SDL_DECLSPEC int SDLCALL SDL_swprintf(SDL_OUT_Z_CAP(maxlen) wchar_t *text, size_t maxlen, SDL_PRINTF_FORMAT_STRING const wchar_t *fmt, ... ) SDL_WPRINTF_VARARG_FUNC(3); +extern SDL_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 SDL_DECLSPEC int SDLCALL SDL_swprintf(SDL_OUT_Z_CAP(maxlen) wchar_t *text, size_t maxlen, SDL_PRINTF_FORMAT_STRING const wchar_t *fmt, ...) SDL_WPRINTF_VARARG_FUNC(3); extern SDL_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 SDL_DECLSPEC int SDLCALL SDL_vswprintf(SDL_OUT_Z_CAP(maxlen) wchar_t *text, size_t maxlen, const wchar_t *fmt, va_list ap); +extern SDL_DECLSPEC int SDLCALL SDL_vswprintf(SDL_OUT_Z_CAP(maxlen) wchar_t *text, size_t maxlen, SDL_PRINTF_FORMAT_STRING const wchar_t *fmt, va_list ap) SDL_WPRINTF_VARARG_FUNCV(3); extern SDL_DECLSPEC int SDLCALL SDL_asprintf(char **strp, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2); extern SDL_DECLSPEC int SDLCALL SDL_vasprintf(char **strp, SDL_PRINTF_FORMAT_STRING const char *fmt, va_list ap) SDL_PRINTF_VARARG_FUNCV(2); @@ -3073,6 +4009,7 @@ size_t wcslcat(wchar_t *dst, const wchar_t *src, size_t size); #define SDL_wcsncmp wcsncmp #define SDL_strcasecmp strcasecmp #define SDL_strncasecmp strncasecmp +#define SDL_strpbrk strpbrk #define SDL_sscanf sscanf #define SDL_vsscanf vsscanf #define SDL_snprintf snprintf @@ -3082,28 +4019,27 @@ size_t wcslcat(wchar_t *dst, const wchar_t *src, size_t size); /** * Multiply two integers, checking for overflow. * - * If `a * b` would overflow, return SDL_FALSE. + * If `a * b` would overflow, return false. * - * Otherwise store `a * b` via ret and return SDL_TRUE. + * Otherwise store `a * b` via ret and return true. * * \param a the multiplicand. * \param b the multiplier. * \param ret on non-overflow output, stores the multiplication result. May * not be NULL. - * \returns SDL_FALSE on overflow, SDL_TRUE if result is multiplied without - * overflow. + * \returns false on overflow, true if result is multiplied without overflow. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.0.0. */ -SDL_FORCE_INLINE SDL_bool SDL_size_mul_check_overflow(size_t a, size_t b, size_t *ret) +SDL_FORCE_INLINE bool SDL_size_mul_check_overflow(size_t a, size_t b, size_t *ret) { if (a != 0 && b > SDL_SIZE_MAX / a) { - return SDL_FALSE; + return false; } *ret = a * b; - return SDL_TRUE; + return true; } #ifndef SDL_WIKI_DOCUMENTATION_SECTION @@ -3111,7 +4047,7 @@ SDL_FORCE_INLINE SDL_bool SDL_size_mul_check_overflow(size_t a, size_t b, size_t /* This needs to be wrapped in an inline rather than being a direct #define, * because __builtin_mul_overflow() is type-generic, but we want to be * consistent about interpreting a and b as size_t. */ -SDL_FORCE_INLINE SDL_bool SDL_size_mul_check_overflow_builtin(size_t a, size_t b, size_t *ret) +SDL_FORCE_INLINE bool SDL_size_mul_check_overflow_builtin(size_t a, size_t b, size_t *ret) { return (__builtin_mul_overflow(a, b, ret) == 0); } @@ -3130,27 +4066,26 @@ SDL_FORCE_INLINE SDL_bool SDL_size_mul_check_overflow_builtin(size_t a, size_t b * \param b the second addend. * \param ret on non-overflow output, stores the addition result. May not be * NULL. - * \returns SDL_FALSE on overflow, SDL_TRUE if result is added without - * overflow. + * \returns false on overflow, true if result is added without overflow. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.0.0. */ -SDL_FORCE_INLINE SDL_bool SDL_size_add_check_overflow(size_t a, size_t b, size_t *ret) +SDL_FORCE_INLINE bool SDL_size_add_check_overflow(size_t a, size_t b, size_t *ret) { if (b > SDL_SIZE_MAX - a) { - return SDL_FALSE; + return false; } *ret = a + b; - return SDL_TRUE; + return true; } #ifndef SDL_WIKI_DOCUMENTATION_SECTION #if SDL_HAS_BUILTIN(__builtin_add_overflow) /* This needs to be wrapped in an inline rather than being a direct #define, * the same as the call to __builtin_mul_overflow() above. */ -SDL_FORCE_INLINE SDL_bool SDL_size_add_check_overflow_builtin(size_t a, size_t b, size_t *ret) +SDL_FORCE_INLINE bool SDL_size_add_check_overflow_builtin(size_t a, size_t b, size_t *ret) { return (__builtin_add_overflow(a, b, ret) == 0); } @@ -3159,7 +4094,25 @@ SDL_FORCE_INLINE SDL_bool SDL_size_add_check_overflow_builtin(size_t a, size_t b #endif /* This is a generic function pointer which should be cast to the type you expect */ -#ifdef SDL_FUNCTION_POINTER_IS_VOID_POINTER +#ifdef SDL_WIKI_DOCUMENTATION_SECTION + +/** + * A generic function pointer. + * + * In theory, generic function pointers should use this, instead of `void *`, + * since some platforms could treat code addresses differently than data + * addresses. Although in current times no popular platforms make this + * distinction, it is more correct and portable to use the correct type for a + * generic pointer. + * + * If for some reason you need to force this typedef to be an actual `void *`, + * perhaps to work around a compiler or existing code, you can define + * `SDL_FUNCTION_POINTER_IS_VOID_POINTER` before including any SDL headers. + * + * \since This datatype is available since SDL 3.0.0. + */ +typedef void (*SDL_FunctionPointer)(void); +#elif defined(SDL_FUNCTION_POINTER_IS_VOID_POINTER) typedef void *SDL_FunctionPointer; #else typedef void (*SDL_FunctionPointer)(void); diff --git a/include/SDL3/SDL_storage.h b/include/SDL3/SDL_storage.h index 91a90bc4..243046d0 100644 --- a/include/SDL3/SDL_storage.h +++ b/include/SDL3/SDL_storage.h @@ -52,44 +52,61 @@ extern "C" { * It is not usually necessary to do this; SDL provides standard * implementations for many things you might expect to do with an SDL_Storage. * + * This structure should be initialized using SDL_INIT_INTERFACE() + * * \since This struct is available since SDL 3.0.0. + * + * \sa SDL_INIT_INTERFACE */ typedef struct SDL_StorageInterface { + /* The version of this interface */ + Uint32 version; + /* Called when the storage is closed */ - SDL_bool (SDLCALL *close)(void *userdata); + bool (SDLCALL *close)(void *userdata); /* Optional, returns whether the storage is currently ready for access */ - SDL_bool (SDLCALL *ready)(void *userdata); + bool (SDLCALL *ready)(void *userdata); /* Enumerate a directory, optional for write-only storage */ - SDL_bool (SDLCALL *enumerate)(void *userdata, const char *path, SDL_EnumerateDirectoryCallback callback, void *callback_userdata); + bool (SDLCALL *enumerate)(void *userdata, const char *path, SDL_EnumerateDirectoryCallback callback, void *callback_userdata); /* Get path information, optional for write-only storage */ - SDL_bool (SDLCALL *info)(void *userdata, const char *path, SDL_PathInfo *info); + bool (SDLCALL *info)(void *userdata, const char *path, SDL_PathInfo *info); /* Read a file from storage, optional for write-only storage */ - SDL_bool (SDLCALL *read_file)(void *userdata, const char *path, void *destination, Uint64 length); + bool (SDLCALL *read_file)(void *userdata, const char *path, void *destination, Uint64 length); /* Write a file to storage, optional for read-only storage */ - SDL_bool (SDLCALL *write_file)(void *userdata, const char *path, const void *source, Uint64 length); + bool (SDLCALL *write_file)(void *userdata, const char *path, const void *source, Uint64 length); /* Create a directory, optional for read-only storage */ - SDL_bool (SDLCALL *mkdir)(void *userdata, const char *path); + bool (SDLCALL *mkdir)(void *userdata, const char *path); /* Remove a file or empty directory, optional for read-only storage */ - SDL_bool (SDLCALL *remove)(void *userdata, const char *path); + bool (SDLCALL *remove)(void *userdata, const char *path); /* Rename a path, optional for read-only storage */ - SDL_bool (SDLCALL *rename)(void *userdata, const char *oldpath, const char *newpath); + bool (SDLCALL *rename)(void *userdata, const char *oldpath, const char *newpath); /* Copy a file, optional for read-only storage */ - SDL_bool (SDLCALL *copy)(void *userdata, const char *oldpath, const char *newpath); + bool (SDLCALL *copy)(void *userdata, const char *oldpath, const char *newpath); /* Get the space remaining, optional for read-only storage */ Uint64 (SDLCALL *space_remaining)(void *userdata); } SDL_StorageInterface; +/* Check the size of SDL_StorageInterface + * + * If this assert fails, either the compiler is padding to an unexpected size, + * or the interface has been updated and this should be updated to match and + * the code using this interface should be updated to handle the old version. + */ +SDL_COMPILE_TIME_ASSERT(SDL_StorageInterface_SIZE, + (sizeof(void *) == 4 && sizeof(SDL_StorageInterface) == 48) || + (sizeof(void *) == 8 && sizeof(SDL_StorageInterface) == 96)); + /** * An abstract interface for filesystem access. * @@ -176,8 +193,12 @@ extern SDL_DECLSPEC SDL_Storage * SDLCALL SDL_OpenFileStorage(const char *path); * should use the built-in implementations in SDL, like SDL_OpenTitleStorage() * or SDL_OpenUserStorage(). * - * \param iface the function table to be used by this container. - * \param userdata the pointer that will be passed to the store interface. + * This function makes a copy of `iface` and the caller does not need to keep + * it around after this call. + * + * \param iface the interface that implements this storage, initialized using + * SDL_INIT_INTERFACE(). + * \param userdata the pointer that will be passed to the interface functions. * \returns a storage container on success or NULL on failure; call * SDL_GetError() for more information. * @@ -186,6 +207,7 @@ extern SDL_DECLSPEC SDL_Storage * SDLCALL SDL_OpenFileStorage(const char *path); * \sa SDL_CloseStorage * \sa SDL_GetStorageFileSize * \sa SDL_GetStorageSpaceRemaining + * \sa SDL_INIT_INTERFACE * \sa SDL_ReadStorageFile * \sa SDL_StorageReady * \sa SDL_WriteStorageFile @@ -196,10 +218,10 @@ extern SDL_DECLSPEC SDL_Storage * SDLCALL SDL_OpenStorage(const SDL_StorageInter * Closes and frees a storage container. * * \param storage a storage container to close. - * \returns SDL_TRUE if the container was freed with no errors, SDL_FALSE - * otherwise; call SDL_GetError() for more information. Even if the - * function returns an error, the container data will be freed; the - * error is only for informational purposes. + * \returns true if the container was freed with no errors, false otherwise; + * call SDL_GetError() for more information. Even if the function + * returns an error, the container data will be freed; the error is + * only for informational purposes. * * \since This function is available since SDL 3.0.0. * @@ -208,21 +230,21 @@ extern SDL_DECLSPEC SDL_Storage * SDLCALL SDL_OpenStorage(const SDL_StorageInter * \sa SDL_OpenTitleStorage * \sa SDL_OpenUserStorage */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_CloseStorage(SDL_Storage *storage); +extern SDL_DECLSPEC bool SDLCALL SDL_CloseStorage(SDL_Storage *storage); /** * Checks if the storage container is ready to use. * - * This function should be called in regular intervals until it returns - * SDL_TRUE - however, it is not recommended to spinwait on this call, as the - * backend may depend on a synchronous message loop. + * This function should be called in regular intervals until it returns true - + * however, it is not recommended to spinwait on this call, as the backend may + * depend on a synchronous message loop. * * \param storage a storage container to query. - * \returns SDL_TRUE if the container is ready, SDL_FALSE otherwise. + * \returns true if the container is ready, false otherwise. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_StorageReady(SDL_Storage *storage); +extern SDL_DECLSPEC bool SDLCALL SDL_StorageReady(SDL_Storage *storage); /** * Query the size of a file within a storage container. @@ -230,15 +252,15 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_StorageReady(SDL_Storage *storage); * \param storage a storage container to query. * \param path the relative path of the file to query. * \param length a pointer to be filled with the file's length. - * \returns SDL_TRUE if the file could be queried or SDL_FALSE on failure; - * call SDL_GetError() for more information. + * \returns true if the file could be queried or false on failure; call + * SDL_GetError() for more information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_ReadStorageFile * \sa SDL_StorageReady */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetStorageFileSize(SDL_Storage *storage, const char *path, Uint64 *length); +extern SDL_DECLSPEC bool SDLCALL SDL_GetStorageFileSize(SDL_Storage *storage, const char *path, Uint64 *length); /** * Synchronously read a file from a storage container into a client-provided @@ -248,8 +270,8 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetStorageFileSize(SDL_Storage *storage * \param path the relative path of the file to read. * \param destination a client-provided buffer to read the file into. * \param length the length of the destination buffer. - * \returns SDL_TRUE if the file was read or SDL_FALSE on failure; call - * SDL_GetError() for more information. + * \returns true if the file was read or false on failure; call SDL_GetError() + * for more information. * * \since This function is available since SDL 3.0.0. * @@ -257,7 +279,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetStorageFileSize(SDL_Storage *storage * \sa SDL_StorageReady * \sa SDL_WriteStorageFile */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ReadStorageFile(SDL_Storage *storage, const char *path, void *destination, Uint64 length); +extern SDL_DECLSPEC bool SDLCALL SDL_ReadStorageFile(SDL_Storage *storage, const char *path, void *destination, Uint64 length); /** * Synchronously write a file from client memory into a storage container. @@ -266,7 +288,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ReadStorageFile(SDL_Storage *storage, c * \param path the relative path of the file to write. * \param source a client-provided buffer to write from. * \param length the length of the source buffer. - * \returns SDL_TRUE if the file was written or SDL_FALSE on failure; call + * \returns true if the file was written or false on failure; call * SDL_GetError() for more information. * * \since This function is available since SDL 3.0.0. @@ -275,21 +297,21 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ReadStorageFile(SDL_Storage *storage, c * \sa SDL_ReadStorageFile * \sa SDL_StorageReady */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_WriteStorageFile(SDL_Storage *storage, const char *path, const void *source, Uint64 length); +extern SDL_DECLSPEC bool SDLCALL SDL_WriteStorageFile(SDL_Storage *storage, const char *path, const void *source, Uint64 length); /** * Create a directory in a writable storage container. * * \param storage a storage container. * \param path the path of the directory to create. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_StorageReady */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_CreateStorageDirectory(SDL_Storage *storage, const char *path); +extern SDL_DECLSPEC bool SDLCALL SDL_CreateStorageDirectory(SDL_Storage *storage, const char *path); /** * Enumerate a directory in a storage container through a callback function. @@ -302,28 +324,28 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_CreateStorageDirectory(SDL_Storage *sto * \param path the path of the directory to enumerate. * \param callback a function that is called for each entry in the directory. * \param userdata a pointer that is passed to `callback`. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_StorageReady */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_EnumerateStorageDirectory(SDL_Storage *storage, const char *path, SDL_EnumerateDirectoryCallback callback, void *userdata); +extern SDL_DECLSPEC bool SDLCALL SDL_EnumerateStorageDirectory(SDL_Storage *storage, const char *path, SDL_EnumerateDirectoryCallback callback, void *userdata); /** * Remove a file or an empty directory in a writable storage container. * * \param storage a storage container. * \param path the path of the directory to enumerate. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_StorageReady */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_RemoveStoragePath(SDL_Storage *storage, const char *path); +extern SDL_DECLSPEC bool SDLCALL SDL_RemoveStoragePath(SDL_Storage *storage, const char *path); /** * Rename a file or directory in a writable storage container. @@ -331,14 +353,14 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_RemoveStoragePath(SDL_Storage *storage, * \param storage a storage container. * \param oldpath the old path. * \param newpath the new path. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_StorageReady */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_RenameStoragePath(SDL_Storage *storage, const char *oldpath, const char *newpath); +extern SDL_DECLSPEC bool SDLCALL SDL_RenameStoragePath(SDL_Storage *storage, const char *oldpath, const char *newpath); /** * Copy a file in a writable storage container. @@ -346,14 +368,14 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_RenameStoragePath(SDL_Storage *storage, * \param storage a storage container. * \param oldpath the old path. * \param newpath the new path. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_StorageReady */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_CopyStorageFile(SDL_Storage *storage, const char *oldpath, const char *newpath); +extern SDL_DECLSPEC bool SDLCALL SDL_CopyStorageFile(SDL_Storage *storage, const char *oldpath, const char *newpath); /** * Get information about a filesystem path in a storage container. @@ -362,14 +384,14 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_CopyStorageFile(SDL_Storage *storage, c * \param path the path to query. * \param info a pointer filled in with information about the path, or NULL to * check for the existence of a file. - * \returns SDL_TRUE on success or SDL_FALSE if the file doesn't exist, or - * another failure; call SDL_GetError() for more information. + * \returns true on success or false if the file doesn't exist, or another + * failure; call SDL_GetError() for more information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_StorageReady */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetStoragePathInfo(SDL_Storage *storage, const char *path, SDL_PathInfo *info); +extern SDL_DECLSPEC bool SDLCALL SDL_GetStoragePathInfo(SDL_Storage *storage, const char *path, SDL_PathInfo *info); /** * Queries the remaining space in a storage container. diff --git a/include/SDL3/SDL_surface.h b/include/SDL3/SDL_surface.h index aafe574d..01c05124 100644 --- a/include/SDL3/SDL_surface.h +++ b/include/SDL3/SDL_surface.h @@ -223,14 +223,14 @@ extern SDL_DECLSPEC SDL_PropertiesID SDLCALL SDL_GetSurfaceProperties(SDL_Surfac * \param surface the SDL_Surface structure to update. * \param colorspace an SDL_ColorSpace value describing the surface * colorspace. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_GetSurfaceColorspace */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetSurfaceColorspace(SDL_Surface *surface, SDL_Colorspace colorspace); +extern SDL_DECLSPEC bool SDLCALL SDL_SetSurfaceColorspace(SDL_Surface *surface, SDL_Colorspace colorspace); /** * Get the colorspace used by a surface. @@ -284,15 +284,15 @@ extern SDL_DECLSPEC SDL_Palette * SDLCALL SDL_CreateSurfacePalette(SDL_Surface * * * \param surface the SDL_Surface structure to update. * \param palette the SDL_Palette structure to use. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_CreatePalette * \sa SDL_GetSurfacePalette */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetSurfacePalette(SDL_Surface *surface, SDL_Palette *palette); +extern SDL_DECLSPEC bool SDLCALL SDL_SetSurfacePalette(SDL_Surface *surface, SDL_Palette *palette); /** * Get the palette used by a surface. @@ -321,8 +321,8 @@ extern SDL_DECLSPEC SDL_Palette * SDLCALL SDL_GetSurfacePalette(SDL_Surface *sur * \param surface the SDL_Surface structure to update. * \param image a pointer to an alternate SDL_Surface to associate with this * surface. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * @@ -330,14 +330,13 @@ extern SDL_DECLSPEC SDL_Palette * SDLCALL SDL_GetSurfacePalette(SDL_Surface *sur * \sa SDL_GetSurfaceImages * \sa SDL_SurfaceHasAlternateImages */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_AddSurfaceAlternateImage(SDL_Surface *surface, SDL_Surface *image); +extern SDL_DECLSPEC bool SDLCALL SDL_AddSurfaceAlternateImage(SDL_Surface *surface, SDL_Surface *image); /** * Return whether a surface has alternate versions available. * * \param surface the SDL_Surface structure to query. - * \returns SDL_TRUE if alternate versions are available or SDL_TRUE - * otherwise. + * \returns true if alternate versions are available or true otherwise. * * \since This function is available since SDL 3.0.0. * @@ -345,7 +344,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_AddSurfaceAlternateImage(SDL_Surface *s * \sa SDL_RemoveSurfaceAlternateImages * \sa SDL_GetSurfaceImages */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SurfaceHasAlternateImages(SDL_Surface *surface); +extern SDL_DECLSPEC bool SDLCALL SDL_SurfaceHasAlternateImages(SDL_Surface *surface); /** * Get an array including all versions of a surface. @@ -401,15 +400,15 @@ extern SDL_DECLSPEC void SDLCALL SDL_RemoveSurfaceAlternateImages(SDL_Surface *s * format of the surface will not change. * * \param surface the SDL_Surface structure to be locked. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_MUSTLOCK * \sa SDL_UnlockSurface */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_LockSurface(SDL_Surface *surface); +extern SDL_DECLSPEC bool SDLCALL SDL_LockSurface(SDL_Surface *surface); /** * Release a surface after directly accessing the pixels. @@ -429,8 +428,8 @@ extern SDL_DECLSPEC void SDLCALL SDL_UnlockSurface(SDL_Surface *surface); * will result in a memory leak. * * \param src the data stream for the surface. - * \param closeio if SDL_TRUE, calls SDL_CloseIO() on `src` before returning, - * even in the case of an error. + * \param closeio if true, calls SDL_CloseIO() on `src` before returning, even + * in the case of an error. * \returns a pointer to a new SDL_Surface structure or NULL on failure; call * SDL_GetError() for more information. * @@ -440,7 +439,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_UnlockSurface(SDL_Surface *surface); * \sa SDL_LoadBMP * \sa SDL_SaveBMP_IO */ -extern SDL_DECLSPEC SDL_Surface * SDLCALL SDL_LoadBMP_IO(SDL_IOStream *src, SDL_bool closeio); +extern SDL_DECLSPEC SDL_Surface * SDLCALL SDL_LoadBMP_IO(SDL_IOStream *src, bool closeio); /** * Load a BMP image from a file. @@ -471,17 +470,17 @@ extern SDL_DECLSPEC SDL_Surface * SDLCALL SDL_LoadBMP(const char *file); * * \param surface the SDL_Surface structure containing the image to be saved. * \param dst a data stream to save to. - * \param closeio if SDL_TRUE, calls SDL_CloseIO() on `dst` before returning, - * even in the case of an error. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \param closeio if true, calls SDL_CloseIO() on `dst` before returning, even + * in the case of an error. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_LoadBMP_IO * \sa SDL_SaveBMP */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SaveBMP_IO(SDL_Surface *surface, SDL_IOStream *dst, SDL_bool closeio); +extern SDL_DECLSPEC bool SDLCALL SDL_SaveBMP_IO(SDL_Surface *surface, SDL_IOStream *dst, bool closeio); /** * Save a surface to a file. @@ -494,15 +493,15 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SaveBMP_IO(SDL_Surface *surface, SDL_IO * * \param surface the SDL_Surface structure containing the image to be saved. * \param file a file to save to. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_LoadBMP * \sa SDL_SaveBMP_IO */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SaveBMP(SDL_Surface *surface, const char *file); +extern SDL_DECLSPEC bool SDLCALL SDL_SaveBMP(SDL_Surface *surface, const char *file); /** * Set the RLE acceleration hint for a surface. @@ -511,10 +510,9 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SaveBMP(SDL_Surface *surface, const cha * the surface must be locked before directly accessing the pixels. * * \param surface the SDL_Surface structure to optimize. - * \param enabled SDL_TRUE to enable RLE acceleration, SDL_FALSE to disable - * it. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \param enabled true to enable RLE acceleration, false to disable it. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * @@ -522,21 +520,21 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SaveBMP(SDL_Surface *surface, const cha * \sa SDL_LockSurface * \sa SDL_UnlockSurface */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetSurfaceRLE(SDL_Surface *surface, SDL_bool enabled); +extern SDL_DECLSPEC bool SDLCALL SDL_SetSurfaceRLE(SDL_Surface *surface, bool enabled); /** * Returns whether the surface is RLE enabled. * - * It is safe to pass a NULL `surface` here; it will return SDL_FALSE. + * It is safe to pass a NULL `surface` here; it will return false. * * \param surface the SDL_Surface structure to query. - * \returns SDL_TRUE if the surface is RLE enabled, SDL_FALSE otherwise. + * \returns true if the surface is RLE enabled, false otherwise. * * \since This function is available since SDL 3.0.0. * * \sa SDL_SetSurfaceRLE */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SurfaceHasRLE(SDL_Surface *surface); +extern SDL_DECLSPEC bool SDLCALL SDL_SurfaceHasRLE(SDL_Surface *surface); /** * Set the color key (transparent pixel) in a surface. @@ -549,11 +547,10 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SurfaceHasRLE(SDL_Surface *surface); * SDL_MapRGB(). * * \param surface the SDL_Surface structure to update. - * \param enabled SDL_TRUE to enable color key, SDL_FALSE to disable color - * key. + * \param enabled true to enable color key, false to disable color key. * \param key the transparent pixel. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * @@ -561,22 +558,22 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SurfaceHasRLE(SDL_Surface *surface); * \sa SDL_SetSurfaceRLE * \sa SDL_SurfaceHasColorKey */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetSurfaceColorKey(SDL_Surface *surface, SDL_bool enabled, Uint32 key); +extern SDL_DECLSPEC bool SDLCALL SDL_SetSurfaceColorKey(SDL_Surface *surface, bool enabled, Uint32 key); /** * Returns whether the surface has a color key. * - * It is safe to pass a NULL `surface` here; it will return SDL_FALSE. + * It is safe to pass a NULL `surface` here; it will return false. * * \param surface the SDL_Surface structure to query. - * \returns SDL_TRUE if the surface has a color key, SDL_FALSE otherwise. + * \returns true if the surface has a color key, false otherwise. * * \since This function is available since SDL 3.0.0. * * \sa SDL_SetSurfaceColorKey * \sa SDL_GetSurfaceColorKey */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SurfaceHasColorKey(SDL_Surface *surface); +extern SDL_DECLSPEC bool SDLCALL SDL_SurfaceHasColorKey(SDL_Surface *surface); /** * Get the color key (transparent pixel) for a surface. @@ -584,19 +581,19 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SurfaceHasColorKey(SDL_Surface *surface * The color key is a pixel of the format used by the surface, as generated by * SDL_MapRGB(). * - * If the surface doesn't have color key enabled this function returns -1. + * If the surface doesn't have color key enabled this function returns false. * * \param surface the SDL_Surface structure to query. * \param key a pointer filled in with the transparent pixel. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_SetSurfaceColorKey * \sa SDL_SurfaceHasColorKey */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetSurfaceColorKey(SDL_Surface *surface, Uint32 *key); +extern SDL_DECLSPEC bool SDLCALL SDL_GetSurfaceColorKey(SDL_Surface *surface, Uint32 *key); /** * Set an additional color value multiplied into blit operations. @@ -611,15 +608,15 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetSurfaceColorKey(SDL_Surface *surface * \param r the red color value multiplied into blit operations. * \param g the green color value multiplied into blit operations. * \param b the blue color value multiplied into blit operations. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_GetSurfaceColorMod * \sa SDL_SetSurfaceAlphaMod */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetSurfaceColorMod(SDL_Surface *surface, Uint8 r, Uint8 g, Uint8 b); +extern SDL_DECLSPEC bool SDLCALL SDL_SetSurfaceColorMod(SDL_Surface *surface, Uint8 r, Uint8 g, Uint8 b); /** @@ -629,15 +626,15 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetSurfaceColorMod(SDL_Surface *surface * \param r a pointer filled in with the current red color value. * \param g a pointer filled in with the current green color value. * \param b a pointer filled in with the current blue color value. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_GetSurfaceAlphaMod * \sa SDL_SetSurfaceColorMod */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetSurfaceColorMod(SDL_Surface *surface, Uint8 *r, Uint8 *g, Uint8 *b); +extern SDL_DECLSPEC bool SDLCALL SDL_GetSurfaceColorMod(SDL_Surface *surface, Uint8 *r, Uint8 *g, Uint8 *b); /** * Set an additional alpha value used in blit operations. @@ -649,30 +646,30 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetSurfaceColorMod(SDL_Surface *surface * * \param surface the SDL_Surface structure to update. * \param alpha the alpha value multiplied into blit operations. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_GetSurfaceAlphaMod * \sa SDL_SetSurfaceColorMod */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetSurfaceAlphaMod(SDL_Surface *surface, Uint8 alpha); +extern SDL_DECLSPEC bool SDLCALL SDL_SetSurfaceAlphaMod(SDL_Surface *surface, Uint8 alpha); /** * Get the additional alpha value used in blit operations. * * \param surface the SDL_Surface structure to query. * \param alpha a pointer filled in with the current alpha value. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_GetSurfaceColorMod * \sa SDL_SetSurfaceAlphaMod */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetSurfaceAlphaMod(SDL_Surface *surface, Uint8 *alpha); +extern SDL_DECLSPEC bool SDLCALL SDL_GetSurfaceAlphaMod(SDL_Surface *surface, Uint8 *alpha); /** * Set the blend mode used for blit operations. @@ -683,28 +680,28 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetSurfaceAlphaMod(SDL_Surface *surface * * \param surface the SDL_Surface structure to update. * \param blendMode the SDL_BlendMode to use for blit blending. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_GetSurfaceBlendMode */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetSurfaceBlendMode(SDL_Surface *surface, SDL_BlendMode blendMode); +extern SDL_DECLSPEC bool SDLCALL SDL_SetSurfaceBlendMode(SDL_Surface *surface, SDL_BlendMode blendMode); /** * Get the blend mode used for blit operations. * * \param surface the SDL_Surface structure to query. * \param blendMode a pointer filled in with the current SDL_BlendMode. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_SetSurfaceBlendMode */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetSurfaceBlendMode(SDL_Surface *surface, SDL_BlendMode *blendMode); +extern SDL_DECLSPEC bool SDLCALL SDL_GetSurfaceBlendMode(SDL_Surface *surface, SDL_BlendMode *blendMode); /** * Set the clipping rectangle for a surface. @@ -718,14 +715,14 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetSurfaceBlendMode(SDL_Surface *surfac * \param surface the SDL_Surface structure to be clipped. * \param rect the SDL_Rect structure representing the clipping rectangle, or * NULL to disable clipping. - * \returns SDL_TRUE if the rectangle intersects the surface, otherwise - * SDL_FALSE and blits will be completely clipped. + * \returns true if the rectangle intersects the surface, otherwise false and + * blits will be completely clipped. * * \since This function is available since SDL 3.0.0. * * \sa SDL_GetSurfaceClipRect */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetSurfaceClipRect(SDL_Surface *surface, const SDL_Rect *rect); +extern SDL_DECLSPEC bool SDLCALL SDL_SetSurfaceClipRect(SDL_Surface *surface, const SDL_Rect *rect); /** * Get the clipping rectangle for a surface. @@ -737,26 +734,26 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetSurfaceClipRect(SDL_Surface *surface * clipped. * \param rect an SDL_Rect structure filled in with the clipping rectangle for * the surface. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_SetSurfaceClipRect */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetSurfaceClipRect(SDL_Surface *surface, SDL_Rect *rect); +extern SDL_DECLSPEC bool SDLCALL SDL_GetSurfaceClipRect(SDL_Surface *surface, SDL_Rect *rect); /** * Flip a surface vertically or horizontally. * * \param surface the surface to flip. * \param flip the direction to flip. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_FlipSurface(SDL_Surface *surface, SDL_FlipMode flip); +extern SDL_DECLSPEC bool SDLCALL SDL_FlipSurface(SDL_Surface *surface, SDL_FlipMode flip); /** * Creates a new surface identical to the existing surface. @@ -859,14 +856,14 @@ extern SDL_DECLSPEC SDL_Surface * SDLCALL SDL_ConvertSurfaceAndColorspace(SDL_Su * \param dst_format an SDL_PixelFormat value of the `dst` pixels format. * \param dst a pointer to be filled in with new pixel data. * \param dst_pitch the pitch of the destination pixels, in bytes. - * \returns SDL_FALSE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns false on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_ConvertPixelsAndColorspace */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ConvertPixels(int width, int height, SDL_PixelFormat src_format, const void *src, int src_pitch, SDL_PixelFormat dst_format, void *dst, int dst_pitch); +extern SDL_DECLSPEC bool SDLCALL SDL_ConvertPixels(int width, int height, SDL_PixelFormat src_format, const void *src, int src_pitch, SDL_PixelFormat dst_format, void *dst, int dst_pitch); /** * Copy a block of pixels of one format and colorspace to another format and @@ -888,14 +885,14 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ConvertPixels(int width, int height, SD * properties, or 0. * \param dst a pointer to be filled in with new pixel data. * \param dst_pitch the pitch of the destination pixels, in bytes. - * \returns SDL_FALSE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns false on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_ConvertPixels */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ConvertPixelsAndColorspace(int width, int height, SDL_PixelFormat src_format, SDL_Colorspace src_colorspace, SDL_PropertiesID src_properties, const void *src, int src_pitch, SDL_PixelFormat dst_format, SDL_Colorspace dst_colorspace, SDL_PropertiesID dst_properties, void *dst, int dst_pitch); +extern SDL_DECLSPEC bool SDLCALL SDL_ConvertPixelsAndColorspace(int width, int height, SDL_PixelFormat src_format, SDL_Colorspace src_colorspace, SDL_PropertiesID src_properties, const void *src, int src_pitch, SDL_PixelFormat dst_format, SDL_Colorspace dst_colorspace, SDL_PropertiesID dst_properties, void *dst, int dst_pitch); /** * Premultiply the alpha on a block of pixels. @@ -910,14 +907,14 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ConvertPixelsAndColorspace(int width, i * \param dst_format an SDL_PixelFormat value of the `dst` pixels format. * \param dst a pointer to be filled in with premultiplied pixel data. * \param dst_pitch the pitch of the destination pixels, in bytes. - * \param linear SDL_TRUE to convert from sRGB to linear space for the alpha - * multiplication, SDL_FALSE to do multiplication in sRGB space. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \param linear true to convert from sRGB to linear space for the alpha + * multiplication, false to do multiplication in sRGB space. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_PremultiplyAlpha(int width, int height, SDL_PixelFormat src_format, const void *src, int src_pitch, SDL_PixelFormat dst_format, void *dst, int dst_pitch, SDL_bool linear); +extern SDL_DECLSPEC bool SDLCALL SDL_PremultiplyAlpha(int width, int height, SDL_PixelFormat src_format, const void *src, int src_pitch, SDL_PixelFormat dst_format, void *dst, int dst_pitch, bool linear); /** * Premultiply the alpha in a surface. @@ -925,14 +922,14 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_PremultiplyAlpha(int width, int height, * This is safe to use with src == dst, but not for other overlapping areas. * * \param surface the surface to modify. - * \param linear SDL_TRUE to convert from sRGB to linear space for the alpha - * multiplication, SDL_FALSE to do multiplication in sRGB space. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \param linear true to convert from sRGB to linear space for the alpha + * multiplication, false to do multiplication in sRGB space. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_PremultiplySurfaceAlpha(SDL_Surface *surface, SDL_bool linear); +extern SDL_DECLSPEC bool SDLCALL SDL_PremultiplySurfaceAlpha(SDL_Surface *surface, bool linear); /** * Clear a surface with a specific color, with floating point precision. @@ -947,12 +944,12 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_PremultiplySurfaceAlpha(SDL_Surface *su * \param g the green component of the pixel, normally in the range 0-1. * \param b the blue component of the pixel, normally in the range 0-1. * \param a the alpha component of the pixel, normally in the range 0-1. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ClearSurface(SDL_Surface *surface, float r, float g, float b, float a); +extern SDL_DECLSPEC bool SDLCALL SDL_ClearSurface(SDL_Surface *surface, float r, float g, float b, float a); /** * Perform a fast fill of a rectangle with a specific color. @@ -970,14 +967,14 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ClearSurface(SDL_Surface *surface, floa * \param rect the SDL_Rect structure representing the rectangle to fill, or * NULL to fill the entire surface. * \param color the color to fill with. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_FillSurfaceRects */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_FillSurfaceRect(SDL_Surface *dst, const SDL_Rect *rect, Uint32 color); +extern SDL_DECLSPEC bool SDLCALL SDL_FillSurfaceRect(SDL_Surface *dst, const SDL_Rect *rect, Uint32 color); /** * Perform a fast fill of a set of rectangles with a specific color. @@ -995,14 +992,14 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_FillSurfaceRect(SDL_Surface *dst, const * \param rects an array of SDL_Rects representing the rectangles to fill. * \param count the number of rectangles in the array. * \param color the color to fill with. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_FillSurfaceRect */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_FillSurfaceRects(SDL_Surface *dst, const SDL_Rect *rects, int count, Uint32 color); +extern SDL_DECLSPEC bool SDLCALL SDL_FillSurfaceRects(SDL_Surface *dst, const SDL_Rect *rects, int count, Uint32 color); /** * Performs a fast blit from the source surface to the destination surface. @@ -1066,8 +1063,8 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_FillSurfaceRects(SDL_Surface *dst, cons * height are ignored, and are copied from `srcrect`. If you * want a specific width and height, you should use * SDL_BlitSurfaceScaled(). - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \threadsafety The same destination surface should not be used from two * threads at once. It is safe to use the same source surface @@ -1077,7 +1074,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_FillSurfaceRects(SDL_Surface *dst, cons * * \sa SDL_BlitSurfaceScaled */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_BlitSurface(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, const SDL_Rect *dstrect); +extern SDL_DECLSPEC bool SDLCALL SDL_BlitSurface(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, const SDL_Rect *dstrect); /** * Perform low-level surface blitting only. @@ -1091,8 +1088,8 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_BlitSurface(SDL_Surface *src, const SDL * \param dst the SDL_Surface structure that is the blit target. * \param dstrect the SDL_Rect structure representing the target rectangle in * the destination surface, may not be NULL. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \threadsafety The same destination surface should not be used from two * threads at once. It is safe to use the same source surface @@ -1102,7 +1099,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_BlitSurface(SDL_Surface *src, const SDL * * \sa SDL_BlitSurface */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_BlitSurfaceUnchecked(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, const SDL_Rect *dstrect); +extern SDL_DECLSPEC bool SDLCALL SDL_BlitSurfaceUnchecked(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, const SDL_Rect *dstrect); /** * Perform a scaled blit to a destination surface, which may be of a different @@ -1116,8 +1113,8 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_BlitSurfaceUnchecked(SDL_Surface *src, * the destination surface, or NULL to fill the entire * destination surface. * \param scaleMode the SDL_ScaleMode to be used. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \threadsafety The same destination surface should not be used from two * threads at once. It is safe to use the same source surface @@ -1127,7 +1124,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_BlitSurfaceUnchecked(SDL_Surface *src, * * \sa SDL_BlitSurface */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_BlitSurfaceScaled(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, const SDL_Rect *dstrect, SDL_ScaleMode scaleMode); +extern SDL_DECLSPEC bool SDLCALL SDL_BlitSurfaceScaled(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, const SDL_Rect *dstrect, SDL_ScaleMode scaleMode); /** * Perform low-level surface scaled blitting only. @@ -1142,8 +1139,8 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_BlitSurfaceScaled(SDL_Surface *src, con * \param dstrect the SDL_Rect structure representing the target rectangle in * the destination surface, may not be NULL. * \param scaleMode the SDL_ScaleMode to be used. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \threadsafety The same destination surface should not be used from two * threads at once. It is safe to use the same source surface @@ -1153,7 +1150,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_BlitSurfaceScaled(SDL_Surface *src, con * * \sa SDL_BlitSurfaceScaled */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_BlitSurfaceUncheckedScaled(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, const SDL_Rect *dstrect, SDL_ScaleMode scaleMode); +extern SDL_DECLSPEC bool SDLCALL SDL_BlitSurfaceUncheckedScaled(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, const SDL_Rect *dstrect, SDL_ScaleMode scaleMode); /** * Perform a tiled blit to a destination surface, which may be of a different @@ -1168,8 +1165,8 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_BlitSurfaceUncheckedScaled(SDL_Surface * \param dst the SDL_Surface structure that is the blit target. * \param dstrect the SDL_Rect structure representing the target rectangle in * the destination surface, or NULL to fill the entire surface. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \threadsafety The same destination surface should not be used from two * threads at once. It is safe to use the same source surface @@ -1179,7 +1176,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_BlitSurfaceUncheckedScaled(SDL_Surface * * \sa SDL_BlitSurface */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_BlitSurfaceTiled(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, const SDL_Rect *dstrect); +extern SDL_DECLSPEC bool SDLCALL SDL_BlitSurfaceTiled(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, const SDL_Rect *dstrect); /** * Perform a scaled and tiled blit to a destination surface, which may be of a @@ -1198,8 +1195,8 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_BlitSurfaceTiled(SDL_Surface *src, cons * \param dst the SDL_Surface structure that is the blit target. * \param dstrect the SDL_Rect structure representing the target rectangle in * the destination surface, or NULL to fill the entire surface. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \threadsafety The same destination surface should not be used from two * threads at once. It is safe to use the same source surface @@ -1209,7 +1206,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_BlitSurfaceTiled(SDL_Surface *src, cons * * \sa SDL_BlitSurface */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_BlitSurfaceTiledWithScale(SDL_Surface *src, const SDL_Rect *srcrect, float scale, SDL_ScaleMode scaleMode, SDL_Surface *dst, const SDL_Rect *dstrect); +extern SDL_DECLSPEC bool SDLCALL SDL_BlitSurfaceTiledWithScale(SDL_Surface *src, const SDL_Rect *srcrect, float scale, SDL_ScaleMode scaleMode, SDL_Surface *dst, const SDL_Rect *dstrect); /** * Perform a scaled blit using the 9-grid algorithm to a destination surface, @@ -1235,8 +1232,8 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_BlitSurfaceTiledWithScale(SDL_Surface * * \param dst the SDL_Surface structure that is the blit target. * \param dstrect the SDL_Rect structure representing the target rectangle in * the destination surface, or NULL to fill the entire surface. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \threadsafety The same destination surface should not be used from two * threads at once. It is safe to use the same source surface @@ -1246,7 +1243,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_BlitSurfaceTiledWithScale(SDL_Surface * * * \sa SDL_BlitSurface */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_BlitSurface9Grid(SDL_Surface *src, const SDL_Rect *srcrect, int left_width, int right_width, int top_height, int bottom_height, float scale, SDL_ScaleMode scaleMode, SDL_Surface *dst, const SDL_Rect *dstrect); +extern SDL_DECLSPEC bool SDLCALL SDL_BlitSurface9Grid(SDL_Surface *src, const SDL_Rect *srcrect, int left_width, int right_width, int top_height, int bottom_height, float scale, SDL_ScaleMode scaleMode, SDL_Surface *dst, const SDL_Rect *dstrect); /** * Map an RGB triple to an opaque pixel value for a surface. @@ -1329,12 +1326,12 @@ extern SDL_DECLSPEC Uint32 SDLCALL SDL_MapSurfaceRGBA(SDL_Surface *surface, Uint * ignore this channel. * \param a a pointer filled in with the alpha channel, 0-255, or NULL to * ignore this channel. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ReadSurfacePixel(SDL_Surface *surface, int x, int y, Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a); +extern SDL_DECLSPEC bool SDLCALL SDL_ReadSurfacePixel(SDL_Surface *surface, int x, int y, Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a); /** * Retrieves a single pixel from a surface. @@ -1353,12 +1350,12 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ReadSurfacePixel(SDL_Surface *surface, * 0-1, or NULL to ignore this channel. * \param a a pointer filled in with the alpha channel, normally in the range * 0-1, or NULL to ignore this channel. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ReadSurfacePixelFloat(SDL_Surface *surface, int x, int y, float *r, float *g, float *b, float *a); +extern SDL_DECLSPEC bool SDLCALL SDL_ReadSurfacePixelFloat(SDL_Surface *surface, int x, int y, float *r, float *g, float *b, float *a); /** * Writes a single pixel to a surface. @@ -1376,12 +1373,12 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ReadSurfacePixelFloat(SDL_Surface *surf * \param g the green channel value, 0-255. * \param b the blue channel value, 0-255. * \param a the alpha channel value, 0-255. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_WriteSurfacePixel(SDL_Surface *surface, int x, int y, Uint8 r, Uint8 g, Uint8 b, Uint8 a); +extern SDL_DECLSPEC bool SDLCALL SDL_WriteSurfacePixel(SDL_Surface *surface, int x, int y, Uint8 r, Uint8 g, Uint8 b, Uint8 a); /** * Writes a single pixel to a surface. @@ -1396,12 +1393,12 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_WriteSurfacePixel(SDL_Surface *surface, * \param g the green channel value, normally in the range 0-1. * \param b the blue channel value, normally in the range 0-1. * \param a the alpha channel value, normally in the range 0-1. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_WriteSurfacePixelFloat(SDL_Surface *surface, int x, int y, float r, float g, float b, float a); +extern SDL_DECLSPEC bool SDLCALL SDL_WriteSurfacePixelFloat(SDL_Surface *surface, int x, int y, float r, float g, float b, float a); /* Ends C function definitions when using C++ */ #ifdef __cplusplus diff --git a/include/SDL3/SDL_system.h b/include/SDL3/SDL_system.h index 17ac0a10..a005cfa5 100644 --- a/include/SDL3/SDL_system.h +++ b/include/SDL3/SDL_system.h @@ -31,7 +31,6 @@ #include #include #include -#include #include #include @@ -44,16 +43,15 @@ extern "C" { /* * Platform specific functions for Windows */ -#if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK) +#if defined(SDL_PLATFORM_WINDOWS) typedef struct tagMSG MSG; /** * A callback to be used with SDL_SetWindowsMessageHook. * - * This callback may modify the message, and should return SDL_TRUE if the - * message should continue to be processed, or SDL_FALSE to prevent further - * processing. + * This callback may modify the message, and should return true if the message + * should continue to be processed, or false to prevent further processing. * * As this is processing a message directly from the Windows event loop, this * callback should do the minimum required work and return quickly. @@ -61,7 +59,7 @@ typedef struct tagMSG MSG; * \param userdata the app-defined pointer provided to * SDL_SetWindowsMessageHook. * \param msg a pointer to a Win32 event structure to process. - * \returns SDL_TRUE to let event continue on, SDL_FALSE to drop it. + * \returns true to let event continue on, false to drop it. * * \threadsafety This may only be called (by SDL) from the thread handling the * Windows event loop. @@ -71,14 +69,13 @@ typedef struct tagMSG MSG; * \sa SDL_SetWindowsMessageHook * \sa SDL_HINT_WINDOWS_ENABLE_MESSAGELOOP */ -typedef SDL_bool (SDLCALL *SDL_WindowsMessageHook)(void *userdata, MSG *msg); +typedef bool (SDLCALL *SDL_WindowsMessageHook)(void *userdata, MSG *msg); /** * Set a callback for every Windows message, run before TranslateMessage(). * - * The callback may modify the message, and should return SDL_TRUE if the - * message should continue to be processed, or SDL_FALSE to prevent further - * processing. + * The callback may modify the message, and should return true if the message + * should continue to be processed, or false to prevent further processing. * * \param callback the SDL_WindowsMessageHook function to call. * \param userdata a pointer to pass to every iteration of `callback`. @@ -90,7 +87,7 @@ typedef SDL_bool (SDLCALL *SDL_WindowsMessageHook)(void *userdata, MSG *msg); */ extern SDL_DECLSPEC void SDLCALL SDL_SetWindowsMessageHook(SDL_WindowsMessageHook callback, void *userdata); -#endif /* defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK) */ +#endif /* defined(SDL_PLATFORM_WINDOWS) */ #if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINGDK) @@ -108,10 +105,6 @@ extern SDL_DECLSPEC void SDLCALL SDL_SetWindowsMessageHook(SDL_WindowsMessageHoo */ extern SDL_DECLSPEC int SDLCALL SDL_GetDirect3D9AdapterIndex(SDL_DisplayID displayID); -#endif /* defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINGDK) */ - -#if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINGDK) - /** * Get the DXGI Adapter and Output indices for the specified display. * @@ -122,28 +115,28 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetDirect3D9AdapterIndex(SDL_DisplayID displ * \param displayID the instance of the display to query. * \param adapterIndex a pointer to be filled in with the adapter index. * \param outputIndex a pointer to be filled in with the output index. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetDXGIOutputInfo(SDL_DisplayID displayID, int *adapterIndex, int *outputIndex); +extern SDL_DECLSPEC bool SDLCALL SDL_GetDXGIOutputInfo(SDL_DisplayID displayID, int *adapterIndex, int *outputIndex); #endif /* defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINGDK) */ + /* * Platform specific functions for UNIX */ typedef union _XEvent XEvent; -typedef SDL_bool (SDLCALL *SDL_X11EventHook)(void *userdata, XEvent *xevent); +typedef bool (SDLCALL *SDL_X11EventHook)(void *userdata, XEvent *xevent); /** * Set a callback for every X11 event. * - * The callback may modify the event, and should return SDL_TRUE if the event - * should continue to be processed, or SDL_FALSE to prevent further - * processing. + * The callback may modify the event, and should return true if the event + * should continue to be processed, or false to prevent further processing. * * \param callback the SDL_X11EventHook function to call. * \param userdata a pointer to pass to every iteration of `callback`. @@ -162,12 +155,12 @@ extern SDL_DECLSPEC void SDLCALL SDL_SetX11EventHook(SDL_X11EventHook callback, * * \param threadID the Unix thread ID to change priority of. * \param priority the new, Unix-specific, priority value. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetLinuxThreadPriority(Sint64 threadID, int priority); +extern SDL_DECLSPEC bool SDLCALL SDL_SetLinuxThreadPriority(Sint64 threadID, int priority); /** * Sets the priority (not nice level) and scheduling policy for a thread. @@ -178,12 +171,12 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetLinuxThreadPriority(Sint64 threadID, * \param sdlPriority the new SDL_ThreadPriority value. * \param schedPolicy the new scheduling policy (SCHED_FIFO, SCHED_RR, * SCHED_OTHER, etc...). - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetLinuxThreadPriorityAndPolicy(Sint64 threadID, int sdlPriority, int schedPolicy); +extern SDL_DECLSPEC bool SDLCALL SDL_SetLinuxThreadPriorityAndPolicy(Sint64 threadID, int sdlPriority, int schedPolicy); #endif /* SDL_PLATFORM_LINUX */ @@ -240,27 +233,27 @@ typedef void (SDLCALL *SDL_iOSAnimationCallback)(void *userdata); * called. * \param callback the function to call for every frame. * \param callbackParam a pointer that is passed to `callback`. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_SetiOSEventPump */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetiOSAnimationCallback(SDL_Window *window, int interval, SDL_iOSAnimationCallback callback, void *callbackParam); +extern SDL_DECLSPEC bool SDLCALL SDL_SetiOSAnimationCallback(SDL_Window *window, int interval, SDL_iOSAnimationCallback callback, void *callbackParam); /** * Use this function to enable or disable the SDL event pump on Apple iOS. * * This function is only available on Apple iOS. * - * \param enabled SDL_TRUE to enable the event pump, SDL_FALSE to disable it. + * \param enabled true to enable the event pump, false to disable it. * * \since This function is available since SDL 3.0.0. * * \sa SDL_SetiOSAnimationCallback */ -extern SDL_DECLSPEC void SDLCALL SDL_SetiOSEventPump(SDL_bool enabled); +extern SDL_DECLSPEC void SDLCALL SDL_SetiOSEventPump(bool enabled); #endif /* SDL_PLATFORM_IOS */ @@ -356,29 +349,29 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetAndroidSDKVersion(void); /** * Query if the application is running on Android TV. * - * \returns SDL_TRUE if this is Android TV, SDL_FALSE otherwise. + * \returns true if this is Android TV, false otherwise. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_IsAndroidTV(void); +extern SDL_DECLSPEC bool SDLCALL SDL_IsAndroidTV(void); /** * Query if the application is running on a Chromebook. * - * \returns SDL_TRUE if this is a Chromebook, SDL_FALSE otherwise. + * \returns true if this is a Chromebook, false otherwise. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_IsChromebook(void); +extern SDL_DECLSPEC bool SDLCALL SDL_IsChromebook(void); /** * Query if the application is running on a Samsung DeX docking station. * - * \returns SDL_TRUE if this is a DeX docking station, SDL_FALSE otherwise. + * \returns true if this is a DeX docking station, false otherwise. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_IsDeXMode(void); +extern SDL_DECLSPEC bool SDLCALL SDL_IsDeXMode(void); /** * Trigger the Android system back button behavior. @@ -479,7 +472,7 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetAndroidExternalStoragePath(void) extern SDL_DECLSPEC const char * SDLCALL SDL_GetAndroidCachePath(void); -typedef void (SDLCALL *SDL_RequestAndroidPermissionCallback)(void *userdata, const char *permission, SDL_bool granted); +typedef void (SDLCALL *SDL_RequestAndroidPermissionCallback)(void *userdata, const char *permission, bool granted); /** * Request permissions at runtime, asynchronously. @@ -503,15 +496,15 @@ typedef void (SDLCALL *SDL_RequestAndroidPermissionCallback)(void *userdata, con * \param permission the permission to request. * \param cb the callback to trigger when the request has a response. * \param userdata an app-controlled pointer that is passed to the callback. - * \returns SDL_TRUE if the request was submitted, SDL_FALSE if there was an - * error submitting. The result of the request is only ever reported + * \returns true if the request was submitted, false if there was an error + * submitting. The result of the request is only ever reported * through the callback, not this return value. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_RequestAndroidPermission(const char *permission, SDL_RequestAndroidPermissionCallback cb, void *userdata); +extern SDL_DECLSPEC bool SDLCALL SDL_RequestAndroidPermission(const char *permission, SDL_RequestAndroidPermissionCallback cb, void *userdata); /** * Shows an Android toast notification. @@ -532,14 +525,14 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_RequestAndroidPermission(const char *pe * \param gravity where the notification should appear on the screen. * \param xoffset set this parameter only when gravity >=0. * \param yoffset set this parameter only when gravity >=0. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ShowAndroidToast(const char *message, int duration, int gravity, int xoffset, int yoffset); +extern SDL_DECLSPEC bool SDLCALL SDL_ShowAndroidToast(const char *message, int duration, int gravity, int xoffset, int yoffset); /** * Send a user command to SDLActivity. @@ -548,111 +541,27 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ShowAndroidToast(const char *message, i * * \param command user command that must be greater or equal to 0x8000. * \param param user parameter. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \threadsafety It is safe to call this function from any thread. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SendAndroidMessage(Uint32 command, int param); +extern SDL_DECLSPEC bool SDLCALL SDL_SendAndroidMessage(Uint32 command, int param); #endif /* SDL_PLATFORM_ANDROID */ -/* - * Platform specific functions for WinRT - */ -#ifdef SDL_PLATFORM_WINRT - -/** - * WinRT / Windows Phone path types - * - * \since This enum is available since SDL 3.0.0. - */ -typedef enum SDL_WinRT_Path -{ - /** The installed app's root directory. - Files here are likely to be read-only. */ - SDL_WINRT_PATH_INSTALLED_LOCATION, - - /** The app's local data store. Files may be written here */ - SDL_WINRT_PATH_LOCAL_FOLDER, - - /** The app's roaming data store. Unsupported on Windows Phone. - Files written here may be copied to other machines via a network - connection. - */ - SDL_WINRT_PATH_ROAMING_FOLDER, - - /** The app's temporary data store. Unsupported on Windows Phone. - Files written here may be deleted at any time. */ - SDL_WINRT_PATH_TEMP_FOLDER -} SDL_WinRT_Path; - - -/** - * WinRT Device Family - * - * \since This enum is available since SDL 3.0.0. - */ -typedef enum SDL_WinRT_DeviceFamily -{ - /** Unknown family */ - SDL_WINRT_DEVICEFAMILY_UNKNOWN, - - /** Desktop family*/ - SDL_WINRT_DEVICEFAMILY_DESKTOP, - - /** Mobile family (for example smartphone) */ - SDL_WINRT_DEVICEFAMILY_MOBILE, - - /** XBox family */ - SDL_WINRT_DEVICEFAMILY_XBOX, -} SDL_WinRT_DeviceFamily; - - -/** - * Retrieve a WinRT defined path on the local file system. - * - * Not all paths are available on all versions of Windows. This is especially - * true on Windows Phone. Check the documentation for the given SDL_WinRT_Path - * for more information on which path types are supported where. - * - * Documentation on most app-specific path types on WinRT can be found on - * MSDN, at the URL: - * - * https://msdn.microsoft.com/en-us/library/windows/apps/hh464917.aspx - * - * \param pathType the type of path to retrieve, one of SDL_WinRT_Path. - * \returns a UTF-8 string (8-bit, multi-byte) containing the path, or NULL if - * the path is not available for any reason; call SDL_GetError() for - * more information. - * - * \since This function is available since SDL 3.0.0. - */ -extern SDL_DECLSPEC const char * SDLCALL SDL_GetWinRTFSPath(SDL_WinRT_Path pathType); - -/** - * Detects the device family of WinRT platform at runtime. - * - * \returns a value from the SDL_WinRT_DeviceFamily enum. - * - * \since This function is available since SDL 3.0.0. - */ -extern SDL_DECLSPEC SDL_WinRT_DeviceFamily SDLCALL SDL_GetWinRTDeviceFamily(); - -#endif /* SDL_PLATFORM_WINRT */ - /** * Query if the current device is a tablet. * - * If SDL can't determine this, it will return SDL_FALSE. + * If SDL can't determine this, it will return false. * - * \returns SDL_TRUE if the device is a tablet, SDL_FALSE otherwise. + * \returns true if the device is a tablet, false otherwise. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_IsTablet(void); +extern SDL_DECLSPEC bool SDLCALL SDL_IsTablet(void); /* Functions used by iOS app delegates to notify SDL about state changes. */ @@ -794,12 +703,12 @@ typedef struct XUser *XUserHandle; * leak. * * \param outTaskQueue a pointer to be filled in with task queue handle. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetGDKTaskQueue(XTaskQueueHandle *outTaskQueue); +extern SDL_DECLSPEC bool SDLCALL SDL_GetGDKTaskQueue(XTaskQueueHandle *outTaskQueue); /** * Gets a reference to the default user handle for GDK. @@ -809,12 +718,12 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetGDKTaskQueue(XTaskQueueHandle *outTa * * \param outUserHandle a pointer to be filled in with the default user * handle. - * \returns SDL_TRUE if success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true if success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetGDKDefaultUser(XUserHandle *outUserHandle); +extern SDL_DECLSPEC bool SDLCALL SDL_GetGDKDefaultUser(XUserHandle *outUserHandle); #endif diff --git a/include/SDL3/SDL_test_assert.h b/include/SDL3/SDL_test_assert.h index 64a149d6..4d857b2a 100644 --- a/include/SDL3/SDL_test_assert.h +++ b/include/SDL3/SDL_test_assert.h @@ -54,7 +54,7 @@ extern "C" { * \param assertCondition Evaluated condition or variable to assert; fail (==0) or pass (!=0). * \param assertDescription Message to log with the assert describing it. */ -void SDLTest_Assert(int assertCondition, SDL_PRINTF_FORMAT_STRING const char *assertDescription, ...) SDL_PRINTF_VARARG_FUNC(2); +void SDLCALL SDLTest_Assert(int assertCondition, SDL_PRINTF_FORMAT_STRING const char *assertDescription, ...) SDL_PRINTF_VARARG_FUNC(2); /* * Assert for test cases that logs but does not break execution flow on failures. Updates assertion counters. @@ -64,32 +64,31 @@ void SDLTest_Assert(int assertCondition, SDL_PRINTF_FORMAT_STRING const char *as * * \returns the assertCondition so it can be used to externally to break execution flow if desired. */ -int SDLTest_AssertCheck(int assertCondition, SDL_PRINTF_FORMAT_STRING const char *assertDescription, ...) SDL_PRINTF_VARARG_FUNC(2); +int SDLCALL SDLTest_AssertCheck(int assertCondition, SDL_PRINTF_FORMAT_STRING const char *assertDescription, ...) SDL_PRINTF_VARARG_FUNC(2); /* * Explicitly pass without checking an assertion condition. Updates assertion counter. * * \param assertDescription Message to log with the assert describing it. */ -void SDLTest_AssertPass(SDL_PRINTF_FORMAT_STRING const char *assertDescription, ...) SDL_PRINTF_VARARG_FUNC(1); +void SDLCALL SDLTest_AssertPass(SDL_PRINTF_FORMAT_STRING const char *assertDescription, ...) SDL_PRINTF_VARARG_FUNC(1); /* * Resets the assert summary counters to zero. */ -void SDLTest_ResetAssertSummary(void); +void SDLCALL SDLTest_ResetAssertSummary(void); /* * Logs summary of all assertions (total, pass, fail) since last reset as INFO or ERROR. */ -void SDLTest_LogAssertSummary(void); - +void SDLCALL SDLTest_LogAssertSummary(void); /* * Converts the current assert summary state to a test result. * * \returns TEST_RESULT_PASSED, TEST_RESULT_FAILED, or TEST_RESULT_NO_ASSERT */ -int SDLTest_AssertSummaryToTestResult(void); +int SDLCALL SDLTest_AssertSummaryToTestResult(void); #ifdef __cplusplus } diff --git a/include/SDL3/SDL_test_common.h b/include/SDL3/SDL_test_common.h index 8bef9295..69f63765 100644 --- a/include/SDL3/SDL_test_common.h +++ b/include/SDL3/SDL_test_common.h @@ -53,6 +53,27 @@ typedef Uint32 SDLTest_VerboseFlags; #define VERBOSE_AUDIO 0x00000010 #define VERBOSE_MOTION 0x00000020 +/* !< Function pointer parsing one argument at argv[index], returning the number of parsed arguments, + * or a negative value when the argument is invalid */ +typedef int (SDLCALL *SDLTest_ParseArgumentsFp)(void *data, char **argv, int index); + +/* !< Finalize the argument parser. */ +typedef void (SDLCALL *SDLTest_FinalizeArgumentParserFp)(void *arg); + +typedef struct SDLTest_ArgumentParser +{ + /* !< Parse an argument. */ + SDLTest_ParseArgumentsFp parse_arguments; + /* !< Finalize this argument parser. Called once before parsing the first argument. */ + SDLTest_FinalizeArgumentParserFp finalize; + /* !< Null-terminated array of arguments. Printed when running with --help. */ + const char **usage; + /* !< User data, passed to all callbacks. */ + void *data; + /* !< Next argument parser. */ + struct SDLTest_ArgumentParser *next; +} SDLTest_ArgumentParser; + typedef struct { /* SDL init flags */ @@ -67,7 +88,7 @@ typedef struct const char *window_title; const char *window_icon; SDL_WindowFlags window_flags; - SDL_bool flash_on_focus_loss; + bool flash_on_focus_loss; int window_x; int window_y; int window_w; @@ -80,14 +101,14 @@ typedef struct float window_max_aspect; int logical_w; int logical_h; - SDL_bool auto_scale_content; + bool auto_scale_content; SDL_RendererLogicalPresentation logical_presentation; SDL_ScaleMode logical_scale_mode; float scale; int depth; float refresh_rate; - SDL_bool fill_usable_bounds; - SDL_bool fullscreen_exclusive; + bool fill_usable_bounds; + bool fullscreen_exclusive; SDL_DisplayMode fullscreen_mode; int num_windows; SDL_Window **windows; @@ -96,7 +117,7 @@ typedef struct /* Renderer info */ const char *renderdriver; int render_vsync; - SDL_bool skip_renderer; + bool skip_renderer; SDL_Renderer **renderers; SDL_Texture **targets; @@ -132,8 +153,14 @@ typedef struct /* Mouse info */ SDL_Rect confine; - SDL_bool hide_cursor; + bool hide_cursor; + /* Options info */ + SDLTest_ArgumentParser common_argparser; + SDLTest_ArgumentParser video_argparser; + SDLTest_ArgumentParser audio_argparser; + + SDLTest_ArgumentParser *argparser; } SDLTest_CommonState; #include @@ -152,7 +179,7 @@ extern "C" { * * \returns a newly allocated common state object. */ -SDLTest_CommonState *SDLTest_CommonCreateState(char **argv, SDL_InitFlags flags); +SDLTest_CommonState *SDLCALL SDLTest_CommonCreateState(char **argv, SDL_InitFlags flags); /** * Free the common state object. @@ -161,7 +188,7 @@ SDLTest_CommonState *SDLTest_CommonCreateState(char **argv, SDL_InitFlags flags) * * \param state The common state object to destroy */ -void SDLTest_CommonDestroyState(SDLTest_CommonState *state); +void SDLCALL SDLTest_CommonDestroyState(SDLTest_CommonState *state); /** * Process one common argument. @@ -171,7 +198,7 @@ void SDLTest_CommonDestroyState(SDLTest_CommonState *state); * * \returns the number of arguments processed (i.e. 1 for --fullscreen, 2 for --video [videodriver], or -1 on error. */ -int SDLTest_CommonArg(SDLTest_CommonState *state, int index); +int SDLCALL SDLTest_CommonArg(SDLTest_CommonState *state, int index); /** @@ -186,16 +213,16 @@ int SDLTest_CommonArg(SDLTest_CommonState *state, int index); * \param argv0 argv[0], as passed to main/SDL_main. * \param options an array of strings for application specific options. The last element of the array should be NULL. */ -void SDLTest_CommonLogUsage(SDLTest_CommonState *state, const char *argv0, const char **options); +void SDLCALL SDLTest_CommonLogUsage(SDLTest_CommonState *state, const char *argv0, const char **options); /** * Open test window. * * \param state The common state describing the test window to create. * - * \returns SDL_TRUE if initialization succeeded, false otherwise + * \returns true if initialization succeeded, false otherwise */ -SDL_bool SDLTest_CommonInit(SDLTest_CommonState *state); +bool SDLCALL SDLTest_CommonInit(SDLTest_CommonState *state); /** * Easy argument handling when test app doesn't need any custom args. @@ -204,9 +231,9 @@ SDL_bool SDLTest_CommonInit(SDLTest_CommonState *state); * \param argc argc, as supplied to SDL_main * \param argv argv, as supplied to SDL_main * - * \returns SDL_FALSE if app should quit, true otherwise. + * \returns false if app should quit, true otherwise. */ -SDL_bool SDLTest_CommonDefaultArgs(SDLTest_CommonState *state, const int argc, char **argv); +bool SDLCALL SDLTest_CommonDefaultArgs(SDLTest_CommonState *state, const int argc, char **argv); /** * Print the details of an event. @@ -215,7 +242,7 @@ SDL_bool SDLTest_CommonDefaultArgs(SDLTest_CommonState *state, const int argc, c * * \param event The event to print. */ -void SDLTest_PrintEvent(const SDL_Event *event); +void SDLCALL SDLTest_PrintEvent(const SDL_Event *event); /** * Common event handler for test windows if you use a standard SDL_main. @@ -224,7 +251,7 @@ void SDLTest_PrintEvent(const SDL_Event *event); * \param event The event to handle. * \param done Flag indicating we are done. */ -void SDLTest_CommonEvent(SDLTest_CommonState *state, SDL_Event *event, int *done); +void SDLCALL SDLTest_CommonEvent(SDLTest_CommonState *state, SDL_Event *event, int *done); /** * Common event handler for test windows if you use SDL_AppEvent. @@ -235,7 +262,7 @@ void SDLTest_CommonEvent(SDLTest_CommonState *state, SDL_Event *event, int *done * \param event The event to handle. * \returns Value suitable for returning from SDL_AppEvent(). */ -SDL_AppResult SDLTest_CommonEventMainCallbacks(SDLTest_CommonState *state, const SDL_Event *event); +SDL_AppResult SDLCALL SDLTest_CommonEventMainCallbacks(SDLTest_CommonState *state, const SDL_Event *event); /** * Close test window. @@ -243,7 +270,7 @@ SDL_AppResult SDLTest_CommonEventMainCallbacks(SDLTest_CommonState *state, const * \param state The common state used to create test window. * */ -void SDLTest_CommonQuit(SDLTest_CommonState *state); +void SDLCALL SDLTest_CommonQuit(SDLTest_CommonState *state); /** * Draws various window information (position, size, etc.) to the renderer. @@ -253,7 +280,7 @@ void SDLTest_CommonQuit(SDLTest_CommonState *state); * \param usedHeight Returns the height used, so the caller can draw more below. * */ -void SDLTest_CommonDrawWindowInfo(SDL_Renderer *renderer, SDL_Window *window, float *usedHeight); +void SDLCALL SDLTest_CommonDrawWindowInfo(SDL_Renderer *renderer, SDL_Window *window, float *usedHeight); /* Ends C function definitions when using C++ */ #ifdef __cplusplus diff --git a/include/SDL3/SDL_test_compare.h b/include/SDL3/SDL_test_compare.h index 2aa84e00..a7e18e3c 100644 --- a/include/SDL3/SDL_test_compare.h +++ b/include/SDL3/SDL_test_compare.h @@ -53,7 +53,7 @@ extern "C" { * * \returns 0 if comparison succeeded, >0 (=number of pixels for which the comparison failed) if comparison failed, -1 if any of the surfaces were NULL, -2 if the surface sizes differ. */ -int SDLTest_CompareSurfaces(SDL_Surface *surface, SDL_Surface *referenceSurface, int allowable_error); +int SDLCALL SDLTest_CompareSurfaces(SDL_Surface *surface, SDL_Surface *referenceSurface, int allowable_error); /** * Compares 2 memory blocks for equality @@ -67,7 +67,7 @@ int SDLTest_CompareSurfaces(SDL_Surface *surface, SDL_Surface *referenceSurface, * * \since This function is available since SDL 3.0.0. */ -extern int SDLTest_CompareMemory(const void *actual, size_t size_actual, const void *reference, size_t size_reference); +int SDLCALL SDLTest_CompareMemory(const void *actual, size_t size_actual, const void *reference, size_t size_reference); /* Ends C function definitions when using C++ */ #ifdef __cplusplus diff --git a/include/SDL3/SDL_test_crc32.h b/include/SDL3/SDL_test_crc32.h index e6316bcf..49c4cf21 100644 --- a/include/SDL3/SDL_test_crc32.h +++ b/include/SDL3/SDL_test_crc32.h @@ -40,7 +40,6 @@ extern "C" { #endif - /* ------------ Definitions --------- */ /* Definition shared by all CRC routines */ @@ -74,11 +73,11 @@ extern "C" { * * \param crcContext pointer to context variable * - * \returns 0 for OK, -1 on error + * \returns true on success or false on failure; call SDL_GetError() + * for more information. * */ - int SDLTest_Crc32Init(SDLTest_Crc32Context *crcContext); - +bool SDLCALL SDLTest_Crc32Init(SDLTest_Crc32Context *crcContext); /* * calculate a crc32 from a data block @@ -88,28 +87,28 @@ extern "C" { * \param inLen length of input buffer * \param crc32 pointer to Uint32 to store the final CRC into * - * \returns 0 for OK, -1 on error + * \returns true on success or false on failure; call SDL_GetError() + * for more information. * */ -int SDLTest_Crc32Calc(SDLTest_Crc32Context *crcContext, CrcUint8 *inBuf, CrcUint32 inLen, CrcUint32 *crc32); +bool SDLCALL SDLTest_Crc32Calc(SDLTest_Crc32Context *crcContext, CrcUint8 *inBuf, CrcUint32 inLen, CrcUint32 *crc32); /* Same routine broken down into three steps */ -int SDLTest_Crc32CalcStart(SDLTest_Crc32Context *crcContext, CrcUint32 *crc32); -int SDLTest_Crc32CalcEnd(SDLTest_Crc32Context *crcContext, CrcUint32 *crc32); -int SDLTest_Crc32CalcBuffer(SDLTest_Crc32Context *crcContext, CrcUint8 *inBuf, CrcUint32 inLen, CrcUint32 *crc32); - +bool SDLCALL SDLTest_Crc32CalcStart(SDLTest_Crc32Context *crcContext, CrcUint32 *crc32); +bool SDLCALL SDLTest_Crc32CalcEnd(SDLTest_Crc32Context *crcContext, CrcUint32 *crc32); +bool SDLCALL SDLTest_Crc32CalcBuffer(SDLTest_Crc32Context *crcContext, CrcUint8 *inBuf, CrcUint32 inLen, CrcUint32 *crc32); /* * clean up CRC context * * \param crcContext pointer to context variable * - * \returns 0 for OK, -1 on error + * \returns true on success or false on failure; call SDL_GetError() + * for more information. * */ -int SDLTest_Crc32Done(SDLTest_Crc32Context *crcContext); - +bool SDLCALL SDLTest_Crc32Done(SDLTest_Crc32Context *crcContext); /* Ends C function definitions when using C++ */ #ifdef __cplusplus diff --git a/include/SDL3/SDL_test_font.h b/include/SDL3/SDL_test_font.h index 8a65fe94..99308abb 100644 --- a/include/SDL3/SDL_test_font.h +++ b/include/SDL3/SDL_test_font.h @@ -54,9 +54,9 @@ extern int FONT_CHARACTER_SIZE; * \param y The Y coordinate of the upper left corner of the character. * \param c The character to draw. * - * \returns SDL_TRUE on success, SDL_FALSE on failure. + * \returns true on success, false on failure. */ -SDL_bool SDLTest_DrawCharacter(SDL_Renderer *renderer, float x, float y, Uint32 c); +bool SDLCALL SDLTest_DrawCharacter(SDL_Renderer *renderer, float x, float y, Uint32 c); /* * Draw a UTF-8 string in the currently set font. @@ -68,9 +68,9 @@ SDL_bool SDLTest_DrawCharacter(SDL_Renderer *renderer, float x, float y, Uint32 * \param y The Y coordinate of the upper left corner of the string. * \param s The string to draw. * - * \returns SDL_TRUE on success, SDL_FALSE on failure. + * \returns true on success, false on failure. */ -SDL_bool SDLTest_DrawString(SDL_Renderer *renderer, float x, float y, const char *s); +bool SDLCALL SDLTest_DrawString(SDL_Renderer *renderer, float x, float y, const char *s); /* * Data used for multi-line text output @@ -95,7 +95,7 @@ typedef struct SDLTest_TextWindow * * \since This function is available since SDL 3.0.0. */ -SDLTest_TextWindow *SDLTest_TextWindowCreate(float x, float y, float w, float h); +SDLTest_TextWindow * SDLCALL SDLTest_TextWindowCreate(float x, float y, float w, float h); /* * Display a multi-line text output window @@ -107,7 +107,7 @@ SDLTest_TextWindow *SDLTest_TextWindowCreate(float x, float y, float w, float h) * * \since This function is available since SDL 3.0.0. */ -void SDLTest_TextWindowDisplay(SDLTest_TextWindow *textwin, SDL_Renderer *renderer); +void SDLCALL SDLTest_TextWindowDisplay(SDLTest_TextWindow *textwin, SDL_Renderer *renderer); /* * Add text to a multi-line text output window @@ -122,7 +122,7 @@ void SDLTest_TextWindowDisplay(SDLTest_TextWindow *textwin, SDL_Renderer *render * * \since This function is available since SDL 3.0.0. */ -void SDLTest_TextWindowAddText(SDLTest_TextWindow *textwin, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2); +void SDLCALL SDLTest_TextWindowAddText(SDLTest_TextWindow *textwin, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(2); /* * Add text to a multi-line text output window @@ -137,7 +137,7 @@ void SDLTest_TextWindowAddText(SDLTest_TextWindow *textwin, SDL_PRINTF_FORMAT_ST * * \since This function is available since SDL 3.0.0. */ -void SDLTest_TextWindowAddTextWithLength(SDLTest_TextWindow *textwin, const char *text, size_t len); +void SDLCALL SDLTest_TextWindowAddTextWithLength(SDLTest_TextWindow *textwin, const char *text, size_t len); /* * Clear the text in a multi-line text output window @@ -146,7 +146,7 @@ void SDLTest_TextWindowAddTextWithLength(SDLTest_TextWindow *textwin, const char * * \since This function is available since SDL 3.0.0. */ -void SDLTest_TextWindowClear(SDLTest_TextWindow *textwin); +void SDLCALL SDLTest_TextWindowClear(SDLTest_TextWindow *textwin); /* * Free the storage associated with a multi-line text output window @@ -155,12 +155,12 @@ void SDLTest_TextWindowClear(SDLTest_TextWindow *textwin); * * \since This function is available since SDL 3.0.0. */ -void SDLTest_TextWindowDestroy(SDLTest_TextWindow *textwin); +void SDLCALL SDLTest_TextWindowDestroy(SDLTest_TextWindow *textwin); /* * Cleanup textures used by font drawing functions. */ -void SDLTest_CleanupTextDrawing(void); +void SDLCALL SDLTest_CleanupTextDrawing(void); /* Ends C function definitions when using C++ */ #ifdef __cplusplus diff --git a/include/SDL3/SDL_test_fuzzer.h b/include/SDL3/SDL_test_fuzzer.h index a935de21..4fdfd498 100644 --- a/include/SDL3/SDL_test_fuzzer.h +++ b/include/SDL3/SDL_test_fuzzer.h @@ -42,12 +42,10 @@ extern "C" { #endif - /* Based on GSOC code by Markus Kauppila */ - /** * Note: The fuzzer implementation uses a static instance of random context * internally which makes it thread-UNsafe. @@ -59,53 +57,49 @@ extern "C" { * \param execKey Execution "Key" that initializes the random number generator uniquely for the test. * */ -void SDLTest_FuzzerInit(Uint64 execKey); - +void SDLCALL SDLTest_FuzzerInit(Uint64 execKey); /** * Returns a random Uint8 * * \returns a generated integer */ -Uint8 SDLTest_RandomUint8(void); +Uint8 SDLCALL SDLTest_RandomUint8(void); /** * Returns a random Sint8 * * \returns a generated signed integer */ -Sint8 SDLTest_RandomSint8(void); - +Sint8 SDLCALL SDLTest_RandomSint8(void); /** * Returns a random Uint16 * * \returns a generated integer */ -Uint16 SDLTest_RandomUint16(void); +Uint16 SDLCALL SDLTest_RandomUint16(void); /** * Returns a random Sint16 * * \returns a generated signed integer */ -Sint16 SDLTest_RandomSint16(void); - +Sint16 SDLCALL SDLTest_RandomSint16(void); /** * Returns a random integer * * \returns a generated integer */ -Sint32 SDLTest_RandomSint32(void); - +Sint32 SDLCALL SDLTest_RandomSint32(void); /** * Returns a random positive integer * * \returns a generated integer */ -Uint32 SDLTest_RandomUint32(void); +Uint32 SDLCALL SDLTest_RandomUint32(void); /** * Returns random Uint64. @@ -114,35 +108,34 @@ Uint32 SDLTest_RandomUint32(void); */ Uint64 SDLTest_RandomUint64(void); - /** * Returns random Sint64. * * \returns a generated signed integer */ -Sint64 SDLTest_RandomSint64(void); +Sint64 SDLCALL SDLTest_RandomSint64(void); /** * \returns a random float in range [0.0 - 1.0] */ -float SDLTest_RandomUnitFloat(void); +float SDLCALL SDLTest_RandomUnitFloat(void); /** * \returns a random double in range [0.0 - 1.0] */ -double SDLTest_RandomUnitDouble(void); +double SDLCALL SDLTest_RandomUnitDouble(void); /** * \returns a random float. * */ -float SDLTest_RandomFloat(void); +float SDLCALL SDLTest_RandomFloat(void); /** * \returns a random double. * */ -double SDLTest_RandomDouble(void); +double SDLCALL SDLTest_RandomDouble(void); /** * Returns a random boundary value for Uint8 within the given boundaries. @@ -152,10 +145,10 @@ double SDLTest_RandomDouble(void); * If boundary1 > boundary2, the values are swapped * * Usage examples: - * RandomUint8BoundaryValue(10, 20, SDL_TRUE) returns 10, 11, 19 or 20 - * RandomUint8BoundaryValue(1, 20, SDL_FALSE) returns 0 or 21 - * RandomUint8BoundaryValue(0, 99, SDL_FALSE) returns 100 - * RandomUint8BoundaryValue(0, 255, SDL_FALSE) returns 0 (error set) + * RandomUint8BoundaryValue(10, 20, true) returns 10, 11, 19 or 20 + * RandomUint8BoundaryValue(1, 20, false) returns 0 or 21 + * RandomUint8BoundaryValue(0, 99, false) returns 100 + * RandomUint8BoundaryValue(0, 255, false) returns 0 (error set) * * \param boundary1 Lower boundary limit * \param boundary2 Upper boundary limit @@ -163,7 +156,7 @@ double SDLTest_RandomDouble(void); * * \returns a random boundary value for the given range and domain or 0 with error set */ -Uint8 SDLTest_RandomUint8BoundaryValue(Uint8 boundary1, Uint8 boundary2, SDL_bool validDomain); +Uint8 SDLCALL SDLTest_RandomUint8BoundaryValue(Uint8 boundary1, Uint8 boundary2, bool validDomain); /** * Returns a random boundary value for Uint16 within the given boundaries. @@ -173,10 +166,10 @@ Uint8 SDLTest_RandomUint8BoundaryValue(Uint8 boundary1, Uint8 boundary2, SDL_boo * If boundary1 > boundary2, the values are swapped * * Usage examples: - * RandomUint16BoundaryValue(10, 20, SDL_TRUE) returns 10, 11, 19 or 20 - * RandomUint16BoundaryValue(1, 20, SDL_FALSE) returns 0 or 21 - * RandomUint16BoundaryValue(0, 99, SDL_FALSE) returns 100 - * RandomUint16BoundaryValue(0, 0xFFFF, SDL_FALSE) returns 0 (error set) + * RandomUint16BoundaryValue(10, 20, true) returns 10, 11, 19 or 20 + * RandomUint16BoundaryValue(1, 20, false) returns 0 or 21 + * RandomUint16BoundaryValue(0, 99, false) returns 100 + * RandomUint16BoundaryValue(0, 0xFFFF, false) returns 0 (error set) * * \param boundary1 Lower boundary limit * \param boundary2 Upper boundary limit @@ -184,7 +177,7 @@ Uint8 SDLTest_RandomUint8BoundaryValue(Uint8 boundary1, Uint8 boundary2, SDL_boo * * \returns a random boundary value for the given range and domain or 0 with error set */ -Uint16 SDLTest_RandomUint16BoundaryValue(Uint16 boundary1, Uint16 boundary2, SDL_bool validDomain); +Uint16 SDLCALL SDLTest_RandomUint16BoundaryValue(Uint16 boundary1, Uint16 boundary2, bool validDomain); /** * Returns a random boundary value for Uint32 within the given boundaries. @@ -194,10 +187,10 @@ Uint16 SDLTest_RandomUint16BoundaryValue(Uint16 boundary1, Uint16 boundary2, SDL * If boundary1 > boundary2, the values are swapped * * Usage examples: - * RandomUint32BoundaryValue(10, 20, SDL_TRUE) returns 10, 11, 19 or 20 - * RandomUint32BoundaryValue(1, 20, SDL_FALSE) returns 0 or 21 - * RandomUint32BoundaryValue(0, 99, SDL_FALSE) returns 100 - * RandomUint32BoundaryValue(0, 0xFFFFFFFF, SDL_FALSE) returns 0 (with error set) + * RandomUint32BoundaryValue(10, 20, true) returns 10, 11, 19 or 20 + * RandomUint32BoundaryValue(1, 20, false) returns 0 or 21 + * RandomUint32BoundaryValue(0, 99, false) returns 100 + * RandomUint32BoundaryValue(0, 0xFFFFFFFF, false) returns 0 (with error set) * * \param boundary1 Lower boundary limit * \param boundary2 Upper boundary limit @@ -205,7 +198,7 @@ Uint16 SDLTest_RandomUint16BoundaryValue(Uint16 boundary1, Uint16 boundary2, SDL * * \returns a random boundary value for the given range and domain or 0 with error set */ -Uint32 SDLTest_RandomUint32BoundaryValue(Uint32 boundary1, Uint32 boundary2, SDL_bool validDomain); +Uint32 SDLCALL SDLTest_RandomUint32BoundaryValue(Uint32 boundary1, Uint32 boundary2, bool validDomain); /** * Returns a random boundary value for Uint64 within the given boundaries. @@ -215,10 +208,10 @@ Uint32 SDLTest_RandomUint32BoundaryValue(Uint32 boundary1, Uint32 boundary2, SDL * If boundary1 > boundary2, the values are swapped * * Usage examples: - * RandomUint64BoundaryValue(10, 20, SDL_TRUE) returns 10, 11, 19 or 20 - * RandomUint64BoundaryValue(1, 20, SDL_FALSE) returns 0 or 21 - * RandomUint64BoundaryValue(0, 99, SDL_FALSE) returns 100 - * RandomUint64BoundaryValue(0, 0xFFFFFFFFFFFFFFFF, SDL_FALSE) returns 0 (with error set) + * RandomUint64BoundaryValue(10, 20, true) returns 10, 11, 19 or 20 + * RandomUint64BoundaryValue(1, 20, false) returns 0 or 21 + * RandomUint64BoundaryValue(0, 99, false) returns 100 + * RandomUint64BoundaryValue(0, 0xFFFFFFFFFFFFFFFF, false) returns 0 (with error set) * * \param boundary1 Lower boundary limit * \param boundary2 Upper boundary limit @@ -226,7 +219,7 @@ Uint32 SDLTest_RandomUint32BoundaryValue(Uint32 boundary1, Uint32 boundary2, SDL * * \returns a random boundary value for the given range and domain or 0 with error set */ -Uint64 SDLTest_RandomUint64BoundaryValue(Uint64 boundary1, Uint64 boundary2, SDL_bool validDomain); +Uint64 SDLCALL SDLTest_RandomUint64BoundaryValue(Uint64 boundary1, Uint64 boundary2, bool validDomain); /** * Returns a random boundary value for Sint8 within the given boundaries. @@ -236,10 +229,10 @@ Uint64 SDLTest_RandomUint64BoundaryValue(Uint64 boundary1, Uint64 boundary2, SDL * If boundary1 > boundary2, the values are swapped * * Usage examples: - * RandomSint8BoundaryValue(-10, 20, SDL_TRUE) returns -11, -10, 19 or 20 - * RandomSint8BoundaryValue(-100, -10, SDL_FALSE) returns -101 or -9 - * RandomSint8BoundaryValue(SINT8_MIN, 99, SDL_FALSE) returns 100 - * RandomSint8BoundaryValue(SINT8_MIN, SINT8_MAX, SDL_FALSE) returns SINT8_MIN (== error value) with error set + * RandomSint8BoundaryValue(-10, 20, true) returns -11, -10, 19 or 20 + * RandomSint8BoundaryValue(-100, -10, false) returns -101 or -9 + * RandomSint8BoundaryValue(SINT8_MIN, 99, false) returns 100 + * RandomSint8BoundaryValue(SINT8_MIN, SINT8_MAX, false) returns SINT8_MIN (== error value) with error set * * \param boundary1 Lower boundary limit * \param boundary2 Upper boundary limit @@ -247,8 +240,7 @@ Uint64 SDLTest_RandomUint64BoundaryValue(Uint64 boundary1, Uint64 boundary2, SDL * * \returns a random boundary value for the given range and domain or SINT8_MIN with error set */ -Sint8 SDLTest_RandomSint8BoundaryValue(Sint8 boundary1, Sint8 boundary2, SDL_bool validDomain); - +Sint8 SDLCALL SDLTest_RandomSint8BoundaryValue(Sint8 boundary1, Sint8 boundary2, bool validDomain); /** * Returns a random boundary value for Sint16 within the given boundaries. @@ -258,10 +250,10 @@ Sint8 SDLTest_RandomSint8BoundaryValue(Sint8 boundary1, Sint8 boundary2, SDL_boo * If boundary1 > boundary2, the values are swapped * * Usage examples: - * RandomSint16BoundaryValue(-10, 20, SDL_TRUE) returns -11, -10, 19 or 20 - * RandomSint16BoundaryValue(-100, -10, SDL_FALSE) returns -101 or -9 - * RandomSint16BoundaryValue(SINT16_MIN, 99, SDL_FALSE) returns 100 - * RandomSint16BoundaryValue(SINT16_MIN, SINT16_MAX, SDL_FALSE) returns SINT16_MIN (== error value) with error set + * RandomSint16BoundaryValue(-10, 20, true) returns -11, -10, 19 or 20 + * RandomSint16BoundaryValue(-100, -10, false) returns -101 or -9 + * RandomSint16BoundaryValue(SINT16_MIN, 99, false) returns 100 + * RandomSint16BoundaryValue(SINT16_MIN, SINT16_MAX, false) returns SINT16_MIN (== error value) with error set * * \param boundary1 Lower boundary limit * \param boundary2 Upper boundary limit @@ -269,7 +261,7 @@ Sint8 SDLTest_RandomSint8BoundaryValue(Sint8 boundary1, Sint8 boundary2, SDL_boo * * \returns a random boundary value for the given range and domain or SINT16_MIN with error set */ -Sint16 SDLTest_RandomSint16BoundaryValue(Sint16 boundary1, Sint16 boundary2, SDL_bool validDomain); +Sint16 SDLCALL SDLTest_RandomSint16BoundaryValue(Sint16 boundary1, Sint16 boundary2, bool validDomain); /** * Returns a random boundary value for Sint32 within the given boundaries. @@ -279,10 +271,10 @@ Sint16 SDLTest_RandomSint16BoundaryValue(Sint16 boundary1, Sint16 boundary2, SDL * If boundary1 > boundary2, the values are swapped * * Usage examples: - * RandomSint32BoundaryValue(-10, 20, SDL_TRUE) returns -11, -10, 19 or 20 - * RandomSint32BoundaryValue(-100, -10, SDL_FALSE) returns -101 or -9 - * RandomSint32BoundaryValue(SINT32_MIN, 99, SDL_FALSE) returns 100 - * RandomSint32BoundaryValue(SINT32_MIN, SINT32_MAX, SDL_FALSE) returns SINT32_MIN (== error value) + * RandomSint32BoundaryValue(-10, 20, true) returns -11, -10, 19 or 20 + * RandomSint32BoundaryValue(-100, -10, false) returns -101 or -9 + * RandomSint32BoundaryValue(SINT32_MIN, 99, false) returns 100 + * RandomSint32BoundaryValue(SINT32_MIN, SINT32_MAX, false) returns SINT32_MIN (== error value) * * \param boundary1 Lower boundary limit * \param boundary2 Upper boundary limit @@ -290,7 +282,7 @@ Sint16 SDLTest_RandomSint16BoundaryValue(Sint16 boundary1, Sint16 boundary2, SDL * * \returns a random boundary value for the given range and domain or SINT32_MIN with error set */ -Sint32 SDLTest_RandomSint32BoundaryValue(Sint32 boundary1, Sint32 boundary2, SDL_bool validDomain); +Sint32 SDLCALL SDLTest_RandomSint32BoundaryValue(Sint32 boundary1, Sint32 boundary2, bool validDomain); /** * Returns a random boundary value for Sint64 within the given boundaries. @@ -300,10 +292,10 @@ Sint32 SDLTest_RandomSint32BoundaryValue(Sint32 boundary1, Sint32 boundary2, SDL * If boundary1 > boundary2, the values are swapped * * Usage examples: - * RandomSint64BoundaryValue(-10, 20, SDL_TRUE) returns -11, -10, 19 or 20 - * RandomSint64BoundaryValue(-100, -10, SDL_FALSE) returns -101 or -9 - * RandomSint64BoundaryValue(SINT64_MIN, 99, SDL_FALSE) returns 100 - * RandomSint64BoundaryValue(SINT64_MIN, SINT64_MAX, SDL_FALSE) returns SINT64_MIN (== error value) and error set + * RandomSint64BoundaryValue(-10, 20, true) returns -11, -10, 19 or 20 + * RandomSint64BoundaryValue(-100, -10, false) returns -101 or -9 + * RandomSint64BoundaryValue(SINT64_MIN, 99, false) returns 100 + * RandomSint64BoundaryValue(SINT64_MIN, SINT64_MAX, false) returns SINT64_MIN (== error value) and error set * * \param boundary1 Lower boundary limit * \param boundary2 Upper boundary limit @@ -311,8 +303,7 @@ Sint32 SDLTest_RandomSint32BoundaryValue(Sint32 boundary1, Sint32 boundary2, SDL * * \returns a random boundary value for the given range and domain or SINT64_MIN with error set */ -Sint64 SDLTest_RandomSint64BoundaryValue(Sint64 boundary1, Sint64 boundary2, SDL_bool validDomain); - +Sint64 SDLCALL SDLTest_RandomSint64BoundaryValue(Sint64 boundary1, Sint64 boundary2, bool validDomain); /** * Returns integer in range [min, max] (inclusive). @@ -325,8 +316,7 @@ Sint64 SDLTest_RandomSint64BoundaryValue(Sint64 boundary1, Sint64 boundary2, SDL * * \returns a generated random integer in range */ -Sint32 SDLTest_RandomIntegerInRange(Sint32 min, Sint32 max); - +Sint32 SDLCALL SDLTest_RandomIntegerInRange(Sint32 min, Sint32 max); /** * Generates random null-terminated string. The minimum length for @@ -337,8 +327,7 @@ Sint32 SDLTest_RandomIntegerInRange(Sint32 min, Sint32 max); * * \returns a newly allocated random string; or NULL if length was invalid or string could not be allocated. */ -char *SDLTest_RandomAsciiString(void); - +char * SDLCALL SDLTest_RandomAsciiString(void); /** * Generates random null-terminated string. The maximum length for @@ -351,8 +340,7 @@ char *SDLTest_RandomAsciiString(void); * * \returns a newly allocated random string; or NULL if maxLength was invalid or string could not be allocated. */ -char *SDLTest_RandomAsciiStringWithMaximumLength(int maxLength); - +char * SDLCALL SDLTest_RandomAsciiStringWithMaximumLength(int maxLength); /** * Generates random null-terminated string. The length for @@ -365,14 +353,14 @@ char *SDLTest_RandomAsciiStringWithMaximumLength(int maxLength); * * \returns a newly allocated random string; or NULL if size was invalid or string could not be allocated. */ -char *SDLTest_RandomAsciiStringOfSize(int size); +char * SDLCALL SDLTest_RandomAsciiStringOfSize(int size); /** * Get the invocation count for the fuzzer since last ...FuzzerInit. * * \returns the invocation count. */ -int SDLTest_GetFuzzerInvocationCount(void); +int SDLCALL SDLTest_GetFuzzerInvocationCount(void); /* Ends C function definitions when using C++ */ #ifdef __cplusplus diff --git a/include/SDL3/SDL_test_harness.h b/include/SDL3/SDL_test_harness.h index 30238890..cea0db46 100644 --- a/include/SDL3/SDL_test_harness.h +++ b/include/SDL3/SDL_test_harness.h @@ -37,6 +37,7 @@ #define SDL_test_h_arness_h #include +#include /* SDLTest_CommonState */ #include /* Set up for C function definitions, even when using C++ */ @@ -44,7 +45,6 @@ extern "C" { #endif - /* ! Definitions for test case structures */ #define TEST_ENABLED 1 #define TEST_DISABLED 0 @@ -63,13 +63,13 @@ extern "C" { #define TEST_RESULT_SETUP_FAILURE 4 /* !< Function pointer to a test case setup function (run before every test) */ -typedef void (*SDLTest_TestCaseSetUpFp)(void *arg); +typedef void (SDLCALL *SDLTest_TestCaseSetUpFp)(void **arg); /* !< Function pointer to a test case function */ -typedef int (*SDLTest_TestCaseFp)(void *arg); +typedef int (SDLCALL *SDLTest_TestCaseFp)(void *arg); /* !< Function pointer to a test case teardown function (run after every test) */ -typedef void (*SDLTest_TestCaseTearDownFp)(void *arg); +typedef void (SDLCALL *SDLTest_TestCaseTearDownFp)(void *arg); /* * Holds information about a single test case. @@ -101,30 +101,48 @@ typedef struct SDLTest_TestSuiteReference { /* - * Generates a random run seed string for the harness. The generated seed will contain alphanumeric characters (0-9A-Z). + * Generates a random run seed string for the harness. The generated seed + * will contain alphanumeric characters (0-9A-Z). * - * Note: The returned string needs to be deallocated by the caller. + * \param buffer Buffer in which to generate the random seed. Must have a capacity of at least length + 1 characters. + * \param length Number of alphanumeric characters to write to buffer, must be >0 * - * \param length The length of the seed string to generate - * - * \returns the generated seed string + * \returns A null-terminated seed string and equal to the in put buffer on success, NULL on failure */ -char *SDLTest_GenerateRunSeed(const int length); +char * SDLCALL SDLTest_GenerateRunSeed(char *buffer, int length); /* - * Execute a test suite using the given run seed and execution key. + * Holds information about the execution of test suites. + * */ +typedef struct SDLTest_TestSuiteRunner SDLTest_TestSuiteRunner; + +/* + * Create a new test suite runner, that will execute the given test suites. + * It will register the harness cli arguments to the common SDL state. * - * \param testSuites Suites containing the test case. - * \param userRunSeed Custom run seed provided by user, or NULL to autogenerate one. - * \param userExecKey Custom execution key provided by user, or 0 to autogenerate one. - * \param filter Filter specification. NULL disables. Case sensitive. - * \param testIterations Number of iterations to run each test case. - * \param randomOrder allow to run suites and tests in random order when there is no filter + * \param state Common SDL state on which to register CLI arguments. + * \param testSuites NULL-terminated test suites containing test cases. * * \returns the test run result: 0 when all tests passed, 1 if any tests failed. */ -int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *userRunSeed, Uint64 userExecKey, const char *filter, int testIterations, SDL_bool randomOrder); +SDLTest_TestSuiteRunner * SDLCALL SDLTest_CreateTestSuiteRunner(SDLTest_CommonState *state, SDLTest_TestSuiteReference *testSuites[]); +/* + * Destroy a test suite runner. + * It will unregister the harness cli arguments to the common SDL state. + * + * \param runner The runner that should be destroyed. + */ +void SDLCALL SDLTest_DestroyTestSuiteRunner(SDLTest_TestSuiteRunner *runner); + +/* + * Execute a test suite, using the configured run seed, execution key, filter, etc. + * + * \param runner The runner that should be executed. + * + * \returns the test run result: 0 when all tests passed, 1 if any tests failed. + */ +int SDLCALL SDLTest_ExecuteTestSuiteRunner(SDLTest_TestSuiteRunner *runner); /* Ends C function definitions when using C++ */ #ifdef __cplusplus diff --git a/include/SDL3/SDL_test_log.h b/include/SDL3/SDL_test_log.h index d0aaf340..ff798d63 100644 --- a/include/SDL3/SDL_test_log.h +++ b/include/SDL3/SDL_test_log.h @@ -49,14 +49,24 @@ extern "C" { * * \param fmt Message to be logged */ -void SDLTest_Log(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(1); +void SDLCALL SDLTest_Log(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(1); + +/** + * Prints given prefix and buffer. + * Non-printible characters in the raw data are substituted by printible alternatives. + * + * \param prefix Prefix message. + * \param buffer Raw data to be escaped. + * \param size Number of bytes in buffer. + */ +void SDLCALL SDLTest_LogEscapedString(const char *prefix, const void *buffer, size_t size); /** * Prints given message with a timestamp in the TEST category and the ERROR priority. * * \param fmt Message to be logged */ -void SDLTest_LogError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(1); +void SDLCALL SDLTest_LogError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(1); /* Ends C function definitions when using C++ */ #ifdef __cplusplus diff --git a/include/SDL3/SDL_test_md5.h b/include/SDL3/SDL_test_md5.h index 81d601df..d751aab9 100644 --- a/include/SDL3/SDL_test_md5.h +++ b/include/SDL3/SDL_test_md5.h @@ -67,15 +67,15 @@ extern "C" { /* ------------ Definitions --------- */ /* typedef a 32-bit type */ - typedef Uint32 MD5UINT4; +typedef Uint32 MD5UINT4; /* Data structure for MD5 (Message-Digest) computation */ - typedef struct SDLTest_Md5Context { - MD5UINT4 i[2]; /* number of _bits_ handled mod 2^64 */ - MD5UINT4 buf[4]; /* scratch buffer */ - unsigned char in[64]; /* input buffer */ +typedef struct SDLTest_Md5Context { + MD5UINT4 i[2]; /* number of _bits_ handled mod 2^64 */ + MD5UINT4 buf[4]; /* scratch buffer */ + unsigned char in[64]; /* input buffer */ unsigned char digest[16]; /* actual digest after Md5Final call */ - } SDLTest_Md5Context; +} SDLTest_Md5Context; /* ---------- Function Prototypes ------------- */ @@ -88,8 +88,7 @@ extern "C" { * mdContext. Call before each new use of the context - * all fields are set to zero. */ - void SDLTest_Md5Init(SDLTest_Md5Context *mdContext); - +void SDLCALL SDLTest_Md5Init(SDLTest_Md5Context *mdContext); /** * update digest from variable length data @@ -101,12 +100,10 @@ extern "C" { * Note: The function updates the message-digest context to account * for the presence of each of the characters inBuf[0..inLen-1] * in the message whose digest is being computed. -*/ - - void SDLTest_Md5Update(SDLTest_Md5Context *mdContext, unsigned char *inBuf, + */ +void SDLCALL SDLTest_Md5Update(SDLTest_Md5Context *mdContext, unsigned char *inBuf, unsigned int inLen); - /** * complete digest computation * @@ -115,10 +112,8 @@ extern "C" { * Note: The function terminates the message-digest computation and * ends with the desired message digest in mdContext.digest[0..15]. * Always call before using the digest[] variable. -*/ - - void SDLTest_Md5Final(SDLTest_Md5Context *mdContext); - + */ +void SDLCALL SDLTest_Md5Final(SDLTest_Md5Context *mdContext); /* Ends C function definitions when using C++ */ #ifdef __cplusplus diff --git a/include/SDL3/SDL_test_memory.h b/include/SDL3/SDL_test_memory.h index 8e22ed3a..a1f8b1b3 100644 --- a/include/SDL3/SDL_test_memory.h +++ b/include/SDL3/SDL_test_memory.h @@ -36,28 +36,26 @@ extern "C" { #endif - /** * Start tracking SDL memory allocations * * \note This should be called before any other SDL functions for complete tracking coverage */ -void SDLTest_TrackAllocations(void); +void SDLCALL SDLTest_TrackAllocations(void); /** * Fill allocations with random data * * \note This implicitly calls SDLTest_TrackAllocations() */ -void SDLTest_RandFillAllocations(void); +void SDLCALL SDLTest_RandFillAllocations(void); /** * Print a log of any outstanding allocations * * \note This can be called after SDL_Quit() */ -void SDLTest_LogAllocations(void); - +void SDLCALL SDLTest_LogAllocations(void); /* Ends C function definitions when using C++ */ #ifdef __cplusplus diff --git a/include/SDL3/SDL_thread.h b/include/SDL3/SDL_thread.h index 0fdc8a02..526ab061 100644 --- a/include/SDL3/SDL_thread.h +++ b/include/SDL3/SDL_thread.h @@ -34,9 +34,8 @@ /* Thread synchronization primitives */ #include -#include -#if (defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK)) && !defined(SDL_PLATFORM_WINRT) +#if defined(SDL_PLATFORM_WINDOWS) #include /* _beginthreadex() and _endthreadex() */ #endif @@ -263,7 +262,7 @@ extern SDL_DECLSPEC SDL_Thread * SDLCALL SDL_CreateThreadWithProperties(SDL_Prop /* The real implementation, hidden from the wiki, so it can show this as real functions that don't have macro magic. */ #ifndef SDL_WIKI_DOCUMENTATION_SECTION -# if (defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK)) && !defined(SDL_PLATFORM_WINRT) +# if defined(SDL_PLATFORM_WINDOWS) # ifndef SDL_BeginThreadFunction # define SDL_BeginThreadFunction _beginthreadex # endif @@ -381,12 +380,12 @@ extern SDL_DECLSPEC SDL_ThreadID SDLCALL SDL_GetThreadID(SDL_Thread *thread); * an administrator account. Be prepared for this to fail. * * \param priority the SDL_ThreadPriority to set. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetThreadPriority(SDL_ThreadPriority priority); +extern SDL_DECLSPEC bool SDLCALL SDL_SetThreadPriority(SDL_ThreadPriority priority); /** * Wait for a thread to finish. @@ -504,8 +503,8 @@ typedef void (SDLCALL *SDL_TLSDestructorCallback)(void *value); * \param value the value to associate with the ID for the current thread. * \param destructor a function called when the thread exits, to free the * value, may be NULL. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \threadsafety It is safe to call this function from any thread. * @@ -513,7 +512,7 @@ typedef void (SDLCALL *SDL_TLSDestructorCallback)(void *value); * * \sa SDL_GetTLS */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetTLS(SDL_TLSID *id, const void *value, SDL_TLSDestructorCallback destructor); +extern SDL_DECLSPEC bool SDLCALL SDL_SetTLS(SDL_TLSID *id, const void *value, SDL_TLSDestructorCallback destructor); /** * Cleanup all TLS data for this thread. diff --git a/include/SDL3/SDL_time.h b/include/SDL3/SDL_time.h index 86c1fad0..eb73f7a7 100644 --- a/include/SDL3/SDL_time.h +++ b/include/SDL3/SDL_time.h @@ -95,24 +95,24 @@ typedef enum SDL_TimeFormat * format, may be NULL. * \param timeFormat a pointer to the SDL_TimeFormat to hold the returned time * format, may be NULL. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetDateTimeLocalePreferences(SDL_DateFormat *dateFormat, SDL_TimeFormat *timeFormat); +extern SDL_DECLSPEC bool SDLCALL SDL_GetDateTimeLocalePreferences(SDL_DateFormat *dateFormat, SDL_TimeFormat *timeFormat); /** * Gets the current value of the system realtime clock in nanoseconds since * Jan 1, 1970 in Universal Coordinated Time (UTC). * * \param ticks the SDL_Time to hold the returned tick count. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetCurrentTime(SDL_Time *ticks); +extern SDL_DECLSPEC bool SDLCALL SDL_GetCurrentTime(SDL_Time *ticks); /** * Converts an SDL_Time in nanoseconds since the epoch to a calendar time in @@ -123,12 +123,12 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetCurrentTime(SDL_Time *ticks); * \param localTime the resulting SDL_DateTime will be expressed in local time * if true, otherwise it will be in Universal Coordinated * Time (UTC). - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_TimeToDateTime(SDL_Time ticks, SDL_DateTime *dt, SDL_bool localTime); +extern SDL_DECLSPEC bool SDLCALL SDL_TimeToDateTime(SDL_Time ticks, SDL_DateTime *dt, bool localTime); /** * Converts a calendar time to an SDL_Time in nanoseconds since the epoch. @@ -138,12 +138,12 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_TimeToDateTime(SDL_Time ticks, SDL_Date * * \param dt the source SDL_DateTime. * \param ticks the resulting SDL_Time. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_DateTimeToTime(const SDL_DateTime *dt, SDL_Time *ticks); +extern SDL_DECLSPEC bool SDLCALL SDL_DateTimeToTime(const SDL_DateTime *dt, SDL_Time *ticks); /** * Converts an SDL time into a Windows FILETIME (100-nanosecond intervals diff --git a/include/SDL3/SDL_timer.h b/include/SDL3/SDL_timer.h index 9d05161b..fa8b2bb2 100644 --- a/include/SDL3/SDL_timer.h +++ b/include/SDL3/SDL_timer.h @@ -160,8 +160,6 @@ typedef Uint32 (SDLCALL *SDL_TimerCallback)(void *userdata, SDL_TimerID timerID, /** * Call a callback function at a future time. * - * If you use this function, you must pass `SDL_INIT_TIMER` to SDL_Init(). - * * The callback function is passed the current timer interval and the user * supplied parameter from the SDL_AddTimer() call and should return the next * timer interval. If the value returned from the callback is 0, the timer is @@ -224,8 +222,6 @@ typedef Uint64 (SDLCALL *SDL_NSTimerCallback)(void *userdata, SDL_TimerID timerI /** * Call a callback function at a future time. * - * If you use this function, you must pass `SDL_INIT_TIMER` to SDL_Init(). - * * The callback function is passed the current timer interval and the user * supplied parameter from the SDL_AddTimerNS() call and should return the * next timer interval. If the value returned from the callback is 0, the @@ -263,14 +259,14 @@ extern SDL_DECLSPEC SDL_TimerID SDLCALL SDL_AddTimerNS(Uint64 interval, SDL_NSTi * Remove a timer created with SDL_AddTimer(). * * \param id the ID of the timer to remove. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_AddTimer */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_RemoveTimer(SDL_TimerID id); +extern SDL_DECLSPEC bool SDLCALL SDL_RemoveTimer(SDL_TimerID id); /* Ends C function definitions when using C++ */ diff --git a/include/SDL3/SDL_touch.h b/include/SDL3/SDL_touch.h index 6889f369..2b07d2d3 100644 --- a/include/SDL3/SDL_touch.h +++ b/include/SDL3/SDL_touch.h @@ -31,7 +31,6 @@ #include #include #include -#include #include /* Set up for C function definitions, even when using C++ */ diff --git a/include/SDL3/SDL_version.h b/include/SDL3/SDL_version.h index c0f518d4..01946dd9 100644 --- a/include/SDL3/SDL_version.h +++ b/include/SDL3/SDL_version.h @@ -30,7 +30,6 @@ #define SDL_version_h_ #include -#include #include /* Set up for C function definitions, even when using C++ */ diff --git a/include/SDL3/SDL_video.h b/include/SDL3/SDL_video.h index 7cce828a..3207120e 100644 --- a/include/SDL3/SDL_video.h +++ b/include/SDL3/SDL_video.h @@ -475,15 +475,15 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetDisplayName(SDL_DisplayID displa * * \param displayID the instance ID of the display to query. * \param rect the SDL_Rect structure filled in with the display bounds. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_GetDisplayUsableBounds * \sa SDL_GetDisplays */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetDisplayBounds(SDL_DisplayID displayID, SDL_Rect *rect); +extern SDL_DECLSPEC bool SDLCALL SDL_GetDisplayBounds(SDL_DisplayID displayID, SDL_Rect *rect); /** * Get the usable desktop area represented by a display, in screen @@ -499,15 +499,15 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetDisplayBounds(SDL_DisplayID displayI * * \param displayID the instance ID of the display to query. * \param rect the SDL_Rect structure filled in with the display bounds. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_GetDisplayBounds * \sa SDL_GetDisplays */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetDisplayUsableBounds(SDL_DisplayID displayID, SDL_Rect *rect); +extern SDL_DECLSPEC bool SDLCALL SDL_GetDisplayUsableBounds(SDL_DisplayID displayID, SDL_Rect *rect); /** * Get the orientation of a display when it is unrotated. @@ -598,15 +598,15 @@ extern SDL_DECLSPEC SDL_DisplayMode ** SDLCALL SDL_GetFullscreenDisplayModes(SDL * the search. * \param mode a pointer filled in with the closest display mode equal to or * larger than the desired mode. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_GetDisplays * \sa SDL_GetFullscreenDisplayModes */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetClosestFullscreenDisplayMode(SDL_DisplayID displayID, int w, int h, float refresh_rate, SDL_bool include_high_density_modes, SDL_DisplayMode *mode); +extern SDL_DECLSPEC bool SDLCALL SDL_GetClosestFullscreenDisplayMode(SDL_DisplayID displayID, int w, int h, float refresh_rate, bool include_high_density_modes, SDL_DisplayMode *mode); /** * Get information about the desktop's display mode. @@ -743,16 +743,16 @@ extern SDL_DECLSPEC float SDLCALL SDL_GetWindowDisplayScale(SDL_Window *window); * taken effect. * * When the new mode takes effect, an SDL_EVENT_WINDOW_RESIZED and/or an - * SDL_EVENT_WINDOOW_PIXEL_SIZE_CHANGED event will be emitted with the new - * mode dimensions. + * SDL_EVENT_WINDOW_PIXEL_SIZE_CHANGED event will be emitted with the new mode + * dimensions. * * \param window the window to affect. * \param mode a pointer to the display mode to use, which can be NULL for * borderless fullscreen desktop mode, or one of the fullscreen * modes returned by SDL_GetFullscreenDisplayModes() to set an * exclusive fullscreen mode. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * @@ -760,7 +760,7 @@ extern SDL_DECLSPEC float SDLCALL SDL_GetWindowDisplayScale(SDL_Window *window); * \sa SDL_SetWindowFullscreen * \sa SDL_SyncWindow */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetWindowFullscreenMode(SDL_Window *window, const SDL_DisplayMode *mode); +extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowFullscreenMode(SDL_Window *window, const SDL_DisplayMode *mode); /** * Query the display mode to use when a window is visible at fullscreen. @@ -1215,11 +1215,6 @@ extern SDL_DECLSPEC SDL_Window * SDLCALL SDL_GetWindowParent(SDL_Window *window) * - `SDL_PROP_WINDOW_VIVANTE_SURFACE_POINTER`: the EGLSurface associated with * the window * - * On UWP: - * - * - `SDL_PROP_WINDOW_WINRT_WINDOW_POINTER`: the IInspectable CoreWindow - * associated with the window - * * On Windows: * * - `SDL_PROP_WINDOW_WIN32_HWND_POINTER`: the HWND associated with the window @@ -1286,7 +1281,6 @@ extern SDL_DECLSPEC SDL_PropertiesID SDLCALL SDL_GetWindowProperties(SDL_Window #define SDL_PROP_WINDOW_VIVANTE_DISPLAY_POINTER "SDL.window.vivante.display" #define SDL_PROP_WINDOW_VIVANTE_WINDOW_POINTER "SDL.window.vivante.window" #define SDL_PROP_WINDOW_VIVANTE_SURFACE_POINTER "SDL.window.vivante.surface" -#define SDL_PROP_WINDOW_WINRT_WINDOW_POINTER "SDL.window.winrt.window" #define SDL_PROP_WINDOW_WIN32_HWND_POINTER "SDL.window.win32.hwnd" #define SDL_PROP_WINDOW_WIN32_HDC_POINTER "SDL.window.win32.hdc" #define SDL_PROP_WINDOW_WIN32_INSTANCE_POINTER "SDL.window.win32.instance" @@ -1327,14 +1321,14 @@ extern SDL_DECLSPEC SDL_WindowFlags SDLCALL SDL_GetWindowFlags(SDL_Window *windo * * \param window the window to change. * \param title the desired window title in UTF-8 format. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_GetWindowTitle */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetWindowTitle(SDL_Window *window, const char *title); +extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowTitle(SDL_Window *window, const char *title); /** * Get the title of a window. @@ -1364,12 +1358,12 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetWindowTitle(SDL_Window *window); * * \param window the window to change. * \param icon an SDL_Surface structure containing the icon for the window. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetWindowIcon(SDL_Window *window, SDL_Surface *icon); +extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowIcon(SDL_Window *window, SDL_Surface *icon); /** * Request that the window's position be set. @@ -1401,15 +1395,15 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetWindowIcon(SDL_Window *window, SDL_S * `SDL_WINDOWPOS_UNDEFINED`. * \param y the y coordinate of the window, or `SDL_WINDOWPOS_CENTERED` or * `SDL_WINDOWPOS_UNDEFINED`. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_GetWindowPosition * \sa SDL_SyncWindow */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetWindowPosition(SDL_Window *window, int x, int y); +extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowPosition(SDL_Window *window, int x, int y); /** * Get the position of a window. @@ -1425,14 +1419,14 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetWindowPosition(SDL_Window *window, i * NULL. * \param y a pointer filled in with the y position of the window, may be * NULL. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_SetWindowPosition */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetWindowPosition(SDL_Window *window, int *x, int *y); +extern SDL_DECLSPEC bool SDLCALL SDL_GetWindowPosition(SDL_Window *window, int *x, int *y); /** * Request that the size of a window's client area be set. @@ -1459,8 +1453,8 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetWindowPosition(SDL_Window *window, i * \param window the window to change. * \param w the width of the window, must be > 0. * \param h the height of the window, must be > 0. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * @@ -1468,7 +1462,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetWindowPosition(SDL_Window *window, i * \sa SDL_SetWindowFullscreenMode * \sa SDL_SyncWindow */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetWindowSize(SDL_Window *window, int w, int h); +extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowSize(SDL_Window *window, int w, int h); /** * Get the size of a window's client area. @@ -1480,8 +1474,8 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetWindowSize(SDL_Window *window, int w * \param window the window to query the width and height from. * \param w a pointer filled in with the width of the window, may be NULL. * \param h a pointer filled in with the height of the window, may be NULL. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * @@ -1489,7 +1483,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetWindowSize(SDL_Window *window, int w * \sa SDL_GetWindowSizeInPixels * \sa SDL_SetWindowSize */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetWindowSize(SDL_Window *window, int *w, int *h); +extern SDL_DECLSPEC bool SDLCALL SDL_GetWindowSize(SDL_Window *window, int *w, int *h); /** * Get the safe area for this window. @@ -1504,12 +1498,12 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetWindowSize(SDL_Window *window, int * * \param window the window to query. * \param rect a pointer filled in with the client area that is safe for * interactive content. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetWindowSafeArea(SDL_Window *window, SDL_Rect *rect); +extern SDL_DECLSPEC bool SDLCALL SDL_GetWindowSafeArea(SDL_Window *window, SDL_Rect *rect); /** * Request that the aspect ratio of a window's client area be set. @@ -1540,15 +1534,15 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetWindowSafeArea(SDL_Window *window, S * limit. * \param max_aspect the maximum aspect ratio of the window, or 0.0f for no * limit. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_GetWindowAspectRatio * \sa SDL_SyncWindow */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetWindowAspectRatio(SDL_Window *window, float min_aspect, float max_aspect); +extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowAspectRatio(SDL_Window *window, float min_aspect, float max_aspect); /** * Get the size of a window's client area. @@ -1558,19 +1552,19 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetWindowAspectRatio(SDL_Window *window * window, may be NULL. * \param max_aspect a pointer filled in with the maximum aspect ratio of the * window, may be NULL. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_SetWindowAspectRatio */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetWindowAspectRatio(SDL_Window *window, float *min_aspect, float *max_aspect); +extern SDL_DECLSPEC bool SDLCALL SDL_GetWindowAspectRatio(SDL_Window *window, float *min_aspect, float *max_aspect); /** * Get the size of a window's borders (decorations) around the client area. * - * Note: If this function fails (returns -1), the size values will be + * Note: If this function fails (returns false), the size values will be * initialized to 0, 0, 0, 0 (if a non-NULL pointer is provided), as if the * window in question was borderless. * @@ -1580,7 +1574,8 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetWindowAspectRatio(SDL_Window *window * window has been presented and composited, so that the window system has a * chance to decorate the window and provide the border dimensions to SDL. * - * This function also returns -1 if getting the information is not supported. + * This function also returns false if getting the information is not + * supported. * * \param window the window to query the size values of the border * (decorations) from. @@ -1592,14 +1587,14 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetWindowAspectRatio(SDL_Window *window * border; NULL is permitted. * \param right pointer to variable for storing the size of the right border; * NULL is permitted. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_GetWindowSize */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetWindowBordersSize(SDL_Window *window, int *top, int *left, int *bottom, int *right); +extern SDL_DECLSPEC bool SDLCALL SDL_GetWindowBordersSize(SDL_Window *window, int *top, int *left, int *bottom, int *right); /** * Get the size of a window's client area, in pixels. @@ -1609,15 +1604,15 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetWindowBordersSize(SDL_Window *window * NULL. * \param h a pointer to variable for storing the height in pixels, may be * NULL. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_CreateWindow * \sa SDL_GetWindowSize */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetWindowSizeInPixels(SDL_Window *window, int *w, int *h); +extern SDL_DECLSPEC bool SDLCALL SDL_GetWindowSizeInPixels(SDL_Window *window, int *w, int *h); /** * Set the minimum size of a window's client area. @@ -1625,15 +1620,15 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetWindowSizeInPixels(SDL_Window *windo * \param window the window to change. * \param min_w the minimum width of the window, or 0 for no limit. * \param min_h the minimum height of the window, or 0 for no limit. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_GetWindowMinimumSize * \sa SDL_SetWindowMaximumSize */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetWindowMinimumSize(SDL_Window *window, int min_w, int min_h); +extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowMinimumSize(SDL_Window *window, int min_w, int min_h); /** * Get the minimum size of a window's client area. @@ -1643,15 +1638,15 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetWindowMinimumSize(SDL_Window *window * NULL. * \param h a pointer filled in with the minimum height of the window, may be * NULL. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_GetWindowMaximumSize * \sa SDL_SetWindowMinimumSize */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetWindowMinimumSize(SDL_Window *window, int *w, int *h); +extern SDL_DECLSPEC bool SDLCALL SDL_GetWindowMinimumSize(SDL_Window *window, int *w, int *h); /** * Set the maximum size of a window's client area. @@ -1659,15 +1654,15 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetWindowMinimumSize(SDL_Window *window * \param window the window to change. * \param max_w the maximum width of the window, or 0 for no limit. * \param max_h the maximum height of the window, or 0 for no limit. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_GetWindowMaximumSize * \sa SDL_SetWindowMinimumSize */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetWindowMaximumSize(SDL_Window *window, int max_w, int max_h); +extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowMaximumSize(SDL_Window *window, int max_w, int max_h); /** * Get the maximum size of a window's client area. @@ -1677,15 +1672,15 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetWindowMaximumSize(SDL_Window *window * NULL. * \param h a pointer filled in with the maximum height of the window, may be * NULL. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_GetWindowMinimumSize * \sa SDL_SetWindowMaximumSize */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetWindowMaximumSize(SDL_Window *window, int *w, int *h); +extern SDL_DECLSPEC bool SDLCALL SDL_GetWindowMaximumSize(SDL_Window *window, int *w, int *h); /** * Set the border state of a window. @@ -1697,15 +1692,15 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetWindowMaximumSize(SDL_Window *window * You can't change the border state of a fullscreen window. * * \param window the window of which to change the border state. - * \param bordered SDL_FALSE to remove border, SDL_TRUE to add border. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \param bordered false to remove border, true to add border. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_GetWindowFlags */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetWindowBordered(SDL_Window *window, SDL_bool bordered); +extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowBordered(SDL_Window *window, bool bordered); /** * Set the user-resizable state of a window. @@ -1717,15 +1712,15 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetWindowBordered(SDL_Window *window, S * You can't change the resizable state of a fullscreen window. * * \param window the window of which to change the resizable state. - * \param resizable SDL_TRUE to allow resizing, SDL_FALSE to disallow. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \param resizable true to allow resizing, false to disallow. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_GetWindowFlags */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetWindowResizable(SDL_Window *window, SDL_bool resizable); +extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowResizable(SDL_Window *window, bool resizable); /** * Set the window to always be above the others. @@ -1734,43 +1729,42 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetWindowResizable(SDL_Window *window, * will bring the window to the front and keep the window above the rest. * * \param window the window of which to change the always on top state. - * \param on_top SDL_TRUE to set the window always on top, SDL_FALSE to - * disable. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \param on_top true to set the window always on top, false to disable. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_GetWindowFlags */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetWindowAlwaysOnTop(SDL_Window *window, SDL_bool on_top); +extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowAlwaysOnTop(SDL_Window *window, bool on_top); /** * Show a window. * * \param window the window to show. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_HideWindow * \sa SDL_RaiseWindow */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ShowWindow(SDL_Window *window); +extern SDL_DECLSPEC bool SDLCALL SDL_ShowWindow(SDL_Window *window); /** * Hide a window. * * \param window the window to hide. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_ShowWindow */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_HideWindow(SDL_Window *window); +extern SDL_DECLSPEC bool SDLCALL SDL_HideWindow(SDL_Window *window); /** * Request that a window be raised above other windows and gain the input @@ -1783,12 +1777,12 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_HideWindow(SDL_Window *window); * the window will have the SDL_WINDOW_INPUT_FOCUS flag set. * * \param window the window to raise. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_RaiseWindow(SDL_Window *window); +extern SDL_DECLSPEC bool SDLCALL SDL_RaiseWindow(SDL_Window *window); /** * Request that the window be made as large as possible. @@ -1811,8 +1805,8 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_RaiseWindow(SDL_Window *window); * and Wayland window managers may vary. * * \param window the window to maximize. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * @@ -1820,7 +1814,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_RaiseWindow(SDL_Window *window); * \sa SDL_RestoreWindow * \sa SDL_SyncWindow */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_MaximizeWindow(SDL_Window *window); +extern SDL_DECLSPEC bool SDLCALL SDL_MaximizeWindow(SDL_Window *window); /** * Request that the window be minimized to an iconic representation. @@ -1835,8 +1829,8 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_MaximizeWindow(SDL_Window *window); * deny the state change. * * \param window the window to minimize. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * @@ -1844,7 +1838,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_MaximizeWindow(SDL_Window *window); * \sa SDL_RestoreWindow * \sa SDL_SyncWindow */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_MinimizeWindow(SDL_Window *window); +extern SDL_DECLSPEC bool SDLCALL SDL_MinimizeWindow(SDL_Window *window); /** * Request that the size and position of a minimized or maximized window be @@ -1860,8 +1854,8 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_MinimizeWindow(SDL_Window *window); * deny the state change. * * \param window the window to restore. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * @@ -1869,7 +1863,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_MinimizeWindow(SDL_Window *window); * \sa SDL_MinimizeWindow * \sa SDL_SyncWindow */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_RestoreWindow(SDL_Window *window); +extern SDL_DECLSPEC bool SDLCALL SDL_RestoreWindow(SDL_Window *window); /** * Request that the window's fullscreen state be changed. @@ -1888,10 +1882,9 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_RestoreWindow(SDL_Window *window); * is just a request, it can be denied by the windowing system. * * \param window the window to change. - * \param fullscreen SDL_TRUE for fullscreen mode, SDL_FALSE for windowed - * mode. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \param fullscreen true for fullscreen mode, false for windowed mode. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * @@ -1899,7 +1892,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_RestoreWindow(SDL_Window *window); * \sa SDL_SetWindowFullscreenMode * \sa SDL_SyncWindow */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetWindowFullscreen(SDL_Window *window, SDL_bool fullscreen); +extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowFullscreen(SDL_Window *window, bool fullscreen); /** * Block until any pending window state is finalized. @@ -1915,8 +1908,8 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetWindowFullscreen(SDL_Window *window, * * \param window the window for which to wait for the pending state to be * applied. - * \returns SDL_TRUE on success or SDL_FALSE if the operation timed out before - * the window was in the requested state. + * \returns true on success or false if the operation timed out before the + * window was in the requested state. * * \since This function is available since SDL 3.0.0. * @@ -1928,20 +1921,20 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetWindowFullscreen(SDL_Window *window, * \sa SDL_RestoreWindow * \sa SDL_HINT_VIDEO_SYNC_WINDOW_OPERATIONS */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SyncWindow(SDL_Window *window); +extern SDL_DECLSPEC bool SDLCALL SDL_SyncWindow(SDL_Window *window); /** * Return whether the window has a surface associated with it. * * \param window the window to query. - * \returns SDL_TRUE if there is a surface associated with the window, or - * SDL_FALSE otherwise. + * \returns true if there is a surface associated with the window, or false + * otherwise. * * \since This function is available since SDL 3.0.0. * * \sa SDL_GetWindowSurface */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_WindowHasSurface(SDL_Window *window); +extern SDL_DECLSPEC bool SDLCALL SDL_WindowHasSurface(SDL_Window *window); /** * Get the SDL surface associated with the window. @@ -1985,14 +1978,14 @@ extern SDL_DECLSPEC SDL_Surface * SDLCALL SDL_GetWindowSurface(SDL_Window *windo * * \param window the window. * \param vsync the vertical refresh sync interval. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_GetWindowSurfaceVSync */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetWindowSurfaceVSync(SDL_Window *window, int vsync); +extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowSurfaceVSync(SDL_Window *window, int vsync); #define SDL_WINDOW_SURFACE_VSYNC_DISABLED 0 #define SDL_WINDOW_SURFACE_VSYNC_ADAPTIVE (-1) @@ -2003,14 +1996,14 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetWindowSurfaceVSync(SDL_Window *windo * \param window the window to query. * \param vsync an int filled with the current vertical refresh sync interval. * See SDL_SetWindowSurfaceVSync() for the meaning of the value. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_SetWindowSurfaceVSync */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetWindowSurfaceVSync(SDL_Window *window, int *vsync); +extern SDL_DECLSPEC bool SDLCALL SDL_GetWindowSurfaceVSync(SDL_Window *window, int *vsync); /** * Copy the window surface to the screen. @@ -2021,15 +2014,15 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetWindowSurfaceVSync(SDL_Window *windo * This function is equivalent to the SDL 1.2 API SDL_Flip(). * * \param window the window to update. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_GetWindowSurface * \sa SDL_UpdateWindowSurfaceRects */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_UpdateWindowSurface(SDL_Window *window); +extern SDL_DECLSPEC bool SDLCALL SDL_UpdateWindowSurface(SDL_Window *window); /** * Copy areas of the window surface to the screen. @@ -2048,29 +2041,29 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_UpdateWindowSurface(SDL_Window *window) * \param rects an array of SDL_Rect structures representing areas of the * surface to copy, in pixels. * \param numrects the number of rectangles. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_GetWindowSurface * \sa SDL_UpdateWindowSurface */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_UpdateWindowSurfaceRects(SDL_Window *window, const SDL_Rect *rects, int numrects); +extern SDL_DECLSPEC bool SDLCALL SDL_UpdateWindowSurfaceRects(SDL_Window *window, const SDL_Rect *rects, int numrects); /** * Destroy the surface associated with the window. * * \param window the window to update. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_GetWindowSurface * \sa SDL_WindowHasSurface */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_DestroyWindowSurface(SDL_Window *window); +extern SDL_DECLSPEC bool SDLCALL SDL_DestroyWindowSurface(SDL_Window *window); /** * Set a window's keyboard grab mode. @@ -2092,16 +2085,16 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_DestroyWindowSurface(SDL_Window *window * other window loses its grab in favor of the caller's window. * * \param window the window for which the keyboard grab mode should be set. - * \param grabbed this is SDL_TRUE to grab keyboard, and SDL_FALSE to release. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \param grabbed this is true to grab keyboard, and false to release. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_GetWindowKeyboardGrab * \sa SDL_SetWindowMouseGrab */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetWindowKeyboardGrab(SDL_Window *window, SDL_bool grabbed); +extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowKeyboardGrab(SDL_Window *window, bool grabbed); /** * Set a window's mouse grab mode. @@ -2109,40 +2102,40 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetWindowKeyboardGrab(SDL_Window *windo * Mouse grab confines the mouse cursor to the window. * * \param window the window for which the mouse grab mode should be set. - * \param grabbed this is SDL_TRUE to grab mouse, and SDL_FALSE to release. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \param grabbed this is true to grab mouse, and false to release. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_GetWindowMouseGrab * \sa SDL_SetWindowKeyboardGrab */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetWindowMouseGrab(SDL_Window *window, SDL_bool grabbed); +extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowMouseGrab(SDL_Window *window, bool grabbed); /** * Get a window's keyboard grab mode. * * \param window the window to query. - * \returns SDL_TRUE if keyboard is grabbed, and SDL_FALSE otherwise. + * \returns true if keyboard is grabbed, and false otherwise. * * \since This function is available since SDL 3.0.0. * * \sa SDL_SetWindowKeyboardGrab */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetWindowKeyboardGrab(SDL_Window *window); +extern SDL_DECLSPEC bool SDLCALL SDL_GetWindowKeyboardGrab(SDL_Window *window); /** * Get a window's mouse grab mode. * * \param window the window to query. - * \returns SDL_TRUE if mouse is grabbed, and SDL_FALSE otherwise. + * \returns true if mouse is grabbed, and false otherwise. * * \since This function is available since SDL 3.0.0. * * \sa SDL_SetWindowKeyboardGrab */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetWindowMouseGrab(SDL_Window *window); +extern SDL_DECLSPEC bool SDLCALL SDL_GetWindowMouseGrab(SDL_Window *window); /** * Get the window that currently has an input grab enabled. @@ -2165,15 +2158,15 @@ extern SDL_DECLSPEC SDL_Window * SDLCALL SDL_GetGrabbedWindow(void); * \param window the window that will be associated with the barrier. * \param rect a rectangle area in window-relative coordinates. If NULL the * barrier for the specified window will be destroyed. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_GetWindowMouseRect * \sa SDL_SetWindowMouseGrab */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetWindowMouseRect(SDL_Window *window, const SDL_Rect *rect); +extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowMouseRect(SDL_Window *window, const SDL_Rect *rect); /** * Get the mouse confinement rectangle of a window. @@ -2194,18 +2187,18 @@ extern SDL_DECLSPEC const SDL_Rect * SDLCALL SDL_GetWindowMouseRect(SDL_Window * * The parameter `opacity` will be clamped internally between 0.0f * (transparent) and 1.0f (opaque). * - * This function also returns -1 if setting the opacity isn't supported. + * This function also returns false if setting the opacity isn't supported. * * \param window the window which will be made transparent or opaque. * \param opacity the opacity value (0.0f - transparent, 1.0f - opaque). - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_GetWindowOpacity */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetWindowOpacity(SDL_Window *window, float opacity); +extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowOpacity(SDL_Window *window, float opacity); /** * Get the opacity of a window. @@ -2224,36 +2217,58 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetWindowOpacity(SDL_Window *window, fl extern SDL_DECLSPEC float SDLCALL SDL_GetWindowOpacity(SDL_Window *window); /** - * Set the window as a modal to a parent window. + * Set the window as a child of a parent window. * - * If the window is already modal to an existing window, it will be reparented - * to the new owner. Setting the parent window to null unparents the modal - * window and removes modal status. + * If the window is already the child of an existing window, it will be + * reparented to the new owner. Setting the parent window to NULL unparents + * the window and removes child window status. * - * Setting a window as modal to a parent that is a descendent of the modal - * window results in undefined behavior. + * Attempting to set the parent of a window that is currently in the modal + * state will fail. Use SDL_SetWindowModalFor() to cancel the modal status + * before attempting to change the parent. * - * \param modal_window the window that should be set modal. - * \param parent_window the parent window for the modal window. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * Setting a parent window that is currently the sibling or descendent of the + * child window results in undefined behavior. + * + * \param window the window that should become the child of a parent. + * \param parent the new parent window for the child window. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. + * + * \sa SDL_SetWindowModal */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetWindowModalFor(SDL_Window *modal_window, SDL_Window *parent_window); +extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowParent(SDL_Window *window, SDL_Window *parent); + +/** + * Toggle the state of the window as modal. + * + * To enable modal status on a window, the window must currently be the child + * window of a parent, or toggling modal status on will fail. + * + * \param window the window on which to set the modal state. + * \param modal true to toggle modal status on, false to toggle it off. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. + * + * \since This function is available since SDL 3.0.0. + * + * \sa SDL_SetWindowParent + */ +extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowModal(SDL_Window *window, bool modal); /** * Set whether the window may have input focus. * * \param window the window to set focusable state. - * \param focusable SDL_TRUE to allow input focus, SDL_FALSE to not allow - * input focus. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \param focusable true to allow input focus, false to not allow input focus. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetWindowFocusable(SDL_Window *window, SDL_bool focusable); +extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowFocusable(SDL_Window *window, bool focusable); /** @@ -2272,12 +2287,12 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetWindowFocusable(SDL_Window *window, * the client area. * \param y the y coordinate of the menu, relative to the origin (top-left) of * the client area. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ShowWindowSystemMenu(SDL_Window *window, int x, int y); +extern SDL_DECLSPEC bool SDLCALL SDL_ShowWindowSystemMenu(SDL_Window *window, int x, int y); /** * Possible return values from the SDL_HitTest callback. @@ -2335,7 +2350,7 @@ typedef SDL_HitTestResult (SDLCALL *SDL_HitTest)(SDL_Window *win, * Specifying NULL for a callback disables hit-testing. Hit-testing is * disabled by default. * - * Platforms that don't support this functionality will return SDL_FALSE + * Platforms that don't support this functionality will return false * unconditionally, even if you're attempting to disable hit-testing. * * Your callback may fire at any time, and its firing does not indicate any @@ -2349,12 +2364,12 @@ typedef SDL_HitTestResult (SDLCALL *SDL_HitTest)(SDL_Window *win, * \param window the window to set hit-testing on. * \param callback the function to call when doing a hit-test. * \param callback_data an app-defined void pointer passed to **callback**. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetWindowHitTest(SDL_Window *window, SDL_HitTest callback, void *callback_data); +extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowHitTest(SDL_Window *window, SDL_HitTest callback, void *callback_data); /** * Set the shape of a transparent window. @@ -2373,24 +2388,24 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetWindowHitTest(SDL_Window *window, SD * \param window the window. * \param shape the surface representing the shape of the window, or NULL to * remove any current shape. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetWindowShape(SDL_Window *window, SDL_Surface *shape); +extern SDL_DECLSPEC bool SDLCALL SDL_SetWindowShape(SDL_Window *window, SDL_Surface *shape); /** * Request a window to demand attention from the user. * * \param window the window to be flashed. * \param operation the operation to perform. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_FlashWindow(SDL_Window *window, SDL_FlashOperation operation); +extern SDL_DECLSPEC bool SDLCALL SDL_FlashWindow(SDL_Window *window, SDL_FlashOperation operation); /** * Destroy a window. @@ -2416,28 +2431,27 @@ extern SDL_DECLSPEC void SDLCALL SDL_DestroyWindow(SDL_Window *window); * * The default can also be changed using `SDL_HINT_VIDEO_ALLOW_SCREENSAVER`. * - * \returns SDL_TRUE if the screensaver is enabled, SDL_FALSE if it is - * disabled. + * \returns true if the screensaver is enabled, false if it is disabled. * * \since This function is available since SDL 3.0.0. * * \sa SDL_DisableScreenSaver * \sa SDL_EnableScreenSaver */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ScreenSaverEnabled(void); +extern SDL_DECLSPEC bool SDLCALL SDL_ScreenSaverEnabled(void); /** * Allow the screen to be blanked by a screen saver. * - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_DisableScreenSaver * \sa SDL_ScreenSaverEnabled */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_EnableScreenSaver(void); +extern SDL_DECLSPEC bool SDLCALL SDL_EnableScreenSaver(void); /** * Prevent the screen from being blanked by a screen saver. @@ -2448,15 +2462,15 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_EnableScreenSaver(void); * The screensaver is disabled by default, but this may by changed by * SDL_HINT_VIDEO_ALLOW_SCREENSAVER. * - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_EnableScreenSaver * \sa SDL_ScreenSaverEnabled */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_DisableScreenSaver(void); +extern SDL_DECLSPEC bool SDLCALL SDL_DisableScreenSaver(void); /** @@ -2476,15 +2490,15 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_DisableScreenSaver(void); * * \param path the platform dependent OpenGL library name, or NULL to open the * default OpenGL library. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_GL_GetProcAddress * \sa SDL_GL_UnloadLibrary */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GL_LoadLibrary(const char *path); +extern SDL_DECLSPEC bool SDLCALL SDL_GL_LoadLibrary(const char *path); /** * Get an OpenGL function by name. @@ -2580,11 +2594,11 @@ extern SDL_DECLSPEC void SDLCALL SDL_GL_UnloadLibrary(void); * every time you need to know. * * \param extension the name of the extension to check. - * \returns SDL_TRUE if the extension is supported, SDL_FALSE otherwise. + * \returns true if the extension is supported, false otherwise. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GL_ExtensionSupported(const char *extension); +extern SDL_DECLSPEC bool SDLCALL SDL_GL_ExtensionSupported(const char *extension); /** * Reset all previously set OpenGL context attributes to their default values. @@ -2607,15 +2621,15 @@ extern SDL_DECLSPEC void SDLCALL SDL_GL_ResetAttributes(void); * \param attr an SDL_GLattr enum value specifying the OpenGL attribute to * set. * \param value the desired value for the attribute. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_GL_GetAttribute * \sa SDL_GL_ResetAttributes */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GL_SetAttribute(SDL_GLattr attr, int value); +extern SDL_DECLSPEC bool SDLCALL SDL_GL_SetAttribute(SDL_GLattr attr, int value); /** * Get the actual value for an attribute from the current context. @@ -2623,15 +2637,15 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GL_SetAttribute(SDL_GLattr attr, int va * \param attr an SDL_GLattr enum value specifying the OpenGL attribute to * get. * \param value a pointer filled in with the current value of `attr`. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_GL_ResetAttributes * \sa SDL_GL_SetAttribute */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GL_GetAttribute(SDL_GLattr attr, int *value); +extern SDL_DECLSPEC bool SDLCALL SDL_GL_GetAttribute(SDL_GLattr attr, int *value); /** * Create an OpenGL context for an OpenGL window, and make it current. @@ -2662,14 +2676,14 @@ extern SDL_DECLSPEC SDL_GLContext SDLCALL SDL_GL_CreateContext(SDL_Window *windo * * \param window the window to associate with the context. * \param context the OpenGL context to associate with the window. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_GL_CreateContext */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GL_MakeCurrent(SDL_Window *window, SDL_GLContext context); +extern SDL_DECLSPEC bool SDLCALL SDL_GL_MakeCurrent(SDL_Window *window, SDL_GLContext context); /** * Get the currently active OpenGL window. @@ -2758,7 +2772,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_EGL_SetAttributeCallbacks(SDL_EGLAttribArra * the vertical retrace for a given frame, it swaps buffers immediately, which * might be less jarring for the user during occasional framerate drops. If an * application requests adaptive vsync and the system does not support it, - * this function will fail and return SDL_FALSE. In such a case, you should + * this function will fail and return false. In such a case, you should * probably retry the call with 1 for the interval. * * Adaptive vsync is implemented for some glX drivers with @@ -2770,14 +2784,14 @@ extern SDL_DECLSPEC void SDLCALL SDL_EGL_SetAttributeCallbacks(SDL_EGLAttribArra * * \param interval 0 for immediate updates, 1 for updates synchronized with * the vertical retrace, -1 for adaptive vsync. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_GL_GetSwapInterval */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GL_SetSwapInterval(int interval); +extern SDL_DECLSPEC bool SDLCALL SDL_GL_SetSwapInterval(int interval); /** * Get the swap interval for the current OpenGL context. @@ -2789,14 +2803,14 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GL_SetSwapInterval(int interval); * synchronization, 1 if the buffer swap is synchronized with * the vertical retrace, and -1 if late swaps happen * immediately instead of waiting for the next retrace. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_GL_SetSwapInterval */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GL_GetSwapInterval(int *interval); +extern SDL_DECLSPEC bool SDLCALL SDL_GL_GetSwapInterval(int *interval); /** * Update a window with OpenGL rendering. @@ -2809,25 +2823,25 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GL_GetSwapInterval(int *interval); * extra. * * \param window the window to change. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GL_SwapWindow(SDL_Window *window); +extern SDL_DECLSPEC bool SDLCALL SDL_GL_SwapWindow(SDL_Window *window); /** * Delete an OpenGL context. * * \param context the OpenGL context to be deleted. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_GL_CreateContext */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GL_DestroyContext(SDL_GLContext context); +extern SDL_DECLSPEC bool SDLCALL SDL_GL_DestroyContext(SDL_GLContext context); /* @} *//* OpenGL support functions */ diff --git a/include/SDL3/SDL_vulkan.h b/include/SDL3/SDL_vulkan.h index c31d33c1..6c777749 100644 --- a/include/SDL3/SDL_vulkan.h +++ b/include/SDL3/SDL_vulkan.h @@ -28,6 +28,7 @@ #ifndef SDL_vulkan_h_ #define SDL_vulkan_h_ +#include #include #include @@ -95,15 +96,15 @@ struct VkAllocationCallbacks; * library version. * * \param path the platform dependent Vulkan loader library name or NULL. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_Vulkan_GetVkGetInstanceProcAddr * \sa SDL_Vulkan_UnloadLibrary */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_Vulkan_LoadLibrary(const char *path); +extern SDL_DECLSPEC bool SDLCALL SDL_Vulkan_LoadLibrary(const char *path); /** * Get the address of the `vkGetInstanceProcAddr` function. @@ -175,15 +176,15 @@ extern SDL_DECLSPEC char const * const * SDLCALL SDL_Vulkan_GetInstanceExtension * allocator that creates the surface. Can be NULL. * \param surface a pointer to a VkSurfaceKHR handle to output the newly * created surface. - * \returns SDL_TRUE on success or SDL_FALSE on failure; call SDL_GetError() - * for more information. + * \returns true on success or false on failure; call SDL_GetError() for more + * information. * * \since This function is available since SDL 3.0.0. * * \sa SDL_Vulkan_GetInstanceExtensions * \sa SDL_Vulkan_DestroySurface */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_Vulkan_CreateSurface(SDL_Window *window, +extern SDL_DECLSPEC bool SDLCALL SDL_Vulkan_CreateSurface(SDL_Window *window, VkInstance instance, const struct VkAllocationCallbacks *allocator, VkSurfaceKHR* surface); @@ -226,14 +227,13 @@ extern SDL_DECLSPEC void SDLCALL SDL_Vulkan_DestroySurface(VkInstance instance, * \param physicalDevice a valid Vulkan physical device handle. * \param queueFamilyIndex a valid queue family index for the given physical * device. - * \returns SDL_TRUE if supported, SDL_FALSE if unsupported or an error - * occurred. + * \returns true if supported, false if unsupported or an error occurred. * * \since This function is available since SDL 3.0.0. * * \sa SDL_Vulkan_GetInstanceExtensions */ -extern SDL_DECLSPEC SDL_bool SDLCALL SDL_Vulkan_GetPresentationSupport(VkInstance instance, +extern SDL_DECLSPEC bool SDLCALL SDL_Vulkan_GetPresentationSupport(VkInstance instance, VkPhysicalDevice physicalDevice, Uint32 queueFamilyIndex); diff --git a/include/build_config/SDL_build_config.h b/include/build_config/SDL_build_config.h index beaceb58..eca4268c 100644 --- a/include/build_config/SDL_build_config.h +++ b/include/build_config/SDL_build_config.h @@ -33,8 +33,6 @@ /* Add any platform that doesn't build using the configure system. */ #if defined(SDL_PLATFORM_WIN32) #include "SDL_build_config_windows.h" -#elif defined(SDL_PLATFORM_WINRT) -#include "SDL_build_config_winrt.h" #elif defined(SDL_PLATFORM_WINGDK) #include "SDL_build_config_wingdk.h" #elif defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES) diff --git a/include/build_config/SDL_build_config.h.cmake b/include/build_config/SDL_build_config.h.cmake index 7300f777..d0598aea 100644 --- a/include/build_config/SDL_build_config.h.cmake +++ b/include/build_config/SDL_build_config.h.cmake @@ -100,6 +100,7 @@ #cmakedefine HAVE_STRNLEN 1 #cmakedefine HAVE_STRLCPY 1 #cmakedefine HAVE_STRLCAT 1 +#cmakedefine HAVE_STRPBRK 1 #cmakedefine HAVE__STRREV 1 #cmakedefine HAVE__STRUPR 1 #cmakedefine HAVE__STRLWR 1 @@ -262,6 +263,7 @@ #cmakedefine SDL_VIDEO_DISABLED @SDL_VIDEO_DISABLED@ #cmakedefine SDL_POWER_DISABLED @SDL_POWER_DISABLED@ #cmakedefine SDL_CAMERA_DISABLED @SDL_CAMERA_DISABLED@ +#cmakedefine SDL_GPU_DISABLED @SDL_GPU_DISABLED@ /* Enable various audio drivers */ #cmakedefine SDL_AUDIO_DRIVER_ALSA @SDL_AUDIO_DRIVER_ALSA@ @@ -324,6 +326,11 @@ #cmakedefine SDL_LIBUSB_DYNAMIC @SDL_LIBUSB_DYNAMIC@ #cmakedefine SDL_UDEV_DYNAMIC @SDL_UDEV_DYNAMIC@ +/* Enable various process implementations */ +#cmakedefine SDL_PROCESS_DUMMY @SDL_PROCESS_DUMMY@ +#cmakedefine SDL_PROCESS_POSIX @SDL_PROCESS_POSIX@ +#cmakedefine SDL_PROCESS_WINDOWS @SDL_PROCESS_WINDOWS@ + /* Enable various sensor drivers */ #cmakedefine SDL_SENSOR_ANDROID @SDL_SENSOR_ANDROID@ #cmakedefine SDL_SENSOR_COREMOTION @SDL_SENSOR_COREMOTION@ @@ -395,7 +402,6 @@ #cmakedefine SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_LIBDECOR @SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_LIBDECOR@ #cmakedefine SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON @SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON@ #cmakedefine SDL_VIDEO_DRIVER_WINDOWS @SDL_VIDEO_DRIVER_WINDOWS@ -#cmakedefine SDL_VIDEO_DRIVER_WINRT @SDL_VIDEO_DRIVER_WINRT@ #cmakedefine SDL_VIDEO_DRIVER_X11 @SDL_VIDEO_DRIVER_X11@ #cmakedefine SDL_VIDEO_DRIVER_X11_DYNAMIC @SDL_VIDEO_DRIVER_X11_DYNAMIC@ #cmakedefine SDL_VIDEO_DRIVER_X11_DYNAMIC_XCURSOR @SDL_VIDEO_DRIVER_X11_DYNAMIC_XCURSOR@ @@ -419,6 +425,7 @@ #cmakedefine SDL_VIDEO_RENDER_D3D @SDL_VIDEO_RENDER_D3D@ #cmakedefine SDL_VIDEO_RENDER_D3D11 @SDL_VIDEO_RENDER_D3D11@ #cmakedefine SDL_VIDEO_RENDER_D3D12 @SDL_VIDEO_RENDER_D3D12@ +#cmakedefine SDL_VIDEO_RENDER_GPU @SDL_VIDEO_RENDER_GPU@ #cmakedefine SDL_VIDEO_RENDER_METAL @SDL_VIDEO_RENDER_METAL@ #cmakedefine SDL_VIDEO_RENDER_VULKAN @SDL_VIDEO_RENDER_VULKAN@ #cmakedefine SDL_VIDEO_RENDER_OGL @SDL_VIDEO_RENDER_OGL@ @@ -426,7 +433,6 @@ #cmakedefine SDL_VIDEO_RENDER_PS2 @SDL_VIDEO_RENDER_PS2@ #cmakedefine SDL_VIDEO_RENDER_PSP @SDL_VIDEO_RENDER_PSP@ #cmakedefine SDL_VIDEO_RENDER_VITA_GXM @SDL_VIDEO_RENDER_VITA_GXM@ -#cmakedefine SDL_VIDEO_RENDER_GPU @SDL_VIDEO_RENDER_GPU@ /* Enable OpenGL support */ #cmakedefine SDL_VIDEO_OPENGL @SDL_VIDEO_OPENGL@ @@ -456,7 +462,6 @@ #cmakedefine SDL_POWER_ANDROID @SDL_POWER_ANDROID@ #cmakedefine SDL_POWER_LINUX @SDL_POWER_LINUX@ #cmakedefine SDL_POWER_WINDOWS @SDL_POWER_WINDOWS@ -#cmakedefine SDL_POWER_WINRT @SDL_POWER_WINRT@ #cmakedefine SDL_POWER_MACOSX @SDL_POWER_MACOSX@ #cmakedefine SDL_POWER_UIKIT @SDL_POWER_UIKIT@ #cmakedefine SDL_POWER_HAIKU @SDL_POWER_HAIKU@ diff --git a/include/build_config/SDL_build_config_android.h b/include/build_config/SDL_build_config_android.h index ddb15854..db5e3ceb 100644 --- a/include/build_config/SDL_build_config_android.h +++ b/include/build_config/SDL_build_config_android.h @@ -159,6 +159,9 @@ #define SDL_HAPTIC_ANDROID 1 #endif /* SDL_HAPTIC_DISABLED */ +/* Enable the stub process support */ +#define SDL_PROCESS_DUMMY 1 + /* Enable sensor driver */ #ifndef SDL_SENSOR_DISABLED #define SDL_SENSOR_ANDROID 1 @@ -187,17 +190,14 @@ #define SDL_VIDEO_RENDER_OGL_ES2 1 /* Enable Vulkan support */ -/* Android does not support Vulkan in native code using the "armeabi" ABI. */ #if defined(__ARM_ARCH) && __ARM_ARCH < 7 -#define SDL_VIDEO_VULKAN 0 +/* Android does not support Vulkan in native code using the "armeabi" ABI. */ #else #define SDL_VIDEO_VULKAN 1 -#ifndef SDL_VIDEO_RENDER_VULKAN -#define SDL_VIDEO_RENDER_VULKAN 1 +#define SDL_VIDEO_RENDER_VULKAN 1 +#define SDL_GPU_VULKAN 1 +#define SDL_VIDEO_RENDER_GPU 1 #endif -#endif - -#define SDL_GPU_VULKAN SDL_VIDEO_VULKAN /* Enable system power support */ #define SDL_POWER_ANDROID 1 diff --git a/include/build_config/SDL_build_config_emscripten.h b/include/build_config/SDL_build_config_emscripten.h index e4ac92ab..d19cf885 100644 --- a/include/build_config/SDL_build_config_emscripten.h +++ b/include/build_config/SDL_build_config_emscripten.h @@ -166,6 +166,9 @@ #define SDL_JOYSTICK_EMSCRIPTEN 1 #define SDL_JOYSTICK_VIRTUAL 1 +/* Enable various process implementations */ +#define SDL_PROCESS_DUMMY 1 + /* Enable various sensor drivers */ #define SDL_SENSOR_DUMMY 1 diff --git a/include/build_config/SDL_build_config_ios.h b/include/build_config/SDL_build_config_ios.h index b283858e..738a8175 100644 --- a/include/build_config/SDL_build_config_ios.h +++ b/include/build_config/SDL_build_config_ios.h @@ -76,6 +76,7 @@ #define HAVE_ATOF 1 #define HAVE_STRCMP 1 #define HAVE_STRNCMP 1 +#define HAVE_STRPBRK 1 #define HAVE_STRCASESTR 1 #define HAVE_VSSCANF 1 #define HAVE_VSNPRINTF 1 @@ -151,6 +152,9 @@ #define SDL_JOYSTICK_MFI 1 #define SDL_JOYSTICK_VIRTUAL 1 +/* Enable various process implementations */ +#define SDL_PROCESS_DUMMY 1 + #ifdef SDL_PLATFORM_TVOS #define SDL_SENSOR_DUMMY 1 #else diff --git a/include/build_config/SDL_build_config_macos.h b/include/build_config/SDL_build_config_macos.h index cf6229e1..cd041b9e 100644 --- a/include/build_config/SDL_build_config_macos.h +++ b/include/build_config/SDL_build_config_macos.h @@ -68,6 +68,7 @@ #define HAVE_STRLEN 1 #define HAVE_STRLCPY 1 #define HAVE_STRLCAT 1 +#define HAVE_STRPBRK 1 #define HAVE_STRCHR 1 #define HAVE_STRRCHR 1 #define HAVE_STRSTR 1 @@ -169,6 +170,9 @@ #define SDL_JOYSTICK_MFI 1 #endif +/* Enable various process implementations */ +#define SDL_PROCESS_POSIX 1 + /* Enable the dummy sensor driver */ #define SDL_SENSOR_DUMMY 1 @@ -211,66 +215,33 @@ #define SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS 1 #endif -#ifndef SDL_VIDEO_RENDER_OGL #define SDL_VIDEO_RENDER_OGL 1 -#endif - -#ifndef SDL_VIDEO_RENDER_OGL_ES2 #define SDL_VIDEO_RENDER_OGL_ES2 1 -#endif /* Metal only supported on 64-bit architectures with 10.11+ */ #if TARGET_RT_64_BIT && (MAC_OS_X_VERSION_MAX_ALLOWED >= 101100) -#define SDL_PLATFORM_SUPPORTS_METAL 1 -#else -#define SDL_PLATFORM_SUPPORTS_METAL 0 +#define SDL_PLATFORM_SUPPORTS_METAL 1 #endif -#ifndef SDL_VIDEO_RENDER_METAL -#if SDL_PLATFORM_SUPPORTS_METAL -#define SDL_VIDEO_RENDER_METAL 1 -#else -#define SDL_VIDEO_RENDER_METAL 0 -#endif +#ifdef SDL_PLATFORM_SUPPORTS_METAL +#define SDL_VIDEO_RENDER_METAL 1 #endif /* Enable OpenGL support */ -#ifndef SDL_VIDEO_OPENGL -#define SDL_VIDEO_OPENGL 1 -#endif -#ifndef SDL_VIDEO_OPENGL_ES2 -#define SDL_VIDEO_OPENGL_ES2 1 -#endif -#ifndef SDL_VIDEO_OPENGL_EGL -#define SDL_VIDEO_OPENGL_EGL 1 -#endif -#ifndef SDL_VIDEO_OPENGL_CGL -#define SDL_VIDEO_OPENGL_CGL 1 -#endif -#ifndef SDL_VIDEO_OPENGL_GLX -#define SDL_VIDEO_OPENGL_GLX 1 -#endif +#define SDL_VIDEO_OPENGL 1 +#define SDL_VIDEO_OPENGL_ES2 1 +#define SDL_VIDEO_OPENGL_EGL 1 +#define SDL_VIDEO_OPENGL_CGL 1 +#define SDL_VIDEO_OPENGL_GLX 1 /* Enable Vulkan and Metal support */ -#ifndef SDL_VIDEO_VULKAN -#if SDL_PLATFORM_SUPPORTS_METAL -#define SDL_VIDEO_VULKAN 1 -#else -#define SDL_VIDEO_VULKAN 0 -#endif -#endif - -#define SDL_GPU_VULKAN SDL_VIDEO_VULKAN - -#ifndef SDL_VIDEO_METAL -#if SDL_PLATFORM_SUPPORTS_METAL +#ifdef SDL_PLATFORM_SUPPORTS_METAL #define SDL_VIDEO_METAL 1 -#else -#define SDL_VIDEO_METAL 0 +#define SDL_GPU_METAL 1 +#define SDL_VIDEO_VULKAN 1 +#define SDL_GPU_VULKAN 1 +#define SDL_VIDEO_RENDER_GPU 1 #endif -#endif - -#define SDL_GPU_METAL SDL_VIDEO_METAL /* Enable system power support */ #define SDL_POWER_MACOSX 1 diff --git a/include/build_config/SDL_build_config_minimal.h b/include/build_config/SDL_build_config_minimal.h index f949f94f..5dc4305a 100644 --- a/include/build_config/SDL_build_config_minimal.h +++ b/include/build_config/SDL_build_config_minimal.h @@ -74,6 +74,9 @@ typedef unsigned int uintptr_t; /* Enable the stub HIDAPI */ #define SDL_HIDAPI_DISABLED 1 +/* Enable the stub process support */ +#define SDL_PROCESS_DUMMY 1 + /* Enable the stub sensor driver (src/sensor/dummy/\*.c) */ #define SDL_SENSOR_DISABLED 1 diff --git a/include/build_config/SDL_build_config_ngage.h b/include/build_config/SDL_build_config_ngage.h index 59694370..a834bc09 100644 --- a/include/build_config/SDL_build_config_ngage.h +++ b/include/build_config/SDL_build_config_ngage.h @@ -77,6 +77,9 @@ typedef unsigned long uintptr_t; /* Enable the stub HIDAPI */ #define SDL_HIDAPI_DISABLED 1 +/* Enable the stub process support */ +#define SDL_PROCESS_DUMMY 1 + /* Enable the stub sensor driver (src/sensor/dummy/\*.c) */ #define SDL_SENSOR_DISABLED 1 diff --git a/include/build_config/SDL_build_config_windows.h b/include/build_config/SDL_build_config_windows.h index 8a6eece1..24e21f88 100644 --- a/include/build_config/SDL_build_config_windows.h +++ b/include/build_config/SDL_build_config_windows.h @@ -160,6 +160,7 @@ typedef unsigned int uintptr_t; #define HAVE_ATOF 1 #define HAVE_STRCMP 1 #define HAVE_STRNCMP 1 +#define HAVE_STRPBRK 1 #define HAVE__WCSDUP 1 #define HAVE_SSCANF 1 #define HAVE_VSSCANF 1 @@ -201,7 +202,7 @@ typedef unsigned int uintptr_t; #define HAVE_SINF 1 #define HAVE_SQRTF 1 #define HAVE_TANF 1 -#if defined(_MSC_VER) +#ifdef _MSC_VER /* These functions were added with the VC++ 2013 C runtime library */ #if _MSC_VER >= 1800 #define HAVE_STRTOLL 1 @@ -241,9 +242,7 @@ typedef unsigned int uintptr_t; #define SDL_JOYSTICK_GAMEINPUT 1 #endif #define SDL_JOYSTICK_HIDAPI 1 -#ifndef SDL_PLATFORM_WINRT #define SDL_JOYSTICK_RAWINPUT 1 -#endif #define SDL_JOYSTICK_VIRTUAL 1 #ifdef HAVE_WINDOWS_GAMING_INPUT_H #define SDL_JOYSTICK_WGI 1 @@ -251,6 +250,9 @@ typedef unsigned int uintptr_t; #define SDL_JOYSTICK_XINPUT 1 #define SDL_HAPTIC_DINPUT 1 +/* Enable various process implementations */ +#define SDL_PROCESS_WINDOWS 1 + /* Enable the sensor driver */ #ifdef HAVE_SENSORSAPI_H #define SDL_SENSOR_WINDOWS 1 @@ -273,56 +275,34 @@ typedef unsigned int uintptr_t; #define SDL_TIMER_WINDOWS 1 /* Enable various video drivers */ -#define SDL_VIDEO_DRIVER_DUMMY 1 -#define SDL_VIDEO_DRIVER_OFFSCREEN 1 -#define SDL_VIDEO_DRIVER_WINDOWS 1 - -#ifndef SDL_VIDEO_RENDER_D3D -#define SDL_VIDEO_RENDER_D3D 1 -#endif -#if !defined(SDL_VIDEO_RENDER_D3D11) && defined(HAVE_D3D11_H) -#define SDL_VIDEO_RENDER_D3D11 1 -#endif -#if !defined(SDL_VIDEO_RENDER_D3D12) -#define SDL_VIDEO_RENDER_D3D12 1 +#define SDL_VIDEO_DRIVER_DUMMY 1 +#define SDL_VIDEO_DRIVER_OFFSCREEN 1 +#define SDL_VIDEO_DRIVER_WINDOWS 1 +#define SDL_VIDEO_RENDER_D3D 1 +#ifdef HAVE_D3D11_H +#define SDL_VIDEO_RENDER_D3D11 1 #endif +#define SDL_VIDEO_RENDER_D3D12 1 /* Enable OpenGL support */ -#ifndef SDL_VIDEO_OPENGL -#define SDL_VIDEO_OPENGL 1 -#endif -#ifndef SDL_VIDEO_OPENGL_WGL -#define SDL_VIDEO_OPENGL_WGL 1 -#endif -#ifndef SDL_VIDEO_RENDER_OGL -#define SDL_VIDEO_RENDER_OGL 1 -#endif -#ifndef SDL_VIDEO_RENDER_OGL_ES2 -#define SDL_VIDEO_RENDER_OGL_ES2 1 -#endif -#ifndef SDL_VIDEO_OPENGL_ES2 -#define SDL_VIDEO_OPENGL_ES2 1 -#endif -#ifndef SDL_VIDEO_OPENGL_EGL -#define SDL_VIDEO_OPENGL_EGL 1 -#endif +#define SDL_VIDEO_OPENGL 1 +#define SDL_VIDEO_OPENGL_WGL 1 +#define SDL_VIDEO_RENDER_OGL 1 +#define SDL_VIDEO_RENDER_OGL_ES2 1 +#define SDL_VIDEO_OPENGL_ES2 1 +#define SDL_VIDEO_OPENGL_EGL 1 /* Enable Vulkan support */ #define SDL_VIDEO_VULKAN 1 +#define SDL_VIDEO_RENDER_VULKAN 1 -#if !defined(SDL_GPU_D3D11) && defined(HAVE_D3D11_H) +/* Enable GPU support */ +#ifdef HAVE_D3D11_H #define SDL_GPU_D3D11 1 #endif -#if !defined(SDL_GPU_D3D12) #define SDL_GPU_D3D12 1 -#endif -#if !defined(SDL_GPU_VULKAN) && defined(SDL_VIDEO_VULKAN) #define SDL_GPU_VULKAN 1 -#endif - -#ifndef SDL_VIDEO_RENDER_VULKAN -#define SDL_VIDEO_RENDER_VULKAN 1 -#endif +#define SDL_VIDEO_RENDER_GPU 1 /* Enable system power support */ #define SDL_POWER_WINDOWS 1 diff --git a/include/build_config/SDL_build_config_wingdk.h b/include/build_config/SDL_build_config_wingdk.h index 8a89414d..5b7ebf1d 100644 --- a/include/build_config/SDL_build_config_wingdk.h +++ b/include/build_config/SDL_build_config_wingdk.h @@ -139,7 +139,7 @@ #define HAVE_SINF 1 #define HAVE_SQRTF 1 #define HAVE_TANF 1 -#if defined(_MSC_VER) +#ifdef _MSC_VER /* These functions were added with the VC++ 2013 C runtime library */ #define HAVE_STRTOLL 1 #define HAVE_STRTOULL 1 @@ -174,6 +174,9 @@ #define SDL_JOYSTICK_XINPUT 1 #define SDL_HAPTIC_DINPUT 1 +/* Enable various process implementations */ +#define SDL_PROCESS_WINDOWS 1 + /* Enable the sensor driver */ #ifdef HAVE_SENSORSAPI_H #define SDL_SENSOR_WINDOWS 1 @@ -196,52 +199,33 @@ #define SDL_TIMER_WINDOWS 1 /* Enable various video drivers */ -#define SDL_VIDEO_DRIVER_DUMMY 1 -#define SDL_VIDEO_DRIVER_WINDOWS 1 - -#ifndef SDL_VIDEO_RENDER_D3D -#define SDL_VIDEO_RENDER_D3D 1 -#endif -#if !defined(SDL_VIDEO_RENDER_D3D11) && defined(HAVE_D3D11_H) -#define SDL_VIDEO_RENDER_D3D11 1 -#endif -#if !defined(SDL_VIDEO_RENDER_D3D12) -#define SDL_VIDEO_RENDER_D3D12 1 +#define SDL_VIDEO_DRIVER_DUMMY 1 +#define SDL_VIDEO_DRIVER_WINDOWS 1 +#define SDL_VIDEO_RENDER_D3D 1 +#ifdef HAVE_D3D11_H +#define SDL_VIDEO_RENDER_D3D11 1 #endif +#define SDL_VIDEO_RENDER_D3D12 1 /* Enable OpenGL support */ -#ifndef SDL_VIDEO_OPENGL -#define SDL_VIDEO_OPENGL 1 -#endif -#ifndef SDL_VIDEO_OPENGL_WGL -#define SDL_VIDEO_OPENGL_WGL 1 -#endif -#ifndef SDL_VIDEO_RENDER_OGL -#define SDL_VIDEO_RENDER_OGL 1 -#endif -#ifndef SDL_VIDEO_RENDER_OGL_ES2 -#define SDL_VIDEO_RENDER_OGL_ES2 1 -#endif -#ifndef SDL_VIDEO_OPENGL_ES2 -#define SDL_VIDEO_OPENGL_ES2 1 -#endif -#ifndef SDL_VIDEO_OPENGL_EGL -#define SDL_VIDEO_OPENGL_EGL 1 -#endif +#define SDL_VIDEO_OPENGL 1 +#define SDL_VIDEO_OPENGL_WGL 1 +#define SDL_VIDEO_RENDER_OGL 1 +#define SDL_VIDEO_RENDER_OGL_ES2 1 +#define SDL_VIDEO_OPENGL_ES2 1 +#define SDL_VIDEO_OPENGL_EGL 1 /* Enable Vulkan support */ #define SDL_VIDEO_VULKAN 1 +#define SDL_VIDEO_RENDER_VULKAN 1 - -#if !defined(SDL_GPU_D3D11) && defined(HAVE_D3D11_H) +/* Enable GPU support */ +#ifdef HAVE_D3D11_H #define SDL_GPU_D3D11 1 #endif -#if !defined(SDL_GPU_D3D12) #define SDL_GPU_D3D12 1 -#endif -#if !defined(SDL_GPU_VULKAN) && defined(SDL_VIDEO_VULKAN) #define SDL_GPU_VULKAN 1 -#endif +#define SDL_VIDEO_RENDER_GPU 1 /* Enable system power support */ #define SDL_POWER_WINDOWS 1 diff --git a/include/build_config/SDL_build_config_winrt.h b/include/build_config/SDL_build_config_winrt.h deleted file mode 100644 index 57d1dea4..00000000 --- a/include/build_config/SDL_build_config_winrt.h +++ /dev/null @@ -1,228 +0,0 @@ -/* - 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. -*/ - -#ifndef SDL_build_config_winrt_h_ -#define SDL_build_config_winrt_h_ -#define SDL_build_config_h_ - -#include - -/* Make sure the Windows SDK's NTDDI_VERSION macro gets defined. This is used - by SDL to determine which version of the Windows SDK is being used. -*/ -#include - -/* Define possibly-undefined NTDDI values (used when compiling SDL against - older versions of the Windows SDK. -*/ -#ifndef NTDDI_WINBLUE -#define NTDDI_WINBLUE 0x06030000 -#endif -#ifndef NTDDI_WIN10 -#define NTDDI_WIN10 0x0A000000 -#endif - -/* This is a set of defines to configure the SDL features */ - -#ifdef __clang__ -# define HAVE_GCC_ATOMICS 1 -#endif - -/* Useful headers */ -#define HAVE_DXGI_H 1 -#if !SDL_WINAPI_FAMILY_PHONE -#define HAVE_XINPUT_H 1 -#endif - -#define HAVE_MMDEVICEAPI_H 1 -#define HAVE_AUDIOCLIENT_H 1 -#define HAVE_TPCSHRD_H 1 - -#define HAVE_LIBC 1 -#define HAVE_FLOAT_H 1 -#define HAVE_LIMITS_H 1 -#define HAVE_MATH_H 1 -#define HAVE_SIGNAL_H 1 -#define HAVE_STDARG_H 1 -#define HAVE_STDBOOL_H 1 -#define HAVE_STDDEF_H 1 -#define HAVE_STDINT_H 1 -#define HAVE_STDIO_H 1 -#define HAVE_STDLIB_H 1 -#define HAVE_STRING_H 1 -#define HAVE_WCHAR_H 1 - -/* C library functions */ -#define HAVE_LIBC 1 -#define HAVE_MALLOC 1 -#define HAVE_CALLOC 1 -#define HAVE_REALLOC 1 -#define HAVE_FREE 1 -#define HAVE_ABS 1 -#define HAVE_MEMSET 1 -#define HAVE_MEMCPY 1 -#define HAVE_MEMMOVE 1 -#define HAVE_MEMCMP 1 -#define HAVE_STRLEN 1 -#define HAVE__STRREV 1 -#define HAVE__STRUPR 1 -#define HAVE_STRCHR 1 -#define HAVE_STRRCHR 1 -#define HAVE_STRSTR 1 -#define HAVE_STRTOL 1 -#define HAVE_STRTOUL 1 -/* #undef HAVE_STRTOLL */ -/* #undef HAVE_STRTOULL */ -#define HAVE_STRTOD 1 -#define HAVE_ATOI 1 -#define HAVE_ATOF 1 -#define HAVE_STRCMP 1 -#define HAVE_STRNCMP 1 -#define HAVE_VSNPRINTF 1 -/* TODO, WinRT: consider using ??_s versions of the following */ -/* #undef HAVE__STRLWR */ -/* #undef HAVE_ITOA */ -/* #undef HAVE__LTOA */ -/* #undef HAVE__ULTOA */ -/* #undef HAVE_SSCANF */ -#define HAVE_ACOS 1 -#define HAVE_ACOSF 1 -#define HAVE_ASIN 1 -#define HAVE_ASINF 1 -#define HAVE_ATAN 1 -#define HAVE_ATANF 1 -#define HAVE_ATAN2 1 -#define HAVE_ATAN2F 1 -#define HAVE_CEIL 1 -#define HAVE_CEILF 1 -#define HAVE__COPYSIGN 1 -#define HAVE_COS 1 -#define HAVE_COSF 1 -#define HAVE_EXP 1 -#define HAVE_EXPF 1 -#define HAVE_FABS 1 -#define HAVE_FABSF 1 -#define HAVE_FLOOR 1 -#define HAVE_FLOORF 1 -#define HAVE_FMOD 1 -#define HAVE_FMODF 1 -#define HAVE_ISINF 1 -#define HAVE_ISINF_FLOAT_MACRO 1 -#define HAVE_ISNAN 1 -#define HAVE_ISNAN_FLOAT_MACRO 1 -#define HAVE_LOG 1 -#define HAVE_LOGF 1 -#define HAVE_LOG10 1 -#define HAVE_LOG10F 1 -#define HAVE_LROUND 1 -#define HAVE_LROUNDF 1 -#define HAVE_MODF 1 -#define HAVE_MODFF 1 -#define HAVE_POW 1 -#define HAVE_POWF 1 -#define HAVE_ROUND 1 -#define HAVE_ROUNDF 1 -#define HAVE__SCALB 1 -#define HAVE_SIN 1 -#define HAVE_SINF 1 -#define HAVE_SQRT 1 -#define HAVE_SQRTF 1 -#define HAVE_TAN 1 -#define HAVE_TANF 1 -#define HAVE_TRUNC 1 -#define HAVE_TRUNCF 1 -#define HAVE__FSEEKI64 1 - -#define HAVE_ROAPI_H 1 - -/* Enable various audio drivers */ -#define SDL_AUDIO_DRIVER_WASAPI 1 -#define SDL_AUDIO_DRIVER_DISK 1 -#define SDL_AUDIO_DRIVER_DUMMY 1 - -/* Enable various input drivers */ -#if SDL_WINAPI_FAMILY_PHONE -#define SDL_JOYSTICK_DISABLED 1 -#define SDL_HAPTIC_DISABLED 1 -#else -#define SDL_JOYSTICK_VIRTUAL 1 -#if (NTDDI_VERSION >= NTDDI_WIN10) -#define SDL_JOYSTICK_WGI 1 -#define SDL_HAPTIC_DISABLED 1 -#else -#define SDL_JOYSTICK_XINPUT 1 -#endif /* WIN10 */ -#endif - -/* WinRT doesn't have HIDAPI available */ -#define SDL_HIDAPI_DISABLED 1 - -/* Enable the dummy sensor driver */ -#define SDL_SENSOR_DUMMY 1 - -/* Enable various shared object loading systems */ -#define SDL_LOADSO_WINDOWS 1 - -/* Enable various threading systems */ -#if (NTDDI_VERSION >= NTDDI_WINBLUE) -#define SDL_THREAD_GENERIC_COND_SUFFIX 1 -#define SDL_THREAD_GENERIC_RWLOCK_SUFFIX 1 -#define SDL_THREAD_WINDOWS 1 -#else -/* WinRT on Windows 8.0 and Windows Phone 8.0 don't support CreateThread() */ -#define SDL_THREAD_STDCPP 1 -#endif - -/* Enable RTC system */ -#define SDL_TIME_WINDOWS 1 - -/* Enable various timer systems */ -#define SDL_TIMER_WINDOWS 1 - -/* Enable various video drivers */ -#define SDL_VIDEO_DRIVER_WINRT 1 -#define SDL_VIDEO_DRIVER_DUMMY 1 - -/* Enable OpenGL ES 2.0 (via a modified ANGLE library) */ -#define SDL_VIDEO_OPENGL_ES2 1 -#define SDL_VIDEO_OPENGL_EGL 1 - -/* Enable appropriate renderer(s) */ -#define SDL_VIDEO_RENDER_D3D11 1 - -/* Disable D3D12 as it's not implemented for WinRT */ -/* #undef SDL_VIDEO_RENDER_D3D12 */ - -#ifdef SDL_VIDEO_OPENGL_ES2 -#define SDL_VIDEO_RENDER_OGL_ES2 1 -#endif - -/* Enable system power support */ -#define SDL_POWER_WINRT 1 - -/* Enable filesystem support */ -#define SDL_FILESYSTEM_WINDOWS 1 -#define SDL_FSOPS_WINDOWS 1 - -/* Enable the camera driver (src/camera/dummy/\*.c) */ /* !!! FIXME */ -#define SDL_CAMERA_DRIVER_DUMMY 1 - -#endif /* SDL_build_config_winrt_h_ */ diff --git a/include/build_config/SDL_build_config_xbox.h b/include/build_config/SDL_build_config_xbox.h index 75066714..02e06799 100644 --- a/include/build_config/SDL_build_config_xbox.h +++ b/include/build_config/SDL_build_config_xbox.h @@ -82,6 +82,7 @@ #define HAVE_MEMMOVE 1 #define HAVE_MEMCMP 1 #define HAVE_STRLEN 1 +#define HAVE_STRPBRK 1 #define HAVE__STRREV 1 /* These functions have security warnings, so we won't use them */ /* #undef HAVE__STRUPR */ @@ -138,7 +139,7 @@ #define HAVE_SINF 1 #define HAVE_SQRTF 1 #define HAVE_TANF 1 -#if defined(_MSC_VER) +#ifdef _MSC_VER /* These functions were added with the VC++ 2013 C runtime library */ #define HAVE_STRTOLL 1 #define HAVE_STRTOULL 1 @@ -171,6 +172,9 @@ #define SDL_JOYSTICK_GAMEINPUT 1 #define SDL_HAPTIC_DUMMY 1 +/* Enable various process implementations */ +#define SDL_PROCESS_DUMMY 1 + /* Enable the sensor driver */ #ifdef HAVE_SENSORSAPI_H #define SDL_SENSOR_WINDOWS 1 @@ -193,27 +197,18 @@ #define SDL_TIMER_WINDOWS 1 /* Enable various video drivers */ -#define SDL_VIDEO_DRIVER_DUMMY 1 -#define SDL_VIDEO_DRIVER_WINDOWS 1 - -#if !defined(SDL_VIDEO_RENDER_D3D12) -#define SDL_VIDEO_RENDER_D3D12 1 -#endif - -#if !defined(SDL_GPU_D3D12) -#define SDL_GPU_D3D12 1 -#endif +#define SDL_VIDEO_DRIVER_DUMMY 1 +#define SDL_VIDEO_DRIVER_WINDOWS 1 +#define SDL_VIDEO_RENDER_D3D12 1 /* Enable OpenGL support */ -#ifndef SDL_VIDEO_OPENGL -#define SDL_VIDEO_OPENGL 1 -#endif -#ifndef SDL_VIDEO_OPENGL_WGL -#define SDL_VIDEO_OPENGL_WGL 1 -#endif -#ifndef SDL_VIDEO_RENDER_OGL -#define SDL_VIDEO_RENDER_OGL 1 -#endif +#define SDL_VIDEO_OPENGL 1 +#define SDL_VIDEO_OPENGL_WGL 1 +#define SDL_VIDEO_RENDER_OGL 1 + +/* Enable GPU support */ +#define SDL_GPU_D3D12 1 +#define SDL_VIDEO_RENDER_GPU 1 /* Enable system power support */ /*#define SDL_POWER_WINDOWS 1*/ diff --git a/src/SDL.c b/src/SDL.c index ef1d815d..6875d968 100644 --- a/src/SDL.c +++ b/src/SDL.c @@ -21,9 +21,9 @@ #include "SDL_internal.h" #include "SDL3/SDL_revision.h" -#if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK) +#if defined(SDL_PLATFORM_WINDOWS) #include "core/windows/SDL_windows.h" -#elif !defined(SDL_PLATFORM_WINRT) +#else #include // _exit(), etc. #endif @@ -49,6 +49,7 @@ #include "joystick/SDL_joystick_c.h" #include "render/SDL_sysrender.h" #include "sensor/SDL_sensor_c.h" +#include "stdlib/SDL_getenv_c.h" #include "thread/SDL_thread_c.h" #include "video/SDL_pixels_c.h" #include "video/SDL_video_c.h" @@ -86,7 +87,7 @@ SDL_COMPILE_TIME_ASSERT(SDL_MICRO_VERSION_max, SDL_MICRO_VERSION <= 999); extern SDL_NORETURN void SDL_ExitProcess(int exitcode); SDL_NORETURN void SDL_ExitProcess(int exitcode) { -#if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK) +#if defined(SDL_PLATFORM_WINDOWS) /* "if you do not know the state of all threads in your process, it is better to call TerminateProcess than ExitProcess" https://msdn.microsoft.com/en-us/library/windows/desktop/ms682658(v=vs.85).aspx */ @@ -109,7 +110,7 @@ SDL_NORETURN void SDL_ExitProcess(int exitcode) // App metadata -SDL_bool SDL_SetAppMetadata(const char *appname, const char *appversion, const char *appidentifier) +bool SDL_SetAppMetadata(const char *appname, const char *appversion, const char *appidentifier) { SDL_SetAppMetadataProperty(SDL_PROP_APP_METADATA_NAME_STRING, appname); SDL_SetAppMetadataProperty(SDL_PROP_APP_METADATA_VERSION_STRING, appversion); @@ -135,7 +136,7 @@ static bool SDL_ValidMetadataProperty(const char *name) return false; } -SDL_bool SDL_SetAppMetadataProperty(const char *name, const char *value) +bool SDL_SetAppMetadataProperty(const char *name, const char *value) { if (!SDL_ValidMetadataProperty(name)) { return SDL_InvalidParamError("name"); @@ -250,25 +251,20 @@ void SDL_SetMainReady(void) void SDL_InitMainThread(void) { SDL_InitTLSData(); + SDL_InitEnvironment(); SDL_InitTicks(); SDL_InitFilesystem(); - SDL_InitLog(); - SDL_InitProperties(); - SDL_GetGlobalProperties(); - SDL_InitHints(); } static void SDL_QuitMainThread(void) { - SDL_QuitHints(); - SDL_QuitProperties(); - SDL_QuitLog(); SDL_QuitFilesystem(); SDL_QuitTicks(); + SDL_QuitEnvironment(); SDL_QuitTLSData(); } -SDL_bool SDL_InitSubSystem(SDL_InitFlags flags) +bool SDL_InitSubSystem(SDL_InitFlags flags) { Uint32 flags_initialized = 0; @@ -304,20 +300,6 @@ SDL_bool SDL_InitSubSystem(SDL_InitFlags flags) flags_initialized |= SDL_INIT_EVENTS; } - // Initialize the timer subsystem - if (flags & SDL_INIT_TIMER) { - if (SDL_ShouldInitSubsystem(SDL_INIT_TIMER)) { - SDL_IncrementSubsystemRefCount(SDL_INIT_TIMER); - if (!SDL_InitTimers()) { - SDL_DecrementSubsystemRefCount(SDL_INIT_TIMER); - goto quit_and_error; - } - } else { - SDL_IncrementSubsystemRefCount(SDL_INIT_TIMER); - } - flags_initialized |= SDL_INIT_TIMER; - } - // Initialize the video subsystem if (flags & SDL_INIT_VIDEO) { #ifndef SDL_VIDEO_DISABLED @@ -330,6 +312,7 @@ SDL_bool SDL_InitSubSystem(SDL_InitFlags flags) SDL_IncrementSubsystemRefCount(SDL_INIT_VIDEO); if (!SDL_VideoInit(NULL)) { SDL_DecrementSubsystemRefCount(SDL_INIT_VIDEO); + SDL_QuitSubSystem(SDL_INIT_EVENTS); goto quit_and_error; } } else { @@ -354,6 +337,7 @@ SDL_bool SDL_InitSubSystem(SDL_InitFlags flags) SDL_IncrementSubsystemRefCount(SDL_INIT_AUDIO); if (!SDL_InitAudio(NULL)) { SDL_DecrementSubsystemRefCount(SDL_INIT_AUDIO); + SDL_QuitSubSystem(SDL_INIT_EVENTS); goto quit_and_error; } } else { @@ -378,6 +362,7 @@ SDL_bool SDL_InitSubSystem(SDL_InitFlags flags) SDL_IncrementSubsystemRefCount(SDL_INIT_JOYSTICK); if (!SDL_InitJoysticks()) { SDL_DecrementSubsystemRefCount(SDL_INIT_JOYSTICK); + SDL_QuitSubSystem(SDL_INIT_EVENTS); goto quit_and_error; } } else { @@ -401,6 +386,7 @@ SDL_bool SDL_InitSubSystem(SDL_InitFlags flags) SDL_IncrementSubsystemRefCount(SDL_INIT_GAMEPAD); if (!SDL_InitGamepads()) { SDL_DecrementSubsystemRefCount(SDL_INIT_GAMEPAD); + SDL_QuitSubSystem(SDL_INIT_JOYSTICK); goto quit_and_error; } } else { @@ -463,6 +449,7 @@ SDL_bool SDL_InitSubSystem(SDL_InitFlags flags) SDL_IncrementSubsystemRefCount(SDL_INIT_CAMERA); if (!SDL_CameraInit(NULL)) { SDL_DecrementSubsystemRefCount(SDL_INIT_CAMERA); + SDL_QuitSubSystem(SDL_INIT_EVENTS); goto quit_and_error; } } else { @@ -484,7 +471,7 @@ quit_and_error: return false; } -SDL_bool SDL_Init(SDL_InitFlags flags) +bool SDL_Init(SDL_InitFlags flags) { return SDL_InitSubSystem(flags); } @@ -565,13 +552,6 @@ void SDL_QuitSubSystem(SDL_InitFlags flags) } #endif - if (flags & SDL_INIT_TIMER) { - if (SDL_ShouldQuitSubsystem(SDL_INIT_TIMER)) { - SDL_QuitTimers(); - } - SDL_DecrementSubsystemRefCount(SDL_INIT_TIMER); - } - if (flags & SDL_INIT_EVENTS) { if (SDL_ShouldQuitSubsystem(SDL_INIT_EVENTS)) { SDL_QuitEvents(); @@ -624,6 +604,8 @@ void SDL_Quit(void) SDL_DBus_Quit(); #endif + SDL_QuitTimers(); + SDL_SetObjectsInvalid(); SDL_AssertionsQuit(); @@ -636,6 +618,10 @@ void SDL_Quit(void) */ SDL_memset(SDL_SubsystemRefCount, 0x0, sizeof(SDL_SubsystemRefCount)); + SDL_QuitLog(); + SDL_QuitHints(); + SDL_QuitProperties(); + SDL_QuitMainThread(); SDL_bInMainQuit = false; @@ -694,8 +680,6 @@ const char *SDL_GetPlatform(void) return "Solaris"; #elif defined(SDL_PLATFORM_WIN32) return "Windows"; -#elif defined(SDL_PLATFORM_WINRT) - return "WinRT"; #elif defined(SDL_PLATFORM_WINGDK) return "WinGDK"; #elif defined(SDL_PLATFORM_XBOXONE) @@ -723,7 +707,7 @@ const char *SDL_GetPlatform(void) #endif } -SDL_bool SDL_IsTablet(void) +bool SDL_IsTablet(void) { #ifdef SDL_PLATFORM_ANDROID extern bool SDL_IsAndroidTablet(void); @@ -754,4 +738,4 @@ BOOL APIENTRY MINGW32_FORCEALIGN _DllMainCRTStartup(HANDLE hModule, DWORD ul_rea } #endif // Building DLL -#endif // defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK) +#endif // defined(SDL_PLATFORM_WIN32) diff --git a/src/SDL_assert.c b/src/SDL_assert.c index 986f08ee..c60737f2 100644 --- a/src/SDL_assert.c +++ b/src/SDL_assert.c @@ -20,14 +20,14 @@ */ #include "SDL_internal.h" -#if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK) +#if defined(SDL_PLATFORM_WINDOWS) #include "core/windows/SDL_windows.h" #endif #include "SDL_assert_c.h" #include "video/SDL_sysvideo.h" -#if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK) +#if defined(SDL_PLATFORM_WINDOWS) #ifndef WS_OVERLAPPEDWINDOW #define WS_OVERLAPPEDWINDOW 0 #endif @@ -86,7 +86,7 @@ static void SDL_AddAssertionToReport(SDL_AssertData *data) } } -#if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK) +#if defined(SDL_PLATFORM_WINDOWS) #define ENDLINE "\r\n" #else #define ENDLINE "\n" diff --git a/src/SDL_error.c b/src/SDL_error.c index 78943e66..f5cb0c2c 100644 --- a/src/SDL_error.c +++ b/src/SDL_error.c @@ -24,7 +24,7 @@ #include "SDL_error_c.h" -SDL_bool SDL_SetError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) +bool SDL_SetError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) { // Ignore call if invalid format pointer was passed if (fmt) { @@ -77,7 +77,7 @@ const char *SDL_GetError(void) } } -SDL_bool SDL_ClearError(void) +bool SDL_ClearError(void) { SDL_error *error = SDL_GetErrBuf(false); @@ -87,7 +87,7 @@ SDL_bool SDL_ClearError(void) return true; } -SDL_bool SDL_OutOfMemory(void) +bool SDL_OutOfMemory(void) { SDL_error *error = SDL_GetErrBuf(true); diff --git a/src/SDL_hashtable.c b/src/SDL_hashtable.c index 168fe1e3..feaa08f5 100644 --- a/src/SDL_hashtable.c +++ b/src/SDL_hashtable.c @@ -294,12 +294,17 @@ Uint32 SDL_HashString(const void *key, void *data) bool SDL_KeyMatchString(const void *a, const void *b, void *data) { + const char *a_string = (const char *)a; + const char *b_string = (const char *)b; + if (a == b) { return true; // same pointer, must match. } else if (!a || !b) { return false; // one pointer is NULL (and first test shows they aren't the same pointer), must not match. + } else if (a_string[0] != b_string[0]) { + return false; // we know they don't match } - return (SDL_strcmp((const char *)a, (const char *)b) == 0); // Check against actual string contents. + return (SDL_strcmp(a_string, b_string) == 0); // Check against actual string contents. } // We assume we can fit the ID in the key directly @@ -318,6 +323,11 @@ bool SDL_KeyMatchID(const void *a, const void *b, void *unused) return false; } +void SDL_NukeFreeKey(const void *key, const void *value, void *unused) +{ + SDL_free((void *)key); +} + void SDL_NukeFreeValue(const void *key, const void *value, void *unused) { SDL_free((void *)value); diff --git a/src/SDL_hashtable.h b/src/SDL_hashtable.h index c897e07c..55b6d53e 100644 --- a/src/SDL_hashtable.h +++ b/src/SDL_hashtable.h @@ -55,6 +55,7 @@ extern bool SDL_KeyMatchString(const void *a, const void *b, void *unused); extern Uint32 SDL_HashID(const void *key, void *unused); extern bool SDL_KeyMatchID(const void *a, const void *b, void *unused); +extern void SDL_NukeFreeKey(const void *key, const void *value, void *unused); extern void SDL_NukeFreeValue(const void *key, const void *value, void *unused); #endif // SDL_hashtable_h_ diff --git a/src/SDL_hints.c b/src/SDL_hints.c index 8dd9c551..6fcd8b8c 100644 --- a/src/SDL_hints.c +++ b/src/SDL_hints.c @@ -36,20 +36,37 @@ typedef struct SDL_Hint SDL_HintWatch *callbacks; } SDL_Hint; -static SDL_PropertiesID SDL_hint_props = 0; +static SDL_AtomicU32 SDL_hint_props; -static SDL_PropertiesID GetHintProperties(bool create) -{ - if (!SDL_hint_props && create) { - SDL_hint_props = SDL_CreateProperties(); - } - return SDL_hint_props; -} void SDL_InitHints(void) { - // Just make sure the hint properties are created on the main thread - (void)GetHintProperties(true); +} + +void SDL_QuitHints(void) +{ + SDL_PropertiesID props; + do { + props = SDL_GetAtomicU32(&SDL_hint_props); + } while (!SDL_CompareAndSwapAtomicU32(&SDL_hint_props, props, 0)); + + if (props) { + SDL_DestroyProperties(props); + } +} + +static SDL_PropertiesID GetHintProperties(bool create) +{ + SDL_PropertiesID props = SDL_GetAtomicU32(&SDL_hint_props); + if (!props && create) { + props = SDL_CreateProperties(); + if (!SDL_CompareAndSwapAtomicU32(&SDL_hint_props, 0, props)) { + // Somebody else created hint properties before us, just use those + SDL_DestroyProperties(props); + props = SDL_GetAtomicU32(&SDL_hint_props); + } + } + return props; } static void SDLCALL CleanupHintProperty(void *userdata, void *value) @@ -66,7 +83,7 @@ static void SDLCALL CleanupHintProperty(void *userdata, void *value) SDL_free(hint); } -SDL_bool SDL_SetHintWithPriority(const char *name, const char *value, SDL_HintPriority priority) +bool SDL_SetHintWithPriority(const char *name, const char *value, SDL_HintPriority priority) { if (!name || !*name) { return SDL_InvalidParamError("name"); @@ -120,7 +137,7 @@ SDL_bool SDL_SetHintWithPriority(const char *name, const char *value, SDL_HintPr return result; } -SDL_bool SDL_ResetHint(const char *name) +bool SDL_ResetHint(const char *name) { if (!name || !*name) { return SDL_InvalidParamError("name"); @@ -185,7 +202,7 @@ void SDL_ResetHints(void) SDL_EnumerateProperties(GetHintProperties(false), ResetHintsCallback, NULL); } -SDL_bool SDL_SetHint(const char *name, const char *value) +bool SDL_SetHint(const char *name, const char *value) { return SDL_SetHintWithPriority(name, value, SDL_HINT_NORMAL); } @@ -243,13 +260,13 @@ bool SDL_GetStringBoolean(const char *value, bool default_value) return true; } -SDL_bool SDL_GetHintBoolean(const char *name, SDL_bool default_value) +bool SDL_GetHintBoolean(const char *name, bool default_value) { const char *hint = SDL_GetHint(name); return SDL_GetStringBoolean(hint, default_value); } -SDL_bool SDL_AddHintCallback(const char *name, SDL_HintCallback callback, void *userdata) +bool SDL_AddHintCallback(const char *name, SDL_HintCallback callback, void *userdata) { if (!name || !*name) { return SDL_InvalidParamError("name"); @@ -336,9 +353,3 @@ void SDL_RemoveHintCallback(const char *name, SDL_HintCallback callback, void *u SDL_UnlockProperties(hints); } -void SDL_QuitHints(void) -{ - SDL_DestroyProperties(SDL_hint_props); - SDL_hint_props = 0; -} - diff --git a/src/SDL_internal.h b/src/SDL_internal.h index c44f631f..4a83cf4c 100644 --- a/src/SDL_internal.h +++ b/src/SDL_internal.h @@ -191,79 +191,28 @@ #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_ES2 -#define SDL_VIDEO_RENDER_OGL_ES2 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 -#ifndef SDL_VIDEO_RENDER_VULKAN -#define SDL_VIDEO_RENDER_VULKAN 0 -#endif -#else // define all as 0 +#ifdef SDL_RENDER_DISABLED #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_GPU #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_ES2 -#define SDL_VIDEO_RENDER_OGL_ES2 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 #undef SDL_VIDEO_RENDER_VULKAN -#define SDL_VIDEO_RENDER_VULKAN 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_ES2 | \ - SDL_VIDEO_RENDER_PS2 | \ - SDL_VIDEO_RENDER_PSP | \ - SDL_VIDEO_RENDER_VITA_GXM | \ - SDL_VIDEO_RENDER_VULKAN ) - -#if !defined(SDL_RENDER_DISABLED) && !SDL_HAS_RENDER_DRIVER -#error SDL_RENDER enabled without any backend drivers. -#endif +#ifdef SDL_GPU_DISABLED +#undef SDL_GPU_D3D11 +#undef SDL_GPU_D3D12 +#undef SDL_GPU_METAL +#undef SDL_GPU_VULKAN +#undef SDL_VIDEO_RENDER_GPU +#endif // SDL_GPU_DISABLED #if !defined(HAVE_LIBC) // If not using _any_ C runtime, these have to be defined before SDL_thread.h @@ -292,9 +241,9 @@ extern void SDL_InitMainThread(void); /* The internal implementations of these functions have up to nanosecond precision. We can expose these functions as part of the API if we want to later. */ -extern SDL_bool SDLCALL SDL_WaitSemaphoreTimeoutNS(SDL_Semaphore *sem, Sint64 timeoutNS); -extern SDL_bool SDLCALL SDL_WaitConditionTimeoutNS(SDL_Condition *cond, SDL_Mutex *mutex, Sint64 timeoutNS); -extern SDL_bool SDLCALL SDL_WaitEventTimeoutNS(SDL_Event *event, Sint64 timeoutNS); +extern bool SDLCALL SDL_WaitSemaphoreTimeoutNS(SDL_Semaphore *sem, Sint64 timeoutNS); +extern bool SDLCALL SDL_WaitConditionTimeoutNS(SDL_Condition *cond, SDL_Mutex *mutex, Sint64 timeoutNS); +extern bool SDLCALL SDL_WaitEventTimeoutNS(SDL_Event *event, Sint64 timeoutNS); // Ends C function definitions when using C++ #ifdef __cplusplus diff --git a/src/SDL_log.c b/src/SDL_log.c index f09289a2..1b9be017 100644 --- a/src/SDL_log.c +++ b/src/SDL_log.c @@ -20,7 +20,7 @@ */ #include "SDL_internal.h" -#if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINRT) || defined(SDL_PLATFORM_GDK) +#if defined(SDL_PLATFORM_WINDOWS) #include "core/windows/SDL_windows.h" #endif @@ -54,14 +54,17 @@ typedef struct SDL_LogLevel // The default log output function static void SDLCALL SDL_LogOutput(void *userdata, int category, SDL_LogPriority priority, const char *message); -static void SDL_ResetLogPrefixes(void); +static void CleanupLogPriorities(void); +static void CleanupLogPrefixes(void); -static SDL_LogLevel *SDL_loglevels; -static bool SDL_forced_priority = 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 SDL_InitState SDL_log_init; +static SDL_Mutex *SDL_log_lock; +static SDL_Mutex *SDL_log_function_lock; +static SDL_LogLevel *SDL_loglevels SDL_GUARDED_BY(SDL_log_lock); +static SDL_LogPriority SDL_log_priorities[SDL_LOG_CATEGORY_CUSTOM] SDL_GUARDED_BY(SDL_log_lock); +static SDL_LogPriority SDL_log_default_priority SDL_GUARDED_BY(SDL_log_lock); +static SDL_LogOutputFunction SDL_log_function SDL_GUARDED_BY(SDL_log_function_lock) = SDL_LogOutput; +static void *SDL_log_userdata SDL_GUARDED_BY(SDL_log_function_lock) = NULL; #ifdef HAVE_GCC_DIAGNOSTIC_PRAGMA #pragma GCC diagnostic push @@ -71,6 +74,7 @@ static SDL_Mutex *log_function_mutex = NULL; // If this list changes, update the documentation for SDL_HINT_LOGGING static const char * const SDL_priority_names[] = { NULL, + "TRACE", "VERBOSE", "DEBUG", "INFO", @@ -78,9 +82,10 @@ static const char * const SDL_priority_names[] = { "ERROR", "CRITICAL" }; -SDL_COMPILE_TIME_ASSERT(priority_names, SDL_arraysize(SDL_priority_names) == SDL_NUM_LOG_PRIORITIES); +SDL_COMPILE_TIME_ASSERT(priority_names, SDL_arraysize(SDL_priority_names) == SDL_LOG_PRIORITY_COUNT); -static const char *SDL_priority_prefixes[SDL_NUM_LOG_PRIORITIES]; +// This is guarded by SDL_log_function_lock because it's the logging function that calls GetLogPriorityPrefix() +static char *SDL_priority_prefixes[SDL_LOG_PRIORITY_COUNT] SDL_GUARDED_BY(SDL_log_function_lock); // If this list changes, update the documentation for SDL_HINT_LOGGING static const char * const SDL_category_names[] = { @@ -91,81 +96,178 @@ static const char * const SDL_category_names[] = { "AUDIO", "VIDEO", "RENDER", - "GPU", "INPUT", - "TEST" + "TEST", + "GPU" }; -SDL_COMPILE_TIME_ASSERT(category_names, SDL_arraysize(SDL_category_names) == SDL_LOG_CATEGORY_RESERVED1); +SDL_COMPILE_TIME_ASSERT(category_names, SDL_arraysize(SDL_category_names) == SDL_LOG_CATEGORY_RESERVED2); #ifdef HAVE_GCC_DIAGNOSTIC_PRAGMA #pragma GCC diagnostic pop #endif #ifdef SDL_PLATFORM_ANDROID -static int SDL_android_priority[SDL_NUM_LOG_PRIORITIES] = { +static int SDL_android_priority[] = { ANDROID_LOG_UNKNOWN, ANDROID_LOG_VERBOSE, + ANDROID_LOG_VERBOSE, ANDROID_LOG_DEBUG, ANDROID_LOG_INFO, ANDROID_LOG_WARN, ANDROID_LOG_ERROR, ANDROID_LOG_FATAL }; +SDL_COMPILE_TIME_ASSERT(android_priority, SDL_arraysize(SDL_android_priority) == SDL_LOG_PRIORITY_COUNT); #endif // SDL_PLATFORM_ANDROID +static void SDLCALL SDL_LoggingChanged(void *userdata, const char *name, const char *oldValue, const char *hint) +{ + SDL_ResetLogPriorities(); +} + void SDL_InitLog(void) { - if (!log_function_mutex) { - // if this fails we'll try to continue without it. - log_function_mutex = SDL_CreateMutex(); + if (!SDL_ShouldInit(&SDL_log_init)) { + return; } + + // If these fail we'll continue without them. + SDL_log_lock = SDL_CreateMutex(); + SDL_log_function_lock = SDL_CreateMutex(); + + SDL_AddHintCallback(SDL_HINT_LOGGING, SDL_LoggingChanged, NULL); + + SDL_SetInitialized(&SDL_log_init, true); } void SDL_QuitLog(void) { - SDL_ResetLogPriorities(); - SDL_ResetLogPrefixes(); + if (!SDL_ShouldQuit(&SDL_log_init)) { + return; + } - if (log_function_mutex) { - SDL_DestroyMutex(log_function_mutex); - log_function_mutex = NULL; + SDL_RemoveHintCallback(SDL_HINT_LOGGING, SDL_LoggingChanged, NULL); + + CleanupLogPriorities(); + CleanupLogPrefixes(); + + if (SDL_log_lock) { + SDL_DestroyMutex(SDL_log_lock); + SDL_log_lock = NULL; + } + if (SDL_log_function_lock) { + SDL_DestroyMutex(SDL_log_function_lock); + SDL_log_function_lock = NULL; + } + + SDL_SetInitialized(&SDL_log_init, false); +} + +static void SDL_CheckInitLog(void) +{ + int status = SDL_GetAtomicInt(&SDL_log_init.status); + if (status == SDL_INIT_STATUS_INITIALIZED || + (status == SDL_INIT_STATUS_INITIALIZING && SDL_log_init.thread == SDL_GetCurrentThreadID())) { + return; + } + + SDL_InitLog(); +} + +static void CleanupLogPriorities(void) +{ + while (SDL_loglevels) { + SDL_LogLevel *entry = SDL_loglevels; + SDL_loglevels = entry->next; + SDL_free(entry); } } void SDL_SetLogPriorities(SDL_LogPriority priority) { - SDL_LogLevel *entry; + SDL_CheckInitLog(); - for (entry = SDL_loglevels; entry; entry = entry->next) { - entry->priority = priority; + SDL_LockMutex(SDL_log_lock); + { + CleanupLogPriorities(); + + SDL_log_default_priority = priority; + for (int i = 0; i < SDL_arraysize(SDL_log_priorities); ++i) { + SDL_log_priorities[i] = priority; + } } - - SDL_forced_priority = true; - SDL_forced_priority_level = priority; + SDL_UnlockMutex(SDL_log_lock); } void SDL_SetLogPriority(int category, SDL_LogPriority priority) { SDL_LogLevel *entry; - for (entry = SDL_loglevels; entry; entry = entry->next) { - if (entry->category == category) { - entry->priority = priority; - return; + SDL_CheckInitLog(); + + SDL_LockMutex(SDL_log_lock); + { + if (category >= 0 && category < SDL_arraysize(SDL_log_priorities)) { + SDL_log_priorities[category] = priority; + } else { + for (entry = SDL_loglevels; entry; entry = entry->next) { + if (entry->category == category) { + entry->priority = priority; + break; + } + } + + if (!entry) { + entry = (SDL_LogLevel *)SDL_malloc(sizeof(*entry)); + if (entry) { + entry->category = category; + entry->priority = priority; + entry->next = SDL_loglevels; + SDL_loglevels = entry; + } + } } } - - // Create a new entry - entry = (SDL_LogLevel *)SDL_malloc(sizeof(*entry)); - if (entry) { - entry->category = category; - entry->priority = priority; - entry->next = SDL_loglevels; - SDL_loglevels = entry; - } + SDL_UnlockMutex(SDL_log_lock); } -static bool SDL_ParseLogCategory(const char *string, size_t length, int *category) +SDL_LogPriority SDL_GetLogPriority(int category) +{ + SDL_LogLevel *entry; + SDL_LogPriority priority = SDL_LOG_PRIORITY_INVALID; + + SDL_CheckInitLog(); + + // Bypass the lock for known categories + // Technically if the priority was set on a different CPU the value might not + // be visible on this CPU for a while, but in practice it's fast enough that + // this performance improvement is worthwhile. + if (category >= 0 && category < SDL_arraysize(SDL_log_priorities)) { + return SDL_log_priorities[category]; + } + + SDL_LockMutex(SDL_log_lock); + { + if (category >= 0 && category < SDL_arraysize(SDL_log_priorities)) { + priority = SDL_log_priorities[category]; + } else { + for (entry = SDL_loglevels; entry; entry = entry->next) { + if (entry->category == category) { + priority = entry->priority; + break; + } + } + if (priority == SDL_LOG_PRIORITY_INVALID) { + priority = SDL_log_default_priority; + } + } + } + SDL_UnlockMutex(SDL_log_lock); + + return priority; +} + +static bool ParseLogCategory(const char *string, size_t length, int *category) { int i; @@ -188,7 +290,7 @@ static bool SDL_ParseLogCategory(const char *string, size_t length, int *categor return false; } -static bool SDL_ParseLogPriority(const char *string, size_t length, SDL_LogPriority *priority) +static bool ParseLogPriority(const char *string, size_t length, SDL_LogPriority *priority) { int i; @@ -196,10 +298,10 @@ static bool SDL_ParseLogPriority(const char *string, size_t length, SDL_LogPrior i = SDL_atoi(string); if (i == 0) { // 0 has a special meaning of "disable this category" - *priority = SDL_NUM_LOG_PRIORITIES; + *priority = SDL_LOG_PRIORITY_COUNT; return true; } - if (i >= SDL_LOG_PRIORITY_VERBOSE && i < SDL_NUM_LOG_PRIORITIES) { + if (i > SDL_LOG_PRIORITY_INVALID && i < SDL_LOG_PRIORITY_COUNT) { *priority = (SDL_LogPriority)i; return true; } @@ -207,11 +309,11 @@ static bool SDL_ParseLogPriority(const char *string, size_t length, SDL_LogPrior } if (SDL_strncasecmp(string, "quiet", length) == 0) { - *priority = SDL_NUM_LOG_PRIORITIES; + *priority = SDL_LOG_PRIORITY_COUNT; return true; } - for (i = SDL_LOG_PRIORITY_VERBOSE; i < SDL_NUM_LOG_PRIORITIES; ++i) { + for (i = SDL_LOG_PRIORITY_INVALID + 1; i < SDL_LOG_PRIORITY_COUNT; ++i) { if (SDL_strncasecmp(string, SDL_priority_names[i], length) == 0) { *priority = (SDL_LogPriority)i; return true; @@ -220,13 +322,17 @@ static bool SDL_ParseLogPriority(const char *string, size_t length, SDL_LogPrior return false; } -static bool SDL_ParseLogCategoryPriority(const char *hint, int category, SDL_LogPriority *priority) +static void ParseLogPriorities(const char *hint) { const char *name, *next; - int current_category; + int category = DEFAULT_CATEGORY; + SDL_LogPriority priority = SDL_LOG_PRIORITY_INVALID; - if (category == DEFAULT_CATEGORY && SDL_strchr(hint, '=') == NULL) { - return SDL_ParseLogPriority(hint, SDL_strlen(hint), priority); + if (SDL_strchr(hint, '=') == NULL) { + if (ParseLogPriority(hint, SDL_strlen(hint), &priority)) { + SDL_SetLogPriorities(priority); + } + return; } for (name = hint; name; name = next) { @@ -239,87 +345,88 @@ static bool SDL_ParseLogCategoryPriority(const char *hint, int category, SDL_Log ++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); + if (ParseLogCategory(name, (sep - name), &category)) { + const char *value = sep + 1; + size_t len; + if (next) { + len = (next - value - 1); + } else { + len = SDL_strlen(value); + } + if (ParseLogPriority(value, len, &priority)) { + if (category == DEFAULT_CATEGORY) { + for (int i = 0; i < SDL_arraysize(SDL_log_priorities); ++i) { + if (SDL_log_priorities[i] == SDL_LOG_PRIORITY_INVALID) { + SDL_log_priorities[i] = priority; + } + } + SDL_log_default_priority = priority; } else { - len = SDL_strlen(value); + SDL_SetLogPriority(category, priority); } - return SDL_ParseLogPriority(value, len, priority); } } } - return 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_GetLogPriority(int category) -{ - SDL_LogLevel *entry; - - for (entry = SDL_loglevels; entry; entry = entry->next) { - if (entry->category == category) { - return entry->priority; - } - } - - if (SDL_forced_priority) { - return SDL_forced_priority_level; - } - - return SDL_GetDefaultLogPriority(category); } void SDL_ResetLogPriorities(void) { - SDL_LogLevel *entry; + SDL_CheckInitLog(); - while (SDL_loglevels) { - entry = SDL_loglevels; - SDL_loglevels = entry->next; - SDL_free(entry); + SDL_LockMutex(SDL_log_lock); + { + CleanupLogPriorities(); + + SDL_log_default_priority = SDL_LOG_PRIORITY_INVALID; + for (int i = 0; i < SDL_arraysize(SDL_log_priorities); ++i) { + SDL_log_priorities[i] = SDL_LOG_PRIORITY_INVALID; + } + + const char *hint = SDL_GetHint(SDL_HINT_LOGGING); + if (hint) { + ParseLogPriorities(hint); + } + + if (SDL_log_default_priority == SDL_LOG_PRIORITY_INVALID) { + SDL_log_default_priority = SDL_LOG_PRIORITY_ERROR; + } + for (int i = 0; i < SDL_arraysize(SDL_log_priorities); ++i) { + if (SDL_log_priorities[i] != SDL_LOG_PRIORITY_INVALID) { + continue; + } + + switch (i) { + case SDL_LOG_CATEGORY_APPLICATION: + SDL_log_priorities[i] = SDL_LOG_PRIORITY_INFO; + break; + case SDL_LOG_CATEGORY_ASSERT: + SDL_log_priorities[i] = SDL_LOG_PRIORITY_WARN; + break; + case SDL_LOG_CATEGORY_TEST: + SDL_log_priorities[i] = SDL_LOG_PRIORITY_VERBOSE; + break; + default: + SDL_log_priorities[i] = SDL_LOG_PRIORITY_ERROR; + break; + } + } } - SDL_forced_priority = false; + SDL_UnlockMutex(SDL_log_lock); } -static void SDL_ResetLogPrefixes(void) +static void CleanupLogPrefixes(void) { for (int i = 0; i < SDL_arraysize(SDL_priority_prefixes); ++i) { - SDL_priority_prefixes[i] = NULL; + if (SDL_priority_prefixes[i]) { + SDL_free(SDL_priority_prefixes[i]); + SDL_priority_prefixes[i] = NULL; + } } } -static const char *SDL_GetLogPriorityPrefix(SDL_LogPriority priority) +static const char *GetLogPriorityPrefix(SDL_LogPriority priority) { - if (priority < SDL_LOG_PRIORITY_VERBOSE || priority >= SDL_NUM_LOG_PRIORITIES) { + if (priority <= SDL_LOG_PRIORITY_INVALID || priority >= SDL_LOG_PRIORITY_COUNT) { return ""; } @@ -339,21 +446,32 @@ static const char *SDL_GetLogPriorityPrefix(SDL_LogPriority priority) } } -SDL_bool SDL_SetLogPriorityPrefix(SDL_LogPriority priority, const char *prefix) +bool SDL_SetLogPriorityPrefix(SDL_LogPriority priority, const char *prefix) { - if (priority < SDL_LOG_PRIORITY_VERBOSE || priority >= SDL_NUM_LOG_PRIORITIES) { + char *prefix_copy; + + if (priority <= SDL_LOG_PRIORITY_INVALID || priority >= SDL_LOG_PRIORITY_COUNT) { return SDL_InvalidParamError("priority"); } - if (!prefix) { - prefix = ""; + if (!prefix || !*prefix) { + prefix_copy = SDL_strdup(""); } else { - prefix = SDL_GetPersistentString(prefix); - if (!prefix) { - return false; - } + prefix_copy = SDL_strdup(prefix); } - SDL_priority_prefixes[priority] = prefix; + if (!prefix_copy) { + return false; + } + + SDL_LockMutex(SDL_log_function_lock); + { + if (SDL_priority_prefixes[priority]) { + SDL_free(SDL_priority_prefixes[priority]); + } + SDL_priority_prefixes[priority] = prefix_copy; + } + SDL_UnlockMutex(SDL_log_function_lock); + return true; } @@ -366,6 +484,15 @@ void SDL_Log(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) va_end(ap); } +void SDL_LogTrace(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) +{ + va_list ap; + + va_start(ap, fmt); + SDL_LogMessageV(category, SDL_LOG_PRIORITY_TRACE, fmt, ap); + va_end(ap); +} + void SDL_LogVerbose(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) { va_list ap; @@ -432,7 +559,7 @@ void SDL_LogMessage(int category, SDL_LogPriority priority, SDL_PRINTF_FORMAT_ST #ifdef SDL_PLATFORM_ANDROID static const char *GetCategoryPrefix(int category) { - if (category < SDL_LOG_CATEGORY_RESERVED1) { + if (category < SDL_LOG_CATEGORY_RESERVED2) { return SDL_category_names[category]; } if (category < SDL_LOG_CATEGORY_CUSTOM) { @@ -455,21 +582,11 @@ void SDL_LogMessageV(int category, SDL_LogPriority priority, SDL_PRINTF_FORMAT_S return; } - // Make sure we don't exceed array bounds - if ((int)priority < 0 || priority >= SDL_NUM_LOG_PRIORITIES) { - return; - } - // See if we want to do anything with this message if (priority < SDL_GetLogPriority(category)) { return; } - 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(); - } - // Render into stack buffer va_copy(aq, ap); len = SDL_vsnprintf(stack_buf, sizeof(stack_buf), fmt, aq); @@ -501,9 +618,11 @@ void SDL_LogMessageV(int category, SDL_LogPriority priority, SDL_PRINTF_FORMAT_S } } - SDL_LockMutex(log_function_mutex); - SDL_log_function(SDL_log_userdata, category, priority, message); - SDL_UnlockMutex(log_function_mutex); + SDL_LockMutex(SDL_log_function_lock); + { + SDL_log_function(SDL_log_userdata, category, priority, message); + } + SDL_UnlockMutex(SDL_log_function_lock); // Free only if dynamically allocated if (message != stack_buf) { @@ -511,7 +630,7 @@ void SDL_LogMessageV(int category, SDL_LogPriority priority, SDL_PRINTF_FORMAT_S } } -#if defined(SDL_PLATFORM_WIN32) && !defined(SDL_PLATFORM_WINRT) && !defined(SDL_PLATFORM_GDK) +#if defined(SDL_PLATFORM_WIN32) && !defined(SDL_PLATFORM_GDK) enum { CONSOLE_UNATTACHED = 0, CONSOLE_ATTACHED_CONSOLE = 1, @@ -526,7 +645,7 @@ static HANDLE stderrHandle = NULL; static void SDLCALL SDL_LogOutput(void *userdata, int category, SDL_LogPriority priority, const char *message) { -#if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINRT) || defined(SDL_PLATFORM_GDK) +#if defined(SDL_PLATFORM_WINDOWS) // Way too many allocations here, urgh // Note: One can't call SDL_SetError here, since that function itself logs. { @@ -535,7 +654,7 @@ static void SDLCALL SDL_LogOutput(void *userdata, int category, SDL_LogPriority LPTSTR tstr; bool isstack; -#if !defined(SDL_PLATFORM_WINRT) && !defined(SDL_PLATFORM_GDK) +#if !defined(SDL_PLATFORM_GDK) BOOL attachResult; DWORD attachError; DWORD consoleMode; @@ -574,16 +693,16 @@ static void SDLCALL SDL_LogOutput(void *userdata, int category, SDL_LogPriority } } } -#endif // !defined(SDL_PLATFORM_WINRT) && !defined(SDL_PLATFORM_GDK) - length = SDL_strlen(SDL_GetLogPriorityPrefix(priority)) + SDL_strlen(message) + 1 + 1 + 1; +#endif // !defined(SDL_PLATFORM_GDK) + length = SDL_strlen(GetLogPriorityPrefix(priority)) + SDL_strlen(message) + 1 + 1 + 1; output = SDL_small_alloc(char, length, &isstack); - (void)SDL_snprintf(output, length, "%s%s\r\n", SDL_GetLogPriorityPrefix(priority), message); + (void)SDL_snprintf(output, length, "%s%s\r\n", GetLogPriorityPrefix(priority), message); tstr = WIN_UTF8ToString(output); // Output to debugger OutputDebugString(tstr); -#if !defined(SDL_PLATFORM_WINRT) && !defined(SDL_PLATFORM_GDK) +#if !defined(SDL_PLATFORM_GDK) // Screen output to stderr, if console was attached. if (consoleAttached == CONSOLE_ATTACHED_CONSOLE) { if (!WriteConsole(stderrHandle, tstr, (DWORD)SDL_tcslen(tstr), &charsWritten, NULL)) { @@ -598,7 +717,7 @@ static void SDLCALL SDL_LogOutput(void *userdata, int category, SDL_LogPriority OutputDebugString(TEXT("Error calling WriteFile\r\n")); } } -#endif // !defined(SDL_PLATFORM_WINRT) && !defined(SDL_PLATFORM_GDK) +#endif // !defined(SDL_PLATFORM_GDK) SDL_free(tstr); SDL_small_free(output, isstack); @@ -615,7 +734,7 @@ static void SDLCALL SDL_LogOutput(void *userdata, int category, SDL_LogPriority */ extern void SDL_NSLog(const char *prefix, const char *text); { - SDL_NSLog(SDL_GetLogPriorityPrefix(priority), message); + SDL_NSLog(GetLogPriorityPrefix(priority), message); return; } #elif defined(SDL_PLATFORM_PSP) || defined(SDL_PLATFORM_PS2) @@ -623,7 +742,7 @@ static void SDLCALL SDL_LogOutput(void *userdata, int category, SDL_LogPriority FILE *pFile; pFile = fopen("SDL_Log.txt", "a"); if (pFile) { - (void)fprintf(pFile, "%s%s\n", SDL_GetLogPriorityPrefix(priority), message); + (void)fprintf(pFile, "%s%s\n", GetLogPriorityPrefix(priority), message); (void)fclose(pFile); } } @@ -632,7 +751,7 @@ static void SDLCALL SDL_LogOutput(void *userdata, int category, SDL_LogPriority FILE *pFile; pFile = fopen("ux0:/data/SDL_Log.txt", "a"); if (pFile) { - (void)fprintf(pFile, "%s%s\n", SDL_GetLogPriorityPrefix(priority), message); + (void)fprintf(pFile, "%s%s\n", GetLogPriorityPrefix(priority), message); (void)fclose(pFile); } } @@ -641,7 +760,7 @@ static void SDLCALL SDL_LogOutput(void *userdata, int category, SDL_LogPriority FILE *pFile; pFile = fopen("sdmc:/3ds/SDL_Log.txt", "a"); if (pFile) { - (void)fprintf(pFile, "%s%s\n", SDL_GetLogPriorityPrefix(priority), message); + (void)fprintf(pFile, "%s%s\n", GetLogPriorityPrefix(priority), message); (void)fclose(pFile); } } @@ -649,22 +768,30 @@ static void SDLCALL SDL_LogOutput(void *userdata, int category, SDL_LogPriority #if defined(HAVE_STDIO_H) && \ !(defined(SDL_PLATFORM_APPLE) && (defined(SDL_VIDEO_DRIVER_COCOA) || defined(SDL_VIDEO_DRIVER_UIKIT))) && \ !(defined(SDL_PLATFORM_WIN32)) - (void)fprintf(stderr, "%s%s\n", SDL_GetLogPriorityPrefix(priority), message); + (void)fprintf(stderr, "%s%s\n", GetLogPriorityPrefix(priority), message); #endif } void SDL_GetLogOutputFunction(SDL_LogOutputFunction *callback, void **userdata) { - if (callback) { - *callback = SDL_log_function; - } - if (userdata) { - *userdata = SDL_log_userdata; + SDL_LockMutex(SDL_log_function_lock); + { + if (callback) { + *callback = SDL_log_function; + } + if (userdata) { + *userdata = SDL_log_userdata; + } } + SDL_UnlockMutex(SDL_log_function_lock); } void SDL_SetLogOutputFunction(SDL_LogOutputFunction callback, void *userdata) { - SDL_log_function = callback; - SDL_log_userdata = userdata; + SDL_LockMutex(SDL_log_function_lock); + { + SDL_log_function = callback; + SDL_log_userdata = userdata; + } + SDL_UnlockMutex(SDL_log_function_lock); } diff --git a/src/SDL_properties.c b/src/SDL_properties.c index 78997d7d..80271710 100644 --- a/src/SDL_properties.c +++ b/src/SDL_properties.c @@ -48,10 +48,11 @@ typedef struct SDL_Mutex *lock; } SDL_Properties; +static SDL_InitState SDL_properties_init; static SDL_HashTable *SDL_properties; static SDL_Mutex *SDL_properties_lock; static SDL_PropertiesID SDL_last_properties_id; -static SDL_PropertiesID SDL_global_properties; +static SDL_AtomicU32 SDL_global_properties; static void SDL_FreePropertyWithCleanup(const void *key, const void *value, void *data, bool cleanup) @@ -99,27 +100,42 @@ static void SDL_FreeProperties(const void *key, const void *value, void *data) bool SDL_InitProperties(void) { - if (!SDL_properties_lock) { - SDL_properties_lock = SDL_CreateMutex(); - if (!SDL_properties_lock) { - return false; - } + if (!SDL_ShouldInit(&SDL_properties_init)) { + return true; } + + // If this fails we'll continue without it. + SDL_properties_lock = SDL_CreateMutex(); + + SDL_properties = SDL_CreateHashTable(NULL, 16, SDL_HashID, SDL_KeyMatchID, SDL_FreeProperties, false); if (!SDL_properties) { - SDL_properties = SDL_CreateHashTable(NULL, 16, SDL_HashID, SDL_KeyMatchID, SDL_FreeProperties, false); - if (!SDL_properties) { - return false; - } + goto error; } + + SDL_SetInitialized(&SDL_properties_init, true); return true; + +error: + SDL_SetInitialized(&SDL_properties_init, true); + SDL_QuitProperties(); + return false; } void SDL_QuitProperties(void) { - if (SDL_global_properties) { - SDL_DestroyProperties(SDL_global_properties); - SDL_global_properties = 0; + if (!SDL_ShouldQuit(&SDL_properties_init)) { + return; } + + SDL_PropertiesID props; + do { + props = SDL_GetAtomicU32(&SDL_global_properties); + } while (!SDL_CompareAndSwapAtomicU32(&SDL_global_properties, props, 0)); + + if (props) { + SDL_DestroyProperties(props); + } + if (SDL_properties) { SDL_DestroyHashTable(SDL_properties); SDL_properties = NULL; @@ -128,14 +144,27 @@ void SDL_QuitProperties(void) SDL_DestroyMutex(SDL_properties_lock); SDL_properties_lock = NULL; } + + SDL_SetInitialized(&SDL_properties_init, false); +} + +static bool SDL_CheckInitProperties(void) +{ + return SDL_InitProperties(); } SDL_PropertiesID SDL_GetGlobalProperties(void) { - if (!SDL_global_properties) { - SDL_global_properties = SDL_CreateProperties(); + SDL_PropertiesID props = SDL_GetAtomicU32(&SDL_global_properties); + if (!props) { + props = SDL_CreateProperties(); + if (!SDL_CompareAndSwapAtomicU32(&SDL_global_properties, 0, props)) { + // Somebody else created global properties before us, just use those + SDL_DestroyProperties(props); + props = SDL_GetAtomicU32(&SDL_global_properties); + } } - return SDL_global_properties; + return props; } SDL_PropertiesID SDL_CreateProperties(void) @@ -144,7 +173,7 @@ SDL_PropertiesID SDL_CreateProperties(void) SDL_Properties *properties = NULL; bool inserted = false; - if (!SDL_properties && !SDL_InitProperties()) { + if (!SDL_CheckInitProperties()) { return 0; } @@ -156,14 +185,9 @@ SDL_PropertiesID SDL_CreateProperties(void) if (!properties->props) { goto error; } - properties->lock = SDL_CreateMutex(); - if (!properties->lock) { - goto error; - } - if (!SDL_InitProperties()) { - goto error; - } + // If this fails we'll continue without it. + properties->lock = SDL_CreateMutex(); SDL_LockMutex(SDL_properties_lock); ++SDL_last_properties_id; @@ -186,7 +210,7 @@ error: return 0; } -SDL_bool SDL_CopyProperties(SDL_PropertiesID src, SDL_PropertiesID dst) +bool SDL_CopyProperties(SDL_PropertiesID src, SDL_PropertiesID dst) { SDL_Properties *src_properties = NULL; SDL_Properties *dst_properties = NULL; @@ -258,7 +282,7 @@ SDL_bool SDL_CopyProperties(SDL_PropertiesID src, SDL_PropertiesID dst) return result; } -SDL_bool SDL_LockProperties(SDL_PropertiesID props) +bool SDL_LockProperties(SDL_PropertiesID props) { SDL_Properties *properties = NULL; @@ -297,7 +321,7 @@ void SDL_UnlockProperties(SDL_PropertiesID props) SDL_UnlockMutex(properties->lock); } -static SDL_bool SDL_PrivateSetProperty(SDL_PropertiesID props, const char *name, SDL_Property *property) +static bool SDL_PrivateSetProperty(SDL_PropertiesID props, const char *name, SDL_Property *property) { SDL_Properties *properties = NULL; bool result = true; @@ -336,7 +360,7 @@ static SDL_bool SDL_PrivateSetProperty(SDL_PropertiesID props, const char *name, return result; } -SDL_bool SDL_SetPointerPropertyWithCleanup(SDL_PropertiesID props, const char *name, void *value, SDL_CleanupPropertyCallback cleanup, void *userdata) +bool SDL_SetPointerPropertyWithCleanup(SDL_PropertiesID props, const char *name, void *value, SDL_CleanupPropertyCallback cleanup, void *userdata) { SDL_Property *property; @@ -362,7 +386,7 @@ SDL_bool SDL_SetPointerPropertyWithCleanup(SDL_PropertiesID props, const char *n return SDL_PrivateSetProperty(props, name, property); } -SDL_bool SDL_SetPointerProperty(SDL_PropertiesID props, const char *name, void *value) +bool SDL_SetPointerProperty(SDL_PropertiesID props, const char *name, void *value) { SDL_Property *property; @@ -401,7 +425,7 @@ bool SDL_SetSurfaceProperty(SDL_PropertiesID props, const char *name, SDL_Surfac return SDL_SetPointerPropertyWithCleanup(props, name, surface, CleanupSurface, NULL); } -SDL_bool SDL_SetStringProperty(SDL_PropertiesID props, const char *name, const char *value) +bool SDL_SetStringProperty(SDL_PropertiesID props, const char *name, const char *value) { SDL_Property *property; @@ -422,7 +446,7 @@ SDL_bool SDL_SetStringProperty(SDL_PropertiesID props, const char *name, const c return SDL_PrivateSetProperty(props, name, property); } -SDL_bool SDL_SetNumberProperty(SDL_PropertiesID props, const char *name, Sint64 value) +bool SDL_SetNumberProperty(SDL_PropertiesID props, const char *name, Sint64 value) { SDL_Property *property = (SDL_Property *)SDL_calloc(1, sizeof(*property)); if (!property) { @@ -433,7 +457,7 @@ SDL_bool SDL_SetNumberProperty(SDL_PropertiesID props, const char *name, Sint64 return SDL_PrivateSetProperty(props, name, property); } -SDL_bool SDL_SetFloatProperty(SDL_PropertiesID props, const char *name, float value) +bool SDL_SetFloatProperty(SDL_PropertiesID props, const char *name, float value) { SDL_Property *property = (SDL_Property *)SDL_calloc(1, sizeof(*property)); if (!property) { @@ -444,7 +468,7 @@ SDL_bool SDL_SetFloatProperty(SDL_PropertiesID props, const char *name, float va return SDL_PrivateSetProperty(props, name, property); } -SDL_bool SDL_SetBooleanProperty(SDL_PropertiesID props, const char *name, SDL_bool value) +bool SDL_SetBooleanProperty(SDL_PropertiesID props, const char *name, bool value) { SDL_Property *property = (SDL_Property *)SDL_calloc(1, sizeof(*property)); if (!property) { @@ -455,7 +479,7 @@ SDL_bool SDL_SetBooleanProperty(SDL_PropertiesID props, const char *name, SDL_bo return SDL_PrivateSetProperty(props, name, property); } -SDL_bool SDL_HasProperty(SDL_PropertiesID props, const char *name) +bool SDL_HasProperty(SDL_PropertiesID props, const char *name) { return (SDL_GetPropertyType(props, name) != SDL_PROPERTY_TYPE_INVALID); } @@ -617,7 +641,7 @@ Sint64 SDL_GetNumberProperty(SDL_PropertiesID props, const char *name, Sint64 de if (SDL_FindInHashTable(properties->props, name, (const void **)&property)) { switch (property->type) { case SDL_PROPERTY_TYPE_STRING: - value = SDL_strtoll(property->value.string_value, NULL, 0); + value = (Sint64)SDL_strtoll(property->value.string_value, NULL, 0); break; case SDL_PROPERTY_TYPE_NUMBER: value = property->value.number_value; @@ -685,7 +709,7 @@ float SDL_GetFloatProperty(SDL_PropertiesID props, const char *name, float defau return value; } -SDL_bool SDL_GetBooleanProperty(SDL_PropertiesID props, const char *name, SDL_bool default_value) +bool SDL_GetBooleanProperty(SDL_PropertiesID props, const char *name, bool default_value) { SDL_Properties *properties = NULL; bool value = default_value ? true : false; @@ -732,12 +756,12 @@ SDL_bool SDL_GetBooleanProperty(SDL_PropertiesID props, const char *name, SDL_bo return value; } -SDL_bool SDL_ClearProperty(SDL_PropertiesID props, const char *name) +bool SDL_ClearProperty(SDL_PropertiesID props, const char *name) { return SDL_PrivateSetProperty(props, name, NULL); } -SDL_bool SDL_EnumerateProperties(SDL_PropertiesID props, SDL_EnumeratePropertiesCallback callback, void *userdata) +bool SDL_EnumerateProperties(SDL_PropertiesID props, SDL_EnumeratePropertiesCallback callback, void *userdata) { SDL_Properties *properties = NULL; diff --git a/src/SDL_utils.c b/src/SDL_utils.c index 0af6460e..1263fea3 100644 --- a/src/SDL_utils.c +++ b/src/SDL_utils.c @@ -121,7 +121,40 @@ bool SDL_endswith(const char *string, const char *suffix) return false; } -// Assume we can wrap SDL_AtomicInt values and cast to Uint32 +bool SDL_ShouldInit(SDL_InitState *state) +{ + while (SDL_GetAtomicInt(&state->status) != SDL_INIT_STATUS_INITIALIZED) { + if (SDL_CompareAndSwapAtomicInt(&state->status, SDL_INIT_STATUS_UNINITIALIZED, SDL_INIT_STATUS_INITIALIZING)) { + state->thread = SDL_GetCurrentThreadID(); + return true; + } + + // Wait for the other thread to complete transition + SDL_Delay(1); + } + return false; +} + +bool SDL_ShouldQuit(SDL_InitState *state) +{ + if (SDL_CompareAndSwapAtomicInt(&state->status, SDL_INIT_STATUS_INITIALIZED, SDL_INIT_STATUS_UNINITIALIZING)) { + state->thread = SDL_GetCurrentThreadID(); + return true; + } + return false; +} + +void SDL_SetInitialized(SDL_InitState *state, bool initialized) +{ + SDL_assert(state->thread == SDL_GetCurrentThreadID()); + + if (initialized) { + SDL_SetAtomicInt(&state->status, SDL_INIT_STATUS_INITIALIZED); + } else { + SDL_SetAtomicInt(&state->status, SDL_INIT_STATUS_UNINITIALIZED); + } +} + SDL_COMPILE_TIME_ASSERT(sizeof_object_id, sizeof(int) == sizeof(Uint32)); Uint32 SDL_GetNextObjectID(void) diff --git a/src/SDL_utils_c.h b/src/SDL_utils_c.h index 500f804f..0a0cfef2 100644 --- a/src/SDL_utils_c.h +++ b/src/SDL_utils_c.h @@ -47,6 +47,24 @@ extern bool SDL_endswith(const char *string, const char *suffix); */ extern int SDL_URIToLocal(const char *src, char *dst); +typedef enum SDL_InitStatus +{ + SDL_INIT_STATUS_UNINITIALIZED, + SDL_INIT_STATUS_INITIALIZING, + SDL_INIT_STATUS_INITIALIZED, + SDL_INIT_STATUS_UNINITIALIZING +} SDL_InitStatus; + +typedef struct SDL_InitState +{ + SDL_AtomicInt status; + SDL_ThreadID thread; +} SDL_InitState; + +extern bool SDL_ShouldInit(SDL_InitState *state); +extern bool SDL_ShouldQuit(SDL_InitState *state); +extern void SDL_SetInitialized(SDL_InitState *state, bool initialized); + typedef enum { SDL_OBJECT_TYPE_UNKNOWN, diff --git a/src/atomic/SDL_atomic.c b/src/atomic/SDL_atomic.c index 2816d6d4..70ee1607 100644 --- a/src/atomic/SDL_atomic.c +++ b/src/atomic/SDL_atomic.c @@ -122,18 +122,19 @@ static SDL_INLINE void leaveLock(void *a) } #endif -SDL_bool SDL_AtomicCompareAndSwap(SDL_AtomicInt *a, int oldval, int newval) +bool SDL_CompareAndSwapAtomicInt(SDL_AtomicInt *a, int oldval, int newval) { #ifdef HAVE_MSC_ATOMICS SDL_COMPILE_TIME_ASSERT(atomic_cas, sizeof(long) == sizeof(a->value)); return _InterlockedCompareExchange((long *)&a->value, (long)newval, (long)oldval) == (long)oldval; #elif defined(HAVE_WATCOM_ATOMICS) - return _SDL_cmpxchg_watcom(&a->value, newval, oldval); + return _SDL_cmpxchg_watcom((volatile int *)&a->value, newval, oldval); #elif defined(HAVE_GCC_ATOMICS) return __sync_bool_compare_and_swap(&a->value, oldval, newval); #elif defined(SDL_PLATFORM_MACOS) // this is deprecated in 10.12 sdk; favor gcc atomics. return OSAtomicCompareAndSwap32Barrier(oldval, newval, &a->value); #elif defined(SDL_PLATFORM_SOLARIS) + SDL_COMPILE_TIME_ASSERT(atomic_cas, sizeof(uint_t) == sizeof(a->value)); return ((int)atomic_cas_uint((volatile uint_t *)&a->value, (uint_t)oldval, (uint_t)newval) == oldval); #elif defined(EMULATE_CAS) bool result = false; @@ -151,7 +152,38 @@ SDL_bool SDL_AtomicCompareAndSwap(SDL_AtomicInt *a, int oldval, int newval) #endif } -SDL_bool SDL_AtomicCompareAndSwapPointer(void **a, void *oldval, void *newval) +bool SDL_CompareAndSwapAtomicU32(SDL_AtomicU32 *a, Uint32 oldval, Uint32 newval) +{ +#ifdef HAVE_MSC_ATOMICS + SDL_COMPILE_TIME_ASSERT(atomic_cas, sizeof(long) == sizeof(a->value)); + return _InterlockedCompareExchange((long *)&a->value, (long)newval, (long)oldval) == (long)oldval; +#elif defined(HAVE_WATCOM_ATOMICS) + SDL_COMPILE_TIME_ASSERT(atomic_cas, sizeof(int) == sizeof(a->value)); + return _SDL_cmpxchg_watcom((volatile int *)&a->value, (int)newval, (int)oldval); +#elif defined(HAVE_GCC_ATOMICS) + return __sync_bool_compare_and_swap(&a->value, oldval, newval); +#elif defined(SDL_PLATFORM_MACOS) // this is deprecated in 10.12 sdk; favor gcc atomics. + return OSAtomicCompareAndSwap32Barrier((int32_t)oldval, (int32_t)newval, (int32_t*)&a->value); +#elif defined(SDL_PLATFORM_SOLARIS) + SDL_COMPILE_TIME_ASSERT(atomic_cas, sizeof(uint_t) == sizeof(a->value)); + return ((Uint32)atomic_cas_uint((volatile uint_t *)&a->value, (uint_t)oldval, (uint_t)newval) == oldval); +#elif defined(EMULATE_CAS) + bool result = false; + + enterLock(a); + if (a->value == oldval) { + a->value = newval; + result = true; + } + leaveLock(a); + + return result; +#else +#error Please define your platform. +#endif +} + +bool SDL_CompareAndSwapAtomicPointer(void **a, void *oldval, void *newval) { #ifdef HAVE_MSC_ATOMICS return _InterlockedCompareExchangePointer(a, newval, oldval) == oldval; @@ -181,7 +213,7 @@ SDL_bool SDL_AtomicCompareAndSwapPointer(void **a, void *oldval, void *newval) #endif } -int SDL_AtomicSet(SDL_AtomicInt *a, int v) +int SDL_SetAtomicInt(SDL_AtomicInt *a, int v) { #ifdef HAVE_MSC_ATOMICS SDL_COMPILE_TIME_ASSERT(atomic_set, sizeof(long) == sizeof(a->value)); @@ -191,17 +223,39 @@ int SDL_AtomicSet(SDL_AtomicInt *a, int v) #elif defined(HAVE_GCC_ATOMICS) return __sync_lock_test_and_set(&a->value, v); #elif defined(SDL_PLATFORM_SOLARIS) + SDL_COMPILE_TIME_ASSERT(atomic_set, sizeof(uint_t) == sizeof(a->value)); return (int)atomic_swap_uint((volatile uint_t *)&a->value, v); #else int value; do { value = a->value; - } while (!SDL_AtomicCompareAndSwap(a, value, v)); + } while (!SDL_CompareAndSwapAtomicInt(a, value, v)); return value; #endif } -void *SDL_AtomicSetPointer(void **a, void *v) +Uint32 SDL_SetAtomicU32(SDL_AtomicU32 *a, Uint32 v) +{ +#ifdef HAVE_MSC_ATOMICS + SDL_COMPILE_TIME_ASSERT(atomic_set, sizeof(long) == sizeof(a->value)); + return _InterlockedExchange((long *)&a->value, v); +#elif defined(HAVE_WATCOM_ATOMICS) + return _SDL_xchg_watcom(&a->value, v); +#elif defined(HAVE_GCC_ATOMICS) + return __sync_lock_test_and_set(&a->value, v); +#elif defined(SDL_PLATFORM_SOLARIS) + SDL_COMPILE_TIME_ASSERT(atomic_set, sizeof(uint_t) == sizeof(a->value)); + return (Uint32)atomic_swap_uint((volatile uint_t *)&a->value, v); +#else + Uint32 value; + do { + value = a->value; + } while (!SDL_CompareAndSwapAtomicU32(a, value, v)); + return value; +#endif +} + +void *SDL_SetAtomicPointer(void **a, void *v) { #ifdef HAVE_MSC_ATOMICS return _InterlockedExchangePointer(a, v); @@ -215,18 +269,19 @@ void *SDL_AtomicSetPointer(void **a, void *v) void *value; do { value = *a; - } while (!SDL_AtomicCompareAndSwapPointer(a, value, v)); + } while (!SDL_CompareAndSwapAtomicPointer(a, value, v)); return value; #endif } -int SDL_AtomicAdd(SDL_AtomicInt *a, int v) +int SDL_AddAtomicInt(SDL_AtomicInt *a, int v) { #ifdef HAVE_MSC_ATOMICS SDL_COMPILE_TIME_ASSERT(atomic_add, sizeof(long) == sizeof(a->value)); return _InterlockedExchangeAdd((long *)&a->value, v); #elif defined(HAVE_WATCOM_ATOMICS) - return _SDL_xadd_watcom(&a->value, v); + SDL_COMPILE_TIME_ASSERT(atomic_add, sizeof(int) == sizeof(a->value)); + return _SDL_xadd_watcom((volatile int *)&a->value, v); #elif defined(HAVE_GCC_ATOMICS) return __sync_fetch_and_add(&a->value, v); #elif defined(SDL_PLATFORM_SOLARIS) @@ -238,12 +293,12 @@ int SDL_AtomicAdd(SDL_AtomicInt *a, int v) int value; do { value = a->value; - } while (!SDL_AtomicCompareAndSwap(a, value, (value + v))); + } while (!SDL_CompareAndSwapAtomicInt(a, value, (value + v))); return value; #endif } -int SDL_AtomicGet(SDL_AtomicInt *a) +int SDL_GetAtomicInt(SDL_AtomicInt *a) { #ifdef HAVE_ATOMIC_LOAD_N return __atomic_load_n(&a->value, __ATOMIC_SEQ_CST); @@ -262,12 +317,38 @@ int SDL_AtomicGet(SDL_AtomicInt *a) int value; do { value = a->value; - } while (!SDL_AtomicCompareAndSwap(a, value, value)); + } while (!SDL_CompareAndSwapAtomicInt(a, value, value)); return value; #endif } -void *SDL_AtomicGetPointer(void **a) +Uint32 SDL_GetAtomicU32(SDL_AtomicU32 *a) +{ +#ifdef HAVE_ATOMIC_LOAD_N + return __atomic_load_n(&a->value, __ATOMIC_SEQ_CST); +#elif defined(HAVE_MSC_ATOMICS) + SDL_COMPILE_TIME_ASSERT(atomic_get, sizeof(long) == sizeof(a->value)); + return (Uint32)_InterlockedOr((long *)&a->value, 0); +#elif defined(HAVE_WATCOM_ATOMICS) + SDL_COMPILE_TIME_ASSERT(atomic_get, sizeof(int) == sizeof(a->value)); + return (Uint32)_SDL_xadd_watcom((volatile int *)&a->value, 0); +#elif defined(HAVE_GCC_ATOMICS) + return __sync_or_and_fetch(&a->value, 0); +#elif defined(SDL_PLATFORM_MACOS) // this is deprecated in 10.12 sdk; favor gcc atomics. + return OSAtomicOr32Barrier(0, (volatile uint32_t *)&a->value); +#elif defined(SDL_PLATFORM_SOLARIS) + SDL_COMPILE_TIME_ASSERT(atomic_get, sizeof(uint_t) == sizeof(a->value)); + return (Uint32)atomic_or_uint_nv((volatile uint_t *)&a->value, 0); +#else + Uint32 value; + do { + value = a->value; + } while (!SDL_CompareAndSwapAtomicU32(a, value, value)); + return value; +#endif +} + +void *SDL_GetAtomicPointer(void **a) { #ifdef HAVE_ATOMIC_LOAD_N return __atomic_load_n(a, __ATOMIC_SEQ_CST); @@ -281,7 +362,7 @@ void *SDL_AtomicGetPointer(void **a) void *value; do { value = *a; - } while (!SDL_AtomicCompareAndSwapPointer(a, value, value)); + } while (!SDL_CompareAndSwapAtomicPointer(a, value, value)); return value; #endif } diff --git a/src/atomic/SDL_spinlock.c b/src/atomic/SDL_spinlock.c index 3ca84476..b1f47698 100644 --- a/src/atomic/SDL_spinlock.c +++ b/src/atomic/SDL_spinlock.c @@ -20,7 +20,7 @@ */ #include "SDL_internal.h" -#if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINRT) || defined(SDL_PLATFORM_GDK) +#if defined(SDL_PLATFORM_WINDOWS) #include "../core/windows/SDL_windows.h" #endif @@ -57,7 +57,7 @@ extern __inline int _SDL_xchg_watcom(volatile int *a, int v); /* *INDENT-ON* */ // clang-format on // This function is where all the magic happens... -SDL_bool SDL_TryLockSpinlock(SDL_SpinLock *lock) +bool SDL_TryLockSpinlock(SDL_SpinLock *lock) { #if defined(HAVE_GCC_ATOMICS) || defined(HAVE_GCC_SYNC_LOCK_TEST_AND_SET) return __sync_lock_test_and_set(lock, 1) == 0; @@ -129,14 +129,14 @@ SDL_bool SDL_TryLockSpinlock(SDL_SpinLock *lock) #elif defined(PS2) uint32_t oldintr; bool res = false; - // disable interuption + // disable interruption oldintr = DIntr(); if (*lock == 0) { *lock = 1; res = true; } - // enable interuption + // enable interruption if (oldintr) { EIntr(); } diff --git a/src/audio/SDL_audio.c b/src/audio/SDL_audio.c index 92bb8e5e..52dd90e0 100644 --- a/src/audio/SDL_audio.c +++ b/src/audio/SDL_audio.c @@ -280,7 +280,7 @@ bool SDL_AudioSpecsEqual(const SDL_AudioSpec *a, const SDL_AudioSpec *b, const i // consumed and apps relying on audio callbacks don't stop making progress. static bool ZombieWaitDevice(SDL_AudioDevice *device) { - if (!SDL_AtomicGet(&device->shutdown)) { + if (!SDL_GetAtomicInt(&device->shutdown)) { const int frames = device->buffer_size / SDL_AUDIO_FRAMESIZE(device->spec); SDL_Delay((frames * 1000) / device->spec.freq); } @@ -390,7 +390,7 @@ static SDL_LogicalAudioDevice *ObtainLogicalAudioDevice(SDL_AudioDeviceID devid, // to make sure the correct physical device gets locked, in case we're in a race with the default changing. while (true) { SDL_LockMutex(device->lock); - SDL_AudioDevice *recheck_device = (SDL_AudioDevice *) SDL_AtomicGetPointer((void **) &logdev->physical_device); + SDL_AudioDevice *recheck_device = (SDL_AudioDevice *) SDL_GetAtomicPointer((void **) &logdev->physical_device); if (device == recheck_device) { break; } @@ -559,7 +559,7 @@ void UnrefPhysicalAudioDevice(SDL_AudioDevice *device) // take it out of the device list. SDL_LockRWLockForWriting(current_audio.device_hash_lock); if (SDL_RemoveFromHashTable(current_audio.device_hash, (const void *) (uintptr_t) device->instance_id)) { - SDL_AtomicAdd(device->recording ? ¤t_audio.recording_device_count : ¤t_audio.playback_device_count, -1); + SDL_AddAtomicInt(device->recording ? ¤t_audio.recording_device_count : ¤t_audio.playback_device_count, -1); } SDL_UnlockRWLock(current_audio.device_hash_lock); DestroyPhysicalAudioDevice(device); // ...and nuke it. @@ -576,7 +576,7 @@ static SDL_AudioDevice *CreatePhysicalAudioDevice(const char *name, bool recordi SDL_assert(name != NULL); SDL_LockRWLockForReading(current_audio.device_hash_lock); - const int shutting_down = SDL_AtomicGet(¤t_audio.shutting_down); + const int shutting_down = SDL_GetAtomicInt(¤t_audio.shutting_down); SDL_UnlockRWLock(current_audio.device_hash_lock); if (shutting_down) { return NULL; // we're shutting down, don't add any devices that are hotplugged at the last possible moment. @@ -608,8 +608,8 @@ static SDL_AudioDevice *CreatePhysicalAudioDevice(const char *name, bool recordi return NULL; } - SDL_AtomicSet(&device->shutdown, 0); - SDL_AtomicSet(&device->zombie, 0); + SDL_SetAtomicInt(&device->shutdown, 0); + SDL_SetAtomicInt(&device->zombie, 0); device->recording = recording; SDL_copyp(&device->spec, spec); SDL_copyp(&device->default_spec, spec); @@ -621,7 +621,7 @@ static SDL_AudioDevice *CreatePhysicalAudioDevice(const char *name, bool recordi SDL_LockRWLockForWriting(current_audio.device_hash_lock); if (SDL_InsertIntoHashTable(current_audio.device_hash, (const void *) (uintptr_t) device->instance_id, device)) { - SDL_AtomicAdd(device_count, 1); + SDL_AddAtomicInt(device_count, 1); } else { SDL_DestroyCondition(device->close_cond); SDL_DestroyMutex(device->lock); @@ -711,7 +711,7 @@ void SDL_AudioDeviceDisconnected(SDL_AudioDevice *device) const bool is_default_device = ((devid == current_audio.default_playback_device_id) || (devid == current_audio.default_recording_device_id)); SDL_UnlockRWLock(current_audio.device_hash_lock); - const bool first_disconnect = SDL_AtomicCompareAndSwap(&device->zombie, 0, 1); + const bool first_disconnect = SDL_CompareAndSwapAtomicInt(&device->zombie, 0, 1); if (first_disconnect) { // if already disconnected this device, don't do it twice. // Swap in "Zombie" versions of the usual platform interfaces, so the device will keep // making progress until the app closes it. Otherwise, streams might continue to @@ -886,7 +886,7 @@ bool SDL_InitAudio(const char *driver_name) } // make sure device IDs start at 2 (because of SDL2 legacy interface), but don't reset the counter on each init, in case the app is holding an old device ID somewhere. - SDL_AtomicCompareAndSwap(&last_device_instance_id, 0, 2); + SDL_CompareAndSwapAtomicInt(&last_device_instance_id, 0, 2); SDL_ChooseAudioConverters(); SDL_SetupAudioResampler(); @@ -1031,13 +1031,13 @@ void SDL_QuitAudio(void) } SDL_LockRWLockForWriting(current_audio.device_hash_lock); - SDL_AtomicSet(¤t_audio.shutting_down, 1); + SDL_SetAtomicInt(¤t_audio.shutting_down, 1); SDL_HashTable *device_hash = current_audio.device_hash; current_audio.device_hash = NULL; SDL_PendingAudioDeviceEvent *pending_events = current_audio.pending_events.next; current_audio.pending_events.next = NULL; - SDL_AtomicSet(¤t_audio.playback_device_count, 0); - SDL_AtomicSet(¤t_audio.recording_device_count, 0); + SDL_SetAtomicInt(¤t_audio.playback_device_count, 0); + SDL_SetAtomicInt(¤t_audio.recording_device_count, 0); SDL_UnlockRWLock(current_audio.device_hash_lock); SDL_PendingAudioDeviceEvent *pending_next = NULL; @@ -1094,7 +1094,7 @@ bool SDL_PlaybackAudioThreadIterate(SDL_AudioDevice *device) SDL_LockMutex(device->lock); - if (SDL_AtomicGet(&device->shutdown)) { + if (SDL_GetAtomicInt(&device->shutdown)) { SDL_UnlockMutex(device->lock); return false; // we're done, shut it down. } @@ -1118,7 +1118,7 @@ bool SDL_PlaybackAudioThreadIterate(SDL_AudioDevice *device) // We should have updated this elsewhere if the format changed! SDL_assert(SDL_AudioSpecsEqual(&stream->dst_spec, &device->spec, stream->dst_chmap, device->chmap)); - const int br = SDL_AtomicGet(&logdev->paused) ? 0 : SDL_GetAudioStreamDataAdjustGain(stream, device_buffer, buffer_size, logdev->gain); + const int br = SDL_GetAtomicInt(&logdev->paused) ? 0 : SDL_GetAudioStreamDataAdjustGain(stream, device_buffer, buffer_size, logdev->gain); if (br < 0) { // Probably OOM. Kill the audio device; the whole thing is likely dying soon anyhow. failed = true; SDL_memset(device_buffer, device->silence_value, buffer_size); // just supply silence to the device before we die. @@ -1139,7 +1139,7 @@ bool SDL_PlaybackAudioThreadIterate(SDL_AudioDevice *device) SDL_memset(final_mix_buffer, '\0', work_buffer_size); // start with silence. for (SDL_LogicalAudioDevice *logdev = device->logical_devices; logdev; logdev = logdev->next) { - if (SDL_AtomicGet(&logdev->paused)) { + if (SDL_GetAtomicInt(&logdev->paused)) { continue; // paused? Skip this logical device. } @@ -1202,7 +1202,7 @@ void SDL_PlaybackAudioThreadShutdown(SDL_AudioDevice *device) SDL_assert(!device->recording); const int frames = device->buffer_size / SDL_AUDIO_FRAMESIZE(device->spec); // Wait for the audio to drain if device didn't die. - if (!SDL_AtomicGet(&device->zombie)) { + if (!SDL_GetAtomicInt(&device->zombie)) { SDL_Delay(((frames * 1000) / device->spec.freq) * 2); } current_audio.impl.ThreadDeinit(device); @@ -1242,7 +1242,7 @@ bool SDL_RecordingAudioThreadIterate(SDL_AudioDevice *device) SDL_LockMutex(device->lock); - if (SDL_AtomicGet(&device->shutdown)) { + if (SDL_GetAtomicInt(&device->shutdown)) { SDL_UnlockMutex(device->lock); return false; // we're done, shut it down. } @@ -1258,7 +1258,7 @@ bool SDL_RecordingAudioThreadIterate(SDL_AudioDevice *device) failed = true; } else if (br > 0) { // queue the new data to each bound stream. for (SDL_LogicalAudioDevice *logdev = device->logical_devices; logdev; logdev = logdev->next) { - if (SDL_AtomicGet(&logdev->paused)) { + if (SDL_GetAtomicInt(&logdev->paused)) { continue; // paused? Skip this logical device. } @@ -1342,7 +1342,7 @@ static SDL_AudioDeviceID *GetAudioDevices(int *count, bool recording) if (SDL_GetCurrentAudioDriver()) { SDL_LockRWLockForReading(current_audio.device_hash_lock); { - num_devices = SDL_AtomicGet(recording ? ¤t_audio.recording_device_count : ¤t_audio.playback_device_count); + num_devices = SDL_GetAtomicInt(recording ? ¤t_audio.recording_device_count : ¤t_audio.playback_device_count); result = (SDL_AudioDeviceID *) SDL_malloc((num_devices + 1) * sizeof (SDL_AudioDeviceID)); if (result) { int devs_seen = 0; @@ -1443,7 +1443,7 @@ const char *SDL_GetAudioDeviceName(SDL_AudioDeviceID devid) return result; } -SDL_bool SDL_GetAudioDeviceFormat(SDL_AudioDeviceID devid, SDL_AudioSpec *spec, int *sample_frames) +bool SDL_GetAudioDeviceFormat(SDL_AudioDeviceID devid, SDL_AudioSpec *spec, int *sample_frames) { if (!spec) { return SDL_InvalidParamError("spec"); @@ -1490,7 +1490,7 @@ int *SDL_GetAudioDeviceChannelMap(SDL_AudioDeviceID devid, int *count) // BE CAREFUL WITH THIS. static void SerializePhysicalDeviceClose(SDL_AudioDevice *device) { - while (SDL_AtomicGet(&device->shutdown)) { + while (SDL_GetAtomicInt(&device->shutdown)) { SDL_WaitCondition(device->close_cond, device->lock); } } @@ -1500,7 +1500,7 @@ static void ClosePhysicalAudioDevice(SDL_AudioDevice *device) { SerializePhysicalDeviceClose(device); - SDL_AtomicSet(&device->shutdown, 1); + SDL_SetAtomicInt(&device->shutdown, 1); // YOU MUST PROTECT KEY POINTS WITH SerializePhysicalDeviceClose() WHILE THE THREAD JOINS SDL_UnlockMutex(device->lock); @@ -1517,7 +1517,7 @@ static void ClosePhysicalAudioDevice(SDL_AudioDevice *device) } SDL_LockMutex(device->lock); - SDL_AtomicSet(&device->shutdown, 0); // ready to go again. + SDL_SetAtomicInt(&device->shutdown, 0); // ready to go again. SDL_BroadcastCondition(device->close_cond); // release anyone waiting in SerializePhysicalDeviceClose; they'll still block until we release device->lock, though. SDL_aligned_free(device->work_buffer); @@ -1630,7 +1630,7 @@ static bool OpenPhysicalAudioDevice(SDL_AudioDevice *device, const SDL_AudioSpec } // Just pretend to open a zombie device. It can still collect logical devices on a default device under the assumption they will all migrate when the default device is officially changed. - if (SDL_AtomicGet(&device->zombie)) { + if (SDL_GetAtomicInt(&device->zombie)) { return true; // Braaaaaaaaains. } @@ -1719,7 +1719,7 @@ SDL_AudioDeviceID SDL_OpenAudioDevice(SDL_AudioDeviceID devid, const SDL_AudioSp if (device) { SDL_LogicalAudioDevice *logdev = NULL; - if (!wants_default && SDL_AtomicGet(&device->zombie)) { + if (!wants_default && SDL_GetAtomicInt(&device->zombie)) { // uhoh, this device is undead, and just waiting to be cleaned up. Refuse explicit opens. SDL_SetError("Device was already lost and can't accept new opens"); } else if ((logdev = (SDL_LogicalAudioDevice *) SDL_calloc(1, sizeof (SDL_LogicalAudioDevice))) == NULL) { @@ -1728,7 +1728,7 @@ SDL_AudioDeviceID SDL_OpenAudioDevice(SDL_AudioDeviceID devid, const SDL_AudioSp SDL_free(logdev); } else { RefPhysicalAudioDevice(device); // unref'd on successful SDL_CloseAudioDevice - SDL_AtomicSet(&logdev->paused, 0); + SDL_SetAtomicInt(&logdev->paused, 0); result = logdev->instance_id = AssignAudioDeviceInstanceId(device->recording, /*islogical=*/true); logdev->physical_device = device; logdev->gain = 1.0f; @@ -1761,28 +1761,28 @@ static bool SetLogicalAudioDevicePauseState(SDL_AudioDeviceID devid, int value) SDL_AudioDevice *device = NULL; SDL_LogicalAudioDevice *logdev = ObtainLogicalAudioDevice(devid, &device); if (logdev) { - SDL_AtomicSet(&logdev->paused, value); + SDL_SetAtomicInt(&logdev->paused, value); } ReleaseAudioDevice(device); return logdev ? true : false; // ObtainLogicalAudioDevice will have set an error. } -SDL_bool SDL_PauseAudioDevice(SDL_AudioDeviceID devid) +bool SDL_PauseAudioDevice(SDL_AudioDeviceID devid) { return SetLogicalAudioDevicePauseState(devid, 1); } -SDL_bool SDLCALL SDL_ResumeAudioDevice(SDL_AudioDeviceID devid) +bool SDLCALL SDL_ResumeAudioDevice(SDL_AudioDeviceID devid) { return SetLogicalAudioDevicePauseState(devid, 0); } -SDL_bool SDL_AudioDevicePaused(SDL_AudioDeviceID devid) +bool SDL_AudioDevicePaused(SDL_AudioDeviceID devid) { SDL_AudioDevice *device = NULL; SDL_LogicalAudioDevice *logdev = ObtainLogicalAudioDevice(devid, &device); bool result = false; - if (logdev && SDL_AtomicGet(&logdev->paused)) { + if (logdev && SDL_GetAtomicInt(&logdev->paused)) { result = true; } ReleaseAudioDevice(device); @@ -1798,7 +1798,7 @@ float SDL_GetAudioDeviceGain(SDL_AudioDeviceID devid) return result; } -SDL_bool SDL_SetAudioDeviceGain(SDL_AudioDeviceID devid, float gain) +bool SDL_SetAudioDeviceGain(SDL_AudioDeviceID devid, float gain) { if (gain < 0.0f) { return SDL_InvalidParamError("gain"); @@ -1827,7 +1827,7 @@ SDL_bool SDL_SetAudioDeviceGain(SDL_AudioDeviceID devid, float gain) return result; } -SDL_bool SDL_SetAudioPostmixCallback(SDL_AudioDeviceID devid, SDL_AudioPostmixCallback callback, void *userdata) +bool SDL_SetAudioPostmixCallback(SDL_AudioDeviceID devid, SDL_AudioPostmixCallback callback, void *userdata) { SDL_AudioDevice *device = NULL; SDL_LogicalAudioDevice *logdev = ObtainLogicalAudioDevice(devid, &device); @@ -1862,7 +1862,7 @@ SDL_bool SDL_SetAudioPostmixCallback(SDL_AudioDeviceID devid, SDL_AudioPostmixCa return result; } -SDL_bool SDL_BindAudioStreams(SDL_AudioDeviceID devid, SDL_AudioStream **streams, int num_streams) +bool SDL_BindAudioStreams(SDL_AudioDeviceID devid, SDL_AudioStream **streams, int num_streams) { const bool islogical = !(devid & (1<<1)); SDL_AudioDevice *device = NULL; @@ -1955,7 +1955,7 @@ SDL_bool SDL_BindAudioStreams(SDL_AudioDeviceID devid, SDL_AudioStream **streams return result; } -SDL_bool SDL_BindAudioStream(SDL_AudioDeviceID devid, SDL_AudioStream *stream) +bool SDL_BindAudioStream(SDL_AudioDeviceID devid, SDL_AudioStream *stream) { return SDL_BindAudioStreams(devid, &stream, 1); } @@ -2067,7 +2067,7 @@ SDL_AudioStream *SDL_OpenAudioDeviceStream(SDL_AudioDeviceID devid, const SDL_Au if (!logdev) { // this shouldn't happen, but just in case. failed = true; } else { - SDL_AtomicSet(&logdev->paused, 1); // start the device paused, to match SDL2. + SDL_SetAtomicInt(&logdev->paused, 1); // start the device paused, to match SDL2. SDL_assert(device != NULL); const bool recording = device->recording; @@ -2120,7 +2120,7 @@ SDL_AudioStream *SDL_OpenAudioDeviceStream(SDL_AudioDeviceID devid, const SDL_Au return stream; } -SDL_bool SDL_PauseAudioStreamDevice(SDL_AudioStream *stream) +bool SDL_PauseAudioStreamDevice(SDL_AudioStream *stream) { SDL_AudioDeviceID devid = SDL_GetAudioStreamDevice(stream); if (!devid) { @@ -2130,7 +2130,7 @@ SDL_bool SDL_PauseAudioStreamDevice(SDL_AudioStream *stream) return SDL_PauseAudioDevice(devid); } -SDL_bool SDL_ResumeAudioStreamDevice(SDL_AudioStream *stream) +bool SDL_ResumeAudioStreamDevice(SDL_AudioStream *stream) { SDL_AudioDeviceID devid = SDL_GetAudioStreamDevice(stream); if (!devid) { @@ -2302,7 +2302,7 @@ void SDL_DefaultAudioDeviceChanged(SDL_AudioDevice *new_default_device) new_default_device->logical_devices = logdev; SDL_UnlockRWLock(current_audio.device_hash_lock); - SDL_assert(SDL_AtomicGet(¤t_default_device->refcount) > 1); // we should hold at least one extra reference to this device, beyond logical devices, during this phase... + SDL_assert(SDL_GetAtomicInt(¤t_default_device->refcount) > 1); // we should hold at least one extra reference to this device, beyond logical devices, during this phase... RefPhysicalAudioDevice(new_default_device); UnrefPhysicalAudioDevice(current_default_device); @@ -2474,7 +2474,7 @@ void SDL_UpdateAudio(void) SDL_zero(event); event.type = i->type; event.adevice.which = (Uint32) i->devid; - event.adevice.recording = (i->devid & (1<<0)) ? 0 : 1; // bit #0 of devid is set for playback devices and unset for recording. + event.adevice.recording = ((i->devid & (1<<0)) == 0); // bit #0 of devid is set for playback devices and unset for recording. SDL_PushEvent(&event); } SDL_free(i); diff --git a/src/audio/SDL_audiocvt.c b/src/audio/SDL_audiocvt.c index bb0f1c38..831b36e8 100644 --- a/src/audio/SDL_audiocvt.c +++ b/src/audio/SDL_audiocvt.c @@ -448,7 +448,7 @@ SDL_PropertiesID SDL_GetAudioStreamProperties(SDL_AudioStream *stream) return stream->props; } -SDL_bool SDL_SetAudioStreamGetCallback(SDL_AudioStream *stream, SDL_AudioStreamCallback callback, void *userdata) +bool SDL_SetAudioStreamGetCallback(SDL_AudioStream *stream, SDL_AudioStreamCallback callback, void *userdata) { if (!stream) { return SDL_InvalidParamError("stream"); @@ -460,7 +460,7 @@ SDL_bool SDL_SetAudioStreamGetCallback(SDL_AudioStream *stream, SDL_AudioStreamC return true; } -SDL_bool SDL_SetAudioStreamPutCallback(SDL_AudioStream *stream, SDL_AudioStreamCallback callback, void *userdata) +bool SDL_SetAudioStreamPutCallback(SDL_AudioStream *stream, SDL_AudioStreamCallback callback, void *userdata) { if (!stream) { return SDL_InvalidParamError("stream"); @@ -472,7 +472,7 @@ SDL_bool SDL_SetAudioStreamPutCallback(SDL_AudioStream *stream, SDL_AudioStreamC return true; } -SDL_bool SDL_LockAudioStream(SDL_AudioStream *stream) +bool SDL_LockAudioStream(SDL_AudioStream *stream) { if (!stream) { return SDL_InvalidParamError("stream"); @@ -481,7 +481,7 @@ SDL_bool SDL_LockAudioStream(SDL_AudioStream *stream) return true; } -SDL_bool SDL_UnlockAudioStream(SDL_AudioStream *stream) +bool SDL_UnlockAudioStream(SDL_AudioStream *stream) { if (!stream) { return SDL_InvalidParamError("stream"); @@ -490,7 +490,7 @@ SDL_bool SDL_UnlockAudioStream(SDL_AudioStream *stream) return true; } -SDL_bool SDL_GetAudioStreamFormat(SDL_AudioStream *stream, SDL_AudioSpec *src_spec, SDL_AudioSpec *dst_spec) +bool SDL_GetAudioStreamFormat(SDL_AudioStream *stream, SDL_AudioSpec *src_spec, SDL_AudioSpec *dst_spec) { if (!stream) { return SDL_InvalidParamError("stream"); @@ -514,7 +514,7 @@ SDL_bool SDL_GetAudioStreamFormat(SDL_AudioStream *stream, SDL_AudioSpec *src_sp return true; } -SDL_bool SDL_SetAudioStreamFormat(SDL_AudioStream *stream, const SDL_AudioSpec *src_spec, const SDL_AudioSpec *dst_spec) +bool SDL_SetAudioStreamFormat(SDL_AudioStream *stream, const SDL_AudioSpec *src_spec, const SDL_AudioSpec *dst_spec) { if (!stream) { return SDL_InvalidParamError("stream"); @@ -626,12 +626,12 @@ bool SetAudioStreamChannelMap(SDL_AudioStream *stream, const SDL_AudioSpec *spec return result; } -SDL_bool SDL_SetAudioStreamInputChannelMap(SDL_AudioStream *stream, const int *chmap, int channels) +bool SDL_SetAudioStreamInputChannelMap(SDL_AudioStream *stream, const int *chmap, int channels) { return SetAudioStreamChannelMap(stream, &stream->src_spec, &stream->src_chmap, chmap, channels, true); } -SDL_bool SDL_SetAudioStreamOutputChannelMap(SDL_AudioStream *stream, const int *chmap, int channels) +bool SDL_SetAudioStreamOutputChannelMap(SDL_AudioStream *stream, const int *chmap, int channels) { return SetAudioStreamChannelMap(stream, &stream->dst_spec, &stream->dst_chmap, chmap, channels, false); } @@ -686,7 +686,7 @@ float SDL_GetAudioStreamFrequencyRatio(SDL_AudioStream *stream) return freq_ratio; } -SDL_bool SDL_SetAudioStreamFrequencyRatio(SDL_AudioStream *stream, float freq_ratio) +bool SDL_SetAudioStreamFrequencyRatio(SDL_AudioStream *stream, float freq_ratio) { if (!stream) { return SDL_InvalidParamError("stream"); @@ -723,7 +723,7 @@ float SDL_GetAudioStreamGain(SDL_AudioStream *stream) return gain; } -SDL_bool SDL_SetAudioStreamGain(SDL_AudioStream *stream, float gain) +bool SDL_SetAudioStreamGain(SDL_AudioStream *stream, float gain) { if (!stream) { return SDL_InvalidParamError("stream"); @@ -805,7 +805,7 @@ static void SDLCALL FreeAllocatedAudioBuffer(void *userdata, const void *buf, in SDL_free((void*) buf); } -SDL_bool SDL_PutAudioStreamData(SDL_AudioStream *stream, const void *buf, int len) +bool SDL_PutAudioStreamData(SDL_AudioStream *stream, const void *buf, int len) { if (!stream) { return SDL_InvalidParamError("stream"); @@ -841,7 +841,7 @@ SDL_bool SDL_PutAudioStreamData(SDL_AudioStream *stream, const void *buf, int le return PutAudioStreamBuffer(stream, buf, len, NULL, NULL); } -SDL_bool SDL_FlushAudioStream(SDL_AudioStream *stream) +bool SDL_FlushAudioStream(SDL_AudioStream *stream) { if (!stream) { return SDL_InvalidParamError("stream"); @@ -1013,7 +1013,7 @@ static bool GetAudioStreamDataInternal(SDL_AudioStream *stream, void *buf, int o // Calculate the number of input frames necessary for this request. // Because resampling happens "between" frames, The same number of output_frames // can require a different number of input_frames, depending on the resample_offset. - // Infact, input_frames can sometimes even be zero when upsampling. + // In fact, input_frames can sometimes even be zero when upsampling. const int input_frames = (int) SDL_GetResamplerInputFrames(output_frames, resample_rate, stream->resample_offset); const int padding_frames = SDL_GetResamplerPaddingFrames(resample_rate); @@ -1254,7 +1254,7 @@ int SDL_GetAudioStreamQueued(SDL_AudioStream *stream) return (int) SDL_min(total, SDL_INT_MAX); } -SDL_bool SDL_ClearAudioStream(SDL_AudioStream *stream) +bool SDL_ClearAudioStream(SDL_AudioStream *stream) { if (!stream) { return SDL_InvalidParamError("stream"); @@ -1303,7 +1303,7 @@ static void SDLCALL DontFreeThisAudioBuffer(void *userdata, const void *buf, int // We don't own the buffer, but know it will outlive the stream } -SDL_bool SDL_ConvertAudioSamples(const SDL_AudioSpec *src_spec, const Uint8 *src_data, int src_len, const SDL_AudioSpec *dst_spec, Uint8 **dst_data, int *dst_len) +bool SDL_ConvertAudioSamples(const SDL_AudioSpec *src_spec, const Uint8 *src_data, int src_len, const SDL_AudioSpec *dst_spec, Uint8 **dst_data, int *dst_len) { if (dst_data) { *dst_data = NULL; diff --git a/src/audio/SDL_audioresample.c b/src/audio/SDL_audioresample.c index 79aa8851..07d0b4a6 100644 --- a/src/audio/SDL_audioresample.c +++ b/src/audio/SDL_audioresample.c @@ -574,16 +574,11 @@ static void SetupAudioResampler(void) void SDL_SetupAudioResampler(void) { - static SDL_SpinLock running = 0; + static SDL_InitState init; - if (!ResampleFrame[0]) { - SDL_LockSpinlock(&running); - - if (!ResampleFrame[0]) { - SetupAudioResampler(); - } - - SDL_UnlockSpinlock(&running); + if (SDL_ShouldInit(&init)) { + SetupAudioResampler(); + SDL_SetInitialized(&init, true); } } diff --git a/src/audio/SDL_mixer.c b/src/audio/SDL_mixer.c index 920b5668..e6924ddc 100644 --- a/src/audio/SDL_mixer.c +++ b/src/audio/SDL_mixer.c @@ -86,7 +86,7 @@ static const Uint8 mix8[] = { // !!! FIXME: Add fast-path for volume = 1 // !!! FIXME: Use larger scales for 16-bit/32-bit integers -SDL_bool SDL_MixAudio(Uint8 *dst, const Uint8 *src, SDL_AudioFormat format, Uint32 len, float fvolume) +bool SDL_MixAudio(Uint8 *dst, const Uint8 *src, SDL_AudioFormat format, Uint32 len, float fvolume) { int volume = (int)SDL_roundf(fvolume * MIX_MAXVOLUME); diff --git a/src/audio/SDL_wave.c b/src/audio/SDL_wave.c index 11012c5f..9ce1c85b 100644 --- a/src/audio/SDL_wave.c +++ b/src/audio/SDL_wave.c @@ -24,7 +24,7 @@ #include #endif #ifndef INT_MAX -// Make a lucky guess. +SDL_COMPILE_TIME_ASSERT(int_size, sizeof(int) == sizeof(Sint32)); #define INT_MAX SDL_MAX_SINT32 #endif #ifndef SIZE_MAX @@ -2076,7 +2076,7 @@ static bool WaveLoad(SDL_IOStream *src, WaveFile *file, SDL_AudioSpec *spec, Uin return true; } -SDL_bool SDL_LoadWAV_IO(SDL_IOStream *src, SDL_bool closeio, SDL_AudioSpec *spec, Uint8 **audio_buf, Uint32 *audio_len) +bool SDL_LoadWAV_IO(SDL_IOStream *src, bool closeio, SDL_AudioSpec *spec, Uint8 **audio_buf, Uint32 *audio_len) { bool result = false; WaveFile file; @@ -2130,7 +2130,7 @@ done: return result; } -SDL_bool SDL_LoadWAV(const char *path, SDL_AudioSpec *spec, Uint8 **audio_buf, Uint32 *audio_len) +bool SDL_LoadWAV(const char *path, SDL_AudioSpec *spec, Uint8 **audio_buf, Uint32 *audio_len) { return SDL_LoadWAV_IO(SDL_IOFromFile(path, "rb"), 1, spec, audio_buf, audio_len); } diff --git a/src/audio/aaudio/SDL_aaudio.c b/src/audio/aaudio/SDL_aaudio.c index 8a9d8d1f..7d6e5cb0 100644 --- a/src/audio/aaudio/SDL_aaudio.c +++ b/src/audio/aaudio/SDL_aaudio.c @@ -82,7 +82,7 @@ static void AAUDIO_errorCallback(AAudioStream *stream, void *userData, aaudio_re // You MUST NOT close the audio stream from this callback, so we cannot call SDL_AudioDeviceDisconnected here. // Just flag the device so we can kill it in PlayDevice instead. SDL_AudioDevice *device = (SDL_AudioDevice *) userData; - SDL_AtomicSet(&device->hidden->error_callback_triggered, (int) error); // AAUDIO_OK is zero, so !triggered means no error. + SDL_SetAtomicInt(&device->hidden->error_callback_triggered, (int) error); // AAUDIO_OK is zero, so !triggered means no error. SDL_SignalSemaphore(device->hidden->semaphore); // in case we're blocking in WaitDevice. } @@ -163,7 +163,7 @@ static Uint8 *AAUDIO_GetDeviceBuf(SDL_AudioDevice *device, int *bufsize) static bool AAUDIO_WaitDevice(SDL_AudioDevice *device) { - while (!SDL_AtomicGet(&device->shutdown)) { + while (!SDL_GetAtomicInt(&device->shutdown)) { // this semaphore won't fire when the app is in the background (AAUDIO_PauseDevices was called). if (SDL_WaitSemaphoreTimeout(device->hidden->semaphore, 100)) { return true; // semaphore was signaled, let's go! @@ -218,7 +218,7 @@ static bool AAUDIO_PlayDevice(SDL_AudioDevice *device, const Uint8 *buffer, int struct SDL_PrivateAudioData *hidden = device->hidden; // AAUDIO_dataCallback picks up our work and unblocks AAUDIO_WaitDevice. But make sure we didn't fail here. - const aaudio_result_t err = (aaudio_result_t) SDL_AtomicGet(&hidden->error_callback_triggered); + const aaudio_result_t err = (aaudio_result_t) SDL_GetAtomicInt(&hidden->error_callback_triggered); if (err) { SDL_LogError(SDL_LOG_CATEGORY_AUDIO, "aaudio: Audio device triggered error %d (%s)", (int) err, ctx.AAudio_convertResultToText(err)); @@ -237,8 +237,8 @@ static int AAUDIO_RecordDevice(SDL_AudioDevice *device, void *buffer, int buflen struct SDL_PrivateAudioData *hidden = device->hidden; // AAUDIO_dataCallback picks up our work and unblocks AAUDIO_WaitDevice. But make sure we didn't fail here. - if (SDL_AtomicGet(&hidden->error_callback_triggered)) { - SDL_AtomicSet(&hidden->error_callback_triggered, 0); + if (SDL_GetAtomicInt(&hidden->error_callback_triggered)) { + SDL_SetAtomicInt(&hidden->error_callback_triggered, 0); return -1; } @@ -279,7 +279,7 @@ static bool BuildAAudioStream(SDL_AudioDevice *device) const bool recording = device->recording; aaudio_result_t res; - SDL_AtomicSet(&hidden->error_callback_triggered, 0); + SDL_SetAtomicInt(&hidden->error_callback_triggered, 0); AAudioStreamBuilder *builder = NULL; res = ctx.AAudio_createStreamBuilder(&builder); @@ -308,8 +308,8 @@ static bool BuildAAudioStream(SDL_AudioDevice *device) } ctx.AAudioStreamBuilder_setFormat(builder, format); ctx.AAudioStreamBuilder_setSampleRate(builder, device->spec.freq); - ctx.AAudioStreamBuilder_setChannelCount(builder, device->spec.channels); #endif + ctx.AAudioStreamBuilder_setChannelCount(builder, device->spec.channels); const aaudio_direction_t direction = (recording ? AAUDIO_DIRECTION_INPUT : AAUDIO_DIRECTION_OUTPUT); ctx.AAudioStreamBuilder_setDirection(builder, direction); @@ -320,7 +320,7 @@ static bool BuildAAudioStream(SDL_AudioDevice *device) ctx.AAudioStreamBuilder_setPerformanceMode(builder, AAUDIO_PERFORMANCE_MODE_LOW_LATENCY); } - LOGI("AAudio Try to open %u hz %u bit chan %u %s samples %u", + LOGI("AAudio Try to open %u hz %u bit %u channels %s samples %u", device->spec.freq, SDL_AUDIO_BITSIZE(device->spec.format), device->spec.channels, SDL_AUDIO_ISBIGENDIAN(device->spec.format) ? "BE" : "LE", device->sample_frames); @@ -370,7 +370,7 @@ static bool BuildAAudioStream(SDL_AudioDevice *device) return false; } - LOGI("AAudio Actually opened %u hz %u bit chan %u %s samples %u, buffers %d", + LOGI("AAudio Actually opened %u hz %u bit %u channels %s samples %u, buffers %d", device->spec.freq, SDL_AUDIO_BITSIZE(device->spec.format), device->spec.channels, SDL_AUDIO_ISBIGENDIAN(device->spec.format) ? "BE" : "LE", device->sample_frames, hidden->num_buffers); @@ -386,9 +386,9 @@ static bool BuildAAudioStream(SDL_AudioDevice *device) } // !!! FIXME: make this non-blocking! -static void SDLCALL RequestAndroidPermissionBlockingCallback(void *userdata, const char *permission, SDL_bool granted) +static void SDLCALL RequestAndroidPermissionBlockingCallback(void *userdata, const char *permission, bool granted) { - SDL_AtomicSet((SDL_AtomicInt *) userdata, granted ? 1 : -1); + SDL_SetAtomicInt((SDL_AtomicInt *) userdata, granted ? 1 : -1); } static bool AAUDIO_OpenDevice(SDL_AudioDevice *device) @@ -402,16 +402,16 @@ static bool AAUDIO_OpenDevice(SDL_AudioDevice *device) if (device->recording) { // !!! FIXME: make this non-blocking! SDL_AtomicInt permission_response; - SDL_AtomicSet(&permission_response, 0); + SDL_SetAtomicInt(&permission_response, 0); if (!SDL_RequestAndroidPermission("android.permission.RECORD_AUDIO", RequestAndroidPermissionBlockingCallback, &permission_response)) { return false; } - while (SDL_AtomicGet(&permission_response) == 0) { + while (SDL_GetAtomicInt(&permission_response) == 0) { SDL_Delay(10); } - if (SDL_AtomicGet(&permission_response) < 0) { + if (SDL_GetAtomicInt(&permission_response) < 0) { LOGI("This app doesn't have RECORD_AUDIO permission"); return SDL_SetError("This app doesn't have RECORD_AUDIO permission"); } diff --git a/src/audio/alsa/SDL_alsa_audio.c b/src/audio/alsa/SDL_alsa_audio.c index bf52cea7..cf67a42f 100644 --- a/src/audio/alsa/SDL_alsa_audio.c +++ b/src/audio/alsa/SDL_alsa_audio.c @@ -265,7 +265,7 @@ static bool ALSA_WaitDevice(SDL_AudioDevice *device) const int fulldelay = (int) ((((Uint64) device->sample_frames) * 1000) / device->spec.freq); const int delay = SDL_max(fulldelay, 10); - while (!SDL_AtomicGet(&device->shutdown)) { + while (!SDL_GetAtomicInt(&device->shutdown)) { const int rc = ALSA_snd_pcm_wait(device->hidden->pcm_handle, delay); if (rc < 0 && (rc != -EAGAIN)) { const int status = ALSA_snd_pcm_recover(device->hidden->pcm_handle, rc, 0); @@ -294,7 +294,7 @@ static bool ALSA_PlayDevice(SDL_AudioDevice *device, const Uint8 *buffer, int bu const int frame_size = SDL_AUDIO_FRAMESIZE(device->spec); snd_pcm_uframes_t frames_left = (snd_pcm_uframes_t) (buflen / frame_size); - while ((frames_left > 0) && !SDL_AtomicGet(&device->shutdown)) { + while ((frames_left > 0) && !SDL_GetAtomicInt(&device->shutdown)) { const int rc = ALSA_snd_pcm_writei(device->hidden->pcm_handle, sample_buf, frames_left); //SDL_LogInfo(SDL_LOG_CATEGORY_AUDIO, "ALSA PLAYDEVICE: WROTE %d of %d bytes", (rc >= 0) ? ((int) (rc * frame_size)) : rc, (int) (frames_left * frame_size)); SDL_assert(rc != 0); // assuming this can't happen if we used snd_pcm_wait and queried for available space. @@ -825,10 +825,10 @@ static int SDLCALL ALSA_HotplugThread(void *arg) { SDL_SetThreadPriority(SDL_THREAD_PRIORITY_LOW); - while (!SDL_AtomicGet(&ALSA_hotplug_shutdown)) { + while (!SDL_GetAtomicInt(&ALSA_hotplug_shutdown)) { // Block awhile before checking again, unless we're told to stop. const Uint64 ticks = SDL_GetTicks() + 5000; - while (!SDL_AtomicGet(&ALSA_hotplug_shutdown) && SDL_GetTicks() < ticks) { + while (!SDL_GetAtomicInt(&ALSA_hotplug_shutdown) && SDL_GetTicks() < ticks) { SDL_Delay(100); } @@ -853,7 +853,7 @@ static void ALSA_DetectDevices(SDL_AudioDevice **default_playback, SDL_AudioDevi } #if SDL_ALSA_HOTPLUG_THREAD - SDL_AtomicSet(&ALSA_hotplug_shutdown, 0); + SDL_SetAtomicInt(&ALSA_hotplug_shutdown, 0); ALSA_hotplug_thread = SDL_CreateThread(ALSA_HotplugThread, "SDLHotplugALSA", NULL); // if the thread doesn't spin, oh well, you just don't get further hotplug events. #endif @@ -866,7 +866,7 @@ static void ALSA_DeinitializeStart(void) #if SDL_ALSA_HOTPLUG_THREAD if (ALSA_hotplug_thread) { - SDL_AtomicSet(&ALSA_hotplug_shutdown, 1); + SDL_SetAtomicInt(&ALSA_hotplug_shutdown, 1); SDL_WaitThread(ALSA_hotplug_thread, NULL); ALSA_hotplug_thread = NULL; } diff --git a/src/audio/coreaudio/SDL_coreaudio.m b/src/audio/coreaudio/SDL_coreaudio.m index ecf185de..9b6b8198 100644 --- a/src/audio/coreaudio/SDL_coreaudio.m +++ b/src/audio/coreaudio/SDL_coreaudio.m @@ -622,7 +622,7 @@ static void RecordingBufferReadyCallback(void *inUserData, AudioQueueRef inAQ, A // buffer is unexpectedly here? We're probably dying, but try to requeue this buffer anyhow. if (device->hidden->current_buffer != NULL) { - SDL_assert(SDL_AtomicGet(&device->shutdown) != 0); + SDL_assert(SDL_GetAtomicInt(&device->shutdown) != 0); COREAUDIO_FlushRecording(device); // just flush it manually, which will requeue it. } } @@ -641,7 +641,7 @@ static void COREAUDIO_CloseDevice(SDL_AudioDevice *device) } if (device->hidden->thread) { - SDL_assert(SDL_AtomicGet(&device->shutdown) != 0); // should have been set by SDL_audio.c + SDL_assert(SDL_GetAtomicInt(&device->shutdown) != 0); // should have been set by SDL_audio.c SDL_WaitThread(device->hidden->thread, NULL); } @@ -839,7 +839,7 @@ static int AudioQueueThreadEntry(void *arg) SDL_SignalSemaphore(device->hidden->ready_semaphore); // This would be WaitDevice/WaitRecordingDevice in the normal SDL audio thread, but we get *BufferReadyCallback calls here to know when to iterate. - while (!SDL_AtomicGet(&device->shutdown)) { + while (!SDL_GetAtomicInt(&device->shutdown)) { CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0.10, 1); } diff --git a/src/audio/directsound/SDL_directsound.c b/src/audio/directsound/SDL_directsound.c index 43a2b79e..43864b2c 100644 --- a/src/audio/directsound/SDL_directsound.c +++ b/src/audio/directsound/SDL_directsound.c @@ -234,7 +234,7 @@ static bool DSOUND_WaitDevice(SDL_AudioDevice *device) /* Semi-busy wait, since we have no way of getting play notification on a primary mixing buffer located in hardware (DirectX 5.0) */ - while (!SDL_AtomicGet(&device->shutdown)) { + while (!SDL_GetAtomicInt(&device->shutdown)) { DWORD status = 0; DWORD cursor = 0; DWORD junk = 0; @@ -336,7 +336,7 @@ static Uint8 *DSOUND_GetDeviceBuf(SDL_AudioDevice *device, int *buffer_size) static bool DSOUND_WaitRecordingDevice(SDL_AudioDevice *device) { struct SDL_PrivateAudioData *h = device->hidden; - while (!SDL_AtomicGet(&device->shutdown)) { + while (!SDL_GetAtomicInt(&device->shutdown)) { DWORD junk, cursor; if (IDirectSoundCaptureBuffer_GetCurrentPosition(h->capturebuf, &junk, &cursor) != DS_OK) { return false; diff --git a/src/audio/dsp/SDL_dspaudio.c b/src/audio/dsp/SDL_dspaudio.c index 199fecb1..62e2f4c4 100644 --- a/src/audio/dsp/SDL_dspaudio.c +++ b/src/audio/dsp/SDL_dspaudio.c @@ -204,7 +204,7 @@ static bool DSP_WaitDevice(SDL_AudioDevice *device) const unsigned long ioctlreq = device->recording ? SNDCTL_DSP_GETISPACE : SNDCTL_DSP_GETOSPACE; struct SDL_PrivateAudioData *h = device->hidden; - while (!SDL_AtomicGet(&device->shutdown)) { + while (!SDL_GetAtomicInt(&device->shutdown)) { audio_buf_info info; const int rc = ioctl(h->audio_fd, ioctlreq, &info); if (rc < 0) { diff --git a/src/audio/dummy/SDL_dummyaudio.h b/src/audio/dummy/SDL_dummyaudio.h index 6f4c31c9..fd46c3a8 100644 --- a/src/audio/dummy/SDL_dummyaudio.h +++ b/src/audio/dummy/SDL_dummyaudio.h @@ -28,7 +28,7 @@ struct SDL_PrivateAudioData { Uint8 *mixbuf; // The file descriptor for the audio device - Uint32 io_delay; // miliseconds to sleep in WaitDevice. + Uint32 io_delay; // milliseconds to sleep in WaitDevice. }; #endif // SDL_dummyaudio_h_ diff --git a/src/audio/n3ds/SDL_n3dsaudio.c b/src/audio/n3ds/SDL_n3dsaudio.c index 6d3afa31..900969ea 100644 --- a/src/audio/n3ds/SDL_n3dsaudio.c +++ b/src/audio/n3ds/SDL_n3dsaudio.c @@ -203,7 +203,7 @@ static bool N3DSAUDIO_PlayDevice(SDL_AudioDevice *device, const Uint8 *buffer, i static bool N3DSAUDIO_WaitDevice(SDL_AudioDevice *device) { contextLock(device); - while (!device->hidden->isCancelled && !SDL_AtomicGet(&device->shutdown) && + while (!device->hidden->isCancelled && !SDL_GetAtomicInt(&device->shutdown) && device->hidden->waveBuf[device->hidden->nextbuf].status != NDSP_WBUF_FREE) { CondVar_Wait(&device->hidden->cv, &device->hidden->lock); } diff --git a/src/audio/netbsd/SDL_netbsdaudio.c b/src/audio/netbsd/SDL_netbsdaudio.c index 92c99cd3..7e105007 100644 --- a/src/audio/netbsd/SDL_netbsdaudio.c +++ b/src/audio/netbsd/SDL_netbsdaudio.c @@ -117,7 +117,7 @@ static void NETBSDAUDIO_Status(SDL_AudioDevice *device) static bool NETBSDAUDIO_WaitDevice(SDL_AudioDevice *device) { const bool recording = device->recording; - while (!SDL_AtomicGet(&device->shutdown)) { + while (!SDL_GetAtomicInt(&device->shutdown)) { audio_info_t info; const int rc = ioctl(device->hidden->audio_fd, AUDIO_GETINFO, &info); if (rc < 0) { diff --git a/src/audio/openslES/SDL_openslES.c b/src/audio/openslES/SDL_openslES.c index 7bc083a2..2ab0de0e 100644 --- a/src/audio/openslES/SDL_openslES.c +++ b/src/audio/openslES/SDL_openslES.c @@ -229,9 +229,9 @@ static void OPENSLES_DestroyPCMRecorder(SDL_AudioDevice *device) } // !!! FIXME: make this non-blocking! -static void SDLCALL RequestAndroidPermissionBlockingCallback(void *userdata, const char *permission, SDL_bool granted) +static void SDLCALL RequestAndroidPermissionBlockingCallback(void *userdata, const char *permission, bool granted) { - SDL_AtomicSet((SDL_AtomicInt *) userdata, granted ? 1 : -1); + SDL_SetAtomicInt((SDL_AtomicInt *) userdata, granted ? 1 : -1); } static bool OPENSLES_CreatePCMRecorder(SDL_AudioDevice *device) @@ -250,16 +250,16 @@ static bool OPENSLES_CreatePCMRecorder(SDL_AudioDevice *device) // !!! FIXME: make this non-blocking! { SDL_AtomicInt permission_response; - SDL_AtomicSet(&permission_response, 0); + SDL_SetAtomicInt(&permission_response, 0); if (!SDL_RequestAndroidPermission("android.permission.RECORD_AUDIO", RequestAndroidPermissionBlockingCallback, &permission_response)) { return false; } - while (SDL_AtomicGet(&permission_response) == 0) { + while (SDL_GetAtomicInt(&permission_response) == 0) { SDL_Delay(10); } - if (SDL_AtomicGet(&permission_response) < 0) { + if (SDL_GetAtomicInt(&permission_response) < 0) { LOGE("This app doesn't have RECORD_AUDIO permission"); return SDL_SetError("This app doesn't have RECORD_AUDIO permission"); } @@ -273,7 +273,7 @@ static bool OPENSLES_CreatePCMRecorder(SDL_AudioDevice *device) // Update the fragment size as size in bytes SDL_UpdatedAudioDeviceFormat(device); - LOGI("Try to open %u hz %u bit chan %u %s samples %u", + LOGI("Try to open %u hz %u bit %u channels %s samples %u", device->spec.freq, SDL_AUDIO_BITSIZE(device->spec.format), device->spec.channels, (device->spec.format & 0x1000) ? "BE" : "LE", device->sample_frames); @@ -453,7 +453,7 @@ static bool OPENSLES_CreatePCMPlayer(SDL_AudioDevice *device) // Update the fragment size as size in bytes SDL_UpdatedAudioDeviceFormat(device); - LOGI("Try to open %u hz %s %u bit chan %u %s samples %u", + LOGI("Try to open %u hz %s %u bit %u channels %s samples %u", device->spec.freq, SDL_AUDIO_ISFLOAT(device->spec.format) ? "float" : "pcm", SDL_AUDIO_BITSIZE(device->spec.format), device->spec.channels, (device->spec.format & 0x1000) ? "BE" : "LE", device->sample_frames); @@ -652,7 +652,7 @@ static bool OPENSLES_WaitDevice(SDL_AudioDevice *device) LOGV("OPENSLES_WaitDevice()"); - while (!SDL_AtomicGet(&device->shutdown)) { + while (!SDL_GetAtomicInt(&device->shutdown)) { // this semaphore won't fire when the app is in the background (OPENSLES_PauseDevices was called). if (SDL_WaitSemaphoreTimeout(audiodata->playsem, 100)) { return true; // semaphore was signaled, let's go! diff --git a/src/audio/pipewire/SDL_pipewire.c b/src/audio/pipewire/SDL_pipewire.c index ca23a59a..1cfe9a8d 100644 --- a/src/audio/pipewire/SDL_pipewire.c +++ b/src/audio/pipewire/SDL_pipewire.c @@ -711,7 +711,7 @@ static bool hotplug_loop_init(void) spa_list_init(&hotplug_pending_list); spa_list_init(&hotplug_io_list); - hotplug_loop = PIPEWIRE_pw_thread_loop_new("SDLAudioHotplug", NULL); + hotplug_loop = PIPEWIRE_pw_thread_loop_new("SDLPwAudioPlug", NULL); if (!hotplug_loop) { return SDL_SetError("Pipewire: Failed to create hotplug detection loop (%i)", errno); } @@ -1215,6 +1215,7 @@ static void PIPEWIRE_DeinitializeStart(void) static void PIPEWIRE_Deinitialize(void) { if (pipewire_initialized) { + hotplug_loop_destroy(); deinit_pipewire_library(); pipewire_initialized = false; } @@ -1270,7 +1271,6 @@ static bool PIPEWIRE_PREFERRED_Init(SDL_AudioDriverImpl *impl) PIPEWIRE_pw_thread_loop_unlock(hotplug_loop); if (no_devices || !pipewire_core_version_at_least(1, 0, 0)) { - hotplug_loop_destroy(); PIPEWIRE_Deinitialize(); return false; } diff --git a/src/audio/pulseaudio/SDL_pulseaudio.c b/src/audio/pulseaudio/SDL_pulseaudio.c index 43b35772..73390436 100644 --- a/src/audio/pulseaudio/SDL_pulseaudio.c +++ b/src/audio/pulseaudio/SDL_pulseaudio.c @@ -413,7 +413,7 @@ static bool PULSEAUDIO_WaitDevice(SDL_AudioDevice *device) PULSEAUDIO_pa_threaded_mainloop_lock(pulseaudio_threaded_mainloop); - while (!SDL_AtomicGet(&device->shutdown) && (h->bytes_requested == 0)) { + while (!SDL_GetAtomicInt(&device->shutdown) && (h->bytes_requested == 0)) { //SDL_Log("PULSEAUDIO WAIT IN WAITDEVICE!"); PULSEAUDIO_pa_threaded_mainloop_wait(pulseaudio_threaded_mainloop); @@ -486,7 +486,7 @@ static bool PULSEAUDIO_WaitRecordingDevice(SDL_AudioDevice *device) PULSEAUDIO_pa_threaded_mainloop_lock(pulseaudio_threaded_mainloop); - while (!SDL_AtomicGet(&device->shutdown)) { + while (!SDL_GetAtomicInt(&device->shutdown)) { 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)) { //SDL_Log("PULSEAUDIO DEVICE FAILURE IN WAITRECORDINGDEVICE!"); @@ -553,7 +553,7 @@ static void PULSEAUDIO_FlushRecording(SDL_AudioDevice *device) h->recordinglen = 0; } - while (!SDL_AtomicGet(&device->shutdown) && (PULSEAUDIO_pa_stream_readable_size(h->stream) > 0)) { + while (!SDL_GetAtomicInt(&device->shutdown) && (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)) { //SDL_Log("PULSEAUDIO DEVICE FAILURE IN FLUSHRECORDING!"); @@ -901,7 +901,7 @@ static int SDLCALL HotplugThread(void *data) SDL_SignalSemaphore((SDL_Semaphore *) data); - while (SDL_AtomicGet(&pulseaudio_hotplug_thread_active)) { + while (SDL_GetAtomicInt(&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); @@ -956,9 +956,14 @@ static void PULSEAUDIO_DetectDevices(SDL_AudioDevice **default_playback, SDL_Aud } // ok, we have a sane list, let's set up hotplug notifications now... - SDL_AtomicSet(&pulseaudio_hotplug_thread_active, 1); - pulseaudio_hotplug_thread = SDL_CreateThreadWithStackSize(HotplugThread, "PulseHotplug", 256 * 1024, ready_sem); // !!! FIXME: this can probably survive in significantly less stack space. - SDL_WaitSemaphore(ready_sem); + SDL_SetAtomicInt(&pulseaudio_hotplug_thread_active, 1); + pulseaudio_hotplug_thread = SDL_CreateThread(HotplugThread, "PulseHotplug", ready_sem); + if (pulseaudio_hotplug_thread) { + SDL_WaitSemaphore(ready_sem); // wait until the thread hits it's main loop. + } else { + SDL_SetAtomicInt(&pulseaudio_hotplug_thread_active, 0); // thread failed to start, we'll go on without hotplug. + } + SDL_DestroySemaphore(ready_sem); } @@ -973,7 +978,7 @@ static void PULSEAUDIO_DeinitializeStart(void) { if (pulseaudio_hotplug_thread) { PULSEAUDIO_pa_threaded_mainloop_lock(pulseaudio_threaded_mainloop); - SDL_AtomicSet(&pulseaudio_hotplug_thread_active, 0); + SDL_SetAtomicInt(&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); diff --git a/src/audio/qnx/SDL_qsa_audio.c b/src/audio/qnx/SDL_qsa_audio.c index 7dffa1f9..3a549b87 100644 --- a/src/audio/qnx/SDL_qsa_audio.c +++ b/src/audio/qnx/SDL_qsa_audio.c @@ -112,14 +112,14 @@ static bool QSA_WaitDevice(SDL_AudioDevice *device) static bool QSA_PlayDevice(SDL_AudioDevice *device, const Uint8 *buffer, int buflen) { - if (SDL_AtomicGet(&device->shutdown) || !device->hidden) { + if (SDL_GetAtomicInt(&device->shutdown) || !device->hidden) { return true; } int towrite = buflen; // Write the audio data, checking for EAGAIN (buffer full) and underrun - while ((towrite > 0) && !SDL_AtomicGet(&device->shutdown)); + while ((towrite > 0) && !SDL_GetAtomicInt(&device->shutdown)); const int bw = snd_pcm_plugin_write(device->hidden->audio_handle, buffer, towrite); if (bw != towrite) { // Check if samples playback got stuck somewhere in hardware or in the audio device driver diff --git a/src/audio/sndio/SDL_sndioaudio.c b/src/audio/sndio/SDL_sndioaudio.c index 0e709fa0..91cfe79d 100644 --- a/src/audio/sndio/SDL_sndioaudio.c +++ b/src/audio/sndio/SDL_sndioaudio.c @@ -151,7 +151,7 @@ static bool SNDIO_WaitDevice(SDL_AudioDevice *device) { const bool recording = device->recording; - while (!SDL_AtomicGet(&device->shutdown)) { + while (!SDL_GetAtomicInt(&device->shutdown)) { if (SNDIO_sio_eof(device->hidden->dev)) { return false; } @@ -200,7 +200,7 @@ static int SNDIO_RecordDevice(SDL_AudioDevice *device, void *buffer, int buflen) static void SNDIO_FlushRecording(SDL_AudioDevice *device) { char buf[512]; - while (!SDL_AtomicGet(&device->shutdown) && (SNDIO_sio_read(device->hidden->dev, buf, sizeof(buf)) > 0)) { + while (!SDL_GetAtomicInt(&device->shutdown) && (SNDIO_sio_read(device->hidden->dev, buf, sizeof(buf)) > 0)) { // do nothing } } diff --git a/src/audio/vita/SDL_vitaaudio.c b/src/audio/vita/SDL_vitaaudio.c index fcd046c6..ad479f98 100644 --- a/src/audio/vita/SDL_vitaaudio.c +++ b/src/audio/vita/SDL_vitaaudio.c @@ -137,7 +137,7 @@ static bool VITAAUD_PlayDevice(SDL_AudioDevice *device, const Uint8 *buffer, int static bool VITAAUD_WaitDevice(SDL_AudioDevice *device) { // !!! FIXME: we might just need to sleep roughly as long as playback buffers take to process, based on sample rate, etc. - while (!SDL_AtomicGet(&device->shutdown) && (sceAudioOutGetRestSample(device->hidden->port) >= device->buffer_size)) { + while (!SDL_GetAtomicInt(&device->shutdown) && (sceAudioOutGetRestSample(device->hidden->port) >= device->buffer_size)) { SDL_Delay(1); } return true; @@ -176,7 +176,7 @@ static bool VITAAUD_WaitRecordingDevice(SDL_AudioDevice *device) // there's only a blocking call to obtain more data, so we'll just sleep as // long as a buffer would run. const Uint64 endticks = SDL_GetTicks() + ((device->sample_frames * 1000) / device->spec.freq); - while (!SDL_AtomicGet(&device->shutdown) && (SDL_GetTicks() < endticks)) { + while (!SDL_GetAtomicInt(&device->shutdown) && (SDL_GetTicks() < endticks)) { SDL_Delay(1); } return true; diff --git a/src/audio/wasapi/SDL_wasapi.c b/src/audio/wasapi/SDL_wasapi.c index cf3b86b0..6c8eee6c 100644 --- a/src/audio/wasapi/SDL_wasapi.c +++ b/src/audio/wasapi/SDL_wasapi.c @@ -74,11 +74,11 @@ static void ManagementThreadMainloop(void) { SDL_LockMutex(ManagementThreadLock); ManagementThreadPendingTask *task; - while (((task = (ManagementThreadPendingTask *)SDL_AtomicGetPointer((void **)&ManagementThreadPendingTasks)) != NULL) || !SDL_AtomicGet(&ManagementThreadShutdown)) { + while (((task = (ManagementThreadPendingTask *)SDL_GetAtomicPointer((void **)&ManagementThreadPendingTasks)) != NULL) || !SDL_GetAtomicInt(&ManagementThreadShutdown)) { if (!task) { SDL_WaitCondition(ManagementThreadCondition, ManagementThreadLock); // block until there's something to do. } else { - SDL_AtomicSetPointer((void **) &ManagementThreadPendingTasks, task->next); // take task off the pending list. + SDL_SetAtomicPointer((void **) &ManagementThreadPendingTasks, task->next); // take task off the pending list. SDL_UnlockMutex(ManagementThreadLock); // let other things add to the list while we chew on this task. task->result = task->fn(task->userdata); // run this task. if (task->task_complete_sem) { // something waiting on result? @@ -101,7 +101,7 @@ bool WASAPI_ProxyToManagementThread(ManagementThreadTask task, void *userdata, b return true; // completed! } - if (SDL_AtomicGet(&ManagementThreadShutdown)) { + if (SDL_GetAtomicInt(&ManagementThreadShutdown)) { return SDL_SetError("Can't add task, we're shutting down"); } @@ -127,14 +127,14 @@ bool WASAPI_ProxyToManagementThread(ManagementThreadTask task, void *userdata, b // add to end of task list. ManagementThreadPendingTask *prev = NULL; - for (ManagementThreadPendingTask *i = (ManagementThreadPendingTask *)SDL_AtomicGetPointer((void **)&ManagementThreadPendingTasks); i; i = i->next) { + for (ManagementThreadPendingTask *i = (ManagementThreadPendingTask *)SDL_GetAtomicPointer((void **)&ManagementThreadPendingTasks); i; i = i->next) { prev = i; } if (prev) { prev->next = pending; } else { - SDL_AtomicSetPointer((void **) &ManagementThreadPendingTasks, pending); + SDL_SetAtomicPointer((void **) &ManagementThreadPendingTasks, pending); } // task is added to the end of the pending list, let management thread rip! @@ -210,8 +210,8 @@ static bool InitManagementThread(void) return false; } - SDL_AtomicSetPointer((void **) &ManagementThreadPendingTasks, NULL); - SDL_AtomicSet(&ManagementThreadShutdown, 0); + SDL_SetAtomicPointer((void **) &ManagementThreadPendingTasks, NULL); + SDL_SetAtomicInt(&ManagementThreadShutdown, 0); ManagementThread = SDL_CreateThreadWithStackSize(ManagementThreadEntry, "SDLWASAPIMgmt", 256 * 1024, &mgmtdata); // !!! FIXME: maybe even smaller stack size? if (!ManagementThread) { return false; @@ -234,7 +234,7 @@ static bool InitManagementThread(void) static void DeinitManagementThread(void) { if (ManagementThread) { - SDL_AtomicSet(&ManagementThreadShutdown, 1); + SDL_SetAtomicInt(&ManagementThreadShutdown, 1); SDL_LockMutex(ManagementThreadLock); SDL_SignalCondition(ManagementThreadCondition); SDL_UnlockMutex(ManagementThreadLock); @@ -242,13 +242,13 @@ static void DeinitManagementThread(void) ManagementThread = NULL; } - SDL_assert(SDL_AtomicGetPointer((void **) &ManagementThreadPendingTasks) == NULL); + SDL_assert(SDL_GetAtomicPointer((void **) &ManagementThreadPendingTasks) == NULL); SDL_DestroyCondition(ManagementThreadCondition); SDL_DestroyMutex(ManagementThreadLock); ManagementThreadCondition = NULL; ManagementThreadLock = NULL; - SDL_AtomicSet(&ManagementThreadShutdown, 0); + SDL_SetAtomicInt(&ManagementThreadShutdown, 0); } typedef struct @@ -325,12 +325,6 @@ static bool mgmtthrtask_CoTaskMemFree(void *userdata) return true; } -static bool mgmtthrtask_PlatformDeleteActivationHandler(void *userdata) -{ - WASAPI_PlatformDeleteActivationHandler(userdata); - return true; -} - static bool mgmtthrtask_CloseHandle(void *userdata) { CloseHandle((HANDLE) userdata); @@ -370,12 +364,6 @@ static void ResetWasapiDevice(SDL_AudioDevice *device) WASAPI_ProxyToManagementThread(mgmtthrtask_CoTaskMemFree, ptr, NULL); } - if (device->hidden->activation_handler) { - void *activation_handler = device->hidden->activation_handler; - device->hidden->activation_handler = NULL; - WASAPI_ProxyToManagementThread(mgmtthrtask_PlatformDeleteActivationHandler, activation_handler, NULL); - } - if (device->hidden->event) { HANDLE event = device->hidden->event; device->hidden->event = NULL; @@ -415,14 +403,14 @@ static bool RecoverWasapiDevice(SDL_AudioDevice *device) // do not call when holding the device lock! static bool RecoverWasapiIfLost(SDL_AudioDevice *device) { - if (SDL_AtomicGet(&device->shutdown)) { + if (SDL_GetAtomicInt(&device->shutdown)) { return false; // already failed. } else if (device->hidden->device_dead) { // had a fatal error elsewhere, clean up and quit IAudioClient_Stop(device->hidden->client); WASAPI_DisconnectDevice(device); - SDL_assert(SDL_AtomicGet(&device->shutdown)); // so we don't come back through here. + SDL_assert(SDL_GetAtomicInt(&device->shutdown)); // so we don't come back through here. return false; // already failed. - } else if (SDL_AtomicGet(&device->zombie)) { + } else if (SDL_GetAtomicInt(&device->zombie)) { return false; // we're already dead, so just leave and let the Zombie implementations take over. } else if (!device->hidden->client) { return true; // still waiting for activation. @@ -550,7 +538,7 @@ static void WASAPI_FlushRecording(SDL_AudioDevice *device) DWORD flags = 0; // just read until we stop getting packets, throwing them away. - while (!SDL_AtomicGet(&device->shutdown) && device->hidden->capture) { + while (!SDL_GetAtomicInt(&device->shutdown) && device->hidden->capture) { const HRESULT ret = IAudioCaptureClient_GetBuffer(device->hidden->capture, &ptr, &frames, &flags, NULL, NULL); if (ret == AUDCLNT_S_BUFFER_EMPTY) { break; // no more buffered data; we're done. @@ -592,7 +580,7 @@ static bool mgmtthrtask_PrepDevice(void *userdata) IAudioClient *client = device->hidden->client; SDL_assert(client != NULL); -#if defined(SDL_PLATFORM_WINRT) || defined(SDL_PLATFORM_GDK) // CreateEventEx() arrived in Vista, so we need an #ifdef for XP. +#if defined(SDL_PLATFORM_GDK) // CreateEventEx() arrived in Vista, so we need an #ifdef for XP. device->hidden->event = CreateEventEx(NULL, NULL, 0, EVENT_ALL_ACCESS); #else device->hidden->event = CreateEventW(NULL, 0, 0, NULL); diff --git a/src/audio/wasapi/SDL_wasapi.h b/src/audio/wasapi/SDL_wasapi.h index 107ddb53..3d4744cf 100644 --- a/src/audio/wasapi/SDL_wasapi.h +++ b/src/audio/wasapi/SDL_wasapi.h @@ -42,10 +42,9 @@ struct SDL_PrivateAudioData int framesize; bool device_lost; bool device_dead; - void *activation_handler; }; -// win32 and winrt implementations call into these. +// win32 implementation calls into these. bool WASAPI_PrepDevice(SDL_AudioDevice *device); void WASAPI_DisconnectDevice(SDL_AudioDevice *device); // don't hold the device lock when calling this! @@ -54,7 +53,7 @@ void WASAPI_DisconnectDevice(SDL_AudioDevice *device); // don't hold the device typedef bool (*ManagementThreadTask)(void *userdata); bool WASAPI_ProxyToManagementThread(ManagementThreadTask task, void *userdata, bool *wait_until_complete); -// These are functions that are implemented differently for Windows vs WinRT. +// These are functions that are (were...?) implemented differently for various Windows versions. // UNLESS OTHERWISE NOTED THESE ALL HAPPEN ON THE MANAGEMENT THREAD. bool WASAPI_PlatformInit(void); void WASAPI_PlatformDeinit(void); @@ -63,7 +62,6 @@ void WASAPI_EnumerateEndpoints(SDL_AudioDevice **default_playback, SDL_AudioDevi bool WASAPI_ActivateDevice(SDL_AudioDevice *device); void WASAPI_PlatformThreadInit(SDL_AudioDevice *device); // this happens on the audio device thread, not the management thread. void WASAPI_PlatformThreadDeinit(SDL_AudioDevice *device); // this happens on the audio device thread, not the management thread. -void WASAPI_PlatformDeleteActivationHandler(void *handler); void WASAPI_PlatformFreeDeviceHandle(SDL_AudioDevice *device); #ifdef __cplusplus diff --git a/src/audio/wasapi/SDL_wasapi_win32.c b/src/audio/wasapi/SDL_wasapi_win32.c index e548c999..cd13115f 100644 --- a/src/audio/wasapi/SDL_wasapi_win32.c +++ b/src/audio/wasapi/SDL_wasapi_win32.c @@ -20,13 +20,14 @@ */ #include "SDL_internal.h" -/* This is code that Windows uses to talk to WASAPI-related system APIs. +/* !!! FIXME: merge this all into SDL_wasapi.c, now that WinRT is gone. + This is code that Windows uses to talk to WASAPI-related system APIs. This is for non-WinRT desktop apps. The C++/CX implementation of these functions, exclusive to WinRT, are in SDL_wasapi_winrt.cpp. 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 defined(SDL_AUDIO_DRIVER_WASAPI) && !defined(SDL_PLATFORM_WINRT) +#if defined(SDL_AUDIO_DRIVER_WASAPI) #include "../../core/windows/SDL_windows.h" #include "../../core/windows/SDL_immdevice.h" @@ -191,15 +192,9 @@ void WASAPI_EnumerateEndpoints(SDL_AudioDevice **default_playback, SDL_AudioDevi SDL_IMMDevice_EnumerateEndpoints(default_playback, default_recording); } -void WASAPI_PlatformDeleteActivationHandler(void *handler) -{ - // not asynchronous. - SDL_assert(!"This function should have only been called on WinRT."); -} - void WASAPI_PlatformFreeDeviceHandle(SDL_AudioDevice *device) { SDL_IMMDevice_FreeDeviceHandle(device); } -#endif // SDL_AUDIO_DRIVER_WASAPI && !defined(SDL_PLATFORM_WINRT) +#endif // SDL_AUDIO_DRIVER_WASAPI diff --git a/src/audio/wasapi/SDL_wasapi_winrt.cpp b/src/audio/wasapi/SDL_wasapi_winrt.cpp deleted file mode 100644 index 4b27df29..00000000 --- a/src/audio/wasapi/SDL_wasapi_winrt.cpp +++ /dev/null @@ -1,360 +0,0 @@ -/* - 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" - -// This is C++/CX code that the WinRT port uses to talk to WASAPI-related -// system APIs. The C implementation of these functions, for non-WinRT apps, -// 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 defined(SDL_AUDIO_DRIVER_WASAPI) && defined(SDL_PLATFORM_WINRT) - -#include -#include -#include -#include -#include -#include - -extern "C" { -#include "../../core/windows/SDL_windows.h" -#include "../SDL_sysaudio.h" -} - -#define COBJMACROS -#include -#include - -#include "SDL_wasapi.h" - -using namespace Windows::Devices::Enumeration; -using namespace Windows::Media::Devices; -using namespace Windows::Foundation; -using namespace Microsoft::WRL; - -static Platform::String ^ SDL_PKEY_AudioEngine_DeviceFormat = L"{f19f064d-082c-4e27-bc73-6882a1bb8e4c} 0"; - - -static bool FindWinRTAudioDeviceCallback(SDL_AudioDevice *device, void *userdata) -{ - return (SDL_wcscmp((LPCWSTR) device->handle, (LPCWSTR) userdata) == 0); -} - -static SDL_AudioDevice *FindWinRTAudioDevice(LPCWSTR devid) -{ - return SDL_FindPhysicalAudioDeviceByCallback(FindWinRTAudioDeviceCallback, (void *) devid); -} - -class SDL_WasapiDeviceEventHandler -{ - public: - SDL_WasapiDeviceEventHandler(const bool _recording); - ~SDL_WasapiDeviceEventHandler(); - void OnDeviceAdded(DeviceWatcher ^ sender, DeviceInformation ^ args); - void OnDeviceRemoved(DeviceWatcher ^ sender, DeviceInformationUpdate ^ args); - void OnDeviceUpdated(DeviceWatcher ^ sender, DeviceInformationUpdate ^ args); - void OnEnumerationCompleted(DeviceWatcher ^ sender, Platform::Object ^ args); - void OnDefaultRenderDeviceChanged(Platform::Object ^ sender, DefaultAudioRenderDeviceChangedEventArgs ^ args); - void OnDefaultCaptureDeviceChanged(Platform::Object ^ sender, DefaultAudioCaptureDeviceChangedEventArgs ^ args); - void WaitForCompletion(); - - private: - SDL_Semaphore *completed_semaphore; - const bool recording; - DeviceWatcher ^ watcher; - Windows::Foundation::EventRegistrationToken added_handler; - Windows::Foundation::EventRegistrationToken removed_handler; - Windows::Foundation::EventRegistrationToken updated_handler; - Windows::Foundation::EventRegistrationToken completed_handler; - Windows::Foundation::EventRegistrationToken default_changed_handler; -}; - -SDL_WasapiDeviceEventHandler::SDL_WasapiDeviceEventHandler(const bool _recording) - : recording(_recording), completed_semaphore(SDL_CreateSemaphore(0)) -{ - if (!completed_semaphore) { - return; // uhoh. - } - - Platform::String ^ selector = _recording ? MediaDevice::GetAudioCaptureSelector() : MediaDevice::GetAudioRenderSelector(); - Platform::Collections::Vector properties; - properties.Append(SDL_PKEY_AudioEngine_DeviceFormat); - watcher = DeviceInformation::CreateWatcher(selector, properties.GetView()); - if (!watcher) - return; // uhoh. - - // !!! FIXME: this doesn't need a lambda here, I think, if I make SDL_WasapiDeviceEventHandler a proper C++/CX class. --ryan. - added_handler = watcher->Added += ref new TypedEventHandler([this](DeviceWatcher ^ sender, DeviceInformation ^ args) { OnDeviceAdded(sender, args); }); - removed_handler = watcher->Removed += ref new TypedEventHandler([this](DeviceWatcher ^ sender, DeviceInformationUpdate ^ args) { OnDeviceRemoved(sender, args); }); - updated_handler = watcher->Updated += ref new TypedEventHandler([this](DeviceWatcher ^ sender, DeviceInformationUpdate ^ args) { OnDeviceUpdated(sender, args); }); - completed_handler = watcher->EnumerationCompleted += ref new TypedEventHandler([this](DeviceWatcher ^ sender, Platform::Object ^ args) { OnEnumerationCompleted(sender, args); }); - if (recording) { - default_changed_handler = MediaDevice::DefaultAudioCaptureDeviceChanged += ref new TypedEventHandler([this](Platform::Object ^ sender, DefaultAudioCaptureDeviceChangedEventArgs ^ args) { OnDefaultCaptureDeviceChanged(sender, args); }); - } else { - default_changed_handler = MediaDevice::DefaultAudioRenderDeviceChanged += ref new TypedEventHandler([this](Platform::Object ^ sender, DefaultAudioRenderDeviceChangedEventArgs ^ args) { OnDefaultRenderDeviceChanged(sender, args); }); - } - watcher->Start(); -} - -SDL_WasapiDeviceEventHandler::~SDL_WasapiDeviceEventHandler() -{ - if (watcher) { - watcher->Added -= added_handler; - watcher->Removed -= removed_handler; - watcher->Updated -= updated_handler; - watcher->EnumerationCompleted -= completed_handler; - watcher->Stop(); - watcher = nullptr; - } - - if (completed_semaphore) { - SDL_DestroySemaphore(completed_semaphore); - completed_semaphore = nullptr; - } - - if (recording) { - MediaDevice::DefaultAudioCaptureDeviceChanged -= default_changed_handler; - } else { - MediaDevice::DefaultAudioRenderDeviceChanged -= default_changed_handler; - } -} - -void SDL_WasapiDeviceEventHandler::OnDeviceAdded(DeviceWatcher ^ sender, DeviceInformation ^ info) -{ - /* You can have multiple endpoints on a device that are mutually exclusive ("Speakers" vs "Line Out" or whatever). - In a perfect world, things that are unplugged won't be in this collection. The only gotcha is probably for - phones and tablets, where you might have an internal speaker and a headphone jack and expect both to be - available and switch automatically. (!!! FIXME...?) */ - - SDL_assert(sender == this->watcher); - char *utf8dev = WIN_StringToUTF8W(info->Name->Data()); - if (utf8dev) { - SDL_AudioSpec spec; - SDL_zero(spec); - - Platform::Object ^ obj = info->Properties->Lookup(SDL_PKEY_AudioEngine_DeviceFormat); - if (obj) { - IPropertyValue ^ property = (IPropertyValue ^) obj; - Platform::Array ^ data; - property->GetUInt8Array(&data); - WAVEFORMATEXTENSIBLE fmt; - SDL_zero(fmt); - SDL_memcpy(&fmt, data->Data, SDL_min(data->Length, sizeof(WAVEFORMATEXTENSIBLE))); - spec.channels = (Uint8)fmt.Format.nChannels; - spec.freq = fmt.Format.nSamplesPerSec; - spec.format = SDL_WaveFormatExToSDLFormat((WAVEFORMATEX *)&fmt); - } - - LPWSTR devid = SDL_wcsdup(info->Id->Data()); - if (devid) { - SDL_AddAudioDevice(this->recording, utf8dev, spec.channels ? &spec : NULL, devid); - } - SDL_free(utf8dev); - } -} - -void SDL_WasapiDeviceEventHandler::OnDeviceRemoved(DeviceWatcher ^ sender, DeviceInformationUpdate ^ info) -{ - SDL_assert(sender == this->watcher); - WASAPI_DisconnectDevice(FindWinRTAudioDevice(info->Id->Data())); -} - -void SDL_WasapiDeviceEventHandler::OnDeviceUpdated(DeviceWatcher ^ sender, DeviceInformationUpdate ^ args) -{ - SDL_assert(sender == this->watcher); -} - -void SDL_WasapiDeviceEventHandler::OnEnumerationCompleted(DeviceWatcher ^ sender, Platform::Object ^ args) -{ - SDL_assert(sender == this->watcher); - if (this->completed_semaphore) { - SDL_SignalSemaphore(this->completed_semaphore); - } -} - -void SDL_WasapiDeviceEventHandler::OnDefaultRenderDeviceChanged(Platform::Object ^ sender, DefaultAudioRenderDeviceChangedEventArgs ^ args) -{ - SDL_assert(!this->recording); - SDL_DefaultAudioDeviceChanged(FindWinRTAudioDevice(args->Id->Data())); -} - -void SDL_WasapiDeviceEventHandler::OnDefaultCaptureDeviceChanged(Platform::Object ^ sender, DefaultAudioCaptureDeviceChangedEventArgs ^ args) -{ - SDL_assert(this->recording); - SDL_DefaultAudioDeviceChanged(FindWinRTAudioDevice(args->Id->Data())); -} - -void SDL_WasapiDeviceEventHandler::WaitForCompletion() -{ - if (this->completed_semaphore) { - SDL_WaitSemaphore(this->completed_semaphore); - SDL_DestroySemaphore(this->completed_semaphore); - this->completed_semaphore = nullptr; - } -} - -static SDL_WasapiDeviceEventHandler *playback_device_event_handler; -static SDL_WasapiDeviceEventHandler *recording_device_event_handler; - -bool WASAPI_PlatformInit(void) -{ - return true; -} - -static void StopWasapiHotplug(void) -{ - delete playback_device_event_handler; - playback_device_event_handler = nullptr; - delete recording_device_event_handler; - recording_device_event_handler = nullptr; -} - -void WASAPI_PlatformDeinit(void) -{ - StopWasapiHotplug(); -} - -void WASAPI_PlatformDeinitializeStart(void) -{ - StopWasapiHotplug(); -} - - -void WASAPI_EnumerateEndpoints(SDL_AudioDevice **default_playback, SDL_AudioDevice **default_recording) -{ - Platform::String ^ defdevid; - - // DeviceWatchers will fire an Added event for each existing device at - // startup, so we don't need to enumerate them separately before - // listening for updates. - playback_device_event_handler = new SDL_WasapiDeviceEventHandler(false); - playback_device_event_handler->WaitForCompletion(); - defdevid = MediaDevice::GetDefaultAudioRenderId(AudioDeviceRole::Default); - if (defdevid) { - *default_playback = FindWinRTAudioDevice(defdevid->Data()); - } - - recording_device_event_handler = new SDL_WasapiDeviceEventHandler(true); - recording_device_event_handler->WaitForCompletion(); - defdevid = MediaDevice::GetDefaultAudioCaptureId(AudioDeviceRole::Default); - if (defdevid) { - *default_recording = FindWinRTAudioDevice(defdevid->Data()); - } -} - -class SDL_WasapiActivationHandler : public RuntimeClass, FtmBase, IActivateAudioInterfaceCompletionHandler> -{ -public: - SDL_WasapiActivationHandler() : completion_semaphore(SDL_CreateSemaphore(0)) { SDL_assert(completion_semaphore != NULL); } - STDMETHOD(ActivateCompleted)(IActivateAudioInterfaceAsyncOperation *operation); - void WaitForCompletion(); -private: - SDL_Semaphore *completion_semaphore; -}; - -void SDL_WasapiActivationHandler::WaitForCompletion() -{ - if (completion_semaphore) { - SDL_WaitSemaphore(completion_semaphore); - SDL_DestroySemaphore(completion_semaphore); - completion_semaphore = NULL; - } -} - -HRESULT -SDL_WasapiActivationHandler::ActivateCompleted(IActivateAudioInterfaceAsyncOperation *async) -{ - // Just set a flag, since we're probably in a different thread. We'll pick it up and init everything on our own thread to prevent races. - SDL_SignalSemaphore(completion_semaphore); - return S_OK; -} - -void WASAPI_PlatformDeleteActivationHandler(void *handler) -{ - ((SDL_WasapiActivationHandler *)handler)->Release(); -} - -bool WASAPI_ActivateDevice(SDL_AudioDevice *device) -{ - LPCWSTR devid = (LPCWSTR) device->handle; - SDL_assert(devid != NULL); - - ComPtr handler = Make(); - if (handler == nullptr) { - return SDL_SetError("Failed to allocate WASAPI activation handler"); - } - - handler.Get()->AddRef(); // we hold a reference after ComPtr destructs on return, causing a Release, and Release ourselves in WASAPI_PlatformDeleteActivationHandler(), etc. - device->hidden->activation_handler = handler.Get(); - - IActivateAudioInterfaceAsyncOperation *async = nullptr; - const HRESULT ret = ActivateAudioInterfaceAsync(devid, __uuidof(IAudioClient), nullptr, handler.Get(), &async); - - if (FAILED(ret) || async == nullptr) { - if (async != nullptr) { - async->Release(); - } - handler.Get()->Release(); - return WIN_SetErrorFromHRESULT("WASAPI can't activate requested audio endpoint", ret); - } - - // !!! FIXME: the problems in SDL2 that needed this to be synchronous are _probably_ solved by SDL3, and this can block indefinitely if a user prompt is shown to get permission to use a microphone. - handler.Get()->WaitForCompletion(); // block here until we have an answer, so this is synchronous to us after all. - - HRESULT activateRes = S_OK; - IUnknown *iunknown = nullptr; - const HRESULT getActivateRes = async->GetActivateResult(&activateRes, &iunknown); - async->Release(); - if (FAILED(getActivateRes)) { - return WIN_SetErrorFromHRESULT("Failed to get WASAPI activate result", getActivateRes); - } else if (FAILED(activateRes)) { - return WIN_SetErrorFromHRESULT("Failed to activate WASAPI device", activateRes); - } - - iunknown->QueryInterface(IID_PPV_ARGS(&device->hidden->client)); - if (!device->hidden->client) { - return SDL_SetError("Failed to query WASAPI client interface"); - } - - if (!WASAPI_PrepDevice(device)) { - return false; - } - - return true; -} - -void WASAPI_PlatformThreadInit(SDL_AudioDevice *device) -{ - // !!! FIXME: set this thread to "Pro Audio" priority. - SDL_SetThreadPriority(device->recording ? SDL_THREAD_PRIORITY_HIGH : SDL_THREAD_PRIORITY_TIME_CRITICAL); -} - -void WASAPI_PlatformThreadDeinit(SDL_AudioDevice *device) -{ - // !!! FIXME: set this thread to "Pro Audio" priority. -} - -void WASAPI_PlatformFreeDeviceHandle(SDL_AudioDevice *device) -{ - SDL_free(device->handle); -} - -#endif // SDL_AUDIO_DRIVER_WASAPI && defined(SDL_PLATFORM_WINRT) diff --git a/src/camera/SDL_camera.c b/src/camera/SDL_camera.c index 25d70973..a76a095b 100644 --- a/src/camera/SDL_camera.c +++ b/src/camera/SDL_camera.c @@ -115,8 +115,8 @@ bool SDL_AddCameraFormat(CameraFormatAddData *data, SDL_PixelFormat format, SDL_ // loss notifications will get black frames but otherwise keep functioning. static bool ZombieWaitDevice(SDL_Camera *device) { - if (!SDL_AtomicGet(&device->shutdown)) { - // !!! FIXME: this is bad for several reasons (uses double, could be precalculated, doesn't track elasped time). + if (!SDL_GetAtomicInt(&device->shutdown)) { + // !!! FIXME: this is bad for several reasons (uses double, could be precalculated, doesn't track elapsed time). const double duration = ((double) device->actual_spec.framerate_denominator / ((double) device->actual_spec.framerate_numerator)); SDL_Delay((Uint32) (duration * 1000.0)); } @@ -230,7 +230,7 @@ static void ClosePhysicalCamera(SDL_Camera *device) return; } - SDL_AtomicSet(&device->shutdown, 1); + SDL_SetAtomicInt(&device->shutdown, 1); // !!! FIXME: the close_cond stuff from audio might help the race condition here. @@ -297,7 +297,7 @@ void UnrefPhysicalCamera(SDL_Camera *device) // take it out of the device list. SDL_LockRWLockForWriting(camera_driver.device_hash_lock); if (SDL_RemoveFromHashTable(camera_driver.device_hash, (const void *) (uintptr_t) device->instance_id)) { - SDL_AtomicAdd(&camera_driver.device_count, -1); + SDL_AddAtomicInt(&camera_driver.device_count, -1); } SDL_UnlockRWLock(camera_driver.device_hash_lock); DestroyPhysicalCamera(device); // ...and nuke it. @@ -421,7 +421,7 @@ SDL_Camera *SDL_AddCamera(const char *name, SDL_CameraPosition position, int num SDL_assert(handle != NULL); SDL_LockRWLockForReading(camera_driver.device_hash_lock); - const int shutting_down = SDL_AtomicGet(&camera_driver.shutting_down); + const int shutting_down = SDL_GetAtomicInt(&camera_driver.shutting_down); SDL_UnlockRWLock(camera_driver.device_hash_lock); if (shutting_down) { return NULL; // we're shutting down, don't add any devices that are hotplugged at the last possible moment. @@ -488,13 +488,13 @@ SDL_Camera *SDL_AddCamera(const char *name, SDL_CameraPosition position, int num device->num_specs = num_specs; device->handle = handle; device->instance_id = SDL_GetNextObjectID(); - SDL_AtomicSet(&device->shutdown, 0); - SDL_AtomicSet(&device->zombie, 0); + SDL_SetAtomicInt(&device->shutdown, 0); + SDL_SetAtomicInt(&device->zombie, 0); RefPhysicalCamera(device); SDL_LockRWLockForWriting(camera_driver.device_hash_lock); if (SDL_InsertIntoHashTable(camera_driver.device_hash, (const void *) (uintptr_t) device->instance_id, device)) { - SDL_AtomicAdd(&camera_driver.device_count, 1); + SDL_AddAtomicInt(&camera_driver.device_count, 1); } else { SDL_DestroyMutex(device->lock); SDL_free(device->all_specs); @@ -542,7 +542,7 @@ void SDL_CameraDisconnected(SDL_Camera *device) ObtainPhysicalCameraObj(device); - const bool first_disconnect = SDL_AtomicCompareAndSwap(&device->zombie, 0, 1); + const bool first_disconnect = SDL_CompareAndSwapAtomicInt(&device->zombie, 0, 1); if (first_disconnect) { // if already disconnected this device, don't do it twice. // Swap in "Zombie" versions of the usual platform interfaces, so the device will keep // making progress until the app closes it. Otherwise, streams might continue to @@ -650,7 +650,7 @@ void SDL_CloseCamera(SDL_Camera *camera) ClosePhysicalCamera(device); } -SDL_bool SDL_GetCameraFormat(SDL_Camera *camera, SDL_CameraSpec *spec) +bool SDL_GetCameraFormat(SDL_Camera *camera, SDL_CameraSpec *spec) { bool result; @@ -713,7 +713,7 @@ SDL_CameraID *SDL_GetCameras(int *count) SDL_CameraID *result = NULL; SDL_LockRWLockForReading(camera_driver.device_hash_lock); - int num_devices = SDL_AtomicGet(&camera_driver.device_count); + int num_devices = SDL_GetAtomicInt(&camera_driver.device_count); result = (SDL_CameraID *) SDL_malloc((num_devices + 1) * sizeof (SDL_CameraID)); if (!result) { num_devices = 0; @@ -792,7 +792,7 @@ bool SDL_CameraThreadIterate(SDL_Camera *device) { SDL_LockMutex(device->lock); - if (SDL_AtomicGet(&device->shutdown)) { + if (SDL_GetAtomicInt(&device->shutdown)) { SDL_UnlockMutex(device->lock); return false; // we're done, shut it down. } @@ -1078,7 +1078,7 @@ SDL_Camera *SDL_OpenCamera(SDL_CameraID instance_id, const SDL_CameraSpec *spec) return NULL; } - SDL_AtomicSet(&device->shutdown, 0); + SDL_SetAtomicInt(&device->shutdown, 0); // These start with the backend's implementation, but we might swap them out with zombie versions later. device->WaitDevice = camera_driver.impl.WaitDevice; @@ -1360,12 +1360,12 @@ void SDL_QuitCamera(void) } SDL_LockRWLockForWriting(camera_driver.device_hash_lock); - SDL_AtomicSet(&camera_driver.shutting_down, 1); + SDL_SetAtomicInt(&camera_driver.shutting_down, 1); SDL_HashTable *device_hash = camera_driver.device_hash; camera_driver.device_hash = NULL; SDL_PendingCameraEvent *pending_events = camera_driver.pending_events.next; camera_driver.pending_events.next = NULL; - SDL_AtomicSet(&camera_driver.device_count, 0); + SDL_SetAtomicInt(&camera_driver.device_count, 0); SDL_UnlockRWLock(camera_driver.device_hash_lock); SDL_PendingCameraEvent *pending_next = NULL; @@ -1407,7 +1407,7 @@ static void NukeCameraHashItem(const void *key, const void *value, void *data) // no-op, keys and values in this hashtable are treated as Plain Old Data and don't get freed here. } -SDL_bool SDL_CameraInit(const char *driver_name) +bool SDL_CameraInit(const char *driver_name) { if (SDL_GetCurrentCameraDriver()) { SDL_QuitCamera(); // shutdown driver if already running. diff --git a/src/camera/SDL_camera_c.h b/src/camera/SDL_camera_c.h index 2ffe2c16..7436ab43 100644 --- a/src/camera/SDL_camera_c.h +++ b/src/camera/SDL_camera_c.h @@ -24,7 +24,7 @@ #define SDL_camera_c_h_ // Initialize the camera subsystem -extern SDL_bool SDL_CameraInit(const char *driver_name); +extern bool SDL_CameraInit(const char *driver_name); // Shutdown the camera subsystem extern void SDL_QuitCamera(void); diff --git a/src/camera/android/SDL_camera_android.c b/src/camera/android/SDL_camera_android.c index 640b2916..1838f9b4 100644 --- a/src/camera/android/SDL_camera_android.c +++ b/src/camera/android/SDL_camera_android.c @@ -194,7 +194,7 @@ static const char *MediaStatusStr(const media_status_t rc) { switch (rc) { case AMEDIA_OK: return "no error"; - case AMEDIACODEC_ERROR_INSUFFICIENT_RESOURCE: return "insuffient resources"; + case AMEDIACODEC_ERROR_INSUFFICIENT_RESOURCE: return "insufficient resources"; case AMEDIACODEC_ERROR_RECLAIMED: return "reclaimed"; case AMEDIA_ERROR_UNKNOWN: return "unknown error"; case AMEDIA_ERROR_MALFORMED: return "malformed"; @@ -516,7 +516,7 @@ static bool PrepareCamera(SDL_Camera *device) return true; } -static void SDLCALL CameraPermissionCallback(void *userdata, const char *permission, SDL_bool granted) +static void SDLCALL CameraPermissionCallback(void *userdata, const char *permission, bool granted) { SDL_Camera *device = (SDL_Camera *) userdata; if (device->hidden != NULL) { // if device was already closed, don't send an event. diff --git a/src/camera/mediafoundation/SDL_camera_mediafoundation.c b/src/camera/mediafoundation/SDL_camera_mediafoundation.c index d26fe6cb..1e794169 100644 --- a/src/camera/mediafoundation/SDL_camera_mediafoundation.c +++ b/src/camera/mediafoundation/SDL_camera_mediafoundation.c @@ -354,7 +354,7 @@ static bool MEDIAFOUNDATION_WaitDevice(SDL_Camera *device) IMFSourceReader *srcreader = device->hidden->srcreader; IMFSample *sample = NULL; - while (!SDL_AtomicGet(&device->shutdown)) { + while (!SDL_GetAtomicInt(&device->shutdown)) { DWORD stream_flags = 0; const HRESULT ret = IMFSourceReader_ReadSample(srcreader, (DWORD)MF_SOURCE_READER_FIRST_VIDEO_STREAM, 0, NULL, &stream_flags, NULL, &sample); if (FAILED(ret)) { diff --git a/src/camera/pipewire/SDL_camera_pipewire.c b/src/camera/pipewire/SDL_camera_pipewire.c index d1b37c47..c1c7a8e1 100644 --- a/src/camera/pipewire/SDL_camera_pipewire.c +++ b/src/camera/pipewire/SDL_camera_pipewire.c @@ -981,7 +981,7 @@ static bool hotplug_loop_init(void) hotplug.have_1_0_5 = PIPEWIRE_pw_check_library_version(1,0,5); - hotplug.loop = PIPEWIRE_pw_thread_loop_new("SDLAudioHotplug", NULL); + hotplug.loop = PIPEWIRE_pw_thread_loop_new("SDLPwCameraPlug", NULL); if (!hotplug.loop) { return SDL_SetError("Pipewire: Failed to create hotplug detection loop (%i)", errno); } diff --git a/src/camera/v4l2/SDL_camera_v4l2.c b/src/camera/v4l2/SDL_camera_v4l2.c index 819ea145..fbe0516a 100644 --- a/src/camera/v4l2/SDL_camera_v4l2.c +++ b/src/camera/v4l2/SDL_camera_v4l2.c @@ -107,10 +107,12 @@ static bool V4L2_WaitDevice(SDL_Camera *device) rc = select(fd + 1, &fds, NULL, NULL, &tv); if ((rc == -1) && (errno == EINTR)) { rc = 0; // pretend it was a timeout, keep looping. + } else if (rc > 0) { + return true; } // Thread is requested to shut down - if (SDL_AtomicGet(&device->shutdown)) { + if (SDL_GetAtomicInt(&device->shutdown)) { return true; } diff --git a/src/core/SDL_core_unsupported.c b/src/core/SDL_core_unsupported.c index daa2c40f..244a596a 100644 --- a/src/core/SDL_core_unsupported.c +++ b/src/core/SDL_core_unsupported.c @@ -31,16 +31,16 @@ void SDL_SetX11EventHook(SDL_X11EventHook callback, void *userdata) #ifndef SDL_PLATFORM_LINUX -SDL_DECLSPEC SDL_bool SDLCALL SDL_SetLinuxThreadPriority(Sint64 threadID, int priority); -SDL_bool SDL_SetLinuxThreadPriority(Sint64 threadID, int priority) +SDL_DECLSPEC bool SDLCALL SDL_SetLinuxThreadPriority(Sint64 threadID, int priority); +bool SDL_SetLinuxThreadPriority(Sint64 threadID, int priority) { (void)threadID; (void)priority; return SDL_Unsupported(); } -SDL_DECLSPEC SDL_bool SDLCALL SDL_SetLinuxThreadPriorityAndPolicy(Sint64 threadID, int sdlPriority, int schedPolicy); -SDL_bool SDL_SetLinuxThreadPriorityAndPolicy(Sint64 threadID, int sdlPriority, int schedPolicy) +SDL_DECLSPEC bool SDLCALL SDL_SetLinuxThreadPriorityAndPolicy(Sint64 threadID, int sdlPriority, int schedPolicy); +bool SDL_SetLinuxThreadPriorityAndPolicy(Sint64 threadID, int sdlPriority, int schedPolicy) { (void)threadID; (void)sdlPriority; @@ -58,8 +58,8 @@ void SDL_GDKSuspendComplete(void) SDL_Unsupported(); } -SDL_DECLSPEC SDL_bool SDLCALL SDL_GetGDKDefaultUser(void *outUserHandle); /* XUserHandle *outUserHandle */ -SDL_bool SDL_GetGDKDefaultUser(void *outUserHandle) +SDL_DECLSPEC bool SDLCALL SDL_GetGDKDefaultUser(void *outUserHandle); /* XUserHandle *outUserHandle */ +bool SDL_GetGDKDefaultUser(void *outUserHandle) { return SDL_Unsupported(); } @@ -76,10 +76,10 @@ void SDL_GDKResumeGPU(SDL_GPUDevice *device) #endif -#if !(defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINRT) || defined(SDL_PLATFORM_GDK)) +#if !defined(SDL_PLATFORM_WINDOWS) -SDL_DECLSPEC SDL_bool SDLCALL SDL_RegisterApp(const char *name, Uint32 style, void *hInst); -SDL_bool SDL_RegisterApp(const char *name, Uint32 style, void *hInst) +SDL_DECLSPEC bool SDLCALL SDL_RegisterApp(const char *name, Uint32 style, void *hInst); +bool SDL_RegisterApp(const char *name, Uint32 style, void *hInst) { (void)name; (void)style; @@ -103,25 +103,6 @@ void SDL_UnregisterApp(void) #endif -#ifndef SDL_PLATFORM_WINRT - -// Returns SDL_WinRT_DeviceFamily enum -SDL_DECLSPEC int SDLCALL SDL_GetWinRTDeviceFamily(void); -int SDL_GetWinRTDeviceFamily(void) -{ - SDL_Unsupported(); - return 0; // SDL_WINRT_DEVICEFAMILY_UNKNOWN -} - -SDL_DECLSPEC const char *SDLCALL SDL_GetWinRTFSPath(int pathType); // SDL_WinRT_Path pathType -const char *SDL_GetWinRTFSPath(int pathType) -{ - (void)pathType; - SDL_Unsupported(); - return NULL; -} -#endif - #ifndef SDL_PLATFORM_ANDROID SDL_DECLSPEC void SDLCALL SDL_SendAndroidBackButton(void); @@ -173,8 +154,8 @@ void *SDL_GetAndroidJNIEnv(void) } typedef void (SDLCALL *SDL_RequestAndroidPermissionCallback)(void *userdata, const char *permission, bool granted); -SDL_DECLSPEC SDL_bool SDLCALL SDL_RequestAndroidPermission(const char *permission, SDL_RequestAndroidPermissionCallback cb, void *userdata); -SDL_bool SDL_RequestAndroidPermission(const char *permission, SDL_RequestAndroidPermissionCallback cb, void *userdata) +SDL_DECLSPEC bool SDLCALL SDL_RequestAndroidPermission(const char *permission, SDL_RequestAndroidPermissionCallback cb, void *userdata); +bool SDL_RequestAndroidPermission(const char *permission, SDL_RequestAndroidPermissionCallback cb, void *userdata) { (void)permission; (void)cb; @@ -182,16 +163,16 @@ SDL_bool SDL_RequestAndroidPermission(const char *permission, SDL_RequestAndroid return SDL_Unsupported(); } -SDL_DECLSPEC SDL_bool SDLCALL SDL_SendAndroidMessage(Uint32 command, int param); -SDL_bool SDL_SendAndroidMessage(Uint32 command, int param) +SDL_DECLSPEC bool SDLCALL SDL_SendAndroidMessage(Uint32 command, int param); +bool SDL_SendAndroidMessage(Uint32 command, int param) { (void)command; (void)param; return SDL_Unsupported(); } -SDL_DECLSPEC SDL_bool SDLCALL SDL_ShowAndroidToast(const char* message, int duration, int gravity, int xoffset, int yoffset); -SDL_bool SDL_ShowAndroidToast(const char* message, int duration, int gravity, int xoffset, int yoffset) +SDL_DECLSPEC bool SDLCALL SDL_ShowAndroidToast(const char* message, int duration, int gravity, int xoffset, int yoffset); +bool SDL_ShowAndroidToast(const char* message, int duration, int gravity, int xoffset, int yoffset) { (void)message; (void)duration; @@ -207,22 +188,22 @@ int SDL_GetAndroidSDKVersion(void) return SDL_Unsupported(); } -SDL_DECLSPEC SDL_bool SDLCALL SDL_IsAndroidTV(void); -SDL_bool SDL_IsAndroidTV(void) +SDL_DECLSPEC bool SDLCALL SDL_IsAndroidTV(void); +bool SDL_IsAndroidTV(void) { SDL_Unsupported(); return false; } -SDL_DECLSPEC SDL_bool SDLCALL SDL_IsChromebook(void); -SDL_bool SDL_IsChromebook(void) +SDL_DECLSPEC bool SDLCALL SDL_IsChromebook(void); +bool SDL_IsChromebook(void) { SDL_Unsupported(); return false; } -SDL_DECLSPEC SDL_bool SDLCALL SDL_IsDeXMode(void); -SDL_bool SDL_IsDeXMode(void) +SDL_DECLSPEC bool SDLCALL SDL_IsDeXMode(void); +bool SDL_IsDeXMode(void) { SDL_Unsupported(); return false; diff --git a/src/core/android/SDL_android.c b/src/core/android/SDL_android.c index 67016052..6f9db679 100644 --- a/src/core/android/SDL_android.c +++ b/src/core/android/SDL_android.c @@ -558,7 +558,7 @@ JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved) register_methods(env, "org/libsdl/app/SDLAudioManager", SDLAudioManager_tab, SDL_arraysize(SDLAudioManager_tab)); register_methods(env, "org/libsdl/app/SDLControllerManager", SDLControllerManager_tab, SDL_arraysize(SDLControllerManager_tab)); register_methods(env, "org/libsdl/app/HIDDeviceManager", HIDDeviceManager_tab, SDL_arraysize(HIDDeviceManager_tab)); - SDL_AtomicSet(&bAllowRecreateActivity, false); + SDL_SetAtomicInt(&bAllowRecreateActivity, false); return JNI_VERSION_1_4; } @@ -761,16 +761,16 @@ JNIEXPORT int JNICALL SDL_JAVA_INTERFACE(nativeCheckSDLThreadCounter)( static void SDLCALL SDL_AllowRecreateActivityChanged(void *userdata, const char *name, const char *oldValue, const char *hint) { if (SDL_GetStringBoolean(hint, false)) { - SDL_AtomicSet(&bAllowRecreateActivity, true); + SDL_SetAtomicInt(&bAllowRecreateActivity, true); } else { - SDL_AtomicSet(&bAllowRecreateActivity, false); + SDL_SetAtomicInt(&bAllowRecreateActivity, false); } } JNIEXPORT jboolean JNICALL SDL_JAVA_INTERFACE(nativeAllowRecreateActivity)( JNIEnv *env, jclass jcls) { - return SDL_AtomicGet(&bAllowRecreateActivity); + return SDL_GetAtomicInt(&bAllowRecreateActivity); } JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeInitMainThread)( @@ -1524,7 +1524,8 @@ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeSetenv)( const char *utfname = (*env)->GetStringUTFChars(env, name, NULL); const char *utfvalue = (*env)->GetStringUTFChars(env, value, NULL); - SDL_setenv(utfname, utfvalue, 1); + // This is only called at startup, to initialize the environment + SDL_setenv_unsafe(utfname, utfvalue, 1); (*env)->ReleaseStringUTFChars(env, name, utfname); (*env)->ReleaseStringUTFChars(env, value, utfvalue); @@ -1689,7 +1690,7 @@ static bool Android_JNI_ExceptionOccurred(bool silent) jthrowable exception; // Detect mismatch LocalReferenceHolder_Init/Cleanup - SDL_assert(SDL_AtomicGet(&s_active) > 0); + SDL_assert(SDL_GetAtomicInt(&s_active) > 0); exception = (*env)->ExceptionOccurred(env); if (exception != NULL) { @@ -1828,7 +1829,7 @@ Sint64 Android_JNI_FileSeek(void *userdata, Sint64 offset, SDL_IOWhence whence) return (Sint64) AAsset_seek64((AAsset *)userdata, offset, (int)whence); } -SDL_bool Android_JNI_FileClose(void *userdata) +bool Android_JNI_FileClose(void *userdata) { AAsset_close((AAsset *)userdata); return true; @@ -2028,7 +2029,7 @@ void Android_JNI_HapticStop(int device_id) // See SDLActivity.java for constants. #define COMMAND_SET_KEEP_SCREEN_ON 5 -SDL_bool SDL_SendAndroidMessage(Uint32 command, int param) +bool SDL_SendAndroidMessage(Uint32 command, int param) { if (command < 0x8000) { return SDL_InvalidParamError("command"); @@ -2122,8 +2123,8 @@ bool Android_JNI_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *b } if (messageboxdata->colorScheme) { - colors = (*env)->NewIntArray(env, SDL_MESSAGEBOX_COLOR_MAX); - for (i = 0; i < SDL_MESSAGEBOX_COLOR_MAX; ++i) { + colors = (*env)->NewIntArray(env, SDL_MESSAGEBOX_COLOR_COUNT); + for (i = 0; i < SDL_MESSAGEBOX_COLOR_COUNT; ++i) { temp = (0xFFU << 24) | (messageboxdata->colorScheme->colors[i].r << 16) | (messageboxdata->colorScheme->colors[i].g << 8) | @@ -2210,19 +2211,19 @@ bool SDL_IsAndroidTablet(void) return (*env)->CallStaticBooleanMethod(env, mActivityClass, midIsTablet); } -SDL_bool SDL_IsAndroidTV(void) +bool SDL_IsAndroidTV(void) { JNIEnv *env = Android_JNI_GetEnv(); return (*env)->CallStaticBooleanMethod(env, mActivityClass, midIsAndroidTV); } -SDL_bool SDL_IsChromebook(void) +bool SDL_IsChromebook(void) { JNIEnv *env = Android_JNI_GetEnv(); return (*env)->CallStaticBooleanMethod(env, mActivityClass, midIsChromebook); } -SDL_bool SDL_IsDeXMode(void) +bool SDL_IsDeXMode(void) { JNIEnv *env = Android_JNI_GetEnv(); return (*env)->CallStaticBooleanMethod(env, mActivityClass, midIsDeXMode); @@ -2419,7 +2420,7 @@ const char *SDL_GetAndroidCachePath(void) return s_AndroidCachePath; } -SDL_bool SDL_ShowAndroidToast(const char *message, int duration, int gravity, int xOffset, int yOffset) +bool SDL_ShowAndroidToast(const char *message, int duration, int gravity, int xOffset, int yOffset) { return Android_JNI_ShowToast(message, duration, gravity, xOffset, yOffset); } @@ -2518,7 +2519,7 @@ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativePermissionResult)( SDL_UnlockMutex(Android_ActivityMutex); } -SDL_bool SDL_RequestAndroidPermission(const char *permission, SDL_RequestAndroidPermissionCallback cb, void *userdata) +bool SDL_RequestAndroidPermission(const char *permission, SDL_RequestAndroidPermissionCallback cb, void *userdata) { if (!permission) { return SDL_InvalidParamError("permission"); @@ -2538,7 +2539,7 @@ SDL_bool SDL_RequestAndroidPermission(const char *permission, SDL_RequestAndroid } static SDL_AtomicInt next_request_code; - info->request_code = SDL_AtomicAdd(&next_request_code, 1); + info->request_code = SDL_AddAtomicInt(&next_request_code, 1); info->callback = cb; info->userdata = userdata; @@ -2710,7 +2711,7 @@ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeFileDialog)( // Convert fileList to string size_t count = (*env)->GetArrayLength(env, fileList); - char **charFileList = SDL_calloc(sizeof(char*), count + 1); + char **charFileList = SDL_calloc(count + 1, sizeof(char*)); if (charFileList == NULL) { mAndroidFileDialogData.callback(mAndroidFileDialogData.userdata, NULL, -1); @@ -2797,7 +2798,7 @@ bool Android_JNI_OpenFileDialog( // Setup data static SDL_AtomicInt next_request_code; - mAndroidFileDialogData.request_code = SDL_AtomicAdd(&next_request_code, 1); + mAndroidFileDialogData.request_code = SDL_AddAtomicInt(&next_request_code, 1); mAndroidFileDialogData.userdata = userdata; mAndroidFileDialogData.callback = callback; @@ -2807,7 +2808,7 @@ bool Android_JNI_OpenFileDialog( (*env)->DeleteLocalRef(env, filtersArray); if (!success) { mAndroidFileDialogData.callback = NULL; - SDL_AtomicAdd(&next_request_code, -1); + SDL_AddAtomicInt(&next_request_code, -1); SDL_SetError("Unspecified error in JNI"); return false; diff --git a/src/core/android/SDL_android.h b/src/core/android/SDL_android.h index 3ca03c9b..4d810c99 100644 --- a/src/core/android/SDL_android.h +++ b/src/core/android/SDL_android.h @@ -85,7 +85,7 @@ Sint64 Android_JNI_FileSize(void *userdata); Sint64 Android_JNI_FileSeek(void *userdata, Sint64 offset, SDL_IOWhence whence); size_t Android_JNI_FileRead(void *userdata, void *buffer, size_t size, SDL_IOStatus *status); size_t Android_JNI_FileWrite(void *userdata, const void *buffer, size_t size, SDL_IOStatus *status); -SDL_bool Android_JNI_FileClose(void *userdata); +bool Android_JNI_FileClose(void *userdata); // Environment support void Android_JNI_GetManifestEnvironmentVariables(void); diff --git a/src/core/freebsd/SDL_evdev_kbd_freebsd.c b/src/core/freebsd/SDL_evdev_kbd_freebsd.c index a421d8b1..6f076b10 100644 --- a/src/core/freebsd/SDL_evdev_kbd_freebsd.c +++ b/src/core/freebsd/SDL_evdev_kbd_freebsd.c @@ -241,9 +241,9 @@ SDL_EVDEV_keyboard_state *SDL_EVDEV_kbd_init(void) kbd->shift_state = 0; - kbd->accents = SDL_calloc(sizeof(accentmap_t), 1); - kbd->key_map = SDL_calloc(sizeof(keymap_t), 1); - kbd->kbInfo = SDL_calloc(sizeof(keyboard_info_t), 1); + kbd->accents = SDL_calloc(1, sizeof(accentmap_t)); + kbd->key_map = SDL_calloc(1, sizeof(keymap_t)); + kbd->kbInfo = SDL_calloc(1, sizeof(keyboard_info_t)); ioctl(kbd->console_fd, KDGKBINFO, kbd->kbInfo); ioctl(kbd->console_fd, CONS_MOUSECTL, &mData); diff --git a/src/core/gdk/SDL_gdk.cpp b/src/core/gdk/SDL_gdk.cpp index 2cde67b6..efd56f31 100644 --- a/src/core/gdk/SDL_gdk.cpp +++ b/src/core/gdk/SDL_gdk.cpp @@ -35,7 +35,7 @@ PAPPCONSTRAIN_REGISTRATION hCPLM = {}; HANDLE plmSuspendComplete = nullptr; extern "C" -SDL_bool SDL_GetGDKTaskQueue(XTaskQueueHandle *outTaskQueue) +bool SDL_GetGDKTaskQueue(XTaskQueueHandle *outTaskQueue) { // If this is the first call, first create the global task queue. if (!GDK_GlobalTaskQueue) { @@ -139,7 +139,7 @@ void SDL_GDKSuspendComplete() } extern "C" -SDL_bool SDL_GetGDKDefaultUser(XUserHandle *outUserHandle) +bool SDL_GetGDKDefaultUser(XUserHandle *outUserHandle) { XAsyncBlock block = { 0 }; HRESULT result; diff --git a/src/core/haiku/SDL_BApp.h b/src/core/haiku/SDL_BApp.h index 8b927559..14b69055 100644 --- a/src/core/haiku/SDL_BApp.h +++ b/src/core/haiku/SDL_BApp.h @@ -264,15 +264,16 @@ class SDL_BLooper : public BLooper { SDL_Window *win; int32 winID; - int32 button, state; // left/middle/right, pressed/released + int32 button; + bool down; if ( !_GetWinID(msg, &winID) || msg->FindInt32("button-id", &button) != B_OK || - msg->FindInt32("button-state", &state) != B_OK) { + msg->FindBool("button-down", &down) != B_OK) { return; } win = GetSDLWindow(winID); - SDL_SendMouseButton(0, win, SDL_DEFAULT_MOUSE_ID, state, button); + SDL_SendMouseButton(0, win, SDL_DEFAULT_MOUSE_ID, button, down); } void _HandleMouseWheel(BMessage *msg) @@ -294,18 +295,19 @@ class SDL_BLooper : public BLooper { SDL_Window *win; int32 winID; - int32 scancode, state; // scancode, pressed/released + int32 scancode; + bool down; if ( !_GetWinID(msg, &winID) || - msg->FindInt32("key-state", &state) != B_OK || - msg->FindInt32("key-scancode", &scancode) != B_OK) { + msg->FindInt32("key-scancode", &scancode) != B_OK || + msg->FindBool("key-down", &down) != B_OK) { return; } - SDL_SendKeyboardKey(0, SDL_DEFAULT_KEYBOARD_ID, scancode, HAIKU_GetScancodeFromBeKey(scancode), state); + SDL_SendKeyboardKey(0, SDL_DEFAULT_KEYBOARD_ID, scancode, HAIKU_GetScancodeFromBeKey(scancode), down); win = GetSDLWindow(winID); - if (state == SDL_PRESSED && SDL_TextInputActive(win)) { + if (down && SDL_TextInputActive(win)) { const int8 *keyUtf8; ssize_t count; if (msg->FindData("key-utf8", B_INT8_TYPE, (const void **)&keyUtf8, &count) == B_OK) { diff --git a/src/core/linux/SDL_dbus.c b/src/core/linux/SDL_dbus.c index 01032334..b13d27bf 100644 --- a/src/core/linux/SDL_dbus.c +++ b/src/core/linux/SDL_dbus.c @@ -122,60 +122,61 @@ static bool LoadDBUSLibrary(void) return result; } -static SDL_SpinLock spinlock_dbus_init = 0; +static SDL_InitState dbus_init; -// you must hold spinlock_dbus_init before calling this! -static void SDL_DBus_Init_Spinlocked(void) +void SDL_DBus_Init(void) { static bool is_dbus_available = true; + if (!is_dbus_available) { return; // don't keep trying if this fails. } - if (!dbus.session_conn) { - DBusError err; - - if (!LoadDBUSLibrary()) { - is_dbus_available = false; // can't load at all? Don't keep trying. - return; - } - - if (!dbus.threads_init_default()) { - is_dbus_available = false; - return; - } - - dbus.error_init(&err); - // session bus is required - - dbus.session_conn = dbus.bus_get_private(DBUS_BUS_SESSION, &err); - if (dbus.error_is_set(&err)) { - dbus.error_free(&err); - SDL_DBus_Quit(); - is_dbus_available = false; - return; // oh well - } - dbus.connection_set_exit_on_disconnect(dbus.session_conn, 0); - - // system bus is optional - dbus.system_conn = dbus.bus_get_private(DBUS_BUS_SYSTEM, &err); - if (!dbus.error_is_set(&err)) { - dbus.connection_set_exit_on_disconnect(dbus.system_conn, 0); - } - - dbus.error_free(&err); + if (!SDL_ShouldInit(&dbus_init)) { + return; } -} -void SDL_DBus_Init(void) -{ - SDL_LockSpinlock(&spinlock_dbus_init); // make sure two threads can't init at same time, since this can happen before SDL_Init. - SDL_DBus_Init_Spinlocked(); - SDL_UnlockSpinlock(&spinlock_dbus_init); + if (!LoadDBUSLibrary()) { + goto error; + } + + if (!dbus.threads_init_default()) { + goto error; + } + + DBusError err; + dbus.error_init(&err); + // session bus is required + + dbus.session_conn = dbus.bus_get_private(DBUS_BUS_SESSION, &err); + if (dbus.error_is_set(&err)) { + dbus.error_free(&err); + goto error; + } + dbus.connection_set_exit_on_disconnect(dbus.session_conn, 0); + + // system bus is optional + dbus.system_conn = dbus.bus_get_private(DBUS_BUS_SYSTEM, &err); + if (!dbus.error_is_set(&err)) { + dbus.connection_set_exit_on_disconnect(dbus.system_conn, 0); + } + + dbus.error_free(&err); + SDL_SetInitialized(&dbus_init, true); + return; + +error: + is_dbus_available = false; + SDL_SetInitialized(&dbus_init, true); + SDL_DBus_Quit(); } void SDL_DBus_Quit(void) { + if (!SDL_ShouldQuit(&dbus_init)) { + return; + } + if (dbus.system_conn) { dbus.connection_close(dbus.system_conn); dbus.connection_unref(dbus.system_conn); @@ -193,8 +194,12 @@ void SDL_DBus_Quit(void) SDL_zero(dbus); UnloadDBUSLibrary(); - SDL_free(inhibit_handle); - inhibit_handle = NULL; + if (inhibit_handle) { + SDL_free(inhibit_handle); + inhibit_handle = NULL; + } + + SDL_SetInitialized(&dbus_init, false); } SDL_DBusContext *SDL_DBus_GetContext(void) diff --git a/src/core/linux/SDL_evdev.c b/src/core/linux/SDL_evdev.c index 758377d4..c5b62ae7 100644 --- a/src/core/linux/SDL_evdev.c +++ b/src/core/linux/SDL_evdev.c @@ -164,7 +164,7 @@ static void SDL_EVDEV_UpdateKeyboardMute(void) } } -SDL_bool SDL_EVDEV_Init(void) +bool SDL_EVDEV_Init(void) { if (!_this) { _this = (SDL_EVDEV_PrivateData *)SDL_calloc(1, sizeof(*_this)); @@ -347,18 +347,14 @@ void SDL_EVDEV_Poll(void) case EV_KEY: if (event->code >= BTN_MOUSE && event->code < BTN_MOUSE + SDL_arraysize(EVDEV_MouseButtons)) { mouse_button = event->code - BTN_MOUSE; - if (event->value == 0) { - SDL_SendMouseButton(SDL_EVDEV_GetEventTimestamp(event), mouse->focus, (SDL_MouseID)item->fd, SDL_RELEASED, EVDEV_MouseButtons[mouse_button]); - } else if (event->value == 1) { - SDL_SendMouseButton(SDL_EVDEV_GetEventTimestamp(event), mouse->focus, (SDL_MouseID)item->fd, SDL_PRESSED, EVDEV_MouseButtons[mouse_button]); - } + SDL_SendMouseButton(SDL_EVDEV_GetEventTimestamp(event), mouse->focus, (SDL_MouseID)item->fd, EVDEV_MouseButtons[mouse_button], (event->value != 0)); break; } /* BTN_TOUCH event value 1 indicates there is contact with - a touchscreen or trackpad (earlist finger's current + a touchscreen or trackpad (earliest finger's current position is sent in EV_ABS ABS_X/ABS_Y, switching to - next finger after earlist is released) */ + next finger after earliest is released) */ if (item->is_touchscreen && event->code == BTN_TOUCH) { if (item->touchscreen_data->max_slots == 1) { if (event->value) { @@ -373,9 +369,9 @@ void SDL_EVDEV_Poll(void) // Probably keyboard scancode = SDL_EVDEV_translate_keycode(event->code); if (event->value == 0) { - SDL_SendKeyboardKey(SDL_EVDEV_GetEventTimestamp(event), (SDL_KeyboardID)item->fd, event->code, scancode, SDL_RELEASED); + SDL_SendKeyboardKey(SDL_EVDEV_GetEventTimestamp(event), (SDL_KeyboardID)item->fd, event->code, scancode, false); } else if (event->value == 1 || event->value == 2 /* key repeated */) { - SDL_SendKeyboardKey(SDL_EVDEV_GetEventTimestamp(event), (SDL_KeyboardID)item->fd, event->code, scancode, SDL_PRESSED); + SDL_SendKeyboardKey(SDL_EVDEV_GetEventTimestamp(event), (SDL_KeyboardID)item->fd, event->code, scancode, true); } SDL_EVDEV_kbd_keycode(_this->kbd, event->code, event->value); break; diff --git a/src/core/linux/SDL_evdev.h b/src/core/linux/SDL_evdev.h index 3b4e3844..0eaa6006 100644 --- a/src/core/linux/SDL_evdev.h +++ b/src/core/linux/SDL_evdev.h @@ -28,7 +28,7 @@ struct input_event; -extern SDL_bool SDL_EVDEV_Init(void); +extern bool 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); diff --git a/src/core/linux/SDL_evdev_kbd.c b/src/core/linux/SDL_evdev_kbd.c index 5ab45aff..5ea7b555 100644 --- a/src/core/linux/SDL_evdev_kbd.c +++ b/src/core/linux/SDL_evdev_kbd.c @@ -313,12 +313,12 @@ typedef void (*signal_handler)(int signum); static void kbd_vt_release_signal_action(int signum) { - SDL_AtomicSet(&vt_signal_pending, VT_SIGNAL_RELEASE); + SDL_SetAtomicInt(&vt_signal_pending, VT_SIGNAL_RELEASE); } static void kbd_vt_acquire_signal_action(int signum) { - SDL_AtomicSet(&vt_signal_pending, VT_SIGNAL_ACQUIRE); + SDL_SetAtomicInt(&vt_signal_pending, VT_SIGNAL_ACQUIRE); } static bool setup_vt_signal(int signum, signal_handler handler) @@ -403,7 +403,7 @@ static bool kbd_vt_init(int console_fd) static void kbd_vt_update(SDL_EVDEV_keyboard_state *state) { - int signal_pending = SDL_AtomicGet(&vt_signal_pending); + int signal_pending = SDL_GetAtomicInt(&vt_signal_pending); if (signal_pending != VT_SIGNAL_NONE) { if (signal_pending == VT_SIGNAL_RELEASE) { if (state->vt_release_callback) { @@ -416,7 +416,7 @@ static void kbd_vt_update(SDL_EVDEV_keyboard_state *state) } ioctl(state->console_fd, VT_RELDISP, VT_ACKACQ); } - SDL_AtomicCompareAndSwap(&vt_signal_pending, signal_pending, VT_SIGNAL_NONE); + SDL_CompareAndSwapAtomicInt(&vt_signal_pending, signal_pending, VT_SIGNAL_NONE); } } diff --git a/src/core/linux/SDL_fcitx.c b/src/core/linux/SDL_fcitx.c index 1ab49e38..72451e03 100644 --- a/src/core/linux/SDL_fcitx.c +++ b/src/core/linux/SDL_fcitx.c @@ -379,11 +379,11 @@ void SDL_Fcitx_Reset(void) FcitxClientICCallMethod(&fcitx_client, "Reset"); } -bool SDL_Fcitx_ProcessKeyEvent(Uint32 keysym, Uint32 keycode, Uint8 state) +bool SDL_Fcitx_ProcessKeyEvent(Uint32 keysym, Uint32 keycode, bool down) { Uint32 mod_state = Fcitx_ModState(); Uint32 handled = false; - Uint32 is_release = (state == SDL_RELEASED); + Uint32 is_release = !down; Uint32 event_time = 0; if (!fcitx_client.ic_path) { diff --git a/src/core/linux/SDL_fcitx.h b/src/core/linux/SDL_fcitx.h index 5788baac..59dc9135 100644 --- a/src/core/linux/SDL_fcitx.h +++ b/src/core/linux/SDL_fcitx.h @@ -28,7 +28,7 @@ extern bool SDL_Fcitx_Init(void); extern void SDL_Fcitx_Quit(void); extern void SDL_Fcitx_SetFocus(bool focused); extern void SDL_Fcitx_Reset(void); -extern bool SDL_Fcitx_ProcessKeyEvent(Uint32 keysym, Uint32 keycode, Uint8 state); +extern bool SDL_Fcitx_ProcessKeyEvent(Uint32 keysym, Uint32 keycode, bool down); extern void SDL_Fcitx_UpdateTextInputArea(SDL_Window *window); extern void SDL_Fcitx_PumpEvents(void); diff --git a/src/core/linux/SDL_ibus.c b/src/core/linux/SDL_ibus.c index a6f0730a..dbbc3e17 100644 --- a/src/core/linux/SDL_ibus.c +++ b/src/core/linux/SDL_ibus.c @@ -660,7 +660,7 @@ void SDL_IBus_Reset(void) IBus_SimpleMessage("Reset"); } -bool SDL_IBus_ProcessKeyEvent(Uint32 keysym, Uint32 keycode, Uint8 state) +bool SDL_IBus_ProcessKeyEvent(Uint32 keysym, Uint32 keycode, bool down) { Uint32 result = 0; SDL_DBusContext *dbus = SDL_DBus_GetContext(); @@ -668,7 +668,7 @@ bool SDL_IBus_ProcessKeyEvent(Uint32 keysym, Uint32 keycode, Uint8 state) if (IBus_CheckConnection(dbus)) { Uint32 mods = IBus_ModState(); Uint32 ibus_keycode = keycode - 8; - if (state == SDL_RELEASED) { + if (!down) { mods |= (1 << 30); // IBUS_RELEASE_MASK } if (!SDL_DBus_CallMethodOnConnection(ibus_conn, ibus_service, input_ctx_path, ibus_input_interface, "ProcessKeyEvent", diff --git a/src/core/linux/SDL_ibus.h b/src/core/linux/SDL_ibus.h index 26349f97..ffd7e8e5 100644 --- a/src/core/linux/SDL_ibus.h +++ b/src/core/linux/SDL_ibus.h @@ -40,7 +40,7 @@ extern void SDL_IBus_Reset(void); /* Sends a keypress event to IBus, returns true if IBus used this event to update its candidate list or change input methods. PumpEvents should be called some time after this, to receive the TextInput / TextEditing event back. */ -extern bool SDL_IBus_ProcessKeyEvent(Uint32 keysym, Uint32 keycode, Uint8 state); +extern bool SDL_IBus_ProcessKeyEvent(Uint32 keysym, Uint32 keycode, bool down); /* Update the position of IBus' candidate list. If rect is NULL then this will just reposition it relative to the focused window's new position. */ diff --git a/src/core/linux/SDL_ime.c b/src/core/linux/SDL_ime.c index 2904f020..a853618b 100644 --- a/src/core/linux/SDL_ime.c +++ b/src/core/linux/SDL_ime.c @@ -28,7 +28,7 @@ typedef bool (*SDL_IME_Init_t)(void); typedef void (*SDL_IME_Quit_t)(void); typedef void (*SDL_IME_SetFocus_t)(bool); typedef void (*SDL_IME_Reset_t)(void); -typedef bool (*SDL_IME_ProcessKeyEvent_t)(Uint32, Uint32, Uint8 state); +typedef bool (*SDL_IME_ProcessKeyEvent_t)(Uint32, Uint32, bool down); typedef void (*SDL_IME_UpdateTextInputArea_t)(SDL_Window *window); typedef void (*SDL_IME_PumpEvents_t)(void); @@ -126,10 +126,10 @@ void SDL_IME_Reset(void) } } -bool SDL_IME_ProcessKeyEvent(Uint32 keysym, Uint32 keycode, Uint8 state) +bool SDL_IME_ProcessKeyEvent(Uint32 keysym, Uint32 keycode, bool down) { if (SDL_IME_ProcessKeyEvent_Real) { - return SDL_IME_ProcessKeyEvent_Real(keysym, keycode, state); + return SDL_IME_ProcessKeyEvent_Real(keysym, keycode, down); } return false; diff --git a/src/core/linux/SDL_ime.h b/src/core/linux/SDL_ime.h index 90767632..2b75cdd3 100644 --- a/src/core/linux/SDL_ime.h +++ b/src/core/linux/SDL_ime.h @@ -28,7 +28,7 @@ extern bool SDL_IME_Init(void); extern void SDL_IME_Quit(void); extern void SDL_IME_SetFocus(bool focused); extern void SDL_IME_Reset(void); -extern bool SDL_IME_ProcessKeyEvent(Uint32 keysym, Uint32 keycode, Uint8 state); +extern bool SDL_IME_ProcessKeyEvent(Uint32 keysym, Uint32 keycode, bool down); extern void SDL_IME_UpdateTextInputArea(SDL_Window *window); extern void SDL_IME_PumpEvents(void); diff --git a/src/core/linux/SDL_sandbox.c b/src/core/linux/SDL_sandbox.c index 413148fc..5a8df848 100644 --- a/src/core/linux/SDL_sandbox.c +++ b/src/core/linux/SDL_sandbox.c @@ -33,7 +33,9 @@ SDL_Sandbox SDL_DetectSandbox(void) /* For Snap, we check multiple variables because they might be set for * unrelated reasons. This is the same thing WebKitGTK does. */ - if (SDL_getenv("SNAP") != NULL && SDL_getenv("SNAP_NAME") != NULL && SDL_getenv("SNAP_REVISION") != NULL) { + if (SDL_getenv("SNAP") != NULL && + SDL_getenv("SNAP_NAME") != NULL && + SDL_getenv("SNAP_REVISION") != NULL) { return SDL_SANDBOX_SNAP; } diff --git a/src/core/linux/SDL_threadprio.c b/src/core/linux/SDL_threadprio.c index 0a63b3b0..fb5b27be 100644 --- a/src/core/linux/SDL_threadprio.c +++ b/src/core/linux/SDL_threadprio.c @@ -249,7 +249,7 @@ static bool rtkit_setpriority_realtime(pid_t thread, int rt_priority) #endif // threads // this is a public symbol, so it has to exist even if threads are disabled. -SDL_bool SDL_SetLinuxThreadPriority(Sint64 threadID, int priority) +bool SDL_SetLinuxThreadPriority(Sint64 threadID, int priority) { #ifdef SDL_THREADS_DISABLED return SDL_Unsupported(); @@ -281,7 +281,7 @@ SDL_bool SDL_SetLinuxThreadPriority(Sint64 threadID, int priority) } // this is a public symbol, so it has to exist even if threads are disabled. -SDL_bool SDL_SetLinuxThreadPriorityAndPolicy(Sint64 threadID, int sdlPriority, int schedPolicy) +bool SDL_SetLinuxThreadPriorityAndPolicy(Sint64 threadID, int sdlPriority, int schedPolicy) { #ifdef SDL_THREADS_DISABLED return SDL_Unsupported(); diff --git a/src/core/openbsd/SDL_wscons_kbd.c b/src/core/openbsd/SDL_wscons_kbd.c index b6d92430..281d2eca 100644 --- a/src/core/openbsd/SDL_wscons_kbd.c +++ b/src/core/openbsd/SDL_wscons_kbd.c @@ -435,7 +435,7 @@ static SDL_WSCONS_input_data *SDL_WSCONS_Init_Keyboard(const char *dev) input->keyboardID = SDL_GetNextObjectID(); SDL_AddKeyboard(input->keyboardID, NULL, false); - input->keymap.map = SDL_calloc(sizeof(struct wscons_keymap), KS_NUMKEYCODES); + input->keymap.map = SDL_calloc(KS_NUMKEYCODES, sizeof(struct wscons_keymap)); if (!input->keymap.map) { SDL_free(input); return NULL; @@ -560,22 +560,22 @@ static void Translate_to_keycode(SDL_WSCONS_input_data *input, int type, keysym_ switch (keyDesc.command) { case KS_Cmd_ScrollBack: { - SDL_SendKeyboardKey(0, input->keyboardID, 0, SDL_SCANCODE_PAGEUP, type == WSCONS_EVENT_KEY_DOWN ? SDL_PRESSED : SDL_RELEASED); + SDL_SendKeyboardKey(0, input->keyboardID, 0, SDL_SCANCODE_PAGEUP, (type == WSCONS_EVENT_KEY_DOWN)); return; } case KS_Cmd_ScrollFwd: { - SDL_SendKeyboardKey(0, input->keyboardID, 0, SDL_SCANCODE_PAGEDOWN, type == WSCONS_EVENT_KEY_DOWN ? SDL_PRESSED : SDL_RELEASED); + SDL_SendKeyboardKey(0, input->keyboardID, 0, SDL_SCANCODE_PAGEDOWN, (type == WSCONS_EVENT_KEY_DOWN)); return; } } for (i = 0; i < sizeof(conversion_table) / sizeof(struct wscons_keycode_to_SDL); i++) { if (conversion_table[i].sourcekey == group[0]) { - SDL_SendKeyboardKey(0, input->keyboardID, group[0], conversion_table[i].targetKey, type == WSCONS_EVENT_KEY_DOWN ? SDL_PRESSED : SDL_RELEASED); + SDL_SendKeyboardKey(0, input->keyboardID, group[0], conversion_table[i].targetKey, (type == WSCONS_EVENT_KEY_DOWN)); return; } } - SDL_SendKeyboardKey(0, input->keyboardID, group[0], SDL_SCANCODE_UNKNOWN, type == WSCONS_EVENT_KEY_DOWN ? SDL_PRESSED : SDL_RELEASED); + SDL_SendKeyboardKey(0, input->keyboardID, group[0], SDL_SCANCODE_UNKNOWN, (type == WSCONS_EVENT_KEY_DOWN)); } static void updateKeyboard(SDL_WSCONS_input_data *input) @@ -808,14 +808,14 @@ static void updateKeyboard(SDL_WSCONS_input_data *input) } } break; case WSCONS_EVENT_ALL_KEYS_UP: - for (i = 0; i < SDL_NUM_SCANCODES; i++) { - SDL_SendKeyboardKey(0, input->keyboardID, 0, (SDL_Scancode)i, SDL_RELEASED); + for (i = 0; i < SDL_SCANCODE_COUNT; i++) { + SDL_SendKeyboardKey(0, input->keyboardID, 0, (SDL_Scancode)i, false); } break; } if (input->type == WSKBD_TYPE_USB && events[i].value <= 0xE7) - SDL_SendKeyboardKey(0, input->keyboardID, 0, (SDL_Scancode)events[i].value, type == WSCONS_EVENT_KEY_DOWN ? SDL_PRESSED : SDL_RELEASED); + SDL_SendKeyboardKey(0, input->keyboardID, 0, (SDL_Scancode)events[i].value, (type == WSCONS_EVENT_KEY_DOWN)); else Translate_to_keycode(input, type, events[i].value); diff --git a/src/core/openbsd/SDL_wscons_mouse.c b/src/core/openbsd/SDL_wscons_mouse.c index 03b0f7de..5ba7a500 100644 --- a/src/core/openbsd/SDL_wscons_mouse.c +++ b/src/core/openbsd/SDL_wscons_mouse.c @@ -79,13 +79,13 @@ void updateMouse(SDL_WSCONS_mouse_input_data *input) { switch (events[i].value) { case 0: // Left Mouse Button. - SDL_SendMouseButton(0, mouse->focus, input->mouseID, SDL_PRESSED, SDL_BUTTON_LEFT); + SDL_SendMouseButton(0, mouse->focus, input->mouseID, SDL_BUTTON_LEFT, true); break; case 1: // Middle Mouse Button. - SDL_SendMouseButton(0, mouse->focus, input->mouseID, SDL_PRESSED, SDL_BUTTON_MIDDLE); + SDL_SendMouseButton(0, mouse->focus, input->mouseID, SDL_BUTTON_MIDDLE, true); break; case 2: // Right Mouse Button. - SDL_SendMouseButton(0, mouse->focus, input->mouseID, SDL_PRESSED, SDL_BUTTON_RIGHT); + SDL_SendMouseButton(0, mouse->focus, input->mouseID, SDL_BUTTON_RIGHT, true); break; } } break; @@ -93,13 +93,13 @@ void updateMouse(SDL_WSCONS_mouse_input_data *input) { switch (events[i].value) { case 0: // Left Mouse Button. - SDL_SendMouseButton(0, mouse->focus, input->mouseID, SDL_RELEASED, SDL_BUTTON_LEFT); + SDL_SendMouseButton(0, mouse->focus, input->mouseID, SDL_BUTTON_LEFT, false); break; case 1: // Middle Mouse Button. - SDL_SendMouseButton(0, mouse->focus, input->mouseID, SDL_RELEASED, SDL_BUTTON_MIDDLE); + SDL_SendMouseButton(0, mouse->focus, input->mouseID, SDL_BUTTON_MIDDLE, false); break; case 2: // Right Mouse Button. - SDL_SendMouseButton(0, mouse->focus, input->mouseID, SDL_RELEASED, SDL_BUTTON_RIGHT); + SDL_SendMouseButton(0, mouse->focus, input->mouseID, SDL_BUTTON_RIGHT, false); break; } } break; diff --git a/src/core/unix/SDL_appid.h b/src/core/unix/SDL_appid.h index 47660509..37c9e11f 100644 --- a/src/core/unix/SDL_appid.h +++ b/src/core/unix/SDL_appid.h @@ -24,7 +24,7 @@ freely, subject to the following restrictions: #ifndef SDL_appid_h_ #define SDL_appid_h_ -extern const char *SDL_GetExeName(); -extern const char *SDL_GetAppID(); +extern const char *SDL_GetExeName(void); +extern const char *SDL_GetAppID(void); #endif // SDL_appid_h_ diff --git a/src/core/windows/SDL_hid.c b/src/core/windows/SDL_hid.c index 2758b633..419cb727 100644 --- a/src/core/windows/SDL_hid.c +++ b/src/core/windows/SDL_hid.c @@ -20,8 +20,6 @@ */ #include "SDL_internal.h" -#ifndef SDL_PLATFORM_WINRT - #include "SDL_hid.h" HidD_GetString_t SDL_HidD_GetManufacturerString; @@ -82,9 +80,7 @@ void WIN_UnloadHIDDLL(void) } } -#endif // !SDL_PLATFORM_WINRT - -#if !defined(SDL_PLATFORM_WINRT) && !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) +#if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) // CM_Register_Notification definitions @@ -253,4 +249,4 @@ void WIN_QuitDeviceNotification(void) { } -#endif // !SDL_PLATFORM_WINRT && !SDL_PLATFORM_XBOXONE && !SDL_PLATFORM_XBOXSERIES +#endif // !SDL_PLATFORM_XBOXONE && !SDL_PLATFORM_XBOXSERIES diff --git a/src/core/windows/SDL_hid.h b/src/core/windows/SDL_hid.h index afa00717..50c5d38c 100644 --- a/src/core/windows/SDL_hid.h +++ b/src/core/windows/SDL_hid.h @@ -25,8 +25,6 @@ #include "SDL_windows.h" -#ifndef SDL_PLATFORM_WINRT - typedef LONG NTSTATUS; typedef USHORT USAGE; typedef struct _HIDP_PREPARSED_DATA *PHIDP_PREPARSED_DATA; @@ -208,9 +206,6 @@ extern HidP_GetValueCaps_t SDL_HidP_GetValueCaps; extern HidP_MaxDataListLength_t SDL_HidP_MaxDataListLength; extern HidP_GetData_t SDL_HidP_GetData; -#endif // !SDL_PLATFORM_WINRT - - void WIN_InitDeviceNotification(void); Uint64 WIN_GetLastDeviceNotification(void); void WIN_QuitDeviceNotification(void); diff --git a/src/core/windows/SDL_immdevice.c b/src/core/windows/SDL_immdevice.c index 54f12946..ddf55cda 100644 --- a/src/core/windows/SDL_immdevice.c +++ b/src/core/windows/SDL_immdevice.c @@ -20,7 +20,7 @@ */ #include "SDL_internal.h" -#if (defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK)) && defined(HAVE_MMDEVICEAPI_H) +#if defined(SDL_PLATFORM_WINDOWS) && defined(HAVE_MMDEVICEAPI_H) #include "SDL_windows.h" #include "SDL_immdevice.h" @@ -134,7 +134,7 @@ static SDL_AudioDevice *SDL_IMMDevice_Add(const bool recording, const char *devn // see if we already have this one first. SDL_AudioDevice *device = SDL_IMMDevice_FindByDevID(devid); if (device) { - if (SDL_AtomicGet(&device->zombie)) { + if (SDL_GetAtomicInt(&device->zombie)) { // whoa, it came back! This can happen if you unplug and replug USB headphones while we're still keeping the SDL object alive. // Kill this device's IMMDevice id; the device will go away when the app closes it, or maybe a new default device is chosen // (possibly this reconnected device), so we just want to make sure IMMDevice doesn't try to find the old device by the existing ID string. @@ -209,7 +209,7 @@ static ULONG STDMETHODCALLTYPE SDLMMNotificationClient_Release(IMMNotificationCl SDLMMNotificationClient *client = (SDLMMNotificationClient *)iclient; const ULONG rc = SDL_AtomicDecRef(&client->refcount); if (rc == 0) { - SDL_AtomicSet(&client->refcount, 0); // uhh... + SDL_SetAtomicInt(&client->refcount, 0); // uhh... return 0; } return rc - 1; @@ -431,4 +431,4 @@ void SDL_IMMDevice_EnumerateEndpoints(SDL_AudioDevice **default_playback, SDL_Au IMMDeviceEnumerator_RegisterEndpointNotificationCallback(enumerator, (IMMNotificationClient *)¬ification_client); } -#endif // (defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK)) && defined(HAVE_MMDEVICEAPI_H) +#endif // defined(SDL_PLATFORM_WINDOWS) && defined(HAVE_MMDEVICEAPI_H) diff --git a/src/core/windows/SDL_windows.c b/src/core/windows/SDL_windows.c index 393cefea..2bc52204 100644 --- a/src/core/windows/SDL_windows.c +++ b/src/core/windows/SDL_windows.c @@ -20,7 +20,7 @@ */ #include "SDL_internal.h" -#if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINRT) || defined(SDL_PLATFORM_GDK) +#if defined(SDL_PLATFORM_WINDOWS) #include "SDL_windows.h" @@ -90,14 +90,7 @@ WIN_CoInitialize(void) If you need multi-threaded mode, call CoInitializeEx() before SDL_Init() */ -#ifdef SDL_PLATFORM_WINRT - /* DLudwig: On WinRT, it is assumed that COM was initialized in main(). - CoInitializeEx is available (not CoInitialize though), however - on WinRT, main() is typically declared with the [MTAThread] - attribute, which, AFAIK, should initialize COM. - */ - return S_OK; -#elif defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES) +#if defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES) // On Xbox, there's no need to call CoInitializeEx (and it's not implemented) return S_OK; #else @@ -118,12 +111,9 @@ WIN_CoInitialize(void) void WIN_CoUninitialize(void) { -#ifndef SDL_PLATFORM_WINRT CoUninitialize(); -#endif } -#ifndef SDL_PLATFORM_WINRT FARPROC WIN_LoadComBaseFunction(const char *name) { static bool s_bLoaded; @@ -139,14 +129,10 @@ FARPROC WIN_LoadComBaseFunction(const char *name) return NULL; } } -#endif HRESULT WIN_RoInitialize(void) { -#ifdef SDL_PLATFORM_WINRT - return S_OK; -#else typedef HRESULT(WINAPI * RoInitialize_t)(RO_INIT_TYPE initType); RoInitialize_t RoInitializeFunc = (RoInitialize_t)WIN_LoadComBaseFunction("RoInitialize"); if (RoInitializeFunc) { @@ -166,21 +152,18 @@ WIN_RoInitialize(void) } else { return E_NOINTERFACE; } -#endif } void WIN_RoUninitialize(void) { -#ifndef SDL_PLATFORM_WINRT typedef void(WINAPI * RoUninitialize_t)(void); RoUninitialize_t RoUninitializeFunc = (RoUninitialize_t)WIN_LoadComBaseFunction("RoUninitialize"); if (RoUninitializeFunc) { RoUninitializeFunc(); } -#endif } -#if !defined(SDL_PLATFORM_WINRT) && !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) +#if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) static BOOL IsWindowsVersionOrGreater(WORD wMajorVersion, WORD wMinorVersion, WORD wServicePackMajor) { OSVERSIONINFOEXW osvi; @@ -202,7 +185,7 @@ static BOOL IsWindowsVersionOrGreater(WORD wMajorVersion, WORD wMinorVersion, WO #endif // apply some static variables so we only call into the Win32 API once per process for each check. -#if defined(SDL_PLATFORM_WINRT) || defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES) +#if defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES) #define CHECKWINVER(notdesktop_platform_result, test) return (notdesktop_platform_result); #else #define CHECKWINVER(notdesktop_platform_result, test) \ @@ -265,8 +248,8 @@ WASAPI doesn't need this. This is just for DirectSound/WinMM. */ char *WIN_LookupAudioDeviceName(const WCHAR *name, const GUID *guid) { -#if defined(SDL_PLATFORM_WINRT) || defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES) - return WIN_StringToUTF8W(name); // No registry access on WinRT/UWP and Xbox, go with what we've got. +#if defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES) + return WIN_StringToUTF8W(name); // No registry access on Xbox, go with what we've got. #else static const GUID nullguid = { 0 }; const unsigned char *ptr; @@ -318,7 +301,7 @@ char *WIN_LookupAudioDeviceName(const WCHAR *name, const GUID *guid) result = WIN_StringToUTF8(strw); SDL_free(strw); return result ? result : WIN_StringToUTF8(name); -#endif // if SDL_PLATFORM_WINRT / else +#endif } BOOL WIN_IsEqualGUID(const GUID *a, const GUID *b) @@ -349,7 +332,7 @@ void WIN_RectToRECT(const SDL_Rect *sdlrect, RECT *winrect) BOOL WIN_IsRectEmpty(const RECT *rect) { - // Calculating this manually because UWP and Xbox do not support Win32 IsRectEmpty. + // Calculating this manually because Xbox does not support Win32 IsRectEmpty. return (rect->right <= rect->left) || (rect->bottom <= rect->top); } @@ -389,4 +372,4 @@ int WIN_WideCharToMultiByte(UINT CodePage, DWORD dwFlags, LPCWCH lpWideCharStr, return WideCharToMultiByte(CodePage, dwFlags, lpWideCharStr, cchWideChar, lpMultiByteStr, cbMultiByte, lpDefaultChar, lpUsedDefaultChar); } -#endif // defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINRT) || defined(SDL_PLATFORM_GDK) +#endif // defined(SDL_PLATFORM_WINDOWS) diff --git a/src/core/windows/SDL_windows.h b/src/core/windows/SDL_windows.h index f83e2140..854c072c 100644 --- a/src/core/windows/SDL_windows.h +++ b/src/core/windows/SDL_windows.h @@ -36,7 +36,7 @@ #endif #undef WINVER #undef _WIN32_WINNT -#if SDL_VIDEO_RENDER_D3D12 || defined(HAVE_DXGI1_6_H) +#if defined(SDL_VIDEO_RENDER_D3D12) || defined(HAVE_DXGI1_6_H) #define _WIN32_WINNT 0xA00 // For D3D12, 0xA00 is required #elif defined(HAVE_SHELLSCALINGAPI_H) #define _WIN32_WINNT 0x603 // For DPI support @@ -122,10 +122,8 @@ extern bool WIN_SetErrorFromHRESULT(const char *prefix, HRESULT hr); // Sets an error message based on GetLastError(). Always return -1. extern bool WIN_SetError(const char *prefix); -#ifndef SDL_PLATFORM_WINRT // Load a function from combase.dll FARPROC WIN_LoadComBaseFunction(const char *name); -#endif // Wrap up the oddities of CoInitialize() into a common function. extern HRESULT WIN_CoInitialize(void); @@ -163,7 +161,7 @@ extern BOOL WIN_IsRectEmpty(const RECT *rect); extern SDL_AudioFormat SDL_WaveFormatExToSDLFormat(WAVEFORMATEX *waveformat); -// WideCharToMultiByte, but with some WinXP manangement. +// WideCharToMultiByte, but with some WinXP management. extern int WIN_WideCharToMultiByte(UINT CodePage, DWORD dwFlags, LPCWCH lpWideCharStr, int cchWideChar, LPSTR lpMultiByteStr, int cbMultiByte, LPCCH lpDefaultChar, LPBOOL lpUsedDefaultChar); // Ends C function definitions when using C++ diff --git a/src/core/windows/SDL_xinput.c b/src/core/windows/SDL_xinput.c index 32d4722e..76b5bd2c 100644 --- a/src/core/windows/SDL_xinput.c +++ b/src/core/windows/SDL_xinput.c @@ -37,21 +37,17 @@ DWORD SDL_XInputVersion = 0; static HMODULE s_pXInputDLL = NULL; static int s_XInputDLLRefCount = 0; -#if defined(SDL_PLATFORM_WINRT) || defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES) +#if defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES) bool WIN_LoadXInputDLL(void) { /* Getting handles to system dlls (via LoadLibrary and its variants) is not - * supported on WinRT, thus, pointers to XInput's functions can't be + * supported on Xbox, thus, pointers to XInput's functions can't be * retrieved via GetProcAddress. * - * When on WinRT, assume that XInput is already loaded, and directly map + * When on Xbox, assume that XInput is already loaded, and directly map * its XInput.h-declared functions to the SDL_XInput* set of function * pointers. - * - * Side-note: XInputGetStateEx is not available for use in WinRT. - * This seems to mean that support for the guide button is not available - * in WinRT, unfortunately. */ SDL_XInputGetState = (XInputGetState_t)XInputGetState; SDL_XInputSetState = (XInputSetState_t)XInputSetState; @@ -68,7 +64,7 @@ void WIN_UnloadXInputDLL(void) { } -#else // !(defined(SDL_PLATFORM_WINRT) || defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES)) +#else // !(defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES)) bool WIN_LoadXInputDLL(void) { @@ -136,7 +132,7 @@ void WIN_UnloadXInputDLL(void) } } -#endif // SDL_PLATFORM_WINRT +#endif // Ends C function definitions when using C++ #ifdef __cplusplus diff --git a/src/core/winrt/SDL_winrtapp_common.cpp b/src/core/winrt/SDL_winrtapp_common.cpp deleted file mode 100644 index be3558de..00000000 --- a/src/core/winrt/SDL_winrtapp_common.cpp +++ /dev/null @@ -1,43 +0,0 @@ -/* - 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 - -int (*WINRT_SDLAppEntryPoint)(int, char **) = NULL; - -extern "C" -SDL_WinRT_DeviceFamily SDL_GetWinRTDeviceFamily() -{ -#if NTDDI_VERSION >= NTDDI_WIN10 // !!! FIXME: I have no idea if this is the right test. This is a UWP API, I think. Older windows should...just return "mobile"? I don't know. --ryan. - Platform::String ^ deviceFamily = Windows::System::Profile::AnalyticsInfo::VersionInfo->DeviceFamily; - - if (deviceFamily->Equals("Windows.Desktop")) { - return SDL_WINRT_DEVICEFAMILY_DESKTOP; - } else if (deviceFamily->Equals("Windows.Mobile")) { - return SDL_WINRT_DEVICEFAMILY_MOBILE; - } else if (deviceFamily->Equals("Windows.Xbox")) { - return SDL_WINRT_DEVICEFAMILY_XBOX; - } -#endif - - return SDL_WINRT_DEVICEFAMILY_UNKNOWN; -} diff --git a/src/core/winrt/SDL_winrtapp_common.h b/src/core/winrt/SDL_winrtapp_common.h deleted file mode 100644 index 83cfd776..00000000 --- a/src/core/winrt/SDL_winrtapp_common.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - 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" - -#ifndef SDL_winrtapp_common_h_ -#define SDL_winrtapp_common_h_ - -/* A pointer to the app's C-style main() function (which is a different - function than the WinRT app's actual entry point). - */ -extern int (*WINRT_SDLAppEntryPoint)(int, char **); - -#endif // SDL_winrtapp_common_h_ diff --git a/src/core/winrt/SDL_winrtapp_direct3d.cpp b/src/core/winrt/SDL_winrtapp_direct3d.cpp deleted file mode 100644 index 30172255..00000000 --- a/src/core/winrt/SDL_winrtapp_direct3d.cpp +++ /dev/null @@ -1,758 +0,0 @@ -/* - 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" - -// Windows includes -#include "ppltasks.h" -using namespace concurrency; -using namespace Windows::ApplicationModel; -using namespace Windows::ApplicationModel::Core; -using namespace Windows::ApplicationModel::Activation; -using namespace Windows::Devices::Input; -using namespace Windows::Graphics::Display; -using namespace Windows::Foundation; -using namespace Windows::System; -using namespace Windows::UI::Core; -using namespace Windows::UI::Input; - -#if SDL_WINAPI_FAMILY_PHONE -using namespace Windows::Phone::UI::Input; -#endif - -// SDL includes -extern "C" { -#include "../../video/SDL_sysvideo.h" -#include "../../events/SDL_events_c.h" -#include "../../events/SDL_keyboard_c.h" -#include "../../events/SDL_mouse_c.h" -#include "../../events/SDL_windowevents_c.h" -#include "../../render/SDL_sysrender.h" -#include "../windows/SDL_windows.h" -} - -#include "../../video/winrt/SDL_winrtevents_c.h" -#include "../../video/winrt/SDL_winrtvideo_cpp.h" -#include "SDL_winrtapp_common.h" -#include "SDL_winrtapp_direct3d.h" - -#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. - */ -extern "C" void D3D11_Trim(SDL_Renderer *); -#endif - -// Compile-time debugging options: -// To enable, uncomment; to disable, comment them out. -// #define LOG_POINTER_EVENTS 1 -// #define LOG_WINDOW_EVENTS 1 -// #define LOG_ORIENTATION_EVENTS 1 - -// HACK, DLudwig: record a reference to the global, WinRT 'app'/view. -// SDL/WinRT will use this throughout its code. -// -// TODO, WinRT: consider replacing SDL_WinRTGlobalApp with something -// non-global, such as something created inside -// SDL_InitSubSystem(SDL_INIT_VIDEO), or something inside -// SDL_CreateWindow(). -SDL_WinRTApp ^ SDL_WinRTGlobalApp = nullptr; - -ref class SDLApplicationSource sealed : Windows::ApplicationModel::Core::IFrameworkViewSource -{ - public: - virtual Windows::ApplicationModel::Core::IFrameworkView ^ CreateView(); -}; - -IFrameworkView ^ SDLApplicationSource::CreateView() -{ - // TODO, WinRT: see if this function (CreateView) can ever get called - // more than once. For now, just prevent it from ever assigning - // SDL_WinRTGlobalApp more than once. - SDL_assert(!SDL_WinRTGlobalApp); - SDL_WinRTApp ^ app = ref new SDL_WinRTApp(); - if (!SDL_WinRTGlobalApp) { - SDL_WinRTGlobalApp = app; - } - return app; -} - -bool SDL_WinRTInitNonXAMLApp(int (*mainFunction)(int, char **)) -{ - WINRT_SDLAppEntryPoint = mainFunction; - auto direct3DApplicationSource = ref new SDLApplicationSource(); - CoreApplication::Run(direct3DApplicationSource); - return true; -} - -static void WINRT_ProcessWindowSizeChange() // TODO: Pass an SDL_Window-identifying thing into WINRT_ProcessWindowSizeChange() -{ - CoreWindow ^ coreWindow = CoreWindow::GetForCurrentThread(); - if (coreWindow) { - if (WINRT_GlobalSDLWindow) { - SDL_Window *window = WINRT_GlobalSDLWindow; - SDL_WindowData *data = window->internal; - - int x = (int)SDL_lroundf(data->coreWindow->Bounds.Left); - int y = (int)SDL_lroundf(data->coreWindow->Bounds.Top); - int w = (int)SDL_floorf(data->coreWindow->Bounds.Width); - int h = (int)SDL_floorf(data->coreWindow->Bounds.Height); - -#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 - orientation. - - Attempt to emulate WinPhone 8.1's behavior on WinPhone 8.0, with - regards to window size. This fixes a rendering bug that occurs - when a WinPhone 8.0 app is rotated to either 90 or 270 degrees. - */ - const DisplayOrientations currentOrientation = WINRT_DISPLAY_PROPERTY(CurrentOrientation); - switch (currentOrientation) { - case DisplayOrientations::Landscape: - case DisplayOrientations::LandscapeFlipped: - { - int tmp = w; - w = h; - h = tmp; - } break; - } -#endif - - const SDL_WindowFlags latestFlags = WINRT_DetectWindowFlags(window); - if (latestFlags & SDL_WINDOW_MAXIMIZED) { - SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_MAXIMIZED, 0, 0); - } else { - SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_RESTORED, 0, 0); - } - - WINRT_UpdateWindowFlags(window, SDL_WINDOW_FULLSCREEN); - - /* The window can move during a resize event, such as when maximizing - or resizing from a corner */ - SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_MOVED, x, y); - SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_RESIZED, w, h); - } - } -} - -SDL_WinRTApp::SDL_WinRTApp() : m_windowClosed(false), - m_windowVisible(true) -{ -} - -void SDL_WinRTApp::Initialize(CoreApplicationView ^ applicationView) -{ - applicationView->Activated += - ref new TypedEventHandler(this, &SDL_WinRTApp::OnAppActivated); - - CoreApplication::Suspending += - ref new EventHandler(this, &SDL_WinRTApp::OnSuspending); - - CoreApplication::Resuming += - ref new EventHandler(this, &SDL_WinRTApp::OnResuming); - - CoreApplication::Exiting += - ref new EventHandler(this, &SDL_WinRTApp::OnExiting); - -#if NTDDI_VERSION >= NTDDI_WIN10 - /* HACK ALERT! Xbox One doesn't seem to detect gamepads unless something - gets registered to receive Win10's Windows.Gaming.Input.Gamepad.GamepadAdded - events. We'll register an event handler for these events here, to make - sure that gamepad detection works later on, if requested. - */ - Windows::Gaming::Input::Gamepad::GamepadAdded += - ref new Windows::Foundation::EventHandler( - this, &SDL_WinRTApp::OnGamepadAdded); -#endif -} - -#if NTDDI_VERSION > NTDDI_WIN8 -void SDL_WinRTApp::OnOrientationChanged(DisplayInformation ^ sender, Object ^ args) -#else -void SDL_WinRTApp::OnOrientationChanged(Object ^ sender) -#endif -{ -#if LOG_ORIENTATION_EVENTS == 1 - { - CoreWindow ^ window = CoreWindow::GetForCurrentThread(); - if (window) { - SDL_Log("%s, current orientation=%d, native orientation=%d, auto rot. pref=%d, CoreWindow Bounds={%f,%f,%f,%f}\n", - __FUNCTION__, - WINRT_DISPLAY_PROPERTY(CurrentOrientation), - WINRT_DISPLAY_PROPERTY(NativeOrientation), - WINRT_DISPLAY_PROPERTY(AutoRotationPreferences), - window->Bounds.X, - window->Bounds.Y, - window->Bounds.Width, - window->Bounds.Height); - } else { - SDL_Log("%s, current orientation=%d, native orientation=%d, auto rot. pref=%d\n", - __FUNCTION__, - WINRT_DISPLAY_PROPERTY(CurrentOrientation), - WINRT_DISPLAY_PROPERTY(NativeOrientation), - WINRT_DISPLAY_PROPERTY(AutoRotationPreferences)); - } - } -#endif - - WINRT_ProcessWindowSizeChange(); - -#if SDL_WINAPI_FAMILY_PHONE - // HACK: Make sure that orientation changes - // lead to the Direct3D renderer's viewport getting updated: - // - // For some reason, this doesn't seem to need to be done on Windows 8.x, - // even when going from Landscape to LandscapeFlipped. It only seems to - // be needed on Windows Phone, at least when I tested on my devices. - // I'm not currently sure why this is, but it seems to work fine. -- David L. - // - // TODO, WinRT: do more extensive research into why orientation changes on Win 8.x don't need D3D changes, or if they might, in some cases - SDL_Window *window = WINRT_GlobalSDLWindow; - if (window) { - SDL_WindowData *data = window->internal; - int w = (int)SDL_floorf(data->coreWindow->Bounds.Width); - int h = (int)SDL_floorf(data->coreWindow->Bounds.Height); - SDL_SendWindowEvent(WINRT_GlobalSDLWindow, SDL_EVENT_WINDOW_RESIZED, w, h); - } -#endif -} - -void SDL_WinRTApp::SetWindow(CoreWindow ^ window) -{ -#if LOG_WINDOW_EVENTS == 1 - SDL_Log("%s, current orientation=%d, native orientation=%d, auto rot. pref=%d, window bounds={%f, %f, %f,%f}\n", - __FUNCTION__, - WINRT_DISPLAY_PROPERTY(CurrentOrientation), - WINRT_DISPLAY_PROPERTY(NativeOrientation), - WINRT_DISPLAY_PROPERTY(AutoRotationPreferences), - window->Bounds.X, - window->Bounds.Y, - window->Bounds.Width, - window->Bounds.Height); -#endif - - window->SizeChanged += - ref new TypedEventHandler(this, &SDL_WinRTApp::OnWindowSizeChanged); - - window->VisibilityChanged += - ref new TypedEventHandler(this, &SDL_WinRTApp::OnVisibilityChanged); - - window->Activated += - ref new TypedEventHandler(this, &SDL_WinRTApp::OnWindowActivated); - - window->Closed += - ref new TypedEventHandler(this, &SDL_WinRTApp::OnWindowClosed); - -#if !SDL_WINAPI_FAMILY_PHONE - window->PointerCursor = ref new CoreCursor(CoreCursorType::Arrow, 0); -#endif - - window->PointerPressed += - ref new TypedEventHandler(this, &SDL_WinRTApp::OnPointerPressed); - - window->PointerMoved += - ref new TypedEventHandler(this, &SDL_WinRTApp::OnPointerMoved); - - window->PointerReleased += - ref new TypedEventHandler(this, &SDL_WinRTApp::OnPointerReleased); - - window->PointerEntered += - ref new TypedEventHandler(this, &SDL_WinRTApp::OnPointerEntered); - - window->PointerExited += - ref new TypedEventHandler(this, &SDL_WinRTApp::OnPointerExited); - - window->PointerWheelChanged += - ref new TypedEventHandler(this, &SDL_WinRTApp::OnPointerWheelChanged); - -#if !SDL_WINAPI_FAMILY_PHONE - // Retrieves relative-only mouse movements: - Windows::Devices::Input::MouseDevice::GetForCurrentView()->MouseMoved += - ref new TypedEventHandler(this, &SDL_WinRTApp::OnMouseMoved); -#endif - - window->Dispatcher->AcceleratorKeyActivated += - ref new TypedEventHandler(this, &SDL_WinRTApp::OnAcceleratorKeyActivated); - - window->CharacterReceived += - ref new TypedEventHandler(this, &SDL_WinRTApp::OnCharacterReceived); - -#if NTDDI_VERSION >= NTDDI_WIN10 - Windows::UI::Core::SystemNavigationManager::GetForCurrentView()->BackRequested += - ref new EventHandler(this, &SDL_WinRTApp::OnBackButtonPressed); -#elif SDL_WINAPI_FAMILY_PHONE - HardwareButtons::BackPressed += - ref new EventHandler(this, &SDL_WinRTApp::OnBackButtonPressed); -#endif - -#if NTDDI_VERSION > NTDDI_WIN8 - DisplayInformation::GetForCurrentView()->OrientationChanged += - ref new TypedEventHandler(this, &SDL_WinRTApp::OnOrientationChanged); -#else - DisplayProperties::OrientationChanged += - ref new DisplayPropertiesEventHandler(this, &SDL_WinRTApp::OnOrientationChanged); -#endif - -#if (WINAPI_FAMILY == WINAPI_FAMILY_APP) && (NTDDI_VERSION < NTDDI_WIN10) // for Windows 8/8.1/RT apps... (and not Phone apps) - // Make sure we know when a user has opened the app's settings pane. - // This is needed in order to display a privacy policy, which needs - // to be done for network-enabled apps, as per Windows Store requirements. - using namespace Windows::UI::ApplicationSettings; - SettingsPane::GetForCurrentView()->CommandsRequested += - ref new TypedEventHandler(this, &SDL_WinRTApp::OnSettingsPaneCommandsRequested); -#endif -} - -void SDL_WinRTApp::Load(Platform::String ^ entryPoint) -{ -} - -void SDL_WinRTApp::Run() -{ - SDL_SetMainReady(); - if (WINRT_SDLAppEntryPoint) { - // TODO, WinRT: pass the C-style main() a reasonably realistic - // representation of command line arguments. - int argc = 1; - char **argv = (char **)SDL_malloc(2 * sizeof(*argv)); - if (!argv) { - return; - } - argv[0] = SDL_strdup("WinRTApp"); - argv[1] = NULL; - WINRT_SDLAppEntryPoint(argc, argv); - SDL_free(argv[0]); - SDL_free(argv); - } -} - -static bool IsSDLWindowEventPending(SDL_EventType windowEventID) -{ - SDL_Event events[128]; - const int count = SDL_PeepEvents(events, sizeof(events) / sizeof(SDL_Event), SDL_PEEKEVENT, windowEventID, windowEventID); - return (count > 0); -} - -bool SDL_WinRTApp::ShouldWaitForAppResumeEvents() -{ - // Don't wait if the app is visible: - if (m_windowVisible) { - return false; - } - - /* Don't wait until the window-hide events finish processing. - * Do note that if an app-suspend event is sent (as indicated - * by SDL_EVENT_WILL_ENTER_BACKGROUND and SDL_EVENT_DID_ENTER_BACKGROUND - * events), then this code may be a moot point, as WinRT's - * own event pump (aka ProcessEvents()) will pause regardless - * of what we do here. This happens on Windows Phone 8, to note. - * Windows 8.x apps, on the other hand, may get a chance to run - * these. - */ - if (IsSDLWindowEventPending(SDL_EVENT_WINDOW_HIDDEN)) { - return false; - } else if (IsSDLWindowEventPending(SDL_EVENT_WINDOW_FOCUS_LOST)) { - return false; - } else if (IsSDLWindowEventPending(SDL_EVENT_WINDOW_MINIMIZED)) { - return false; - } - - return true; -} - -void SDL_WinRTApp::PumpEvents() -{ - if (!m_windowClosed) { - if (!ShouldWaitForAppResumeEvents()) { - /* This is the normal way in which events should be pumped. - * 'ProcessAllIfPresent' will make ProcessEvents() process anywhere - * from zero to N events, and will then return. - */ - CoreWindow::GetForCurrentThread()->Dispatcher->ProcessEvents(CoreProcessEventsOption::ProcessAllIfPresent); - } else { - /* This style of event-pumping, with 'ProcessOneAndAllPending', - * will cause anywhere from one to N events to be processed. If - * at least one event is processed, the call will return. If - * no events are pending, then the call will wait until one is - * available, and will not return (to the caller) until this - * happens! This should only occur when the app is hidden. - */ - CoreWindow::GetForCurrentThread()->Dispatcher->ProcessEvents(CoreProcessEventsOption::ProcessOneAndAllPending); - } - } -} - -void SDL_WinRTApp::Uninitialize() -{ -} - -#if (WINAPI_FAMILY == WINAPI_FAMILY_APP) && (NTDDI_VERSION < NTDDI_WIN10) -void SDL_WinRTApp::OnSettingsPaneCommandsRequested( - Windows::UI::ApplicationSettings::SettingsPane ^ p, - Windows::UI::ApplicationSettings::SettingsPaneCommandsRequestedEventArgs ^ args) -{ - using namespace Platform; - using namespace Windows::UI::ApplicationSettings; - using namespace Windows::UI::Popups; - - String ^ privacyPolicyURL = nullptr; // a URL to an app's Privacy Policy - String ^ privacyPolicyLabel = nullptr; // label/link text - const char *tmpHintValue = NULL; // SDL_GetHint-retrieved value, used immediately - wchar_t *tmpStr = NULL; // used for UTF8 to UCS2 conversion - - // Setup a 'Privacy Policy' link, if one is available (via SDL_GetHint): - tmpHintValue = SDL_GetHint(SDL_HINT_WINRT_PRIVACY_POLICY_URL); - if (tmpHintValue && tmpHintValue[0] != '\0') { - // Convert the privacy policy's URL to UCS2: - tmpStr = WIN_UTF8ToString(tmpHintValue); - privacyPolicyURL = ref new String(tmpStr); - SDL_free(tmpStr); - - // Optionally retrieve custom label-text for the link. If this isn't - // available, a default value will be used instead. - tmpHintValue = SDL_GetHint(SDL_HINT_WINRT_PRIVACY_POLICY_LABEL); - if (tmpHintValue && tmpHintValue[0] != '\0') { - tmpStr = WIN_UTF8ToString(tmpHintValue); - privacyPolicyLabel = ref new String(tmpStr); - SDL_free(tmpStr); - } else { - privacyPolicyLabel = ref new String(L"Privacy Policy"); - } - - // Register the link, along with a handler to be called if and when it is - // clicked: - auto cmd = ref new SettingsCommand(L"privacyPolicy", privacyPolicyLabel, - ref new UICommandInvokedHandler([=](IUICommand ^) { - Windows::System::Launcher::LaunchUriAsync(ref new Uri(privacyPolicyURL)); - })); - args->Request->ApplicationCommands->Append(cmd); - } -} -#endif // if (WINAPI_FAMILY == WINAPI_FAMILY_APP) && (NTDDI_VERSION < NTDDI_WIN10) - -void SDL_WinRTApp::OnWindowSizeChanged(CoreWindow ^ sender, WindowSizeChangedEventArgs ^ args) -{ -#if LOG_WINDOW_EVENTS == 1 - SDL_Log("%s, size={%f,%f}, bounds={%f,%f,%f,%f}, current orientation=%d, native orientation=%d, auto rot. pref=%d, WINRT_GlobalSDLWindow?=%s\n", - __FUNCTION__, - args->Size.Width, args->Size.Height, - sender->Bounds.X, sender->Bounds.Y, sender->Bounds.Width, sender->Bounds.Height, - WINRT_DISPLAY_PROPERTY(CurrentOrientation), - WINRT_DISPLAY_PROPERTY(NativeOrientation), - WINRT_DISPLAY_PROPERTY(AutoRotationPreferences), - (WINRT_GlobalSDLWindow ? "yes" : "no")); -#endif - - WINRT_ProcessWindowSizeChange(); -} - -void SDL_WinRTApp::OnVisibilityChanged(CoreWindow ^ sender, VisibilityChangedEventArgs ^ args) -{ -#if LOG_WINDOW_EVENTS == 1 - SDL_Log("%s, visible?=%s, bounds={%f,%f,%f,%f}, WINRT_GlobalSDLWindow?=%s\n", - __FUNCTION__, - (args->Visible ? "yes" : "no"), - sender->Bounds.X, sender->Bounds.Y, - sender->Bounds.Width, sender->Bounds.Height, - (WINRT_GlobalSDLWindow ? "yes" : "no")); -#endif - - m_windowVisible = args->Visible; - if (WINRT_GlobalSDLWindow) { - bool wasSDLWindowSurfaceValid = WINRT_GlobalSDLWindow->surface_valid; - SDL_WindowFlags latestWindowFlags = WINRT_DetectWindowFlags(WINRT_GlobalSDLWindow); - if (args->Visible) { - SDL_SendWindowEvent(WINRT_GlobalSDLWindow, SDL_EVENT_WINDOW_SHOWN, 0, 0); - SDL_SendWindowEvent(WINRT_GlobalSDLWindow, SDL_EVENT_WINDOW_FOCUS_GAINED, 0, 0); - if (latestWindowFlags & SDL_WINDOW_MAXIMIZED) { - SDL_SendWindowEvent(WINRT_GlobalSDLWindow, SDL_EVENT_WINDOW_MAXIMIZED, 0, 0); - } else { - SDL_SendWindowEvent(WINRT_GlobalSDLWindow, SDL_EVENT_WINDOW_RESTORED, 0, 0); - } - } else { - SDL_SendWindowEvent(WINRT_GlobalSDLWindow, SDL_EVENT_WINDOW_HIDDEN, 0, 0); - SDL_SendWindowEvent(WINRT_GlobalSDLWindow, SDL_EVENT_WINDOW_FOCUS_LOST, 0, 0); - SDL_SendWindowEvent(WINRT_GlobalSDLWindow, SDL_EVENT_WINDOW_MINIMIZED, 0, 0); - } - - // HACK: Prevent SDL's window-hide handling code, which currently - // triggers a fake window resize (possibly erroneously), from - // marking the SDL window's surface as invalid. - // - // A better solution to this probably involves figuring out if the - // fake window resize can be prevented. - WINRT_GlobalSDLWindow->surface_valid = wasSDLWindowSurfaceValid; - } -} - -void SDL_WinRTApp::OnWindowActivated(CoreWindow ^ sender, WindowActivatedEventArgs ^ args) -{ -#if LOG_WINDOW_EVENTS == 1 - SDL_Log("%s, WINRT_GlobalSDLWindow?=%s\n\n", - __FUNCTION__, - (WINRT_GlobalSDLWindow ? "yes" : "no")); -#endif - - /* There's no property in Win 8.x to tell whether a window is active or - not. [De]activation events are, however, sent to the app. We'll just - record those, in case the CoreWindow gets wrapped by an SDL_Window at - some future time. - */ - sender->CustomProperties->Insert("SDLHelperWindowActivationState", args->WindowActivationState); - - SDL_Window *window = WINRT_GlobalSDLWindow; - if (window) { - if (args->WindowActivationState != CoreWindowActivationState::Deactivated) { - SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_SHOWN, 0, 0); - if (SDL_GetKeyboardFocus() != window) { - SDL_SetKeyboardFocus(window); - } - - /* Send a mouse-motion event as appropriate. - This doesn't work when called from OnPointerEntered, at least - not in WinRT CoreWindow apps (as OnPointerEntered doesn't - appear to be called after window-reactivation, at least not - in Windows 10, Build 10586.3 (November 2015 update, non-beta). - - Don't do it on WinPhone 8.0 though, as CoreWindow's 'PointerPosition' - property isn't available. - */ -#if !SDL_WINAPI_FAMILY_PHONE || NTDDI_VERSION >= NTDDI_WINBLUE - Point cursorPos = WINRT_TransformCursorPosition(window, sender->PointerPosition, TransformToSDLWindowSize); - SDL_SendMouseMotion(0, window, SDL_GLOBAL_MOUSE_ID, false, cursorPos.X, cursorPos.Y); -#endif - - // TODO, WinRT: see if the Win32 bugfix from https://hg.libsdl.org/SDL/rev/d278747da408 needs to be applied (on window activation) - // WIN_CheckAsyncMouseRelease(data); - - // TODO, WinRT: implement clipboard support, if possible - ///* - // * FIXME: Update keyboard state - // */ - // WIN_CheckClipboardUpdate(data->videodata); - - // HACK: Resetting the mouse-cursor here seems to fix - // https://bugzilla.libsdl.org/show_bug.cgi?id=3217, whereby a - // WinRT app's mouse cursor may switch to Windows' 'wait' cursor, - // after a user alt-tabs back into a full-screened SDL app. - // This bug does not appear to reproduce 100% of the time. - // It may be a bug in Windows itself (v.10.0.586.36, as tested, - // and the most-recent as of this writing). - SDL_SetCursor(NULL); - } else { - if (SDL_GetKeyboardFocus() == window) { - SDL_SetKeyboardFocus(NULL); - } - } - } -} - -void SDL_WinRTApp::OnWindowClosed(CoreWindow ^ sender, CoreWindowEventArgs ^ args) -{ -#if LOG_WINDOW_EVENTS == 1 - SDL_Log("%s\n", __FUNCTION__); -#endif - m_windowClosed = true; -} - -void SDL_WinRTApp::OnAppActivated(CoreApplicationView ^ applicationView, IActivatedEventArgs ^ args) -{ - CoreWindow::GetForCurrentThread()->Activate(); -} - -void SDL_WinRTApp::OnSuspending(Platform::Object ^ sender, SuspendingEventArgs ^ args) -{ - // Save app state asynchronously after requesting a deferral. Holding a deferral - // indicates that the application is busy performing suspending operations. Be - // aware that a deferral may not be held indefinitely. After about five seconds, - // the app will be forced to exit. - - // ... but first, let the app know it's about to go to the background. - // The separation of events may be important, given that the deferral - // runs in a separate thread. This'll make SDL_EVENT_WILL_ENTER_BACKGROUND - // the only event among the two that runs in the main thread. Given - // that a few WinRT operations can only be done from the main thread - // (things that access the WinRT CoreWindow are one example of this), - // this could be important. - SDL_SendAppEvent(SDL_EVENT_WILL_ENTER_BACKGROUND); - - SuspendingDeferral ^ deferral = args->SuspendingOperation->GetDeferral(); - create_task([this, deferral]() { - // Send an app did-enter-background event immediately to observers. - // CoreDispatcher::ProcessEvents, which is the backbone on which - // SDL_WinRTApp::PumpEvents is built, will not return to its caller - // once it sends out a suspend event. Any events posted to SDL's - // event queue won't get received until the WinRT app is resumed. - // SDL_AddEventWatch() may be used to receive app-suspend events on - // WinRT. - SDL_SendAppEvent(SDL_EVENT_DID_ENTER_BACKGROUND); - - // 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 - if (WINRT_GlobalSDLWindow) { - SDL_Renderer *renderer = SDL_GetRenderer(WINRT_GlobalSDLWindow); - if (renderer && (SDL_strcmp(renderer->name, "direct3d11") == 0)) { - D3D11_Trim(renderer); - } - } -#endif - - deferral->Complete(); - }); -} - -void SDL_WinRTApp::OnResuming(Platform::Object ^ sender, Platform::Object ^ args) -{ - // Restore any data or state that was unloaded on suspend. By default, data - // and state are persisted when resuming from suspend. Note that these events - // do not occur if the app was previously terminated. - SDL_SendAppEvent(SDL_EVENT_WILL_ENTER_FOREGROUND); - SDL_SendAppEvent(SDL_EVENT_DID_ENTER_FOREGROUND); -} - -void SDL_WinRTApp::OnExiting(Platform::Object ^ sender, Platform::Object ^ args) -{ - SDL_SendAppEvent(SDL_EVENT_TERMINATING); -} - -static void WINRT_LogPointerEvent(const char *header, Windows::UI::Core::PointerEventArgs ^ args, Windows::Foundation::Point transformedPoint) -{ - Uint8 button, pressed; - Windows::UI::Input::PointerPoint ^ pt = args->CurrentPoint; - WINRT_GetSDLButtonForPointerPoint(pt, &button, &pressed); - SDL_Log("%s: Position={%f,%f}, Transformed Pos={%f, %f}, MouseWheelDelta=%d, FrameId=%d, PointerId=%d, SDL button=%d pressed=%d\n", - header, - pt->Position.X, pt->Position.Y, - transformedPoint.X, transformedPoint.Y, - pt->Properties->MouseWheelDelta, - pt->FrameId, - pt->PointerId, - button, - pressed); -} - -void SDL_WinRTApp::OnPointerPressed(CoreWindow ^ sender, PointerEventArgs ^ args) -{ -#if LOG_POINTER_EVENTS - WINRT_LogPointerEvent("pointer pressed", args, WINRT_TransformCursorPosition(WINRT_GlobalSDLWindow, args->CurrentPoint->Position, TransformToSDLWindowSize)); -#endif - - WINRT_ProcessPointerPressedEvent(WINRT_GlobalSDLWindow, args->CurrentPoint); -} - -void SDL_WinRTApp::OnPointerMoved(CoreWindow ^ sender, PointerEventArgs ^ args) -{ -#if LOG_POINTER_EVENTS - WINRT_LogPointerEvent("pointer moved", args, WINRT_TransformCursorPosition(WINRT_GlobalSDLWindow, args->CurrentPoint->Position, TransformToSDLWindowSize)); -#endif - - WINRT_ProcessPointerMovedEvent(WINRT_GlobalSDLWindow, args->CurrentPoint); -} - -void SDL_WinRTApp::OnPointerReleased(CoreWindow ^ sender, PointerEventArgs ^ args) -{ -#if LOG_POINTER_EVENTS - WINRT_LogPointerEvent("pointer released", args, WINRT_TransformCursorPosition(WINRT_GlobalSDLWindow, args->CurrentPoint->Position, TransformToSDLWindowSize)); -#endif - - WINRT_ProcessPointerReleasedEvent(WINRT_GlobalSDLWindow, args->CurrentPoint); -} - -void SDL_WinRTApp::OnPointerEntered(CoreWindow ^ sender, PointerEventArgs ^ args) -{ -#if LOG_POINTER_EVENTS - WINRT_LogPointerEvent("pointer entered", args, WINRT_TransformCursorPosition(WINRT_GlobalSDLWindow, args->CurrentPoint->Position, TransformToSDLWindowSize)); -#endif - - WINRT_ProcessPointerEnteredEvent(WINRT_GlobalSDLWindow, args->CurrentPoint); -} - -void SDL_WinRTApp::OnPointerExited(CoreWindow ^ sender, PointerEventArgs ^ args) -{ -#if LOG_POINTER_EVENTS - WINRT_LogPointerEvent("pointer exited", args, WINRT_TransformCursorPosition(WINRT_GlobalSDLWindow, args->CurrentPoint->Position, TransformToSDLWindowSize)); -#endif - - WINRT_ProcessPointerExitedEvent(WINRT_GlobalSDLWindow, args->CurrentPoint); -} - -void SDL_WinRTApp::OnPointerWheelChanged(CoreWindow ^ sender, PointerEventArgs ^ args) -{ -#if LOG_POINTER_EVENTS - WINRT_LogPointerEvent("pointer wheel changed", args, WINRT_TransformCursorPosition(WINRT_GlobalSDLWindow, args->CurrentPoint->Position, TransformToSDLWindowSize)); -#endif - - WINRT_ProcessPointerWheelChangedEvent(WINRT_GlobalSDLWindow, args->CurrentPoint); -} - -void SDL_WinRTApp::OnMouseMoved(MouseDevice ^ mouseDevice, MouseEventArgs ^ args) -{ - WINRT_ProcessMouseMovedEvent(WINRT_GlobalSDLWindow, args); -} - -void SDL_WinRTApp::OnAcceleratorKeyActivated(Windows::UI::Core::CoreDispatcher ^ sender, Windows::UI::Core::AcceleratorKeyEventArgs ^ args) -{ - WINRT_ProcessAcceleratorKeyActivated(args); -} - -void SDL_WinRTApp::OnCharacterReceived(Windows::UI::Core::CoreWindow ^ sender, Windows::UI::Core::CharacterReceivedEventArgs ^ args) -{ - WINRT_ProcessCharacterReceivedEvent(WINRT_GlobalSDLWindow, args); -} - -template -static void WINRT_OnBackButtonPressed(BackButtonEventArgs ^ args) -{ - SDL_SendKeyboardKey(0, SDL_GLOBAL_KEYBOARD_ID, 0, SDL_SCANCODE_AC_BACK, SDL_PRESSED); - SDL_SendKeyboardKey(0, SDL_GLOBAL_KEYBOARD_ID, 0, SDL_SCANCODE_AC_BACK, SDL_RELEASED); - - if (SDL_GetHintBoolean(SDL_HINT_WINRT_HANDLE_BACK_BUTTON, false)) { - args->Handled = true; - } -} - -#if NTDDI_VERSION >= NTDDI_WIN10 -void SDL_WinRTApp::OnBackButtonPressed(Platform::Object ^ sender, Windows::UI::Core::BackRequestedEventArgs ^ args) - -{ - WINRT_OnBackButtonPressed(args); -} -#elif SDL_WINAPI_FAMILY_PHONE -void SDL_WinRTApp::OnBackButtonPressed(Platform::Object ^ sender, Windows::Phone::UI::Input::BackPressedEventArgs ^ args) - -{ - WINRT_OnBackButtonPressed(args); -} -#endif - -#if NTDDI_VERSION >= NTDDI_WIN10 -void SDL_WinRTApp::OnGamepadAdded(Platform::Object ^ sender, Windows::Gaming::Input::Gamepad ^ gamepad) -{ - /* HACK ALERT: Nothing needs to be done here, as this method currently - only exists to allow something to be registered with Win10's - GamepadAdded event, an operation that seems to be necessary to get - Xinput-based detection to work on Xbox One. - */ -} -#endif diff --git a/src/core/winrt/SDL_winrtapp_direct3d.h b/src/core/winrt/SDL_winrtapp_direct3d.h deleted file mode 100644 index 07e6f162..00000000 --- a/src/core/winrt/SDL_winrtapp_direct3d.h +++ /dev/null @@ -1,92 +0,0 @@ -/* - 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 - -extern bool SDL_WinRTInitNonXAMLApp(int (*mainFunction)(int, char **)); - -ref class SDL_WinRTApp sealed : public Windows::ApplicationModel::Core::IFrameworkView -{ - public: - SDL_WinRTApp(); - - // IFrameworkView Methods. - virtual void Initialize(Windows::ApplicationModel::Core::CoreApplicationView ^ applicationView); - virtual void SetWindow(Windows::UI::Core::CoreWindow ^ window); - virtual void Load(Platform::String ^ entryPoint); - virtual void Run(); - virtual void Uninitialize(); - - internal : - // SDL-specific methods - void - PumpEvents(); - - protected: - bool ShouldWaitForAppResumeEvents(); - - // Event Handlers. - -#if (WINAPI_FAMILY == WINAPI_FAMILY_APP) && (NTDDI_VERSION < NTDDI_WIN10) // for Windows 8/8.1/RT apps... (and not Phone apps) - void OnSettingsPaneCommandsRequested( - Windows::UI::ApplicationSettings::SettingsPane ^ p, - Windows::UI::ApplicationSettings::SettingsPaneCommandsRequestedEventArgs ^ args); -#endif // if (WINAPI_FAMILY == WINAPI_FAMILY_APP) && (NTDDI_VERSION < NTDDI_WIN10) - -#if NTDDI_VERSION > NTDDI_WIN8 - void OnOrientationChanged(Windows::Graphics::Display::DisplayInformation ^ sender, Platform::Object ^ args); -#else - void OnOrientationChanged(Platform::Object ^ sender); -#endif - void OnWindowSizeChanged(Windows::UI::Core::CoreWindow ^ sender, Windows::UI::Core::WindowSizeChangedEventArgs ^ args); - void OnLogicalDpiChanged(Platform::Object ^ sender); - void OnAppActivated(Windows::ApplicationModel::Core::CoreApplicationView ^ applicationView, Windows::ApplicationModel::Activation::IActivatedEventArgs ^ args); - void OnSuspending(Platform::Object ^ sender, Windows::ApplicationModel::SuspendingEventArgs ^ args); - void OnResuming(Platform::Object ^ sender, Platform::Object ^ args); - void OnExiting(Platform::Object ^ sender, Platform::Object ^ args); - void OnWindowActivated(Windows::UI::Core::CoreWindow ^ sender, Windows::UI::Core::WindowActivatedEventArgs ^ args); - void OnWindowClosed(Windows::UI::Core::CoreWindow ^ sender, Windows::UI::Core::CoreWindowEventArgs ^ args); - void OnVisibilityChanged(Windows::UI::Core::CoreWindow ^ sender, Windows::UI::Core::VisibilityChangedEventArgs ^ args); - void OnPointerPressed(Windows::UI::Core::CoreWindow ^ sender, Windows::UI::Core::PointerEventArgs ^ args); - void OnPointerReleased(Windows::UI::Core::CoreWindow ^ sender, Windows::UI::Core::PointerEventArgs ^ args); - void OnPointerWheelChanged(Windows::UI::Core::CoreWindow ^ sender, Windows::UI::Core::PointerEventArgs ^ args); - void OnPointerMoved(Windows::UI::Core::CoreWindow ^ sender, Windows::UI::Core::PointerEventArgs ^ args); - void OnPointerEntered(Windows::UI::Core::CoreWindow ^ sender, Windows::UI::Core::PointerEventArgs ^ args); - void OnPointerExited(Windows::UI::Core::CoreWindow ^ sender, Windows::UI::Core::PointerEventArgs ^ args); - void OnMouseMoved(Windows::Devices::Input::MouseDevice ^ mouseDevice, Windows::Devices::Input::MouseEventArgs ^ args); - void OnAcceleratorKeyActivated(Windows::UI::Core::CoreDispatcher ^ sender, Windows::UI::Core::AcceleratorKeyEventArgs ^ args); - void OnCharacterReceived(Windows::UI::Core::CoreWindow ^ sender, Windows::UI::Core::CharacterReceivedEventArgs ^ args); - -#if NTDDI_VERSION >= NTDDI_WIN10 - void OnBackButtonPressed(Platform::Object ^ sender, Windows::UI::Core::BackRequestedEventArgs ^ args); -#elif SDL_WINAPI_FAMILY_PHONE - void OnBackButtonPressed(Platform::Object ^ sender, Windows::Phone::UI::Input::BackPressedEventArgs ^ args); -#endif - -#if NTDDI_VERSION >= NTDDI_WIN10 - void OnGamepadAdded(Platform::Object ^ sender, Windows::Gaming::Input::Gamepad ^ gamepad); -#endif - - private: - bool m_windowClosed; - bool m_windowVisible; -}; - -extern SDL_WinRTApp ^ SDL_WinRTGlobalApp; diff --git a/src/core/winrt/SDL_winrtapp_xaml.cpp b/src/core/winrt/SDL_winrtapp_xaml.cpp deleted file mode 100644 index 876c73a8..00000000 --- a/src/core/winrt/SDL_winrtapp_xaml.cpp +++ /dev/null @@ -1,146 +0,0 @@ -/* - 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" - -// Windows includes -#include -#include - -#if WINAPI_FAMILY == WINAPI_FAMILY_APP -#include -#endif - -// SDL includes -#include "../../video/winrt/SDL_winrtevents_c.h" -#include "../../video/winrt/SDL_winrtvideo_cpp.h" -#include "SDL_winrtapp_common.h" -#include "SDL_winrtapp_xaml.h" - -// SDL-internal globals: -bool WINRT_XAMLWasEnabled = false; - -#if WINAPI_FAMILY == WINAPI_FAMILY_APP -extern "C" ISwapChainBackgroundPanelNative *WINRT_GlobalSwapChainBackgroundPanelNative = NULL; -static Windows::Foundation::EventRegistrationToken WINRT_XAMLAppEventToken; -#endif - -/* - * Input event handlers (XAML) - */ -#if WINAPI_FAMILY == WINAPI_FAMILY_APP - -static void WINRT_OnPointerPressedViaXAML(Platform::Object ^ sender, Windows::UI::Xaml::Input::PointerRoutedEventArgs ^ args) -{ - WINRT_ProcessPointerPressedEvent(WINRT_GlobalSDLWindow, args->GetCurrentPoint(nullptr)); -} - -static void WINRT_OnPointerMovedViaXAML(Platform::Object ^ sender, Windows::UI::Xaml::Input::PointerRoutedEventArgs ^ args) -{ - WINRT_ProcessPointerMovedEvent(WINRT_GlobalSDLWindow, args->GetCurrentPoint(nullptr)); -} - -static void WINRT_OnPointerReleasedViaXAML(Platform::Object ^ sender, Windows::UI::Xaml::Input::PointerRoutedEventArgs ^ args) -{ - WINRT_ProcessPointerReleasedEvent(WINRT_GlobalSDLWindow, args->GetCurrentPoint(nullptr)); -} - -static void WINRT_OnPointerWheelChangedViaXAML(Platform::Object ^ sender, Windows::UI::Xaml::Input::PointerRoutedEventArgs ^ args) -{ - WINRT_ProcessPointerWheelChangedEvent(WINRT_GlobalSDLWindow, args->GetCurrentPoint(nullptr)); -} - -#endif // WINAPI_FAMILY == WINAPI_FAMILY_APP - -/* - * XAML-to-SDL Rendering Callback - */ -#if WINAPI_FAMILY == WINAPI_FAMILY_APP - -static void WINRT_OnRenderViaXAML(_In_ Platform::Object ^ sender, _In_ Platform::Object ^ args) -{ - WINRT_CycleXAMLThread(); -} - -#endif // WINAPI_FAMILY == WINAPI_FAMILY_APP - -/* - * SDL + XAML Initialization - */ - -bool SDL_WinRTInitXAMLApp(int (*mainFunction)(int, char **), void *backgroundPanelAsIInspectable) -{ -#if SDL_WINAPI_FAMILY_PHONE - return SDL_SetError("XAML support is not yet available in Windows Phone."); -#else - // Declare C++/CX namespaces: - using namespace Platform; - using namespace Windows::Foundation; - using namespace Windows::UI::Core; - using namespace Windows::UI::Xaml; - using namespace Windows::UI::Xaml::Controls; - using namespace Windows::UI::Xaml::Input; - using namespace Windows::UI::Xaml::Media; - - // Make sure we have a valid XAML element (to draw onto): - if (!backgroundPanelAsIInspectable) { - return SDL_InvalidParamError("backgroundPanelAsIInspectable"); - } - - Platform::Object ^ backgroundPanel = reinterpret_cast((IInspectable *)backgroundPanelAsIInspectable); - SwapChainBackgroundPanel ^ swapChainBackgroundPanel = dynamic_cast(backgroundPanel); - if (!swapChainBackgroundPanel) { - return SDL_SetError("An unknown or unsupported type of XAML control was specified."); - } - - // Setup event handlers: - swapChainBackgroundPanel->PointerPressed += ref new PointerEventHandler(WINRT_OnPointerPressedViaXAML); - swapChainBackgroundPanel->PointerReleased += ref new PointerEventHandler(WINRT_OnPointerReleasedViaXAML); - swapChainBackgroundPanel->PointerWheelChanged += ref new PointerEventHandler(WINRT_OnPointerWheelChangedViaXAML); - swapChainBackgroundPanel->PointerMoved += ref new PointerEventHandler(WINRT_OnPointerMovedViaXAML); - - // Setup for rendering: - IInspectable *panelInspectable = (IInspectable *)reinterpret_cast(swapChainBackgroundPanel); - panelInspectable->QueryInterface(__uuidof(ISwapChainBackgroundPanelNative), (void **)&WINRT_GlobalSwapChainBackgroundPanelNative); - - WINRT_XAMLAppEventToken = CompositionTarget::Rendering::add(ref new EventHandler(WINRT_OnRenderViaXAML)); - - // Make sure the app is ready to call the SDL-centric main() function: - WINRT_SDLAppEntryPoint = mainFunction; - SDL_SetMainReady(); - - // Make sure video-init knows that we're initializing XAML: - bool oldXAMLWasEnabledValue = WINRT_XAMLWasEnabled; - WINRT_XAMLWasEnabled = true; - - // Make sure video modes are detected now, while we still have access to the WinRT - // CoreWindow. WinRT will not allow the app's CoreWindow to be accessed via the - // SDL/WinRT thread. - if (!SDL_InitSubSystem(SDL_INIT_VIDEO)) { - // SDL_InitSubSystem will, on error, set the SDL error. Let that propagate to - // the caller to here: - WINRT_XAMLWasEnabled = oldXAMLWasEnabledValue; - return false; - } - - // All done, for now. - return true; -#endif // SDL_WINAPI_FAMILY_PHONE -} diff --git a/src/core/winrt/SDL_winrtapp_xaml.h b/src/core/winrt/SDL_winrtapp_xaml.h deleted file mode 100644 index 148e278d..00000000 --- a/src/core/winrt/SDL_winrtapp_xaml.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - 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" - -#ifndef SDL_winrtapp_xaml_h_ -#define SDL_winrtapp_xaml_h_ - -#ifdef __cplusplus -extern bool WINRT_XAMLWasEnabled; -extern bool SDL_WinRTInitXAMLApp(int (*mainFunction)(int, char **), void *backgroundPanelAsIInspectable); -#endif // ifdef __cplusplus - -#endif // SDL_winrtapp_xaml_h_ diff --git a/src/cpuinfo/SDL_cpuinfo.c b/src/cpuinfo/SDL_cpuinfo.c index 4704bdc6..6fdf3c02 100644 --- a/src/cpuinfo/SDL_cpuinfo.c +++ b/src/cpuinfo/SDL_cpuinfo.c @@ -23,7 +23,7 @@ #include "SDL_cpuinfo_c.h" -#if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_WINRT) || defined(SDL_PLATFORM_GDK) +#if defined(SDL_PLATFORM_WINDOWS) #include "../core/windows/SDL_windows.h" #endif @@ -620,35 +620,35 @@ static int CPU_haveAVX512F(void) } #endif -static int SDL_CPUCount = 0; +static int SDL_NumLogicalCPUCores = 0; -int SDL_GetCPUCount(void) +int SDL_GetNumLogicalCPUCores(void) { - if (!SDL_CPUCount) { + if (!SDL_NumLogicalCPUCores) { #if defined(HAVE_SYSCONF) && defined(_SC_NPROCESSORS_ONLN) - if (SDL_CPUCount <= 0) { - SDL_CPUCount = (int)sysconf(_SC_NPROCESSORS_ONLN); + if (SDL_NumLogicalCPUCores <= 0) { + SDL_NumLogicalCPUCores = (int)sysconf(_SC_NPROCESSORS_ONLN); } #endif #ifdef HAVE_SYSCTLBYNAME - if (SDL_CPUCount <= 0) { - size_t size = sizeof(SDL_CPUCount); - sysctlbyname("hw.ncpu", &SDL_CPUCount, &size, NULL, 0); + if (SDL_NumLogicalCPUCores <= 0) { + size_t size = sizeof(SDL_NumLogicalCPUCores); + sysctlbyname("hw.ncpu", &SDL_NumLogicalCPUCores, &size, NULL, 0); } #endif -#if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK) - if (SDL_CPUCount <= 0) { +#if defined(SDL_PLATFORM_WINDOWS) + if (SDL_NumLogicalCPUCores <= 0) { SYSTEM_INFO info; GetSystemInfo(&info); - SDL_CPUCount = info.dwNumberOfProcessors; + SDL_NumLogicalCPUCores = info.dwNumberOfProcessors; } #endif // There has to be at least 1, right? :) - if (SDL_CPUCount <= 0) { - SDL_CPUCount = 1; + if (SDL_NumLogicalCPUCores <= 0) { + SDL_NumLogicalCPUCores = 1; } } - return SDL_CPUCount; + return SDL_NumLogicalCPUCores; } #ifdef __e2k__ @@ -1035,72 +1035,72 @@ void SDL_QuitCPUInfo(void) { #define CPU_FEATURE_AVAILABLE(f) ((SDL_GetCPUFeatures() & (f)) ? true : false) -SDL_bool SDL_HasAltiVec(void) +bool SDL_HasAltiVec(void) { return CPU_FEATURE_AVAILABLE(CPU_HAS_ALTIVEC); } -SDL_bool SDL_HasMMX(void) +bool SDL_HasMMX(void) { return CPU_FEATURE_AVAILABLE(CPU_HAS_MMX); } -SDL_bool SDL_HasSSE(void) +bool SDL_HasSSE(void) { return CPU_FEATURE_AVAILABLE(CPU_HAS_SSE); } -SDL_bool SDL_HasSSE2(void) +bool SDL_HasSSE2(void) { return CPU_FEATURE_AVAILABLE(CPU_HAS_SSE2); } -SDL_bool SDL_HasSSE3(void) +bool SDL_HasSSE3(void) { return CPU_FEATURE_AVAILABLE(CPU_HAS_SSE3); } -SDL_bool SDL_HasSSE41(void) +bool SDL_HasSSE41(void) { return CPU_FEATURE_AVAILABLE(CPU_HAS_SSE41); } -SDL_bool SDL_HasSSE42(void) +bool SDL_HasSSE42(void) { return CPU_FEATURE_AVAILABLE(CPU_HAS_SSE42); } -SDL_bool SDL_HasAVX(void) +bool SDL_HasAVX(void) { return CPU_FEATURE_AVAILABLE(CPU_HAS_AVX); } -SDL_bool SDL_HasAVX2(void) +bool SDL_HasAVX2(void) { return CPU_FEATURE_AVAILABLE(CPU_HAS_AVX2); } -SDL_bool SDL_HasAVX512F(void) +bool SDL_HasAVX512F(void) { return CPU_FEATURE_AVAILABLE(CPU_HAS_AVX512F); } -SDL_bool SDL_HasARMSIMD(void) +bool SDL_HasARMSIMD(void) { return CPU_FEATURE_AVAILABLE(CPU_HAS_ARM_SIMD); } -SDL_bool SDL_HasNEON(void) +bool SDL_HasNEON(void) { return CPU_FEATURE_AVAILABLE(CPU_HAS_NEON); } -SDL_bool SDL_HasLSX(void) +bool SDL_HasLSX(void) { return CPU_FEATURE_AVAILABLE(CPU_HAS_LSX); } -SDL_bool SDL_HasLASX(void) +bool SDL_HasLASX(void) { return CPU_FEATURE_AVAILABLE(CPU_HAS_LASX); } @@ -1138,7 +1138,7 @@ int SDL_GetSystemRAM(void) } } #endif -#if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK) +#if defined(SDL_PLATFORM_WINDOWS) if (SDL_SystemRAM <= 0) { MEMORYSTATUSEX stat; stat.dwLength = sizeof(stat); diff --git a/src/dialog/SDL_dialog_utils.h b/src/dialog/SDL_dialog_utils.h index 1422231a..6c5a77df 100644 --- a/src/dialog/SDL_dialog_utils.h +++ b/src/dialog/SDL_dialog_utils.h @@ -46,7 +46,7 @@ char *convert_filter(const SDL_DialogFileFilter filter, NameTransform ntf, const char *suffix, const char *ext_prefix, const char *ext_separator, const char *ext_suffix); -// Converts the extenstion list of a filter into a single string. +// Converts the extension list of a filter into a single string. // [extension]{[extension]...} char *convert_ext_list(const char *list, const char *prefix, const char *separator, const char *suffix); diff --git a/src/dialog/android/SDL_androiddialog.c b/src/dialog/android/SDL_androiddialog.c index 80de9bfd..fd9e102e 100644 --- a/src/dialog/android/SDL_androiddialog.c +++ b/src/dialog/android/SDL_androiddialog.c @@ -22,7 +22,7 @@ #include "SDL_internal.h" #include "../../core/android/SDL_android.h" -void SDLCALL SDL_ShowOpenFileDialog(SDL_DialogFileCallback callback, void *userdata, SDL_Window *window, const SDL_DialogFileFilter *filters, int nfilters, const char *default_location, SDL_bool allow_many) +void SDLCALL SDL_ShowOpenFileDialog(SDL_DialogFileCallback callback, void *userdata, SDL_Window *window, const SDL_DialogFileFilter *filters, int nfilters, const char *default_location, bool allow_many) { if (!Android_JNI_OpenFileDialog(callback, userdata, filters, nfilters, false, allow_many)) { // SDL_SetError is already called when it fails @@ -38,7 +38,7 @@ void SDLCALL SDL_ShowSaveFileDialog(SDL_DialogFileCallback callback, void *userd } } -void SDLCALL SDL_ShowOpenFolderDialog(SDL_DialogFileCallback callback, void *userdata, SDL_Window *window, const char *default_location, SDL_bool allow_many) +void SDLCALL SDL_ShowOpenFolderDialog(SDL_DialogFileCallback callback, void *userdata, SDL_Window *window, const char *default_location, bool allow_many) { SDL_Unsupported(); callback(userdata, NULL, -1); diff --git a/src/dialog/cocoa/SDL_cocoadialog.m b/src/dialog/cocoa/SDL_cocoadialog.m index 72f2df6e..eee685e2 100644 --- a/src/dialog/cocoa/SDL_cocoadialog.m +++ b/src/dialog/cocoa/SDL_cocoadialog.m @@ -178,7 +178,7 @@ void show_file_dialog(cocoa_FileDialogType type, SDL_DialogFileCallback callback #endif // defined(SDL_PLATFORM_TVOS) || defined(SDL_PLATFORM_IOS) } -void SDL_ShowOpenFileDialog(SDL_DialogFileCallback callback, void* userdata, SDL_Window* window, const SDL_DialogFileFilter *filters, int nfilters, const char* default_location, SDL_bool allow_many) +void SDL_ShowOpenFileDialog(SDL_DialogFileCallback callback, void* userdata, SDL_Window* window, const SDL_DialogFileFilter *filters, int nfilters, const char* default_location, bool allow_many) { show_file_dialog(FDT_OPEN, callback, userdata, window, filters, nfilters, default_location, allow_many); } @@ -188,7 +188,7 @@ void SDL_ShowSaveFileDialog(SDL_DialogFileCallback callback, void* userdata, SDL show_file_dialog(FDT_SAVE, callback, userdata, window, filters, nfilters, default_location, 0); } -void SDL_ShowOpenFolderDialog(SDL_DialogFileCallback callback, void* userdata, SDL_Window* window, const char* default_location, SDL_bool allow_many) +void SDL_ShowOpenFolderDialog(SDL_DialogFileCallback callback, void* userdata, SDL_Window* window, const char* default_location, bool allow_many) { show_file_dialog(FDT_OPENFOLDER, callback, userdata, window, NULL, 0, default_location, allow_many); } diff --git a/src/dialog/dummy/SDL_dummydialog.c b/src/dialog/dummy/SDL_dummydialog.c index 0f7456b9..209efe76 100644 --- a/src/dialog/dummy/SDL_dummydialog.c +++ b/src/dialog/dummy/SDL_dummydialog.c @@ -20,7 +20,7 @@ */ #include "SDL_internal.h" -void SDL_ShowOpenFileDialog(SDL_DialogFileCallback callback, void* userdata, SDL_Window* window, const SDL_DialogFileFilter *filters, int nfilters, const char* default_location, SDL_bool allow_many) +void SDL_ShowOpenFileDialog(SDL_DialogFileCallback callback, void* userdata, SDL_Window* window, const SDL_DialogFileFilter *filters, int nfilters, const char* default_location, bool allow_many) { SDL_Unsupported(); callback(userdata, NULL, -1); @@ -32,7 +32,7 @@ void SDL_ShowSaveFileDialog(SDL_DialogFileCallback callback, void* userdata, SDL callback(userdata, NULL, -1); } -void SDL_ShowOpenFolderDialog(SDL_DialogFileCallback callback, void* userdata, SDL_Window* window, const char* default_location, SDL_bool allow_many) +void SDL_ShowOpenFolderDialog(SDL_DialogFileCallback callback, void* userdata, SDL_Window* window, const char* default_location, bool allow_many) { SDL_Unsupported(); callback(userdata, NULL, -1); diff --git a/src/dialog/haiku/SDL_haikudialog.cc b/src/dialog/haiku/SDL_haikudialog.cc index 2aa48589..9d6e3730 100644 --- a/src/dialog/haiku/SDL_haikudialog.cc +++ b/src/dialog/haiku/SDL_haikudialog.cc @@ -243,7 +243,7 @@ void ShowDialog(bool save, SDL_DialogFileCallback callback, void *userdata, bool panel->Show(); } -void SDL_ShowOpenFileDialog(SDL_DialogFileCallback callback, void *userdata, SDL_Window *window, const SDL_DialogFileFilter *filters, int nfilters, const char *default_location, SDL_bool allow_many) +void SDL_ShowOpenFileDialog(SDL_DialogFileCallback callback, void *userdata, SDL_Window *window, const SDL_DialogFileFilter *filters, int nfilters, const char *default_location, bool allow_many) { ShowDialog(false, callback, userdata, allow_many == true, !!window, filters, nfilters, false, default_location); } @@ -253,7 +253,7 @@ void SDL_ShowSaveFileDialog(SDL_DialogFileCallback callback, void *userdata, SDL ShowDialog(true, callback, userdata, false, !!window, filters, nfilters, false, default_location); } -void SDL_ShowOpenFolderDialog(SDL_DialogFileCallback callback, void *userdata, SDL_Window *window, const char* default_location, SDL_bool allow_many) +void SDL_ShowOpenFolderDialog(SDL_DialogFileCallback callback, void *userdata, SDL_Window *window, const char* default_location, bool allow_many) { ShowDialog(false, callback, userdata, allow_many == true, !!window, NULL, 0, true, default_location); } diff --git a/src/dialog/unix/SDL_portaldialog.c b/src/dialog/unix/SDL_portaldialog.c index 7938567a..ac6b575c 100644 --- a/src/dialog/unix/SDL_portaldialog.c +++ b/src/dialog/unix/SDL_portaldialog.c @@ -96,7 +96,7 @@ static void DBus_AppendFilter(SDL_DBusContext *dbus, DBusMessageIter *parent, co dbus->message_iter_open_container(&filter_array, DBUS_TYPE_STRUCT, NULL, &filter_array_entry); dbus->message_iter_append_basic(&filter_array_entry, DBUS_TYPE_UINT32, &zero); - glob_pattern = SDL_calloc(sizeof(char), max_len); + glob_pattern = SDL_calloc(max_len, sizeof(char)); if (!glob_pattern) { goto cleanup; } diff --git a/src/dialog/unix/SDL_unixdialog.c b/src/dialog/unix/SDL_unixdialog.c index 91603e7d..5e81b70c 100644 --- a/src/dialog/unix/SDL_unixdialog.c +++ b/src/dialog/unix/SDL_unixdialog.c @@ -73,7 +73,7 @@ static int detect_available_methods(const char *value) return 0; } -void SDL_ShowOpenFileDialog(SDL_DialogFileCallback callback, void* userdata, SDL_Window* window, const SDL_DialogFileFilter *filters, int nfilters, const char* default_location, SDL_bool allow_many) +void SDL_ShowOpenFileDialog(SDL_DialogFileCallback callback, void* userdata, SDL_Window* window, const SDL_DialogFileFilter *filters, int nfilters, const char* default_location, bool allow_many) { // Call detect_available_methods() again each time in case the situation changed if (!detected_open && !detect_available_methods(NULL)) { @@ -97,7 +97,7 @@ void SDL_ShowSaveFileDialog(SDL_DialogFileCallback callback, void* userdata, SDL detected_save(callback, userdata, window, filters, nfilters, default_location); } -void SDL_ShowOpenFolderDialog(SDL_DialogFileCallback callback, void* userdata, SDL_Window* window, const char* default_location, SDL_bool allow_many) +void SDL_ShowOpenFolderDialog(SDL_DialogFileCallback callback, void* userdata, SDL_Window* window, const char* default_location, bool allow_many) { // Call detect_available_methods() again each time in case the situation changed if (!detected_folder && !detect_available_methods(NULL)) { diff --git a/src/dialog/unix/SDL_zenitydialog.c b/src/dialog/unix/SDL_zenitydialog.c index 131352e7..bca4ed1c 100644 --- a/src/dialog/unix/SDL_zenitydialog.c +++ b/src/dialog/unix/SDL_zenitydialog.c @@ -191,128 +191,95 @@ static void run_zenity(zenityArgs* arg_struct) { SDL_DialogFileCallback callback = arg_struct->callback; void* userdata = arg_struct->userdata; - - int out[2]; - pid_t process; + SDL_Process *process = NULL; + char **args = NULL; + SDL_Environment *env = NULL; int status = -1; + size_t bytes_read = 0; + char *container = NULL; + size_t narray = 1; + char **array = NULL; + bool result = false; - if (pipe(out) < 0) { - SDL_SetError("Could not create pipe: %s", strerror(errno)); - callback(userdata, NULL, -1); - return; - } - - /* Args are only needed in the forked process, but generating them early - allows catching the error messages in the main process */ - char **args = generate_args(arg_struct); - + args = generate_args(arg_struct); if (!args) { - // SDL_SetError will have been called already - callback(userdata, NULL, -1); - return; + goto done; } - process = fork(); + env = SDL_CreateEnvironment(true); + if (!env) { + goto done; + } - if (process < 0) { - SDL_SetError("Could not fork process: %s", strerror(errno)); - close(out[0]); - close(out[1]); - free_args(args); - callback(userdata, NULL, -1); - return; - } else if (process == 0){ - dup2(out[1], STDOUT_FILENO); - close(STDERR_FILENO); // Hide errors from Zenity to stderr - close(out[0]); - close(out[1]); + /* Recent versions of Zenity have different exit codes, but picks up + different codes from the environment */ + SDL_SetEnvironmentVariable(env, "ZENITY_OK", "0", true); + SDL_SetEnvironmentVariable(env, "ZENITY_CANCEL", "1", true); + SDL_SetEnvironmentVariable(env, "ZENITY_ESC", "1", true); + SDL_SetEnvironmentVariable(env, "ZENITY_EXTRA", "2", true); + SDL_SetEnvironmentVariable(env, "ZENITY_ERROR", "2", true); + SDL_SetEnvironmentVariable(env, "ZENITY_TIMEOUT", "2", true); - /* Recent versions of Zenity have different exit codes, but picks up - different codes from the environment */ - SDL_setenv("ZENITY_OK", "0", 1); - SDL_setenv("ZENITY_CANCEL", "1", 1); - SDL_setenv("ZENITY_ESC", "1", 1); - SDL_setenv("ZENITY_EXTRA", "2", 1); - SDL_setenv("ZENITY_ERROR", "2", 1); - SDL_setenv("ZENITY_TIMEOUT", "2", 1); + SDL_PropertiesID props = SDL_CreateProperties(); + SDL_SetPointerProperty(props, SDL_PROP_PROCESS_CREATE_ARGS_POINTER, args); + SDL_SetPointerProperty(props, SDL_PROP_PROCESS_CREATE_ENVIRONMENT_POINTER, env); + SDL_SetNumberProperty(props, SDL_PROP_PROCESS_CREATE_STDIN_NUMBER, SDL_PROCESS_STDIO_NULL); + SDL_SetNumberProperty(props, SDL_PROP_PROCESS_CREATE_STDOUT_NUMBER, SDL_PROCESS_STDIO_APP); + SDL_SetNumberProperty(props, SDL_PROP_PROCESS_CREATE_STDERR_NUMBER, SDL_PROCESS_STDIO_NULL); + process = SDL_CreateProcessWithProperties(props); + SDL_DestroyProperties(props); + if (!process) { + goto done; + } - execv(args[0], args); + container = SDL_ReadProcess(process, &bytes_read, &status); + if (!container) { + goto done; + } - exit(errno + 128); - } else { - char readbuffer[2048]; - size_t bytes_read = 0, bytes_last_read; - char *container = NULL; - close(out[1]); - free_args(args); + array = (char **)SDL_malloc((narray + 1) * sizeof(char *)); + if (!array) { + goto done; + } + array[0] = container; + array[1] = NULL; - while ((bytes_last_read = read(out[0], readbuffer, sizeof(readbuffer)))) { - char *new_container = SDL_realloc(container, bytes_read + bytes_last_read); - if (!new_container) { - SDL_free(container); - close(out[0]); - callback(userdata, NULL, -1); - return; - } - container = new_container; - SDL_memcpy(container + bytes_read, readbuffer, bytes_last_read); - bytes_read += bytes_last_read; - } - close(out[0]); - - if (waitpid(process, &status, 0) == -1) { - SDL_SetError("waitpid failed"); - SDL_free(container); - callback(userdata, NULL, -1); - return; - } - - if (WIFEXITED(status)) { - status = WEXITSTATUS(status); - } - - size_t narray = 1; - char **array = (char **) SDL_malloc((narray + 1) * sizeof(char *)); - - if (!array) { - SDL_free(container); - callback(userdata, NULL, -1); - return; - } - - array[0] = container; - array[1] = NULL; - - for (int i = 0; i < bytes_read; i++) { - if (container[i] == '\n') { - container[i] = '\0'; - // Reading from a process often leaves a trailing \n, so ignore the last one - if (i < bytes_read - 1) { - array[narray] = container + i + 1; - narray++; - char **new_array = (char **) SDL_realloc(array, (narray + 1) * sizeof(char *)); - if (!new_array) { - SDL_free(container); - SDL_free(array); - callback(userdata, NULL, -1); - return; - } - array = new_array; - array[narray] = NULL; + for (int i = 0; i < bytes_read; i++) { + if (container[i] == '\n') { + container[i] = '\0'; + // Reading from a process often leaves a trailing \n, so ignore the last one + if (i < bytes_read - 1) { + array[narray] = container + i + 1; + narray++; + char **new_array = (char **) SDL_realloc(array, (narray + 1) * sizeof(char *)); + if (!new_array) { + goto done; } + array = new_array; + array[narray] = NULL; } } + } - // 0 = the user chose one or more files, 1 = the user canceled the dialog - if (status == 0 || status == 1) { - callback(userdata, (const char * const*) array, -1); - } else { - SDL_SetError("Could not run zenity: exit code %d (may be zenity or execv+128)", status); - callback(userdata, NULL, -1); - } + // 0 = the user chose one or more files, 1 = the user canceled the dialog + if (status == 0 || status == 1) { + callback(userdata, (const char * const*)array, -1); + } else { + SDL_SetError("Could not run zenity: exit code %d", status); + callback(userdata, NULL, -1); + } - SDL_free(array); - SDL_free(container); + result = true; + +done: + SDL_free(array); + SDL_free(container); + free_args(args); + SDL_DestroyEnvironment(env); + SDL_DestroyProcess(process); + + if (!result) { + callback(userdata, NULL, -1); } } @@ -409,30 +376,21 @@ void SDL_Zenity_ShowOpenFolderDialog(SDL_DialogFileCallback callback, void* user bool SDL_Zenity_detect(void) { - pid_t process; + const char *args[] = { + "/usr/bin/env", "zenity", "--version", NULL + }; int status = -1; - process = fork(); - - if (process < 0) { - SDL_SetError("Could not fork process: %s", strerror(errno)); - return false; - } else if (process == 0){ - // Disable output - close(STDERR_FILENO); - close(STDOUT_FILENO); - execl("/usr/bin/env", "/usr/bin/env", "zenity", "--version", NULL); - exit(errno + 128); - } else { - if (waitpid(process, &status, 0) == -1) { - SDL_SetError("waitpid failed"); - return false; - } - - if (WIFEXITED(status)) { - status = WEXITSTATUS(status); - } - - return (status == 0); + SDL_PropertiesID props = SDL_CreateProperties(); + SDL_SetPointerProperty(props, SDL_PROP_PROCESS_CREATE_ARGS_POINTER, args); + SDL_SetNumberProperty(props, SDL_PROP_PROCESS_CREATE_STDIN_NUMBER, SDL_PROCESS_STDIO_NULL); + SDL_SetNumberProperty(props, SDL_PROP_PROCESS_CREATE_STDOUT_NUMBER, SDL_PROCESS_STDIO_NULL); + SDL_SetNumberProperty(props, SDL_PROP_PROCESS_CREATE_STDERR_NUMBER, SDL_PROCESS_STDIO_NULL); + SDL_Process *process = SDL_CreateProcessWithProperties(props); + SDL_DestroyProperties(props); + if (process) { + SDL_WaitProcess(process, true, &status); + SDL_DestroyProcess(process); } + return (status == 0); } diff --git a/src/dialog/windows/SDL_windowsdialog.c b/src/dialog/windows/SDL_windowsdialog.c index 6fb86503..9bb6d991 100644 --- a/src/dialog/windows/SDL_windowsdialog.c +++ b/src/dialog/windows/SDL_windowsdialog.c @@ -426,7 +426,7 @@ int windows_folder_dialog_thread(void* ptr) return 0; } -void SDL_ShowOpenFileDialog(SDL_DialogFileCallback callback, void* userdata, SDL_Window* window, const SDL_DialogFileFilter *filters, int nfilters, const char* default_location, SDL_bool allow_many) +void SDL_ShowOpenFileDialog(SDL_DialogFileCallback callback, void* userdata, SDL_Window* window, const SDL_DialogFileFilter *filters, int nfilters, const char* default_location, bool allow_many) { winArgs *args; SDL_Thread *thread; @@ -449,7 +449,7 @@ void SDL_ShowOpenFileDialog(SDL_DialogFileCallback callback, void* userdata, SDL args->nfilters = nfilters; args->default_file = default_location; args->parent = window; - args->flags = (allow_many != SDL_FALSE) ? OFN_ALLOWMULTISELECT : 0; + args->flags = (allow_many != false) ? OFN_ALLOWMULTISELECT : 0; args->callback = callback; args->userdata = userdata; @@ -501,7 +501,7 @@ void SDL_ShowSaveFileDialog(SDL_DialogFileCallback callback, void* userdata, SDL SDL_DetachThread(thread); } -void SDL_ShowOpenFolderDialog(SDL_DialogFileCallback callback, void* userdata, SDL_Window* window, const char* default_location, SDL_bool allow_many) +void SDL_ShowOpenFolderDialog(SDL_DialogFileCallback callback, void* userdata, SDL_Window* window, const char* default_location, bool allow_many) { winFArgs *args; SDL_Thread *thread; diff --git a/src/dynapi/SDL_dynapi.c b/src/dynapi/SDL_dynapi.c index b67b6cb4..c0078ad9 100644 --- a/src/dynapi/SDL_dynapi.c +++ b/src/dynapi/SDL_dynapi.c @@ -76,7 +76,7 @@ static void SDL_InitDynamicAPI(void); } #define SDL_DYNAPI_VARARGS(_static, name, initcall) \ - _static SDL_bool SDLCALL SDL_SetError##name(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) \ + _static bool SDLCALL SDL_SetError##name(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) \ { \ char buf[128], *str = buf; \ int result; \ @@ -100,7 +100,7 @@ static void SDL_InitDynamicAPI(void); if (str != buf) { \ jump_table.SDL_free(str); \ } \ - return SDL_FALSE; \ + return false; \ } \ _static int SDLCALL SDL_sscanf##name(const char *buf, SDL_SCANF_FORMAT_STRING const char *fmt, ...) \ { \ @@ -168,6 +168,7 @@ static void SDL_InitDynamicAPI(void); jump_table.SDL_LogMessageV(category, priority, fmt, ap); \ va_end(ap); \ } \ + SDL_DYNAPI_VARARGS_LOGFN(_static, name, initcall, Trace, TRACE) \ SDL_DYNAPI_VARARGS_LOGFN(_static, name, initcall, Verbose, VERBOSE) \ SDL_DYNAPI_VARARGS_LOGFN(_static, name, initcall, Debug, DEBUG) \ SDL_DYNAPI_VARARGS_LOGFN(_static, name, initcall, Info, INFO) \ @@ -232,7 +233,7 @@ SDL_DYNAPI_VARARGS(, , ) #define ENABLE_SDL_CALL_LOGGING 0 #if ENABLE_SDL_CALL_LOGGING -static SDL_bool SDLCALL SDL_SetError_LOGSDLCALLS(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) +static bool SDLCALL SDL_SetError_LOGSDLCALLS(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) { char buf[512]; // !!! FIXME: dynamic allocation va_list ap; @@ -317,6 +318,7 @@ static void SDLCALL SDL_LogMessage_LOGSDLCALLS(int category, SDL_LogPriority pri SDL_LogMessageV_REAL(category, SDL_LOG_PRIORITY_##prio, fmt, ap); \ va_end(ap); \ } +SDL_DYNAPI_VARARGS_LOGFN_LOGSDLCALLS(Trace, TRACE) SDL_DYNAPI_VARARGS_LOGFN_LOGSDLCALLS(Verbose, VERBOSE) SDL_DYNAPI_VARARGS_LOGFN_LOGSDLCALLS(Debug, DEBUG) SDL_DYNAPI_VARARGS_LOGFN_LOGSDLCALLS(Info, INFO) @@ -351,8 +353,8 @@ static Sint32 initialize_jumptable(Uint32 apiver, void *table, Uint32 tablesize) // Init our jump table first. #if ENABLE_SDL_CALL_LOGGING { - const char *env = SDL_getenv_REAL("SDL_DYNAPI_LOG_CALLS"); - const SDL_bool log_calls = (env && SDL_atoi_REAL(env)); + const char *env = SDL_getenv_unsafe_REAL("SDL_DYNAPI_LOG_CALLS"); + const bool log_calls = (env && SDL_atoi_REAL(env)); if (log_calls) { #define SDL_DYNAPI_PROC(rc, fn, params, args, ret) jump_table.fn = fn##_LOGSDLCALLS; #include "SDL_dynapi_procs.h" @@ -461,15 +463,15 @@ extern SDL_NORETURN void SDL_ExitProcess(int exitcode); static void SDL_InitDynamicAPILocked(void) { - const char *libname = SDL_getenv_REAL(SDL_DYNAMIC_API_ENVVAR); + const char *libname = SDL_getenv_unsafe_REAL(SDL_DYNAMIC_API_ENVVAR); SDL_DYNAPI_ENTRYFN entry = NULL; // funcs from here by default. - SDL_bool use_internal = SDL_TRUE; + bool use_internal = true; if (libname) { while (*libname && !entry) { // This is evil, but we're not making any permanent changes... char *ptr = (char *)libname; - while (SDL_TRUE) { + while (true) { char ch = *ptr; if ((ch == ',') || (ch == '\0')) { *ptr = '\0'; @@ -493,7 +495,7 @@ static void SDL_InitDynamicAPILocked(void) dynapi_warn("Couldn't override SDL library. Using a newer SDL build might help. Please fix or remove the " SDL_DYNAMIC_API_ENVVAR " environment variable. Using the default SDL."); // Just fill in the function pointers from this library, later. } else { - use_internal = SDL_FALSE; // We overrode SDL! Don't use the internal version! + use_internal = false; // We overrode SDL! Don't use the internal version! } } @@ -522,14 +524,14 @@ static void SDL_InitDynamicAPI(void) * SDL_CreateThread() would also call this function before building the * new thread). */ - static SDL_bool already_initialized = SDL_FALSE; + static bool already_initialized = false; static SDL_SpinLock lock = 0; SDL_LockSpinlock_REAL(&lock); if (!already_initialized) { SDL_InitDynamicAPILocked(); - already_initialized = SDL_TRUE; + already_initialized = true; } SDL_UnlockSpinlock_REAL(&lock); diff --git a/src/dynapi/SDL_dynapi.h b/src/dynapi/SDL_dynapi.h index 2e8e2383..be52f2c2 100644 --- a/src/dynapi/SDL_dynapi.h +++ b/src/dynapi/SDL_dynapi.h @@ -49,8 +49,6 @@ #define SDL_DYNAMIC_API 0 #elif defined(SDL_PLATFORM_EMSCRIPTEN) // probably not useful on Emscripten. #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(SDL_PLATFORM_PS2) && SDL_PLATFORM_PS2 #define SDL_DYNAMIC_API 0 #elif defined(SDL_PLATFORM_PSP) && SDL_PLATFORM_PSP diff --git a/src/dynapi/SDL_dynapi.sym b/src/dynapi/SDL_dynapi.sym index 9ce6598e..1b22f054 100644 --- a/src/dynapi/SDL_dynapi.sym +++ b/src/dynapi/SDL_dynapi.sym @@ -5,6 +5,7 @@ SDL3_0.0.0 { SDL_AcquireCameraFrame; SDL_AcquireGPUCommandBuffer; SDL_AcquireGPUSwapchainTexture; + SDL_AddAtomicInt; SDL_AddEventWatch; SDL_AddGamepadMapping; SDL_AddGamepadMappingsFromFile; @@ -14,13 +15,6 @@ SDL3_0.0.0 { SDL_AddTimer; SDL_AddTimerNS; SDL_AddVulkanRenderSemaphores; - SDL_AtomicAdd; - SDL_AtomicCompareAndSwap; - SDL_AtomicCompareAndSwapPointer; - SDL_AtomicGet; - SDL_AtomicGetPointer; - SDL_AtomicSet; - SDL_AtomicSetPointer; SDL_AttachVirtualJoystick; SDL_AudioDevicePaused; SDL_BeginGPUComputePass; @@ -29,6 +23,7 @@ SDL3_0.0.0 { SDL_BindAudioStream; SDL_BindAudioStreams; SDL_BindGPUComputePipeline; + SDL_BindGPUComputeSamplers; SDL_BindGPUComputeStorageBuffers; SDL_BindGPUComputeStorageTextures; SDL_BindGPUFragmentSamplers; @@ -66,6 +61,9 @@ SDL3_0.0.0 { SDL_CloseJoystick; SDL_CloseSensor; SDL_CloseStorage; + SDL_CompareAndSwapAtomicInt; + SDL_CompareAndSwapAtomicPointer; + SDL_CompareAndSwapAtomicU32; SDL_ComposeCustomBlendMode; SDL_ConvertAudioSamples; SDL_ConvertEventToRenderCoordinates; @@ -83,6 +81,7 @@ SDL3_0.0.0 { SDL_CreateCondition; SDL_CreateCursor; SDL_CreateDirectory; + SDL_CreateEnvironment; SDL_CreateGPUBuffer; SDL_CreateGPUComputePipeline; SDL_CreateGPUDevice; @@ -96,6 +95,8 @@ SDL3_0.0.0 { SDL_CreateMutex; SDL_CreatePalette; SDL_CreatePopupWindow; + SDL_CreateProcess; + SDL_CreateProcessWithProperties; SDL_CreateProperties; SDL_CreateRWLock; SDL_CreateRenderer; @@ -117,17 +118,17 @@ SDL3_0.0.0 { SDL_CreateWindowWithProperties; SDL_CursorVisible; SDL_DateTimeToTime; - SDL_RemoveEventWatch; - SDL_RemoveHintCallback; SDL_Delay; SDL_DelayNS; SDL_DestroyAudioStream; SDL_DestroyCondition; SDL_DestroyCursor; + SDL_DestroyEnvironment; SDL_DestroyGPUDevice; SDL_DestroyHapticEffect; SDL_DestroyMutex; SDL_DestroyPalette; + SDL_DestroyProcess; SDL_DestroyProperties; SDL_DestroyRWLock; SDL_DestroyRenderer; @@ -170,6 +171,7 @@ SDL3_0.0.0 { SDL_FlushAudioStream; SDL_FlushEvent; SDL_FlushEvents; + SDL_FlushIO; SDL_FlushRenderer; SDL_GDKResumeGPU; SDL_GDKSuspendComplete; @@ -189,6 +191,8 @@ SDL3_0.0.0 { SDL_GL_SetSwapInterval; SDL_GL_SwapWindow; SDL_GL_UnloadLibrary; + SDL_GPUSupportsProperties; + SDL_GPUSupportsShaderFormats; SDL_GPUTextureFormatTexelBlockSize; SDL_GPUTextureSupportsFormat; SDL_GPUTextureSupportsSampleCount; @@ -210,6 +214,9 @@ SDL3_0.0.0 { SDL_GetAppMetadataProperty; SDL_GetAssertionHandler; SDL_GetAssertionReport; + SDL_GetAtomicInt; + SDL_GetAtomicPointer; + SDL_GetAtomicU32; SDL_GetAudioDeviceChannelMap; SDL_GetAudioDeviceFormat; SDL_GetAudioDeviceGain; @@ -231,7 +238,6 @@ SDL3_0.0.0 { SDL_GetBasePath; SDL_GetBooleanProperty; SDL_GetCPUCacheLineSize; - SDL_GetCPUCount; SDL_GetCameraDriver; SDL_GetCameraFormat; SDL_GetCameraID; @@ -271,13 +277,18 @@ SDL3_0.0.0 { SDL_GetDisplayProperties; SDL_GetDisplayUsableBounds; SDL_GetDisplays; + SDL_GetEnvironment; + SDL_GetEnvironmentVariable; + SDL_GetEnvironmentVariables; SDL_GetError; SDL_GetEventFilter; SDL_GetFloatProperty; SDL_GetFullscreenDisplayModes; SDL_GetGDKDefaultUser; SDL_GetGDKTaskQueue; + SDL_GetGPUDeviceDriver; SDL_GetGPUDriver; + SDL_GetGPUShaderFormats; SDL_GetGPUSwapchainTextureFormat; SDL_GetGamepadAppleSFSymbolsNameForAxis; SDL_GetGamepadAppleSFSymbolsNameForButton; @@ -393,6 +404,7 @@ SDL3_0.0.0 { SDL_GetNumAllocations; SDL_GetNumAudioDrivers; SDL_GetNumCameraDrivers; + SDL_GetNumGPUDrivers; SDL_GetNumGamepadTouchpadFingers; SDL_GetNumGamepadTouchpads; SDL_GetNumHapticAxes; @@ -400,6 +412,7 @@ SDL3_0.0.0 { SDL_GetNumJoystickBalls; SDL_GetNumJoystickButtons; SDL_GetNumJoystickHats; + SDL_GetNumLogicalCPUCores; SDL_GetNumRenderDrivers; SDL_GetNumVideoDrivers; SDL_GetNumberProperty; @@ -417,6 +430,9 @@ SDL3_0.0.0 { SDL_GetPreferredLocales; SDL_GetPrimaryDisplay; SDL_GetPrimarySelectionText; + SDL_GetProcessInput; + SDL_GetProcessOutput; + SDL_GetProcessProperties; SDL_GetPropertyType; SDL_GetRGB; SDL_GetRGBA; @@ -506,8 +522,6 @@ SDL3_0.0.0 { SDL_GetUserFolder; SDL_GetVersion; SDL_GetVideoDriver; - SDL_GetWinRTDeviceFamily; - SDL_GetWinRTFSPath; SDL_GetWindowAspectRatio; SDL_GetWindowBordersSize; SDL_GetWindowDisplayScale; @@ -589,6 +603,7 @@ SDL3_0.0.0 { SDL_IsTablet; SDL_JoystickConnected; SDL_JoystickEventsEnabled; + SDL_KillProcess; SDL_LoadBMP; SDL_LoadBMP_IO; SDL_LoadFile; @@ -614,6 +629,7 @@ SDL3_0.0.0 { SDL_LogInfo; SDL_LogMessage; SDL_LogMessageV; + SDL_LogTrace; SDL_LogVerbose; SDL_LogWarn; SDL_MapGPUTransferBuffer; @@ -673,6 +689,7 @@ SDL3_0.0.0 { SDL_QuitSubSystem; SDL_RaiseWindow; SDL_ReadIO; + SDL_ReadProcess; SDL_ReadS16BE; SDL_ReadS16LE; SDL_ReadS32BE; @@ -703,6 +720,8 @@ SDL3_0.0.0 { SDL_ReleaseGPUTransferBuffer; SDL_ReleaseWindowFromGPUDevice; SDL_ReloadGamepadMappings; + SDL_RemoveEventWatch; + SDL_RemoveHintCallback; SDL_RemovePath; SDL_RemoveStoragePath; SDL_RemoveSurfaceAlternateImages; @@ -761,6 +780,9 @@ SDL3_0.0.0 { SDL_SetAppMetadata; SDL_SetAppMetadataProperty; SDL_SetAssertionHandler; + SDL_SetAtomicInt; + SDL_SetAtomicPointer; + SDL_SetAtomicU32; SDL_SetAudioDeviceGain; SDL_SetAudioPostmixCallback; SDL_SetAudioStreamFormat; @@ -774,12 +796,15 @@ SDL3_0.0.0 { SDL_SetClipboardData; SDL_SetClipboardText; SDL_SetCursor; + SDL_SetEnvironmentVariable; SDL_SetError; SDL_SetEventEnabled; SDL_SetEventFilter; SDL_SetFloatProperty; + SDL_SetGPUBlendConstants; SDL_SetGPUBufferName; SDL_SetGPUScissor; + SDL_SetGPUStencilReference; SDL_SetGPUSwapchainParameters; SDL_SetGPUTextureName; SDL_SetGPUViewport; @@ -854,10 +879,11 @@ SDL3_0.0.0 { SDL_SetWindowKeyboardGrab; SDL_SetWindowMaximumSize; SDL_SetWindowMinimumSize; - SDL_SetWindowModalFor; + SDL_SetWindowModal; SDL_SetWindowMouseGrab; SDL_SetWindowMouseRect; SDL_SetWindowOpacity; + SDL_SetWindowParent; SDL_SetWindowPosition; SDL_SetWindowRelativeMouseMode; SDL_SetWindowResizable; @@ -919,6 +945,7 @@ SDL3_0.0.0 { SDL_UnlockTexture; SDL_UnmapGPUTransferBuffer; SDL_UnregisterApp; + SDL_UnsetEnvironmentVariable; SDL_UpdateGamepads; SDL_UpdateHapticEffect; SDL_UpdateJoysticks; @@ -943,6 +970,7 @@ SDL3_0.0.0 { SDL_WaitEventTimeout; SDL_WaitForGPUFences; SDL_WaitForGPUIdle; + SDL_WaitProcess; SDL_WaitSemaphore; SDL_WaitSemaphoreTimeout; SDL_WaitThread; @@ -1005,6 +1033,7 @@ SDL3_0.0.0 { SDL_fmodf; SDL_free; SDL_getenv; + SDL_getenv_unsafe; SDL_hid_ble_scan; SDL_hid_close; SDL_hid_device_change_count; @@ -1079,7 +1108,7 @@ SDL3_0.0.0 { SDL_roundf; SDL_scalbn; SDL_scalbnf; - SDL_setenv; + SDL_setenv_unsafe; SDL_sin; SDL_sinf; SDL_snprintf; @@ -1101,6 +1130,7 @@ SDL3_0.0.0 { SDL_strndup; SDL_strnlen; SDL_strnstr; + SDL_strpbrk; SDL_strrchr; SDL_strrev; SDL_strstr; @@ -1121,7 +1151,7 @@ SDL3_0.0.0 { SDL_uitoa; SDL_ulltoa; SDL_ultoa; - SDL_unsetenv; + SDL_unsetenv_unsafe; SDL_utf8strlcpy; SDL_utf8strlen; SDL_utf8strnlen; diff --git a/src/dynapi/SDL_dynapi_overrides.h b/src/dynapi/SDL_dynapi_overrides.h index a4b486ad..4b59a825 100644 --- a/src/dynapi/SDL_dynapi_overrides.h +++ b/src/dynapi/SDL_dynapi_overrides.h @@ -30,6 +30,7 @@ #define SDL_AcquireCameraFrame SDL_AcquireCameraFrame_REAL #define SDL_AcquireGPUCommandBuffer SDL_AcquireGPUCommandBuffer_REAL #define SDL_AcquireGPUSwapchainTexture SDL_AcquireGPUSwapchainTexture_REAL +#define SDL_AddAtomicInt SDL_AddAtomicInt_REAL #define SDL_AddEventWatch SDL_AddEventWatch_REAL #define SDL_AddGamepadMapping SDL_AddGamepadMapping_REAL #define SDL_AddGamepadMappingsFromFile SDL_AddGamepadMappingsFromFile_REAL @@ -39,13 +40,6 @@ #define SDL_AddTimer SDL_AddTimer_REAL #define SDL_AddTimerNS SDL_AddTimerNS_REAL #define SDL_AddVulkanRenderSemaphores SDL_AddVulkanRenderSemaphores_REAL -#define SDL_AtomicAdd SDL_AtomicAdd_REAL -#define SDL_AtomicCompareAndSwap SDL_AtomicCompareAndSwap_REAL -#define SDL_AtomicCompareAndSwapPointer SDL_AtomicCompareAndSwapPointer_REAL -#define SDL_AtomicGet SDL_AtomicGet_REAL -#define SDL_AtomicGetPointer SDL_AtomicGetPointer_REAL -#define SDL_AtomicSet SDL_AtomicSet_REAL -#define SDL_AtomicSetPointer SDL_AtomicSetPointer_REAL #define SDL_AttachVirtualJoystick SDL_AttachVirtualJoystick_REAL #define SDL_AudioDevicePaused SDL_AudioDevicePaused_REAL #define SDL_BeginGPUComputePass SDL_BeginGPUComputePass_REAL @@ -54,6 +48,7 @@ #define SDL_BindAudioStream SDL_BindAudioStream_REAL #define SDL_BindAudioStreams SDL_BindAudioStreams_REAL #define SDL_BindGPUComputePipeline SDL_BindGPUComputePipeline_REAL +#define SDL_BindGPUComputeSamplers SDL_BindGPUComputeSamplers_REAL #define SDL_BindGPUComputeStorageBuffers SDL_BindGPUComputeStorageBuffers_REAL #define SDL_BindGPUComputeStorageTextures SDL_BindGPUComputeStorageTextures_REAL #define SDL_BindGPUFragmentSamplers SDL_BindGPUFragmentSamplers_REAL @@ -91,6 +86,9 @@ #define SDL_CloseJoystick SDL_CloseJoystick_REAL #define SDL_CloseSensor SDL_CloseSensor_REAL #define SDL_CloseStorage SDL_CloseStorage_REAL +#define SDL_CompareAndSwapAtomicInt SDL_CompareAndSwapAtomicInt_REAL +#define SDL_CompareAndSwapAtomicPointer SDL_CompareAndSwapAtomicPointer_REAL +#define SDL_CompareAndSwapAtomicU32 SDL_CompareAndSwapAtomicU32_REAL #define SDL_ComposeCustomBlendMode SDL_ComposeCustomBlendMode_REAL #define SDL_ConvertAudioSamples SDL_ConvertAudioSamples_REAL #define SDL_ConvertEventToRenderCoordinates SDL_ConvertEventToRenderCoordinates_REAL @@ -108,6 +106,7 @@ #define SDL_CreateCondition SDL_CreateCondition_REAL #define SDL_CreateCursor SDL_CreateCursor_REAL #define SDL_CreateDirectory SDL_CreateDirectory_REAL +#define SDL_CreateEnvironment SDL_CreateEnvironment_REAL #define SDL_CreateGPUBuffer SDL_CreateGPUBuffer_REAL #define SDL_CreateGPUComputePipeline SDL_CreateGPUComputePipeline_REAL #define SDL_CreateGPUDevice SDL_CreateGPUDevice_REAL @@ -121,6 +120,8 @@ #define SDL_CreateMutex SDL_CreateMutex_REAL #define SDL_CreatePalette SDL_CreatePalette_REAL #define SDL_CreatePopupWindow SDL_CreatePopupWindow_REAL +#define SDL_CreateProcess SDL_CreateProcess_REAL +#define SDL_CreateProcessWithProperties SDL_CreateProcessWithProperties_REAL #define SDL_CreateProperties SDL_CreateProperties_REAL #define SDL_CreateRWLock SDL_CreateRWLock_REAL #define SDL_CreateRenderer SDL_CreateRenderer_REAL @@ -142,17 +143,17 @@ #define SDL_CreateWindowWithProperties SDL_CreateWindowWithProperties_REAL #define SDL_CursorVisible SDL_CursorVisible_REAL #define SDL_DateTimeToTime SDL_DateTimeToTime_REAL -#define SDL_RemoveEventWatch SDL_RemoveEventWatch_REAL -#define SDL_RemoveHintCallback SDL_RemoveHintCallback_REAL #define SDL_Delay SDL_Delay_REAL #define SDL_DelayNS SDL_DelayNS_REAL #define SDL_DestroyAudioStream SDL_DestroyAudioStream_REAL #define SDL_DestroyCondition SDL_DestroyCondition_REAL #define SDL_DestroyCursor SDL_DestroyCursor_REAL +#define SDL_DestroyEnvironment SDL_DestroyEnvironment_REAL #define SDL_DestroyGPUDevice SDL_DestroyGPUDevice_REAL #define SDL_DestroyHapticEffect SDL_DestroyHapticEffect_REAL #define SDL_DestroyMutex SDL_DestroyMutex_REAL #define SDL_DestroyPalette SDL_DestroyPalette_REAL +#define SDL_DestroyProcess SDL_DestroyProcess_REAL #define SDL_DestroyProperties SDL_DestroyProperties_REAL #define SDL_DestroyRWLock SDL_DestroyRWLock_REAL #define SDL_DestroyRenderer SDL_DestroyRenderer_REAL @@ -195,6 +196,7 @@ #define SDL_FlushAudioStream SDL_FlushAudioStream_REAL #define SDL_FlushEvent SDL_FlushEvent_REAL #define SDL_FlushEvents SDL_FlushEvents_REAL +#define SDL_FlushIO SDL_FlushIO_REAL #define SDL_FlushRenderer SDL_FlushRenderer_REAL #define SDL_GDKResumeGPU SDL_GDKResumeGPU_REAL #define SDL_GDKSuspendComplete SDL_GDKSuspendComplete_REAL @@ -214,6 +216,8 @@ #define SDL_GL_SetSwapInterval SDL_GL_SetSwapInterval_REAL #define SDL_GL_SwapWindow SDL_GL_SwapWindow_REAL #define SDL_GL_UnloadLibrary SDL_GL_UnloadLibrary_REAL +#define SDL_GPUSupportsProperties SDL_GPUSupportsProperties_REAL +#define SDL_GPUSupportsShaderFormats SDL_GPUSupportsShaderFormats_REAL #define SDL_GPUTextureFormatTexelBlockSize SDL_GPUTextureFormatTexelBlockSize_REAL #define SDL_GPUTextureSupportsFormat SDL_GPUTextureSupportsFormat_REAL #define SDL_GPUTextureSupportsSampleCount SDL_GPUTextureSupportsSampleCount_REAL @@ -235,6 +239,9 @@ #define SDL_GetAppMetadataProperty SDL_GetAppMetadataProperty_REAL #define SDL_GetAssertionHandler SDL_GetAssertionHandler_REAL #define SDL_GetAssertionReport SDL_GetAssertionReport_REAL +#define SDL_GetAtomicInt SDL_GetAtomicInt_REAL +#define SDL_GetAtomicPointer SDL_GetAtomicPointer_REAL +#define SDL_GetAtomicU32 SDL_GetAtomicU32_REAL #define SDL_GetAudioDeviceChannelMap SDL_GetAudioDeviceChannelMap_REAL #define SDL_GetAudioDeviceFormat SDL_GetAudioDeviceFormat_REAL #define SDL_GetAudioDeviceGain SDL_GetAudioDeviceGain_REAL @@ -256,7 +263,6 @@ #define SDL_GetBasePath SDL_GetBasePath_REAL #define SDL_GetBooleanProperty SDL_GetBooleanProperty_REAL #define SDL_GetCPUCacheLineSize SDL_GetCPUCacheLineSize_REAL -#define SDL_GetCPUCount SDL_GetCPUCount_REAL #define SDL_GetCameraDriver SDL_GetCameraDriver_REAL #define SDL_GetCameraFormat SDL_GetCameraFormat_REAL #define SDL_GetCameraID SDL_GetCameraID_REAL @@ -296,13 +302,18 @@ #define SDL_GetDisplayProperties SDL_GetDisplayProperties_REAL #define SDL_GetDisplayUsableBounds SDL_GetDisplayUsableBounds_REAL #define SDL_GetDisplays SDL_GetDisplays_REAL +#define SDL_GetEnvironment SDL_GetEnvironment_REAL +#define SDL_GetEnvironmentVariable SDL_GetEnvironmentVariable_REAL +#define SDL_GetEnvironmentVariables SDL_GetEnvironmentVariables_REAL #define SDL_GetError SDL_GetError_REAL #define SDL_GetEventFilter SDL_GetEventFilter_REAL #define SDL_GetFloatProperty SDL_GetFloatProperty_REAL #define SDL_GetFullscreenDisplayModes SDL_GetFullscreenDisplayModes_REAL #define SDL_GetGDKDefaultUser SDL_GetGDKDefaultUser_REAL #define SDL_GetGDKTaskQueue SDL_GetGDKTaskQueue_REAL +#define SDL_GetGPUDeviceDriver SDL_GetGPUDeviceDriver_REAL #define SDL_GetGPUDriver SDL_GetGPUDriver_REAL +#define SDL_GetGPUShaderFormats SDL_GetGPUShaderFormats_REAL #define SDL_GetGPUSwapchainTextureFormat SDL_GetGPUSwapchainTextureFormat_REAL #define SDL_GetGamepadAppleSFSymbolsNameForAxis SDL_GetGamepadAppleSFSymbolsNameForAxis_REAL #define SDL_GetGamepadAppleSFSymbolsNameForButton SDL_GetGamepadAppleSFSymbolsNameForButton_REAL @@ -418,6 +429,7 @@ #define SDL_GetNumAllocations SDL_GetNumAllocations_REAL #define SDL_GetNumAudioDrivers SDL_GetNumAudioDrivers_REAL #define SDL_GetNumCameraDrivers SDL_GetNumCameraDrivers_REAL +#define SDL_GetNumGPUDrivers SDL_GetNumGPUDrivers_REAL #define SDL_GetNumGamepadTouchpadFingers SDL_GetNumGamepadTouchpadFingers_REAL #define SDL_GetNumGamepadTouchpads SDL_GetNumGamepadTouchpads_REAL #define SDL_GetNumHapticAxes SDL_GetNumHapticAxes_REAL @@ -425,6 +437,7 @@ #define SDL_GetNumJoystickBalls SDL_GetNumJoystickBalls_REAL #define SDL_GetNumJoystickButtons SDL_GetNumJoystickButtons_REAL #define SDL_GetNumJoystickHats SDL_GetNumJoystickHats_REAL +#define SDL_GetNumLogicalCPUCores SDL_GetNumLogicalCPUCores_REAL #define SDL_GetNumRenderDrivers SDL_GetNumRenderDrivers_REAL #define SDL_GetNumVideoDrivers SDL_GetNumVideoDrivers_REAL #define SDL_GetNumberProperty SDL_GetNumberProperty_REAL @@ -442,6 +455,9 @@ #define SDL_GetPreferredLocales SDL_GetPreferredLocales_REAL #define SDL_GetPrimaryDisplay SDL_GetPrimaryDisplay_REAL #define SDL_GetPrimarySelectionText SDL_GetPrimarySelectionText_REAL +#define SDL_GetProcessInput SDL_GetProcessInput_REAL +#define SDL_GetProcessOutput SDL_GetProcessOutput_REAL +#define SDL_GetProcessProperties SDL_GetProcessProperties_REAL #define SDL_GetPropertyType SDL_GetPropertyType_REAL #define SDL_GetRGB SDL_GetRGB_REAL #define SDL_GetRGBA SDL_GetRGBA_REAL @@ -531,8 +547,6 @@ #define SDL_GetUserFolder SDL_GetUserFolder_REAL #define SDL_GetVersion SDL_GetVersion_REAL #define SDL_GetVideoDriver SDL_GetVideoDriver_REAL -#define SDL_GetWinRTDeviceFamily SDL_GetWinRTDeviceFamily_REAL -#define SDL_GetWinRTFSPath SDL_GetWinRTFSPath_REAL #define SDL_GetWindowAspectRatio SDL_GetWindowAspectRatio_REAL #define SDL_GetWindowBordersSize SDL_GetWindowBordersSize_REAL #define SDL_GetWindowDisplayScale SDL_GetWindowDisplayScale_REAL @@ -614,6 +628,7 @@ #define SDL_IsTablet SDL_IsTablet_REAL #define SDL_JoystickConnected SDL_JoystickConnected_REAL #define SDL_JoystickEventsEnabled SDL_JoystickEventsEnabled_REAL +#define SDL_KillProcess SDL_KillProcess_REAL #define SDL_LoadBMP SDL_LoadBMP_REAL #define SDL_LoadBMP_IO SDL_LoadBMP_IO_REAL #define SDL_LoadFile SDL_LoadFile_REAL @@ -639,6 +654,7 @@ #define SDL_LogInfo SDL_LogInfo_REAL #define SDL_LogMessage SDL_LogMessage_REAL #define SDL_LogMessageV SDL_LogMessageV_REAL +#define SDL_LogTrace SDL_LogTrace_REAL #define SDL_LogVerbose SDL_LogVerbose_REAL #define SDL_LogWarn SDL_LogWarn_REAL #define SDL_MapGPUTransferBuffer SDL_MapGPUTransferBuffer_REAL @@ -698,6 +714,7 @@ #define SDL_QuitSubSystem SDL_QuitSubSystem_REAL #define SDL_RaiseWindow SDL_RaiseWindow_REAL #define SDL_ReadIO SDL_ReadIO_REAL +#define SDL_ReadProcess SDL_ReadProcess_REAL #define SDL_ReadS16BE SDL_ReadS16BE_REAL #define SDL_ReadS16LE SDL_ReadS16LE_REAL #define SDL_ReadS32BE SDL_ReadS32BE_REAL @@ -728,6 +745,8 @@ #define SDL_ReleaseGPUTransferBuffer SDL_ReleaseGPUTransferBuffer_REAL #define SDL_ReleaseWindowFromGPUDevice SDL_ReleaseWindowFromGPUDevice_REAL #define SDL_ReloadGamepadMappings SDL_ReloadGamepadMappings_REAL +#define SDL_RemoveEventWatch SDL_RemoveEventWatch_REAL +#define SDL_RemoveHintCallback SDL_RemoveHintCallback_REAL #define SDL_RemovePath SDL_RemovePath_REAL #define SDL_RemoveStoragePath SDL_RemoveStoragePath_REAL #define SDL_RemoveSurfaceAlternateImages SDL_RemoveSurfaceAlternateImages_REAL @@ -786,6 +805,9 @@ #define SDL_SetAppMetadata SDL_SetAppMetadata_REAL #define SDL_SetAppMetadataProperty SDL_SetAppMetadataProperty_REAL #define SDL_SetAssertionHandler SDL_SetAssertionHandler_REAL +#define SDL_SetAtomicInt SDL_SetAtomicInt_REAL +#define SDL_SetAtomicPointer SDL_SetAtomicPointer_REAL +#define SDL_SetAtomicU32 SDL_SetAtomicU32_REAL #define SDL_SetAudioDeviceGain SDL_SetAudioDeviceGain_REAL #define SDL_SetAudioPostmixCallback SDL_SetAudioPostmixCallback_REAL #define SDL_SetAudioStreamFormat SDL_SetAudioStreamFormat_REAL @@ -799,12 +821,15 @@ #define SDL_SetClipboardData SDL_SetClipboardData_REAL #define SDL_SetClipboardText SDL_SetClipboardText_REAL #define SDL_SetCursor SDL_SetCursor_REAL +#define SDL_SetEnvironmentVariable SDL_SetEnvironmentVariable_REAL #define SDL_SetError SDL_SetError_REAL #define SDL_SetEventEnabled SDL_SetEventEnabled_REAL #define SDL_SetEventFilter SDL_SetEventFilter_REAL #define SDL_SetFloatProperty SDL_SetFloatProperty_REAL +#define SDL_SetGPUBlendConstants SDL_SetGPUBlendConstants_REAL #define SDL_SetGPUBufferName SDL_SetGPUBufferName_REAL #define SDL_SetGPUScissor SDL_SetGPUScissor_REAL +#define SDL_SetGPUStencilReference SDL_SetGPUStencilReference_REAL #define SDL_SetGPUSwapchainParameters SDL_SetGPUSwapchainParameters_REAL #define SDL_SetGPUTextureName SDL_SetGPUTextureName_REAL #define SDL_SetGPUViewport SDL_SetGPUViewport_REAL @@ -879,10 +904,11 @@ #define SDL_SetWindowKeyboardGrab SDL_SetWindowKeyboardGrab_REAL #define SDL_SetWindowMaximumSize SDL_SetWindowMaximumSize_REAL #define SDL_SetWindowMinimumSize SDL_SetWindowMinimumSize_REAL -#define SDL_SetWindowModalFor SDL_SetWindowModalFor_REAL +#define SDL_SetWindowModal SDL_SetWindowModal_REAL #define SDL_SetWindowMouseGrab SDL_SetWindowMouseGrab_REAL #define SDL_SetWindowMouseRect SDL_SetWindowMouseRect_REAL #define SDL_SetWindowOpacity SDL_SetWindowOpacity_REAL +#define SDL_SetWindowParent SDL_SetWindowParent_REAL #define SDL_SetWindowPosition SDL_SetWindowPosition_REAL #define SDL_SetWindowRelativeMouseMode SDL_SetWindowRelativeMouseMode_REAL #define SDL_SetWindowResizable SDL_SetWindowResizable_REAL @@ -944,6 +970,7 @@ #define SDL_UnlockTexture SDL_UnlockTexture_REAL #define SDL_UnmapGPUTransferBuffer SDL_UnmapGPUTransferBuffer_REAL #define SDL_UnregisterApp SDL_UnregisterApp_REAL +#define SDL_UnsetEnvironmentVariable SDL_UnsetEnvironmentVariable_REAL #define SDL_UpdateGamepads SDL_UpdateGamepads_REAL #define SDL_UpdateHapticEffect SDL_UpdateHapticEffect_REAL #define SDL_UpdateJoysticks SDL_UpdateJoysticks_REAL @@ -968,6 +995,7 @@ #define SDL_WaitEventTimeout SDL_WaitEventTimeout_REAL #define SDL_WaitForGPUFences SDL_WaitForGPUFences_REAL #define SDL_WaitForGPUIdle SDL_WaitForGPUIdle_REAL +#define SDL_WaitProcess SDL_WaitProcess_REAL #define SDL_WaitSemaphore SDL_WaitSemaphore_REAL #define SDL_WaitSemaphoreTimeout SDL_WaitSemaphoreTimeout_REAL #define SDL_WaitThread SDL_WaitThread_REAL @@ -1030,6 +1058,7 @@ #define SDL_fmodf SDL_fmodf_REAL #define SDL_free SDL_free_REAL #define SDL_getenv SDL_getenv_REAL +#define SDL_getenv_unsafe SDL_getenv_unsafe_REAL #define SDL_hid_ble_scan SDL_hid_ble_scan_REAL #define SDL_hid_close SDL_hid_close_REAL #define SDL_hid_device_change_count SDL_hid_device_change_count_REAL @@ -1104,7 +1133,7 @@ #define SDL_roundf SDL_roundf_REAL #define SDL_scalbn SDL_scalbn_REAL #define SDL_scalbnf SDL_scalbnf_REAL -#define SDL_setenv SDL_setenv_REAL +#define SDL_setenv_unsafe SDL_setenv_unsafe_REAL #define SDL_sin SDL_sin_REAL #define SDL_sinf SDL_sinf_REAL #define SDL_snprintf SDL_snprintf_REAL @@ -1126,6 +1155,7 @@ #define SDL_strndup SDL_strndup_REAL #define SDL_strnlen SDL_strnlen_REAL #define SDL_strnstr SDL_strnstr_REAL +#define SDL_strpbrk SDL_strpbrk_REAL #define SDL_strrchr SDL_strrchr_REAL #define SDL_strrev SDL_strrev_REAL #define SDL_strstr SDL_strstr_REAL @@ -1146,7 +1176,7 @@ #define SDL_uitoa SDL_uitoa_REAL #define SDL_ulltoa SDL_ulltoa_REAL #define SDL_ultoa SDL_ultoa_REAL -#define SDL_unsetenv SDL_unsetenv_REAL +#define SDL_unsetenv_unsafe SDL_unsetenv_unsafe_REAL #define SDL_utf8strlcpy SDL_utf8strlcpy_REAL #define SDL_utf8strlen SDL_utf8strlen_REAL #define SDL_utf8strnlen SDL_utf8strnlen_REAL diff --git a/src/dynapi/SDL_dynapi_procs.h b/src/dynapi/SDL_dynapi_procs.h index 07a6a5a8..051f0b9c 100644 --- a/src/dynapi/SDL_dynapi_procs.h +++ b/src/dynapi/SDL_dynapi_procs.h @@ -37,9 +37,10 @@ SDL_DYNAPI_PROC(void,SDL_LogDebug,(int a, SDL_PRINTF_FORMAT_STRING const char *b SDL_DYNAPI_PROC(void,SDL_LogError,(int a, SDL_PRINTF_FORMAT_STRING const char *b, ...),(a,b),) SDL_DYNAPI_PROC(void,SDL_LogInfo,(int a, SDL_PRINTF_FORMAT_STRING const char *b, ...),(a,b),) SDL_DYNAPI_PROC(void,SDL_LogMessage,(int a, SDL_LogPriority b, SDL_PRINTF_FORMAT_STRING const char *c, ...),(a,b,c),) +SDL_DYNAPI_PROC(void,SDL_LogTrace,(int a, SDL_PRINTF_FORMAT_STRING const char *b, ...),(a,b),) SDL_DYNAPI_PROC(void,SDL_LogVerbose,(int a, SDL_PRINTF_FORMAT_STRING const char *b, ...),(a,b),) SDL_DYNAPI_PROC(void,SDL_LogWarn,(int a, SDL_PRINTF_FORMAT_STRING const char *b, ...),(a,b),) -SDL_DYNAPI_PROC(SDL_bool,SDL_SetError,(SDL_PRINTF_FORMAT_STRING const char *a, ...),(a),return) +SDL_DYNAPI_PROC(bool,SDL_SetError,(SDL_PRINTF_FORMAT_STRING const char *a, ...),(a),return) SDL_DYNAPI_PROC(int,SDL_asprintf,(char **a, SDL_PRINTF_FORMAT_STRING const char *b, ...),(a,b),return) SDL_DYNAPI_PROC(int,SDL_snprintf,(SDL_OUT_Z_CAP(b) char *a, size_t b, SDL_PRINTF_FORMAT_STRING const char *c, ...),(a,b,c),return) SDL_DYNAPI_PROC(int,SDL_sscanf,(const char *a, SDL_SCANF_FORMAT_STRING const char *b, ...),(a,b),return) @@ -50,104 +51,105 @@ SDL_DYNAPI_PROC(int,SDL_swprintf,(SDL_OUT_Z_CAP(b) wchar_t *a, size_t b, SDL_PRI SDL_DYNAPI_PROC(SDL_Surface*,SDL_AcquireCameraFrame,(SDL_Camera *a, Uint64 *b),(a,b),return) SDL_DYNAPI_PROC(SDL_GPUCommandBuffer*,SDL_AcquireGPUCommandBuffer,(SDL_GPUDevice *a),(a),return) SDL_DYNAPI_PROC(SDL_GPUTexture*,SDL_AcquireGPUSwapchainTexture,(SDL_GPUCommandBuffer *a, SDL_Window *b, Uint32 *c, Uint32 *d),(a,b,c,d),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_AddEventWatch,(SDL_EventFilter a, void *b),(a,b),return) +SDL_DYNAPI_PROC(int,SDL_AddAtomicInt,(SDL_AtomicInt *a, int b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_AddEventWatch,(SDL_EventFilter a, void *b),(a,b),return) SDL_DYNAPI_PROC(int,SDL_AddGamepadMapping,(const char *a),(a),return) SDL_DYNAPI_PROC(int,SDL_AddGamepadMappingsFromFile,(const char *a),(a),return) -SDL_DYNAPI_PROC(int,SDL_AddGamepadMappingsFromIO,(SDL_IOStream *a, SDL_bool b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_AddHintCallback,(const char *a, SDL_HintCallback b, void *c),(a,b,c),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_AddSurfaceAlternateImage,(SDL_Surface *a, SDL_Surface *b),(a,b),return) +SDL_DYNAPI_PROC(int,SDL_AddGamepadMappingsFromIO,(SDL_IOStream *a, bool b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_AddHintCallback,(const char *a, SDL_HintCallback b, void *c),(a,b,c),return) +SDL_DYNAPI_PROC(bool,SDL_AddSurfaceAlternateImage,(SDL_Surface *a, SDL_Surface *b),(a,b),return) SDL_DYNAPI_PROC(SDL_TimerID,SDL_AddTimer,(Uint32 a, SDL_TimerCallback b, void *c),(a,b,c),return) SDL_DYNAPI_PROC(SDL_TimerID,SDL_AddTimerNS,(Uint64 a, SDL_NSTimerCallback b, void *c),(a,b,c),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_AddVulkanRenderSemaphores,(SDL_Renderer *a, Uint32 b, Sint64 c, Sint64 d),(a,b,c,d),return) -SDL_DYNAPI_PROC(int,SDL_AtomicAdd,(SDL_AtomicInt *a, int b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_AtomicCompareAndSwap,(SDL_AtomicInt *a, int b, int c),(a,b,c),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_AtomicCompareAndSwapPointer,(void **a, void *b, void *c),(a,b,c),return) -SDL_DYNAPI_PROC(int,SDL_AtomicGet,(SDL_AtomicInt *a),(a),return) -SDL_DYNAPI_PROC(void*,SDL_AtomicGetPointer,(void **a),(a),return) -SDL_DYNAPI_PROC(int,SDL_AtomicSet,(SDL_AtomicInt *a, int b),(a,b),return) -SDL_DYNAPI_PROC(void*,SDL_AtomicSetPointer,(void **a, void *b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_AddVulkanRenderSemaphores,(SDL_Renderer *a, Uint32 b, Sint64 c, Sint64 d),(a,b,c,d),return) SDL_DYNAPI_PROC(SDL_JoystickID,SDL_AttachVirtualJoystick,(const SDL_VirtualJoystickDesc *a),(a),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_AudioDevicePaused,(SDL_AudioDeviceID a),(a),return) -SDL_DYNAPI_PROC(SDL_GPUComputePass*,SDL_BeginGPUComputePass,(SDL_GPUCommandBuffer *a, SDL_GPUStorageTextureWriteOnlyBinding *b, Uint32 c, SDL_GPUStorageBufferWriteOnlyBinding *d, Uint32 e),(a,b,c,d,e),return) +SDL_DYNAPI_PROC(bool,SDL_AudioDevicePaused,(SDL_AudioDeviceID a),(a),return) +SDL_DYNAPI_PROC(SDL_GPUComputePass*,SDL_BeginGPUComputePass,(SDL_GPUCommandBuffer *a, const SDL_GPUStorageTextureWriteOnlyBinding *b, Uint32 c, const SDL_GPUStorageBufferWriteOnlyBinding *d, Uint32 e),(a,b,c,d,e),return) SDL_DYNAPI_PROC(SDL_GPUCopyPass*,SDL_BeginGPUCopyPass,(SDL_GPUCommandBuffer *a),(a),return) -SDL_DYNAPI_PROC(SDL_GPURenderPass*,SDL_BeginGPURenderPass,(SDL_GPUCommandBuffer *a, SDL_GPUColorAttachmentInfo *b, Uint32 c, SDL_GPUDepthStencilAttachmentInfo *d),(a,b,c,d),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_BindAudioStream,(SDL_AudioDeviceID a, SDL_AudioStream *b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_BindAudioStreams,(SDL_AudioDeviceID a, SDL_AudioStream **b, int c),(a,b,c),return) +SDL_DYNAPI_PROC(SDL_GPURenderPass*,SDL_BeginGPURenderPass,(SDL_GPUCommandBuffer *a, const SDL_GPUColorTargetInfo *b, Uint32 c, const SDL_GPUDepthStencilTargetInfo *d),(a,b,c,d),return) +SDL_DYNAPI_PROC(bool,SDL_BindAudioStream,(SDL_AudioDeviceID a, SDL_AudioStream *b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_BindAudioStreams,(SDL_AudioDeviceID a, SDL_AudioStream **b, int c),(a,b,c),return) SDL_DYNAPI_PROC(void,SDL_BindGPUComputePipeline,(SDL_GPUComputePass *a, SDL_GPUComputePipeline *b),(a,b),) -SDL_DYNAPI_PROC(void,SDL_BindGPUComputeStorageBuffers,(SDL_GPUComputePass *a, Uint32 b, SDL_GPUBuffer **c, Uint32 d),(a,b,c,d),) -SDL_DYNAPI_PROC(void,SDL_BindGPUComputeStorageTextures,(SDL_GPUComputePass *a, Uint32 b, SDL_GPUTexture **c, Uint32 d),(a,b,c,d),) -SDL_DYNAPI_PROC(void,SDL_BindGPUFragmentSamplers,(SDL_GPURenderPass *a, Uint32 b, SDL_GPUTextureSamplerBinding *c, Uint32 d),(a,b,c,d),) -SDL_DYNAPI_PROC(void,SDL_BindGPUFragmentStorageBuffers,(SDL_GPURenderPass *a, Uint32 b, SDL_GPUBuffer **c, Uint32 d),(a,b,c,d),) -SDL_DYNAPI_PROC(void,SDL_BindGPUFragmentStorageTextures,(SDL_GPURenderPass *a, Uint32 b, SDL_GPUTexture **c, Uint32 d),(a,b,c,d),) +SDL_DYNAPI_PROC(void,SDL_BindGPUComputeSamplers,(SDL_GPUComputePass *a, Uint32 b, const SDL_GPUTextureSamplerBinding *c, Uint32 d),(a,b,c,d),) +SDL_DYNAPI_PROC(void,SDL_BindGPUComputeStorageBuffers,(SDL_GPUComputePass *a, Uint32 b, SDL_GPUBuffer *const *c, Uint32 d),(a,b,c,d),) +SDL_DYNAPI_PROC(void,SDL_BindGPUComputeStorageTextures,(SDL_GPUComputePass *a, Uint32 b, SDL_GPUTexture *const *c, Uint32 d),(a,b,c,d),) +SDL_DYNAPI_PROC(void,SDL_BindGPUFragmentSamplers,(SDL_GPURenderPass *a, Uint32 b, const SDL_GPUTextureSamplerBinding *c, Uint32 d),(a,b,c,d),) +SDL_DYNAPI_PROC(void,SDL_BindGPUFragmentStorageBuffers,(SDL_GPURenderPass *a, Uint32 b, SDL_GPUBuffer *const *c, Uint32 d),(a,b,c,d),) +SDL_DYNAPI_PROC(void,SDL_BindGPUFragmentStorageTextures,(SDL_GPURenderPass *a, Uint32 b, SDL_GPUTexture *const *c, Uint32 d),(a,b,c,d),) SDL_DYNAPI_PROC(void,SDL_BindGPUGraphicsPipeline,(SDL_GPURenderPass *a, SDL_GPUGraphicsPipeline *b),(a,b),) -SDL_DYNAPI_PROC(void,SDL_BindGPUIndexBuffer,(SDL_GPURenderPass *a, SDL_GPUBufferBinding *b, SDL_GPUIndexElementSize c),(a,b,c),) -SDL_DYNAPI_PROC(void,SDL_BindGPUVertexBuffers,(SDL_GPURenderPass *a, Uint32 b, SDL_GPUBufferBinding *c, Uint32 d),(a,b,c,d),) -SDL_DYNAPI_PROC(void,SDL_BindGPUVertexSamplers,(SDL_GPURenderPass *a, Uint32 b, SDL_GPUTextureSamplerBinding *c, Uint32 d),(a,b,c,d),) -SDL_DYNAPI_PROC(void,SDL_BindGPUVertexStorageBuffers,(SDL_GPURenderPass *a, Uint32 b, SDL_GPUBuffer **c, Uint32 d),(a,b,c,d),) -SDL_DYNAPI_PROC(void,SDL_BindGPUVertexStorageTextures,(SDL_GPURenderPass *a, Uint32 b, SDL_GPUTexture **c, Uint32 d),(a,b,c,d),) -SDL_DYNAPI_PROC(void,SDL_BlitGPUTexture,(SDL_GPUCommandBuffer *a, SDL_GPUBlitRegion *b, SDL_GPUBlitRegion *c, SDL_FlipMode d, SDL_GPUFilter e, SDL_bool f),(a,b,c,d,e,f),) -SDL_DYNAPI_PROC(SDL_bool,SDL_BlitSurface,(SDL_Surface *a, const SDL_Rect *b, SDL_Surface *c, const SDL_Rect *d),(a,b,c,d),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_BlitSurface9Grid,(SDL_Surface *a, const SDL_Rect *b, int c, int d, int e, int f, float g, SDL_ScaleMode h, SDL_Surface *i, const SDL_Rect *j),(a,b,c,d,e,f,g,h,i,j),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_BlitSurfaceScaled,(SDL_Surface *a, const SDL_Rect *b, SDL_Surface *c, const SDL_Rect *d, SDL_ScaleMode e),(a,b,c,d,e),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_BlitSurfaceTiled,(SDL_Surface *a, const SDL_Rect *b, SDL_Surface *c, const SDL_Rect *d),(a,b,c,d),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_BlitSurfaceTiledWithScale,(SDL_Surface *a, const SDL_Rect *b, float c, SDL_ScaleMode d, SDL_Surface *e, const SDL_Rect *f),(a,b,c,d,e,f),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_BlitSurfaceUnchecked,(SDL_Surface *a, const SDL_Rect *b, SDL_Surface *c, const SDL_Rect *d),(a,b,c,d),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_BlitSurfaceUncheckedScaled,(SDL_Surface *a, const SDL_Rect *b, SDL_Surface *c, const SDL_Rect *d, SDL_ScaleMode e),(a,b,c,d,e),return) +SDL_DYNAPI_PROC(void,SDL_BindGPUIndexBuffer,(SDL_GPURenderPass *a, const SDL_GPUBufferBinding *b, SDL_GPUIndexElementSize c),(a,b,c),) +SDL_DYNAPI_PROC(void,SDL_BindGPUVertexBuffers,(SDL_GPURenderPass *a, Uint32 b, const SDL_GPUBufferBinding *c, Uint32 d),(a,b,c,d),) +SDL_DYNAPI_PROC(void,SDL_BindGPUVertexSamplers,(SDL_GPURenderPass *a, Uint32 b, const SDL_GPUTextureSamplerBinding *c, Uint32 d),(a,b,c,d),) +SDL_DYNAPI_PROC(void,SDL_BindGPUVertexStorageBuffers,(SDL_GPURenderPass *a, Uint32 b, SDL_GPUBuffer *const *c, Uint32 d),(a,b,c,d),) +SDL_DYNAPI_PROC(void,SDL_BindGPUVertexStorageTextures,(SDL_GPURenderPass *a, Uint32 b, SDL_GPUTexture *const *c, Uint32 d),(a,b,c,d),) +SDL_DYNAPI_PROC(void,SDL_BlitGPUTexture,(SDL_GPUCommandBuffer *a, const SDL_GPUBlitInfo *b),(a,b),) +SDL_DYNAPI_PROC(bool,SDL_BlitSurface,(SDL_Surface *a, const SDL_Rect *b, SDL_Surface *c, const SDL_Rect *d),(a,b,c,d),return) +SDL_DYNAPI_PROC(bool,SDL_BlitSurface9Grid,(SDL_Surface *a, const SDL_Rect *b, int c, int d, int e, int f, float g, SDL_ScaleMode h, SDL_Surface *i, const SDL_Rect *j),(a,b,c,d,e,f,g,h,i,j),return) +SDL_DYNAPI_PROC(bool,SDL_BlitSurfaceScaled,(SDL_Surface *a, const SDL_Rect *b, SDL_Surface *c, const SDL_Rect *d, SDL_ScaleMode e),(a,b,c,d,e),return) +SDL_DYNAPI_PROC(bool,SDL_BlitSurfaceTiled,(SDL_Surface *a, const SDL_Rect *b, SDL_Surface *c, const SDL_Rect *d),(a,b,c,d),return) +SDL_DYNAPI_PROC(bool,SDL_BlitSurfaceTiledWithScale,(SDL_Surface *a, const SDL_Rect *b, float c, SDL_ScaleMode d, SDL_Surface *e, const SDL_Rect *f),(a,b,c,d,e,f),return) +SDL_DYNAPI_PROC(bool,SDL_BlitSurfaceUnchecked,(SDL_Surface *a, const SDL_Rect *b, SDL_Surface *c, const SDL_Rect *d),(a,b,c,d),return) +SDL_DYNAPI_PROC(bool,SDL_BlitSurfaceUncheckedScaled,(SDL_Surface *a, const SDL_Rect *b, SDL_Surface *c, const SDL_Rect *d, SDL_ScaleMode e),(a,b,c,d,e),return) SDL_DYNAPI_PROC(void,SDL_BroadcastCondition,(SDL_Condition *a),(a),) -SDL_DYNAPI_PROC(SDL_bool,SDL_CaptureMouse,(SDL_bool a),(a),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_ClaimWindowForGPUDevice,(SDL_GPUDevice *a, SDL_Window *b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_CaptureMouse,(bool a),(a),return) +SDL_DYNAPI_PROC(bool,SDL_ClaimWindowForGPUDevice,(SDL_GPUDevice *a, SDL_Window *b),(a,b),return) SDL_DYNAPI_PROC(void,SDL_CleanupTLS,(void),(),) -SDL_DYNAPI_PROC(SDL_bool,SDL_ClearAudioStream,(SDL_AudioStream *a),(a),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_ClearClipboardData,(void),(),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_ClearComposition,(SDL_Window *a),(a),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_ClearError,(void),(),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_ClearProperty,(SDL_PropertiesID a, const char *b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_ClearSurface,(SDL_Surface *a, float b, float c, float d, float e),(a,b,c,d,e),return) +SDL_DYNAPI_PROC(bool,SDL_ClearAudioStream,(SDL_AudioStream *a),(a),return) +SDL_DYNAPI_PROC(bool,SDL_ClearClipboardData,(void),(),return) +SDL_DYNAPI_PROC(bool,SDL_ClearComposition,(SDL_Window *a),(a),return) +SDL_DYNAPI_PROC(bool,SDL_ClearError,(void),(),return) +SDL_DYNAPI_PROC(bool,SDL_ClearProperty,(SDL_PropertiesID a, const char *b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_ClearSurface,(SDL_Surface *a, float b, float c, float d, float e),(a,b,c,d,e),return) SDL_DYNAPI_PROC(void,SDL_CloseAudioDevice,(SDL_AudioDeviceID a),(a),) SDL_DYNAPI_PROC(void,SDL_CloseCamera,(SDL_Camera *a),(a),) SDL_DYNAPI_PROC(void,SDL_CloseGamepad,(SDL_Gamepad *a),(a),) SDL_DYNAPI_PROC(void,SDL_CloseHaptic,(SDL_Haptic *a),(a),) -SDL_DYNAPI_PROC(SDL_bool,SDL_CloseIO,(SDL_IOStream *a),(a),return) +SDL_DYNAPI_PROC(bool,SDL_CloseIO,(SDL_IOStream *a),(a),return) SDL_DYNAPI_PROC(void,SDL_CloseJoystick,(SDL_Joystick *a),(a),) SDL_DYNAPI_PROC(void,SDL_CloseSensor,(SDL_Sensor *a),(a),) -SDL_DYNAPI_PROC(SDL_bool,SDL_CloseStorage,(SDL_Storage *a),(a),return) +SDL_DYNAPI_PROC(bool,SDL_CloseStorage,(SDL_Storage *a),(a),return) +SDL_DYNAPI_PROC(bool,SDL_CompareAndSwapAtomicInt,(SDL_AtomicInt *a, int b, int c),(a,b,c),return) +SDL_DYNAPI_PROC(bool,SDL_CompareAndSwapAtomicPointer,(void **a, void *b, void *c),(a,b,c),return) +SDL_DYNAPI_PROC(bool,SDL_CompareAndSwapAtomicU32,(SDL_AtomicU32 *a, Uint32 b, Uint32 c),(a,b,c),return) SDL_DYNAPI_PROC(SDL_BlendMode,SDL_ComposeCustomBlendMode,(SDL_BlendFactor a, SDL_BlendFactor b, SDL_BlendOperation c, SDL_BlendFactor d, SDL_BlendFactor e, SDL_BlendOperation f),(a,b,c,d,e,f),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_ConvertAudioSamples,(const SDL_AudioSpec *a, const Uint8 *b, int c, const SDL_AudioSpec *d, Uint8 **e, int *f),(a,b,c,d,e,f),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_ConvertEventToRenderCoordinates,(SDL_Renderer *a, SDL_Event *b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_ConvertPixels,(int a, int b, SDL_PixelFormat c, const void *d, int e, SDL_PixelFormat f, void *g, int h),(a,b,c,d,e,f,g,h),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_ConvertPixelsAndColorspace,(int a, int b, SDL_PixelFormat c, SDL_Colorspace d, SDL_PropertiesID e, const void *f, int g, SDL_PixelFormat h, SDL_Colorspace i, SDL_PropertiesID j, void *k, int l),(a,b,c,d,e,f,g,h,i,j,k,l),return) +SDL_DYNAPI_PROC(bool,SDL_ConvertAudioSamples,(const SDL_AudioSpec *a, const Uint8 *b, int c, const SDL_AudioSpec *d, Uint8 **e, int *f),(a,b,c,d,e,f),return) +SDL_DYNAPI_PROC(bool,SDL_ConvertEventToRenderCoordinates,(SDL_Renderer *a, SDL_Event *b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_ConvertPixels,(int a, int b, SDL_PixelFormat c, const void *d, int e, SDL_PixelFormat f, void *g, int h),(a,b,c,d,e,f,g,h),return) +SDL_DYNAPI_PROC(bool,SDL_ConvertPixelsAndColorspace,(int a, int b, SDL_PixelFormat c, SDL_Colorspace d, SDL_PropertiesID e, const void *f, int g, SDL_PixelFormat h, SDL_Colorspace i, SDL_PropertiesID j, void *k, int l),(a,b,c,d,e,f,g,h,i,j,k,l),return) SDL_DYNAPI_PROC(SDL_Surface*,SDL_ConvertSurface,(SDL_Surface *a, SDL_PixelFormat b),(a,b),return) SDL_DYNAPI_PROC(SDL_Surface*,SDL_ConvertSurfaceAndColorspace,(SDL_Surface *a, SDL_PixelFormat b, SDL_Palette *c, SDL_Colorspace d, SDL_PropertiesID e),(a,b,c,d,e),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_CopyFile,(const char *a, const char *b),(a,b),return) -SDL_DYNAPI_PROC(void,SDL_CopyGPUBufferToBuffer,(SDL_GPUCopyPass *a, SDL_GPUBufferLocation *b, SDL_GPUBufferLocation *c, Uint32 d, SDL_bool e),(a,b,c,d,e),) -SDL_DYNAPI_PROC(void,SDL_CopyGPUTextureToTexture,(SDL_GPUCopyPass *a, SDL_GPUTextureLocation *b, SDL_GPUTextureLocation *c, Uint32 d, Uint32 e, Uint32 f, SDL_bool g),(a,b,c,d,e,f,g),) -SDL_DYNAPI_PROC(SDL_bool,SDL_CopyProperties,(SDL_PropertiesID a, SDL_PropertiesID b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_CopyStorageFile,(SDL_Storage *a, const char *b, const char *c),(a,b,c),return) +SDL_DYNAPI_PROC(bool,SDL_CopyFile,(const char *a, const char *b),(a,b),return) +SDL_DYNAPI_PROC(void,SDL_CopyGPUBufferToBuffer,(SDL_GPUCopyPass *a, const SDL_GPUBufferLocation *b, const SDL_GPUBufferLocation *c, Uint32 d, bool e),(a,b,c,d,e),) +SDL_DYNAPI_PROC(void,SDL_CopyGPUTextureToTexture,(SDL_GPUCopyPass *a, const SDL_GPUTextureLocation *b, const SDL_GPUTextureLocation *c, Uint32 d, Uint32 e, Uint32 f, bool g),(a,b,c,d,e,f,g),) +SDL_DYNAPI_PROC(bool,SDL_CopyProperties,(SDL_PropertiesID a, SDL_PropertiesID b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_CopyStorageFile,(SDL_Storage *a, const char *b, const char *c),(a,b,c),return) SDL_DYNAPI_PROC(SDL_AudioStream*,SDL_CreateAudioStream,(const SDL_AudioSpec *a, const SDL_AudioSpec *b),(a,b),return) SDL_DYNAPI_PROC(SDL_Cursor*,SDL_CreateColorCursor,(SDL_Surface *a, int b, int c),(a,b,c),return) SDL_DYNAPI_PROC(SDL_Condition*,SDL_CreateCondition,(void),(),return) SDL_DYNAPI_PROC(SDL_Cursor*,SDL_CreateCursor,(const Uint8 *a, const Uint8 *b, int c, int d, int e, int f),(a,b,c,d,e,f),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_CreateDirectory,(const char *a),(a),return) -SDL_DYNAPI_PROC(SDL_GPUBuffer*,SDL_CreateGPUBuffer,(SDL_GPUDevice *a, SDL_GPUBufferCreateInfo* b),(a,b),return) -SDL_DYNAPI_PROC(SDL_GPUComputePipeline*,SDL_CreateGPUComputePipeline,(SDL_GPUDevice *a, SDL_GPUComputePipelineCreateInfo *b),(a,b),return) -SDL_DYNAPI_PROC(SDL_GPUDevice*,SDL_CreateGPUDevice,(SDL_GPUShaderFormat a, SDL_bool b, const char *c),(a,b,c),return) +SDL_DYNAPI_PROC(bool,SDL_CreateDirectory,(const char *a),(a),return) +SDL_DYNAPI_PROC(SDL_Environment*,SDL_CreateEnvironment,(bool a),(a),return) +SDL_DYNAPI_PROC(SDL_GPUBuffer*,SDL_CreateGPUBuffer,(SDL_GPUDevice *a, const SDL_GPUBufferCreateInfo* b),(a,b),return) +SDL_DYNAPI_PROC(SDL_GPUComputePipeline*,SDL_CreateGPUComputePipeline,(SDL_GPUDevice *a, const SDL_GPUComputePipelineCreateInfo *b),(a,b),return) +SDL_DYNAPI_PROC(SDL_GPUDevice*,SDL_CreateGPUDevice,(SDL_GPUShaderFormat a, bool b, const char *c),(a,b,c),return) SDL_DYNAPI_PROC(SDL_GPUDevice*,SDL_CreateGPUDeviceWithProperties,(SDL_PropertiesID a),(a),return) -SDL_DYNAPI_PROC(SDL_GPUGraphicsPipeline*,SDL_CreateGPUGraphicsPipeline,(SDL_GPUDevice *a, SDL_GPUGraphicsPipelineCreateInfo *b),(a,b),return) -SDL_DYNAPI_PROC(SDL_GPUSampler*,SDL_CreateGPUSampler,(SDL_GPUDevice *a, SDL_GPUSamplerCreateInfo *b),(a,b),return) -SDL_DYNAPI_PROC(SDL_GPUShader*,SDL_CreateGPUShader,(SDL_GPUDevice *a, SDL_GPUShaderCreateInfo *b),(a,b),return) -SDL_DYNAPI_PROC(SDL_GPUTexture*,SDL_CreateGPUTexture,(SDL_GPUDevice *a, SDL_GPUTextureCreateInfo *b),(a,b),return) -SDL_DYNAPI_PROC(SDL_GPUTransferBuffer*,SDL_CreateGPUTransferBuffer,(SDL_GPUDevice *a, SDL_GPUTransferBufferCreateInfo *b),(a,b),return) +SDL_DYNAPI_PROC(SDL_GPUGraphicsPipeline*,SDL_CreateGPUGraphicsPipeline,(SDL_GPUDevice *a, const SDL_GPUGraphicsPipelineCreateInfo *b),(a,b),return) +SDL_DYNAPI_PROC(SDL_GPUSampler*,SDL_CreateGPUSampler,(SDL_GPUDevice *a, const SDL_GPUSamplerCreateInfo *b),(a,b),return) +SDL_DYNAPI_PROC(SDL_GPUShader*,SDL_CreateGPUShader,(SDL_GPUDevice *a, const SDL_GPUShaderCreateInfo *b),(a,b),return) +SDL_DYNAPI_PROC(SDL_GPUTexture*,SDL_CreateGPUTexture,(SDL_GPUDevice *a, const SDL_GPUTextureCreateInfo *b),(a,b),return) +SDL_DYNAPI_PROC(SDL_GPUTransferBuffer*,SDL_CreateGPUTransferBuffer,(SDL_GPUDevice *a, const SDL_GPUTransferBufferCreateInfo *b),(a,b),return) SDL_DYNAPI_PROC(int,SDL_CreateHapticEffect,(SDL_Haptic *a, const SDL_HapticEffect *b),(a,b),return) SDL_DYNAPI_PROC(SDL_Mutex*,SDL_CreateMutex,(void),(),return) SDL_DYNAPI_PROC(SDL_Palette*,SDL_CreatePalette,(int a),(a),return) SDL_DYNAPI_PROC(SDL_Window*,SDL_CreatePopupWindow,(SDL_Window *a, int b, int c, int d, int e, SDL_WindowFlags f),(a,b,c,d,e,f),return) +SDL_DYNAPI_PROC(SDL_Process*,SDL_CreateProcess,(const char * const *a, bool b),(a,b),return) +SDL_DYNAPI_PROC(SDL_Process*,SDL_CreateProcessWithProperties,(SDL_PropertiesID a),(a),return) SDL_DYNAPI_PROC(SDL_PropertiesID,SDL_CreateProperties,(void),(),return) SDL_DYNAPI_PROC(SDL_RWLock*,SDL_CreateRWLock,(void),(),return) SDL_DYNAPI_PROC(SDL_Renderer*,SDL_CreateRenderer,(SDL_Window *a, const char *b),(a,b),return) SDL_DYNAPI_PROC(SDL_Renderer*,SDL_CreateRendererWithProperties,(SDL_PropertiesID a),(a),return) SDL_DYNAPI_PROC(SDL_Semaphore*,SDL_CreateSemaphore,(Uint32 a),(a),return) SDL_DYNAPI_PROC(SDL_Renderer*,SDL_CreateSoftwareRenderer,(SDL_Surface *a),(a),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_CreateStorageDirectory,(SDL_Storage *a, const char *b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_CreateStorageDirectory,(SDL_Storage *a, const char *b),(a,b),return) SDL_DYNAPI_PROC(SDL_Surface*,SDL_CreateSurface,(int a, int b, SDL_PixelFormat c),(a,b,c),return) SDL_DYNAPI_PROC(SDL_Surface*,SDL_CreateSurfaceFrom,(int a, int b, SDL_PixelFormat c, void *d, int e),(a,b,c,d,e),return) SDL_DYNAPI_PROC(SDL_Palette*,SDL_CreateSurfacePalette,(SDL_Surface *a),(a),return) @@ -158,19 +160,21 @@ SDL_DYNAPI_PROC(SDL_Texture*,SDL_CreateTextureWithProperties,(SDL_Renderer *a, S SDL_DYNAPI_PROC(SDL_Thread*,SDL_CreateThreadRuntime,(SDL_ThreadFunction a, const char *b, void *c, SDL_FunctionPointer d, SDL_FunctionPointer e),(a,b,c,d,e),return) SDL_DYNAPI_PROC(SDL_Thread*,SDL_CreateThreadWithPropertiesRuntime,(SDL_PropertiesID a, SDL_FunctionPointer b, SDL_FunctionPointer c),(a,b,c),return) SDL_DYNAPI_PROC(SDL_Window*,SDL_CreateWindow,(const char *a, int b, int c, SDL_WindowFlags d),(a,b,c,d),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_CreateWindowAndRenderer,(const char *a, int b, int c, SDL_WindowFlags d, SDL_Window **e, SDL_Renderer **f),(a,b,c,d,e,f),return) +SDL_DYNAPI_PROC(bool,SDL_CreateWindowAndRenderer,(const char *a, int b, int c, SDL_WindowFlags d, SDL_Window **e, SDL_Renderer **f),(a,b,c,d,e,f),return) SDL_DYNAPI_PROC(SDL_Window*,SDL_CreateWindowWithProperties,(SDL_PropertiesID a),(a),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_CursorVisible,(void),(),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_DateTimeToTime,(const SDL_DateTime *a, SDL_Time *b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_CursorVisible,(void),(),return) +SDL_DYNAPI_PROC(bool,SDL_DateTimeToTime,(const SDL_DateTime *a, SDL_Time *b),(a,b),return) SDL_DYNAPI_PROC(void,SDL_Delay,(Uint32 a),(a),) SDL_DYNAPI_PROC(void,SDL_DelayNS,(Uint64 a),(a),) SDL_DYNAPI_PROC(void,SDL_DestroyAudioStream,(SDL_AudioStream *a),(a),) SDL_DYNAPI_PROC(void,SDL_DestroyCondition,(SDL_Condition *a),(a),) SDL_DYNAPI_PROC(void,SDL_DestroyCursor,(SDL_Cursor *a),(a),) +SDL_DYNAPI_PROC(void,SDL_DestroyEnvironment,(SDL_Environment *a),(a),) SDL_DYNAPI_PROC(void,SDL_DestroyGPUDevice,(SDL_GPUDevice *a),(a),) SDL_DYNAPI_PROC(void,SDL_DestroyHapticEffect,(SDL_Haptic *a, int b),(a,b),) SDL_DYNAPI_PROC(void,SDL_DestroyMutex,(SDL_Mutex *a),(a),) SDL_DYNAPI_PROC(void,SDL_DestroyPalette,(SDL_Palette *a),(a),) +SDL_DYNAPI_PROC(void,SDL_DestroyProcess,(SDL_Process *a),(a),) SDL_DYNAPI_PROC(void,SDL_DestroyProperties,(SDL_PropertiesID a),(a),) SDL_DYNAPI_PROC(void,SDL_DestroyRWLock,(SDL_RWLock *a),(a),) SDL_DYNAPI_PROC(void,SDL_DestroyRenderer,(SDL_Renderer *a),(a),) @@ -178,70 +182,73 @@ SDL_DYNAPI_PROC(void,SDL_DestroySemaphore,(SDL_Semaphore *a),(a),) SDL_DYNAPI_PROC(void,SDL_DestroySurface,(SDL_Surface *a),(a),) SDL_DYNAPI_PROC(void,SDL_DestroyTexture,(SDL_Texture *a),(a),) SDL_DYNAPI_PROC(void,SDL_DestroyWindow,(SDL_Window *a),(a),) -SDL_DYNAPI_PROC(SDL_bool,SDL_DestroyWindowSurface,(SDL_Window *a),(a),return) +SDL_DYNAPI_PROC(bool,SDL_DestroyWindowSurface,(SDL_Window *a),(a),return) SDL_DYNAPI_PROC(void,SDL_DetachThread,(SDL_Thread *a),(a),) -SDL_DYNAPI_PROC(SDL_bool,SDL_DetachVirtualJoystick,(SDL_JoystickID a),(a),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_DisableScreenSaver,(void),(),return) +SDL_DYNAPI_PROC(bool,SDL_DetachVirtualJoystick,(SDL_JoystickID a),(a),return) +SDL_DYNAPI_PROC(bool,SDL_DisableScreenSaver,(void),(),return) SDL_DYNAPI_PROC(void,SDL_DispatchGPUCompute,(SDL_GPUComputePass *a, Uint32 b, Uint32 c, Uint32 d),(a,b,c,d),) SDL_DYNAPI_PROC(void,SDL_DispatchGPUComputeIndirect,(SDL_GPUComputePass *a, SDL_GPUBuffer *b, Uint32 c),(a,b,c),) -SDL_DYNAPI_PROC(void,SDL_DownloadFromGPUBuffer,(SDL_GPUCopyPass *a, SDL_GPUBufferRegion *b, SDL_GPUTransferBufferLocation *c),(a,b,c),) -SDL_DYNAPI_PROC(void,SDL_DownloadFromGPUTexture,(SDL_GPUCopyPass *a, SDL_GPUTextureRegion *b, SDL_GPUTextureTransferInfo *c),(a,b,c),) +SDL_DYNAPI_PROC(void,SDL_DownloadFromGPUBuffer,(SDL_GPUCopyPass *a, const SDL_GPUBufferRegion *b, const SDL_GPUTransferBufferLocation *c),(a,b,c),) +SDL_DYNAPI_PROC(void,SDL_DownloadFromGPUTexture,(SDL_GPUCopyPass *a, const SDL_GPUTextureRegion *b, const SDL_GPUTextureTransferInfo *c),(a,b,c),) SDL_DYNAPI_PROC(void,SDL_DrawGPUIndexedPrimitives,(SDL_GPURenderPass *a, Uint32 b, Uint32 c, Uint32 d, Sint32 e, Uint32 f),(a,b,c,d,e,f),) -SDL_DYNAPI_PROC(void,SDL_DrawGPUIndexedPrimitivesIndirect,(SDL_GPURenderPass *a, SDL_GPUBuffer *b, Uint32 c, Uint32 d, Uint32 e),(a,b,c,d,e),) +SDL_DYNAPI_PROC(void,SDL_DrawGPUIndexedPrimitivesIndirect,(SDL_GPURenderPass *a, SDL_GPUBuffer *b, Uint32 c, Uint32 d),(a,b,c,d),) SDL_DYNAPI_PROC(void,SDL_DrawGPUPrimitives,(SDL_GPURenderPass *a, Uint32 b, Uint32 c, Uint32 d, Uint32 e),(a,b,c,d,e),) -SDL_DYNAPI_PROC(void,SDL_DrawGPUPrimitivesIndirect,(SDL_GPURenderPass *a, SDL_GPUBuffer *b, Uint32 c, Uint32 d, Uint32 e),(a,b,c,d,e),) +SDL_DYNAPI_PROC(void,SDL_DrawGPUPrimitivesIndirect,(SDL_GPURenderPass *a, SDL_GPUBuffer *b, Uint32 c, Uint32 d),(a,b,c,d),) SDL_DYNAPI_PROC(SDL_Surface*,SDL_DuplicateSurface,(SDL_Surface *a),(a),return) SDL_DYNAPI_PROC(SDL_EGLConfig,SDL_EGL_GetCurrentConfig,(void),(),return) SDL_DYNAPI_PROC(SDL_EGLDisplay,SDL_EGL_GetCurrentDisplay,(void),(),return) SDL_DYNAPI_PROC(SDL_FunctionPointer,SDL_EGL_GetProcAddress,(const char *a),(a),return) SDL_DYNAPI_PROC(SDL_EGLSurface,SDL_EGL_GetWindowSurface,(SDL_Window *a),(a),return) SDL_DYNAPI_PROC(void,SDL_EGL_SetAttributeCallbacks,(SDL_EGLAttribArrayCallback a, SDL_EGLIntArrayCallback b, SDL_EGLIntArrayCallback c),(a,b,c),) -SDL_DYNAPI_PROC(SDL_bool,SDL_EnableScreenSaver,(void),(),return) +SDL_DYNAPI_PROC(bool,SDL_EnableScreenSaver,(void),(),return) SDL_DYNAPI_PROC(void,SDL_EndGPUComputePass,(SDL_GPUComputePass *a),(a),) SDL_DYNAPI_PROC(void,SDL_EndGPUCopyPass,(SDL_GPUCopyPass *a),(a),) SDL_DYNAPI_PROC(void,SDL_EndGPURenderPass,(SDL_GPURenderPass *a),(a),) SDL_DYNAPI_PROC(int,SDL_EnterAppMainCallbacks,(int a, char *b[], SDL_AppInit_func c, SDL_AppIterate_func d, SDL_AppEvent_func e, SDL_AppQuit_func f),(a,b,c,d,e,f),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_EnumerateDirectory,(const char *a, SDL_EnumerateDirectoryCallback b, void *c),(a,b,c),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_EnumerateProperties,(SDL_PropertiesID a, SDL_EnumeratePropertiesCallback b, void *c),(a,b,c),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_EnumerateStorageDirectory,(SDL_Storage *a, const char *b, SDL_EnumerateDirectoryCallback c, void *d),(a,b,c,d),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_EventEnabled,(Uint32 a),(a),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_FillSurfaceRect,(SDL_Surface *a, const SDL_Rect *b, Uint32 c),(a,b,c),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_FillSurfaceRects,(SDL_Surface *a, const SDL_Rect *b, int c, Uint32 d),(a,b,c,d),return) +SDL_DYNAPI_PROC(bool,SDL_EnumerateDirectory,(const char *a, SDL_EnumerateDirectoryCallback b, void *c),(a,b,c),return) +SDL_DYNAPI_PROC(bool,SDL_EnumerateProperties,(SDL_PropertiesID a, SDL_EnumeratePropertiesCallback b, void *c),(a,b,c),return) +SDL_DYNAPI_PROC(bool,SDL_EnumerateStorageDirectory,(SDL_Storage *a, const char *b, SDL_EnumerateDirectoryCallback c, void *d),(a,b,c,d),return) +SDL_DYNAPI_PROC(bool,SDL_EventEnabled,(Uint32 a),(a),return) +SDL_DYNAPI_PROC(bool,SDL_FillSurfaceRect,(SDL_Surface *a, const SDL_Rect *b, Uint32 c),(a,b,c),return) +SDL_DYNAPI_PROC(bool,SDL_FillSurfaceRects,(SDL_Surface *a, const SDL_Rect *b, int c, Uint32 d),(a,b,c,d),return) SDL_DYNAPI_PROC(void,SDL_FilterEvents,(SDL_EventFilter a, void *b),(a,b),) -SDL_DYNAPI_PROC(SDL_bool,SDL_FlashWindow,(SDL_Window *a, SDL_FlashOperation b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_FlipSurface,(SDL_Surface *a, SDL_FlipMode b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_FlushAudioStream,(SDL_AudioStream *a),(a),return) +SDL_DYNAPI_PROC(bool,SDL_FlashWindow,(SDL_Window *a, SDL_FlashOperation b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_FlipSurface,(SDL_Surface *a, SDL_FlipMode b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_FlushAudioStream,(SDL_AudioStream *a),(a),return) SDL_DYNAPI_PROC(void,SDL_FlushEvent,(Uint32 a),(a),) SDL_DYNAPI_PROC(void,SDL_FlushEvents,(Uint32 a, Uint32 b),(a,b),) -SDL_DYNAPI_PROC(SDL_bool,SDL_FlushRenderer,(SDL_Renderer *a),(a),return) +SDL_DYNAPI_PROC(bool,SDL_FlushIO,(SDL_IOStream *a),(a),return) +SDL_DYNAPI_PROC(bool,SDL_FlushRenderer,(SDL_Renderer *a),(a),return) SDL_DYNAPI_PROC(void,SDL_GDKResumeGPU,(SDL_GPUDevice *a),(a),) SDL_DYNAPI_PROC(void,SDL_GDKSuspendComplete,(void),(),) SDL_DYNAPI_PROC(void,SDL_GDKSuspendGPU,(SDL_GPUDevice *a),(a),) SDL_DYNAPI_PROC(SDL_GLContext,SDL_GL_CreateContext,(SDL_Window *a),(a),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_GL_DestroyContext,(SDL_GLContext a),(a),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_GL_ExtensionSupported,(const char *a),(a),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_GL_GetAttribute,(SDL_GLattr a, int *b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_GL_DestroyContext,(SDL_GLContext a),(a),return) +SDL_DYNAPI_PROC(bool,SDL_GL_ExtensionSupported,(const char *a),(a),return) +SDL_DYNAPI_PROC(bool,SDL_GL_GetAttribute,(SDL_GLattr a, int *b),(a,b),return) SDL_DYNAPI_PROC(SDL_GLContext,SDL_GL_GetCurrentContext,(void),(),return) SDL_DYNAPI_PROC(SDL_Window*,SDL_GL_GetCurrentWindow,(void),(),return) SDL_DYNAPI_PROC(SDL_FunctionPointer,SDL_GL_GetProcAddress,(const char *a),(a),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_GL_GetSwapInterval,(int *a),(a),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_GL_LoadLibrary,(const char *a),(a),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_GL_MakeCurrent,(SDL_Window *a, SDL_GLContext b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_GL_GetSwapInterval,(int *a),(a),return) +SDL_DYNAPI_PROC(bool,SDL_GL_LoadLibrary,(const char *a),(a),return) +SDL_DYNAPI_PROC(bool,SDL_GL_MakeCurrent,(SDL_Window *a, SDL_GLContext b),(a,b),return) SDL_DYNAPI_PROC(void,SDL_GL_ResetAttributes,(void),(),) -SDL_DYNAPI_PROC(SDL_bool,SDL_GL_SetAttribute,(SDL_GLattr a, int b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_GL_SetSwapInterval,(int a),(a),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_GL_SwapWindow,(SDL_Window *a),(a),return) +SDL_DYNAPI_PROC(bool,SDL_GL_SetAttribute,(SDL_GLattr a, int b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_GL_SetSwapInterval,(int a),(a),return) +SDL_DYNAPI_PROC(bool,SDL_GL_SwapWindow,(SDL_Window *a),(a),return) SDL_DYNAPI_PROC(void,SDL_GL_UnloadLibrary,(void),(),) +SDL_DYNAPI_PROC(bool,SDL_GPUSupportsProperties,(SDL_PropertiesID a),(a),return) +SDL_DYNAPI_PROC(bool,SDL_GPUSupportsShaderFormats,(SDL_GPUShaderFormat a, const char *b),(a,b),return) SDL_DYNAPI_PROC(Uint32,SDL_GPUTextureFormatTexelBlockSize,(SDL_GPUTextureFormat a),(a),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_GPUTextureSupportsFormat,(SDL_GPUDevice *a, SDL_GPUTextureFormat b, SDL_GPUTextureType c, SDL_GPUTextureUsageFlags d),(a,b,c,d),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_GPUTextureSupportsSampleCount,(SDL_GPUDevice *a, SDL_GPUTextureFormat b, SDL_GPUSampleCount c),(a,b,c),return) +SDL_DYNAPI_PROC(bool,SDL_GPUTextureSupportsFormat,(SDL_GPUDevice *a, SDL_GPUTextureFormat b, SDL_GPUTextureType c, SDL_GPUTextureUsageFlags d),(a,b,c,d),return) +SDL_DYNAPI_PROC(bool,SDL_GPUTextureSupportsSampleCount,(SDL_GPUDevice *a, SDL_GPUTextureFormat b, SDL_GPUSampleCount c),(a,b,c),return) SDL_DYNAPI_PROC(void,SDL_GUIDToString,(SDL_GUID a, char *b, int c),(a,b,c),) -SDL_DYNAPI_PROC(SDL_bool,SDL_GamepadConnected,(SDL_Gamepad *a),(a),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_GamepadEventsEnabled,(void),(),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_GamepadHasAxis,(SDL_Gamepad *a, SDL_GamepadAxis b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_GamepadHasButton,(SDL_Gamepad *a, SDL_GamepadButton b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_GamepadHasSensor,(SDL_Gamepad *a, SDL_SensorType b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_GamepadSensorEnabled,(SDL_Gamepad *a, SDL_SensorType b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_GamepadConnected,(SDL_Gamepad *a),(a),return) +SDL_DYNAPI_PROC(bool,SDL_GamepadEventsEnabled,(void),(),return) +SDL_DYNAPI_PROC(bool,SDL_GamepadHasAxis,(SDL_Gamepad *a, SDL_GamepadAxis b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_GamepadHasButton,(SDL_Gamepad *a, SDL_GamepadButton b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_GamepadHasSensor,(SDL_Gamepad *a, SDL_SensorType b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_GamepadSensorEnabled,(SDL_Gamepad *a, SDL_SensorType b),(a,b),return) SDL_DYNAPI_PROC(void,SDL_GenerateMipmapsForGPUTexture,(SDL_GPUCommandBuffer *a, SDL_GPUTexture *b),(a,b),) SDL_DYNAPI_PROC(void*,SDL_GetAndroidActivity,(void),(),return) SDL_DYNAPI_PROC(const char*,SDL_GetAndroidCachePath,(void),(),return) @@ -253,8 +260,11 @@ SDL_DYNAPI_PROC(int,SDL_GetAndroidSDKVersion,(void),(),return) SDL_DYNAPI_PROC(const char*,SDL_GetAppMetadataProperty,(const char *a),(a),return) SDL_DYNAPI_PROC(SDL_AssertionHandler,SDL_GetAssertionHandler,(void **a),(a),return) SDL_DYNAPI_PROC(const SDL_AssertData*,SDL_GetAssertionReport,(void),(),return) +SDL_DYNAPI_PROC(int,SDL_GetAtomicInt,(SDL_AtomicInt *a),(a),return) +SDL_DYNAPI_PROC(void*,SDL_GetAtomicPointer,(void **a),(a),return) +SDL_DYNAPI_PROC(Uint32,SDL_GetAtomicU32,(SDL_AtomicU32 *a),(a),return) SDL_DYNAPI_PROC(int*,SDL_GetAudioDeviceChannelMap,(SDL_AudioDeviceID a, int *b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_GetAudioDeviceFormat,(SDL_AudioDeviceID a, SDL_AudioSpec *b, int *c),(a,b,c),return) +SDL_DYNAPI_PROC(bool,SDL_GetAudioDeviceFormat,(SDL_AudioDeviceID a, SDL_AudioSpec *b, int *c),(a,b,c),return) SDL_DYNAPI_PROC(float,SDL_GetAudioDeviceGain,(SDL_AudioDeviceID a),(a),return) SDL_DYNAPI_PROC(const char*,SDL_GetAudioDeviceName,(SDL_AudioDeviceID a),(a),return) SDL_DYNAPI_PROC(const char*,SDL_GetAudioDriver,(int a),(a),return) @@ -264,7 +274,7 @@ SDL_DYNAPI_PROC(SDL_AudioDeviceID*,SDL_GetAudioRecordingDevices,(int *a),(a),ret SDL_DYNAPI_PROC(int,SDL_GetAudioStreamAvailable,(SDL_AudioStream *a),(a),return) SDL_DYNAPI_PROC(int,SDL_GetAudioStreamData,(SDL_AudioStream *a, void *b, int c),(a,b,c),return) SDL_DYNAPI_PROC(SDL_AudioDeviceID,SDL_GetAudioStreamDevice,(SDL_AudioStream *a),(a),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_GetAudioStreamFormat,(SDL_AudioStream *a, SDL_AudioSpec *b, SDL_AudioSpec *c),(a,b,c),return) +SDL_DYNAPI_PROC(bool,SDL_GetAudioStreamFormat,(SDL_AudioStream *a, SDL_AudioSpec *b, SDL_AudioSpec *c),(a,b,c),return) SDL_DYNAPI_PROC(float,SDL_GetAudioStreamFrequencyRatio,(SDL_AudioStream *a),(a),return) SDL_DYNAPI_PROC(float,SDL_GetAudioStreamGain,(SDL_AudioStream *a),(a),return) SDL_DYNAPI_PROC(int*,SDL_GetAudioStreamInputChannelMap,(SDL_AudioStream *a, int *b),(a,b),return) @@ -272,11 +282,10 @@ SDL_DYNAPI_PROC(int*,SDL_GetAudioStreamOutputChannelMap,(SDL_AudioStream *a, int SDL_DYNAPI_PROC(SDL_PropertiesID,SDL_GetAudioStreamProperties,(SDL_AudioStream *a),(a),return) SDL_DYNAPI_PROC(int,SDL_GetAudioStreamQueued,(SDL_AudioStream *a),(a),return) SDL_DYNAPI_PROC(const char*,SDL_GetBasePath,(void),(),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_GetBooleanProperty,(SDL_PropertiesID a, const char *b, SDL_bool c),(a,b,c),return) +SDL_DYNAPI_PROC(bool,SDL_GetBooleanProperty,(SDL_PropertiesID a, const char *b, bool c),(a,b,c),return) SDL_DYNAPI_PROC(int,SDL_GetCPUCacheLineSize,(void),(),return) -SDL_DYNAPI_PROC(int,SDL_GetCPUCount,(void),(),return) SDL_DYNAPI_PROC(const char*,SDL_GetCameraDriver,(int a),(a),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_GetCameraFormat,(SDL_Camera *a, SDL_CameraSpec *b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_GetCameraFormat,(SDL_Camera *a, SDL_CameraSpec *b),(a,b),return) SDL_DYNAPI_PROC(SDL_CameraID,SDL_GetCameraID,(SDL_Camera *a),(a),return) SDL_DYNAPI_PROC(const char*,SDL_GetCameraName,(SDL_CameraID a),(a),return) SDL_DYNAPI_PROC(int,SDL_GetCameraPermissionState,(SDL_Camera *a),(a),return) @@ -286,18 +295,18 @@ SDL_DYNAPI_PROC(SDL_CameraSpec**,SDL_GetCameraSupportedFormats,(SDL_CameraID a, SDL_DYNAPI_PROC(SDL_CameraID*,SDL_GetCameras,(int *a),(a),return) SDL_DYNAPI_PROC(void*,SDL_GetClipboardData,(const char *a, size_t *b),(a,b),return) SDL_DYNAPI_PROC(char*,SDL_GetClipboardText,(void),(),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_GetClosestFullscreenDisplayMode,(SDL_DisplayID a, int b, int c, float d, SDL_bool e, SDL_DisplayMode *f),(a,b,c,d,e,f),return) +SDL_DYNAPI_PROC(bool,SDL_GetClosestFullscreenDisplayMode,(SDL_DisplayID a, int b, int c, float d, bool e, SDL_DisplayMode *f),(a,b,c,d,e,f),return) SDL_DYNAPI_PROC(const char*,SDL_GetCurrentAudioDriver,(void),(),return) SDL_DYNAPI_PROC(const char*,SDL_GetCurrentCameraDriver,(void),(),return) SDL_DYNAPI_PROC(const SDL_DisplayMode*,SDL_GetCurrentDisplayMode,(SDL_DisplayID a),(a),return) SDL_DYNAPI_PROC(SDL_DisplayOrientation,SDL_GetCurrentDisplayOrientation,(SDL_DisplayID a),(a),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_GetCurrentRenderOutputSize,(SDL_Renderer *a, int *b, int *c),(a,b,c),return) +SDL_DYNAPI_PROC(bool,SDL_GetCurrentRenderOutputSize,(SDL_Renderer *a, int *b, int *c),(a,b,c),return) SDL_DYNAPI_PROC(SDL_ThreadID,SDL_GetCurrentThreadID,(void),(),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_GetCurrentTime,(SDL_Time *a),(a),return) +SDL_DYNAPI_PROC(bool,SDL_GetCurrentTime,(SDL_Time *a),(a),return) SDL_DYNAPI_PROC(const char*,SDL_GetCurrentVideoDriver,(void),(),return) SDL_DYNAPI_PROC(SDL_Cursor*,SDL_GetCursor,(void),(),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_GetDXGIOutputInfo,(SDL_DisplayID a, int *b, int *c),(a,b,c),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_GetDateTimeLocalePreferences,(SDL_DateFormat *a, SDL_TimeFormat *b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_GetDXGIOutputInfo,(SDL_DisplayID a, int *b, int *c),(a,b,c),return) +SDL_DYNAPI_PROC(bool,SDL_GetDateTimeLocalePreferences,(SDL_DateFormat *a, SDL_TimeFormat *b),(a,b),return) SDL_DYNAPI_PROC(int,SDL_GetDayOfWeek,(int a, int b, int c),(a,b,c),return) SDL_DYNAPI_PROC(int,SDL_GetDayOfYear,(int a, int b, int c),(a,b,c),return) SDL_DYNAPI_PROC(int,SDL_GetDaysInMonth,(int a, int b),(a,b),return) @@ -305,29 +314,34 @@ SDL_DYNAPI_PROC(SDL_AssertionHandler,SDL_GetDefaultAssertionHandler,(void),(),re SDL_DYNAPI_PROC(SDL_Cursor*,SDL_GetDefaultCursor,(void),(),return) SDL_DYNAPI_PROC(const SDL_DisplayMode*,SDL_GetDesktopDisplayMode,(SDL_DisplayID a),(a),return) SDL_DYNAPI_PROC(int,SDL_GetDirect3D9AdapterIndex,(SDL_DisplayID a),(a),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_GetDisplayBounds,(SDL_DisplayID a, SDL_Rect *b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_GetDisplayBounds,(SDL_DisplayID a, SDL_Rect *b),(a,b),return) SDL_DYNAPI_PROC(float,SDL_GetDisplayContentScale,(SDL_DisplayID a),(a),return) SDL_DYNAPI_PROC(SDL_DisplayID,SDL_GetDisplayForPoint,(const SDL_Point *a),(a),return) SDL_DYNAPI_PROC(SDL_DisplayID,SDL_GetDisplayForRect,(const SDL_Rect *a),(a),return) SDL_DYNAPI_PROC(SDL_DisplayID,SDL_GetDisplayForWindow,(SDL_Window *a),(a),return) SDL_DYNAPI_PROC(const char*,SDL_GetDisplayName,(SDL_DisplayID a),(a),return) SDL_DYNAPI_PROC(SDL_PropertiesID,SDL_GetDisplayProperties,(SDL_DisplayID a),(a),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_GetDisplayUsableBounds,(SDL_DisplayID a, SDL_Rect *b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_GetDisplayUsableBounds,(SDL_DisplayID a, SDL_Rect *b),(a,b),return) SDL_DYNAPI_PROC(SDL_DisplayID*,SDL_GetDisplays,(int *a),(a),return) +SDL_DYNAPI_PROC(SDL_Environment*,SDL_GetEnvironment,(void),(),return) +SDL_DYNAPI_PROC(const char*,SDL_GetEnvironmentVariable,(SDL_Environment *a, const char *b),(a,b),return) +SDL_DYNAPI_PROC(char**,SDL_GetEnvironmentVariables,(SDL_Environment *a),(a),return) SDL_DYNAPI_PROC(const char*,SDL_GetError,(void),(),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_GetEventFilter,(SDL_EventFilter *a, void **b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_GetEventFilter,(SDL_EventFilter *a, void **b),(a,b),return) SDL_DYNAPI_PROC(float,SDL_GetFloatProperty,(SDL_PropertiesID a, const char *b, float c),(a,b,c),return) SDL_DYNAPI_PROC(SDL_DisplayMode**,SDL_GetFullscreenDisplayModes,(SDL_DisplayID a, int *b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_GetGDKDefaultUser,(XUserHandle *a),(a),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_GetGDKTaskQueue,(XTaskQueueHandle *a),(a),return) -SDL_DYNAPI_PROC(SDL_GPUDriver,SDL_GetGPUDriver,(SDL_GPUDevice *a),(a),return) +SDL_DYNAPI_PROC(bool,SDL_GetGDKDefaultUser,(XUserHandle *a),(a),return) +SDL_DYNAPI_PROC(bool,SDL_GetGDKTaskQueue,(XTaskQueueHandle *a),(a),return) +SDL_DYNAPI_PROC(const char*,SDL_GetGPUDeviceDriver,(SDL_GPUDevice *a),(a),return) +SDL_DYNAPI_PROC(const char*,SDL_GetGPUDriver,(int a),(a),return) +SDL_DYNAPI_PROC(SDL_GPUShaderFormat,SDL_GetGPUShaderFormats,(SDL_GPUDevice *a),(a),return) SDL_DYNAPI_PROC(SDL_GPUTextureFormat,SDL_GetGPUSwapchainTextureFormat,(SDL_GPUDevice *a, SDL_Window *b),(a,b),return) SDL_DYNAPI_PROC(const char*,SDL_GetGamepadAppleSFSymbolsNameForAxis,(SDL_Gamepad *a, SDL_GamepadAxis b),(a,b),return) SDL_DYNAPI_PROC(const char*,SDL_GetGamepadAppleSFSymbolsNameForButton,(SDL_Gamepad *a, SDL_GamepadButton b),(a,b),return) SDL_DYNAPI_PROC(Sint16,SDL_GetGamepadAxis,(SDL_Gamepad *a, SDL_GamepadAxis b),(a,b),return) SDL_DYNAPI_PROC(SDL_GamepadAxis,SDL_GetGamepadAxisFromString,(const char *a),(a),return) SDL_DYNAPI_PROC(SDL_GamepadBinding**,SDL_GetGamepadBindings,(SDL_Gamepad *a, int *b),(a,b),return) -SDL_DYNAPI_PROC(Uint8,SDL_GetGamepadButton,(SDL_Gamepad *a, SDL_GamepadButton b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_GetGamepadButton,(SDL_Gamepad *a, SDL_GamepadButton b),(a,b),return) SDL_DYNAPI_PROC(SDL_GamepadButton,SDL_GetGamepadButtonFromString,(const char *a),(a),return) SDL_DYNAPI_PROC(SDL_GamepadButtonLabel,SDL_GetGamepadButtonLabel,(SDL_Gamepad *a, SDL_GamepadButton b),(a,b),return) SDL_DYNAPI_PROC(SDL_GamepadButtonLabel,SDL_GetGamepadButtonLabelForType,(SDL_GamepadType a, SDL_GamepadButton b),(a,b),return) @@ -354,14 +368,14 @@ SDL_DYNAPI_PROC(Uint16,SDL_GetGamepadProductForID,(SDL_JoystickID a),(a),return) SDL_DYNAPI_PROC(Uint16,SDL_GetGamepadProductVersion,(SDL_Gamepad *a),(a),return) SDL_DYNAPI_PROC(Uint16,SDL_GetGamepadProductVersionForID,(SDL_JoystickID a),(a),return) SDL_DYNAPI_PROC(SDL_PropertiesID,SDL_GetGamepadProperties,(SDL_Gamepad *a),(a),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_GetGamepadSensorData,(SDL_Gamepad *a, SDL_SensorType b, float *c, int d),(a,b,c,d),return) +SDL_DYNAPI_PROC(bool,SDL_GetGamepadSensorData,(SDL_Gamepad *a, SDL_SensorType b, float *c, int d),(a,b,c,d),return) SDL_DYNAPI_PROC(float,SDL_GetGamepadSensorDataRate,(SDL_Gamepad *a, SDL_SensorType b),(a,b),return) SDL_DYNAPI_PROC(const char*,SDL_GetGamepadSerial,(SDL_Gamepad *a),(a),return) SDL_DYNAPI_PROC(Uint64,SDL_GetGamepadSteamHandle,(SDL_Gamepad *a),(a),return) SDL_DYNAPI_PROC(const char*,SDL_GetGamepadStringForAxis,(SDL_GamepadAxis a),(a),return) SDL_DYNAPI_PROC(const char*,SDL_GetGamepadStringForButton,(SDL_GamepadButton a),(a),return) SDL_DYNAPI_PROC(const char*,SDL_GetGamepadStringForType,(SDL_GamepadType a),(a),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_GetGamepadTouchpadFinger,(SDL_Gamepad *a, int b, int c, Uint8 *d, float *e, float *f, float *g),(a,b,c,d,e,f,g),return) +SDL_DYNAPI_PROC(bool,SDL_GetGamepadTouchpadFinger,(SDL_Gamepad *a, int b, int c, bool *d, float *e, float *f, float *g),(a,b,c,d,e,f,g),return) SDL_DYNAPI_PROC(SDL_GamepadType,SDL_GetGamepadType,(SDL_Gamepad *a),(a),return) SDL_DYNAPI_PROC(SDL_GamepadType,SDL_GetGamepadTypeForID,(SDL_JoystickID a),(a),return) SDL_DYNAPI_PROC(SDL_GamepadType,SDL_GetGamepadTypeFromString,(const char *a),(a),return) @@ -371,7 +385,7 @@ SDL_DYNAPI_PROC(SDL_JoystickID*,SDL_GetGamepads,(int *a),(a),return) SDL_DYNAPI_PROC(SDL_MouseButtonFlags,SDL_GetGlobalMouseState,(float *a, float *b),(a,b),return) SDL_DYNAPI_PROC(SDL_PropertiesID,SDL_GetGlobalProperties,(void),(),return) SDL_DYNAPI_PROC(SDL_Window*,SDL_GetGrabbedWindow,(void),(),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_GetHapticEffectStatus,(SDL_Haptic *a, int b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_GetHapticEffectStatus,(SDL_Haptic *a, int b),(a,b),return) SDL_DYNAPI_PROC(Uint32,SDL_GetHapticFeatures,(SDL_Haptic *a),(a),return) SDL_DYNAPI_PROC(SDL_Haptic*,SDL_GetHapticFromID,(SDL_HapticID a),(a),return) SDL_DYNAPI_PROC(SDL_HapticID,SDL_GetHapticID,(SDL_Haptic *a),(a),return) @@ -379,14 +393,14 @@ SDL_DYNAPI_PROC(const char*,SDL_GetHapticName,(SDL_Haptic *a),(a),return) SDL_DYNAPI_PROC(const char*,SDL_GetHapticNameForID,(SDL_HapticID a),(a),return) SDL_DYNAPI_PROC(SDL_HapticID*,SDL_GetHaptics,(int *a),(a),return) SDL_DYNAPI_PROC(const char*,SDL_GetHint,(const char *a),(a),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_GetHintBoolean,(const char *a, SDL_bool b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_GetHintBoolean,(const char *a, bool b),(a,b),return) SDL_DYNAPI_PROC(SDL_PropertiesID,SDL_GetIOProperties,(SDL_IOStream *a),(a),return) SDL_DYNAPI_PROC(Sint64,SDL_GetIOSize,(SDL_IOStream *a),(a),return) SDL_DYNAPI_PROC(SDL_IOStatus,SDL_GetIOStatus,(SDL_IOStream *a),(a),return) SDL_DYNAPI_PROC(Sint16,SDL_GetJoystickAxis,(SDL_Joystick *a, int b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_GetJoystickAxisInitialState,(SDL_Joystick *a, int b, Sint16 *c),(a,b,c),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_GetJoystickBall,(SDL_Joystick *a, int b, int *c, int *d),(a,b,c,d),return) -SDL_DYNAPI_PROC(Uint8,SDL_GetJoystickButton,(SDL_Joystick *a, int b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_GetJoystickAxisInitialState,(SDL_Joystick *a, int b, Sint16 *c),(a,b,c),return) +SDL_DYNAPI_PROC(bool,SDL_GetJoystickBall,(SDL_Joystick *a, int b, int *c, int *d),(a,b,c,d),return) +SDL_DYNAPI_PROC(bool,SDL_GetJoystickButton,(SDL_Joystick *a, int b),(a,b),return) SDL_DYNAPI_PROC(SDL_JoystickConnectionState,SDL_GetJoystickConnectionState,(SDL_Joystick *a),(a),return) SDL_DYNAPI_PROC(Uint16,SDL_GetJoystickFirmwareVersion,(SDL_Joystick *a),(a),return) SDL_DYNAPI_PROC(SDL_Joystick*,SDL_GetJoystickFromID,(SDL_JoystickID a),(a),return) @@ -415,15 +429,15 @@ SDL_DYNAPI_PROC(Uint16,SDL_GetJoystickVendor,(SDL_Joystick *a),(a),return) SDL_DYNAPI_PROC(Uint16,SDL_GetJoystickVendorForID,(SDL_JoystickID a),(a),return) SDL_DYNAPI_PROC(SDL_JoystickID*,SDL_GetJoysticks,(int *a),(a),return) SDL_DYNAPI_PROC(SDL_Keycode,SDL_GetKeyFromName,(const char *a),(a),return) -SDL_DYNAPI_PROC(SDL_Keycode,SDL_GetKeyFromScancode,(SDL_Scancode a, SDL_Keymod b, SDL_bool c),(a,b,c),return) +SDL_DYNAPI_PROC(SDL_Keycode,SDL_GetKeyFromScancode,(SDL_Scancode a, SDL_Keymod b, bool c),(a,b,c),return) SDL_DYNAPI_PROC(const char*,SDL_GetKeyName,(SDL_Keycode a),(a),return) SDL_DYNAPI_PROC(SDL_Window*,SDL_GetKeyboardFocus,(void),(),return) SDL_DYNAPI_PROC(const char*,SDL_GetKeyboardNameForID,(SDL_KeyboardID a),(a),return) -SDL_DYNAPI_PROC(const Uint8*,SDL_GetKeyboardState,(int *a),(a),return) +SDL_DYNAPI_PROC(const bool*,SDL_GetKeyboardState,(int *a),(a),return) SDL_DYNAPI_PROC(SDL_KeyboardID*,SDL_GetKeyboards,(int *a),(a),return) SDL_DYNAPI_PROC(void,SDL_GetLogOutputFunction,(SDL_LogOutputFunction *a, void **b),(a,b),) SDL_DYNAPI_PROC(SDL_LogPriority,SDL_GetLogPriority,(int a),(a),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_GetMasksForPixelFormat,(SDL_PixelFormat a, int *b, Uint32 *c, Uint32 *d, Uint32 *e, Uint32 *f),(a,b,c,d,e,f),return) +SDL_DYNAPI_PROC(bool,SDL_GetMasksForPixelFormat,(SDL_PixelFormat a, int *b, Uint32 *c, Uint32 *d, Uint32 *e, Uint32 *f),(a,b,c,d,e,f),return) SDL_DYNAPI_PROC(int,SDL_GetMaxHapticEffects,(SDL_Haptic *a),(a),return) SDL_DYNAPI_PROC(int,SDL_GetMaxHapticEffectsPlaying,(SDL_Haptic *a),(a),return) SDL_DYNAPI_PROC(void,SDL_GetMemoryFunctions,(SDL_malloc_func *a, SDL_calloc_func *b, SDL_realloc_func *c, SDL_free_func *d),(a,b,c,d),) @@ -436,6 +450,7 @@ SDL_DYNAPI_PROC(SDL_DisplayOrientation,SDL_GetNaturalDisplayOrientation,(SDL_Dis SDL_DYNAPI_PROC(int,SDL_GetNumAllocations,(void),(),return) SDL_DYNAPI_PROC(int,SDL_GetNumAudioDrivers,(void),(),return) SDL_DYNAPI_PROC(int,SDL_GetNumCameraDrivers,(void),(),return) +SDL_DYNAPI_PROC(int,SDL_GetNumGPUDrivers,(void),(),return) SDL_DYNAPI_PROC(int,SDL_GetNumGamepadTouchpadFingers,(SDL_Gamepad *a, int b),(a,b),return) SDL_DYNAPI_PROC(int,SDL_GetNumGamepadTouchpads,(SDL_Gamepad *a),(a),return) SDL_DYNAPI_PROC(int,SDL_GetNumHapticAxes,(SDL_Haptic *a),(a),return) @@ -443,11 +458,12 @@ SDL_DYNAPI_PROC(int,SDL_GetNumJoystickAxes,(SDL_Joystick *a),(a),return) SDL_DYNAPI_PROC(int,SDL_GetNumJoystickBalls,(SDL_Joystick *a),(a),return) SDL_DYNAPI_PROC(int,SDL_GetNumJoystickButtons,(SDL_Joystick *a),(a),return) SDL_DYNAPI_PROC(int,SDL_GetNumJoystickHats,(SDL_Joystick *a),(a),return) +SDL_DYNAPI_PROC(int,SDL_GetNumLogicalCPUCores,(void),(),return) SDL_DYNAPI_PROC(int,SDL_GetNumRenderDrivers,(void),(),return) SDL_DYNAPI_PROC(int,SDL_GetNumVideoDrivers,(void),(),return) SDL_DYNAPI_PROC(Sint64,SDL_GetNumberProperty,(SDL_PropertiesID a, const char *b, Sint64 c),(a,b,c),return) SDL_DYNAPI_PROC(void,SDL_GetOriginalMemoryFunctions,(SDL_malloc_func *a, SDL_calloc_func *b, SDL_realloc_func *c, SDL_free_func *d),(a,b,c,d),) -SDL_DYNAPI_PROC(SDL_bool,SDL_GetPathInfo,(const char *a, SDL_PathInfo *b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_GetPathInfo,(const char *a, SDL_PathInfo *b),(a,b),return) SDL_DYNAPI_PROC(Uint64,SDL_GetPerformanceCounter,(void),(),return) SDL_DYNAPI_PROC(Uint64,SDL_GetPerformanceFrequency,(void),(),return) SDL_DYNAPI_PROC(const SDL_PixelFormatDetails*,SDL_GetPixelFormatDetails,(SDL_PixelFormat a),(a),return) @@ -460,36 +476,39 @@ SDL_DYNAPI_PROC(char*,SDL_GetPrefPath,(const char *a, const char *b),(a,b),retur SDL_DYNAPI_PROC(SDL_Locale**,SDL_GetPreferredLocales,(int *a),(a),return) SDL_DYNAPI_PROC(SDL_DisplayID,SDL_GetPrimaryDisplay,(void),(),return) SDL_DYNAPI_PROC(char*,SDL_GetPrimarySelectionText,(void),(),return) +SDL_DYNAPI_PROC(SDL_IOStream*,SDL_GetProcessInput,(SDL_Process *a),(a),return) +SDL_DYNAPI_PROC(SDL_IOStream*,SDL_GetProcessOutput,(SDL_Process *a),(a),return) +SDL_DYNAPI_PROC(SDL_PropertiesID,SDL_GetProcessProperties,(SDL_Process *a),(a),return) SDL_DYNAPI_PROC(SDL_PropertyType,SDL_GetPropertyType,(SDL_PropertiesID a, const char *b),(a,b),return) SDL_DYNAPI_PROC(void,SDL_GetRGB,(Uint32 a, const SDL_PixelFormatDetails *b, const SDL_Palette *c, Uint8 *d, Uint8 *e, Uint8 *f),(a,b,c,d,e,f),) SDL_DYNAPI_PROC(void,SDL_GetRGBA,(Uint32 a, const SDL_PixelFormatDetails *b, const SDL_Palette *c, Uint8 *d, Uint8 *e, Uint8 *f, Uint8 *g),(a,b,c,d,e,f,g),) SDL_DYNAPI_PROC(SDL_GamepadType,SDL_GetRealGamepadType,(SDL_Gamepad *a),(a),return) SDL_DYNAPI_PROC(SDL_GamepadType,SDL_GetRealGamepadTypeForID,(SDL_JoystickID a),(a),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_GetRectAndLineIntersection,(const SDL_Rect *a, int *b, int *c, int *d, int *e),(a,b,c,d,e),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_GetRectAndLineIntersectionFloat,(const SDL_FRect *a, float *b, float *c, float *d, float *e),(a,b,c,d,e),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_GetRectEnclosingPoints,(const SDL_Point *a, int b, const SDL_Rect *c, SDL_Rect *d),(a,b,c,d),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_GetRectEnclosingPointsFloat,(const SDL_FPoint *a, int b, const SDL_FRect *c, SDL_FRect *d),(a,b,c,d),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_GetRectIntersection,(const SDL_Rect *a, const SDL_Rect *b, SDL_Rect *c),(a,b,c),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_GetRectIntersectionFloat,(const SDL_FRect *a, const SDL_FRect *b, SDL_FRect *c),(a,b,c),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_GetRectUnion,(const SDL_Rect *a, const SDL_Rect *b, SDL_Rect *c),(a,b,c),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_GetRectUnionFloat,(const SDL_FRect *a, const SDL_FRect *b, SDL_FRect *c),(a,b,c),return) +SDL_DYNAPI_PROC(bool,SDL_GetRectAndLineIntersection,(const SDL_Rect *a, int *b, int *c, int *d, int *e),(a,b,c,d,e),return) +SDL_DYNAPI_PROC(bool,SDL_GetRectAndLineIntersectionFloat,(const SDL_FRect *a, float *b, float *c, float *d, float *e),(a,b,c,d,e),return) +SDL_DYNAPI_PROC(bool,SDL_GetRectEnclosingPoints,(const SDL_Point *a, int b, const SDL_Rect *c, SDL_Rect *d),(a,b,c,d),return) +SDL_DYNAPI_PROC(bool,SDL_GetRectEnclosingPointsFloat,(const SDL_FPoint *a, int b, const SDL_FRect *c, SDL_FRect *d),(a,b,c,d),return) +SDL_DYNAPI_PROC(bool,SDL_GetRectIntersection,(const SDL_Rect *a, const SDL_Rect *b, SDL_Rect *c),(a,b,c),return) +SDL_DYNAPI_PROC(bool,SDL_GetRectIntersectionFloat,(const SDL_FRect *a, const SDL_FRect *b, SDL_FRect *c),(a,b,c),return) +SDL_DYNAPI_PROC(bool,SDL_GetRectUnion,(const SDL_Rect *a, const SDL_Rect *b, SDL_Rect *c),(a,b,c),return) +SDL_DYNAPI_PROC(bool,SDL_GetRectUnionFloat,(const SDL_FRect *a, const SDL_FRect *b, SDL_FRect *c),(a,b,c),return) SDL_DYNAPI_PROC(SDL_MouseButtonFlags,SDL_GetRelativeMouseState,(float *a, float *b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_GetRenderClipRect,(SDL_Renderer *a, SDL_Rect *b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_GetRenderColorScale,(SDL_Renderer *a, float *b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_GetRenderDrawBlendMode,(SDL_Renderer *a, SDL_BlendMode *b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_GetRenderDrawColor,(SDL_Renderer *a, Uint8 *b, Uint8 *c, Uint8 *d, Uint8 *e),(a,b,c,d,e),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_GetRenderDrawColorFloat,(SDL_Renderer *a, float *b, float *c, float *d, float *e),(a,b,c,d,e),return) +SDL_DYNAPI_PROC(bool,SDL_GetRenderClipRect,(SDL_Renderer *a, SDL_Rect *b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_GetRenderColorScale,(SDL_Renderer *a, float *b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_GetRenderDrawBlendMode,(SDL_Renderer *a, SDL_BlendMode *b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_GetRenderDrawColor,(SDL_Renderer *a, Uint8 *b, Uint8 *c, Uint8 *d, Uint8 *e),(a,b,c,d,e),return) +SDL_DYNAPI_PROC(bool,SDL_GetRenderDrawColorFloat,(SDL_Renderer *a, float *b, float *c, float *d, float *e),(a,b,c,d,e),return) SDL_DYNAPI_PROC(const char*,SDL_GetRenderDriver,(int a),(a),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_GetRenderLogicalPresentation,(SDL_Renderer *a, int *b, int *c, SDL_RendererLogicalPresentation *d, SDL_ScaleMode *e),(a,b,c,d,e),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_GetRenderLogicalPresentationRect,(SDL_Renderer *a, SDL_FRect *b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_GetRenderLogicalPresentation,(SDL_Renderer *a, int *b, int *c, SDL_RendererLogicalPresentation *d, SDL_ScaleMode *e),(a,b,c,d,e),return) +SDL_DYNAPI_PROC(bool,SDL_GetRenderLogicalPresentationRect,(SDL_Renderer *a, SDL_FRect *b),(a,b),return) SDL_DYNAPI_PROC(void*,SDL_GetRenderMetalCommandEncoder,(SDL_Renderer *a),(a),return) SDL_DYNAPI_PROC(void*,SDL_GetRenderMetalLayer,(SDL_Renderer *a),(a),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_GetRenderOutputSize,(SDL_Renderer *a, int *b, int *c),(a,b,c),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_GetRenderSafeArea,(SDL_Renderer *a, SDL_Rect *b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_GetRenderScale,(SDL_Renderer *a, float *b, float *c),(a,b,c),return) +SDL_DYNAPI_PROC(bool,SDL_GetRenderOutputSize,(SDL_Renderer *a, int *b, int *c),(a,b,c),return) +SDL_DYNAPI_PROC(bool,SDL_GetRenderSafeArea,(SDL_Renderer *a, SDL_Rect *b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_GetRenderScale,(SDL_Renderer *a, float *b, float *c),(a,b,c),return) SDL_DYNAPI_PROC(SDL_Texture*,SDL_GetRenderTarget,(SDL_Renderer *a),(a),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_GetRenderVSync,(SDL_Renderer *a, int *b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_GetRenderViewport,(SDL_Renderer *a, SDL_Rect *b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_GetRenderVSync,(SDL_Renderer *a, int *b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_GetRenderViewport,(SDL_Renderer *a, SDL_Rect *b),(a,b),return) SDL_DYNAPI_PROC(SDL_Window*,SDL_GetRenderWindow,(SDL_Renderer *a),(a),return) SDL_DYNAPI_PROC(SDL_Renderer*,SDL_GetRenderer,(SDL_Window *a),(a),return) SDL_DYNAPI_PROC(SDL_Renderer*,SDL_GetRendererFromTexture,(SDL_Texture *a),(a),return) @@ -501,7 +520,7 @@ SDL_DYNAPI_PROC(SDL_Scancode,SDL_GetScancodeFromKey,(SDL_Keycode a, SDL_Keymod * SDL_DYNAPI_PROC(SDL_Scancode,SDL_GetScancodeFromName,(const char *a),(a),return) SDL_DYNAPI_PROC(const char*,SDL_GetScancodeName,(SDL_Scancode a),(a),return) SDL_DYNAPI_PROC(Uint32,SDL_GetSemaphoreValue,(SDL_Semaphore *a),(a),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_GetSensorData,(SDL_Sensor *a, float *b, int c),(a,b,c),return) +SDL_DYNAPI_PROC(bool,SDL_GetSensorData,(SDL_Sensor *a, float *b, int c),(a,b,c),return) SDL_DYNAPI_PROC(SDL_Sensor*,SDL_GetSensorFromID,(SDL_SensorID a),(a),return) SDL_DYNAPI_PROC(SDL_SensorID,SDL_GetSensorID,(SDL_Sensor *a),(a),return) SDL_DYNAPI_PROC(const char*,SDL_GetSensorName,(SDL_Sensor *a),(a),return) @@ -513,15 +532,15 @@ SDL_DYNAPI_PROC(SDL_SensorType,SDL_GetSensorType,(SDL_Sensor *a),(a),return) SDL_DYNAPI_PROC(SDL_SensorType,SDL_GetSensorTypeForID,(SDL_SensorID a),(a),return) SDL_DYNAPI_PROC(SDL_SensorID*,SDL_GetSensors,(int *a),(a),return) SDL_DYNAPI_PROC(int,SDL_GetSilenceValueForFormat,(SDL_AudioFormat a),(a),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_GetStorageFileSize,(SDL_Storage *a, const char *b, Uint64 *c),(a,b,c),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_GetStoragePathInfo,(SDL_Storage *a, const char *b, SDL_PathInfo *c),(a,b,c),return) +SDL_DYNAPI_PROC(bool,SDL_GetStorageFileSize,(SDL_Storage *a, const char *b, Uint64 *c),(a,b,c),return) +SDL_DYNAPI_PROC(bool,SDL_GetStoragePathInfo,(SDL_Storage *a, const char *b, SDL_PathInfo *c),(a,b,c),return) SDL_DYNAPI_PROC(Uint64,SDL_GetStorageSpaceRemaining,(SDL_Storage *a),(a),return) SDL_DYNAPI_PROC(const char*,SDL_GetStringProperty,(SDL_PropertiesID a, const char *b, const char *c),(a,b,c),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_GetSurfaceAlphaMod,(SDL_Surface *a, Uint8 *b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_GetSurfaceBlendMode,(SDL_Surface *a, SDL_BlendMode *b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_GetSurfaceClipRect,(SDL_Surface *a, SDL_Rect *b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_GetSurfaceColorKey,(SDL_Surface *a, Uint32 *b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_GetSurfaceColorMod,(SDL_Surface *a, Uint8 *b, Uint8 *c, Uint8 *d),(a,b,c,d),return) +SDL_DYNAPI_PROC(bool,SDL_GetSurfaceAlphaMod,(SDL_Surface *a, Uint8 *b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_GetSurfaceBlendMode,(SDL_Surface *a, SDL_BlendMode *b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_GetSurfaceClipRect,(SDL_Surface *a, SDL_Rect *b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_GetSurfaceColorKey,(SDL_Surface *a, Uint32 *b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_GetSurfaceColorMod,(SDL_Surface *a, Uint8 *b, Uint8 *c, Uint8 *d),(a,b,c,d),return) SDL_DYNAPI_PROC(SDL_Colorspace,SDL_GetSurfaceColorspace,(SDL_Surface *a),(a),return) SDL_DYNAPI_PROC(SDL_Surface**,SDL_GetSurfaceImages,(SDL_Surface *a, int *b),(a,b),return) SDL_DYNAPI_PROC(SDL_Palette*,SDL_GetSurfacePalette,(SDL_Surface *a),(a),return) @@ -529,15 +548,15 @@ SDL_DYNAPI_PROC(SDL_PropertiesID,SDL_GetSurfaceProperties,(SDL_Surface *a),(a),r SDL_DYNAPI_PROC(int,SDL_GetSystemRAM,(void),(),return) SDL_DYNAPI_PROC(SDL_SystemTheme,SDL_GetSystemTheme,(void),(),return) SDL_DYNAPI_PROC(void*,SDL_GetTLS,(SDL_TLSID *a),(a),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_GetTextInputArea,(SDL_Window *a, SDL_Rect *b, int *c),(a,b,c),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_GetTextureAlphaMod,(SDL_Texture *a, Uint8 *b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_GetTextureAlphaModFloat,(SDL_Texture *a, float *b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_GetTextureBlendMode,(SDL_Texture *a, SDL_BlendMode *b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_GetTextureColorMod,(SDL_Texture *a, Uint8 *b, Uint8 *c, Uint8 *d),(a,b,c,d),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_GetTextureColorModFloat,(SDL_Texture *a, float *b, float *c, float *d),(a,b,c,d),return) +SDL_DYNAPI_PROC(bool,SDL_GetTextInputArea,(SDL_Window *a, SDL_Rect *b, int *c),(a,b,c),return) +SDL_DYNAPI_PROC(bool,SDL_GetTextureAlphaMod,(SDL_Texture *a, Uint8 *b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_GetTextureAlphaModFloat,(SDL_Texture *a, float *b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_GetTextureBlendMode,(SDL_Texture *a, SDL_BlendMode *b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_GetTextureColorMod,(SDL_Texture *a, Uint8 *b, Uint8 *c, Uint8 *d),(a,b,c,d),return) +SDL_DYNAPI_PROC(bool,SDL_GetTextureColorModFloat,(SDL_Texture *a, float *b, float *c, float *d),(a,b,c,d),return) SDL_DYNAPI_PROC(SDL_PropertiesID,SDL_GetTextureProperties,(SDL_Texture *a),(a),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_GetTextureScaleMode,(SDL_Texture *a, SDL_ScaleMode *b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_GetTextureSize,(SDL_Texture *a, float *b, float *c),(a,b,c),return) +SDL_DYNAPI_PROC(bool,SDL_GetTextureScaleMode,(SDL_Texture *a, SDL_ScaleMode *b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_GetTextureSize,(SDL_Texture *a, float *b, float *c),(a,b,c),return) SDL_DYNAPI_PROC(SDL_ThreadID,SDL_GetThreadID,(SDL_Thread *a),(a),return) SDL_DYNAPI_PROC(const char*,SDL_GetThreadName,(SDL_Thread *a),(a),return) SDL_DYNAPI_PROC(Uint64,SDL_GetTicks,(void),(),return) @@ -549,10 +568,8 @@ SDL_DYNAPI_PROC(SDL_Finger**,SDL_GetTouchFingers,(SDL_TouchID a, int *b),(a,b),r SDL_DYNAPI_PROC(const char*,SDL_GetUserFolder,(SDL_Folder a),(a),return) SDL_DYNAPI_PROC(int,SDL_GetVersion,(void),(),return) SDL_DYNAPI_PROC(const char*,SDL_GetVideoDriver,(int a),(a),return) -SDL_DYNAPI_PROC(SDL_WinRT_DeviceFamily,SDL_GetWinRTDeviceFamily,(void),(),return) -SDL_DYNAPI_PROC(const char*,SDL_GetWinRTFSPath,(SDL_WinRT_Path a),(a),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_GetWindowAspectRatio,(SDL_Window *a, float *b, float *c),(a,b,c),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_GetWindowBordersSize,(SDL_Window *a, int *b, int *c, int *d, int *e),(a,b,c,d,e),return) +SDL_DYNAPI_PROC(bool,SDL_GetWindowAspectRatio,(SDL_Window *a, float *b, float *c),(a,b,c),return) +SDL_DYNAPI_PROC(bool,SDL_GetWindowBordersSize,(SDL_Window *a, int *b, int *c, int *d, int *e),(a,b,c,d,e),return) SDL_DYNAPI_PROC(float,SDL_GetWindowDisplayScale,(SDL_Window *a),(a),return) SDL_DYNAPI_PROC(SDL_WindowFlags,SDL_GetWindowFlags,(SDL_Window *a),(a),return) SDL_DYNAPI_PROC(SDL_Window*,SDL_GetWindowFromEvent,(const SDL_Event *a),(a),return) @@ -560,109 +577,110 @@ SDL_DYNAPI_PROC(SDL_Window*,SDL_GetWindowFromID,(SDL_WindowID a),(a),return) SDL_DYNAPI_PROC(const SDL_DisplayMode*,SDL_GetWindowFullscreenMode,(SDL_Window *a),(a),return) SDL_DYNAPI_PROC(void*,SDL_GetWindowICCProfile,(SDL_Window *a, size_t *b),(a,b),return) SDL_DYNAPI_PROC(SDL_WindowID,SDL_GetWindowID,(SDL_Window *a),(a),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_GetWindowKeyboardGrab,(SDL_Window *a),(a),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_GetWindowMaximumSize,(SDL_Window *a, int *b, int *c),(a,b,c),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_GetWindowMinimumSize,(SDL_Window *a, int *b, int *c),(a,b,c),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_GetWindowMouseGrab,(SDL_Window *a),(a),return) +SDL_DYNAPI_PROC(bool,SDL_GetWindowKeyboardGrab,(SDL_Window *a),(a),return) +SDL_DYNAPI_PROC(bool,SDL_GetWindowMaximumSize,(SDL_Window *a, int *b, int *c),(a,b,c),return) +SDL_DYNAPI_PROC(bool,SDL_GetWindowMinimumSize,(SDL_Window *a, int *b, int *c),(a,b,c),return) +SDL_DYNAPI_PROC(bool,SDL_GetWindowMouseGrab,(SDL_Window *a),(a),return) SDL_DYNAPI_PROC(const SDL_Rect*,SDL_GetWindowMouseRect,(SDL_Window *a),(a),return) SDL_DYNAPI_PROC(float,SDL_GetWindowOpacity,(SDL_Window *a),(a),return) SDL_DYNAPI_PROC(SDL_Window*,SDL_GetWindowParent,(SDL_Window *a),(a),return) SDL_DYNAPI_PROC(float,SDL_GetWindowPixelDensity,(SDL_Window *a),(a),return) SDL_DYNAPI_PROC(SDL_PixelFormat,SDL_GetWindowPixelFormat,(SDL_Window *a),(a),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_GetWindowPosition,(SDL_Window *a, int *b, int *c),(a,b,c),return) +SDL_DYNAPI_PROC(bool,SDL_GetWindowPosition,(SDL_Window *a, int *b, int *c),(a,b,c),return) SDL_DYNAPI_PROC(SDL_PropertiesID,SDL_GetWindowProperties,(SDL_Window *a),(a),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_GetWindowRelativeMouseMode,(SDL_Window *a),(a),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_GetWindowSafeArea,(SDL_Window *a, SDL_Rect *b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_GetWindowSize,(SDL_Window *a, int *b, int *c),(a,b,c),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_GetWindowSizeInPixels,(SDL_Window *a, int *b, int *c),(a,b,c),return) +SDL_DYNAPI_PROC(bool,SDL_GetWindowRelativeMouseMode,(SDL_Window *a),(a),return) +SDL_DYNAPI_PROC(bool,SDL_GetWindowSafeArea,(SDL_Window *a, SDL_Rect *b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_GetWindowSize,(SDL_Window *a, int *b, int *c),(a,b,c),return) +SDL_DYNAPI_PROC(bool,SDL_GetWindowSizeInPixels,(SDL_Window *a, int *b, int *c),(a,b,c),return) SDL_DYNAPI_PROC(SDL_Surface*,SDL_GetWindowSurface,(SDL_Window *a),(a),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_GetWindowSurfaceVSync,(SDL_Window *a, int *b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_GetWindowSurfaceVSync,(SDL_Window *a, int *b),(a,b),return) SDL_DYNAPI_PROC(const char*,SDL_GetWindowTitle,(SDL_Window *a),(a),return) SDL_DYNAPI_PROC(SDL_Window**,SDL_GetWindows,(int *a),(a),return) SDL_DYNAPI_PROC(char **,SDL_GlobDirectory,(const char *a, const char *b, SDL_GlobFlags c, int *d),(a,b,c,d),return) SDL_DYNAPI_PROC(char **,SDL_GlobStorageDirectory,(SDL_Storage *a, const char *b, const char *c, SDL_GlobFlags d, int *e),(a,b,c,d,e),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_HapticEffectSupported,(SDL_Haptic *a, const SDL_HapticEffect *b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_HapticRumbleSupported,(SDL_Haptic *a),(a),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_HasARMSIMD,(void),(),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_HasAVX,(void),(),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_HasAVX2,(void),(),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_HasAVX512F,(void),(),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_HasAltiVec,(void),(),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_HasClipboardData,(const char *a),(a),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_HasClipboardText,(void),(),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_HasEvent,(Uint32 a),(a),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_HasEvents,(Uint32 a, Uint32 b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_HasGamepad,(void),(),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_HasJoystick,(void),(),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_HasKeyboard,(void),(),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_HasLASX,(void),(),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_HasLSX,(void),(),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_HasMMX,(void),(),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_HasMouse,(void),(),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_HasNEON,(void),(),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_HasPrimarySelectionText,(void),(),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_HasProperty,(SDL_PropertiesID a, const char *b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_HasRectIntersection,(const SDL_Rect *a, const SDL_Rect *b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_HasRectIntersectionFloat,(const SDL_FRect *a, const SDL_FRect *b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_HasSSE,(void),(),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_HasSSE2,(void),(),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_HasSSE3,(void),(),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_HasSSE41,(void),(),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_HasSSE42,(void),(),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_HasScreenKeyboardSupport,(void),(),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_HideCursor,(void),(),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_HideWindow,(SDL_Window *a),(a),return) +SDL_DYNAPI_PROC(bool,SDL_HapticEffectSupported,(SDL_Haptic *a, const SDL_HapticEffect *b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_HapticRumbleSupported,(SDL_Haptic *a),(a),return) +SDL_DYNAPI_PROC(bool,SDL_HasARMSIMD,(void),(),return) +SDL_DYNAPI_PROC(bool,SDL_HasAVX,(void),(),return) +SDL_DYNAPI_PROC(bool,SDL_HasAVX2,(void),(),return) +SDL_DYNAPI_PROC(bool,SDL_HasAVX512F,(void),(),return) +SDL_DYNAPI_PROC(bool,SDL_HasAltiVec,(void),(),return) +SDL_DYNAPI_PROC(bool,SDL_HasClipboardData,(const char *a),(a),return) +SDL_DYNAPI_PROC(bool,SDL_HasClipboardText,(void),(),return) +SDL_DYNAPI_PROC(bool,SDL_HasEvent,(Uint32 a),(a),return) +SDL_DYNAPI_PROC(bool,SDL_HasEvents,(Uint32 a, Uint32 b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_HasGamepad,(void),(),return) +SDL_DYNAPI_PROC(bool,SDL_HasJoystick,(void),(),return) +SDL_DYNAPI_PROC(bool,SDL_HasKeyboard,(void),(),return) +SDL_DYNAPI_PROC(bool,SDL_HasLASX,(void),(),return) +SDL_DYNAPI_PROC(bool,SDL_HasLSX,(void),(),return) +SDL_DYNAPI_PROC(bool,SDL_HasMMX,(void),(),return) +SDL_DYNAPI_PROC(bool,SDL_HasMouse,(void),(),return) +SDL_DYNAPI_PROC(bool,SDL_HasNEON,(void),(),return) +SDL_DYNAPI_PROC(bool,SDL_HasPrimarySelectionText,(void),(),return) +SDL_DYNAPI_PROC(bool,SDL_HasProperty,(SDL_PropertiesID a, const char *b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_HasRectIntersection,(const SDL_Rect *a, const SDL_Rect *b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_HasRectIntersectionFloat,(const SDL_FRect *a, const SDL_FRect *b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_HasSSE,(void),(),return) +SDL_DYNAPI_PROC(bool,SDL_HasSSE2,(void),(),return) +SDL_DYNAPI_PROC(bool,SDL_HasSSE3,(void),(),return) +SDL_DYNAPI_PROC(bool,SDL_HasSSE41,(void),(),return) +SDL_DYNAPI_PROC(bool,SDL_HasSSE42,(void),(),return) +SDL_DYNAPI_PROC(bool,SDL_HasScreenKeyboardSupport,(void),(),return) +SDL_DYNAPI_PROC(bool,SDL_HideCursor,(void),(),return) +SDL_DYNAPI_PROC(bool,SDL_HideWindow,(SDL_Window *a),(a),return) SDL_DYNAPI_PROC(SDL_IOStream*,SDL_IOFromConstMem,(const void *a, size_t b),(a,b),return) SDL_DYNAPI_PROC(SDL_IOStream*,SDL_IOFromDynamicMem,(void),(),return) SDL_DYNAPI_PROC(SDL_IOStream*,SDL_IOFromFile,(const char *a, const char *b),(a,b),return) SDL_DYNAPI_PROC(SDL_IOStream*,SDL_IOFromMem,(void *a, size_t b),(a,b),return) SDL_DYNAPI_PROC(size_t,SDL_IOvprintf,(SDL_IOStream *a, SDL_PRINTF_FORMAT_STRING const char *b, va_list c),(a,b,c),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_Init,(SDL_InitFlags a),(a),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_InitHapticRumble,(SDL_Haptic *a),(a),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_InitSubSystem,(SDL_InitFlags a),(a),return) +SDL_DYNAPI_PROC(bool,SDL_Init,(SDL_InitFlags a),(a),return) +SDL_DYNAPI_PROC(bool,SDL_InitHapticRumble,(SDL_Haptic *a),(a),return) +SDL_DYNAPI_PROC(bool,SDL_InitSubSystem,(SDL_InitFlags a),(a),return) SDL_DYNAPI_PROC(void,SDL_InsertGPUDebugLabel,(SDL_GPUCommandBuffer *a, const char *b),(a,b),) -SDL_DYNAPI_PROC(SDL_bool,SDL_IsAndroidTV,(void),(),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_IsChromebook,(void),(),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_IsDeXMode,(void),(),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_IsGamepad,(SDL_JoystickID a),(a),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_IsJoystickHaptic,(SDL_Joystick *a),(a),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_IsJoystickVirtual,(SDL_JoystickID a),(a),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_IsMouseHaptic,(void),(),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_IsTablet,(void),(),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_JoystickConnected,(SDL_Joystick *a),(a),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_JoystickEventsEnabled,(void),(),return) +SDL_DYNAPI_PROC(bool,SDL_IsAndroidTV,(void),(),return) +SDL_DYNAPI_PROC(bool,SDL_IsChromebook,(void),(),return) +SDL_DYNAPI_PROC(bool,SDL_IsDeXMode,(void),(),return) +SDL_DYNAPI_PROC(bool,SDL_IsGamepad,(SDL_JoystickID a),(a),return) +SDL_DYNAPI_PROC(bool,SDL_IsJoystickHaptic,(SDL_Joystick *a),(a),return) +SDL_DYNAPI_PROC(bool,SDL_IsJoystickVirtual,(SDL_JoystickID a),(a),return) +SDL_DYNAPI_PROC(bool,SDL_IsMouseHaptic,(void),(),return) +SDL_DYNAPI_PROC(bool,SDL_IsTablet,(void),(),return) +SDL_DYNAPI_PROC(bool,SDL_JoystickConnected,(SDL_Joystick *a),(a),return) +SDL_DYNAPI_PROC(bool,SDL_JoystickEventsEnabled,(void),(),return) +SDL_DYNAPI_PROC(bool,SDL_KillProcess,(SDL_Process *a, bool b),(a,b),return) SDL_DYNAPI_PROC(SDL_Surface*,SDL_LoadBMP,(const char *a),(a),return) -SDL_DYNAPI_PROC(SDL_Surface*,SDL_LoadBMP_IO,(SDL_IOStream *a, SDL_bool b),(a,b),return) +SDL_DYNAPI_PROC(SDL_Surface*,SDL_LoadBMP_IO,(SDL_IOStream *a, bool b),(a,b),return) SDL_DYNAPI_PROC(void*,SDL_LoadFile,(const char *a, size_t *b),(a,b),return) -SDL_DYNAPI_PROC(void*,SDL_LoadFile_IO,(SDL_IOStream *a, size_t *b, SDL_bool c),(a,b,c),return) +SDL_DYNAPI_PROC(void*,SDL_LoadFile_IO,(SDL_IOStream *a, size_t *b, bool c),(a,b,c),return) SDL_DYNAPI_PROC(SDL_FunctionPointer,SDL_LoadFunction,(void *a, const char *b),(a,b),return) SDL_DYNAPI_PROC(void*,SDL_LoadObject,(const char *a),(a),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_LoadWAV,(const char *a, SDL_AudioSpec *b, Uint8 **c, Uint32 *d),(a,b,c,d),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_LoadWAV_IO,(SDL_IOStream *a, SDL_bool b, SDL_AudioSpec *c, Uint8 **d, Uint32 *e),(a,b,c,d,e),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_LockAudioStream,(SDL_AudioStream *a),(a),return) +SDL_DYNAPI_PROC(bool,SDL_LoadWAV,(const char *a, SDL_AudioSpec *b, Uint8 **c, Uint32 *d),(a,b,c,d),return) +SDL_DYNAPI_PROC(bool,SDL_LoadWAV_IO,(SDL_IOStream *a, bool b, SDL_AudioSpec *c, Uint8 **d, Uint32 *e),(a,b,c,d,e),return) +SDL_DYNAPI_PROC(bool,SDL_LockAudioStream,(SDL_AudioStream *a),(a),return) SDL_DYNAPI_PROC(void,SDL_LockJoysticks,(void),(),) SDL_DYNAPI_PROC(void,SDL_LockMutex,(SDL_Mutex *a),(a),) -SDL_DYNAPI_PROC(SDL_bool,SDL_LockProperties,(SDL_PropertiesID a),(a),return) +SDL_DYNAPI_PROC(bool,SDL_LockProperties,(SDL_PropertiesID a),(a),return) SDL_DYNAPI_PROC(void,SDL_LockRWLockForReading,(SDL_RWLock *a),(a),) SDL_DYNAPI_PROC(void,SDL_LockRWLockForWriting,(SDL_RWLock *a),(a),) SDL_DYNAPI_PROC(void,SDL_LockSpinlock,(SDL_SpinLock *a),(a),) -SDL_DYNAPI_PROC(SDL_bool,SDL_LockSurface,(SDL_Surface *a),(a),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_LockTexture,(SDL_Texture *a, const SDL_Rect *b, void **c, int *d),(a,b,c,d),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_LockTextureToSurface,(SDL_Texture *a, const SDL_Rect *b, SDL_Surface **c),(a,b,c),return) +SDL_DYNAPI_PROC(bool,SDL_LockSurface,(SDL_Surface *a),(a),return) +SDL_DYNAPI_PROC(bool,SDL_LockTexture,(SDL_Texture *a, const SDL_Rect *b, void **c, int *d),(a,b,c,d),return) +SDL_DYNAPI_PROC(bool,SDL_LockTextureToSurface,(SDL_Texture *a, const SDL_Rect *b, SDL_Surface **c),(a,b,c),return) SDL_DYNAPI_PROC(void,SDL_LogMessageV,(int a, SDL_LogPriority b, SDL_PRINTF_FORMAT_STRING const char *c, va_list d),(a,b,c,d),) -SDL_DYNAPI_PROC(void*,SDL_MapGPUTransferBuffer,(SDL_GPUDevice *a, SDL_GPUTransferBuffer *b, SDL_bool c),(a,b,c),return) +SDL_DYNAPI_PROC(void*,SDL_MapGPUTransferBuffer,(SDL_GPUDevice *a, SDL_GPUTransferBuffer *b, bool c),(a,b,c),return) SDL_DYNAPI_PROC(Uint32,SDL_MapRGB,(const SDL_PixelFormatDetails *a, const SDL_Palette *b, Uint8 c, Uint8 d, Uint8 e),(a,b,c,d,e),return) SDL_DYNAPI_PROC(Uint32,SDL_MapRGBA,(const SDL_PixelFormatDetails *a, const SDL_Palette *b, Uint8 c, Uint8 d, Uint8 e, Uint8 f),(a,b,c,d,e,f),return) SDL_DYNAPI_PROC(Uint32,SDL_MapSurfaceRGB,(SDL_Surface *a, Uint8 b, Uint8 c, Uint8 d),(a,b,c,d),return) SDL_DYNAPI_PROC(Uint32,SDL_MapSurfaceRGBA,(SDL_Surface *a, Uint8 b, Uint8 c, Uint8 d, Uint8 e),(a,b,c,d,e),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_MaximizeWindow,(SDL_Window *a),(a),return) +SDL_DYNAPI_PROC(bool,SDL_MaximizeWindow,(SDL_Window *a),(a),return) SDL_DYNAPI_PROC(void,SDL_MemoryBarrierAcquireFunction,(void),(),) SDL_DYNAPI_PROC(void,SDL_MemoryBarrierReleaseFunction,(void),(),) SDL_DYNAPI_PROC(SDL_MetalView,SDL_Metal_CreateView,(SDL_Window *a),(a),return) SDL_DYNAPI_PROC(void,SDL_Metal_DestroyView,(SDL_MetalView a),(a),) SDL_DYNAPI_PROC(void*,SDL_Metal_GetLayer,(SDL_MetalView a),(a),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_MinimizeWindow,(SDL_Window *a),(a),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_MixAudio,(Uint8 *a, const Uint8 *b, SDL_AudioFormat c, Uint32 d, float e),(a,b,c,d,e),return) +SDL_DYNAPI_PROC(bool,SDL_MinimizeWindow,(SDL_Window *a),(a),return) +SDL_DYNAPI_PROC(bool,SDL_MixAudio,(Uint8 *a, const Uint8 *b, SDL_AudioFormat c, Uint32 d, float e),(a,b,c,d,e),return) SDL_DYNAPI_PROC(void,SDL_OnApplicationDidChangeStatusBarOrientation,(void),(),) SDL_DYNAPI_PROC(void,SDL_OnApplicationDidEnterBackground,(void),(),) SDL_DYNAPI_PROC(void,SDL_OnApplicationDidEnterForeground,(void),(),) @@ -683,48 +701,49 @@ SDL_DYNAPI_PROC(SDL_Joystick*,SDL_OpenJoystick,(SDL_JoystickID a),(a),return) SDL_DYNAPI_PROC(SDL_Sensor*,SDL_OpenSensor,(SDL_SensorID a),(a),return) SDL_DYNAPI_PROC(SDL_Storage*,SDL_OpenStorage,(const SDL_StorageInterface *a, void *b),(a,b),return) SDL_DYNAPI_PROC(SDL_Storage*,SDL_OpenTitleStorage,(const char *a, SDL_PropertiesID b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_OpenURL,(const char *a),(a),return) +SDL_DYNAPI_PROC(bool,SDL_OpenURL,(const char *a),(a),return) SDL_DYNAPI_PROC(SDL_Storage*,SDL_OpenUserStorage,(const char *a, const char *b, SDL_PropertiesID c),(a,b,c),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_OutOfMemory,(void),(),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_PauseAudioDevice,(SDL_AudioDeviceID a),(a),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_PauseAudioStreamDevice,(SDL_AudioStream *a),(a),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_PauseHaptic,(SDL_Haptic *a),(a),return) +SDL_DYNAPI_PROC(bool,SDL_OutOfMemory,(void),(),return) +SDL_DYNAPI_PROC(bool,SDL_PauseAudioDevice,(SDL_AudioDeviceID a),(a),return) +SDL_DYNAPI_PROC(bool,SDL_PauseAudioStreamDevice,(SDL_AudioStream *a),(a),return) +SDL_DYNAPI_PROC(bool,SDL_PauseHaptic,(SDL_Haptic *a),(a),return) SDL_DYNAPI_PROC(int,SDL_PeepEvents,(SDL_Event *a, int b, SDL_EventAction c, Uint32 d, Uint32 e),(a,b,c,d,e),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_PlayHapticRumble,(SDL_Haptic *a, float b, Uint32 c),(a,b,c),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_PollEvent,(SDL_Event *a),(a),return) +SDL_DYNAPI_PROC(bool,SDL_PlayHapticRumble,(SDL_Haptic *a, float b, Uint32 c),(a,b,c),return) +SDL_DYNAPI_PROC(bool,SDL_PollEvent,(SDL_Event *a),(a),return) SDL_DYNAPI_PROC(void,SDL_PopGPUDebugGroup,(SDL_GPUCommandBuffer *a),(a),) -SDL_DYNAPI_PROC(SDL_bool,SDL_PremultiplyAlpha,(int a, int b, SDL_PixelFormat c, const void *d, int e, SDL_PixelFormat f, void *g, int h, SDL_bool i),(a,b,c,d,e,f,g,h,i),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_PremultiplySurfaceAlpha,(SDL_Surface *a, SDL_bool b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_PremultiplyAlpha,(int a, int b, SDL_PixelFormat c, const void *d, int e, SDL_PixelFormat f, void *g, int h, bool i),(a,b,c,d,e,f,g,h,i),return) +SDL_DYNAPI_PROC(bool,SDL_PremultiplySurfaceAlpha,(SDL_Surface *a, bool b),(a,b),return) SDL_DYNAPI_PROC(void,SDL_PumpEvents,(void),(),) -SDL_DYNAPI_PROC(SDL_bool,SDL_PushEvent,(SDL_Event *a),(a),return) +SDL_DYNAPI_PROC(bool,SDL_PushEvent,(SDL_Event *a),(a),return) SDL_DYNAPI_PROC(void,SDL_PushGPUComputeUniformData,(SDL_GPUCommandBuffer *a, Uint32 b, const void *c, Uint32 d),(a,b,c,d),) SDL_DYNAPI_PROC(void,SDL_PushGPUDebugGroup,(SDL_GPUCommandBuffer *a, const char *b),(a,b),) SDL_DYNAPI_PROC(void,SDL_PushGPUFragmentUniformData,(SDL_GPUCommandBuffer *a, Uint32 b, const void *c, Uint32 d),(a,b,c,d),) SDL_DYNAPI_PROC(void,SDL_PushGPUVertexUniformData,(SDL_GPUCommandBuffer *a, Uint32 b, const void *c, Uint32 d),(a,b,c,d),) -SDL_DYNAPI_PROC(SDL_bool,SDL_PutAudioStreamData,(SDL_AudioStream *a, const void *b, int c),(a,b,c),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_QueryGPUFence,(SDL_GPUDevice *a, SDL_GPUFence *b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_PutAudioStreamData,(SDL_AudioStream *a, const void *b, int c),(a,b,c),return) +SDL_DYNAPI_PROC(bool,SDL_QueryGPUFence,(SDL_GPUDevice *a, SDL_GPUFence *b),(a,b),return) SDL_DYNAPI_PROC(void,SDL_Quit,(void),(),) SDL_DYNAPI_PROC(void,SDL_QuitSubSystem,(SDL_InitFlags a),(a),) -SDL_DYNAPI_PROC(SDL_bool,SDL_RaiseWindow,(SDL_Window *a),(a),return) +SDL_DYNAPI_PROC(bool,SDL_RaiseWindow,(SDL_Window *a),(a),return) SDL_DYNAPI_PROC(size_t,SDL_ReadIO,(SDL_IOStream *a, void *b, size_t c),(a,b,c),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_ReadS16BE,(SDL_IOStream *a, Sint16 *b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_ReadS16LE,(SDL_IOStream *a, Sint16 *b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_ReadS32BE,(SDL_IOStream *a, Sint32 *b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_ReadS32LE,(SDL_IOStream *a, Sint32 *b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_ReadS64BE,(SDL_IOStream *a, Sint64 *b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_ReadS64LE,(SDL_IOStream *a, Sint64 *b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_ReadS8,(SDL_IOStream *a, Sint8 *b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_ReadStorageFile,(SDL_Storage *a, const char *b, void *c, Uint64 d),(a,b,c,d),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_ReadSurfacePixel,(SDL_Surface *a, int b, int c, Uint8 *d, Uint8 *e, Uint8 *f, Uint8 *g),(a,b,c,d,e,f,g),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_ReadSurfacePixelFloat,(SDL_Surface *a, int b, int c, float *d, float *e, float *f, float *g),(a,b,c,d,e,f,g),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_ReadU16BE,(SDL_IOStream *a, Uint16 *b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_ReadU16LE,(SDL_IOStream *a, Uint16 *b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_ReadU32BE,(SDL_IOStream *a, Uint32 *b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_ReadU32LE,(SDL_IOStream *a, Uint32 *b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_ReadU64BE,(SDL_IOStream *a, Uint64 *b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_ReadU64LE,(SDL_IOStream *a, Uint64 *b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_ReadU8,(SDL_IOStream *a, Uint8 *b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_RegisterApp,(const char *a, Uint32 b, void *c),(a,b,c),return) +SDL_DYNAPI_PROC(void*,SDL_ReadProcess,(SDL_Process *a, size_t *b, int *c),(a,b,c),return) +SDL_DYNAPI_PROC(bool,SDL_ReadS16BE,(SDL_IOStream *a, Sint16 *b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_ReadS16LE,(SDL_IOStream *a, Sint16 *b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_ReadS32BE,(SDL_IOStream *a, Sint32 *b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_ReadS32LE,(SDL_IOStream *a, Sint32 *b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_ReadS64BE,(SDL_IOStream *a, Sint64 *b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_ReadS64LE,(SDL_IOStream *a, Sint64 *b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_ReadS8,(SDL_IOStream *a, Sint8 *b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_ReadStorageFile,(SDL_Storage *a, const char *b, void *c, Uint64 d),(a,b,c,d),return) +SDL_DYNAPI_PROC(bool,SDL_ReadSurfacePixel,(SDL_Surface *a, int b, int c, Uint8 *d, Uint8 *e, Uint8 *f, Uint8 *g),(a,b,c,d,e,f,g),return) +SDL_DYNAPI_PROC(bool,SDL_ReadSurfacePixelFloat,(SDL_Surface *a, int b, int c, float *d, float *e, float *f, float *g),(a,b,c,d,e,f,g),return) +SDL_DYNAPI_PROC(bool,SDL_ReadU16BE,(SDL_IOStream *a, Uint16 *b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_ReadU16LE,(SDL_IOStream *a, Uint16 *b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_ReadU32BE,(SDL_IOStream *a, Uint32 *b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_ReadU32LE,(SDL_IOStream *a, Uint32 *b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_ReadU64BE,(SDL_IOStream *a, Uint64 *b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_ReadU64LE,(SDL_IOStream *a, Uint64 *b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_ReadU8,(SDL_IOStream *a, Uint8 *b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_RegisterApp,(const char *a, Uint32 b, void *c),(a,b,c),return) SDL_DYNAPI_PROC(Uint32,SDL_RegisterEvents,(int a),(a),return) SDL_DYNAPI_PROC(void,SDL_ReleaseCameraFrame,(SDL_Camera *a, SDL_Surface *b),(a,b),) SDL_DYNAPI_PROC(void,SDL_ReleaseGPUBuffer,(SDL_GPUDevice *a, SDL_GPUBuffer *b),(a,b),) @@ -736,215 +755,222 @@ SDL_DYNAPI_PROC(void,SDL_ReleaseGPUShader,(SDL_GPUDevice *a, SDL_GPUShader *b),( SDL_DYNAPI_PROC(void,SDL_ReleaseGPUTexture,(SDL_GPUDevice *a, SDL_GPUTexture *b),(a,b),) SDL_DYNAPI_PROC(void,SDL_ReleaseGPUTransferBuffer,(SDL_GPUDevice *a, SDL_GPUTransferBuffer *b),(a,b),) SDL_DYNAPI_PROC(void,SDL_ReleaseWindowFromGPUDevice,(SDL_GPUDevice *a, SDL_Window *b),(a,b),) -SDL_DYNAPI_PROC(SDL_bool,SDL_ReloadGamepadMappings,(void),(),return) +SDL_DYNAPI_PROC(bool,SDL_ReloadGamepadMappings,(void),(),return) SDL_DYNAPI_PROC(void,SDL_RemoveEventWatch,(SDL_EventFilter a, void *b),(a,b),) SDL_DYNAPI_PROC(void,SDL_RemoveHintCallback,(const char *a, SDL_HintCallback b, void *c),(a,b,c),) -SDL_DYNAPI_PROC(SDL_bool,SDL_RemovePath,(const char *a),(a),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_RemoveStoragePath,(SDL_Storage *a, const char *b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_RemovePath,(const char *a),(a),return) +SDL_DYNAPI_PROC(bool,SDL_RemoveStoragePath,(SDL_Storage *a, const char *b),(a,b),return) SDL_DYNAPI_PROC(void,SDL_RemoveSurfaceAlternateImages,(SDL_Surface *a),(a),) -SDL_DYNAPI_PROC(SDL_bool,SDL_RemoveTimer,(SDL_TimerID a),(a),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_RenamePath,(const char *a, const char *b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_RenameStoragePath,(SDL_Storage *a, const char *b, const char *c),(a,b,c),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_RenderClear,(SDL_Renderer *a),(a),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_RenderClipEnabled,(SDL_Renderer *a),(a),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_RenderCoordinatesFromWindow,(SDL_Renderer *a, float b, float c, float *d, float *e),(a,b,c,d,e),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_RenderCoordinatesToWindow,(SDL_Renderer *a, float b, float c, float *d, float *e),(a,b,c,d,e),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_RenderFillRect,(SDL_Renderer *a, const SDL_FRect *b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_RenderFillRects,(SDL_Renderer *a, const SDL_FRect *b, int c),(a,b,c),return) -SDL_DYNAPI_PROC(SDL_bool,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(SDL_bool,SDL_RenderGeometryRaw,(SDL_Renderer *a, SDL_Texture *b, const float *c, int d, const SDL_FColor *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(SDL_bool,SDL_RenderLine,(SDL_Renderer *a, float b, float c, float d, float e),(a,b,c,d,e),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_RenderLines,(SDL_Renderer *a, const SDL_FPoint *b, int c),(a,b,c),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_RenderPoint,(SDL_Renderer *a, float b, float c),(a,b,c),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_RenderPoints,(SDL_Renderer *a, const SDL_FPoint *b, int c),(a,b,c),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_RenderPresent,(SDL_Renderer *a),(a),return) +SDL_DYNAPI_PROC(bool,SDL_RemoveTimer,(SDL_TimerID a),(a),return) +SDL_DYNAPI_PROC(bool,SDL_RenamePath,(const char *a, const char *b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_RenameStoragePath,(SDL_Storage *a, const char *b, const char *c),(a,b,c),return) +SDL_DYNAPI_PROC(bool,SDL_RenderClear,(SDL_Renderer *a),(a),return) +SDL_DYNAPI_PROC(bool,SDL_RenderClipEnabled,(SDL_Renderer *a),(a),return) +SDL_DYNAPI_PROC(bool,SDL_RenderCoordinatesFromWindow,(SDL_Renderer *a, float b, float c, float *d, float *e),(a,b,c,d,e),return) +SDL_DYNAPI_PROC(bool,SDL_RenderCoordinatesToWindow,(SDL_Renderer *a, float b, float c, float *d, float *e),(a,b,c,d,e),return) +SDL_DYNAPI_PROC(bool,SDL_RenderFillRect,(SDL_Renderer *a, const SDL_FRect *b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_RenderFillRects,(SDL_Renderer *a, const SDL_FRect *b, int c),(a,b,c),return) +SDL_DYNAPI_PROC(bool,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(bool,SDL_RenderGeometryRaw,(SDL_Renderer *a, SDL_Texture *b, const float *c, int d, const SDL_FColor *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(bool,SDL_RenderLine,(SDL_Renderer *a, float b, float c, float d, float e),(a,b,c,d,e),return) +SDL_DYNAPI_PROC(bool,SDL_RenderLines,(SDL_Renderer *a, const SDL_FPoint *b, int c),(a,b,c),return) +SDL_DYNAPI_PROC(bool,SDL_RenderPoint,(SDL_Renderer *a, float b, float c),(a,b,c),return) +SDL_DYNAPI_PROC(bool,SDL_RenderPoints,(SDL_Renderer *a, const SDL_FPoint *b, int c),(a,b,c),return) +SDL_DYNAPI_PROC(bool,SDL_RenderPresent,(SDL_Renderer *a),(a),return) SDL_DYNAPI_PROC(SDL_Surface*,SDL_RenderReadPixels,(SDL_Renderer *a, const SDL_Rect *b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_RenderRect,(SDL_Renderer *a, const SDL_FRect *b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_RenderRects,(SDL_Renderer *a, const SDL_FRect *b, int c),(a,b,c),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_RenderTexture,(SDL_Renderer *a, SDL_Texture *b, const SDL_FRect *c, const SDL_FRect *d),(a,b,c,d),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_RenderTexture9Grid,(SDL_Renderer *a, SDL_Texture *b, const SDL_FRect *c, float d, float e, float f, float g, float h, const SDL_FRect *i),(a,b,c,d,e,f,g,h,i),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_RenderTextureRotated,(SDL_Renderer *a, SDL_Texture *b, const SDL_FRect *c, const SDL_FRect *d, const double e, const SDL_FPoint *f, const SDL_FlipMode g),(a,b,c,d,e,f,g),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_RenderTextureTiled,(SDL_Renderer *a, SDL_Texture *b, const SDL_FRect *c, float d, const SDL_FRect *e),(a,b,c,d,e),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_RenderViewportSet,(SDL_Renderer *a),(a),return) +SDL_DYNAPI_PROC(bool,SDL_RenderRect,(SDL_Renderer *a, const SDL_FRect *b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_RenderRects,(SDL_Renderer *a, const SDL_FRect *b, int c),(a,b,c),return) +SDL_DYNAPI_PROC(bool,SDL_RenderTexture,(SDL_Renderer *a, SDL_Texture *b, const SDL_FRect *c, const SDL_FRect *d),(a,b,c,d),return) +SDL_DYNAPI_PROC(bool,SDL_RenderTexture9Grid,(SDL_Renderer *a, SDL_Texture *b, const SDL_FRect *c, float d, float e, float f, float g, float h, const SDL_FRect *i),(a,b,c,d,e,f,g,h,i),return) +SDL_DYNAPI_PROC(bool,SDL_RenderTextureRotated,(SDL_Renderer *a, SDL_Texture *b, const SDL_FRect *c, const SDL_FRect *d, const double e, const SDL_FPoint *f, const SDL_FlipMode g),(a,b,c,d,e,f,g),return) +SDL_DYNAPI_PROC(bool,SDL_RenderTextureTiled,(SDL_Renderer *a, SDL_Texture *b, const SDL_FRect *c, float d, const SDL_FRect *e),(a,b,c,d,e),return) +SDL_DYNAPI_PROC(bool,SDL_RenderViewportSet,(SDL_Renderer *a),(a),return) SDL_DYNAPI_PROC(SDL_AssertState,SDL_ReportAssertion,(SDL_AssertData *a, const char *b, const char *c, int d),(a,b,c,d),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_RequestAndroidPermission,(const char *a, SDL_RequestAndroidPermissionCallback b, void *c),(a,b,c),return) +SDL_DYNAPI_PROC(bool,SDL_RequestAndroidPermission,(const char *a, SDL_RequestAndroidPermissionCallback b, void *c),(a,b,c),return) SDL_DYNAPI_PROC(void,SDL_ResetAssertionReport,(void),(),) -SDL_DYNAPI_PROC(SDL_bool,SDL_ResetHint,(const char *a),(a),return) +SDL_DYNAPI_PROC(bool,SDL_ResetHint,(const char *a),(a),return) SDL_DYNAPI_PROC(void,SDL_ResetHints,(void),(),) SDL_DYNAPI_PROC(void,SDL_ResetKeyboard,(void),(),) SDL_DYNAPI_PROC(void,SDL_ResetLogPriorities,(void),(),) -SDL_DYNAPI_PROC(SDL_bool,SDL_RestoreWindow,(SDL_Window *a),(a),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_ResumeAudioDevice,(SDL_AudioDeviceID a),(a),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_ResumeAudioStreamDevice,(SDL_AudioStream *a),(a),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_ResumeHaptic,(SDL_Haptic *a),(a),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_RumbleGamepad,(SDL_Gamepad *a, Uint16 b, Uint16 c, Uint32 d),(a,b,c,d),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_RumbleGamepadTriggers,(SDL_Gamepad *a, Uint16 b, Uint16 c, Uint32 d),(a,b,c,d),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_RumbleJoystick,(SDL_Joystick *a, Uint16 b, Uint16 c, Uint32 d),(a,b,c,d),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_RumbleJoystickTriggers,(SDL_Joystick *a, Uint16 b, Uint16 c, Uint32 d),(a,b,c,d),return) +SDL_DYNAPI_PROC(bool,SDL_RestoreWindow,(SDL_Window *a),(a),return) +SDL_DYNAPI_PROC(bool,SDL_ResumeAudioDevice,(SDL_AudioDeviceID a),(a),return) +SDL_DYNAPI_PROC(bool,SDL_ResumeAudioStreamDevice,(SDL_AudioStream *a),(a),return) +SDL_DYNAPI_PROC(bool,SDL_ResumeHaptic,(SDL_Haptic *a),(a),return) +SDL_DYNAPI_PROC(bool,SDL_RumbleGamepad,(SDL_Gamepad *a, Uint16 b, Uint16 c, Uint32 d),(a,b,c,d),return) +SDL_DYNAPI_PROC(bool,SDL_RumbleGamepadTriggers,(SDL_Gamepad *a, Uint16 b, Uint16 c, Uint32 d),(a,b,c,d),return) +SDL_DYNAPI_PROC(bool,SDL_RumbleJoystick,(SDL_Joystick *a, Uint16 b, Uint16 c, Uint32 d),(a,b,c,d),return) +SDL_DYNAPI_PROC(bool,SDL_RumbleJoystickTriggers,(SDL_Joystick *a, Uint16 b, Uint16 c, Uint32 d),(a,b,c,d),return) SDL_DYNAPI_PROC(int,SDL_RunApp,(int a, char *b[], SDL_main_func c, void *d),(a,b,c,d),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_RunHapticEffect,(SDL_Haptic *a, int b, Uint32 c),(a,b,c),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_SaveBMP,(SDL_Surface *a, const char *b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_SaveBMP_IO,(SDL_Surface *a, SDL_IOStream *b, SDL_bool c),(a,b,c),return) +SDL_DYNAPI_PROC(bool,SDL_RunHapticEffect,(SDL_Haptic *a, int b, Uint32 c),(a,b,c),return) +SDL_DYNAPI_PROC(bool,SDL_SaveBMP,(SDL_Surface *a, const char *b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_SaveBMP_IO,(SDL_Surface *a, SDL_IOStream *b, bool c),(a,b,c),return) SDL_DYNAPI_PROC(SDL_Surface*,SDL_ScaleSurface,(SDL_Surface *a, int b, int c, SDL_ScaleMode d),(a,b,c,d),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_ScreenKeyboardShown,(SDL_Window *a),(a),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_ScreenSaverEnabled,(void),(),return) +SDL_DYNAPI_PROC(bool,SDL_ScreenKeyboardShown,(SDL_Window *a),(a),return) +SDL_DYNAPI_PROC(bool,SDL_ScreenSaverEnabled,(void),(),return) SDL_DYNAPI_PROC(Sint64,SDL_SeekIO,(SDL_IOStream *a, Sint64 b, SDL_IOWhence c),(a,b,c),return) SDL_DYNAPI_PROC(void,SDL_SendAndroidBackButton,(void),(),) -SDL_DYNAPI_PROC(SDL_bool,SDL_SendAndroidMessage,(Uint32 a, int b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_SendGamepadEffect,(SDL_Gamepad *a, const void *b, int c),(a,b,c),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_SendJoystickEffect,(SDL_Joystick *a, const void *b, int c),(a,b,c),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_SendJoystickVirtualSensorData,(SDL_Joystick *a, SDL_SensorType b, Uint64 c, const float *d, int e),(a,b,c,d,e),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_SetAppMetadata,(const char *a, const char *b, const char *c),(a,b,c),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_SetAppMetadataProperty,(const char *a, const char *b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_SendAndroidMessage,(Uint32 a, int b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_SendGamepadEffect,(SDL_Gamepad *a, const void *b, int c),(a,b,c),return) +SDL_DYNAPI_PROC(bool,SDL_SendJoystickEffect,(SDL_Joystick *a, const void *b, int c),(a,b,c),return) +SDL_DYNAPI_PROC(bool,SDL_SendJoystickVirtualSensorData,(SDL_Joystick *a, SDL_SensorType b, Uint64 c, const float *d, int e),(a,b,c,d,e),return) +SDL_DYNAPI_PROC(bool,SDL_SetAppMetadata,(const char *a, const char *b, const char *c),(a,b,c),return) +SDL_DYNAPI_PROC(bool,SDL_SetAppMetadataProperty,(const char *a, const char *b),(a,b),return) SDL_DYNAPI_PROC(void,SDL_SetAssertionHandler,(SDL_AssertionHandler a, void *b),(a,b),) -SDL_DYNAPI_PROC(SDL_bool,SDL_SetAudioDeviceGain,(SDL_AudioDeviceID a, float b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_SetAudioPostmixCallback,(SDL_AudioDeviceID a, SDL_AudioPostmixCallback b, void *c),(a,b,c),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_SetAudioStreamFormat,(SDL_AudioStream *a, const SDL_AudioSpec *b, const SDL_AudioSpec *c),(a,b,c),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_SetAudioStreamFrequencyRatio,(SDL_AudioStream *a, float b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_SetAudioStreamGain,(SDL_AudioStream *a, float b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_SetAudioStreamGetCallback,(SDL_AudioStream *a, SDL_AudioStreamCallback b, void *c),(a,b,c),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_SetAudioStreamInputChannelMap,(SDL_AudioStream *a, const int *b, int c),(a,b,c),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_SetAudioStreamOutputChannelMap,(SDL_AudioStream *a, const int *b, int c),(a,b,c),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_SetAudioStreamPutCallback,(SDL_AudioStream *a, SDL_AudioStreamCallback b, void *c),(a,b,c),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_SetBooleanProperty,(SDL_PropertiesID a, const char *b, SDL_bool c),(a,b,c),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_SetClipboardData,(SDL_ClipboardDataCallback a, SDL_ClipboardCleanupCallback b, void *c, const char **d, size_t e),(a,b,c,d,e),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_SetClipboardText,(const char *a),(a),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_SetCursor,(SDL_Cursor *a),(a),return) -SDL_DYNAPI_PROC(void,SDL_SetEventEnabled,(Uint32 a, SDL_bool b),(a,b),) +SDL_DYNAPI_PROC(int,SDL_SetAtomicInt,(SDL_AtomicInt *a, int b),(a,b),return) +SDL_DYNAPI_PROC(void*,SDL_SetAtomicPointer,(void **a, void *b),(a,b),return) +SDL_DYNAPI_PROC(Uint32,SDL_SetAtomicU32,(SDL_AtomicU32 *a, Uint32 b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_SetAudioDeviceGain,(SDL_AudioDeviceID a, float b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_SetAudioPostmixCallback,(SDL_AudioDeviceID a, SDL_AudioPostmixCallback b, void *c),(a,b,c),return) +SDL_DYNAPI_PROC(bool,SDL_SetAudioStreamFormat,(SDL_AudioStream *a, const SDL_AudioSpec *b, const SDL_AudioSpec *c),(a,b,c),return) +SDL_DYNAPI_PROC(bool,SDL_SetAudioStreamFrequencyRatio,(SDL_AudioStream *a, float b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_SetAudioStreamGain,(SDL_AudioStream *a, float b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_SetAudioStreamGetCallback,(SDL_AudioStream *a, SDL_AudioStreamCallback b, void *c),(a,b,c),return) +SDL_DYNAPI_PROC(bool,SDL_SetAudioStreamInputChannelMap,(SDL_AudioStream *a, const int *b, int c),(a,b,c),return) +SDL_DYNAPI_PROC(bool,SDL_SetAudioStreamOutputChannelMap,(SDL_AudioStream *a, const int *b, int c),(a,b,c),return) +SDL_DYNAPI_PROC(bool,SDL_SetAudioStreamPutCallback,(SDL_AudioStream *a, SDL_AudioStreamCallback b, void *c),(a,b,c),return) +SDL_DYNAPI_PROC(bool,SDL_SetBooleanProperty,(SDL_PropertiesID a, const char *b, bool c),(a,b,c),return) +SDL_DYNAPI_PROC(bool,SDL_SetClipboardData,(SDL_ClipboardDataCallback a, SDL_ClipboardCleanupCallback b, void *c, const char **d, size_t e),(a,b,c,d,e),return) +SDL_DYNAPI_PROC(bool,SDL_SetClipboardText,(const char *a),(a),return) +SDL_DYNAPI_PROC(bool,SDL_SetCursor,(SDL_Cursor *a),(a),return) +SDL_DYNAPI_PROC(bool,SDL_SetEnvironmentVariable,(SDL_Environment *a, const char *b, const char *c, bool d),(a,b,c,d),return) +SDL_DYNAPI_PROC(void,SDL_SetEventEnabled,(Uint32 a, bool b),(a,b),) SDL_DYNAPI_PROC(void,SDL_SetEventFilter,(SDL_EventFilter a, void *b),(a,b),) -SDL_DYNAPI_PROC(SDL_bool,SDL_SetFloatProperty,(SDL_PropertiesID a, const char *b, float c),(a,b,c),return) +SDL_DYNAPI_PROC(bool,SDL_SetFloatProperty,(SDL_PropertiesID a, const char *b, float c),(a,b,c),return) +SDL_DYNAPI_PROC(void,SDL_SetGPUBlendConstants,(SDL_GPURenderPass *a, SDL_FColor b),(a,b),) SDL_DYNAPI_PROC(void,SDL_SetGPUBufferName,(SDL_GPUDevice *a, SDL_GPUBuffer *b, const char *c),(a,b,c),) -SDL_DYNAPI_PROC(void,SDL_SetGPUScissor,(SDL_GPURenderPass *a, SDL_Rect *b),(a,b),) -SDL_DYNAPI_PROC(SDL_bool,SDL_SetGPUSwapchainParameters,(SDL_GPUDevice *a, SDL_Window *b, SDL_GPUSwapchainComposition c, SDL_GPUPresentMode d),(a,b,c,d),return) +SDL_DYNAPI_PROC(void,SDL_SetGPUScissor,(SDL_GPURenderPass *a, const SDL_Rect *b),(a,b),) +SDL_DYNAPI_PROC(void,SDL_SetGPUStencilReference,(SDL_GPURenderPass *a, Uint8 b),(a,b),) +SDL_DYNAPI_PROC(bool,SDL_SetGPUSwapchainParameters,(SDL_GPUDevice *a, SDL_Window *b, SDL_GPUSwapchainComposition c, SDL_GPUPresentMode d),(a,b,c,d),return) SDL_DYNAPI_PROC(void,SDL_SetGPUTextureName,(SDL_GPUDevice *a, SDL_GPUTexture *b, const char *c),(a,b,c),) -SDL_DYNAPI_PROC(void,SDL_SetGPUViewport,(SDL_GPURenderPass *a, SDL_GPUViewport *b),(a,b),) -SDL_DYNAPI_PROC(void,SDL_SetGamepadEventsEnabled,(SDL_bool a),(a),) -SDL_DYNAPI_PROC(SDL_bool,SDL_SetGamepadLED,(SDL_Gamepad *a, Uint8 b, Uint8 c, Uint8 d),(a,b,c,d),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_SetGamepadMapping,(SDL_JoystickID a, const char *b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_SetGamepadPlayerIndex,(SDL_Gamepad *a, int b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_SetGamepadSensorEnabled,(SDL_Gamepad *a, SDL_SensorType b, SDL_bool c),(a,b,c),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_SetHapticAutocenter,(SDL_Haptic *a, int b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_SetHapticGain,(SDL_Haptic *a, int b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_SetHint,(const char *a, const char *b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_SetHintWithPriority,(const char *a, const char *b, SDL_HintPriority c),(a,b,c),return) -SDL_DYNAPI_PROC(void,SDL_SetJoystickEventsEnabled,(SDL_bool a),(a),) -SDL_DYNAPI_PROC(SDL_bool,SDL_SetJoystickLED,(SDL_Joystick *a, Uint8 b, Uint8 c, Uint8 d),(a,b,c,d),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_SetJoystickPlayerIndex,(SDL_Joystick *a, int b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_SetJoystickVirtualAxis,(SDL_Joystick *a, int b, Sint16 c),(a,b,c),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_SetJoystickVirtualBall,(SDL_Joystick *a, int b, Sint16 c, Sint16 d),(a,b,c,d),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_SetJoystickVirtualButton,(SDL_Joystick *a, int b, Uint8 c),(a,b,c),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_SetJoystickVirtualHat,(SDL_Joystick *a, int b, Uint8 c),(a,b,c),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_SetJoystickVirtualTouchpad,(SDL_Joystick *a, int b, int c, Uint8 d, float e, float f, float g),(a,b,c,d,e,f,g),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_SetLinuxThreadPriority,(Sint64 a, int b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_SetLinuxThreadPriorityAndPolicy,(Sint64 a, int b, int c),(a,b,c),return) +SDL_DYNAPI_PROC(void,SDL_SetGPUViewport,(SDL_GPURenderPass *a, const SDL_GPUViewport *b),(a,b),) +SDL_DYNAPI_PROC(void,SDL_SetGamepadEventsEnabled,(bool a),(a),) +SDL_DYNAPI_PROC(bool,SDL_SetGamepadLED,(SDL_Gamepad *a, Uint8 b, Uint8 c, Uint8 d),(a,b,c,d),return) +SDL_DYNAPI_PROC(bool,SDL_SetGamepadMapping,(SDL_JoystickID a, const char *b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_SetGamepadPlayerIndex,(SDL_Gamepad *a, int b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_SetGamepadSensorEnabled,(SDL_Gamepad *a, SDL_SensorType b, bool c),(a,b,c),return) +SDL_DYNAPI_PROC(bool,SDL_SetHapticAutocenter,(SDL_Haptic *a, int b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_SetHapticGain,(SDL_Haptic *a, int b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_SetHint,(const char *a, const char *b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_SetHintWithPriority,(const char *a, const char *b, SDL_HintPriority c),(a,b,c),return) +SDL_DYNAPI_PROC(void,SDL_SetJoystickEventsEnabled,(bool a),(a),) +SDL_DYNAPI_PROC(bool,SDL_SetJoystickLED,(SDL_Joystick *a, Uint8 b, Uint8 c, Uint8 d),(a,b,c,d),return) +SDL_DYNAPI_PROC(bool,SDL_SetJoystickPlayerIndex,(SDL_Joystick *a, int b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_SetJoystickVirtualAxis,(SDL_Joystick *a, int b, Sint16 c),(a,b,c),return) +SDL_DYNAPI_PROC(bool,SDL_SetJoystickVirtualBall,(SDL_Joystick *a, int b, Sint16 c, Sint16 d),(a,b,c,d),return) +SDL_DYNAPI_PROC(bool,SDL_SetJoystickVirtualButton,(SDL_Joystick *a, int b, bool c),(a,b,c),return) +SDL_DYNAPI_PROC(bool,SDL_SetJoystickVirtualHat,(SDL_Joystick *a, int b, Uint8 c),(a,b,c),return) +SDL_DYNAPI_PROC(bool,SDL_SetJoystickVirtualTouchpad,(SDL_Joystick *a, int b, int c, bool d, float e, float f, float g),(a,b,c,d,e,f,g),return) +SDL_DYNAPI_PROC(bool,SDL_SetLinuxThreadPriority,(Sint64 a, int b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_SetLinuxThreadPriorityAndPolicy,(Sint64 a, int b, int c),(a,b,c),return) SDL_DYNAPI_PROC(void,SDL_SetLogOutputFunction,(SDL_LogOutputFunction a, void *b),(a,b),) SDL_DYNAPI_PROC(void,SDL_SetLogPriorities,(SDL_LogPriority a),(a),) SDL_DYNAPI_PROC(void,SDL_SetLogPriority,(int a, SDL_LogPriority b),(a,b),) -SDL_DYNAPI_PROC(SDL_bool,SDL_SetLogPriorityPrefix,(SDL_LogPriority a, const char *b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_SetLogPriorityPrefix,(SDL_LogPriority a, const char *b),(a,b),return) SDL_DYNAPI_PROC(void,SDL_SetMainReady,(void),(),) -SDL_DYNAPI_PROC(SDL_bool,SDL_SetMemoryFunctions,(SDL_malloc_func a, SDL_calloc_func b, SDL_realloc_func c, SDL_free_func d),(a,b,c,d),return) +SDL_DYNAPI_PROC(bool,SDL_SetMemoryFunctions,(SDL_malloc_func a, SDL_calloc_func b, SDL_realloc_func c, SDL_free_func d),(a,b,c,d),return) SDL_DYNAPI_PROC(void,SDL_SetModState,(SDL_Keymod a),(a),) -SDL_DYNAPI_PROC(SDL_bool,SDL_SetNumberProperty,(SDL_PropertiesID a, const char *b, Sint64 c),(a,b,c),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_SetPaletteColors,(SDL_Palette *a, const SDL_Color *b, int c, int d),(a,b,c,d),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_SetPointerProperty,(SDL_PropertiesID a, const char *b, void *c),(a,b,c),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_SetPointerPropertyWithCleanup,(SDL_PropertiesID a, const char *b, void *c, SDL_CleanupPropertyCallback d, void *e),(a,b,c,d,e),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_SetPrimarySelectionText,(const char *a),(a),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_SetRenderClipRect,(SDL_Renderer *a, const SDL_Rect *b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_SetRenderColorScale,(SDL_Renderer *a, float b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_SetRenderDrawBlendMode,(SDL_Renderer *a, SDL_BlendMode b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_SetRenderDrawColor,(SDL_Renderer *a, Uint8 b, Uint8 c, Uint8 d, Uint8 e),(a,b,c,d,e),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_SetRenderDrawColorFloat,(SDL_Renderer *a, float b, float c, float d, float e),(a,b,c,d,e),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_SetRenderLogicalPresentation,(SDL_Renderer *a, int b, int c, SDL_RendererLogicalPresentation d, SDL_ScaleMode e),(a,b,c,d,e),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_SetRenderScale,(SDL_Renderer *a, float b, float c),(a,b,c),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_SetRenderTarget,(SDL_Renderer *a, SDL_Texture *b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_SetRenderVSync,(SDL_Renderer *a, int b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_SetRenderViewport,(SDL_Renderer *a, const SDL_Rect *b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_SetScancodeName,(SDL_Scancode a, const char *b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_SetStringProperty,(SDL_PropertiesID a, const char *b, const char *c),(a,b,c),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_SetSurfaceAlphaMod,(SDL_Surface *a, Uint8 b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_SetSurfaceBlendMode,(SDL_Surface *a, SDL_BlendMode b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_SetSurfaceClipRect,(SDL_Surface *a, const SDL_Rect *b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_SetSurfaceColorKey,(SDL_Surface *a, SDL_bool b, Uint32 c),(a,b,c),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_SetSurfaceColorMod,(SDL_Surface *a, Uint8 b, Uint8 c, Uint8 d),(a,b,c,d),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_SetSurfaceColorspace,(SDL_Surface *a, SDL_Colorspace b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_SetSurfacePalette,(SDL_Surface *a, SDL_Palette *b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_SetSurfaceRLE,(SDL_Surface *a, SDL_bool b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_SetTLS,(SDL_TLSID *a, const void *b, SDL_TLSDestructorCallback c),(a,b,c),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_SetTextInputArea,(SDL_Window *a, const SDL_Rect *b, int c),(a,b,c),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_SetTextureAlphaMod,(SDL_Texture *a, Uint8 b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_SetTextureAlphaModFloat,(SDL_Texture *a, float b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_SetTextureBlendMode,(SDL_Texture *a, SDL_BlendMode b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_SetTextureColorMod,(SDL_Texture *a, Uint8 b, Uint8 c, Uint8 d),(a,b,c,d),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_SetTextureColorModFloat,(SDL_Texture *a, float b, float c, float d),(a,b,c,d),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_SetTextureScaleMode,(SDL_Texture *a, SDL_ScaleMode b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_SetThreadPriority,(SDL_ThreadPriority a),(a),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_SetWindowAlwaysOnTop,(SDL_Window *a, SDL_bool b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_SetWindowAspectRatio,(SDL_Window *a, float b, float c),(a,b,c),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_SetWindowBordered,(SDL_Window *a, SDL_bool b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_SetWindowFocusable,(SDL_Window *a, SDL_bool b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_SetWindowFullscreen,(SDL_Window *a, SDL_bool b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_SetWindowFullscreenMode,(SDL_Window *a, const SDL_DisplayMode *b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_SetWindowHitTest,(SDL_Window *a, SDL_HitTest b, void *c),(a,b,c),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_SetWindowIcon,(SDL_Window *a, SDL_Surface *b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_SetWindowKeyboardGrab,(SDL_Window *a, SDL_bool b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_SetWindowMaximumSize,(SDL_Window *a, int b, int c),(a,b,c),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_SetWindowMinimumSize,(SDL_Window *a, int b, int c),(a,b,c),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_SetWindowModalFor,(SDL_Window *a, SDL_Window *b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_SetWindowMouseGrab,(SDL_Window *a, SDL_bool b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_SetWindowMouseRect,(SDL_Window *a, const SDL_Rect *b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_SetWindowOpacity,(SDL_Window *a, float b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_SetWindowPosition,(SDL_Window *a, int b, int c),(a,b,c),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_SetWindowRelativeMouseMode,(SDL_Window *a, SDL_bool b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_SetWindowResizable,(SDL_Window *a, SDL_bool b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_SetWindowShape,(SDL_Window *a, SDL_Surface *b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_SetWindowSize,(SDL_Window *a, int b, int c),(a,b,c),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_SetWindowSurfaceVSync,(SDL_Window *a, int b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_SetWindowTitle,(SDL_Window *a, const char *b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_SetNumberProperty,(SDL_PropertiesID a, const char *b, Sint64 c),(a,b,c),return) +SDL_DYNAPI_PROC(bool,SDL_SetPaletteColors,(SDL_Palette *a, const SDL_Color *b, int c, int d),(a,b,c,d),return) +SDL_DYNAPI_PROC(bool,SDL_SetPointerProperty,(SDL_PropertiesID a, const char *b, void *c),(a,b,c),return) +SDL_DYNAPI_PROC(bool,SDL_SetPointerPropertyWithCleanup,(SDL_PropertiesID a, const char *b, void *c, SDL_CleanupPropertyCallback d, void *e),(a,b,c,d,e),return) +SDL_DYNAPI_PROC(bool,SDL_SetPrimarySelectionText,(const char *a),(a),return) +SDL_DYNAPI_PROC(bool,SDL_SetRenderClipRect,(SDL_Renderer *a, const SDL_Rect *b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_SetRenderColorScale,(SDL_Renderer *a, float b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_SetRenderDrawBlendMode,(SDL_Renderer *a, SDL_BlendMode b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_SetRenderDrawColor,(SDL_Renderer *a, Uint8 b, Uint8 c, Uint8 d, Uint8 e),(a,b,c,d,e),return) +SDL_DYNAPI_PROC(bool,SDL_SetRenderDrawColorFloat,(SDL_Renderer *a, float b, float c, float d, float e),(a,b,c,d,e),return) +SDL_DYNAPI_PROC(bool,SDL_SetRenderLogicalPresentation,(SDL_Renderer *a, int b, int c, SDL_RendererLogicalPresentation d, SDL_ScaleMode e),(a,b,c,d,e),return) +SDL_DYNAPI_PROC(bool,SDL_SetRenderScale,(SDL_Renderer *a, float b, float c),(a,b,c),return) +SDL_DYNAPI_PROC(bool,SDL_SetRenderTarget,(SDL_Renderer *a, SDL_Texture *b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_SetRenderVSync,(SDL_Renderer *a, int b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_SetRenderViewport,(SDL_Renderer *a, const SDL_Rect *b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_SetScancodeName,(SDL_Scancode a, const char *b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_SetStringProperty,(SDL_PropertiesID a, const char *b, const char *c),(a,b,c),return) +SDL_DYNAPI_PROC(bool,SDL_SetSurfaceAlphaMod,(SDL_Surface *a, Uint8 b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_SetSurfaceBlendMode,(SDL_Surface *a, SDL_BlendMode b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_SetSurfaceClipRect,(SDL_Surface *a, const SDL_Rect *b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_SetSurfaceColorKey,(SDL_Surface *a, bool b, Uint32 c),(a,b,c),return) +SDL_DYNAPI_PROC(bool,SDL_SetSurfaceColorMod,(SDL_Surface *a, Uint8 b, Uint8 c, Uint8 d),(a,b,c,d),return) +SDL_DYNAPI_PROC(bool,SDL_SetSurfaceColorspace,(SDL_Surface *a, SDL_Colorspace b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_SetSurfacePalette,(SDL_Surface *a, SDL_Palette *b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_SetSurfaceRLE,(SDL_Surface *a, bool b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_SetTLS,(SDL_TLSID *a, const void *b, SDL_TLSDestructorCallback c),(a,b,c),return) +SDL_DYNAPI_PROC(bool,SDL_SetTextInputArea,(SDL_Window *a, const SDL_Rect *b, int c),(a,b,c),return) +SDL_DYNAPI_PROC(bool,SDL_SetTextureAlphaMod,(SDL_Texture *a, Uint8 b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_SetTextureAlphaModFloat,(SDL_Texture *a, float b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_SetTextureBlendMode,(SDL_Texture *a, SDL_BlendMode b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_SetTextureColorMod,(SDL_Texture *a, Uint8 b, Uint8 c, Uint8 d),(a,b,c,d),return) +SDL_DYNAPI_PROC(bool,SDL_SetTextureColorModFloat,(SDL_Texture *a, float b, float c, float d),(a,b,c,d),return) +SDL_DYNAPI_PROC(bool,SDL_SetTextureScaleMode,(SDL_Texture *a, SDL_ScaleMode b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_SetThreadPriority,(SDL_ThreadPriority a),(a),return) +SDL_DYNAPI_PROC(bool,SDL_SetWindowAlwaysOnTop,(SDL_Window *a, bool b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_SetWindowAspectRatio,(SDL_Window *a, float b, float c),(a,b,c),return) +SDL_DYNAPI_PROC(bool,SDL_SetWindowBordered,(SDL_Window *a, bool b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_SetWindowFocusable,(SDL_Window *a, bool b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_SetWindowFullscreen,(SDL_Window *a, bool b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_SetWindowFullscreenMode,(SDL_Window *a, const SDL_DisplayMode *b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_SetWindowHitTest,(SDL_Window *a, SDL_HitTest b, void *c),(a,b,c),return) +SDL_DYNAPI_PROC(bool,SDL_SetWindowIcon,(SDL_Window *a, SDL_Surface *b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_SetWindowKeyboardGrab,(SDL_Window *a, bool b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_SetWindowMaximumSize,(SDL_Window *a, int b, int c),(a,b,c),return) +SDL_DYNAPI_PROC(bool,SDL_SetWindowMinimumSize,(SDL_Window *a, int b, int c),(a,b,c),return) +SDL_DYNAPI_PROC(bool,SDL_SetWindowModal,(SDL_Window *a, bool b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_SetWindowMouseGrab,(SDL_Window *a, bool b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_SetWindowMouseRect,(SDL_Window *a, const SDL_Rect *b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_SetWindowOpacity,(SDL_Window *a, float b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_SetWindowParent,(SDL_Window *a, SDL_Window *b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_SetWindowPosition,(SDL_Window *a, int b, int c),(a,b,c),return) +SDL_DYNAPI_PROC(bool,SDL_SetWindowRelativeMouseMode,(SDL_Window *a, bool b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_SetWindowResizable,(SDL_Window *a, bool b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_SetWindowShape,(SDL_Window *a, SDL_Surface *b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_SetWindowSize,(SDL_Window *a, int b, int c),(a,b,c),return) +SDL_DYNAPI_PROC(bool,SDL_SetWindowSurfaceVSync,(SDL_Window *a, int b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_SetWindowTitle,(SDL_Window *a, const char *b),(a,b),return) SDL_DYNAPI_PROC(void,SDL_SetWindowsMessageHook,(SDL_WindowsMessageHook a, void *b),(a,b),) SDL_DYNAPI_PROC(void,SDL_SetX11EventHook,(SDL_X11EventHook a, void *b),(a,b),) -SDL_DYNAPI_PROC(SDL_bool,SDL_SetiOSAnimationCallback,(SDL_Window *a, int b, SDL_iOSAnimationCallback c, void *d),(a,b,c,d),return) -SDL_DYNAPI_PROC(void,SDL_SetiOSEventPump,(SDL_bool a),(a),) -SDL_DYNAPI_PROC(SDL_bool,SDL_ShowAndroidToast,(const char *a, int b, int c, int d, int e),(a,b,c,d,e),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_ShowCursor,(void),(),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_ShowMessageBox,(const SDL_MessageBoxData *a, int *b),(a,b),return) -SDL_DYNAPI_PROC(void,SDL_ShowOpenFileDialog,(SDL_DialogFileCallback a, void *b, SDL_Window *c, const SDL_DialogFileFilter *d, int e, const char *f, SDL_bool g),(a,b,c,d,e,f,g),) -SDL_DYNAPI_PROC(void,SDL_ShowOpenFolderDialog,(SDL_DialogFileCallback a, void *b, SDL_Window *c, const char *d, SDL_bool e),(a,b,c,d,e),) +SDL_DYNAPI_PROC(bool,SDL_SetiOSAnimationCallback,(SDL_Window *a, int b, SDL_iOSAnimationCallback c, void *d),(a,b,c,d),return) +SDL_DYNAPI_PROC(void,SDL_SetiOSEventPump,(bool a),(a),) +SDL_DYNAPI_PROC(bool,SDL_ShowAndroidToast,(const char *a, int b, int c, int d, int e),(a,b,c,d,e),return) +SDL_DYNAPI_PROC(bool,SDL_ShowCursor,(void),(),return) +SDL_DYNAPI_PROC(bool,SDL_ShowMessageBox,(const SDL_MessageBoxData *a, int *b),(a,b),return) +SDL_DYNAPI_PROC(void,SDL_ShowOpenFileDialog,(SDL_DialogFileCallback a, void *b, SDL_Window *c, const SDL_DialogFileFilter *d, int e, const char *f, bool g),(a,b,c,d,e,f,g),) +SDL_DYNAPI_PROC(void,SDL_ShowOpenFolderDialog,(SDL_DialogFileCallback a, void *b, SDL_Window *c, const char *d, bool e),(a,b,c,d,e),) SDL_DYNAPI_PROC(void,SDL_ShowSaveFileDialog,(SDL_DialogFileCallback a, void *b, SDL_Window *c, const SDL_DialogFileFilter *d, int e, const char *f),(a,b,c,d,e,f),) -SDL_DYNAPI_PROC(SDL_bool,SDL_ShowSimpleMessageBox,(SDL_MessageBoxFlags a, const char *b, const char *c, SDL_Window *d),(a,b,c,d),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_ShowWindow,(SDL_Window *a),(a),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_ShowWindowSystemMenu,(SDL_Window *a, int b, int c),(a,b,c),return) +SDL_DYNAPI_PROC(bool,SDL_ShowSimpleMessageBox,(SDL_MessageBoxFlags a, const char *b, const char *c, SDL_Window *d),(a,b,c,d),return) +SDL_DYNAPI_PROC(bool,SDL_ShowWindow,(SDL_Window *a),(a),return) +SDL_DYNAPI_PROC(bool,SDL_ShowWindowSystemMenu,(SDL_Window *a, int b, int c),(a,b,c),return) SDL_DYNAPI_PROC(void,SDL_SignalCondition,(SDL_Condition *a),(a),) SDL_DYNAPI_PROC(void,SDL_SignalSemaphore,(SDL_Semaphore *a),(a),) -SDL_DYNAPI_PROC(SDL_bool,SDL_StartTextInput,(SDL_Window *a),(a),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_StartTextInputWithProperties,(SDL_Window *a, SDL_PropertiesID b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_StartTextInput,(SDL_Window *a),(a),return) +SDL_DYNAPI_PROC(bool,SDL_StartTextInputWithProperties,(SDL_Window *a, SDL_PropertiesID b),(a,b),return) SDL_DYNAPI_PROC(Uint32,SDL_StepUTF8,(const char **a, size_t *b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_StopHapticEffect,(SDL_Haptic *a, int b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_StopHapticEffects,(SDL_Haptic *a),(a),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_StopHapticRumble,(SDL_Haptic *a),(a),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_StopTextInput,(SDL_Window *a),(a),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_StorageReady,(SDL_Storage *a),(a),return) +SDL_DYNAPI_PROC(bool,SDL_StopHapticEffect,(SDL_Haptic *a, int b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_StopHapticEffects,(SDL_Haptic *a),(a),return) +SDL_DYNAPI_PROC(bool,SDL_StopHapticRumble,(SDL_Haptic *a),(a),return) +SDL_DYNAPI_PROC(bool,SDL_StopTextInput,(SDL_Window *a),(a),return) +SDL_DYNAPI_PROC(bool,SDL_StorageReady,(SDL_Storage *a),(a),return) SDL_DYNAPI_PROC(SDL_GUID,SDL_StringToGUID,(const char *a),(a),return) SDL_DYNAPI_PROC(void,SDL_SubmitGPUCommandBuffer,(SDL_GPUCommandBuffer *a),(a),) SDL_DYNAPI_PROC(SDL_GPUFence*,SDL_SubmitGPUCommandBufferAndAcquireFence,(SDL_GPUCommandBuffer *a),(a),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_SurfaceHasAlternateImages,(SDL_Surface *a),(a),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_SurfaceHasColorKey,(SDL_Surface *a),(a),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_SurfaceHasRLE,(SDL_Surface *a),(a),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_SyncWindow,(SDL_Window *a),(a),return) +SDL_DYNAPI_PROC(bool,SDL_SurfaceHasAlternateImages,(SDL_Surface *a),(a),return) +SDL_DYNAPI_PROC(bool,SDL_SurfaceHasColorKey,(SDL_Surface *a),(a),return) +SDL_DYNAPI_PROC(bool,SDL_SurfaceHasRLE,(SDL_Surface *a),(a),return) +SDL_DYNAPI_PROC(bool,SDL_SyncWindow,(SDL_Window *a),(a),return) SDL_DYNAPI_PROC(Sint64,SDL_TellIO,(SDL_IOStream *a),(a),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_TextInputActive,(SDL_Window *a),(a),return) +SDL_DYNAPI_PROC(bool,SDL_TextInputActive,(SDL_Window *a),(a),return) SDL_DYNAPI_PROC(SDL_Time,SDL_TimeFromWindows,(Uint32 a, Uint32 b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_TimeToDateTime,(SDL_Time a, SDL_DateTime *b, SDL_bool c),(a,b,c),return) +SDL_DYNAPI_PROC(bool,SDL_TimeToDateTime,(SDL_Time a, SDL_DateTime *b, bool c),(a,b,c),return) SDL_DYNAPI_PROC(void,SDL_TimeToWindows,(SDL_Time a, Uint32 *b, Uint32 *c),(a,b,c),) -SDL_DYNAPI_PROC(SDL_bool,SDL_TryLockMutex,(SDL_Mutex *a),(a),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_TryLockRWLockForReading,(SDL_RWLock *a),(a),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_TryLockRWLockForWriting,(SDL_RWLock *a),(a),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_TryLockSpinlock,(SDL_SpinLock *a),(a),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_TryWaitSemaphore,(SDL_Semaphore *a),(a),return) +SDL_DYNAPI_PROC(bool,SDL_TryLockMutex,(SDL_Mutex *a),(a),return) +SDL_DYNAPI_PROC(bool,SDL_TryLockRWLockForReading,(SDL_RWLock *a),(a),return) +SDL_DYNAPI_PROC(bool,SDL_TryLockRWLockForWriting,(SDL_RWLock *a),(a),return) +SDL_DYNAPI_PROC(bool,SDL_TryLockSpinlock,(SDL_SpinLock *a),(a),return) +SDL_DYNAPI_PROC(bool,SDL_TryWaitSemaphore,(SDL_Semaphore *a),(a),return) SDL_DYNAPI_PROC(char*,SDL_UCS4ToUTF8,(Uint32 a, char *b),(a,b),return) SDL_DYNAPI_PROC(void,SDL_UnbindAudioStream,(SDL_AudioStream *a),(a),) SDL_DYNAPI_PROC(void,SDL_UnbindAudioStreams,(SDL_AudioStream **a, int b),(a,b),) SDL_DYNAPI_PROC(void,SDL_UnloadObject,(void *a),(a),) -SDL_DYNAPI_PROC(SDL_bool,SDL_UnlockAudioStream,(SDL_AudioStream *a),(a),return) +SDL_DYNAPI_PROC(bool,SDL_UnlockAudioStream,(SDL_AudioStream *a),(a),return) SDL_DYNAPI_PROC(void,SDL_UnlockJoysticks,(void),(),) SDL_DYNAPI_PROC(void,SDL_UnlockMutex,(SDL_Mutex *a),(a),) SDL_DYNAPI_PROC(void,SDL_UnlockProperties,(SDL_PropertiesID a),(a),) @@ -954,57 +980,59 @@ SDL_DYNAPI_PROC(void,SDL_UnlockSurface,(SDL_Surface *a),(a),) SDL_DYNAPI_PROC(void,SDL_UnlockTexture,(SDL_Texture *a),(a),) SDL_DYNAPI_PROC(void,SDL_UnmapGPUTransferBuffer,(SDL_GPUDevice *a, SDL_GPUTransferBuffer *b),(a,b),) SDL_DYNAPI_PROC(void,SDL_UnregisterApp,(void),(),) +SDL_DYNAPI_PROC(bool,SDL_UnsetEnvironmentVariable,(SDL_Environment *a, const char *b),(a,b),return) SDL_DYNAPI_PROC(void,SDL_UpdateGamepads,(void),(),) -SDL_DYNAPI_PROC(SDL_bool,SDL_UpdateHapticEffect,(SDL_Haptic *a, int b, const SDL_HapticEffect *c),(a,b,c),return) +SDL_DYNAPI_PROC(bool,SDL_UpdateHapticEffect,(SDL_Haptic *a, int b, const SDL_HapticEffect *c),(a,b,c),return) SDL_DYNAPI_PROC(void,SDL_UpdateJoysticks,(void),(),) -SDL_DYNAPI_PROC(SDL_bool,SDL_UpdateNVTexture,(SDL_Texture *a, const SDL_Rect *b, const Uint8 *c, int d, const Uint8 *e, int f),(a,b,c,d,e,f),return) +SDL_DYNAPI_PROC(bool,SDL_UpdateNVTexture,(SDL_Texture *a, const SDL_Rect *b, const Uint8 *c, int d, const Uint8 *e, int f),(a,b,c,d,e,f),return) SDL_DYNAPI_PROC(void,SDL_UpdateSensors,(void),(),) -SDL_DYNAPI_PROC(SDL_bool,SDL_UpdateTexture,(SDL_Texture *a, const SDL_Rect *b, const void *c, int d),(a,b,c,d),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_UpdateWindowSurface,(SDL_Window *a),(a),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_UpdateWindowSurfaceRects,(SDL_Window *a, const SDL_Rect *b, int c),(a,b,c),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_UpdateYUVTexture,(SDL_Texture *a, const SDL_Rect *b, const Uint8 *c, int d, const Uint8 *e, int f, const Uint8 *g, int h),(a,b,c,d,e,f,g,h),return) -SDL_DYNAPI_PROC(void,SDL_UploadToGPUBuffer,(SDL_GPUCopyPass *a, SDL_GPUTransferBufferLocation *b, SDL_GPUBufferRegion *c, SDL_bool d),(a,b,c,d),) -SDL_DYNAPI_PROC(void,SDL_UploadToGPUTexture,(SDL_GPUCopyPass *a, SDL_GPUTextureTransferInfo *b, SDL_GPUTextureRegion *c, SDL_bool d),(a,b,c,d),) -SDL_DYNAPI_PROC(SDL_bool,SDL_Vulkan_CreateSurface,(SDL_Window *a, VkInstance b, const struct VkAllocationCallbacks *c, VkSurfaceKHR *d),(a,b,c,d),return) +SDL_DYNAPI_PROC(bool,SDL_UpdateTexture,(SDL_Texture *a, const SDL_Rect *b, const void *c, int d),(a,b,c,d),return) +SDL_DYNAPI_PROC(bool,SDL_UpdateWindowSurface,(SDL_Window *a),(a),return) +SDL_DYNAPI_PROC(bool,SDL_UpdateWindowSurfaceRects,(SDL_Window *a, const SDL_Rect *b, int c),(a,b,c),return) +SDL_DYNAPI_PROC(bool,SDL_UpdateYUVTexture,(SDL_Texture *a, const SDL_Rect *b, const Uint8 *c, int d, const Uint8 *e, int f, const Uint8 *g, int h),(a,b,c,d,e,f,g,h),return) +SDL_DYNAPI_PROC(void,SDL_UploadToGPUBuffer,(SDL_GPUCopyPass *a, const SDL_GPUTransferBufferLocation *b, const SDL_GPUBufferRegion *c, bool d),(a,b,c,d),) +SDL_DYNAPI_PROC(void,SDL_UploadToGPUTexture,(SDL_GPUCopyPass *a, const SDL_GPUTextureTransferInfo *b, const SDL_GPUTextureRegion *c, bool d),(a,b,c,d),) +SDL_DYNAPI_PROC(bool,SDL_Vulkan_CreateSurface,(SDL_Window *a, VkInstance b, const struct VkAllocationCallbacks *c, VkSurfaceKHR *d),(a,b,c,d),return) SDL_DYNAPI_PROC(void,SDL_Vulkan_DestroySurface,(VkInstance a, VkSurfaceKHR b, const struct VkAllocationCallbacks *c),(a,b,c),) SDL_DYNAPI_PROC(char const* const*,SDL_Vulkan_GetInstanceExtensions,(Uint32 *a),(a),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_Vulkan_GetPresentationSupport,(VkInstance a, VkPhysicalDevice b, Uint32 c),(a,b,c),return) +SDL_DYNAPI_PROC(bool,SDL_Vulkan_GetPresentationSupport,(VkInstance a, VkPhysicalDevice b, Uint32 c),(a,b,c),return) SDL_DYNAPI_PROC(SDL_FunctionPointer,SDL_Vulkan_GetVkGetInstanceProcAddr,(void),(),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_Vulkan_LoadLibrary,(const char *a),(a),return) +SDL_DYNAPI_PROC(bool,SDL_Vulkan_LoadLibrary,(const char *a),(a),return) SDL_DYNAPI_PROC(void,SDL_Vulkan_UnloadLibrary,(void),(),) SDL_DYNAPI_PROC(void,SDL_WaitCondition,(SDL_Condition *a, SDL_Mutex *b),(a,b),) -SDL_DYNAPI_PROC(SDL_bool,SDL_WaitConditionTimeout,(SDL_Condition *a, SDL_Mutex *b, Sint32 c),(a,b,c),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_WaitEvent,(SDL_Event *a),(a),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_WaitEventTimeout,(SDL_Event *a, Sint32 b),(a,b),return) -SDL_DYNAPI_PROC(void,SDL_WaitForGPUFences,(SDL_GPUDevice *a, SDL_bool b, SDL_GPUFence **c, Uint32 d),(a,b,c,d),) +SDL_DYNAPI_PROC(bool,SDL_WaitConditionTimeout,(SDL_Condition *a, SDL_Mutex *b, Sint32 c),(a,b,c),return) +SDL_DYNAPI_PROC(bool,SDL_WaitEvent,(SDL_Event *a),(a),return) +SDL_DYNAPI_PROC(bool,SDL_WaitEventTimeout,(SDL_Event *a, Sint32 b),(a,b),return) +SDL_DYNAPI_PROC(void,SDL_WaitForGPUFences,(SDL_GPUDevice *a, bool b, SDL_GPUFence *const *c, Uint32 d),(a,b,c,d),) SDL_DYNAPI_PROC(void,SDL_WaitForGPUIdle,(SDL_GPUDevice *a),(a),) +SDL_DYNAPI_PROC(bool,SDL_WaitProcess,(SDL_Process *a, bool b, int *c),(a,b,c),return) SDL_DYNAPI_PROC(void,SDL_WaitSemaphore,(SDL_Semaphore *a),(a),) -SDL_DYNAPI_PROC(SDL_bool,SDL_WaitSemaphoreTimeout,(SDL_Semaphore *a, Sint32 b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_WaitSemaphoreTimeout,(SDL_Semaphore *a, Sint32 b),(a,b),return) SDL_DYNAPI_PROC(void,SDL_WaitThread,(SDL_Thread *a, int *b),(a,b),) -SDL_DYNAPI_PROC(SDL_bool,SDL_WarpMouseGlobal,(float a, float b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_WarpMouseGlobal,(float a, float b),(a,b),return) SDL_DYNAPI_PROC(void,SDL_WarpMouseInWindow,(SDL_Window *a, float b, float c),(a,b,c),) SDL_DYNAPI_PROC(SDL_InitFlags,SDL_WasInit,(SDL_InitFlags a),(a),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_WindowHasSurface,(SDL_Window *a),(a),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_WindowSupportsGPUPresentMode,(SDL_GPUDevice *a, SDL_Window *b, SDL_GPUPresentMode c),(a,b,c),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_WindowSupportsGPUSwapchainComposition,(SDL_GPUDevice *a, SDL_Window *b, SDL_GPUSwapchainComposition c),(a,b,c),return) +SDL_DYNAPI_PROC(bool,SDL_WindowHasSurface,(SDL_Window *a),(a),return) +SDL_DYNAPI_PROC(bool,SDL_WindowSupportsGPUPresentMode,(SDL_GPUDevice *a, SDL_Window *b, SDL_GPUPresentMode c),(a,b,c),return) +SDL_DYNAPI_PROC(bool,SDL_WindowSupportsGPUSwapchainComposition,(SDL_GPUDevice *a, SDL_Window *b, SDL_GPUSwapchainComposition c),(a,b,c),return) SDL_DYNAPI_PROC(size_t,SDL_WriteIO,(SDL_IOStream *a, const void *b, size_t c),(a,b,c),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_WriteS16BE,(SDL_IOStream *a, Sint16 b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_WriteS16LE,(SDL_IOStream *a, Sint16 b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_WriteS32BE,(SDL_IOStream *a, Sint32 b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_WriteS32LE,(SDL_IOStream *a, Sint32 b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_WriteS64BE,(SDL_IOStream *a, Sint64 b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_WriteS64LE,(SDL_IOStream *a, Sint64 b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_WriteS8,(SDL_IOStream *a, Sint8 b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_WriteStorageFile,(SDL_Storage *a, const char *b, const void *c, Uint64 d),(a,b,c,d),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_WriteSurfacePixel,(SDL_Surface *a, int b, int c, Uint8 d, Uint8 e, Uint8 f, Uint8 g),(a,b,c,d,e,f,g),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_WriteSurfacePixelFloat,(SDL_Surface *a, int b, int c, float d, float e, float f, float g),(a,b,c,d,e,f,g),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_WriteU16BE,(SDL_IOStream *a, Uint16 b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_WriteU16LE,(SDL_IOStream *a, Uint16 b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_WriteU32BE,(SDL_IOStream *a, Uint32 b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_WriteU32LE,(SDL_IOStream *a, Uint32 b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_WriteU64BE,(SDL_IOStream *a, Uint64 b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_WriteU64LE,(SDL_IOStream *a, Uint64 b),(a,b),return) -SDL_DYNAPI_PROC(SDL_bool,SDL_WriteU8,(SDL_IOStream *a, Uint8 b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_WriteS16BE,(SDL_IOStream *a, Sint16 b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_WriteS16LE,(SDL_IOStream *a, Sint16 b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_WriteS32BE,(SDL_IOStream *a, Sint32 b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_WriteS32LE,(SDL_IOStream *a, Sint32 b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_WriteS64BE,(SDL_IOStream *a, Sint64 b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_WriteS64LE,(SDL_IOStream *a, Sint64 b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_WriteS8,(SDL_IOStream *a, Sint8 b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_WriteStorageFile,(SDL_Storage *a, const char *b, const void *c, Uint64 d),(a,b,c,d),return) +SDL_DYNAPI_PROC(bool,SDL_WriteSurfacePixel,(SDL_Surface *a, int b, int c, Uint8 d, Uint8 e, Uint8 f, Uint8 g),(a,b,c,d,e,f,g),return) +SDL_DYNAPI_PROC(bool,SDL_WriteSurfacePixelFloat,(SDL_Surface *a, int b, int c, float d, float e, float f, float g),(a,b,c,d,e,f,g),return) +SDL_DYNAPI_PROC(bool,SDL_WriteU16BE,(SDL_IOStream *a, Uint16 b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_WriteU16LE,(SDL_IOStream *a, Uint16 b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_WriteU32BE,(SDL_IOStream *a, Uint32 b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_WriteU32LE,(SDL_IOStream *a, Uint32 b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_WriteU64BE,(SDL_IOStream *a, Uint64 b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_WriteU64LE,(SDL_IOStream *a, Uint64 b),(a,b),return) +SDL_DYNAPI_PROC(bool,SDL_WriteU8,(SDL_IOStream *a, Uint8 b),(a,b),return) SDL_DYNAPI_PROC(int,SDL_abs,(int a),(a),return) SDL_DYNAPI_PROC(double,SDL_acos,(double a),(a),return) SDL_DYNAPI_PROC(float,SDL_acosf,(float a),(a),return) @@ -1039,7 +1067,8 @@ SDL_DYNAPI_PROC(double,SDL_fmod,(double a, double b),(a,b),return) SDL_DYNAPI_PROC(float,SDL_fmodf,(float a, float b),(a,b),return) SDL_DYNAPI_PROC(void,SDL_free,(void *a),(a),) SDL_DYNAPI_PROC(const char*,SDL_getenv,(const char *a),(a),return) -SDL_DYNAPI_PROC(void,SDL_hid_ble_scan,(SDL_bool a),(a),) +SDL_DYNAPI_PROC(const char*,SDL_getenv_unsafe,(const char *a),(a),return) +SDL_DYNAPI_PROC(void,SDL_hid_ble_scan,(bool a),(a),) SDL_DYNAPI_PROC(int,SDL_hid_close,(SDL_hid_device *a),(a),return) SDL_DYNAPI_PROC(Uint32,SDL_hid_device_change_count,(void),(),return) SDL_DYNAPI_PROC(SDL_hid_device_info*,SDL_hid_enumerate,(unsigned short a, unsigned short b),(a,b),return) @@ -1082,7 +1111,7 @@ SDL_DYNAPI_PROC(int,SDL_isspace,(int a),(a),return) SDL_DYNAPI_PROC(int,SDL_isupper,(int a),(a),return) SDL_DYNAPI_PROC(int,SDL_isxdigit,(int a),(a),return) SDL_DYNAPI_PROC(char*,SDL_itoa,(int a, char *b, int c),(a,b,c),return) -SDL_DYNAPI_PROC(char*,SDL_lltoa,(Sint64 a, char *b, int c),(a,b,c),return) +SDL_DYNAPI_PROC(char*,SDL_lltoa,(long long a, char *b, int c),(a,b,c),return) SDL_DYNAPI_PROC(double,SDL_log,(double a),(a),return) SDL_DYNAPI_PROC(double,SDL_log10,(double a),(a),return) SDL_DYNAPI_PROC(float,SDL_log10f,(float a),(a),return) @@ -1113,7 +1142,7 @@ SDL_DYNAPI_PROC(double,SDL_round,(double a),(a),return) SDL_DYNAPI_PROC(float,SDL_roundf,(float a),(a),return) SDL_DYNAPI_PROC(double,SDL_scalbn,(double a, int b),(a,b),return) SDL_DYNAPI_PROC(float,SDL_scalbnf,(float a, int b),(a,b),return) -SDL_DYNAPI_PROC(int,SDL_setenv,(const char *a, const char *b, int c),(a,b,c),return) +SDL_DYNAPI_PROC(int,SDL_setenv_unsafe,(const char *a, const char *b, int c),(a,b,c),return) SDL_DYNAPI_PROC(double,SDL_sin,(double a),(a),return) SDL_DYNAPI_PROC(float,SDL_sinf,(float a),(a),return) SDL_DYNAPI_PROC(double,SDL_sqrt,(double a),(a),return) @@ -1133,15 +1162,16 @@ SDL_DYNAPI_PROC(int,SDL_strncmp,(const char *a, const char *b, size_t c),(a,b,c) SDL_DYNAPI_PROC(char*,SDL_strndup,(const char *a, size_t b),(a,b),return) SDL_DYNAPI_PROC(size_t,SDL_strnlen,(const char *a, size_t b),(a,b),return) SDL_DYNAPI_PROC(char*,SDL_strnstr,(const char *a, const char *b, size_t c),(a,b,c),return) +SDL_DYNAPI_PROC(char*,SDL_strpbrk,(const char *a, const char *b),(a,b),return) SDL_DYNAPI_PROC(char*,SDL_strrchr,(const char *a, int b),(a,b),return) SDL_DYNAPI_PROC(char*,SDL_strrev,(char *a),(a),return) SDL_DYNAPI_PROC(char*,SDL_strstr,(const char *a, const char *b),(a,b),return) SDL_DYNAPI_PROC(double,SDL_strtod,(const char *a, char **b),(a,b),return) SDL_DYNAPI_PROC(char*,SDL_strtok_r,(char *a, const char *b, char **c),(a,b,c),return) SDL_DYNAPI_PROC(long,SDL_strtol,(const char *a, char **b, int c),(a,b,c),return) -SDL_DYNAPI_PROC(Sint64,SDL_strtoll,(const char *a, char **b, int c),(a,b,c),return) +SDL_DYNAPI_PROC(long long,SDL_strtoll,(const char *a, char **b, int c),(a,b,c),return) SDL_DYNAPI_PROC(unsigned long,SDL_strtoul,(const char *a, char **b, int c),(a,b,c),return) -SDL_DYNAPI_PROC(Uint64,SDL_strtoull,(const char *a, char **b, int c),(a,b,c),return) +SDL_DYNAPI_PROC(unsigned long long,SDL_strtoull,(const char *a, char **b, int c),(a,b,c),return) SDL_DYNAPI_PROC(char*,SDL_strupr,(char *a),(a),return) SDL_DYNAPI_PROC(double,SDL_tan,(double a),(a),return) SDL_DYNAPI_PROC(float,SDL_tanf,(float a),(a),return) @@ -1150,9 +1180,9 @@ SDL_DYNAPI_PROC(int,SDL_toupper,(int a),(a),return) SDL_DYNAPI_PROC(double,SDL_trunc,(double a),(a),return) SDL_DYNAPI_PROC(float,SDL_truncf,(float a),(a),return) SDL_DYNAPI_PROC(char*,SDL_uitoa,(unsigned int a, char *b, int c),(a,b,c),return) -SDL_DYNAPI_PROC(char*,SDL_ulltoa,(Uint64 a, char *b, int c),(a,b,c),return) +SDL_DYNAPI_PROC(char*,SDL_ulltoa,(unsigned long long a, char *b, int c),(a,b,c),return) SDL_DYNAPI_PROC(char*,SDL_ultoa,(unsigned long a, char *b, int c),(a,b,c),return) -SDL_DYNAPI_PROC(int,SDL_unsetenv,(const char *a),(a),return) +SDL_DYNAPI_PROC(int,SDL_unsetenv_unsafe,(const char *a),(a),return) SDL_DYNAPI_PROC(size_t,SDL_utf8strlcpy,(SDL_OUT_Z_CAP(c) char *a, const char *b, size_t c),(a,b,c),return) SDL_DYNAPI_PROC(size_t,SDL_utf8strlen,(const char *a),(a),return) SDL_DYNAPI_PROC(size_t,SDL_utf8strnlen,(const char *a, size_t b),(a,b),return) diff --git a/src/dynapi/SDL_dynapi_unsupported.h b/src/dynapi/SDL_dynapi_unsupported.h index ce6864c8..780e6d6b 100644 --- a/src/dynapi/SDL_dynapi_unsupported.h +++ b/src/dynapi/SDL_dynapi_unsupported.h @@ -23,7 +23,7 @@ #define SDL_dynapi_unsupported_h_ -#if !(defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK)) +#if !defined(SDL_PLATFORM_WINDOWS) typedef struct ID3D12Device ID3D12Device; typedef void *SDL_WindowsMessageHook; #endif @@ -37,10 +37,6 @@ typedef struct IDirect3DDevice9 IDirect3DDevice9; typedef struct XTaskQueueHandle XTaskQueueHandle; #endif -#ifndef SDL_PLATFORM_WINRT -typedef int SDL_WinRT_DeviceFamily; -typedef int SDL_WinRT_Path; -#endif #ifndef SDL_PLATFORM_GDK typedef struct XUserHandle XUserHandle; #endif diff --git a/src/dynapi/gendynapi.py b/src/dynapi/gendynapi.py index 7c5f430f..651174aa 100755 --- a/src/dynapi/gendynapi.py +++ b/src/dynapi/gendynapi.py @@ -85,7 +85,7 @@ def main(): ignore_wiki_documentation = False continue - # Discard wiki documentions blocks. + # Discard wiki documentations blocks. if line.startswith("#ifdef SDL_WIKI_DOCUMENTATION_SECTION"): ignore_wiki_documentation = True continue @@ -167,6 +167,7 @@ def main(): func = func.replace(" SDL_PRINTF_VARARG_FUNCV(2)", ""); func = func.replace(" SDL_PRINTF_VARARG_FUNCV(3)", ""); func = func.replace(" SDL_WPRINTF_VARARG_FUNC(3)", ""); + func = func.replace(" SDL_WPRINTF_VARARG_FUNCV(3)", ""); func = func.replace(" SDL_SCANF_VARARG_FUNC(2)", ""); func = func.replace(" SDL_SCANF_VARARG_FUNCV(2)", ""); func = func.replace(" SDL_ANALYZER_NORETURN", ""); diff --git a/src/events/SDL_events.c b/src/events/SDL_events.c index a532058c..81bed445 100644 --- a/src/events/SDL_events.c +++ b/src/events/SDL_events.c @@ -379,7 +379,7 @@ static void SDLCALL SDL_EventLoggingChanged(void *userdata, const char *name, co static void SDL_LogEvent(const SDL_Event *event) { static const char *pen_axisnames[] = { "PRESSURE", "XTILT", "YTILT", "DISTANCE", "ROTATION", "SLIDER", "TANGENTIAL_PRESSURE" }; - SDL_COMPILE_TIME_ASSERT(pen_axisnames_array_matches, SDL_arraysize(pen_axisnames) == SDL_PEN_NUM_AXES); + SDL_COMPILE_TIME_ASSERT(pen_axisnames_array_matches, SDL_arraysize(pen_axisnames) == SDL_PEN_AXIS_COUNT); char name[64]; char details[128]; @@ -512,7 +512,7 @@ static void SDL_LogEvent(const SDL_Event *event) #define PRINT_KEY_EVENT(event) \ (void)SDL_snprintf(details, sizeof(details), " (timestamp=%u windowid=%u which=%u state=%s repeat=%s scancode=%u keycode=%u mod=0x%x)", \ (uint)event->key.timestamp, (uint)event->key.windowID, (uint)event->key.which, \ - event->key.state == SDL_PRESSED ? "pressed" : "released", \ + event->key.down ? "pressed" : "released", \ event->key.repeat ? "true" : "false", \ (uint)event->key.scancode, \ (uint)event->key.key, \ @@ -562,7 +562,7 @@ static void SDL_LogEvent(const SDL_Event *event) (void)SDL_snprintf(details, sizeof(details), " (timestamp=%u windowid=%u which=%u button=%u state=%s clicks=%u x=%g y=%g)", \ (uint)event->button.timestamp, (uint)event->button.windowID, \ (uint)event->button.which, (uint)event->button.button, \ - event->button.state == SDL_PRESSED ? "pressed" : "released", \ + event->button.down ? "pressed" : "released", \ (uint)event->button.clicks, event->button.x, event->button.y) SDL_EVENT_CASE(SDL_EVENT_MOUSE_BUTTON_DOWN) PRINT_MBUTTON_EVENT(event); @@ -600,7 +600,7 @@ static void SDL_LogEvent(const SDL_Event *event) #define PRINT_JBUTTON_EVENT(event) \ (void)SDL_snprintf(details, sizeof(details), " (timestamp=%u which=%d button=%u state=%s)", \ (uint)event->jbutton.timestamp, (int)event->jbutton.which, \ - (uint)event->jbutton.button, event->jbutton.state == SDL_PRESSED ? "pressed" : "released") + (uint)event->jbutton.button, event->jbutton.down ? "pressed" : "released") SDL_EVENT_CASE(SDL_EVENT_JOYSTICK_BUTTON_DOWN) PRINT_JBUTTON_EVENT(event); break; @@ -636,7 +636,7 @@ static void SDL_LogEvent(const SDL_Event *event) #define PRINT_CBUTTON_EVENT(event) \ (void)SDL_snprintf(details, sizeof(details), " (timestamp=%u which=%d button=%u state=%s)", \ (uint)event->gbutton.timestamp, (int)event->gbutton.which, \ - (uint)event->gbutton.button, event->gbutton.state == SDL_PRESSED ? "pressed" : "released") + (uint)event->gbutton.button, event->gbutton.down ? "pressed" : "released") SDL_EVENT_CASE(SDL_EVENT_GAMEPAD_BUTTON_DOWN) PRINT_CBUTTON_EVENT(event); break; @@ -704,7 +704,7 @@ static void SDL_LogEvent(const SDL_Event *event) #define PRINT_PTOUCH_EVENT(event) \ (void)SDL_snprintf(details, sizeof(details), " (timestamp=%u windowid=%u which=%u pen_state=%u x=%g y=%g eraser=%s state=%s)", \ (uint)event->ptouch.timestamp, (uint)event->ptouch.windowID, (uint)event->ptouch.which, (uint)event->ptouch.pen_state, event->ptouch.x, event->ptouch.y, \ - event->ptouch.eraser ? "yes" : "no", event->ptouch.state == SDL_PRESSED ? "down" : "up"); + event->ptouch.eraser ? "yes" : "no", event->ptouch.down ? "down" : "up"); SDL_EVENT_CASE(SDL_EVENT_PEN_DOWN) PRINT_PTOUCH_EVENT(event); break; @@ -738,7 +738,7 @@ static void SDL_LogEvent(const SDL_Event *event) #define PRINT_PBUTTON_EVENT(event) \ (void)SDL_snprintf(details, sizeof(details), " (timestamp=%u windowid=%u which=%u pen_state=%u x=%g y=%g button=%u state=%s)", \ (uint)event->pbutton.timestamp, (uint)event->pbutton.windowID, (uint)event->pbutton.which, (uint)event->pbutton.pen_state, event->pbutton.x, event->pbutton.y, \ - (uint)event->pbutton.button, event->pbutton.state == SDL_PRESSED ? "down" : "up"); + (uint)event->pbutton.button, event->pbutton.down ? "down" : "up"); SDL_EVENT_CASE(SDL_EVENT_PEN_BUTTON_DOWN) PRINT_PBUTTON_EVENT(event); break; @@ -852,12 +852,12 @@ void SDL_StopEventLoop(void) entry = next; } - SDL_AtomicSet(&SDL_EventQ.count, 0); + SDL_SetAtomicInt(&SDL_EventQ.count, 0); SDL_EventQ.max_events_seen = 0; SDL_EventQ.head = NULL; SDL_EventQ.tail = NULL; SDL_EventQ.free = NULL; - SDL_AtomicSet(&SDL_sentinel_pending, 0); + SDL_SetAtomicInt(&SDL_sentinel_pending, 0); // Clear disabled event state for (i = 0; i < SDL_arraysize(SDL_disabled_events); ++i) { @@ -921,7 +921,7 @@ bool SDL_StartEventLoop(void) static int SDL_AddEvent(SDL_Event *event) { SDL_EventEntry *entry; - const int initial_count = SDL_AtomicGet(&SDL_EventQ.count); + const int initial_count = SDL_GetAtomicInt(&SDL_EventQ.count); int final_count; if (initial_count >= SDL_MAX_QUEUED_EVENTS) { @@ -945,7 +945,7 @@ static int SDL_AddEvent(SDL_Event *event) SDL_copyp(&entry->event, event); if (event->type == SDL_EVENT_POLL_SENTINEL) { - SDL_AtomicAdd(&SDL_sentinel_pending, 1); + SDL_AddAtomicInt(&SDL_sentinel_pending, 1); } entry->memory = NULL; SDL_TransferTemporaryMemoryToEvent(entry); @@ -963,7 +963,7 @@ static int SDL_AddEvent(SDL_Event *event) entry->next = NULL; } - final_count = SDL_AtomicAdd(&SDL_EventQ.count, 1) + 1; + final_count = SDL_AddAtomicInt(&SDL_EventQ.count, 1) + 1; if (final_count > SDL_EventQ.max_events_seen) { SDL_EventQ.max_events_seen = final_count; } @@ -995,13 +995,13 @@ static void SDL_CutEvent(SDL_EventEntry *entry) } if (entry->event.type == SDL_EVENT_POLL_SENTINEL) { - SDL_AtomicAdd(&SDL_sentinel_pending, -1); + SDL_AddAtomicInt(&SDL_sentinel_pending, -1); } entry->next = SDL_EventQ.free; SDL_EventQ.free = entry; - SDL_assert(SDL_AtomicGet(&SDL_EventQ.count) > 0); - SDL_AtomicAdd(&SDL_EventQ.count, -1); + SDL_assert(SDL_GetAtomicInt(&SDL_EventQ.count) > 0); + SDL_AddAtomicInt(&SDL_EventQ.count, -1); } static void SDL_SendWakeupEvent(void) @@ -1079,7 +1079,7 @@ static int SDL_PeepEventsInternal(SDL_Event *events, int numevents, SDL_EventAct if (events == NULL || action != SDL_GETEVENT) { ++sentinels_expected; } - if (SDL_AtomicGet(&SDL_sentinel_pending) > sentinels_expected) { + if (SDL_GetAtomicInt(&SDL_sentinel_pending) > sentinels_expected) { // Skip it, there's another one pending continue; } @@ -1103,12 +1103,12 @@ int SDL_PeepEvents(SDL_Event *events, int numevents, SDL_EventAction action, return SDL_PeepEventsInternal(events, numevents, action, minType, maxType, false); } -SDL_bool SDL_HasEvent(Uint32 type) +bool SDL_HasEvent(Uint32 type) { return SDL_PeepEvents(NULL, 0, SDL_PEEKEVENT, type, type) > 0; } -SDL_bool SDL_HasEvents(Uint32 minType, Uint32 maxType) +bool SDL_HasEvents(Uint32 minType, Uint32 maxType) { return SDL_PeepEvents(NULL, 0, SDL_PEEKEVENT, minType, maxType) > 0; } @@ -1198,7 +1198,7 @@ static void SDL_PumpEventsInternal(bool push_sentinel) SDL_Event sentinel; // Make sure we don't already have a sentinel in the queue, and add one to the end - if (SDL_AtomicGet(&SDL_sentinel_pending) > 0) { + if (SDL_GetAtomicInt(&SDL_sentinel_pending) > 0) { SDL_PeepEventsInternal(&sentinel, 1, SDL_GETEVENT, SDL_EVENT_POLL_SENTINEL, SDL_EVENT_POLL_SENTINEL, true); } @@ -1215,7 +1215,7 @@ void SDL_PumpEvents(void) // Public functions -SDL_bool SDL_PollEvent(SDL_Event *event) +bool SDL_PollEvent(SDL_Event *event) { return SDL_WaitEventTimeoutNS(event, 0); } @@ -1330,12 +1330,12 @@ static SDL_Window *SDL_find_active_window(SDL_VideoDevice *_this) #endif // !SDL_PLATFORM_ANDROID -SDL_bool SDL_WaitEvent(SDL_Event *event) +bool SDL_WaitEvent(SDL_Event *event) { return SDL_WaitEventTimeoutNS(event, -1); } -SDL_bool SDL_WaitEventTimeout(SDL_Event *event, Sint32 timeoutMS) +bool SDL_WaitEventTimeout(SDL_Event *event, Sint32 timeoutMS) { Sint64 timeoutNS; @@ -1347,7 +1347,7 @@ SDL_bool SDL_WaitEventTimeout(SDL_Event *event, Sint32 timeoutMS) return SDL_WaitEventTimeoutNS(event, timeoutNS); } -SDL_bool SDL_WaitEventTimeoutNS(SDL_Event *event, Sint64 timeoutNS) +bool SDL_WaitEventTimeoutNS(SDL_Event *event, Sint64 timeoutNS) { Uint64 start, expiration; bool include_sentinel = (timeoutNS == 0); @@ -1362,7 +1362,7 @@ SDL_bool SDL_WaitEventTimeoutNS(SDL_Event *event, Sint64 timeoutNS) } // If there isn't a poll sentinel event pending, pump events and add one - if (SDL_AtomicGet(&SDL_sentinel_pending) == 0) { + if (SDL_GetAtomicInt(&SDL_sentinel_pending) == 0) { SDL_PumpEventsInternal(true); } @@ -1500,7 +1500,7 @@ static bool SDL_CallEventWatchers(SDL_Event *event) return true; } -SDL_bool SDL_PushEvent(SDL_Event *event) +bool SDL_PushEvent(SDL_Event *event) { if (!event->common.timestamp) { event->common.timestamp = SDL_GetTicksNS(); @@ -1543,7 +1543,7 @@ void SDL_SetEventFilter(SDL_EventFilter filter, void *userdata) SDL_UnlockMutex(SDL_event_watchers_lock); } -SDL_bool SDL_GetEventFilter(SDL_EventFilter *filter, void **userdata) +bool SDL_GetEventFilter(SDL_EventFilter *filter, void **userdata) { SDL_EventWatcher event_ok; @@ -1562,7 +1562,7 @@ SDL_bool SDL_GetEventFilter(SDL_EventFilter *filter, void **userdata) return event_ok.callback ? true : false; } -SDL_bool SDL_AddEventWatch(SDL_EventFilter filter, void *userdata) +bool SDL_AddEventWatch(SDL_EventFilter filter, void *userdata) { bool result = true; @@ -1628,7 +1628,7 @@ void SDL_FilterEvents(SDL_EventFilter filter, void *userdata) SDL_UnlockMutex(SDL_EventQ.lock); } -void SDL_SetEventEnabled(Uint32 type, SDL_bool enabled) +void SDL_SetEventEnabled(Uint32 type, bool enabled) { bool current_state; Uint8 hi = ((type >> 8) & 0xff); @@ -1641,7 +1641,7 @@ void SDL_SetEventEnabled(Uint32 type, SDL_bool enabled) current_state = true; } - if ((enabled != SDL_FALSE) != current_state) { + if ((enabled != false) != current_state) { if (enabled) { SDL_assert(SDL_disabled_events[hi] != NULL); SDL_disabled_events[hi]->bits[lo / 32] &= ~(1 << (lo & 31)); @@ -1688,7 +1688,7 @@ void SDL_SetEventEnabled(Uint32 type, SDL_bool enabled) } } -SDL_bool SDL_EventEnabled(Uint32 type) +bool SDL_EventEnabled(Uint32 type) { Uint8 hi = ((type >> 8) & 0xff); Uint8 lo = (type & 0xff); diff --git a/src/events/SDL_keyboard.c b/src/events/SDL_keyboard.c index 7aef8604..2e7dcb83 100644 --- a/src/events/SDL_keyboard.c +++ b/src/events/SDL_keyboard.c @@ -53,8 +53,8 @@ typedef struct SDL_Keyboard // Data common to all keyboards SDL_Window *focus; SDL_Keymod modstate; - Uint8 keysource[SDL_NUM_SCANCODES]; - Uint8 keystate[SDL_NUM_SCANCODES]; + Uint8 keysource[SDL_SCANCODE_COUNT]; + bool keystate[SDL_SCANCODE_COUNT]; SDL_Keymap *keymap; bool french_numbers; bool latin_letters; @@ -173,7 +173,7 @@ void SDL_RemoveKeyboard(SDL_KeyboardID keyboardID, bool send_event) } } -SDL_bool SDL_HasKeyboard(void) +bool SDL_HasKeyboard(void) { return (SDL_keyboard_count > 0); } @@ -219,9 +219,9 @@ void SDL_ResetKeyboard(void) #ifdef DEBUG_KEYBOARD printf("Resetting keyboard\n"); #endif - for (scancode = SDL_SCANCODE_UNKNOWN; scancode < SDL_NUM_SCANCODES; ++scancode) { - if (keyboard->keystate[scancode] == SDL_PRESSED) { - SDL_SendKeyboardKey(0, SDL_GLOBAL_KEYBOARD_ID, 0, (SDL_Scancode)scancode, SDL_RELEASED); + for (scancode = SDL_SCANCODE_UNKNOWN; scancode < SDL_SCANCODE_COUNT; ++scancode) { + if (keyboard->keystate[scancode]) { + SDL_SendKeyboardKey(0, SDL_GLOBAL_KEYBOARD_ID, 0, (SDL_Scancode)scancode, false); } } } @@ -453,7 +453,7 @@ static SDL_Keycode SDL_ConvertNumpadKeycode(SDL_Keycode keycode, bool numlock) } } -SDL_Keycode SDL_GetKeyFromScancode(SDL_Scancode scancode, SDL_Keymod modstate, SDL_bool key_event) +SDL_Keycode SDL_GetKeyFromScancode(SDL_Scancode scancode, SDL_Keymod modstate, bool key_event) { SDL_Keyboard *keyboard = &SDL_keyboard; @@ -490,36 +490,29 @@ SDL_Scancode SDL_GetScancodeFromKey(SDL_Keycode key, SDL_Keymod *modstate) return SDL_GetKeymapScancode(keyboard->keymap, key, modstate); } -static bool SDL_SendKeyboardKeyInternal(Uint64 timestamp, Uint32 flags, SDL_KeyboardID keyboardID, int rawcode, SDL_Scancode scancode, Uint8 state) +static bool SDL_SendKeyboardKeyInternal(Uint64 timestamp, Uint32 flags, SDL_KeyboardID keyboardID, int rawcode, SDL_Scancode scancode, bool down) { SDL_Keyboard *keyboard = &SDL_keyboard; bool posted = false; SDL_Keycode keycode = SDLK_UNKNOWN; Uint32 type; - Uint8 repeat = false; + bool repeat = false; const Uint8 source = flags & KEYBOARD_SOURCE_MASK; #ifdef DEBUG_KEYBOARD - printf("The '%s' key has been %s\n", SDL_GetScancodeName(scancode), - state == SDL_PRESSED ? "pressed" : "released"); + printf("The '%s' key has been %s\n", SDL_GetScancodeName(scancode), down ? "pressed" : "released"); #endif // Figure out what type of event this is - switch (state) { - case SDL_PRESSED: + if (down) { type = SDL_EVENT_KEY_DOWN; - break; - case SDL_RELEASED: + } else { type = SDL_EVENT_KEY_UP; - break; - default: - // Invalid state -- bail - return false; } - if (scancode > SDL_SCANCODE_UNKNOWN && scancode < SDL_NUM_SCANCODES) { + if (scancode > SDL_SCANCODE_UNKNOWN && scancode < SDL_SCANCODE_COUNT) { // Drop events that don't change state - if (state) { + if (down) { if (keyboard->keystate[scancode]) { if (!(keyboard->keysource[scancode] & source)) { keyboard->keysource[scancode] |= source; @@ -536,7 +529,7 @@ static bool SDL_SendKeyboardKeyInternal(Uint64 timestamp, Uint32 flags, SDL_Keyb } // Update internal keyboard state - keyboard->keystate[scancode] = state; + keyboard->keystate[scancode] = down; keycode = SDL_GetKeyFromScancode(scancode, keyboard->modstate, true); @@ -616,7 +609,7 @@ static bool SDL_SendKeyboardKeyInternal(Uint64 timestamp, Uint32 flags, SDL_Keyb event.key.key = keycode; event.key.mod = keyboard->modstate; event.key.raw = (Uint16)rawcode; - event.key.state = state; + event.key.down = down; event.key.repeat = repeat; event.key.windowID = keyboard->focus ? keyboard->focus->id : 0; event.key.which = keyboardID; @@ -626,8 +619,7 @@ static bool SDL_SendKeyboardKeyInternal(Uint64 timestamp, Uint32 flags, SDL_Keyb /* If the keyboard is grabbed and the grabbed window is in full-screen, minimize the window when we receive Alt+Tab, unless the application has explicitly opted out of this behavior. */ - if (keycode == SDLK_TAB && - state == SDL_PRESSED && + if (keycode == SDLK_TAB && down && (keyboard->modstate & SDL_KMOD_ALT) && keyboard->focus && (keyboard->focus->flags & SDL_WINDOW_KEYBOARD_GRABBED) && @@ -655,42 +647,42 @@ void SDL_SendKeyboardUnicodeKey(Uint64 timestamp, Uint32 ch) if (modstate & SDL_KMOD_SHIFT) { // If the character uses shift, press shift down - SDL_SendKeyboardKeyInternal(timestamp, KEYBOARD_VIRTUAL, SDL_GLOBAL_KEYBOARD_ID, 0, SDL_SCANCODE_LSHIFT, SDL_PRESSED); + SDL_SendKeyboardKeyInternal(timestamp, KEYBOARD_VIRTUAL, SDL_GLOBAL_KEYBOARD_ID, 0, SDL_SCANCODE_LSHIFT, true); } // Send a keydown and keyup for the character - SDL_SendKeyboardKeyInternal(timestamp, KEYBOARD_VIRTUAL, SDL_GLOBAL_KEYBOARD_ID, 0, scancode, SDL_PRESSED); - SDL_SendKeyboardKeyInternal(timestamp, KEYBOARD_VIRTUAL, SDL_GLOBAL_KEYBOARD_ID, 0, scancode, SDL_RELEASED); + SDL_SendKeyboardKeyInternal(timestamp, KEYBOARD_VIRTUAL, SDL_GLOBAL_KEYBOARD_ID, 0, scancode, true); + SDL_SendKeyboardKeyInternal(timestamp, KEYBOARD_VIRTUAL, SDL_GLOBAL_KEYBOARD_ID, 0, scancode, false); if (modstate & SDL_KMOD_SHIFT) { // If the character uses shift, release shift - SDL_SendKeyboardKeyInternal(timestamp, KEYBOARD_VIRTUAL, SDL_GLOBAL_KEYBOARD_ID, 0, SDL_SCANCODE_LSHIFT, SDL_RELEASED); + SDL_SendKeyboardKeyInternal(timestamp, KEYBOARD_VIRTUAL, SDL_GLOBAL_KEYBOARD_ID, 0, SDL_SCANCODE_LSHIFT, false); } } -bool SDL_SendKeyboardKey(Uint64 timestamp, SDL_KeyboardID keyboardID, int rawcode, SDL_Scancode scancode, Uint8 state) +bool SDL_SendKeyboardKey(Uint64 timestamp, SDL_KeyboardID keyboardID, int rawcode, SDL_Scancode scancode, bool down) { - return SDL_SendKeyboardKeyInternal(timestamp, KEYBOARD_HARDWARE, keyboardID, rawcode, scancode, state); + return SDL_SendKeyboardKeyInternal(timestamp, KEYBOARD_HARDWARE, keyboardID, rawcode, scancode, down); } -bool SDL_SendKeyboardKeyAndKeycode(Uint64 timestamp, SDL_KeyboardID keyboardID, int rawcode, SDL_Scancode scancode, SDL_Keycode keycode, Uint8 state) +bool SDL_SendKeyboardKeyAndKeycode(Uint64 timestamp, SDL_KeyboardID keyboardID, int rawcode, SDL_Scancode scancode, SDL_Keycode keycode, bool down) { - if (state == SDL_PRESSED) { + if (down) { // Make sure we have this keycode in our keymap SetKeymapEntry(scancode, SDL_GetModState(), keycode); } - return SDL_SendKeyboardKeyInternal(timestamp, KEYBOARD_HARDWARE, keyboardID, rawcode, scancode, state); + return SDL_SendKeyboardKeyInternal(timestamp, KEYBOARD_HARDWARE, keyboardID, rawcode, scancode, down); } -bool SDL_SendKeyboardKeyIgnoreModifiers(Uint64 timestamp, SDL_KeyboardID keyboardID, int rawcode, SDL_Scancode scancode, Uint8 state) +bool SDL_SendKeyboardKeyIgnoreModifiers(Uint64 timestamp, SDL_KeyboardID keyboardID, int rawcode, SDL_Scancode scancode, bool down) { - return SDL_SendKeyboardKeyInternal(timestamp, KEYBOARD_HARDWARE | KEYBOARD_IGNOREMODIFIERS, keyboardID, rawcode, scancode, state); + return SDL_SendKeyboardKeyInternal(timestamp, KEYBOARD_HARDWARE | KEYBOARD_IGNOREMODIFIERS, keyboardID, rawcode, scancode, down); } bool SDL_SendKeyboardKeyAutoRelease(Uint64 timestamp, SDL_Scancode scancode) { - return SDL_SendKeyboardKeyInternal(timestamp, KEYBOARD_AUTORELEASE, SDL_GLOBAL_KEYBOARD_ID, 0, scancode, SDL_PRESSED); + return SDL_SendKeyboardKeyInternal(timestamp, KEYBOARD_AUTORELEASE, SDL_GLOBAL_KEYBOARD_ID, 0, scancode, false); } void SDL_ReleaseAutoReleaseKeys(void) @@ -699,9 +691,9 @@ void SDL_ReleaseAutoReleaseKeys(void) int scancode; if (keyboard->autorelease_pending) { - for (scancode = SDL_SCANCODE_UNKNOWN; scancode < SDL_NUM_SCANCODES; ++scancode) { + for (scancode = SDL_SCANCODE_UNKNOWN; scancode < SDL_SCANCODE_COUNT; ++scancode) { if (keyboard->keysource[scancode] == KEYBOARD_AUTORELEASE) { - SDL_SendKeyboardKeyInternal(0, KEYBOARD_AUTORELEASE, SDL_GLOBAL_KEYBOARD_ID, 0, (SDL_Scancode)scancode, SDL_RELEASED); + SDL_SendKeyboardKeyInternal(0, KEYBOARD_AUTORELEASE, SDL_GLOBAL_KEYBOARD_ID, 0, (SDL_Scancode)scancode, false); } } keyboard->autorelease_pending = false; @@ -720,7 +712,7 @@ bool SDL_HardwareKeyboardKeyPressed(void) SDL_Keyboard *keyboard = &SDL_keyboard; int scancode; - for (scancode = SDL_SCANCODE_UNKNOWN; scancode < SDL_NUM_SCANCODES; ++scancode) { + for (scancode = SDL_SCANCODE_UNKNOWN; scancode < SDL_SCANCODE_COUNT; ++scancode) { if (keyboard->keysource[scancode] & KEYBOARD_HARDWARE) { return true; } @@ -871,12 +863,12 @@ void SDL_QuitKeyboard(void) SDL_KeycodeOptionsChanged, &SDL_keyboard); } -const Uint8 *SDL_GetKeyboardState(int *numkeys) +const bool *SDL_GetKeyboardState(int *numkeys) { SDL_Keyboard *keyboard = &SDL_keyboard; if (numkeys != (int *)0) { - *numkeys = SDL_NUM_SCANCODES; + *numkeys = SDL_SCANCODE_COUNT; } return keyboard->keystate; } diff --git a/src/events/SDL_keyboard_c.h b/src/events/SDL_keyboard_c.h index 28e8bce0..cf4662c8 100644 --- a/src/events/SDL_keyboard_c.h +++ b/src/events/SDL_keyboard_c.h @@ -55,13 +55,13 @@ extern bool SDL_SetKeyboardFocus(SDL_Window *window); extern void SDL_SendKeyboardUnicodeKey(Uint64 timestamp, Uint32 ch); // Send a keyboard key event -extern bool SDL_SendKeyboardKey(Uint64 timestamp, SDL_KeyboardID keyboardID, int rawcode, SDL_Scancode scancode, Uint8 state); -extern bool SDL_SendKeyboardKeyIgnoreModifiers(Uint64 timestamp, SDL_KeyboardID keyboardID, int rawcode, SDL_Scancode scancode, Uint8 state); +extern bool SDL_SendKeyboardKey(Uint64 timestamp, SDL_KeyboardID keyboardID, int rawcode, SDL_Scancode scancode, bool down); +extern bool SDL_SendKeyboardKeyIgnoreModifiers(Uint64 timestamp, SDL_KeyboardID keyboardID, int rawcode, SDL_Scancode scancode, bool down); extern bool SDL_SendKeyboardKeyAutoRelease(Uint64 timestamp, SDL_Scancode scancode); /* This is for platforms that don't know the keymap but can report scancode and keycode directly. Most platforms should prefer to optionally call SDL_SetKeymap and then use SDL_SendKeyboardKey. */ -extern bool SDL_SendKeyboardKeyAndKeycode(Uint64 timestamp, SDL_KeyboardID keyboardID, int rawcode, SDL_Scancode scancode, SDL_Keycode keycode, Uint8 state); +extern bool SDL_SendKeyboardKeyAndKeycode(Uint64 timestamp, SDL_KeyboardID keyboardID, int rawcode, SDL_Scancode scancode, SDL_Keycode keycode, bool down); // Release all the autorelease keys extern void SDL_ReleaseAutoReleaseKeys(void); diff --git a/src/events/SDL_keymap.c b/src/events/SDL_keymap.c index dc1b3117..eb1e0973 100644 --- a/src/events/SDL_keymap.c +++ b/src/events/SDL_keymap.c @@ -192,7 +192,7 @@ static const SDL_Keycode shifted_default_symbols[] = { static SDL_Keycode SDL_GetDefaultKeyFromScancode(SDL_Scancode scancode, SDL_Keymod modstate) { - if (((int)scancode) < SDL_SCANCODE_UNKNOWN || scancode >= SDL_NUM_SCANCODES) { + if (((int)scancode) < SDL_SCANCODE_UNKNOWN || scancode >= SDL_SCANCODE_COUNT) { SDL_InvalidParamError("scancode"); return SDLK_UNKNOWN; } @@ -638,7 +638,7 @@ static SDL_Scancode SDL_GetDefaultScancodeFromKey(SDL_Keycode key, SDL_Keymod *m return SDL_SCANCODE_UNKNOWN; } -static const char *SDL_scancode_names[SDL_NUM_SCANCODES] = +static const char *SDL_scancode_names[SDL_SCANCODE_COUNT] = { /* 0 */ NULL, /* 1 */ NULL, @@ -933,9 +933,9 @@ static const char *SDL_scancode_names[SDL_NUM_SCANCODES] = /* 290 */ "EndCall", }; -SDL_bool SDL_SetScancodeName(SDL_Scancode scancode, const char *name) +bool SDL_SetScancodeName(SDL_Scancode scancode, const char *name) { - if (((int)scancode) < SDL_SCANCODE_UNKNOWN || scancode >= SDL_NUM_SCANCODES) { + if (((int)scancode) < SDL_SCANCODE_UNKNOWN || scancode >= SDL_SCANCODE_COUNT) { return SDL_InvalidParamError("scancode"); } @@ -946,7 +946,7 @@ SDL_bool SDL_SetScancodeName(SDL_Scancode scancode, const char *name) const char *SDL_GetScancodeName(SDL_Scancode scancode) { const char *name; - if (((int)scancode) < SDL_SCANCODE_UNKNOWN || scancode >= SDL_NUM_SCANCODES) { + if (((int)scancode) < SDL_SCANCODE_UNKNOWN || scancode >= SDL_SCANCODE_COUNT) { SDL_InvalidParamError("scancode"); return ""; } diff --git a/src/events/SDL_mouse.c b/src/events/SDL_mouse.c index f718ca20..80a3c632 100644 --- a/src/events/SDL_mouse.c +++ b/src/events/SDL_mouse.c @@ -26,7 +26,7 @@ #include "../video/SDL_sysvideo.h" #include "SDL_events_c.h" #include "SDL_mouse_c.h" -#if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK) +#if defined(SDL_PLATFORM_WINDOWS) #include "../core/windows/SDL_windows.h" // For GetDoubleClickTime() #endif @@ -356,7 +356,7 @@ void SDL_RemoveMouse(SDL_MouseID mouseID, bool send_event) } } -SDL_bool SDL_HasMouse(void) +bool SDL_HasMouse(void) { return (SDL_mouse_count > 0); } @@ -486,7 +486,7 @@ void SDL_ResetMouse(void) for (i = 1; i <= sizeof(buttonState)*8; ++i) { if (buttonState & SDL_BUTTON(i)) { - SDL_SendMouseButton(0, mouse->focus, mouse->mouseID, SDL_RELEASED, i); + SDL_SendMouseButton(0, mouse->focus, mouse->mouseID, i, false); } } SDL_assert(SDL_GetMouseButtonState(mouse, SDL_GLOBAL_MOUSE_ID, false) == 0); @@ -863,7 +863,7 @@ static void SDL_PrivateSendMouseMotion(Uint64 timestamp, SDL_Window *window, SDL } } -static SDL_MouseInputSource *GetMouseInputSource(SDL_Mouse *mouse, SDL_MouseID mouseID, Uint8 state, Uint8 button) +static SDL_MouseInputSource *GetMouseInputSource(SDL_Mouse *mouse, SDL_MouseID mouseID, bool down, Uint8 button) { SDL_MouseInputSource *source, *match = NULL, *sources; int i; @@ -876,7 +876,7 @@ static SDL_MouseInputSource *GetMouseInputSource(SDL_Mouse *mouse, SDL_MouseID m } } - if (!state && (!match || !(match->buttonstate & SDL_BUTTON(button)))) { + if (!down && (!match || !(match->buttonstate & SDL_BUTTON(button)))) { /* This might be a button release from a transition between mouse messages and raw input. * See if there's another mouse source that already has that button down and use that. */ @@ -922,7 +922,7 @@ static SDL_MouseClickState *GetMouseClickState(SDL_Mouse *mouse, Uint8 button) return &mouse->clickstate[button]; } -static void SDL_PrivateSendMouseButton(Uint64 timestamp, SDL_Window *window, SDL_MouseID mouseID, Uint8 state, Uint8 button, int clicks) +static void SDL_PrivateSendMouseButton(Uint64 timestamp, SDL_Window *window, SDL_MouseID mouseID, Uint8 button, bool down, int clicks) { SDL_Mouse *mouse = SDL_GetMouse(); Uint32 type; @@ -934,7 +934,7 @@ static void SDL_PrivateSendMouseButton(Uint64 timestamp, SDL_Window *window, SDL mouseID = SDL_GLOBAL_MOUSE_ID; } - source = GetMouseInputSource(mouse, mouseID, state, button); + source = GetMouseInputSource(mouse, mouseID, down, button); if (!source) { return; } @@ -943,7 +943,7 @@ static void SDL_PrivateSendMouseButton(Uint64 timestamp, SDL_Window *window, SDL // SDL_HINT_MOUSE_TOUCH_EVENTS: controlling whether mouse events should generate synthetic touch events if (mouse->mouse_touch_events) { if (mouseID != SDL_TOUCH_MOUSEID && button == SDL_BUTTON_LEFT) { - if (state == SDL_PRESSED) { + if (down) { track_mouse_down = true; } else { track_mouse_down = false; @@ -964,22 +964,16 @@ static void SDL_PrivateSendMouseButton(Uint64 timestamp, SDL_Window *window, SDL } // Figure out which event to perform - switch (state) { - case SDL_PRESSED: + if (down) { type = SDL_EVENT_MOUSE_BUTTON_DOWN; buttonstate |= SDL_BUTTON(button); - break; - case SDL_RELEASED: + } else { type = SDL_EVENT_MOUSE_BUTTON_UP; buttonstate &= ~SDL_BUTTON(button); - break; - default: - // Invalid state -- bail - return; } // We do this after calculating buttonstate so button presses gain focus - if (window && state == SDL_PRESSED) { + if (window && down) { SDL_UpdateMouseFocus(window, mouse->x, mouse->y, buttonstate, true); } @@ -992,7 +986,7 @@ static void SDL_PrivateSendMouseButton(Uint64 timestamp, SDL_Window *window, SDL if (clicks < 0) { SDL_MouseClickState *clickstate = GetMouseClickState(mouse, button); if (clickstate) { - if (state == SDL_PRESSED) { + if (down) { Uint64 now = SDL_GetTicks(); if (now >= (clickstate->last_timestamp + mouse->double_click_time) || @@ -1020,7 +1014,7 @@ static void SDL_PrivateSendMouseButton(Uint64 timestamp, SDL_Window *window, SDL event.common.timestamp = timestamp; event.button.windowID = mouse->focus ? mouse->focus->id : 0; event.button.which = source->mouseID; - event.button.state = state; + event.button.down = down; event.button.button = button; event.button.clicks = (Uint8)SDL_min(clicks, 255); event.button.x = mouse->x; @@ -1029,7 +1023,7 @@ static void SDL_PrivateSendMouseButton(Uint64 timestamp, SDL_Window *window, SDL } // We do this after dispatching event so button releases can lose focus - if (window && state == SDL_RELEASED) { + if (window && !down) { SDL_UpdateMouseFocus(window, mouse->x, mouse->y, buttonstate, true); } @@ -1039,15 +1033,15 @@ static void SDL_PrivateSendMouseButton(Uint64 timestamp, SDL_Window *window, SDL } } -void SDL_SendMouseButtonClicks(Uint64 timestamp, SDL_Window *window, SDL_MouseID mouseID, Uint8 state, Uint8 button, int clicks) +void SDL_SendMouseButtonClicks(Uint64 timestamp, SDL_Window *window, SDL_MouseID mouseID, Uint8 button, bool down, int clicks) { clicks = SDL_max(clicks, 0); - SDL_PrivateSendMouseButton(timestamp, window, mouseID, state, button, clicks); + SDL_PrivateSendMouseButton(timestamp, window, mouseID, button, down, clicks); } -void SDL_SendMouseButton(Uint64 timestamp, SDL_Window *window, SDL_MouseID mouseID, Uint8 state, Uint8 button) +void SDL_SendMouseButton(Uint64 timestamp, SDL_Window *window, SDL_MouseID mouseID, Uint8 button, bool down) { - SDL_PrivateSendMouseButton(timestamp, window, mouseID, state, button, -1); + SDL_PrivateSendMouseButton(timestamp, window, mouseID, button, down, -1); } void SDL_SendMouseWheel(Uint64 timestamp, SDL_Window *window, SDL_MouseID mouseID, float x, float y, SDL_MouseWheelDirection direction) @@ -1260,7 +1254,7 @@ void SDL_PerformWarpMouseInWindow(SDL_Window *window, float x, float y, bool ign } } -void SDL_DisableMouseWarpEmulation() +void SDL_DisableMouseWarpEmulation(void) { SDL_Mouse *mouse = SDL_GetMouse(); @@ -1311,7 +1305,7 @@ void SDL_WarpMouseInWindow(SDL_Window *window, float x, float y) SDL_PerformWarpMouseInWindow(window, x, y, mouse->warp_emulation_active); } -SDL_bool SDL_WarpMouseGlobal(float x, float y) +bool SDL_WarpMouseGlobal(float x, float y) { SDL_Mouse *mouse = SDL_GetMouse(); @@ -1468,7 +1462,7 @@ bool SDL_UpdateMouseCapture(bool force_release) return true; } -SDL_bool SDL_CaptureMouse(SDL_bool enabled) +bool SDL_CaptureMouse(bool enabled) { SDL_Mouse *mouse = SDL_GetMouse(); @@ -1608,7 +1602,7 @@ SDL_Cursor *SDL_CreateSystemCursor(SDL_SystemCursor id) if this is desired for any reason. This is used when setting the video mode and when the SDL window gains the mouse focus. */ -SDL_bool SDL_SetCursor(SDL_Cursor *cursor) +bool SDL_SetCursor(SDL_Cursor *cursor) { SDL_Mouse *mouse = SDL_GetMouse(); @@ -1707,7 +1701,7 @@ void SDL_DestroyCursor(SDL_Cursor *cursor) } } -SDL_bool SDL_ShowCursor(void) +bool SDL_ShowCursor(void) { SDL_Mouse *mouse = SDL_GetMouse(); @@ -1723,7 +1717,7 @@ SDL_bool SDL_ShowCursor(void) return true; } -SDL_bool SDL_HideCursor(void) +bool SDL_HideCursor(void) { SDL_Mouse *mouse = SDL_GetMouse(); @@ -1734,7 +1728,7 @@ SDL_bool SDL_HideCursor(void) return true; } -SDL_bool SDL_CursorVisible(void) +bool SDL_CursorVisible(void) { SDL_Mouse *mouse = SDL_GetMouse(); diff --git a/src/events/SDL_mouse_c.h b/src/events/SDL_mouse_c.h index f093dcf3..993e2ae1 100644 --- a/src/events/SDL_mouse_c.h +++ b/src/events/SDL_mouse_c.h @@ -169,10 +169,10 @@ extern bool SDL_SetMouseSystemScale(int num_values, const float *values); extern void SDL_SendMouseMotion(Uint64 timestamp, SDL_Window *window, SDL_MouseID mouseID, bool relative, float x, float y); // Send a mouse button event -extern void SDL_SendMouseButton(Uint64 timestamp, SDL_Window *window, SDL_MouseID mouseID, Uint8 state, Uint8 button); +extern void SDL_SendMouseButton(Uint64 timestamp, SDL_Window *window, SDL_MouseID mouseID, Uint8 button, bool down); // Send a mouse button event with a click count -extern void SDL_SendMouseButtonClicks(Uint64 timestamp, SDL_Window *window, SDL_MouseID mouseID, Uint8 state, Uint8 button, int clicks); +extern void SDL_SendMouseButtonClicks(Uint64 timestamp, SDL_Window *window, SDL_MouseID mouseID, Uint8 button, bool down, int clicks); // Send a mouse wheel event extern void SDL_SendMouseWheel(Uint64 timestamp, SDL_Window *window, SDL_MouseID mouseID, float x, float y, SDL_MouseWheelDirection direction); diff --git a/src/events/SDL_pen.c b/src/events/SDL_pen.c index 6ef721d1..9d234efa 100644 --- a/src/events/SDL_pen.c +++ b/src/events/SDL_pen.c @@ -31,7 +31,7 @@ typedef struct SDL_Pen SDL_PenID instance_id; char *name; SDL_PenInfo info; - float axes[SDL_PEN_NUM_AXES]; + float axes[SDL_PEN_AXIS_COUNT]; float x; float y; SDL_PenInputFlags input_state; @@ -142,7 +142,7 @@ const char *SDL_GetPenName(SDL_PenID instance_id) return result; } -SDL_bool SDL_GetPenInfo(SDL_PenID instance_id, SDL_PenInfo *info) +bool SDL_GetPenInfo(SDL_PenID instance_id, SDL_PenInfo *info) { SDL_LockRWLockForReading(pen_device_rwlock); const SDL_Pen *pen = FindPenByInstanceId(instance_id); @@ -170,10 +170,10 @@ SDL_PenInputFlags SDL_GetPenStatus(SDL_PenID instance_id, float *axes, int num_a if (pen) { result = pen->input_state; if (axes && num_axes) { - SDL_memcpy(axes, pen->axes, SDL_min(num_axes, SDL_PEN_NUM_AXES) * sizeof (*axes)); + SDL_memcpy(axes, pen->axes, SDL_min(num_axes, SDL_PEN_AXIS_COUNT) * sizeof (*axes)); // zero out axes we don't know about, in case the caller built with newer SDL headers that support more of them. - if (num_axes > SDL_PEN_NUM_AXES) { - SDL_memset(&axes[SDL_PEN_NUM_AXES], '\0', (num_axes - SDL_PEN_NUM_AXES) * sizeof (*axes)); + if (num_axes > SDL_PEN_AXIS_COUNT) { + SDL_memset(&axes[SDL_PEN_AXIS_COUNT], '\0', (num_axes - SDL_PEN_AXIS_COUNT) * sizeof (*axes)); } } } @@ -309,7 +309,7 @@ void SDL_RemoveAllPenDevices(void (*callback)(SDL_PenID instance_id, void *handl SDL_UnlockRWLock(pen_device_rwlock); } -void SDL_SendPenTouch(Uint64 timestamp, SDL_PenID instance_id, const SDL_Window *window, Uint8 state, Uint8 eraser) +void SDL_SendPenTouch(Uint64 timestamp, SDL_PenID instance_id, const SDL_Window *window, bool eraser, bool down) { bool send_event = false; SDL_PenInputFlags input_state = 0; @@ -327,10 +327,10 @@ void SDL_SendPenTouch(Uint64 timestamp, SDL_PenID instance_id, const SDL_Window x = pen->x; y = pen->y; - if (state && ((input_state & SDL_PEN_INPUT_DOWN) == 0)) { + if (down && ((input_state & SDL_PEN_INPUT_DOWN) == 0)) { input_state |= SDL_PEN_INPUT_DOWN; send_event = true; - } else if (!state && (input_state & SDL_PEN_INPUT_DOWN)) { + } else if (!down && (input_state & SDL_PEN_INPUT_DOWN)) { input_state &= ~SDL_PEN_INPUT_DOWN; send_event = true; } @@ -338,17 +338,17 @@ void SDL_SendPenTouch(Uint64 timestamp, SDL_PenID instance_id, const SDL_Window if (eraser && ((input_state & SDL_PEN_INPUT_ERASER_TIP) == 0)) { input_state |= SDL_PEN_INPUT_ERASER_TIP; send_event = true; - } else if (!state && (input_state & SDL_PEN_INPUT_ERASER_TIP)) { + } else if (!down && (input_state & SDL_PEN_INPUT_ERASER_TIP)) { input_state &= ~SDL_PEN_INPUT_ERASER_TIP; send_event = true; } - pen->input_state = input_state; // we could do an SDL_AtomicSet here if we run into trouble... + pen->input_state = input_state; // we could do an SDL_SetAtomicInt here if we run into trouble... } SDL_UnlockRWLock(pen_device_rwlock); if (send_event) { - const SDL_EventType evtype = state ? SDL_EVENT_PEN_DOWN : SDL_EVENT_PEN_UP; + const SDL_EventType evtype = down ? SDL_EVENT_PEN_DOWN : SDL_EVENT_PEN_UP; if (send_event && SDL_EventEnabled(evtype)) { SDL_Event event; SDL_zero(event); @@ -359,8 +359,8 @@ void SDL_SendPenTouch(Uint64 timestamp, SDL_PenID instance_id, const SDL_Window event.ptouch.pen_state = input_state; event.ptouch.x = x; event.ptouch.y = y; - event.ptouch.eraser = eraser ? 1 : 0; - event.ptouch.state = state ? SDL_PRESSED : SDL_RELEASED; + event.ptouch.eraser = eraser; + event.ptouch.down = down; SDL_PushEvent(&event); } } @@ -368,7 +368,7 @@ void SDL_SendPenTouch(Uint64 timestamp, SDL_PenID instance_id, const SDL_Window void SDL_SendPenAxis(Uint64 timestamp, SDL_PenID instance_id, const SDL_Window *window, SDL_PenAxis axis, float value) { - SDL_assert((axis >= 0) && (axis < SDL_PEN_NUM_AXES)); // fix the backend if this triggers. + SDL_assert((axis >= 0) && (axis < SDL_PEN_AXIS_COUNT)); // fix the backend if this triggers. bool send_event = false; SDL_PenInputFlags input_state = 0; @@ -383,7 +383,7 @@ void SDL_SendPenAxis(Uint64 timestamp, SDL_PenID instance_id, const SDL_Window * SDL_Pen *pen = FindPenByInstanceId(instance_id); if (pen) { if (pen->axes[axis] != value) { - pen->axes[axis] = value; // we could do an SDL_AtomicSet here if we run into trouble... + pen->axes[axis] = value; // we could do an SDL_SetAtomicInt here if we run into trouble... input_state = pen->input_state; x = pen->x; y = pen->y; @@ -421,8 +421,8 @@ void SDL_SendPenMotion(Uint64 timestamp, SDL_PenID instance_id, const SDL_Window SDL_Pen *pen = FindPenByInstanceId(instance_id); if (pen) { if ((pen->x != x) || (pen->y != y)) { - pen->x = x; // we could do an SDL_AtomicSet here if we run into trouble... - pen->y = y; // we could do an SDL_AtomicSet here if we run into trouble... + pen->x = x; // we could do an SDL_SetAtomicInt here if we run into trouble... + pen->y = y; // we could do an SDL_SetAtomicInt here if we run into trouble... input_state = pen->input_state; send_event = true; } @@ -443,7 +443,7 @@ void SDL_SendPenMotion(Uint64 timestamp, SDL_PenID instance_id, const SDL_Window } } -void SDL_SendPenButton(Uint64 timestamp, SDL_PenID instance_id, const SDL_Window *window, Uint8 state, Uint8 button) +void SDL_SendPenButton(Uint64 timestamp, SDL_PenID instance_id, const SDL_Window *window, Uint8 button, bool down) { bool send_event = false; SDL_PenInputFlags input_state = 0; @@ -463,22 +463,22 @@ void SDL_SendPenButton(Uint64 timestamp, SDL_PenID instance_id, const SDL_Window if (pen) { input_state = pen->input_state; const Uint32 flag = (Uint32) (1u << button); - const Uint8 current = (input_state & flag) ? 1 : 0; + const bool current = ((input_state & flag) != 0); x = pen->x; y = pen->y; - if (state && !current) { + if (down && !current) { input_state |= flag; send_event = true; - } else if (!state && current) { + } else if (!down && current) { input_state &= ~flag; send_event = true; } - pen->input_state = input_state; // we could do an SDL_AtomicSet here if we run into trouble... + pen->input_state = input_state; // we could do an SDL_SetAtomicInt here if we run into trouble... } SDL_UnlockRWLock(pen_device_rwlock); if (send_event) { - const SDL_EventType evtype = state ? SDL_EVENT_PEN_BUTTON_DOWN : SDL_EVENT_PEN_BUTTON_UP; + const SDL_EventType evtype = down ? SDL_EVENT_PEN_BUTTON_DOWN : SDL_EVENT_PEN_BUTTON_UP; if (SDL_EventEnabled(evtype)) { SDL_Event event; SDL_zero(event); @@ -490,7 +490,7 @@ void SDL_SendPenButton(Uint64 timestamp, SDL_PenID instance_id, const SDL_Window event.pbutton.x = x; event.pbutton.y = y; event.pbutton.button = button; - event.pbutton.state = state ? SDL_PRESSED : SDL_RELEASED; + event.pbutton.down = down; SDL_PushEvent(&event); } } diff --git a/src/events/SDL_pen_c.h b/src/events/SDL_pen_c.h index fba1e4e2..7e069b00 100644 --- a/src/events/SDL_pen_c.h +++ b/src/events/SDL_pen_c.h @@ -24,7 +24,6 @@ #ifndef SDL_pen_c_h_ #define SDL_pen_c_h_ -#include "../../include/SDL3/SDL_pen.h" #include "SDL_mouse_c.h" typedef Uint32 SDL_PenCapabilityFlags; @@ -68,7 +67,7 @@ extern void SDL_RemovePenDevice(Uint64 timestamp, SDL_PenID instance_id); extern void SDL_RemoveAllPenDevices(void (*callback)(SDL_PenID instance_id, void *handle, void *userdata), void *userdata); // Backend calls this when a pen's button changes, to generate events and update state. -extern void SDL_SendPenTouch(Uint64 timestamp, SDL_PenID instance_id, const SDL_Window *window, Uint8 state, Uint8 eraser); +extern void SDL_SendPenTouch(Uint64 timestamp, SDL_PenID instance_id, const SDL_Window *window, bool eraser, bool down); // Backend calls this when a pen moves on the tablet, to generate events and update state. extern void SDL_SendPenMotion(Uint64 timestamp, SDL_PenID instance_id, const SDL_Window *window, float x, float y); @@ -77,7 +76,7 @@ extern void SDL_SendPenMotion(Uint64 timestamp, SDL_PenID instance_id, const SDL extern void SDL_SendPenAxis(Uint64 timestamp, SDL_PenID instance_id, const SDL_Window *window, SDL_PenAxis axis, float value); // Backend calls this when a pen's button changes, to generate events and update state. -extern void SDL_SendPenButton(Uint64 timestamp, SDL_PenID instance_id, const SDL_Window *window, Uint8 state, Uint8 button); +extern void SDL_SendPenButton(Uint64 timestamp, SDL_PenID instance_id, const SDL_Window *window, Uint8 button, bool down); // Backend can optionally use this to find the SDL_PenID for the `handle` that was passed to SDL_AddPenDevice. extern SDL_PenID SDL_FindPenByHandle(void *handle); @@ -95,5 +94,3 @@ extern bool SDL_InitPen(void); extern void SDL_QuitPen(void); #endif // SDL_pen_c_h_ - -// vi: set ts=4 sw=4 expandtab: diff --git a/src/events/SDL_touch.c b/src/events/SDL_touch.c index 19c4db71..3ad041d8 100644 --- a/src/events/SDL_touch.c +++ b/src/events/SDL_touch.c @@ -295,11 +295,11 @@ void SDL_SendTouch(Uint64 timestamp, SDL_TouchID id, SDL_FingerID fingerid, SDL_ pos_y = (float)(window->h - 1); } SDL_SendMouseMotion(timestamp, window, SDL_TOUCH_MOUSEID, false, pos_x, pos_y); - SDL_SendMouseButton(timestamp, window, SDL_TOUCH_MOUSEID, SDL_PRESSED, SDL_BUTTON_LEFT); + SDL_SendMouseButton(timestamp, window, SDL_TOUCH_MOUSEID, SDL_BUTTON_LEFT, true); } } else { if (finger_touching == true && track_touchid == id && track_fingerid == fingerid) { - SDL_SendMouseButton(timestamp, window, SDL_TOUCH_MOUSEID, SDL_RELEASED, SDL_BUTTON_LEFT); + SDL_SendMouseButton(timestamp, window, SDL_TOUCH_MOUSEID, SDL_BUTTON_LEFT, false); } } } diff --git a/src/events/SDL_windowevents.c b/src/events/SDL_windowevents.c index 82b39939..01a09ab7 100644 --- a/src/events/SDL_windowevents.c +++ b/src/events/SDL_windowevents.c @@ -26,7 +26,7 @@ #include "SDL_mouse_c.h" -static SDL_bool SDLCALL RemoveSupercededWindowEvents(void *userdata, SDL_Event *event) +static bool SDLCALL RemoveSupercededWindowEvents(void *userdata, SDL_Event *event) { SDL_Event *new_event = (SDL_Event *)userdata; diff --git a/src/file/SDL_iostream.c b/src/file/SDL_iostream.c index 7c04e65a..bb14e090 100644 --- a/src/file/SDL_iostream.c +++ b/src/file/SDL_iostream.c @@ -20,7 +20,7 @@ */ #include "SDL_internal.h" -#if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK) || defined(SDL_PLATFORM_WINRT) +#if defined(SDL_PLATFORM_WINDOWS) #include "../core/windows/SDL_windows.h" #endif @@ -54,15 +54,16 @@ struct SDL_IOStream #include "../core/android/SDL_android.h" #endif -#if defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK) || defined(SDL_PLATFORM_WINRT) +#if defined(SDL_PLATFORM_WINDOWS) typedef struct IOStreamWindowsData { - bool append; HANDLE h; void *data; size_t size; size_t left; + bool append; + bool autoclose; } IOStreamWindowsData; @@ -73,9 +74,9 @@ typedef struct IOStreamWindowsData #define READAHEAD_BUFFER_SIZE 1024 -static bool SDLCALL windows_file_open(IOStreamWindowsData *iodata, const char *filename, const char *mode) +static HANDLE SDLCALL windows_file_open(const char *filename, const char *mode) { -#if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) && !defined(SDL_PLATFORM_WINRT) +#if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) UINT old_error_mode; #endif HANDLE h; @@ -83,9 +84,6 @@ static bool SDLCALL windows_file_open(IOStreamWindowsData *iodata, const char *f DWORD must_exist, truncate; int a_mode; - SDL_zerop(iodata); - iodata->h = INVALID_HANDLE_VALUE; // mark this as unusable - // "r" = reading, file must exist // "w" = writing, truncate existing, file may not exist // "r+"= reading or writing, file must exist @@ -100,33 +98,17 @@ static bool SDLCALL windows_file_open(IOStreamWindowsData *iodata, const char *f w_right = (a_mode || SDL_strchr(mode, '+') || truncate) ? GENERIC_WRITE : 0; if (!r_right && !w_right) { - return false; // inconsistent mode + return INVALID_HANDLE_VALUE; // inconsistent mode } // failed (invalid call) - iodata->data = (char *)SDL_malloc(READAHEAD_BUFFER_SIZE); - if (!iodata->data) { - return false; - } -#if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) && !defined(SDL_PLATFORM_WINRT) +#if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) // Do not open a dialog box if failure - old_error_mode = - SetErrorMode(SEM_NOOPENFILEERRORBOX | SEM_FAILCRITICALERRORS); + old_error_mode = SetErrorMode(SEM_NOOPENFILEERRORBOX | SEM_FAILCRITICALERRORS); #endif { LPWSTR str = WIN_UTF8ToStringW(filename); -#if defined(SDL_PLATFORM_WINRT) - CREATEFILE2_EXTENDED_PARAMETERS extparams; - SDL_zero(extparams); - extparams.dwSize = sizeof(extparams); - extparams.dwFileAttributes = FILE_ATTRIBUTE_NORMAL; - h = CreateFile2(str, - (w_right | r_right), - (w_right) ? 0 : FILE_SHARE_READ, - (must_exist | truncate | a_mode), - &extparams); -#else h = CreateFileW(str, (w_right | r_right), (w_right) ? 0 : FILE_SHARE_READ, @@ -134,25 +116,18 @@ static bool SDLCALL windows_file_open(IOStreamWindowsData *iodata, const char *f (must_exist | truncate | a_mode), FILE_ATTRIBUTE_NORMAL, NULL); -#endif SDL_free(str); } -#if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) && !defined(SDL_PLATFORM_WINRT) +#if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES) // restore old behavior SetErrorMode(old_error_mode); #endif if (h == INVALID_HANDLE_VALUE) { - SDL_free(iodata->data); - iodata->data = NULL; SDL_SetError("Couldn't open %s", filename); - return false; // failed (CreateFile) } - iodata->h = h; - iodata->append = a_mode ? true : false; - - return true; // ok + return h; } static Sint64 SDLCALL windows_file_size(void *userdata) @@ -196,7 +171,7 @@ static Sint64 SDLCALL windows_file_seek(void *userdata, Sint64 offset, SDL_IOWhe windowsoffset.QuadPart = offset; if (!SetFilePointerEx(iodata->h, windowsoffset, &windowsoffset, windowswhence)) { - return WIN_SetError("windows_file_seek"); + return WIN_SetError("Error seeking in datastream"); } return windowsoffset.QuadPart; } @@ -227,7 +202,18 @@ static size_t SDLCALL windows_file_read(void *userdata, void *ptr, size_t size, if (total_need < READAHEAD_BUFFER_SIZE) { if (!ReadFile(iodata->h, iodata->data, READAHEAD_BUFFER_SIZE, &bytes, NULL)) { - SDL_SetError("Error reading from datastream"); + DWORD error = GetLastError(); + switch (error) { + case ERROR_BROKEN_PIPE: + case ERROR_HANDLE_EOF: + break; + case ERROR_NO_DATA: + *status = SDL_IO_STATUS_NOT_READY; + break; + default: + WIN_SetError("Error reading from datastream"); + break; + } return 0; } read_ahead = SDL_min(total_need, bytes); @@ -237,7 +223,18 @@ static size_t SDLCALL windows_file_read(void *userdata, void *ptr, size_t size, total_read += read_ahead; } else { if (!ReadFile(iodata->h, ptr, (DWORD)total_need, &bytes, NULL)) { - SDL_SetError("Error reading from datastream"); + DWORD error = GetLastError(); + switch (error) { + case ERROR_BROKEN_PIPE: + case ERROR_HANDLE_EOF: + break; + case ERROR_NO_DATA: + *status = SDL_IO_STATUS_NOT_READY; + break; + default: + WIN_SetError("Error reading from datastream"); + break; + } return 0; } total_read += bytes; @@ -248,12 +245,11 @@ static size_t SDLCALL windows_file_read(void *userdata, void *ptr, size_t size, static size_t SDLCALL windows_file_write(void *userdata, const void *ptr, size_t size, SDL_IOStatus *status) { IOStreamWindowsData *iodata = (IOStreamWindowsData *) userdata; - const size_t total_bytes = size; DWORD bytes; if (iodata->left) { if (!SetFilePointer(iodata->h, -(LONG)iodata->left, NULL, FILE_CURRENT)) { - SDL_SetError("Error seeking in datastream"); + WIN_SetError("Error seeking in datastream"); return 0; } iodata->left = 0; @@ -264,33 +260,80 @@ static size_t SDLCALL windows_file_write(void *userdata, const void *ptr, size_t LARGE_INTEGER windowsoffset; windowsoffset.QuadPart = 0; if (!SetFilePointerEx(iodata->h, windowsoffset, &windowsoffset, FILE_END)) { - SDL_SetError("Error seeking in datastream"); + WIN_SetError("Error seeking in datastream"); return 0; } } - if (!WriteFile(iodata->h, ptr, (DWORD)total_bytes, &bytes, NULL)) { - SDL_SetError("Error writing to datastream"); + if (!WriteFile(iodata->h, ptr, (DWORD)size, &bytes, NULL)) { + WIN_SetError("Error writing to datastream"); return 0; } - + if (bytes == 0 && size > 0) { + *status = SDL_IO_STATUS_NOT_READY; + } return bytes; } -static SDL_bool SDLCALL windows_file_close(void *userdata) +static bool SDLCALL windows_file_close(void *userdata) { IOStreamWindowsData *iodata = (IOStreamWindowsData *) userdata; if (iodata->h != INVALID_HANDLE_VALUE) { - CloseHandle(iodata->h); + if (iodata->autoclose) { + CloseHandle(iodata->h); + } iodata->h = INVALID_HANDLE_VALUE; // to be sure } SDL_free(iodata->data); SDL_free(iodata); return true; } -#endif // defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK) -#if defined(HAVE_STDIO_H) && !(defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK)) +SDL_IOStream *SDL_IOFromHandle(HANDLE handle, const char *mode, bool autoclose) +{ + IOStreamWindowsData *iodata = (IOStreamWindowsData *) SDL_calloc(1, sizeof (*iodata)); + if (!iodata) { + if (autoclose) { + CloseHandle(handle); + } + return NULL; + } + + SDL_IOStreamInterface iface; + SDL_INIT_INTERFACE(&iface); + if (GetFileType(handle) == FILE_TYPE_DISK) { + iface.size = windows_file_size; + iface.seek = windows_file_seek; + } + iface.read = windows_file_read; + iface.write = windows_file_write; + iface.close = windows_file_close; + + iodata->h = handle; + iodata->append = (SDL_strchr(mode, 'a') != NULL); + iodata->autoclose = autoclose; + + iodata->data = (char *)SDL_malloc(READAHEAD_BUFFER_SIZE); + if (!iodata->data) { + iface.close(iodata); + return NULL; + } + + SDL_IOStream *iostr = SDL_OpenIO(&iface, iodata); + if (!iostr) { + iface.close(iodata); + } else { + const SDL_PropertiesID props = SDL_GetIOProperties(iostr); + if (props) { + SDL_SetPointerProperty(props, SDL_PROP_IOSTREAM_WINDOWS_HANDLE_POINTER, iodata->h); + } + } + + return iostr; +} +#endif // defined(SDL_PLATFORM_WINDOWS) + +#if defined(HAVE_STDIO_H) && !defined(SDL_PLATFORM_WINDOWS) // Functions to read/write stdio file pointers. Not used for windows. @@ -369,12 +412,12 @@ static Sint64 SDLCALL stdio_seek(void *userdata, Sint64 offset, SDL_IOWhence whe if (is_noop || fseek(iodata->fp, (fseek_off_t)offset, stdiowhence) == 0) { const Sint64 pos = ftell(iodata->fp); if (pos < 0) { - SDL_SetError("Couldn't get stream offset"); + SDL_SetError("Couldn't get stream offset: %s", strerror(errno)); return -1; } return pos; } - SDL_SetError("Error seeking in datastream"); + SDL_SetError("Error seeking in datastream: %s", strerror(errno)); return -1; } @@ -383,7 +426,12 @@ static size_t SDLCALL stdio_read(void *userdata, void *ptr, size_t size, SDL_IOS IOStreamStdioData *iodata = (IOStreamStdioData *) userdata; const size_t bytes = fread(ptr, 1, size, iodata->fp); if (bytes == 0 && ferror(iodata->fp)) { - SDL_SetError("Error reading from datastream"); + if (errno == EAGAIN) { + *status = SDL_IO_STATUS_NOT_READY; + clearerr(iodata->fp); + } else { + SDL_SetError("Error reading from datastream: %s", strerror(errno)); + } } return bytes; } @@ -393,37 +441,60 @@ static size_t SDLCALL stdio_write(void *userdata, const void *ptr, size_t size, IOStreamStdioData *iodata = (IOStreamStdioData *) userdata; const size_t bytes = fwrite(ptr, 1, size, iodata->fp); if (bytes == 0 && ferror(iodata->fp)) { - SDL_SetError("Error writing to datastream"); + if (errno == EAGAIN) { + *status = SDL_IO_STATUS_NOT_READY; + clearerr(iodata->fp); + } else { + SDL_SetError("Error writing to datastream: %s", strerror(errno)); + } } return bytes; } -static SDL_bool SDLCALL stdio_close(void *userdata) +static bool SDLCALL stdio_flush(void *userdata, SDL_IOStatus *status) +{ + IOStreamStdioData *iodata = (IOStreamStdioData *) userdata; + if (fflush(iodata->fp) != 0) { + if (errno == EAGAIN) { + *status = SDL_IO_STATUS_NOT_READY; + return false; + } else { + return SDL_SetError("Error flushing datastream: %s", strerror(errno)); + } + } + return true; +} + +static bool SDLCALL stdio_close(void *userdata) { IOStreamStdioData *iodata = (IOStreamStdioData *) userdata; bool status = true; if (iodata->autoclose) { if (fclose(iodata->fp) != 0) { - status = SDL_SetError("Error writing to datastream"); + status = SDL_SetError("Error writing to datastream: %s", strerror(errno)); } } SDL_free(iodata); return status; } -static SDL_IOStream *SDL_IOFromFP(FILE *fp, bool autoclose) +SDL_IOStream *SDL_IOFromFP(FILE *fp, bool autoclose) { - IOStreamStdioData *iodata = (IOStreamStdioData *) SDL_malloc(sizeof (*iodata)); + IOStreamStdioData *iodata = (IOStreamStdioData *) SDL_calloc(1, sizeof (*iodata)); if (!iodata) { + if (autoclose) { + fclose(fp); + } return NULL; } SDL_IOStreamInterface iface; - SDL_zero(iface); + SDL_INIT_INTERFACE(&iface); // There's no stdio_size because SDL_GetIOSize emulates it the same way we'd do it for stdio anyhow. iface.seek = stdio_seek; iface.read = stdio_read; iface.write = stdio_write; + iface.flush = stdio_flush; iface.close = stdio_close; iodata->fp = fp; @@ -436,12 +507,13 @@ static SDL_IOStream *SDL_IOFromFP(FILE *fp, bool autoclose) const SDL_PropertiesID props = SDL_GetIOProperties(iostr); if (props) { SDL_SetPointerProperty(props, SDL_PROP_IOSTREAM_STDIO_FILE_POINTER, fp); + SDL_SetNumberProperty(props, SDL_PROP_IOSTREAM_FILE_DESCRIPTOR_NUMBER, fileno(fp)); } } return iostr; } -#endif // !HAVE_STDIO_H && !(SDL_PLATFORM_WIN32 || SDL_PLATFORM_GDK) +#endif // !HAVE_STDIO_H && !defined(SDL_PLATFORM_WINDOWS) // Functions to read/write memory pointers @@ -511,7 +583,7 @@ static size_t SDLCALL mem_write(void *userdata, const void *ptr, size_t size, SD return mem_io(userdata, iodata->here, ptr, size); } -static SDL_bool SDLCALL mem_close(void *userdata) +static bool SDLCALL mem_close(void *userdata) { SDL_free(userdata); return true; @@ -522,18 +594,10 @@ static SDL_bool SDLCALL mem_close(void *userdata) #if defined(HAVE_STDIO_H) && !defined(SDL_PLATFORM_WINDOWS) static bool IsRegularFileOrPipe(FILE *f) { - #ifdef SDL_PLATFORM_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 false; - } - #else struct stat st; if (fstat(fileno(f), &st) < 0 || !(S_ISREG(st.st_mode) || S_ISFIFO(st.st_mode))) { return false; } - #endif return true; } #endif @@ -562,7 +626,7 @@ SDL_IOStream *SDL_IOFromFile(const char *file, const char *mode) SDL_SetError("%s is not a regular file or pipe", file); return NULL; } - return SDL_IOFromFP(fp, 1); + return SDL_IOFromFP(fp, true); } } else if (SDL_strncmp(file, "content://", 10) == 0) { // Try opening content:// URI @@ -593,7 +657,7 @@ SDL_IOStream *SDL_IOFromFile(const char *file, const char *mode) SDL_SetError("%s is not a regular file or pipe", path); return NULL; } - return SDL_IOFromFP(fp, 1); + return SDL_IOFromFP(fp, true); } } } @@ -607,7 +671,7 @@ SDL_IOStream *SDL_IOFromFile(const char *file, const char *mode) } SDL_IOStreamInterface iface; - SDL_zero(iface); + SDL_INIT_INTERFACE(&iface); iface.size = Android_JNI_FileSize; iface.seek = Android_JNI_FileSeek; iface.read = Android_JNI_FileRead; @@ -624,41 +688,15 @@ SDL_IOStream *SDL_IOFromFile(const char *file, const char *mode) } } -#elif defined(SDL_PLATFORM_WIN32) || defined(SDL_PLATFORM_GDK) || defined(SDL_PLATFORM_WINRT) - IOStreamWindowsData *iodata = (IOStreamWindowsData *) SDL_malloc(sizeof (*iodata)); - if (!iodata) { - return NULL; - } - - if (!windows_file_open(iodata, file, mode)) { - windows_file_close(iodata); - return NULL; - } - - SDL_IOStreamInterface iface; - SDL_zero(iface); - iface.size = windows_file_size; - iface.seek = windows_file_seek; - iface.read = windows_file_read; - iface.write = windows_file_write; - iface.close = windows_file_close; - - iostr = SDL_OpenIO(&iface, iodata); - if (!iostr) { - windows_file_close(iodata); - } else { - const SDL_PropertiesID props = SDL_GetIOProperties(iostr); - if (props) { - SDL_SetPointerProperty(props, SDL_PROP_IOSTREAM_WINDOWS_HANDLE_POINTER, iodata->h); - } +#elif defined(SDL_PLATFORM_WINDOWS) + HANDLE handle = windows_file_open(file, mode); + if (handle != INVALID_HANDLE_VALUE) { + iostr = SDL_IOFromHandle(handle, mode, true); } #elif defined(HAVE_STDIO_H) { - #if defined(SDL_PLATFORM_WINRT) - FILE *fp = NULL; - fopen_s(&fp, file, mode); - #elif defined(SDL_PLATFORM_3DS) + #if defined(SDL_PLATFORM_3DS) FILE *fp = N3DS_FileOpen(file, mode); #else FILE *fp = fopen(file, mode); @@ -692,13 +730,13 @@ SDL_IOStream *SDL_IOFromMem(void *mem, size_t size) return NULL; } - IOStreamMemData *iodata = (IOStreamMemData *) SDL_malloc(sizeof (*iodata)); + IOStreamMemData *iodata = (IOStreamMemData *) SDL_calloc(1, sizeof (*iodata)); if (!iodata) { return NULL; } SDL_IOStreamInterface iface; - SDL_zero(iface); + SDL_INIT_INTERFACE(&iface); iface.size = mem_size; iface.seek = mem_seek; iface.read = mem_read; @@ -726,13 +764,13 @@ SDL_IOStream *SDL_IOFromConstMem(const void *mem, size_t size) return NULL; } - IOStreamMemData *iodata = (IOStreamMemData *) SDL_malloc(sizeof (*iodata)); + IOStreamMemData *iodata = (IOStreamMemData *) SDL_calloc(1, sizeof (*iodata)); if (!iodata) { return NULL; } SDL_IOStreamInterface iface; - SDL_zero(iface); + SDL_INIT_INTERFACE(&iface); iface.size = mem_size; iface.seek = mem_seek; iface.read = mem_read; @@ -813,7 +851,7 @@ static size_t SDLCALL dynamic_mem_write(void *userdata, const void *ptr, size_t return mem_io(&iodata->data, iodata->data.here, ptr, size); } -static SDL_bool SDLCALL dynamic_mem_close(void *userdata) +static bool SDLCALL dynamic_mem_close(void *userdata) { const IOStreamDynamicMemData *iodata = (IOStreamDynamicMemData *) userdata; void *mem = SDL_GetPointerProperty(SDL_GetIOProperties(iodata->stream), SDL_PROP_IOSTREAM_DYNAMIC_MEMORY_POINTER, NULL); @@ -826,24 +864,19 @@ static SDL_bool SDLCALL dynamic_mem_close(void *userdata) SDL_IOStream *SDL_IOFromDynamicMem(void) { - IOStreamDynamicMemData *iodata = (IOStreamDynamicMemData *) SDL_malloc(sizeof (*iodata)); + IOStreamDynamicMemData *iodata = (IOStreamDynamicMemData *) SDL_calloc(1, sizeof (*iodata)); if (!iodata) { return NULL; } SDL_IOStreamInterface iface; - SDL_zero(iface); + SDL_INIT_INTERFACE(&iface); iface.size = dynamic_mem_size; iface.seek = dynamic_mem_seek; iface.read = dynamic_mem_read; iface.write = dynamic_mem_write; iface.close = dynamic_mem_close; - iodata->data.base = NULL; - iodata->data.here = NULL; - iodata->data.stop = NULL; - iodata->end = NULL; - SDL_IOStream *iostr = SDL_OpenIO(&iface, iodata); if (iostr) { iodata->stream = iostr; @@ -868,6 +901,11 @@ SDL_IOStream *SDL_OpenIO(const SDL_IOStreamInterface *iface, void *userdata) SDL_InvalidParamError("iface"); return NULL; } + if (iface->version < sizeof(*iface)) { + // Update this to handle older versions of this interface + SDL_SetError("Invalid interface, should be initialized with SDL_INIT_INTERFACE()"); + return NULL; + } SDL_IOStream *iostr = (SDL_IOStream *)SDL_calloc(1, sizeof(*iostr)); if (iostr) { @@ -877,7 +915,7 @@ SDL_IOStream *SDL_OpenIO(const SDL_IOStreamInterface *iface, void *userdata) return iostr; } -SDL_bool SDL_CloseIO(SDL_IOStream *iostr) +bool SDL_CloseIO(SDL_IOStream *iostr) { bool result = true; if (iostr) { @@ -891,7 +929,7 @@ SDL_bool SDL_CloseIO(SDL_IOStream *iostr) } // Load all the data from an SDL data stream -void *SDL_LoadFile_IO(SDL_IOStream *src, size_t *datasize, SDL_bool closeio) +void *SDL_LoadFile_IO(SDL_IOStream *src, size_t *datasize, bool closeio) { const int FILE_CHUNK_SIZE = 1024; Sint64 size, size_total = 0; @@ -940,6 +978,10 @@ void *SDL_LoadFile_IO(SDL_IOStream *src, size_t *datasize, SDL_bool closeio) if (size_read > 0) { size_total += size_read; continue; + } else if (SDL_GetIOStatus(src) == SDL_IO_STATUS_NOT_READY) { + // Wait for the stream to be ready + SDL_Delay(1); + continue; } // The stream status will remain set for the caller to check @@ -999,9 +1041,11 @@ Sint64 SDL_GetIOSize(SDL_IOStream *context) Sint64 SDL_SeekIO(SDL_IOStream *context, Sint64 offset, SDL_IOWhence whence) { if (!context) { - return SDL_InvalidParamError("context"); + SDL_InvalidParamError("context"); + return -1; } else if (!context->iface.seek) { - return SDL_Unsupported(); + SDL_Unsupported(); + return -1; } return context->iface.seek(context->userdata, offset, whence); } @@ -1104,9 +1148,29 @@ size_t SDL_IOvprintf(SDL_IOStream *context, SDL_PRINTF_FORMAT_STRING const char return bytes; } +bool SDL_FlushIO(SDL_IOStream *context) +{ + bool result = true; + + if (!context) { + return SDL_InvalidParamError("context"); + } + + context->status = SDL_IO_STATUS_READY; + SDL_ClearError(); + + if (context->iface.flush) { + result = context->iface.flush(context->userdata, &context->status); + } + if (!result && (context->status == SDL_IO_STATUS_READY)) { + context->status = SDL_IO_STATUS_ERROR; + } + return result; +} + // Functions for dynamically reading and writing endian-specific values -SDL_bool SDL_ReadU8(SDL_IOStream *src, Uint8 *value) +bool SDL_ReadU8(SDL_IOStream *src, Uint8 *value) { Uint8 data = 0; bool result = false; @@ -1120,7 +1184,7 @@ SDL_bool SDL_ReadU8(SDL_IOStream *src, Uint8 *value) return result; } -SDL_bool SDL_ReadS8(SDL_IOStream *src, Sint8 *value) +bool SDL_ReadS8(SDL_IOStream *src, Sint8 *value) { Sint8 data = 0; bool result = false; @@ -1134,7 +1198,7 @@ SDL_bool SDL_ReadS8(SDL_IOStream *src, Sint8 *value) return result; } -SDL_bool SDL_ReadU16LE(SDL_IOStream *src, Uint16 *value) +bool SDL_ReadU16LE(SDL_IOStream *src, Uint16 *value) { Uint16 data = 0; bool result = false; @@ -1148,12 +1212,12 @@ SDL_bool SDL_ReadU16LE(SDL_IOStream *src, Uint16 *value) return result; } -SDL_bool SDL_ReadS16LE(SDL_IOStream *src, Sint16 *value) +bool SDL_ReadS16LE(SDL_IOStream *src, Sint16 *value) { return SDL_ReadU16LE(src, (Uint16 *)value); } -SDL_bool SDL_ReadU16BE(SDL_IOStream *src, Uint16 *value) +bool SDL_ReadU16BE(SDL_IOStream *src, Uint16 *value) { Uint16 data = 0; bool result = false; @@ -1167,12 +1231,12 @@ SDL_bool SDL_ReadU16BE(SDL_IOStream *src, Uint16 *value) return result; } -SDL_bool SDL_ReadS16BE(SDL_IOStream *src, Sint16 *value) +bool SDL_ReadS16BE(SDL_IOStream *src, Sint16 *value) { return SDL_ReadU16BE(src, (Uint16 *)value); } -SDL_bool SDL_ReadU32LE(SDL_IOStream *src, Uint32 *value) +bool SDL_ReadU32LE(SDL_IOStream *src, Uint32 *value) { Uint32 data = 0; bool result = false; @@ -1186,12 +1250,12 @@ SDL_bool SDL_ReadU32LE(SDL_IOStream *src, Uint32 *value) return result; } -SDL_bool SDL_ReadS32LE(SDL_IOStream *src, Sint32 *value) +bool SDL_ReadS32LE(SDL_IOStream *src, Sint32 *value) { return SDL_ReadU32LE(src, (Uint32 *)value); } -SDL_bool SDL_ReadU32BE(SDL_IOStream *src, Uint32 *value) +bool SDL_ReadU32BE(SDL_IOStream *src, Uint32 *value) { Uint32 data = 0; bool result = false; @@ -1205,12 +1269,12 @@ SDL_bool SDL_ReadU32BE(SDL_IOStream *src, Uint32 *value) return result; } -SDL_bool SDL_ReadS32BE(SDL_IOStream *src, Sint32 *value) +bool SDL_ReadS32BE(SDL_IOStream *src, Sint32 *value) { return SDL_ReadU32BE(src, (Uint32 *)value); } -SDL_bool SDL_ReadU64LE(SDL_IOStream *src, Uint64 *value) +bool SDL_ReadU64LE(SDL_IOStream *src, Uint64 *value) { Uint64 data = 0; bool result = false; @@ -1224,12 +1288,12 @@ SDL_bool SDL_ReadU64LE(SDL_IOStream *src, Uint64 *value) return result; } -SDL_bool SDL_ReadS64LE(SDL_IOStream *src, Sint64 *value) +bool SDL_ReadS64LE(SDL_IOStream *src, Sint64 *value) { return SDL_ReadU64LE(src, (Uint64 *)value); } -SDL_bool SDL_ReadU64BE(SDL_IOStream *src, Uint64 *value) +bool SDL_ReadU64BE(SDL_IOStream *src, Uint64 *value) { Uint64 data = 0; bool result = false; @@ -1243,83 +1307,83 @@ SDL_bool SDL_ReadU64BE(SDL_IOStream *src, Uint64 *value) return result; } -SDL_bool SDL_ReadS64BE(SDL_IOStream *src, Sint64 *value) +bool SDL_ReadS64BE(SDL_IOStream *src, Sint64 *value) { return SDL_ReadU64BE(src, (Uint64 *)value); } -SDL_bool SDL_WriteU8(SDL_IOStream *dst, Uint8 value) +bool SDL_WriteU8(SDL_IOStream *dst, Uint8 value) { return (SDL_WriteIO(dst, &value, sizeof(value)) == sizeof(value)); } -SDL_bool SDL_WriteS8(SDL_IOStream *dst, Sint8 value) +bool SDL_WriteS8(SDL_IOStream *dst, Sint8 value) { return (SDL_WriteIO(dst, &value, sizeof(value)) == sizeof(value)); } -SDL_bool SDL_WriteU16LE(SDL_IOStream *dst, Uint16 value) +bool SDL_WriteU16LE(SDL_IOStream *dst, Uint16 value) { const Uint16 swapped = SDL_Swap16LE(value); return (SDL_WriteIO(dst, &swapped, sizeof(swapped)) == sizeof(swapped)); } -SDL_bool SDL_WriteS16LE(SDL_IOStream *dst, Sint16 value) +bool SDL_WriteS16LE(SDL_IOStream *dst, Sint16 value) { return SDL_WriteU16LE(dst, (Uint16)value); } -SDL_bool SDL_WriteU16BE(SDL_IOStream *dst, Uint16 value) +bool SDL_WriteU16BE(SDL_IOStream *dst, Uint16 value) { const Uint16 swapped = SDL_Swap16BE(value); return (SDL_WriteIO(dst, &swapped, sizeof(swapped)) == sizeof(swapped)); } -SDL_bool SDL_WriteS16BE(SDL_IOStream *dst, Sint16 value) +bool SDL_WriteS16BE(SDL_IOStream *dst, Sint16 value) { return SDL_WriteU16BE(dst, (Uint16)value); } -SDL_bool SDL_WriteU32LE(SDL_IOStream *dst, Uint32 value) +bool SDL_WriteU32LE(SDL_IOStream *dst, Uint32 value) { const Uint32 swapped = SDL_Swap32LE(value); return (SDL_WriteIO(dst, &swapped, sizeof(swapped)) == sizeof(swapped)); } -SDL_bool SDL_WriteS32LE(SDL_IOStream *dst, Sint32 value) +bool SDL_WriteS32LE(SDL_IOStream *dst, Sint32 value) { return SDL_WriteU32LE(dst, (Uint32)value); } -SDL_bool SDL_WriteU32BE(SDL_IOStream *dst, Uint32 value) +bool SDL_WriteU32BE(SDL_IOStream *dst, Uint32 value) { const Uint32 swapped = SDL_Swap32BE(value); return (SDL_WriteIO(dst, &swapped, sizeof(swapped)) == sizeof(swapped)); } -SDL_bool SDL_WriteS32BE(SDL_IOStream *dst, Sint32 value) +bool SDL_WriteS32BE(SDL_IOStream *dst, Sint32 value) { return SDL_WriteU32BE(dst, (Uint32)value); } -SDL_bool SDL_WriteU64LE(SDL_IOStream *dst, Uint64 value) +bool SDL_WriteU64LE(SDL_IOStream *dst, Uint64 value) { const Uint64 swapped = SDL_Swap64LE(value); return (SDL_WriteIO(dst, &swapped, sizeof(swapped)) == sizeof(swapped)); } -SDL_bool SDL_WriteS64LE(SDL_IOStream *dst, Sint64 value) +bool SDL_WriteS64LE(SDL_IOStream *dst, Sint64 value) { return SDL_WriteU64LE(dst, (Uint64)value); } -SDL_bool SDL_WriteU64BE(SDL_IOStream *dst, Uint64 value) +bool SDL_WriteU64BE(SDL_IOStream *dst, Uint64 value) { const Uint64 swapped = SDL_Swap64BE(value); return (SDL_WriteIO(dst, &swapped, sizeof(swapped)) == sizeof(swapped)); } -SDL_bool SDL_WriteS64BE(SDL_IOStream *dst, Sint64 value) +bool SDL_WriteS64BE(SDL_IOStream *dst, Sint64 value) { return SDL_WriteU64BE(dst, (Uint64)value); } diff --git a/src/render/direct3d11/SDL_render_winrt.h b/src/file/SDL_iostream_c.h similarity index 77% rename from src/render/direct3d11/SDL_render_winrt.h rename to src/file/SDL_iostream_c.h index f657dacd..005eb72b 100644 --- a/src/render/direct3d11/SDL_render_winrt.h +++ b/src/file/SDL_iostream_c.h @@ -20,17 +20,13 @@ */ #include "SDL_internal.h" -#if SDL_VIDEO_RENDER_D3D11 +#ifndef SDL_iostream_c_h_ +#define SDL_iostream_c_h_ -#ifdef __cplusplus -extern "C" { +#if defined(SDL_PLATFORM_WINDOWS) +SDL_IOStream *SDL_IOFromHandle(HANDLE handle, const char *mode, bool autoclose); +#elif defined(HAVE_STDIO_H) +extern SDL_IOStream *SDL_IOFromFP(FILE *fp, bool autoclose); #endif -void *D3D11_GetCoreWindowFromSDLRenderer(SDL_Renderer *renderer); -DXGI_MODE_ROTATION D3D11_GetCurrentRotation(); - -#ifdef __cplusplus -} -#endif - -#endif // SDL_VIDEO_RENDER_D3D11 +#endif // SDL_iostream_c_h_ diff --git a/src/filesystem/SDL_filesystem.c b/src/filesystem/SDL_filesystem.c index 5b16a4e1..69056148 100644 --- a/src/filesystem/SDL_filesystem.c +++ b/src/filesystem/SDL_filesystem.c @@ -25,7 +25,7 @@ #include "SDL_sysfilesystem.h" #include "../stdlib/SDL_sysstdlib.h" -SDL_bool SDL_RemovePath(const char *path) +bool SDL_RemovePath(const char *path) { if (!path) { return SDL_InvalidParamError("path"); @@ -33,7 +33,7 @@ SDL_bool SDL_RemovePath(const char *path) return SDL_SYS_RemovePath(path); } -SDL_bool SDL_RenamePath(const char *oldpath, const char *newpath) +bool SDL_RenamePath(const char *oldpath, const char *newpath) { if (!oldpath) { return SDL_InvalidParamError("oldpath"); @@ -43,7 +43,7 @@ SDL_bool SDL_RenamePath(const char *oldpath, const char *newpath) return SDL_SYS_RenamePath(oldpath, newpath); } -SDL_bool SDL_CopyFile(const char *oldpath, const char *newpath) +bool SDL_CopyFile(const char *oldpath, const char *newpath) { if (!oldpath) { return SDL_InvalidParamError("oldpath"); @@ -53,7 +53,7 @@ SDL_bool SDL_CopyFile(const char *oldpath, const char *newpath) return SDL_SYS_CopyFile(oldpath, newpath); } -SDL_bool SDL_CreateDirectory(const char *path) +bool SDL_CreateDirectory(const char *path) { // TODO: Recursively create subdirectories if (!path) { @@ -62,7 +62,7 @@ SDL_bool SDL_CreateDirectory(const char *path) return SDL_SYS_CreateDirectory(path); } -SDL_bool SDL_EnumerateDirectory(const char *path, SDL_EnumerateDirectoryCallback callback, void *userdata) +bool SDL_EnumerateDirectory(const char *path, SDL_EnumerateDirectoryCallback callback, void *userdata) { if (!path) { return SDL_InvalidParamError("path"); @@ -75,7 +75,7 @@ SDL_bool SDL_EnumerateDirectory(const char *path, SDL_EnumerateDirectoryCallback return true; } -SDL_bool SDL_GetPathInfo(const char *path, SDL_PathInfo *info) +bool SDL_GetPathInfo(const char *path, SDL_PathInfo *info) { SDL_PathInfo dummy; @@ -399,12 +399,12 @@ char **SDL_InternalGlobDirectory(const char *path, const char *pattern, SDL_Glob return result; } -static SDL_bool GlobDirectoryGetPathInfo(const char *path, SDL_PathInfo *info, void *userdata) +static bool GlobDirectoryGetPathInfo(const char *path, SDL_PathInfo *info, void *userdata) { return SDL_GetPathInfo(path, info); } -static SDL_bool GlobDirectoryEnumerator(const char *path, SDL_EnumerateDirectoryCallback cb, void *cbuserdata, void *userdata) +static bool GlobDirectoryEnumerator(const char *path, SDL_EnumerateDirectoryCallback cb, void *cbuserdata, void *userdata) { return SDL_EnumerateDirectory(path, cb, cbuserdata); } @@ -427,7 +427,7 @@ const char *SDL_GetBasePath(void) } -static char *CachedUserFolders[SDL_FOLDER_TOTAL]; +static char *CachedUserFolders[SDL_FOLDER_COUNT]; const char *SDL_GetUserFolder(SDL_Folder folder) { diff --git a/src/filesystem/SDL_sysfilesystem.h b/src/filesystem/SDL_sysfilesystem.h index 615f3947..c35035bc 100644 --- a/src/filesystem/SDL_sysfilesystem.h +++ b/src/filesystem/SDL_sysfilesystem.h @@ -34,8 +34,8 @@ extern bool SDL_SYS_CopyFile(const char *oldpath, const char *newpath); extern bool SDL_SYS_CreateDirectory(const char *path); extern bool SDL_SYS_GetPathInfo(const char *path, SDL_PathInfo *info); -typedef SDL_bool (*SDL_GlobEnumeratorFunc)(const char *path, SDL_EnumerateDirectoryCallback cb, void *cbuserdata, void *userdata); -typedef SDL_bool (*SDL_GlobGetPathInfoFunc)(const char *path, SDL_PathInfo *info, void *userdata); +typedef bool (*SDL_GlobEnumeratorFunc)(const char *path, SDL_EnumerateDirectoryCallback cb, void *cbuserdata, void *userdata); +typedef bool (*SDL_GlobGetPathInfoFunc)(const char *path, SDL_PathInfo *info, void *userdata); extern char **SDL_InternalGlobDirectory(const char *path, const char *pattern, SDL_GlobFlags flags, int *count, SDL_GlobEnumeratorFunc enumerator, SDL_GlobGetPathInfoFunc getpathinfo, void *userdata); #endif diff --git a/src/filesystem/gdk/SDL_sysfilesystem.cpp b/src/filesystem/gdk/SDL_sysfilesystem.cpp index d5fb3962..d2811007 100644 --- a/src/filesystem/gdk/SDL_sysfilesystem.cpp +++ b/src/filesystem/gdk/SDL_sysfilesystem.cpp @@ -141,5 +141,3 @@ char *SDL_SYS_GetUserFolder(SDL_Folder folder) SDL_Unsupported(); return NULL; } - -// vi: set ts=4 sw=4 expandtab: diff --git a/src/filesystem/unix/SDL_sysfilesystem.c b/src/filesystem/unix/SDL_sysfilesystem.c index 630620e3..6f46a5b3 100644 --- a/src/filesystem/unix/SDL_sysfilesystem.c +++ b/src/filesystem/unix/SDL_sysfilesystem.c @@ -368,12 +368,12 @@ static char *xdg_user_dir_lookup_with_fallback (const char *type, const char *fa int relative; size_t l; - home_dir = SDL_getenv ("HOME"); + home_dir = SDL_getenv("HOME"); if (!home_dir) goto error; - config_home = SDL_getenv ("XDG_CONFIG_HOME"); + config_home = SDL_getenv("XDG_CONFIG_HOME"); if (!config_home || config_home[0] == 0) { l = SDL_strlen (home_dir) + SDL_strlen ("/.config/user-dirs.dirs") + 1; diff --git a/src/filesystem/winrt/SDL_sysfilesystem.cpp b/src/filesystem/winrt/SDL_sysfilesystem.cpp deleted file mode 100644 index fd73b0c6..00000000 --- a/src/filesystem/winrt/SDL_sysfilesystem.cpp +++ /dev/null @@ -1,262 +0,0 @@ -/* - 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" - -/* TODO, WinRT: remove the need to compile this with C++/CX (/ZW) extensions, and if possible, without C++ at all - */ - -#ifdef SDL_PLATFORM_WINRT - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -// System dependent filesystem routines - -extern "C" { -#include "../../core/windows/SDL_windows.h" -#include "../SDL_sysfilesystem.h" -} - -#include -#include - -using namespace std; -using namespace Windows::Storage; - -static const wchar_t *SDL_GetWinRTFSPathUNICODE(SDL_WinRT_Path pathType) -{ - switch (pathType) { - case SDL_WINRT_PATH_INSTALLED_LOCATION: - { - static wstring path; - if (path.empty()) { -#if defined(NTDDI_WIN10_19H1) && (NTDDI_VERSION >= NTDDI_WIN10_19H1) && (WINAPI_FAMILY == WINAPI_FAMILY_PC_APP) // Only PC supports mods - // Windows 1903 supports mods, via the EffectiveLocation API - if (Windows::Foundation::Metadata::ApiInformation::IsApiContractPresent("Windows.Foundation.UniversalApiContract", 8, 0)) { - path = Windows::ApplicationModel::Package::Current->EffectiveLocation->Path->Data(); - } else { - path = Windows::ApplicationModel::Package::Current->InstalledLocation->Path->Data(); - } -#else - path = Windows::ApplicationModel::Package::Current->InstalledLocation->Path->Data(); -#endif - } - return path.c_str(); - } - - case SDL_WINRT_PATH_LOCAL_FOLDER: - { - static wstring path; - if (path.empty()) { - path = ApplicationData::Current->LocalFolder->Path->Data(); - } - return path.c_str(); - } - -#if !SDL_WINAPI_FAMILY_PHONE || NTDDI_VERSION > NTDDI_WIN8 - case SDL_WINRT_PATH_ROAMING_FOLDER: - { - static wstring path; - if (path.empty()) { - path = ApplicationData::Current->RoamingFolder->Path->Data(); - } - return path.c_str(); - } - - case SDL_WINRT_PATH_TEMP_FOLDER: - { - static wstring path; - if (path.empty()) { - path = ApplicationData::Current->TemporaryFolder->Path->Data(); - } - return path.c_str(); - } -#endif - - default: - break; - } - - SDL_Unsupported(); - return NULL; -} - -extern "C" const char *SDL_GetWinRTFSPath(SDL_WinRT_Path pathType) -{ - typedef unordered_map UTF8PathMap; - static UTF8PathMap utf8Paths; - - UTF8PathMap::iterator searchResult = utf8Paths.find(pathType); - if (searchResult != utf8Paths.end()) { - return searchResult->second.c_str(); - } - - const wchar_t *ucs2Path = SDL_GetWinRTFSPathUNICODE(pathType); - if (!ucs2Path) { - return NULL; - } - - char *utf8Path = WIN_StringToUTF8W(ucs2Path); - utf8Paths[pathType] = utf8Path; - SDL_free(utf8Path); - return SDL_GetPersistentString(utf8Paths[pathType].c_str()); -} - -extern "C" char *SDL_SYS_GetBasePath(void) -{ - const char *srcPath = SDL_GetWinRTFSPath(SDL_WINRT_PATH_INSTALLED_LOCATION); - size_t destPathLen; - char *destPath = 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) { - return NULL; - } - - SDL_snprintf(destPath, destPathLen, "%s\\", srcPath); - return destPath; -} - -extern "C" char *SDL_SYS_GetPrefPath(const char *org, const char *app) -{ - /* WinRT note: The 'SHGetFolderPath' API that is used in Windows 7 and - * earlier is not available on WinRT or Windows Phone. WinRT provides - * a similar API, but SHGetFolderPath can't be called, at least not - * without violating Microsoft's app-store requirements. - */ - - const WCHAR *srcPath = NULL; - WCHAR path[MAX_PATH]; - char *result = NULL; - WCHAR *worg = NULL; - WCHAR *wapp = NULL; - size_t new_wpath_len = 0; - BOOL api_result = FALSE; - - if (!app) { - SDL_InvalidParamError("app"); - return NULL; - } - if (!org) { - org = ""; - } - - srcPath = SDL_GetWinRTFSPathUNICODE(SDL_WINRT_PATH_LOCAL_FOLDER); - if (!srcPath) { - SDL_SetError("Unable to find a source path"); - return NULL; - } - - if (SDL_wcslen(srcPath) >= MAX_PATH) { - SDL_SetError("Path too long."); - return NULL; - } - SDL_wcslcpy(path, srcPath, SDL_arraysize(path)); - - worg = WIN_UTF8ToStringW(org); - if (!worg) { - return NULL; - } - - wapp = WIN_UTF8ToStringW(app); - if (!wapp) { - SDL_free(worg); - return NULL; - } - - new_wpath_len = SDL_wcslen(worg) + SDL_wcslen(wapp) + SDL_wcslen(path) + 3; - - if ((new_wpath_len + 1) > MAX_PATH) { - SDL_free(worg); - SDL_free(wapp); - SDL_SetError("Path too long."); - return NULL; - } - - if (*worg) { - SDL_wcslcat(path, L"\\", new_wpath_len + 1); - SDL_wcslcat(path, worg, new_wpath_len + 1); - SDL_free(worg); - } - - api_result = CreateDirectoryW(path, NULL); - if (api_result == FALSE) { - if (GetLastError() != ERROR_ALREADY_EXISTS) { - SDL_free(wapp); - WIN_SetError("Couldn't create a prefpath."); - return NULL; - } - } - - SDL_wcslcat(path, L"\\", new_wpath_len + 1); - SDL_wcslcat(path, wapp, new_wpath_len + 1); - SDL_free(wapp); - - api_result = CreateDirectoryW(path, NULL); - if (api_result == FALSE) { - if (GetLastError() != ERROR_ALREADY_EXISTS) { - WIN_SetError("Couldn't create a prefpath."); - return NULL; - } - } - - SDL_wcslcat(path, L"\\", new_wpath_len + 1); - - result = WIN_StringToUTF8W(path); - - return result; -} - -char *SDL_SYS_GetUserFolder(SDL_Folder folder) -{ - wstring wpath; - - switch (folder) { - #define CASEPATH(sym, var) case sym: wpath = Windows::Storage::UserDataPaths::GetDefault()->var->Data(); break - CASEPATH(SDL_FOLDER_HOME, Profile); - CASEPATH(SDL_FOLDER_DESKTOP, Desktop); - CASEPATH(SDL_FOLDER_DOCUMENTS, Documents); - CASEPATH(SDL_FOLDER_DOWNLOADS, Downloads); - CASEPATH(SDL_FOLDER_MUSIC, Music); - CASEPATH(SDL_FOLDER_PICTURES, Pictures); - CASEPATH(SDL_FOLDER_SCREENSHOTS, Screenshots); - CASEPATH(SDL_FOLDER_TEMPLATES, Templates); - CASEPATH(SDL_FOLDER_VIDEOS, Videos); - #undef CASEPATH - #define UNSUPPPORTED_CASEPATH(sym) SDL_SetError("The %s folder is unsupported on WinRT", #sym); return NULL; - UNSUPPPORTED_CASEPATH(SDL_FOLDER_PUBLICSHARE); - UNSUPPPORTED_CASEPATH(SDL_FOLDER_SAVEDGAMES); - #undef UNSUPPPORTED_CASEPATH - default: - SDL_SetError("Invalid SDL_Folder: %d", (int)folder); - return NULL; - }; - - wpath += L"\\"; - - return WIN_StringToUTF8W(wpath.c_str()); -} - -#endif // SDL_PLATFORM_WINRT diff --git a/src/gpu/SDL_gpu.c b/src/gpu/SDL_gpu.c index 2193cf9b..935137fe 100644 --- a/src/gpu/SDL_gpu.c +++ b/src/gpu/SDL_gpu.c @@ -1,4 +1,4 @@ -/* +/* Simple DirectMedia Layer Copyright (C) 1997-2024 Sam Lantinga @@ -29,97 +29,128 @@ } #define CHECK_COMMAND_BUFFER \ - if (((CommandBufferCommonHeader *)commandBuffer)->submitted) { \ + if (((CommandBufferCommonHeader *)command_buffer)->submitted) { \ SDL_assert_release(!"Command buffer already submitted!"); \ return; \ } #define CHECK_COMMAND_BUFFER_RETURN_NULL \ - if (((CommandBufferCommonHeader *)commandBuffer)->submitted) { \ + if (((CommandBufferCommonHeader *)command_buffer)->submitted) { \ SDL_assert_release(!"Command buffer already submitted!"); \ return NULL; \ } #define CHECK_ANY_PASS_IN_PROGRESS(msg, retval) \ if ( \ - ((CommandBufferCommonHeader *)commandBuffer)->renderPass.inProgress || \ - ((CommandBufferCommonHeader *)commandBuffer)->computePass.inProgress || \ - ((CommandBufferCommonHeader *)commandBuffer)->copyPass.inProgress) { \ + ((CommandBufferCommonHeader *)command_buffer)->render_pass.in_progress || \ + ((CommandBufferCommonHeader *)command_buffer)->compute_pass.in_progress || \ + ((CommandBufferCommonHeader *)command_buffer)->copy_pass.in_progress) { \ SDL_assert_release(!msg); \ return retval; \ } #define CHECK_RENDERPASS \ - if (!((Pass *)renderPass)->inProgress) { \ + if (!((Pass *)render_pass)->in_progress) { \ SDL_assert_release(!"Render pass not in progress!"); \ return; \ } #define CHECK_GRAPHICS_PIPELINE_BOUND \ - if (!((CommandBufferCommonHeader *)RENDERPASS_COMMAND_BUFFER)->graphicsPipelineBound) { \ + if (!((CommandBufferCommonHeader *)RENDERPASS_COMMAND_BUFFER)->graphics_pipeline_bound) { \ SDL_assert_release(!"Graphics pipeline not bound!"); \ return; \ } #define CHECK_COMPUTEPASS \ - if (!((Pass *)computePass)->inProgress) { \ + if (!((Pass *)compute_pass)->in_progress) { \ SDL_assert_release(!"Compute pass not in progress!"); \ return; \ } #define CHECK_COMPUTE_PIPELINE_BOUND \ - if (!((CommandBufferCommonHeader *)COMPUTEPASS_COMMAND_BUFFER)->computePipelineBound) { \ + if (!((CommandBufferCommonHeader *)COMPUTEPASS_COMMAND_BUFFER)->compute_pipeline_bound) { \ SDL_assert_release(!"Compute pipeline not bound!"); \ return; \ } #define CHECK_COPYPASS \ - if (!((Pass *)copyPass)->inProgress) { \ + if (!((Pass *)copy_pass)->in_progress) { \ SDL_assert_release(!"Copy pass not in progress!"); \ return; \ } -#define CHECK_TEXTUREFORMAT_ENUM_INVALID(format, retval) \ - if (format >= SDL_GPU_TEXTUREFORMAT_MAX) { \ +#define CHECK_TEXTUREFORMAT_ENUM_INVALID(enumval, retval) \ + if (enumval <= SDL_GPU_TEXTUREFORMAT_INVALID || enumval >= SDL_GPU_TEXTUREFORMAT_MAX_ENUM_VALUE) { \ SDL_assert_release(!"Invalid texture format enum!"); \ return retval; \ } +#define CHECK_VERTEXELEMENTFORMAT_ENUM_INVALID(enumval, retval) \ + if (enumval <= SDL_GPU_VERTEXELEMENTFORMAT_INVALID || enumval >= SDL_GPU_VERTEXELEMENTFORMAT_MAX_ENUM_VALUE) { \ + SDL_assert_release(!"Invalid vertex format enum!"); \ + return retval; \ + } + +#define CHECK_COMPAREOP_ENUM_INVALID(enumval, retval) \ + if (enumval <= SDL_GPU_COMPAREOP_INVALID || enumval >= SDL_GPU_COMPAREOP_MAX_ENUM_VALUE) { \ + SDL_assert_release(!"Invalid compare op enum!"); \ + return retval; \ + } + +#define CHECK_STENCILOP_ENUM_INVALID(enumval, retval) \ + if (enumval <= SDL_GPU_STENCILOP_INVALID || enumval >= SDL_GPU_STENCILOP_MAX_ENUM_VALUE) { \ + SDL_assert_release(!"Invalid stencil op enum!"); \ + return retval; \ + } + +#define CHECK_BLENDOP_ENUM_INVALID(enumval, retval) \ + if (enumval <= SDL_GPU_BLENDOP_INVALID || enumval >= SDL_GPU_BLENDOP_MAX_ENUM_VALUE) { \ + SDL_assert_release(!"Invalid blend op enum!"); \ + return retval; \ + } + +#define CHECK_BLENDFACTOR_ENUM_INVALID(enumval, retval) \ + if (enumval <= SDL_GPU_BLENDFACTOR_INVALID || enumval >= SDL_GPU_BLENDFACTOR_MAX_ENUM_VALUE) { \ + SDL_assert_release(!"Invalid blend factor enum!"); \ + return retval; \ + } + #define CHECK_SWAPCHAINCOMPOSITION_ENUM_INVALID(enumval, retval) \ - if (enumval >= SDL_GPU_SWAPCHAINCOMPOSITION_MAX) { \ + if (enumval < 0 || enumval >= SDL_GPU_SWAPCHAINCOMPOSITION_MAX_ENUM_VALUE) { \ SDL_assert_release(!"Invalid swapchain composition enum!"); \ return retval; \ } #define CHECK_PRESENTMODE_ENUM_INVALID(enumval, retval) \ - if (enumval >= SDL_GPU_PRESENTMODE_MAX) { \ + if (enumval < 0 || enumval >= SDL_GPU_PRESENTMODE_MAX_ENUM_VALUE) { \ SDL_assert_release(!"Invalid present mode enum!"); \ return retval; \ } #define COMMAND_BUFFER_DEVICE \ - ((CommandBufferCommonHeader *)commandBuffer)->device + ((CommandBufferCommonHeader *)command_buffer)->device #define RENDERPASS_COMMAND_BUFFER \ - ((Pass *)renderPass)->commandBuffer + ((Pass *)render_pass)->command_buffer #define RENDERPASS_DEVICE \ ((CommandBufferCommonHeader *)RENDERPASS_COMMAND_BUFFER)->device #define COMPUTEPASS_COMMAND_BUFFER \ - ((Pass *)computePass)->commandBuffer + ((Pass *)compute_pass)->command_buffer #define COMPUTEPASS_DEVICE \ ((CommandBufferCommonHeader *)COMPUTEPASS_COMMAND_BUFFER)->device #define COPYPASS_COMMAND_BUFFER \ - ((Pass *)copyPass)->commandBuffer + ((Pass *)copy_pass)->command_buffer #define COPYPASS_DEVICE \ ((CommandBufferCommonHeader *)COPYPASS_COMMAND_BUFFER)->device // Drivers +#ifndef SDL_GPU_DISABLED static const SDL_GPUBootstrap *backends[] = { #ifdef SDL_GPU_METAL &MetalDriver, @@ -135,73 +166,72 @@ static const SDL_GPUBootstrap *backends[] = { #endif NULL }; +#endif // !SDL_GPU_DISABLED // Internal Utility Functions SDL_GPUGraphicsPipeline *SDL_GPU_FetchBlitPipeline( SDL_GPUDevice *device, - SDL_GPUTextureType sourceTextureType, - SDL_GPUTextureFormat destinationFormat, - SDL_GPUShader *blitVertexShader, - SDL_GPUShader *blitFrom2DShader, - SDL_GPUShader *blitFrom2DArrayShader, - SDL_GPUShader *blitFrom3DShader, - SDL_GPUShader *blitFromCubeShader, - BlitPipelineCacheEntry **blitPipelines, - Uint32 *blitPipelineCount, - Uint32 *blitPipelineCapacity) + SDL_GPUTextureType source_texture_type, + SDL_GPUTextureFormat destination_format, + SDL_GPUShader *blit_vertex_shader, + SDL_GPUShader *blit_from_2d_shader, + SDL_GPUShader *blit_from_2d_array_shader, + SDL_GPUShader *blit_from_3d_shader, + SDL_GPUShader *blit_from_cube_shader, + SDL_GPUShader *blit_from_cube_array_shader, + BlitPipelineCacheEntry **blit_pipelines, + Uint32 *blit_pipeline_count, + Uint32 *blit_pipeline_capacity) { - SDL_GPUGraphicsPipelineCreateInfo blitPipelineCreateInfo; - SDL_GPUColorAttachmentDescription colorAttachmentDesc; + SDL_GPUGraphicsPipelineCreateInfo blit_pipeline_create_info; + SDL_GPUColorTargetDescription color_target_desc; SDL_GPUGraphicsPipeline *pipeline; - if (blitPipelineCount == NULL) { + if (blit_pipeline_count == NULL) { // use pre-created, format-agnostic pipelines - return (*blitPipelines)[sourceTextureType].pipeline; + return (*blit_pipelines)[source_texture_type].pipeline; } - for (Uint32 i = 0; i < *blitPipelineCount; i += 1) { - if ((*blitPipelines)[i].type == sourceTextureType && (*blitPipelines)[i].format == destinationFormat) { - return (*blitPipelines)[i].pipeline; + for (Uint32 i = 0; i < *blit_pipeline_count; i += 1) { + if ((*blit_pipelines)[i].type == source_texture_type && (*blit_pipelines)[i].format == destination_format) { + return (*blit_pipelines)[i].pipeline; } } // No pipeline found, we'll need to make one! - SDL_zero(blitPipelineCreateInfo); + SDL_zero(blit_pipeline_create_info); - SDL_zero(colorAttachmentDesc); - colorAttachmentDesc.blendState.colorWriteMask = 0xF; - colorAttachmentDesc.format = destinationFormat; + SDL_zero(color_target_desc); + color_target_desc.blend_state.color_write_mask = 0xF; + color_target_desc.format = destination_format; - blitPipelineCreateInfo.attachmentInfo.colorAttachmentDescriptions = &colorAttachmentDesc; - blitPipelineCreateInfo.attachmentInfo.colorAttachmentCount = 1; - blitPipelineCreateInfo.attachmentInfo.depthStencilFormat = SDL_GPU_TEXTUREFORMAT_D16_UNORM; // arbitrary - blitPipelineCreateInfo.attachmentInfo.hasDepthStencilAttachment = false; + blit_pipeline_create_info.target_info.color_target_descriptions = &color_target_desc; + blit_pipeline_create_info.target_info.num_color_targets = 1; + blit_pipeline_create_info.target_info.depth_stencil_format = SDL_GPU_TEXTUREFORMAT_D16_UNORM; // arbitrary + blit_pipeline_create_info.target_info.has_depth_stencil_target = false; - blitPipelineCreateInfo.vertexShader = blitVertexShader; - if (sourceTextureType == SDL_GPU_TEXTURETYPE_CUBE) { - blitPipelineCreateInfo.fragmentShader = blitFromCubeShader; - } else if (sourceTextureType == SDL_GPU_TEXTURETYPE_2D_ARRAY) { - blitPipelineCreateInfo.fragmentShader = blitFrom2DArrayShader; - } else if (sourceTextureType == SDL_GPU_TEXTURETYPE_3D) { - blitPipelineCreateInfo.fragmentShader = blitFrom3DShader; + blit_pipeline_create_info.vertex_shader = blit_vertex_shader; + if (source_texture_type == SDL_GPU_TEXTURETYPE_CUBE) { + blit_pipeline_create_info.fragment_shader = blit_from_cube_shader; + } else if (source_texture_type == SDL_GPU_TEXTURETYPE_CUBE_ARRAY) { + blit_pipeline_create_info.fragment_shader = blit_from_cube_array_shader; + } else if (source_texture_type == SDL_GPU_TEXTURETYPE_2D_ARRAY) { + blit_pipeline_create_info.fragment_shader = blit_from_2d_array_shader; + } else if (source_texture_type == SDL_GPU_TEXTURETYPE_3D) { + blit_pipeline_create_info.fragment_shader = blit_from_3d_shader; } else { - blitPipelineCreateInfo.fragmentShader = blitFrom2DShader; + blit_pipeline_create_info.fragment_shader = blit_from_2d_shader; } - blitPipelineCreateInfo.multisampleState.sampleCount = SDL_GPU_SAMPLECOUNT_1; - blitPipelineCreateInfo.multisampleState.sampleMask = 0xFFFFFFFF; + blit_pipeline_create_info.multisample_state.sample_count = SDL_GPU_SAMPLECOUNT_1; + blit_pipeline_create_info.multisample_state.enable_mask = false; - blitPipelineCreateInfo.primitiveType = SDL_GPU_PRIMITIVETYPE_TRIANGLELIST; - - blitPipelineCreateInfo.blendConstants[0] = 1.0f; - blitPipelineCreateInfo.blendConstants[1] = 1.0f; - blitPipelineCreateInfo.blendConstants[2] = 1.0f; - blitPipelineCreateInfo.blendConstants[3] = 1.0f; + blit_pipeline_create_info.primitive_type = SDL_GPU_PRIMITIVETYPE_TRIANGLELIST; pipeline = SDL_CreateGPUGraphicsPipeline( device, - &blitPipelineCreateInfo); + &blit_pipeline_create_info); if (pipeline == NULL) { SDL_LogError(SDL_LOG_CATEGORY_GPU, "Failed to create graphics pipeline for blit"); @@ -210,229 +240,142 @@ SDL_GPUGraphicsPipeline *SDL_GPU_FetchBlitPipeline( // Cache the new pipeline EXPAND_ARRAY_IF_NEEDED( - (*blitPipelines), + (*blit_pipelines), BlitPipelineCacheEntry, - *blitPipelineCount + 1, - *blitPipelineCapacity, - *blitPipelineCapacity * 2) + *blit_pipeline_count + 1, + *blit_pipeline_capacity, + *blit_pipeline_capacity * 2) - (*blitPipelines)[*blitPipelineCount].pipeline = pipeline; - (*blitPipelines)[*blitPipelineCount].type = sourceTextureType; - (*blitPipelines)[*blitPipelineCount].format = destinationFormat; - *blitPipelineCount += 1; + (*blit_pipelines)[*blit_pipeline_count].pipeline = pipeline; + (*blit_pipelines)[*blit_pipeline_count].type = source_texture_type; + (*blit_pipelines)[*blit_pipeline_count].format = destination_format; + *blit_pipeline_count += 1; return pipeline; } void SDL_GPU_BlitCommon( - SDL_GPUCommandBuffer *commandBuffer, - SDL_GPUBlitRegion *source, - SDL_GPUBlitRegion *destination, - SDL_FlipMode flipMode, - SDL_GPUFilter filterMode, - bool cycle, - SDL_GPUSampler *blitLinearSampler, - SDL_GPUSampler *blitNearestSampler, - SDL_GPUShader *blitVertexShader, - SDL_GPUShader *blitFrom2DShader, - SDL_GPUShader *blitFrom2DArrayShader, - SDL_GPUShader *blitFrom3DShader, - SDL_GPUShader *blitFromCubeShader, - BlitPipelineCacheEntry **blitPipelines, - Uint32 *blitPipelineCount, - Uint32 *blitPipelineCapacity) + SDL_GPUCommandBuffer *command_buffer, + const SDL_GPUBlitInfo *info, + SDL_GPUSampler *blit_linear_sampler, + SDL_GPUSampler *blit_nearest_sampler, + SDL_GPUShader *blit_vertex_shader, + SDL_GPUShader *blit_from_2d_shader, + SDL_GPUShader *blit_from_2d_array_shader, + SDL_GPUShader *blit_from_3d_shader, + SDL_GPUShader *blit_from_cube_shader, + SDL_GPUShader *blit_from_cube_array_shader, + BlitPipelineCacheEntry **blit_pipelines, + Uint32 *blit_pipeline_count, + Uint32 *blit_pipeline_capacity) { - CommandBufferCommonHeader *cmdbufHeader = (CommandBufferCommonHeader *)commandBuffer; - SDL_GPURenderPass *renderPass; - TextureCommonHeader *srcHeader = (TextureCommonHeader *)source->texture; - TextureCommonHeader *dstHeader = (TextureCommonHeader *)destination->texture; - SDL_GPUGraphicsPipeline *blitPipeline; - SDL_GPUColorAttachmentInfo colorAttachmentInfo; + CommandBufferCommonHeader *cmdbufHeader = (CommandBufferCommonHeader *)command_buffer; + SDL_GPURenderPass *render_pass; + TextureCommonHeader *src_header = (TextureCommonHeader *)info->source.texture; + TextureCommonHeader *dst_header = (TextureCommonHeader *)info->destination.texture; + SDL_GPUGraphicsPipeline *blit_pipeline; + SDL_GPUColorTargetInfo color_target_info; SDL_GPUViewport viewport; - SDL_GPUTextureSamplerBinding textureSamplerBinding; - BlitFragmentUniforms blitFragmentUniforms; - Uint32 layerDivisor; + SDL_GPUTextureSamplerBinding texture_sampler_binding; + BlitFragmentUniforms blit_fragment_uniforms; + Uint32 layer_divisor; - blitPipeline = SDL_GPU_FetchBlitPipeline( + blit_pipeline = SDL_GPU_FetchBlitPipeline( cmdbufHeader->device, - srcHeader->info.type, - dstHeader->info.format, - blitVertexShader, - blitFrom2DShader, - blitFrom2DArrayShader, - blitFrom3DShader, - blitFromCubeShader, - blitPipelines, - blitPipelineCount, - blitPipelineCapacity); + src_header->info.type, + dst_header->info.format, + blit_vertex_shader, + blit_from_2d_shader, + blit_from_2d_array_shader, + blit_from_3d_shader, + blit_from_cube_shader, + blit_from_cube_array_shader, + blit_pipelines, + blit_pipeline_count, + blit_pipeline_capacity); - if (blitPipeline == NULL) { + if (blit_pipeline == NULL) { SDL_LogWarn(SDL_LOG_CATEGORY_GPU, "Could not fetch blit pipeline"); return; } - // If the entire destination is blitted, we don't have to load - if ( - dstHeader->info.layerCountOrDepth == 1 && - dstHeader->info.levelCount == 1 && - dstHeader->info.type != SDL_GPU_TEXTURETYPE_3D && - destination->w == dstHeader->info.width && - destination->h == dstHeader->info.height) { - colorAttachmentInfo.loadOp = SDL_GPU_LOADOP_DONT_CARE; - } else { - colorAttachmentInfo.loadOp = SDL_GPU_LOADOP_LOAD; - } + color_target_info.load_op = info->load_op; + color_target_info.clear_color = info->clear_color; + color_target_info.store_op = SDL_GPU_STOREOP_STORE; - colorAttachmentInfo.storeOp = SDL_GPU_STOREOP_STORE; + color_target_info.texture = info->destination.texture; + color_target_info.mip_level = info->destination.mip_level; + color_target_info.layer_or_depth_plane = info->destination.layer_or_depth_plane; + color_target_info.cycle = info->cycle; - colorAttachmentInfo.texture = destination->texture; - colorAttachmentInfo.mipLevel = destination->mipLevel; - colorAttachmentInfo.layerOrDepthPlane = destination->layerOrDepthPlane; - colorAttachmentInfo.cycle = cycle; - - renderPass = SDL_BeginGPURenderPass( - commandBuffer, - &colorAttachmentInfo, + render_pass = SDL_BeginGPURenderPass( + command_buffer, + &color_target_info, 1, NULL); - viewport.x = (float)destination->x; - viewport.y = (float)destination->y; - viewport.w = (float)destination->w; - viewport.h = (float)destination->h; - viewport.minDepth = 0; - viewport.maxDepth = 1; + viewport.x = (float)info->destination.x; + viewport.y = (float)info->destination.y; + viewport.w = (float)info->destination.w; + viewport.h = (float)info->destination.h; + viewport.min_depth = 0; + viewport.max_depth = 1; SDL_SetGPUViewport( - renderPass, + render_pass, &viewport); SDL_BindGPUGraphicsPipeline( - renderPass, - blitPipeline); + render_pass, + blit_pipeline); - textureSamplerBinding.texture = source->texture; - textureSamplerBinding.sampler = - filterMode == SDL_GPU_FILTER_NEAREST ? blitNearestSampler : blitLinearSampler; + texture_sampler_binding.texture = info->source.texture; + texture_sampler_binding.sampler = + info->filter == SDL_GPU_FILTER_NEAREST ? blit_nearest_sampler : blit_linear_sampler; SDL_BindGPUFragmentSamplers( - renderPass, + render_pass, 0, - &textureSamplerBinding, + &texture_sampler_binding, 1); - blitFragmentUniforms.left = (float)source->x / (srcHeader->info.width >> source->mipLevel); - blitFragmentUniforms.top = (float)source->y / (srcHeader->info.height >> source->mipLevel); - blitFragmentUniforms.width = (float)source->w / (srcHeader->info.width >> source->mipLevel); - blitFragmentUniforms.height = (float)source->h / (srcHeader->info.height >> source->mipLevel); - blitFragmentUniforms.mipLevel = source->mipLevel; + blit_fragment_uniforms.left = (float)info->source.x / (src_header->info.width >> info->source.mip_level); + blit_fragment_uniforms.top = (float)info->source.y / (src_header->info.height >> info->source.mip_level); + blit_fragment_uniforms.width = (float)info->source.w / (src_header->info.width >> info->source.mip_level); + blit_fragment_uniforms.height = (float)info->source.h / (src_header->info.height >> info->source.mip_level); + blit_fragment_uniforms.mip_level = info->source.mip_level; - layerDivisor = (srcHeader->info.type == SDL_GPU_TEXTURETYPE_3D) ? srcHeader->info.layerCountOrDepth : 1; - blitFragmentUniforms.layerOrDepth = (float)source->layerOrDepthPlane / layerDivisor; + layer_divisor = (src_header->info.type == SDL_GPU_TEXTURETYPE_3D) ? src_header->info.layer_count_or_depth : 1; + blit_fragment_uniforms.layer_or_depth = (float)info->source.layer_or_depth_plane / layer_divisor; - if (flipMode & SDL_FLIP_HORIZONTAL) { - blitFragmentUniforms.left += blitFragmentUniforms.width; - blitFragmentUniforms.width *= -1; + if (info->flip_mode & SDL_FLIP_HORIZONTAL) { + blit_fragment_uniforms.left += blit_fragment_uniforms.width; + blit_fragment_uniforms.width *= -1; } - if (flipMode & SDL_FLIP_VERTICAL) { - blitFragmentUniforms.top += blitFragmentUniforms.height; - blitFragmentUniforms.height *= -1; + if (info->flip_mode & SDL_FLIP_VERTICAL) { + blit_fragment_uniforms.top += blit_fragment_uniforms.height; + blit_fragment_uniforms.height *= -1; } SDL_PushGPUFragmentUniformData( - commandBuffer, + command_buffer, 0, - &blitFragmentUniforms, - sizeof(blitFragmentUniforms)); + &blit_fragment_uniforms, + sizeof(blit_fragment_uniforms)); - SDL_DrawGPUPrimitives(renderPass, 3, 1, 0, 0); - SDL_EndGPURenderPass(renderPass); + SDL_DrawGPUPrimitives(render_pass, 3, 1, 0, 0); + SDL_EndGPURenderPass(render_pass); } // Driver Functions -static SDL_GPUDriver SDL_GPUSelectBackend( - SDL_VideoDevice *_this, - const char *gpudriver, - SDL_GPUShaderFormat formatFlags) +#ifndef SDL_GPU_DISABLED +static const SDL_GPUBootstrap * SDL_GPUSelectBackend(SDL_PropertiesID props) { Uint32 i; - - // Environment/Properties override... - if (gpudriver != NULL) { - for (i = 0; backends[i]; i += 1) { - if (SDL_strcasecmp(gpudriver, backends[i]->Name) == 0) { - if (!(backends[i]->shaderFormats & formatFlags)) { - SDL_LogError(SDL_LOG_CATEGORY_GPU, "Required shader format for backend %s not provided!", gpudriver); - return SDL_GPU_DRIVER_INVALID; - } - if (backends[i]->PrepareDriver(_this)) { - return backends[i]->backendflag; - } - } - } - - SDL_LogError(SDL_LOG_CATEGORY_GPU, "SDL_HINT_GPU_DRIVER %s unsupported!", gpudriver); - return SDL_GPU_DRIVER_INVALID; - } - - for (i = 0; backends[i]; i += 1) { - if ((backends[i]->shaderFormats & formatFlags) == 0) { - // Don't select a backend which doesn't support the app's shaders. - continue; - } - if (backends[i]->PrepareDriver(_this)) { - return backends[i]->backendflag; - } - } - - SDL_LogError(SDL_LOG_CATEGORY_GPU, "No supported SDL_GPU backend found!"); - return SDL_GPU_DRIVER_INVALID; -} - -SDL_GPUDevice *SDL_CreateGPUDevice( - SDL_GPUShaderFormat formatFlags, - SDL_bool debugMode, - const char *name) -{ - SDL_GPUDevice *result; - SDL_PropertiesID props = SDL_CreateProperties(); - if (formatFlags & SDL_GPU_SHADERFORMAT_PRIVATE) { - SDL_SetBooleanProperty(props, SDL_PROP_GPU_DEVICE_CREATE_SHADERS_PRIVATE_BOOL, true); - } - if (formatFlags & SDL_GPU_SHADERFORMAT_SPIRV) { - SDL_SetBooleanProperty(props, SDL_PROP_GPU_DEVICE_CREATE_SHADERS_SPIRV_BOOL, true); - } - if (formatFlags & SDL_GPU_SHADERFORMAT_DXBC) { - SDL_SetBooleanProperty(props, SDL_PROP_GPU_DEVICE_CREATE_SHADERS_DXBC_BOOL, true); - } - if (formatFlags & SDL_GPU_SHADERFORMAT_DXIL) { - SDL_SetBooleanProperty(props, SDL_PROP_GPU_DEVICE_CREATE_SHADERS_DXIL_BOOL, true); - } - if (formatFlags & SDL_GPU_SHADERFORMAT_MSL) { - SDL_SetBooleanProperty(props, SDL_PROP_GPU_DEVICE_CREATE_SHADERS_MSL_BOOL, true); - } - if (formatFlags & SDL_GPU_SHADERFORMAT_METALLIB) { - SDL_SetBooleanProperty(props, SDL_PROP_GPU_DEVICE_CREATE_SHADERS_METALLIB_BOOL, true); - } - SDL_SetBooleanProperty(props, SDL_PROP_GPU_DEVICE_CREATE_DEBUGMODE_BOOL, debugMode); - SDL_SetStringProperty(props, SDL_PROP_GPU_DEVICE_CREATE_NAME_STRING, name); - result = SDL_CreateGPUDeviceWithProperties(props); - SDL_DestroyProperties(props); - return result; -} - -SDL_GPUDevice *SDL_CreateGPUDeviceWithProperties(SDL_PropertiesID props) -{ - SDL_GPUShaderFormat formatFlags = 0; - bool debugMode; - bool preferLowPower; - - int i; + SDL_GPUShaderFormat format_flags = 0; const char *gpudriver; - SDL_GPUDevice *result = NULL; - SDL_GPUDriver selectedBackend; SDL_VideoDevice *_this = SDL_GetVideoDevice(); if (_this == NULL) { @@ -441,47 +384,160 @@ SDL_GPUDevice *SDL_CreateGPUDeviceWithProperties(SDL_PropertiesID props) } if (SDL_GetBooleanProperty(props, SDL_PROP_GPU_DEVICE_CREATE_SHADERS_PRIVATE_BOOL, false)) { - formatFlags |= SDL_GPU_SHADERFORMAT_PRIVATE; + format_flags |= SDL_GPU_SHADERFORMAT_PRIVATE; } if (SDL_GetBooleanProperty(props, SDL_PROP_GPU_DEVICE_CREATE_SHADERS_SPIRV_BOOL, false)) { - formatFlags |= SDL_GPU_SHADERFORMAT_SPIRV; + format_flags |= SDL_GPU_SHADERFORMAT_SPIRV; } if (SDL_GetBooleanProperty(props, SDL_PROP_GPU_DEVICE_CREATE_SHADERS_DXBC_BOOL, false)) { - formatFlags |= SDL_GPU_SHADERFORMAT_DXBC; + format_flags |= SDL_GPU_SHADERFORMAT_DXBC; } if (SDL_GetBooleanProperty(props, SDL_PROP_GPU_DEVICE_CREATE_SHADERS_DXIL_BOOL, false)) { - formatFlags |= SDL_GPU_SHADERFORMAT_DXIL; + format_flags |= SDL_GPU_SHADERFORMAT_DXIL; } if (SDL_GetBooleanProperty(props, SDL_PROP_GPU_DEVICE_CREATE_SHADERS_MSL_BOOL, false)) { - formatFlags |= SDL_GPU_SHADERFORMAT_MSL; + format_flags |= SDL_GPU_SHADERFORMAT_MSL; } if (SDL_GetBooleanProperty(props, SDL_PROP_GPU_DEVICE_CREATE_SHADERS_METALLIB_BOOL, false)) { - formatFlags |= SDL_GPU_SHADERFORMAT_METALLIB; + format_flags |= SDL_GPU_SHADERFORMAT_METALLIB; } - debugMode = SDL_GetBooleanProperty(props, SDL_PROP_GPU_DEVICE_CREATE_DEBUGMODE_BOOL, true); - preferLowPower = SDL_GetBooleanProperty(props, SDL_PROP_GPU_DEVICE_CREATE_PREFERLOWPOWER_BOOL, false); - gpudriver = SDL_GetHint(SDL_HINT_GPU_DRIVER); if (gpudriver == NULL) { gpudriver = SDL_GetStringProperty(props, SDL_PROP_GPU_DEVICE_CREATE_NAME_STRING, NULL); } - selectedBackend = SDL_GPUSelectBackend(_this, gpudriver, formatFlags); - if (selectedBackend != SDL_GPU_DRIVER_INVALID) { + // Environment/Properties override... + if (gpudriver != NULL) { for (i = 0; backends[i]; i += 1) { - if (backends[i]->backendflag == selectedBackend) { - result = backends[i]->CreateDevice(debugMode, preferLowPower, props); - if (result != NULL) { - result->backend = backends[i]->backendflag; - result->shaderFormats = backends[i]->shaderFormats; - result->debugMode = debugMode; - break; + if (SDL_strcasecmp(gpudriver, backends[i]->name) == 0) { + if (!(backends[i]->shader_formats & format_flags)) { + SDL_LogError(SDL_LOG_CATEGORY_GPU, "Required shader format for backend %s not provided!", gpudriver); + return NULL; + } + if (backends[i]->PrepareDriver(_this)) { + return backends[i]; } } } + + SDL_LogError(SDL_LOG_CATEGORY_GPU, "SDL_HINT_GPU_DRIVER %s unsupported!", gpudriver); + return NULL; + } + + for (i = 0; backends[i]; i += 1) { + if ((backends[i]->shader_formats & format_flags) == 0) { + // Don't select a backend which doesn't support the app's shaders. + continue; + } + if (backends[i]->PrepareDriver(_this)) { + return backends[i]; + } + } + + SDL_LogError(SDL_LOG_CATEGORY_GPU, "No supported SDL_GPU backend found!"); + return NULL; +} + +static void SDL_GPU_FillProperties( + SDL_PropertiesID props, + SDL_GPUShaderFormat format_flags, + bool debug_mode, + const char *name) +{ + if (format_flags & SDL_GPU_SHADERFORMAT_PRIVATE) { + SDL_SetBooleanProperty(props, SDL_PROP_GPU_DEVICE_CREATE_SHADERS_PRIVATE_BOOL, true); + } + if (format_flags & SDL_GPU_SHADERFORMAT_SPIRV) { + SDL_SetBooleanProperty(props, SDL_PROP_GPU_DEVICE_CREATE_SHADERS_SPIRV_BOOL, true); + } + if (format_flags & SDL_GPU_SHADERFORMAT_DXBC) { + SDL_SetBooleanProperty(props, SDL_PROP_GPU_DEVICE_CREATE_SHADERS_DXBC_BOOL, true); + } + if (format_flags & SDL_GPU_SHADERFORMAT_DXIL) { + SDL_SetBooleanProperty(props, SDL_PROP_GPU_DEVICE_CREATE_SHADERS_DXIL_BOOL, true); + } + if (format_flags & SDL_GPU_SHADERFORMAT_MSL) { + SDL_SetBooleanProperty(props, SDL_PROP_GPU_DEVICE_CREATE_SHADERS_MSL_BOOL, true); + } + if (format_flags & SDL_GPU_SHADERFORMAT_METALLIB) { + SDL_SetBooleanProperty(props, SDL_PROP_GPU_DEVICE_CREATE_SHADERS_METALLIB_BOOL, true); + } + SDL_SetBooleanProperty(props, SDL_PROP_GPU_DEVICE_CREATE_DEBUGMODE_BOOL, debug_mode); + SDL_SetStringProperty(props, SDL_PROP_GPU_DEVICE_CREATE_NAME_STRING, name); +} +#endif // SDL_GPU_DISABLED + +bool SDL_GPUSupportsShaderFormats( + SDL_GPUShaderFormat format_flags, + const char *name) +{ +#ifndef SDL_GPU_DISABLED + bool result; + SDL_PropertiesID props = SDL_CreateProperties(); + SDL_GPU_FillProperties(props, format_flags, false, name); + result = SDL_GPUSupportsProperties(props); + SDL_DestroyProperties(props); + return result; +#else + SDL_SetError("SDL not built with GPU support"); + return false; +#endif +} + +bool SDL_GPUSupportsProperties(SDL_PropertiesID props) +{ +#ifndef SDL_GPU_DISABLED + return (SDL_GPUSelectBackend(props) != NULL); +#else + SDL_SetError("SDL not built with GPU support"); + return false; +#endif +} + +SDL_GPUDevice *SDL_CreateGPUDevice( + SDL_GPUShaderFormat format_flags, + bool debug_mode, + const char *name) +{ +#ifndef SDL_GPU_DISABLED + SDL_GPUDevice *result; + SDL_PropertiesID props = SDL_CreateProperties(); + SDL_GPU_FillProperties(props, format_flags, debug_mode, name); + result = SDL_CreateGPUDeviceWithProperties(props); + SDL_DestroyProperties(props); + return result; +#else + SDL_SetError("SDL not built with GPU support"); + return NULL; +#endif // SDL_GPU_DISABLED +} + +SDL_GPUDevice *SDL_CreateGPUDeviceWithProperties(SDL_PropertiesID props) +{ +#ifndef SDL_GPU_DISABLED + bool debug_mode; + bool preferLowPower; + SDL_GPUDevice *result = NULL; + const SDL_GPUBootstrap *selectedBackend; + + selectedBackend = SDL_GPUSelectBackend(props); + if (selectedBackend != NULL) { + debug_mode = SDL_GetBooleanProperty(props, SDL_PROP_GPU_DEVICE_CREATE_DEBUGMODE_BOOL, true); + preferLowPower = SDL_GetBooleanProperty(props, SDL_PROP_GPU_DEVICE_CREATE_PREFERLOWPOWER_BOOL, false); + + result = selectedBackend->CreateDevice(debug_mode, preferLowPower, props); + if (result != NULL) { + result->backend = selectedBackend->name; + result->shader_formats = selectedBackend->shader_formats; + result->debug_mode = debug_mode; + } } return result; +#else + SDL_SetError("SDL not built with GPU support"); + return NULL; +#endif // SDL_GPU_DISABLED } void SDL_DestroyGPUDevice(SDL_GPUDevice *device) @@ -491,17 +547,42 @@ void SDL_DestroyGPUDevice(SDL_GPUDevice *device) device->DestroyDevice(device); } -SDL_GPUDriver SDL_GetGPUDriver(SDL_GPUDevice *device) +int SDL_GetNumGPUDrivers(void) { - CHECK_DEVICE_MAGIC(device, SDL_GPU_DRIVER_INVALID); +#ifndef SDL_GPU_DISABLED + return SDL_arraysize(backends) - 1; +#else + return 0; +#endif +} + +const char * SDL_GetGPUDriver(int index) +{ + if (index < 0 || index >= SDL_GetNumGPUDrivers()) { + SDL_InvalidParamError("index"); + return NULL; + } + return backends[index]->name; +} + +const char * SDL_GetGPUDeviceDriver(SDL_GPUDevice *device) +{ + CHECK_DEVICE_MAGIC(device, NULL); return device->backend; } -Uint32 SDL_GPUTextureFormatTexelBlockSize( - SDL_GPUTextureFormat textureFormat) +SDL_GPUShaderFormat SDL_GetGPUShaderFormats(SDL_GPUDevice *device) { - switch (textureFormat) { + CHECK_DEVICE_MAGIC(device, SDL_GPU_SHADERFORMAT_INVALID); + + return device->shader_formats; +} + +Uint32 SDL_GPUTextureFormatTexelBlockSize( + SDL_GPUTextureFormat format) +{ + switch (format) { case SDL_GPU_TEXTUREFORMAT_BC1_RGBA_UNORM: case SDL_GPU_TEXTUREFORMAT_BC1_RGBA_UNORM_SRGB: case SDL_GPU_TEXTUREFORMAT_BC4_R_UNORM: @@ -560,7 +641,7 @@ Uint32 SDL_GPUTextureFormatTexelBlockSize( } } -SDL_bool SDL_GPUTextureSupportsFormat( +bool SDL_GPUTextureSupportsFormat( SDL_GPUDevice *device, SDL_GPUTextureFormat format, SDL_GPUTextureType type, @@ -568,7 +649,7 @@ SDL_bool SDL_GPUTextureSupportsFormat( { CHECK_DEVICE_MAGIC(device, false); - if (device->debugMode) { + if (device->debug_mode) { CHECK_TEXTUREFORMAT_ENUM_INVALID(format, false) } @@ -579,52 +660,55 @@ SDL_bool SDL_GPUTextureSupportsFormat( usage); } -SDL_bool SDL_GPUTextureSupportsSampleCount( +bool SDL_GPUTextureSupportsSampleCount( SDL_GPUDevice *device, SDL_GPUTextureFormat format, - SDL_GPUSampleCount sampleCount) + SDL_GPUSampleCount sample_count) { CHECK_DEVICE_MAGIC(device, 0); - if (device->debugMode) { + if (device->debug_mode) { CHECK_TEXTUREFORMAT_ENUM_INVALID(format, 0) } return device->SupportsSampleCount( device->driverData, format, - sampleCount); + sample_count); } // State Creation SDL_GPUComputePipeline *SDL_CreateGPUComputePipeline( SDL_GPUDevice *device, - SDL_GPUComputePipelineCreateInfo *computePipelineCreateInfo) + const SDL_GPUComputePipelineCreateInfo *createinfo) { CHECK_DEVICE_MAGIC(device, NULL); - if (computePipelineCreateInfo == NULL) { - SDL_InvalidParamError("computePipelineCreateInfo"); + if (createinfo == NULL) { + SDL_InvalidParamError("createinfo"); return NULL; } - if (device->debugMode) { - if (!(computePipelineCreateInfo->format & device->shaderFormats)) { + if (device->debug_mode) { + if (createinfo->format == SDL_GPU_SHADERFORMAT_INVALID) { + SDL_assert_release(!"Shader format cannot be INVALID!"); + return NULL; + } + if (!(createinfo->format & device->shader_formats)) { SDL_assert_release(!"Incompatible shader format for GPU backend"); return NULL; } - - if (computePipelineCreateInfo->writeOnlyStorageTextureCount > MAX_COMPUTE_WRITE_TEXTURES) { + if (createinfo->num_writeonly_storage_textures > MAX_COMPUTE_WRITE_TEXTURES) { SDL_assert_release(!"Compute pipeline write-only texture count cannot be higher than 8!"); return NULL; } - if (computePipelineCreateInfo->writeOnlyStorageBufferCount > MAX_COMPUTE_WRITE_BUFFERS) { + if (createinfo->num_writeonly_storage_buffers > MAX_COMPUTE_WRITE_BUFFERS) { SDL_assert_release(!"Compute pipeline write-only buffer count cannot be higher than 8!"); return NULL; } - if (computePipelineCreateInfo->threadCountX == 0 || - computePipelineCreateInfo->threadCountY == 0 || - computePipelineCreateInfo->threadCountZ == 0) { + if (createinfo->threadcount_x == 0 || + createinfo->threadcount_y == 0 || + createinfo->threadcount_z == 0) { SDL_assert_release(!"Compute pipeline threadCount dimensions must be at least 1!"); return NULL; } @@ -632,12 +716,12 @@ SDL_GPUComputePipeline *SDL_CreateGPUComputePipeline( return device->CreateComputePipeline( device->driverData, - computePipelineCreateInfo); + createinfo); } SDL_GPUGraphicsPipeline *SDL_CreateGPUGraphicsPipeline( SDL_GPUDevice *device, - SDL_GPUGraphicsPipelineCreateInfo *graphicsPipelineCreateInfo) + const SDL_GPUGraphicsPipelineCreateInfo *graphicsPipelineCreateInfo) { CHECK_DEVICE_MAGIC(device, NULL); if (graphicsPipelineCreateInfo == NULL) { @@ -645,21 +729,71 @@ SDL_GPUGraphicsPipeline *SDL_CreateGPUGraphicsPipeline( return NULL; } - if (device->debugMode) { - for (Uint32 i = 0; i < graphicsPipelineCreateInfo->attachmentInfo.colorAttachmentCount; i += 1) { - CHECK_TEXTUREFORMAT_ENUM_INVALID(graphicsPipelineCreateInfo->attachmentInfo.colorAttachmentDescriptions[i].format, NULL); - if (IsDepthFormat(graphicsPipelineCreateInfo->attachmentInfo.colorAttachmentDescriptions[i].format)) { - SDL_assert_release(!"Color attachment formats cannot be a depth format!"); + if (device->debug_mode) { + if (graphicsPipelineCreateInfo->target_info.num_color_targets > 0 && graphicsPipelineCreateInfo->target_info.color_target_descriptions == NULL) { + SDL_assert_release(!"Color target descriptions array pointer cannot be NULL if num_color_targets is greater than zero!"); + return NULL; + } + for (Uint32 i = 0; i < graphicsPipelineCreateInfo->target_info.num_color_targets; i += 1) { + CHECK_TEXTUREFORMAT_ENUM_INVALID(graphicsPipelineCreateInfo->target_info.color_target_descriptions[i].format, NULL); + if (IsDepthFormat(graphicsPipelineCreateInfo->target_info.color_target_descriptions[i].format)) { + SDL_assert_release(!"Color target formats cannot be a depth format!"); + return NULL; + } + if (graphicsPipelineCreateInfo->target_info.color_target_descriptions[i].blend_state.enable_blend) { + const SDL_GPUColorTargetBlendState *blend_state = &graphicsPipelineCreateInfo->target_info.color_target_descriptions[i].blend_state; + CHECK_BLENDFACTOR_ENUM_INVALID(blend_state->src_color_blendfactor, NULL) + CHECK_BLENDFACTOR_ENUM_INVALID(blend_state->dst_color_blendfactor, NULL) + CHECK_BLENDOP_ENUM_INVALID(blend_state->color_blend_op, NULL) + CHECK_BLENDFACTOR_ENUM_INVALID(blend_state->src_alpha_blendfactor, NULL) + CHECK_BLENDFACTOR_ENUM_INVALID(blend_state->dst_alpha_blendfactor, NULL) + CHECK_BLENDOP_ENUM_INVALID(blend_state->alpha_blend_op, NULL) + } + } + if (graphicsPipelineCreateInfo->target_info.has_depth_stencil_target) { + CHECK_TEXTUREFORMAT_ENUM_INVALID(graphicsPipelineCreateInfo->target_info.depth_stencil_format, NULL); + if (!IsDepthFormat(graphicsPipelineCreateInfo->target_info.depth_stencil_format)) { + SDL_assert_release(!"Depth-stencil target format must be a depth format!"); return NULL; } } - if (graphicsPipelineCreateInfo->attachmentInfo.hasDepthStencilAttachment) { - CHECK_TEXTUREFORMAT_ENUM_INVALID(graphicsPipelineCreateInfo->attachmentInfo.depthStencilFormat, NULL); - if (!IsDepthFormat(graphicsPipelineCreateInfo->attachmentInfo.depthStencilFormat)) { - SDL_assert_release(!"Depth-stencil attachment format must be a depth format!"); - return NULL; + if (graphicsPipelineCreateInfo->vertex_input_state.num_vertex_buffers > 0 && graphicsPipelineCreateInfo->vertex_input_state.vertex_buffer_descriptions == NULL) { + SDL_assert_release(!"Vertex buffer descriptions array pointer cannot be NULL!"); + return NULL; + } + if (graphicsPipelineCreateInfo->vertex_input_state.num_vertex_buffers > MAX_VERTEX_BUFFERS) { + SDL_assert_release(!"The number of vertex buffer descriptions in a vertex input state must not exceed 16!"); + return NULL; + } + if (graphicsPipelineCreateInfo->vertex_input_state.num_vertex_attributes > 0 && graphicsPipelineCreateInfo->vertex_input_state.vertex_attributes == NULL) { + SDL_assert_release(!"Vertex attributes array pointer cannot be NULL!"); + return NULL; + } + if (graphicsPipelineCreateInfo->vertex_input_state.num_vertex_attributes > MAX_VERTEX_ATTRIBUTES) { + SDL_assert_release(!"The number of vertex attributes in a vertex input state must not exceed 16!"); + return NULL; + } + Uint32 locations[MAX_VERTEX_ATTRIBUTES]; + for (Uint32 i = 0; i < graphicsPipelineCreateInfo->vertex_input_state.num_vertex_attributes; i += 1) { + CHECK_VERTEXELEMENTFORMAT_ENUM_INVALID(graphicsPipelineCreateInfo->vertex_input_state.vertex_attributes[i].format, NULL); + + locations[i] = graphicsPipelineCreateInfo->vertex_input_state.vertex_attributes[i].location; + for (Uint32 j = 0; j < i; j += 1) { + if (locations[j] == locations[i]) { + SDL_assert_release(!"Each vertex attribute location in a vertex input state must be unique!"); + } } } + if (graphicsPipelineCreateInfo->depth_stencil_state.enable_depth_test) { + CHECK_COMPAREOP_ENUM_INVALID(graphicsPipelineCreateInfo->depth_stencil_state.compare_op, NULL) + } + if (graphicsPipelineCreateInfo->depth_stencil_state.enable_stencil_test) { + const SDL_GPUStencilOpState *stencil_state = &graphicsPipelineCreateInfo->depth_stencil_state.back_stencil_state; + CHECK_COMPAREOP_ENUM_INVALID(stencil_state->compare_op, NULL) + CHECK_STENCILOP_ENUM_INVALID(stencil_state->fail_op, NULL) + CHECK_STENCILOP_ENUM_INVALID(stencil_state->pass_op, NULL) + CHECK_STENCILOP_ENUM_INVALID(stencil_state->depth_fail_op, NULL) + } } return device->CreateGraphicsPipeline( @@ -669,31 +803,35 @@ SDL_GPUGraphicsPipeline *SDL_CreateGPUGraphicsPipeline( SDL_GPUSampler *SDL_CreateGPUSampler( SDL_GPUDevice *device, - SDL_GPUSamplerCreateInfo *samplerCreateInfo) + const SDL_GPUSamplerCreateInfo *createinfo) { CHECK_DEVICE_MAGIC(device, NULL); - if (samplerCreateInfo == NULL) { - SDL_InvalidParamError("samplerCreateInfo"); + if (createinfo == NULL) { + SDL_InvalidParamError("createinfo"); return NULL; } return device->CreateSampler( device->driverData, - samplerCreateInfo); + createinfo); } SDL_GPUShader *SDL_CreateGPUShader( SDL_GPUDevice *device, - SDL_GPUShaderCreateInfo *shaderCreateInfo) + const SDL_GPUShaderCreateInfo *createinfo) { CHECK_DEVICE_MAGIC(device, NULL); - if (shaderCreateInfo == NULL) { - SDL_InvalidParamError("shaderCreateInfo"); + if (createinfo == NULL) { + SDL_InvalidParamError("createinfo"); return NULL; } - if (device->debugMode) { - if (!(shaderCreateInfo->format & device->shaderFormats)) { + if (device->debug_mode) { + if (createinfo->format == SDL_GPU_SHADERFORMAT_INVALID) { + SDL_assert_release(!"Shader format cannot be INVALID!"); + return NULL; + } + if (!(createinfo->format & device->shader_formats)) { SDL_assert_release(!"Incompatible shader format for GPU backend"); return NULL; } @@ -701,109 +839,133 @@ SDL_GPUShader *SDL_CreateGPUShader( return device->CreateShader( device->driverData, - shaderCreateInfo); + createinfo); } SDL_GPUTexture *SDL_CreateGPUTexture( SDL_GPUDevice *device, - SDL_GPUTextureCreateInfo *textureCreateInfo) + const SDL_GPUTextureCreateInfo *createinfo) { CHECK_DEVICE_MAGIC(device, NULL); - if (textureCreateInfo == NULL) { - SDL_InvalidParamError("textureCreateInfo"); + if (createinfo == NULL) { + SDL_InvalidParamError("createinfo"); return NULL; } - if (device->debugMode) { + if (device->debug_mode) { bool failed = false; const Uint32 MAX_2D_DIMENSION = 16384; const Uint32 MAX_3D_DIMENSION = 2048; // Common checks for all texture types - CHECK_TEXTUREFORMAT_ENUM_INVALID(textureCreateInfo->format, NULL) + CHECK_TEXTUREFORMAT_ENUM_INVALID(createinfo->format, NULL) - if (textureCreateInfo->width <= 0 || textureCreateInfo->height <= 0 || textureCreateInfo->layerCountOrDepth <= 0) { - SDL_assert_release(!"For any texture: width, height, and layerCountOrDepth must be >= 1"); + if (createinfo->width <= 0 || createinfo->height <= 0 || createinfo->layer_count_or_depth <= 0) { + SDL_assert_release(!"For any texture: width, height, and layer_count_or_depth must be >= 1"); failed = true; } - if (textureCreateInfo->levelCount <= 0) { - SDL_assert_release(!"For any texture: levelCount must be >= 1"); + if (createinfo->num_levels <= 0) { + SDL_assert_release(!"For any texture: num_levels must be >= 1"); failed = true; } - if ((textureCreateInfo->usageFlags & SDL_GPU_TEXTUREUSAGE_GRAPHICS_STORAGE_READ) && (textureCreateInfo->usageFlags & SDL_GPU_TEXTUREUSAGE_SAMPLER)) { - SDL_assert_release(!"For any texture: usageFlags cannot contain both GRAPHICS_STORAGE_READ and SAMPLER"); + if ((createinfo->usage & SDL_GPU_TEXTUREUSAGE_GRAPHICS_STORAGE_READ) && (createinfo->usage & SDL_GPU_TEXTUREUSAGE_SAMPLER)) { + SDL_assert_release(!"For any texture: usage cannot contain both GRAPHICS_STORAGE_READ and SAMPLER"); failed = true; } - if (IsDepthFormat(textureCreateInfo->format) && (textureCreateInfo->usageFlags & ~(SDL_GPU_TEXTUREUSAGE_DEPTH_STENCIL_TARGET | SDL_GPU_TEXTUREUSAGE_SAMPLER))) { - SDL_assert_release(!"For depth textures: usageFlags cannot contain any flags except for DEPTH_STENCIL_TARGET and SAMPLER"); + if (createinfo->sample_count > SDL_GPU_SAMPLECOUNT_1 && + (createinfo->usage & (SDL_GPU_TEXTUREUSAGE_SAMPLER | + SDL_GPU_TEXTUREUSAGE_GRAPHICS_STORAGE_READ | + SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_READ | + SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_WRITE))) { + SDL_assert_release(!"For multisample textures: usage cannot contain SAMPLER or STORAGE flags"); failed = true; } - if (IsIntegerFormat(textureCreateInfo->format) && (textureCreateInfo->usageFlags & SDL_GPU_TEXTUREUSAGE_SAMPLER)) { - SDL_assert_release(!"For any texture: usageFlags cannot contain SAMPLER for textures with an integer format"); + if (IsDepthFormat(createinfo->format) && (createinfo->usage & ~(SDL_GPU_TEXTUREUSAGE_DEPTH_STENCIL_TARGET | SDL_GPU_TEXTUREUSAGE_SAMPLER))) { + SDL_assert_release(!"For depth textures: usage cannot contain any flags except for DEPTH_STENCIL_TARGET and SAMPLER"); + failed = true; + } + if (IsIntegerFormat(createinfo->format) && (createinfo->usage & SDL_GPU_TEXTUREUSAGE_SAMPLER)) { + SDL_assert_release(!"For any texture: usage cannot contain SAMPLER for textures with an integer format"); failed = true; } - if (textureCreateInfo->type == SDL_GPU_TEXTURETYPE_CUBE) { + if (createinfo->type == SDL_GPU_TEXTURETYPE_CUBE) { // Cubemap validation - if (textureCreateInfo->width != textureCreateInfo->height) { + if (createinfo->width != createinfo->height) { SDL_assert_release(!"For cube textures: width and height must be identical"); failed = true; } - if (textureCreateInfo->width > MAX_2D_DIMENSION || textureCreateInfo->height > MAX_2D_DIMENSION) { + if (createinfo->width > MAX_2D_DIMENSION || createinfo->height > MAX_2D_DIMENSION) { SDL_assert_release(!"For cube textures: width and height must be <= 16384"); failed = true; } - if (textureCreateInfo->layerCountOrDepth != 6) { - SDL_assert_release(!"For cube textures: layerCountOrDepth must be 6"); + if (createinfo->layer_count_or_depth != 6) { + SDL_assert_release(!"For cube textures: layer_count_or_depth must be 6"); failed = true; } - if (textureCreateInfo->sampleCount > SDL_GPU_SAMPLECOUNT_1) { - SDL_assert_release(!"For cube textures: sampleCount must be SDL_GPU_SAMPLECOUNT_1"); + if (createinfo->sample_count > SDL_GPU_SAMPLECOUNT_1) { + SDL_assert_release(!"For cube textures: sample_count must be SDL_GPU_SAMPLECOUNT_1"); failed = true; } - if (!SDL_GPUTextureSupportsFormat(device, textureCreateInfo->format, SDL_GPU_TEXTURETYPE_CUBE, textureCreateInfo->usageFlags)) { - SDL_assert_release(!"For cube textures: the format is unsupported for the given usageFlags"); + if (!SDL_GPUTextureSupportsFormat(device, createinfo->format, SDL_GPU_TEXTURETYPE_CUBE, createinfo->usage)) { + SDL_assert_release(!"For cube textures: the format is unsupported for the given usage"); failed = true; } - } else if (textureCreateInfo->type == SDL_GPU_TEXTURETYPE_3D) { + } else if (createinfo->type == SDL_GPU_TEXTURETYPE_CUBE_ARRAY) { + // Cubemap array validation + if (createinfo->width != createinfo->height) { + SDL_assert_release(!"For cube array textures: width and height must be identical"); + failed = true; + } + if (createinfo->width > MAX_2D_DIMENSION || createinfo->height > MAX_2D_DIMENSION) { + SDL_assert_release(!"For cube array textures: width and height must be <= 16384"); + failed = true; + } + if (createinfo->layer_count_or_depth % 6 != 0) { + SDL_assert_release(!"For cube array textures: layer_count_or_depth must be a multiple of 6"); + failed = true; + } + if (createinfo->sample_count > SDL_GPU_SAMPLECOUNT_1) { + SDL_assert_release(!"For cube array textures: sample_count must be SDL_GPU_SAMPLECOUNT_1"); + failed = true; + } + if (!SDL_GPUTextureSupportsFormat(device, createinfo->format, SDL_GPU_TEXTURETYPE_CUBE_ARRAY, createinfo->usage)) { + SDL_assert_release(!"For cube array textures: the format is unsupported for the given usage"); + failed = true; + } + } else if (createinfo->type == SDL_GPU_TEXTURETYPE_3D) { // 3D Texture Validation - if (textureCreateInfo->width > MAX_3D_DIMENSION || textureCreateInfo->height > MAX_3D_DIMENSION || textureCreateInfo->layerCountOrDepth > MAX_3D_DIMENSION) { - SDL_assert_release(!"For 3D textures: width, height, and layerCountOrDepth must be <= 2048"); + if (createinfo->width > MAX_3D_DIMENSION || createinfo->height > MAX_3D_DIMENSION || createinfo->layer_count_or_depth > MAX_3D_DIMENSION) { + SDL_assert_release(!"For 3D textures: width, height, and layer_count_or_depth must be <= 2048"); failed = true; } - if (textureCreateInfo->usageFlags & SDL_GPU_TEXTUREUSAGE_DEPTH_STENCIL_TARGET) { - SDL_assert_release(!"For 3D textures: usageFlags must not contain DEPTH_STENCIL_TARGET"); + if (createinfo->usage & SDL_GPU_TEXTUREUSAGE_DEPTH_STENCIL_TARGET) { + SDL_assert_release(!"For 3D textures: usage must not contain DEPTH_STENCIL_TARGET"); failed = true; } - if (textureCreateInfo->sampleCount > SDL_GPU_SAMPLECOUNT_1) { - SDL_assert_release(!"For 3D textures: sampleCount must be SDL_GPU_SAMPLECOUNT_1"); + if (createinfo->sample_count > SDL_GPU_SAMPLECOUNT_1) { + SDL_assert_release(!"For 3D textures: sample_count must be SDL_GPU_SAMPLECOUNT_1"); failed = true; } - if (!SDL_GPUTextureSupportsFormat(device, textureCreateInfo->format, SDL_GPU_TEXTURETYPE_3D, textureCreateInfo->usageFlags)) { - SDL_assert_release(!"For 3D textures: the format is unsupported for the given usageFlags"); + if (!SDL_GPUTextureSupportsFormat(device, createinfo->format, SDL_GPU_TEXTURETYPE_3D, createinfo->usage)) { + SDL_assert_release(!"For 3D textures: the format is unsupported for the given usage"); failed = true; } } else { - if (textureCreateInfo->type == SDL_GPU_TEXTURETYPE_2D_ARRAY) { + if (createinfo->type == SDL_GPU_TEXTURETYPE_2D_ARRAY) { // Array Texture Validation - if (textureCreateInfo->usageFlags & SDL_GPU_TEXTUREUSAGE_DEPTH_STENCIL_TARGET) { - SDL_assert_release(!"For array textures: usageFlags must not contain DEPTH_STENCIL_TARGET"); - failed = true; - } - if (textureCreateInfo->sampleCount > SDL_GPU_SAMPLECOUNT_1) { - SDL_assert_release(!"For array textures: sampleCount must be SDL_GPU_SAMPLECOUNT_1"); - failed = true; - } - } else { - // 2D Texture Validation - if (textureCreateInfo->sampleCount > SDL_GPU_SAMPLECOUNT_1 && textureCreateInfo->levelCount > 1) { - SDL_assert_release(!"For 2D textures: if sampleCount is >= SDL_GPU_SAMPLECOUNT_1, then levelCount must be 1"); + if (createinfo->usage & SDL_GPU_TEXTUREUSAGE_DEPTH_STENCIL_TARGET) { + SDL_assert_release(!"For array textures: usage must not contain DEPTH_STENCIL_TARGET"); failed = true; } } - if (!SDL_GPUTextureSupportsFormat(device, textureCreateInfo->format, SDL_GPU_TEXTURETYPE_2D, textureCreateInfo->usageFlags)) { - SDL_assert_release(!"For 2D textures: the format is unsupported for the given usageFlags"); + if (createinfo->sample_count > SDL_GPU_SAMPLECOUNT_1 && createinfo->num_levels > 1) { + SDL_assert_release(!"For 2D multisample textures: num_levels must be 1"); + failed = true; + } + if (!SDL_GPUTextureSupportsFormat(device, createinfo->format, SDL_GPU_TEXTURETYPE_2D, createinfo->usage)) { + SDL_assert_release(!"For 2D textures: the format is unsupported for the given usage"); failed = true; } } @@ -815,39 +977,39 @@ SDL_GPUTexture *SDL_CreateGPUTexture( return device->CreateTexture( device->driverData, - textureCreateInfo); + createinfo); } SDL_GPUBuffer *SDL_CreateGPUBuffer( SDL_GPUDevice *device, - SDL_GPUBufferCreateInfo *bufferCreateInfo) + const SDL_GPUBufferCreateInfo *createinfo) { CHECK_DEVICE_MAGIC(device, NULL); - if (bufferCreateInfo == NULL) { - SDL_InvalidParamError("bufferCreateInfo"); + if (createinfo == NULL) { + SDL_InvalidParamError("createinfo"); return NULL; } return device->CreateBuffer( device->driverData, - bufferCreateInfo->usageFlags, - bufferCreateInfo->sizeInBytes); + createinfo->usage, + createinfo->size); } SDL_GPUTransferBuffer *SDL_CreateGPUTransferBuffer( SDL_GPUDevice *device, - SDL_GPUTransferBufferCreateInfo *transferBufferCreateInfo) + const SDL_GPUTransferBufferCreateInfo *createinfo) { CHECK_DEVICE_MAGIC(device, NULL); - if (transferBufferCreateInfo == NULL) { - SDL_InvalidParamError("transferBufferCreateInfo"); + if (createinfo == NULL) { + SDL_InvalidParamError("createinfo"); return NULL; } return device->CreateTransferBuffer( device->driverData, - transferBufferCreateInfo->usage, - transferBufferCreateInfo->sizeInBytes); + createinfo->usage, + createinfo->size); } // Debug Naming @@ -893,11 +1055,11 @@ void SDL_SetGPUTextureName( } void SDL_InsertGPUDebugLabel( - SDL_GPUCommandBuffer *commandBuffer, + SDL_GPUCommandBuffer *command_buffer, const char *text) { - if (commandBuffer == NULL) { - SDL_InvalidParamError("commandBuffer"); + if (command_buffer == NULL) { + SDL_InvalidParamError("command_buffer"); return; } if (text == NULL) { @@ -905,21 +1067,21 @@ void SDL_InsertGPUDebugLabel( return; } - if (COMMAND_BUFFER_DEVICE->debugMode) { + if (COMMAND_BUFFER_DEVICE->debug_mode) { CHECK_COMMAND_BUFFER } COMMAND_BUFFER_DEVICE->InsertDebugLabel( - commandBuffer, + command_buffer, text); } void SDL_PushGPUDebugGroup( - SDL_GPUCommandBuffer *commandBuffer, + SDL_GPUCommandBuffer *command_buffer, const char *name) { - if (commandBuffer == NULL) { - SDL_InvalidParamError("commandBuffer"); + if (command_buffer == NULL) { + SDL_InvalidParamError("command_buffer"); return; } if (name == NULL) { @@ -927,29 +1089,29 @@ void SDL_PushGPUDebugGroup( return; } - if (COMMAND_BUFFER_DEVICE->debugMode) { + if (COMMAND_BUFFER_DEVICE->debug_mode) { CHECK_COMMAND_BUFFER } COMMAND_BUFFER_DEVICE->PushDebugGroup( - commandBuffer, + command_buffer, name); } void SDL_PopGPUDebugGroup( - SDL_GPUCommandBuffer *commandBuffer) + SDL_GPUCommandBuffer *command_buffer) { - if (commandBuffer == NULL) { - SDL_InvalidParamError("commandBuffer"); + if (command_buffer == NULL) { + SDL_InvalidParamError("command_buffer"); return; } - if (COMMAND_BUFFER_DEVICE->debugMode) { + if (COMMAND_BUFFER_DEVICE->debug_mode) { CHECK_COMMAND_BUFFER } COMMAND_BUFFER_DEVICE->PopDebugGroup( - commandBuffer); + command_buffer); } // Disposal @@ -998,16 +1160,16 @@ void SDL_ReleaseGPUBuffer( void SDL_ReleaseGPUTransferBuffer( SDL_GPUDevice *device, - SDL_GPUTransferBuffer *transferBuffer) + SDL_GPUTransferBuffer *transfer_buffer) { CHECK_DEVICE_MAGIC(device, ); - if (transferBuffer == NULL) { + if (transfer_buffer == NULL) { return; } device->ReleaseTransferBuffer( device->driverData, - transferBuffer); + transfer_buffer); } void SDL_ReleaseGPUShader( @@ -1026,30 +1188,30 @@ void SDL_ReleaseGPUShader( void SDL_ReleaseGPUComputePipeline( SDL_GPUDevice *device, - SDL_GPUComputePipeline *computePipeline) + SDL_GPUComputePipeline *compute_pipeline) { CHECK_DEVICE_MAGIC(device, ); - if (computePipeline == NULL) { + if (compute_pipeline == NULL) { return; } device->ReleaseComputePipeline( device->driverData, - computePipeline); + compute_pipeline); } void SDL_ReleaseGPUGraphicsPipeline( SDL_GPUDevice *device, - SDL_GPUGraphicsPipeline *graphicsPipeline) + SDL_GPUGraphicsPipeline *graphics_pipeline) { CHECK_DEVICE_MAGIC(device, ); - if (graphicsPipeline == NULL) { + if (graphics_pipeline == NULL) { return; } device->ReleaseGraphicsPipeline( device->driverData, - graphicsPipeline); + graphics_pipeline); } // Command Buffer @@ -1057,43 +1219,43 @@ void SDL_ReleaseGPUGraphicsPipeline( SDL_GPUCommandBuffer *SDL_AcquireGPUCommandBuffer( SDL_GPUDevice *device) { - SDL_GPUCommandBuffer *commandBuffer; + SDL_GPUCommandBuffer *command_buffer; CommandBufferCommonHeader *commandBufferHeader; CHECK_DEVICE_MAGIC(device, NULL); - commandBuffer = device->AcquireCommandBuffer( + command_buffer = device->AcquireCommandBuffer( device->driverData); - if (commandBuffer == NULL) { + if (command_buffer == NULL) { return NULL; } - commandBufferHeader = (CommandBufferCommonHeader *)commandBuffer; + commandBufferHeader = (CommandBufferCommonHeader *)command_buffer; commandBufferHeader->device = device; - commandBufferHeader->renderPass.commandBuffer = commandBuffer; - commandBufferHeader->renderPass.inProgress = false; - commandBufferHeader->graphicsPipelineBound = false; - commandBufferHeader->computePass.commandBuffer = commandBuffer; - commandBufferHeader->computePass.inProgress = false; - commandBufferHeader->computePipelineBound = false; - commandBufferHeader->copyPass.commandBuffer = commandBuffer; - commandBufferHeader->copyPass.inProgress = false; + commandBufferHeader->render_pass.command_buffer = command_buffer; + commandBufferHeader->render_pass.in_progress = false; + commandBufferHeader->graphics_pipeline_bound = false; + commandBufferHeader->compute_pass.command_buffer = command_buffer; + commandBufferHeader->compute_pass.in_progress = false; + commandBufferHeader->compute_pipeline_bound = false; + commandBufferHeader->copy_pass.command_buffer = command_buffer; + commandBufferHeader->copy_pass.in_progress = false; commandBufferHeader->submitted = false; - return commandBuffer; + return command_buffer; } // Uniforms void SDL_PushGPUVertexUniformData( - SDL_GPUCommandBuffer *commandBuffer, - Uint32 slotIndex, + SDL_GPUCommandBuffer *command_buffer, + Uint32 slot_index, const void *data, - Uint32 dataLengthInBytes) + Uint32 length) { - if (commandBuffer == NULL) { - SDL_InvalidParamError("commandBuffer"); + if (command_buffer == NULL) { + SDL_InvalidParamError("command_buffer"); return; } if (data == NULL) { @@ -1101,25 +1263,25 @@ void SDL_PushGPUVertexUniformData( return; } - if (COMMAND_BUFFER_DEVICE->debugMode) { + if (COMMAND_BUFFER_DEVICE->debug_mode) { CHECK_COMMAND_BUFFER } COMMAND_BUFFER_DEVICE->PushVertexUniformData( - commandBuffer, - slotIndex, + command_buffer, + slot_index, data, - dataLengthInBytes); + length); } void SDL_PushGPUFragmentUniformData( - SDL_GPUCommandBuffer *commandBuffer, - Uint32 slotIndex, + SDL_GPUCommandBuffer *command_buffer, + Uint32 slot_index, const void *data, - Uint32 dataLengthInBytes) + Uint32 length) { - if (commandBuffer == NULL) { - SDL_InvalidParamError("commandBuffer"); + if (command_buffer == NULL) { + SDL_InvalidParamError("command_buffer"); return; } if (data == NULL) { @@ -1127,25 +1289,25 @@ void SDL_PushGPUFragmentUniformData( return; } - if (COMMAND_BUFFER_DEVICE->debugMode) { + if (COMMAND_BUFFER_DEVICE->debug_mode) { CHECK_COMMAND_BUFFER } COMMAND_BUFFER_DEVICE->PushFragmentUniformData( - commandBuffer, - slotIndex, + command_buffer, + slot_index, data, - dataLengthInBytes); + length); } void SDL_PushGPUComputeUniformData( - SDL_GPUCommandBuffer *commandBuffer, - Uint32 slotIndex, + SDL_GPUCommandBuffer *command_buffer, + Uint32 slot_index, const void *data, - Uint32 dataLengthInBytes) + Uint32 length) { - if (commandBuffer == NULL) { - SDL_InvalidParamError("commandBuffer"); + if (command_buffer == NULL) { + SDL_InvalidParamError("command_buffer"); return; } if (data == NULL) { @@ -1153,96 +1315,133 @@ void SDL_PushGPUComputeUniformData( return; } - if (COMMAND_BUFFER_DEVICE->debugMode) { + if (COMMAND_BUFFER_DEVICE->debug_mode) { CHECK_COMMAND_BUFFER } COMMAND_BUFFER_DEVICE->PushComputeUniformData( - commandBuffer, - slotIndex, + command_buffer, + slot_index, data, - dataLengthInBytes); + length); } // Render Pass SDL_GPURenderPass *SDL_BeginGPURenderPass( - SDL_GPUCommandBuffer *commandBuffer, - SDL_GPUColorAttachmentInfo *colorAttachmentInfos, - Uint32 colorAttachmentCount, - SDL_GPUDepthStencilAttachmentInfo *depthStencilAttachmentInfo) + SDL_GPUCommandBuffer *command_buffer, + const SDL_GPUColorTargetInfo *color_target_infos, + Uint32 num_color_targets, + const SDL_GPUDepthStencilTargetInfo *depth_stencil_target_info) { CommandBufferCommonHeader *commandBufferHeader; - if (commandBuffer == NULL) { - SDL_InvalidParamError("commandBuffer"); + if (command_buffer == NULL) { + SDL_InvalidParamError("command_buffer"); return NULL; } - if (colorAttachmentInfos == NULL && colorAttachmentCount > 0) { - SDL_InvalidParamError("colorAttachmentInfos"); + if (color_target_infos == NULL && num_color_targets > 0) { + SDL_InvalidParamError("color_target_infos"); return NULL; } - if (colorAttachmentCount > MAX_COLOR_TARGET_BINDINGS) { - SDL_SetError("colorAttachmentCount exceeds MAX_COLOR_TARGET_BINDINGS"); + if (num_color_targets > MAX_COLOR_TARGET_BINDINGS) { + SDL_SetError("num_color_targets exceeds MAX_COLOR_TARGET_BINDINGS"); return NULL; } - if (COMMAND_BUFFER_DEVICE->debugMode) { + if (COMMAND_BUFFER_DEVICE->debug_mode) { CHECK_COMMAND_BUFFER_RETURN_NULL CHECK_ANY_PASS_IN_PROGRESS("Cannot begin render pass during another pass!", NULL) - for (Uint32 i = 0; i < colorAttachmentCount; i += 1) { - if (colorAttachmentInfos[i].cycle && colorAttachmentInfos[i].loadOp == SDL_GPU_LOADOP_LOAD) { - SDL_assert_release(!"Cannot cycle color attachment when load op is LOAD!"); + for (Uint32 i = 0; i < num_color_targets; i += 1) { + TextureCommonHeader *textureHeader = (TextureCommonHeader *)color_target_infos[i].texture; + + if (color_target_infos[i].cycle && color_target_infos[i].load_op == SDL_GPU_LOADOP_LOAD) { + SDL_assert_release(!"Cannot cycle color target when load op is LOAD!"); + } + + if (color_target_infos[i].store_op == SDL_GPU_STOREOP_RESOLVE || color_target_infos[i].store_op == SDL_GPU_STOREOP_RESOLVE_AND_STORE) { + if (color_target_infos[i].resolve_texture == NULL) { + SDL_assert_release(!"Store op is RESOLVE or RESOLVE_AND_STORE but resolve_texture is NULL!"); + } else { + TextureCommonHeader *resolveTextureHeader = (TextureCommonHeader *)color_target_infos[i].resolve_texture; + if (textureHeader->info.sample_count == SDL_GPU_SAMPLECOUNT_1) { + SDL_assert_release(!"Store op is RESOLVE or RESOLVE_AND_STORE but texture is not multisample!"); + } + if (resolveTextureHeader->info.sample_count != SDL_GPU_SAMPLECOUNT_1) { + SDL_assert_release(!"Resolve texture must have a sample count of 1!"); + } + if (resolveTextureHeader->info.format != textureHeader->info.format) { + SDL_assert_release(!"Resolve texture must have the same format as its corresponding color target!"); + } + if (resolveTextureHeader->info.type == SDL_GPU_TEXTURETYPE_3D) { + SDL_assert_release(!"Resolve texture must not be of TEXTURETYPE_3D!"); + } + } } } - if (depthStencilAttachmentInfo != NULL && depthStencilAttachmentInfo->cycle && (depthStencilAttachmentInfo->loadOp == SDL_GPU_LOADOP_LOAD || depthStencilAttachmentInfo->loadOp == SDL_GPU_LOADOP_LOAD)) { - SDL_assert_release(!"Cannot cycle depth attachment when load op or stencil load op is LOAD!"); + if (depth_stencil_target_info != NULL) { + + TextureCommonHeader *textureHeader = (TextureCommonHeader *)depth_stencil_target_info->texture; + if (!(textureHeader->info.usage & SDL_GPU_TEXTUREUSAGE_DEPTH_STENCIL_TARGET)) { + SDL_assert_release(!"Depth target must have been created with the DEPTH_STENCIL_TARGET usage flag!"); + } + + if (depth_stencil_target_info->cycle && (depth_stencil_target_info->load_op == SDL_GPU_LOADOP_LOAD || depth_stencil_target_info->stencil_load_op == SDL_GPU_LOADOP_LOAD)) { + SDL_assert_release(!"Cannot cycle depth target when load op or stencil load op is LOAD!"); + } + + if (depth_stencil_target_info->store_op == SDL_GPU_STOREOP_RESOLVE || + depth_stencil_target_info->stencil_store_op == SDL_GPU_STOREOP_RESOLVE || + depth_stencil_target_info->store_op == SDL_GPU_STOREOP_RESOLVE_AND_STORE || + depth_stencil_target_info->stencil_store_op == SDL_GPU_STOREOP_RESOLVE_AND_STORE) { + SDL_assert_release(!"RESOLVE store ops are not supported for depth-stencil targets!"); + } } } COMMAND_BUFFER_DEVICE->BeginRenderPass( - commandBuffer, - colorAttachmentInfos, - colorAttachmentCount, - depthStencilAttachmentInfo); + command_buffer, + color_target_infos, + num_color_targets, + depth_stencil_target_info); - commandBufferHeader = (CommandBufferCommonHeader *)commandBuffer; - commandBufferHeader->renderPass.inProgress = true; - return (SDL_GPURenderPass *)&(commandBufferHeader->renderPass); + commandBufferHeader = (CommandBufferCommonHeader *)command_buffer; + commandBufferHeader->render_pass.in_progress = true; + return (SDL_GPURenderPass *)&(commandBufferHeader->render_pass); } void SDL_BindGPUGraphicsPipeline( - SDL_GPURenderPass *renderPass, - SDL_GPUGraphicsPipeline *graphicsPipeline) + SDL_GPURenderPass *render_pass, + SDL_GPUGraphicsPipeline *graphics_pipeline) { CommandBufferCommonHeader *commandBufferHeader; - if (renderPass == NULL) { - SDL_InvalidParamError("renderPass"); + if (render_pass == NULL) { + SDL_InvalidParamError("render_pass"); return; } - if (graphicsPipeline == NULL) { - SDL_InvalidParamError("graphicsPipeline"); + if (graphics_pipeline == NULL) { + SDL_InvalidParamError("graphics_pipeline"); return; } RENDERPASS_DEVICE->BindGraphicsPipeline( RENDERPASS_COMMAND_BUFFER, - graphicsPipeline); + graphics_pipeline); commandBufferHeader = (CommandBufferCommonHeader *)RENDERPASS_COMMAND_BUFFER; - commandBufferHeader->graphicsPipelineBound = true; + commandBufferHeader->graphics_pipeline_bound = true; } void SDL_SetGPUViewport( - SDL_GPURenderPass *renderPass, - SDL_GPUViewport *viewport) + SDL_GPURenderPass *render_pass, + const SDL_GPUViewport *viewport) { - if (renderPass == NULL) { - SDL_InvalidParamError("renderPass"); + if (render_pass == NULL) { + SDL_InvalidParamError("render_pass"); return; } if (viewport == NULL) { @@ -1250,7 +1449,7 @@ void SDL_SetGPUViewport( return; } - if (RENDERPASS_DEVICE->debugMode) { + if (RENDERPASS_DEVICE->debug_mode) { CHECK_RENDERPASS } @@ -1260,11 +1459,11 @@ void SDL_SetGPUViewport( } void SDL_SetGPUScissor( - SDL_GPURenderPass *renderPass, - SDL_Rect *scissor) + SDL_GPURenderPass *render_pass, + const SDL_Rect *scissor) { - if (renderPass == NULL) { - SDL_InvalidParamError("renderPass"); + if (render_pass == NULL) { + SDL_InvalidParamError("render_pass"); return; } if (scissor == NULL) { @@ -1272,7 +1471,7 @@ void SDL_SetGPUScissor( return; } - if (RENDERPASS_DEVICE->debugMode) { + if (RENDERPASS_DEVICE->debug_mode) { CHECK_RENDERPASS } @@ -1281,273 +1480,308 @@ void SDL_SetGPUScissor( scissor); } -void SDL_BindGPUVertexBuffers( - SDL_GPURenderPass *renderPass, - Uint32 firstBinding, - SDL_GPUBufferBinding *pBindings, - Uint32 bindingCount) +void SDL_SetGPUBlendConstants( + SDL_GPURenderPass *render_pass, + SDL_FColor blend_constants) { - if (renderPass == NULL) { - SDL_InvalidParamError("renderPass"); - return; - } - if (pBindings == NULL && bindingCount > 0) { - SDL_InvalidParamError("pBindings"); + if (render_pass == NULL) { + SDL_InvalidParamError("render_pass"); return; } - if (RENDERPASS_DEVICE->debugMode) { + if (RENDERPASS_DEVICE->debug_mode) { + CHECK_RENDERPASS + } + + RENDERPASS_DEVICE->SetBlendConstants( + RENDERPASS_COMMAND_BUFFER, + blend_constants); +} + +void SDL_SetGPUStencilReference( + SDL_GPURenderPass *render_pass, + Uint8 reference) +{ + if (render_pass == NULL) { + SDL_InvalidParamError("render_pass"); + return; + } + + if (RENDERPASS_DEVICE->debug_mode) { + CHECK_RENDERPASS + } + + RENDERPASS_DEVICE->SetStencilReference( + RENDERPASS_COMMAND_BUFFER, + reference); +} + +void SDL_BindGPUVertexBuffers( + SDL_GPURenderPass *render_pass, + Uint32 first_binding, + const SDL_GPUBufferBinding *bindings, + Uint32 num_bindings) +{ + if (render_pass == NULL) { + SDL_InvalidParamError("render_pass"); + return; + } + if (bindings == NULL && num_bindings > 0) { + SDL_InvalidParamError("bindings"); + return; + } + + if (RENDERPASS_DEVICE->debug_mode) { CHECK_RENDERPASS } RENDERPASS_DEVICE->BindVertexBuffers( RENDERPASS_COMMAND_BUFFER, - firstBinding, - pBindings, - bindingCount); + first_binding, + bindings, + num_bindings); } void SDL_BindGPUIndexBuffer( - SDL_GPURenderPass *renderPass, - SDL_GPUBufferBinding *pBinding, - SDL_GPUIndexElementSize indexElementSize) + SDL_GPURenderPass *render_pass, + const SDL_GPUBufferBinding *binding, + SDL_GPUIndexElementSize index_element_size) { - if (renderPass == NULL) { - SDL_InvalidParamError("renderPass"); + if (render_pass == NULL) { + SDL_InvalidParamError("render_pass"); return; } - if (pBinding == NULL) { - SDL_InvalidParamError("pBinding"); + if (binding == NULL) { + SDL_InvalidParamError("binding"); return; } - if (RENDERPASS_DEVICE->debugMode) { + if (RENDERPASS_DEVICE->debug_mode) { CHECK_RENDERPASS } RENDERPASS_DEVICE->BindIndexBuffer( RENDERPASS_COMMAND_BUFFER, - pBinding, - indexElementSize); + binding, + index_element_size); } void SDL_BindGPUVertexSamplers( - SDL_GPURenderPass *renderPass, - Uint32 firstSlot, - SDL_GPUTextureSamplerBinding *textureSamplerBindings, - Uint32 bindingCount) + SDL_GPURenderPass *render_pass, + Uint32 first_slot, + const SDL_GPUTextureSamplerBinding *texture_sampler_bindings, + Uint32 num_bindings) { - if (renderPass == NULL) { - SDL_InvalidParamError("renderPass"); + if (render_pass == NULL) { + SDL_InvalidParamError("render_pass"); return; } - if (textureSamplerBindings == NULL && bindingCount > 0) { - SDL_InvalidParamError("textureSamplerBindings"); + if (texture_sampler_bindings == NULL && num_bindings > 0) { + SDL_InvalidParamError("texture_sampler_bindings"); return; } - if (RENDERPASS_DEVICE->debugMode) { + if (RENDERPASS_DEVICE->debug_mode) { CHECK_RENDERPASS } RENDERPASS_DEVICE->BindVertexSamplers( RENDERPASS_COMMAND_BUFFER, - firstSlot, - textureSamplerBindings, - bindingCount); + first_slot, + texture_sampler_bindings, + num_bindings); } void SDL_BindGPUVertexStorageTextures( - SDL_GPURenderPass *renderPass, - Uint32 firstSlot, - SDL_GPUTexture **storageTextures, - Uint32 bindingCount) + SDL_GPURenderPass *render_pass, + Uint32 first_slot, + SDL_GPUTexture *const *storage_textures, + Uint32 num_bindings) { - if (renderPass == NULL) { - SDL_InvalidParamError("renderPass"); + if (render_pass == NULL) { + SDL_InvalidParamError("render_pass"); return; } - if (storageTextures == NULL && bindingCount > 0) { - SDL_InvalidParamError("storageTextures"); + if (storage_textures == NULL && num_bindings > 0) { + SDL_InvalidParamError("storage_textures"); return; } - if (RENDERPASS_DEVICE->debugMode) { + if (RENDERPASS_DEVICE->debug_mode) { CHECK_RENDERPASS } RENDERPASS_DEVICE->BindVertexStorageTextures( RENDERPASS_COMMAND_BUFFER, - firstSlot, - storageTextures, - bindingCount); + first_slot, + storage_textures, + num_bindings); } void SDL_BindGPUVertexStorageBuffers( - SDL_GPURenderPass *renderPass, - Uint32 firstSlot, - SDL_GPUBuffer **storageBuffers, - Uint32 bindingCount) + SDL_GPURenderPass *render_pass, + Uint32 first_slot, + SDL_GPUBuffer *const *storage_buffers, + Uint32 num_bindings) { - if (renderPass == NULL) { - SDL_InvalidParamError("renderPass"); + if (render_pass == NULL) { + SDL_InvalidParamError("render_pass"); return; } - if (storageBuffers == NULL && bindingCount > 0) { - SDL_InvalidParamError("storageBuffers"); + if (storage_buffers == NULL && num_bindings > 0) { + SDL_InvalidParamError("storage_buffers"); return; } - if (RENDERPASS_DEVICE->debugMode) { + if (RENDERPASS_DEVICE->debug_mode) { CHECK_RENDERPASS } RENDERPASS_DEVICE->BindVertexStorageBuffers( RENDERPASS_COMMAND_BUFFER, - firstSlot, - storageBuffers, - bindingCount); + first_slot, + storage_buffers, + num_bindings); } void SDL_BindGPUFragmentSamplers( - SDL_GPURenderPass *renderPass, - Uint32 firstSlot, - SDL_GPUTextureSamplerBinding *textureSamplerBindings, - Uint32 bindingCount) + SDL_GPURenderPass *render_pass, + Uint32 first_slot, + const SDL_GPUTextureSamplerBinding *texture_sampler_bindings, + Uint32 num_bindings) { - if (renderPass == NULL) { - SDL_InvalidParamError("renderPass"); + if (render_pass == NULL) { + SDL_InvalidParamError("render_pass"); return; } - if (textureSamplerBindings == NULL && bindingCount > 0) { - SDL_InvalidParamError("textureSamplerBindings"); + if (texture_sampler_bindings == NULL && num_bindings > 0) { + SDL_InvalidParamError("texture_sampler_bindings"); return; } - if (RENDERPASS_DEVICE->debugMode) { + if (RENDERPASS_DEVICE->debug_mode) { CHECK_RENDERPASS } RENDERPASS_DEVICE->BindFragmentSamplers( RENDERPASS_COMMAND_BUFFER, - firstSlot, - textureSamplerBindings, - bindingCount); + first_slot, + texture_sampler_bindings, + num_bindings); } void SDL_BindGPUFragmentStorageTextures( - SDL_GPURenderPass *renderPass, - Uint32 firstSlot, - SDL_GPUTexture **storageTextures, - Uint32 bindingCount) + SDL_GPURenderPass *render_pass, + Uint32 first_slot, + SDL_GPUTexture *const *storage_textures, + Uint32 num_bindings) { - if (renderPass == NULL) { - SDL_InvalidParamError("renderPass"); + if (render_pass == NULL) { + SDL_InvalidParamError("render_pass"); return; } - if (storageTextures == NULL && bindingCount > 0) { - SDL_InvalidParamError("storageTextures"); + if (storage_textures == NULL && num_bindings > 0) { + SDL_InvalidParamError("storage_textures"); return; } - if (RENDERPASS_DEVICE->debugMode) { + if (RENDERPASS_DEVICE->debug_mode) { CHECK_RENDERPASS } RENDERPASS_DEVICE->BindFragmentStorageTextures( RENDERPASS_COMMAND_BUFFER, - firstSlot, - storageTextures, - bindingCount); + first_slot, + storage_textures, + num_bindings); } void SDL_BindGPUFragmentStorageBuffers( - SDL_GPURenderPass *renderPass, - Uint32 firstSlot, - SDL_GPUBuffer **storageBuffers, - Uint32 bindingCount) + SDL_GPURenderPass *render_pass, + Uint32 first_slot, + SDL_GPUBuffer *const *storage_buffers, + Uint32 num_bindings) { - if (renderPass == NULL) { - SDL_InvalidParamError("renderPass"); + if (render_pass == NULL) { + SDL_InvalidParamError("render_pass"); return; } - if (storageBuffers == NULL && bindingCount > 0) { - SDL_InvalidParamError("storageBuffers"); + if (storage_buffers == NULL && num_bindings > 0) { + SDL_InvalidParamError("storage_buffers"); return; } - if (RENDERPASS_DEVICE->debugMode) { + if (RENDERPASS_DEVICE->debug_mode) { CHECK_RENDERPASS } RENDERPASS_DEVICE->BindFragmentStorageBuffers( RENDERPASS_COMMAND_BUFFER, - firstSlot, - storageBuffers, - bindingCount); + first_slot, + storage_buffers, + num_bindings); } void SDL_DrawGPUIndexedPrimitives( - SDL_GPURenderPass *renderPass, - Uint32 indexCount, - Uint32 instanceCount, - Uint32 firstIndex, - Sint32 vertexOffset, - Uint32 firstInstance) + SDL_GPURenderPass *render_pass, + Uint32 num_indices, + Uint32 num_instances, + Uint32 first_index, + Sint32 vertex_offset, + Uint32 first_instance) { - if (renderPass == NULL) { - SDL_InvalidParamError("renderPass"); + if (render_pass == NULL) { + SDL_InvalidParamError("render_pass"); return; } - if (RENDERPASS_DEVICE->debugMode) { + if (RENDERPASS_DEVICE->debug_mode) { CHECK_RENDERPASS CHECK_GRAPHICS_PIPELINE_BOUND } RENDERPASS_DEVICE->DrawIndexedPrimitives( RENDERPASS_COMMAND_BUFFER, - indexCount, - instanceCount, - firstIndex, - vertexOffset, - firstInstance); + num_indices, + num_instances, + first_index, + vertex_offset, + first_instance); } void SDL_DrawGPUPrimitives( - SDL_GPURenderPass *renderPass, - Uint32 vertexCount, - Uint32 instanceCount, - Uint32 firstVertex, - Uint32 firstInstance) + SDL_GPURenderPass *render_pass, + Uint32 num_vertices, + Uint32 num_instances, + Uint32 first_vertex, + Uint32 first_instance) { - if (renderPass == NULL) { - SDL_InvalidParamError("renderPass"); + if (render_pass == NULL) { + SDL_InvalidParamError("render_pass"); return; } - if (RENDERPASS_DEVICE->debugMode) { + if (RENDERPASS_DEVICE->debug_mode) { CHECK_RENDERPASS CHECK_GRAPHICS_PIPELINE_BOUND } RENDERPASS_DEVICE->DrawPrimitives( RENDERPASS_COMMAND_BUFFER, - vertexCount, - instanceCount, - firstVertex, - firstInstance); + num_vertices, + num_instances, + first_vertex, + first_instance); } void SDL_DrawGPUPrimitivesIndirect( - SDL_GPURenderPass *renderPass, + SDL_GPURenderPass *render_pass, SDL_GPUBuffer *buffer, - Uint32 offsetInBytes, - Uint32 drawCount, - Uint32 stride) + Uint32 offset, + Uint32 draw_count) { - if (renderPass == NULL) { - SDL_InvalidParamError("renderPass"); + if (render_pass == NULL) { + SDL_InvalidParamError("render_pass"); return; } if (buffer == NULL) { @@ -1555,7 +1789,7 @@ void SDL_DrawGPUPrimitivesIndirect( return; } - if (RENDERPASS_DEVICE->debugMode) { + if (RENDERPASS_DEVICE->debug_mode) { CHECK_RENDERPASS CHECK_GRAPHICS_PIPELINE_BOUND } @@ -1563,20 +1797,18 @@ void SDL_DrawGPUPrimitivesIndirect( RENDERPASS_DEVICE->DrawPrimitivesIndirect( RENDERPASS_COMMAND_BUFFER, buffer, - offsetInBytes, - drawCount, - stride); + offset, + draw_count); } void SDL_DrawGPUIndexedPrimitivesIndirect( - SDL_GPURenderPass *renderPass, + SDL_GPURenderPass *render_pass, SDL_GPUBuffer *buffer, - Uint32 offsetInBytes, - Uint32 drawCount, - Uint32 stride) + Uint32 offset, + Uint32 draw_count) { - if (renderPass == NULL) { - SDL_InvalidParamError("renderPass"); + if (render_pass == NULL) { + SDL_InvalidParamError("render_pass"); return; } if (buffer == NULL) { @@ -1584,7 +1816,7 @@ void SDL_DrawGPUIndexedPrimitivesIndirect( return; } - if (RENDERPASS_DEVICE->debugMode) { + if (RENDERPASS_DEVICE->debug_mode) { CHECK_RENDERPASS CHECK_GRAPHICS_PIPELINE_BOUND } @@ -1592,22 +1824,21 @@ void SDL_DrawGPUIndexedPrimitivesIndirect( RENDERPASS_DEVICE->DrawIndexedPrimitivesIndirect( RENDERPASS_COMMAND_BUFFER, buffer, - offsetInBytes, - drawCount, - stride); + offset, + draw_count); } void SDL_EndGPURenderPass( - SDL_GPURenderPass *renderPass) + SDL_GPURenderPass *render_pass) { CommandBufferCommonHeader *commandBufferCommonHeader; - if (renderPass == NULL) { - SDL_InvalidParamError("renderPass"); + if (render_pass == NULL) { + SDL_InvalidParamError("render_pass"); return; } - if (RENDERPASS_DEVICE->debugMode) { + if (RENDERPASS_DEVICE->debug_mode) { CHECK_RENDERPASS } @@ -1615,171 +1846,197 @@ void SDL_EndGPURenderPass( RENDERPASS_COMMAND_BUFFER); commandBufferCommonHeader = (CommandBufferCommonHeader *)RENDERPASS_COMMAND_BUFFER; - commandBufferCommonHeader->renderPass.inProgress = false; - commandBufferCommonHeader->graphicsPipelineBound = false; + commandBufferCommonHeader->render_pass.in_progress = false; + commandBufferCommonHeader->graphics_pipeline_bound = false; } // Compute Pass SDL_GPUComputePass *SDL_BeginGPUComputePass( - SDL_GPUCommandBuffer *commandBuffer, - SDL_GPUStorageTextureWriteOnlyBinding *storageTextureBindings, - Uint32 storageTextureBindingCount, - SDL_GPUStorageBufferWriteOnlyBinding *storageBufferBindings, - Uint32 storageBufferBindingCount) + SDL_GPUCommandBuffer *command_buffer, + const SDL_GPUStorageTextureWriteOnlyBinding *storage_texture_bindings, + Uint32 num_storage_texture_bindings, + const SDL_GPUStorageBufferWriteOnlyBinding *storage_buffer_bindings, + Uint32 num_storage_buffer_bindings) { CommandBufferCommonHeader *commandBufferHeader; - if (commandBuffer == NULL) { - SDL_InvalidParamError("commandBuffer"); + if (command_buffer == NULL) { + SDL_InvalidParamError("command_buffer"); return NULL; } - if (storageTextureBindings == NULL && storageTextureBindingCount > 0) { - SDL_InvalidParamError("storageTextureBindings"); + if (storage_texture_bindings == NULL && num_storage_texture_bindings > 0) { + SDL_InvalidParamError("storage_texture_bindings"); return NULL; } - if (storageBufferBindings == NULL && storageBufferBindingCount > 0) { - SDL_InvalidParamError("storageBufferBindings"); + if (storage_buffer_bindings == NULL && num_storage_buffer_bindings > 0) { + SDL_InvalidParamError("storage_buffer_bindings"); return NULL; } - if (storageTextureBindingCount > MAX_COMPUTE_WRITE_TEXTURES) { - SDL_InvalidParamError("storageTextureBindingCount"); + if (num_storage_texture_bindings > MAX_COMPUTE_WRITE_TEXTURES) { + SDL_InvalidParamError("num_storage_texture_bindings"); return NULL; } - if (storageBufferBindingCount > MAX_COMPUTE_WRITE_BUFFERS) { - SDL_InvalidParamError("storageBufferBindingCount"); + if (num_storage_buffer_bindings > MAX_COMPUTE_WRITE_BUFFERS) { + SDL_InvalidParamError("num_storage_buffer_bindings"); return NULL; } - if (COMMAND_BUFFER_DEVICE->debugMode) { + if (COMMAND_BUFFER_DEVICE->debug_mode) { CHECK_COMMAND_BUFFER_RETURN_NULL CHECK_ANY_PASS_IN_PROGRESS("Cannot begin compute pass during another pass!", NULL) } COMMAND_BUFFER_DEVICE->BeginComputePass( - commandBuffer, - storageTextureBindings, - storageTextureBindingCount, - storageBufferBindings, - storageBufferBindingCount); + command_buffer, + storage_texture_bindings, + num_storage_texture_bindings, + storage_buffer_bindings, + num_storage_buffer_bindings); - commandBufferHeader = (CommandBufferCommonHeader *)commandBuffer; - commandBufferHeader->computePass.inProgress = true; - return (SDL_GPUComputePass *)&(commandBufferHeader->computePass); + commandBufferHeader = (CommandBufferCommonHeader *)command_buffer; + commandBufferHeader->compute_pass.in_progress = true; + return (SDL_GPUComputePass *)&(commandBufferHeader->compute_pass); } void SDL_BindGPUComputePipeline( - SDL_GPUComputePass *computePass, - SDL_GPUComputePipeline *computePipeline) + SDL_GPUComputePass *compute_pass, + SDL_GPUComputePipeline *compute_pipeline) { CommandBufferCommonHeader *commandBufferHeader; - if (computePass == NULL) { - SDL_InvalidParamError("computePass"); + if (compute_pass == NULL) { + SDL_InvalidParamError("compute_pass"); return; } - if (computePipeline == NULL) { - SDL_InvalidParamError("computePipeline"); + if (compute_pipeline == NULL) { + SDL_InvalidParamError("compute_pipeline"); return; } - if (COMPUTEPASS_DEVICE->debugMode) { + if (COMPUTEPASS_DEVICE->debug_mode) { CHECK_COMPUTEPASS } COMPUTEPASS_DEVICE->BindComputePipeline( COMPUTEPASS_COMMAND_BUFFER, - computePipeline); + compute_pipeline); commandBufferHeader = (CommandBufferCommonHeader *)COMPUTEPASS_COMMAND_BUFFER; - commandBufferHeader->computePipelineBound = true; + commandBufferHeader->compute_pipeline_bound = true; +} + +void SDL_BindGPUComputeSamplers( + SDL_GPUComputePass *compute_pass, + Uint32 first_slot, + const SDL_GPUTextureSamplerBinding *texture_sampler_bindings, + Uint32 num_bindings) +{ + if (compute_pass == NULL) { + SDL_InvalidParamError("compute_pass"); + return; + } + if (texture_sampler_bindings == NULL && num_bindings > 0) { + SDL_InvalidParamError("texture_sampler_bindings"); + return; + } + + if (COMPUTEPASS_DEVICE->debug_mode) { + CHECK_COMPUTEPASS + } + + COMPUTEPASS_DEVICE->BindComputeSamplers( + COMPUTEPASS_COMMAND_BUFFER, + first_slot, + texture_sampler_bindings, + num_bindings); } void SDL_BindGPUComputeStorageTextures( - SDL_GPUComputePass *computePass, - Uint32 firstSlot, - SDL_GPUTexture **storageTextures, - Uint32 bindingCount) + SDL_GPUComputePass *compute_pass, + Uint32 first_slot, + SDL_GPUTexture *const *storage_textures, + Uint32 num_bindings) { - if (computePass == NULL) { - SDL_InvalidParamError("computePass"); + if (compute_pass == NULL) { + SDL_InvalidParamError("compute_pass"); return; } - if (storageTextures == NULL && bindingCount > 0) { - SDL_InvalidParamError("storageTextures"); + if (storage_textures == NULL && num_bindings > 0) { + SDL_InvalidParamError("storage_textures"); return; } - if (COMPUTEPASS_DEVICE->debugMode) { + if (COMPUTEPASS_DEVICE->debug_mode) { CHECK_COMPUTEPASS } COMPUTEPASS_DEVICE->BindComputeStorageTextures( COMPUTEPASS_COMMAND_BUFFER, - firstSlot, - storageTextures, - bindingCount); + first_slot, + storage_textures, + num_bindings); } void SDL_BindGPUComputeStorageBuffers( - SDL_GPUComputePass *computePass, - Uint32 firstSlot, - SDL_GPUBuffer **storageBuffers, - Uint32 bindingCount) + SDL_GPUComputePass *compute_pass, + Uint32 first_slot, + SDL_GPUBuffer *const *storage_buffers, + Uint32 num_bindings) { - if (computePass == NULL) { - SDL_InvalidParamError("computePass"); + if (compute_pass == NULL) { + SDL_InvalidParamError("compute_pass"); return; } - if (storageBuffers == NULL && bindingCount > 0) { - SDL_InvalidParamError("storageBuffers"); + if (storage_buffers == NULL && num_bindings > 0) { + SDL_InvalidParamError("storage_buffers"); return; } - if (COMPUTEPASS_DEVICE->debugMode) { + if (COMPUTEPASS_DEVICE->debug_mode) { CHECK_COMPUTEPASS } COMPUTEPASS_DEVICE->BindComputeStorageBuffers( COMPUTEPASS_COMMAND_BUFFER, - firstSlot, - storageBuffers, - bindingCount); + first_slot, + storage_buffers, + num_bindings); } void SDL_DispatchGPUCompute( - SDL_GPUComputePass *computePass, - Uint32 groupCountX, - Uint32 groupCountY, - Uint32 groupCountZ) + SDL_GPUComputePass *compute_pass, + Uint32 groupcount_x, + Uint32 groupcount_y, + Uint32 groupcount_z) { - if (computePass == NULL) { - SDL_InvalidParamError("computePass"); + if (compute_pass == NULL) { + SDL_InvalidParamError("compute_pass"); return; } - if (COMPUTEPASS_DEVICE->debugMode) { + if (COMPUTEPASS_DEVICE->debug_mode) { CHECK_COMPUTEPASS CHECK_COMPUTE_PIPELINE_BOUND } COMPUTEPASS_DEVICE->DispatchCompute( COMPUTEPASS_COMMAND_BUFFER, - groupCountX, - groupCountY, - groupCountZ); + groupcount_x, + groupcount_y, + groupcount_z); } void SDL_DispatchGPUComputeIndirect( - SDL_GPUComputePass *computePass, + SDL_GPUComputePass *compute_pass, SDL_GPUBuffer *buffer, - Uint32 offsetInBytes) + Uint32 offset) { - if (computePass == NULL) { - SDL_InvalidParamError("computePass"); + if (compute_pass == NULL) { + SDL_InvalidParamError("compute_pass"); return; } - if (COMPUTEPASS_DEVICE->debugMode) { + if (COMPUTEPASS_DEVICE->debug_mode) { CHECK_COMPUTEPASS CHECK_COMPUTE_PIPELINE_BOUND } @@ -1787,20 +2044,20 @@ void SDL_DispatchGPUComputeIndirect( COMPUTEPASS_DEVICE->DispatchComputeIndirect( COMPUTEPASS_COMMAND_BUFFER, buffer, - offsetInBytes); + offset); } void SDL_EndGPUComputePass( - SDL_GPUComputePass *computePass) + SDL_GPUComputePass *compute_pass) { CommandBufferCommonHeader *commandBufferCommonHeader; - if (computePass == NULL) { - SDL_InvalidParamError("computePass"); + if (compute_pass == NULL) { + SDL_InvalidParamError("compute_pass"); return; } - if (COMPUTEPASS_DEVICE->debugMode) { + if (COMPUTEPASS_DEVICE->debug_mode) { CHECK_COMPUTEPASS } @@ -1808,77 +2065,77 @@ void SDL_EndGPUComputePass( COMPUTEPASS_COMMAND_BUFFER); commandBufferCommonHeader = (CommandBufferCommonHeader *)COMPUTEPASS_COMMAND_BUFFER; - commandBufferCommonHeader->computePass.inProgress = false; - commandBufferCommonHeader->computePipelineBound = false; + commandBufferCommonHeader->compute_pass.in_progress = false; + commandBufferCommonHeader->compute_pipeline_bound = false; } // TransferBuffer Data void *SDL_MapGPUTransferBuffer( SDL_GPUDevice *device, - SDL_GPUTransferBuffer *transferBuffer, - SDL_bool cycle) + SDL_GPUTransferBuffer *transfer_buffer, + bool cycle) { CHECK_DEVICE_MAGIC(device, NULL); - if (transferBuffer == NULL) { - SDL_InvalidParamError("transferBuffer"); + if (transfer_buffer == NULL) { + SDL_InvalidParamError("transfer_buffer"); return NULL; } return device->MapTransferBuffer( device->driverData, - transferBuffer, + transfer_buffer, cycle); } void SDL_UnmapGPUTransferBuffer( SDL_GPUDevice *device, - SDL_GPUTransferBuffer *transferBuffer) + SDL_GPUTransferBuffer *transfer_buffer) { CHECK_DEVICE_MAGIC(device, ); - if (transferBuffer == NULL) { - SDL_InvalidParamError("transferBuffer"); + if (transfer_buffer == NULL) { + SDL_InvalidParamError("transfer_buffer"); return; } device->UnmapTransferBuffer( device->driverData, - transferBuffer); + transfer_buffer); } // Copy Pass SDL_GPUCopyPass *SDL_BeginGPUCopyPass( - SDL_GPUCommandBuffer *commandBuffer) + SDL_GPUCommandBuffer *command_buffer) { CommandBufferCommonHeader *commandBufferHeader; - if (commandBuffer == NULL) { - SDL_InvalidParamError("commandBuffer"); + if (command_buffer == NULL) { + SDL_InvalidParamError("command_buffer"); return NULL; } - if (COMMAND_BUFFER_DEVICE->debugMode) { + if (COMMAND_BUFFER_DEVICE->debug_mode) { CHECK_COMMAND_BUFFER_RETURN_NULL CHECK_ANY_PASS_IN_PROGRESS("Cannot begin copy pass during another pass!", NULL) } COMMAND_BUFFER_DEVICE->BeginCopyPass( - commandBuffer); + command_buffer); - commandBufferHeader = (CommandBufferCommonHeader *)commandBuffer; - commandBufferHeader->copyPass.inProgress = true; - return (SDL_GPUCopyPass *)&(commandBufferHeader->copyPass); + commandBufferHeader = (CommandBufferCommonHeader *)command_buffer; + commandBufferHeader->copy_pass.in_progress = true; + return (SDL_GPUCopyPass *)&(commandBufferHeader->copy_pass); } void SDL_UploadToGPUTexture( - SDL_GPUCopyPass *copyPass, - SDL_GPUTextureTransferInfo *source, - SDL_GPUTextureRegion *destination, - SDL_bool cycle) + SDL_GPUCopyPass *copy_pass, + const SDL_GPUTextureTransferInfo *source, + const SDL_GPUTextureRegion *destination, + bool cycle) { - if (copyPass == NULL) { - SDL_InvalidParamError("copyPass"); + if (copy_pass == NULL) { + SDL_InvalidParamError("copy_pass"); return; } if (source == NULL) { @@ -1890,8 +2147,16 @@ void SDL_UploadToGPUTexture( return; } - if (COPYPASS_DEVICE->debugMode) { + if (COPYPASS_DEVICE->debug_mode) { CHECK_COPYPASS + if (source->transfer_buffer == NULL) { + SDL_assert_release(!"Source transfer buffer cannot be NULL!"); + return; + } + if (destination->texture == NULL) { + SDL_assert_release(!"Destination texture cannot be NULL!"); + return; + } } COPYPASS_DEVICE->UploadToTexture( @@ -1902,13 +2167,13 @@ void SDL_UploadToGPUTexture( } void SDL_UploadToGPUBuffer( - SDL_GPUCopyPass *copyPass, - SDL_GPUTransferBufferLocation *source, - SDL_GPUBufferRegion *destination, - SDL_bool cycle) + SDL_GPUCopyPass *copy_pass, + const SDL_GPUTransferBufferLocation *source, + const SDL_GPUBufferRegion *destination, + bool cycle) { - if (copyPass == NULL) { - SDL_InvalidParamError("copyPass"); + if (copy_pass == NULL) { + SDL_InvalidParamError("copy_pass"); return; } if (source == NULL) { @@ -1920,6 +2185,18 @@ void SDL_UploadToGPUBuffer( return; } + if (COPYPASS_DEVICE->debug_mode) { + CHECK_COPYPASS + if (source->transfer_buffer == NULL) { + SDL_assert_release(!"Source transfer buffer cannot be NULL!"); + return; + } + if (destination->buffer == NULL) { + SDL_assert_release(!"Destination buffer cannot be NULL!"); + return; + } + } + COPYPASS_DEVICE->UploadToBuffer( COPYPASS_COMMAND_BUFFER, source, @@ -1928,16 +2205,16 @@ void SDL_UploadToGPUBuffer( } void SDL_CopyGPUTextureToTexture( - SDL_GPUCopyPass *copyPass, - SDL_GPUTextureLocation *source, - SDL_GPUTextureLocation *destination, + SDL_GPUCopyPass *copy_pass, + const SDL_GPUTextureLocation *source, + const SDL_GPUTextureLocation *destination, Uint32 w, Uint32 h, Uint32 d, - SDL_bool cycle) + bool cycle) { - if (copyPass == NULL) { - SDL_InvalidParamError("copyPass"); + if (copy_pass == NULL) { + SDL_InvalidParamError("copy_pass"); return; } if (source == NULL) { @@ -1949,6 +2226,18 @@ void SDL_CopyGPUTextureToTexture( return; } + if (COPYPASS_DEVICE->debug_mode) { + CHECK_COPYPASS + if (source->texture == NULL) { + SDL_assert_release(!"Source texture cannot be NULL!"); + return; + } + if (destination->texture == NULL) { + SDL_assert_release(!"Destination texture cannot be NULL!"); + return; + } + } + COPYPASS_DEVICE->CopyTextureToTexture( COPYPASS_COMMAND_BUFFER, source, @@ -1960,14 +2249,14 @@ void SDL_CopyGPUTextureToTexture( } void SDL_CopyGPUBufferToBuffer( - SDL_GPUCopyPass *copyPass, - SDL_GPUBufferLocation *source, - SDL_GPUBufferLocation *destination, + SDL_GPUCopyPass *copy_pass, + const SDL_GPUBufferLocation *source, + const SDL_GPUBufferLocation *destination, Uint32 size, - SDL_bool cycle) + bool cycle) { - if (copyPass == NULL) { - SDL_InvalidParamError("copyPass"); + if (copy_pass == NULL) { + SDL_InvalidParamError("copy_pass"); return; } if (source == NULL) { @@ -1979,6 +2268,18 @@ void SDL_CopyGPUBufferToBuffer( return; } + if (COPYPASS_DEVICE->debug_mode) { + CHECK_COPYPASS + if (source->buffer == NULL) { + SDL_assert_release(!"Source buffer cannot be NULL!"); + return; + } + if (destination->buffer == NULL) { + SDL_assert_release(!"Destination buffer cannot be NULL!"); + return; + } + } + COPYPASS_DEVICE->CopyBufferToBuffer( COPYPASS_COMMAND_BUFFER, source, @@ -1988,12 +2289,12 @@ void SDL_CopyGPUBufferToBuffer( } void SDL_DownloadFromGPUTexture( - SDL_GPUCopyPass *copyPass, - SDL_GPUTextureRegion *source, - SDL_GPUTextureTransferInfo *destination) + SDL_GPUCopyPass *copy_pass, + const SDL_GPUTextureRegion *source, + const SDL_GPUTextureTransferInfo *destination) { - if (copyPass == NULL) { - SDL_InvalidParamError("copyPass"); + if (copy_pass == NULL) { + SDL_InvalidParamError("copy_pass"); return; } if (source == NULL) { @@ -2005,6 +2306,18 @@ void SDL_DownloadFromGPUTexture( return; } + if (COPYPASS_DEVICE->debug_mode) { + CHECK_COPYPASS + if (source->texture == NULL) { + SDL_assert_release(!"Source texture cannot be NULL!"); + return; + } + if (destination->transfer_buffer == NULL) { + SDL_assert_release(!"Destination transfer buffer cannot be NULL!"); + return; + } + } + COPYPASS_DEVICE->DownloadFromTexture( COPYPASS_COMMAND_BUFFER, source, @@ -2012,12 +2325,12 @@ void SDL_DownloadFromGPUTexture( } void SDL_DownloadFromGPUBuffer( - SDL_GPUCopyPass *copyPass, - SDL_GPUBufferRegion *source, - SDL_GPUTransferBufferLocation *destination) + SDL_GPUCopyPass *copy_pass, + const SDL_GPUBufferRegion *source, + const SDL_GPUTransferBufferLocation *destination) { - if (copyPass == NULL) { - SDL_InvalidParamError("copyPass"); + if (copy_pass == NULL) { + SDL_InvalidParamError("copy_pass"); return; } if (source == NULL) { @@ -2029,6 +2342,18 @@ void SDL_DownloadFromGPUBuffer( return; } + if (COPYPASS_DEVICE->debug_mode) { + CHECK_COPYPASS + if (source->buffer == NULL) { + SDL_assert_release(!"Source buffer cannot be NULL!"); + return; + } + if (destination->transfer_buffer == NULL) { + SDL_assert_release(!"Destination transfer buffer cannot be NULL!"); + return; + } + } + COPYPASS_DEVICE->DownloadFromBuffer( COPYPASS_COMMAND_BUFFER, source, @@ -2036,29 +2361,29 @@ void SDL_DownloadFromGPUBuffer( } void SDL_EndGPUCopyPass( - SDL_GPUCopyPass *copyPass) + SDL_GPUCopyPass *copy_pass) { - if (copyPass == NULL) { - SDL_InvalidParamError("copyPass"); + if (copy_pass == NULL) { + SDL_InvalidParamError("copy_pass"); return; } - if (COPYPASS_DEVICE->debugMode) { + if (COPYPASS_DEVICE->debug_mode) { CHECK_COPYPASS } COPYPASS_DEVICE->EndCopyPass( COPYPASS_COMMAND_BUFFER); - ((CommandBufferCommonHeader *)COPYPASS_COMMAND_BUFFER)->copyPass.inProgress = false; + ((CommandBufferCommonHeader *)COPYPASS_COMMAND_BUFFER)->copy_pass.in_progress = false; } void SDL_GenerateMipmapsForGPUTexture( - SDL_GPUCommandBuffer *commandBuffer, + SDL_GPUCommandBuffer *command_buffer, SDL_GPUTexture *texture) { - if (commandBuffer == NULL) { - SDL_InvalidParamError("commandBuffer"); + if (command_buffer == NULL) { + SDL_InvalidParamError("command_buffer"); return; } if (texture == NULL) { @@ -2066,66 +2391,66 @@ void SDL_GenerateMipmapsForGPUTexture( return; } - if (COMMAND_BUFFER_DEVICE->debugMode) { + if (COMMAND_BUFFER_DEVICE->debug_mode) { CHECK_COMMAND_BUFFER CHECK_ANY_PASS_IN_PROGRESS("Cannot generate mipmaps during a pass!", ) TextureCommonHeader *header = (TextureCommonHeader *)texture; - if (header->info.levelCount <= 1) { - SDL_assert_release(!"Cannot generate mipmaps for texture with levelCount <= 1!"); + if (header->info.num_levels <= 1) { + SDL_assert_release(!"Cannot generate mipmaps for texture with num_levels <= 1!"); return; } - if (!(header->info.usageFlags & SDL_GPU_TEXTUREUSAGE_SAMPLER) || !(header->info.usageFlags & SDL_GPU_TEXTUREUSAGE_COLOR_TARGET)) { + if (!(header->info.usage & SDL_GPU_TEXTUREUSAGE_SAMPLER) || !(header->info.usage & SDL_GPU_TEXTUREUSAGE_COLOR_TARGET)) { SDL_assert_release(!"GenerateMipmaps texture must be created with SAMPLER and COLOR_TARGET usage flags!"); return; } } COMMAND_BUFFER_DEVICE->GenerateMipmaps( - commandBuffer, + command_buffer, texture); } void SDL_BlitGPUTexture( - SDL_GPUCommandBuffer *commandBuffer, - SDL_GPUBlitRegion *source, - SDL_GPUBlitRegion *destination, - SDL_FlipMode flipMode, - SDL_GPUFilter filterMode, - SDL_bool cycle) + SDL_GPUCommandBuffer *command_buffer, + const SDL_GPUBlitInfo *info) { - if (commandBuffer == NULL) { - SDL_InvalidParamError("commandBuffer"); + if (command_buffer == NULL) { + SDL_InvalidParamError("command_buffer"); return; } - if (source == NULL) { - SDL_InvalidParamError("source"); - return; - } - if (destination == NULL) { - SDL_InvalidParamError("destination"); + if (info == NULL) { + SDL_InvalidParamError("info"); return; } - if (COMMAND_BUFFER_DEVICE->debugMode) { + if (COMMAND_BUFFER_DEVICE->debug_mode) { CHECK_COMMAND_BUFFER CHECK_ANY_PASS_IN_PROGRESS("Cannot blit during a pass!", ) // Validation bool failed = false; - TextureCommonHeader *srcHeader = (TextureCommonHeader *)source->texture; - TextureCommonHeader *dstHeader = (TextureCommonHeader *)destination->texture; + TextureCommonHeader *srcHeader = (TextureCommonHeader *)info->source.texture; + TextureCommonHeader *dstHeader = (TextureCommonHeader *)info->destination.texture; - if (srcHeader == NULL || dstHeader == NULL) { - SDL_assert_release(!"Blit source and destination textures must be non-NULL"); + if (srcHeader == NULL) { + SDL_assert_release(!"Blit source texture must be non-NULL"); return; // attempting to proceed will crash } - if ((srcHeader->info.usageFlags & SDL_GPU_TEXTUREUSAGE_SAMPLER) == 0) { + if (dstHeader == NULL) { + SDL_assert_release(!"Blit destination texture must be non-NULL"); + return; // attempting to proceed will crash + } + if (srcHeader->info.sample_count != SDL_GPU_SAMPLECOUNT_1) { + SDL_assert_release(!"Blit source texture must have a sample count of 1"); + failed = true; + } + if ((srcHeader->info.usage & SDL_GPU_TEXTUREUSAGE_SAMPLER) == 0) { SDL_assert_release(!"Blit source texture must be created with the SAMPLER usage flag"); failed = true; } - if ((dstHeader->info.usageFlags & SDL_GPU_TEXTUREUSAGE_COLOR_TARGET) == 0) { + if ((dstHeader->info.usage & SDL_GPU_TEXTUREUSAGE_COLOR_TARGET) == 0) { SDL_assert_release(!"Blit destination texture must be created with the COLOR_TARGET usage flag"); failed = true; } @@ -2133,7 +2458,7 @@ void SDL_BlitGPUTexture( SDL_assert_release(!"Blit source texture cannot have a depth format"); failed = true; } - if (source->w == 0 || source->h == 0 || destination->w == 0 || destination->h == 0) { + if (info->source.w == 0 || info->source.h == 0 || info->destination.w == 0 || info->destination.h == 0) { SDL_assert_release(!"Blit source/destination regions must have non-zero width, height, and depth"); failed = true; } @@ -2144,20 +2469,16 @@ void SDL_BlitGPUTexture( } COMMAND_BUFFER_DEVICE->Blit( - commandBuffer, - source, - destination, - flipMode, - filterMode, - cycle); + command_buffer, + info); } // Submission/Presentation -SDL_bool SDL_WindowSupportsGPUSwapchainComposition( +bool SDL_WindowSupportsGPUSwapchainComposition( SDL_GPUDevice *device, SDL_Window *window, - SDL_GPUSwapchainComposition swapchainComposition) + SDL_GPUSwapchainComposition swapchain_composition) { CHECK_DEVICE_MAGIC(device, false); if (window == NULL) { @@ -2165,20 +2486,20 @@ SDL_bool SDL_WindowSupportsGPUSwapchainComposition( return false; } - if (device->debugMode) { - CHECK_SWAPCHAINCOMPOSITION_ENUM_INVALID(swapchainComposition, false) + if (device->debug_mode) { + CHECK_SWAPCHAINCOMPOSITION_ENUM_INVALID(swapchain_composition, false) } return device->SupportsSwapchainComposition( device->driverData, window, - swapchainComposition); + swapchain_composition); } -SDL_bool SDL_WindowSupportsGPUPresentMode( +bool SDL_WindowSupportsGPUPresentMode( SDL_GPUDevice *device, SDL_Window *window, - SDL_GPUPresentMode presentMode) + SDL_GPUPresentMode present_mode) { CHECK_DEVICE_MAGIC(device, false); if (window == NULL) { @@ -2186,17 +2507,17 @@ SDL_bool SDL_WindowSupportsGPUPresentMode( return false; } - if (device->debugMode) { - CHECK_PRESENTMODE_ENUM_INVALID(presentMode, false) + if (device->debug_mode) { + CHECK_PRESENTMODE_ENUM_INVALID(present_mode, false) } return device->SupportsPresentMode( device->driverData, window, - presentMode); + present_mode); } -SDL_bool SDL_ClaimWindowForGPUDevice( +bool SDL_ClaimWindowForGPUDevice( SDL_GPUDevice *device, SDL_Window *window) { @@ -2226,11 +2547,11 @@ void SDL_ReleaseWindowFromGPUDevice( window); } -SDL_bool SDL_SetGPUSwapchainParameters( +bool SDL_SetGPUSwapchainParameters( SDL_GPUDevice *device, SDL_Window *window, - SDL_GPUSwapchainComposition swapchainComposition, - SDL_GPUPresentMode presentMode) + SDL_GPUSwapchainComposition swapchain_composition, + SDL_GPUPresentMode present_mode) { CHECK_DEVICE_MAGIC(device, false); if (window == NULL) { @@ -2238,16 +2559,16 @@ SDL_bool SDL_SetGPUSwapchainParameters( return false; } - if (device->debugMode) { - CHECK_SWAPCHAINCOMPOSITION_ENUM_INVALID(swapchainComposition, false) - CHECK_PRESENTMODE_ENUM_INVALID(presentMode, false) + if (device->debug_mode) { + CHECK_SWAPCHAINCOMPOSITION_ENUM_INVALID(swapchain_composition, false) + CHECK_PRESENTMODE_ENUM_INVALID(present_mode, false) } return device->SetSwapchainParameters( device->driverData, window, - swapchainComposition, - presentMode); + swapchain_composition, + present_mode); } SDL_GPUTextureFormat SDL_GetGPUSwapchainTextureFormat( @@ -2266,56 +2587,56 @@ SDL_GPUTextureFormat SDL_GetGPUSwapchainTextureFormat( } SDL_GPUTexture *SDL_AcquireGPUSwapchainTexture( - SDL_GPUCommandBuffer *commandBuffer, + SDL_GPUCommandBuffer *command_buffer, SDL_Window *window, - Uint32 *pWidth, - Uint32 *pHeight) + Uint32 *w, + Uint32 *h) { - if (commandBuffer == NULL) { - SDL_InvalidParamError("commandBuffer"); + if (command_buffer == NULL) { + SDL_InvalidParamError("command_buffer"); return NULL; } if (window == NULL) { SDL_InvalidParamError("window"); return NULL; } - if (pWidth == NULL) { - SDL_InvalidParamError("pWidth"); + if (w == NULL) { + SDL_InvalidParamError("w"); return NULL; } - if (pHeight == NULL) { - SDL_InvalidParamError("pHeight"); + if (h == NULL) { + SDL_InvalidParamError("h"); return NULL; } - if (COMMAND_BUFFER_DEVICE->debugMode) { + if (COMMAND_BUFFER_DEVICE->debug_mode) { CHECK_COMMAND_BUFFER_RETURN_NULL CHECK_ANY_PASS_IN_PROGRESS("Cannot acquire a swapchain texture during a pass!", NULL) } return COMMAND_BUFFER_DEVICE->AcquireSwapchainTexture( - commandBuffer, + command_buffer, window, - pWidth, - pHeight); + w, + h); } void SDL_SubmitGPUCommandBuffer( - SDL_GPUCommandBuffer *commandBuffer) + SDL_GPUCommandBuffer *command_buffer) { - CommandBufferCommonHeader *commandBufferHeader = (CommandBufferCommonHeader *)commandBuffer; + CommandBufferCommonHeader *commandBufferHeader = (CommandBufferCommonHeader *)command_buffer; - if (commandBuffer == NULL) { - SDL_InvalidParamError("commandBuffer"); + if (command_buffer == NULL) { + SDL_InvalidParamError("command_buffer"); return; } - if (COMMAND_BUFFER_DEVICE->debugMode) { + if (COMMAND_BUFFER_DEVICE->debug_mode) { CHECK_COMMAND_BUFFER if ( - commandBufferHeader->renderPass.inProgress || - commandBufferHeader->computePass.inProgress || - commandBufferHeader->copyPass.inProgress) { + commandBufferHeader->render_pass.in_progress || + commandBufferHeader->compute_pass.in_progress || + commandBufferHeader->copy_pass.in_progress) { SDL_assert_release(!"Cannot submit command buffer while a pass is in progress!"); return; } @@ -2324,25 +2645,25 @@ void SDL_SubmitGPUCommandBuffer( commandBufferHeader->submitted = true; COMMAND_BUFFER_DEVICE->Submit( - commandBuffer); + command_buffer); } SDL_GPUFence *SDL_SubmitGPUCommandBufferAndAcquireFence( - SDL_GPUCommandBuffer *commandBuffer) + SDL_GPUCommandBuffer *command_buffer) { - CommandBufferCommonHeader *commandBufferHeader = (CommandBufferCommonHeader *)commandBuffer; + CommandBufferCommonHeader *commandBufferHeader = (CommandBufferCommonHeader *)command_buffer; - if (commandBuffer == NULL) { - SDL_InvalidParamError("commandBuffer"); + if (command_buffer == NULL) { + SDL_InvalidParamError("command_buffer"); return NULL; } - if (COMMAND_BUFFER_DEVICE->debugMode) { + if (COMMAND_BUFFER_DEVICE->debug_mode) { CHECK_COMMAND_BUFFER_RETURN_NULL if ( - commandBufferHeader->renderPass.inProgress || - commandBufferHeader->computePass.inProgress || - commandBufferHeader->copyPass.inProgress) { + commandBufferHeader->render_pass.in_progress || + commandBufferHeader->compute_pass.in_progress || + commandBufferHeader->copy_pass.in_progress) { SDL_assert_release(!"Cannot submit command buffer while a pass is in progress!"); return NULL; } @@ -2351,7 +2672,7 @@ SDL_GPUFence *SDL_SubmitGPUCommandBufferAndAcquireFence( commandBufferHeader->submitted = true; return COMMAND_BUFFER_DEVICE->SubmitAndAcquireFence( - commandBuffer); + command_buffer); } void SDL_WaitForGPUIdle( @@ -2365,24 +2686,24 @@ void SDL_WaitForGPUIdle( void SDL_WaitForGPUFences( SDL_GPUDevice *device, - SDL_bool waitAll, - SDL_GPUFence **pFences, - Uint32 fenceCount) + bool wait_all, + SDL_GPUFence *const *fences, + Uint32 num_fences) { CHECK_DEVICE_MAGIC(device, ); - if (pFences == NULL && fenceCount > 0) { - SDL_InvalidParamError("pFences"); + if (fences == NULL && num_fences > 0) { + SDL_InvalidParamError("fences"); return; } device->WaitForFences( device->driverData, - waitAll, - pFences, - fenceCount); + wait_all, + fences, + num_fences); } -SDL_bool SDL_QueryGPUFence( +bool SDL_QueryGPUFence( SDL_GPUDevice *device, SDL_GPUFence *fence) { diff --git a/src/gpu/SDL_sysgpu.h b/src/gpu/SDL_sysgpu.h index 720acb43..5ae9b95a 100644 --- a/src/gpu/SDL_sysgpu.h +++ b/src/gpu/SDL_sysgpu.h @@ -18,8 +18,8 @@ misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ -#include "SDL_internal.h" #include "../video/SDL_sysvideo.h" +#include "SDL_internal.h" #ifndef SDL_GPU_DRIVER_H #define SDL_GPU_DRIVER_H @@ -28,18 +28,18 @@ typedef struct Pass { - SDL_GPUCommandBuffer *commandBuffer; - bool inProgress; + SDL_GPUCommandBuffer *command_buffer; + bool in_progress; } Pass; typedef struct CommandBufferCommonHeader { SDL_GPUDevice *device; - Pass renderPass; - bool graphicsPipelineBound; - Pass computePass; - bool computePipelineBound; - Pass copyPass; + Pass render_pass; + bool graphics_pipeline_bound; + Pass compute_pass; + bool compute_pipeline_bound; + Pass copy_pass; bool submitted; } CommandBufferCommonHeader; @@ -56,8 +56,8 @@ typedef struct BlitFragmentUniforms float width; float height; - Uint32 mipLevel; - float layerOrDepth; + Uint32 mip_level; + float layer_or_depth; } BlitFragmentUniforms; typedef struct BlitPipelineCacheEntry @@ -69,9 +69,14 @@ typedef struct BlitPipelineCacheEntry // Internal Helper Utilities -#define SDL_GPU_TEXTUREFORMAT_MAX (SDL_GPU_TEXTUREFORMAT_D32_FLOAT_S8_UINT + 1) -#define SDL_GPU_SWAPCHAINCOMPOSITION_MAX (SDL_GPU_SWAPCHAINCOMPOSITION_HDR10_ST2048 + 1) -#define SDL_GPU_PRESENTMODE_MAX (SDL_GPU_PRESENTMODE_MAILBOX + 1) +#define SDL_GPU_TEXTUREFORMAT_MAX_ENUM_VALUE (SDL_GPU_TEXTUREFORMAT_D32_FLOAT_S8_UINT + 1) +#define SDL_GPU_VERTEXELEMENTFORMAT_MAX_ENUM_VALUE (SDL_GPU_VERTEXELEMENTFORMAT_HALF4 + 1) +#define SDL_GPU_COMPAREOP_MAX_ENUM_VALUE (SDL_GPU_COMPAREOP_ALWAYS + 1) +#define SDL_GPU_STENCILOP_MAX_ENUM_VALUE (SDL_GPU_STENCILOP_DECREMENT_AND_WRAP + 1) +#define SDL_GPU_BLENDOP_MAX_ENUM_VALUE (SDL_GPU_BLENDOP_MAX + 1) +#define SDL_GPU_BLENDFACTOR_MAX_ENUM_VALUE (SDL_GPU_BLENDFACTOR_SRC_ALPHA_SATURATE + 1) +#define SDL_GPU_SWAPCHAINCOMPOSITION_MAX_ENUM_VALUE (SDL_GPU_SWAPCHAINCOMPOSITION_HDR10_ST2048 + 1) +#define SDL_GPU_PRESENTMODE_MAX_ENUM_VALUE (SDL_GPU_PRESENTMODE_MAILBOX + 1) static inline Sint32 Texture_GetBlockSize( SDL_GPUTextureFormat format) @@ -227,7 +232,8 @@ static inline Sint32 BytesPerImage( #define MAX_COMPUTE_WRITE_TEXTURES 8 #define MAX_COMPUTE_WRITE_BUFFERS 8 #define UNIFORM_BUFFER_SIZE 32768 -#define MAX_BUFFER_BINDINGS 16 +#define MAX_VERTEX_BUFFERS 16 +#define MAX_VERTEX_ATTRIBUTES 16 #define MAX_COLOR_TARGET_BINDINGS 4 #define MAX_PRESENT_COUNT 16 #define MAX_FRAMES_IN_FLIGHT 3 @@ -257,17 +263,14 @@ SDL_GPUGraphicsPipeline *SDL_GPU_FetchBlitPipeline( SDL_GPUShader *blitFrom2DArrayShader, SDL_GPUShader *blitFrom3DShader, SDL_GPUShader *blitFromCubeShader, + SDL_GPUShader *blitFromCubeArrayShader, BlitPipelineCacheEntry **blitPipelines, Uint32 *blitPipelineCount, Uint32 *blitPipelineCapacity); void SDL_GPU_BlitCommon( SDL_GPUCommandBuffer *commandBuffer, - SDL_GPUBlitRegion *source, - SDL_GPUBlitRegion *destination, - SDL_FlipMode flipMode, - SDL_GPUFilter filterMode, - bool cycle, + const SDL_GPUBlitInfo *info, SDL_GPUSampler *blitLinearSampler, SDL_GPUSampler *blitNearestSampler, SDL_GPUShader *blitVertexShader, @@ -275,6 +278,7 @@ void SDL_GPU_BlitCommon( SDL_GPUShader *blitFrom2DArrayShader, SDL_GPUShader *blitFrom3DShader, SDL_GPUShader *blitFromCubeShader, + SDL_GPUShader *blitFromCubeArrayShader, BlitPipelineCacheEntry **blitPipelines, Uint32 *blitPipelineCount, Uint32 *blitPipelineCapacity); @@ -297,33 +301,33 @@ struct SDL_GPUDevice SDL_GPUComputePipeline *(*CreateComputePipeline)( SDL_GPURenderer *driverData, - SDL_GPUComputePipelineCreateInfo *pipelineCreateInfo); + const SDL_GPUComputePipelineCreateInfo *createinfo); SDL_GPUGraphicsPipeline *(*CreateGraphicsPipeline)( SDL_GPURenderer *driverData, - SDL_GPUGraphicsPipelineCreateInfo *pipelineCreateInfo); + const SDL_GPUGraphicsPipelineCreateInfo *createinfo); SDL_GPUSampler *(*CreateSampler)( SDL_GPURenderer *driverData, - SDL_GPUSamplerCreateInfo *samplerCreateInfo); + const SDL_GPUSamplerCreateInfo *createinfo); SDL_GPUShader *(*CreateShader)( SDL_GPURenderer *driverData, - SDL_GPUShaderCreateInfo *shaderCreateInfo); + const SDL_GPUShaderCreateInfo *createinfo); SDL_GPUTexture *(*CreateTexture)( SDL_GPURenderer *driverData, - SDL_GPUTextureCreateInfo *textureCreateInfo); + const SDL_GPUTextureCreateInfo *createinfo); SDL_GPUBuffer *(*CreateBuffer)( SDL_GPURenderer *driverData, SDL_GPUBufferUsageFlags usageFlags, - Uint32 sizeInBytes); + Uint32 size); SDL_GPUTransferBuffer *(*CreateTransferBuffer)( SDL_GPURenderer *driverData, SDL_GPUTransferBufferUsage usage, - Uint32 sizeInBytes); + Uint32 size); // Debug Naming @@ -382,9 +386,9 @@ struct SDL_GPUDevice void (*BeginRenderPass)( SDL_GPUCommandBuffer *commandBuffer, - SDL_GPUColorAttachmentInfo *colorAttachmentInfos, - Uint32 colorAttachmentCount, - SDL_GPUDepthStencilAttachmentInfo *depthStencilAttachmentInfo); + const SDL_GPUColorTargetInfo *colorTargetInfos, + Uint32 numColorTargets, + const SDL_GPUDepthStencilTargetInfo *depthStencilTargetInfo); void (*BindGraphicsPipeline)( SDL_GPUCommandBuffer *commandBuffer, @@ -392,99 +396,105 @@ struct SDL_GPUDevice void (*SetViewport)( SDL_GPUCommandBuffer *commandBuffer, - SDL_GPUViewport *viewport); + const SDL_GPUViewport *viewport); void (*SetScissor)( SDL_GPUCommandBuffer *commandBuffer, - SDL_Rect *scissor); + const SDL_Rect *scissor); + + void (*SetBlendConstants)( + SDL_GPUCommandBuffer *commandBuffer, + SDL_FColor blendConstants); + + void (*SetStencilReference)( + SDL_GPUCommandBuffer *commandBuffer, + Uint8 reference); void (*BindVertexBuffers)( SDL_GPUCommandBuffer *commandBuffer, - Uint32 firstBinding, - SDL_GPUBufferBinding *pBindings, - Uint32 bindingCount); + Uint32 firstSlot, + const SDL_GPUBufferBinding *bindings, + Uint32 numBindings); void (*BindIndexBuffer)( SDL_GPUCommandBuffer *commandBuffer, - SDL_GPUBufferBinding *pBinding, + const SDL_GPUBufferBinding *binding, SDL_GPUIndexElementSize indexElementSize); void (*BindVertexSamplers)( SDL_GPUCommandBuffer *commandBuffer, Uint32 firstSlot, - SDL_GPUTextureSamplerBinding *textureSamplerBindings, - Uint32 bindingCount); + const SDL_GPUTextureSamplerBinding *textureSamplerBindings, + Uint32 numBindings); void (*BindVertexStorageTextures)( SDL_GPUCommandBuffer *commandBuffer, Uint32 firstSlot, - SDL_GPUTexture **storageTextures, - Uint32 bindingCount); + SDL_GPUTexture *const *storageTextures, + Uint32 numBindings); void (*BindVertexStorageBuffers)( SDL_GPUCommandBuffer *commandBuffer, Uint32 firstSlot, - SDL_GPUBuffer **storageBuffers, - Uint32 bindingCount); + SDL_GPUBuffer *const *storageBuffers, + Uint32 numBindings); void (*BindFragmentSamplers)( SDL_GPUCommandBuffer *commandBuffer, Uint32 firstSlot, - SDL_GPUTextureSamplerBinding *textureSamplerBindings, - Uint32 bindingCount); + const SDL_GPUTextureSamplerBinding *textureSamplerBindings, + Uint32 numBindings); void (*BindFragmentStorageTextures)( SDL_GPUCommandBuffer *commandBuffer, Uint32 firstSlot, - SDL_GPUTexture **storageTextures, - Uint32 bindingCount); + SDL_GPUTexture *const *storageTextures, + Uint32 numBindings); void (*BindFragmentStorageBuffers)( SDL_GPUCommandBuffer *commandBuffer, Uint32 firstSlot, - SDL_GPUBuffer **storageBuffers, - Uint32 bindingCount); + SDL_GPUBuffer *const *storageBuffers, + Uint32 numBindings); void (*PushVertexUniformData)( SDL_GPUCommandBuffer *commandBuffer, Uint32 slotIndex, const void *data, - Uint32 dataLengthInBytes); + Uint32 length); void (*PushFragmentUniformData)( SDL_GPUCommandBuffer *commandBuffer, Uint32 slotIndex, const void *data, - Uint32 dataLengthInBytes); + Uint32 length); void (*DrawIndexedPrimitives)( SDL_GPUCommandBuffer *commandBuffer, - Uint32 indexCount, - Uint32 instanceCount, + Uint32 numIndices, + Uint32 numInstances, Uint32 firstIndex, Sint32 vertexOffset, Uint32 firstInstance); void (*DrawPrimitives)( SDL_GPUCommandBuffer *commandBuffer, - Uint32 vertexCount, - Uint32 instanceCount, + Uint32 numVertices, + Uint32 numInstances, Uint32 firstVertex, Uint32 firstInstance); void (*DrawPrimitivesIndirect)( SDL_GPUCommandBuffer *commandBuffer, SDL_GPUBuffer *buffer, - Uint32 offsetInBytes, - Uint32 drawCount, - Uint32 stride); + Uint32 offset, + Uint32 drawCount); void (*DrawIndexedPrimitivesIndirect)( SDL_GPUCommandBuffer *commandBuffer, SDL_GPUBuffer *buffer, - Uint32 offsetInBytes, - Uint32 drawCount, - Uint32 stride); + Uint32 offset, + Uint32 drawCount); void (*EndRenderPass)( SDL_GPUCommandBuffer *commandBuffer); @@ -493,43 +503,49 @@ struct SDL_GPUDevice void (*BeginComputePass)( SDL_GPUCommandBuffer *commandBuffer, - SDL_GPUStorageTextureWriteOnlyBinding *storageTextureBindings, - Uint32 storageTextureBindingCount, - SDL_GPUStorageBufferWriteOnlyBinding *storageBufferBindings, - Uint32 storageBufferBindingCount); + const SDL_GPUStorageTextureWriteOnlyBinding *storageTextureBindings, + Uint32 numStorageTextureBindings, + const SDL_GPUStorageBufferWriteOnlyBinding *storageBufferBindings, + Uint32 numStorageBufferBindings); void (*BindComputePipeline)( SDL_GPUCommandBuffer *commandBuffer, SDL_GPUComputePipeline *computePipeline); + void (*BindComputeSamplers)( + SDL_GPUCommandBuffer *commandBuffer, + Uint32 firstSlot, + const SDL_GPUTextureSamplerBinding *textureSamplerBindings, + Uint32 numBindings); + void (*BindComputeStorageTextures)( SDL_GPUCommandBuffer *commandBuffer, Uint32 firstSlot, - SDL_GPUTexture **storageTextures, - Uint32 bindingCount); + SDL_GPUTexture *const *storageTextures, + Uint32 numBindings); void (*BindComputeStorageBuffers)( SDL_GPUCommandBuffer *commandBuffer, Uint32 firstSlot, - SDL_GPUBuffer **storageBuffers, - Uint32 bindingCount); + SDL_GPUBuffer *const *storageBuffers, + Uint32 numBindings); void (*PushComputeUniformData)( SDL_GPUCommandBuffer *commandBuffer, Uint32 slotIndex, const void *data, - Uint32 dataLengthInBytes); + Uint32 length); void (*DispatchCompute)( SDL_GPUCommandBuffer *commandBuffer, - Uint32 groupCountX, - Uint32 groupCountY, - Uint32 groupCountZ); + Uint32 groupcountX, + Uint32 groupcountY, + Uint32 groupcountZ); void (*DispatchComputeIndirect)( SDL_GPUCommandBuffer *commandBuffer, SDL_GPUBuffer *buffer, - Uint32 offsetInBytes); + Uint32 offset); void (*EndComputePass)( SDL_GPUCommandBuffer *commandBuffer); @@ -552,20 +568,20 @@ struct SDL_GPUDevice void (*UploadToTexture)( SDL_GPUCommandBuffer *commandBuffer, - SDL_GPUTextureTransferInfo *source, - SDL_GPUTextureRegion *destination, + const SDL_GPUTextureTransferInfo *source, + const SDL_GPUTextureRegion *destination, bool cycle); void (*UploadToBuffer)( SDL_GPUCommandBuffer *commandBuffer, - SDL_GPUTransferBufferLocation *source, - SDL_GPUBufferRegion *destination, + const SDL_GPUTransferBufferLocation *source, + const SDL_GPUBufferRegion *destination, bool cycle); void (*CopyTextureToTexture)( SDL_GPUCommandBuffer *commandBuffer, - SDL_GPUTextureLocation *source, - SDL_GPUTextureLocation *destination, + const SDL_GPUTextureLocation *source, + const SDL_GPUTextureLocation *destination, Uint32 w, Uint32 h, Uint32 d, @@ -573,8 +589,8 @@ struct SDL_GPUDevice void (*CopyBufferToBuffer)( SDL_GPUCommandBuffer *commandBuffer, - SDL_GPUBufferLocation *source, - SDL_GPUBufferLocation *destination, + const SDL_GPUBufferLocation *source, + const SDL_GPUBufferLocation *destination, Uint32 size, bool cycle); @@ -584,24 +600,20 @@ struct SDL_GPUDevice void (*DownloadFromTexture)( SDL_GPUCommandBuffer *commandBuffer, - SDL_GPUTextureRegion *source, - SDL_GPUTextureTransferInfo *destination); + const SDL_GPUTextureRegion *source, + const SDL_GPUTextureTransferInfo *destination); void (*DownloadFromBuffer)( SDL_GPUCommandBuffer *commandBuffer, - SDL_GPUBufferRegion *source, - SDL_GPUTransferBufferLocation *destination); + const SDL_GPUBufferRegion *source, + const SDL_GPUTransferBufferLocation *destination); void (*EndCopyPass)( SDL_GPUCommandBuffer *commandBuffer); void (*Blit)( SDL_GPUCommandBuffer *commandBuffer, - SDL_GPUBlitRegion *source, - SDL_GPUBlitRegion *destination, - SDL_FlipMode flipMode, - SDL_GPUFilter filterMode, - bool cycle); + const SDL_GPUBlitInfo *info); // Submission/Presentation @@ -639,8 +651,8 @@ struct SDL_GPUDevice SDL_GPUTexture *(*AcquireSwapchainTexture)( SDL_GPUCommandBuffer *commandBuffer, SDL_Window *window, - Uint32 *pWidth, - Uint32 *pHeight); + Uint32 *w, + Uint32 *h); void (*Submit)( SDL_GPUCommandBuffer *commandBuffer); @@ -654,8 +666,8 @@ struct SDL_GPUDevice void (*WaitForFences)( SDL_GPURenderer *driverData, bool waitAll, - SDL_GPUFence **pFences, - Uint32 fenceCount); + SDL_GPUFence *const *fences, + Uint32 numFences); bool (*QueryFence)( SDL_GPURenderer *driverData, @@ -681,12 +693,14 @@ struct SDL_GPUDevice // Opaque pointer for the Driver SDL_GPURenderer *driverData; - // Store this for SDL_GetGPUDriver() - SDL_GPUDriver backend; + // Store this for SDL_GetGPUDeviceDriver() + const char *backend; + + // Store this for SDL_GetGPUShaderFormats() + SDL_GPUShaderFormat shader_formats; // Store this for SDL_gpu.c's debug layer - bool debugMode; - SDL_GPUShaderFormat shaderFormats; + bool debug_mode; }; #define ASSIGN_DRIVER_FUNC(func, name) \ @@ -716,6 +730,8 @@ struct SDL_GPUDevice ASSIGN_DRIVER_FUNC(BindGraphicsPipeline, name) \ ASSIGN_DRIVER_FUNC(SetViewport, name) \ ASSIGN_DRIVER_FUNC(SetScissor, name) \ + ASSIGN_DRIVER_FUNC(SetBlendConstants, name) \ + ASSIGN_DRIVER_FUNC(SetStencilReference, name) \ ASSIGN_DRIVER_FUNC(BindVertexBuffers, name) \ ASSIGN_DRIVER_FUNC(BindIndexBuffer, name) \ ASSIGN_DRIVER_FUNC(BindVertexSamplers, name) \ @@ -733,6 +749,7 @@ struct SDL_GPUDevice ASSIGN_DRIVER_FUNC(EndRenderPass, name) \ ASSIGN_DRIVER_FUNC(BeginComputePass, name) \ ASSIGN_DRIVER_FUNC(BindComputePipeline, name) \ + ASSIGN_DRIVER_FUNC(BindComputeSamplers, name) \ ASSIGN_DRIVER_FUNC(BindComputeStorageTextures, name) \ ASSIGN_DRIVER_FUNC(BindComputeStorageBuffers, name) \ ASSIGN_DRIVER_FUNC(PushComputeUniformData, name) \ @@ -770,11 +787,10 @@ struct SDL_GPUDevice typedef struct SDL_GPUBootstrap { - const char *Name; - const SDL_GPUDriver backendflag; - const SDL_GPUShaderFormat shaderFormats; + const char *name; + const SDL_GPUShaderFormat shader_formats; bool (*PrepareDriver)(SDL_VideoDevice *_this); - SDL_GPUDevice *(*CreateDevice)(bool debugMode, bool preferLowPower, SDL_PropertiesID props); + SDL_GPUDevice *(*CreateDevice)(bool debug_mode, bool prefer_low_power, SDL_PropertiesID props); } SDL_GPUBootstrap; #ifdef __cplusplus diff --git a/src/gpu/d3d11/D3D11_Blit.h b/src/gpu/d3d11/D3D11_Blit.h index 2394dccf..58800af6 100644 --- a/src/gpu/d3d11/D3D11_Blit.h +++ b/src/gpu/d3d11/D3D11_Blit.h @@ -1014,10 +1014,10 @@ switch r1.x break case l(2) mul r0.xz, r0.xxzx, l(1.000000, 0.000000, -1.000000, 0.000000) - mov r0.y, l(-1.000000) + mov r0.y, l(1.000000) break case l(3) - mov r0.y, l(1.000000) + mov r0.y, l(-1.000000) break case l(4) mul r0.xy, r0.xzxx, l(1.000000, -1.000000, 0.000000, 0.000000) @@ -1039,10 +1039,10 @@ ret const BYTE g_BlitFromCube[] = { - 68, 88, 66, 67, 74, 191, - 49, 23, 175, 39, 209, 200, - 62, 140, 77, 177, 73, 191, - 60, 231, 1, 0, 0, 0, + 68, 88, 66, 67, 10, 119, + 223, 12, 113, 233, 111, 65, + 57, 156, 6, 26, 212, 111, + 79, 35, 1, 0, 0, 0, 176, 6, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, 156, 2, 0, 0, 244, 2, @@ -1248,13 +1248,13 @@ const BYTE g_BlitFromCube[] = 54, 0, 0, 5, 34, 0, 16, 0, 0, 0, 0, 0, 1, 64, 0, 0, 0, 0, - 128, 191, 2, 0, 0, 1, + 128, 63, 2, 0, 0, 1, 6, 0, 0, 3, 1, 64, 0, 0, 3, 0, 0, 0, 54, 0, 0, 5, 34, 0, 16, 0, 0, 0, 0, 0, 1, 64, 0, 0, 0, 0, - 128, 63, 2, 0, 0, 1, + 128, 191, 2, 0, 0, 1, 6, 0, 0, 3, 1, 64, 0, 0, 4, 0, 0, 0, 56, 0, 0, 10, 50, 0, @@ -1326,3 +1326,382 @@ const BYTE g_BlitFromCube[] = 0, 0, 0, 0, 0, 0, 0, 0 }; +#if 0 +// +// Generated by Microsoft (R) HLSL Shader Compiler 10.1 +// +// +// Buffer Definitions: +// +// cbuffer SourceRegionBuffer +// { +// +// float2 UVLeftTop; // Offset: 0 Size: 8 +// float2 UVDimensions; // Offset: 8 Size: 8 +// uint MipLevel; // Offset: 16 Size: 4 +// float LayerOrDepth; // Offset: 20 Size: 4 +// +// } +// +// +// Resource Bindings: +// +// Name Type Format Dim HLSL Bind Count +// ------------------------------ ---------- ------- ----------- -------------- ------ +// SourceSampler sampler NA NA s0 1 +// SourceTextureCubeArray texture float4 cubearray t0 1 +// SourceRegionBuffer cbuffer NA NA cb0 1 +// +// +// +// Input signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// TEXCOORD 0 xy 0 NONE float xy +// SV_POSITION 0 xyzw 1 POS float +// +// +// Output signature: +// +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Target 0 xyzw 0 TARGET float xyzw +// +ps_5_0 +dcl_globalFlags refactoringAllowed +dcl_constantbuffer CB0[2], immediateIndexed +dcl_sampler s0, mode_default +dcl_resource_texturecubearray (float,float,float,float) t0 +dcl_input_ps linear v0.xy +dcl_output o0.xyzw +dcl_temps 3 +mad r0.xy, cb0[0].zwzz, v0.xyxx, cb0[0].xyxx +mad r0.xz, r0.xxyx, l(2.000000, 0.000000, 2.000000, 0.000000), l(-1.000000, 0.000000, -1.000000, 0.000000) +ftou r1.x, cb0[1].y +udiv r1.x, r2.x, r1.x, l(6) +switch r2.x + case l(0) + mov r0.yz, -r0.zzxz + mov r0.x, l(1.000000) + break + case l(1) + mov r0.y, l(-1.000000) + mov r0.w, -r0.z + mov r0.xyz, r0.ywxy + break + case l(2) + mul r0.xz, r0.xxzx, l(1.000000, 0.000000, -1.000000, 0.000000) + mov r0.y, l(1.000000) + break + case l(3) + mov r0.y, l(-1.000000) + break + case l(4) + mul r0.xy, r0.xzxx, l(1.000000, -1.000000, 0.000000, 0.000000) + mov r0.z, l(1.000000) + break + case l(5) + mov r0.xy, -r0.xzxx + mov r0.z, l(-1.000000) + break +endswitch +utof r0.w, r1.x +utof r1.x, cb0[1].x +sample_l_indexable(texturecubearray)(float,float,float,float) o0.xyzw, r0.xyzw, t0.xyzw, s0, r1.x +ret +// Approximately 34 instruction slots used +#endif + +const BYTE g_BlitFromCubeArray[] = +{ + 68, 88, 66, 67, 59, 147, + 203, 21, 33, 208, 116, 167, + 11, 254, 103, 46, 206, 206, + 176, 66, 1, 0, 0, 0, + 196, 6, 0, 0, 5, 0, + 0, 0, 52, 0, 0, 0, + 160, 2, 0, 0, 248, 2, + 0, 0, 44, 3, 0, 0, + 40, 6, 0, 0, 82, 68, + 69, 70, 100, 2, 0, 0, + 1, 0, 0, 0, 212, 0, + 0, 0, 3, 0, 0, 0, + 60, 0, 0, 0, 0, 5, + 255, 255, 0, 1, 0, 0, + 60, 2, 0, 0, 82, 68, + 49, 49, 60, 0, 0, 0, + 24, 0, 0, 0, 32, 0, + 0, 0, 40, 0, 0, 0, + 36, 0, 0, 0, 12, 0, + 0, 0, 0, 0, 0, 0, + 156, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 1, 0, + 0, 0, 170, 0, 0, 0, + 2, 0, 0, 0, 5, 0, + 0, 0, 10, 0, 0, 0, + 255, 255, 255, 255, 0, 0, + 0, 0, 1, 0, 0, 0, + 13, 0, 0, 0, 193, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 1, 0, 0, 0, + 83, 111, 117, 114, 99, 101, + 83, 97, 109, 112, 108, 101, + 114, 0, 83, 111, 117, 114, + 99, 101, 84, 101, 120, 116, + 117, 114, 101, 67, 117, 98, + 101, 65, 114, 114, 97, 121, + 0, 83, 111, 117, 114, 99, + 101, 82, 101, 103, 105, 111, + 110, 66, 117, 102, 102, 101, + 114, 0, 193, 0, 0, 0, + 4, 0, 0, 0, 236, 0, + 0, 0, 32, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 140, 1, 0, 0, + 0, 0, 0, 0, 8, 0, + 0, 0, 2, 0, 0, 0, + 160, 1, 0, 0, 0, 0, + 0, 0, 255, 255, 255, 255, + 0, 0, 0, 0, 255, 255, + 255, 255, 0, 0, 0, 0, + 196, 1, 0, 0, 8, 0, + 0, 0, 8, 0, 0, 0, + 2, 0, 0, 0, 160, 1, + 0, 0, 0, 0, 0, 0, + 255, 255, 255, 255, 0, 0, + 0, 0, 255, 255, 255, 255, + 0, 0, 0, 0, 209, 1, + 0, 0, 16, 0, 0, 0, + 4, 0, 0, 0, 2, 0, + 0, 0, 224, 1, 0, 0, + 0, 0, 0, 0, 255, 255, + 255, 255, 0, 0, 0, 0, + 255, 255, 255, 255, 0, 0, + 0, 0, 4, 2, 0, 0, + 20, 0, 0, 0, 4, 0, + 0, 0, 2, 0, 0, 0, + 24, 2, 0, 0, 0, 0, + 0, 0, 255, 255, 255, 255, + 0, 0, 0, 0, 255, 255, + 255, 255, 0, 0, 0, 0, + 85, 86, 76, 101, 102, 116, + 84, 111, 112, 0, 102, 108, + 111, 97, 116, 50, 0, 171, + 171, 171, 1, 0, 3, 0, + 1, 0, 2, 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, 150, 1, + 0, 0, 85, 86, 68, 105, + 109, 101, 110, 115, 105, 111, + 110, 115, 0, 77, 105, 112, + 76, 101, 118, 101, 108, 0, + 100, 119, 111, 114, 100, 0, + 0, 0, 19, 0, 1, 0, + 1, 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, 218, 1, 0, 0, + 76, 97, 121, 101, 114, 79, + 114, 68, 101, 112, 116, 104, + 0, 102, 108, 111, 97, 116, + 0, 171, 0, 0, 3, 0, + 1, 0, 1, 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, 17, 2, + 0, 0, 77, 105, 99, 114, + 111, 115, 111, 102, 116, 32, + 40, 82, 41, 32, 72, 76, + 83, 76, 32, 83, 104, 97, + 100, 101, 114, 32, 67, 111, + 109, 112, 105, 108, 101, 114, + 32, 49, 48, 46, 49, 0, + 73, 83, 71, 78, 80, 0, + 0, 0, 2, 0, 0, 0, + 8, 0, 0, 0, 56, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 3, 3, 0, 0, 65, 0, + 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 3, 0, + 0, 0, 1, 0, 0, 0, + 15, 0, 0, 0, 84, 69, + 88, 67, 79, 79, 82, 68, + 0, 83, 86, 95, 80, 79, + 83, 73, 84, 73, 79, 78, + 0, 171, 171, 171, 79, 83, + 71, 78, 44, 0, 0, 0, + 1, 0, 0, 0, 8, 0, + 0, 0, 32, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 3, 0, 0, 0, + 0, 0, 0, 0, 15, 0, + 0, 0, 83, 86, 95, 84, + 97, 114, 103, 101, 116, 0, + 171, 171, 83, 72, 69, 88, + 244, 2, 0, 0, 80, 0, + 0, 0, 189, 0, 0, 0, + 106, 8, 0, 1, 89, 0, + 0, 4, 70, 142, 32, 0, + 0, 0, 0, 0, 2, 0, + 0, 0, 90, 0, 0, 3, + 0, 96, 16, 0, 0, 0, + 0, 0, 88, 80, 0, 4, + 0, 112, 16, 0, 0, 0, + 0, 0, 85, 85, 0, 0, + 98, 16, 0, 3, 50, 16, + 16, 0, 0, 0, 0, 0, + 101, 0, 0, 3, 242, 32, + 16, 0, 0, 0, 0, 0, + 104, 0, 0, 2, 3, 0, + 0, 0, 50, 0, 0, 11, + 50, 0, 16, 0, 0, 0, + 0, 0, 230, 138, 32, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 70, 16, 16, 0, + 0, 0, 0, 0, 70, 128, + 32, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 50, 0, + 0, 15, 82, 0, 16, 0, + 0, 0, 0, 0, 6, 1, + 16, 0, 0, 0, 0, 0, + 2, 64, 0, 0, 0, 0, + 0, 64, 0, 0, 0, 0, + 0, 0, 0, 64, 0, 0, + 0, 0, 2, 64, 0, 0, + 0, 0, 128, 191, 0, 0, + 0, 0, 0, 0, 128, 191, + 0, 0, 0, 0, 28, 0, + 0, 6, 18, 0, 16, 0, + 1, 0, 0, 0, 26, 128, + 32, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 78, 0, + 0, 9, 18, 0, 16, 0, + 1, 0, 0, 0, 18, 0, + 16, 0, 2, 0, 0, 0, + 10, 0, 16, 0, 1, 0, + 0, 0, 1, 64, 0, 0, + 6, 0, 0, 0, 76, 0, + 0, 3, 10, 0, 16, 0, + 2, 0, 0, 0, 6, 0, + 0, 3, 1, 64, 0, 0, + 0, 0, 0, 0, 54, 0, + 0, 6, 98, 0, 16, 0, + 0, 0, 0, 0, 166, 8, + 16, 128, 65, 0, 0, 0, + 0, 0, 0, 0, 54, 0, + 0, 5, 18, 0, 16, 0, + 0, 0, 0, 0, 1, 64, + 0, 0, 0, 0, 128, 63, + 2, 0, 0, 1, 6, 0, + 0, 3, 1, 64, 0, 0, + 1, 0, 0, 0, 54, 0, + 0, 5, 34, 0, 16, 0, + 0, 0, 0, 0, 1, 64, + 0, 0, 0, 0, 128, 191, + 54, 0, 0, 6, 130, 0, + 16, 0, 0, 0, 0, 0, + 42, 0, 16, 128, 65, 0, + 0, 0, 0, 0, 0, 0, + 54, 0, 0, 5, 114, 0, + 16, 0, 0, 0, 0, 0, + 214, 4, 16, 0, 0, 0, + 0, 0, 2, 0, 0, 1, + 6, 0, 0, 3, 1, 64, + 0, 0, 2, 0, 0, 0, + 56, 0, 0, 10, 82, 0, + 16, 0, 0, 0, 0, 0, + 6, 2, 16, 0, 0, 0, + 0, 0, 2, 64, 0, 0, + 0, 0, 128, 63, 0, 0, + 0, 0, 0, 0, 128, 191, + 0, 0, 0, 0, 54, 0, + 0, 5, 34, 0, 16, 0, + 0, 0, 0, 0, 1, 64, + 0, 0, 0, 0, 128, 63, + 2, 0, 0, 1, 6, 0, + 0, 3, 1, 64, 0, 0, + 3, 0, 0, 0, 54, 0, + 0, 5, 34, 0, 16, 0, + 0, 0, 0, 0, 1, 64, + 0, 0, 0, 0, 128, 191, + 2, 0, 0, 1, 6, 0, + 0, 3, 1, 64, 0, 0, + 4, 0, 0, 0, 56, 0, + 0, 10, 50, 0, 16, 0, + 0, 0, 0, 0, 134, 0, + 16, 0, 0, 0, 0, 0, + 2, 64, 0, 0, 0, 0, + 128, 63, 0, 0, 128, 191, + 0, 0, 0, 0, 0, 0, + 0, 0, 54, 0, 0, 5, + 66, 0, 16, 0, 0, 0, + 0, 0, 1, 64, 0, 0, + 0, 0, 128, 63, 2, 0, + 0, 1, 6, 0, 0, 3, + 1, 64, 0, 0, 5, 0, + 0, 0, 54, 0, 0, 6, + 50, 0, 16, 0, 0, 0, + 0, 0, 134, 0, 16, 128, + 65, 0, 0, 0, 0, 0, + 0, 0, 54, 0, 0, 5, + 66, 0, 16, 0, 0, 0, + 0, 0, 1, 64, 0, 0, + 0, 0, 128, 191, 2, 0, + 0, 1, 23, 0, 0, 1, + 86, 0, 0, 5, 130, 0, + 16, 0, 0, 0, 0, 0, + 10, 0, 16, 0, 1, 0, + 0, 0, 86, 0, 0, 6, + 18, 0, 16, 0, 1, 0, + 0, 0, 10, 128, 32, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 72, 0, 0, 141, + 130, 2, 0, 128, 67, 85, + 21, 0, 242, 32, 16, 0, + 0, 0, 0, 0, 70, 14, + 16, 0, 0, 0, 0, 0, + 70, 126, 16, 0, 0, 0, + 0, 0, 0, 96, 16, 0, + 0, 0, 0, 0, 10, 0, + 16, 0, 1, 0, 0, 0, + 62, 0, 0, 1, 83, 84, + 65, 84, 148, 0, 0, 0, + 34, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 2, 0, 0, 0, 7, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 7, 0, + 0, 0, 1, 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, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 7, 0, + 0, 0, 0, 0, 0, 0, + 3, 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 +}; diff --git a/src/gpu/d3d11/SDL_gpu_d3d11.c b/src/gpu/d3d11/SDL_gpu_d3d11.c index ce1129ca..25be9a19 100644 --- a/src/gpu/d3d11/SDL_gpu_d3d11.c +++ b/src/gpu/d3d11/SDL_gpu_d3d11.c @@ -21,7 +21,7 @@ #include "SDL_internal.h" -#if SDL_GPU_D3D11 +#ifdef SDL_GPU_D3D11 #define D3D11_NO_HELPERS #define CINTERFACE @@ -35,8 +35,7 @@ #include "../SDL_sysgpu.h" -// MinGW doesn't implement this yet -#ifdef _WIN32 +#ifdef __IDXGIInfoQueue_INTERFACE_DEFINED__ #define HAVE_IDXGIINFOQUEUE #endif @@ -93,17 +92,19 @@ static const GUID D3D_IID_DXGI_DEBUG_ALL = { 0xe48ae283, 0xda80, 0x490b, { 0x87, // Built-in shaders, compiled with compile_shaders.bat -#define g_FullscreenVert D3D11_FullscreenVert -#define g_BlitFrom2D D3D11_BlitFrom2D -#define g_BlitFrom2DArray D3D11_BlitFrom2DArray -#define g_BlitFrom3D D3D11_BlitFrom3D -#define g_BlitFromCube D3D11_BlitFromCube +#define g_FullscreenVert D3D11_FullscreenVert +#define g_BlitFrom2D D3D11_BlitFrom2D +#define g_BlitFrom2DArray D3D11_BlitFrom2DArray +#define g_BlitFrom3D D3D11_BlitFrom3D +#define g_BlitFromCube D3D11_BlitFromCube +#define g_BlitFromCubeArray D3D11_BlitFromCubeArray #include "D3D11_Blit.h" #undef g_FullscreenVert #undef g_BlitFrom2D #undef g_BlitFrom2DArray #undef g_BlitFrom3D #undef g_BlitFromCube +#undef g_BlitFromCubeArray // Macros @@ -169,6 +170,7 @@ static DXGI_COLOR_SPACE_TYPE SwapchainCompositionToColorSpace[] = { }; static DXGI_FORMAT SDLToD3D11_TextureFormat[] = { + DXGI_FORMAT_UNKNOWN, // INVALID DXGI_FORMAT_A8_UNORM, // A8_UNORM DXGI_FORMAT_R8_UNORM, // R8_UNORM DXGI_FORMAT_R8G8_UNORM, // R8G8_UNORM @@ -226,9 +228,10 @@ static DXGI_FORMAT SDLToD3D11_TextureFormat[] = { DXGI_FORMAT_D24_UNORM_S8_UINT, // D24_UNORM_S8_UINT DXGI_FORMAT_D32_FLOAT_S8X24_UINT, // D32_FLOAT_S8_UINT }; -SDL_COMPILE_TIME_ASSERT(SDLToD3D11_TextureFormat, SDL_arraysize(SDLToD3D11_TextureFormat) == SDL_GPU_TEXTUREFORMAT_MAX); +SDL_COMPILE_TIME_ASSERT(SDLToD3D11_TextureFormat, SDL_arraysize(SDLToD3D11_TextureFormat) == SDL_GPU_TEXTUREFORMAT_MAX_ENUM_VALUE); static DXGI_FORMAT SDLToD3D11_VertexFormat[] = { + DXGI_FORMAT_UNKNOWN, // INVALID DXGI_FORMAT_R32_SINT, // INT DXGI_FORMAT_R32G32_SINT, // INT2 DXGI_FORMAT_R32G32B32_SINT, // INT3 @@ -260,6 +263,7 @@ static DXGI_FORMAT SDLToD3D11_VertexFormat[] = { DXGI_FORMAT_R16G16_FLOAT, // HALF2 DXGI_FORMAT_R16G16B16A16_FLOAT // HALF4 }; +SDL_COMPILE_TIME_ASSERT(SDLToD3D11_VertexFormat, SDL_arraysize(SDLToD3D11_VertexFormat) == SDL_GPU_VERTEXELEMENTFORMAT_MAX_ENUM_VALUE); static Uint32 SDLToD3D11_SampleCount[] = { 1, // SDL_GPU_SAMPLECOUNT_1 @@ -274,11 +278,11 @@ static DXGI_FORMAT SDLToD3D11_IndexType[] = { }; static D3D11_PRIMITIVE_TOPOLOGY SDLToD3D11_PrimitiveType[] = { - D3D_PRIMITIVE_TOPOLOGY_POINTLIST, // POINTLIST - D3D_PRIMITIVE_TOPOLOGY_LINELIST, // LINELIST - D3D_PRIMITIVE_TOPOLOGY_LINESTRIP, // LINESTRIP - D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST, // TRIANGLELIST - D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP // TRIANGLESTRIP + D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST, // TRIANGLELIST + D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP, // TRIANGLESTRIP + D3D_PRIMITIVE_TOPOLOGY_LINELIST, // LINELIST + D3D_PRIMITIVE_TOPOLOGY_LINESTRIP, // LINESTRIP + D3D_PRIMITIVE_TOPOLOGY_POINTLIST // POINTLIST }; static D3D11_CULL_MODE SDLToD3D11_CullMode[] = { @@ -288,6 +292,7 @@ static D3D11_CULL_MODE SDLToD3D11_CullMode[] = { }; static D3D11_BLEND SDLToD3D11_BlendFactor[] = { + D3D11_BLEND_ZERO, // INVALID D3D11_BLEND_ZERO, // ZERO D3D11_BLEND_ONE, // ONE D3D11_BLEND_SRC_COLOR, // SRC_COLOR @@ -302,8 +307,10 @@ static D3D11_BLEND SDLToD3D11_BlendFactor[] = { D3D11_BLEND_INV_BLEND_FACTOR, // ONE_MINUS_CONSTANT_COLOR D3D11_BLEND_SRC_ALPHA_SAT, // SRC_ALPHA_SATURATE }; +SDL_COMPILE_TIME_ASSERT(SDLToD3D11_BlendFactor, SDL_arraysize(SDLToD3D11_BlendFactor) == SDL_GPU_BLENDFACTOR_MAX_ENUM_VALUE); static D3D11_BLEND SDLToD3D11_BlendFactorAlpha[] = { + D3D11_BLEND_ZERO, // ALPHA D3D11_BLEND_ZERO, // ZERO D3D11_BLEND_ONE, // ONE D3D11_BLEND_SRC_ALPHA, // SRC_COLOR @@ -318,16 +325,20 @@ static D3D11_BLEND SDLToD3D11_BlendFactorAlpha[] = { D3D11_BLEND_INV_BLEND_FACTOR, // ONE_MINUS_CONSTANT_COLOR D3D11_BLEND_SRC_ALPHA_SAT, // SRC_ALPHA_SATURATE }; +SDL_COMPILE_TIME_ASSERT(SDLToD3D11_BlendFactorAlpha, SDL_arraysize(SDLToD3D11_BlendFactorAlpha) == SDL_GPU_BLENDFACTOR_MAX_ENUM_VALUE); static D3D11_BLEND_OP SDLToD3D11_BlendOp[] = { + D3D11_BLEND_OP_ADD, // INVALID D3D11_BLEND_OP_ADD, // ADD D3D11_BLEND_OP_SUBTRACT, // SUBTRACT D3D11_BLEND_OP_REV_SUBTRACT, // REVERSE_SUBTRACT D3D11_BLEND_OP_MIN, // MIN D3D11_BLEND_OP_MAX // MAX }; +SDL_COMPILE_TIME_ASSERT(SDLToD3D11_BlendOp, SDL_arraysize(SDLToD3D11_BlendOp) == SDL_GPU_BLENDOP_MAX_ENUM_VALUE); static D3D11_COMPARISON_FUNC SDLToD3D11_CompareOp[] = { + D3D11_COMPARISON_NEVER, // INVALID D3D11_COMPARISON_NEVER, // NEVER D3D11_COMPARISON_LESS, // LESS D3D11_COMPARISON_EQUAL, // EQUAL @@ -337,8 +348,10 @@ static D3D11_COMPARISON_FUNC SDLToD3D11_CompareOp[] = { D3D11_COMPARISON_GREATER_EQUAL, // GREATER_OR_EQUAL D3D11_COMPARISON_ALWAYS // ALWAYS }; +SDL_COMPILE_TIME_ASSERT(SDLToD3D11_CompareOp, SDL_arraysize(SDLToD3D11_CompareOp) == SDL_GPU_COMPAREOP_MAX_ENUM_VALUE); static D3D11_STENCIL_OP SDLToD3D11_StencilOp[] = { + D3D11_STENCIL_OP_KEEP, // INVALID D3D11_STENCIL_OP_KEEP, // KEEP D3D11_STENCIL_OP_ZERO, // ZERO D3D11_STENCIL_OP_REPLACE, // REPLACE @@ -348,6 +361,7 @@ static D3D11_STENCIL_OP SDLToD3D11_StencilOp[] = { D3D11_STENCIL_OP_INCR, // INCREMENT_AND_WRAP D3D11_STENCIL_OP_DECR // DECREMENT_AND_WRAP }; +SDL_COMPILE_TIME_ASSERT(SDLToD3D11_StencilOp, SDL_arraysize(SDLToD3D11_StencilOp) == SDL_GPU_STENCILOP_MAX_ENUM_VALUE); static D3D11_INPUT_CLASSIFICATION SDLToD3D11_VertexInputRate[] = { D3D11_INPUT_PER_VERTEX_DATA, // VERTEX @@ -360,31 +374,31 @@ static D3D11_TEXTURE_ADDRESS_MODE SDLToD3D11_SamplerAddressMode[] = { D3D11_TEXTURE_ADDRESS_CLAMP // CLAMP_TO_EDGE }; -static D3D11_FILTER SDLToD3D11_Filter(SDL_GPUSamplerCreateInfo *createInfo) +static D3D11_FILTER SDLToD3D11_Filter(const SDL_GPUSamplerCreateInfo *createInfo) { - if (createInfo->minFilter == SDL_GPU_FILTER_LINEAR) { - if (createInfo->magFilter == SDL_GPU_FILTER_LINEAR) { - if (createInfo->mipmapMode == SDL_GPU_SAMPLERMIPMAPMODE_LINEAR) { + if (createInfo->min_filter == SDL_GPU_FILTER_LINEAR) { + if (createInfo->mag_filter == SDL_GPU_FILTER_LINEAR) { + if (createInfo->mipmap_mode == SDL_GPU_SAMPLERMIPMAPMODE_LINEAR) { return D3D11_FILTER_MIN_MAG_MIP_LINEAR; } else { return D3D11_FILTER_MIN_MAG_LINEAR_MIP_POINT; } } else { - if (createInfo->mipmapMode == SDL_GPU_SAMPLERMIPMAPMODE_LINEAR) { + if (createInfo->mipmap_mode == SDL_GPU_SAMPLERMIPMAPMODE_LINEAR) { return D3D11_FILTER_MIN_LINEAR_MAG_POINT_MIP_LINEAR; } else { return D3D11_FILTER_MIN_LINEAR_MAG_MIP_POINT; } } } else { - if (createInfo->magFilter == SDL_GPU_FILTER_LINEAR) { - if (createInfo->mipmapMode == SDL_GPU_SAMPLERMIPMAPMODE_LINEAR) { + if (createInfo->mag_filter == SDL_GPU_FILTER_LINEAR) { + if (createInfo->mipmap_mode == SDL_GPU_SAMPLERMIPMAPMODE_LINEAR) { return D3D11_FILTER_MIN_POINT_MAG_MIP_LINEAR; } else { return D3D11_FILTER_MIN_POINT_MAG_LINEAR_MIP_POINT; } } else { - if (createInfo->mipmapMode == SDL_GPU_SAMPLERMIPMAPMODE_LINEAR) { + if (createInfo->mipmap_mode == SDL_GPU_SAMPLERMIPMAPMODE_LINEAR) { return D3D11_FILTER_MIN_MAG_POINT_MIP_LINEAR; } else { return D3D11_FILTER_MIN_MAG_MIP_POINT; @@ -402,13 +416,13 @@ typedef struct D3D11TextureContainer TextureCommonHeader header; D3D11Texture *activeTexture; - bool canBeCycled; Uint32 textureCapacity; Uint32 textureCount; D3D11Texture **textures; char *debugName; + bool canBeCycled; } D3D11TextureContainer; typedef struct D3D11TextureSubresource @@ -424,9 +438,6 @@ typedef struct D3D11TextureSubresource ID3D11UnorderedAccessView *uav; // NULL if not a storage texture ID3D11DepthStencilView *depthStencilTargetView; // NULL if not a depth stencil target - - ID3D11Resource *msaaHandle; // NULL if not using MSAA - ID3D11RenderTargetView *msaaTargetView; // NULL if not an MSAA color target } D3D11TextureSubresource; struct D3D11Texture @@ -438,7 +449,7 @@ struct D3D11Texture ID3D11ShaderResourceView *shaderView; D3D11TextureSubresource *subresources; - Uint32 subresourceCount; /* layerCount * levelCount */ + Uint32 subresourceCount; /* layerCount * num_levels */ SDL_AtomicInt referenceCount; }; @@ -459,7 +470,7 @@ typedef struct D3D11WindowData SDL_GPUSwapchainComposition swapchainComposition; DXGI_FORMAT swapchainFormat; DXGI_COLOR_SPACE_TYPE swapchainColorSpace; - D3D11Fence *inFlightFences[MAX_FRAMES_IN_FLIGHT]; + SDL_GPUFence *inFlightFences[MAX_FRAMES_IN_FLIGHT]; Uint32 frameCounter; } D3D11WindowData; @@ -469,25 +480,24 @@ typedef struct D3D11Shader void *bytecode; size_t bytecodeSize; - Uint32 samplerCount; - Uint32 uniformBufferCount; - Uint32 storageBufferCount; - Uint32 storageTextureCount; + Uint32 numSamplers; + Uint32 numUniformBuffers; + Uint32 numStorageBuffers; + Uint32 numStorageTextures; } D3D11Shader; typedef struct D3D11GraphicsPipeline { - float blendConstants[4]; - Sint32 numColorAttachments; - DXGI_FORMAT colorAttachmentFormats[MAX_COLOR_TARGET_BINDINGS]; - ID3D11BlendState *colorAttachmentBlendState; + Sint32 numColorTargets; + DXGI_FORMAT colorTargetFormats[MAX_COLOR_TARGET_BINDINGS]; + ID3D11BlendState *colorTargetBlendState; + Uint32 sampleMask; SDL_GPUMultisampleState multisampleState; - Uint8 hasDepthStencilAttachment; - DXGI_FORMAT depthStencilAttachmentFormat; + Uint8 hasDepthStencilTarget; + DXGI_FORMAT depthStencilTargetFormat; ID3D11DepthStencilState *depthStencilState; - Uint8 stencilRef; SDL_GPUPrimitiveType primitiveType; ID3D11RasterizerState *rasterizerState; @@ -496,7 +506,7 @@ typedef struct D3D11GraphicsPipeline ID3D11PixelShader *fragmentShader; ID3D11InputLayout *inputLayout; - Uint32 *vertexStrides; + Uint32 vertexStrides[MAX_VERTEX_BUFFERS]; Uint32 vertexSamplerCount; Uint32 vertexUniformBufferCount; @@ -513,11 +523,12 @@ typedef struct D3D11ComputePipeline { ID3D11ComputeShader *computeShader; - Uint32 readOnlyStorageTextureCount; - Uint32 writeOnlyStorageTextureCount; - Uint32 readOnlyStorageBufferCount; - Uint32 writeOnlyStorageBufferCount; - Uint32 uniformBufferCount; + Uint32 numSamplers; + Uint32 numReadonlyStorageTextures; + Uint32 numWriteonlyStorageTextures; + Uint32 numReadonlyStorageBuffers; + Uint32 numWriteonlyStorageBuffers; + Uint32 numUniformBuffers; } D3D11ComputePipeline; typedef struct D3D11Buffer @@ -599,6 +610,11 @@ typedef struct D3D11UniformBuffer Uint32 currentBlockSize; } D3D11UniformBuffer; +typedef struct D3D11Sampler +{ + ID3D11SamplerState *handle; +} D3D11Sampler; + typedef struct D3D11Renderer D3D11Renderer; typedef struct D3D11CommandBuffer @@ -616,12 +632,10 @@ typedef struct D3D11CommandBuffer // Render Pass D3D11GraphicsPipeline *graphicsPipeline; - - // Render Pass MSAA resolve - D3D11Texture *colorTargetResolveTexture[MAX_COLOR_TARGET_BINDINGS]; - Uint32 colorTargetResolveSubresourceIndex[MAX_COLOR_TARGET_BINDINGS]; - ID3D11Resource *colorTargetMsaaHandle[MAX_COLOR_TARGET_BINDINGS]; - DXGI_FORMAT colorTargetMsaaFormat[MAX_COLOR_TARGET_BINDINGS]; + Uint8 stencilRef; + SDL_FColor blendConstants; + D3D11TextureSubresource *colorTargetSubresources[MAX_COLOR_TARGET_BINDINGS]; + D3D11TextureSubresource *colorResolveSubresources[MAX_COLOR_TARGET_BINDINGS]; // Compute Pass D3D11ComputePipeline *computePipeline; @@ -634,35 +648,43 @@ typedef struct D3D11CommandBuffer bool needVertexBufferBind; bool needVertexSamplerBind; - bool needVertexResourceBind; + bool needVertexStorageTextureBind; + bool needVertexStorageBufferBind; bool needVertexUniformBufferBind; bool needFragmentSamplerBind; - bool needFragmentResourceBind; + bool needFragmentStorageTextureBind; + bool needFragmentStorageBufferBind; bool needFragmentUniformBufferBind; - bool needComputeUAVBind; - bool needComputeSRVBind; + bool needComputeSamplerBind; + bool needComputeReadOnlyTextureBind; + bool needComputeReadOnlyBufferBind; bool needComputeUniformBufferBind; - ID3D11Buffer *vertexBuffers[MAX_BUFFER_BINDINGS]; - Uint32 vertexBufferOffsets[MAX_BUFFER_BINDINGS]; + // defer OMSetBlendState because it combines three different states + bool needBlendStateSet; + + ID3D11Buffer *vertexBuffers[MAX_VERTEX_BUFFERS]; + Uint32 vertexBufferOffsets[MAX_VERTEX_BUFFERS]; Uint32 vertexBufferCount; - ID3D11SamplerState *vertexSamplers[MAX_TEXTURE_SAMPLERS_PER_STAGE]; - ID3D11ShaderResourceView *vertexShaderResourceViews[MAX_TEXTURE_SAMPLERS_PER_STAGE + - MAX_STORAGE_BUFFERS_PER_STAGE + - MAX_STORAGE_TEXTURES_PER_STAGE]; + D3D11Texture *vertexSamplerTextures[MAX_TEXTURE_SAMPLERS_PER_STAGE]; + D3D11Sampler *vertexSamplers[MAX_TEXTURE_SAMPLERS_PER_STAGE]; + D3D11Texture *vertexStorageTextures[MAX_STORAGE_TEXTURES_PER_STAGE]; + D3D11Buffer *vertexStorageBuffers[MAX_STORAGE_BUFFERS_PER_STAGE]; - ID3D11SamplerState *fragmentSamplers[MAX_TEXTURE_SAMPLERS_PER_STAGE]; - ID3D11ShaderResourceView *fragmentShaderResourceViews[MAX_TEXTURE_SAMPLERS_PER_STAGE + - MAX_STORAGE_BUFFERS_PER_STAGE + - MAX_STORAGE_TEXTURES_PER_STAGE]; + D3D11Texture *fragmentSamplerTextures[MAX_TEXTURE_SAMPLERS_PER_STAGE]; + D3D11Sampler *fragmentSamplers[MAX_TEXTURE_SAMPLERS_PER_STAGE]; + D3D11Texture *fragmentStorageTextures[MAX_STORAGE_TEXTURES_PER_STAGE]; + D3D11Buffer *fragmentStorageBuffers[MAX_STORAGE_BUFFERS_PER_STAGE]; - ID3D11ShaderResourceView *computeShaderResourceViews[MAX_STORAGE_TEXTURES_PER_STAGE + - MAX_STORAGE_BUFFERS_PER_STAGE]; - ID3D11UnorderedAccessView *computeUnorderedAccessViews[MAX_COMPUTE_WRITE_TEXTURES + - MAX_COMPUTE_WRITE_BUFFERS]; + D3D11Texture *computeSamplerTextures[MAX_TEXTURE_SAMPLERS_PER_STAGE]; + D3D11Sampler *computeSamplers[MAX_TEXTURE_SAMPLERS_PER_STAGE]; + D3D11Texture *computeReadOnlyStorageTextures[MAX_STORAGE_TEXTURES_PER_STAGE]; + D3D11Buffer *computeReadOnlyStorageBuffers[MAX_STORAGE_BUFFERS_PER_STAGE]; + D3D11TextureSubresource *computeWriteOnlyStorageTextureSubresources[MAX_COMPUTE_WRITE_TEXTURES]; + D3D11Buffer *computeWriteOnlyStorageBuffers[MAX_COMPUTE_WRITE_BUFFERS]; // Uniform buffers D3D11UniformBuffer *vertexUniformBuffers[MAX_UNIFORM_BUFFERS_PER_STAGE]; @@ -691,11 +713,6 @@ typedef struct D3D11CommandBuffer Uint32 usedUniformBufferCapacity; } D3D11CommandBuffer; -typedef struct D3D11Sampler -{ - ID3D11SamplerState *handle; -} D3D11Sampler; - struct D3D11Renderer { ID3D11Device1 *device; @@ -718,7 +735,7 @@ struct D3D11Renderer SDL_iconv_t iconv; // Blit - BlitPipelineCacheEntry blitPipelines[4]; + BlitPipelineCacheEntry blitPipelines[5]; SDL_GPUSampler *blitNearestSampler; SDL_GPUSampler *blitLinearSampler; @@ -760,20 +777,19 @@ struct D3D11Renderer SDL_Mutex *acquireUniformBufferLock; SDL_Mutex *fenceLock; SDL_Mutex *windowLock; -}; -// Null arrays for resetting shader resource slots + // Null arrays for resetting resource slots + ID3D11RenderTargetView *nullRTVs[MAX_COLOR_TARGET_BINDINGS]; -ID3D11RenderTargetView *nullRTVs[MAX_COLOR_TARGET_BINDINGS]; - -ID3D11ShaderResourceView *nullSRVs[MAX_TEXTURE_SAMPLERS_PER_STAGE + + ID3D11ShaderResourceView *nullSRVs[MAX_TEXTURE_SAMPLERS_PER_STAGE * 2 + MAX_STORAGE_TEXTURES_PER_STAGE + MAX_STORAGE_BUFFERS_PER_STAGE]; -ID3D11SamplerState *nullSamplers[MAX_TEXTURE_SAMPLERS_PER_STAGE]; + ID3D11SamplerState *nullSamplers[MAX_TEXTURE_SAMPLERS_PER_STAGE * 2]; -ID3D11UnorderedAccessView *nullUAVs[MAX_COMPUTE_WRITE_TEXTURES + + ID3D11UnorderedAccessView *nullUAVs[MAX_COMPUTE_WRITE_TEXTURES + MAX_COMPUTE_WRITE_BUFFERS]; +}; // Logging @@ -1067,14 +1083,6 @@ static void D3D11_INTERNAL_DestroyTexture(D3D11Texture *d3d11Texture) } for (Uint32 subresourceIndex = 0; subresourceIndex < d3d11Texture->subresourceCount; subresourceIndex += 1) { - if (d3d11Texture->subresources[subresourceIndex].msaaHandle != NULL) { - ID3D11Resource_Release(d3d11Texture->subresources[subresourceIndex].msaaHandle); - } - - if (d3d11Texture->subresources[subresourceIndex].msaaTargetView != NULL) { - ID3D11RenderTargetView_Release(d3d11Texture->subresources[subresourceIndex].msaaTargetView); - } - if (d3d11Texture->subresources[subresourceIndex].colorTargetViews != NULL) { for (Uint32 depthIndex = 0; depthIndex < d3d11Texture->subresources[subresourceIndex].depth; depthIndex += 1) { ID3D11RenderTargetView_Release(d3d11Texture->subresources[subresourceIndex].colorTargetViews[depthIndex]); @@ -1228,16 +1236,13 @@ static void D3D11_ReleaseGraphicsPipeline( (void)driverData; // used by other backends D3D11GraphicsPipeline *d3d11GraphicsPipeline = (D3D11GraphicsPipeline *)graphicsPipeline; - ID3D11BlendState_Release(d3d11GraphicsPipeline->colorAttachmentBlendState); + ID3D11BlendState_Release(d3d11GraphicsPipeline->colorTargetBlendState); ID3D11DepthStencilState_Release(d3d11GraphicsPipeline->depthStencilState); ID3D11RasterizerState_Release(d3d11GraphicsPipeline->rasterizerState); if (d3d11GraphicsPipeline->inputLayout) { ID3D11InputLayout_Release(d3d11GraphicsPipeline->inputLayout); } - if (d3d11GraphicsPipeline->vertexStrides) { - SDL_free(d3d11GraphicsPipeline->vertexStrides); - } ID3D11VertexShader_Release(d3d11GraphicsPipeline->vertexShader); ID3D11PixelShader_Release(d3d11GraphicsPipeline->fragmentShader); @@ -1249,8 +1254,8 @@ static void D3D11_ReleaseGraphicsPipeline( static ID3D11BlendState *D3D11_INTERNAL_FetchBlendState( D3D11Renderer *renderer, - Uint32 numColorAttachments, - SDL_GPUColorAttachmentDescription *colorAttachments) + Uint32 numColorTargets, + const SDL_GPUColorTargetDescription *colorTargets) { ID3D11BlendState *result; D3D11_BLEND_DESC blendDesc; @@ -1264,15 +1269,19 @@ static ID3D11BlendState *D3D11_INTERNAL_FetchBlendState( blendDesc.AlphaToCoverageEnable = FALSE; blendDesc.IndependentBlendEnable = TRUE; - for (Uint32 i = 0; i < numColorAttachments; i += 1) { - blendDesc.RenderTarget[i].BlendEnable = colorAttachments[i].blendState.blendEnable; - blendDesc.RenderTarget[i].BlendOp = SDLToD3D11_BlendOp[colorAttachments[i].blendState.colorBlendOp]; - blendDesc.RenderTarget[i].BlendOpAlpha = SDLToD3D11_BlendOp[colorAttachments[i].blendState.alphaBlendOp]; - blendDesc.RenderTarget[i].DestBlend = SDLToD3D11_BlendFactor[colorAttachments[i].blendState.dstColorBlendFactor]; - blendDesc.RenderTarget[i].DestBlendAlpha = SDLToD3D11_BlendFactorAlpha[colorAttachments[i].blendState.dstAlphaBlendFactor]; - blendDesc.RenderTarget[i].RenderTargetWriteMask = colorAttachments[i].blendState.colorWriteMask; - blendDesc.RenderTarget[i].SrcBlend = SDLToD3D11_BlendFactor[colorAttachments[i].blendState.srcColorBlendFactor]; - blendDesc.RenderTarget[i].SrcBlendAlpha = SDLToD3D11_BlendFactorAlpha[colorAttachments[i].blendState.srcAlphaBlendFactor]; + for (Uint32 i = 0; i < numColorTargets; i += 1) { + SDL_GPUColorComponentFlags colorWriteMask = colorTargets[i].blend_state.enable_color_write_mask ? + colorTargets[i].blend_state.color_write_mask : + 0xF; + + blendDesc.RenderTarget[i].BlendEnable = colorTargets[i].blend_state.enable_blend; + blendDesc.RenderTarget[i].BlendOp = SDLToD3D11_BlendOp[colorTargets[i].blend_state.color_blend_op]; + blendDesc.RenderTarget[i].BlendOpAlpha = SDLToD3D11_BlendOp[colorTargets[i].blend_state.alpha_blend_op]; + blendDesc.RenderTarget[i].DestBlend = SDLToD3D11_BlendFactor[colorTargets[i].blend_state.dst_color_blendfactor]; + blendDesc.RenderTarget[i].DestBlendAlpha = SDLToD3D11_BlendFactorAlpha[colorTargets[i].blend_state.dst_alpha_blendfactor]; + blendDesc.RenderTarget[i].RenderTargetWriteMask = colorWriteMask; + blendDesc.RenderTarget[i].SrcBlend = SDLToD3D11_BlendFactor[colorTargets[i].blend_state.src_color_blendfactor]; + blendDesc.RenderTarget[i].SrcBlendAlpha = SDLToD3D11_BlendFactorAlpha[colorTargets[i].blend_state.src_alpha_blendfactor]; } res = ID3D11Device_CreateBlendState( @@ -1295,23 +1304,23 @@ static ID3D11DepthStencilState *D3D11_INTERNAL_FetchDepthStencilState( /* Create a new depth-stencil state. * The spec says the driver will not create duplicate states, so there's no need to cache. */ - dsDesc.DepthEnable = depthStencilState.depthTestEnable; - dsDesc.StencilEnable = depthStencilState.stencilTestEnable; - dsDesc.DepthFunc = SDLToD3D11_CompareOp[depthStencilState.compareOp]; - dsDesc.DepthWriteMask = (depthStencilState.depthWriteEnable ? D3D11_DEPTH_WRITE_MASK_ALL : D3D11_DEPTH_WRITE_MASK_ZERO); + dsDesc.DepthEnable = depthStencilState.enable_depth_test; + dsDesc.StencilEnable = depthStencilState.enable_stencil_test; + dsDesc.DepthFunc = SDLToD3D11_CompareOp[depthStencilState.compare_op]; + dsDesc.DepthWriteMask = (depthStencilState.enable_depth_write ? D3D11_DEPTH_WRITE_MASK_ALL : D3D11_DEPTH_WRITE_MASK_ZERO); - dsDesc.BackFace.StencilFunc = SDLToD3D11_CompareOp[depthStencilState.backStencilState.compareOp]; - dsDesc.BackFace.StencilDepthFailOp = SDLToD3D11_StencilOp[depthStencilState.backStencilState.depthFailOp]; - dsDesc.BackFace.StencilFailOp = SDLToD3D11_StencilOp[depthStencilState.backStencilState.failOp]; - dsDesc.BackFace.StencilPassOp = SDLToD3D11_StencilOp[depthStencilState.backStencilState.passOp]; + dsDesc.BackFace.StencilFunc = SDLToD3D11_CompareOp[depthStencilState.back_stencil_state.compare_op]; + dsDesc.BackFace.StencilDepthFailOp = SDLToD3D11_StencilOp[depthStencilState.back_stencil_state.depth_fail_op]; + dsDesc.BackFace.StencilFailOp = SDLToD3D11_StencilOp[depthStencilState.back_stencil_state.fail_op]; + dsDesc.BackFace.StencilPassOp = SDLToD3D11_StencilOp[depthStencilState.back_stencil_state.pass_op]; - dsDesc.FrontFace.StencilFunc = SDLToD3D11_CompareOp[depthStencilState.frontStencilState.compareOp]; - dsDesc.FrontFace.StencilDepthFailOp = SDLToD3D11_StencilOp[depthStencilState.frontStencilState.depthFailOp]; - dsDesc.FrontFace.StencilFailOp = SDLToD3D11_StencilOp[depthStencilState.frontStencilState.failOp]; - dsDesc.FrontFace.StencilPassOp = SDLToD3D11_StencilOp[depthStencilState.frontStencilState.passOp]; + dsDesc.FrontFace.StencilFunc = SDLToD3D11_CompareOp[depthStencilState.front_stencil_state.compare_op]; + dsDesc.FrontFace.StencilDepthFailOp = SDLToD3D11_StencilOp[depthStencilState.front_stencil_state.depth_fail_op]; + dsDesc.FrontFace.StencilFailOp = SDLToD3D11_StencilOp[depthStencilState.front_stencil_state.fail_op]; + dsDesc.FrontFace.StencilPassOp = SDLToD3D11_StencilOp[depthStencilState.front_stencil_state.pass_op]; - dsDesc.StencilReadMask = depthStencilState.compareMask; - dsDesc.StencilWriteMask = depthStencilState.writeMask; + dsDesc.StencilReadMask = depthStencilState.compare_mask; + dsDesc.StencilWriteMask = depthStencilState.write_mask; res = ID3D11Device_CreateDepthStencilState( renderer->device, @@ -1334,15 +1343,15 @@ static ID3D11RasterizerState *D3D11_INTERNAL_FetchRasterizerState( * The spec says the driver will not create duplicate states, so there's no need to cache. */ rasterizerDesc.AntialiasedLineEnable = FALSE; - rasterizerDesc.CullMode = SDLToD3D11_CullMode[rasterizerState.cullMode]; - rasterizerDesc.DepthBias = SDL_lroundf(rasterizerState.depthBiasConstantFactor); - rasterizerDesc.DepthBiasClamp = rasterizerState.depthBiasClamp; + rasterizerDesc.CullMode = SDLToD3D11_CullMode[rasterizerState.cull_mode]; + rasterizerDesc.DepthBias = SDL_lroundf(rasterizerState.depth_bias_constant_factor); + rasterizerDesc.DepthBiasClamp = rasterizerState.depth_bias_clamp; rasterizerDesc.DepthClipEnable = TRUE; - rasterizerDesc.FillMode = (rasterizerState.fillMode == SDL_GPU_FILLMODE_FILL) ? D3D11_FILL_SOLID : D3D11_FILL_WIREFRAME; - rasterizerDesc.FrontCounterClockwise = (rasterizerState.frontFace == SDL_GPU_FRONTFACE_COUNTER_CLOCKWISE); + rasterizerDesc.FillMode = (rasterizerState.fill_mode == SDL_GPU_FILLMODE_FILL) ? D3D11_FILL_SOLID : D3D11_FILL_WIREFRAME; + rasterizerDesc.FrontCounterClockwise = (rasterizerState.front_face == SDL_GPU_FRONTFACE_COUNTER_CLOCKWISE); rasterizerDesc.MultisampleEnable = TRUE; // only applies to MSAA render targets rasterizerDesc.ScissorEnable = TRUE; - rasterizerDesc.SlopeScaledDepthBias = rasterizerState.depthBiasSlopeFactor; + rasterizerDesc.SlopeScaledDepthBias = rasterizerState.depth_bias_slope_factor; res = ID3D11Device_CreateRasterizerState( renderer->device, @@ -1353,18 +1362,18 @@ static ID3D11RasterizerState *D3D11_INTERNAL_FetchRasterizerState( return result; } -static Uint32 D3D11_INTERNAL_FindIndexOfVertexBinding( - Uint32 targetBinding, - const SDL_GPUVertexBinding *bindings, - Uint32 numBindings) +static Uint32 D3D11_INTERNAL_FindIndexOfVertexSlot( + Uint32 targetSlot, + const SDL_GPUVertexBufferDescription *bufferDescriptions, + Uint32 numDescriptions) { - for (Uint32 i = 0; i < numBindings; i += 1) { - if (bindings[i].binding == targetBinding) { + for (Uint32 i = 0; i < numDescriptions; i += 1) { + if (bufferDescriptions[i].slot == targetSlot) { return i; } } - SDL_LogError(SDL_LOG_CATEGORY_GPU, "Could not find vertex binding %u!", targetBinding); + SDL_LogError(SDL_LOG_CATEGORY_GPU, "Could not find vertex buffer slot %u!", targetSlot); return 0; } @@ -1380,37 +1389,39 @@ static ID3D11InputLayout *D3D11_INTERNAL_FetchInputLayout( HRESULT res; // Don't bother creating/fetching an input layout if there are no attributes. - if (inputState.vertexAttributeCount == 0) { + if (inputState.num_vertex_attributes == 0) { return NULL; } // Allocate an array of vertex elements elementDescs = SDL_stack_alloc( D3D11_INPUT_ELEMENT_DESC, - inputState.vertexAttributeCount); + inputState.num_vertex_attributes); // Create the array of input elements - for (Uint32 i = 0; i < inputState.vertexAttributeCount; i += 1) { - elementDescs[i].AlignedByteOffset = inputState.vertexAttributes[i].offset; - elementDescs[i].Format = SDLToD3D11_VertexFormat[inputState.vertexAttributes[i].format]; - elementDescs[i].InputSlot = inputState.vertexAttributes[i].binding; + for (Uint32 i = 0; i < inputState.num_vertex_attributes; i += 1) { + elementDescs[i].AlignedByteOffset = inputState.vertex_attributes[i].offset; + elementDescs[i].Format = SDLToD3D11_VertexFormat[inputState.vertex_attributes[i].format]; + elementDescs[i].InputSlot = inputState.vertex_attributes[i].buffer_slot; - bindingIndex = D3D11_INTERNAL_FindIndexOfVertexBinding( + bindingIndex = D3D11_INTERNAL_FindIndexOfVertexSlot( elementDescs[i].InputSlot, - inputState.vertexBindings, - inputState.vertexBindingCount); - elementDescs[i].InputSlotClass = SDLToD3D11_VertexInputRate[inputState.vertexBindings[bindingIndex].inputRate]; + inputState.vertex_buffer_descriptions, + inputState.num_vertex_buffers); + elementDescs[i].InputSlotClass = SDLToD3D11_VertexInputRate[inputState.vertex_buffer_descriptions[bindingIndex].input_rate]; // The spec requires this to be 0 for per-vertex data - elementDescs[i].InstanceDataStepRate = (inputState.vertexBindings[bindingIndex].inputRate == SDL_GPU_VERTEXINPUTRATE_INSTANCE) ? inputState.vertexBindings[bindingIndex].instanceStepRate : 0; + elementDescs[i].InstanceDataStepRate = (inputState.vertex_buffer_descriptions[bindingIndex].input_rate == SDL_GPU_VERTEXINPUTRATE_INSTANCE) + ? inputState.vertex_buffer_descriptions[bindingIndex].instance_step_rate + : 0; - elementDescs[i].SemanticIndex = inputState.vertexAttributes[i].location; + elementDescs[i].SemanticIndex = inputState.vertex_attributes[i].location; elementDescs[i].SemanticName = "TEXCOORD"; } res = ID3D11Device_CreateInputLayout( renderer->device, elementDescs, - inputState.vertexAttributeCount, + inputState.num_vertex_attributes, shaderBytes, shaderByteLength, &result); @@ -1436,7 +1447,7 @@ static ID3D11DeviceChild *D3D11_INTERNAL_CreateID3D11Shader( Uint32 stage, const Uint8 *code, size_t codeSize, - const char *entryPointName, + const char *entrypointName, void **pBytecode, size_t *pBytecodeSize) { @@ -1490,7 +1501,7 @@ static ID3D11DeviceChild *D3D11_INTERNAL_CreateID3D11Shader( static SDL_GPUComputePipeline *D3D11_CreateComputePipeline( SDL_GPURenderer *driverData, - SDL_GPUComputePipelineCreateInfo *pipelineCreateInfo) + const SDL_GPUComputePipelineCreateInfo *createinfo) { D3D11Renderer *renderer = (D3D11Renderer *)driverData; ID3D11ComputeShader *shader; @@ -1499,9 +1510,9 @@ static SDL_GPUComputePipeline *D3D11_CreateComputePipeline( shader = (ID3D11ComputeShader *)D3D11_INTERNAL_CreateID3D11Shader( renderer, SDL_GPU_SHADERSTAGE_COMPUTE, - pipelineCreateInfo->code, - pipelineCreateInfo->codeSize, - pipelineCreateInfo->entryPointName, + createinfo->code, + createinfo->code_size, + createinfo->entrypoint, NULL, NULL); if (shader == NULL) { @@ -1511,11 +1522,12 @@ static SDL_GPUComputePipeline *D3D11_CreateComputePipeline( pipeline = SDL_malloc(sizeof(D3D11ComputePipeline)); pipeline->computeShader = shader; - pipeline->readOnlyStorageTextureCount = pipelineCreateInfo->readOnlyStorageTextureCount; - pipeline->writeOnlyStorageTextureCount = pipelineCreateInfo->writeOnlyStorageTextureCount; - pipeline->readOnlyStorageBufferCount = pipelineCreateInfo->readOnlyStorageBufferCount; - pipeline->writeOnlyStorageBufferCount = pipelineCreateInfo->writeOnlyStorageBufferCount; - pipeline->uniformBufferCount = pipelineCreateInfo->uniformBufferCount; + pipeline->numSamplers = createinfo->num_samplers; + pipeline->numReadonlyStorageTextures = createinfo->num_readonly_storage_textures; + pipeline->numWriteonlyStorageTextures = createinfo->num_writeonly_storage_textures; + pipeline->numReadonlyStorageBuffers = createinfo->num_readonly_storage_buffers; + pipeline->numWriteonlyStorageBuffers = createinfo->num_writeonly_storage_buffers; + pipeline->numUniformBuffers = createinfo->num_uniform_buffers; // thread counts are ignored in d3d11 return (SDL_GPUComputePipeline *)pipeline; @@ -1523,50 +1535,47 @@ static SDL_GPUComputePipeline *D3D11_CreateComputePipeline( static SDL_GPUGraphicsPipeline *D3D11_CreateGraphicsPipeline( SDL_GPURenderer *driverData, - SDL_GPUGraphicsPipelineCreateInfo *pipelineCreateInfo) + const SDL_GPUGraphicsPipelineCreateInfo *createinfo) { D3D11Renderer *renderer = (D3D11Renderer *)driverData; - D3D11Shader *vertShader = (D3D11Shader *)pipelineCreateInfo->vertexShader; - D3D11Shader *fragShader = (D3D11Shader *)pipelineCreateInfo->fragmentShader; + D3D11Shader *vertShader = (D3D11Shader *)createinfo->vertex_shader; + D3D11Shader *fragShader = (D3D11Shader *)createinfo->fragment_shader; D3D11GraphicsPipeline *pipeline = SDL_malloc(sizeof(D3D11GraphicsPipeline)); // Blend - pipeline->colorAttachmentBlendState = D3D11_INTERNAL_FetchBlendState( + pipeline->colorTargetBlendState = D3D11_INTERNAL_FetchBlendState( renderer, - pipelineCreateInfo->attachmentInfo.colorAttachmentCount, - pipelineCreateInfo->attachmentInfo.colorAttachmentDescriptions); + createinfo->target_info.num_color_targets, + createinfo->target_info.color_target_descriptions); - pipeline->numColorAttachments = pipelineCreateInfo->attachmentInfo.colorAttachmentCount; - for (Sint32 i = 0; i < pipeline->numColorAttachments; i += 1) { - pipeline->colorAttachmentFormats[i] = SDLToD3D11_TextureFormat[pipelineCreateInfo->attachmentInfo.colorAttachmentDescriptions[i].format]; + pipeline->numColorTargets = createinfo->target_info.num_color_targets; + for (Sint32 i = 0; i < pipeline->numColorTargets; i += 1) { + pipeline->colorTargetFormats[i] = SDLToD3D11_TextureFormat[createinfo->target_info.color_target_descriptions[i].format]; } - pipeline->blendConstants[0] = pipelineCreateInfo->blendConstants[0]; - pipeline->blendConstants[1] = pipelineCreateInfo->blendConstants[1]; - pipeline->blendConstants[2] = pipelineCreateInfo->blendConstants[2]; - pipeline->blendConstants[3] = pipelineCreateInfo->blendConstants[3]; - // Multisample - pipeline->multisampleState = pipelineCreateInfo->multisampleState; + pipeline->multisampleState = createinfo->multisample_state; + pipeline->sampleMask = createinfo->multisample_state.enable_mask ? + createinfo->multisample_state.sample_mask : + 0xFFFFFFFF; // Depth-Stencil pipeline->depthStencilState = D3D11_INTERNAL_FetchDepthStencilState( renderer, - pipelineCreateInfo->depthStencilState); + createinfo->depth_stencil_state); - pipeline->hasDepthStencilAttachment = pipelineCreateInfo->attachmentInfo.hasDepthStencilAttachment; - pipeline->depthStencilAttachmentFormat = SDLToD3D11_TextureFormat[pipelineCreateInfo->attachmentInfo.depthStencilFormat]; - pipeline->stencilRef = pipelineCreateInfo->depthStencilState.reference; + pipeline->hasDepthStencilTarget = createinfo->target_info.has_depth_stencil_target; + pipeline->depthStencilTargetFormat = SDLToD3D11_TextureFormat[createinfo->target_info.depth_stencil_format]; // Rasterizer - pipeline->primitiveType = pipelineCreateInfo->primitiveType; + pipeline->primitiveType = createinfo->primitive_type; pipeline->rasterizerState = D3D11_INTERNAL_FetchRasterizerState( renderer, - pipelineCreateInfo->rasterizerState); + createinfo->rasterizer_state); // Shaders @@ -1580,33 +1589,29 @@ static SDL_GPUGraphicsPipeline *D3D11_CreateGraphicsPipeline( pipeline->inputLayout = D3D11_INTERNAL_FetchInputLayout( renderer, - pipelineCreateInfo->vertexInputState, + createinfo->vertex_input_state, vertShader->bytecode, vertShader->bytecodeSize); - if (pipelineCreateInfo->vertexInputState.vertexBindingCount > 0) { - pipeline->vertexStrides = SDL_malloc( - sizeof(Uint32) * - pipelineCreateInfo->vertexInputState.vertexBindingCount); - - for (Uint32 i = 0; i < pipelineCreateInfo->vertexInputState.vertexBindingCount; i += 1) { - pipeline->vertexStrides[i] = pipelineCreateInfo->vertexInputState.vertexBindings[i].stride; + SDL_zeroa(pipeline->vertexStrides); + if (createinfo->vertex_input_state.num_vertex_buffers > 0) { + for (Uint32 i = 0; i < createinfo->vertex_input_state.num_vertex_buffers; i += 1) { + pipeline->vertexStrides[createinfo->vertex_input_state.vertex_buffer_descriptions[i].slot] = + createinfo->vertex_input_state.vertex_buffer_descriptions[i].pitch; } - } else { - pipeline->vertexStrides = NULL; } // Resource layout - pipeline->vertexSamplerCount = vertShader->samplerCount; - pipeline->vertexStorageTextureCount = vertShader->storageTextureCount; - pipeline->vertexStorageBufferCount = vertShader->storageBufferCount; - pipeline->vertexUniformBufferCount = vertShader->uniformBufferCount; + pipeline->vertexSamplerCount = vertShader->numSamplers; + pipeline->vertexStorageTextureCount = vertShader->numStorageTextures; + pipeline->vertexStorageBufferCount = vertShader->numStorageBuffers; + pipeline->vertexUniformBufferCount = vertShader->numUniformBuffers; - pipeline->fragmentSamplerCount = fragShader->samplerCount; - pipeline->fragmentStorageTextureCount = fragShader->storageTextureCount; - pipeline->fragmentStorageBufferCount = fragShader->storageBufferCount; - pipeline->fragmentUniformBufferCount = fragShader->uniformBufferCount; + pipeline->fragmentSamplerCount = fragShader->numSamplers; + pipeline->fragmentStorageTextureCount = fragShader->numStorageTextures; + pipeline->fragmentStorageBufferCount = fragShader->numStorageBuffers; + pipeline->fragmentUniformBufferCount = fragShader->numUniformBuffers; return (SDL_GPUGraphicsPipeline *)pipeline; } @@ -1701,10 +1706,10 @@ static bool D3D11_INTERNAL_StrToWStr( D3D11Renderer *renderer, const char *str, wchar_t *wstr, - size_t wstr_size) + size_t wstrSize) { size_t inlen, result; - size_t outlen = wstr_size; + size_t outlen = wstrSize; if (renderer->iconv == NULL) { renderer->iconv = SDL_iconv_open("WCHAR_T", "UTF-8"); @@ -1787,7 +1792,7 @@ static void D3D11_PopDebugGroup( static SDL_GPUSampler *D3D11_CreateSampler( SDL_GPURenderer *driverData, - SDL_GPUSamplerCreateInfo *samplerCreateInfo) + const SDL_GPUSamplerCreateInfo *createinfo) { D3D11Renderer *renderer = (D3D11Renderer *)driverData; D3D11_SAMPLER_DESC samplerDesc; @@ -1795,15 +1800,15 @@ static SDL_GPUSampler *D3D11_CreateSampler( D3D11Sampler *d3d11Sampler; HRESULT res; - samplerDesc.AddressU = SDLToD3D11_SamplerAddressMode[samplerCreateInfo->addressModeU]; - samplerDesc.AddressV = SDLToD3D11_SamplerAddressMode[samplerCreateInfo->addressModeV]; - samplerDesc.AddressW = SDLToD3D11_SamplerAddressMode[samplerCreateInfo->addressModeW]; - samplerDesc.ComparisonFunc = (samplerCreateInfo->compareEnable ? SDLToD3D11_CompareOp[samplerCreateInfo->compareOp] : SDLToD3D11_CompareOp[SDL_GPU_COMPAREOP_ALWAYS]); - samplerDesc.MaxAnisotropy = (samplerCreateInfo->anisotropyEnable ? (UINT)samplerCreateInfo->maxAnisotropy : 0); - samplerDesc.Filter = SDLToD3D11_Filter(samplerCreateInfo); - samplerDesc.MaxLOD = samplerCreateInfo->maxLod; - samplerDesc.MinLOD = samplerCreateInfo->minLod; - samplerDesc.MipLODBias = samplerCreateInfo->mipLodBias; + samplerDesc.AddressU = SDLToD3D11_SamplerAddressMode[createinfo->address_mode_u]; + samplerDesc.AddressV = SDLToD3D11_SamplerAddressMode[createinfo->address_mode_v]; + samplerDesc.AddressW = SDLToD3D11_SamplerAddressMode[createinfo->address_mode_w]; + samplerDesc.ComparisonFunc = (createinfo->enable_compare ? SDLToD3D11_CompareOp[createinfo->compare_op] : SDLToD3D11_CompareOp[SDL_GPU_COMPAREOP_ALWAYS]); + samplerDesc.MaxAnisotropy = (createinfo->enable_anisotropy ? (UINT)createinfo->max_anisotropy : 0); + samplerDesc.Filter = SDLToD3D11_Filter(createinfo); + samplerDesc.MaxLOD = createinfo->max_lod; + samplerDesc.MinLOD = createinfo->min_lod; + samplerDesc.MipLODBias = createinfo->mip_lod_bias; SDL_zeroa(samplerDesc.BorderColor); // arbitrary, unused res = ID3D11Device_CreateSamplerState( @@ -1820,7 +1825,7 @@ static SDL_GPUSampler *D3D11_CreateSampler( SDL_GPUShader *D3D11_CreateShader( SDL_GPURenderer *driverData, - SDL_GPUShaderCreateInfo *shaderCreateInfo) + const SDL_GPUShaderCreateInfo *createinfo) { D3D11Renderer *renderer = (D3D11Renderer *)driverData; ID3D11DeviceChild *handle; @@ -1830,23 +1835,23 @@ SDL_GPUShader *D3D11_CreateShader( handle = D3D11_INTERNAL_CreateID3D11Shader( renderer, - shaderCreateInfo->stage, - shaderCreateInfo->code, - shaderCreateInfo->codeSize, - shaderCreateInfo->entryPointName, - shaderCreateInfo->stage == SDL_GPU_SHADERSTAGE_VERTEX ? &bytecode : NULL, - shaderCreateInfo->stage == SDL_GPU_SHADERSTAGE_VERTEX ? &bytecodeSize : NULL); + createinfo->stage, + createinfo->code, + createinfo->code_size, + createinfo->entrypoint, + createinfo->stage == SDL_GPU_SHADERSTAGE_VERTEX ? &bytecode : NULL, + createinfo->stage == SDL_GPU_SHADERSTAGE_VERTEX ? &bytecodeSize : NULL); if (!handle) { return NULL; } shader = (D3D11Shader *)SDL_calloc(1, sizeof(D3D11Shader)); shader->handle = handle; - shader->samplerCount = shaderCreateInfo->samplerCount; - shader->storageBufferCount = shaderCreateInfo->storageBufferCount; - shader->storageTextureCount = shaderCreateInfo->storageTextureCount; - shader->uniformBufferCount = shaderCreateInfo->uniformBufferCount; - if (shaderCreateInfo->stage == SDL_GPU_SHADERSTAGE_VERTEX) { + shader->numSamplers = createinfo->num_samplers; + shader->numStorageBuffers = createinfo->num_storage_buffers; + shader->numStorageTextures = createinfo->num_storage_textures; + shader->numUniformBuffers = createinfo->num_uniform_buffers; + if (createinfo->stage == SDL_GPU_SHADERSTAGE_VERTEX) { // Store the raw bytecode and its length for creating InputLayouts shader->bytecode = bytecode; shader->bytecodeSize = bytecodeSize; @@ -1857,7 +1862,7 @@ SDL_GPUShader *D3D11_CreateShader( static D3D11Texture *D3D11_INTERNAL_CreateTexture( D3D11Renderer *renderer, - SDL_GPUTextureCreateInfo *createInfo, + const SDL_GPUTextureCreateInfo *createInfo, D3D11_SUBRESOURCE_DATA *initialData) { Uint8 needsSRV, isColorTarget, isDepthStencil, isMultisample, isStaging, needSubresourceUAV, isMippable; @@ -1867,27 +1872,27 @@ static D3D11Texture *D3D11_INTERNAL_CreateTexture( D3D11Texture *d3d11Texture; HRESULT res; - isColorTarget = createInfo->usageFlags & SDL_GPU_TEXTUREUSAGE_COLOR_TARGET; - isDepthStencil = createInfo->usageFlags & SDL_GPU_TEXTUREUSAGE_DEPTH_STENCIL_TARGET; + isColorTarget = createInfo->usage & SDL_GPU_TEXTUREUSAGE_COLOR_TARGET; + isDepthStencil = createInfo->usage & SDL_GPU_TEXTUREUSAGE_DEPTH_STENCIL_TARGET; needsSRV = - (createInfo->usageFlags & SDL_GPU_TEXTUREUSAGE_SAMPLER) || - (createInfo->usageFlags & SDL_GPU_TEXTUREUSAGE_GRAPHICS_STORAGE_READ) || - (createInfo->usageFlags & SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_READ); + (createInfo->usage & SDL_GPU_TEXTUREUSAGE_SAMPLER) || + (createInfo->usage & SDL_GPU_TEXTUREUSAGE_GRAPHICS_STORAGE_READ) || + (createInfo->usage & SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_READ); needSubresourceUAV = - (createInfo->usageFlags & SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_WRITE); - isMultisample = createInfo->sampleCount > SDL_GPU_SAMPLECOUNT_1; - isStaging = createInfo->usageFlags == 0; + (createInfo->usage & SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_WRITE); + isMultisample = createInfo->sample_count > SDL_GPU_SAMPLECOUNT_1; + isStaging = createInfo->usage == 0; isMippable = - createInfo->levelCount > 1 && - (createInfo->usageFlags & SDL_GPU_TEXTUREUSAGE_SAMPLER) && - (createInfo->usageFlags & SDL_GPU_TEXTUREUSAGE_COLOR_TARGET); + createInfo->num_levels > 1 && + (createInfo->usage & SDL_GPU_TEXTUREUSAGE_SAMPLER) && + (createInfo->usage & SDL_GPU_TEXTUREUSAGE_COLOR_TARGET); format = SDLToD3D11_TextureFormat[createInfo->format]; if (isDepthStencil) { format = D3D11_INTERNAL_GetTypelessFormat(format); } - Uint32 layerCount = createInfo->type == SDL_GPU_TEXTURETYPE_3D ? 1 : createInfo->layerCountOrDepth; - Uint32 depth = createInfo->type == SDL_GPU_TEXTURETYPE_3D ? createInfo->layerCountOrDepth : 1; + Uint32 layerCount = createInfo->type == SDL_GPU_TEXTURETYPE_3D ? 1 : createInfo->layer_count_or_depth; + Uint32 depth = createInfo->type == SDL_GPU_TEXTURETYPE_3D ? createInfo->layer_count_or_depth : 1; if (createInfo->type != SDL_GPU_TEXTURETYPE_3D) { D3D11_TEXTURE2D_DESC desc2D; @@ -1911,13 +1916,13 @@ static D3D11Texture *D3D11_INTERNAL_CreateTexture( desc2D.ArraySize = layerCount; desc2D.CPUAccessFlags = isStaging ? D3D11_CPU_ACCESS_WRITE : 0; desc2D.Format = format; - desc2D.MipLevels = createInfo->levelCount; + desc2D.MipLevels = createInfo->num_levels; desc2D.MiscFlags = 0; - desc2D.SampleDesc.Count = 1; - desc2D.SampleDesc.Quality = 0; + desc2D.SampleDesc.Count = SDLToD3D11_SampleCount[createInfo->sample_count]; + desc2D.SampleDesc.Quality = isMultisample ? D3D11_STANDARD_MULTISAMPLE_PATTERN : 0; desc2D.Usage = isStaging ? D3D11_USAGE_STAGING : D3D11_USAGE_DEFAULT; - if (createInfo->type == SDL_GPU_TEXTURETYPE_CUBE) { + if (createInfo->type == SDL_GPU_TEXTURETYPE_CUBE || createInfo->type == SDL_GPU_TEXTURETYPE_CUBE_ARRAY) { desc2D.MiscFlags |= D3D11_RESOURCE_MISC_TEXTURECUBE; } if (isMippable) { @@ -1940,6 +1945,12 @@ static D3D11Texture *D3D11_INTERNAL_CreateTexture( srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURECUBE; srvDesc.TextureCube.MipLevels = desc2D.MipLevels; srvDesc.TextureCube.MostDetailedMip = 0; + } else if (createInfo->type == SDL_GPU_TEXTURETYPE_CUBE_ARRAY) { + srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURECUBEARRAY; + srvDesc.TextureCubeArray.MipLevels = desc2D.MipLevels; + srvDesc.TextureCubeArray.MostDetailedMip = 0; + srvDesc.TextureCubeArray.First2DArrayFace = 0; + srvDesc.TextureCubeArray.NumCubes = layerCount / 6; } else if (createInfo->type == SDL_GPU_TEXTURETYPE_2D_ARRAY) { srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2DARRAY; srvDesc.Texture2DArray.MipLevels = desc2D.MipLevels; @@ -1982,7 +1993,7 @@ static D3D11Texture *D3D11_INTERNAL_CreateTexture( desc3D.Depth = depth; desc3D.CPUAccessFlags = isStaging ? D3D11_CPU_ACCESS_WRITE : 0; desc3D.Format = format; - desc3D.MipLevels = createInfo->levelCount; + desc3D.MipLevels = createInfo->num_levels; desc3D.MiscFlags = isMippable ? D3D11_RESOURCE_MISC_GENERATE_MIPS : 0; desc3D.Usage = isStaging ? D3D11_USAGE_STAGING : D3D11_USAGE_DEFAULT; @@ -2017,20 +2028,20 @@ static D3D11Texture *D3D11_INTERNAL_CreateTexture( d3d11Texture = (D3D11Texture *)SDL_malloc(sizeof(D3D11Texture)); d3d11Texture->handle = textureHandle; d3d11Texture->shaderView = srv; - SDL_AtomicSet(&d3d11Texture->referenceCount, 0); + SDL_SetAtomicInt(&d3d11Texture->referenceCount, 0); d3d11Texture->container = NULL; d3d11Texture->containerIndex = 0; - d3d11Texture->subresourceCount = createInfo->levelCount * layerCount; + d3d11Texture->subresourceCount = createInfo->num_levels * layerCount; d3d11Texture->subresources = SDL_malloc( d3d11Texture->subresourceCount * sizeof(D3D11TextureSubresource)); for (Uint32 layerIndex = 0; layerIndex < layerCount; layerIndex += 1) { - for (Uint32 levelIndex = 0; levelIndex < createInfo->levelCount; levelIndex += 1) { + for (Uint32 levelIndex = 0; levelIndex < createInfo->num_levels; levelIndex += 1) { Uint32 subresourceIndex = D3D11_INTERNAL_CalcSubresource( levelIndex, layerIndex, - createInfo->levelCount); + createInfo->num_levels); d3d11Texture->subresources[subresourceIndex].parent = d3d11Texture; d3d11Texture->subresources[subresourceIndex].layer = layerIndex; @@ -2041,54 +2052,10 @@ static D3D11Texture *D3D11_INTERNAL_CreateTexture( d3d11Texture->subresources[subresourceIndex].colorTargetViews = NULL; d3d11Texture->subresources[subresourceIndex].uav = NULL; d3d11Texture->subresources[subresourceIndex].depthStencilTargetView = NULL; - d3d11Texture->subresources[subresourceIndex].msaaHandle = NULL; - d3d11Texture->subresources[subresourceIndex].msaaTargetView = NULL; - - if (isMultisample) { - D3D11_TEXTURE2D_DESC desc2D; - - if (isColorTarget) { - desc2D.BindFlags = D3D11_BIND_RENDER_TARGET; - } else if (isDepthStencil) { - desc2D.BindFlags = D3D11_BIND_DEPTH_STENCIL; - } - - desc2D.Width = createInfo->width; - desc2D.Height = createInfo->height; - desc2D.ArraySize = 1; - desc2D.CPUAccessFlags = 0; - desc2D.Format = format; - desc2D.MipLevels = 1; - desc2D.MiscFlags = 0; - desc2D.SampleDesc.Count = SDLToD3D11_SampleCount[createInfo->sampleCount]; - desc2D.SampleDesc.Quality = (UINT)D3D11_STANDARD_MULTISAMPLE_PATTERN; - desc2D.Usage = D3D11_USAGE_DEFAULT; - - res = ID3D11Device_CreateTexture2D( - renderer->device, - &desc2D, - NULL, - (ID3D11Texture2D **)&d3d11Texture->subresources[subresourceIndex].msaaHandle); - ERROR_CHECK_RETURN("Could not create MSAA texture!", NULL); - - if (!isDepthStencil) { - D3D11_RENDER_TARGET_VIEW_DESC rtvDesc; - - rtvDesc.Format = format; - rtvDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2DMS; - - res = ID3D11Device_CreateRenderTargetView( - renderer->device, - d3d11Texture->subresources[subresourceIndex].msaaHandle, - &rtvDesc, - &d3d11Texture->subresources[subresourceIndex].msaaTargetView); - ERROR_CHECK_RETURN("Could not create MSAA RTV!", NULL); - } - } if (isDepthStencil) { - D3D11_DEPTH_STENCIL_VIEW_DESC dsvDesc; + D3D11_DEPTH_STENCIL_VIEW_DESC dsvDesc; dsvDesc.Format = SDLToD3D11_TextureFormat[createInfo->format]; dsvDesc.Flags = 0; @@ -2101,31 +2068,42 @@ static D3D11Texture *D3D11_INTERNAL_CreateTexture( res = ID3D11Device_CreateDepthStencilView( renderer->device, - isMultisample ? d3d11Texture->subresources[subresourceIndex].msaaHandle : d3d11Texture->handle, + d3d11Texture->handle, &dsvDesc, &d3d11Texture->subresources[subresourceIndex].depthStencilTargetView); ERROR_CHECK_RETURN("Could not create DSV!", NULL); + } else if (isColorTarget) { + d3d11Texture->subresources[subresourceIndex].colorTargetViews = SDL_calloc(depth, sizeof(ID3D11RenderTargetView *)); for (Uint32 depthIndex = 0; depthIndex < depth; depthIndex += 1) { D3D11_RENDER_TARGET_VIEW_DESC rtvDesc; - rtvDesc.Format = SDLToD3D11_TextureFormat[createInfo->format]; - if (createInfo->type == SDL_GPU_TEXTURETYPE_2D_ARRAY || createInfo->type == SDL_GPU_TEXTURETYPE_CUBE) { - rtvDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2DARRAY; - rtvDesc.Texture2DArray.MipSlice = levelIndex; - rtvDesc.Texture2DArray.FirstArraySlice = layerIndex; - rtvDesc.Texture2DArray.ArraySize = 1; - } else if (createInfo->type == SDL_GPU_TEXTURETYPE_3D) { - rtvDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE3D; - rtvDesc.Texture3D.MipSlice = levelIndex; - rtvDesc.Texture3D.FirstWSlice = depthIndex; - rtvDesc.Texture3D.WSize = 1; + if (isMultisample) { + if (createInfo->type == SDL_GPU_TEXTURETYPE_2D) { + rtvDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2DMS; + } else if (createInfo->type == SDL_GPU_TEXTURETYPE_2D_ARRAY) { + rtvDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2DMSARRAY; + rtvDesc.Texture2DMSArray.FirstArraySlice = layerIndex; + rtvDesc.Texture2DMSArray.ArraySize = 1; + } } else { - rtvDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D; - rtvDesc.Texture2D.MipSlice = levelIndex; + if (createInfo->type == SDL_GPU_TEXTURETYPE_2D_ARRAY || createInfo->type == SDL_GPU_TEXTURETYPE_CUBE || createInfo->type == SDL_GPU_TEXTURETYPE_CUBE_ARRAY) { + rtvDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2DARRAY; + rtvDesc.Texture2DArray.MipSlice = levelIndex; + rtvDesc.Texture2DArray.FirstArraySlice = layerIndex; + rtvDesc.Texture2DArray.ArraySize = 1; + } else if (createInfo->type == SDL_GPU_TEXTURETYPE_3D) { + rtvDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE3D; + rtvDesc.Texture3D.MipSlice = levelIndex; + rtvDesc.Texture3D.FirstWSlice = depthIndex; + rtvDesc.Texture3D.WSize = 1; + } else { + rtvDesc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D; + rtvDesc.Texture2D.MipSlice = levelIndex; + } } res = ID3D11Device_CreateRenderTargetView( @@ -2141,7 +2119,7 @@ static D3D11Texture *D3D11_INTERNAL_CreateTexture( D3D11_UNORDERED_ACCESS_VIEW_DESC uavDesc; uavDesc.Format = format; - if (createInfo->type == SDL_GPU_TEXTURETYPE_2D_ARRAY || createInfo->type == SDL_GPU_TEXTURETYPE_CUBE) { + if (createInfo->type == SDL_GPU_TEXTURETYPE_2D_ARRAY || createInfo->type == SDL_GPU_TEXTURETYPE_CUBE || createInfo->type == SDL_GPU_TEXTURETYPE_CUBE_ARRAY) { uavDesc.ViewDimension = D3D11_UAV_DIMENSION_TEXTURE2DARRAY; uavDesc.Texture2DArray.MipSlice = levelIndex; uavDesc.Texture2DArray.FirstArraySlice = layerIndex; @@ -2188,7 +2166,7 @@ static bool D3D11_SupportsSampleCount( static SDL_GPUTexture *D3D11_CreateTexture( SDL_GPURenderer *driverData, - SDL_GPUTextureCreateInfo *textureCreateInfo) + const SDL_GPUTextureCreateInfo *createinfo) { D3D11Renderer *renderer = (D3D11Renderer *)driverData; D3D11TextureContainer *container; @@ -2196,7 +2174,7 @@ static SDL_GPUTexture *D3D11_CreateTexture( texture = D3D11_INTERNAL_CreateTexture( renderer, - textureCreateInfo, + createinfo, NULL); if (texture == NULL) { @@ -2205,7 +2183,7 @@ static SDL_GPUTexture *D3D11_CreateTexture( } container = SDL_malloc(sizeof(D3D11TextureContainer)); - container->header.info = *textureCreateInfo; + container->header.info = *createinfo; container->canBeCycled = 1; container->activeTexture = texture; container->textureCapacity = 1; @@ -2226,7 +2204,7 @@ static void D3D11_INTERNAL_CycleActiveTexture( D3D11TextureContainer *container) { for (Uint32 i = 0; i < container->textureCount; i += 1) { - if (SDL_AtomicGet(&container->textures[i]->referenceCount) == 0) { + if (SDL_GetAtomicInt(&container->textures[i]->referenceCount) == 0) { container->activeTexture = container->textures[i]; return; } @@ -2273,7 +2251,7 @@ static D3D11TextureSubresource *D3D11_INTERNAL_FetchTextureSubresource( Uint32 index = D3D11_INTERNAL_CalcSubresource( level, layer, - container->header.info.levelCount); + container->header.info.num_levels); return &container->activeTexture->subresources[index]; } @@ -2292,7 +2270,7 @@ static D3D11TextureSubresource *D3D11_INTERNAL_PrepareTextureSubresourceForWrite if ( container->canBeCycled && cycle && - SDL_AtomicGet(&subresource->parent->referenceCount) > 0) { + SDL_GetAtomicInt(&subresource->parent->referenceCount) > 0) { D3D11_INTERNAL_CycleActiveTexture( renderer, container); @@ -2309,7 +2287,7 @@ static D3D11TextureSubresource *D3D11_INTERNAL_PrepareTextureSubresourceForWrite static D3D11Buffer *D3D11_INTERNAL_CreateBuffer( D3D11Renderer *renderer, D3D11_BUFFER_DESC *bufferDesc, - Uint32 sizeInBytes) + Uint32 size) { ID3D11Buffer *bufferHandle; ID3D11UnorderedAccessView *uav = NULL; @@ -2318,7 +2296,7 @@ static D3D11Buffer *D3D11_INTERNAL_CreateBuffer( HRESULT res; // Storage buffers have to be 4-aligned, so might as well align them all - sizeInBytes = D3D11_INTERNAL_NextHighestAlignment(sizeInBytes, 4); + size = D3D11_INTERNAL_NextHighestAlignment(size, 4); res = ID3D11Device_CreateBuffer( renderer->device, @@ -2335,7 +2313,7 @@ static D3D11Buffer *D3D11_INTERNAL_CreateBuffer( uavDesc.Format = DXGI_FORMAT_R32_TYPELESS; uavDesc.ViewDimension = D3D11_UAV_DIMENSION_BUFFER; uavDesc.Buffer.FirstElement = 0; - uavDesc.Buffer.NumElements = sizeInBytes / sizeof(Uint32); + uavDesc.Buffer.NumElements = size / sizeof(Uint32); uavDesc.Buffer.Flags = D3D11_BUFFER_UAV_FLAG_RAW; res = ID3D11Device_CreateUnorderedAccessView( @@ -2354,7 +2332,7 @@ static D3D11Buffer *D3D11_INTERNAL_CreateBuffer( srvDesc.Format = DXGI_FORMAT_R32_TYPELESS; srvDesc.ViewDimension = D3D11_SRV_DIMENSION_BUFFEREX; srvDesc.BufferEx.FirstElement = 0; - srvDesc.BufferEx.NumElements = sizeInBytes / sizeof(Uint32); + srvDesc.BufferEx.NumElements = size / sizeof(Uint32); srvDesc.BufferEx.Flags = D3D11_BUFFEREX_SRV_FLAG_RAW; res = ID3D11Device_CreateShaderResourceView( @@ -2370,10 +2348,10 @@ static D3D11Buffer *D3D11_INTERNAL_CreateBuffer( d3d11Buffer = SDL_malloc(sizeof(D3D11Buffer)); d3d11Buffer->handle = bufferHandle; - d3d11Buffer->size = sizeInBytes; + d3d11Buffer->size = size; d3d11Buffer->uav = uav; d3d11Buffer->srv = srv; - SDL_AtomicSet(&d3d11Buffer->referenceCount, 0); + SDL_SetAtomicInt(&d3d11Buffer->referenceCount, 0); return d3d11Buffer; } @@ -2381,7 +2359,7 @@ static D3D11Buffer *D3D11_INTERNAL_CreateBuffer( static SDL_GPUBuffer *D3D11_CreateBuffer( SDL_GPURenderer *driverData, SDL_GPUBufferUsageFlags usageFlags, - Uint32 sizeInBytes) + Uint32 size) { D3D11Renderer *renderer = (D3D11Renderer *)driverData; D3D11BufferContainer *container; @@ -2405,7 +2383,7 @@ static SDL_GPUBuffer *D3D11_CreateBuffer( bufferDesc.BindFlags |= D3D11_BIND_UNORDERED_ACCESS | D3D11_BIND_SHADER_RESOURCE; } - bufferDesc.ByteWidth = sizeInBytes; + bufferDesc.ByteWidth = size; bufferDesc.Usage = D3D11_USAGE_DEFAULT; bufferDesc.CPUAccessFlags = 0; bufferDesc.StructureByteStride = 0; @@ -2423,7 +2401,7 @@ static SDL_GPUBuffer *D3D11_CreateBuffer( buffer = D3D11_INTERNAL_CreateBuffer( renderer, &bufferDesc, - sizeInBytes); + size); if (buffer == NULL) { SDL_LogError(SDL_LOG_CATEGORY_GPU, "Failed to create buffer!"); @@ -2445,7 +2423,7 @@ static SDL_GPUBuffer *D3D11_CreateBuffer( static D3D11UniformBuffer *D3D11_INTERNAL_CreateUniformBuffer( D3D11Renderer *renderer, - Uint32 sizeInBytes) + Uint32 size) { D3D11UniformBuffer *uniformBuffer; ID3D11Buffer *buffer; @@ -2453,7 +2431,7 @@ static D3D11UniformBuffer *D3D11_INTERNAL_CreateUniformBuffer( HRESULT res; bufferDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER; - bufferDesc.ByteWidth = sizeInBytes; + bufferDesc.ByteWidth = size; bufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; bufferDesc.MiscFlags = 0; bufferDesc.StructureByteStride = 0; @@ -2482,7 +2460,7 @@ static void D3D11_INTERNAL_CycleActiveBuffer( Uint32 size = container->activeBuffer->size; for (Uint32 i = 0; i < container->bufferCount; i += 1) { - if (SDL_AtomicGet(&container->buffers[i]->referenceCount) == 0) { + if (SDL_GetAtomicInt(&container->buffers[i]->referenceCount) == 0) { container->activeBuffer = container->buffers[i]; return; } @@ -2518,7 +2496,7 @@ static D3D11Buffer *D3D11_INTERNAL_PrepareBufferForWrite( { if ( cycle && - SDL_AtomicGet(&container->activeBuffer->referenceCount) > 0) { + SDL_GetAtomicInt(&container->activeBuffer->referenceCount) > 0) { D3D11_INTERNAL_CycleActiveBuffer( renderer, container); @@ -2529,13 +2507,13 @@ static D3D11Buffer *D3D11_INTERNAL_PrepareBufferForWrite( static D3D11TransferBuffer *D3D11_INTERNAL_CreateTransferBuffer( D3D11Renderer *renderer, - Uint32 sizeInBytes) + Uint32 size) { D3D11TransferBuffer *transferBuffer = SDL_malloc(sizeof(D3D11TransferBuffer)); - transferBuffer->data = (Uint8 *)SDL_malloc(sizeInBytes); - transferBuffer->size = sizeInBytes; - SDL_AtomicSet(&transferBuffer->referenceCount, 0); + transferBuffer->data = (Uint8 *)SDL_malloc(size); + transferBuffer->size = size; + SDL_SetAtomicInt(&transferBuffer->referenceCount, 0); transferBuffer->bufferDownloads = NULL; transferBuffer->bufferDownloadCount = 0; @@ -2552,7 +2530,7 @@ static D3D11TransferBuffer *D3D11_INTERNAL_CreateTransferBuffer( static SDL_GPUTransferBuffer *D3D11_CreateTransferBuffer( SDL_GPURenderer *driverData, SDL_GPUTransferBufferUsage usage, // ignored on D3D11 - Uint32 sizeInBytes) + Uint32 size) { D3D11Renderer *renderer = (D3D11Renderer *)driverData; D3D11TransferBufferContainer *container = (D3D11TransferBufferContainer *)SDL_malloc(sizeof(D3D11TransferBufferContainer)); @@ -2564,7 +2542,7 @@ static SDL_GPUTransferBuffer *D3D11_CreateTransferBuffer( container->buffers[0] = D3D11_INTERNAL_CreateTransferBuffer( renderer, - sizeInBytes); + size); container->activeBuffer = container->buffers[0]; @@ -2580,7 +2558,7 @@ static void D3D11_INTERNAL_CycleActiveTransferBuffer( Uint32 size = container->activeBuffer->size; for (Uint32 i = 0; i < container->bufferCount; i += 1) { - if (SDL_AtomicGet(&container->buffers[i]->referenceCount) == 0) { + if (SDL_GetAtomicInt(&container->buffers[i]->referenceCount) == 0) { container->activeBuffer = container->buffers[i]; return; } @@ -2613,7 +2591,7 @@ static void *D3D11_MapTransferBuffer( // Rotate the transfer buffer if necessary if ( cycle && - SDL_AtomicGet(&container->activeBuffer->referenceCount) > 0) { + SDL_GetAtomicInt(&container->activeBuffer->referenceCount) > 0) { D3D11_INTERNAL_CycleActiveTransferBuffer( renderer, container); @@ -2642,18 +2620,18 @@ static void D3D11_BeginCopyPass( static void D3D11_UploadToTexture( SDL_GPUCommandBuffer *commandBuffer, - SDL_GPUTextureTransferInfo *source, - SDL_GPUTextureRegion *destination, + const SDL_GPUTextureTransferInfo *source, + const SDL_GPUTextureRegion *destination, bool cycle) { D3D11CommandBuffer *d3d11CommandBuffer = (D3D11CommandBuffer *)commandBuffer; D3D11Renderer *renderer = (D3D11Renderer *)d3d11CommandBuffer->renderer; - D3D11TransferBufferContainer *srcTransferContainer = (D3D11TransferBufferContainer *)source->transferBuffer; + D3D11TransferBufferContainer *srcTransferContainer = (D3D11TransferBufferContainer *)source->transfer_buffer; D3D11TransferBuffer *srcTransferBuffer = srcTransferContainer->activeBuffer; D3D11TextureContainer *dstTextureContainer = (D3D11TextureContainer *)destination->texture; SDL_GPUTextureFormat dstFormat = dstTextureContainer->header.info.format; - Uint32 bufferStride = source->imagePitch; - Uint32 bufferImageHeight = source->imageHeight; + Uint32 bufferStride = source->pixels_per_row; + Uint32 bufferImageHeight = source->rows_per_layer; Sint32 w = destination->w; Sint32 h = destination->h; D3D11Texture *stagingTexture; @@ -2664,7 +2642,7 @@ static void D3D11_UploadToTexture( renderer, dstTextureContainer, destination->layer, - destination->mipLevel, + destination->mip_level, cycle); Sint32 blockSize = Texture_GetBlockSize(dstFormat); @@ -2691,11 +2669,11 @@ static void D3D11_UploadToTexture( stagingTextureCreateInfo.width = w; stagingTextureCreateInfo.height = h; - stagingTextureCreateInfo.layerCountOrDepth = 1; - stagingTextureCreateInfo.levelCount = 1; + stagingTextureCreateInfo.layer_count_or_depth = 1; + stagingTextureCreateInfo.num_levels = 1; stagingTextureCreateInfo.type = SDL_GPU_TEXTURETYPE_2D; - stagingTextureCreateInfo.usageFlags = 0; - stagingTextureCreateInfo.sampleCount = SDL_GPU_SAMPLECOUNT_1; + stagingTextureCreateInfo.usage = 0; + stagingTextureCreateInfo.sample_count = SDL_GPU_SAMPLECOUNT_1; stagingTextureCreateInfo.format = dstFormat; initialData.pSysMem = srcTransferBuffer->data + source->offset; @@ -2732,13 +2710,13 @@ static void D3D11_UploadToTexture( static void D3D11_UploadToBuffer( SDL_GPUCommandBuffer *commandBuffer, - SDL_GPUTransferBufferLocation *source, - SDL_GPUBufferRegion *destination, + const SDL_GPUTransferBufferLocation *source, + const SDL_GPUBufferRegion *destination, bool cycle) { D3D11CommandBuffer *d3d11CommandBuffer = (D3D11CommandBuffer *)commandBuffer; D3D11Renderer *renderer = (D3D11Renderer *)d3d11CommandBuffer->renderer; - D3D11TransferBufferContainer *transferContainer = (D3D11TransferBufferContainer *)source->transferBuffer; + D3D11TransferBufferContainer *transferContainer = (D3D11TransferBufferContainer *)source->transfer_buffer; D3D11TransferBuffer *d3d11TransferBuffer = transferContainer->activeBuffer; D3D11BufferContainer *bufferContainer = (D3D11BufferContainer *)destination->buffer; D3D11Buffer *d3d11Buffer = D3D11_INTERNAL_PrepareBufferForWrite( @@ -2789,12 +2767,12 @@ static void D3D11_UploadToBuffer( static void D3D11_DownloadFromTexture( SDL_GPUCommandBuffer *commandBuffer, - SDL_GPUTextureRegion *source, - SDL_GPUTextureTransferInfo *destination) + const SDL_GPUTextureRegion *source, + const SDL_GPUTextureTransferInfo *destination) { D3D11CommandBuffer *d3d11CommandBuffer = (D3D11CommandBuffer *)commandBuffer; D3D11Renderer *renderer = d3d11CommandBuffer->renderer; - D3D11TransferBufferContainer *dstTransferContainer = (D3D11TransferBufferContainer *)destination->transferBuffer; + D3D11TransferBufferContainer *dstTransferContainer = (D3D11TransferBufferContainer *)destination->transfer_buffer; D3D11TransferBuffer *d3d11TransferBuffer = dstTransferContainer->activeBuffer; D3D11TextureContainer *srcTextureContainer = (D3D11TextureContainer *)source->texture; SDL_GPUTextureFormat srcFormat = srcTextureContainer->header.info.format; @@ -2803,10 +2781,10 @@ static void D3D11_DownloadFromTexture( D3D11TextureSubresource *textureSubresource = D3D11_INTERNAL_FetchTextureSubresource( srcTextureContainer, source->layer, - source->mipLevel); + source->mip_level); D3D11TextureDownload *textureDownload; - Uint32 bufferStride = destination->imagePitch; - Uint32 bufferImageHeight = destination->imageHeight; + Uint32 bufferStride = destination->pixels_per_row; + Uint32 bufferImageHeight = destination->rows_per_layer; Uint32 bytesPerRow, bytesPerDepthSlice; D3D11_BOX srcBox = { source->x, source->y, source->z, source->x + source->w, source->y + source->h, source->z + source->d }; HRESULT res; @@ -2894,12 +2872,12 @@ static void D3D11_DownloadFromTexture( static void D3D11_DownloadFromBuffer( SDL_GPUCommandBuffer *commandBuffer, - SDL_GPUBufferRegion *source, - SDL_GPUTransferBufferLocation *destination) + const SDL_GPUBufferRegion *source, + const SDL_GPUTransferBufferLocation *destination) { D3D11CommandBuffer *d3d11CommandBuffer = (D3D11CommandBuffer *)commandBuffer; D3D11Renderer *renderer = d3d11CommandBuffer->renderer; - D3D11TransferBufferContainer *dstTransferContainer = (D3D11TransferBufferContainer *)destination->transferBuffer; + D3D11TransferBufferContainer *dstTransferContainer = (D3D11TransferBufferContainer *)destination->transfer_buffer; D3D11TransferBuffer *d3d11TransferBuffer = dstTransferContainer->activeBuffer; D3D11BufferContainer *srcBufferContainer = (D3D11BufferContainer *)source->buffer; D3D11BufferDownload *bufferDownload; @@ -2952,8 +2930,8 @@ static void D3D11_DownloadFromBuffer( static void D3D11_CopyTextureToTexture( SDL_GPUCommandBuffer *commandBuffer, - SDL_GPUTextureLocation *source, - SDL_GPUTextureLocation *destination, + const SDL_GPUTextureLocation *source, + const SDL_GPUTextureLocation *destination, Uint32 w, Uint32 h, Uint32 d, @@ -2969,13 +2947,13 @@ static void D3D11_CopyTextureToTexture( D3D11TextureSubresource *srcSubresource = D3D11_INTERNAL_FetchTextureSubresource( srcContainer, source->layer, - source->mipLevel); + source->mip_level); D3D11TextureSubresource *dstSubresource = D3D11_INTERNAL_PrepareTextureSubresourceForWrite( renderer, dstContainer, destination->layer, - destination->mipLevel, + destination->mip_level, cycle); ID3D11DeviceContext1_CopySubresourceRegion( @@ -2995,8 +2973,8 @@ static void D3D11_CopyTextureToTexture( static void D3D11_CopyBufferToBuffer( SDL_GPUCommandBuffer *commandBuffer, - SDL_GPUBufferLocation *source, - SDL_GPUBufferLocation *destination, + const SDL_GPUBufferLocation *source, + const SDL_GPUBufferLocation *destination, Uint32 size, bool cycle) { @@ -3148,7 +3126,7 @@ static bool D3D11_INTERNAL_CreateFence( fence = SDL_malloc(sizeof(D3D11Fence)); fence->handle = queryHandle; - SDL_AtomicSet(&fence->referenceCount, 0); + SDL_SetAtomicInt(&fence->referenceCount, 0); // Add it to the available pool if (renderer->availableFenceCount >= renderer->availableFenceCapacity) { @@ -3205,12 +3183,15 @@ static SDL_GPUCommandBuffer *D3D11_AcquireCommandBuffer( commandBuffer = D3D11_INTERNAL_GetInactiveCommandBufferFromPool(renderer); commandBuffer->graphicsPipeline = NULL; + commandBuffer->stencilRef = 0; + commandBuffer->blendConstants.r = 1.0f; + commandBuffer->blendConstants.g = 1.0f; + commandBuffer->blendConstants.b = 1.0f; + commandBuffer->blendConstants.a = 1.0f; commandBuffer->computePipeline = NULL; for (i = 0; i < MAX_COLOR_TARGET_BINDINGS; i += 1) { - commandBuffer->colorTargetResolveTexture[i] = NULL; - commandBuffer->colorTargetResolveSubresourceIndex[i] = 0; - commandBuffer->colorTargetMsaaHandle[i] = NULL; - commandBuffer->colorTargetMsaaFormat[i] = DXGI_FORMAT_UNKNOWN; + commandBuffer->colorTargetSubresources[i] = NULL; + commandBuffer->colorResolveSubresources[i] = NULL; } for (i = 0; i < MAX_UNIFORM_BUFFERS_PER_STAGE; i += 1) { @@ -3220,21 +3201,32 @@ static SDL_GPUCommandBuffer *D3D11_AcquireCommandBuffer( } commandBuffer->needVertexSamplerBind = true; - commandBuffer->needVertexResourceBind = true; + commandBuffer->needVertexStorageTextureBind = true; + commandBuffer->needVertexStorageBufferBind = true; commandBuffer->needVertexUniformBufferBind = true; commandBuffer->needFragmentSamplerBind = true; - commandBuffer->needFragmentResourceBind = true; + commandBuffer->needFragmentStorageTextureBind = true; + commandBuffer->needFragmentStorageBufferBind = true; commandBuffer->needFragmentUniformBufferBind = true; - commandBuffer->needComputeUAVBind = true; - commandBuffer->needComputeSRVBind = true; commandBuffer->needComputeUniformBufferBind = true; + commandBuffer->needBlendStateSet = true; SDL_zeroa(commandBuffer->vertexSamplers); - SDL_zeroa(commandBuffer->vertexShaderResourceViews); + SDL_zeroa(commandBuffer->vertexSamplerTextures); + SDL_zeroa(commandBuffer->vertexStorageTextures); + SDL_zeroa(commandBuffer->vertexStorageBuffers); + SDL_zeroa(commandBuffer->fragmentSamplers); - SDL_zeroa(commandBuffer->fragmentShaderResourceViews); - SDL_zeroa(commandBuffer->computeShaderResourceViews); - SDL_zeroa(commandBuffer->computeUnorderedAccessViews); + SDL_zeroa(commandBuffer->fragmentSamplerTextures); + SDL_zeroa(commandBuffer->fragmentStorageTextures); + SDL_zeroa(commandBuffer->fragmentStorageBuffers); + + SDL_zeroa(commandBuffer->computeSamplers); + SDL_zeroa(commandBuffer->computeSamplerTextures); + SDL_zeroa(commandBuffer->computeReadOnlyStorageTextures); + SDL_zeroa(commandBuffer->computeReadOnlyStorageBuffers); + SDL_zeroa(commandBuffer->computeWriteOnlyStorageTextureSubresources); + SDL_zeroa(commandBuffer->computeWriteOnlyStorageBuffers); D3D11_INTERNAL_AcquireFence(commandBuffer); commandBuffer->autoReleaseFence = 1; @@ -3292,7 +3284,7 @@ static void D3D11_INTERNAL_PushUniformData( SDL_GPUShaderStage shaderStage, Uint32 slotIndex, const void *data, - Uint32 dataLengthInBytes) + Uint32 length) { D3D11Renderer *renderer = d3d11CommandBuffer->renderer; D3D11UniformBuffer *d3d11UniformBuffer; @@ -3324,7 +3316,7 @@ static void D3D11_INTERNAL_PushUniformData( d3d11UniformBuffer->currentBlockSize = D3D11_INTERNAL_NextHighestAlignment( - dataLengthInBytes, + length, 256); // If there is no more room, acquire a new uniform buffer @@ -3370,7 +3362,7 @@ static void D3D11_INTERNAL_PushUniformData( SDL_memcpy( (Uint8 *)d3d11UniformBuffer->mappedData + d3d11UniformBuffer->writeOffset, data, - dataLengthInBytes); + length); d3d11UniformBuffer->writeOffset += d3d11UniformBuffer->currentBlockSize; @@ -3385,11 +3377,74 @@ static void D3D11_INTERNAL_PushUniformData( } } +static void D3D11_SetViewport( + SDL_GPUCommandBuffer *commandBuffer, + const SDL_GPUViewport *viewport) +{ + D3D11CommandBuffer *d3d11CommandBuffer = (D3D11CommandBuffer *)commandBuffer; + D3D11_VIEWPORT vp = { + viewport->x, + viewport->y, + viewport->w, + viewport->h, + viewport->min_depth, + viewport->max_depth + }; + + ID3D11DeviceContext_RSSetViewports( + d3d11CommandBuffer->context, + 1, + &vp); +} + +static void D3D11_SetScissor( + SDL_GPUCommandBuffer *commandBuffer, + const SDL_Rect *scissor) +{ + D3D11CommandBuffer *d3d11CommandBuffer = (D3D11CommandBuffer *)commandBuffer; + D3D11_RECT rect = { + scissor->x, + scissor->y, + scissor->x + scissor->w, + scissor->y + scissor->h + }; + + ID3D11DeviceContext_RSSetScissorRects( + d3d11CommandBuffer->context, + 1, + &rect); +} + +static void D3D11_SetBlendConstants( + SDL_GPUCommandBuffer *commandBuffer, + SDL_FColor blendConstants) +{ + D3D11CommandBuffer *d3d11CommandBuffer = (D3D11CommandBuffer *)commandBuffer; + d3d11CommandBuffer->blendConstants = blendConstants; + d3d11CommandBuffer->needBlendStateSet = true; +} + +static void D3D11_SetStencilReference( + SDL_GPUCommandBuffer *commandBuffer, + Uint8 reference) +{ + D3D11CommandBuffer *d3d11CommandBuffer = (D3D11CommandBuffer *)commandBuffer; + + d3d11CommandBuffer->stencilRef = reference; + + if (d3d11CommandBuffer->graphicsPipeline != NULL) { + ID3D11DeviceContext_OMSetDepthStencilState( + d3d11CommandBuffer->context, + d3d11CommandBuffer->graphicsPipeline->depthStencilState, + reference); + } +} + static void D3D11_BeginRenderPass( SDL_GPUCommandBuffer *commandBuffer, - SDL_GPUColorAttachmentInfo *colorAttachmentInfos, - Uint32 colorAttachmentCount, - SDL_GPUDepthStencilAttachmentInfo *depthStencilAttachmentInfo) + const SDL_GPUColorTargetInfo *colorTargetInfos, + Uint32 numColorTargets, + const SDL_GPUDepthStencilTargetInfo *depthStencilTargetInfo) { D3D11CommandBuffer *d3d11CommandBuffer = (D3D11CommandBuffer *)commandBuffer; D3D11Renderer *renderer = (D3D11Renderer *)d3d11CommandBuffer->renderer; @@ -3397,50 +3452,47 @@ static void D3D11_BeginRenderPass( ID3D11DepthStencilView *dsv = NULL; Uint32 vpWidth = SDL_MAX_UINT32; Uint32 vpHeight = SDL_MAX_UINT32; - D3D11_VIEWPORT viewport; - D3D11_RECT scissorRect; - - d3d11CommandBuffer->needVertexSamplerBind = true; - d3d11CommandBuffer->needVertexResourceBind = true; - d3d11CommandBuffer->needFragmentSamplerBind = true; - d3d11CommandBuffer->needFragmentResourceBind = true; + SDL_GPUViewport viewport; + SDL_Rect scissorRect; // Clear the bound targets for the current command buffer for (Uint32 i = 0; i < MAX_COLOR_TARGET_BINDINGS; i += 1) { - d3d11CommandBuffer->colorTargetResolveTexture[i] = NULL; - d3d11CommandBuffer->colorTargetResolveSubresourceIndex[i] = 0; - d3d11CommandBuffer->colorTargetMsaaHandle[i] = NULL; - d3d11CommandBuffer->colorTargetMsaaFormat[i] = DXGI_FORMAT_UNKNOWN; + d3d11CommandBuffer->colorTargetSubresources[i] = NULL; + d3d11CommandBuffer->colorResolveSubresources[i] = NULL; } // Set up the new color target bindings - for (Uint32 i = 0; i < colorAttachmentCount; i += 1) { - D3D11TextureContainer *container = (D3D11TextureContainer *)colorAttachmentInfos[i].texture; + for (Uint32 i = 0; i < numColorTargets; i += 1) { + D3D11TextureContainer *container = (D3D11TextureContainer *)colorTargetInfos[i].texture; D3D11TextureSubresource *subresource = D3D11_INTERNAL_PrepareTextureSubresourceForWrite( renderer, container, - container->header.info.type == SDL_GPU_TEXTURETYPE_3D ? 0 : colorAttachmentInfos[i].layerOrDepthPlane, - colorAttachmentInfos[i].mipLevel, - colorAttachmentInfos[i].cycle); + container->header.info.type == SDL_GPU_TEXTURETYPE_3D ? 0 : colorTargetInfos[i].layer_or_depth_plane, + colorTargetInfos[i].mip_level, + colorTargetInfos[i].cycle); - if (subresource->msaaHandle != NULL) { - d3d11CommandBuffer->colorTargetResolveTexture[i] = subresource->parent; - d3d11CommandBuffer->colorTargetResolveSubresourceIndex[i] = subresource->index; - d3d11CommandBuffer->colorTargetMsaaHandle[i] = subresource->msaaHandle; - d3d11CommandBuffer->colorTargetMsaaFormat[i] = SDLToD3D11_TextureFormat[container->header.info.format]; + Uint32 rtvIndex = container->header.info.type == SDL_GPU_TEXTURETYPE_3D ? colorTargetInfos[i].layer_or_depth_plane : 0; + rtvs[i] = subresource->colorTargetViews[rtvIndex]; + d3d11CommandBuffer->colorTargetSubresources[i] = subresource; - rtvs[i] = subresource->msaaTargetView; - } else { - Uint32 rtvIndex = container->header.info.type == SDL_GPU_TEXTURETYPE_3D ? colorAttachmentInfos[i].layerOrDepthPlane : 0; - rtvs[i] = subresource->colorTargetViews[rtvIndex]; + if (colorTargetInfos[i].store_op == SDL_GPU_STOREOP_RESOLVE || colorTargetInfos[i].store_op == SDL_GPU_STOREOP_RESOLVE_AND_STORE) { + D3D11TextureContainer *resolveContainer = (D3D11TextureContainer *)colorTargetInfos[i].resolve_texture; + D3D11TextureSubresource *resolveSubresource = D3D11_INTERNAL_PrepareTextureSubresourceForWrite( + renderer, + resolveContainer, + colorTargetInfos[i].resolve_layer, + colorTargetInfos[i].resolve_mip_level, + colorTargetInfos[i].cycle_resolve_texture); + + d3d11CommandBuffer->colorResolveSubresources[i] = resolveSubresource; } - if (colorAttachmentInfos[i].loadOp == SDL_GPU_LOADOP_CLEAR) { + if (colorTargetInfos[i].load_op == SDL_GPU_LOADOP_CLEAR) { float clearColor[] = { - colorAttachmentInfos[i].clearColor.r, - colorAttachmentInfos[i].clearColor.g, - colorAttachmentInfos[i].clearColor.b, - colorAttachmentInfos[i].clearColor.a + colorTargetInfos[i].clear_color.r, + colorTargetInfos[i].clear_color.g, + colorTargetInfos[i].clear_color.b, + colorTargetInfos[i].clear_color.a }; ID3D11DeviceContext_ClearRenderTargetView( d3d11CommandBuffer->context, @@ -3453,15 +3505,15 @@ static void D3D11_BeginRenderPass( subresource->parent); } - // Get the DSV for the depth stencil attachment, if applicable - if (depthStencilAttachmentInfo != NULL) { - D3D11TextureContainer *container = (D3D11TextureContainer *)depthStencilAttachmentInfo->texture; + // Get the DSV for the depth stencil target, if applicable + if (depthStencilTargetInfo != NULL) { + D3D11TextureContainer *container = (D3D11TextureContainer *)depthStencilTargetInfo->texture; D3D11TextureSubresource *subresource = D3D11_INTERNAL_PrepareTextureSubresourceForWrite( renderer, container, 0, 0, - depthStencilAttachmentInfo->cycle); + depthStencilTargetInfo->cycle); dsv = subresource->depthStencilTargetView; @@ -3473,16 +3525,16 @@ static void D3D11_BeginRenderPass( // Actually set the RTs ID3D11DeviceContext_OMSetRenderTargets( d3d11CommandBuffer->context, - colorAttachmentCount, - colorAttachmentCount > 0 ? rtvs : NULL, + numColorTargets, + numColorTargets > 0 ? rtvs : NULL, dsv); - if (depthStencilAttachmentInfo != NULL) { + if (depthStencilTargetInfo != NULL) { D3D11_CLEAR_FLAG dsClearFlags = 0; - if (depthStencilAttachmentInfo->loadOp == SDL_GPU_LOADOP_CLEAR) { + if (depthStencilTargetInfo->load_op == SDL_GPU_LOADOP_CLEAR) { dsClearFlags |= D3D11_CLEAR_DEPTH; } - if (depthStencilAttachmentInfo->stencilLoadOp == SDL_GPU_LOADOP_CLEAR) { + if (depthStencilTargetInfo->stencil_load_op == SDL_GPU_LOADOP_CLEAR) { dsClearFlags |= D3D11_CLEAR_STENCIL; } @@ -3491,16 +3543,16 @@ static void D3D11_BeginRenderPass( d3d11CommandBuffer->context, dsv, dsClearFlags, - depthStencilAttachmentInfo->depthStencilClearValue.depth, - depthStencilAttachmentInfo->depthStencilClearValue.stencil); + depthStencilTargetInfo->clear_depth, + depthStencilTargetInfo->clear_stencil); } } - // The viewport cannot be larger than the smallest attachment. - for (Uint32 i = 0; i < colorAttachmentCount; i += 1) { - D3D11TextureContainer *container = (D3D11TextureContainer *)colorAttachmentInfos[i].texture; - Uint32 w = container->header.info.width >> colorAttachmentInfos[i].mipLevel; - Uint32 h = container->header.info.height >> colorAttachmentInfos[i].mipLevel; + // The viewport cannot be larger than the smallest target. + for (Uint32 i = 0; i < numColorTargets; i += 1) { + D3D11TextureContainer *container = (D3D11TextureContainer *)colorTargetInfos[i].texture; + Uint32 w = container->header.info.width >> colorTargetInfos[i].mip_level; + Uint32 h = container->header.info.height >> colorTargetInfos[i].mip_level; if (w < vpWidth) { vpWidth = w; @@ -3511,8 +3563,8 @@ static void D3D11_BeginRenderPass( } } - if (depthStencilAttachmentInfo != NULL) { - D3D11TextureContainer *container = (D3D11TextureContainer *)depthStencilAttachmentInfo->texture; + if (depthStencilTargetInfo != NULL) { + D3D11TextureContainer *container = (D3D11TextureContainer *)depthStencilTargetInfo->texture; Uint32 w = container->header.info.width; Uint32 h = container->header.info.height; @@ -3525,28 +3577,40 @@ static void D3D11_BeginRenderPass( } } - // Set default viewport and scissor state - viewport.TopLeftX = 0; - viewport.TopLeftY = 0; - viewport.Width = (FLOAT)vpWidth; - viewport.Height = (FLOAT)vpHeight; - viewport.MinDepth = 0; - viewport.MaxDepth = 1; + // Set sensible default states + viewport.x = 0; + viewport.y = 0; + viewport.w = (float)vpWidth; + viewport.h = (float)vpHeight; + viewport.min_depth = 0; + viewport.max_depth = 1; - ID3D11DeviceContext_RSSetViewports( - d3d11CommandBuffer->context, - 1, + D3D11_SetViewport( + commandBuffer, &viewport); - scissorRect.left = 0; - scissorRect.right = (LONG)viewport.Width; - scissorRect.top = 0; - scissorRect.bottom = (LONG)viewport.Height; + scissorRect.x = 0; + scissorRect.y = 0; + scissorRect.w = (int)vpWidth; + scissorRect.h = (int)vpHeight; - ID3D11DeviceContext_RSSetScissorRects( - d3d11CommandBuffer->context, - 1, + D3D11_SetScissor( + commandBuffer, &scissorRect); + + D3D11_SetStencilReference( + commandBuffer, + 0); + + SDL_FColor blendConstants; + blendConstants.r = 1.0f; + blendConstants.g = 1.0f; + blendConstants.b = 1.0f; + blendConstants.a = 1.0f; + + D3D11_SetBlendConstants( + commandBuffer, + blendConstants); } static void D3D11_BindGraphicsPipeline( @@ -3555,19 +3619,12 @@ static void D3D11_BindGraphicsPipeline( { D3D11CommandBuffer *d3d11CommandBuffer = (D3D11CommandBuffer *)commandBuffer; D3D11GraphicsPipeline *pipeline = (D3D11GraphicsPipeline *)graphicsPipeline; - d3d11CommandBuffer->graphicsPipeline = pipeline; - ID3D11DeviceContext_OMSetBlendState( - d3d11CommandBuffer->context, - pipeline->colorAttachmentBlendState, - pipeline->blendConstants, - pipeline->multisampleState.sampleMask); - ID3D11DeviceContext_OMSetDepthStencilState( d3d11CommandBuffer->context, pipeline->depthStencilState, - pipeline->stencilRef); + d3d11CommandBuffer->stencilRef); ID3D11DeviceContext_IASetPrimitiveTopology( d3d11CommandBuffer->context, @@ -3608,77 +3665,46 @@ static void D3D11_BindGraphicsPipeline( } } - // Mark that uniform bindings are needed + // Mark that bindings are needed + d3d11CommandBuffer->needVertexSamplerBind = true; + d3d11CommandBuffer->needVertexStorageTextureBind = true; + d3d11CommandBuffer->needVertexStorageBufferBind = true; d3d11CommandBuffer->needVertexUniformBufferBind = true; + d3d11CommandBuffer->needFragmentSamplerBind = true; + d3d11CommandBuffer->needFragmentStorageTextureBind = true; + d3d11CommandBuffer->needFragmentStorageBufferBind = true; d3d11CommandBuffer->needFragmentUniformBufferBind = true; -} - -static void D3D11_SetViewport( - SDL_GPUCommandBuffer *commandBuffer, - SDL_GPUViewport *viewport) -{ - D3D11CommandBuffer *d3d11CommandBuffer = (D3D11CommandBuffer *)commandBuffer; - D3D11_VIEWPORT vp = { - viewport->x, - viewport->y, - viewport->w, - viewport->h, - viewport->minDepth, - viewport->maxDepth - }; - - ID3D11DeviceContext_RSSetViewports( - d3d11CommandBuffer->context, - 1, - &vp); -} - -static void D3D11_SetScissor( - SDL_GPUCommandBuffer *commandBuffer, - SDL_Rect *scissor) -{ - D3D11CommandBuffer *d3d11CommandBuffer = (D3D11CommandBuffer *)commandBuffer; - D3D11_RECT rect = { - scissor->x, - scissor->y, - scissor->x + scissor->w, - scissor->y + scissor->h - }; - - ID3D11DeviceContext_RSSetScissorRects( - d3d11CommandBuffer->context, - 1, - &rect); + d3d11CommandBuffer->needBlendStateSet = true; } static void D3D11_BindVertexBuffers( SDL_GPUCommandBuffer *commandBuffer, - Uint32 firstBinding, - SDL_GPUBufferBinding *pBindings, - Uint32 bindingCount) + Uint32 firstSlot, + const SDL_GPUBufferBinding *bindings, + Uint32 numBindings) { D3D11CommandBuffer *d3d11CommandBuffer = (D3D11CommandBuffer *)commandBuffer; - for (Uint32 i = 0; i < bindingCount; i += 1) { - D3D11Buffer *currentBuffer = ((D3D11BufferContainer *)pBindings[i].buffer)->activeBuffer; - d3d11CommandBuffer->vertexBuffers[firstBinding + i] = currentBuffer->handle; - d3d11CommandBuffer->vertexBufferOffsets[firstBinding + i] = pBindings[i].offset; + for (Uint32 i = 0; i < numBindings; i += 1) { + D3D11Buffer *currentBuffer = ((D3D11BufferContainer *)bindings[i].buffer)->activeBuffer; + d3d11CommandBuffer->vertexBuffers[firstSlot + i] = currentBuffer->handle; + d3d11CommandBuffer->vertexBufferOffsets[firstSlot + i] = bindings[i].offset; D3D11_INTERNAL_TrackBuffer(d3d11CommandBuffer, currentBuffer); } d3d11CommandBuffer->vertexBufferCount = - SDL_max(d3d11CommandBuffer->vertexBufferCount, firstBinding + bindingCount); + SDL_max(d3d11CommandBuffer->vertexBufferCount, firstSlot + numBindings); d3d11CommandBuffer->needVertexBufferBind = true; } static void D3D11_BindIndexBuffer( SDL_GPUCommandBuffer *commandBuffer, - SDL_GPUBufferBinding *pBinding, + const SDL_GPUBufferBinding *binding, SDL_GPUIndexElementSize indexElementSize) { D3D11CommandBuffer *d3d11CommandBuffer = (D3D11CommandBuffer *)commandBuffer; - D3D11Buffer *d3d11Buffer = ((D3D11BufferContainer *)pBinding->buffer)->activeBuffer; + D3D11Buffer *d3d11Buffer = ((D3D11BufferContainer *)binding->buffer)->activeBuffer; D3D11_INTERNAL_TrackBuffer(d3d11CommandBuffer, d3d11Buffer); @@ -3686,18 +3712,18 @@ static void D3D11_BindIndexBuffer( d3d11CommandBuffer->context, d3d11Buffer->handle, SDLToD3D11_IndexType[indexElementSize], - (UINT)pBinding->offset); + (UINT)binding->offset); } static void D3D11_BindVertexSamplers( SDL_GPUCommandBuffer *commandBuffer, Uint32 firstSlot, - SDL_GPUTextureSamplerBinding *textureSamplerBindings, - Uint32 bindingCount) + const SDL_GPUTextureSamplerBinding *textureSamplerBindings, + Uint32 numBindings) { D3D11CommandBuffer *d3d11CommandBuffer = (D3D11CommandBuffer *)commandBuffer; - for (Uint32 i = 0; i < bindingCount; i += 1) { + for (Uint32 i = 0; i < numBindings; i += 1) { D3D11TextureContainer *textureContainer = (D3D11TextureContainer *)textureSamplerBindings[i].texture; D3D11_INTERNAL_TrackTexture( @@ -3705,72 +3731,70 @@ static void D3D11_BindVertexSamplers( textureContainer->activeTexture); d3d11CommandBuffer->vertexSamplers[firstSlot + i] = - ((D3D11Sampler *)textureSamplerBindings[i].sampler)->handle; + (D3D11Sampler *)textureSamplerBindings[i].sampler; - d3d11CommandBuffer->vertexShaderResourceViews[firstSlot + i] = - textureContainer->activeTexture->shaderView; + d3d11CommandBuffer->vertexSamplerTextures[firstSlot + i] = + textureContainer->activeTexture; } d3d11CommandBuffer->needVertexSamplerBind = true; - d3d11CommandBuffer->needVertexResourceBind = true; } static void D3D11_BindVertexStorageTextures( SDL_GPUCommandBuffer *commandBuffer, Uint32 firstSlot, - SDL_GPUTexture **storageTextures, - Uint32 bindingCount) + SDL_GPUTexture *const *storageTextures, + Uint32 numBindings) { D3D11CommandBuffer *d3d11CommandBuffer = (D3D11CommandBuffer *)commandBuffer; - for (Uint32 i = 0; i < bindingCount; i += 1) { + for (Uint32 i = 0; i < numBindings; i += 1) { D3D11TextureContainer *textureContainer = (D3D11TextureContainer *)storageTextures[i]; D3D11_INTERNAL_TrackTexture( d3d11CommandBuffer, textureContainer->activeTexture); - d3d11CommandBuffer->vertexShaderResourceViews[firstSlot + i + - d3d11CommandBuffer->graphicsPipeline->vertexSamplerCount] = textureContainer->activeTexture->shaderView; + d3d11CommandBuffer->vertexStorageTextures[firstSlot + i] = + textureContainer->activeTexture; } - d3d11CommandBuffer->needVertexResourceBind = true; + d3d11CommandBuffer->needVertexStorageTextureBind = true; } static void D3D11_BindVertexStorageBuffers( SDL_GPUCommandBuffer *commandBuffer, Uint32 firstSlot, - SDL_GPUBuffer **storageBuffers, - Uint32 bindingCount) + SDL_GPUBuffer *const *storageBuffers, + Uint32 numBindings) { D3D11CommandBuffer *d3d11CommandBuffer = (D3D11CommandBuffer *)commandBuffer; D3D11BufferContainer *bufferContainer; Uint32 i; - for (i = 0; i < bindingCount; i += 1) { + for (i = 0; i < numBindings; i += 1) { bufferContainer = (D3D11BufferContainer *)storageBuffers[i]; D3D11_INTERNAL_TrackBuffer( d3d11CommandBuffer, bufferContainer->activeBuffer); - d3d11CommandBuffer->vertexShaderResourceViews[firstSlot + i + - d3d11CommandBuffer->graphicsPipeline->vertexSamplerCount + - d3d11CommandBuffer->graphicsPipeline->vertexStorageTextureCount] = bufferContainer->activeBuffer->srv; + d3d11CommandBuffer->vertexStorageBuffers[firstSlot + i] = + bufferContainer->activeBuffer; } - d3d11CommandBuffer->needVertexResourceBind = true; + d3d11CommandBuffer->needVertexStorageBufferBind = true; } static void D3D11_BindFragmentSamplers( SDL_GPUCommandBuffer *commandBuffer, Uint32 firstSlot, - SDL_GPUTextureSamplerBinding *textureSamplerBindings, - Uint32 bindingCount) + const SDL_GPUTextureSamplerBinding *textureSamplerBindings, + Uint32 numBindings) { D3D11CommandBuffer *d3d11CommandBuffer = (D3D11CommandBuffer *)commandBuffer; - for (Uint32 i = 0; i < bindingCount; i += 1) { + for (Uint32 i = 0; i < numBindings; i += 1) { D3D11TextureContainer *textureContainer = (D3D11TextureContainer *)textureSamplerBindings[i].texture; D3D11_INTERNAL_TrackTexture( @@ -3778,61 +3802,59 @@ static void D3D11_BindFragmentSamplers( textureContainer->activeTexture); d3d11CommandBuffer->fragmentSamplers[firstSlot + i] = - ((D3D11Sampler *)textureSamplerBindings[i].sampler)->handle; + (D3D11Sampler *)textureSamplerBindings[i].sampler; - d3d11CommandBuffer->fragmentShaderResourceViews[firstSlot + i] = - textureContainer->activeTexture->shaderView; + d3d11CommandBuffer->fragmentSamplerTextures[firstSlot + i] = + (D3D11Texture *)textureContainer->activeTexture; } d3d11CommandBuffer->needFragmentSamplerBind = true; - d3d11CommandBuffer->needFragmentResourceBind = true; } static void D3D11_BindFragmentStorageTextures( SDL_GPUCommandBuffer *commandBuffer, Uint32 firstSlot, - SDL_GPUTexture **storageTextures, - Uint32 bindingCount) + SDL_GPUTexture *const *storageTextures, + Uint32 numBindings) { D3D11CommandBuffer *d3d11CommandBuffer = (D3D11CommandBuffer *)commandBuffer; - for (Uint32 i = 0; i < bindingCount; i += 1) { + for (Uint32 i = 0; i < numBindings; i += 1) { D3D11TextureContainer *textureContainer = (D3D11TextureContainer *)storageTextures[i]; D3D11_INTERNAL_TrackTexture( d3d11CommandBuffer, textureContainer->activeTexture); - d3d11CommandBuffer->fragmentShaderResourceViews[firstSlot + i + - d3d11CommandBuffer->graphicsPipeline->fragmentSamplerCount] = textureContainer->activeTexture->shaderView; + d3d11CommandBuffer->fragmentStorageTextures[firstSlot + i] = + textureContainer->activeTexture; } - d3d11CommandBuffer->needFragmentResourceBind = true; + d3d11CommandBuffer->needFragmentStorageTextureBind = true; } static void D3D11_BindFragmentStorageBuffers( SDL_GPUCommandBuffer *commandBuffer, Uint32 firstSlot, - SDL_GPUBuffer **storageBuffers, - Uint32 bindingCount) + SDL_GPUBuffer *const *storageBuffers, + Uint32 numBindings) { D3D11CommandBuffer *d3d11CommandBuffer = (D3D11CommandBuffer *)commandBuffer; D3D11BufferContainer *bufferContainer; Uint32 i; - for (i = 0; i < bindingCount; i += 1) { + for (i = 0; i < numBindings; i += 1) { bufferContainer = (D3D11BufferContainer *)storageBuffers[i]; D3D11_INTERNAL_TrackBuffer( d3d11CommandBuffer, bufferContainer->activeBuffer); - d3d11CommandBuffer->fragmentShaderResourceViews[firstSlot + i + - d3d11CommandBuffer->graphicsPipeline->fragmentSamplerCount + - d3d11CommandBuffer->graphicsPipeline->fragmentStorageTextureCount] = bufferContainer->activeBuffer->srv; + d3d11CommandBuffer->fragmentStorageBuffers[firstSlot + i] = + bufferContainer->activeBuffer; } - d3d11CommandBuffer->needFragmentResourceBind = true; + d3d11CommandBuffer->needFragmentStorageBufferBind = true; } static void D3D11_INTERNAL_BindGraphicsResources( @@ -3840,18 +3862,8 @@ static void D3D11_INTERNAL_BindGraphicsResources( { D3D11GraphicsPipeline *graphicsPipeline = commandBuffer->graphicsPipeline; - Uint32 vertexResourceCount = - graphicsPipeline->vertexSamplerCount + - graphicsPipeline->vertexStorageTextureCount + - graphicsPipeline->vertexStorageBufferCount; - - Uint32 fragmentResourceCount = - graphicsPipeline->fragmentSamplerCount + - graphicsPipeline->fragmentStorageTextureCount + - graphicsPipeline->fragmentStorageBufferCount; - ID3D11Buffer *nullBuf = NULL; - Uint32 offsetInConstants, blockSizeInConstants, i; + Uint32 offsetInConstants, blockSizeInConstants; if (commandBuffer->needVertexBufferBind) { ID3D11DeviceContext_IASetVertexBuffers( @@ -3865,30 +3877,68 @@ static void D3D11_INTERNAL_BindGraphicsResources( if (commandBuffer->needVertexSamplerBind) { if (graphicsPipeline->vertexSamplerCount > 0) { + ID3D11SamplerState *samplerStates[MAX_TEXTURE_SAMPLERS_PER_STAGE]; + ID3D11ShaderResourceView *srvs[MAX_TEXTURE_SAMPLERS_PER_STAGE]; + + for (Uint32 i = 0; i < graphicsPipeline->vertexSamplerCount; i += 1) { + samplerStates[i] = commandBuffer->vertexSamplers[i]->handle; + srvs[i] = commandBuffer->vertexSamplerTextures[i]->shaderView; + } + ID3D11DeviceContext_VSSetSamplers( commandBuffer->context, 0, graphicsPipeline->vertexSamplerCount, - commandBuffer->vertexSamplers); + samplerStates); + + ID3D11DeviceContext_VSSetShaderResources( + commandBuffer->context, + 0, + graphicsPipeline->vertexSamplerCount, + srvs); } commandBuffer->needVertexSamplerBind = false; } - if (commandBuffer->needVertexResourceBind) { - if (vertexResourceCount > 0) { + if (commandBuffer->needVertexStorageTextureBind) { + if (graphicsPipeline->vertexStorageTextureCount > 0) { + ID3D11ShaderResourceView *srvs[MAX_STORAGE_TEXTURES_PER_STAGE]; + + for (Uint32 i = 0; i < graphicsPipeline->vertexStorageTextureCount; i += 1) { + srvs[i] = commandBuffer->vertexStorageTextures[i]->shaderView; + } + ID3D11DeviceContext_VSSetShaderResources( commandBuffer->context, - 0, - vertexResourceCount, - commandBuffer->vertexShaderResourceViews); + graphicsPipeline->vertexSamplerCount, + graphicsPipeline->vertexStorageTextureCount, + srvs); } - commandBuffer->needVertexResourceBind = false; + commandBuffer->needVertexStorageTextureBind = false; + } + + if (commandBuffer->needVertexStorageBufferBind) { + if (graphicsPipeline->vertexStorageBufferCount > 0) { + ID3D11ShaderResourceView *srvs[MAX_STORAGE_BUFFERS_PER_STAGE]; + + for (Uint32 i = 0; i < graphicsPipeline->vertexStorageBufferCount; i += 1) { + srvs[i] = commandBuffer->vertexStorageBuffers[i]->srv; + } + + ID3D11DeviceContext_VSSetShaderResources( + commandBuffer->context, + graphicsPipeline->vertexSamplerCount + graphicsPipeline->vertexStorageTextureCount, + graphicsPipeline->vertexStorageBufferCount, + srvs); + } + + commandBuffer->needVertexStorageBufferBind = false; } if (commandBuffer->needVertexUniformBufferBind) { - for (i = 0; i < graphicsPipeline->vertexUniformBufferCount; i += 1) { + for (Uint32 i = 0; i < graphicsPipeline->vertexUniformBufferCount; i += 1) { /* stupid workaround for god awful D3D11 drivers * see: https://learn.microsoft.com/en-us/windows/win32/api/d3d11_1/nf-d3d11_1-id3d11devicecontext1-vssetconstantbuffers1#calling-vssetconstantbuffers1-with-command-list-emulation */ @@ -3915,30 +3965,68 @@ static void D3D11_INTERNAL_BindGraphicsResources( if (commandBuffer->needFragmentSamplerBind) { if (graphicsPipeline->fragmentSamplerCount > 0) { + ID3D11SamplerState *samplerStates[MAX_TEXTURE_SAMPLERS_PER_STAGE]; + ID3D11ShaderResourceView *srvs[MAX_TEXTURE_SAMPLERS_PER_STAGE]; + + for (Uint32 i = 0; i < graphicsPipeline->fragmentSamplerCount; i += 1) { + samplerStates[i] = commandBuffer->fragmentSamplers[i]->handle; + srvs[i] = commandBuffer->fragmentSamplerTextures[i]->shaderView; + } + ID3D11DeviceContext_PSSetSamplers( commandBuffer->context, 0, graphicsPipeline->fragmentSamplerCount, - commandBuffer->fragmentSamplers); + samplerStates); + + ID3D11DeviceContext_PSSetShaderResources( + commandBuffer->context, + 0, + graphicsPipeline->fragmentSamplerCount, + srvs); } commandBuffer->needFragmentSamplerBind = false; } - if (commandBuffer->needFragmentResourceBind) { - if (fragmentResourceCount > 0) { + if (commandBuffer->needFragmentStorageTextureBind) { + if (graphicsPipeline->fragmentStorageTextureCount > 0) { + ID3D11ShaderResourceView *srvs[MAX_STORAGE_TEXTURES_PER_STAGE]; + + for (Uint32 i = 0; i < graphicsPipeline->fragmentStorageTextureCount; i += 1) { + srvs[i] = commandBuffer->fragmentStorageTextures[i]->shaderView; + } + ID3D11DeviceContext_PSSetShaderResources( commandBuffer->context, - 0, - fragmentResourceCount, - commandBuffer->fragmentShaderResourceViews); + graphicsPipeline->fragmentSamplerCount, + graphicsPipeline->fragmentStorageTextureCount, + srvs); } - commandBuffer->needFragmentResourceBind = false; + commandBuffer->needFragmentStorageTextureBind = false; + } + + if (commandBuffer->needFragmentStorageBufferBind) { + if (graphicsPipeline->fragmentStorageBufferCount > 0) { + ID3D11ShaderResourceView *srvs[MAX_STORAGE_BUFFERS_PER_STAGE]; + + for (Uint32 i = 0; i < graphicsPipeline->fragmentStorageBufferCount; i += 1) { + srvs[i] = commandBuffer->fragmentStorageBuffers[i]->srv; + } + + ID3D11DeviceContext_PSSetShaderResources( + commandBuffer->context, + graphicsPipeline->fragmentSamplerCount + graphicsPipeline->fragmentStorageTextureCount, + graphicsPipeline->fragmentStorageBufferCount, + srvs); + } + + commandBuffer->needFragmentStorageBufferBind = false; } if (commandBuffer->needFragmentUniformBufferBind) { - for (i = 0; i < graphicsPipeline->fragmentUniformBufferCount; i += 1) { + for (Uint32 i = 0; i < graphicsPipeline->fragmentUniformBufferCount; i += 1) { /* stupid workaround for god awful D3D11 drivers * see: https://learn.microsoft.com/en-us/windows/win32/api/d3d11_1/nf-d3d11_1-id3d11devicecontext1-pssetconstantbuffers1#calling-pssetconstantbuffers1-with-command-list-emulation */ @@ -3962,12 +4050,29 @@ static void D3D11_INTERNAL_BindGraphicsResources( commandBuffer->needFragmentUniformBufferBind = false; } + + if (commandBuffer->needBlendStateSet) { + FLOAT blendFactor[4] = { + commandBuffer->blendConstants.r, + commandBuffer->blendConstants.g, + commandBuffer->blendConstants.b, + commandBuffer->blendConstants.a + }; + + ID3D11DeviceContext_OMSetBlendState( + commandBuffer->context, + graphicsPipeline->colorTargetBlendState, + blendFactor, + graphicsPipeline->sampleMask); + + commandBuffer->needBlendStateSet = false; + } } static void D3D11_DrawIndexedPrimitives( SDL_GPUCommandBuffer *commandBuffer, - Uint32 indexCount, - Uint32 instanceCount, + Uint32 numIndices, + Uint32 numInstances, Uint32 firstIndex, Sint32 vertexOffset, Uint32 firstInstance) @@ -3977,8 +4082,8 @@ static void D3D11_DrawIndexedPrimitives( ID3D11DeviceContext_DrawIndexedInstanced( d3d11CommandBuffer->context, - indexCount, - instanceCount, + numIndices, + numInstances, firstIndex, vertexOffset, firstInstance); @@ -3986,8 +4091,8 @@ static void D3D11_DrawIndexedPrimitives( static void D3D11_DrawPrimitives( SDL_GPUCommandBuffer *commandBuffer, - Uint32 vertexCount, - Uint32 instanceCount, + Uint32 numVertices, + Uint32 numInstances, Uint32 firstVertex, Uint32 firstInstance) { @@ -3996,8 +4101,8 @@ static void D3D11_DrawPrimitives( ID3D11DeviceContext_DrawInstanced( d3d11CommandBuffer->context, - vertexCount, - instanceCount, + numVertices, + numInstances, firstVertex, firstInstance); } @@ -4005,9 +4110,8 @@ static void D3D11_DrawPrimitives( static void D3D11_DrawPrimitivesIndirect( SDL_GPUCommandBuffer *commandBuffer, SDL_GPUBuffer *buffer, - Uint32 offsetInBytes, - Uint32 drawCount, - Uint32 stride) + Uint32 offset, + Uint32 drawCount) { D3D11CommandBuffer *d3d11CommandBuffer = (D3D11CommandBuffer *)commandBuffer; D3D11_INTERNAL_BindGraphicsResources(d3d11CommandBuffer); @@ -4021,7 +4125,7 @@ static void D3D11_DrawPrimitivesIndirect( ID3D11DeviceContext_DrawInstancedIndirect( d3d11CommandBuffer->context, d3d11Buffer->handle, - offsetInBytes + (stride * i)); + offset + (sizeof(SDL_GPUIndirectDrawCommand) * i)); } D3D11_INTERNAL_TrackBuffer(d3d11CommandBuffer, d3d11Buffer); @@ -4030,9 +4134,8 @@ static void D3D11_DrawPrimitivesIndirect( static void D3D11_DrawIndexedPrimitivesIndirect( SDL_GPUCommandBuffer *commandBuffer, SDL_GPUBuffer *buffer, - Uint32 offsetInBytes, - Uint32 drawCount, - Uint32 stride) + Uint32 offset, + Uint32 drawCount) { D3D11CommandBuffer *d3d11CommandBuffer = (D3D11CommandBuffer *)commandBuffer; D3D11_INTERNAL_BindGraphicsResources(d3d11CommandBuffer); @@ -4046,7 +4149,7 @@ static void D3D11_DrawIndexedPrimitivesIndirect( ID3D11DeviceContext_DrawIndexedInstancedIndirect( d3d11CommandBuffer->context, d3d11Buffer->handle, - offsetInBytes + (stride * i)); + offset + (sizeof(SDL_GPUIndexedIndirectDrawCommand) * i)); } D3D11_INTERNAL_TrackBuffer(d3d11CommandBuffer, d3d11Buffer); @@ -4056,6 +4159,7 @@ static void D3D11_EndRenderPass( SDL_GPUCommandBuffer *commandBuffer) { D3D11CommandBuffer *d3d11CommandBuffer = (D3D11CommandBuffer *)commandBuffer; + D3D11Renderer *renderer = d3d11CommandBuffer->renderer; Uint32 i; // Set render target slots to NULL to avoid NULL set behavior @@ -4063,71 +4167,95 @@ static void D3D11_EndRenderPass( ID3D11DeviceContext_OMSetRenderTargets( d3d11CommandBuffer->context, MAX_COLOR_TARGET_BINDINGS, - nullRTVs, + renderer->nullRTVs, NULL); // Resolve MSAA color render targets for (i = 0; i < MAX_COLOR_TARGET_BINDINGS; i += 1) { - if (d3d11CommandBuffer->colorTargetMsaaHandle[i] != NULL) { + if (d3d11CommandBuffer->colorResolveSubresources[i] != NULL) { ID3D11DeviceContext_ResolveSubresource( d3d11CommandBuffer->context, - d3d11CommandBuffer->colorTargetResolveTexture[i]->handle, - d3d11CommandBuffer->colorTargetResolveSubresourceIndex[i], - d3d11CommandBuffer->colorTargetMsaaHandle[i], - 0, - d3d11CommandBuffer->colorTargetMsaaFormat[i]); + d3d11CommandBuffer->colorResolveSubresources[i]->parent->handle, + d3d11CommandBuffer->colorResolveSubresources[i]->index, + d3d11CommandBuffer->colorTargetSubresources[i]->parent->handle, + d3d11CommandBuffer->colorTargetSubresources[i]->index, + SDLToD3D11_TextureFormat[d3d11CommandBuffer->colorTargetSubresources[i]->parent->container->header.info.format]); } } + ID3D11DeviceContext_VSSetSamplers( + d3d11CommandBuffer->context, + 0, + MAX_TEXTURE_SAMPLERS_PER_STAGE, + renderer->nullSamplers); + + ID3D11DeviceContext_VSSetShaderResources( + d3d11CommandBuffer->context, + 0, + MAX_TEXTURE_SAMPLERS_PER_STAGE * 2 + MAX_STORAGE_TEXTURES_PER_STAGE + MAX_STORAGE_BUFFERS_PER_STAGE, + renderer->nullSRVs); + + ID3D11DeviceContext_PSSetSamplers( + d3d11CommandBuffer->context, + 0, + MAX_TEXTURE_SAMPLERS_PER_STAGE, + renderer->nullSamplers); + + ID3D11DeviceContext_PSSetShaderResources( + d3d11CommandBuffer->context, + 0, + MAX_TEXTURE_SAMPLERS_PER_STAGE * 2 + MAX_STORAGE_TEXTURES_PER_STAGE + MAX_STORAGE_BUFFERS_PER_STAGE, + renderer->nullSRVs); + // Reset bind state SDL_zeroa(d3d11CommandBuffer->vertexBuffers); SDL_zeroa(d3d11CommandBuffer->vertexBufferOffsets); d3d11CommandBuffer->vertexBufferCount = 0; SDL_zeroa(d3d11CommandBuffer->vertexSamplers); - SDL_zeroa(d3d11CommandBuffer->vertexShaderResourceViews); + SDL_zeroa(d3d11CommandBuffer->vertexSamplerTextures); + SDL_zeroa(d3d11CommandBuffer->vertexStorageTextures); + SDL_zeroa(d3d11CommandBuffer->vertexStorageBuffers); SDL_zeroa(d3d11CommandBuffer->fragmentSamplers); - SDL_zeroa(d3d11CommandBuffer->fragmentShaderResourceViews); + SDL_zeroa(d3d11CommandBuffer->fragmentSamplerTextures); + SDL_zeroa(d3d11CommandBuffer->fragmentStorageTextures); + SDL_zeroa(d3d11CommandBuffer->fragmentStorageBuffers); } static void D3D11_PushVertexUniformData( SDL_GPUCommandBuffer *commandBuffer, Uint32 slotIndex, const void *data, - Uint32 dataLengthInBytes) + Uint32 length) { D3D11_INTERNAL_PushUniformData( (D3D11CommandBuffer *)commandBuffer, SDL_GPU_SHADERSTAGE_VERTEX, slotIndex, data, - dataLengthInBytes); + length); } static void D3D11_PushFragmentUniformData( SDL_GPUCommandBuffer *commandBuffer, Uint32 slotIndex, const void *data, - Uint32 dataLengthInBytes) + Uint32 length) { D3D11_INTERNAL_PushUniformData( (D3D11CommandBuffer *)commandBuffer, SDL_GPU_SHADERSTAGE_FRAGMENT, slotIndex, data, - dataLengthInBytes); + length); } // Blit static void D3D11_Blit( SDL_GPUCommandBuffer *commandBuffer, - SDL_GPUBlitRegion *source, - SDL_GPUBlitRegion *destination, - SDL_FlipMode flipMode, - SDL_GPUFilter filterMode, - bool cycle) + const SDL_GPUBlitInfo *info) { D3D11CommandBuffer *d3d11CommandBuffer = (D3D11CommandBuffer *)commandBuffer; D3D11Renderer *renderer = (D3D11Renderer *)d3d11CommandBuffer->renderer; @@ -4135,11 +4263,7 @@ static void D3D11_Blit( SDL_GPU_BlitCommon( commandBuffer, - source, - destination, - flipMode, - filterMode, - cycle, + info, renderer->blitLinearSampler, renderer->blitNearestSampler, NULL, @@ -4147,6 +4271,7 @@ static void D3D11_Blit( NULL, NULL, NULL, + NULL, &blitPipelines, NULL, NULL); @@ -4156,39 +4281,36 @@ static void D3D11_Blit( static void D3D11_BeginComputePass( SDL_GPUCommandBuffer *commandBuffer, - SDL_GPUStorageTextureWriteOnlyBinding *storageTextureBindings, - Uint32 storageTextureBindingCount, - SDL_GPUStorageBufferWriteOnlyBinding *storageBufferBindings, - Uint32 storageBufferBindingCount) + const SDL_GPUStorageTextureWriteOnlyBinding *storageTextureBindings, + Uint32 numStorageTextureBindings, + const SDL_GPUStorageBufferWriteOnlyBinding *storageBufferBindings, + Uint32 numStorageBufferBindings) { D3D11CommandBuffer *d3d11CommandBuffer = (D3D11CommandBuffer *)commandBuffer; D3D11TextureContainer *textureContainer; D3D11TextureSubresource *textureSubresource; D3D11BufferContainer *bufferContainer; D3D11Buffer *buffer; - Uint32 i; + ID3D11UnorderedAccessView *uavs[MAX_COMPUTE_WRITE_TEXTURES + MAX_COMPUTE_WRITE_BUFFERS]; - for (i = 0; i < storageTextureBindingCount; i += 1) { + for (Uint32 i = 0; i < numStorageTextureBindings; i += 1) { textureContainer = (D3D11TextureContainer *)storageTextureBindings[i].texture; - if (!(textureContainer->header.info.usageFlags & SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_WRITE)) { - SDL_LogError(SDL_LOG_CATEGORY_GPU, "Attempted to bind read-only texture as compute write texture"); - } textureSubresource = D3D11_INTERNAL_PrepareTextureSubresourceForWrite( d3d11CommandBuffer->renderer, textureContainer, storageTextureBindings[i].layer, - storageTextureBindings[i].mipLevel, + storageTextureBindings[i].mip_level, storageTextureBindings[i].cycle); D3D11_INTERNAL_TrackTexture( d3d11CommandBuffer, textureSubresource->parent); - d3d11CommandBuffer->computeUnorderedAccessViews[i] = textureSubresource->uav; + d3d11CommandBuffer->computeWriteOnlyStorageTextureSubresources[i] = textureSubresource; } - for (i = 0; i < storageBufferBindingCount; i += 1) { + for (Uint32 i = 0; i < numStorageBufferBindings; i += 1) { bufferContainer = (D3D11BufferContainer *)storageBufferBindings[i].buffer; buffer = D3D11_INTERNAL_PrepareBufferForWrite( @@ -4200,10 +4322,23 @@ static void D3D11_BeginComputePass( d3d11CommandBuffer, buffer); - d3d11CommandBuffer->computeUnorderedAccessViews[i + storageTextureBindingCount] = buffer->uav; + d3d11CommandBuffer->computeWriteOnlyStorageBuffers[i] = buffer; } - d3d11CommandBuffer->needComputeUAVBind = true; + for (Uint32 i = 0; i < numStorageTextureBindings; i += 1) { + uavs[i] = d3d11CommandBuffer->computeWriteOnlyStorageTextureSubresources[i]->uav; + } + + for (Uint32 i = 0; i < numStorageBufferBindings; i += 1) { + uavs[numStorageTextureBindings + i] = d3d11CommandBuffer->computeWriteOnlyStorageBuffers[i]->uav; + } + + ID3D11DeviceContext_CSSetUnorderedAccessViews( + d3d11CommandBuffer->context, + 0, + numStorageTextureBindings + numStorageBufferBindings, + uavs, + NULL); } static void D3D11_BindComputePipeline( @@ -4222,74 +4357,102 @@ static void D3D11_BindComputePipeline( 0); // Acquire uniform buffers if necessary - for (Uint32 i = 0; i < pipeline->uniformBufferCount; i += 1) { + for (Uint32 i = 0; i < pipeline->numUniformBuffers; i += 1) { if (d3d11CommandBuffer->computeUniformBuffers[i] == NULL) { d3d11CommandBuffer->computeUniformBuffers[i] = D3D11_INTERNAL_AcquireUniformBufferFromPool( d3d11CommandBuffer); } } + d3d11CommandBuffer->needComputeSamplerBind = true; + d3d11CommandBuffer->needComputeReadOnlyTextureBind = true; + d3d11CommandBuffer->needComputeReadOnlyBufferBind = true; d3d11CommandBuffer->needComputeUniformBufferBind = true; } +static void D3D11_BindComputeSamplers( + SDL_GPUCommandBuffer *commandBuffer, + Uint32 firstSlot, + const SDL_GPUTextureSamplerBinding *textureSamplerBindings, + Uint32 numBindings) +{ + D3D11CommandBuffer *d3d11CommandBuffer = (D3D11CommandBuffer *)commandBuffer; + + for (Uint32 i = 0; i < numBindings; i += 1) { + D3D11TextureContainer *textureContainer = (D3D11TextureContainer *)textureSamplerBindings[i].texture; + + D3D11_INTERNAL_TrackTexture( + d3d11CommandBuffer, + textureContainer->activeTexture); + + d3d11CommandBuffer->computeSamplers[firstSlot + i] = + (D3D11Sampler *)textureSamplerBindings[i].sampler; + + d3d11CommandBuffer->computeSamplerTextures[firstSlot + i] = + textureContainer->activeTexture; + } + + d3d11CommandBuffer->needComputeSamplerBind = true; +} + static void D3D11_BindComputeStorageTextures( SDL_GPUCommandBuffer *commandBuffer, Uint32 firstSlot, - SDL_GPUTexture **storageTextures, - Uint32 bindingCount) + SDL_GPUTexture *const *storageTextures, + Uint32 numBindings) { D3D11CommandBuffer *d3d11CommandBuffer = (D3D11CommandBuffer *)commandBuffer; - for (Uint32 i = 0; i < bindingCount; i += 1) { + for (Uint32 i = 0; i < numBindings; i += 1) { D3D11TextureContainer *textureContainer = (D3D11TextureContainer *)storageTextures[i]; D3D11_INTERNAL_TrackTexture( d3d11CommandBuffer, textureContainer->activeTexture); - d3d11CommandBuffer->computeShaderResourceViews[firstSlot + i] = - textureContainer->activeTexture->shaderView; + d3d11CommandBuffer->computeReadOnlyStorageTextures[firstSlot + i] = + textureContainer->activeTexture; } - d3d11CommandBuffer->needComputeSRVBind = true; + d3d11CommandBuffer->needComputeReadOnlyTextureBind = true; } static void D3D11_BindComputeStorageBuffers( SDL_GPUCommandBuffer *commandBuffer, Uint32 firstSlot, - SDL_GPUBuffer **storageBuffers, - Uint32 bindingCount) + SDL_GPUBuffer *const *storageBuffers, + Uint32 numBindings) { D3D11CommandBuffer *d3d11CommandBuffer = (D3D11CommandBuffer *)commandBuffer; D3D11BufferContainer *bufferContainer; Uint32 i; - for (i = 0; i < bindingCount; i += 1) { + for (i = 0; i < numBindings; i += 1) { bufferContainer = (D3D11BufferContainer *)storageBuffers[i]; D3D11_INTERNAL_TrackBuffer( d3d11CommandBuffer, bufferContainer->activeBuffer); - d3d11CommandBuffer->computeShaderResourceViews[firstSlot + i + - d3d11CommandBuffer->computePipeline->readOnlyStorageTextureCount] = bufferContainer->activeBuffer->srv; + d3d11CommandBuffer->computeReadOnlyStorageBuffers[firstSlot + i] = + bufferContainer->activeBuffer; } - d3d11CommandBuffer->needComputeSRVBind = true; + d3d11CommandBuffer->needComputeReadOnlyBufferBind = true; } static void D3D11_PushComputeUniformData( SDL_GPUCommandBuffer *commandBuffer, Uint32 slotIndex, const void *data, - Uint32 dataLengthInBytes) + Uint32 length) { D3D11_INTERNAL_PushUniformData( (D3D11CommandBuffer *)commandBuffer, SDL_GPU_SHADERSTAGE_COMPUTE, slotIndex, data, - dataLengthInBytes); + length); } static void D3D11_INTERNAL_BindComputeResources( @@ -4297,40 +4460,73 @@ static void D3D11_INTERNAL_BindComputeResources( { D3D11ComputePipeline *computePipeline = commandBuffer->computePipeline; - Uint32 readOnlyResourceCount = - computePipeline->readOnlyStorageTextureCount + - computePipeline->readOnlyStorageBufferCount; - - Uint32 writeOnlyResourceCount = - computePipeline->writeOnlyStorageTextureCount + - computePipeline->writeOnlyStorageBufferCount; - ID3D11Buffer *nullBuf = NULL; - Uint32 offsetInConstants, blockSizeInConstants, i; + Uint32 offsetInConstants, blockSizeInConstants; - if (commandBuffer->needComputeUAVBind) { - ID3D11DeviceContext_CSSetUnorderedAccessViews( - commandBuffer->context, - 0, - writeOnlyResourceCount, - commandBuffer->computeUnorderedAccessViews, - NULL); + if (commandBuffer->needComputeSamplerBind) { + if (computePipeline->numSamplers > 0) { + ID3D11SamplerState *samplers[MAX_TEXTURE_SAMPLERS_PER_STAGE]; + ID3D11ShaderResourceView *srvs[MAX_TEXTURE_SAMPLERS_PER_STAGE]; - commandBuffer->needComputeUAVBind = false; + for (Uint32 i = 0; i < computePipeline->numSamplers; i += 1) { + samplers[i] = commandBuffer->computeSamplers[i]->handle; + srvs[i] = commandBuffer->computeSamplerTextures[i]->shaderView; + } + + ID3D11DeviceContext_CSSetSamplers( + commandBuffer->context, + 0, + computePipeline->numSamplers, + samplers); + + ID3D11DeviceContext_CSSetShaderResources( + commandBuffer->context, + 0, + computePipeline->numSamplers, + srvs); + } + + commandBuffer->needComputeSamplerBind = false; } - if (commandBuffer->needComputeSRVBind) { - ID3D11DeviceContext_CSSetShaderResources( - commandBuffer->context, - 0, - readOnlyResourceCount, - commandBuffer->computeShaderResourceViews); + if (commandBuffer->needComputeReadOnlyTextureBind) { + if (computePipeline->numReadonlyStorageTextures > 0) { + ID3D11ShaderResourceView *srvs[MAX_STORAGE_TEXTURES_PER_STAGE]; - commandBuffer->needComputeSRVBind = false; + for (Uint32 i = 0; i < computePipeline->numReadonlyStorageTextures; i += 1) { + srvs[i] = commandBuffer->computeReadOnlyStorageTextures[i]->shaderView; + } + + ID3D11DeviceContext_CSSetShaderResources( + commandBuffer->context, + computePipeline->numSamplers, + computePipeline->numReadonlyStorageTextures, + srvs); + } + + commandBuffer->needComputeReadOnlyTextureBind = false; + } + + if (commandBuffer->needComputeReadOnlyBufferBind) { + if (computePipeline->numReadonlyStorageBuffers > 0) { + ID3D11ShaderResourceView *srvs[MAX_STORAGE_TEXTURES_PER_STAGE]; + + for (Uint32 i = 0; i < computePipeline->numReadonlyStorageBuffers; i += 1) { + srvs[i] = commandBuffer->computeReadOnlyStorageBuffers[i]->srv; + } + + ID3D11DeviceContext_CSSetShaderResources( + commandBuffer->context, + computePipeline->numSamplers + computePipeline->numReadonlyStorageTextures, + computePipeline->numReadonlyStorageBuffers, + srvs); + } + + commandBuffer->needComputeReadOnlyBufferBind = false; } if (commandBuffer->needComputeUniformBufferBind) { - for (i = 0; i < computePipeline->uniformBufferCount; i += 1) { + for (Uint32 i = 0; i < computePipeline->numUniformBuffers; i += 1) { /* stupid workaround for god awful D3D11 drivers * see: https://learn.microsoft.com/en-us/windows/win32/api/d3d11_1/nf-d3d11_1-id3d11devicecontext1-vssetconstantbuffers1#calling-vssetconstantbuffers1-with-command-list-emulation */ @@ -4357,24 +4553,24 @@ static void D3D11_INTERNAL_BindComputeResources( static void D3D11_DispatchCompute( SDL_GPUCommandBuffer *commandBuffer, - Uint32 groupCountX, - Uint32 groupCountY, - Uint32 groupCountZ) + Uint32 groupcountX, + Uint32 groupcountY, + Uint32 groupcountZ) { D3D11CommandBuffer *d3d11CommandBuffer = (D3D11CommandBuffer *)commandBuffer; D3D11_INTERNAL_BindComputeResources(d3d11CommandBuffer); ID3D11DeviceContext_Dispatch( d3d11CommandBuffer->context, - groupCountX, - groupCountY, - groupCountZ); + groupcountX, + groupcountY, + groupcountZ); } static void D3D11_DispatchComputeIndirect( SDL_GPUCommandBuffer *commandBuffer, SDL_GPUBuffer *buffer, - Uint32 offsetInBytes) + Uint32 offset) { D3D11CommandBuffer *d3d11CommandBuffer = (D3D11CommandBuffer *)commandBuffer; D3D11Buffer *d3d11Buffer = ((D3D11BufferContainer *)buffer)->activeBuffer; @@ -4384,7 +4580,7 @@ static void D3D11_DispatchComputeIndirect( ID3D11DeviceContext_DispatchIndirect( d3d11CommandBuffer->context, d3d11Buffer->handle, - offsetInBytes); + offset); D3D11_INTERNAL_TrackBuffer(d3d11CommandBuffer, d3d11Buffer); } @@ -4393,6 +4589,7 @@ static void D3D11_EndComputePass( SDL_GPUCommandBuffer *commandBuffer) { D3D11CommandBuffer *d3d11CommandBuffer = (D3D11CommandBuffer *)commandBuffer; + D3D11Renderer *renderer = d3d11CommandBuffer->renderer; // reset UAV slots to avoid NULL set behavior // https://learn.microsoft.com/en-us/windows/win32/api/d3d11/nf-d3d11-id3d11devicecontext-cssetshaderresources @@ -4400,14 +4597,30 @@ static void D3D11_EndComputePass( d3d11CommandBuffer->context, 0, MAX_COMPUTE_WRITE_TEXTURES + MAX_COMPUTE_WRITE_BUFFERS, - nullUAVs, + renderer->nullUAVs, NULL); + ID3D11DeviceContext_CSSetSamplers( + d3d11CommandBuffer->context, + 0, + MAX_TEXTURE_SAMPLERS_PER_STAGE, + renderer->nullSamplers); + + ID3D11DeviceContext_CSSetShaderResources( + d3d11CommandBuffer->context, + 0, + MAX_TEXTURE_SAMPLERS_PER_STAGE + MAX_STORAGE_TEXTURES_PER_STAGE + MAX_STORAGE_BUFFERS_PER_STAGE, + renderer->nullSRVs); + d3d11CommandBuffer->computePipeline = NULL; // Reset bind state - SDL_zeroa(d3d11CommandBuffer->computeUnorderedAccessViews); - SDL_zeroa(d3d11CommandBuffer->computeShaderResourceViews); + SDL_zeroa(d3d11CommandBuffer->computeSamplers); + SDL_zeroa(d3d11CommandBuffer->computeSamplerTextures); + SDL_zeroa(d3d11CommandBuffer->computeReadOnlyStorageTextures); + SDL_zeroa(d3d11CommandBuffer->computeReadOnlyStorageBuffers); + SDL_zeroa(d3d11CommandBuffer->computeWriteOnlyStorageTextureSubresources); + SDL_zeroa(d3d11CommandBuffer->computeWriteOnlyStorageBuffers); } // Fence Cleanup @@ -4626,7 +4839,7 @@ static void D3D11_INTERNAL_PerformPendingDestroys( for (i = renderer->transferBufferContainersToDestroyCount - 1; i >= 0; i -= 1) { referenceCount = 0; for (j = 0; j < renderer->transferBufferContainersToDestroy[i]->bufferCount; j += 1) { - referenceCount += SDL_AtomicGet(&renderer->transferBufferContainersToDestroy[i]->buffers[j]->referenceCount); + referenceCount += SDL_GetAtomicInt(&renderer->transferBufferContainersToDestroy[i]->buffers[j]->referenceCount); } if (referenceCount == 0) { @@ -4641,7 +4854,7 @@ static void D3D11_INTERNAL_PerformPendingDestroys( for (i = renderer->bufferContainersToDestroyCount - 1; i >= 0; i -= 1) { referenceCount = 0; for (j = 0; j < renderer->bufferContainersToDestroy[i]->bufferCount; j += 1) { - referenceCount += SDL_AtomicGet(&renderer->bufferContainersToDestroy[i]->buffers[j]->referenceCount); + referenceCount += SDL_GetAtomicInt(&renderer->bufferContainersToDestroy[i]->buffers[j]->referenceCount); } if (referenceCount == 0) { @@ -4656,7 +4869,7 @@ static void D3D11_INTERNAL_PerformPendingDestroys( for (i = renderer->textureContainersToDestroyCount - 1; i >= 0; i -= 1) { referenceCount = 0; for (j = 0; j < renderer->textureContainersToDestroy[i]->textureCount; j += 1) { - referenceCount += SDL_AtomicGet(&renderer->textureContainersToDestroy[i]->textures[j]->referenceCount); + referenceCount += SDL_GetAtomicInt(&renderer->textureContainersToDestroy[i]->textures[j]->referenceCount); } if (referenceCount == 0) { @@ -4695,8 +4908,8 @@ static void D3D11_INTERNAL_WaitForFence( static void D3D11_WaitForFences( SDL_GPURenderer *driverData, bool waitAll, - SDL_GPUFence **pFences, - Uint32 fenceCount) + SDL_GPUFence *const *fences, + Uint32 numFences) { D3D11Renderer *renderer = (D3D11Renderer *)driverData; D3D11Fence *fence; @@ -4704,16 +4917,16 @@ static void D3D11_WaitForFences( HRESULT res = S_FALSE; if (waitAll) { - for (Uint32 i = 0; i < fenceCount; i += 1) { - fence = (D3D11Fence *)pFences[i]; + for (Uint32 i = 0; i < numFences; i += 1) { + fence = (D3D11Fence *)fences[i]; D3D11_INTERNAL_WaitForFence(renderer, fence); } } else { SDL_LockMutex(renderer->contextLock); while (res != S_OK) { - for (Uint32 i = 0; i < fenceCount; i += 1) { - fence = (D3D11Fence *)pFences[i]; + for (Uint32 i = 0; i < numFences; i += 1) { + fence = (D3D11Fence *)fences[i]; res = ID3D11DeviceContext_GetData( renderer->immediateContext, (ID3D11Asynchronous *)fence->handle, @@ -4822,20 +5035,16 @@ static bool D3D11_INTERNAL_InitializeSwapchainTexture( return false; } - // Create container - // Fill out the texture struct pTexture->handle = NULL; // This will be set in AcquireSwapchainTexture. pTexture->shaderView = NULL; // We don't allow swapchain texture to be sampled - SDL_AtomicSet(&pTexture->referenceCount, 0); + SDL_SetAtomicInt(&pTexture->referenceCount, 0); pTexture->subresourceCount = 1; pTexture->subresources = SDL_malloc(sizeof(D3D11TextureSubresource)); pTexture->subresources[0].colorTargetViews = SDL_calloc(1, sizeof(ID3D11RenderTargetView *)); pTexture->subresources[0].colorTargetViews[0] = rtv; pTexture->subresources[0].uav = NULL; pTexture->subresources[0].depthStencilTargetView = NULL; - pTexture->subresources[0].msaaHandle = NULL; - pTexture->subresources[0].msaaTargetView = NULL; pTexture->subresources[0].layer = 0; pTexture->subresources[0].level = 0; pTexture->subresources[0].depth = 1; @@ -4991,12 +5200,12 @@ static bool D3D11_INTERNAL_CreateSwapchain( windowData->textureContainer.textureCount = 1; windowData->textureContainer.textureCapacity = 1; - windowData->textureContainer.header.info.layerCountOrDepth = 1; + windowData->textureContainer.header.info.layer_count_or_depth = 1; windowData->textureContainer.header.info.format = SwapchainCompositionToSDLTextureFormat[windowData->swapchainComposition]; windowData->textureContainer.header.info.type = SDL_GPU_TEXTURETYPE_2D; - windowData->textureContainer.header.info.levelCount = 1; - windowData->textureContainer.header.info.sampleCount = SDL_GPU_SAMPLECOUNT_1; - windowData->textureContainer.header.info.usageFlags = SDL_GPU_TEXTUREUSAGE_COLOR_TARGET; + windowData->textureContainer.header.info.num_levels = 1; + windowData->textureContainer.header.info.sample_count = SDL_GPU_SAMPLECOUNT_1; + windowData->textureContainer.header.info.usage = SDL_GPU_TEXTUREUSAGE_COLOR_TARGET; windowData->texture.container = &windowData->textureContainer; windowData->texture.containerIndex = 0; @@ -5175,7 +5384,7 @@ static void D3D11_INTERNAL_DestroySwapchain( if (windowData->inFlightFences[i] != NULL) { D3D11_ReleaseFence( (SDL_GPURenderer *)renderer, - (SDL_GPUFence *)windowData->inFlightFences[i]); + windowData->inFlightFences[i]); } } } @@ -5213,14 +5422,14 @@ static void D3D11_ReleaseWindow( static SDL_GPUTexture *D3D11_AcquireSwapchainTexture( SDL_GPUCommandBuffer *commandBuffer, SDL_Window *window, - Uint32 *pWidth, - Uint32 *pHeight) + Uint32 *w, + Uint32 *h) { D3D11CommandBuffer *d3d11CommandBuffer = (D3D11CommandBuffer *)commandBuffer; D3D11Renderer *renderer = (D3D11Renderer *)d3d11CommandBuffer->renderer; D3D11WindowData *windowData; DXGI_SWAP_CHAIN_DESC swapchainDesc; - int w, h; + int windowW, windowH; HRESULT res; windowData = D3D11_INTERNAL_FetchWindowData(window); @@ -5230,14 +5439,14 @@ static SDL_GPUTexture *D3D11_AcquireSwapchainTexture( // Check for window size changes and resize the swapchain if needed. IDXGISwapChain_GetDesc(windowData->swapchain, &swapchainDesc); - SDL_GetWindowSize(window, &w, &h); + SDL_GetWindowSize(window, &windowW, &windowH); - if ((UINT)w != swapchainDesc.BufferDesc.Width || (UINT)h != swapchainDesc.BufferDesc.Height) { + if ((UINT)windowW != swapchainDesc.BufferDesc.Width || (UINT)windowH != swapchainDesc.BufferDesc.Height) { res = D3D11_INTERNAL_ResizeSwapchain( renderer, windowData, - w, - h); + windowW, + windowH); ERROR_CHECK_RETURN("Could not resize swapchain", NULL); } @@ -5247,12 +5456,12 @@ static SDL_GPUTexture *D3D11_AcquireSwapchainTexture( D3D11_WaitForFences( (SDL_GPURenderer *)renderer, true, - (SDL_GPUFence **)&windowData->inFlightFences[windowData->frameCounter], + &windowData->inFlightFences[windowData->frameCounter], 1); } else { if (!D3D11_QueryFence( (SDL_GPURenderer *)d3d11CommandBuffer->renderer, - (SDL_GPUFence *)windowData->inFlightFences[windowData->frameCounter])) { + windowData->inFlightFences[windowData->frameCounter])) { /* * In MAILBOX or IMMEDIATE mode, if the least recent fence is not signaled, * return NULL to indicate that rendering should be skipped @@ -5263,7 +5472,7 @@ static SDL_GPUTexture *D3D11_AcquireSwapchainTexture( D3D11_ReleaseFence( (SDL_GPURenderer *)d3d11CommandBuffer->renderer, - (SDL_GPUFence *)windowData->inFlightFences[windowData->frameCounter]); + windowData->inFlightFences[windowData->frameCounter]); windowData->inFlightFences[windowData->frameCounter] = NULL; } @@ -5277,12 +5486,12 @@ static SDL_GPUTexture *D3D11_AcquireSwapchainTexture( ERROR_CHECK_RETURN("Could not acquire swapchain!", NULL); // Send the dimensions to the out parameters. - *pWidth = w; - *pHeight = h; + *w = windowW; + *h = windowH; // Update the texture container dimensions - windowData->textureContainer.header.info.width = w; - windowData->textureContainer.header.info.height = h; + windowData->textureContainer.header.info.width = windowW; + windowData->textureContainer.header.info.height = windowH; // Set up presentation if (d3d11CommandBuffer->windowDataCount == d3d11CommandBuffer->windowDataCapacity) { @@ -5306,7 +5515,7 @@ static SDL_GPUTextureFormat D3D11_GetSwapchainTextureFormat( if (windowData == NULL) { SDL_LogError(SDL_LOG_CATEGORY_GPU, "Cannot get swapchain format, window has not been claimed!"); - return 0; + return SDL_GPU_TEXTUREFORMAT_INVALID; } return windowData->textureContainer.header.info.format; @@ -5447,7 +5656,7 @@ static void D3D11_Submit( ID3D11Texture2D_Release(windowData->texture.handle); - windowData->inFlightFences[windowData->frameCounter] = d3d11CommandBuffer->fence; + windowData->inFlightFences[windowData->frameCounter] = (SDL_GPUFence*)d3d11CommandBuffer->fence; (void)SDL_AtomicIncRef(&d3d11CommandBuffer->fence->referenceCount); @@ -5564,6 +5773,9 @@ static bool D3D11_SupportsTextureFormat( if (type == SDL_GPU_TEXTURETYPE_CUBE && !(formatSupport & D3D11_FORMAT_SUPPORT_TEXTURECUBE)) { return false; } + if (type == SDL_GPU_TEXTURETYPE_CUBE_ARRAY && !(formatSupport & D3D11_FORMAT_SUPPORT_TEXTURECUBE)) { + return false; + } // Are the usage flags supported? if ((usage & SDL_GPU_TEXTUREUSAGE_SAMPLER) && !(formatSupport & D3D11_FORMAT_SUPPORT_SHADER_SAMPLE)) { @@ -5588,12 +5800,12 @@ static bool D3D11_SupportsTextureFormat( // Device Creation -static bool D3D11_PrepareDriver(SDL_VideoDevice *_this) +static bool D3D11_PrepareDriver(SDL_VideoDevice *this) { void *d3d11_dll, *dxgi_dll; PFN_D3D11_CREATE_DEVICE D3D11CreateDeviceFunc; D3D_FEATURE_LEVEL levels[] = { D3D_FEATURE_LEVEL_11_1 }; - PFN_CREATE_DXGI_FACTORY1 CreateDXGIFactoryFunc; + PFN_CREATE_DXGI_FACTORY1 CreateDxgiFactoryFunc; HRESULT res; // Can we load D3D11? @@ -5642,11 +5854,11 @@ static bool D3D11_PrepareDriver(SDL_VideoDevice *_this) return false; } - CreateDXGIFactoryFunc = (PFN_CREATE_DXGI_FACTORY1)SDL_LoadFunction( + CreateDxgiFactoryFunc = (PFN_CREATE_DXGI_FACTORY1)SDL_LoadFunction( dxgi_dll, CREATE_DXGI_FACTORY1_FUNC); SDL_UnloadObject(dxgi_dll); // We're not going to call this function, so we can just unload now. - if (CreateDXGIFactoryFunc == NULL) { + if (CreateDxgiFactoryFunc == NULL) { SDL_LogWarn(SDL_LOG_CATEGORY_GPU, "D3D11: Could not find function " CREATE_DXGI_FACTORY1_FUNC " in " DXGI_DLL); return false; } @@ -5695,18 +5907,19 @@ static void D3D11_INTERNAL_InitBlitPipelines( SDL_GPUShader *blitFrom2DArrayPixelShader; SDL_GPUShader *blitFrom3DPixelShader; SDL_GPUShader *blitFromCubePixelShader; + SDL_GPUShader *blitFromCubeArrayPixelShader; SDL_GPUGraphicsPipelineCreateInfo blitPipelineCreateInfo; SDL_GPUGraphicsPipeline *blitPipeline; SDL_GPUSamplerCreateInfo samplerCreateInfo; - SDL_GPUColorAttachmentDescription colorAttachmentDesc; + SDL_GPUColorTargetDescription colorTargetDesc; // Fullscreen vertex shader SDL_zero(shaderCreateInfo); shaderCreateInfo.code = (Uint8 *)D3D11_FullscreenVert; - shaderCreateInfo.codeSize = sizeof(D3D11_FullscreenVert); + shaderCreateInfo.code_size = sizeof(D3D11_FullscreenVert); shaderCreateInfo.stage = SDL_GPU_SHADERSTAGE_VERTEX; shaderCreateInfo.format = SDL_GPU_SHADERFORMAT_DXBC; - shaderCreateInfo.entryPointName = "main"; + shaderCreateInfo.entrypoint = "main"; fullscreenVertexShader = D3D11_CreateShader( (SDL_GPURenderer *)renderer, @@ -5718,10 +5931,10 @@ static void D3D11_INTERNAL_InitBlitPipelines( // BlitFrom2D pixel shader shaderCreateInfo.code = (Uint8 *)D3D11_BlitFrom2D; - shaderCreateInfo.codeSize = sizeof(D3D11_BlitFrom2D); + shaderCreateInfo.code_size = sizeof(D3D11_BlitFrom2D); shaderCreateInfo.stage = SDL_GPU_SHADERSTAGE_FRAGMENT; - shaderCreateInfo.samplerCount = 1; - shaderCreateInfo.uniformBufferCount = 1; + shaderCreateInfo.num_samplers = 1; + shaderCreateInfo.num_uniform_buffers = 1; blitFrom2DPixelShader = D3D11_CreateShader( (SDL_GPURenderer *)renderer, @@ -5733,7 +5946,7 @@ static void D3D11_INTERNAL_InitBlitPipelines( // BlitFrom2DArray pixel shader shaderCreateInfo.code = (Uint8 *)D3D11_BlitFrom2DArray; - shaderCreateInfo.codeSize = sizeof(D3D11_BlitFrom2DArray); + shaderCreateInfo.code_size = sizeof(D3D11_BlitFrom2DArray); blitFrom2DArrayPixelShader = D3D11_CreateShader( (SDL_GPURenderer *)renderer, @@ -5745,7 +5958,7 @@ static void D3D11_INTERNAL_InitBlitPipelines( // BlitFrom3D pixel shader shaderCreateInfo.code = (Uint8 *)D3D11_BlitFrom3D; - shaderCreateInfo.codeSize = sizeof(D3D11_BlitFrom3D); + shaderCreateInfo.code_size = sizeof(D3D11_BlitFrom3D); blitFrom3DPixelShader = D3D11_CreateShader( (SDL_GPURenderer *)renderer, @@ -5757,7 +5970,7 @@ static void D3D11_INTERNAL_InitBlitPipelines( // BlitFromCube pixel shader shaderCreateInfo.code = (Uint8 *)D3D11_BlitFromCube; - shaderCreateInfo.codeSize = sizeof(D3D11_BlitFromCube); + shaderCreateInfo.code_size = sizeof(D3D11_BlitFromCube); blitFromCubePixelShader = D3D11_CreateShader( (SDL_GPURenderer *)renderer, @@ -5767,30 +5980,37 @@ static void D3D11_INTERNAL_InitBlitPipelines( SDL_LogError(SDL_LOG_CATEGORY_GPU, "Failed to compile BlitFromCube pixel shader!"); } + // BlitFromCubeArray pixel shader + shaderCreateInfo.code = (Uint8 *)D3D11_BlitFromCubeArray; + shaderCreateInfo.code_size = sizeof(D3D11_BlitFromCubeArray); + + blitFromCubeArrayPixelShader = D3D11_CreateShader( + (SDL_GPURenderer *)renderer, + &shaderCreateInfo); + + if (blitFromCubeArrayPixelShader == NULL) { + SDL_LogError(SDL_LOG_CATEGORY_GPU, "Failed to compile BlitFromCubeArray pixel shader!"); + } + // BlitFrom2D pipeline SDL_zero(blitPipelineCreateInfo); - SDL_zero(colorAttachmentDesc); - colorAttachmentDesc.blendState.colorWriteMask = 0xF; - colorAttachmentDesc.format = SDL_GPU_TEXTUREFORMAT_R8G8B8A8_UNORM; // format doesn't matter in d3d11 + SDL_zero(colorTargetDesc); + colorTargetDesc.blend_state.color_write_mask = 0xF; + colorTargetDesc.format = SDL_GPU_TEXTUREFORMAT_R8G8B8A8_UNORM; // format doesn't matter in d3d11 - blitPipelineCreateInfo.attachmentInfo.colorAttachmentDescriptions = &colorAttachmentDesc; - blitPipelineCreateInfo.attachmentInfo.colorAttachmentCount = 1; - blitPipelineCreateInfo.attachmentInfo.depthStencilFormat = SDL_GPU_TEXTUREFORMAT_D16_UNORM; // arbitrary - blitPipelineCreateInfo.attachmentInfo.hasDepthStencilAttachment = false; + blitPipelineCreateInfo.target_info.color_target_descriptions = &colorTargetDesc; + blitPipelineCreateInfo.target_info.num_color_targets = 1; + blitPipelineCreateInfo.target_info.depth_stencil_format = SDL_GPU_TEXTUREFORMAT_D16_UNORM; // arbitrary + blitPipelineCreateInfo.target_info.has_depth_stencil_target = false; - blitPipelineCreateInfo.vertexShader = fullscreenVertexShader; - blitPipelineCreateInfo.fragmentShader = blitFrom2DPixelShader; + blitPipelineCreateInfo.vertex_shader = fullscreenVertexShader; + blitPipelineCreateInfo.fragment_shader = blitFrom2DPixelShader; - blitPipelineCreateInfo.multisampleState.sampleCount = SDL_GPU_SAMPLECOUNT_1; - blitPipelineCreateInfo.multisampleState.sampleMask = 0xFFFFFFFF; + blitPipelineCreateInfo.multisample_state.sample_count = SDL_GPU_SAMPLECOUNT_1; + blitPipelineCreateInfo.multisample_state.enable_mask = false; - blitPipelineCreateInfo.primitiveType = SDL_GPU_PRIMITIVETYPE_TRIANGLELIST; - - blitPipelineCreateInfo.blendConstants[0] = 1.0f; - blitPipelineCreateInfo.blendConstants[1] = 1.0f; - blitPipelineCreateInfo.blendConstants[2] = 1.0f; - blitPipelineCreateInfo.blendConstants[3] = 1.0f; + blitPipelineCreateInfo.primitive_type = SDL_GPU_PRIMITIVETYPE_TRIANGLELIST; blitPipeline = D3D11_CreateGraphicsPipeline( (SDL_GPURenderer *)renderer, @@ -5805,7 +6025,7 @@ static void D3D11_INTERNAL_InitBlitPipelines( renderer->blitPipelines[SDL_GPU_TEXTURETYPE_2D].format = SDL_GPU_TEXTUREFORMAT_INVALID; // BlitFrom2DArrayPipeline - blitPipelineCreateInfo.fragmentShader = blitFrom2DArrayPixelShader; + blitPipelineCreateInfo.fragment_shader = blitFrom2DArrayPixelShader; blitPipeline = D3D11_CreateGraphicsPipeline( (SDL_GPURenderer *)renderer, &blitPipelineCreateInfo); @@ -5819,7 +6039,7 @@ static void D3D11_INTERNAL_InitBlitPipelines( renderer->blitPipelines[SDL_GPU_TEXTURETYPE_2D_ARRAY].format = SDL_GPU_TEXTUREFORMAT_INVALID; // BlitFrom3DPipeline - blitPipelineCreateInfo.fragmentShader = blitFrom3DPixelShader; + blitPipelineCreateInfo.fragment_shader = blitFrom3DPixelShader; blitPipeline = D3D11_CreateGraphicsPipeline( (SDL_GPURenderer *)renderer, &blitPipelineCreateInfo); @@ -5833,7 +6053,7 @@ static void D3D11_INTERNAL_InitBlitPipelines( renderer->blitPipelines[SDL_GPU_TEXTURETYPE_3D].format = SDL_GPU_TEXTUREFORMAT_INVALID; // BlitFromCubePipeline - blitPipelineCreateInfo.fragmentShader = blitFromCubePixelShader; + blitPipelineCreateInfo.fragment_shader = blitFromCubePixelShader; blitPipeline = D3D11_CreateGraphicsPipeline( (SDL_GPURenderer *)renderer, &blitPipelineCreateInfo); @@ -5846,18 +6066,32 @@ static void D3D11_INTERNAL_InitBlitPipelines( renderer->blitPipelines[SDL_GPU_TEXTURETYPE_CUBE].type = SDL_GPU_TEXTURETYPE_CUBE; renderer->blitPipelines[SDL_GPU_TEXTURETYPE_CUBE].format = SDL_GPU_TEXTUREFORMAT_INVALID; + // BlitFromCubeArrayPipeline + blitPipelineCreateInfo.fragment_shader = blitFromCubeArrayPixelShader; + blitPipeline = D3D11_CreateGraphicsPipeline( + (SDL_GPURenderer *)renderer, + &blitPipelineCreateInfo); + + if (blitPipeline == NULL) { + SDL_LogError(SDL_LOG_CATEGORY_GPU, "Failed to create BlitFromCubeArray pipeline!"); + } + + renderer->blitPipelines[SDL_GPU_TEXTURETYPE_CUBE_ARRAY].pipeline = blitPipeline; + renderer->blitPipelines[SDL_GPU_TEXTURETYPE_CUBE_ARRAY].type = SDL_GPU_TEXTURETYPE_CUBE_ARRAY; + renderer->blitPipelines[SDL_GPU_TEXTURETYPE_CUBE_ARRAY].format = SDL_GPU_TEXTUREFORMAT_INVALID; + // Create samplers - samplerCreateInfo.addressModeU = SDL_GPU_SAMPLERADDRESSMODE_CLAMP_TO_EDGE; - samplerCreateInfo.addressModeV = SDL_GPU_SAMPLERADDRESSMODE_CLAMP_TO_EDGE; - samplerCreateInfo.addressModeW = SDL_GPU_SAMPLERADDRESSMODE_CLAMP_TO_EDGE; - samplerCreateInfo.anisotropyEnable = 0; - samplerCreateInfo.compareEnable = 0; - samplerCreateInfo.magFilter = SDL_GPU_FILTER_NEAREST; - samplerCreateInfo.minFilter = SDL_GPU_FILTER_NEAREST; - samplerCreateInfo.mipmapMode = SDL_GPU_SAMPLERMIPMAPMODE_NEAREST; - samplerCreateInfo.mipLodBias = 0.0f; - samplerCreateInfo.minLod = 0; - samplerCreateInfo.maxLod = 1000; + samplerCreateInfo.address_mode_u = SDL_GPU_SAMPLERADDRESSMODE_CLAMP_TO_EDGE; + samplerCreateInfo.address_mode_v = SDL_GPU_SAMPLERADDRESSMODE_CLAMP_TO_EDGE; + samplerCreateInfo.address_mode_w = SDL_GPU_SAMPLERADDRESSMODE_CLAMP_TO_EDGE; + samplerCreateInfo.enable_anisotropy = 0; + samplerCreateInfo.enable_compare = 0; + samplerCreateInfo.mag_filter = SDL_GPU_FILTER_NEAREST; + samplerCreateInfo.min_filter = SDL_GPU_FILTER_NEAREST; + samplerCreateInfo.mipmap_mode = SDL_GPU_SAMPLERMIPMAPMODE_NEAREST; + samplerCreateInfo.mip_lod_bias = 0.0f; + samplerCreateInfo.min_lod = 0; + samplerCreateInfo.max_lod = 1000; renderer->blitNearestSampler = D3D11_CreateSampler( (SDL_GPURenderer *)renderer, @@ -5867,9 +6101,9 @@ static void D3D11_INTERNAL_InitBlitPipelines( SDL_LogError(SDL_LOG_CATEGORY_GPU, "Failed to create blit nearest sampler!"); } - samplerCreateInfo.magFilter = SDL_GPU_FILTER_LINEAR; - samplerCreateInfo.minFilter = SDL_GPU_FILTER_LINEAR; - samplerCreateInfo.mipmapMode = SDL_GPU_SAMPLERMIPMAPMODE_LINEAR; + samplerCreateInfo.mag_filter = SDL_GPU_FILTER_LINEAR; + samplerCreateInfo.min_filter = SDL_GPU_FILTER_LINEAR; + samplerCreateInfo.mipmap_mode = SDL_GPU_SAMPLERMIPMAPMODE_LINEAR; renderer->blitLinearSampler = D3D11_CreateSampler( (SDL_GPURenderer *)renderer, @@ -5885,6 +6119,7 @@ static void D3D11_INTERNAL_InitBlitPipelines( D3D11_ReleaseShader((SDL_GPURenderer *)renderer, blitFrom2DArrayPixelShader); D3D11_ReleaseShader((SDL_GPURenderer *)renderer, blitFrom3DPixelShader); D3D11_ReleaseShader((SDL_GPURenderer *)renderer, blitFromCubePixelShader); + D3D11_ReleaseShader((SDL_GPURenderer *)renderer, blitFromCubeArrayPixelShader); } static void D3D11_INTERNAL_DestroyBlitPipelines( @@ -5901,7 +6136,7 @@ static void D3D11_INTERNAL_DestroyBlitPipelines( static SDL_GPUDevice *D3D11_CreateDevice(bool debugMode, bool preferLowPower, SDL_PropertiesID props) { D3D11Renderer *renderer; - PFN_CREATE_DXGI_FACTORY1 CreateDXGIFactoryFunc; + PFN_CREATE_DXGI_FACTORY1 CreateDxgiFactoryFunc; PFN_D3D11_CREATE_DEVICE D3D11CreateDeviceFunc; D3D_FEATURE_LEVEL levels[] = { D3D_FEATURE_LEVEL_11_1 }; IDXGIFactory4 *factory4; @@ -5923,16 +6158,16 @@ static SDL_GPUDevice *D3D11_CreateDevice(bool debugMode, bool preferLowPower, SD } // Load the CreateDXGIFactory1 function - CreateDXGIFactoryFunc = (PFN_CREATE_DXGI_FACTORY1)SDL_LoadFunction( + CreateDxgiFactoryFunc = (PFN_CREATE_DXGI_FACTORY1)SDL_LoadFunction( renderer->dxgi_dll, CREATE_DXGI_FACTORY1_FUNC); - if (CreateDXGIFactoryFunc == NULL) { + if (CreateDxgiFactoryFunc == NULL) { SDL_LogError(SDL_LOG_CATEGORY_GPU, "Could not load function: " CREATE_DXGI_FACTORY1_FUNC); return NULL; } // Create the DXGI factory - res = CreateDXGIFactoryFunc( + res = CreateDxgiFactoryFunc( &D3D_IID_IDXGIFactory1, (void **)&renderer->factory); ERROR_CHECK_RETURN("Could not create DXGIFactory", NULL); @@ -6127,10 +6362,10 @@ tryCreateDevice: // Initialize null states - SDL_zeroa(nullRTVs); - SDL_zeroa(nullSRVs); - SDL_zeroa(nullSamplers); - SDL_zeroa(nullUAVs); + SDL_zeroa(renderer->nullRTVs); + SDL_zeroa(renderer->nullSRVs); + SDL_zeroa(renderer->nullSamplers); + SDL_zeroa(renderer->nullUAVs); // Initialize built-in pipelines D3D11_INTERNAL_InitBlitPipelines(renderer); @@ -6145,7 +6380,6 @@ tryCreateDevice: SDL_GPUBootstrap D3D11Driver = { "direct3d11", - SDL_GPU_DRIVER_D3D11, SDL_GPU_SHADERFORMAT_DXBC, D3D11_PrepareDriver, D3D11_CreateDevice diff --git a/src/gpu/d3d11/compile_shaders.bat b/src/gpu/d3d11/compile_shaders.bat index 4880b85f..56eadcc2 100644 --- a/src/gpu/d3d11/compile_shaders.bat +++ b/src/gpu/d3d11/compile_shaders.bat @@ -3,5 +3,6 @@ fxc /T ps_5_0 /E BlitFrom2D /Fh D3D11_BlitFrom2D.h ..\d3dcommon\D3D_Blit.hlsl fxc /T ps_5_0 /E BlitFrom2DArray /Fh D3D11_BlitFrom2DArray.h ..\d3dcommon\D3D_Blit.hlsl fxc /T ps_5_0 /E BlitFrom3D /Fh D3D11_BlitFrom3D.h ..\d3dcommon\D3D_Blit.hlsl fxc /T ps_5_0 /E BlitFromCube /Fh D3D11_BlitFromCube.h ..\d3dcommon\D3D_Blit.hlsl -copy /b D3D11_FullscreenVert.h+D3D11_BlitFrom2D.h+D3D11_BlitFrom2DArray.h+D3D11_BlitFrom3D.h+D3D11_BlitFromCube.h D3D11_Blit.h -del D3D11_FullscreenVert.h D3D11_BlitFrom2D.h D3D11_BlitFrom2DArray.h D3D11_BlitFrom3D.h D3D11_BlitFromCube.h \ No newline at end of file +fxc /T ps_5_0 /E BlitFromCubeArray /Fh D3D11_BlitFromCubeArray.h ..\d3dcommon\D3D_Blit.hlsl +copy /b D3D11_FullscreenVert.h+D3D11_BlitFrom2D.h+D3D11_BlitFrom2DArray.h+D3D11_BlitFrom3D.h+D3D11_BlitFromCube.h+D3D11_BlitFromCubeArray.h D3D11_Blit.h +del D3D11_FullscreenVert.h D3D11_BlitFrom2D.h D3D11_BlitFrom2DArray.h D3D11_BlitFrom3D.h D3D11_BlitFromCube.h D3D11_BlitFromCubeArray.h diff --git a/src/gpu/d3d12/D3D12_Blit.h b/src/gpu/d3d12/D3D12_Blit.h index e83c957b..d8cfbaf6 100644 --- a/src/gpu/d3d12/D3D12_Blit.h +++ b/src/gpu/d3d12/D3D12_Blit.h @@ -119,43 +119,176 @@ attributes #1 = { nounwind } #endif const unsigned char g_FullscreenVert[] = { - 0x44, 0x58, 0x42, 0x43, 0x9a, 0xbe, 0xe2, 0x88, 0x72, 0x7c, 0xa1, 0x03, - 0xa6, 0x2d, 0x0a, 0x39, 0x62, 0x29, 0x6c, 0x96, 0x01, 0x00, 0x00, 0x00, - 0xb9, 0x0c, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, - 0x4c, 0x00, 0x00, 0x00, 0x88, 0x00, 0x00, 0x00, 0xed, 0x00, 0x00, 0x00, - 0x89, 0x01, 0x00, 0x00, 0x15, 0x07, 0x00, 0x00, 0x31, 0x07, 0x00, 0x00, - 0x53, 0x46, 0x49, 0x30, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x49, 0x53, 0x47, 0x31, 0x34, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x56, 0x65, 0x72, 0x74, 0x65, - 0x78, 0x49, 0x44, 0x00, 0x4f, 0x53, 0x47, 0x31, 0x5d, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x0c, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x54, 0x45, 0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44, 0x00, 0x53, 0x56, 0x5f, - 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x50, 0x53, 0x56, - 0x30, 0x94, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, + 0x44, 0x58, 0x42, 0x43, 0x81, 0xc4, 0x09, 0xbf, 0x6d, 0xef, 0xac, 0x67, + 0x8f, 0x1d, 0x64, 0xb4, 0xf2, 0x1e, 0x4b, 0xca, 0x01, 0x00, 0x00, 0x00, + 0x4d, 0x0d, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, + 0x50, 0x00, 0x00, 0x00, 0x8c, 0x00, 0x00, 0x00, 0xf1, 0x00, 0x00, 0x00, + 0x8d, 0x01, 0x00, 0x00, 0x1d, 0x02, 0x00, 0x00, 0xa9, 0x07, 0x00, 0x00, + 0xc5, 0x07, 0x00, 0x00, 0x53, 0x46, 0x49, 0x30, 0x08, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x49, 0x53, 0x47, 0x31, + 0x34, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x53, 0x56, 0x5f, 0x56, + 0x65, 0x72, 0x74, 0x65, 0x78, 0x49, 0x44, 0x00, 0x4f, 0x53, 0x47, 0x31, + 0x5d, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x03, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x51, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x54, 0x45, 0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44, + 0x00, 0x53, 0x56, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, + 0x00, 0x50, 0x53, 0x56, 0x30, 0x94, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, + 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, + 0xff, 0x01, 0x00, 0x00, 0x00, 0x01, 0x02, 0x00, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, - 0x00, 0x01, 0x02, 0x00, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x54, 0x45, + 0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x41, 0x01, 0x01, 0x00, 0x00, + 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x42, + 0x00, 0x03, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x01, 0x01, 0x44, 0x03, 0x03, 0x04, 0x00, 0x00, 0x33, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x54, 0x45, 0x58, 0x43, 0x4f, 0x4f, - 0x52, 0x44, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x01, 0x00, 0x41, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x42, 0x00, 0x03, 0x02, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x44, - 0x03, 0x03, 0x04, 0x00, 0x00, 0x33, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x53, 0x54, 0x41, - 0x54, 0x84, 0x05, 0x00, 0x00, 0x60, 0x00, 0x01, 0x00, 0x61, 0x01, 0x00, + 0x00, 0x52, 0x54, 0x53, 0x30, 0x88, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, + 0x00, 0x03, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x05, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x05, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, + 0x00, 0x05, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, + 0x00, 0x44, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, + 0xff, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x53, 0x54, 0x41, 0x54, 0x84, 0x05, 0x00, 0x00, 0x60, 0x00, 0x01, + 0x00, 0x61, 0x01, 0x00, 0x00, 0x44, 0x58, 0x49, 0x4c, 0x00, 0x01, 0x00, + 0x00, 0x10, 0x00, 0x00, 0x00, 0x6c, 0x05, 0x00, 0x00, 0x42, 0x43, 0xc0, + 0xde, 0x21, 0x0c, 0x00, 0x00, 0x58, 0x01, 0x00, 0x00, 0x0b, 0x82, 0x20, + 0x00, 0x02, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x07, 0x81, 0x23, + 0x91, 0x41, 0xc8, 0x04, 0x49, 0x06, 0x10, 0x32, 0x39, 0x92, 0x01, 0x84, + 0x0c, 0x25, 0x05, 0x08, 0x19, 0x1e, 0x04, 0x8b, 0x62, 0x80, 0x10, 0x45, + 0x02, 0x42, 0x92, 0x0b, 0x42, 0x84, 0x10, 0x32, 0x14, 0x38, 0x08, 0x18, + 0x4b, 0x0a, 0x32, 0x42, 0x88, 0x48, 0x90, 0x14, 0x20, 0x43, 0x46, 0x88, + 0xa5, 0x00, 0x19, 0x32, 0x42, 0xe4, 0x48, 0x0e, 0x90, 0x11, 0x22, 0xc4, + 0x50, 0x41, 0x51, 0x81, 0x8c, 0xe1, 0x83, 0xe5, 0x8a, 0x04, 0x21, 0x46, + 0x06, 0x51, 0x18, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x1b, 0x8c, 0xe0, + 0xff, 0xff, 0xff, 0xff, 0x07, 0x40, 0x02, 0xa8, 0x0d, 0x84, 0xf0, 0xff, + 0xff, 0xff, 0xff, 0x03, 0x20, 0x01, 0x00, 0x00, 0x00, 0x49, 0x18, 0x00, + 0x00, 0x02, 0x00, 0x00, 0x00, 0x13, 0x82, 0x60, 0x42, 0x20, 0x00, 0x00, + 0x00, 0x89, 0x20, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00, 0x32, 0x22, 0x08, + 0x09, 0x20, 0x64, 0x85, 0x04, 0x13, 0x22, 0xa4, 0x84, 0x04, 0x13, 0x22, + 0xe3, 0x84, 0xa1, 0x90, 0x14, 0x12, 0x4c, 0x88, 0x8c, 0x0b, 0x84, 0x84, + 0x4c, 0x10, 0x3c, 0x23, 0x00, 0x25, 0x00, 0x8a, 0x39, 0x02, 0x30, 0x98, + 0x23, 0x40, 0x8a, 0x31, 0x33, 0x43, 0x43, 0x35, 0x03, 0x50, 0x0c, 0x98, + 0x19, 0x3a, 0xc2, 0x81, 0x80, 0x61, 0x04, 0xe1, 0x18, 0x46, 0x20, 0x8e, + 0xa3, 0xa4, 0x29, 0xa2, 0x84, 0xc9, 0x7f, 0x89, 0x68, 0x22, 0xae, 0xd6, + 0x49, 0x91, 0x8b, 0x58, 0x90, 0xb0, 0x9c, 0x03, 0x03, 0x13, 0x14, 0x72, + 0xc0, 0x87, 0x74, 0x60, 0x87, 0x36, 0x68, 0x87, 0x79, 0x68, 0x03, 0x72, + 0xc0, 0x87, 0x0d, 0xaf, 0x50, 0x0e, 0x6d, 0xd0, 0x0e, 0x7a, 0x50, 0x0e, + 0x6d, 0x00, 0x0f, 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, + 0x6d, 0x90, 0x0e, 0x71, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, + 0x78, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x71, 0x60, 0x07, + 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xe9, 0x30, 0x07, 0x72, 0xa0, 0x07, + 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, + 0x74, 0xd0, 0x06, 0xe6, 0x10, 0x07, 0x76, 0xa0, 0x07, 0x73, 0x20, 0x07, + 0x6d, 0x60, 0x0e, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, + 0xe6, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, 0xe0, 0x0e, + 0x78, 0xa0, 0x07, 0x71, 0x60, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, + 0x76, 0x40, 0x07, 0x43, 0x9e, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x86, 0x3c, 0x05, 0x10, 0x00, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x79, 0x10, 0x20, 0x00, 0x04, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc8, 0x02, 0x01, 0x0e, 0x00, 0x00, + 0x00, 0x32, 0x1e, 0x98, 0x14, 0x19, 0x11, 0x4c, 0x90, 0x8c, 0x09, 0x26, + 0x47, 0xc6, 0x04, 0x43, 0x9a, 0x12, 0x18, 0x01, 0x28, 0x86, 0x02, 0x2a, + 0x83, 0x42, 0x28, 0x87, 0x92, 0x28, 0x90, 0xf2, 0x28, 0x97, 0xc2, 0x20, + 0x2a, 0x85, 0x12, 0x18, 0x01, 0x28, 0x89, 0x22, 0x28, 0x83, 0x42, 0xa0, + 0x9e, 0x01, 0x20, 0x1f, 0x6b, 0x08, 0x90, 0x39, 0x00, 0x79, 0x18, 0x00, + 0x00, 0x84, 0x00, 0x00, 0x00, 0x1a, 0x03, 0x4c, 0x90, 0x46, 0x02, 0x13, + 0x44, 0x35, 0x18, 0x63, 0x0b, 0x73, 0x3b, 0x03, 0xb1, 0x2b, 0x93, 0x9b, + 0x4b, 0x7b, 0x73, 0x03, 0x99, 0x71, 0xb9, 0x01, 0x41, 0xa1, 0x0b, 0x3b, + 0x9b, 0x7b, 0x91, 0x2a, 0x62, 0x2a, 0x0a, 0x9a, 0x2a, 0xfa, 0x9a, 0xb9, + 0x81, 0x79, 0x31, 0x4b, 0x73, 0x0b, 0x63, 0x4b, 0xd9, 0x10, 0x04, 0x13, + 0x84, 0x61, 0x98, 0x20, 0x0c, 0xc4, 0x06, 0x61, 0x20, 0x36, 0x08, 0x04, + 0x41, 0xc1, 0x6e, 0x6e, 0x82, 0x30, 0x14, 0x1b, 0x86, 0x03, 0x21, 0x26, + 0x08, 0x8d, 0x35, 0x41, 0x18, 0x0c, 0x0e, 0x74, 0x65, 0x78, 0x13, 0x84, + 0xe1, 0x98, 0x20, 0x0c, 0x08, 0x13, 0xaa, 0x22, 0xac, 0xa1, 0xa7, 0x27, + 0x29, 0x22, 0x98, 0x09, 0xc2, 0x90, 0x4c, 0x10, 0x06, 0x65, 0x03, 0x82, + 0x30, 0x0d, 0xe1, 0x3c, 0x50, 0xc4, 0x01, 0xee, 0x6d, 0x6e, 0x82, 0x30, + 0x2c, 0x5c, 0xa6, 0xac, 0xbe, 0xa0, 0x9e, 0xa6, 0x92, 0xa8, 0x92, 0x9e, + 0x9c, 0x36, 0x20, 0xc8, 0xd4, 0x50, 0x4e, 0x05, 0x45, 0x1b, 0x86, 0x45, + 0xb2, 0x36, 0x0c, 0x84, 0x72, 0x4d, 0x10, 0x04, 0x60, 0x03, 0xb0, 0x61, + 0x20, 0x34, 0x6d, 0x43, 0xb0, 0x6d, 0x18, 0x86, 0x8c, 0x9b, 0x20, 0x38, + 0xd7, 0x86, 0xc0, 0xa3, 0x63, 0x54, 0xc7, 0xc6, 0x36, 0x37, 0x26, 0x57, + 0x56, 0xe6, 0x66, 0x55, 0x26, 0x47, 0xc7, 0x65, 0xca, 0xea, 0xcb, 0xaa, + 0x4c, 0x8e, 0xae, 0x0c, 0x2f, 0x89, 0x68, 0x82, 0x40, 0x3c, 0x13, 0x04, + 0x02, 0xda, 0x10, 0x10, 0x13, 0x04, 0x22, 0xda, 0x20, 0x34, 0xc3, 0x86, + 0x85, 0x08, 0x03, 0x31, 0x18, 0x03, 0x32, 0x28, 0x83, 0x61, 0x0c, 0x88, + 0x32, 0x30, 0x83, 0x0d, 0xc1, 0x19, 0x10, 0xa1, 0x2a, 0xc2, 0x1a, 0x7a, + 0x7a, 0x92, 0x22, 0x9a, 0x20, 0x10, 0xd2, 0x04, 0x81, 0x98, 0x36, 0x08, + 0x4d, 0xb3, 0x61, 0x21, 0xd2, 0x40, 0x0d, 0xca, 0x80, 0x0c, 0xd6, 0x60, + 0x58, 0x03, 0xa2, 0x0c, 0xd8, 0x80, 0xcb, 0x94, 0xd5, 0x17, 0xd4, 0xdb, + 0x5c, 0x1a, 0x5d, 0xda, 0x9b, 0xdb, 0x04, 0x81, 0xa0, 0x26, 0x08, 0x44, + 0x35, 0x41, 0x18, 0x98, 0x0d, 0x42, 0x13, 0x07, 0x1b, 0x96, 0xc1, 0x0d, + 0xd4, 0xe0, 0x0d, 0xc8, 0x00, 0x0e, 0x06, 0x38, 0x18, 0xca, 0x40, 0x0e, + 0x36, 0x08, 0x6d, 0x30, 0x07, 0x1b, 0x06, 0x34, 0xa0, 0x03, 0x60, 0x43, + 0x91, 0x81, 0x41, 0x1d, 0x00, 0x00, 0x0d, 0x33, 0xb6, 0xb7, 0x30, 0xba, + 0x39, 0x16, 0x69, 0x6e, 0x73, 0x74, 0x73, 0x13, 0x84, 0xa1, 0xa1, 0x31, + 0x97, 0x76, 0xf6, 0xc5, 0x46, 0x46, 0x63, 0x2e, 0xed, 0xec, 0x6b, 0x8e, + 0x6e, 0x82, 0x30, 0x38, 0x2c, 0xea, 0xd2, 0xdc, 0xe8, 0xe6, 0x36, 0x28, + 0x77, 0x80, 0xe0, 0x41, 0x1e, 0xe8, 0xc1, 0xb0, 0x07, 0x7c, 0xd0, 0x07, + 0x4d, 0x15, 0x36, 0x36, 0xbb, 0x36, 0x97, 0x34, 0xb2, 0x32, 0x37, 0xba, + 0x29, 0x41, 0x50, 0x85, 0x0c, 0xcf, 0xc5, 0xae, 0x4c, 0x6e, 0x2e, 0xed, + 0xcd, 0x6d, 0x4a, 0x40, 0x34, 0x21, 0xc3, 0x73, 0xb1, 0x0b, 0x63, 0xb3, + 0x2b, 0x93, 0x9b, 0x12, 0x14, 0x75, 0xc8, 0xf0, 0x5c, 0xe6, 0xd0, 0xc2, + 0xc8, 0xca, 0xe4, 0x9a, 0xde, 0xc8, 0xca, 0xd8, 0xa6, 0x04, 0x48, 0x25, + 0x32, 0x3c, 0x17, 0xba, 0x3c, 0xb8, 0xb2, 0x20, 0x37, 0xb7, 0x37, 0xba, + 0x30, 0xba, 0xb4, 0x37, 0xb7, 0xb9, 0x29, 0xc2, 0xc5, 0xd5, 0x21, 0xc3, + 0x73, 0xb1, 0x4b, 0x2b, 0xbb, 0x4b, 0x22, 0x9b, 0xa2, 0x0b, 0xa3, 0x2b, + 0x9b, 0x12, 0x78, 0x75, 0xc8, 0xf0, 0x5c, 0xca, 0xdc, 0xe8, 0xe4, 0xf2, + 0xa0, 0xde, 0xd2, 0xdc, 0xe8, 0xe6, 0xa6, 0x04, 0x75, 0xd0, 0x85, 0x0c, + 0xcf, 0x65, 0xec, 0xad, 0xce, 0x8d, 0xae, 0x4c, 0x6e, 0x6e, 0x4a, 0xd0, + 0x07, 0x00, 0x00, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00, 0x4c, 0x00, 0x00, + 0x00, 0x33, 0x08, 0x80, 0x1c, 0xc4, 0xe1, 0x1c, 0x66, 0x14, 0x01, 0x3d, + 0x88, 0x43, 0x38, 0x84, 0xc3, 0x8c, 0x42, 0x80, 0x07, 0x79, 0x78, 0x07, + 0x73, 0x98, 0x71, 0x0c, 0xe6, 0x00, 0x0f, 0xed, 0x10, 0x0e, 0xf4, 0x80, + 0x0e, 0x33, 0x0c, 0x42, 0x1e, 0xc2, 0xc1, 0x1d, 0xce, 0xa1, 0x1c, 0x66, + 0x30, 0x05, 0x3d, 0x88, 0x43, 0x38, 0x84, 0x83, 0x1b, 0xcc, 0x03, 0x3d, + 0xc8, 0x43, 0x3d, 0x8c, 0x03, 0x3d, 0xcc, 0x78, 0x8c, 0x74, 0x70, 0x07, + 0x7b, 0x08, 0x07, 0x79, 0x48, 0x87, 0x70, 0x70, 0x07, 0x7a, 0x70, 0x03, + 0x76, 0x78, 0x87, 0x70, 0x20, 0x87, 0x19, 0xcc, 0x11, 0x0e, 0xec, 0x90, + 0x0e, 0xe1, 0x30, 0x0f, 0x6e, 0x30, 0x0f, 0xe3, 0xf0, 0x0e, 0xf0, 0x50, + 0x0e, 0x33, 0x10, 0xc4, 0x1d, 0xde, 0x21, 0x1c, 0xd8, 0x21, 0x1d, 0xc2, + 0x61, 0x1e, 0x66, 0x30, 0x89, 0x3b, 0xbc, 0x83, 0x3b, 0xd0, 0x43, 0x39, + 0xb4, 0x03, 0x3c, 0xbc, 0x83, 0x3c, 0x84, 0x03, 0x3b, 0xcc, 0xf0, 0x14, + 0x76, 0x60, 0x07, 0x7b, 0x68, 0x07, 0x37, 0x68, 0x87, 0x72, 0x68, 0x07, + 0x37, 0x80, 0x87, 0x70, 0x90, 0x87, 0x70, 0x60, 0x07, 0x76, 0x28, 0x07, + 0x76, 0xf8, 0x05, 0x76, 0x78, 0x87, 0x77, 0x80, 0x87, 0x5f, 0x08, 0x87, + 0x71, 0x18, 0x87, 0x72, 0x98, 0x87, 0x79, 0x98, 0x81, 0x2c, 0xee, 0xf0, + 0x0e, 0xee, 0xe0, 0x0e, 0xf5, 0xc0, 0x0e, 0xec, 0x30, 0x03, 0x62, 0xc8, + 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xcc, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xdc, + 0x61, 0x1c, 0xca, 0x21, 0x1c, 0xc4, 0x81, 0x1d, 0xca, 0x61, 0x06, 0xd6, + 0x90, 0x43, 0x39, 0xc8, 0x43, 0x39, 0x98, 0x43, 0x39, 0xc8, 0x43, 0x39, + 0xb8, 0xc3, 0x38, 0x94, 0x43, 0x38, 0x88, 0x03, 0x3b, 0x94, 0xc3, 0x2f, + 0xbc, 0x83, 0x3c, 0xfc, 0x82, 0x3b, 0xd4, 0x03, 0x3b, 0xb0, 0xc3, 0x0c, + 0xc4, 0x21, 0x07, 0x7c, 0x70, 0x03, 0x7a, 0x28, 0x87, 0x76, 0x80, 0x87, + 0x19, 0xd1, 0x43, 0x0e, 0xf8, 0xe0, 0x06, 0xe4, 0x20, 0x0e, 0xe7, 0xe0, + 0x06, 0xf6, 0x10, 0x0e, 0xf2, 0xc0, 0x0e, 0xe1, 0x90, 0x0f, 0xef, 0x50, + 0x0f, 0xf4, 0x00, 0x00, 0x00, 0x71, 0x20, 0x00, 0x00, 0x0c, 0x00, 0x00, + 0x00, 0x06, 0xe0, 0x7c, 0xd4, 0xb2, 0x48, 0x42, 0x44, 0x10, 0xcd, 0x4b, + 0x44, 0x93, 0x05, 0x4c, 0xc3, 0xe5, 0x3b, 0x8f, 0xbf, 0x38, 0xc0, 0x20, + 0x36, 0x0f, 0x35, 0xf9, 0xc8, 0x6d, 0x9b, 0x40, 0x35, 0x5c, 0xbe, 0xf3, + 0xf8, 0xd2, 0xe4, 0x44, 0x04, 0x4a, 0x4d, 0x0f, 0x35, 0xf9, 0xc5, 0x6d, + 0x03, 0x00, 0x00, 0x00, 0x00, 0x48, 0x41, 0x53, 0x48, 0x14, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x34, 0x75, 0x72, 0x25, 0x9f, 0x9a, 0x9e, + 0xa8, 0x4d, 0x2f, 0x90, 0xba, 0xfb, 0xd0, 0xe1, 0xae, 0x44, 0x58, 0x49, + 0x4c, 0x80, 0x05, 0x00, 0x00, 0x60, 0x00, 0x01, 0x00, 0x60, 0x01, 0x00, 0x00, 0x44, 0x58, 0x49, 0x4c, 0x00, 0x01, 0x00, 0x00, 0x10, 0x00, 0x00, - 0x00, 0x6c, 0x05, 0x00, 0x00, 0x42, 0x43, 0xc0, 0xde, 0x21, 0x0c, 0x00, - 0x00, 0x58, 0x01, 0x00, 0x00, 0x0b, 0x82, 0x20, 0x00, 0x02, 0x00, 0x00, + 0x00, 0x68, 0x05, 0x00, 0x00, 0x42, 0x43, 0xc0, 0xde, 0x21, 0x0c, 0x00, + 0x00, 0x57, 0x01, 0x00, 0x00, 0x0b, 0x82, 0x20, 0x00, 0x02, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x07, 0x81, 0x23, 0x91, 0x41, 0xc8, 0x04, 0x49, 0x06, 0x10, 0x32, 0x39, 0x92, 0x01, 0x84, 0x0c, 0x25, 0x05, 0x08, 0x19, 0x1e, 0x04, 0x8b, 0x62, 0x80, 0x10, 0x45, 0x02, 0x42, 0x92, 0x0b, @@ -167,14 +300,12 @@ const unsigned char g_FullscreenVert[] = { 0x07, 0x40, 0x02, 0xa8, 0x0d, 0x84, 0xf0, 0xff, 0xff, 0xff, 0xff, 0x03, 0x20, 0x01, 0x00, 0x00, 0x00, 0x49, 0x18, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x13, 0x82, 0x60, 0x42, 0x20, 0x00, 0x00, 0x00, 0x89, 0x20, 0x00, - 0x00, 0x15, 0x00, 0x00, 0x00, 0x32, 0x22, 0x08, 0x09, 0x20, 0x64, 0x85, + 0x00, 0x0f, 0x00, 0x00, 0x00, 0x32, 0x22, 0x08, 0x09, 0x20, 0x64, 0x85, 0x04, 0x13, 0x22, 0xa4, 0x84, 0x04, 0x13, 0x22, 0xe3, 0x84, 0xa1, 0x90, - 0x14, 0x12, 0x4c, 0x88, 0x8c, 0x0b, 0x84, 0x84, 0x4c, 0x10, 0x3c, 0x23, + 0x14, 0x12, 0x4c, 0x88, 0x8c, 0x0b, 0x84, 0x84, 0x4c, 0x10, 0x30, 0x23, 0x00, 0x25, 0x00, 0x8a, 0x39, 0x02, 0x30, 0x98, 0x23, 0x40, 0x8a, 0x31, 0x33, 0x43, 0x43, 0x35, 0x03, 0x50, 0x0c, 0x98, 0x19, 0x3a, 0xc2, 0x81, - 0x80, 0x61, 0x04, 0xe1, 0x18, 0x46, 0x20, 0x8e, 0xa3, 0xa4, 0x29, 0xa2, - 0x84, 0xc9, 0x7f, 0x89, 0x68, 0x22, 0xae, 0xd6, 0x49, 0x91, 0x8b, 0x58, - 0x90, 0xb0, 0x9c, 0x03, 0x03, 0x13, 0x14, 0x72, 0xc0, 0x87, 0x74, 0x60, + 0x80, 0x1c, 0x18, 0x00, 0x00, 0x13, 0x14, 0x72, 0xc0, 0x87, 0x74, 0x60, 0x87, 0x36, 0x68, 0x87, 0x79, 0x68, 0x03, 0x72, 0xc0, 0x87, 0x0d, 0xaf, 0x50, 0x0e, 0x6d, 0xd0, 0x0e, 0x7a, 0x50, 0x0e, 0x6d, 0x00, 0x0f, 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x71, @@ -186,59 +317,41 @@ const unsigned char g_FullscreenVert[] = { 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xe6, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, 0xe0, 0x0e, 0x78, 0xa0, 0x07, 0x71, 0x60, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x43, - 0x9e, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x9e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x86, 0x3c, 0x05, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x79, 0x10, 0x20, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xc8, 0x02, 0x01, 0x0e, 0x00, 0x00, 0x00, 0x32, 0x1e, 0x98, + 0x00, 0x00, 0xc8, 0x02, 0x01, 0x0b, 0x00, 0x00, 0x00, 0x32, 0x1e, 0x98, 0x14, 0x19, 0x11, 0x4c, 0x90, 0x8c, 0x09, 0x26, 0x47, 0xc6, 0x04, 0x43, - 0x9a, 0x12, 0x18, 0x01, 0x28, 0x86, 0x02, 0x2a, 0x83, 0x42, 0x28, 0x87, - 0x92, 0x28, 0x90, 0xf2, 0x28, 0x97, 0xc2, 0x20, 0x2a, 0x85, 0x12, 0x18, - 0x01, 0x28, 0x89, 0x22, 0x28, 0x83, 0x42, 0xa0, 0x9e, 0x01, 0x20, 0x1f, - 0x6b, 0x08, 0x90, 0x39, 0x00, 0x79, 0x18, 0x00, 0x00, 0x84, 0x00, 0x00, + 0x9a, 0x12, 0x18, 0x01, 0x28, 0x86, 0x32, 0x28, 0x0f, 0xa2, 0x52, 0x28, + 0x81, 0x11, 0x80, 0x92, 0x28, 0x82, 0x32, 0x28, 0x04, 0xda, 0xb1, 0x86, + 0x00, 0x99, 0x03, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00, 0x51, 0x00, 0x00, 0x00, 0x1a, 0x03, 0x4c, 0x90, 0x46, 0x02, 0x13, 0x44, 0x35, 0x18, 0x63, 0x0b, 0x73, 0x3b, 0x03, 0xb1, 0x2b, 0x93, 0x9b, 0x4b, 0x7b, 0x73, 0x03, 0x99, 0x71, 0xb9, 0x01, 0x41, 0xa1, 0x0b, 0x3b, 0x9b, 0x7b, 0x91, 0x2a, 0x62, 0x2a, 0x0a, 0x9a, 0x2a, 0xfa, 0x9a, 0xb9, 0x81, 0x79, 0x31, 0x4b, 0x73, 0x0b, 0x63, 0x4b, 0xd9, 0x10, 0x04, 0x13, 0x84, 0x61, 0x98, 0x20, - 0x0c, 0xc4, 0x06, 0x61, 0x20, 0x36, 0x08, 0x04, 0x41, 0xc1, 0x6e, 0x6e, - 0x82, 0x30, 0x14, 0x1b, 0x86, 0x03, 0x21, 0x26, 0x08, 0x8d, 0x35, 0x41, - 0x18, 0x0c, 0x0e, 0x74, 0x65, 0x78, 0x13, 0x84, 0xe1, 0x98, 0x20, 0x0c, - 0x08, 0x13, 0xaa, 0x22, 0xac, 0xa1, 0xa7, 0x27, 0x29, 0x22, 0x98, 0x09, - 0xc2, 0x90, 0x4c, 0x10, 0x06, 0x65, 0x03, 0x82, 0x30, 0x0d, 0xe1, 0x3c, - 0x50, 0xc4, 0x01, 0xee, 0x6d, 0x6e, 0x82, 0x30, 0x2c, 0x5c, 0xa6, 0xac, - 0xbe, 0xa0, 0x9e, 0xa6, 0x92, 0xa8, 0x92, 0x9e, 0x9c, 0x36, 0x20, 0xc8, - 0xd4, 0x50, 0x4e, 0x05, 0x45, 0x1b, 0x86, 0x45, 0xb2, 0x36, 0x0c, 0x84, - 0x72, 0x4d, 0x10, 0x04, 0x60, 0x03, 0xb0, 0x61, 0x20, 0x34, 0x6d, 0x43, - 0xb0, 0x6d, 0x18, 0x86, 0x8c, 0x9b, 0x20, 0x38, 0xd7, 0x86, 0xc0, 0xa3, - 0x63, 0x54, 0xc7, 0xc6, 0x36, 0x37, 0x26, 0x57, 0x56, 0xe6, 0x66, 0x55, - 0x26, 0x47, 0xc7, 0x65, 0xca, 0xea, 0xcb, 0xaa, 0x4c, 0x8e, 0xae, 0x0c, - 0x2f, 0x89, 0x68, 0x82, 0x40, 0x3c, 0x13, 0x04, 0x02, 0xda, 0x10, 0x10, - 0x13, 0x04, 0x22, 0xda, 0x20, 0x34, 0xc3, 0x86, 0x85, 0x08, 0x03, 0x31, - 0x18, 0x03, 0x32, 0x28, 0x83, 0x61, 0x0c, 0x88, 0x32, 0x30, 0x83, 0x0d, - 0xc1, 0x19, 0x10, 0xa1, 0x2a, 0xc2, 0x1a, 0x7a, 0x7a, 0x92, 0x22, 0x9a, - 0x20, 0x10, 0xd2, 0x04, 0x81, 0x98, 0x36, 0x08, 0x4d, 0xb3, 0x61, 0x21, - 0xd2, 0x40, 0x0d, 0xca, 0x80, 0x0c, 0xd6, 0x60, 0x58, 0x03, 0xa2, 0x0c, - 0xd8, 0x80, 0xcb, 0x94, 0xd5, 0x17, 0xd4, 0xdb, 0x5c, 0x1a, 0x5d, 0xda, - 0x9b, 0xdb, 0x04, 0x81, 0xa0, 0x26, 0x08, 0x44, 0x35, 0x41, 0x18, 0x98, - 0x0d, 0x42, 0x13, 0x07, 0x1b, 0x96, 0xc1, 0x0d, 0xd4, 0xe0, 0x0d, 0xc8, - 0x00, 0x0e, 0x06, 0x38, 0x18, 0xca, 0x40, 0x0e, 0x36, 0x08, 0x6d, 0x30, - 0x07, 0x1b, 0x06, 0x34, 0xa0, 0x03, 0x60, 0x43, 0x91, 0x81, 0x41, 0x1d, - 0x00, 0x00, 0x0d, 0x33, 0xb6, 0xb7, 0x30, 0xba, 0x39, 0x16, 0x69, 0x6e, - 0x73, 0x74, 0x73, 0x13, 0x84, 0xa1, 0xa1, 0x31, 0x97, 0x76, 0xf6, 0xc5, - 0x46, 0x46, 0x63, 0x2e, 0xed, 0xec, 0x6b, 0x8e, 0x6e, 0x82, 0x30, 0x38, - 0x2c, 0xea, 0xd2, 0xdc, 0xe8, 0xe6, 0x36, 0x28, 0x77, 0x80, 0xe0, 0x41, - 0x1e, 0xe8, 0xc1, 0xb0, 0x07, 0x7c, 0xd0, 0x07, 0x4d, 0x15, 0x36, 0x36, - 0xbb, 0x36, 0x97, 0x34, 0xb2, 0x32, 0x37, 0xba, 0x29, 0x41, 0x50, 0x85, - 0x0c, 0xcf, 0xc5, 0xae, 0x4c, 0x6e, 0x2e, 0xed, 0xcd, 0x6d, 0x4a, 0x40, - 0x34, 0x21, 0xc3, 0x73, 0xb1, 0x0b, 0x63, 0xb3, 0x2b, 0x93, 0x9b, 0x12, - 0x14, 0x75, 0xc8, 0xf0, 0x5c, 0xe6, 0xd0, 0xc2, 0xc8, 0xca, 0xe4, 0x9a, - 0xde, 0xc8, 0xca, 0xd8, 0xa6, 0x04, 0x48, 0x25, 0x32, 0x3c, 0x17, 0xba, - 0x3c, 0xb8, 0xb2, 0x20, 0x37, 0xb7, 0x37, 0xba, 0x30, 0xba, 0xb4, 0x37, - 0xb7, 0xb9, 0x29, 0xc2, 0xc5, 0xd5, 0x21, 0xc3, 0x73, 0xb1, 0x4b, 0x2b, - 0xbb, 0x4b, 0x22, 0x9b, 0xa2, 0x0b, 0xa3, 0x2b, 0x9b, 0x12, 0x78, 0x75, - 0xc8, 0xf0, 0x5c, 0xca, 0xdc, 0xe8, 0xe4, 0xf2, 0xa0, 0xde, 0xd2, 0xdc, - 0xe8, 0xe6, 0xa6, 0x04, 0x75, 0xd0, 0x85, 0x0c, 0xcf, 0x65, 0xec, 0xad, - 0xce, 0x8d, 0xae, 0x4c, 0x6e, 0x6e, 0x4a, 0xd0, 0x07, 0x00, 0x00, 0x00, + 0x0c, 0xc4, 0x06, 0x61, 0x20, 0x26, 0x08, 0x43, 0xb1, 0x41, 0x18, 0x0c, + 0x0a, 0x76, 0x73, 0x1b, 0x06, 0xc4, 0x20, 0x26, 0x08, 0xcb, 0xb3, 0x21, + 0x50, 0x26, 0x08, 0x02, 0x40, 0xc7, 0xa8, 0x8e, 0x8d, 0x6d, 0x6e, 0x4c, + 0xae, 0xac, 0xcc, 0xcd, 0xaa, 0x4c, 0x8e, 0x8e, 0xcb, 0x94, 0xd5, 0x97, + 0x55, 0x99, 0x1c, 0x5d, 0x19, 0x5e, 0x12, 0xd1, 0x04, 0x81, 0x40, 0x26, + 0x08, 0x44, 0xb2, 0x21, 0x20, 0x26, 0x08, 0x84, 0x32, 0x41, 0x18, 0x8c, + 0x0d, 0xc2, 0x34, 0x6c, 0x58, 0x08, 0xe7, 0x81, 0x22, 0x69, 0x80, 0x08, + 0x89, 0xda, 0x10, 0x54, 0x44, 0xa8, 0x8a, 0xb0, 0x86, 0x9e, 0x9e, 0xa4, + 0x88, 0x26, 0x08, 0xc4, 0x32, 0x41, 0x20, 0x98, 0x0d, 0xc2, 0x34, 0x6d, + 0x58, 0x88, 0x0b, 0x93, 0xa2, 0x6c, 0xc8, 0x08, 0x49, 0xe3, 0x32, 0x65, + 0xf5, 0x05, 0xf5, 0x36, 0x97, 0x46, 0x97, 0xf6, 0xe6, 0x36, 0x41, 0x20, + 0x9a, 0x09, 0x02, 0xe1, 0x4c, 0x10, 0x86, 0x63, 0x83, 0x30, 0x7d, 0x1b, + 0x96, 0x81, 0xc3, 0xba, 0xc8, 0x1b, 0xbc, 0x41, 0x02, 0x83, 0x0d, 0xc2, + 0x16, 0x06, 0x1b, 0x06, 0x4b, 0x0c, 0x80, 0x0d, 0x05, 0xd3, 0x8c, 0x01, + 0x00, 0x54, 0x61, 0x63, 0xb3, 0x6b, 0x73, 0x49, 0x23, 0x2b, 0x73, 0xa3, + 0x9b, 0x12, 0x04, 0x55, 0xc8, 0xf0, 0x5c, 0xec, 0xca, 0xe4, 0xe6, 0xd2, + 0xde, 0xdc, 0xa6, 0x04, 0x44, 0x13, 0x32, 0x3c, 0x17, 0xbb, 0x30, 0x36, + 0xbb, 0x32, 0xb9, 0x29, 0x81, 0x51, 0x87, 0x0c, 0xcf, 0x65, 0x0e, 0x2d, + 0x8c, 0xac, 0x4c, 0xae, 0xe9, 0x8d, 0xac, 0x8c, 0x6d, 0x4a, 0x80, 0xd4, + 0x21, 0xc3, 0x73, 0xb1, 0x4b, 0x2b, 0xbb, 0x4b, 0x22, 0x9b, 0xa2, 0x0b, + 0xa3, 0x2b, 0x9b, 0x12, 0x28, 0x75, 0xc8, 0xf0, 0x5c, 0xca, 0xdc, 0xe8, + 0xe4, 0xf2, 0xa0, 0xde, 0xd2, 0xdc, 0xe8, 0xe6, 0xa6, 0x04, 0x63, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x33, 0x08, 0x80, 0x1c, 0xc4, 0xe1, 0x1c, 0x66, 0x14, 0x01, 0x3d, 0x88, 0x43, 0x38, 0x84, 0xc3, 0x8c, 0x42, 0x80, 0x07, 0x79, 0x78, 0x07, 0x73, 0x98, 0x71, 0x0c, @@ -269,128 +382,27 @@ const unsigned char g_FullscreenVert[] = { 0xd4, 0xb2, 0x48, 0x42, 0x44, 0x10, 0xcd, 0x4b, 0x44, 0x93, 0x05, 0x4c, 0xc3, 0xe5, 0x3b, 0x8f, 0xbf, 0x38, 0xc0, 0x20, 0x36, 0x0f, 0x35, 0xf9, 0xc8, 0x6d, 0x9b, 0x40, 0x35, 0x5c, 0xbe, 0xf3, 0xf8, 0xd2, 0xe4, 0x44, - 0x04, 0x4a, 0x4d, 0x0f, 0x35, 0xf9, 0xc5, 0x6d, 0x03, 0x00, 0x00, 0x00, - 0x00, 0x48, 0x41, 0x53, 0x48, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x34, 0x75, 0x72, 0x25, 0x9f, 0x9a, 0x9e, 0xa8, 0x4d, 0x2f, 0x90, - 0xba, 0xfb, 0xd0, 0xe1, 0xae, 0x44, 0x58, 0x49, 0x4c, 0x80, 0x05, 0x00, - 0x00, 0x60, 0x00, 0x01, 0x00, 0x60, 0x01, 0x00, 0x00, 0x44, 0x58, 0x49, - 0x4c, 0x00, 0x01, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x68, 0x05, 0x00, - 0x00, 0x42, 0x43, 0xc0, 0xde, 0x21, 0x0c, 0x00, 0x00, 0x57, 0x01, 0x00, - 0x00, 0x0b, 0x82, 0x20, 0x00, 0x02, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, - 0x00, 0x07, 0x81, 0x23, 0x91, 0x41, 0xc8, 0x04, 0x49, 0x06, 0x10, 0x32, - 0x39, 0x92, 0x01, 0x84, 0x0c, 0x25, 0x05, 0x08, 0x19, 0x1e, 0x04, 0x8b, - 0x62, 0x80, 0x10, 0x45, 0x02, 0x42, 0x92, 0x0b, 0x42, 0x84, 0x10, 0x32, - 0x14, 0x38, 0x08, 0x18, 0x4b, 0x0a, 0x32, 0x42, 0x88, 0x48, 0x90, 0x14, - 0x20, 0x43, 0x46, 0x88, 0xa5, 0x00, 0x19, 0x32, 0x42, 0xe4, 0x48, 0x0e, - 0x90, 0x11, 0x22, 0xc4, 0x50, 0x41, 0x51, 0x81, 0x8c, 0xe1, 0x83, 0xe5, - 0x8a, 0x04, 0x21, 0x46, 0x06, 0x51, 0x18, 0x00, 0x00, 0x06, 0x00, 0x00, - 0x00, 0x1b, 0x8c, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x07, 0x40, 0x02, 0xa8, - 0x0d, 0x84, 0xf0, 0xff, 0xff, 0xff, 0xff, 0x03, 0x20, 0x01, 0x00, 0x00, - 0x00, 0x49, 0x18, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x13, 0x82, 0x60, - 0x42, 0x20, 0x00, 0x00, 0x00, 0x89, 0x20, 0x00, 0x00, 0x0f, 0x00, 0x00, - 0x00, 0x32, 0x22, 0x08, 0x09, 0x20, 0x64, 0x85, 0x04, 0x13, 0x22, 0xa4, - 0x84, 0x04, 0x13, 0x22, 0xe3, 0x84, 0xa1, 0x90, 0x14, 0x12, 0x4c, 0x88, - 0x8c, 0x0b, 0x84, 0x84, 0x4c, 0x10, 0x30, 0x23, 0x00, 0x25, 0x00, 0x8a, - 0x39, 0x02, 0x30, 0x98, 0x23, 0x40, 0x8a, 0x31, 0x33, 0x43, 0x43, 0x35, - 0x03, 0x50, 0x0c, 0x98, 0x19, 0x3a, 0xc2, 0x81, 0x80, 0x1c, 0x18, 0x00, - 0x00, 0x13, 0x14, 0x72, 0xc0, 0x87, 0x74, 0x60, 0x87, 0x36, 0x68, 0x87, - 0x79, 0x68, 0x03, 0x72, 0xc0, 0x87, 0x0d, 0xaf, 0x50, 0x0e, 0x6d, 0xd0, - 0x0e, 0x7a, 0x50, 0x0e, 0x6d, 0x00, 0x0f, 0x7a, 0x30, 0x07, 0x72, 0xa0, - 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x71, 0xa0, 0x07, 0x73, 0x20, - 0x07, 0x6d, 0x90, 0x0e, 0x78, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, - 0x0e, 0x71, 0x60, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xe9, 0x30, - 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x76, 0x40, - 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, 0xe6, 0x10, 0x07, 0x76, 0xa0, - 0x07, 0x73, 0x20, 0x07, 0x6d, 0x60, 0x0e, 0x73, 0x20, 0x07, 0x7a, 0x30, - 0x07, 0x72, 0xd0, 0x06, 0xe6, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, - 0x07, 0x6d, 0xe0, 0x0e, 0x78, 0xa0, 0x07, 0x71, 0x60, 0x07, 0x7a, 0x30, - 0x07, 0x72, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x43, 0x9e, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x86, 0x3c, 0x05, 0x10, - 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x79, 0x10, - 0x20, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc8, 0x02, - 0x01, 0x0b, 0x00, 0x00, 0x00, 0x32, 0x1e, 0x98, 0x14, 0x19, 0x11, 0x4c, - 0x90, 0x8c, 0x09, 0x26, 0x47, 0xc6, 0x04, 0x43, 0x9a, 0x12, 0x18, 0x01, - 0x28, 0x86, 0x32, 0x28, 0x0f, 0xa2, 0x52, 0x28, 0x81, 0x11, 0x80, 0x92, - 0x28, 0x82, 0x32, 0x28, 0x04, 0xda, 0xb1, 0x86, 0x00, 0x99, 0x03, 0x00, - 0x00, 0x79, 0x18, 0x00, 0x00, 0x51, 0x00, 0x00, 0x00, 0x1a, 0x03, 0x4c, - 0x90, 0x46, 0x02, 0x13, 0x44, 0x35, 0x18, 0x63, 0x0b, 0x73, 0x3b, 0x03, - 0xb1, 0x2b, 0x93, 0x9b, 0x4b, 0x7b, 0x73, 0x03, 0x99, 0x71, 0xb9, 0x01, - 0x41, 0xa1, 0x0b, 0x3b, 0x9b, 0x7b, 0x91, 0x2a, 0x62, 0x2a, 0x0a, 0x9a, - 0x2a, 0xfa, 0x9a, 0xb9, 0x81, 0x79, 0x31, 0x4b, 0x73, 0x0b, 0x63, 0x4b, - 0xd9, 0x10, 0x04, 0x13, 0x84, 0x61, 0x98, 0x20, 0x0c, 0xc4, 0x06, 0x61, - 0x20, 0x26, 0x08, 0x43, 0xb1, 0x41, 0x18, 0x0c, 0x0a, 0x76, 0x73, 0x1b, - 0x06, 0xc4, 0x20, 0x26, 0x08, 0xcb, 0xb3, 0x21, 0x50, 0x26, 0x08, 0x02, - 0x40, 0xc7, 0xa8, 0x8e, 0x8d, 0x6d, 0x6e, 0x4c, 0xae, 0xac, 0xcc, 0xcd, - 0xaa, 0x4c, 0x8e, 0x8e, 0xcb, 0x94, 0xd5, 0x97, 0x55, 0x99, 0x1c, 0x5d, - 0x19, 0x5e, 0x12, 0xd1, 0x04, 0x81, 0x40, 0x26, 0x08, 0x44, 0xb2, 0x21, - 0x20, 0x26, 0x08, 0x84, 0x32, 0x41, 0x18, 0x8c, 0x0d, 0xc2, 0x34, 0x6c, - 0x58, 0x08, 0xe7, 0x81, 0x22, 0x69, 0x80, 0x08, 0x89, 0xda, 0x10, 0x54, - 0x44, 0xa8, 0x8a, 0xb0, 0x86, 0x9e, 0x9e, 0xa4, 0x88, 0x26, 0x08, 0xc4, - 0x32, 0x41, 0x20, 0x98, 0x0d, 0xc2, 0x34, 0x6d, 0x58, 0x88, 0x0b, 0x93, - 0xa2, 0x6c, 0xc8, 0x08, 0x49, 0xe3, 0x32, 0x65, 0xf5, 0x05, 0xf5, 0x36, - 0x97, 0x46, 0x97, 0xf6, 0xe6, 0x36, 0x41, 0x20, 0x9a, 0x09, 0x02, 0xe1, - 0x4c, 0x10, 0x86, 0x63, 0x83, 0x30, 0x7d, 0x1b, 0x96, 0x81, 0xc3, 0xba, - 0xc8, 0x1b, 0xbc, 0x41, 0x02, 0x83, 0x0d, 0xc2, 0x16, 0x06, 0x1b, 0x06, - 0x4b, 0x0c, 0x80, 0x0d, 0x05, 0xd3, 0x8c, 0x01, 0x00, 0x54, 0x61, 0x63, - 0xb3, 0x6b, 0x73, 0x49, 0x23, 0x2b, 0x73, 0xa3, 0x9b, 0x12, 0x04, 0x55, - 0xc8, 0xf0, 0x5c, 0xec, 0xca, 0xe4, 0xe6, 0xd2, 0xde, 0xdc, 0xa6, 0x04, - 0x44, 0x13, 0x32, 0x3c, 0x17, 0xbb, 0x30, 0x36, 0xbb, 0x32, 0xb9, 0x29, - 0x81, 0x51, 0x87, 0x0c, 0xcf, 0x65, 0x0e, 0x2d, 0x8c, 0xac, 0x4c, 0xae, - 0xe9, 0x8d, 0xac, 0x8c, 0x6d, 0x4a, 0x80, 0xd4, 0x21, 0xc3, 0x73, 0xb1, - 0x4b, 0x2b, 0xbb, 0x4b, 0x22, 0x9b, 0xa2, 0x0b, 0xa3, 0x2b, 0x9b, 0x12, - 0x28, 0x75, 0xc8, 0xf0, 0x5c, 0xca, 0xdc, 0xe8, 0xe4, 0xf2, 0xa0, 0xde, - 0xd2, 0xdc, 0xe8, 0xe6, 0xa6, 0x04, 0x63, 0x00, 0x00, 0x79, 0x18, 0x00, - 0x00, 0x4c, 0x00, 0x00, 0x00, 0x33, 0x08, 0x80, 0x1c, 0xc4, 0xe1, 0x1c, - 0x66, 0x14, 0x01, 0x3d, 0x88, 0x43, 0x38, 0x84, 0xc3, 0x8c, 0x42, 0x80, - 0x07, 0x79, 0x78, 0x07, 0x73, 0x98, 0x71, 0x0c, 0xe6, 0x00, 0x0f, 0xed, - 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x33, 0x0c, 0x42, 0x1e, 0xc2, 0xc1, 0x1d, - 0xce, 0xa1, 0x1c, 0x66, 0x30, 0x05, 0x3d, 0x88, 0x43, 0x38, 0x84, 0x83, - 0x1b, 0xcc, 0x03, 0x3d, 0xc8, 0x43, 0x3d, 0x8c, 0x03, 0x3d, 0xcc, 0x78, - 0x8c, 0x74, 0x70, 0x07, 0x7b, 0x08, 0x07, 0x79, 0x48, 0x87, 0x70, 0x70, - 0x07, 0x7a, 0x70, 0x03, 0x76, 0x78, 0x87, 0x70, 0x20, 0x87, 0x19, 0xcc, - 0x11, 0x0e, 0xec, 0x90, 0x0e, 0xe1, 0x30, 0x0f, 0x6e, 0x30, 0x0f, 0xe3, - 0xf0, 0x0e, 0xf0, 0x50, 0x0e, 0x33, 0x10, 0xc4, 0x1d, 0xde, 0x21, 0x1c, - 0xd8, 0x21, 0x1d, 0xc2, 0x61, 0x1e, 0x66, 0x30, 0x89, 0x3b, 0xbc, 0x83, - 0x3b, 0xd0, 0x43, 0x39, 0xb4, 0x03, 0x3c, 0xbc, 0x83, 0x3c, 0x84, 0x03, - 0x3b, 0xcc, 0xf0, 0x14, 0x76, 0x60, 0x07, 0x7b, 0x68, 0x07, 0x37, 0x68, - 0x87, 0x72, 0x68, 0x07, 0x37, 0x80, 0x87, 0x70, 0x90, 0x87, 0x70, 0x60, - 0x07, 0x76, 0x28, 0x07, 0x76, 0xf8, 0x05, 0x76, 0x78, 0x87, 0x77, 0x80, - 0x87, 0x5f, 0x08, 0x87, 0x71, 0x18, 0x87, 0x72, 0x98, 0x87, 0x79, 0x98, - 0x81, 0x2c, 0xee, 0xf0, 0x0e, 0xee, 0xe0, 0x0e, 0xf5, 0xc0, 0x0e, 0xec, - 0x30, 0x03, 0x62, 0xc8, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xcc, 0xa1, 0x1c, - 0xe4, 0xa1, 0x1c, 0xdc, 0x61, 0x1c, 0xca, 0x21, 0x1c, 0xc4, 0x81, 0x1d, - 0xca, 0x61, 0x06, 0xd6, 0x90, 0x43, 0x39, 0xc8, 0x43, 0x39, 0x98, 0x43, - 0x39, 0xc8, 0x43, 0x39, 0xb8, 0xc3, 0x38, 0x94, 0x43, 0x38, 0x88, 0x03, - 0x3b, 0x94, 0xc3, 0x2f, 0xbc, 0x83, 0x3c, 0xfc, 0x82, 0x3b, 0xd4, 0x03, - 0x3b, 0xb0, 0xc3, 0x0c, 0xc4, 0x21, 0x07, 0x7c, 0x70, 0x03, 0x7a, 0x28, - 0x87, 0x76, 0x80, 0x87, 0x19, 0xd1, 0x43, 0x0e, 0xf8, 0xe0, 0x06, 0xe4, - 0x20, 0x0e, 0xe7, 0xe0, 0x06, 0xf6, 0x10, 0x0e, 0xf2, 0xc0, 0x0e, 0xe1, - 0x90, 0x0f, 0xef, 0x50, 0x0f, 0xf4, 0x00, 0x00, 0x00, 0x71, 0x20, 0x00, - 0x00, 0x0c, 0x00, 0x00, 0x00, 0x06, 0xe0, 0x7c, 0xd4, 0xb2, 0x48, 0x42, - 0x44, 0x10, 0xcd, 0x4b, 0x44, 0x93, 0x05, 0x4c, 0xc3, 0xe5, 0x3b, 0x8f, - 0xbf, 0x38, 0xc0, 0x20, 0x36, 0x0f, 0x35, 0xf9, 0xc8, 0x6d, 0x9b, 0x40, - 0x35, 0x5c, 0xbe, 0xf3, 0xf8, 0xd2, 0xe4, 0x44, 0x04, 0x4a, 0x4d, 0x0f, - 0x35, 0xf9, 0xc5, 0x6d, 0x03, 0x61, 0x20, 0x00, 0x00, 0x39, 0x00, 0x00, - 0x00, 0x13, 0x04, 0x41, 0x2c, 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, - 0x00, 0x34, 0xa5, 0x50, 0x04, 0x85, 0x30, 0x03, 0x40, 0x37, 0x02, 0x30, - 0x46, 0x00, 0x82, 0x20, 0x08, 0x82, 0xc1, 0x18, 0x01, 0x08, 0x82, 0x20, - 0xfe, 0x8d, 0x11, 0x80, 0x20, 0x08, 0xe2, 0xbf, 0x00, 0x23, 0x06, 0x09, - 0x00, 0x82, 0x60, 0x50, 0x5c, 0x06, 0x45, 0x39, 0x45, 0x05, 0xd6, 0x55, - 0x90, 0xe8, 0x05, 0x57, 0x45, 0x2c, 0x7a, 0xc1, 0xd5, 0x88, 0x41, 0x02, - 0x80, 0x20, 0x18, 0x20, 0x9c, 0xa3, 0x69, 0x94, 0x32, 0x62, 0x90, 0x00, - 0x20, 0x08, 0x06, 0x08, 0xe7, 0x68, 0x5a, 0xa5, 0x8c, 0x18, 0x24, 0x00, - 0x08, 0x82, 0x01, 0xc2, 0x39, 0x9b, 0x46, 0x29, 0x23, 0x06, 0x09, 0x00, - 0x82, 0x60, 0x80, 0x70, 0xce, 0xa6, 0x55, 0xca, 0x88, 0x41, 0x02, 0x80, - 0x20, 0x18, 0x20, 0x9c, 0xb3, 0x69, 0x92, 0x32, 0x62, 0x90, 0x00, 0x20, - 0x08, 0x06, 0x08, 0xe7, 0x6c, 0x5a, 0xa4, 0x8c, 0x18, 0x24, 0x00, 0x08, - 0x82, 0x01, 0xc2, 0x39, 0x9a, 0x46, 0x0d, 0x23, 0x06, 0x09, 0x00, 0x82, - 0x60, 0x80, 0x70, 0x8e, 0xa6, 0x55, 0x81, 0x0d, 0x89, 0x7c, 0x4c, 0x50, - 0xe4, 0x63, 0x42, 0x02, 0x1f, 0x5b, 0x84, 0xf8, 0x8c, 0x18, 0x24, 0x00, - 0x08, 0x82, 0x01, 0x02, 0x06, 0xd2, 0xe7, 0x61, 0xc2, 0x88, 0x41, 0x02, - 0x80, 0x20, 0x18, 0x20, 0x60, 0x20, 0x7d, 0x5e, 0x16, 0x8c, 0x18, 0x24, - 0x00, 0x08, 0x82, 0x01, 0x02, 0x06, 0xd2, 0xe7, 0x59, 0xce, 0x88, 0x41, - 0x02, 0x80, 0x20, 0x18, 0x20, 0x60, 0x20, 0x7d, 0x5e, 0xc5, 0x20, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00 + 0x04, 0x4a, 0x4d, 0x0f, 0x35, 0xf9, 0xc5, 0x6d, 0x03, 0x61, 0x20, 0x00, + 0x00, 0x39, 0x00, 0x00, 0x00, 0x13, 0x04, 0x41, 0x2c, 0x10, 0x00, 0x00, + 0x00, 0x08, 0x00, 0x00, 0x00, 0x34, 0xa5, 0x50, 0x04, 0x85, 0x30, 0x03, + 0x40, 0x37, 0x02, 0x30, 0x46, 0x00, 0x82, 0x20, 0x08, 0x82, 0xc1, 0x18, + 0x01, 0x08, 0x82, 0x20, 0xfe, 0x8d, 0x11, 0x80, 0x20, 0x08, 0xe2, 0xbf, + 0x00, 0x23, 0x06, 0x09, 0x00, 0x82, 0x60, 0x50, 0x5c, 0x06, 0x45, 0x39, + 0x45, 0x05, 0xd6, 0x55, 0x90, 0xe8, 0x05, 0x57, 0x45, 0x2c, 0x7a, 0xc1, + 0xd5, 0x88, 0x41, 0x02, 0x80, 0x20, 0x18, 0x20, 0x9c, 0xa3, 0x69, 0x94, + 0x32, 0x62, 0x90, 0x00, 0x20, 0x08, 0x06, 0x08, 0xe7, 0x68, 0x5a, 0xa5, + 0x8c, 0x18, 0x24, 0x00, 0x08, 0x82, 0x01, 0xc2, 0x39, 0x9b, 0x46, 0x29, + 0x23, 0x06, 0x09, 0x00, 0x82, 0x60, 0x80, 0x70, 0xce, 0xa6, 0x55, 0xca, + 0x88, 0x41, 0x02, 0x80, 0x20, 0x18, 0x20, 0x9c, 0xb3, 0x69, 0x92, 0x32, + 0x62, 0x90, 0x00, 0x20, 0x08, 0x06, 0x08, 0xe7, 0x6c, 0x5a, 0xa4, 0x8c, + 0x18, 0x24, 0x00, 0x08, 0x82, 0x01, 0xc2, 0x39, 0x9a, 0x46, 0x0d, 0x23, + 0x06, 0x09, 0x00, 0x82, 0x60, 0x80, 0x70, 0x8e, 0xa6, 0x55, 0x81, 0x0d, + 0x89, 0x7c, 0x4c, 0x50, 0xe4, 0x63, 0x42, 0x02, 0x1f, 0x5b, 0x84, 0xf8, + 0x8c, 0x18, 0x24, 0x00, 0x08, 0x82, 0x01, 0x02, 0x06, 0xd2, 0xe7, 0x61, + 0xc2, 0x88, 0x41, 0x02, 0x80, 0x20, 0x18, 0x20, 0x60, 0x20, 0x7d, 0x5e, + 0x16, 0x8c, 0x18, 0x24, 0x00, 0x08, 0x82, 0x01, 0x02, 0x06, 0xd2, 0xe7, + 0x59, 0xce, 0x88, 0x41, 0x02, 0x80, 0x20, 0x18, 0x20, 0x60, 0x20, 0x7d, + 0x5e, 0xc5, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; #if 0 ; @@ -566,50 +578,233 @@ attributes #2 = { nounwind readonly } #endif const unsigned char g_BlitFrom2D[] = { - 0x44, 0x58, 0x42, 0x43, 0x88, 0xd8, 0x55, 0x7c, 0x96, 0x93, 0xc1, 0x86, - 0xcd, 0x75, 0xbd, 0x9a, 0xec, 0x55, 0x00, 0x0b, 0x01, 0x00, 0x00, 0x00, - 0x97, 0x11, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, - 0x4c, 0x00, 0x00, 0x00, 0xb1, 0x00, 0x00, 0x00, 0xeb, 0x00, 0x00, 0x00, - 0xe3, 0x01, 0x00, 0x00, 0xc7, 0x09, 0x00, 0x00, 0xe3, 0x09, 0x00, 0x00, - 0x53, 0x46, 0x49, 0x30, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x49, 0x53, 0x47, 0x31, 0x5d, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x54, 0x45, 0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44, 0x00, 0x53, 0x56, 0x5f, - 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x4f, 0x53, 0x47, - 0x31, 0x32, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x40, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x53, 0x56, 0x5f, - 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x00, 0x50, 0x53, 0x56, 0x30, 0xf0, - 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x44, 0x58, 0x42, 0x43, 0x18, 0x05, 0x35, 0x74, 0x86, 0x3d, 0x7b, 0xa8, + 0x8e, 0x1e, 0xae, 0xc3, 0xeb, 0x7f, 0x9a, 0xd9, 0x01, 0x00, 0x00, 0x00, + 0x2b, 0x12, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, + 0x50, 0x00, 0x00, 0x00, 0xb5, 0x00, 0x00, 0x00, 0xef, 0x00, 0x00, 0x00, + 0xe7, 0x01, 0x00, 0x00, 0x77, 0x02, 0x00, 0x00, 0x5b, 0x0a, 0x00, 0x00, + 0x77, 0x0a, 0x00, 0x00, 0x53, 0x46, 0x49, 0x30, 0x08, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x49, 0x53, 0x47, 0x31, + 0x5d, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x51, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x54, 0x45, 0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44, + 0x00, 0x53, 0x56, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, + 0x00, 0x4f, 0x53, 0x47, 0x31, 0x32, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, + 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x53, 0x56, 0x5f, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x00, 0x50, + 0x53, 0x56, 0x30, 0xf0, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x02, - 0x01, 0x00, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x18, - 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, + 0x00, 0x00, 0x00, 0x02, 0x01, 0x00, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, + 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x03, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0d, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, + 0x54, 0x45, 0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44, 0x00, 0x00, 0x00, 0x01, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x42, 0x00, 0x03, + 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, + 0x01, 0x44, 0x03, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x01, 0x00, 0x44, 0x10, 0x03, 0x00, 0x00, 0x00, 0x0f, + 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x52, 0x54, 0x53, 0x30, 0x88, + 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x18, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x88, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x3c, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x5c, + 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x7c, + 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x03, + 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x01, + 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x54, 0x45, 0x58, 0x43, - 0x4f, 0x4f, 0x52, 0x44, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x01, 0x00, 0x42, 0x00, 0x03, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x44, 0x03, 0x03, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, - 0x00, 0x44, 0x10, 0x03, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x0f, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x53, 0x54, 0x41, 0x54, 0xdc, 0x07, 0x00, 0x00, 0x60, - 0x00, 0x00, 0x00, 0xf7, 0x01, 0x00, 0x00, 0x44, 0x58, 0x49, 0x4c, 0x00, - 0x01, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0xc4, 0x07, 0x00, 0x00, 0x42, - 0x43, 0xc0, 0xde, 0x21, 0x0c, 0x00, 0x00, 0xee, 0x01, 0x00, 0x00, 0x0b, + 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x03, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x53, 0x54, 0x41, 0x54, 0xdc, + 0x07, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0xf7, 0x01, 0x00, 0x00, 0x44, + 0x58, 0x49, 0x4c, 0x00, 0x01, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0xc4, + 0x07, 0x00, 0x00, 0x42, 0x43, 0xc0, 0xde, 0x21, 0x0c, 0x00, 0x00, 0xee, + 0x01, 0x00, 0x00, 0x0b, 0x82, 0x20, 0x00, 0x02, 0x00, 0x00, 0x00, 0x13, + 0x00, 0x00, 0x00, 0x07, 0x81, 0x23, 0x91, 0x41, 0xc8, 0x04, 0x49, 0x06, + 0x10, 0x32, 0x39, 0x92, 0x01, 0x84, 0x0c, 0x25, 0x05, 0x08, 0x19, 0x1e, + 0x04, 0x8b, 0x62, 0x80, 0x18, 0x45, 0x02, 0x42, 0x92, 0x0b, 0x42, 0xc4, + 0x10, 0x32, 0x14, 0x38, 0x08, 0x18, 0x4b, 0x0a, 0x32, 0x62, 0x88, 0x48, + 0x90, 0x14, 0x20, 0x43, 0x46, 0x88, 0xa5, 0x00, 0x19, 0x32, 0x42, 0xe4, + 0x48, 0x0e, 0x90, 0x11, 0x23, 0xc4, 0x50, 0x41, 0x51, 0x81, 0x8c, 0xe1, + 0x83, 0xe5, 0x8a, 0x04, 0x31, 0x46, 0x06, 0x51, 0x18, 0x00, 0x00, 0x08, + 0x00, 0x00, 0x00, 0x1b, 0x8c, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x07, 0x40, + 0x02, 0xa8, 0x0d, 0x84, 0xf0, 0xff, 0xff, 0xff, 0xff, 0x03, 0x20, 0x6d, + 0x30, 0x86, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x09, 0xa8, 0x00, 0x49, + 0x18, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x13, 0x82, 0x60, 0x42, 0x20, + 0x4c, 0x08, 0x06, 0x00, 0x00, 0x00, 0x00, 0x89, 0x20, 0x00, 0x00, 0x58, + 0x00, 0x00, 0x00, 0x32, 0x22, 0x88, 0x09, 0x20, 0x64, 0x85, 0x04, 0x13, + 0x23, 0xa4, 0x84, 0x04, 0x13, 0x23, 0xe3, 0x84, 0xa1, 0x90, 0x14, 0x12, + 0x4c, 0x8c, 0x8c, 0x0b, 0x84, 0xc4, 0x4c, 0x10, 0x8c, 0xc1, 0x08, 0x40, + 0x09, 0x00, 0x0a, 0x66, 0x00, 0xe6, 0x08, 0xc0, 0x60, 0x8e, 0x00, 0x29, + 0xc6, 0x40, 0x10, 0x44, 0x41, 0x90, 0x51, 0x0c, 0x80, 0x20, 0x88, 0x62, + 0x20, 0xe4, 0xa6, 0xe1, 0xf2, 0x27, 0xec, 0x21, 0x24, 0x7f, 0x25, 0xa4, + 0x95, 0x98, 0xfc, 0xe2, 0xb6, 0x51, 0x31, 0x0c, 0xc3, 0x40, 0x50, 0x71, + 0xcf, 0x70, 0xf9, 0x13, 0xf6, 0x10, 0x92, 0x1f, 0x02, 0xcd, 0xb0, 0x10, + 0x28, 0x58, 0x0a, 0xa3, 0x10, 0x0c, 0x33, 0x0c, 0xc3, 0x40, 0x10, 0xc4, + 0x40, 0xcd, 0x51, 0xc3, 0xe5, 0x4f, 0xd8, 0x43, 0x48, 0x3e, 0xb7, 0x51, + 0xc5, 0x4a, 0x4c, 0x3e, 0x72, 0xdb, 0x88, 0x20, 0x08, 0x82, 0x28, 0xc4, + 0x43, 0x30, 0x04, 0x41, 0x47, 0x0d, 0x97, 0x3f, 0x61, 0x0f, 0x21, 0xf9, + 0xdc, 0x46, 0x15, 0x2b, 0x31, 0xf9, 0xc5, 0x6d, 0x23, 0x62, 0x18, 0x86, + 0xa1, 0x10, 0x12, 0xc1, 0x10, 0x34, 0xcd, 0x11, 0x04, 0xc5, 0x60, 0x88, + 0x82, 0x20, 0x2a, 0xb2, 0x06, 0x02, 0x86, 0x11, 0x88, 0x61, 0xa6, 0x36, + 0x18, 0x07, 0x76, 0x08, 0x87, 0x79, 0x98, 0x07, 0x37, 0xa0, 0x85, 0x72, + 0xc0, 0x07, 0x7a, 0xa8, 0x07, 0x79, 0x28, 0x07, 0x39, 0x20, 0x05, 0x3e, + 0xb0, 0x87, 0x72, 0x18, 0x07, 0x7a, 0x78, 0x07, 0x79, 0xe0, 0x03, 0x73, + 0x60, 0x87, 0x77, 0x08, 0x07, 0x7a, 0x60, 0x03, 0x30, 0xa0, 0x03, 0x3f, + 0x00, 0x03, 0x3f, 0xd0, 0x03, 0x3d, 0x68, 0x87, 0x74, 0x80, 0x87, 0x79, + 0xf8, 0x05, 0x7a, 0xc8, 0x07, 0x78, 0x28, 0x07, 0x14, 0x10, 0x33, 0x89, + 0xc1, 0x38, 0xb0, 0x43, 0x38, 0xcc, 0xc3, 0x3c, 0xb8, 0x01, 0x2d, 0x94, + 0x03, 0x3e, 0xd0, 0x43, 0x3d, 0xc8, 0x43, 0x39, 0xc8, 0x01, 0x29, 0xf0, + 0x81, 0x3d, 0x94, 0xc3, 0x38, 0xd0, 0xc3, 0x3b, 0xc8, 0x03, 0x1f, 0x98, + 0x03, 0x3b, 0xbc, 0x43, 0x38, 0xd0, 0x03, 0x1b, 0x80, 0x01, 0x1d, 0xf8, + 0x01, 0x18, 0xf8, 0x01, 0x12, 0x32, 0x8d, 0xb6, 0x61, 0x04, 0x61, 0x38, + 0x89, 0x75, 0xa8, 0x48, 0x20, 0x56, 0xc2, 0x40, 0x9c, 0x66, 0xa3, 0x8a, + 0x82, 0x88, 0x10, 0xd1, 0x75, 0xc4, 0x40, 0xde, 0x4d, 0xd2, 0x14, 0x51, + 0xc2, 0xe4, 0xb3, 0x00, 0xf3, 0x2c, 0x44, 0xc4, 0x4e, 0xc0, 0x44, 0xa0, + 0x80, 0x20, 0x30, 0x15, 0x08, 0x00, 0x00, 0x13, 0x14, 0x72, 0xc0, 0x87, + 0x74, 0x60, 0x87, 0x36, 0x68, 0x87, 0x79, 0x68, 0x03, 0x72, 0xc0, 0x87, + 0x0d, 0xaf, 0x50, 0x0e, 0x6d, 0xd0, 0x0e, 0x7a, 0x50, 0x0e, 0x6d, 0x00, + 0x0f, 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, + 0x0e, 0x71, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x78, 0xa0, + 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x71, 0x60, 0x07, 0x7a, 0x30, + 0x07, 0x72, 0xd0, 0x06, 0xe9, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, + 0x07, 0x6d, 0x90, 0x0e, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, + 0x06, 0xe6, 0x10, 0x07, 0x76, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x60, + 0x0e, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xe6, 0x60, + 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, 0xe0, 0x0e, 0x78, 0xa0, + 0x07, 0x71, 0x60, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x76, 0x40, + 0x07, 0x43, 0x9e, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x86, 0x3c, 0x06, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x0c, 0x79, 0x10, 0x20, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x18, 0xf2, 0x34, 0x40, 0x00, 0x0c, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0xe4, 0x81, 0x80, 0x00, 0x18, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0xc8, 0x33, 0x01, 0x01, 0x30, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x90, 0xc7, 0x02, 0x02, + 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x2c, 0x10, 0x14, + 0x00, 0x00, 0x00, 0x32, 0x1e, 0x98, 0x18, 0x19, 0x11, 0x4c, 0x90, 0x8c, + 0x09, 0x26, 0x47, 0xc6, 0x04, 0x43, 0x22, 0x4a, 0x60, 0x04, 0xa0, 0x18, + 0x8a, 0xa0, 0x24, 0xca, 0xa0, 0x60, 0xca, 0xa1, 0x20, 0x0a, 0xa4, 0x14, + 0x0a, 0xa5, 0x3c, 0xca, 0xa6, 0x10, 0xa8, 0x28, 0x89, 0x11, 0x80, 0x22, + 0x28, 0x83, 0x42, 0x28, 0x10, 0xaa, 0x6a, 0x80, 0xb8, 0x19, 0x00, 0xf2, + 0x66, 0x00, 0xe8, 0x9b, 0x01, 0xa0, 0x70, 0x06, 0x80, 0xc4, 0xb1, 0x14, + 0x84, 0x78, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x79, + 0x18, 0x00, 0x00, 0xae, 0x00, 0x00, 0x00, 0x1a, 0x03, 0x4c, 0x90, 0x46, + 0x02, 0x13, 0x44, 0x35, 0x18, 0x63, 0x0b, 0x73, 0x3b, 0x03, 0xb1, 0x2b, + 0x93, 0x9b, 0x4b, 0x7b, 0x73, 0x03, 0x99, 0x71, 0xb9, 0x01, 0x41, 0xa1, + 0x0b, 0x3b, 0x9b, 0x7b, 0x91, 0x2a, 0x62, 0x2a, 0x0a, 0x9a, 0x2a, 0xfa, + 0x9a, 0xb9, 0x81, 0x79, 0x31, 0x4b, 0x73, 0x0b, 0x63, 0x4b, 0xd9, 0x10, + 0x04, 0x13, 0x04, 0xe2, 0x98, 0x20, 0x10, 0xc8, 0x06, 0x61, 0x20, 0x36, + 0x08, 0x04, 0x41, 0x01, 0x6e, 0x6e, 0x82, 0x40, 0x24, 0x1b, 0x86, 0x03, + 0x21, 0x26, 0x08, 0x5c, 0xc7, 0x67, 0xea, 0xad, 0x4e, 0x6e, 0xac, 0x8c, + 0xaa, 0x0c, 0x8f, 0xae, 0x4e, 0xae, 0x4c, 0x86, 0x68, 0x82, 0x40, 0x28, + 0x13, 0x04, 0x62, 0xd9, 0x20, 0x10, 0xcd, 0x86, 0x84, 0x50, 0x16, 0x86, + 0x18, 0x18, 0xc2, 0xd9, 0x10, 0x3c, 0x13, 0x84, 0xef, 0xa3, 0x34, 0xf5, + 0x56, 0x27, 0x37, 0x56, 0x26, 0x55, 0x76, 0x96, 0xf6, 0xe6, 0x26, 0x54, + 0x67, 0x66, 0x56, 0x26, 0x37, 0x41, 0x20, 0x98, 0x09, 0x02, 0xd1, 0x6c, + 0x40, 0x88, 0x48, 0x9a, 0x88, 0x81, 0x02, 0x36, 0x04, 0xd5, 0x04, 0x21, + 0x0c, 0xc0, 0x80, 0xcd, 0xd4, 0x5b, 0x9d, 0xdc, 0x58, 0xd9, 0x54, 0x58, + 0x1b, 0x1c, 0x5b, 0x99, 0xdc, 0x06, 0x84, 0xb8, 0x30, 0x86, 0x18, 0x08, + 0x60, 0x43, 0x90, 0x6d, 0x20, 0x20, 0xc0, 0xd2, 0x26, 0x08, 0x9e, 0xc7, + 0xa4, 0xca, 0x8a, 0xa9, 0xcc, 0x8c, 0x8e, 0xea, 0x0d, 0x6e, 0x82, 0x40, + 0x38, 0x13, 0x84, 0x8a, 0xdb, 0x80, 0x20, 0xdd, 0x44, 0x78, 0x4d, 0xf3, + 0x91, 0xa9, 0xb2, 0x22, 0x4a, 0x6b, 0x2b, 0x73, 0x9b, 0x4b, 0x7b, 0x73, + 0x9b, 0x9b, 0x20, 0x10, 0xcf, 0x06, 0x04, 0x09, 0x83, 0x49, 0x0c, 0xbc, + 0xa6, 0xf9, 0x88, 0x34, 0xa5, 0xc1, 0x31, 0x95, 0xd9, 0x95, 0xb1, 0x4d, + 0x10, 0x08, 0x68, 0x82, 0x40, 0x44, 0x1b, 0x10, 0x84, 0x0c, 0xa6, 0x32, + 0xf0, 0xcc, 0xa0, 0xf9, 0xc8, 0x30, 0x85, 0xe5, 0x95, 0xc9, 0x3d, 0xc9, + 0x11, 0x95, 0xc1, 0xd1, 0xa1, 0x4d, 0x10, 0x08, 0x69, 0x83, 0x81, 0xa0, + 0xc1, 0x94, 0x06, 0x5e, 0xb3, 0xa1, 0xa0, 0xc0, 0x60, 0x0c, 0xce, 0x40, + 0x0d, 0x36, 0x0c, 0x04, 0xb7, 0x06, 0x13, 0x04, 0x01, 0xd8, 0x00, 0x6c, + 0x18, 0x08, 0x37, 0x70, 0x83, 0x0d, 0xc1, 0x1b, 0x6c, 0x18, 0x86, 0x36, + 0x80, 0x83, 0x09, 0x82, 0x18, 0x84, 0xc1, 0x86, 0x40, 0x0e, 0xa8, 0x08, + 0xb1, 0xa5, 0xd1, 0x19, 0xc9, 0xbd, 0xb5, 0xc9, 0x10, 0x11, 0xa1, 0x2a, + 0xc2, 0x1a, 0x7a, 0x7a, 0x92, 0x22, 0x9a, 0x20, 0x14, 0xd6, 0x04, 0xa1, + 0xb8, 0x36, 0x04, 0xc4, 0x04, 0xa1, 0xc0, 0x36, 0x08, 0xd3, 0xb4, 0x61, + 0x21, 0xea, 0xc0, 0x0e, 0xee, 0x00, 0x0f, 0xf2, 0x60, 0xc8, 0x03, 0xe2, + 0x0e, 0xf4, 0x80, 0xcb, 0x94, 0xd5, 0x17, 0xd4, 0xdb, 0x5c, 0x1a, 0x5d, + 0xda, 0x9b, 0xdb, 0x04, 0xa1, 0xc8, 0x26, 0x08, 0x85, 0xb6, 0x61, 0x19, + 0xf8, 0xc0, 0x0e, 0xfa, 0x00, 0x0f, 0xfc, 0x60, 0xf0, 0x83, 0xe1, 0x0e, + 0x80, 0x0d, 0xc2, 0x1e, 0xfc, 0x01, 0x93, 0x29, 0xab, 0x2f, 0xaa, 0x30, + 0xb9, 0xb3, 0x32, 0xba, 0x09, 0x42, 0xb1, 0x4d, 0x10, 0x88, 0x69, 0x83, + 0x30, 0x8d, 0xc2, 0x86, 0x85, 0x08, 0x05, 0x3b, 0x10, 0x05, 0x3c, 0xb8, + 0x83, 0xc1, 0x0f, 0x88, 0x3b, 0x20, 0x85, 0x0d, 0x41, 0x29, 0x6c, 0x18, + 0x40, 0xc1, 0x14, 0x80, 0x0d, 0x45, 0x1b, 0xd0, 0xc1, 0x29, 0x6c, 0x00, + 0x0d, 0x33, 0xb6, 0xb7, 0x30, 0xba, 0x39, 0x16, 0x69, 0x6e, 0x73, 0x74, + 0x73, 0x13, 0x04, 0x82, 0xa2, 0x31, 0x97, 0x76, 0xf6, 0xc5, 0x46, 0x46, + 0x63, 0x2e, 0xed, 0xec, 0x6b, 0x8e, 0x6e, 0x82, 0x40, 0x54, 0x44, 0xe8, + 0xca, 0xf0, 0xbe, 0xdc, 0xde, 0xe4, 0xda, 0x36, 0x28, 0xa9, 0x60, 0x06, + 0xaa, 0xb0, 0x0a, 0xac, 0xc0, 0xb4, 0x82, 0x2b, 0xbc, 0xc2, 0x50, 0x85, + 0x8d, 0xcd, 0xae, 0xcd, 0x25, 0x8d, 0xac, 0xcc, 0x8d, 0x6e, 0x4a, 0x10, + 0x54, 0x21, 0xc3, 0x73, 0xb1, 0x2b, 0x93, 0x9b, 0x4b, 0x7b, 0x73, 0x9b, + 0x12, 0x10, 0x4d, 0xc8, 0xf0, 0x5c, 0xec, 0xc2, 0xd8, 0xec, 0xca, 0xe4, + 0xa6, 0x04, 0x45, 0x1d, 0x32, 0x3c, 0x97, 0x39, 0xb4, 0x30, 0xb2, 0x32, + 0xb9, 0xa6, 0x37, 0xb2, 0x32, 0xb6, 0x29, 0x01, 0x52, 0x86, 0x0c, 0xcf, + 0x45, 0xae, 0x6c, 0xee, 0xad, 0x4e, 0x6e, 0xac, 0x6c, 0x6e, 0x4a, 0xa0, + 0x55, 0x22, 0xc3, 0x73, 0xa1, 0xcb, 0x83, 0x2b, 0x0b, 0x72, 0x73, 0x7b, + 0xa3, 0x0b, 0xa3, 0x4b, 0x7b, 0x73, 0x9b, 0x9b, 0x22, 0xac, 0x01, 0x1c, + 0xd4, 0x21, 0xc3, 0x73, 0xb1, 0x4b, 0x2b, 0xbb, 0x4b, 0x22, 0x9b, 0xa2, + 0x0b, 0xa3, 0x2b, 0x9b, 0x12, 0xc8, 0x41, 0x1d, 0x32, 0x3c, 0x97, 0x32, + 0x37, 0x3a, 0xb9, 0x3c, 0xa8, 0xb7, 0x34, 0x37, 0xba, 0xb9, 0x29, 0xc1, + 0x29, 0x74, 0x21, 0xc3, 0x73, 0x19, 0x7b, 0xab, 0x73, 0xa3, 0x2b, 0x93, + 0x9b, 0x9b, 0x12, 0xbc, 0x02, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00, 0x4c, + 0x00, 0x00, 0x00, 0x33, 0x08, 0x80, 0x1c, 0xc4, 0xe1, 0x1c, 0x66, 0x14, + 0x01, 0x3d, 0x88, 0x43, 0x38, 0x84, 0xc3, 0x8c, 0x42, 0x80, 0x07, 0x79, + 0x78, 0x07, 0x73, 0x98, 0x71, 0x0c, 0xe6, 0x00, 0x0f, 0xed, 0x10, 0x0e, + 0xf4, 0x80, 0x0e, 0x33, 0x0c, 0x42, 0x1e, 0xc2, 0xc1, 0x1d, 0xce, 0xa1, + 0x1c, 0x66, 0x30, 0x05, 0x3d, 0x88, 0x43, 0x38, 0x84, 0x83, 0x1b, 0xcc, + 0x03, 0x3d, 0xc8, 0x43, 0x3d, 0x8c, 0x03, 0x3d, 0xcc, 0x78, 0x8c, 0x74, + 0x70, 0x07, 0x7b, 0x08, 0x07, 0x79, 0x48, 0x87, 0x70, 0x70, 0x07, 0x7a, + 0x70, 0x03, 0x76, 0x78, 0x87, 0x70, 0x20, 0x87, 0x19, 0xcc, 0x11, 0x0e, + 0xec, 0x90, 0x0e, 0xe1, 0x30, 0x0f, 0x6e, 0x30, 0x0f, 0xe3, 0xf0, 0x0e, + 0xf0, 0x50, 0x0e, 0x33, 0x10, 0xc4, 0x1d, 0xde, 0x21, 0x1c, 0xd8, 0x21, + 0x1d, 0xc2, 0x61, 0x1e, 0x66, 0x30, 0x89, 0x3b, 0xbc, 0x83, 0x3b, 0xd0, + 0x43, 0x39, 0xb4, 0x03, 0x3c, 0xbc, 0x83, 0x3c, 0x84, 0x03, 0x3b, 0xcc, + 0xf0, 0x14, 0x76, 0x60, 0x07, 0x7b, 0x68, 0x07, 0x37, 0x68, 0x87, 0x72, + 0x68, 0x07, 0x37, 0x80, 0x87, 0x70, 0x90, 0x87, 0x70, 0x60, 0x07, 0x76, + 0x28, 0x07, 0x76, 0xf8, 0x05, 0x76, 0x78, 0x87, 0x77, 0x80, 0x87, 0x5f, + 0x08, 0x87, 0x71, 0x18, 0x87, 0x72, 0x98, 0x87, 0x79, 0x98, 0x81, 0x2c, + 0xee, 0xf0, 0x0e, 0xee, 0xe0, 0x0e, 0xf5, 0xc0, 0x0e, 0xec, 0x30, 0x03, + 0x62, 0xc8, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xcc, 0xa1, 0x1c, 0xe4, 0xa1, + 0x1c, 0xdc, 0x61, 0x1c, 0xca, 0x21, 0x1c, 0xc4, 0x81, 0x1d, 0xca, 0x61, + 0x06, 0xd6, 0x90, 0x43, 0x39, 0xc8, 0x43, 0x39, 0x98, 0x43, 0x39, 0xc8, + 0x43, 0x39, 0xb8, 0xc3, 0x38, 0x94, 0x43, 0x38, 0x88, 0x03, 0x3b, 0x94, + 0xc3, 0x2f, 0xbc, 0x83, 0x3c, 0xfc, 0x82, 0x3b, 0xd4, 0x03, 0x3b, 0xb0, + 0xc3, 0x0c, 0xc4, 0x21, 0x07, 0x7c, 0x70, 0x03, 0x7a, 0x28, 0x87, 0x76, + 0x80, 0x87, 0x19, 0xd1, 0x43, 0x0e, 0xf8, 0xe0, 0x06, 0xe4, 0x20, 0x0e, + 0xe7, 0xe0, 0x06, 0xf6, 0x10, 0x0e, 0xf2, 0xc0, 0x0e, 0xe1, 0x90, 0x0f, + 0xef, 0x50, 0x0f, 0xf4, 0x00, 0x00, 0x00, 0x71, 0x20, 0x00, 0x00, 0x1f, + 0x00, 0x00, 0x00, 0x06, 0xa0, 0x6c, 0x0b, 0x32, 0x7d, 0x91, 0xc3, 0xd8, + 0x9d, 0x15, 0x6c, 0xc3, 0xe5, 0x3b, 0x8f, 0x2f, 0x04, 0x54, 0x51, 0x10, + 0x51, 0xe9, 0x00, 0x43, 0x49, 0x18, 0x80, 0x80, 0xf9, 0xc5, 0x6d, 0x1b, + 0xc1, 0x36, 0x5c, 0xbe, 0xf3, 0xf8, 0x42, 0x40, 0x15, 0x05, 0x11, 0x95, + 0x0e, 0x30, 0x94, 0x84, 0x01, 0x08, 0x98, 0x8f, 0xdc, 0xb6, 0x19, 0x48, + 0xc3, 0xe5, 0x3b, 0x8f, 0x2f, 0x44, 0x04, 0x30, 0x11, 0x21, 0xd0, 0x0c, + 0x0b, 0x61, 0x01, 0xd3, 0x70, 0xf9, 0xce, 0xe3, 0x2f, 0x0e, 0x30, 0x88, + 0xcd, 0x43, 0x4d, 0x7e, 0x71, 0xdb, 0x36, 0x50, 0x0d, 0x97, 0xef, 0x3c, + 0xbe, 0x04, 0x30, 0xcf, 0x42, 0x94, 0x44, 0x45, 0x2c, 0x7e, 0x71, 0xdb, + 0x26, 0x50, 0x0d, 0x97, 0xef, 0x3c, 0xbe, 0x34, 0x39, 0x11, 0x81, 0x52, + 0xd3, 0x43, 0x4d, 0x7e, 0x71, 0xdb, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, + 0x41, 0x53, 0x48, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x96, + 0x4a, 0x75, 0x13, 0xa7, 0xff, 0x55, 0x58, 0xed, 0x84, 0x39, 0x1b, 0x53, + 0x97, 0x1f, 0x63, 0x44, 0x58, 0x49, 0x4c, 0xac, 0x07, 0x00, 0x00, 0x60, + 0x00, 0x00, 0x00, 0xeb, 0x01, 0x00, 0x00, 0x44, 0x58, 0x49, 0x4c, 0x00, + 0x01, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, 0x42, + 0x43, 0xc0, 0xde, 0x21, 0x0c, 0x00, 0x00, 0xe2, 0x01, 0x00, 0x00, 0x0b, 0x82, 0x20, 0x00, 0x02, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x07, 0x81, 0x23, 0x91, 0x41, 0xc8, 0x04, 0x49, 0x06, 0x10, 0x32, 0x39, 0x92, 0x01, 0x84, 0x0c, 0x25, 0x05, 0x08, 0x19, 0x1e, 0x04, 0x8b, 0x62, 0x80, @@ -664,284 +859,113 @@ const unsigned char g_BlitFrom2D[] = { 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xe6, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, 0xe0, 0x0e, 0x78, 0xa0, 0x07, 0x71, 0x60, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x43, 0x9e, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x86, 0x3c, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x86, 0x3c, 0x06, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x79, 0x10, 0x20, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0xf2, 0x34, 0x40, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0xe4, 0x81, 0x80, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0xc8, 0x33, 0x01, 0x01, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x90, 0xc7, 0x02, 0x02, 0x60, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x80, 0x2c, 0x10, 0x14, 0x00, 0x00, 0x00, 0x32, - 0x1e, 0x98, 0x18, 0x19, 0x11, 0x4c, 0x90, 0x8c, 0x09, 0x26, 0x47, 0xc6, + 0x00, 0x00, 0x00, 0x00, 0x80, 0x2c, 0x10, 0x10, 0x00, 0x00, 0x00, 0x32, + 0x1e, 0x98, 0x14, 0x19, 0x11, 0x4c, 0x90, 0x8c, 0x09, 0x26, 0x47, 0xc6, 0x04, 0x43, 0x22, 0x4a, 0x60, 0x04, 0xa0, 0x18, 0x8a, 0xa0, 0x24, 0xca, - 0xa0, 0x60, 0xca, 0xa1, 0x20, 0x0a, 0xa4, 0x14, 0x0a, 0xa5, 0x3c, 0xca, - 0xa6, 0x10, 0xa8, 0x28, 0x89, 0x11, 0x80, 0x22, 0x28, 0x83, 0x42, 0x28, - 0x10, 0xaa, 0x6a, 0x80, 0xb8, 0x19, 0x00, 0xf2, 0x66, 0x00, 0xe8, 0x9b, - 0x01, 0xa0, 0x70, 0x06, 0x80, 0xc4, 0xb1, 0x14, 0x84, 0x78, 0x1e, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00, 0xae, - 0x00, 0x00, 0x00, 0x1a, 0x03, 0x4c, 0x90, 0x46, 0x02, 0x13, 0x44, 0x35, - 0x18, 0x63, 0x0b, 0x73, 0x3b, 0x03, 0xb1, 0x2b, 0x93, 0x9b, 0x4b, 0x7b, - 0x73, 0x03, 0x99, 0x71, 0xb9, 0x01, 0x41, 0xa1, 0x0b, 0x3b, 0x9b, 0x7b, - 0x91, 0x2a, 0x62, 0x2a, 0x0a, 0x9a, 0x2a, 0xfa, 0x9a, 0xb9, 0x81, 0x79, - 0x31, 0x4b, 0x73, 0x0b, 0x63, 0x4b, 0xd9, 0x10, 0x04, 0x13, 0x04, 0xe2, - 0x98, 0x20, 0x10, 0xc8, 0x06, 0x61, 0x20, 0x36, 0x08, 0x04, 0x41, 0x01, - 0x6e, 0x6e, 0x82, 0x40, 0x24, 0x1b, 0x86, 0x03, 0x21, 0x26, 0x08, 0x5c, - 0xc7, 0x67, 0xea, 0xad, 0x4e, 0x6e, 0xac, 0x8c, 0xaa, 0x0c, 0x8f, 0xae, - 0x4e, 0xae, 0x4c, 0x86, 0x68, 0x82, 0x40, 0x28, 0x13, 0x04, 0x62, 0xd9, - 0x20, 0x10, 0xcd, 0x86, 0x84, 0x50, 0x16, 0x86, 0x18, 0x18, 0xc2, 0xd9, - 0x10, 0x3c, 0x13, 0x84, 0xef, 0xa3, 0x34, 0xf5, 0x56, 0x27, 0x37, 0x56, - 0x26, 0x55, 0x76, 0x96, 0xf6, 0xe6, 0x26, 0x54, 0x67, 0x66, 0x56, 0x26, - 0x37, 0x41, 0x20, 0x98, 0x09, 0x02, 0xd1, 0x6c, 0x40, 0x88, 0x48, 0x9a, - 0x88, 0x81, 0x02, 0x36, 0x04, 0xd5, 0x04, 0x21, 0x0c, 0xc0, 0x80, 0xcd, - 0xd4, 0x5b, 0x9d, 0xdc, 0x58, 0xd9, 0x54, 0x58, 0x1b, 0x1c, 0x5b, 0x99, - 0xdc, 0x06, 0x84, 0xb8, 0x30, 0x86, 0x18, 0x08, 0x60, 0x43, 0x90, 0x6d, - 0x20, 0x20, 0xc0, 0xd2, 0x26, 0x08, 0x9e, 0xc7, 0xa4, 0xca, 0x8a, 0xa9, - 0xcc, 0x8c, 0x8e, 0xea, 0x0d, 0x6e, 0x82, 0x40, 0x38, 0x13, 0x84, 0x8a, - 0xdb, 0x80, 0x20, 0xdd, 0x44, 0x78, 0x4d, 0xf3, 0x91, 0xa9, 0xb2, 0x22, - 0x4a, 0x6b, 0x2b, 0x73, 0x9b, 0x4b, 0x7b, 0x73, 0x9b, 0x9b, 0x20, 0x10, - 0xcf, 0x06, 0x04, 0x09, 0x83, 0x49, 0x0c, 0xbc, 0xa6, 0xf9, 0x88, 0x34, - 0xa5, 0xc1, 0x31, 0x95, 0xd9, 0x95, 0xb1, 0x4d, 0x10, 0x08, 0x68, 0x82, - 0x40, 0x44, 0x1b, 0x10, 0x84, 0x0c, 0xa6, 0x32, 0xf0, 0xcc, 0xa0, 0xf9, - 0xc8, 0x30, 0x85, 0xe5, 0x95, 0xc9, 0x3d, 0xc9, 0x11, 0x95, 0xc1, 0xd1, - 0xa1, 0x4d, 0x10, 0x08, 0x69, 0x83, 0x81, 0xa0, 0xc1, 0x94, 0x06, 0x5e, - 0xb3, 0xa1, 0xa0, 0xc0, 0x60, 0x0c, 0xce, 0x40, 0x0d, 0x36, 0x0c, 0x04, - 0xb7, 0x06, 0x13, 0x04, 0x01, 0xd8, 0x00, 0x6c, 0x18, 0x08, 0x37, 0x70, - 0x83, 0x0d, 0xc1, 0x1b, 0x6c, 0x18, 0x86, 0x36, 0x80, 0x83, 0x09, 0x82, - 0x18, 0x84, 0xc1, 0x86, 0x40, 0x0e, 0xa8, 0x08, 0xb1, 0xa5, 0xd1, 0x19, - 0xc9, 0xbd, 0xb5, 0xc9, 0x10, 0x11, 0xa1, 0x2a, 0xc2, 0x1a, 0x7a, 0x7a, - 0x92, 0x22, 0x9a, 0x20, 0x14, 0xd6, 0x04, 0xa1, 0xb8, 0x36, 0x04, 0xc4, - 0x04, 0xa1, 0xc0, 0x36, 0x08, 0xd3, 0xb4, 0x61, 0x21, 0xea, 0xc0, 0x0e, - 0xee, 0x00, 0x0f, 0xf2, 0x60, 0xc8, 0x03, 0xe2, 0x0e, 0xf4, 0x80, 0xcb, - 0x94, 0xd5, 0x17, 0xd4, 0xdb, 0x5c, 0x1a, 0x5d, 0xda, 0x9b, 0xdb, 0x04, - 0xa1, 0xc8, 0x26, 0x08, 0x85, 0xb6, 0x61, 0x19, 0xf8, 0xc0, 0x0e, 0xfa, - 0x00, 0x0f, 0xfc, 0x60, 0xf0, 0x83, 0xe1, 0x0e, 0x80, 0x0d, 0xc2, 0x1e, - 0xfc, 0x01, 0x93, 0x29, 0xab, 0x2f, 0xaa, 0x30, 0xb9, 0xb3, 0x32, 0xba, - 0x09, 0x42, 0xb1, 0x4d, 0x10, 0x88, 0x69, 0x83, 0x30, 0x8d, 0xc2, 0x86, - 0x85, 0x08, 0x05, 0x3b, 0x10, 0x05, 0x3c, 0xb8, 0x83, 0xc1, 0x0f, 0x88, - 0x3b, 0x20, 0x85, 0x0d, 0x41, 0x29, 0x6c, 0x18, 0x40, 0xc1, 0x14, 0x80, - 0x0d, 0x45, 0x1b, 0xd0, 0xc1, 0x29, 0x6c, 0x00, 0x0d, 0x33, 0xb6, 0xb7, - 0x30, 0xba, 0x39, 0x16, 0x69, 0x6e, 0x73, 0x74, 0x73, 0x13, 0x04, 0x82, - 0xa2, 0x31, 0x97, 0x76, 0xf6, 0xc5, 0x46, 0x46, 0x63, 0x2e, 0xed, 0xec, - 0x6b, 0x8e, 0x6e, 0x82, 0x40, 0x54, 0x44, 0xe8, 0xca, 0xf0, 0xbe, 0xdc, - 0xde, 0xe4, 0xda, 0x36, 0x28, 0xa9, 0x60, 0x06, 0xaa, 0xb0, 0x0a, 0xac, - 0xc0, 0xb4, 0x82, 0x2b, 0xbc, 0xc2, 0x50, 0x85, 0x8d, 0xcd, 0xae, 0xcd, - 0x25, 0x8d, 0xac, 0xcc, 0x8d, 0x6e, 0x4a, 0x10, 0x54, 0x21, 0xc3, 0x73, - 0xb1, 0x2b, 0x93, 0x9b, 0x4b, 0x7b, 0x73, 0x9b, 0x12, 0x10, 0x4d, 0xc8, - 0xf0, 0x5c, 0xec, 0xc2, 0xd8, 0xec, 0xca, 0xe4, 0xa6, 0x04, 0x45, 0x1d, - 0x32, 0x3c, 0x97, 0x39, 0xb4, 0x30, 0xb2, 0x32, 0xb9, 0xa6, 0x37, 0xb2, - 0x32, 0xb6, 0x29, 0x01, 0x52, 0x86, 0x0c, 0xcf, 0x45, 0xae, 0x6c, 0xee, - 0xad, 0x4e, 0x6e, 0xac, 0x6c, 0x6e, 0x4a, 0xa0, 0x55, 0x22, 0xc3, 0x73, - 0xa1, 0xcb, 0x83, 0x2b, 0x0b, 0x72, 0x73, 0x7b, 0xa3, 0x0b, 0xa3, 0x4b, - 0x7b, 0x73, 0x9b, 0x9b, 0x22, 0xac, 0x01, 0x1c, 0xd4, 0x21, 0xc3, 0x73, - 0xb1, 0x4b, 0x2b, 0xbb, 0x4b, 0x22, 0x9b, 0xa2, 0x0b, 0xa3, 0x2b, 0x9b, - 0x12, 0xc8, 0x41, 0x1d, 0x32, 0x3c, 0x97, 0x32, 0x37, 0x3a, 0xb9, 0x3c, - 0xa8, 0xb7, 0x34, 0x37, 0xba, 0xb9, 0x29, 0xc1, 0x29, 0x74, 0x21, 0xc3, - 0x73, 0x19, 0x7b, 0xab, 0x73, 0xa3, 0x2b, 0x93, 0x9b, 0x9b, 0x12, 0xbc, - 0x02, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x33, - 0x08, 0x80, 0x1c, 0xc4, 0xe1, 0x1c, 0x66, 0x14, 0x01, 0x3d, 0x88, 0x43, - 0x38, 0x84, 0xc3, 0x8c, 0x42, 0x80, 0x07, 0x79, 0x78, 0x07, 0x73, 0x98, - 0x71, 0x0c, 0xe6, 0x00, 0x0f, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x33, - 0x0c, 0x42, 0x1e, 0xc2, 0xc1, 0x1d, 0xce, 0xa1, 0x1c, 0x66, 0x30, 0x05, - 0x3d, 0x88, 0x43, 0x38, 0x84, 0x83, 0x1b, 0xcc, 0x03, 0x3d, 0xc8, 0x43, - 0x3d, 0x8c, 0x03, 0x3d, 0xcc, 0x78, 0x8c, 0x74, 0x70, 0x07, 0x7b, 0x08, - 0x07, 0x79, 0x48, 0x87, 0x70, 0x70, 0x07, 0x7a, 0x70, 0x03, 0x76, 0x78, - 0x87, 0x70, 0x20, 0x87, 0x19, 0xcc, 0x11, 0x0e, 0xec, 0x90, 0x0e, 0xe1, - 0x30, 0x0f, 0x6e, 0x30, 0x0f, 0xe3, 0xf0, 0x0e, 0xf0, 0x50, 0x0e, 0x33, - 0x10, 0xc4, 0x1d, 0xde, 0x21, 0x1c, 0xd8, 0x21, 0x1d, 0xc2, 0x61, 0x1e, - 0x66, 0x30, 0x89, 0x3b, 0xbc, 0x83, 0x3b, 0xd0, 0x43, 0x39, 0xb4, 0x03, - 0x3c, 0xbc, 0x83, 0x3c, 0x84, 0x03, 0x3b, 0xcc, 0xf0, 0x14, 0x76, 0x60, - 0x07, 0x7b, 0x68, 0x07, 0x37, 0x68, 0x87, 0x72, 0x68, 0x07, 0x37, 0x80, - 0x87, 0x70, 0x90, 0x87, 0x70, 0x60, 0x07, 0x76, 0x28, 0x07, 0x76, 0xf8, - 0x05, 0x76, 0x78, 0x87, 0x77, 0x80, 0x87, 0x5f, 0x08, 0x87, 0x71, 0x18, - 0x87, 0x72, 0x98, 0x87, 0x79, 0x98, 0x81, 0x2c, 0xee, 0xf0, 0x0e, 0xee, - 0xe0, 0x0e, 0xf5, 0xc0, 0x0e, 0xec, 0x30, 0x03, 0x62, 0xc8, 0xa1, 0x1c, - 0xe4, 0xa1, 0x1c, 0xcc, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xdc, 0x61, 0x1c, - 0xca, 0x21, 0x1c, 0xc4, 0x81, 0x1d, 0xca, 0x61, 0x06, 0xd6, 0x90, 0x43, - 0x39, 0xc8, 0x43, 0x39, 0x98, 0x43, 0x39, 0xc8, 0x43, 0x39, 0xb8, 0xc3, - 0x38, 0x94, 0x43, 0x38, 0x88, 0x03, 0x3b, 0x94, 0xc3, 0x2f, 0xbc, 0x83, - 0x3c, 0xfc, 0x82, 0x3b, 0xd4, 0x03, 0x3b, 0xb0, 0xc3, 0x0c, 0xc4, 0x21, - 0x07, 0x7c, 0x70, 0x03, 0x7a, 0x28, 0x87, 0x76, 0x80, 0x87, 0x19, 0xd1, - 0x43, 0x0e, 0xf8, 0xe0, 0x06, 0xe4, 0x20, 0x0e, 0xe7, 0xe0, 0x06, 0xf6, - 0x10, 0x0e, 0xf2, 0xc0, 0x0e, 0xe1, 0x90, 0x0f, 0xef, 0x50, 0x0f, 0xf4, - 0x00, 0x00, 0x00, 0x71, 0x20, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x06, - 0xa0, 0x6c, 0x0b, 0x32, 0x7d, 0x91, 0xc3, 0xd8, 0x9d, 0x15, 0x6c, 0xc3, - 0xe5, 0x3b, 0x8f, 0x2f, 0x04, 0x54, 0x51, 0x10, 0x51, 0xe9, 0x00, 0x43, - 0x49, 0x18, 0x80, 0x80, 0xf9, 0xc5, 0x6d, 0x1b, 0xc1, 0x36, 0x5c, 0xbe, - 0xf3, 0xf8, 0x42, 0x40, 0x15, 0x05, 0x11, 0x95, 0x0e, 0x30, 0x94, 0x84, - 0x01, 0x08, 0x98, 0x8f, 0xdc, 0xb6, 0x19, 0x48, 0xc3, 0xe5, 0x3b, 0x8f, - 0x2f, 0x44, 0x04, 0x30, 0x11, 0x21, 0xd0, 0x0c, 0x0b, 0x61, 0x01, 0xd3, - 0x70, 0xf9, 0xce, 0xe3, 0x2f, 0x0e, 0x30, 0x88, 0xcd, 0x43, 0x4d, 0x7e, - 0x71, 0xdb, 0x36, 0x50, 0x0d, 0x97, 0xef, 0x3c, 0xbe, 0x04, 0x30, 0xcf, - 0x42, 0x94, 0x44, 0x45, 0x2c, 0x7e, 0x71, 0xdb, 0x26, 0x50, 0x0d, 0x97, - 0xef, 0x3c, 0xbe, 0x34, 0x39, 0x11, 0x81, 0x52, 0xd3, 0x43, 0x4d, 0x7e, - 0x71, 0xdb, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x41, 0x53, 0x48, 0x14, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x96, 0x4a, 0x75, 0x13, 0xa7, - 0xff, 0x55, 0x58, 0xed, 0x84, 0x39, 0x1b, 0x53, 0x97, 0x1f, 0x63, 0x44, - 0x58, 0x49, 0x4c, 0xac, 0x07, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0xeb, - 0x01, 0x00, 0x00, 0x44, 0x58, 0x49, 0x4c, 0x00, 0x01, 0x00, 0x00, 0x10, - 0x00, 0x00, 0x00, 0x94, 0x07, 0x00, 0x00, 0x42, 0x43, 0xc0, 0xde, 0x21, - 0x0c, 0x00, 0x00, 0xe2, 0x01, 0x00, 0x00, 0x0b, 0x82, 0x20, 0x00, 0x02, - 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x07, 0x81, 0x23, 0x91, 0x41, - 0xc8, 0x04, 0x49, 0x06, 0x10, 0x32, 0x39, 0x92, 0x01, 0x84, 0x0c, 0x25, - 0x05, 0x08, 0x19, 0x1e, 0x04, 0x8b, 0x62, 0x80, 0x18, 0x45, 0x02, 0x42, - 0x92, 0x0b, 0x42, 0xc4, 0x10, 0x32, 0x14, 0x38, 0x08, 0x18, 0x4b, 0x0a, - 0x32, 0x62, 0x88, 0x48, 0x90, 0x14, 0x20, 0x43, 0x46, 0x88, 0xa5, 0x00, - 0x19, 0x32, 0x42, 0xe4, 0x48, 0x0e, 0x90, 0x11, 0x23, 0xc4, 0x50, 0x41, - 0x51, 0x81, 0x8c, 0xe1, 0x83, 0xe5, 0x8a, 0x04, 0x31, 0x46, 0x06, 0x51, - 0x18, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1b, 0x8c, 0xe0, 0xff, 0xff, - 0xff, 0xff, 0x07, 0x40, 0x02, 0xa8, 0x0d, 0x84, 0xf0, 0xff, 0xff, 0xff, - 0xff, 0x03, 0x20, 0x6d, 0x30, 0x86, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, - 0x09, 0xa8, 0x00, 0x49, 0x18, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x13, - 0x82, 0x60, 0x42, 0x20, 0x4c, 0x08, 0x06, 0x00, 0x00, 0x00, 0x00, 0x89, - 0x20, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00, 0x32, 0x22, 0x88, 0x09, 0x20, - 0x64, 0x85, 0x04, 0x13, 0x23, 0xa4, 0x84, 0x04, 0x13, 0x23, 0xe3, 0x84, - 0xa1, 0x90, 0x14, 0x12, 0x4c, 0x8c, 0x8c, 0x0b, 0x84, 0xc4, 0x4c, 0x10, - 0x8c, 0xc1, 0x08, 0x40, 0x09, 0x00, 0x0a, 0x66, 0x00, 0xe6, 0x08, 0xc0, - 0x60, 0x8e, 0x00, 0x29, 0xc6, 0x40, 0x10, 0x44, 0x41, 0x90, 0x51, 0x0c, - 0x80, 0x20, 0x88, 0x62, 0x20, 0xe4, 0xa6, 0xe1, 0xf2, 0x27, 0xec, 0x21, - 0x24, 0x7f, 0x25, 0xa4, 0x95, 0x98, 0xfc, 0xe2, 0xb6, 0x51, 0x31, 0x0c, - 0xc3, 0x40, 0x50, 0x71, 0xcf, 0x70, 0xf9, 0x13, 0xf6, 0x10, 0x92, 0x1f, - 0x02, 0xcd, 0xb0, 0x10, 0x28, 0x58, 0x0a, 0xa3, 0x10, 0x0c, 0x33, 0x0c, - 0xc3, 0x40, 0x10, 0xc4, 0x40, 0xcd, 0x51, 0xc3, 0xe5, 0x4f, 0xd8, 0x43, - 0x48, 0x3e, 0xb7, 0x51, 0xc5, 0x4a, 0x4c, 0x3e, 0x72, 0xdb, 0x88, 0x20, - 0x08, 0x82, 0x28, 0xc4, 0x43, 0x30, 0x04, 0x41, 0x47, 0x0d, 0x97, 0x3f, - 0x61, 0x0f, 0x21, 0xf9, 0xdc, 0x46, 0x15, 0x2b, 0x31, 0xf9, 0xc5, 0x6d, - 0x23, 0x62, 0x18, 0x86, 0xa1, 0x10, 0x12, 0xc1, 0x10, 0x34, 0xcd, 0x11, - 0x04, 0xc5, 0x60, 0x88, 0x82, 0x20, 0x2a, 0xb2, 0x06, 0x02, 0x86, 0x11, - 0x88, 0x61, 0xa6, 0x36, 0x18, 0x07, 0x76, 0x08, 0x87, 0x79, 0x98, 0x07, - 0x37, 0xa0, 0x85, 0x72, 0xc0, 0x07, 0x7a, 0xa8, 0x07, 0x79, 0x28, 0x07, - 0x39, 0x20, 0x05, 0x3e, 0xb0, 0x87, 0x72, 0x18, 0x07, 0x7a, 0x78, 0x07, - 0x79, 0xe0, 0x03, 0x73, 0x60, 0x87, 0x77, 0x08, 0x07, 0x7a, 0x60, 0x03, - 0x30, 0xa0, 0x03, 0x3f, 0x00, 0x03, 0x3f, 0xd0, 0x03, 0x3d, 0x68, 0x87, - 0x74, 0x80, 0x87, 0x79, 0xf8, 0x05, 0x7a, 0xc8, 0x07, 0x78, 0x28, 0x07, - 0x14, 0x10, 0x33, 0x89, 0xc1, 0x38, 0xb0, 0x43, 0x38, 0xcc, 0xc3, 0x3c, - 0xb8, 0x01, 0x2d, 0x94, 0x03, 0x3e, 0xd0, 0x43, 0x3d, 0xc8, 0x43, 0x39, - 0xc8, 0x01, 0x29, 0xf0, 0x81, 0x3d, 0x94, 0xc3, 0x38, 0xd0, 0xc3, 0x3b, - 0xc8, 0x03, 0x1f, 0x98, 0x03, 0x3b, 0xbc, 0x43, 0x38, 0xd0, 0x03, 0x1b, - 0x80, 0x01, 0x1d, 0xf8, 0x01, 0x18, 0xf8, 0x01, 0x12, 0x32, 0x8d, 0xb6, - 0x61, 0x04, 0x61, 0x38, 0x89, 0x75, 0xa8, 0x48, 0x20, 0x56, 0xc2, 0x40, - 0x9c, 0x66, 0xa3, 0x8a, 0x82, 0x88, 0x10, 0xd1, 0x75, 0xc4, 0x40, 0xde, - 0x4d, 0xd2, 0x14, 0x51, 0xc2, 0xe4, 0xb3, 0x00, 0xf3, 0x2c, 0x44, 0xc4, - 0x4e, 0xc0, 0x44, 0xa0, 0x80, 0x20, 0x30, 0x15, 0x08, 0x00, 0x00, 0x13, - 0x14, 0x72, 0xc0, 0x87, 0x74, 0x60, 0x87, 0x36, 0x68, 0x87, 0x79, 0x68, - 0x03, 0x72, 0xc0, 0x87, 0x0d, 0xaf, 0x50, 0x0e, 0x6d, 0xd0, 0x0e, 0x7a, - 0x50, 0x0e, 0x6d, 0x00, 0x0f, 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, - 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x71, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, - 0x90, 0x0e, 0x78, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x71, - 0x60, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xe9, 0x30, 0x07, 0x72, - 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x76, 0x40, 0x07, 0x7a, - 0x60, 0x07, 0x74, 0xd0, 0x06, 0xe6, 0x10, 0x07, 0x76, 0xa0, 0x07, 0x73, - 0x20, 0x07, 0x6d, 0x60, 0x0e, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, - 0xd0, 0x06, 0xe6, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, - 0xe0, 0x0e, 0x78, 0xa0, 0x07, 0x71, 0x60, 0x07, 0x7a, 0x30, 0x07, 0x72, - 0xa0, 0x07, 0x76, 0x40, 0x07, 0x43, 0x9e, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x86, 0x3c, 0x06, 0x10, 0x00, 0x01, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x79, 0x10, 0x20, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0xf2, 0x34, 0x40, - 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0xe4, 0x81, - 0x80, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0xc8, - 0x33, 0x01, 0x01, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, - 0x90, 0xc7, 0x02, 0x02, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x80, 0x2c, 0x10, 0x10, 0x00, 0x00, 0x00, 0x32, 0x1e, 0x98, 0x14, 0x19, - 0x11, 0x4c, 0x90, 0x8c, 0x09, 0x26, 0x47, 0xc6, 0x04, 0x43, 0x22, 0x4a, - 0x60, 0x04, 0xa0, 0x18, 0x8a, 0xa0, 0x24, 0xca, 0xa0, 0x60, 0xca, 0x83, - 0x8a, 0x92, 0x18, 0x01, 0x28, 0x82, 0x32, 0x28, 0x84, 0x02, 0x21, 0x6e, - 0x06, 0x80, 0xbe, 0x19, 0x00, 0x0a, 0x67, 0x00, 0x48, 0x1c, 0x4b, 0x41, - 0x88, 0xe7, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x79, - 0x18, 0x00, 0x00, 0x66, 0x00, 0x00, 0x00, 0x1a, 0x03, 0x4c, 0x90, 0x46, - 0x02, 0x13, 0x44, 0x35, 0x18, 0x63, 0x0b, 0x73, 0x3b, 0x03, 0xb1, 0x2b, - 0x93, 0x9b, 0x4b, 0x7b, 0x73, 0x03, 0x99, 0x71, 0xb9, 0x01, 0x41, 0xa1, - 0x0b, 0x3b, 0x9b, 0x7b, 0x91, 0x2a, 0x62, 0x2a, 0x0a, 0x9a, 0x2a, 0xfa, - 0x9a, 0xb9, 0x81, 0x79, 0x31, 0x4b, 0x73, 0x0b, 0x63, 0x4b, 0xd9, 0x10, - 0x04, 0x13, 0x04, 0xe2, 0x98, 0x20, 0x10, 0xc8, 0x06, 0x61, 0x20, 0x26, - 0x08, 0x44, 0xb2, 0x41, 0x18, 0x0c, 0x0a, 0x70, 0x73, 0x1b, 0x06, 0xc4, - 0x20, 0x26, 0x08, 0x5c, 0x45, 0x60, 0x82, 0x40, 0x28, 0x13, 0x04, 0x62, - 0xd9, 0x20, 0x10, 0xcd, 0x86, 0x84, 0x50, 0x16, 0x86, 0x18, 0x18, 0xc2, - 0xd9, 0x10, 0x3c, 0x13, 0x84, 0xcf, 0x9a, 0x20, 0x10, 0xcc, 0x04, 0x81, - 0x68, 0x36, 0x20, 0x44, 0xb4, 0x48, 0xc4, 0x30, 0x01, 0x1b, 0x02, 0x6a, - 0x82, 0x10, 0x06, 0xd7, 0x06, 0x84, 0xb0, 0x16, 0x86, 0x18, 0x08, 0x60, - 0x43, 0x70, 0x6d, 0x20, 0x20, 0xa0, 0xc2, 0x26, 0x08, 0x62, 0x80, 0x6d, - 0x08, 0xb4, 0x09, 0x82, 0x00, 0x50, 0x11, 0x62, 0x4b, 0xa3, 0x33, 0x92, - 0x7b, 0x6b, 0x93, 0x21, 0x22, 0x42, 0x55, 0x84, 0x35, 0xf4, 0xf4, 0x24, - 0x45, 0x34, 0x41, 0x28, 0x9e, 0x09, 0x42, 0x01, 0x6d, 0x08, 0x88, 0x09, - 0x42, 0x11, 0x6d, 0x10, 0x24, 0x69, 0xc3, 0x42, 0x78, 0x1f, 0x18, 0x84, - 0x81, 0x18, 0x0c, 0x62, 0x40, 0x80, 0xc1, 0x18, 0x70, 0x99, 0xb2, 0xfa, - 0x82, 0x7a, 0x9b, 0x4b, 0xa3, 0x4b, 0x7b, 0x73, 0x9b, 0x20, 0x14, 0xd2, - 0x04, 0xa1, 0x98, 0x36, 0x2c, 0x43, 0x19, 0x7c, 0x66, 0x10, 0x06, 0x67, - 0x30, 0x9c, 0xc1, 0x00, 0x06, 0xc0, 0x06, 0x81, 0x0c, 0xd0, 0x80, 0xc9, - 0x94, 0xd5, 0x17, 0x55, 0x98, 0xdc, 0x59, 0x19, 0xdd, 0x04, 0xa1, 0xa0, - 0x26, 0x08, 0x84, 0xb3, 0x41, 0x90, 0xd8, 0x60, 0xc3, 0x42, 0xa8, 0xc1, - 0xb7, 0x06, 0x61, 0x00, 0x06, 0xc3, 0x19, 0x10, 0x60, 0xd0, 0x06, 0x1b, - 0x02, 0x37, 0xd8, 0x30, 0xa4, 0xc1, 0x1b, 0x00, 0x1b, 0x0a, 0xae, 0x83, - 0x83, 0x0c, 0xa8, 0xc2, 0xc6, 0x66, 0xd7, 0xe6, 0x92, 0x46, 0x56, 0xe6, - 0x46, 0x37, 0x25, 0x08, 0xaa, 0x90, 0xe1, 0xb9, 0xd8, 0x95, 0xc9, 0xcd, - 0xa5, 0xbd, 0xb9, 0x4d, 0x09, 0x88, 0x26, 0x64, 0x78, 0x2e, 0x76, 0x61, - 0x6c, 0x76, 0x65, 0x72, 0x53, 0x02, 0xa3, 0x0e, 0x19, 0x9e, 0xcb, 0x1c, - 0x5a, 0x18, 0x59, 0x99, 0x5c, 0xd3, 0x1b, 0x59, 0x19, 0xdb, 0x94, 0x00, - 0x29, 0x43, 0x86, 0xe7, 0x22, 0x57, 0x36, 0xf7, 0x56, 0x27, 0x37, 0x56, - 0x36, 0x37, 0x25, 0xc0, 0xea, 0x90, 0xe1, 0xb9, 0xd8, 0xa5, 0x95, 0xdd, - 0x25, 0x91, 0x4d, 0xd1, 0x85, 0xd1, 0x95, 0x4d, 0x09, 0xb4, 0x3a, 0x64, - 0x78, 0x2e, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x50, 0x6f, 0x69, 0x6e, 0x74, - 0x73, 0x53, 0x02, 0x38, 0x00, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00, 0x4c, - 0x00, 0x00, 0x00, 0x33, 0x08, 0x80, 0x1c, 0xc4, 0xe1, 0x1c, 0x66, 0x14, - 0x01, 0x3d, 0x88, 0x43, 0x38, 0x84, 0xc3, 0x8c, 0x42, 0x80, 0x07, 0x79, - 0x78, 0x07, 0x73, 0x98, 0x71, 0x0c, 0xe6, 0x00, 0x0f, 0xed, 0x10, 0x0e, - 0xf4, 0x80, 0x0e, 0x33, 0x0c, 0x42, 0x1e, 0xc2, 0xc1, 0x1d, 0xce, 0xa1, - 0x1c, 0x66, 0x30, 0x05, 0x3d, 0x88, 0x43, 0x38, 0x84, 0x83, 0x1b, 0xcc, - 0x03, 0x3d, 0xc8, 0x43, 0x3d, 0x8c, 0x03, 0x3d, 0xcc, 0x78, 0x8c, 0x74, - 0x70, 0x07, 0x7b, 0x08, 0x07, 0x79, 0x48, 0x87, 0x70, 0x70, 0x07, 0x7a, - 0x70, 0x03, 0x76, 0x78, 0x87, 0x70, 0x20, 0x87, 0x19, 0xcc, 0x11, 0x0e, - 0xec, 0x90, 0x0e, 0xe1, 0x30, 0x0f, 0x6e, 0x30, 0x0f, 0xe3, 0xf0, 0x0e, - 0xf0, 0x50, 0x0e, 0x33, 0x10, 0xc4, 0x1d, 0xde, 0x21, 0x1c, 0xd8, 0x21, - 0x1d, 0xc2, 0x61, 0x1e, 0x66, 0x30, 0x89, 0x3b, 0xbc, 0x83, 0x3b, 0xd0, - 0x43, 0x39, 0xb4, 0x03, 0x3c, 0xbc, 0x83, 0x3c, 0x84, 0x03, 0x3b, 0xcc, - 0xf0, 0x14, 0x76, 0x60, 0x07, 0x7b, 0x68, 0x07, 0x37, 0x68, 0x87, 0x72, - 0x68, 0x07, 0x37, 0x80, 0x87, 0x70, 0x90, 0x87, 0x70, 0x60, 0x07, 0x76, - 0x28, 0x07, 0x76, 0xf8, 0x05, 0x76, 0x78, 0x87, 0x77, 0x80, 0x87, 0x5f, - 0x08, 0x87, 0x71, 0x18, 0x87, 0x72, 0x98, 0x87, 0x79, 0x98, 0x81, 0x2c, - 0xee, 0xf0, 0x0e, 0xee, 0xe0, 0x0e, 0xf5, 0xc0, 0x0e, 0xec, 0x30, 0x03, - 0x62, 0xc8, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xcc, 0xa1, 0x1c, 0xe4, 0xa1, - 0x1c, 0xdc, 0x61, 0x1c, 0xca, 0x21, 0x1c, 0xc4, 0x81, 0x1d, 0xca, 0x61, - 0x06, 0xd6, 0x90, 0x43, 0x39, 0xc8, 0x43, 0x39, 0x98, 0x43, 0x39, 0xc8, - 0x43, 0x39, 0xb8, 0xc3, 0x38, 0x94, 0x43, 0x38, 0x88, 0x03, 0x3b, 0x94, - 0xc3, 0x2f, 0xbc, 0x83, 0x3c, 0xfc, 0x82, 0x3b, 0xd4, 0x03, 0x3b, 0xb0, - 0xc3, 0x0c, 0xc4, 0x21, 0x07, 0x7c, 0x70, 0x03, 0x7a, 0x28, 0x87, 0x76, - 0x80, 0x87, 0x19, 0xd1, 0x43, 0x0e, 0xf8, 0xe0, 0x06, 0xe4, 0x20, 0x0e, - 0xe7, 0xe0, 0x06, 0xf6, 0x10, 0x0e, 0xf2, 0xc0, 0x0e, 0xe1, 0x90, 0x0f, - 0xef, 0x50, 0x0f, 0xf4, 0x00, 0x00, 0x00, 0x71, 0x20, 0x00, 0x00, 0x1f, - 0x00, 0x00, 0x00, 0x06, 0xa0, 0x6c, 0x0b, 0x32, 0x7d, 0x91, 0xc3, 0xd8, - 0x9d, 0x15, 0x6c, 0xc3, 0xe5, 0x3b, 0x8f, 0x2f, 0x04, 0x54, 0x51, 0x10, - 0x51, 0xe9, 0x00, 0x43, 0x49, 0x18, 0x80, 0x80, 0xf9, 0xc5, 0x6d, 0x1b, - 0xc1, 0x36, 0x5c, 0xbe, 0xf3, 0xf8, 0x42, 0x40, 0x15, 0x05, 0x11, 0x95, - 0x0e, 0x30, 0x94, 0x84, 0x01, 0x08, 0x98, 0x8f, 0xdc, 0xb6, 0x19, 0x48, - 0xc3, 0xe5, 0x3b, 0x8f, 0x2f, 0x44, 0x04, 0x30, 0x11, 0x21, 0xd0, 0x0c, - 0x0b, 0x61, 0x01, 0xd3, 0x70, 0xf9, 0xce, 0xe3, 0x2f, 0x0e, 0x30, 0x88, - 0xcd, 0x43, 0x4d, 0x7e, 0x71, 0xdb, 0x36, 0x50, 0x0d, 0x97, 0xef, 0x3c, - 0xbe, 0x04, 0x30, 0xcf, 0x42, 0x94, 0x44, 0x45, 0x2c, 0x7e, 0x71, 0xdb, - 0x26, 0x50, 0x0d, 0x97, 0xef, 0x3c, 0xbe, 0x34, 0x39, 0x11, 0x81, 0x52, - 0xd3, 0x43, 0x4d, 0x7e, 0x71, 0xdb, 0x00, 0x61, 0x20, 0x00, 0x00, 0x3e, - 0x00, 0x00, 0x00, 0x13, 0x04, 0x41, 0x2c, 0x10, 0x00, 0x00, 0x00, 0x06, - 0x00, 0x00, 0x00, 0x54, 0x8d, 0x00, 0x10, 0x51, 0x0a, 0x25, 0x37, 0x03, - 0x50, 0x08, 0x65, 0x57, 0x7c, 0x54, 0x94, 0x00, 0x0d, 0x33, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x23, 0x06, 0x09, 0x00, 0x82, 0x60, 0x60, 0x71, 0x87, - 0xa4, 0x69, 0xc9, 0x88, 0x41, 0x02, 0x80, 0x20, 0x18, 0x58, 0x1d, 0x12, - 0x6d, 0x9b, 0x32, 0x62, 0x90, 0x00, 0x20, 0x08, 0x06, 0x96, 0x97, 0x4c, - 0x1c, 0xb7, 0x8c, 0x18, 0x24, 0x00, 0x08, 0x82, 0x81, 0x41, 0x06, 0x48, - 0xd7, 0x55, 0xc9, 0x88, 0x41, 0x02, 0x80, 0x20, 0x18, 0x18, 0x65, 0x90, - 0x78, 0x9e, 0xa1, 0x8c, 0x18, 0x1c, 0x00, 0x08, 0x82, 0xc1, 0x24, 0x06, - 0xc9, 0xf0, 0x8d, 0x26, 0x04, 0xc0, 0x68, 0x82, 0x10, 0x8c, 0x26, 0x0c, - 0xc2, 0x68, 0x02, 0x31, 0x98, 0x70, 0xc8, 0xc7, 0x84, 0x43, 0x3e, 0x26, - 0x18, 0xf0, 0x31, 0xc1, 0x80, 0xcf, 0x88, 0xc1, 0x01, 0x80, 0x20, 0x18, - 0x40, 0x6c, 0x20, 0x31, 0x69, 0x30, 0x9a, 0x10, 0x00, 0x17, 0x0c, 0x35, - 0x62, 0xf0, 0x00, 0x20, 0x08, 0x06, 0x0d, 0x1c, 0x50, 0x11, 0x54, 0x10, - 0x92, 0xb4, 0x06, 0x6b, 0x70, 0x05, 0xa3, 0x09, 0x01, 0x30, 0x9a, 0x20, - 0x04, 0xa3, 0x09, 0x83, 0x30, 0x9a, 0x40, 0x0c, 0x23, 0x06, 0x09, 0x00, - 0x82, 0x60, 0x80, 0xd8, 0x81, 0x07, 0x07, 0x70, 0x80, 0x06, 0xc4, 0x88, - 0x41, 0x02, 0x80, 0x20, 0x18, 0x20, 0x76, 0xe0, 0xc1, 0x01, 0x1c, 0x60, - 0xc3, 0x88, 0x41, 0x02, 0x80, 0x20, 0x18, 0x20, 0x76, 0xe0, 0xc1, 0x01, - 0x1c, 0x9c, 0x81, 0x30, 0x62, 0x90, 0x00, 0x20, 0x08, 0x06, 0x88, 0x1d, - 0x78, 0x70, 0x00, 0x07, 0x66, 0x10, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00 + 0xa0, 0x60, 0xca, 0x83, 0x8a, 0x92, 0x18, 0x01, 0x28, 0x82, 0x32, 0x28, + 0x84, 0x02, 0x21, 0x6e, 0x06, 0x80, 0xbe, 0x19, 0x00, 0x0a, 0x67, 0x00, + 0x48, 0x1c, 0x4b, 0x41, 0x88, 0xe7, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00, 0x66, 0x00, 0x00, 0x00, 0x1a, + 0x03, 0x4c, 0x90, 0x46, 0x02, 0x13, 0x44, 0x35, 0x18, 0x63, 0x0b, 0x73, + 0x3b, 0x03, 0xb1, 0x2b, 0x93, 0x9b, 0x4b, 0x7b, 0x73, 0x03, 0x99, 0x71, + 0xb9, 0x01, 0x41, 0xa1, 0x0b, 0x3b, 0x9b, 0x7b, 0x91, 0x2a, 0x62, 0x2a, + 0x0a, 0x9a, 0x2a, 0xfa, 0x9a, 0xb9, 0x81, 0x79, 0x31, 0x4b, 0x73, 0x0b, + 0x63, 0x4b, 0xd9, 0x10, 0x04, 0x13, 0x04, 0xe2, 0x98, 0x20, 0x10, 0xc8, + 0x06, 0x61, 0x20, 0x26, 0x08, 0x44, 0xb2, 0x41, 0x18, 0x0c, 0x0a, 0x70, + 0x73, 0x1b, 0x06, 0xc4, 0x20, 0x26, 0x08, 0x5c, 0x45, 0x60, 0x82, 0x40, + 0x28, 0x13, 0x04, 0x62, 0xd9, 0x20, 0x10, 0xcd, 0x86, 0x84, 0x50, 0x16, + 0x86, 0x18, 0x18, 0xc2, 0xd9, 0x10, 0x3c, 0x13, 0x84, 0xcf, 0x9a, 0x20, + 0x10, 0xcc, 0x04, 0x81, 0x68, 0x36, 0x20, 0x44, 0xb4, 0x48, 0xc4, 0x30, + 0x01, 0x1b, 0x02, 0x6a, 0x82, 0x10, 0x06, 0xd7, 0x06, 0x84, 0xb0, 0x16, + 0x86, 0x18, 0x08, 0x60, 0x43, 0x70, 0x6d, 0x20, 0x20, 0xa0, 0xc2, 0x26, + 0x08, 0x62, 0x80, 0x6d, 0x08, 0xb4, 0x09, 0x82, 0x00, 0x50, 0x11, 0x62, + 0x4b, 0xa3, 0x33, 0x92, 0x7b, 0x6b, 0x93, 0x21, 0x22, 0x42, 0x55, 0x84, + 0x35, 0xf4, 0xf4, 0x24, 0x45, 0x34, 0x41, 0x28, 0x9e, 0x09, 0x42, 0x01, + 0x6d, 0x08, 0x88, 0x09, 0x42, 0x11, 0x6d, 0x10, 0x24, 0x69, 0xc3, 0x42, + 0x78, 0x1f, 0x18, 0x84, 0x81, 0x18, 0x0c, 0x62, 0x40, 0x80, 0xc1, 0x18, + 0x70, 0x99, 0xb2, 0xfa, 0x82, 0x7a, 0x9b, 0x4b, 0xa3, 0x4b, 0x7b, 0x73, + 0x9b, 0x20, 0x14, 0xd2, 0x04, 0xa1, 0x98, 0x36, 0x2c, 0x43, 0x19, 0x7c, + 0x66, 0x10, 0x06, 0x67, 0x30, 0x9c, 0xc1, 0x00, 0x06, 0xc0, 0x06, 0x81, + 0x0c, 0xd0, 0x80, 0xc9, 0x94, 0xd5, 0x17, 0x55, 0x98, 0xdc, 0x59, 0x19, + 0xdd, 0x04, 0xa1, 0xa0, 0x26, 0x08, 0x84, 0xb3, 0x41, 0x90, 0xd8, 0x60, + 0xc3, 0x42, 0xa8, 0xc1, 0xb7, 0x06, 0x61, 0x00, 0x06, 0xc3, 0x19, 0x10, + 0x60, 0xd0, 0x06, 0x1b, 0x02, 0x37, 0xd8, 0x30, 0xa4, 0xc1, 0x1b, 0x00, + 0x1b, 0x0a, 0xae, 0x83, 0x83, 0x0c, 0xa8, 0xc2, 0xc6, 0x66, 0xd7, 0xe6, + 0x92, 0x46, 0x56, 0xe6, 0x46, 0x37, 0x25, 0x08, 0xaa, 0x90, 0xe1, 0xb9, + 0xd8, 0x95, 0xc9, 0xcd, 0xa5, 0xbd, 0xb9, 0x4d, 0x09, 0x88, 0x26, 0x64, + 0x78, 0x2e, 0x76, 0x61, 0x6c, 0x76, 0x65, 0x72, 0x53, 0x02, 0xa3, 0x0e, + 0x19, 0x9e, 0xcb, 0x1c, 0x5a, 0x18, 0x59, 0x99, 0x5c, 0xd3, 0x1b, 0x59, + 0x19, 0xdb, 0x94, 0x00, 0x29, 0x43, 0x86, 0xe7, 0x22, 0x57, 0x36, 0xf7, + 0x56, 0x27, 0x37, 0x56, 0x36, 0x37, 0x25, 0xc0, 0xea, 0x90, 0xe1, 0xb9, + 0xd8, 0xa5, 0x95, 0xdd, 0x25, 0x91, 0x4d, 0xd1, 0x85, 0xd1, 0x95, 0x4d, + 0x09, 0xb4, 0x3a, 0x64, 0x78, 0x2e, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x50, + 0x6f, 0x69, 0x6e, 0x74, 0x73, 0x53, 0x02, 0x38, 0x00, 0x00, 0x00, 0x79, + 0x18, 0x00, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x33, 0x08, 0x80, 0x1c, 0xc4, + 0xe1, 0x1c, 0x66, 0x14, 0x01, 0x3d, 0x88, 0x43, 0x38, 0x84, 0xc3, 0x8c, + 0x42, 0x80, 0x07, 0x79, 0x78, 0x07, 0x73, 0x98, 0x71, 0x0c, 0xe6, 0x00, + 0x0f, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x33, 0x0c, 0x42, 0x1e, 0xc2, + 0xc1, 0x1d, 0xce, 0xa1, 0x1c, 0x66, 0x30, 0x05, 0x3d, 0x88, 0x43, 0x38, + 0x84, 0x83, 0x1b, 0xcc, 0x03, 0x3d, 0xc8, 0x43, 0x3d, 0x8c, 0x03, 0x3d, + 0xcc, 0x78, 0x8c, 0x74, 0x70, 0x07, 0x7b, 0x08, 0x07, 0x79, 0x48, 0x87, + 0x70, 0x70, 0x07, 0x7a, 0x70, 0x03, 0x76, 0x78, 0x87, 0x70, 0x20, 0x87, + 0x19, 0xcc, 0x11, 0x0e, 0xec, 0x90, 0x0e, 0xe1, 0x30, 0x0f, 0x6e, 0x30, + 0x0f, 0xe3, 0xf0, 0x0e, 0xf0, 0x50, 0x0e, 0x33, 0x10, 0xc4, 0x1d, 0xde, + 0x21, 0x1c, 0xd8, 0x21, 0x1d, 0xc2, 0x61, 0x1e, 0x66, 0x30, 0x89, 0x3b, + 0xbc, 0x83, 0x3b, 0xd0, 0x43, 0x39, 0xb4, 0x03, 0x3c, 0xbc, 0x83, 0x3c, + 0x84, 0x03, 0x3b, 0xcc, 0xf0, 0x14, 0x76, 0x60, 0x07, 0x7b, 0x68, 0x07, + 0x37, 0x68, 0x87, 0x72, 0x68, 0x07, 0x37, 0x80, 0x87, 0x70, 0x90, 0x87, + 0x70, 0x60, 0x07, 0x76, 0x28, 0x07, 0x76, 0xf8, 0x05, 0x76, 0x78, 0x87, + 0x77, 0x80, 0x87, 0x5f, 0x08, 0x87, 0x71, 0x18, 0x87, 0x72, 0x98, 0x87, + 0x79, 0x98, 0x81, 0x2c, 0xee, 0xf0, 0x0e, 0xee, 0xe0, 0x0e, 0xf5, 0xc0, + 0x0e, 0xec, 0x30, 0x03, 0x62, 0xc8, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xcc, + 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xdc, 0x61, 0x1c, 0xca, 0x21, 0x1c, 0xc4, + 0x81, 0x1d, 0xca, 0x61, 0x06, 0xd6, 0x90, 0x43, 0x39, 0xc8, 0x43, 0x39, + 0x98, 0x43, 0x39, 0xc8, 0x43, 0x39, 0xb8, 0xc3, 0x38, 0x94, 0x43, 0x38, + 0x88, 0x03, 0x3b, 0x94, 0xc3, 0x2f, 0xbc, 0x83, 0x3c, 0xfc, 0x82, 0x3b, + 0xd4, 0x03, 0x3b, 0xb0, 0xc3, 0x0c, 0xc4, 0x21, 0x07, 0x7c, 0x70, 0x03, + 0x7a, 0x28, 0x87, 0x76, 0x80, 0x87, 0x19, 0xd1, 0x43, 0x0e, 0xf8, 0xe0, + 0x06, 0xe4, 0x20, 0x0e, 0xe7, 0xe0, 0x06, 0xf6, 0x10, 0x0e, 0xf2, 0xc0, + 0x0e, 0xe1, 0x90, 0x0f, 0xef, 0x50, 0x0f, 0xf4, 0x00, 0x00, 0x00, 0x71, + 0x20, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x06, 0xa0, 0x6c, 0x0b, 0x32, + 0x7d, 0x91, 0xc3, 0xd8, 0x9d, 0x15, 0x6c, 0xc3, 0xe5, 0x3b, 0x8f, 0x2f, + 0x04, 0x54, 0x51, 0x10, 0x51, 0xe9, 0x00, 0x43, 0x49, 0x18, 0x80, 0x80, + 0xf9, 0xc5, 0x6d, 0x1b, 0xc1, 0x36, 0x5c, 0xbe, 0xf3, 0xf8, 0x42, 0x40, + 0x15, 0x05, 0x11, 0x95, 0x0e, 0x30, 0x94, 0x84, 0x01, 0x08, 0x98, 0x8f, + 0xdc, 0xb6, 0x19, 0x48, 0xc3, 0xe5, 0x3b, 0x8f, 0x2f, 0x44, 0x04, 0x30, + 0x11, 0x21, 0xd0, 0x0c, 0x0b, 0x61, 0x01, 0xd3, 0x70, 0xf9, 0xce, 0xe3, + 0x2f, 0x0e, 0x30, 0x88, 0xcd, 0x43, 0x4d, 0x7e, 0x71, 0xdb, 0x36, 0x50, + 0x0d, 0x97, 0xef, 0x3c, 0xbe, 0x04, 0x30, 0xcf, 0x42, 0x94, 0x44, 0x45, + 0x2c, 0x7e, 0x71, 0xdb, 0x26, 0x50, 0x0d, 0x97, 0xef, 0x3c, 0xbe, 0x34, + 0x39, 0x11, 0x81, 0x52, 0xd3, 0x43, 0x4d, 0x7e, 0x71, 0xdb, 0x00, 0x61, + 0x20, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x13, 0x04, 0x41, 0x2c, 0x10, + 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x54, 0x8d, 0x00, 0x10, 0x51, + 0x0a, 0x25, 0x37, 0x03, 0x50, 0x08, 0x65, 0x57, 0x7c, 0x54, 0x94, 0x00, + 0x0d, 0x33, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x06, 0x09, 0x00, 0x82, + 0x60, 0x60, 0x71, 0x87, 0xa4, 0x69, 0xc9, 0x88, 0x41, 0x02, 0x80, 0x20, + 0x18, 0x58, 0x1d, 0x12, 0x6d, 0x9b, 0x32, 0x62, 0x90, 0x00, 0x20, 0x08, + 0x06, 0x96, 0x97, 0x4c, 0x1c, 0xb7, 0x8c, 0x18, 0x24, 0x00, 0x08, 0x82, + 0x81, 0x41, 0x06, 0x48, 0xd7, 0x55, 0xc9, 0x88, 0x41, 0x02, 0x80, 0x20, + 0x18, 0x18, 0x65, 0x90, 0x78, 0x9e, 0xa1, 0x8c, 0x18, 0x1c, 0x00, 0x08, + 0x82, 0xc1, 0x24, 0x06, 0xc9, 0xf0, 0x8d, 0x26, 0x04, 0xc0, 0x68, 0x82, + 0x10, 0x8c, 0x26, 0x0c, 0xc2, 0x68, 0x02, 0x31, 0x98, 0x70, 0xc8, 0xc7, + 0x84, 0x43, 0x3e, 0x26, 0x18, 0xf0, 0x31, 0xc1, 0x80, 0xcf, 0x88, 0xc1, + 0x01, 0x80, 0x20, 0x18, 0x40, 0x6c, 0x20, 0x31, 0x69, 0x30, 0x9a, 0x10, + 0x00, 0x17, 0x0c, 0x35, 0x62, 0xf0, 0x00, 0x20, 0x08, 0x06, 0x0d, 0x1c, + 0x50, 0x11, 0x54, 0x10, 0x92, 0xb4, 0x06, 0x6b, 0x70, 0x05, 0xa3, 0x09, + 0x01, 0x30, 0x9a, 0x20, 0x04, 0xa3, 0x09, 0x83, 0x30, 0x9a, 0x40, 0x0c, + 0x23, 0x06, 0x09, 0x00, 0x82, 0x60, 0x80, 0xd8, 0x81, 0x07, 0x07, 0x70, + 0x80, 0x06, 0xc4, 0x88, 0x41, 0x02, 0x80, 0x20, 0x18, 0x20, 0x76, 0xe0, + 0xc1, 0x01, 0x1c, 0x60, 0xc3, 0x88, 0x41, 0x02, 0x80, 0x20, 0x18, 0x20, + 0x76, 0xe0, 0xc1, 0x01, 0x1c, 0x9c, 0x81, 0x30, 0x62, 0x90, 0x00, 0x20, + 0x08, 0x06, 0x88, 0x1d, 0x78, 0x70, 0x00, 0x07, 0x66, 0x10, 0x20, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; #if 0 ; @@ -1121,223 +1145,62 @@ attributes #2 = { nounwind readonly } #endif const unsigned char g_BlitFrom2DArray[] = { - 0x44, 0x58, 0x42, 0x43, 0x97, 0x9b, 0xe2, 0xe6, 0x7c, 0x9a, 0x59, 0x06, - 0xdd, 0x35, 0x7a, 0xab, 0x5f, 0x91, 0x3d, 0xe1, 0x01, 0x00, 0x00, 0x00, - 0xef, 0x11, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, - 0x4c, 0x00, 0x00, 0x00, 0xb1, 0x00, 0x00, 0x00, 0xeb, 0x00, 0x00, 0x00, - 0xe3, 0x01, 0x00, 0x00, 0xe7, 0x09, 0x00, 0x00, 0x03, 0x0a, 0x00, 0x00, - 0x53, 0x46, 0x49, 0x30, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x49, 0x53, 0x47, 0x31, 0x5d, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x54, 0x45, 0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44, 0x00, 0x53, 0x56, 0x5f, - 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x4f, 0x53, 0x47, - 0x31, 0x32, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x40, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x53, 0x56, 0x5f, - 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x00, 0x50, 0x53, 0x56, 0x30, 0xf0, - 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x44, 0x58, 0x42, 0x43, 0xdf, 0xde, 0xbd, 0x23, 0xe2, 0x83, 0x0e, 0x5d, + 0xfb, 0xe3, 0x84, 0xf0, 0x8c, 0x87, 0xbb, 0x3c, 0x01, 0x00, 0x00, 0x00, + 0x83, 0x12, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, + 0x50, 0x00, 0x00, 0x00, 0xb5, 0x00, 0x00, 0x00, 0xef, 0x00, 0x00, 0x00, + 0xe7, 0x01, 0x00, 0x00, 0x77, 0x02, 0x00, 0x00, 0x7b, 0x0a, 0x00, 0x00, + 0x97, 0x0a, 0x00, 0x00, 0x53, 0x46, 0x49, 0x30, 0x08, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x49, 0x53, 0x47, 0x31, + 0x5d, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x51, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x54, 0x45, 0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44, + 0x00, 0x53, 0x56, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, + 0x00, 0x4f, 0x53, 0x47, 0x31, 0x32, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, + 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x53, 0x56, 0x5f, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x00, 0x50, + 0x53, 0x56, 0x30, 0xf0, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x02, - 0x01, 0x00, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x18, - 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x54, 0x45, 0x58, 0x43, - 0x4f, 0x4f, 0x52, 0x44, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x01, 0x00, 0x42, 0x00, 0x03, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x44, 0x03, 0x03, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, - 0x00, 0x44, 0x10, 0x03, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x0f, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, + 0x00, 0x00, 0x00, 0x02, 0x01, 0x00, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, + 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x03, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0d, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, + 0x54, 0x45, 0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44, 0x00, 0x00, 0x00, 0x01, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x42, 0x00, 0x03, + 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, + 0x01, 0x44, 0x03, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x01, 0x00, 0x44, 0x10, 0x03, 0x00, 0x00, 0x00, 0x0f, + 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x53, 0x54, 0x41, 0x54, 0xfc, 0x07, 0x00, 0x00, 0x60, - 0x00, 0x00, 0x00, 0xff, 0x01, 0x00, 0x00, 0x44, 0x58, 0x49, 0x4c, 0x00, - 0x01, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0xe4, 0x07, 0x00, 0x00, 0x42, - 0x43, 0xc0, 0xde, 0x21, 0x0c, 0x00, 0x00, 0xf6, 0x01, 0x00, 0x00, 0x0b, - 0x82, 0x20, 0x00, 0x02, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x07, - 0x81, 0x23, 0x91, 0x41, 0xc8, 0x04, 0x49, 0x06, 0x10, 0x32, 0x39, 0x92, - 0x01, 0x84, 0x0c, 0x25, 0x05, 0x08, 0x19, 0x1e, 0x04, 0x8b, 0x62, 0x80, - 0x18, 0x45, 0x02, 0x42, 0x92, 0x0b, 0x42, 0xc4, 0x10, 0x32, 0x14, 0x38, - 0x08, 0x18, 0x4b, 0x0a, 0x32, 0x62, 0x88, 0x48, 0x90, 0x14, 0x20, 0x43, - 0x46, 0x88, 0xa5, 0x00, 0x19, 0x32, 0x42, 0xe4, 0x48, 0x0e, 0x90, 0x11, - 0x23, 0xc4, 0x50, 0x41, 0x51, 0x81, 0x8c, 0xe1, 0x83, 0xe5, 0x8a, 0x04, - 0x31, 0x46, 0x06, 0x51, 0x18, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1b, - 0x8c, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x07, 0x40, 0x02, 0xa8, 0x0d, 0x84, - 0xf0, 0xff, 0xff, 0xff, 0xff, 0x03, 0x20, 0x6d, 0x30, 0x86, 0xff, 0xff, - 0xff, 0xff, 0x1f, 0x00, 0x09, 0xa8, 0x00, 0x49, 0x18, 0x00, 0x00, 0x03, - 0x00, 0x00, 0x00, 0x13, 0x82, 0x60, 0x42, 0x20, 0x4c, 0x08, 0x06, 0x00, - 0x00, 0x00, 0x00, 0x89, 0x20, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, 0x32, - 0x22, 0x88, 0x09, 0x20, 0x64, 0x85, 0x04, 0x13, 0x23, 0xa4, 0x84, 0x04, - 0x13, 0x23, 0xe3, 0x84, 0xa1, 0x90, 0x14, 0x12, 0x4c, 0x8c, 0x8c, 0x0b, - 0x84, 0xc4, 0x4c, 0x10, 0x8c, 0xc1, 0x08, 0x40, 0x09, 0x00, 0x0a, 0x66, - 0x00, 0xe6, 0x08, 0xc0, 0x60, 0x8e, 0x00, 0x29, 0xc6, 0x40, 0x10, 0x44, - 0x41, 0x90, 0x51, 0x0c, 0x80, 0x20, 0x88, 0x62, 0x20, 0xe4, 0xa6, 0xe1, - 0xf2, 0x27, 0xec, 0x21, 0x24, 0x7f, 0x25, 0xa4, 0x95, 0x98, 0xfc, 0xe2, - 0xb6, 0x51, 0x31, 0x0c, 0xc3, 0x40, 0x50, 0x71, 0xcf, 0x70, 0xf9, 0x13, - 0xf6, 0x10, 0x92, 0x1f, 0x02, 0xcd, 0xb0, 0x10, 0x28, 0x58, 0x0a, 0xa3, - 0x10, 0x0c, 0x33, 0x0c, 0xc3, 0x40, 0x10, 0xc4, 0x40, 0xcd, 0x51, 0xc3, - 0xe5, 0x4f, 0xd8, 0x43, 0x48, 0x3e, 0xb7, 0x51, 0xc5, 0x4a, 0x4c, 0x7e, - 0x71, 0xdb, 0x88, 0x18, 0x86, 0x61, 0x28, 0xc4, 0x43, 0x30, 0x04, 0x41, - 0x47, 0x0d, 0x97, 0x3f, 0x61, 0x0f, 0x21, 0xf9, 0xdc, 0x46, 0x15, 0x2b, - 0x31, 0xf9, 0xc8, 0x6d, 0x23, 0x82, 0x20, 0x08, 0xa2, 0x10, 0x12, 0xc1, - 0x10, 0x34, 0xcd, 0x11, 0x04, 0xc5, 0x60, 0x88, 0x82, 0x20, 0x2a, 0xb2, - 0x06, 0x02, 0x86, 0x11, 0x88, 0x61, 0x26, 0x39, 0x18, 0x07, 0x76, 0x08, - 0x87, 0x79, 0x98, 0x07, 0x37, 0xa0, 0x85, 0x72, 0xc0, 0x07, 0x7a, 0xa8, - 0x07, 0x79, 0x28, 0x07, 0x39, 0x20, 0x85, 0x50, 0x90, 0x07, 0x79, 0x08, - 0x87, 0x7c, 0xe0, 0x03, 0x7b, 0x28, 0x87, 0x71, 0xa0, 0x87, 0x77, 0x90, - 0x07, 0x3e, 0x30, 0x07, 0x76, 0x78, 0x87, 0x70, 0xa0, 0x07, 0x36, 0x00, - 0x03, 0x3a, 0xf0, 0x03, 0x30, 0xf0, 0x03, 0x3d, 0xd0, 0x83, 0x76, 0x48, - 0x07, 0x78, 0x98, 0x87, 0x5f, 0xa0, 0x87, 0x7c, 0x80, 0x87, 0x72, 0x40, - 0x01, 0x31, 0xd3, 0x19, 0x8c, 0x03, 0x3b, 0x84, 0xc3, 0x3c, 0xcc, 0x83, - 0x1b, 0xd0, 0x42, 0x39, 0xe0, 0x03, 0x3d, 0xd4, 0x83, 0x3c, 0x94, 0x83, - 0x1c, 0x90, 0x42, 0x28, 0xc8, 0x83, 0x3c, 0x84, 0x43, 0x3e, 0xf0, 0x81, - 0x3d, 0x94, 0xc3, 0x38, 0xd0, 0xc3, 0x3b, 0xc8, 0x03, 0x1f, 0x98, 0x03, - 0x3b, 0xbc, 0x43, 0x38, 0xd0, 0x03, 0x1b, 0x80, 0x01, 0x1d, 0xf8, 0x01, - 0x18, 0xf8, 0x01, 0x12, 0x32, 0x8d, 0xb6, 0x61, 0x04, 0x61, 0x38, 0x89, - 0x75, 0xa8, 0x48, 0x20, 0x56, 0xc2, 0x40, 0x9c, 0x66, 0xa3, 0x8a, 0x82, - 0x88, 0x10, 0xd1, 0x75, 0xc4, 0x40, 0xde, 0x4d, 0xd2, 0x14, 0x51, 0xc2, - 0xe4, 0xb3, 0x00, 0xf3, 0x2c, 0x44, 0xc4, 0x4e, 0xc0, 0x44, 0xa0, 0x80, - 0x20, 0x30, 0x15, 0x08, 0x00, 0x00, 0x00, 0x13, 0x14, 0x72, 0xc0, 0x87, - 0x74, 0x60, 0x87, 0x36, 0x68, 0x87, 0x79, 0x68, 0x03, 0x72, 0xc0, 0x87, - 0x0d, 0xaf, 0x50, 0x0e, 0x6d, 0xd0, 0x0e, 0x7a, 0x50, 0x0e, 0x6d, 0x00, - 0x0f, 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, - 0x0e, 0x71, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x78, 0xa0, - 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x71, 0x60, 0x07, 0x7a, 0x30, - 0x07, 0x72, 0xd0, 0x06, 0xe9, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, - 0x07, 0x6d, 0x90, 0x0e, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, - 0x06, 0xe6, 0x10, 0x07, 0x76, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x60, - 0x0e, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xe6, 0x60, - 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, 0xe0, 0x0e, 0x78, 0xa0, - 0x07, 0x71, 0x60, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x76, 0x40, - 0x07, 0x43, 0x9e, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x86, 0x3c, 0x06, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x0c, 0x79, 0x10, 0x20, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x18, 0xf2, 0x34, 0x40, 0x00, 0x0c, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0xe4, 0x81, 0x80, 0x00, 0x18, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0xc8, 0x33, 0x01, 0x01, 0x30, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x90, 0xc7, 0x02, 0x02, - 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x2c, 0x10, 0x14, - 0x00, 0x00, 0x00, 0x32, 0x1e, 0x98, 0x18, 0x19, 0x11, 0x4c, 0x90, 0x8c, - 0x09, 0x26, 0x47, 0xc6, 0x04, 0x43, 0x22, 0x4a, 0x60, 0x04, 0xa0, 0x18, - 0x8a, 0xa0, 0x1c, 0x4a, 0xa2, 0x0c, 0x0a, 0xa6, 0x20, 0x0a, 0xa4, 0x14, - 0x0a, 0xa5, 0x3c, 0xca, 0xa7, 0x10, 0xa8, 0x28, 0x89, 0x11, 0x80, 0x22, - 0x28, 0x83, 0x42, 0x28, 0x10, 0xaa, 0x6a, 0x80, 0xb8, 0x19, 0x00, 0xf2, - 0x66, 0x00, 0xe8, 0x9b, 0x01, 0xa0, 0x70, 0x06, 0x80, 0xc4, 0xb1, 0x14, - 0x84, 0x78, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x79, - 0x18, 0x00, 0x00, 0xb1, 0x00, 0x00, 0x00, 0x1a, 0x03, 0x4c, 0x90, 0x46, - 0x02, 0x13, 0x44, 0x35, 0x18, 0x63, 0x0b, 0x73, 0x3b, 0x03, 0xb1, 0x2b, - 0x93, 0x9b, 0x4b, 0x7b, 0x73, 0x03, 0x99, 0x71, 0xb9, 0x01, 0x41, 0xa1, - 0x0b, 0x3b, 0x9b, 0x7b, 0x91, 0x2a, 0x62, 0x2a, 0x0a, 0x9a, 0x2a, 0xfa, - 0x9a, 0xb9, 0x81, 0x79, 0x31, 0x4b, 0x73, 0x0b, 0x63, 0x4b, 0xd9, 0x10, - 0x04, 0x13, 0x04, 0xe2, 0x98, 0x20, 0x10, 0xc8, 0x06, 0x61, 0x20, 0x36, - 0x08, 0x04, 0x41, 0x01, 0x6e, 0x6e, 0x82, 0x40, 0x24, 0x1b, 0x86, 0x03, - 0x21, 0x26, 0x08, 0x5c, 0x47, 0x6a, 0xea, 0xad, 0x4e, 0x6e, 0xac, 0x8c, - 0xaa, 0x0c, 0x8f, 0xae, 0x4e, 0xae, 0x4c, 0x86, 0x28, 0x48, 0x4e, 0x2e, - 0x2c, 0x6f, 0x82, 0x40, 0x28, 0x13, 0x04, 0x62, 0x99, 0x20, 0x10, 0xcc, - 0x06, 0x81, 0x70, 0x36, 0x24, 0x84, 0xb2, 0x30, 0xc4, 0xd0, 0x10, 0xcf, - 0x86, 0x00, 0x9a, 0x20, 0x7c, 0x1f, 0xa5, 0xa9, 0xb7, 0x3a, 0xb9, 0xb1, - 0x32, 0xa9, 0xb2, 0xb3, 0xb4, 0x37, 0x37, 0xa1, 0x3a, 0x33, 0xb3, 0x32, - 0xb9, 0x09, 0x02, 0xd1, 0x4c, 0x10, 0x08, 0x67, 0x03, 0x42, 0x48, 0x13, - 0x45, 0x0c, 0x15, 0xb0, 0x21, 0xb0, 0x26, 0x08, 0x61, 0x00, 0x06, 0x6c, - 0xa6, 0xde, 0xea, 0xe4, 0xc6, 0xca, 0xa6, 0xc2, 0xda, 0xe0, 0xd8, 0xca, - 0xe4, 0x36, 0x20, 0x04, 0x96, 0x31, 0xc4, 0x40, 0x00, 0x1b, 0x02, 0x6d, - 0x03, 0x11, 0x01, 0xd7, 0x36, 0x41, 0xf0, 0x3c, 0x26, 0x55, 0x56, 0x4c, - 0x65, 0x66, 0x74, 0x54, 0x6f, 0x70, 0x13, 0x84, 0x8a, 0xdb, 0x80, 0x20, - 0x1e, 0x45, 0x34, 0x8e, 0xf3, 0x91, 0xa9, 0xb2, 0x22, 0x4a, 0x6b, 0x2b, - 0x73, 0x9b, 0x4b, 0x7b, 0x73, 0x9b, 0x9b, 0x20, 0x10, 0xcf, 0x06, 0x04, - 0x09, 0x03, 0x4a, 0x0c, 0x1a, 0xc7, 0xf9, 0x88, 0x34, 0xa5, 0xc1, 0x31, - 0x95, 0xd9, 0x95, 0xb1, 0x4d, 0x10, 0x08, 0x68, 0x82, 0x40, 0x44, 0x1b, - 0x10, 0x84, 0x0c, 0xa8, 0x32, 0x68, 0xcc, 0xc0, 0xf9, 0xc8, 0x30, 0x85, - 0xe5, 0x95, 0xc9, 0x3d, 0xc9, 0x11, 0x95, 0xc1, 0xd1, 0xa1, 0x4d, 0x10, - 0x08, 0x69, 0x03, 0x82, 0xa0, 0x01, 0x95, 0x06, 0x8d, 0xe3, 0x7c, 0x1b, - 0x8a, 0x0a, 0x0c, 0xc6, 0xe0, 0x0c, 0xd4, 0x60, 0xc3, 0x40, 0x74, 0x6b, - 0x30, 0x41, 0x10, 0x80, 0x0d, 0xc0, 0x86, 0x81, 0x70, 0x03, 0x37, 0xd8, - 0x10, 0xbc, 0xc1, 0x86, 0x61, 0x68, 0x03, 0x38, 0x98, 0x20, 0x88, 0x41, - 0x18, 0x6c, 0x08, 0xe4, 0x80, 0x8f, 0x10, 0x5b, 0x1a, 0x9d, 0x91, 0xdc, - 0x5b, 0x9b, 0x0c, 0x51, 0x90, 0x9c, 0x5c, 0x58, 0x1e, 0x11, 0xaa, 0x22, - 0xac, 0xa1, 0xa7, 0x27, 0x29, 0xa2, 0x09, 0x42, 0x61, 0x4d, 0x10, 0x8a, - 0x6b, 0x43, 0x40, 0x4c, 0x10, 0x0a, 0x6c, 0x83, 0x40, 0x51, 0x1b, 0x16, - 0xa2, 0x0e, 0xec, 0xe0, 0x0e, 0xf0, 0x20, 0x0f, 0x86, 0x3c, 0x20, 0xee, - 0x40, 0x0f, 0xb8, 0x4c, 0x59, 0x7d, 0x41, 0xbd, 0xcd, 0xa5, 0xd1, 0xa5, - 0xbd, 0xb9, 0x4d, 0x10, 0x8a, 0x6c, 0x82, 0x50, 0x68, 0x1b, 0x96, 0x81, - 0x0f, 0xec, 0xa0, 0x0f, 0xf0, 0xc0, 0x0f, 0x06, 0x3f, 0x18, 0xee, 0x00, - 0xd8, 0x20, 0xec, 0xc1, 0x1f, 0x30, 0x99, 0xb2, 0xfa, 0xa2, 0x0a, 0x93, - 0x3b, 0x2b, 0xa3, 0x9b, 0x20, 0x14, 0xdb, 0x04, 0x81, 0x98, 0x36, 0x08, - 0xd4, 0x28, 0x6c, 0x58, 0x88, 0x50, 0xb0, 0x03, 0x51, 0xc0, 0x83, 0x3b, - 0x18, 0xfc, 0x80, 0xb8, 0x03, 0x52, 0xd8, 0x10, 0x94, 0xc2, 0x86, 0x01, - 0x14, 0x4c, 0x01, 0xd8, 0x50, 0xb4, 0x01, 0x1d, 0x9c, 0x02, 0x07, 0xd0, - 0x30, 0x63, 0x7b, 0x0b, 0xa3, 0x9b, 0x63, 0x91, 0xe6, 0x36, 0x47, 0x37, - 0x37, 0x41, 0x20, 0x28, 0x1a, 0x73, 0x69, 0x67, 0x5f, 0x6c, 0x64, 0x34, - 0xe6, 0xd2, 0xce, 0xbe, 0xe6, 0xe8, 0x26, 0x08, 0x44, 0x45, 0x84, 0xae, - 0x0c, 0xef, 0xcb, 0xed, 0x4d, 0xae, 0x6d, 0x83, 0x92, 0x0a, 0x8d, 0x2a, - 0xac, 0x02, 0x2b, 0x30, 0xad, 0xe0, 0x0a, 0xaf, 0x30, 0x54, 0x61, 0x63, - 0xb3, 0x6b, 0x73, 0x49, 0x23, 0x2b, 0x73, 0xa3, 0x9b, 0x12, 0x04, 0x55, - 0xc8, 0xf0, 0x5c, 0xec, 0xca, 0xe4, 0xe6, 0xd2, 0xde, 0xdc, 0xa6, 0x04, - 0x44, 0x13, 0x32, 0x3c, 0x17, 0xbb, 0x30, 0x36, 0xbb, 0x32, 0xb9, 0x29, - 0x41, 0x51, 0x87, 0x0c, 0xcf, 0x65, 0x0e, 0x2d, 0x8c, 0xac, 0x4c, 0xae, - 0xe9, 0x8d, 0xac, 0x8c, 0x6d, 0x4a, 0x80, 0x94, 0x21, 0xc3, 0x73, 0x91, - 0x2b, 0x9b, 0x7b, 0xab, 0x93, 0x1b, 0x2b, 0x9b, 0x9b, 0x12, 0x6c, 0x95, - 0xc8, 0xf0, 0x5c, 0xe8, 0xf2, 0xe0, 0xca, 0x82, 0xdc, 0xdc, 0xde, 0xe8, - 0xc2, 0xe8, 0xd2, 0xde, 0xdc, 0xe6, 0xa6, 0x08, 0x6b, 0x00, 0x07, 0x75, - 0xc8, 0xf0, 0x5c, 0xec, 0xd2, 0xca, 0xee, 0x92, 0xc8, 0xa6, 0xe8, 0xc2, - 0xe8, 0xca, 0xa6, 0x04, 0x72, 0x50, 0x87, 0x0c, 0xcf, 0xa5, 0xcc, 0x8d, - 0x4e, 0x2e, 0x0f, 0xea, 0x2d, 0xcd, 0x8d, 0x6e, 0x6e, 0x4a, 0x70, 0x0a, - 0x5d, 0xc8, 0xf0, 0x5c, 0xc6, 0xde, 0xea, 0xdc, 0xe8, 0xca, 0xe4, 0xe6, - 0xa6, 0x04, 0xaf, 0x00, 0x00, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00, 0x4c, - 0x00, 0x00, 0x00, 0x33, 0x08, 0x80, 0x1c, 0xc4, 0xe1, 0x1c, 0x66, 0x14, - 0x01, 0x3d, 0x88, 0x43, 0x38, 0x84, 0xc3, 0x8c, 0x42, 0x80, 0x07, 0x79, - 0x78, 0x07, 0x73, 0x98, 0x71, 0x0c, 0xe6, 0x00, 0x0f, 0xed, 0x10, 0x0e, - 0xf4, 0x80, 0x0e, 0x33, 0x0c, 0x42, 0x1e, 0xc2, 0xc1, 0x1d, 0xce, 0xa1, - 0x1c, 0x66, 0x30, 0x05, 0x3d, 0x88, 0x43, 0x38, 0x84, 0x83, 0x1b, 0xcc, - 0x03, 0x3d, 0xc8, 0x43, 0x3d, 0x8c, 0x03, 0x3d, 0xcc, 0x78, 0x8c, 0x74, - 0x70, 0x07, 0x7b, 0x08, 0x07, 0x79, 0x48, 0x87, 0x70, 0x70, 0x07, 0x7a, - 0x70, 0x03, 0x76, 0x78, 0x87, 0x70, 0x20, 0x87, 0x19, 0xcc, 0x11, 0x0e, - 0xec, 0x90, 0x0e, 0xe1, 0x30, 0x0f, 0x6e, 0x30, 0x0f, 0xe3, 0xf0, 0x0e, - 0xf0, 0x50, 0x0e, 0x33, 0x10, 0xc4, 0x1d, 0xde, 0x21, 0x1c, 0xd8, 0x21, - 0x1d, 0xc2, 0x61, 0x1e, 0x66, 0x30, 0x89, 0x3b, 0xbc, 0x83, 0x3b, 0xd0, - 0x43, 0x39, 0xb4, 0x03, 0x3c, 0xbc, 0x83, 0x3c, 0x84, 0x03, 0x3b, 0xcc, - 0xf0, 0x14, 0x76, 0x60, 0x07, 0x7b, 0x68, 0x07, 0x37, 0x68, 0x87, 0x72, - 0x68, 0x07, 0x37, 0x80, 0x87, 0x70, 0x90, 0x87, 0x70, 0x60, 0x07, 0x76, - 0x28, 0x07, 0x76, 0xf8, 0x05, 0x76, 0x78, 0x87, 0x77, 0x80, 0x87, 0x5f, - 0x08, 0x87, 0x71, 0x18, 0x87, 0x72, 0x98, 0x87, 0x79, 0x98, 0x81, 0x2c, - 0xee, 0xf0, 0x0e, 0xee, 0xe0, 0x0e, 0xf5, 0xc0, 0x0e, 0xec, 0x30, 0x03, - 0x62, 0xc8, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xcc, 0xa1, 0x1c, 0xe4, 0xa1, - 0x1c, 0xdc, 0x61, 0x1c, 0xca, 0x21, 0x1c, 0xc4, 0x81, 0x1d, 0xca, 0x61, - 0x06, 0xd6, 0x90, 0x43, 0x39, 0xc8, 0x43, 0x39, 0x98, 0x43, 0x39, 0xc8, - 0x43, 0x39, 0xb8, 0xc3, 0x38, 0x94, 0x43, 0x38, 0x88, 0x03, 0x3b, 0x94, - 0xc3, 0x2f, 0xbc, 0x83, 0x3c, 0xfc, 0x82, 0x3b, 0xd4, 0x03, 0x3b, 0xb0, - 0xc3, 0x0c, 0xc4, 0x21, 0x07, 0x7c, 0x70, 0x03, 0x7a, 0x28, 0x87, 0x76, - 0x80, 0x87, 0x19, 0xd1, 0x43, 0x0e, 0xf8, 0xe0, 0x06, 0xe4, 0x20, 0x0e, - 0xe7, 0xe0, 0x06, 0xf6, 0x10, 0x0e, 0xf2, 0xc0, 0x0e, 0xe1, 0x90, 0x0f, - 0xef, 0x50, 0x0f, 0xf4, 0x00, 0x00, 0x00, 0x71, 0x20, 0x00, 0x00, 0x20, - 0x00, 0x00, 0x00, 0x06, 0xf0, 0x6c, 0x0b, 0x32, 0x7d, 0x91, 0xc3, 0xd8, - 0x9d, 0x16, 0x45, 0x00, 0x66, 0x04, 0xdb, 0x70, 0xf9, 0xce, 0xe3, 0x0b, - 0x01, 0x55, 0x14, 0x44, 0x54, 0x3a, 0xc0, 0x50, 0x12, 0x06, 0x20, 0x60, - 0x7e, 0x71, 0xdb, 0x56, 0xb0, 0x0d, 0x97, 0xef, 0x3c, 0xbe, 0x10, 0x50, - 0x45, 0x41, 0x44, 0xa5, 0x03, 0x0c, 0x25, 0x61, 0x00, 0x02, 0xe6, 0x23, - 0xb7, 0x6d, 0x06, 0xd2, 0x70, 0xf9, 0xce, 0xe3, 0x0b, 0x11, 0x01, 0x4c, - 0x44, 0x08, 0x34, 0xc3, 0x42, 0x58, 0xc0, 0x34, 0x5c, 0xbe, 0xf3, 0xf8, - 0x8b, 0x03, 0x0c, 0x62, 0xf3, 0x50, 0x93, 0x5f, 0xdc, 0xb6, 0x0d, 0x54, - 0xc3, 0xe5, 0x3b, 0x8f, 0x2f, 0x01, 0xcc, 0xb3, 0x10, 0x25, 0x51, 0x11, - 0x8b, 0x5f, 0xdc, 0xb6, 0x09, 0x54, 0xc3, 0xe5, 0x3b, 0x8f, 0x2f, 0x4d, - 0x4e, 0x44, 0xa0, 0xd4, 0xf4, 0x50, 0x93, 0x5f, 0xdc, 0x36, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x48, 0x41, 0x53, 0x48, 0x14, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x2e, 0x13, 0xf0, 0x4e, 0x87, 0x80, 0xc3, 0x55, 0xf3, - 0x6d, 0xba, 0x74, 0xb8, 0x11, 0xbc, 0x6f, 0x44, 0x58, 0x49, 0x4c, 0xe4, - 0x07, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0xf9, 0x01, 0x00, 0x00, 0x44, - 0x58, 0x49, 0x4c, 0x00, 0x01, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0xcc, - 0x07, 0x00, 0x00, 0x42, 0x43, 0xc0, 0xde, 0x21, 0x0c, 0x00, 0x00, 0xf0, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x52, 0x54, 0x53, 0x30, 0x88, + 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x18, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x88, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x3c, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x5c, + 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x7c, + 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x03, + 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x01, + 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x03, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x53, 0x54, 0x41, 0x54, 0xfc, + 0x07, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0xff, 0x01, 0x00, 0x00, 0x44, + 0x58, 0x49, 0x4c, 0x00, 0x01, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0xe4, + 0x07, 0x00, 0x00, 0x42, 0x43, 0xc0, 0xde, 0x21, 0x0c, 0x00, 0x00, 0xf6, 0x01, 0x00, 0x00, 0x0b, 0x82, 0x20, 0x00, 0x02, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x07, 0x81, 0x23, 0x91, 0x41, 0xc8, 0x04, 0x49, 0x06, 0x10, 0x32, 0x39, 0x92, 0x01, 0x84, 0x0c, 0x25, 0x05, 0x08, 0x19, 0x1e, @@ -1393,7 +1256,7 @@ const unsigned char g_BlitFrom2DArray[] = { 0x20, 0x07, 0x6d, 0x60, 0x0e, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xe6, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, 0xe0, 0x0e, 0x78, 0xa0, 0x07, 0x71, 0x60, 0x07, 0x7a, 0x30, 0x07, 0x72, - 0xa0, 0x07, 0x76, 0x40, 0x07, 0x43, 0x9e, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xa0, 0x07, 0x76, 0x40, 0x07, 0x43, 0x9e, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x86, 0x3c, 0x06, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x79, 0x10, 0x20, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0xf2, 0x34, 0x40, @@ -1401,109 +1264,282 @@ const unsigned char g_BlitFrom2DArray[] = { 0x80, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0xc8, 0x33, 0x01, 0x01, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x90, 0xc7, 0x02, 0x02, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x80, 0x2c, 0x10, 0x10, 0x00, 0x00, 0x00, 0x32, 0x1e, 0x98, 0x14, 0x19, + 0x80, 0x2c, 0x10, 0x14, 0x00, 0x00, 0x00, 0x32, 0x1e, 0x98, 0x18, 0x19, 0x11, 0x4c, 0x90, 0x8c, 0x09, 0x26, 0x47, 0xc6, 0x04, 0x43, 0x22, 0x4a, 0x60, 0x04, 0xa0, 0x18, 0x8a, 0xa0, 0x1c, 0x4a, 0xa2, 0x0c, 0x0a, 0xa6, - 0x3c, 0xa8, 0x28, 0x89, 0x11, 0x80, 0x22, 0x28, 0x83, 0x42, 0x28, 0x10, - 0xe2, 0x66, 0x00, 0xe8, 0x9b, 0x01, 0xa0, 0x70, 0x06, 0x80, 0xc4, 0xb1, - 0x14, 0x84, 0x78, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x79, - 0x18, 0x00, 0x00, 0x69, 0x00, 0x00, 0x00, 0x1a, 0x03, 0x4c, 0x90, 0x46, - 0x02, 0x13, 0x44, 0x35, 0x18, 0x63, 0x0b, 0x73, 0x3b, 0x03, 0xb1, 0x2b, - 0x93, 0x9b, 0x4b, 0x7b, 0x73, 0x03, 0x99, 0x71, 0xb9, 0x01, 0x41, 0xa1, - 0x0b, 0x3b, 0x9b, 0x7b, 0x91, 0x2a, 0x62, 0x2a, 0x0a, 0x9a, 0x2a, 0xfa, - 0x9a, 0xb9, 0x81, 0x79, 0x31, 0x4b, 0x73, 0x0b, 0x63, 0x4b, 0xd9, 0x10, - 0x04, 0x13, 0x04, 0xe2, 0x98, 0x20, 0x10, 0xc8, 0x06, 0x61, 0x20, 0x26, - 0x08, 0x44, 0xb2, 0x41, 0x18, 0x0c, 0x0a, 0x70, 0x73, 0x1b, 0x06, 0xc4, - 0x20, 0x26, 0x08, 0x9c, 0x45, 0x60, 0x82, 0x40, 0x28, 0x13, 0x04, 0x62, + 0x20, 0x0a, 0xa4, 0x14, 0x0a, 0xa5, 0x3c, 0xca, 0xa7, 0x10, 0xa8, 0x28, + 0x89, 0x11, 0x80, 0x22, 0x28, 0x83, 0x42, 0x28, 0x10, 0xaa, 0x6a, 0x80, + 0xb8, 0x19, 0x00, 0xf2, 0x66, 0x00, 0xe8, 0x9b, 0x01, 0xa0, 0x70, 0x06, + 0x80, 0xc4, 0xb1, 0x14, 0x84, 0x78, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00, 0xb1, 0x00, 0x00, 0x00, 0x1a, + 0x03, 0x4c, 0x90, 0x46, 0x02, 0x13, 0x44, 0x35, 0x18, 0x63, 0x0b, 0x73, + 0x3b, 0x03, 0xb1, 0x2b, 0x93, 0x9b, 0x4b, 0x7b, 0x73, 0x03, 0x99, 0x71, + 0xb9, 0x01, 0x41, 0xa1, 0x0b, 0x3b, 0x9b, 0x7b, 0x91, 0x2a, 0x62, 0x2a, + 0x0a, 0x9a, 0x2a, 0xfa, 0x9a, 0xb9, 0x81, 0x79, 0x31, 0x4b, 0x73, 0x0b, + 0x63, 0x4b, 0xd9, 0x10, 0x04, 0x13, 0x04, 0xe2, 0x98, 0x20, 0x10, 0xc8, + 0x06, 0x61, 0x20, 0x36, 0x08, 0x04, 0x41, 0x01, 0x6e, 0x6e, 0x82, 0x40, + 0x24, 0x1b, 0x86, 0x03, 0x21, 0x26, 0x08, 0x5c, 0x47, 0x6a, 0xea, 0xad, + 0x4e, 0x6e, 0xac, 0x8c, 0xaa, 0x0c, 0x8f, 0xae, 0x4e, 0xae, 0x4c, 0x86, + 0x28, 0x48, 0x4e, 0x2e, 0x2c, 0x6f, 0x82, 0x40, 0x28, 0x13, 0x04, 0x62, 0x99, 0x20, 0x10, 0xcc, 0x06, 0x81, 0x70, 0x36, 0x24, 0x84, 0xb2, 0x30, - 0xc4, 0xd0, 0x10, 0xcf, 0x86, 0x00, 0x9a, 0x20, 0x7c, 0xd7, 0x04, 0x81, - 0x68, 0x26, 0x08, 0x84, 0xb3, 0x01, 0x21, 0xa4, 0x65, 0x22, 0x06, 0x0a, - 0xd8, 0x10, 0x54, 0x13, 0x84, 0x30, 0xc0, 0x36, 0x20, 0xc4, 0xb5, 0x30, - 0xc4, 0x40, 0x00, 0x1b, 0x02, 0x6c, 0x03, 0x11, 0x01, 0x56, 0x36, 0x41, - 0x10, 0x83, 0x6c, 0x43, 0xb0, 0x4d, 0x10, 0x04, 0x80, 0x8f, 0x10, 0x5b, + 0xc4, 0xd0, 0x10, 0xcf, 0x86, 0x00, 0x9a, 0x20, 0x7c, 0x1f, 0xa5, 0xa9, + 0xb7, 0x3a, 0xb9, 0xb1, 0x32, 0xa9, 0xb2, 0xb3, 0xb4, 0x37, 0x37, 0xa1, + 0x3a, 0x33, 0xb3, 0x32, 0xb9, 0x09, 0x02, 0xd1, 0x4c, 0x10, 0x08, 0x67, + 0x03, 0x42, 0x48, 0x13, 0x45, 0x0c, 0x15, 0xb0, 0x21, 0xb0, 0x26, 0x08, + 0x61, 0x00, 0x06, 0x6c, 0xa6, 0xde, 0xea, 0xe4, 0xc6, 0xca, 0xa6, 0xc2, + 0xda, 0xe0, 0xd8, 0xca, 0xe4, 0x36, 0x20, 0x04, 0x96, 0x31, 0xc4, 0x40, + 0x00, 0x1b, 0x02, 0x6d, 0x03, 0x11, 0x01, 0xd7, 0x36, 0x41, 0xf0, 0x3c, + 0x26, 0x55, 0x56, 0x4c, 0x65, 0x66, 0x74, 0x54, 0x6f, 0x70, 0x13, 0x84, + 0x8a, 0xdb, 0x80, 0x20, 0x1e, 0x45, 0x34, 0x8e, 0xf3, 0x91, 0xa9, 0xb2, + 0x22, 0x4a, 0x6b, 0x2b, 0x73, 0x9b, 0x4b, 0x7b, 0x73, 0x9b, 0x9b, 0x20, + 0x10, 0xcf, 0x06, 0x04, 0x09, 0x03, 0x4a, 0x0c, 0x1a, 0xc7, 0xf9, 0x88, + 0x34, 0xa5, 0xc1, 0x31, 0x95, 0xd9, 0x95, 0xb1, 0x4d, 0x10, 0x08, 0x68, + 0x82, 0x40, 0x44, 0x1b, 0x10, 0x84, 0x0c, 0xa8, 0x32, 0x68, 0xcc, 0xc0, + 0xf9, 0xc8, 0x30, 0x85, 0xe5, 0x95, 0xc9, 0x3d, 0xc9, 0x11, 0x95, 0xc1, + 0xd1, 0xa1, 0x4d, 0x10, 0x08, 0x69, 0x03, 0x82, 0xa0, 0x01, 0x95, 0x06, + 0x8d, 0xe3, 0x7c, 0x1b, 0x8a, 0x0a, 0x0c, 0xc6, 0xe0, 0x0c, 0xd4, 0x60, + 0xc3, 0x40, 0x74, 0x6b, 0x30, 0x41, 0x10, 0x80, 0x0d, 0xc0, 0x86, 0x81, + 0x70, 0x03, 0x37, 0xd8, 0x10, 0xbc, 0xc1, 0x86, 0x61, 0x68, 0x03, 0x38, + 0x98, 0x20, 0x88, 0x41, 0x18, 0x6c, 0x08, 0xe4, 0x80, 0x8f, 0x10, 0x5b, 0x1a, 0x9d, 0x91, 0xdc, 0x5b, 0x9b, 0x0c, 0x51, 0x90, 0x9c, 0x5c, 0x58, 0x1e, 0x11, 0xaa, 0x22, 0xac, 0xa1, 0xa7, 0x27, 0x29, 0xa2, 0x09, 0x42, - 0x01, 0x4d, 0x10, 0x8a, 0x68, 0x43, 0x40, 0x4c, 0x10, 0x0a, 0x69, 0x83, - 0x30, 0x4d, 0x1b, 0x16, 0xe2, 0x03, 0x83, 0x30, 0x10, 0x83, 0x31, 0x18, - 0xc6, 0x80, 0x08, 0x03, 0x32, 0xe0, 0x32, 0x65, 0xf5, 0x05, 0xf5, 0x36, - 0x97, 0x46, 0x97, 0xf6, 0xe6, 0x36, 0x41, 0x28, 0xa6, 0x09, 0x42, 0x41, - 0x6d, 0x58, 0x06, 0x33, 0x00, 0x83, 0x33, 0x10, 0x03, 0x34, 0x18, 0xd0, - 0x60, 0x08, 0x03, 0x60, 0x83, 0x50, 0x06, 0x69, 0xc0, 0x64, 0xca, 0xea, - 0x8b, 0x2a, 0x4c, 0xee, 0xac, 0x8c, 0x6e, 0x82, 0x50, 0x54, 0x13, 0x04, - 0xe2, 0xd9, 0x20, 0x4c, 0x6d, 0xb0, 0x61, 0x21, 0xd6, 0x00, 0x0c, 0xd8, - 0x40, 0x0c, 0xc2, 0x60, 0x40, 0x03, 0x22, 0x0c, 0xdc, 0x60, 0x43, 0xf0, - 0x06, 0x1b, 0x06, 0x35, 0x80, 0x03, 0x60, 0x43, 0xd1, 0x79, 0x71, 0xa0, - 0x01, 0x55, 0xd8, 0xd8, 0xec, 0xda, 0x5c, 0xd2, 0xc8, 0xca, 0xdc, 0xe8, - 0xa6, 0x04, 0x41, 0x15, 0x32, 0x3c, 0x17, 0xbb, 0x32, 0xb9, 0xb9, 0xb4, - 0x37, 0xb7, 0x29, 0x01, 0xd1, 0x84, 0x0c, 0xcf, 0xc5, 0x2e, 0x8c, 0xcd, - 0xae, 0x4c, 0x6e, 0x4a, 0x60, 0xd4, 0x21, 0xc3, 0x73, 0x99, 0x43, 0x0b, - 0x23, 0x2b, 0x93, 0x6b, 0x7a, 0x23, 0x2b, 0x63, 0x9b, 0x12, 0x20, 0x65, - 0xc8, 0xf0, 0x5c, 0xe4, 0xca, 0xe6, 0xde, 0xea, 0xe4, 0xc6, 0xca, 0xe6, - 0xa6, 0x04, 0x59, 0x1d, 0x32, 0x3c, 0x17, 0xbb, 0xb4, 0xb2, 0xbb, 0x24, - 0xb2, 0x29, 0xba, 0x30, 0xba, 0xb2, 0x29, 0xc1, 0x56, 0x87, 0x0c, 0xcf, - 0xa5, 0xcc, 0x8d, 0x4e, 0x2e, 0x0f, 0xea, 0x2d, 0xcd, 0x8d, 0x6e, 0x6e, - 0x4a, 0x10, 0x07, 0x00, 0x00, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00, 0x4c, - 0x00, 0x00, 0x00, 0x33, 0x08, 0x80, 0x1c, 0xc4, 0xe1, 0x1c, 0x66, 0x14, - 0x01, 0x3d, 0x88, 0x43, 0x38, 0x84, 0xc3, 0x8c, 0x42, 0x80, 0x07, 0x79, - 0x78, 0x07, 0x73, 0x98, 0x71, 0x0c, 0xe6, 0x00, 0x0f, 0xed, 0x10, 0x0e, - 0xf4, 0x80, 0x0e, 0x33, 0x0c, 0x42, 0x1e, 0xc2, 0xc1, 0x1d, 0xce, 0xa1, - 0x1c, 0x66, 0x30, 0x05, 0x3d, 0x88, 0x43, 0x38, 0x84, 0x83, 0x1b, 0xcc, - 0x03, 0x3d, 0xc8, 0x43, 0x3d, 0x8c, 0x03, 0x3d, 0xcc, 0x78, 0x8c, 0x74, - 0x70, 0x07, 0x7b, 0x08, 0x07, 0x79, 0x48, 0x87, 0x70, 0x70, 0x07, 0x7a, - 0x70, 0x03, 0x76, 0x78, 0x87, 0x70, 0x20, 0x87, 0x19, 0xcc, 0x11, 0x0e, - 0xec, 0x90, 0x0e, 0xe1, 0x30, 0x0f, 0x6e, 0x30, 0x0f, 0xe3, 0xf0, 0x0e, - 0xf0, 0x50, 0x0e, 0x33, 0x10, 0xc4, 0x1d, 0xde, 0x21, 0x1c, 0xd8, 0x21, - 0x1d, 0xc2, 0x61, 0x1e, 0x66, 0x30, 0x89, 0x3b, 0xbc, 0x83, 0x3b, 0xd0, - 0x43, 0x39, 0xb4, 0x03, 0x3c, 0xbc, 0x83, 0x3c, 0x84, 0x03, 0x3b, 0xcc, - 0xf0, 0x14, 0x76, 0x60, 0x07, 0x7b, 0x68, 0x07, 0x37, 0x68, 0x87, 0x72, - 0x68, 0x07, 0x37, 0x80, 0x87, 0x70, 0x90, 0x87, 0x70, 0x60, 0x07, 0x76, - 0x28, 0x07, 0x76, 0xf8, 0x05, 0x76, 0x78, 0x87, 0x77, 0x80, 0x87, 0x5f, - 0x08, 0x87, 0x71, 0x18, 0x87, 0x72, 0x98, 0x87, 0x79, 0x98, 0x81, 0x2c, - 0xee, 0xf0, 0x0e, 0xee, 0xe0, 0x0e, 0xf5, 0xc0, 0x0e, 0xec, 0x30, 0x03, - 0x62, 0xc8, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xcc, 0xa1, 0x1c, 0xe4, 0xa1, - 0x1c, 0xdc, 0x61, 0x1c, 0xca, 0x21, 0x1c, 0xc4, 0x81, 0x1d, 0xca, 0x61, - 0x06, 0xd6, 0x90, 0x43, 0x39, 0xc8, 0x43, 0x39, 0x98, 0x43, 0x39, 0xc8, - 0x43, 0x39, 0xb8, 0xc3, 0x38, 0x94, 0x43, 0x38, 0x88, 0x03, 0x3b, 0x94, - 0xc3, 0x2f, 0xbc, 0x83, 0x3c, 0xfc, 0x82, 0x3b, 0xd4, 0x03, 0x3b, 0xb0, - 0xc3, 0x0c, 0xc4, 0x21, 0x07, 0x7c, 0x70, 0x03, 0x7a, 0x28, 0x87, 0x76, - 0x80, 0x87, 0x19, 0xd1, 0x43, 0x0e, 0xf8, 0xe0, 0x06, 0xe4, 0x20, 0x0e, - 0xe7, 0xe0, 0x06, 0xf6, 0x10, 0x0e, 0xf2, 0xc0, 0x0e, 0xe1, 0x90, 0x0f, - 0xef, 0x50, 0x0f, 0xf4, 0x00, 0x00, 0x00, 0x71, 0x20, 0x00, 0x00, 0x20, - 0x00, 0x00, 0x00, 0x06, 0xf0, 0x6c, 0x0b, 0x32, 0x7d, 0x91, 0xc3, 0xd8, - 0x9d, 0x16, 0x45, 0x00, 0x66, 0x04, 0xdb, 0x70, 0xf9, 0xce, 0xe3, 0x0b, - 0x01, 0x55, 0x14, 0x44, 0x54, 0x3a, 0xc0, 0x50, 0x12, 0x06, 0x20, 0x60, - 0x7e, 0x71, 0xdb, 0x56, 0xb0, 0x0d, 0x97, 0xef, 0x3c, 0xbe, 0x10, 0x50, - 0x45, 0x41, 0x44, 0xa5, 0x03, 0x0c, 0x25, 0x61, 0x00, 0x02, 0xe6, 0x23, - 0xb7, 0x6d, 0x06, 0xd2, 0x70, 0xf9, 0xce, 0xe3, 0x0b, 0x11, 0x01, 0x4c, - 0x44, 0x08, 0x34, 0xc3, 0x42, 0x58, 0xc0, 0x34, 0x5c, 0xbe, 0xf3, 0xf8, - 0x8b, 0x03, 0x0c, 0x62, 0xf3, 0x50, 0x93, 0x5f, 0xdc, 0xb6, 0x0d, 0x54, - 0xc3, 0xe5, 0x3b, 0x8f, 0x2f, 0x01, 0xcc, 0xb3, 0x10, 0x25, 0x51, 0x11, - 0x8b, 0x5f, 0xdc, 0xb6, 0x09, 0x54, 0xc3, 0xe5, 0x3b, 0x8f, 0x2f, 0x4d, - 0x4e, 0x44, 0xa0, 0xd4, 0xf4, 0x50, 0x93, 0x5f, 0xdc, 0x36, 0x00, 0x61, - 0x20, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x13, 0x04, 0x41, 0x2c, 0x10, - 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x54, 0x8d, 0x00, 0x10, 0x51, - 0x0a, 0x25, 0x37, 0x03, 0x50, 0x76, 0x85, 0x50, 0x7c, 0x54, 0x94, 0x00, - 0x0d, 0x33, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x06, 0x09, 0x00, 0x82, - 0x60, 0x60, 0x75, 0x87, 0xb4, 0x6d, 0xc9, 0x88, 0x41, 0x02, 0x80, 0x20, - 0x18, 0x58, 0x1e, 0x12, 0x71, 0x9c, 0x32, 0x62, 0x90, 0x00, 0x20, 0x08, - 0x06, 0xd6, 0x97, 0x4c, 0x5d, 0xb7, 0x8c, 0x18, 0x24, 0x00, 0x08, 0x82, - 0x81, 0x51, 0x06, 0x87, 0xe7, 0x55, 0xc9, 0x88, 0x41, 0x02, 0x80, 0x20, - 0x18, 0x18, 0x66, 0x80, 0x7c, 0x9f, 0xa1, 0x8c, 0x18, 0x1c, 0x00, 0x08, - 0x82, 0x01, 0x44, 0x06, 0xca, 0x00, 0x06, 0xa3, 0x09, 0x01, 0x30, 0x9a, - 0x20, 0x04, 0xa3, 0x09, 0x83, 0x30, 0x9a, 0x40, 0x0c, 0x26, 0x1c, 0xf2, - 0x31, 0xe1, 0x90, 0x8f, 0x09, 0x06, 0x7c, 0x4c, 0x30, 0xe0, 0x33, 0x62, - 0x70, 0x00, 0x20, 0x08, 0x06, 0x50, 0x1b, 0x4c, 0x8c, 0x1a, 0x8c, 0x26, - 0x04, 0xc1, 0x05, 0xc4, 0x5c, 0x30, 0xd4, 0x88, 0xc1, 0x01, 0x80, 0x20, - 0x18, 0x4c, 0x70, 0x70, 0x41, 0x6e, 0x30, 0x9a, 0x10, 0x00, 0x17, 0x0c, - 0x35, 0x62, 0xf0, 0x00, 0x20, 0x08, 0x06, 0x4d, 0x1d, 0x60, 0x15, 0x95, - 0x20, 0x84, 0x05, 0x07, 0x70, 0xb0, 0x05, 0xa3, 0x09, 0x01, 0x30, 0x9a, - 0x20, 0x04, 0xa3, 0x09, 0x83, 0x30, 0x9a, 0x40, 0x0c, 0x23, 0x06, 0x09, - 0x00, 0x82, 0x60, 0x80, 0xec, 0x81, 0x18, 0xd4, 0x41, 0x1d, 0xb0, 0x01, - 0x31, 0x62, 0x90, 0x00, 0x20, 0x08, 0x06, 0xc8, 0x1e, 0x88, 0x41, 0x1d, - 0xd4, 0x01, 0x37, 0x8c, 0x18, 0x24, 0x00, 0x08, 0x82, 0x01, 0xb2, 0x07, - 0x62, 0x50, 0x07, 0x75, 0xb0, 0x06, 0xc2, 0x88, 0x41, 0x02, 0x80, 0x20, - 0x18, 0x20, 0x7b, 0x20, 0x06, 0x75, 0x50, 0x07, 0x6a, 0x10, 0x20, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + 0x61, 0x4d, 0x10, 0x8a, 0x6b, 0x43, 0x40, 0x4c, 0x10, 0x0a, 0x6c, 0x83, + 0x40, 0x51, 0x1b, 0x16, 0xa2, 0x0e, 0xec, 0xe0, 0x0e, 0xf0, 0x20, 0x0f, + 0x86, 0x3c, 0x20, 0xee, 0x40, 0x0f, 0xb8, 0x4c, 0x59, 0x7d, 0x41, 0xbd, + 0xcd, 0xa5, 0xd1, 0xa5, 0xbd, 0xb9, 0x4d, 0x10, 0x8a, 0x6c, 0x82, 0x50, + 0x68, 0x1b, 0x96, 0x81, 0x0f, 0xec, 0xa0, 0x0f, 0xf0, 0xc0, 0x0f, 0x06, + 0x3f, 0x18, 0xee, 0x00, 0xd8, 0x20, 0xec, 0xc1, 0x1f, 0x30, 0x99, 0xb2, + 0xfa, 0xa2, 0x0a, 0x93, 0x3b, 0x2b, 0xa3, 0x9b, 0x20, 0x14, 0xdb, 0x04, + 0x81, 0x98, 0x36, 0x08, 0xd4, 0x28, 0x6c, 0x58, 0x88, 0x50, 0xb0, 0x03, + 0x51, 0xc0, 0x83, 0x3b, 0x18, 0xfc, 0x80, 0xb8, 0x03, 0x52, 0xd8, 0x10, + 0x94, 0xc2, 0x86, 0x01, 0x14, 0x4c, 0x01, 0xd8, 0x50, 0xb4, 0x01, 0x1d, + 0x9c, 0x02, 0x07, 0xd0, 0x30, 0x63, 0x7b, 0x0b, 0xa3, 0x9b, 0x63, 0x91, + 0xe6, 0x36, 0x47, 0x37, 0x37, 0x41, 0x20, 0x28, 0x1a, 0x73, 0x69, 0x67, + 0x5f, 0x6c, 0x64, 0x34, 0xe6, 0xd2, 0xce, 0xbe, 0xe6, 0xe8, 0x26, 0x08, + 0x44, 0x45, 0x84, 0xae, 0x0c, 0xef, 0xcb, 0xed, 0x4d, 0xae, 0x6d, 0x83, + 0x92, 0x0a, 0x8d, 0x2a, 0xac, 0x02, 0x2b, 0x30, 0xad, 0xe0, 0x0a, 0xaf, + 0x30, 0x54, 0x61, 0x63, 0xb3, 0x6b, 0x73, 0x49, 0x23, 0x2b, 0x73, 0xa3, + 0x9b, 0x12, 0x04, 0x55, 0xc8, 0xf0, 0x5c, 0xec, 0xca, 0xe4, 0xe6, 0xd2, + 0xde, 0xdc, 0xa6, 0x04, 0x44, 0x13, 0x32, 0x3c, 0x17, 0xbb, 0x30, 0x36, + 0xbb, 0x32, 0xb9, 0x29, 0x41, 0x51, 0x87, 0x0c, 0xcf, 0x65, 0x0e, 0x2d, + 0x8c, 0xac, 0x4c, 0xae, 0xe9, 0x8d, 0xac, 0x8c, 0x6d, 0x4a, 0x80, 0x94, + 0x21, 0xc3, 0x73, 0x91, 0x2b, 0x9b, 0x7b, 0xab, 0x93, 0x1b, 0x2b, 0x9b, + 0x9b, 0x12, 0x6c, 0x95, 0xc8, 0xf0, 0x5c, 0xe8, 0xf2, 0xe0, 0xca, 0x82, + 0xdc, 0xdc, 0xde, 0xe8, 0xc2, 0xe8, 0xd2, 0xde, 0xdc, 0xe6, 0xa6, 0x08, + 0x6b, 0x00, 0x07, 0x75, 0xc8, 0xf0, 0x5c, 0xec, 0xd2, 0xca, 0xee, 0x92, + 0xc8, 0xa6, 0xe8, 0xc2, 0xe8, 0xca, 0xa6, 0x04, 0x72, 0x50, 0x87, 0x0c, + 0xcf, 0xa5, 0xcc, 0x8d, 0x4e, 0x2e, 0x0f, 0xea, 0x2d, 0xcd, 0x8d, 0x6e, + 0x6e, 0x4a, 0x70, 0x0a, 0x5d, 0xc8, 0xf0, 0x5c, 0xc6, 0xde, 0xea, 0xdc, + 0xe8, 0xca, 0xe4, 0xe6, 0xa6, 0x04, 0xaf, 0x00, 0x00, 0x00, 0x00, 0x79, + 0x18, 0x00, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x33, 0x08, 0x80, 0x1c, 0xc4, + 0xe1, 0x1c, 0x66, 0x14, 0x01, 0x3d, 0x88, 0x43, 0x38, 0x84, 0xc3, 0x8c, + 0x42, 0x80, 0x07, 0x79, 0x78, 0x07, 0x73, 0x98, 0x71, 0x0c, 0xe6, 0x00, + 0x0f, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x33, 0x0c, 0x42, 0x1e, 0xc2, + 0xc1, 0x1d, 0xce, 0xa1, 0x1c, 0x66, 0x30, 0x05, 0x3d, 0x88, 0x43, 0x38, + 0x84, 0x83, 0x1b, 0xcc, 0x03, 0x3d, 0xc8, 0x43, 0x3d, 0x8c, 0x03, 0x3d, + 0xcc, 0x78, 0x8c, 0x74, 0x70, 0x07, 0x7b, 0x08, 0x07, 0x79, 0x48, 0x87, + 0x70, 0x70, 0x07, 0x7a, 0x70, 0x03, 0x76, 0x78, 0x87, 0x70, 0x20, 0x87, + 0x19, 0xcc, 0x11, 0x0e, 0xec, 0x90, 0x0e, 0xe1, 0x30, 0x0f, 0x6e, 0x30, + 0x0f, 0xe3, 0xf0, 0x0e, 0xf0, 0x50, 0x0e, 0x33, 0x10, 0xc4, 0x1d, 0xde, + 0x21, 0x1c, 0xd8, 0x21, 0x1d, 0xc2, 0x61, 0x1e, 0x66, 0x30, 0x89, 0x3b, + 0xbc, 0x83, 0x3b, 0xd0, 0x43, 0x39, 0xb4, 0x03, 0x3c, 0xbc, 0x83, 0x3c, + 0x84, 0x03, 0x3b, 0xcc, 0xf0, 0x14, 0x76, 0x60, 0x07, 0x7b, 0x68, 0x07, + 0x37, 0x68, 0x87, 0x72, 0x68, 0x07, 0x37, 0x80, 0x87, 0x70, 0x90, 0x87, + 0x70, 0x60, 0x07, 0x76, 0x28, 0x07, 0x76, 0xf8, 0x05, 0x76, 0x78, 0x87, + 0x77, 0x80, 0x87, 0x5f, 0x08, 0x87, 0x71, 0x18, 0x87, 0x72, 0x98, 0x87, + 0x79, 0x98, 0x81, 0x2c, 0xee, 0xf0, 0x0e, 0xee, 0xe0, 0x0e, 0xf5, 0xc0, + 0x0e, 0xec, 0x30, 0x03, 0x62, 0xc8, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xcc, + 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xdc, 0x61, 0x1c, 0xca, 0x21, 0x1c, 0xc4, + 0x81, 0x1d, 0xca, 0x61, 0x06, 0xd6, 0x90, 0x43, 0x39, 0xc8, 0x43, 0x39, + 0x98, 0x43, 0x39, 0xc8, 0x43, 0x39, 0xb8, 0xc3, 0x38, 0x94, 0x43, 0x38, + 0x88, 0x03, 0x3b, 0x94, 0xc3, 0x2f, 0xbc, 0x83, 0x3c, 0xfc, 0x82, 0x3b, + 0xd4, 0x03, 0x3b, 0xb0, 0xc3, 0x0c, 0xc4, 0x21, 0x07, 0x7c, 0x70, 0x03, + 0x7a, 0x28, 0x87, 0x76, 0x80, 0x87, 0x19, 0xd1, 0x43, 0x0e, 0xf8, 0xe0, + 0x06, 0xe4, 0x20, 0x0e, 0xe7, 0xe0, 0x06, 0xf6, 0x10, 0x0e, 0xf2, 0xc0, + 0x0e, 0xe1, 0x90, 0x0f, 0xef, 0x50, 0x0f, 0xf4, 0x00, 0x00, 0x00, 0x71, + 0x20, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x06, 0xf0, 0x6c, 0x0b, 0x32, + 0x7d, 0x91, 0xc3, 0xd8, 0x9d, 0x16, 0x45, 0x00, 0x66, 0x04, 0xdb, 0x70, + 0xf9, 0xce, 0xe3, 0x0b, 0x01, 0x55, 0x14, 0x44, 0x54, 0x3a, 0xc0, 0x50, + 0x12, 0x06, 0x20, 0x60, 0x7e, 0x71, 0xdb, 0x56, 0xb0, 0x0d, 0x97, 0xef, + 0x3c, 0xbe, 0x10, 0x50, 0x45, 0x41, 0x44, 0xa5, 0x03, 0x0c, 0x25, 0x61, + 0x00, 0x02, 0xe6, 0x23, 0xb7, 0x6d, 0x06, 0xd2, 0x70, 0xf9, 0xce, 0xe3, + 0x0b, 0x11, 0x01, 0x4c, 0x44, 0x08, 0x34, 0xc3, 0x42, 0x58, 0xc0, 0x34, + 0x5c, 0xbe, 0xf3, 0xf8, 0x8b, 0x03, 0x0c, 0x62, 0xf3, 0x50, 0x93, 0x5f, + 0xdc, 0xb6, 0x0d, 0x54, 0xc3, 0xe5, 0x3b, 0x8f, 0x2f, 0x01, 0xcc, 0xb3, + 0x10, 0x25, 0x51, 0x11, 0x8b, 0x5f, 0xdc, 0xb6, 0x09, 0x54, 0xc3, 0xe5, + 0x3b, 0x8f, 0x2f, 0x4d, 0x4e, 0x44, 0xa0, 0xd4, 0xf4, 0x50, 0x93, 0x5f, + 0xdc, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x41, 0x53, 0x48, 0x14, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2e, 0x13, 0xf0, 0x4e, 0x87, + 0x80, 0xc3, 0x55, 0xf3, 0x6d, 0xba, 0x74, 0xb8, 0x11, 0xbc, 0x6f, 0x44, + 0x58, 0x49, 0x4c, 0xe4, 0x07, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0xf9, + 0x01, 0x00, 0x00, 0x44, 0x58, 0x49, 0x4c, 0x00, 0x01, 0x00, 0x00, 0x10, + 0x00, 0x00, 0x00, 0xcc, 0x07, 0x00, 0x00, 0x42, 0x43, 0xc0, 0xde, 0x21, + 0x0c, 0x00, 0x00, 0xf0, 0x01, 0x00, 0x00, 0x0b, 0x82, 0x20, 0x00, 0x02, + 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x07, 0x81, 0x23, 0x91, 0x41, + 0xc8, 0x04, 0x49, 0x06, 0x10, 0x32, 0x39, 0x92, 0x01, 0x84, 0x0c, 0x25, + 0x05, 0x08, 0x19, 0x1e, 0x04, 0x8b, 0x62, 0x80, 0x18, 0x45, 0x02, 0x42, + 0x92, 0x0b, 0x42, 0xc4, 0x10, 0x32, 0x14, 0x38, 0x08, 0x18, 0x4b, 0x0a, + 0x32, 0x62, 0x88, 0x48, 0x90, 0x14, 0x20, 0x43, 0x46, 0x88, 0xa5, 0x00, + 0x19, 0x32, 0x42, 0xe4, 0x48, 0x0e, 0x90, 0x11, 0x23, 0xc4, 0x50, 0x41, + 0x51, 0x81, 0x8c, 0xe1, 0x83, 0xe5, 0x8a, 0x04, 0x31, 0x46, 0x06, 0x51, + 0x18, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1b, 0x8c, 0xe0, 0xff, 0xff, + 0xff, 0xff, 0x07, 0x40, 0x02, 0xa8, 0x0d, 0x84, 0xf0, 0xff, 0xff, 0xff, + 0xff, 0x03, 0x20, 0x6d, 0x30, 0x86, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, + 0x09, 0xa8, 0x00, 0x49, 0x18, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x13, + 0x82, 0x60, 0x42, 0x20, 0x4c, 0x08, 0x06, 0x00, 0x00, 0x00, 0x00, 0x89, + 0x20, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, 0x32, 0x22, 0x88, 0x09, 0x20, + 0x64, 0x85, 0x04, 0x13, 0x23, 0xa4, 0x84, 0x04, 0x13, 0x23, 0xe3, 0x84, + 0xa1, 0x90, 0x14, 0x12, 0x4c, 0x8c, 0x8c, 0x0b, 0x84, 0xc4, 0x4c, 0x10, + 0x8c, 0xc1, 0x08, 0x40, 0x09, 0x00, 0x0a, 0x66, 0x00, 0xe6, 0x08, 0xc0, + 0x60, 0x8e, 0x00, 0x29, 0xc6, 0x40, 0x10, 0x44, 0x41, 0x90, 0x51, 0x0c, + 0x80, 0x20, 0x88, 0x62, 0x20, 0xe4, 0xa6, 0xe1, 0xf2, 0x27, 0xec, 0x21, + 0x24, 0x7f, 0x25, 0xa4, 0x95, 0x98, 0xfc, 0xe2, 0xb6, 0x51, 0x31, 0x0c, + 0xc3, 0x40, 0x50, 0x71, 0xcf, 0x70, 0xf9, 0x13, 0xf6, 0x10, 0x92, 0x1f, + 0x02, 0xcd, 0xb0, 0x10, 0x28, 0x58, 0x0a, 0xa3, 0x10, 0x0c, 0x33, 0x0c, + 0xc3, 0x40, 0x10, 0xc4, 0x40, 0xcd, 0x51, 0xc3, 0xe5, 0x4f, 0xd8, 0x43, + 0x48, 0x3e, 0xb7, 0x51, 0xc5, 0x4a, 0x4c, 0x7e, 0x71, 0xdb, 0x88, 0x18, + 0x86, 0x61, 0x28, 0xc4, 0x43, 0x30, 0x04, 0x41, 0x47, 0x0d, 0x97, 0x3f, + 0x61, 0x0f, 0x21, 0xf9, 0xdc, 0x46, 0x15, 0x2b, 0x31, 0xf9, 0xc8, 0x6d, + 0x23, 0x82, 0x20, 0x08, 0xa2, 0x10, 0x12, 0xc1, 0x10, 0x34, 0xcd, 0x11, + 0x04, 0xc5, 0x60, 0x88, 0x82, 0x20, 0x2a, 0xb2, 0x06, 0x02, 0x86, 0x11, + 0x88, 0x61, 0x26, 0x39, 0x18, 0x07, 0x76, 0x08, 0x87, 0x79, 0x98, 0x07, + 0x37, 0xa0, 0x85, 0x72, 0xc0, 0x07, 0x7a, 0xa8, 0x07, 0x79, 0x28, 0x07, + 0x39, 0x20, 0x85, 0x50, 0x90, 0x07, 0x79, 0x08, 0x87, 0x7c, 0xe0, 0x03, + 0x7b, 0x28, 0x87, 0x71, 0xa0, 0x87, 0x77, 0x90, 0x07, 0x3e, 0x30, 0x07, + 0x76, 0x78, 0x87, 0x70, 0xa0, 0x07, 0x36, 0x00, 0x03, 0x3a, 0xf0, 0x03, + 0x30, 0xf0, 0x03, 0x3d, 0xd0, 0x83, 0x76, 0x48, 0x07, 0x78, 0x98, 0x87, + 0x5f, 0xa0, 0x87, 0x7c, 0x80, 0x87, 0x72, 0x40, 0x01, 0x31, 0xd3, 0x19, + 0x8c, 0x03, 0x3b, 0x84, 0xc3, 0x3c, 0xcc, 0x83, 0x1b, 0xd0, 0x42, 0x39, + 0xe0, 0x03, 0x3d, 0xd4, 0x83, 0x3c, 0x94, 0x83, 0x1c, 0x90, 0x42, 0x28, + 0xc8, 0x83, 0x3c, 0x84, 0x43, 0x3e, 0xf0, 0x81, 0x3d, 0x94, 0xc3, 0x38, + 0xd0, 0xc3, 0x3b, 0xc8, 0x03, 0x1f, 0x98, 0x03, 0x3b, 0xbc, 0x43, 0x38, + 0xd0, 0x03, 0x1b, 0x80, 0x01, 0x1d, 0xf8, 0x01, 0x18, 0xf8, 0x01, 0x12, + 0x32, 0x8d, 0xb6, 0x61, 0x04, 0x61, 0x38, 0x89, 0x75, 0xa8, 0x48, 0x20, + 0x56, 0xc2, 0x40, 0x9c, 0x66, 0xa3, 0x8a, 0x82, 0x88, 0x10, 0xd1, 0x75, + 0xc4, 0x40, 0xde, 0x4d, 0xd2, 0x14, 0x51, 0xc2, 0xe4, 0xb3, 0x00, 0xf3, + 0x2c, 0x44, 0xc4, 0x4e, 0xc0, 0x44, 0xa0, 0x80, 0x20, 0x30, 0x15, 0x08, + 0x00, 0x00, 0x00, 0x13, 0x14, 0x72, 0xc0, 0x87, 0x74, 0x60, 0x87, 0x36, + 0x68, 0x87, 0x79, 0x68, 0x03, 0x72, 0xc0, 0x87, 0x0d, 0xaf, 0x50, 0x0e, + 0x6d, 0xd0, 0x0e, 0x7a, 0x50, 0x0e, 0x6d, 0x00, 0x0f, 0x7a, 0x30, 0x07, + 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x71, 0xa0, 0x07, + 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x78, 0xa0, 0x07, 0x73, 0x20, 0x07, + 0x6d, 0x90, 0x0e, 0x71, 0x60, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, + 0xe9, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, + 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, 0xe6, 0x10, 0x07, + 0x76, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x60, 0x0e, 0x73, 0x20, 0x07, + 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xe6, 0x60, 0x07, 0x74, 0xa0, 0x07, + 0x76, 0x40, 0x07, 0x6d, 0xe0, 0x0e, 0x78, 0xa0, 0x07, 0x71, 0x60, 0x07, + 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x43, 0x9e, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x86, 0x3c, + 0x06, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, + 0x79, 0x10, 0x20, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x18, 0xf2, 0x34, 0x40, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x30, 0xe4, 0x81, 0x80, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x60, 0xc8, 0x33, 0x01, 0x01, 0x30, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xc0, 0x90, 0xc7, 0x02, 0x02, 0x60, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x80, 0x2c, 0x10, 0x10, 0x00, 0x00, 0x00, 0x32, + 0x1e, 0x98, 0x14, 0x19, 0x11, 0x4c, 0x90, 0x8c, 0x09, 0x26, 0x47, 0xc6, + 0x04, 0x43, 0x22, 0x4a, 0x60, 0x04, 0xa0, 0x18, 0x8a, 0xa0, 0x1c, 0x4a, + 0xa2, 0x0c, 0x0a, 0xa6, 0x3c, 0xa8, 0x28, 0x89, 0x11, 0x80, 0x22, 0x28, + 0x83, 0x42, 0x28, 0x10, 0xe2, 0x66, 0x00, 0xe8, 0x9b, 0x01, 0xa0, 0x70, + 0x06, 0x80, 0xc4, 0xb1, 0x14, 0x84, 0x78, 0x1e, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00, 0x69, 0x00, 0x00, 0x00, 0x1a, + 0x03, 0x4c, 0x90, 0x46, 0x02, 0x13, 0x44, 0x35, 0x18, 0x63, 0x0b, 0x73, + 0x3b, 0x03, 0xb1, 0x2b, 0x93, 0x9b, 0x4b, 0x7b, 0x73, 0x03, 0x99, 0x71, + 0xb9, 0x01, 0x41, 0xa1, 0x0b, 0x3b, 0x9b, 0x7b, 0x91, 0x2a, 0x62, 0x2a, + 0x0a, 0x9a, 0x2a, 0xfa, 0x9a, 0xb9, 0x81, 0x79, 0x31, 0x4b, 0x73, 0x0b, + 0x63, 0x4b, 0xd9, 0x10, 0x04, 0x13, 0x04, 0xe2, 0x98, 0x20, 0x10, 0xc8, + 0x06, 0x61, 0x20, 0x26, 0x08, 0x44, 0xb2, 0x41, 0x18, 0x0c, 0x0a, 0x70, + 0x73, 0x1b, 0x06, 0xc4, 0x20, 0x26, 0x08, 0x9c, 0x45, 0x60, 0x82, 0x40, + 0x28, 0x13, 0x04, 0x62, 0x99, 0x20, 0x10, 0xcc, 0x06, 0x81, 0x70, 0x36, + 0x24, 0x84, 0xb2, 0x30, 0xc4, 0xd0, 0x10, 0xcf, 0x86, 0x00, 0x9a, 0x20, + 0x7c, 0xd7, 0x04, 0x81, 0x68, 0x26, 0x08, 0x84, 0xb3, 0x01, 0x21, 0xa4, + 0x65, 0x22, 0x06, 0x0a, 0xd8, 0x10, 0x54, 0x13, 0x84, 0x30, 0xc0, 0x36, + 0x20, 0xc4, 0xb5, 0x30, 0xc4, 0x40, 0x00, 0x1b, 0x02, 0x6c, 0x03, 0x11, + 0x01, 0x56, 0x36, 0x41, 0x10, 0x83, 0x6c, 0x43, 0xb0, 0x4d, 0x10, 0x04, + 0x80, 0x8f, 0x10, 0x5b, 0x1a, 0x9d, 0x91, 0xdc, 0x5b, 0x9b, 0x0c, 0x51, + 0x90, 0x9c, 0x5c, 0x58, 0x1e, 0x11, 0xaa, 0x22, 0xac, 0xa1, 0xa7, 0x27, + 0x29, 0xa2, 0x09, 0x42, 0x01, 0x4d, 0x10, 0x8a, 0x68, 0x43, 0x40, 0x4c, + 0x10, 0x0a, 0x69, 0x83, 0x30, 0x4d, 0x1b, 0x16, 0xe2, 0x03, 0x83, 0x30, + 0x10, 0x83, 0x31, 0x18, 0xc6, 0x80, 0x08, 0x03, 0x32, 0xe0, 0x32, 0x65, + 0xf5, 0x05, 0xf5, 0x36, 0x97, 0x46, 0x97, 0xf6, 0xe6, 0x36, 0x41, 0x28, + 0xa6, 0x09, 0x42, 0x41, 0x6d, 0x58, 0x06, 0x33, 0x00, 0x83, 0x33, 0x10, + 0x03, 0x34, 0x18, 0xd0, 0x60, 0x08, 0x03, 0x60, 0x83, 0x50, 0x06, 0x69, + 0xc0, 0x64, 0xca, 0xea, 0x8b, 0x2a, 0x4c, 0xee, 0xac, 0x8c, 0x6e, 0x82, + 0x50, 0x54, 0x13, 0x04, 0xe2, 0xd9, 0x20, 0x4c, 0x6d, 0xb0, 0x61, 0x21, + 0xd6, 0x00, 0x0c, 0xd8, 0x40, 0x0c, 0xc2, 0x60, 0x40, 0x03, 0x22, 0x0c, + 0xdc, 0x60, 0x43, 0xf0, 0x06, 0x1b, 0x06, 0x35, 0x80, 0x03, 0x60, 0x43, + 0xd1, 0x79, 0x71, 0xa0, 0x01, 0x55, 0xd8, 0xd8, 0xec, 0xda, 0x5c, 0xd2, + 0xc8, 0xca, 0xdc, 0xe8, 0xa6, 0x04, 0x41, 0x15, 0x32, 0x3c, 0x17, 0xbb, + 0x32, 0xb9, 0xb9, 0xb4, 0x37, 0xb7, 0x29, 0x01, 0xd1, 0x84, 0x0c, 0xcf, + 0xc5, 0x2e, 0x8c, 0xcd, 0xae, 0x4c, 0x6e, 0x4a, 0x60, 0xd4, 0x21, 0xc3, + 0x73, 0x99, 0x43, 0x0b, 0x23, 0x2b, 0x93, 0x6b, 0x7a, 0x23, 0x2b, 0x63, + 0x9b, 0x12, 0x20, 0x65, 0xc8, 0xf0, 0x5c, 0xe4, 0xca, 0xe6, 0xde, 0xea, + 0xe4, 0xc6, 0xca, 0xe6, 0xa6, 0x04, 0x59, 0x1d, 0x32, 0x3c, 0x17, 0xbb, + 0xb4, 0xb2, 0xbb, 0x24, 0xb2, 0x29, 0xba, 0x30, 0xba, 0xb2, 0x29, 0xc1, + 0x56, 0x87, 0x0c, 0xcf, 0xa5, 0xcc, 0x8d, 0x4e, 0x2e, 0x0f, 0xea, 0x2d, + 0xcd, 0x8d, 0x6e, 0x6e, 0x4a, 0x10, 0x07, 0x00, 0x00, 0x00, 0x00, 0x79, + 0x18, 0x00, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x33, 0x08, 0x80, 0x1c, 0xc4, + 0xe1, 0x1c, 0x66, 0x14, 0x01, 0x3d, 0x88, 0x43, 0x38, 0x84, 0xc3, 0x8c, + 0x42, 0x80, 0x07, 0x79, 0x78, 0x07, 0x73, 0x98, 0x71, 0x0c, 0xe6, 0x00, + 0x0f, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x33, 0x0c, 0x42, 0x1e, 0xc2, + 0xc1, 0x1d, 0xce, 0xa1, 0x1c, 0x66, 0x30, 0x05, 0x3d, 0x88, 0x43, 0x38, + 0x84, 0x83, 0x1b, 0xcc, 0x03, 0x3d, 0xc8, 0x43, 0x3d, 0x8c, 0x03, 0x3d, + 0xcc, 0x78, 0x8c, 0x74, 0x70, 0x07, 0x7b, 0x08, 0x07, 0x79, 0x48, 0x87, + 0x70, 0x70, 0x07, 0x7a, 0x70, 0x03, 0x76, 0x78, 0x87, 0x70, 0x20, 0x87, + 0x19, 0xcc, 0x11, 0x0e, 0xec, 0x90, 0x0e, 0xe1, 0x30, 0x0f, 0x6e, 0x30, + 0x0f, 0xe3, 0xf0, 0x0e, 0xf0, 0x50, 0x0e, 0x33, 0x10, 0xc4, 0x1d, 0xde, + 0x21, 0x1c, 0xd8, 0x21, 0x1d, 0xc2, 0x61, 0x1e, 0x66, 0x30, 0x89, 0x3b, + 0xbc, 0x83, 0x3b, 0xd0, 0x43, 0x39, 0xb4, 0x03, 0x3c, 0xbc, 0x83, 0x3c, + 0x84, 0x03, 0x3b, 0xcc, 0xf0, 0x14, 0x76, 0x60, 0x07, 0x7b, 0x68, 0x07, + 0x37, 0x68, 0x87, 0x72, 0x68, 0x07, 0x37, 0x80, 0x87, 0x70, 0x90, 0x87, + 0x70, 0x60, 0x07, 0x76, 0x28, 0x07, 0x76, 0xf8, 0x05, 0x76, 0x78, 0x87, + 0x77, 0x80, 0x87, 0x5f, 0x08, 0x87, 0x71, 0x18, 0x87, 0x72, 0x98, 0x87, + 0x79, 0x98, 0x81, 0x2c, 0xee, 0xf0, 0x0e, 0xee, 0xe0, 0x0e, 0xf5, 0xc0, + 0x0e, 0xec, 0x30, 0x03, 0x62, 0xc8, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xcc, + 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xdc, 0x61, 0x1c, 0xca, 0x21, 0x1c, 0xc4, + 0x81, 0x1d, 0xca, 0x61, 0x06, 0xd6, 0x90, 0x43, 0x39, 0xc8, 0x43, 0x39, + 0x98, 0x43, 0x39, 0xc8, 0x43, 0x39, 0xb8, 0xc3, 0x38, 0x94, 0x43, 0x38, + 0x88, 0x03, 0x3b, 0x94, 0xc3, 0x2f, 0xbc, 0x83, 0x3c, 0xfc, 0x82, 0x3b, + 0xd4, 0x03, 0x3b, 0xb0, 0xc3, 0x0c, 0xc4, 0x21, 0x07, 0x7c, 0x70, 0x03, + 0x7a, 0x28, 0x87, 0x76, 0x80, 0x87, 0x19, 0xd1, 0x43, 0x0e, 0xf8, 0xe0, + 0x06, 0xe4, 0x20, 0x0e, 0xe7, 0xe0, 0x06, 0xf6, 0x10, 0x0e, 0xf2, 0xc0, + 0x0e, 0xe1, 0x90, 0x0f, 0xef, 0x50, 0x0f, 0xf4, 0x00, 0x00, 0x00, 0x71, + 0x20, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x06, 0xf0, 0x6c, 0x0b, 0x32, + 0x7d, 0x91, 0xc3, 0xd8, 0x9d, 0x16, 0x45, 0x00, 0x66, 0x04, 0xdb, 0x70, + 0xf9, 0xce, 0xe3, 0x0b, 0x01, 0x55, 0x14, 0x44, 0x54, 0x3a, 0xc0, 0x50, + 0x12, 0x06, 0x20, 0x60, 0x7e, 0x71, 0xdb, 0x56, 0xb0, 0x0d, 0x97, 0xef, + 0x3c, 0xbe, 0x10, 0x50, 0x45, 0x41, 0x44, 0xa5, 0x03, 0x0c, 0x25, 0x61, + 0x00, 0x02, 0xe6, 0x23, 0xb7, 0x6d, 0x06, 0xd2, 0x70, 0xf9, 0xce, 0xe3, + 0x0b, 0x11, 0x01, 0x4c, 0x44, 0x08, 0x34, 0xc3, 0x42, 0x58, 0xc0, 0x34, + 0x5c, 0xbe, 0xf3, 0xf8, 0x8b, 0x03, 0x0c, 0x62, 0xf3, 0x50, 0x93, 0x5f, + 0xdc, 0xb6, 0x0d, 0x54, 0xc3, 0xe5, 0x3b, 0x8f, 0x2f, 0x01, 0xcc, 0xb3, + 0x10, 0x25, 0x51, 0x11, 0x8b, 0x5f, 0xdc, 0xb6, 0x09, 0x54, 0xc3, 0xe5, + 0x3b, 0x8f, 0x2f, 0x4d, 0x4e, 0x44, 0xa0, 0xd4, 0xf4, 0x50, 0x93, 0x5f, + 0xdc, 0x36, 0x00, 0x61, 0x20, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x13, + 0x04, 0x41, 0x2c, 0x10, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x54, + 0x8d, 0x00, 0x10, 0x51, 0x0a, 0x25, 0x37, 0x03, 0x50, 0x76, 0x85, 0x50, + 0x7c, 0x54, 0x94, 0x00, 0x0d, 0x33, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, + 0x06, 0x09, 0x00, 0x82, 0x60, 0x60, 0x75, 0x87, 0xb4, 0x6d, 0xc9, 0x88, + 0x41, 0x02, 0x80, 0x20, 0x18, 0x58, 0x1e, 0x12, 0x71, 0x9c, 0x32, 0x62, + 0x90, 0x00, 0x20, 0x08, 0x06, 0xd6, 0x97, 0x4c, 0x5d, 0xb7, 0x8c, 0x18, + 0x24, 0x00, 0x08, 0x82, 0x81, 0x51, 0x06, 0x87, 0xe7, 0x55, 0xc9, 0x88, + 0x41, 0x02, 0x80, 0x20, 0x18, 0x18, 0x66, 0x80, 0x7c, 0x9f, 0xa1, 0x8c, + 0x18, 0x1c, 0x00, 0x08, 0x82, 0x01, 0x44, 0x06, 0xca, 0x00, 0x06, 0xa3, + 0x09, 0x01, 0x30, 0x9a, 0x20, 0x04, 0xa3, 0x09, 0x83, 0x30, 0x9a, 0x40, + 0x0c, 0x26, 0x1c, 0xf2, 0x31, 0xe1, 0x90, 0x8f, 0x09, 0x06, 0x7c, 0x4c, + 0x30, 0xe0, 0x33, 0x62, 0x70, 0x00, 0x20, 0x08, 0x06, 0x50, 0x1b, 0x4c, + 0x8c, 0x1a, 0x8c, 0x26, 0x04, 0xc1, 0x05, 0xc4, 0x5c, 0x30, 0xd4, 0x88, + 0xc1, 0x01, 0x80, 0x20, 0x18, 0x4c, 0x70, 0x70, 0x41, 0x6e, 0x30, 0x9a, + 0x10, 0x00, 0x17, 0x0c, 0x35, 0x62, 0xf0, 0x00, 0x20, 0x08, 0x06, 0x4d, + 0x1d, 0x60, 0x15, 0x95, 0x20, 0x84, 0x05, 0x07, 0x70, 0xb0, 0x05, 0xa3, + 0x09, 0x01, 0x30, 0x9a, 0x20, 0x04, 0xa3, 0x09, 0x83, 0x30, 0x9a, 0x40, + 0x0c, 0x23, 0x06, 0x09, 0x00, 0x82, 0x60, 0x80, 0xec, 0x81, 0x18, 0xd4, + 0x41, 0x1d, 0xb0, 0x01, 0x31, 0x62, 0x90, 0x00, 0x20, 0x08, 0x06, 0xc8, + 0x1e, 0x88, 0x41, 0x1d, 0xd4, 0x01, 0x37, 0x8c, 0x18, 0x24, 0x00, 0x08, + 0x82, 0x01, 0xb2, 0x07, 0x62, 0x50, 0x07, 0x75, 0xb0, 0x06, 0xc2, 0x88, + 0x41, 0x02, 0x80, 0x20, 0x18, 0x20, 0x7b, 0x20, 0x06, 0x75, 0x50, 0x07, + 0x6a, 0x10, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; #if 0 ; @@ -1681,178 +1717,336 @@ attributes #2 = { nounwind readonly } #endif const unsigned char g_BlitFrom3D[] = { - 0x44, 0x58, 0x42, 0x43, 0x92, 0xfc, 0xc9, 0x36, 0x8a, 0xa4, 0xdc, 0xb9, - 0x51, 0xa8, 0x46, 0x69, 0x09, 0x0b, 0x8e, 0x8e, 0x01, 0x00, 0x00, 0x00, - 0xab, 0x11, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, - 0x4c, 0x00, 0x00, 0x00, 0xb1, 0x00, 0x00, 0x00, 0xeb, 0x00, 0x00, 0x00, - 0xe3, 0x01, 0x00, 0x00, 0xcb, 0x09, 0x00, 0x00, 0xe7, 0x09, 0x00, 0x00, - 0x53, 0x46, 0x49, 0x30, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x49, 0x53, 0x47, 0x31, 0x5d, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x54, 0x45, 0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44, 0x00, 0x53, 0x56, 0x5f, - 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0x4f, 0x53, 0x47, - 0x31, 0x32, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x40, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x53, 0x56, 0x5f, - 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x00, 0x50, 0x53, 0x56, 0x30, 0xf0, - 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x44, 0x58, 0x42, 0x43, 0x02, 0xc7, 0x0f, 0x7e, 0xe3, 0x5a, 0xf4, 0x9b, + 0xc5, 0xb2, 0xf8, 0xed, 0xa6, 0x79, 0xed, 0xf4, 0x01, 0x00, 0x00, 0x00, + 0x3f, 0x12, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, + 0x50, 0x00, 0x00, 0x00, 0xb5, 0x00, 0x00, 0x00, 0xef, 0x00, 0x00, 0x00, + 0xe7, 0x01, 0x00, 0x00, 0x77, 0x02, 0x00, 0x00, 0x5f, 0x0a, 0x00, 0x00, + 0x7b, 0x0a, 0x00, 0x00, 0x53, 0x46, 0x49, 0x30, 0x08, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x49, 0x53, 0x47, 0x31, + 0x5d, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x51, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x54, 0x45, 0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44, + 0x00, 0x53, 0x56, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, + 0x00, 0x4f, 0x53, 0x47, 0x31, 0x32, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, + 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x53, 0x56, 0x5f, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x00, 0x50, + 0x53, 0x56, 0x30, 0xf0, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x02, - 0x01, 0x00, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x18, - 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x54, 0x45, 0x58, 0x43, - 0x4f, 0x4f, 0x52, 0x44, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x01, 0x00, 0x42, 0x00, 0x03, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x44, 0x03, 0x03, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, - 0x00, 0x44, 0x10, 0x03, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x0f, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, + 0x00, 0x00, 0x00, 0x02, 0x01, 0x00, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, + 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x03, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0d, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, + 0x54, 0x45, 0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44, 0x00, 0x00, 0x00, 0x01, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x01, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x42, 0x00, 0x03, + 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, + 0x01, 0x44, 0x03, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x01, 0x00, 0x44, 0x10, 0x03, 0x00, 0x00, 0x00, 0x0f, + 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x53, 0x54, 0x41, 0x54, 0xe0, 0x07, 0x00, 0x00, 0x60, - 0x00, 0x00, 0x00, 0xf8, 0x01, 0x00, 0x00, 0x44, 0x58, 0x49, 0x4c, 0x00, - 0x01, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0xc8, 0x07, 0x00, 0x00, 0x42, - 0x43, 0xc0, 0xde, 0x21, 0x0c, 0x00, 0x00, 0xef, 0x01, 0x00, 0x00, 0x0b, - 0x82, 0x20, 0x00, 0x02, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x07, - 0x81, 0x23, 0x91, 0x41, 0xc8, 0x04, 0x49, 0x06, 0x10, 0x32, 0x39, 0x92, - 0x01, 0x84, 0x0c, 0x25, 0x05, 0x08, 0x19, 0x1e, 0x04, 0x8b, 0x62, 0x80, - 0x18, 0x45, 0x02, 0x42, 0x92, 0x0b, 0x42, 0xc4, 0x10, 0x32, 0x14, 0x38, - 0x08, 0x18, 0x4b, 0x0a, 0x32, 0x62, 0x88, 0x48, 0x90, 0x14, 0x20, 0x43, - 0x46, 0x88, 0xa5, 0x00, 0x19, 0x32, 0x42, 0xe4, 0x48, 0x0e, 0x90, 0x11, - 0x23, 0xc4, 0x50, 0x41, 0x51, 0x81, 0x8c, 0xe1, 0x83, 0xe5, 0x8a, 0x04, - 0x31, 0x46, 0x06, 0x51, 0x18, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1b, - 0x8c, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x07, 0x40, 0x02, 0xa8, 0x0d, 0x84, - 0xf0, 0xff, 0xff, 0xff, 0xff, 0x03, 0x20, 0x6d, 0x30, 0x86, 0xff, 0xff, - 0xff, 0xff, 0x1f, 0x00, 0x09, 0xa8, 0x00, 0x49, 0x18, 0x00, 0x00, 0x03, - 0x00, 0x00, 0x00, 0x13, 0x82, 0x60, 0x42, 0x20, 0x4c, 0x08, 0x06, 0x00, - 0x00, 0x00, 0x00, 0x89, 0x20, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00, 0x32, - 0x22, 0x88, 0x09, 0x20, 0x64, 0x85, 0x04, 0x13, 0x23, 0xa4, 0x84, 0x04, - 0x13, 0x23, 0xe3, 0x84, 0xa1, 0x90, 0x14, 0x12, 0x4c, 0x8c, 0x8c, 0x0b, - 0x84, 0xc4, 0x4c, 0x10, 0x8c, 0xc1, 0x08, 0x40, 0x09, 0x00, 0x0a, 0x66, - 0x00, 0xe6, 0x08, 0xc0, 0x60, 0x8e, 0x00, 0x29, 0xc6, 0x40, 0x10, 0x44, - 0x41, 0x90, 0x51, 0x0c, 0x80, 0x20, 0x88, 0x62, 0x20, 0xe4, 0xa6, 0xe1, - 0xf2, 0x27, 0xec, 0x21, 0x24, 0x7f, 0x25, 0xa4, 0x95, 0x98, 0xfc, 0xe2, - 0xb6, 0x51, 0x31, 0x0c, 0xc3, 0x40, 0x50, 0x71, 0xcf, 0x70, 0xf9, 0x13, - 0xf6, 0x10, 0x92, 0x1f, 0x02, 0xcd, 0xb0, 0x10, 0x28, 0x58, 0x0a, 0xa3, - 0x10, 0x0c, 0x33, 0x0c, 0xc3, 0x40, 0x10, 0xc4, 0x40, 0xcd, 0x51, 0xc3, - 0xe5, 0x4f, 0xd8, 0x43, 0x48, 0x3e, 0xb7, 0x51, 0xc5, 0x4a, 0x4c, 0x7e, - 0x71, 0xdb, 0x88, 0x18, 0x86, 0x61, 0x28, 0xc4, 0x43, 0x30, 0x04, 0x41, - 0x47, 0x0d, 0x97, 0x3f, 0x61, 0x0f, 0x21, 0xf9, 0xdc, 0x46, 0x15, 0x2b, - 0x31, 0xf9, 0xc8, 0x6d, 0x23, 0x82, 0x20, 0x08, 0xa2, 0x10, 0x12, 0xc1, - 0x10, 0x34, 0xcd, 0x11, 0x04, 0xc5, 0x60, 0x88, 0x82, 0x20, 0x2a, 0xb2, - 0x06, 0x02, 0x86, 0x11, 0x88, 0x61, 0xa6, 0x36, 0x18, 0x07, 0x76, 0x08, - 0x87, 0x79, 0x98, 0x07, 0x37, 0xa0, 0x85, 0x72, 0xc0, 0x07, 0x7a, 0xa8, - 0x07, 0x79, 0x28, 0x87, 0x39, 0x20, 0x05, 0x3e, 0xb0, 0x87, 0x72, 0x18, - 0x07, 0x7a, 0x78, 0x07, 0x79, 0xe0, 0x03, 0x73, 0x60, 0x87, 0x77, 0x08, - 0x07, 0x7a, 0x60, 0x03, 0x30, 0xa0, 0x03, 0x3f, 0x00, 0x03, 0x3f, 0xd0, - 0x03, 0x3d, 0x68, 0x87, 0x74, 0x80, 0x87, 0x79, 0xf8, 0x05, 0x7a, 0xc8, - 0x07, 0x78, 0x28, 0x07, 0x14, 0x10, 0x33, 0x89, 0xc1, 0x38, 0xb0, 0x43, - 0x38, 0xcc, 0xc3, 0x3c, 0xb8, 0x01, 0x2d, 0x94, 0x03, 0x3e, 0xd0, 0x43, - 0x3d, 0xc8, 0x43, 0x39, 0xcc, 0x01, 0x29, 0xf0, 0x81, 0x3d, 0x94, 0xc3, - 0x38, 0xd0, 0xc3, 0x3b, 0xc8, 0x03, 0x1f, 0x98, 0x03, 0x3b, 0xbc, 0x43, - 0x38, 0xd0, 0x03, 0x1b, 0x80, 0x01, 0x1d, 0xf8, 0x01, 0x18, 0xf8, 0x01, - 0x12, 0x32, 0x8d, 0xb6, 0x61, 0x04, 0x61, 0x38, 0x89, 0x75, 0xa8, 0x48, - 0x20, 0x56, 0xc2, 0x40, 0x9c, 0x66, 0xa3, 0x8a, 0x82, 0x88, 0x10, 0xd1, - 0x75, 0xc4, 0x40, 0xde, 0x4d, 0xd2, 0x14, 0x51, 0xc2, 0xe4, 0xb3, 0x00, - 0xf3, 0x2c, 0x44, 0xc4, 0x4e, 0xc0, 0x44, 0xa0, 0x80, 0x20, 0x30, 0x15, - 0x08, 0x00, 0x00, 0x13, 0x14, 0x72, 0xc0, 0x87, 0x74, 0x60, 0x87, 0x36, - 0x68, 0x87, 0x79, 0x68, 0x03, 0x72, 0xc0, 0x87, 0x0d, 0xaf, 0x50, 0x0e, - 0x6d, 0xd0, 0x0e, 0x7a, 0x50, 0x0e, 0x6d, 0x00, 0x0f, 0x7a, 0x30, 0x07, - 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x71, 0xa0, 0x07, - 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x78, 0xa0, 0x07, 0x73, 0x20, 0x07, - 0x6d, 0x90, 0x0e, 0x71, 0x60, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, - 0xe9, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, - 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, 0xe6, 0x10, 0x07, - 0x76, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x60, 0x0e, 0x73, 0x20, 0x07, - 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xe6, 0x60, 0x07, 0x74, 0xa0, 0x07, - 0x76, 0x40, 0x07, 0x6d, 0xe0, 0x0e, 0x78, 0xa0, 0x07, 0x71, 0x60, 0x07, - 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x43, 0x9e, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x86, 0x3c, - 0x06, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, - 0x79, 0x10, 0x20, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x18, 0xf2, 0x34, 0x40, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x30, 0xe4, 0x81, 0x80, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x60, 0xc8, 0x33, 0x01, 0x01, 0x30, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xc0, 0x90, 0xc7, 0x02, 0x02, 0x60, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x80, 0x2c, 0x10, 0x14, 0x00, 0x00, 0x00, 0x32, - 0x1e, 0x98, 0x18, 0x19, 0x11, 0x4c, 0x90, 0x8c, 0x09, 0x26, 0x47, 0xc6, - 0x04, 0x43, 0x22, 0x4a, 0x60, 0x04, 0xa0, 0x18, 0x8a, 0xa0, 0x10, 0x4a, - 0xa2, 0x0c, 0x0a, 0xa6, 0x1c, 0x0a, 0xa2, 0x40, 0x4a, 0xa1, 0x50, 0xca, - 0xa3, 0x74, 0xa8, 0x28, 0x89, 0x11, 0x80, 0x22, 0x28, 0x83, 0x42, 0x28, - 0x10, 0xaa, 0x6a, 0x80, 0xb8, 0x19, 0x00, 0xf2, 0x66, 0x00, 0xe8, 0x9b, - 0x01, 0xa0, 0x70, 0x06, 0x80, 0xc4, 0xb1, 0x14, 0x84, 0x78, 0x1e, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00, 0xaf, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x52, 0x54, 0x53, 0x30, 0x88, + 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x18, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x88, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x3c, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x5c, + 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x7c, + 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x03, + 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x01, + 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x03, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x53, 0x54, 0x41, 0x54, 0xe0, + 0x07, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0xf8, 0x01, 0x00, 0x00, 0x44, + 0x58, 0x49, 0x4c, 0x00, 0x01, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0xc8, + 0x07, 0x00, 0x00, 0x42, 0x43, 0xc0, 0xde, 0x21, 0x0c, 0x00, 0x00, 0xef, + 0x01, 0x00, 0x00, 0x0b, 0x82, 0x20, 0x00, 0x02, 0x00, 0x00, 0x00, 0x13, + 0x00, 0x00, 0x00, 0x07, 0x81, 0x23, 0x91, 0x41, 0xc8, 0x04, 0x49, 0x06, + 0x10, 0x32, 0x39, 0x92, 0x01, 0x84, 0x0c, 0x25, 0x05, 0x08, 0x19, 0x1e, + 0x04, 0x8b, 0x62, 0x80, 0x18, 0x45, 0x02, 0x42, 0x92, 0x0b, 0x42, 0xc4, + 0x10, 0x32, 0x14, 0x38, 0x08, 0x18, 0x4b, 0x0a, 0x32, 0x62, 0x88, 0x48, + 0x90, 0x14, 0x20, 0x43, 0x46, 0x88, 0xa5, 0x00, 0x19, 0x32, 0x42, 0xe4, + 0x48, 0x0e, 0x90, 0x11, 0x23, 0xc4, 0x50, 0x41, 0x51, 0x81, 0x8c, 0xe1, + 0x83, 0xe5, 0x8a, 0x04, 0x31, 0x46, 0x06, 0x51, 0x18, 0x00, 0x00, 0x08, + 0x00, 0x00, 0x00, 0x1b, 0x8c, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x07, 0x40, + 0x02, 0xa8, 0x0d, 0x84, 0xf0, 0xff, 0xff, 0xff, 0xff, 0x03, 0x20, 0x6d, + 0x30, 0x86, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x09, 0xa8, 0x00, 0x49, + 0x18, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x13, 0x82, 0x60, 0x42, 0x20, + 0x4c, 0x08, 0x06, 0x00, 0x00, 0x00, 0x00, 0x89, 0x20, 0x00, 0x00, 0x58, + 0x00, 0x00, 0x00, 0x32, 0x22, 0x88, 0x09, 0x20, 0x64, 0x85, 0x04, 0x13, + 0x23, 0xa4, 0x84, 0x04, 0x13, 0x23, 0xe3, 0x84, 0xa1, 0x90, 0x14, 0x12, + 0x4c, 0x8c, 0x8c, 0x0b, 0x84, 0xc4, 0x4c, 0x10, 0x8c, 0xc1, 0x08, 0x40, + 0x09, 0x00, 0x0a, 0x66, 0x00, 0xe6, 0x08, 0xc0, 0x60, 0x8e, 0x00, 0x29, + 0xc6, 0x40, 0x10, 0x44, 0x41, 0x90, 0x51, 0x0c, 0x80, 0x20, 0x88, 0x62, + 0x20, 0xe4, 0xa6, 0xe1, 0xf2, 0x27, 0xec, 0x21, 0x24, 0x7f, 0x25, 0xa4, + 0x95, 0x98, 0xfc, 0xe2, 0xb6, 0x51, 0x31, 0x0c, 0xc3, 0x40, 0x50, 0x71, + 0xcf, 0x70, 0xf9, 0x13, 0xf6, 0x10, 0x92, 0x1f, 0x02, 0xcd, 0xb0, 0x10, + 0x28, 0x58, 0x0a, 0xa3, 0x10, 0x0c, 0x33, 0x0c, 0xc3, 0x40, 0x10, 0xc4, + 0x40, 0xcd, 0x51, 0xc3, 0xe5, 0x4f, 0xd8, 0x43, 0x48, 0x3e, 0xb7, 0x51, + 0xc5, 0x4a, 0x4c, 0x7e, 0x71, 0xdb, 0x88, 0x18, 0x86, 0x61, 0x28, 0xc4, + 0x43, 0x30, 0x04, 0x41, 0x47, 0x0d, 0x97, 0x3f, 0x61, 0x0f, 0x21, 0xf9, + 0xdc, 0x46, 0x15, 0x2b, 0x31, 0xf9, 0xc8, 0x6d, 0x23, 0x82, 0x20, 0x08, + 0xa2, 0x10, 0x12, 0xc1, 0x10, 0x34, 0xcd, 0x11, 0x04, 0xc5, 0x60, 0x88, + 0x82, 0x20, 0x2a, 0xb2, 0x06, 0x02, 0x86, 0x11, 0x88, 0x61, 0xa6, 0x36, + 0x18, 0x07, 0x76, 0x08, 0x87, 0x79, 0x98, 0x07, 0x37, 0xa0, 0x85, 0x72, + 0xc0, 0x07, 0x7a, 0xa8, 0x07, 0x79, 0x28, 0x87, 0x39, 0x20, 0x05, 0x3e, + 0xb0, 0x87, 0x72, 0x18, 0x07, 0x7a, 0x78, 0x07, 0x79, 0xe0, 0x03, 0x73, + 0x60, 0x87, 0x77, 0x08, 0x07, 0x7a, 0x60, 0x03, 0x30, 0xa0, 0x03, 0x3f, + 0x00, 0x03, 0x3f, 0xd0, 0x03, 0x3d, 0x68, 0x87, 0x74, 0x80, 0x87, 0x79, + 0xf8, 0x05, 0x7a, 0xc8, 0x07, 0x78, 0x28, 0x07, 0x14, 0x10, 0x33, 0x89, + 0xc1, 0x38, 0xb0, 0x43, 0x38, 0xcc, 0xc3, 0x3c, 0xb8, 0x01, 0x2d, 0x94, + 0x03, 0x3e, 0xd0, 0x43, 0x3d, 0xc8, 0x43, 0x39, 0xcc, 0x01, 0x29, 0xf0, + 0x81, 0x3d, 0x94, 0xc3, 0x38, 0xd0, 0xc3, 0x3b, 0xc8, 0x03, 0x1f, 0x98, + 0x03, 0x3b, 0xbc, 0x43, 0x38, 0xd0, 0x03, 0x1b, 0x80, 0x01, 0x1d, 0xf8, + 0x01, 0x18, 0xf8, 0x01, 0x12, 0x32, 0x8d, 0xb6, 0x61, 0x04, 0x61, 0x38, + 0x89, 0x75, 0xa8, 0x48, 0x20, 0x56, 0xc2, 0x40, 0x9c, 0x66, 0xa3, 0x8a, + 0x82, 0x88, 0x10, 0xd1, 0x75, 0xc4, 0x40, 0xde, 0x4d, 0xd2, 0x14, 0x51, + 0xc2, 0xe4, 0xb3, 0x00, 0xf3, 0x2c, 0x44, 0xc4, 0x4e, 0xc0, 0x44, 0xa0, + 0x80, 0x20, 0x30, 0x15, 0x08, 0x00, 0x00, 0x13, 0x14, 0x72, 0xc0, 0x87, + 0x74, 0x60, 0x87, 0x36, 0x68, 0x87, 0x79, 0x68, 0x03, 0x72, 0xc0, 0x87, + 0x0d, 0xaf, 0x50, 0x0e, 0x6d, 0xd0, 0x0e, 0x7a, 0x50, 0x0e, 0x6d, 0x00, + 0x0f, 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, + 0x0e, 0x71, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x78, 0xa0, + 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x71, 0x60, 0x07, 0x7a, 0x30, + 0x07, 0x72, 0xd0, 0x06, 0xe9, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, + 0x07, 0x6d, 0x90, 0x0e, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, + 0x06, 0xe6, 0x10, 0x07, 0x76, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x60, + 0x0e, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xe6, 0x60, + 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, 0xe0, 0x0e, 0x78, 0xa0, + 0x07, 0x71, 0x60, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x76, 0x40, + 0x07, 0x43, 0x9e, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x86, 0x3c, 0x06, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x0c, 0x79, 0x10, 0x20, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x18, 0xf2, 0x34, 0x40, 0x00, 0x0c, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0xe4, 0x81, 0x80, 0x00, 0x18, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0xc8, 0x33, 0x01, 0x01, 0x30, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x90, 0xc7, 0x02, 0x02, + 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x2c, 0x10, 0x14, + 0x00, 0x00, 0x00, 0x32, 0x1e, 0x98, 0x18, 0x19, 0x11, 0x4c, 0x90, 0x8c, + 0x09, 0x26, 0x47, 0xc6, 0x04, 0x43, 0x22, 0x4a, 0x60, 0x04, 0xa0, 0x18, + 0x8a, 0xa0, 0x10, 0x4a, 0xa2, 0x0c, 0x0a, 0xa6, 0x1c, 0x0a, 0xa2, 0x40, + 0x4a, 0xa1, 0x50, 0xca, 0xa3, 0x74, 0xa8, 0x28, 0x89, 0x11, 0x80, 0x22, + 0x28, 0x83, 0x42, 0x28, 0x10, 0xaa, 0x6a, 0x80, 0xb8, 0x19, 0x00, 0xf2, + 0x66, 0x00, 0xe8, 0x9b, 0x01, 0xa0, 0x70, 0x06, 0x80, 0xc4, 0xb1, 0x14, + 0x84, 0x78, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x79, + 0x18, 0x00, 0x00, 0xaf, 0x00, 0x00, 0x00, 0x1a, 0x03, 0x4c, 0x90, 0x46, + 0x02, 0x13, 0x44, 0x35, 0x18, 0x63, 0x0b, 0x73, 0x3b, 0x03, 0xb1, 0x2b, + 0x93, 0x9b, 0x4b, 0x7b, 0x73, 0x03, 0x99, 0x71, 0xb9, 0x01, 0x41, 0xa1, + 0x0b, 0x3b, 0x9b, 0x7b, 0x91, 0x2a, 0x62, 0x2a, 0x0a, 0x9a, 0x2a, 0xfa, + 0x9a, 0xb9, 0x81, 0x79, 0x31, 0x4b, 0x73, 0x0b, 0x63, 0x4b, 0xd9, 0x10, + 0x04, 0x13, 0x04, 0xe2, 0x98, 0x20, 0x10, 0xc8, 0x06, 0x61, 0x20, 0x36, + 0x08, 0x04, 0x41, 0x01, 0x6e, 0x6e, 0x82, 0x40, 0x24, 0x1b, 0x86, 0x03, + 0x21, 0x26, 0x08, 0x5c, 0xc7, 0x67, 0xea, 0xad, 0x4e, 0x6e, 0xac, 0x8c, + 0xaa, 0x0c, 0x8f, 0xae, 0x4e, 0xae, 0x6c, 0x86, 0x68, 0x82, 0x40, 0x28, + 0x13, 0x04, 0x62, 0x99, 0x20, 0x10, 0xcc, 0x06, 0x81, 0x70, 0x36, 0x24, + 0x84, 0xb2, 0x30, 0xc4, 0xd0, 0x10, 0xcf, 0x86, 0x00, 0x9a, 0x20, 0x7c, + 0x1f, 0xa5, 0xa9, 0xb7, 0x3a, 0xb9, 0xb1, 0x32, 0xa9, 0xb2, 0xb3, 0xb4, + 0x37, 0x37, 0xa1, 0x3a, 0x33, 0xb3, 0x32, 0xb9, 0x09, 0x02, 0xd1, 0x4c, + 0x10, 0x08, 0x67, 0x03, 0x42, 0x48, 0x13, 0x45, 0x0c, 0x15, 0xb0, 0x21, + 0xb0, 0x26, 0x08, 0x61, 0x00, 0x06, 0x6c, 0xa6, 0xde, 0xea, 0xe4, 0xc6, + 0xca, 0xa6, 0xc2, 0xda, 0xe0, 0xd8, 0xca, 0xe4, 0x36, 0x20, 0x04, 0x96, + 0x31, 0xc4, 0x40, 0x00, 0x1b, 0x02, 0x6d, 0x03, 0x11, 0x01, 0xd7, 0x36, + 0x41, 0xf0, 0x3c, 0x26, 0x55, 0x56, 0x4c, 0x65, 0x66, 0x74, 0x54, 0x6f, + 0x70, 0x13, 0x04, 0xe2, 0x99, 0x20, 0x54, 0xdc, 0x06, 0x04, 0xf1, 0x28, + 0xe2, 0x73, 0x1c, 0x30, 0x20, 0x53, 0x65, 0x45, 0x94, 0xd6, 0x56, 0xe6, + 0x36, 0x97, 0xf6, 0xe6, 0x36, 0x37, 0x41, 0x20, 0xa0, 0x0d, 0x08, 0x22, + 0x06, 0xd4, 0x18, 0x7c, 0x8e, 0x03, 0x06, 0x44, 0x9a, 0xd2, 0xe0, 0x98, + 0xca, 0xec, 0xca, 0xd8, 0x26, 0x08, 0x44, 0x34, 0x41, 0x20, 0xa4, 0x0d, + 0x08, 0x52, 0x06, 0x94, 0x19, 0x7c, 0x67, 0xe0, 0x80, 0x01, 0x19, 0xa6, + 0xb0, 0xbc, 0x32, 0xb9, 0x27, 0x39, 0xa2, 0x32, 0x38, 0x3a, 0xb4, 0x09, + 0x02, 0x31, 0x6d, 0x40, 0x90, 0x34, 0xa0, 0xd4, 0xe0, 0x73, 0x1c, 0x30, + 0xd8, 0x50, 0x54, 0x61, 0x40, 0x06, 0x68, 0xb0, 0x06, 0x1b, 0x06, 0xa2, + 0x63, 0x83, 0x09, 0x82, 0x00, 0x6c, 0x00, 0x36, 0x0c, 0xc4, 0x1b, 0xbc, + 0xc1, 0x86, 0x00, 0x0e, 0x36, 0x0c, 0x83, 0x1b, 0xc4, 0xc1, 0x04, 0x41, + 0x0c, 0xc2, 0x60, 0x43, 0x30, 0x07, 0x54, 0x84, 0xd8, 0xd2, 0xe8, 0x8c, + 0xe4, 0xde, 0xda, 0x66, 0x88, 0x88, 0x50, 0x15, 0x61, 0x0d, 0x3d, 0x3d, + 0x49, 0x11, 0x4d, 0x10, 0x0a, 0x6b, 0x82, 0x50, 0x5c, 0x1b, 0x02, 0x62, + 0x82, 0x50, 0x60, 0x1b, 0x04, 0x8a, 0xda, 0xb0, 0x10, 0x76, 0x70, 0x07, + 0x78, 0x90, 0x07, 0x7a, 0x30, 0xe8, 0x01, 0x81, 0x07, 0x7b, 0xc0, 0x65, + 0xca, 0xea, 0x0b, 0xea, 0x6d, 0x2e, 0x8d, 0x2e, 0xed, 0xcd, 0x6d, 0x82, + 0x50, 0x64, 0x13, 0x84, 0x42, 0xdb, 0xb0, 0x0c, 0x7d, 0x70, 0x07, 0x7e, + 0x90, 0x07, 0x7f, 0x30, 0xfc, 0xc1, 0x80, 0x07, 0xc0, 0x06, 0x81, 0x0f, + 0x40, 0x81, 0xc9, 0x94, 0xd5, 0x17, 0x55, 0x98, 0xdc, 0x59, 0x19, 0xdd, + 0x04, 0xa1, 0xd8, 0x26, 0x08, 0x04, 0xb5, 0x41, 0xa0, 0x48, 0x61, 0xc3, + 0x42, 0x88, 0xc2, 0x1d, 0x8c, 0x42, 0x1e, 0xe0, 0xc1, 0xf0, 0x07, 0x04, + 0x1e, 0x94, 0xc2, 0x86, 0xc0, 0x14, 0x36, 0x0c, 0xa1, 0x70, 0x0a, 0xc0, + 0x86, 0xc2, 0x0d, 0xea, 0x00, 0x15, 0x38, 0x80, 0x86, 0x19, 0xdb, 0x5b, + 0x18, 0xdd, 0x1c, 0x8b, 0x34, 0xb7, 0x39, 0xba, 0xb9, 0x09, 0x02, 0x51, + 0xd1, 0x98, 0x4b, 0x3b, 0xfb, 0x62, 0x23, 0xa3, 0x31, 0x97, 0x76, 0xf6, + 0x35, 0x47, 0x47, 0x84, 0xae, 0x0c, 0xef, 0xcb, 0xed, 0x4d, 0xae, 0x6d, + 0x83, 0xa2, 0x0a, 0x67, 0xb0, 0x0a, 0xac, 0xd0, 0x0a, 0x8c, 0x2b, 0x34, + 0xaf, 0x30, 0x54, 0x61, 0x63, 0xb3, 0x6b, 0x73, 0x49, 0x23, 0x2b, 0x73, + 0xa3, 0x9b, 0x12, 0x04, 0x55, 0xc8, 0xf0, 0x5c, 0xec, 0xca, 0xe4, 0xe6, + 0xd2, 0xde, 0xdc, 0xa6, 0x04, 0x44, 0x13, 0x32, 0x3c, 0x17, 0xbb, 0x30, + 0x36, 0xbb, 0x32, 0xb9, 0x29, 0x41, 0x51, 0x87, 0x0c, 0xcf, 0x65, 0x0e, + 0x2d, 0x8c, 0xac, 0x4c, 0xae, 0xe9, 0x8d, 0xac, 0x8c, 0x6d, 0x4a, 0x80, + 0x94, 0x21, 0xc3, 0x73, 0x91, 0x2b, 0x9b, 0x7b, 0xab, 0x93, 0x1b, 0x2b, + 0x9b, 0x9b, 0x12, 0x6c, 0x95, 0xc8, 0xf0, 0x5c, 0xe8, 0xf2, 0xe0, 0xca, + 0x82, 0xdc, 0xdc, 0xde, 0xe8, 0xc2, 0xe8, 0xd2, 0xde, 0xdc, 0xe6, 0xa6, + 0x08, 0x6c, 0x10, 0x07, 0x75, 0xc8, 0xf0, 0x5c, 0xec, 0xd2, 0xca, 0xee, + 0x92, 0xc8, 0xa6, 0xe8, 0xc2, 0xe8, 0xca, 0xa6, 0x04, 0x73, 0x50, 0x87, + 0x0c, 0xcf, 0xa5, 0xcc, 0x8d, 0x4e, 0x2e, 0x0f, 0xea, 0x2d, 0xcd, 0x8d, + 0x6e, 0x6e, 0x4a, 0x80, 0x0a, 0x5d, 0xc8, 0xf0, 0x5c, 0xc6, 0xde, 0xea, + 0xdc, 0xe8, 0xca, 0xe4, 0xe6, 0xa6, 0x04, 0xaf, 0x00, 0x00, 0x00, 0x79, + 0x18, 0x00, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x33, 0x08, 0x80, 0x1c, 0xc4, + 0xe1, 0x1c, 0x66, 0x14, 0x01, 0x3d, 0x88, 0x43, 0x38, 0x84, 0xc3, 0x8c, + 0x42, 0x80, 0x07, 0x79, 0x78, 0x07, 0x73, 0x98, 0x71, 0x0c, 0xe6, 0x00, + 0x0f, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x33, 0x0c, 0x42, 0x1e, 0xc2, + 0xc1, 0x1d, 0xce, 0xa1, 0x1c, 0x66, 0x30, 0x05, 0x3d, 0x88, 0x43, 0x38, + 0x84, 0x83, 0x1b, 0xcc, 0x03, 0x3d, 0xc8, 0x43, 0x3d, 0x8c, 0x03, 0x3d, + 0xcc, 0x78, 0x8c, 0x74, 0x70, 0x07, 0x7b, 0x08, 0x07, 0x79, 0x48, 0x87, + 0x70, 0x70, 0x07, 0x7a, 0x70, 0x03, 0x76, 0x78, 0x87, 0x70, 0x20, 0x87, + 0x19, 0xcc, 0x11, 0x0e, 0xec, 0x90, 0x0e, 0xe1, 0x30, 0x0f, 0x6e, 0x30, + 0x0f, 0xe3, 0xf0, 0x0e, 0xf0, 0x50, 0x0e, 0x33, 0x10, 0xc4, 0x1d, 0xde, + 0x21, 0x1c, 0xd8, 0x21, 0x1d, 0xc2, 0x61, 0x1e, 0x66, 0x30, 0x89, 0x3b, + 0xbc, 0x83, 0x3b, 0xd0, 0x43, 0x39, 0xb4, 0x03, 0x3c, 0xbc, 0x83, 0x3c, + 0x84, 0x03, 0x3b, 0xcc, 0xf0, 0x14, 0x76, 0x60, 0x07, 0x7b, 0x68, 0x07, + 0x37, 0x68, 0x87, 0x72, 0x68, 0x07, 0x37, 0x80, 0x87, 0x70, 0x90, 0x87, + 0x70, 0x60, 0x07, 0x76, 0x28, 0x07, 0x76, 0xf8, 0x05, 0x76, 0x78, 0x87, + 0x77, 0x80, 0x87, 0x5f, 0x08, 0x87, 0x71, 0x18, 0x87, 0x72, 0x98, 0x87, + 0x79, 0x98, 0x81, 0x2c, 0xee, 0xf0, 0x0e, 0xee, 0xe0, 0x0e, 0xf5, 0xc0, + 0x0e, 0xec, 0x30, 0x03, 0x62, 0xc8, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xcc, + 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xdc, 0x61, 0x1c, 0xca, 0x21, 0x1c, 0xc4, + 0x81, 0x1d, 0xca, 0x61, 0x06, 0xd6, 0x90, 0x43, 0x39, 0xc8, 0x43, 0x39, + 0x98, 0x43, 0x39, 0xc8, 0x43, 0x39, 0xb8, 0xc3, 0x38, 0x94, 0x43, 0x38, + 0x88, 0x03, 0x3b, 0x94, 0xc3, 0x2f, 0xbc, 0x83, 0x3c, 0xfc, 0x82, 0x3b, + 0xd4, 0x03, 0x3b, 0xb0, 0xc3, 0x0c, 0xc4, 0x21, 0x07, 0x7c, 0x70, 0x03, + 0x7a, 0x28, 0x87, 0x76, 0x80, 0x87, 0x19, 0xd1, 0x43, 0x0e, 0xf8, 0xe0, + 0x06, 0xe4, 0x20, 0x0e, 0xe7, 0xe0, 0x06, 0xf6, 0x10, 0x0e, 0xf2, 0xc0, + 0x0e, 0xe1, 0x90, 0x0f, 0xef, 0x50, 0x0f, 0xf4, 0x00, 0x00, 0x00, 0x71, + 0x20, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x06, 0xa0, 0x6c, 0x0b, 0x32, + 0x7d, 0x91, 0xc3, 0xdc, 0x9d, 0x11, 0x6c, 0xc3, 0xe5, 0x3b, 0x8f, 0x2f, + 0x04, 0x54, 0x51, 0x10, 0x51, 0xe9, 0x00, 0x43, 0x49, 0x18, 0x80, 0x80, + 0xf9, 0xc5, 0x6d, 0x5b, 0xc1, 0x36, 0x5c, 0xbe, 0xf3, 0xf8, 0x42, 0x40, + 0x15, 0x05, 0x11, 0x95, 0x0e, 0x30, 0x94, 0x84, 0x01, 0x08, 0x98, 0x8f, + 0xdc, 0xb6, 0x19, 0x48, 0xc3, 0xe5, 0x3b, 0x8f, 0x2f, 0x44, 0x04, 0x30, + 0x11, 0x21, 0xd0, 0x0c, 0x0b, 0x61, 0x01, 0xd3, 0x70, 0xf9, 0xce, 0xe3, + 0x2f, 0x0e, 0x30, 0x88, 0xcd, 0x43, 0x4d, 0x7e, 0x71, 0xdb, 0x36, 0x50, + 0x0d, 0x97, 0xef, 0x3c, 0xbe, 0x04, 0x30, 0xcf, 0x42, 0x94, 0x44, 0x45, + 0x2c, 0x7e, 0x71, 0xdb, 0x26, 0x50, 0x0d, 0x97, 0xef, 0x3c, 0xbe, 0x34, + 0x39, 0x11, 0x81, 0x52, 0xd3, 0x43, 0x4d, 0x7e, 0x71, 0xdb, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x48, 0x41, 0x53, 0x48, 0x14, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x49, 0xc2, 0xf4, 0xbe, 0x13, 0x34, 0x00, 0xe0, 0x7c, + 0x3f, 0x23, 0xe9, 0x79, 0x8b, 0x27, 0xf4, 0x44, 0x58, 0x49, 0x4c, 0xbc, + 0x07, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0xef, 0x01, 0x00, 0x00, 0x44, + 0x58, 0x49, 0x4c, 0x00, 0x01, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0xa4, + 0x07, 0x00, 0x00, 0x42, 0x43, 0xc0, 0xde, 0x21, 0x0c, 0x00, 0x00, 0xe6, + 0x01, 0x00, 0x00, 0x0b, 0x82, 0x20, 0x00, 0x02, 0x00, 0x00, 0x00, 0x13, + 0x00, 0x00, 0x00, 0x07, 0x81, 0x23, 0x91, 0x41, 0xc8, 0x04, 0x49, 0x06, + 0x10, 0x32, 0x39, 0x92, 0x01, 0x84, 0x0c, 0x25, 0x05, 0x08, 0x19, 0x1e, + 0x04, 0x8b, 0x62, 0x80, 0x18, 0x45, 0x02, 0x42, 0x92, 0x0b, 0x42, 0xc4, + 0x10, 0x32, 0x14, 0x38, 0x08, 0x18, 0x4b, 0x0a, 0x32, 0x62, 0x88, 0x48, + 0x90, 0x14, 0x20, 0x43, 0x46, 0x88, 0xa5, 0x00, 0x19, 0x32, 0x42, 0xe4, + 0x48, 0x0e, 0x90, 0x11, 0x23, 0xc4, 0x50, 0x41, 0x51, 0x81, 0x8c, 0xe1, + 0x83, 0xe5, 0x8a, 0x04, 0x31, 0x46, 0x06, 0x51, 0x18, 0x00, 0x00, 0x08, + 0x00, 0x00, 0x00, 0x1b, 0x8c, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x07, 0x40, + 0x02, 0xa8, 0x0d, 0x84, 0xf0, 0xff, 0xff, 0xff, 0xff, 0x03, 0x20, 0x6d, + 0x30, 0x86, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x09, 0xa8, 0x00, 0x49, + 0x18, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x13, 0x82, 0x60, 0x42, 0x20, + 0x4c, 0x08, 0x06, 0x00, 0x00, 0x00, 0x00, 0x89, 0x20, 0x00, 0x00, 0x58, + 0x00, 0x00, 0x00, 0x32, 0x22, 0x88, 0x09, 0x20, 0x64, 0x85, 0x04, 0x13, + 0x23, 0xa4, 0x84, 0x04, 0x13, 0x23, 0xe3, 0x84, 0xa1, 0x90, 0x14, 0x12, + 0x4c, 0x8c, 0x8c, 0x0b, 0x84, 0xc4, 0x4c, 0x10, 0x8c, 0xc1, 0x08, 0x40, + 0x09, 0x00, 0x0a, 0x66, 0x00, 0xe6, 0x08, 0xc0, 0x60, 0x8e, 0x00, 0x29, + 0xc6, 0x40, 0x10, 0x44, 0x41, 0x90, 0x51, 0x0c, 0x80, 0x20, 0x88, 0x62, + 0x20, 0xe4, 0xa6, 0xe1, 0xf2, 0x27, 0xec, 0x21, 0x24, 0x7f, 0x25, 0xa4, + 0x95, 0x98, 0xfc, 0xe2, 0xb6, 0x51, 0x31, 0x0c, 0xc3, 0x40, 0x50, 0x71, + 0xcf, 0x70, 0xf9, 0x13, 0xf6, 0x10, 0x92, 0x1f, 0x02, 0xcd, 0xb0, 0x10, + 0x28, 0x58, 0x0a, 0xa3, 0x10, 0x0c, 0x33, 0x0c, 0xc3, 0x40, 0x10, 0xc4, + 0x40, 0xcd, 0x51, 0xc3, 0xe5, 0x4f, 0xd8, 0x43, 0x48, 0x3e, 0xb7, 0x51, + 0xc5, 0x4a, 0x4c, 0x7e, 0x71, 0xdb, 0x88, 0x18, 0x86, 0x61, 0x28, 0xc4, + 0x43, 0x30, 0x04, 0x41, 0x47, 0x0d, 0x97, 0x3f, 0x61, 0x0f, 0x21, 0xf9, + 0xdc, 0x46, 0x15, 0x2b, 0x31, 0xf9, 0xc8, 0x6d, 0x23, 0x82, 0x20, 0x08, + 0xa2, 0x10, 0x12, 0xc1, 0x10, 0x34, 0xcd, 0x11, 0x04, 0xc5, 0x60, 0x88, + 0x82, 0x20, 0x2a, 0xb2, 0x06, 0x02, 0x86, 0x11, 0x88, 0x61, 0xa6, 0x36, + 0x18, 0x07, 0x76, 0x08, 0x87, 0x79, 0x98, 0x07, 0x37, 0xa0, 0x85, 0x72, + 0xc0, 0x07, 0x7a, 0xa8, 0x07, 0x79, 0x28, 0x87, 0x39, 0x20, 0x05, 0x3e, + 0xb0, 0x87, 0x72, 0x18, 0x07, 0x7a, 0x78, 0x07, 0x79, 0xe0, 0x03, 0x73, + 0x60, 0x87, 0x77, 0x08, 0x07, 0x7a, 0x60, 0x03, 0x30, 0xa0, 0x03, 0x3f, + 0x00, 0x03, 0x3f, 0xd0, 0x03, 0x3d, 0x68, 0x87, 0x74, 0x80, 0x87, 0x79, + 0xf8, 0x05, 0x7a, 0xc8, 0x07, 0x78, 0x28, 0x07, 0x14, 0x10, 0x33, 0x89, + 0xc1, 0x38, 0xb0, 0x43, 0x38, 0xcc, 0xc3, 0x3c, 0xb8, 0x01, 0x2d, 0x94, + 0x03, 0x3e, 0xd0, 0x43, 0x3d, 0xc8, 0x43, 0x39, 0xcc, 0x01, 0x29, 0xf0, + 0x81, 0x3d, 0x94, 0xc3, 0x38, 0xd0, 0xc3, 0x3b, 0xc8, 0x03, 0x1f, 0x98, + 0x03, 0x3b, 0xbc, 0x43, 0x38, 0xd0, 0x03, 0x1b, 0x80, 0x01, 0x1d, 0xf8, + 0x01, 0x18, 0xf8, 0x01, 0x12, 0x32, 0x8d, 0xb6, 0x61, 0x04, 0x61, 0x38, + 0x89, 0x75, 0xa8, 0x48, 0x20, 0x56, 0xc2, 0x40, 0x9c, 0x66, 0xa3, 0x8a, + 0x82, 0x88, 0x10, 0xd1, 0x75, 0xc4, 0x40, 0xde, 0x4d, 0xd2, 0x14, 0x51, + 0xc2, 0xe4, 0xb3, 0x00, 0xf3, 0x2c, 0x44, 0xc4, 0x4e, 0xc0, 0x44, 0xa0, + 0x80, 0x20, 0x30, 0x15, 0x08, 0x00, 0x00, 0x13, 0x14, 0x72, 0xc0, 0x87, + 0x74, 0x60, 0x87, 0x36, 0x68, 0x87, 0x79, 0x68, 0x03, 0x72, 0xc0, 0x87, + 0x0d, 0xaf, 0x50, 0x0e, 0x6d, 0xd0, 0x0e, 0x7a, 0x50, 0x0e, 0x6d, 0x00, + 0x0f, 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, + 0x0e, 0x71, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x78, 0xa0, + 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x71, 0x60, 0x07, 0x7a, 0x30, + 0x07, 0x72, 0xd0, 0x06, 0xe9, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, + 0x07, 0x6d, 0x90, 0x0e, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, + 0x06, 0xe6, 0x10, 0x07, 0x76, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x60, + 0x0e, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xe6, 0x60, + 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, 0xe0, 0x0e, 0x78, 0xa0, + 0x07, 0x71, 0x60, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x76, 0x40, + 0x07, 0x43, 0x9e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x86, 0x3c, 0x06, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x0c, 0x79, 0x10, 0x20, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x18, 0xf2, 0x34, 0x40, 0x00, 0x0c, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0xe4, 0x81, 0x80, 0x00, 0x18, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0xc8, 0x33, 0x01, 0x01, 0x30, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x90, 0xc7, 0x02, 0x02, + 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x2c, 0x10, 0x10, + 0x00, 0x00, 0x00, 0x32, 0x1e, 0x98, 0x14, 0x19, 0x11, 0x4c, 0x90, 0x8c, + 0x09, 0x26, 0x47, 0xc6, 0x04, 0x43, 0x22, 0x4a, 0x60, 0x04, 0xa0, 0x18, + 0x8a, 0xa0, 0x10, 0x4a, 0xa2, 0x0c, 0x0a, 0xa6, 0x3c, 0xa8, 0x28, 0x89, + 0x11, 0x80, 0x22, 0x28, 0x83, 0x42, 0x28, 0x10, 0xe2, 0x66, 0x00, 0xe8, + 0x9b, 0x01, 0xa0, 0x70, 0x06, 0x80, 0xc4, 0xb1, 0x14, 0x84, 0x78, 0x1e, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00, 0x67, 0x00, 0x00, 0x00, 0x1a, 0x03, 0x4c, 0x90, 0x46, 0x02, 0x13, 0x44, 0x35, 0x18, 0x63, 0x0b, 0x73, 0x3b, 0x03, 0xb1, 0x2b, 0x93, 0x9b, 0x4b, 0x7b, 0x73, 0x03, 0x99, 0x71, 0xb9, 0x01, 0x41, 0xa1, 0x0b, 0x3b, 0x9b, 0x7b, 0x91, 0x2a, 0x62, 0x2a, 0x0a, 0x9a, 0x2a, 0xfa, 0x9a, 0xb9, 0x81, 0x79, 0x31, 0x4b, 0x73, 0x0b, 0x63, 0x4b, 0xd9, 0x10, 0x04, 0x13, 0x04, 0xe2, - 0x98, 0x20, 0x10, 0xc8, 0x06, 0x61, 0x20, 0x36, 0x08, 0x04, 0x41, 0x01, - 0x6e, 0x6e, 0x82, 0x40, 0x24, 0x1b, 0x86, 0x03, 0x21, 0x26, 0x08, 0x5c, - 0xc7, 0x67, 0xea, 0xad, 0x4e, 0x6e, 0xac, 0x8c, 0xaa, 0x0c, 0x8f, 0xae, - 0x4e, 0xae, 0x6c, 0x86, 0x68, 0x82, 0x40, 0x28, 0x13, 0x04, 0x62, 0x99, - 0x20, 0x10, 0xcc, 0x06, 0x81, 0x70, 0x36, 0x24, 0x84, 0xb2, 0x30, 0xc4, - 0xd0, 0x10, 0xcf, 0x86, 0x00, 0x9a, 0x20, 0x7c, 0x1f, 0xa5, 0xa9, 0xb7, - 0x3a, 0xb9, 0xb1, 0x32, 0xa9, 0xb2, 0xb3, 0xb4, 0x37, 0x37, 0xa1, 0x3a, - 0x33, 0xb3, 0x32, 0xb9, 0x09, 0x02, 0xd1, 0x4c, 0x10, 0x08, 0x67, 0x03, - 0x42, 0x48, 0x13, 0x45, 0x0c, 0x15, 0xb0, 0x21, 0xb0, 0x26, 0x08, 0x61, - 0x00, 0x06, 0x6c, 0xa6, 0xde, 0xea, 0xe4, 0xc6, 0xca, 0xa6, 0xc2, 0xda, - 0xe0, 0xd8, 0xca, 0xe4, 0x36, 0x20, 0x04, 0x96, 0x31, 0xc4, 0x40, 0x00, - 0x1b, 0x02, 0x6d, 0x03, 0x11, 0x01, 0xd7, 0x36, 0x41, 0xf0, 0x3c, 0x26, - 0x55, 0x56, 0x4c, 0x65, 0x66, 0x74, 0x54, 0x6f, 0x70, 0x13, 0x04, 0xe2, - 0x99, 0x20, 0x54, 0xdc, 0x06, 0x04, 0xf1, 0x28, 0xe2, 0x73, 0x1c, 0x30, - 0x20, 0x53, 0x65, 0x45, 0x94, 0xd6, 0x56, 0xe6, 0x36, 0x97, 0xf6, 0xe6, - 0x36, 0x37, 0x41, 0x20, 0xa0, 0x0d, 0x08, 0x22, 0x06, 0xd4, 0x18, 0x7c, - 0x8e, 0x03, 0x06, 0x44, 0x9a, 0xd2, 0xe0, 0x98, 0xca, 0xec, 0xca, 0xd8, - 0x26, 0x08, 0x44, 0x34, 0x41, 0x20, 0xa4, 0x0d, 0x08, 0x52, 0x06, 0x94, - 0x19, 0x7c, 0x67, 0xe0, 0x80, 0x01, 0x19, 0xa6, 0xb0, 0xbc, 0x32, 0xb9, - 0x27, 0x39, 0xa2, 0x32, 0x38, 0x3a, 0xb4, 0x09, 0x02, 0x31, 0x6d, 0x40, - 0x90, 0x34, 0xa0, 0xd4, 0xe0, 0x73, 0x1c, 0x30, 0xd8, 0x50, 0x54, 0x61, - 0x40, 0x06, 0x68, 0xb0, 0x06, 0x1b, 0x06, 0xa2, 0x63, 0x83, 0x09, 0x82, - 0x00, 0x6c, 0x00, 0x36, 0x0c, 0xc4, 0x1b, 0xbc, 0xc1, 0x86, 0x00, 0x0e, - 0x36, 0x0c, 0x83, 0x1b, 0xc4, 0xc1, 0x04, 0x41, 0x0c, 0xc2, 0x60, 0x43, - 0x30, 0x07, 0x54, 0x84, 0xd8, 0xd2, 0xe8, 0x8c, 0xe4, 0xde, 0xda, 0x66, - 0x88, 0x88, 0x50, 0x15, 0x61, 0x0d, 0x3d, 0x3d, 0x49, 0x11, 0x4d, 0x10, - 0x0a, 0x6b, 0x82, 0x50, 0x5c, 0x1b, 0x02, 0x62, 0x82, 0x50, 0x60, 0x1b, - 0x04, 0x8a, 0xda, 0xb0, 0x10, 0x76, 0x70, 0x07, 0x78, 0x90, 0x07, 0x7a, - 0x30, 0xe8, 0x01, 0x81, 0x07, 0x7b, 0xc0, 0x65, 0xca, 0xea, 0x0b, 0xea, - 0x6d, 0x2e, 0x8d, 0x2e, 0xed, 0xcd, 0x6d, 0x82, 0x50, 0x64, 0x13, 0x84, - 0x42, 0xdb, 0xb0, 0x0c, 0x7d, 0x70, 0x07, 0x7e, 0x90, 0x07, 0x7f, 0x30, - 0xfc, 0xc1, 0x80, 0x07, 0xc0, 0x06, 0x81, 0x0f, 0x40, 0x81, 0xc9, 0x94, - 0xd5, 0x17, 0x55, 0x98, 0xdc, 0x59, 0x19, 0xdd, 0x04, 0xa1, 0xd8, 0x26, - 0x08, 0x04, 0xb5, 0x41, 0xa0, 0x48, 0x61, 0xc3, 0x42, 0x88, 0xc2, 0x1d, - 0x8c, 0x42, 0x1e, 0xe0, 0xc1, 0xf0, 0x07, 0x04, 0x1e, 0x94, 0xc2, 0x86, - 0xc0, 0x14, 0x36, 0x0c, 0xa1, 0x70, 0x0a, 0xc0, 0x86, 0xc2, 0x0d, 0xea, - 0x00, 0x15, 0x38, 0x80, 0x86, 0x19, 0xdb, 0x5b, 0x18, 0xdd, 0x1c, 0x8b, - 0x34, 0xb7, 0x39, 0xba, 0xb9, 0x09, 0x02, 0x51, 0xd1, 0x98, 0x4b, 0x3b, - 0xfb, 0x62, 0x23, 0xa3, 0x31, 0x97, 0x76, 0xf6, 0x35, 0x47, 0x47, 0x84, - 0xae, 0x0c, 0xef, 0xcb, 0xed, 0x4d, 0xae, 0x6d, 0x83, 0xa2, 0x0a, 0x67, - 0xb0, 0x0a, 0xac, 0xd0, 0x0a, 0x8c, 0x2b, 0x34, 0xaf, 0x30, 0x54, 0x61, - 0x63, 0xb3, 0x6b, 0x73, 0x49, 0x23, 0x2b, 0x73, 0xa3, 0x9b, 0x12, 0x04, - 0x55, 0xc8, 0xf0, 0x5c, 0xec, 0xca, 0xe4, 0xe6, 0xd2, 0xde, 0xdc, 0xa6, - 0x04, 0x44, 0x13, 0x32, 0x3c, 0x17, 0xbb, 0x30, 0x36, 0xbb, 0x32, 0xb9, - 0x29, 0x41, 0x51, 0x87, 0x0c, 0xcf, 0x65, 0x0e, 0x2d, 0x8c, 0xac, 0x4c, - 0xae, 0xe9, 0x8d, 0xac, 0x8c, 0x6d, 0x4a, 0x80, 0x94, 0x21, 0xc3, 0x73, - 0x91, 0x2b, 0x9b, 0x7b, 0xab, 0x93, 0x1b, 0x2b, 0x9b, 0x9b, 0x12, 0x6c, - 0x95, 0xc8, 0xf0, 0x5c, 0xe8, 0xf2, 0xe0, 0xca, 0x82, 0xdc, 0xdc, 0xde, - 0xe8, 0xc2, 0xe8, 0xd2, 0xde, 0xdc, 0xe6, 0xa6, 0x08, 0x6c, 0x10, 0x07, - 0x75, 0xc8, 0xf0, 0x5c, 0xec, 0xd2, 0xca, 0xee, 0x92, 0xc8, 0xa6, 0xe8, - 0xc2, 0xe8, 0xca, 0xa6, 0x04, 0x73, 0x50, 0x87, 0x0c, 0xcf, 0xa5, 0xcc, - 0x8d, 0x4e, 0x2e, 0x0f, 0xea, 0x2d, 0xcd, 0x8d, 0x6e, 0x6e, 0x4a, 0x80, - 0x0a, 0x5d, 0xc8, 0xf0, 0x5c, 0xc6, 0xde, 0xea, 0xdc, 0xe8, 0xca, 0xe4, - 0xe6, 0xa6, 0x04, 0xaf, 0x00, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00, 0x4c, + 0x98, 0x20, 0x10, 0xc8, 0x06, 0x61, 0x20, 0x26, 0x08, 0x44, 0xb2, 0x41, + 0x18, 0x0c, 0x0a, 0x70, 0x73, 0x1b, 0x06, 0xc4, 0x20, 0x26, 0x08, 0x9c, + 0x45, 0x60, 0x82, 0x40, 0x28, 0x13, 0x04, 0x62, 0x99, 0x20, 0x10, 0xcc, + 0x06, 0x81, 0x70, 0x36, 0x24, 0x84, 0xb2, 0x30, 0xc4, 0xd0, 0x10, 0xcf, + 0x86, 0x00, 0x9a, 0x20, 0x7c, 0xd7, 0x04, 0x81, 0x68, 0x26, 0x08, 0x84, + 0xb3, 0x01, 0x21, 0xa4, 0x65, 0x22, 0x06, 0x0a, 0xd8, 0x10, 0x54, 0x13, + 0x84, 0x30, 0xc0, 0x36, 0x20, 0xc4, 0xb5, 0x30, 0xc4, 0x40, 0x00, 0x1b, + 0x02, 0x6c, 0x03, 0x11, 0x01, 0x56, 0x36, 0x41, 0x10, 0x83, 0x6c, 0x43, + 0xb0, 0x4d, 0x10, 0x04, 0x80, 0x8a, 0x10, 0x5b, 0x1a, 0x9d, 0x91, 0xdc, + 0x5b, 0xdb, 0x0c, 0x11, 0x11, 0xaa, 0x22, 0xac, 0xa1, 0xa7, 0x27, 0x29, + 0xa2, 0x09, 0x42, 0x01, 0x4d, 0x10, 0x8a, 0x68, 0x43, 0x40, 0x4c, 0x10, + 0x0a, 0x69, 0x83, 0x30, 0x4d, 0x1b, 0x16, 0xe2, 0x03, 0x83, 0x30, 0x10, + 0x83, 0x31, 0x18, 0xc6, 0x80, 0x08, 0x03, 0x32, 0xe0, 0x32, 0x65, 0xf5, + 0x05, 0xf5, 0x36, 0x97, 0x46, 0x97, 0xf6, 0xe6, 0x36, 0x41, 0x28, 0xa6, + 0x09, 0x42, 0x41, 0x6d, 0x58, 0x06, 0x33, 0x00, 0x83, 0x33, 0x10, 0x03, + 0x34, 0x18, 0xd0, 0x60, 0x08, 0x03, 0x60, 0x83, 0x50, 0x06, 0x69, 0xc0, + 0x64, 0xca, 0xea, 0x8b, 0x2a, 0x4c, 0xee, 0xac, 0x8c, 0x6e, 0x82, 0x50, + 0x54, 0x13, 0x04, 0xe2, 0xd9, 0x20, 0x4c, 0x6d, 0xb0, 0x61, 0x21, 0xd6, + 0x00, 0x0c, 0xd8, 0x40, 0x0c, 0xc2, 0x60, 0x40, 0x03, 0x22, 0x0c, 0xdc, + 0x60, 0x43, 0xf0, 0x06, 0x1b, 0x06, 0x35, 0x80, 0x03, 0x60, 0x43, 0xd1, + 0x79, 0x71, 0xa0, 0x01, 0x55, 0xd8, 0xd8, 0xec, 0xda, 0x5c, 0xd2, 0xc8, + 0xca, 0xdc, 0xe8, 0xa6, 0x04, 0x41, 0x15, 0x32, 0x3c, 0x17, 0xbb, 0x32, + 0xb9, 0xb9, 0xb4, 0x37, 0xb7, 0x29, 0x01, 0xd1, 0x84, 0x0c, 0xcf, 0xc5, + 0x2e, 0x8c, 0xcd, 0xae, 0x4c, 0x6e, 0x4a, 0x60, 0xd4, 0x21, 0xc3, 0x73, + 0x99, 0x43, 0x0b, 0x23, 0x2b, 0x93, 0x6b, 0x7a, 0x23, 0x2b, 0x63, 0x9b, + 0x12, 0x20, 0x65, 0xc8, 0xf0, 0x5c, 0xe4, 0xca, 0xe6, 0xde, 0xea, 0xe4, + 0xc6, 0xca, 0xe6, 0xa6, 0x04, 0x59, 0x1d, 0x32, 0x3c, 0x17, 0xbb, 0xb4, + 0xb2, 0xbb, 0x24, 0xb2, 0x29, 0xba, 0x30, 0xba, 0xb2, 0x29, 0xc1, 0x56, + 0x87, 0x0c, 0xcf, 0xa5, 0xcc, 0x8d, 0x4e, 0x2e, 0x0f, 0xea, 0x2d, 0xcd, + 0x8d, 0x6e, 0x6e, 0x4a, 0x10, 0x07, 0x00, 0x79, 0x18, 0x00, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x33, 0x08, 0x80, 0x1c, 0xc4, 0xe1, 0x1c, 0x66, 0x14, 0x01, 0x3d, 0x88, 0x43, 0x38, 0x84, 0xc3, 0x8c, 0x42, 0x80, 0x07, 0x79, 0x78, 0x07, 0x73, 0x98, 0x71, 0x0c, 0xe6, 0x00, 0x0f, 0xed, 0x10, 0x0e, @@ -1889,175 +2083,30 @@ const unsigned char g_BlitFrom3D[] = { 0xcd, 0x43, 0x4d, 0x7e, 0x71, 0xdb, 0x36, 0x50, 0x0d, 0x97, 0xef, 0x3c, 0xbe, 0x04, 0x30, 0xcf, 0x42, 0x94, 0x44, 0x45, 0x2c, 0x7e, 0x71, 0xdb, 0x26, 0x50, 0x0d, 0x97, 0xef, 0x3c, 0xbe, 0x34, 0x39, 0x11, 0x81, 0x52, - 0xd3, 0x43, 0x4d, 0x7e, 0x71, 0xdb, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, - 0x41, 0x53, 0x48, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x49, - 0xc2, 0xf4, 0xbe, 0x13, 0x34, 0x00, 0xe0, 0x7c, 0x3f, 0x23, 0xe9, 0x79, - 0x8b, 0x27, 0xf4, 0x44, 0x58, 0x49, 0x4c, 0xbc, 0x07, 0x00, 0x00, 0x60, - 0x00, 0x00, 0x00, 0xef, 0x01, 0x00, 0x00, 0x44, 0x58, 0x49, 0x4c, 0x00, - 0x01, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0xa4, 0x07, 0x00, 0x00, 0x42, - 0x43, 0xc0, 0xde, 0x21, 0x0c, 0x00, 0x00, 0xe6, 0x01, 0x00, 0x00, 0x0b, - 0x82, 0x20, 0x00, 0x02, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x07, - 0x81, 0x23, 0x91, 0x41, 0xc8, 0x04, 0x49, 0x06, 0x10, 0x32, 0x39, 0x92, - 0x01, 0x84, 0x0c, 0x25, 0x05, 0x08, 0x19, 0x1e, 0x04, 0x8b, 0x62, 0x80, - 0x18, 0x45, 0x02, 0x42, 0x92, 0x0b, 0x42, 0xc4, 0x10, 0x32, 0x14, 0x38, - 0x08, 0x18, 0x4b, 0x0a, 0x32, 0x62, 0x88, 0x48, 0x90, 0x14, 0x20, 0x43, - 0x46, 0x88, 0xa5, 0x00, 0x19, 0x32, 0x42, 0xe4, 0x48, 0x0e, 0x90, 0x11, - 0x23, 0xc4, 0x50, 0x41, 0x51, 0x81, 0x8c, 0xe1, 0x83, 0xe5, 0x8a, 0x04, - 0x31, 0x46, 0x06, 0x51, 0x18, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x1b, - 0x8c, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x07, 0x40, 0x02, 0xa8, 0x0d, 0x84, - 0xf0, 0xff, 0xff, 0xff, 0xff, 0x03, 0x20, 0x6d, 0x30, 0x86, 0xff, 0xff, - 0xff, 0xff, 0x1f, 0x00, 0x09, 0xa8, 0x00, 0x49, 0x18, 0x00, 0x00, 0x03, - 0x00, 0x00, 0x00, 0x13, 0x82, 0x60, 0x42, 0x20, 0x4c, 0x08, 0x06, 0x00, - 0x00, 0x00, 0x00, 0x89, 0x20, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00, 0x32, - 0x22, 0x88, 0x09, 0x20, 0x64, 0x85, 0x04, 0x13, 0x23, 0xa4, 0x84, 0x04, - 0x13, 0x23, 0xe3, 0x84, 0xa1, 0x90, 0x14, 0x12, 0x4c, 0x8c, 0x8c, 0x0b, - 0x84, 0xc4, 0x4c, 0x10, 0x8c, 0xc1, 0x08, 0x40, 0x09, 0x00, 0x0a, 0x66, - 0x00, 0xe6, 0x08, 0xc0, 0x60, 0x8e, 0x00, 0x29, 0xc6, 0x40, 0x10, 0x44, - 0x41, 0x90, 0x51, 0x0c, 0x80, 0x20, 0x88, 0x62, 0x20, 0xe4, 0xa6, 0xe1, - 0xf2, 0x27, 0xec, 0x21, 0x24, 0x7f, 0x25, 0xa4, 0x95, 0x98, 0xfc, 0xe2, - 0xb6, 0x51, 0x31, 0x0c, 0xc3, 0x40, 0x50, 0x71, 0xcf, 0x70, 0xf9, 0x13, - 0xf6, 0x10, 0x92, 0x1f, 0x02, 0xcd, 0xb0, 0x10, 0x28, 0x58, 0x0a, 0xa3, - 0x10, 0x0c, 0x33, 0x0c, 0xc3, 0x40, 0x10, 0xc4, 0x40, 0xcd, 0x51, 0xc3, - 0xe5, 0x4f, 0xd8, 0x43, 0x48, 0x3e, 0xb7, 0x51, 0xc5, 0x4a, 0x4c, 0x7e, - 0x71, 0xdb, 0x88, 0x18, 0x86, 0x61, 0x28, 0xc4, 0x43, 0x30, 0x04, 0x41, - 0x47, 0x0d, 0x97, 0x3f, 0x61, 0x0f, 0x21, 0xf9, 0xdc, 0x46, 0x15, 0x2b, - 0x31, 0xf9, 0xc8, 0x6d, 0x23, 0x82, 0x20, 0x08, 0xa2, 0x10, 0x12, 0xc1, - 0x10, 0x34, 0xcd, 0x11, 0x04, 0xc5, 0x60, 0x88, 0x82, 0x20, 0x2a, 0xb2, - 0x06, 0x02, 0x86, 0x11, 0x88, 0x61, 0xa6, 0x36, 0x18, 0x07, 0x76, 0x08, - 0x87, 0x79, 0x98, 0x07, 0x37, 0xa0, 0x85, 0x72, 0xc0, 0x07, 0x7a, 0xa8, - 0x07, 0x79, 0x28, 0x87, 0x39, 0x20, 0x05, 0x3e, 0xb0, 0x87, 0x72, 0x18, - 0x07, 0x7a, 0x78, 0x07, 0x79, 0xe0, 0x03, 0x73, 0x60, 0x87, 0x77, 0x08, - 0x07, 0x7a, 0x60, 0x03, 0x30, 0xa0, 0x03, 0x3f, 0x00, 0x03, 0x3f, 0xd0, - 0x03, 0x3d, 0x68, 0x87, 0x74, 0x80, 0x87, 0x79, 0xf8, 0x05, 0x7a, 0xc8, - 0x07, 0x78, 0x28, 0x07, 0x14, 0x10, 0x33, 0x89, 0xc1, 0x38, 0xb0, 0x43, - 0x38, 0xcc, 0xc3, 0x3c, 0xb8, 0x01, 0x2d, 0x94, 0x03, 0x3e, 0xd0, 0x43, - 0x3d, 0xc8, 0x43, 0x39, 0xcc, 0x01, 0x29, 0xf0, 0x81, 0x3d, 0x94, 0xc3, - 0x38, 0xd0, 0xc3, 0x3b, 0xc8, 0x03, 0x1f, 0x98, 0x03, 0x3b, 0xbc, 0x43, - 0x38, 0xd0, 0x03, 0x1b, 0x80, 0x01, 0x1d, 0xf8, 0x01, 0x18, 0xf8, 0x01, - 0x12, 0x32, 0x8d, 0xb6, 0x61, 0x04, 0x61, 0x38, 0x89, 0x75, 0xa8, 0x48, - 0x20, 0x56, 0xc2, 0x40, 0x9c, 0x66, 0xa3, 0x8a, 0x82, 0x88, 0x10, 0xd1, - 0x75, 0xc4, 0x40, 0xde, 0x4d, 0xd2, 0x14, 0x51, 0xc2, 0xe4, 0xb3, 0x00, - 0xf3, 0x2c, 0x44, 0xc4, 0x4e, 0xc0, 0x44, 0xa0, 0x80, 0x20, 0x30, 0x15, - 0x08, 0x00, 0x00, 0x13, 0x14, 0x72, 0xc0, 0x87, 0x74, 0x60, 0x87, 0x36, - 0x68, 0x87, 0x79, 0x68, 0x03, 0x72, 0xc0, 0x87, 0x0d, 0xaf, 0x50, 0x0e, - 0x6d, 0xd0, 0x0e, 0x7a, 0x50, 0x0e, 0x6d, 0x00, 0x0f, 0x7a, 0x30, 0x07, - 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x71, 0xa0, 0x07, - 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x78, 0xa0, 0x07, 0x73, 0x20, 0x07, - 0x6d, 0x90, 0x0e, 0x71, 0x60, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, - 0xe9, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, - 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, 0xe6, 0x10, 0x07, - 0x76, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x60, 0x0e, 0x73, 0x20, 0x07, - 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xe6, 0x60, 0x07, 0x74, 0xa0, 0x07, - 0x76, 0x40, 0x07, 0x6d, 0xe0, 0x0e, 0x78, 0xa0, 0x07, 0x71, 0x60, 0x07, - 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x43, 0x9e, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x86, 0x3c, - 0x06, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, - 0x79, 0x10, 0x20, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x18, 0xf2, 0x34, 0x40, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x30, 0xe4, 0x81, 0x80, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x60, 0xc8, 0x33, 0x01, 0x01, 0x30, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xc0, 0x90, 0xc7, 0x02, 0x02, 0x60, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x80, 0x2c, 0x10, 0x10, 0x00, 0x00, 0x00, 0x32, - 0x1e, 0x98, 0x14, 0x19, 0x11, 0x4c, 0x90, 0x8c, 0x09, 0x26, 0x47, 0xc6, - 0x04, 0x43, 0x22, 0x4a, 0x60, 0x04, 0xa0, 0x18, 0x8a, 0xa0, 0x10, 0x4a, - 0xa2, 0x0c, 0x0a, 0xa6, 0x3c, 0xa8, 0x28, 0x89, 0x11, 0x80, 0x22, 0x28, - 0x83, 0x42, 0x28, 0x10, 0xe2, 0x66, 0x00, 0xe8, 0x9b, 0x01, 0xa0, 0x70, - 0x06, 0x80, 0xc4, 0xb1, 0x14, 0x84, 0x78, 0x1e, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00, 0x67, 0x00, 0x00, 0x00, 0x1a, - 0x03, 0x4c, 0x90, 0x46, 0x02, 0x13, 0x44, 0x35, 0x18, 0x63, 0x0b, 0x73, - 0x3b, 0x03, 0xb1, 0x2b, 0x93, 0x9b, 0x4b, 0x7b, 0x73, 0x03, 0x99, 0x71, - 0xb9, 0x01, 0x41, 0xa1, 0x0b, 0x3b, 0x9b, 0x7b, 0x91, 0x2a, 0x62, 0x2a, - 0x0a, 0x9a, 0x2a, 0xfa, 0x9a, 0xb9, 0x81, 0x79, 0x31, 0x4b, 0x73, 0x0b, - 0x63, 0x4b, 0xd9, 0x10, 0x04, 0x13, 0x04, 0xe2, 0x98, 0x20, 0x10, 0xc8, - 0x06, 0x61, 0x20, 0x26, 0x08, 0x44, 0xb2, 0x41, 0x18, 0x0c, 0x0a, 0x70, - 0x73, 0x1b, 0x06, 0xc4, 0x20, 0x26, 0x08, 0x9c, 0x45, 0x60, 0x82, 0x40, - 0x28, 0x13, 0x04, 0x62, 0x99, 0x20, 0x10, 0xcc, 0x06, 0x81, 0x70, 0x36, - 0x24, 0x84, 0xb2, 0x30, 0xc4, 0xd0, 0x10, 0xcf, 0x86, 0x00, 0x9a, 0x20, - 0x7c, 0xd7, 0x04, 0x81, 0x68, 0x26, 0x08, 0x84, 0xb3, 0x01, 0x21, 0xa4, - 0x65, 0x22, 0x06, 0x0a, 0xd8, 0x10, 0x54, 0x13, 0x84, 0x30, 0xc0, 0x36, - 0x20, 0xc4, 0xb5, 0x30, 0xc4, 0x40, 0x00, 0x1b, 0x02, 0x6c, 0x03, 0x11, - 0x01, 0x56, 0x36, 0x41, 0x10, 0x83, 0x6c, 0x43, 0xb0, 0x4d, 0x10, 0x04, - 0x80, 0x8a, 0x10, 0x5b, 0x1a, 0x9d, 0x91, 0xdc, 0x5b, 0xdb, 0x0c, 0x11, - 0x11, 0xaa, 0x22, 0xac, 0xa1, 0xa7, 0x27, 0x29, 0xa2, 0x09, 0x42, 0x01, - 0x4d, 0x10, 0x8a, 0x68, 0x43, 0x40, 0x4c, 0x10, 0x0a, 0x69, 0x83, 0x30, - 0x4d, 0x1b, 0x16, 0xe2, 0x03, 0x83, 0x30, 0x10, 0x83, 0x31, 0x18, 0xc6, - 0x80, 0x08, 0x03, 0x32, 0xe0, 0x32, 0x65, 0xf5, 0x05, 0xf5, 0x36, 0x97, - 0x46, 0x97, 0xf6, 0xe6, 0x36, 0x41, 0x28, 0xa6, 0x09, 0x42, 0x41, 0x6d, - 0x58, 0x06, 0x33, 0x00, 0x83, 0x33, 0x10, 0x03, 0x34, 0x18, 0xd0, 0x60, - 0x08, 0x03, 0x60, 0x83, 0x50, 0x06, 0x69, 0xc0, 0x64, 0xca, 0xea, 0x8b, - 0x2a, 0x4c, 0xee, 0xac, 0x8c, 0x6e, 0x82, 0x50, 0x54, 0x13, 0x04, 0xe2, - 0xd9, 0x20, 0x4c, 0x6d, 0xb0, 0x61, 0x21, 0xd6, 0x00, 0x0c, 0xd8, 0x40, - 0x0c, 0xc2, 0x60, 0x40, 0x03, 0x22, 0x0c, 0xdc, 0x60, 0x43, 0xf0, 0x06, - 0x1b, 0x06, 0x35, 0x80, 0x03, 0x60, 0x43, 0xd1, 0x79, 0x71, 0xa0, 0x01, - 0x55, 0xd8, 0xd8, 0xec, 0xda, 0x5c, 0xd2, 0xc8, 0xca, 0xdc, 0xe8, 0xa6, - 0x04, 0x41, 0x15, 0x32, 0x3c, 0x17, 0xbb, 0x32, 0xb9, 0xb9, 0xb4, 0x37, - 0xb7, 0x29, 0x01, 0xd1, 0x84, 0x0c, 0xcf, 0xc5, 0x2e, 0x8c, 0xcd, 0xae, - 0x4c, 0x6e, 0x4a, 0x60, 0xd4, 0x21, 0xc3, 0x73, 0x99, 0x43, 0x0b, 0x23, - 0x2b, 0x93, 0x6b, 0x7a, 0x23, 0x2b, 0x63, 0x9b, 0x12, 0x20, 0x65, 0xc8, - 0xf0, 0x5c, 0xe4, 0xca, 0xe6, 0xde, 0xea, 0xe4, 0xc6, 0xca, 0xe6, 0xa6, - 0x04, 0x59, 0x1d, 0x32, 0x3c, 0x17, 0xbb, 0xb4, 0xb2, 0xbb, 0x24, 0xb2, - 0x29, 0xba, 0x30, 0xba, 0xb2, 0x29, 0xc1, 0x56, 0x87, 0x0c, 0xcf, 0xa5, - 0xcc, 0x8d, 0x4e, 0x2e, 0x0f, 0xea, 0x2d, 0xcd, 0x8d, 0x6e, 0x6e, 0x4a, - 0x10, 0x07, 0x00, 0x79, 0x18, 0x00, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x33, - 0x08, 0x80, 0x1c, 0xc4, 0xe1, 0x1c, 0x66, 0x14, 0x01, 0x3d, 0x88, 0x43, - 0x38, 0x84, 0xc3, 0x8c, 0x42, 0x80, 0x07, 0x79, 0x78, 0x07, 0x73, 0x98, - 0x71, 0x0c, 0xe6, 0x00, 0x0f, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x33, - 0x0c, 0x42, 0x1e, 0xc2, 0xc1, 0x1d, 0xce, 0xa1, 0x1c, 0x66, 0x30, 0x05, - 0x3d, 0x88, 0x43, 0x38, 0x84, 0x83, 0x1b, 0xcc, 0x03, 0x3d, 0xc8, 0x43, - 0x3d, 0x8c, 0x03, 0x3d, 0xcc, 0x78, 0x8c, 0x74, 0x70, 0x07, 0x7b, 0x08, - 0x07, 0x79, 0x48, 0x87, 0x70, 0x70, 0x07, 0x7a, 0x70, 0x03, 0x76, 0x78, - 0x87, 0x70, 0x20, 0x87, 0x19, 0xcc, 0x11, 0x0e, 0xec, 0x90, 0x0e, 0xe1, - 0x30, 0x0f, 0x6e, 0x30, 0x0f, 0xe3, 0xf0, 0x0e, 0xf0, 0x50, 0x0e, 0x33, - 0x10, 0xc4, 0x1d, 0xde, 0x21, 0x1c, 0xd8, 0x21, 0x1d, 0xc2, 0x61, 0x1e, - 0x66, 0x30, 0x89, 0x3b, 0xbc, 0x83, 0x3b, 0xd0, 0x43, 0x39, 0xb4, 0x03, - 0x3c, 0xbc, 0x83, 0x3c, 0x84, 0x03, 0x3b, 0xcc, 0xf0, 0x14, 0x76, 0x60, - 0x07, 0x7b, 0x68, 0x07, 0x37, 0x68, 0x87, 0x72, 0x68, 0x07, 0x37, 0x80, - 0x87, 0x70, 0x90, 0x87, 0x70, 0x60, 0x07, 0x76, 0x28, 0x07, 0x76, 0xf8, - 0x05, 0x76, 0x78, 0x87, 0x77, 0x80, 0x87, 0x5f, 0x08, 0x87, 0x71, 0x18, - 0x87, 0x72, 0x98, 0x87, 0x79, 0x98, 0x81, 0x2c, 0xee, 0xf0, 0x0e, 0xee, - 0xe0, 0x0e, 0xf5, 0xc0, 0x0e, 0xec, 0x30, 0x03, 0x62, 0xc8, 0xa1, 0x1c, - 0xe4, 0xa1, 0x1c, 0xcc, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xdc, 0x61, 0x1c, - 0xca, 0x21, 0x1c, 0xc4, 0x81, 0x1d, 0xca, 0x61, 0x06, 0xd6, 0x90, 0x43, - 0x39, 0xc8, 0x43, 0x39, 0x98, 0x43, 0x39, 0xc8, 0x43, 0x39, 0xb8, 0xc3, - 0x38, 0x94, 0x43, 0x38, 0x88, 0x03, 0x3b, 0x94, 0xc3, 0x2f, 0xbc, 0x83, - 0x3c, 0xfc, 0x82, 0x3b, 0xd4, 0x03, 0x3b, 0xb0, 0xc3, 0x0c, 0xc4, 0x21, - 0x07, 0x7c, 0x70, 0x03, 0x7a, 0x28, 0x87, 0x76, 0x80, 0x87, 0x19, 0xd1, - 0x43, 0x0e, 0xf8, 0xe0, 0x06, 0xe4, 0x20, 0x0e, 0xe7, 0xe0, 0x06, 0xf6, - 0x10, 0x0e, 0xf2, 0xc0, 0x0e, 0xe1, 0x90, 0x0f, 0xef, 0x50, 0x0f, 0xf4, - 0x00, 0x00, 0x00, 0x71, 0x20, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x06, - 0xa0, 0x6c, 0x0b, 0x32, 0x7d, 0x91, 0xc3, 0xdc, 0x9d, 0x11, 0x6c, 0xc3, - 0xe5, 0x3b, 0x8f, 0x2f, 0x04, 0x54, 0x51, 0x10, 0x51, 0xe9, 0x00, 0x43, - 0x49, 0x18, 0x80, 0x80, 0xf9, 0xc5, 0x6d, 0x5b, 0xc1, 0x36, 0x5c, 0xbe, - 0xf3, 0xf8, 0x42, 0x40, 0x15, 0x05, 0x11, 0x95, 0x0e, 0x30, 0x94, 0x84, - 0x01, 0x08, 0x98, 0x8f, 0xdc, 0xb6, 0x19, 0x48, 0xc3, 0xe5, 0x3b, 0x8f, - 0x2f, 0x44, 0x04, 0x30, 0x11, 0x21, 0xd0, 0x0c, 0x0b, 0x61, 0x01, 0xd3, - 0x70, 0xf9, 0xce, 0xe3, 0x2f, 0x0e, 0x30, 0x88, 0xcd, 0x43, 0x4d, 0x7e, - 0x71, 0xdb, 0x36, 0x50, 0x0d, 0x97, 0xef, 0x3c, 0xbe, 0x04, 0x30, 0xcf, - 0x42, 0x94, 0x44, 0x45, 0x2c, 0x7e, 0x71, 0xdb, 0x26, 0x50, 0x0d, 0x97, - 0xef, 0x3c, 0xbe, 0x34, 0x39, 0x11, 0x81, 0x52, 0xd3, 0x43, 0x4d, 0x7e, - 0x71, 0xdb, 0x00, 0x61, 0x20, 0x00, 0x00, 0x41, 0x00, 0x00, 0x00, 0x13, - 0x04, 0x41, 0x2c, 0x10, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x54, - 0x8d, 0x00, 0x10, 0x51, 0x0a, 0x25, 0x57, 0x76, 0x33, 0x00, 0xc5, 0x47, - 0x45, 0x09, 0xd0, 0x30, 0x03, 0x00, 0x00, 0x23, 0x06, 0x09, 0x00, 0x82, - 0x60, 0x60, 0x71, 0x46, 0xa4, 0x69, 0xc8, 0x88, 0x41, 0x02, 0x80, 0x20, - 0x18, 0x58, 0xdd, 0x01, 0x6d, 0x5b, 0x32, 0x62, 0x90, 0x00, 0x20, 0x08, - 0x06, 0x96, 0x87, 0x48, 0x1c, 0xa7, 0x8c, 0x18, 0x24, 0x00, 0x08, 0x82, - 0x81, 0x41, 0x06, 0x5a, 0xd7, 0x51, 0xc7, 0x88, 0x41, 0x02, 0x80, 0x20, - 0x18, 0x18, 0x65, 0xb0, 0x79, 0x9e, 0x81, 0x8c, 0x18, 0x1c, 0x00, 0x08, - 0x82, 0x01, 0x34, 0x06, 0xca, 0xf0, 0x8d, 0x26, 0x04, 0xc0, 0x68, 0x82, - 0x10, 0x8c, 0x26, 0x0c, 0xc2, 0x68, 0x02, 0x31, 0x98, 0x70, 0xc8, 0xc7, - 0x84, 0x43, 0x3e, 0x26, 0x18, 0xf0, 0x31, 0xc1, 0x80, 0xcf, 0x88, 0xc1, - 0x01, 0x80, 0x20, 0x18, 0x40, 0x6c, 0x30, 0x31, 0x69, 0x30, 0x9a, 0x10, - 0x04, 0x23, 0x06, 0x07, 0x00, 0x82, 0x60, 0x30, 0xb5, 0x41, 0xe5, 0xac, - 0xc1, 0x68, 0x42, 0x00, 0x5c, 0x30, 0xd4, 0x88, 0xc1, 0x03, 0x80, 0x20, - 0x18, 0x34, 0x72, 0x60, 0x4d, 0xd2, 0x61, 0x10, 0x54, 0x1b, 0xb4, 0x41, - 0x1b, 0x04, 0xa3, 0x09, 0x01, 0x30, 0x9a, 0x20, 0x04, 0xa3, 0x09, 0x83, - 0x30, 0x9a, 0x40, 0x0c, 0x23, 0x06, 0x09, 0x00, 0x82, 0x60, 0x80, 0xe0, - 0xc1, 0x27, 0x07, 0x72, 0x90, 0x06, 0xc4, 0x88, 0x41, 0x02, 0x80, 0x20, - 0x18, 0x20, 0x78, 0xf0, 0xc9, 0x81, 0x1c, 0x68, 0xc3, 0x88, 0x41, 0x02, - 0x80, 0x20, 0x18, 0x20, 0x78, 0xf0, 0xc9, 0x81, 0x1c, 0xa0, 0x81, 0x30, - 0x62, 0x90, 0x00, 0x20, 0x08, 0x06, 0x08, 0x1e, 0x7c, 0x72, 0x20, 0x07, - 0x67, 0x10, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + 0xd3, 0x43, 0x4d, 0x7e, 0x71, 0xdb, 0x00, 0x61, 0x20, 0x00, 0x00, 0x41, + 0x00, 0x00, 0x00, 0x13, 0x04, 0x41, 0x2c, 0x10, 0x00, 0x00, 0x00, 0x05, + 0x00, 0x00, 0x00, 0x54, 0x8d, 0x00, 0x10, 0x51, 0x0a, 0x25, 0x57, 0x76, + 0x33, 0x00, 0xc5, 0x47, 0x45, 0x09, 0xd0, 0x30, 0x03, 0x00, 0x00, 0x23, + 0x06, 0x09, 0x00, 0x82, 0x60, 0x60, 0x71, 0x46, 0xa4, 0x69, 0xc8, 0x88, + 0x41, 0x02, 0x80, 0x20, 0x18, 0x58, 0xdd, 0x01, 0x6d, 0x5b, 0x32, 0x62, + 0x90, 0x00, 0x20, 0x08, 0x06, 0x96, 0x87, 0x48, 0x1c, 0xa7, 0x8c, 0x18, + 0x24, 0x00, 0x08, 0x82, 0x81, 0x41, 0x06, 0x5a, 0xd7, 0x51, 0xc7, 0x88, + 0x41, 0x02, 0x80, 0x20, 0x18, 0x18, 0x65, 0xb0, 0x79, 0x9e, 0x81, 0x8c, + 0x18, 0x1c, 0x00, 0x08, 0x82, 0x01, 0x34, 0x06, 0xca, 0xf0, 0x8d, 0x26, + 0x04, 0xc0, 0x68, 0x82, 0x10, 0x8c, 0x26, 0x0c, 0xc2, 0x68, 0x02, 0x31, + 0x98, 0x70, 0xc8, 0xc7, 0x84, 0x43, 0x3e, 0x26, 0x18, 0xf0, 0x31, 0xc1, + 0x80, 0xcf, 0x88, 0xc1, 0x01, 0x80, 0x20, 0x18, 0x40, 0x6c, 0x30, 0x31, + 0x69, 0x30, 0x9a, 0x10, 0x04, 0x23, 0x06, 0x07, 0x00, 0x82, 0x60, 0x30, + 0xb5, 0x41, 0xe5, 0xac, 0xc1, 0x68, 0x42, 0x00, 0x5c, 0x30, 0xd4, 0x88, + 0xc1, 0x03, 0x80, 0x20, 0x18, 0x34, 0x72, 0x60, 0x4d, 0xd2, 0x61, 0x10, + 0x54, 0x1b, 0xb4, 0x41, 0x1b, 0x04, 0xa3, 0x09, 0x01, 0x30, 0x9a, 0x20, + 0x04, 0xa3, 0x09, 0x83, 0x30, 0x9a, 0x40, 0x0c, 0x23, 0x06, 0x09, 0x00, + 0x82, 0x60, 0x80, 0xe0, 0xc1, 0x27, 0x07, 0x72, 0x90, 0x06, 0xc4, 0x88, + 0x41, 0x02, 0x80, 0x20, 0x18, 0x20, 0x78, 0xf0, 0xc9, 0x81, 0x1c, 0x68, + 0xc3, 0x88, 0x41, 0x02, 0x80, 0x20, 0x18, 0x20, 0x78, 0xf0, 0xc9, 0x81, + 0x1c, 0xa0, 0x81, 0x30, 0x62, 0x90, 0x00, 0x20, 0x08, 0x06, 0x08, 0x1e, + 0x7c, 0x72, 0x20, 0x07, 0x67, 0x10, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00 }; #if 0 ; @@ -2075,7 +2124,7 @@ const unsigned char g_BlitFrom3D[] = { ; -------------------- ----- ------ -------- -------- ------- ------ ; SV_Target 0 xyzw 0 TARGET float xyzw ; -; shader hash: 3f9b5204e5a68b236febe48b54bfc9f3 +; shader hash: e88bd1fd8f6be3ae3e613ed8989b06d7 ; ; Pipeline Runtime Information: ; @@ -2203,7 +2252,7 @@ define void @BlitFromCube() { ;