mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2024-07-04 23:31:19 +01:00
Merge pull request #6652 from lat9nq/cmd-vulkan-fixes
yuzu-cmd: Linux Vulkan fixes
This commit is contained in:
commit
ffc78ce9c1
7 changed files with 38 additions and 51 deletions
|
@ -13,7 +13,7 @@ project(yuzu)
|
||||||
option(ENABLE_SDL2 "Enable the SDL2 frontend" ON)
|
option(ENABLE_SDL2 "Enable the SDL2 frontend" ON)
|
||||||
CMAKE_DEPENDENT_OPTION(YUZU_USE_BUNDLED_SDL2 "Download bundled SDL2 binaries" ON "ENABLE_SDL2;MSVC" OFF)
|
CMAKE_DEPENDENT_OPTION(YUZU_USE_BUNDLED_SDL2 "Download bundled SDL2 binaries" ON "ENABLE_SDL2;MSVC" OFF)
|
||||||
# On Linux system SDL2 is likely to be lacking HIDAPI support which have drawbacks but is needed for SDL motion
|
# On Linux system SDL2 is likely to be lacking HIDAPI support which have drawbacks but is needed for SDL motion
|
||||||
option(YUZU_ALLOW_SYSTEM_SDL2 "Try using system SDL2 before fallling back to one from externals" OFF)
|
CMAKE_DEPENDENT_OPTION(YUZU_USE_EXTERNAL_SDL2 "Compile external SDL2" ON "ENABLE_SDL2;NOT MSVC" OFF)
|
||||||
|
|
||||||
option(ENABLE_QT "Enable the Qt frontend" ON)
|
option(ENABLE_QT "Enable the Qt frontend" ON)
|
||||||
option(ENABLE_QT_TRANSLATION "Enable translations for the Qt frontend" OFF)
|
option(ENABLE_QT_TRANSLATION "Enable translations for the Qt frontend" OFF)
|
||||||
|
@ -393,11 +393,11 @@ if (ENABLE_SDL2)
|
||||||
add_library(SDL2 INTERFACE)
|
add_library(SDL2 INTERFACE)
|
||||||
target_link_libraries(SDL2 INTERFACE "${SDL2_LIBRARY}")
|
target_link_libraries(SDL2 INTERFACE "${SDL2_LIBRARY}")
|
||||||
target_include_directories(SDL2 INTERFACE "${SDL2_INCLUDE_DIR}")
|
target_include_directories(SDL2 INTERFACE "${SDL2_INCLUDE_DIR}")
|
||||||
|
elseif (YUZU_USE_EXTERNAL_SDL2)
|
||||||
|
message(STATUS "Using SDL2 from externals.")
|
||||||
else()
|
else()
|
||||||
if (YUZU_ALLOW_SYSTEM_SDL2)
|
find_package(SDL2 2.0.15 REQUIRED)
|
||||||
find_package(SDL2 2.0.15 QUIET)
|
|
||||||
|
|
||||||
if (SDL2_FOUND)
|
|
||||||
# Some installations don't set SDL2_LIBRARIES
|
# Some installations don't set SDL2_LIBRARIES
|
||||||
if("${SDL2_LIBRARIES}" STREQUAL "")
|
if("${SDL2_LIBRARIES}" STREQUAL "")
|
||||||
message(WARNING "SDL2_LIBRARIES wasn't set, manually setting to SDL2::SDL2")
|
message(WARNING "SDL2_LIBRARIES wasn't set, manually setting to SDL2::SDL2")
|
||||||
|
@ -407,12 +407,6 @@ if (ENABLE_SDL2)
|
||||||
include_directories(SYSTEM ${SDL2_INCLUDE_DIRS})
|
include_directories(SYSTEM ${SDL2_INCLUDE_DIRS})
|
||||||
add_library(SDL2 INTERFACE)
|
add_library(SDL2 INTERFACE)
|
||||||
target_link_libraries(SDL2 INTERFACE "${SDL2_LIBRARIES}")
|
target_link_libraries(SDL2 INTERFACE "${SDL2_LIBRARIES}")
|
||||||
else()
|
|
||||||
message(STATUS "SDL2 2.0.15 or newer not found, falling back to externals.")
|
|
||||||
endif()
|
|
||||||
else()
|
|
||||||
message(STATUS "Using SDL2 from externals.")
|
|
||||||
endif()
|
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
2
externals/CMakeLists.txt
vendored
2
externals/CMakeLists.txt
vendored
|
@ -51,7 +51,7 @@ if (NOT LIBUSB_FOUND OR YUZU_USE_BUNDLED_LIBUSB)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# SDL2
|
# SDL2
|
||||||
if (NOT SDL2_FOUND AND ENABLE_SDL2)
|
if (YUZU_USE_EXTERNAL_SDL2)
|
||||||
if (NOT WIN32)
|
if (NOT WIN32)
|
||||||
# Yuzu itself needs: Events Joystick Haptic Sensor Timers Audio
|
# Yuzu itself needs: Events Joystick Haptic Sensor Timers Audio
|
||||||
# Yuzu-cmd also needs: Video (depends on Loadso/Dlopen)
|
# Yuzu-cmd also needs: Video (depends on Loadso/Dlopen)
|
||||||
|
|
|
@ -10,15 +10,7 @@
|
||||||
#include <thread>
|
#include <thread>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
|
||||||
// Ignore -Wimplicit-fallthrough due to https://github.com/libsdl-org/SDL/issues/4307
|
|
||||||
#ifdef __GNUC__
|
|
||||||
#pragma GCC diagnostic push
|
|
||||||
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough"
|
|
||||||
#endif
|
|
||||||
#include <SDL.h>
|
#include <SDL.h>
|
||||||
#ifdef __GNUC__
|
|
||||||
#pragma GCC diagnostic pop
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
#include "common/threadsafe_queue.h"
|
#include "common/threadsafe_queue.h"
|
||||||
|
|
|
@ -38,6 +38,11 @@ target_include_directories(yuzu-cmd PRIVATE ${RESOURCES_DIR})
|
||||||
|
|
||||||
target_include_directories(yuzu-cmd PRIVATE ../../externals/Vulkan-Headers/include)
|
target_include_directories(yuzu-cmd PRIVATE ../../externals/Vulkan-Headers/include)
|
||||||
|
|
||||||
|
if (YUZU_USE_EXTERNAL_SDL2)
|
||||||
|
target_compile_definitions(yuzu-cmd PRIVATE -DYUZU_USE_EXTERNAL_SDL2)
|
||||||
|
target_include_directories(yuzu-cmd PRIVATE ${PROJECT_BINARY_DIR}/externals/SDL/include)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(UNIX AND NOT APPLE)
|
if(UNIX AND NOT APPLE)
|
||||||
install(TARGETS yuzu-cmd RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/bin")
|
install(TARGETS yuzu-cmd RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/bin")
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -2,15 +2,7 @@
|
||||||
// Licensed under GPLv2 or any later version
|
// Licensed under GPLv2 or any later version
|
||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
// Ignore -Wimplicit-fallthrough due to https://github.com/libsdl-org/SDL/issues/4307
|
|
||||||
#ifdef __clang__
|
|
||||||
#pragma clang diagnostic push
|
|
||||||
#pragma clang diagnostic ignored "-Wimplicit-fallthrough"
|
|
||||||
#endif
|
|
||||||
#include <SDL.h>
|
#include <SDL.h>
|
||||||
#ifdef __clang__
|
|
||||||
#pragma clang diagnostic pop
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "common/logging/log.h"
|
#include "common/logging/log.h"
|
||||||
#include "common/scm_rev.h"
|
#include "common/scm_rev.h"
|
||||||
|
|
|
@ -7,15 +7,7 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#define SDL_MAIN_HANDLED
|
#define SDL_MAIN_HANDLED
|
||||||
// Ignore -Wimplicit-fallthrough due to https://github.com/libsdl-org/SDL/issues/4307
|
|
||||||
#ifdef __clang__
|
|
||||||
#pragma clang diagnostic push
|
|
||||||
#pragma clang diagnostic ignored "-Wimplicit-fallthrough"
|
|
||||||
#endif
|
|
||||||
#include <SDL.h>
|
#include <SDL.h>
|
||||||
#ifdef __clang__
|
|
||||||
#pragma clang diagnostic pop
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <fmt/format.h>
|
#include <fmt/format.h>
|
||||||
#include <glad/glad.h>
|
#include <glad/glad.h>
|
||||||
|
|
|
@ -15,16 +15,13 @@
|
||||||
#include "video_core/renderer_vulkan/renderer_vulkan.h"
|
#include "video_core/renderer_vulkan/renderer_vulkan.h"
|
||||||
#include "yuzu_cmd/emu_window/emu_window_sdl2_vk.h"
|
#include "yuzu_cmd/emu_window/emu_window_sdl2_vk.h"
|
||||||
|
|
||||||
// Include these late to avoid polluting everything with Xlib macros
|
#ifdef YUZU_USE_EXTERNAL_SDL2
|
||||||
// Ignore -Wimplicit-fallthrough due to https://github.com/libsdl-org/SDL/issues/4307
|
// Include this before SDL.h to prevent the external from including a dummy
|
||||||
#ifdef __clang__
|
#define USING_GENERATED_CONFIG_H
|
||||||
#pragma clang diagnostic push
|
#include <SDL_config.h>
|
||||||
#pragma clang diagnostic ignored "-Wimplicit-fallthrough"
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <SDL.h>
|
#include <SDL.h>
|
||||||
#ifdef __clang__
|
|
||||||
#pragma clang diagnostic pop
|
|
||||||
#endif
|
|
||||||
#include <SDL_syswm.h>
|
#include <SDL_syswm.h>
|
||||||
|
|
||||||
EmuWindow_SDL2_VK::EmuWindow_SDL2_VK(InputCommon::InputSubsystem* input_subsystem)
|
EmuWindow_SDL2_VK::EmuWindow_SDL2_VK(InputCommon::InputSubsystem* input_subsystem)
|
||||||
|
@ -51,6 +48,11 @@ EmuWindow_SDL2_VK::EmuWindow_SDL2_VK(InputCommon::InputSubsystem* input_subsyste
|
||||||
window_info.type = Core::Frontend::WindowSystemType::Windows;
|
window_info.type = Core::Frontend::WindowSystemType::Windows;
|
||||||
window_info.render_surface = reinterpret_cast<void*>(wm.info.win.window);
|
window_info.render_surface = reinterpret_cast<void*>(wm.info.win.window);
|
||||||
break;
|
break;
|
||||||
|
#else
|
||||||
|
case SDL_SYSWM_TYPE::SDL_SYSWM_WINDOWS:
|
||||||
|
LOG_CRITICAL(Frontend, "Window manager subsystem Windows not compiled");
|
||||||
|
std::exit(EXIT_FAILURE);
|
||||||
|
break;
|
||||||
#endif
|
#endif
|
||||||
#ifdef SDL_VIDEO_DRIVER_X11
|
#ifdef SDL_VIDEO_DRIVER_X11
|
||||||
case SDL_SYSWM_TYPE::SDL_SYSWM_X11:
|
case SDL_SYSWM_TYPE::SDL_SYSWM_X11:
|
||||||
|
@ -58,6 +60,11 @@ EmuWindow_SDL2_VK::EmuWindow_SDL2_VK(InputCommon::InputSubsystem* input_subsyste
|
||||||
window_info.display_connection = wm.info.x11.display;
|
window_info.display_connection = wm.info.x11.display;
|
||||||
window_info.render_surface = reinterpret_cast<void*>(wm.info.x11.window);
|
window_info.render_surface = reinterpret_cast<void*>(wm.info.x11.window);
|
||||||
break;
|
break;
|
||||||
|
#else
|
||||||
|
case SDL_SYSWM_TYPE::SDL_SYSWM_X11:
|
||||||
|
LOG_CRITICAL(Frontend, "Window manager subsystem X11 not compiled");
|
||||||
|
std::exit(EXIT_FAILURE);
|
||||||
|
break;
|
||||||
#endif
|
#endif
|
||||||
#ifdef SDL_VIDEO_DRIVER_WAYLAND
|
#ifdef SDL_VIDEO_DRIVER_WAYLAND
|
||||||
case SDL_SYSWM_TYPE::SDL_SYSWM_WAYLAND:
|
case SDL_SYSWM_TYPE::SDL_SYSWM_WAYLAND:
|
||||||
|
@ -65,6 +72,11 @@ EmuWindow_SDL2_VK::EmuWindow_SDL2_VK(InputCommon::InputSubsystem* input_subsyste
|
||||||
window_info.display_connection = wm.info.wl.display;
|
window_info.display_connection = wm.info.wl.display;
|
||||||
window_info.render_surface = wm.info.wl.surface;
|
window_info.render_surface = wm.info.wl.surface;
|
||||||
break;
|
break;
|
||||||
|
#else
|
||||||
|
case SDL_SYSWM_TYPE::SDL_SYSWM_WAYLAND:
|
||||||
|
LOG_CRITICAL(Frontend, "Window manager subsystem Wayland not compiled");
|
||||||
|
std::exit(EXIT_FAILURE);
|
||||||
|
break;
|
||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
LOG_CRITICAL(Frontend, "Window manager subsystem not implemented");
|
LOG_CRITICAL(Frontend, "Window manager subsystem not implemented");
|
||||||
|
|
Loading…
Reference in a new issue