2
0
Panagiotis Christopoulos Charitos 6 сар өмнө
parent
commit
ac9a07ccaf

+ 1 - 1
AnKi/Core/CMakeLists.txt

@@ -19,7 +19,7 @@ if(SDL)
 		set(extra_libs pthread dl)
 	endif()
 
-	set(extra_libs ${extra_libs} SDL2-static)
+	set(extra_libs ${extra_libs} SDL3-static)
 elseif(ANDROID)
 	set(extra_libs log android nativewindow AnKiAndroidNativeGlue AnKiHwcPipe)
 elseif(WINDOWS)

+ 4 - 0
AnKi/Gr/Vulkan/VkCommon.h

@@ -12,6 +12,8 @@
 // Do nothing
 #elif ANKI_OS_LINUX
 #	define VK_USE_PLATFORM_WAYLAND_KHR 1
+#	define VK_USE_PLATFORM_XCB_KHR 1
+#	define VK_USE_PLATFORM_XLIB_KHR 1
 #elif ANKI_OS_WINDOWS
 #	define VK_USE_PLATFORM_WIN32_KHR 1
 #elif ANKI_OS_ANDROID
@@ -69,6 +71,8 @@ enum class VulkanExtensions : U32
 	kEXT_mesh_shader = 1u << 16u,
 	kKHR_fragment_shader_barycentric = 1u << 17u,
 	kKHR_ray_tracing_position_fetch = 1u << 18u,
+	kKHR_xcb_surface = 1u << 19u,
+	kKHR_xlib_surface = 1u << 20u,
 };
 ANKI_ENUM_ALLOW_NUMERIC_OPERATIONS(VulkanExtensions)
 

+ 14 - 5
AnKi/Gr/Vulkan/VkGrManager.cpp

@@ -26,8 +26,7 @@
 #include <AnKi/Window/NativeWindow.h>
 #if ANKI_WINDOWING_SYSTEM_SDL
 #	include <AnKi/Window/NativeWindowSdl.h>
-#	include <SDL_syswm.h>
-#	include <SDL_vulkan.h>
+#	include <SDL3/SDL_vulkan.h>
 #elif ANKI_WINDOWING_SYSTEM_ANDROID
 #	include <AnKi/Window/NativeWindowAndroid.h>
 #elif ANKI_WINDOWING_SYSTEM_HEADLESS
@@ -574,6 +573,16 @@ Error GrManagerImpl::initInstance()
 				m_extensions |= VulkanExtensions::kKHR_wayland_surface;
 				instExtensions[instExtensionCount++] = VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME;
 			}
+			else if(extensionName == VK_KHR_XCB_SURFACE_EXTENSION_NAME)
+			{
+				m_extensions |= VulkanExtensions::kKHR_xcb_surface;
+				instExtensions[instExtensionCount++] = VK_KHR_XCB_SURFACE_EXTENSION_NAME;
+			}
+			else if(extensionName == VK_KHR_XLIB_SURFACE_EXTENSION_NAME)
+			{
+				m_extensions |= VulkanExtensions::kKHR_xlib_surface;
+				instExtensions[instExtensionCount++] = VK_KHR_XLIB_SURFACE_EXTENSION_NAME;
+			}
 #elif ANKI_OS_WINDOWS
 			if(extensionName == VK_KHR_WIN32_SURFACE_EXTENSION_NAME)
 			{
@@ -602,8 +611,8 @@ Error GrManagerImpl::initInstance()
 		}
 
 		if(!(m_extensions
-			 & (VulkanExtensions::kEXT_headless_surface | VulkanExtensions::kKHR_wayland_surface | VulkanExtensions::kKHR_win32_surface
-				| VulkanExtensions::kKHR_android_surface)))
+			 & (VulkanExtensions::kEXT_headless_surface | VulkanExtensions::kKHR_wayland_surface | VulkanExtensions::kKHR_xcb_surface
+				| VulkanExtensions::kKHR_xlib_surface | VulkanExtensions::kKHR_win32_surface | VulkanExtensions::kKHR_android_surface)))
 		{
 			ANKI_VK_LOGE("Couldn't find suitable surface extension");
 			return Error::kFunctionFailed;
@@ -1582,7 +1591,7 @@ Error GrManagerImpl::printPipelineShaderInfoInternal(VkPipeline ppline, CString
 Error GrManagerImpl::initSurface()
 {
 #if ANKI_WINDOWING_SYSTEM_SDL
-	if(!SDL_Vulkan_CreateSurface(static_cast<NativeWindowSdl&>(NativeWindow::getSingleton()).m_sdlWindow, m_instance, &m_surface))
+	if(!SDL_Vulkan_CreateSurface(static_cast<NativeWindowSdl&>(NativeWindow::getSingleton()).m_sdlWindow, m_instance, nullptr, &m_surface))
 	{
 		ANKI_VK_LOGE("SDL_Vulkan_CreateSurface() failed: %s", SDL_GetError());
 		return Error::kFunctionFailed;

+ 0 - 1
AnKi/Util.h

@@ -32,7 +32,6 @@
 #include <AnKi/Util/Thread.h>
 #include <AnKi/Util/ThreadPool.h>
 #include <AnKi/Util/ThreadJobManager.h>
-#include <AnKi/Util/Visitor.h>
 #include <AnKi/Util/INotify.h>
 #include <AnKi/Util/SparseArray.h>
 #include <AnKi/Util/BlockArray.h>

+ 5 - 5
AnKi/Util/StdTypes.h

@@ -234,27 +234,27 @@ private:
 
 /// @name AnKi type user literals.
 /// @{
-inline constexpr U8 operator"" _U8(unsigned long long arg) noexcept
+inline constexpr U8 operator""_U8(unsigned long long arg) noexcept
 {
 	return U8(arg);
 }
 
-inline constexpr U16 operator"" _U16(unsigned long long arg) noexcept
+inline constexpr U16 operator""_U16(unsigned long long arg) noexcept
 {
 	return U16(arg);
 }
 
-inline constexpr U32 operator"" _U32(unsigned long long arg) noexcept
+inline constexpr U32 operator""_U32(unsigned long long arg) noexcept
 {
 	return U32(arg);
 }
 
-inline constexpr U64 operator"" _U64(unsigned long long arg) noexcept
+inline constexpr U64 operator""_U64(unsigned long long arg) noexcept
 {
 	return U64(arg);
 }
 
-inline constexpr PtrSize operator"" _PtrSize(unsigned long long arg) noexcept
+inline constexpr PtrSize operator""_PtrSize(unsigned long long arg) noexcept
 {
 	return PtrSize(arg);
 }

+ 37 - 20
AnKi/Window/InputSdl.cpp

@@ -7,7 +7,7 @@
 #include <AnKi/Window/InputSdl.h>
 #include <AnKi/Window/NativeWindowSdl.h>
 #include <AnKi/Util/Logger.h>
-#include <SDL.h>
+#include <SDL3/SDL.h>
 
 namespace anki {
 
@@ -90,14 +90,14 @@ void Input::moveCursor(const Vec2& pos)
 {
 	if(pos != m_mousePosNdc)
 	{
-		const I32 x = I32(F32(NativeWindow::getSingleton().getWidth()) * (pos.x() * 0.5f + 0.5f));
-		const I32 y = I32(F32(NativeWindow::getSingleton().getHeight()) * (-pos.y() * 0.5f + 0.5f));
+		const F32 x = F32(NativeWindow::getSingleton().getWidth()) * (pos.x() * 0.5f + 0.5f);
+		const F32 y = F32(NativeWindow::getSingleton().getHeight()) * (-pos.y() * 0.5f + 0.5f);
 
 		SDL_WarpMouseInWindow(static_cast<NativeWindowSdl&>(NativeWindow::getSingleton()).m_sdlWindow, x, y);
 
 		// SDL doesn't generate a SDL_MOUSEMOTION event if the cursor is outside the window. Push that event
 		SDL_Event event;
-		event.type = SDL_MOUSEMOTION;
+		event.type = SDL_EVENT_MOUSE_MOTION;
 		event.button.x = x;
 		event.button.y = y;
 
@@ -107,7 +107,20 @@ void Input::moveCursor(const Vec2& pos)
 
 void Input::hideCursor(Bool hide)
 {
-	SDL_ShowCursor(!hide);
+	if(hide)
+	{
+		if(!SDL_HideCursor())
+		{
+			ANKI_WIND_LOGE("SDL_HideCursor() failed: %s", SDL_GetError());
+		}
+	}
+	else
+	{
+		if(!SDL_ShowCursor())
+		{
+			ANKI_WIND_LOGE("SDL_ShowCursor() failed: %s", SDL_GetError());
+		}
+	}
 }
 
 Bool Input::hasTouchDevice() const
@@ -143,20 +156,24 @@ Error InputSdl::handleEventsInternal()
 
 	SDL_Event event;
 	KeyCode akkey;
-	SDL_StartTextInput();
+	if(!SDL_StartTextInput(static_cast<NativeWindowSdl&>(NativeWindow::getSingleton()).m_sdlWindow))
+	{
+		ANKI_WIND_LOGE("SDL_StartTextInput() failed: %s", SDL_GetError());
+	}
+
 	while(SDL_PollEvent(&event))
 	{
 		switch(event.type)
 		{
-		case SDL_KEYDOWN:
-			akkey = sdlKeytoAnKi(event.key.keysym.sym);
+		case SDL_EVENT_KEY_DOWN:
+			akkey = sdlKeytoAnKi(event.key.key);
 			m_keys[akkey] = 1;
 			break;
-		case SDL_KEYUP:
-			akkey = sdlKeytoAnKi(event.key.keysym.sym);
+		case SDL_EVENT_KEY_UP:
+			akkey = sdlKeytoAnKi(event.key.key);
 			m_keys[akkey] = 0;
 			break;
-		case SDL_MOUSEBUTTONDOWN:
+		case SDL_EVENT_MOUSE_BUTTON_DOWN:
 		{
 			MouseButton mb = sdlMouseButtonToAnKi(event.button.button);
 			if(mb != MouseButton::kCount)
@@ -165,7 +182,7 @@ Error InputSdl::handleEventsInternal()
 			}
 			break;
 		}
-		case SDL_MOUSEBUTTONUP:
+		case SDL_EVENT_MOUSE_BUTTON_UP:
 		{
 			MouseButton mb = sdlMouseButtonToAnKi(event.button.button);
 			if(mb != MouseButton::kCount)
@@ -174,20 +191,20 @@ Error InputSdl::handleEventsInternal()
 			}
 			break;
 		}
-		case SDL_MOUSEWHEEL:
-			m_mouseBtns[MouseButton::kScrollUp] = event.wheel.y > 0;
-			m_mouseBtns[MouseButton::kScrollDown] = event.wheel.y < 0;
+		case SDL_EVENT_MOUSE_WHEEL:
+			m_mouseBtns[MouseButton::kScrollUp] = event.wheel.y > 0.0f;
+			m_mouseBtns[MouseButton::kScrollDown] = event.wheel.y < 0.0f;
 			break;
-		case SDL_MOUSEMOTION:
-			m_mousePosWin.x() = event.button.x;
-			m_mousePosWin.y() = event.button.y;
+		case SDL_EVENT_MOUSE_MOTION:
+			m_mousePosWin.x() = U32(event.button.x);
+			m_mousePosWin.y() = U32(event.button.y);
 			m_mousePosNdc.x() = F32(event.button.x) / F32(NativeWindow::getSingleton().getWidth()) * 2.0f - 1.0f;
 			m_mousePosNdc.y() = -(F32(event.button.y) / F32(NativeWindow::getSingleton().getHeight()) * 2.0f - 1.0f);
 			break;
-		case SDL_QUIT:
+		case SDL_EVENT_QUIT:
 			addEvent(InputEvent::kWindowClosed);
 			break;
-		case SDL_TEXTINPUT:
+		case SDL_EVENT_TEXT_INPUT:
 			std::strncpy(&m_textInput[0], event.text.text, m_textInput.getSize() - 1);
 			break;
 		}

+ 1 - 1
AnKi/Window/InputSdl.h

@@ -6,7 +6,7 @@
 #pragma once
 
 #include <AnKi/Window/Input.h>
-#include <SDL_keycode.h>
+#include <SDL3/SDL_keycode.h>
 #include <unordered_map>
 
 namespace anki {

+ 35 - 47
AnKi/Window/KeyCode.def.h

@@ -9,12 +9,12 @@ ANKI_KEY_CODE(Backspace, BACKSPACE)
 ANKI_KEY_CODE(Tab, TAB)
 ANKI_KEY_CODE(Space, SPACE)
 ANKI_KEY_CODE(Exclaim, EXCLAIM)
-ANKI_KEY_CODE(QuotedBL, QUOTEDBL)
+ANKI_KEY_CODE(DoubleApostrophe, DBLAPOSTROPHE)
 ANKI_KEY_CODE(Hash, HASH)
 ANKI_KEY_CODE(Percent, PERCENT)
 ANKI_KEY_CODE(Dollar, DOLLAR)
 ANKI_KEY_CODE(Ampersand, AMPERSAND)
-ANKI_KEY_CODE(Quote, QUOTE)
+ANKI_KEY_CODE(Apostrophe, APOSTROPHE)
 ANKI_KEY_CODE(LeftParen, LEFTPAREN)
 ANKI_KEY_CODE(RightParen, RIGHTPAREN)
 ANKI_KEY_CODE(Asterisk, ASTERISK)
@@ -45,33 +45,33 @@ ANKI_KEY_CODE(Backslash, BACKSLASH)
 ANKI_KEY_CODE(RightBracket, RIGHTBRACKET)
 ANKI_KEY_CODE(Caret, CARET)
 ANKI_KEY_CODE(Underscore, UNDERSCORE)
-ANKI_KEY_CODE(Backquote, BACKQUOTE)
-ANKI_KEY_CODE(A, a)
-ANKI_KEY_CODE(B, b)
-ANKI_KEY_CODE(C, c)
-ANKI_KEY_CODE(D, d)
-ANKI_KEY_CODE(E, e)
-ANKI_KEY_CODE(F, f)
-ANKI_KEY_CODE(G, g)
-ANKI_KEY_CODE(H, h)
-ANKI_KEY_CODE(I, i)
-ANKI_KEY_CODE(J, j)
-ANKI_KEY_CODE(K, k)
-ANKI_KEY_CODE(L, l)
-ANKI_KEY_CODE(M, m)
-ANKI_KEY_CODE(N, n)
-ANKI_KEY_CODE(O, o)
-ANKI_KEY_CODE(P, p)
-ANKI_KEY_CODE(Q, q)
-ANKI_KEY_CODE(R, r)
-ANKI_KEY_CODE(S, s)
-ANKI_KEY_CODE(T, t)
-ANKI_KEY_CODE(U, u)
-ANKI_KEY_CODE(V, v)
-ANKI_KEY_CODE(W, w)
-ANKI_KEY_CODE(X, x)
-ANKI_KEY_CODE(Y, y)
-ANKI_KEY_CODE(Z, z)
+ANKI_KEY_CODE(Grave, GRAVE)
+ANKI_KEY_CODE(A, A)
+ANKI_KEY_CODE(B, B)
+ANKI_KEY_CODE(C, C)
+ANKI_KEY_CODE(D, D)
+ANKI_KEY_CODE(E, E)
+ANKI_KEY_CODE(F, F)
+ANKI_KEY_CODE(G, G)
+ANKI_KEY_CODE(H, H)
+ANKI_KEY_CODE(I, I)
+ANKI_KEY_CODE(J, J)
+ANKI_KEY_CODE(K, K)
+ANKI_KEY_CODE(L, L)
+ANKI_KEY_CODE(M, M)
+ANKI_KEY_CODE(N, N)
+ANKI_KEY_CODE(O, O)
+ANKI_KEY_CODE(P, P)
+ANKI_KEY_CODE(Q, Q)
+ANKI_KEY_CODE(R, R)
+ANKI_KEY_CODE(S, S)
+ANKI_KEY_CODE(T, T)
+ANKI_KEY_CODE(U, U)
+ANKI_KEY_CODE(V, V)
+ANKI_KEY_CODE(W, W)
+ANKI_KEY_CODE(X, X)
+ANKI_KEY_CODE(Y, Y)
+ANKI_KEY_CODE(Z, Z)
 ANKI_KEY_CODE(Capslock, CAPSLOCK)
 ANKI_KEY_CODE(F1, F1)
 ANKI_KEY_CODE(F2, F2)
@@ -141,7 +141,6 @@ ANKI_KEY_CODE(Cut, CUT)
 ANKI_KEY_CODE(Copy, COPY)
 ANKI_KEY_CODE(Paste, PASTE)
 ANKI_KEY_CODE(Find, FIND)
-ANKI_KEY_CODE(Mute, MUTE)
 ANKI_KEY_CODE(VolumeUp, VOLUMEUP)
 ANKI_KEY_CODE(VolumeDown, VOLUMEDOWN)
 ANKI_KEY_CODE(KpComma, KP_COMMA)
@@ -213,16 +212,12 @@ ANKI_KEY_CODE(RightShift, RSHIFT)
 ANKI_KEY_CODE(RightAlt, RALT)
 ANKI_KEY_CODE(RightGui, RGUI)
 ANKI_KEY_CODE(Mode, MODE)
-ANKI_KEY_CODE(AudioNext, AUDIONEXT)
-ANKI_KEY_CODE(AudioPrev, AUDIOPREV)
-ANKI_KEY_CODE(AudioStop, AUDIOSTOP)
-ANKI_KEY_CODE(AudioPlay, AUDIOPLAY)
-ANKI_KEY_CODE(AudioMute, AUDIOMUTE)
-ANKI_KEY_CODE(MediaSelect, MEDIASELECT)
-ANKI_KEY_CODE(Www, WWW)
-ANKI_KEY_CODE(Mail, MAIL)
-ANKI_KEY_CODE(Calculator, CALCULATOR)
-ANKI_KEY_CODE(Computer, COMPUTER)
+ANKI_KEY_CODE(MediaNextTrack, MEDIA_NEXT_TRACK)
+ANKI_KEY_CODE(MediaPreviousTrack, MEDIA_PREVIOUS_TRACK)
+ANKI_KEY_CODE(MediaStop, MEDIA_STOP)
+ANKI_KEY_CODE(MediaPlay, MEDIA_PLAY)
+ANKI_KEY_CODE(Mute, MUTE)
+ANKI_KEY_CODE(MediaSelect, MEDIA_SELECT)
 ANKI_KEY_CODE(AcSearch, AC_SEARCH)
 ANKI_KEY_CODE(AcHome, AC_HOME)
 ANKI_KEY_CODE(AcBack, AC_BACK)
@@ -230,11 +225,4 @@ ANKI_KEY_CODE(AcForward, AC_FORWARD)
 ANKI_KEY_CODE(AcStop, AC_STOP)
 ANKI_KEY_CODE(AcRefresh, AC_REFRESH)
 ANKI_KEY_CODE(AcBookmarks, AC_BOOKMARKS)
-ANKI_KEY_CODE(BrighnessDown, BRIGHTNESSDOWN)
-ANKI_KEY_CODE(BrighnessUp, BRIGHTNESSUP)
-ANKI_KEY_CODE(DisplaySwitch, DISPLAYSWITCH)
-ANKI_KEY_CODE(KbdIlluminationToggle, KBDILLUMTOGGLE)
-ANKI_KEY_CODE(KdbIlluminationDown, KBDILLUMDOWN)
-ANKI_KEY_CODE(KdbIlluminationUp, KBDILLUMUP)
-ANKI_KEY_CODE(kEject, EJECT)
 ANKI_KEY_CODE(kSleep, SLEEP)

+ 16 - 19
AnKi/Window/NativeWindowSdl.cpp

@@ -6,7 +6,7 @@
 #include <AnKi/Window/NativeWindowSdl.h>
 #include <AnKi/Util/Logger.h>
 #if ANKI_GR_BACKEND_VULKAN
-#	include <SDL_vulkan.h>
+#	include <SDL3/SDL_vulkan.h>
 #endif
 
 namespace anki {
@@ -68,14 +68,14 @@ Error NativeWindowSdl::initSdl(const NativeWindowInitInfo& init)
 	}
 #endif
 
-	if(SDL_Init(kInitSubsystems) != 0)
+	if(!SDL_Init(kInitSubsystems))
 	{
 		ANKI_WIND_LOGE("SDL_Init() failed: %s", SDL_GetError());
 		return Error::kFunctionFailed;
 	}
 
 #if ANKI_GR_BACKEND_VULKAN
-	if(SDL_Vulkan_LoadLibrary(nullptr))
+	if(!SDL_Vulkan_LoadLibrary(nullptr))
 	{
 		ANKI_WIND_LOGE("SDL_Vulkan_LoadLibrary() failed: %s", SDL_GetError());
 		return Error::kFunctionFailed;
@@ -90,36 +90,33 @@ Error NativeWindowSdl::initSdl(const NativeWindowInitInfo& init)
 	//
 	// Create window
 	//
-	U32 flags = 0;
+	U32 flags = SDL_WINDOW_INPUT_FOCUS | SDL_WINDOW_MOUSE_FOCUS | SDL_WINDOW_HIGH_PIXEL_DENSITY;
 
 #if ANKI_GR_BACKEND_VULKAN
 	flags |= SDL_WINDOW_VULKAN;
 #endif
 
-	SDL_SetHint(SDL_HINT_ALLOW_TOPMOST, "0");
 	if(init.m_fullscreenDesktopRez)
 	{
-#if ANKI_OS_WINDOWS
-		if(init.m_exclusiveFullscreen)
+		flags |= SDL_WINDOW_FULLSCREEN;
+
+		SDL_DisplayID display = SDL_GetPrimaryDisplay();
+		if(!display)
 		{
-			flags |= SDL_WINDOW_FULLSCREEN_DESKTOP;
+			ANKI_WIND_LOGE("SDL_GetPrimaryDisplay() failed: %s", SDL_GetError());
+			return Error::kFunctionFailed;
 		}
-#elif ANKI_OS_LINUX
-		flags |= SDL_WINDOW_FULLSCREEN_DESKTOP;
-#else
-#	error See file
-#endif
 
 		// Alter the window size
-		SDL_DisplayMode mode;
-		if(SDL_GetDesktopDisplayMode(0, &mode))
+		const SDL_DisplayMode* mode = SDL_GetCurrentDisplayMode(display);
+		if(!mode)
 		{
-			ANKI_WIND_LOGE("SDL_GetDesktopDisplayMode() failed: %s", SDL_GetError());
+			ANKI_WIND_LOGE("SDL_GetCurrentDisplayMode() failed: %s", SDL_GetError());
 			return Error::kFunctionFailed;
 		}
 
-		m_width = mode.w;
-		m_height = mode.h;
+		m_width = mode->w;
+		m_height = mode->h;
 	}
 	else
 	{
@@ -127,7 +124,7 @@ Error NativeWindowSdl::initSdl(const NativeWindowInitInfo& init)
 		m_height = init.m_height;
 	}
 
-	m_sdlWindow = SDL_CreateWindow(&init.m_title[0], SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, m_width, m_height, flags);
+	m_sdlWindow = SDL_CreateWindow(&init.m_title[0], m_width, m_height, flags);
 
 	if(m_sdlWindow == nullptr)
 	{

+ 2 - 2
AnKi/Window/NativeWindowSdl.h

@@ -6,7 +6,7 @@
 #pragma once
 
 #include <AnKi/Window/NativeWindow.h>
-#include <SDL.h>
+#include <SDL3/SDL.h>
 
 namespace anki {
 
@@ -21,7 +21,7 @@ public:
 	Error initSdl(const NativeWindowInitInfo& init);
 
 private:
-	static constexpr U32 kInitSubsystems = SDL_INIT_VIDEO | SDL_INIT_JOYSTICK | SDL_INIT_EVENTS | SDL_INIT_GAMECONTROLLER;
+	static constexpr U32 kInitSubsystems = SDL_INIT_VIDEO | SDL_INIT_JOYSTICK | SDL_INIT_EVENTS | SDL_INIT_GAMEPAD;
 };
 
 } // end namespace anki

+ 9 - 13
CMakeLists.txt

@@ -193,7 +193,6 @@ if(${ANKI_GR_BACKEND} STREQUAL "DIRECTX")
 elseif(${ANKI_GR_BACKEND} STREQUAL "VULKAN")
 	set(DIRECTX FALSE)
 	set(VULKAN TRUE)
-	set(VIDEO_VULKAN TRUE) # Set for the SDL2 to pick up
 else()
 	message(FATAL_ERROR "Wrong ANKI_GR_BACKEND")
 endif()
@@ -326,14 +325,14 @@ endif()
 
 # SDL
 if(SDL)
-	message("++ Configuring SDL2")
-	option(SDL_X11 OFF)
-	add_subdirectory(ThirdParty/Sdl2)
-	message("++ End configuring SDL2")
+	message("++ Configuring SDL3")
+	option(SDL_STATIC "Build a static version of the library" ON)
+	option(SDL_DYNAMIC "Build a static version of the library" OFF)
+	add_subdirectory(ThirdParty/Sdl3)
+	message("++ End configuring SDL3")
 
 	# Include first the build directory.
-	set(SDL2_INCLUDE_DIRS "${CMAKE_CURRENT_BINARY_DIR}/ThirdParty/Sdl2/include"
-		"${CMAKE_CURRENT_SOURCE_DIR}/ThirdParty/Sdl2/include")
+	set(SDL3_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/ThirdParty/Sdl3/include")
 endif()
 
 # glslang
@@ -469,8 +468,8 @@ include_directories(
 	"ThirdParty/Jolt"
 	${CMAKE_CURRENT_SOURCE_DIR})
 
-if(SDL2_INCLUDE_DIRS)
-	include_directories("${SDL2_INCLUDE_DIRS}")
+if(SDL3_INCLUDE_DIRS)
+	include_directories("${SDL3_INCLUDE_DIRS}")
 endif()
 
 if(LINUX OR MACOS OR WINDOWS)
@@ -485,10 +484,6 @@ endif()
 
 if(LINUX)
 	set(THIRD_PARTY_LIBS ${THIRD_PARTY_LIBS} pthread dl)
-
-	if(SDL)
-		#set(THIRD_PARTY_LIBS ${THIRD_PARTY_LIBS} X11-xcb)
-	endif()
 endif()
 
 if(ANKI_DLSS)
@@ -500,6 +495,7 @@ if(NOT MSVC)
 	add_compile_options(
 		-pedantic
 		-Wno-unknown-warning-option
+		-Wno-nontrivial-memcall
 		-Wall
 		-W
 		-Wextra

+ 1 - 1
Samples/Common/SampleApp.cpp

@@ -51,7 +51,7 @@ Error SampleApp::userMainLoop(Bool& quit, Second elapsedTime)
 		return Error::kNone;
 	}
 
-	if(in.getKey(KeyCode::kBackquote) == 1)
+	if(in.getKey(KeyCode::kGrave) == 1)
 	{
 		toggleDeveloperConsole();
 	}