mirror of https://github.com/libsdl-org/SDL.git
Compare commits
17 Commits
2041d26211
...
c05d3f625e
| Author | SHA1 | Date |
|---|---|---|
|
|
c05d3f625e | |
|
|
038a3806eb | |
|
|
e6c2649afc | |
|
|
e80d084766 | |
|
|
6aedc488d3 | |
|
|
81e3066303 | |
|
|
7d9fd48557 | |
|
|
e68f5ca99a | |
|
|
051ce0ff89 | |
|
|
5fcc83d93b | |
|
|
1bd5110ff0 | |
|
|
eb04219efe | |
|
|
d06b6e42d2 | |
|
|
c19ad189dc | |
|
|
7882e60f0e | |
|
|
e4e29b8601 | |
|
|
eb7df4807f |
161
CMakeLists.txt
161
CMakeLists.txt
|
|
@ -7,6 +7,11 @@ endif()
|
|||
# See docs/release_checklist.md
|
||||
project(SDL3 LANGUAGES C VERSION "3.3.0")
|
||||
|
||||
if(GDK_GAMING_XBOX)
|
||||
# FIXME: Setting the standard of individual files doesn't seem to work properly
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
endif()
|
||||
|
||||
if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
|
||||
set(SDL3_MAINPROJECT ON)
|
||||
else()
|
||||
|
|
@ -331,8 +336,8 @@ dep_option(SDL_DISKAUDIO "Support the disk writer audio driver" ON "SD
|
|||
dep_option(SDL_DUMMYAUDIO "Support the dummy audio driver" ON "SDL_AUDIO" OFF)
|
||||
dep_option(SDL_DUMMYVIDEO "Use dummy video driver" ON "SDL_VIDEO" OFF)
|
||||
dep_option(SDL_IBUS "Enable IBus support" ON "${UNIX_SYS}" OFF)
|
||||
dep_option(SDL_OPENGL "Include OpenGL support" ON "SDL_VIDEO;NOT IOS;NOT VISIONOS;NOT TVOS;NOT WATCHOS" OFF)
|
||||
dep_option(SDL_OPENGLES "Include OpenGL ES support" ON "SDL_VIDEO;NOT VISIONOS;NOT TVOS;NOT WATCHOS" OFF)
|
||||
dep_option(SDL_OPENGL "Include OpenGL support" ON "SDL_VIDEO;NOT IOS;NOT VISIONOS;NOT TVOS;NOT WATCHOS;NOT GDK_GAMING_XBOX" OFF)
|
||||
dep_option(SDL_OPENGLES "Include OpenGL ES support" ON "SDL_VIDEO;NOT VISIONOS;NOT TVOS;NOT WATCHOS;NOT GDK_GAMING_XBOX" OFF)
|
||||
set_option(SDL_PTHREADS "Use POSIX threads for multi-threading" ${SDL_PTHREADS_DEFAULT})
|
||||
dep_option(SDL_PTHREADS_SEM "Use pthread semaphores" ON "SDL_PTHREADS" OFF)
|
||||
dep_option(SDL_OSS "Support the OSS audio API" ${SDL_OSS_DEFAULT} "UNIX_SYS OR RISCOS;SDL_AUDIO" OFF)
|
||||
|
|
@ -375,8 +380,8 @@ dep_option(SDL_RENDER_D3D12 "Enable the Direct3D 12 render driver" ON "SD
|
|||
dep_option(SDL_RENDER_METAL "Enable the Metal render driver" ON "SDL_RENDER;${APPLE}" OFF)
|
||||
dep_option(SDL_RENDER_GPU "Enable the SDL_GPU render driver" ON "SDL_RENDER;SDL_GPU" OFF)
|
||||
dep_option(SDL_VIVANTE "Use Vivante EGL video driver" ON "${UNIX_SYS};SDL_CPU_ARM32" OFF)
|
||||
dep_option(SDL_VULKAN "Enable Vulkan support" ON "SDL_VIDEO;ANDROID OR APPLE OR LINUX OR FREEBSD OR WINDOWS" OFF)
|
||||
dep_option(SDL_RENDER_VULKAN "Enable the Vulkan render driver" ON "SDL_RENDER;SDL_VULKAN" OFF)
|
||||
dep_option(SDL_VULKAN "Enable Vulkan support" ON "SDL_VIDEO;ANDROID OR APPLE OR LINUX OR FREEBSD OR WINDOWS;NOT GDK_GAMING_XBOX" OFF)
|
||||
dep_option(SDL_RENDER_VULKAN "Enable the Vulkan render driver" ON "SDL_RENDER;SDL_VULKAN;NOT GDK_GAMING_XBOX" OFF)
|
||||
dep_option(SDL_METAL "Enable Metal support" ON "APPLE" OFF)
|
||||
set_option(SDL_OPENVR "Use OpenVR video driver" OFF)
|
||||
dep_option(SDL_KMSDRM "Use KMS DRM video driver" ${UNIX_SYS} "SDL_VIDEO" OFF)
|
||||
|
|
@ -385,11 +390,11 @@ set_option(SDL_OFFSCREEN "Use offscreen video driver" ON)
|
|||
dep_option(SDL_DUMMYCAMERA "Support the dummy camera driver" ON SDL_CAMERA OFF)
|
||||
option_string(SDL_BACKGROUNDING_SIGNAL "number to use for magic backgrounding signal or 'OFF'" OFF)
|
||||
option_string(SDL_FOREGROUNDING_SIGNAL "number to use for magic foregrounding signal or 'OFF'" OFF)
|
||||
dep_option(SDL_HIDAPI "Enable the HIDAPI subsystem" ON "NOT VISIONOS" OFF)
|
||||
dep_option(SDL_HIDAPI "Enable the HIDAPI subsystem" ON "NOT VISIONOS;NOT GDK_GAMING_XBOX" OFF)
|
||||
dep_option(SDL_HIDAPI_LIBUSB "Use libusb for low level joystick drivers" ON SDL_HIDAPI_LIBUSB_AVAILABLE OFF)
|
||||
dep_option(SDL_HIDAPI_LIBUSB_SHARED "Dynamically load libusb support" ON "SDL_HIDAPI_LIBUSB;SDL_DEPS_SHARED" OFF)
|
||||
dep_option(SDL_HIDAPI_JOYSTICK "Use HIDAPI for low level joystick drivers" ON SDL_HIDAPI OFF)
|
||||
dep_option(SDL_VIRTUAL_JOYSTICK "Enable the virtual-joystick driver" ON SDL_HIDAPI OFF)
|
||||
dep_option(SDL_VIRTUAL_JOYSTICK "Enable the virtual-joystick driver" ON "SDL_HIDAPI OR GDK_GAMING_XBOX" OFF)
|
||||
set_option(SDL_LIBUDEV "Enable libudev support" ON)
|
||||
set_option(SDL_ASAN "Use AddressSanitizer to detect memory errors" OFF)
|
||||
set_option(SDL_CCACHE "Use Ccache to speed up build" OFF)
|
||||
|
|
@ -441,6 +446,32 @@ if(SDL_PRESEED)
|
|||
SDL_Preseed_CMakeCache()
|
||||
endif()
|
||||
|
||||
if(GDK_GAMING_XBOX)
|
||||
if(GDK_GAMING_XBOX_ONE)
|
||||
message(STATUS "Building shader blobs (Xbox One)")
|
||||
execute_process(
|
||||
COMMAND cmd.exe /Q /c "${SDL3_SOURCE_DIR}/src/render/direct3d12/compile_shaders_xbox.bat ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} one"
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
||||
execute_process(
|
||||
COMMAND cmd.exe /Q /c "${SDL3_SOURCE_DIR}/src/gpu/d3d12/compile_shaders_xbox.bat ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} one"
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
||||
elseif(GDK_GAMING_XBOX_SCARLETT)
|
||||
message(STATUS "Building shader blobs (Xbox Series)")
|
||||
execute_process(
|
||||
COMMAND cmd.exe /Q /c "${SDL3_SOURCE_DIR}/src/render/direct3d12/compile_shaders_xbox.bat ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}"
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
||||
execute_process(
|
||||
COMMAND cmd.exe /Q /c "${SDL3_SOURCE_DIR}/src/gpu/d3d12/compile_shaders_xbox.bat ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}"
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
||||
else()
|
||||
message(FATAL_ERROR "Unknown Xbox system")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(SDL_SHARED)
|
||||
add_library(SDL3-shared SHARED)
|
||||
add_library(SDL3::SDL3-shared ALIAS SDL3-shared)
|
||||
|
|
@ -1055,6 +1086,10 @@ if(SDL_LIBC)
|
|||
strcasestr
|
||||
)
|
||||
endif()
|
||||
if(GDK_GAMING_XBOX)
|
||||
list(REMOVE_ITEM symbols_to_check itoa)
|
||||
endif()
|
||||
|
||||
check_library_exists(m pow "" HAVE_LIBM)
|
||||
cmake_push_check_state()
|
||||
if(HAVE_LIBM)
|
||||
|
|
@ -1922,6 +1957,9 @@ elseif(WINDOWS)
|
|||
sdl_glob_sources("${SDL3_SOURCE_DIR}/src/core/windows/*.cpp")
|
||||
sdl_glob_sources("${SDL3_SOURCE_DIR}/src/main/windows/*.c")
|
||||
sdl_glob_sources("${SDL3_SOURCE_DIR}/src/io/windows/*.c")
|
||||
if(GDK_GAMING_XBOX)
|
||||
sdl_sources("${SDL3_SOURCE_DIR}/src/main/gdk/SDL_sysmain_runapp.cpp")
|
||||
endif()
|
||||
|
||||
if(TARGET SDL3-shared AND MSVC AND NOT SDL_LIBC)
|
||||
# Prevent codegen that would use the VC runtime libraries.
|
||||
|
|
@ -1955,10 +1993,19 @@ 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)
|
||||
check_include_file(dxgi.h HAVE_DXGI_H)
|
||||
# FIXME: Not sure why, avoiding the above still keeps "HAVE_DDRAW_H" and friends being 1?
|
||||
if(GDK_GAMING_XBOX)
|
||||
set(HAVE_D3D9_H 0)
|
||||
set(HAVE_D3D11_H 0)
|
||||
set(HAVE_DDRAW_H 0)
|
||||
set(HAVE_DSOUND_H 0)
|
||||
set(HAVE_DINPUT_H 0)
|
||||
set(HAVE_DXGI_H 0)
|
||||
endif()
|
||||
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)
|
||||
cmake_pop_check_state()
|
||||
if(HAVE_D3D9_H OR HAVE_D3D11_H OR HAVE_DDRAW_H OR HAVE_DSOUND_H OR HAVE_DINPUT_H)
|
||||
set(HAVE_DIRECTX TRUE)
|
||||
|
|
@ -1989,6 +2036,10 @@ elseif(WINDOWS)
|
|||
static __x_ABI_CWindows_CGaming_CInput_CIGamepadStatics2 *s2;
|
||||
int main(int argc, char **argv) { return 0; }" HAVE_WINDOWS_GAMING_INPUT_H
|
||||
)
|
||||
# FIXME: Avoiding the check above still marks it as 1
|
||||
if(GDK_GAMING_XBOX)
|
||||
set(HAVE_WINDOWS_GAMING_INPUT_H 0)
|
||||
endif()
|
||||
check_c_source_compiles("
|
||||
#include <stdbool.h>
|
||||
#define COBJMACROS
|
||||
|
|
@ -2003,6 +2054,11 @@ elseif(WINDOWS)
|
|||
check_include_file(sensorsapi.h HAVE_SENSORSAPI_H)
|
||||
check_include_file(shellscalingapi.h HAVE_SHELLSCALINGAPI_H)
|
||||
check_include_file(shobjidl_core.h HAVE_SHOBJIDL_CORE_H)
|
||||
# FIXME: removing the checks didn't work?
|
||||
if(GDK_GAMING_XBOX)
|
||||
set(HAVE_ROAPI_H 0)
|
||||
set(HAVE_SHELLSCALINGAPI_H 0)
|
||||
endif()
|
||||
check_c_source_compiles("
|
||||
#include <windows.h>
|
||||
#include <mfapi.h>
|
||||
|
|
@ -2034,17 +2090,35 @@ elseif(WINDOWS)
|
|||
|
||||
CheckOpenVR()
|
||||
|
||||
if(SDL_RENDER_D3D AND HAVE_D3D9_H)
|
||||
if(SDL_RENDER_D3D AND HAVE_D3D9_H AND NOT GDK_GAMING_XBOX)
|
||||
set(SDL_VIDEO_RENDER_D3D 1)
|
||||
set(HAVE_RENDER_D3D TRUE)
|
||||
endif()
|
||||
if(SDL_RENDER_D3D11 AND HAVE_D3D11_H)
|
||||
if(GDK_GAMING_XBOX)
|
||||
set_source_files_properties("${SDL3_SOURCE_DIR}/src/render/direct3d/SDL_render_d3d.c" PROPERTIES LANGUAGE CXX)
|
||||
sdl_sources("${SDL3_SOURCE_DIR}/src/video/gdk/SDL_gdktextinput.cpp")
|
||||
endif()
|
||||
if(SDL_RENDER_D3D11 AND HAVE_D3D11_H AND NOT GDK_GAMING_XBOX)
|
||||
set(SDL_VIDEO_RENDER_D3D11 1)
|
||||
set(HAVE_RENDER_D3D11 TRUE)
|
||||
endif()
|
||||
if(SDL_RENDER_D3D12)
|
||||
set(SDL_VIDEO_RENDER_D3D12 1)
|
||||
set(HAVE_RENDER_D3D12 TRUE)
|
||||
if(GDK_GAMING_XBOX)
|
||||
set_source_files_properties("${SDL3_SOURCE_DIR}/src/render/direct3d12/SDL_render_d3d12.c" PROPERTIES LANGUAGE CXX)
|
||||
sdl_sources("${SDL3_SOURCE_DIR}/src/render/direct3d12/SDL_render_d3d12_xbox.cpp")
|
||||
if(GDK_GAMING_XBOX_ONE)
|
||||
sdl_sources("${SDL3_SOURCE_DIR}/src/render/direct3d12/SDL_shaders_d3d12_xboxone.cpp")
|
||||
# TODO: This should also happen for "SDL_GPU && !(SDL_RENDER)"
|
||||
sdl_link_dependency(d3d12 LIBS d3d12_x.lib)
|
||||
elseif(GDK_GAMING_XBOX_SCARLETT)
|
||||
sdl_sources("${SDL3_SOURCE_DIR}/src/render/direct3d12/SDL_shaders_d3d12_xboxseries.cpp")
|
||||
sdl_link_dependency(d3d12 LIBS d3d12_xs.lib)
|
||||
else()
|
||||
message(FATAL_ERROR "Unknown Xbox system")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
set(HAVE_SDL_VIDEO TRUE)
|
||||
endif()
|
||||
|
|
@ -2065,14 +2139,18 @@ elseif(WINDOWS)
|
|||
|
||||
set(HAVE_SDL_THREADS TRUE)
|
||||
|
||||
if(SDL_SENSOR AND HAVE_SENSORSAPI_H)
|
||||
if(SDL_SENSOR AND HAVE_SENSORSAPI_H AND NOT GDK_GAMING_XBOX)
|
||||
set(SDL_SENSOR_WINDOWS 1)
|
||||
set(HAVE_SDL_SENSORS TRUE)
|
||||
sdl_glob_sources("${SDL3_SOURCE_DIR}/src/sensor/windows/*.c")
|
||||
endif()
|
||||
|
||||
if(SDL_POWER)
|
||||
set(SDL_POWER_WINDOWS 1)
|
||||
if(GDK_GAMING_XBOX)
|
||||
set(SDL_POWER_HARDWIRED 1)
|
||||
else()
|
||||
set(SDL_POWER_WINDOWS 1)
|
||||
endif()
|
||||
sdl_sources("${SDL3_SOURCE_DIR}/src/power/windows/SDL_syspower.c")
|
||||
set(HAVE_SDL_POWER TRUE)
|
||||
endif()
|
||||
|
|
@ -2080,8 +2158,15 @@ elseif(WINDOWS)
|
|||
sdl_glob_sources("${SDL3_SOURCE_DIR}/src/locale/windows/*.c")
|
||||
set(HAVE_SDL_LOCALE TRUE)
|
||||
|
||||
set(SDL_FILESYSTEM_WINDOWS 1)
|
||||
sdl_glob_sources("${SDL3_SOURCE_DIR}/src/filesystem/windows/*.c")
|
||||
if(NOT GDK_GAMING_XBOX)
|
||||
set(SDL_FILESYSTEM_WINDOWS 1)
|
||||
endif()
|
||||
file(GLOB SDL3_WIN_FILESYSTEM_FILES "${SDL3_SOURCE_DIR}/src/filesystem/windows/*.c")
|
||||
if(GDK_GAMING_XBOX)
|
||||
list(REMOVE_ITEM SDL3_WIN_FILESYSTEM_FILES "${SDL3_SOURCE_DIR}/src/filesystem/windows/SDL_sysfilesystem.c")
|
||||
sdl_sources("${SDL3_SOURCE_DIR}/src/filesystem/gdk/SDL_sysfilesystem.cpp")
|
||||
endif()
|
||||
sdl_glob_sources("${SDL3_WIN_FILESYSTEM_FILES}")
|
||||
set(HAVE_SDL_FILESYSTEM TRUE)
|
||||
|
||||
set(SDL_FSOPS_WINDOWS 1)
|
||||
|
|
@ -2094,7 +2179,14 @@ elseif(WINDOWS)
|
|||
set(HAVE_SDL_STORAGE 1)
|
||||
|
||||
# Libraries for Win32 native and MinGW
|
||||
sdl_link_dependency(base LIBS kernel32 user32 gdi32 winmm imm32 ole32 oleaut32 version uuid advapi32 setupapi shell32)
|
||||
if(GDK_GAMING_XBOX)
|
||||
add_link_options("/NODEFAULTLIB")
|
||||
# Needed to inherit base dependencies, specifically to link XblInitialize correctly
|
||||
set(CMAKE_CXX_STANDARD_LIBRARIES "$(CMAKE_CXX_STANDARD_LIBRARIES) %(AdditionalDependencies) ")
|
||||
sdl_link_dependency(base LIBS xgameplatform xgameruntime xmem pixevt)
|
||||
else()
|
||||
sdl_link_dependency(base LIBS kernel32 user32 gdi32 winmm imm32 ole32 oleaut32 version uuid advapi32 setupapi shell32)
|
||||
endif()
|
||||
|
||||
set(SDL_TIME_WINDOWS 1)
|
||||
sdl_glob_sources("${SDL3_SOURCE_DIR}/src/time/windows/*.c")
|
||||
|
|
@ -2109,6 +2201,10 @@ elseif(WINDOWS)
|
|||
set(HAVE_SDL_LOADSO TRUE)
|
||||
|
||||
sdl_glob_sources("${SDL3_SOURCE_DIR}/src/core/windows/*.c")
|
||||
if(GDK_GAMING_XBOX)
|
||||
sdl_sources("${SDL3_SOURCE_DIR}/src/core/gdk/SDL_gdk.cpp")
|
||||
# sdl_sources("${SDL3_SOURCE_DIR}/src/core/windows/pch_cpp.cpp")
|
||||
endif()
|
||||
|
||||
if(SDL_VIDEO)
|
||||
if(SDL_OPENGL)
|
||||
|
|
@ -2134,8 +2230,10 @@ elseif(WINDOWS)
|
|||
endif()
|
||||
endif()
|
||||
|
||||
sdl_glob_sources("${SDL3_SOURCE_DIR}/src/tray/windows/*.c")
|
||||
set(HAVE_SDL_TRAY TRUE)
|
||||
if(NOT GDK_GAMING_XBOX)
|
||||
sdl_glob_sources("${SDL3_SOURCE_DIR}/src/tray/windows/*.c")
|
||||
set(HAVE_SDL_TRAY TRUE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(SDL_HIDAPI)
|
||||
|
|
@ -2144,23 +2242,37 @@ elseif(WINDOWS)
|
|||
|
||||
if(SDL_JOYSTICK)
|
||||
sdl_glob_sources("${SDL3_SOURCE_DIR}/src/joystick/windows/*.c")
|
||||
if (GDK_GAMING_XBOX)
|
||||
set_source_files_properties("${SDL3_SOURCE_DIR}/src/joystick/windows/SDL_windowsjoystick.c" PROPERTIES LANGUAGE CXX CXX_STANDARD 17)
|
||||
set_source_files_properties("${SDL3_SOURCE_DIR}/src/joystick/windows/SDL_xinputjoystick.c" PROPERTIES LANGUAGE CXX CXX_STANDARD 17)
|
||||
sdl_sources("${SDL3_SOURCE_DIR}/src/joystick/gdk/SDL_gameinputjoystick.c")
|
||||
endif()
|
||||
|
||||
set(SDL_JOYSTICK_RAWINPUT 1)
|
||||
if(NOT GDK_GAMING_XBOX)
|
||||
set(SDL_JOYSTICK_RAWINPUT 1)
|
||||
endif()
|
||||
if(HAVE_DINPUT_H)
|
||||
set(SDL_JOYSTICK_DINPUT 1)
|
||||
sdl_link_dependency(joystick LIBS dinput8)
|
||||
endif()
|
||||
if(HAVE_XINPUT_H)
|
||||
if(HAVE_XINPUT_H AND NOT GDK_GAMING_XBOX)
|
||||
set(SDL_JOYSTICK_XINPUT 1)
|
||||
set(HAVE_XINPUT TRUE)
|
||||
endif()
|
||||
if(HAVE_WINDOWS_GAMING_INPUT_H)
|
||||
if(GDK_GAMING_XBOX)
|
||||
set_source_files_properties("${SDL3_SOURCE_DIR}/src/core/windows/SDL_xinput.c" PROPERTIES LANGUAGE CXX CXX_STANDARD 17)
|
||||
endif()
|
||||
if(HAVE_WINDOWS_GAMING_INPUT_H AND NOT GDK_GAMING_XBOX)
|
||||
set(SDL_JOYSTICK_WGI 1)
|
||||
endif()
|
||||
if(HAVE_GAMEINPUT_H)
|
||||
sdl_glob_sources("${SDL3_SOURCE_DIR}/src/joystick/gdk/*.cpp")
|
||||
set(SDL_JOYSTICK_GAMEINPUT 1)
|
||||
endif()
|
||||
if(GDK_GAMING_DESKTOP OR GDK_GAMING_XBOX)
|
||||
set(SDL_GDK_TEXTINPUT 1)
|
||||
set(SDL_DISABLE_WINDOWS_IME 1)
|
||||
endif()
|
||||
set(HAVE_SDL_JOYSTICK TRUE)
|
||||
|
||||
if(SDL_HAPTIC)
|
||||
|
|
@ -2168,6 +2280,9 @@ elseif(WINDOWS)
|
|||
sdl_glob_sources("${SDL3_SOURCE_DIR}/src/haptic/windows/*.c")
|
||||
set(SDL_HAPTIC_DINPUT 1)
|
||||
set(HAVE_SDL_HAPTIC TRUE)
|
||||
if(GDK_GAMING_XBOX)
|
||||
set_source_files_properties("${SDL3_SOURCE_DIR}/src/haptic/windows/SDL_windowshaptic.c" PROPERTIES LANGUAGE CXX CXX_STANDARD 17)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
|
@ -3041,7 +3156,7 @@ if (SDL_DIALOG)
|
|||
elseif(HAIKU)
|
||||
sdl_sources(${SDL3_SOURCE_DIR}/src/dialog/haiku/SDL_haikudialog.cc)
|
||||
set(HAVE_SDL_DIALOG TRUE)
|
||||
elseif(WINDOWS)
|
||||
elseif(WINDOWS AND NOT GDK_GAMING_XBOX)
|
||||
sdl_sources(${SDL3_SOURCE_DIR}/src/dialog/windows/SDL_windowsdialog.c)
|
||||
set(HAVE_SDL_DIALOG TRUE)
|
||||
elseif(MACOS)
|
||||
|
|
@ -3051,7 +3166,7 @@ if (SDL_DIALOG)
|
|||
endif()
|
||||
|
||||
sdl_sources("${SDL3_SOURCE_DIR}/src/process/SDL_process.c")
|
||||
if(WINDOWS)
|
||||
if(WINDOWS AND NOT GDK_GAMING_XBOX)
|
||||
sdl_glob_sources("${SDL3_SOURCE_DIR}/src/process/windows/*.c")
|
||||
set(SDL_PROCESS_WINDOWS 1)
|
||||
set(HAVE_SDL_PROCESS TRUE)
|
||||
|
|
@ -3120,6 +3235,10 @@ if(SDL_GPU)
|
|||
endif()
|
||||
if(WINDOWS)
|
||||
sdl_glob_sources("${SDL3_SOURCE_DIR}/src/gpu/d3d12/*.c")
|
||||
sdl_glob_sources("${SDL3_SOURCE_DIR}/src/gpu/d3d12/*.cpp")
|
||||
if(GDK_GAMING_XBOX)
|
||||
set_source_files_properties("${SDL3_SOURCE_DIR}/src/gpu/d3d12/SDL_gpu_d3d12.c" PROPERTIES LANGUAGE CXX CXX_STANDARD 17)
|
||||
endif()
|
||||
set(SDL_GPU_D3D12 1)
|
||||
set(HAVE_SDL_GPU TRUE)
|
||||
endif()
|
||||
|
|
|
|||
|
|
@ -1021,7 +1021,8 @@ extern SDL_DECLSPEC void SDLCALL SDL_UnbindAudioStream(SDL_AudioStream *stream);
|
|||
/**
|
||||
* Query an audio stream for its currently-bound device.
|
||||
*
|
||||
* This reports the audio device that an audio stream is currently bound to.
|
||||
* This reports the logical audio device that an audio stream is currently
|
||||
* bound to.
|
||||
*
|
||||
* If not bound, or invalid, this returns zero, which is not a valid device
|
||||
* ID.
|
||||
|
|
|
|||
|
|
@ -135,7 +135,8 @@ typedef enum SDL_EventType
|
|||
/* 0x201 was SDL_SYSWMEVENT, reserve the number for sdl2-compat */
|
||||
SDL_EVENT_WINDOW_SHOWN = 0x202, /**< Window has been shown */
|
||||
SDL_EVENT_WINDOW_HIDDEN, /**< Window has been hidden */
|
||||
SDL_EVENT_WINDOW_EXPOSED, /**< Window has been exposed and should be redrawn, and can be redrawn directly from event watchers for this event */
|
||||
SDL_EVENT_WINDOW_EXPOSED, /**< Window has been exposed and should be redrawn, and can be redrawn directly from event watchers for this event.
|
||||
data1 is 1 for live-resize expose events, 0 otherwise. */
|
||||
SDL_EVENT_WINDOW_MOVED, /**< Window has been moved to data1, data2 */
|
||||
SDL_EVENT_WINDOW_RESIZED, /**< Window has been resized to data1xdata2 */
|
||||
SDL_EVENT_WINDOW_PIXEL_SIZE_CHANGED,/**< The pixel size of the window has changed to data1xdata2 */
|
||||
|
|
|
|||
|
|
@ -1415,6 +1415,7 @@ static int SDLCALL RecordingAudioThread(void *devicep) // thread entry point
|
|||
typedef struct CountAudioDevicesData
|
||||
{
|
||||
int devs_seen;
|
||||
int devs_skipped;
|
||||
const int num_devices;
|
||||
SDL_AudioDeviceID *result;
|
||||
const bool recording;
|
||||
|
|
@ -1430,7 +1431,13 @@ static bool SDLCALL CountAudioDevices(void *userdata, const SDL_HashTable *table
|
|||
const bool isphysical = !!(devid & (1<<1));
|
||||
if (isphysical && (devid_recording == data->recording)) {
|
||||
SDL_assert(data->devs_seen < data->num_devices);
|
||||
data->result[data->devs_seen++] = devid;
|
||||
SDL_AudioDevice *device = (SDL_AudioDevice *) value; // this is normally risky, but we hold the device_hash_lock here.
|
||||
const bool zombie = SDL_GetAtomicInt(&device->zombie) != 0;
|
||||
if (zombie) {
|
||||
data->devs_skipped++;
|
||||
} else {
|
||||
data->result[data->devs_seen++] = devid;
|
||||
}
|
||||
}
|
||||
return true; // keep iterating.
|
||||
}
|
||||
|
|
@ -1446,10 +1453,11 @@ static SDL_AudioDeviceID *GetAudioDevices(int *count, bool recording)
|
|||
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) {
|
||||
CountAudioDevicesData data = { 0, num_devices, result, recording };
|
||||
CountAudioDevicesData data = { 0, 0, num_devices, result, recording };
|
||||
SDL_IterateHashTable(current_audio.device_hash, CountAudioDevices, &data);
|
||||
SDL_assert(data.devs_seen == num_devices);
|
||||
result[data.devs_seen] = 0; // null-terminated.
|
||||
SDL_assert((data.devs_seen + data.devs_skipped) == num_devices);
|
||||
num_devices = data.devs_seen; // might be less if we skipped any.
|
||||
result[num_devices] = 0; // null-terminated.
|
||||
}
|
||||
}
|
||||
SDL_UnlockRWLock(current_audio.device_hash_lock);
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@
|
|||
|
||||
#include "../SDL_sysaudio.h"
|
||||
#include "SDL_alsa_audio.h"
|
||||
#include "../../core/linux/SDL_udev.h"
|
||||
|
||||
#if SDL_ALSA_DEBUG
|
||||
#define LOGDEBUG(...) SDL_LogDebug(SDL_LOG_CATEGORY_AUDIO, "ALSA: " __VA_ARGS__)
|
||||
|
|
@ -351,21 +352,22 @@ static bool ALSA_WaitDevice(SDL_AudioDevice *device)
|
|||
const int sample_frames = device->sample_frames;
|
||||
const int fulldelay = (int) ((((Uint64) sample_frames) * 1000) / device->spec.freq);
|
||||
const int delay = SDL_clamp(fulldelay, 1, 5);
|
||||
int total_delays = 0;
|
||||
|
||||
SDL_assert(fulldelay > 0); // so the `fulldelay * 5` below produces a reasonable result.
|
||||
|
||||
while (!SDL_GetAtomicInt(&device->shutdown) && (ALSA_snd_pcm_avail(device->hidden->pcm) < sample_frames)) {
|
||||
if (total_delays >= (fulldelay * 5)) {
|
||||
// Hmm, not much we can do - abort
|
||||
SDL_LogError(SDL_LOG_CATEGORY_AUDIO, "ALSA: hardware seems to have frozen, giving up on it.");
|
||||
return false;
|
||||
} else {
|
||||
SDL_Delay(delay);
|
||||
total_delays += delay; // THIS IS NOT EXACT, but just so we don't wait forever on problems...
|
||||
while (!SDL_GetAtomicInt(&device->shutdown)) {
|
||||
const int rc = ALSA_snd_pcm_avail(device->hidden->pcm);
|
||||
if (rc < 0) {
|
||||
const int status = ALSA_snd_pcm_recover(device->hidden->pcm, rc, 0);
|
||||
if (status < 0) {
|
||||
// Hmm, not much we can do - abort
|
||||
SDL_LogError(SDL_LOG_CATEGORY_AUDIO, "ALSA wait failed (unrecoverable): %s", ALSA_snd_strerror(rc));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (rc >= sample_frames) {
|
||||
break;
|
||||
}
|
||||
SDL_Delay(delay);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -1444,6 +1446,65 @@ static int SDLCALL ALSA_HotplugThread(void *arg)
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef SDL_USE_LIBUDEV
|
||||
|
||||
static bool udev_initialized;
|
||||
|
||||
static void ALSA_udev_callback(SDL_UDEV_deviceevent udev_type, int udev_class, const char *devpath)
|
||||
{
|
||||
if (!devpath) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch (udev_type) {
|
||||
case SDL_UDEV_DEVICEADDED:
|
||||
ALSA_HotplugIteration(NULL, NULL);
|
||||
break;
|
||||
|
||||
case SDL_UDEV_DEVICEREMOVED:
|
||||
ALSA_HotplugIteration(NULL, NULL);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static bool ALSA_start_udev()
|
||||
{
|
||||
udev_initialized = SDL_UDEV_Init();
|
||||
if (udev_initialized) {
|
||||
// Set up the udev callback
|
||||
if (!SDL_UDEV_AddCallback(ALSA_udev_callback)) {
|
||||
SDL_UDEV_Quit();
|
||||
udev_initialized = false;
|
||||
}
|
||||
}
|
||||
return udev_initialized;
|
||||
}
|
||||
|
||||
static void ALSA_stop_udev()
|
||||
{
|
||||
if (udev_initialized) {
|
||||
SDL_UDEV_DelCallback(ALSA_udev_callback);
|
||||
SDL_UDEV_Quit();
|
||||
udev_initialized = false;
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
static bool ALSA_start_udev()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
static void ALSA_stop_udev()
|
||||
{
|
||||
}
|
||||
|
||||
#endif // SDL_USE_LIBUDEV
|
||||
|
||||
static void ALSA_DetectDevices(SDL_AudioDevice **default_playback, SDL_AudioDevice **default_recording)
|
||||
{
|
||||
ALSA_guess_device_prefix();
|
||||
|
|
@ -1459,11 +1520,13 @@ static void ALSA_DetectDevices(SDL_AudioDevice **default_playback, SDL_AudioDevi
|
|||
*default_recording = SDL_AddAudioDevice(/*recording=*/true, "ALSA default recording device", NULL, (void *)&default_recording_handle);
|
||||
}
|
||||
|
||||
if (!ALSA_start_udev()) {
|
||||
#if SDL_ALSA_HOTPLUG_THREAD
|
||||
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.
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
static void ALSA_DeinitializeStart(void)
|
||||
|
|
@ -1478,6 +1541,7 @@ static void ALSA_DeinitializeStart(void)
|
|||
ALSA_hotplug_thread = NULL;
|
||||
}
|
||||
#endif
|
||||
ALSA_stop_udev();
|
||||
|
||||
// Shutting down! Clean up any data we've gathered.
|
||||
for (dev = hotplug_devices; dev; dev = next) {
|
||||
|
|
|
|||
|
|
@ -371,10 +371,10 @@ static const SDL_Scancode xfree86_scancode_table2[] = {
|
|||
/* 188, 0x0bc */ SDL_SCANCODE_F18, // XF86Launch9
|
||||
/* 189, 0x0bd */ SDL_SCANCODE_F19, // NoSymbol
|
||||
/* 190, 0x0be */ SDL_SCANCODE_F20, // XF86AudioMicMute
|
||||
/* 191, 0x0bf */ SDL_SCANCODE_UNKNOWN, // XF86TouchpadToggle
|
||||
/* 192, 0x0c0 */ SDL_SCANCODE_UNKNOWN, // XF86TouchpadOn
|
||||
/* 193, 0x0c1 */ SDL_SCANCODE_UNKNOWN, // XF86TouchpadOff
|
||||
/* 194, 0x0c2 */ SDL_SCANCODE_UNKNOWN, // NoSymbol
|
||||
/* 191, 0x0bf */ SDL_SCANCODE_F21, // XF86TouchpadToggle
|
||||
/* 192, 0x0c0 */ SDL_SCANCODE_F22, // XF86TouchpadOn
|
||||
/* 193, 0x0c1 */ SDL_SCANCODE_F23, // XF86TouchpadOff
|
||||
/* 194, 0x0c2 */ SDL_SCANCODE_F24, // NoSymbol
|
||||
/* 195, 0x0c3 */ SDL_SCANCODE_MODE, // Mode_switch
|
||||
/* 196, 0x0c4 */ SDL_SCANCODE_UNKNOWN, // NoSymbol
|
||||
/* 197, 0x0c5 */ SDL_SCANCODE_UNKNOWN, // NoSymbol
|
||||
|
|
|
|||
|
|
@ -71,6 +71,11 @@ extern "C" {
|
|||
#define DETACH_KERNEL_DRIVER
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:5287) /* operands are different enum types */
|
||||
#endif
|
||||
|
||||
/* Uncomment to enable the retrieval of Usage and Usage Page in
|
||||
hid_enumerate(). Warning, on platforms different from FreeBSD
|
||||
this is very invasive as it requires the detach
|
||||
|
|
@ -2144,6 +2149,10 @@ uint16_t get_usb_code_for_current_locale(void)
|
|||
return 0x0;
|
||||
}
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning (pop)
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -979,7 +979,7 @@ static bool LoadStickCalibration(SDL_DriverSwitch_Context *ctx)
|
|||
/* Stick calibration values are 12-bits each and are packed by bit
|
||||
* For whatever reason the fields are in a different order for each stick
|
||||
* Left: X-Max, Y-Max, X-Center, Y-Center, X-Min, Y-Min
|
||||
* Right: X-Center, Y-Center, X-Min, Y-Min, X-Max, Y-Max
|
||||
* Right: X-Center, Y-Center, X-Max, Y-Max, X-Min, Y-Min
|
||||
*/
|
||||
|
||||
// Left stick
|
||||
|
|
@ -993,10 +993,10 @@ static bool LoadStickCalibration(SDL_DriverSwitch_Context *ctx)
|
|||
// Right stick
|
||||
ctx->m_StickCalData[1].axis[0].sCenter = ((pRightStickCal[1] << 8) & 0xF00) | pRightStickCal[0]; // X Axis center
|
||||
ctx->m_StickCalData[1].axis[1].sCenter = (pRightStickCal[2] << 4) | (pRightStickCal[1] >> 4); // Y Axis center
|
||||
ctx->m_StickCalData[1].axis[0].sMin = ((pRightStickCal[4] << 8) & 0xF00) | pRightStickCal[3]; // X Axis min below center
|
||||
ctx->m_StickCalData[1].axis[1].sMin = (pRightStickCal[5] << 4) | (pRightStickCal[4] >> 4); // Y Axis min below center
|
||||
ctx->m_StickCalData[1].axis[0].sMax = ((pRightStickCal[7] << 8) & 0xF00) | pRightStickCal[6]; // X Axis max above center
|
||||
ctx->m_StickCalData[1].axis[1].sMax = (pRightStickCal[8] << 4) | (pRightStickCal[7] >> 4); // Y Axis max above center
|
||||
ctx->m_StickCalData[1].axis[0].sMax = ((pRightStickCal[4] << 8) & 0xF00) | pRightStickCal[3]; // X Axis max above center
|
||||
ctx->m_StickCalData[1].axis[1].sMax = (pRightStickCal[5] << 4) | (pRightStickCal[4] >> 4); // Y Axis max above center
|
||||
ctx->m_StickCalData[1].axis[0].sMin = ((pRightStickCal[7] << 8) & 0xF00) | pRightStickCal[6]; // X Axis min below center
|
||||
ctx->m_StickCalData[1].axis[1].sMin = (pRightStickCal[8] << 4) | (pRightStickCal[7] >> 4); // Y Axis min below center
|
||||
|
||||
// Filter out any values that were uninitialized (0xFFF) in the SPI read
|
||||
for (stick = 0; stick < 2; ++stick) {
|
||||
|
|
@ -1109,14 +1109,17 @@ static Sint16 ApplyStickCalibration(SDL_DriverSwitch_Context *ctx, int nStick, i
|
|||
{
|
||||
sRawValue -= ctx->m_StickCalData[nStick].axis[nAxis].sCenter;
|
||||
|
||||
if (sRawValue > ctx->m_StickExtents[nStick].axis[nAxis].sMax) {
|
||||
ctx->m_StickExtents[nStick].axis[nAxis].sMax = sRawValue;
|
||||
if (sRawValue >= 0) {
|
||||
if (sRawValue > ctx->m_StickExtents[nStick].axis[nAxis].sMax) {
|
||||
ctx->m_StickExtents[nStick].axis[nAxis].sMax = sRawValue;
|
||||
}
|
||||
return (Sint16)HIDAPI_RemapVal(sRawValue, 0, ctx->m_StickExtents[nStick].axis[nAxis].sMax, 0, SDL_MAX_SINT16);
|
||||
} else {
|
||||
if (sRawValue < ctx->m_StickExtents[nStick].axis[nAxis].sMin) {
|
||||
ctx->m_StickExtents[nStick].axis[nAxis].sMin = sRawValue;
|
||||
}
|
||||
return (Sint16)HIDAPI_RemapVal(sRawValue, ctx->m_StickExtents[nStick].axis[nAxis].sMin, 0, SDL_MIN_SINT16, 0);
|
||||
}
|
||||
if (sRawValue < ctx->m_StickExtents[nStick].axis[nAxis].sMin) {
|
||||
ctx->m_StickExtents[nStick].axis[nAxis].sMin = sRawValue;
|
||||
}
|
||||
|
||||
return (Sint16)HIDAPI_RemapVal(sRawValue, ctx->m_StickExtents[nStick].axis[nAxis].sMin, ctx->m_StickExtents[nStick].axis[nAxis].sMax, SDL_MIN_SINT16, SDL_MAX_SINT16);
|
||||
}
|
||||
|
||||
static Sint16 ApplySimpleStickCalibration(SDL_DriverSwitch_Context *ctx, int nStick, int nAxis, Sint16 sRawValue)
|
||||
|
|
@ -1126,14 +1129,17 @@ static Sint16 ApplySimpleStickCalibration(SDL_DriverSwitch_Context *ctx, int nSt
|
|||
|
||||
sRawValue -= usJoystickCenter;
|
||||
|
||||
if (sRawValue > ctx->m_SimpleStickExtents[nStick].axis[nAxis].sMax) {
|
||||
ctx->m_SimpleStickExtents[nStick].axis[nAxis].sMax = sRawValue;
|
||||
if (sRawValue >= 0) {
|
||||
if (sRawValue > ctx->m_SimpleStickExtents[nStick].axis[nAxis].sMax) {
|
||||
ctx->m_SimpleStickExtents[nStick].axis[nAxis].sMax = sRawValue;
|
||||
}
|
||||
return (Sint16)HIDAPI_RemapVal(sRawValue, 0, ctx->m_SimpleStickExtents[nStick].axis[nAxis].sMax, 0, SDL_MAX_SINT16);
|
||||
} else {
|
||||
if (sRawValue < ctx->m_SimpleStickExtents[nStick].axis[nAxis].sMin) {
|
||||
ctx->m_SimpleStickExtents[nStick].axis[nAxis].sMin = sRawValue;
|
||||
}
|
||||
return (Sint16)HIDAPI_RemapVal(sRawValue, ctx->m_SimpleStickExtents[nStick].axis[nAxis].sMin, 0, SDL_MIN_SINT16, 0);
|
||||
}
|
||||
if (sRawValue < ctx->m_SimpleStickExtents[nStick].axis[nAxis].sMin) {
|
||||
ctx->m_SimpleStickExtents[nStick].axis[nAxis].sMin = sRawValue;
|
||||
}
|
||||
|
||||
return (Sint16)HIDAPI_RemapVal(sRawValue, ctx->m_SimpleStickExtents[nStick].axis[nAxis].sMin, ctx->m_SimpleStickExtents[nStick].axis[nAxis].sMax, SDL_MIN_SINT16, SDL_MAX_SINT16);
|
||||
}
|
||||
|
||||
static Uint8 RemapButton(SDL_DriverSwitch_Context *ctx, Uint8 button)
|
||||
|
|
|
|||
|
|
@ -820,6 +820,35 @@ static SceGxmTextureAddrMode TranslateAddressMode(SDL_TextureAddressMode mode)
|
|||
}
|
||||
}
|
||||
|
||||
static void ClampCliprectToViewport(SDL_Rect *clip, const SDL_Rect *viewport)
|
||||
{
|
||||
int max_x_v, max_y_v, max_x_c, max_y_c;
|
||||
|
||||
if (clip->x < 0) {
|
||||
clip->w += clip->x;
|
||||
clip->x = 0;
|
||||
}
|
||||
|
||||
if (clip->y < 0) {
|
||||
clip->h += clip->y;
|
||||
clip->y = 0;
|
||||
}
|
||||
|
||||
max_x_c = clip->x + clip->w;
|
||||
max_y_c = clip->y + clip->h;
|
||||
|
||||
max_x_v = viewport->x + viewport->w;
|
||||
max_y_v = viewport->y + viewport->h;
|
||||
|
||||
if (max_x_c > max_x_v) {
|
||||
clip->w -= (max_x_v - max_x_c);
|
||||
}
|
||||
|
||||
if (max_y_c > max_y_v) {
|
||||
clip->h -= (max_y_v - max_y_c);
|
||||
}
|
||||
}
|
||||
|
||||
static bool SetDrawState(VITA_GXM_RenderData *data, const SDL_RenderCommand *cmd)
|
||||
{
|
||||
SDL_Texture *texture = cmd->data.draw.texture;
|
||||
|
|
@ -862,9 +891,13 @@ static bool SetDrawState(VITA_GXM_RenderData *data, const SDL_RenderCommand *cmd
|
|||
data->drawstate.cliprect_enabled_dirty = false;
|
||||
}
|
||||
|
||||
if (data->drawstate.cliprect_enabled && data->drawstate.cliprect_dirty) {
|
||||
const SDL_Rect *rect = &data->drawstate.cliprect;
|
||||
set_clip_rectangle(data, rect->x, rect->y, rect->x + rect->w, rect->y + rect->h);
|
||||
if ((data->drawstate.cliprect_enabled || data->drawstate.viewport_is_set) && data->drawstate.cliprect_dirty) {
|
||||
SDL_Rect rect;
|
||||
SDL_copyp(&rect, &data->drawstate.cliprect);
|
||||
if (data->drawstate.viewport_is_set) {
|
||||
ClampCliprectToViewport(&rect, &data->drawstate.viewport);
|
||||
}
|
||||
set_clip_rectangle(data, rect.x, rect.y, rect.x + rect.w, rect.y + rect.h);
|
||||
data->drawstate.cliprect_dirty = false;
|
||||
}
|
||||
|
||||
|
|
@ -952,20 +985,31 @@ static void VITA_GXM_InvalidateCachedState(SDL_Renderer *renderer)
|
|||
static bool VITA_GXM_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd, void *vertices, size_t vertsize)
|
||||
{
|
||||
VITA_GXM_RenderData *data = (VITA_GXM_RenderData *)renderer->internal;
|
||||
int w, h;
|
||||
|
||||
StartDrawing(renderer);
|
||||
|
||||
data->drawstate.target = renderer->target;
|
||||
if (!data->drawstate.target) {
|
||||
int w, h;
|
||||
SDL_GetWindowSizeInPixels(renderer->window, &w, &h);
|
||||
if ((w != data->drawstate.drawablew) || (h != data->drawstate.drawableh)) {
|
||||
data->drawstate.viewport_dirty = true; // if the window dimensions changed, invalidate the current viewport, etc.
|
||||
data->drawstate.cliprect_dirty = true;
|
||||
data->drawstate.drawablew = w;
|
||||
data->drawstate.drawableh = h;
|
||||
} else {
|
||||
float fw, fh;
|
||||
if (!SDL_GetTextureSize(renderer->target, &fw, &fh)) {
|
||||
w = data->drawstate.drawablew;
|
||||
h = data->drawstate.drawableh;
|
||||
} else {
|
||||
w = (int)SDL_roundf(fw);
|
||||
h = (int)SDL_roundf(fh);
|
||||
}
|
||||
}
|
||||
|
||||
if ((w != data->drawstate.drawablew) || (h != data->drawstate.drawableh)) {
|
||||
data->drawstate.viewport_dirty = true; // if the window dimensions changed, invalidate the current viewport, etc.
|
||||
data->drawstate.cliprect_dirty = true;
|
||||
data->drawstate.drawablew = w;
|
||||
data->drawstate.drawableh = h;
|
||||
}
|
||||
|
||||
while (cmd) {
|
||||
switch (cmd->command) {
|
||||
|
||||
|
|
@ -976,6 +1020,16 @@ static bool VITA_GXM_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *
|
|||
SDL_copyp(viewport, &cmd->data.viewport.rect);
|
||||
data->drawstate.viewport_dirty = true;
|
||||
data->drawstate.cliprect_dirty = true;
|
||||
data->drawstate.viewport_is_set = viewport->x != 0 || viewport->y != 0 || viewport->w != data->drawstate.drawablew || viewport->h != data->drawstate.drawableh;
|
||||
if (!data->drawstate.cliprect_enabled) {
|
||||
if (data->drawstate.viewport_is_set) {
|
||||
SDL_copyp(&data->drawstate.cliprect, viewport);
|
||||
data->drawstate.cliprect.x = 0;
|
||||
data->drawstate.cliprect.y = 0;
|
||||
} else {
|
||||
data->drawstate.cliprect_enabled_dirty = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
@ -983,9 +1037,15 @@ static bool VITA_GXM_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *
|
|||
case SDL_RENDERCMD_SETCLIPRECT:
|
||||
{
|
||||
const SDL_Rect *rect = &cmd->data.cliprect.rect;
|
||||
const SDL_Rect *viewport = &data->drawstate.viewport;
|
||||
if (data->drawstate.cliprect_enabled != cmd->data.cliprect.enabled) {
|
||||
data->drawstate.cliprect_enabled = cmd->data.cliprect.enabled;
|
||||
data->drawstate.cliprect_enabled_dirty = true;
|
||||
if (!data->drawstate.cliprect_enabled && data->drawstate.viewport_is_set) {
|
||||
SDL_copyp(&data->drawstate.cliprect, viewport);
|
||||
data->drawstate.cliprect.x = 0;
|
||||
data->drawstate.cliprect.y = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (SDL_memcmp(&data->drawstate.cliprect, rect, sizeof(*rect)) != 0) {
|
||||
|
|
|
|||
|
|
@ -105,6 +105,7 @@ typedef struct
|
|||
{
|
||||
SDL_Rect viewport;
|
||||
bool viewport_dirty;
|
||||
bool viewport_is_set;
|
||||
SDL_Texture *texture;
|
||||
SDL_Texture *target;
|
||||
SDL_FColor color;
|
||||
|
|
|
|||
|
|
@ -4139,7 +4139,7 @@ void SDL_OnWindowLiveResizeUpdate(SDL_Window *window)
|
|||
SDL_IterateMainCallbacks(false);
|
||||
} else {
|
||||
// Send an expose event so the application can redraw
|
||||
SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_EXPOSED, 0, 0);
|
||||
SDL_SendWindowEvent(window, SDL_EVENT_WINDOW_EXPOSED, 1, 0);
|
||||
}
|
||||
|
||||
SDL_PumpEventMaintenance();
|
||||
|
|
|
|||
|
|
@ -701,6 +701,10 @@ static void WIN_HandleRawMouseInput(Uint64 timestamp, SDL_VideoData *data, HANDL
|
|||
float fAmount = (float)amount / WHEEL_DELTA;
|
||||
SDL_SendMouseWheel(WIN_GetEventTimestamp(), window, mouseID, fAmount, 0.0f, SDL_MOUSEWHEEL_NORMAL);
|
||||
}
|
||||
|
||||
/* Invalidate the mouse button flags. If we don't do this then disabling raw input
|
||||
will cause held down mouse buttons to persist when released. */
|
||||
windowdata->mouse_button_flags = (WPARAM)-1;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -279,6 +279,9 @@ static void GAMEINPUT_InitialMouseReading(WIN_GameInputData *data, SDL_Window *w
|
|||
bool down = ((state.buttons & mask) != 0);
|
||||
SDL_SendMouseButton(timestamp, window, mouseID, GAMEINPUT_button_map[i], down);
|
||||
}
|
||||
|
||||
// Invalidate mouse button flags
|
||||
window->internal->mouse_button_flags = (WPARAM)-1;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -308,6 +311,9 @@ static void GAMEINPUT_HandleMouseDelta(WIN_GameInputData *data, SDL_Window *wind
|
|||
SDL_SendMouseButton(timestamp, window, mouseID, GAMEINPUT_button_map[i], down);
|
||||
}
|
||||
}
|
||||
|
||||
// Invalidate mouse button flags
|
||||
window->internal->mouse_button_flags = (WPARAM)-1;
|
||||
}
|
||||
if (delta.wheelX || delta.wheelY) {
|
||||
float fAmountX = (float)delta.wheelX / WHEEL_DELTA;
|
||||
|
|
|
|||
|
|
@ -679,6 +679,16 @@ void SetupVulkanRenderProperties(VulkanVideoContext *context, SDL_PropertiesID p
|
|||
SDL_SetNumberProperty(props, SDL_PROP_RENDERER_CREATE_VULKAN_GRAPHICS_QUEUE_FAMILY_INDEX_NUMBER, context->graphicsQueueFamilyIndex);
|
||||
}
|
||||
|
||||
#if LIBAVUTIL_VERSION_MAJOR >= 59
|
||||
static void AddQueueFamily(AVVulkanDeviceContext *ctx, int idx, int num, VkQueueFlagBits flags)
|
||||
{
|
||||
AVVulkanDeviceQueueFamily *entry = &ctx->qf[ctx->nb_qf++];
|
||||
entry->idx = idx;
|
||||
entry->num = num;
|
||||
entry->flags = flags;
|
||||
}
|
||||
#endif /* LIBAVUTIL_VERSION_MAJOR */
|
||||
|
||||
void SetupVulkanDeviceContextData(VulkanVideoContext *context, AVVulkanDeviceContext *ctx)
|
||||
{
|
||||
ctx->get_proc_addr = context->vkGetInstanceProcAddr;
|
||||
|
|
@ -690,6 +700,12 @@ void SetupVulkanDeviceContextData(VulkanVideoContext *context, AVVulkanDeviceCon
|
|||
ctx->nb_enabled_inst_extensions = context->instanceExtensionsCount;
|
||||
ctx->enabled_dev_extensions = context->deviceExtensions;
|
||||
ctx->nb_enabled_dev_extensions = context->deviceExtensionsCount;
|
||||
#if LIBAVUTIL_VERSION_MAJOR >= 59
|
||||
AddQueueFamily(ctx, context->graphicsQueueFamilyIndex, context->graphicsQueueCount, VK_QUEUE_GRAPHICS_BIT);
|
||||
AddQueueFamily(ctx, context->transferQueueFamilyIndex, context->transferQueueCount, VK_QUEUE_TRANSFER_BIT);
|
||||
AddQueueFamily(ctx, context->computeQueueFamilyIndex, context->computeQueueCount, VK_QUEUE_COMPUTE_BIT);
|
||||
AddQueueFamily(ctx, context->decodeQueueFamilyIndex, context->decodeQueueCount, VK_QUEUE_VIDEO_DECODE_BIT_KHR);
|
||||
#else
|
||||
ctx->queue_family_index = context->graphicsQueueFamilyIndex;
|
||||
ctx->nb_graphics_queues = context->graphicsQueueCount;
|
||||
ctx->queue_family_tx_index = context->transferQueueFamilyIndex;
|
||||
|
|
@ -700,6 +716,7 @@ void SetupVulkanDeviceContextData(VulkanVideoContext *context, AVVulkanDeviceCon
|
|||
ctx->nb_encode_queues = 0;
|
||||
ctx->queue_family_decode_index = context->decodeQueueFamilyIndex;
|
||||
ctx->nb_decode_queues = context->decodeQueueCount;
|
||||
#endif /* LIBAVUTIL_VERSION_MAJOR */
|
||||
}
|
||||
|
||||
static int CreateCommandBuffers(VulkanVideoContext *context, SDL_Renderer *renderer)
|
||||
|
|
|
|||
Loading…
Reference in New Issue