mirror of
https://github.com/citra-emu/citra.git
synced 2024-11-23 23:20:10 +00:00
build: Add flags to toggle specific renderer backends. (#7375)
This commit is contained in:
parent
77fce3cf82
commit
82294425e3
@ -80,6 +80,10 @@ option(ENABLE_OPENAL "Enables the OpenAL audio backend" ON)
|
|||||||
|
|
||||||
CMAKE_DEPENDENT_OPTION(ENABLE_LIBUSB "Enable libusb for GameCube Adapter support" ON "NOT IOS" OFF)
|
CMAKE_DEPENDENT_OPTION(ENABLE_LIBUSB "Enable libusb for GameCube Adapter support" ON "NOT IOS" OFF)
|
||||||
|
|
||||||
|
CMAKE_DEPENDENT_OPTION(ENABLE_SOFTWARE_RENDERER "Enables the software renderer" ON "NOT ANDROID" OFF)
|
||||||
|
CMAKE_DEPENDENT_OPTION(ENABLE_OPENGL "Enables the OpenGL renderer" ON "NOT APPLE" OFF)
|
||||||
|
option(ENABLE_VULKAN "Enables the Vulkan renderer" ON)
|
||||||
|
|
||||||
option(USE_DISCORD_PRESENCE "Enables Discord Rich Presence" OFF)
|
option(USE_DISCORD_PRESENCE "Enables Discord Rich Presence" OFF)
|
||||||
|
|
||||||
CMAKE_DEPENDENT_OPTION(CITRA_ENABLE_BUNDLE_TARGET "Enable the distribution bundling target." ON "NOT ANDROID AND NOT IOS" OFF)
|
CMAKE_DEPENDENT_OPTION(CITRA_ENABLE_BUNDLE_TARGET "Enable the distribution bundling target." ON "NOT ANDROID AND NOT IOS" OFF)
|
||||||
@ -255,20 +259,22 @@ find_package(tsl-robin-map QUIET)
|
|||||||
# ======================================
|
# ======================================
|
||||||
|
|
||||||
if (APPLE)
|
if (APPLE)
|
||||||
if (NOT USE_SYSTEM_MOLTENVK)
|
|
||||||
download_moltenvk()
|
|
||||||
endif()
|
|
||||||
find_library(MOLTENVK_LIBRARY MoltenVK REQUIRED)
|
|
||||||
message(STATUS "Using MoltenVK at ${MOLTENVK_LIBRARY}.")
|
|
||||||
|
|
||||||
if (NOT IOS)
|
if (NOT IOS)
|
||||||
# Umbrella framework for everything GUI-related
|
# Umbrella framework for everything GUI-related
|
||||||
find_library(COCOA_LIBRARY Cocoa REQUIRED)
|
find_library(COCOA_LIBRARY Cocoa REQUIRED)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
find_library(AVFOUNDATION_LIBRARY AVFoundation REQUIRED)
|
find_library(AVFOUNDATION_LIBRARY AVFoundation REQUIRED)
|
||||||
find_library(IOSURFACE_LIBRARY IOSurface REQUIRED)
|
find_library(IOSURFACE_LIBRARY IOSurface REQUIRED)
|
||||||
set(PLATFORM_LIBRARIES ${COCOA_LIBRARY} ${AVFOUNDATION_LIBRARY} ${IOSURFACE_LIBRARY} ${MOLTENVK_LIBRARY})
|
set(PLATFORM_LIBRARIES ${COCOA_LIBRARY} ${AVFOUNDATION_LIBRARY} ${IOSURFACE_LIBRARY} ${MOLTENVK_LIBRARY})
|
||||||
|
|
||||||
|
if (ENABLE_VULKAN)
|
||||||
|
if (NOT USE_SYSTEM_MOLTENVK)
|
||||||
|
download_moltenvk()
|
||||||
|
endif()
|
||||||
|
find_library(MOLTENVK_LIBRARY MoltenVK REQUIRED)
|
||||||
|
message(STATUS "Using MoltenVK at ${MOLTENVK_LIBRARY}.")
|
||||||
|
set(PLATFORM_LIBRARIES ${PLATFORM_LIBRARIES} ${MOLTENVK_LIBRARY})
|
||||||
|
endif()
|
||||||
elseif (WIN32)
|
elseif (WIN32)
|
||||||
set(PLATFORM_LIBRARIES winmm ws2_32)
|
set(PLATFORM_LIBRARIES winmm ws2_32)
|
||||||
if (MINGW)
|
if (MINGW)
|
||||||
|
106
externals/CMakeLists.txt
vendored
106
externals/CMakeLists.txt
vendored
@ -120,29 +120,6 @@ if (MSVC)
|
|||||||
add_subdirectory(getopt)
|
add_subdirectory(getopt)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Glad
|
|
||||||
add_subdirectory(glad)
|
|
||||||
|
|
||||||
# glslang
|
|
||||||
if(USE_SYSTEM_GLSLANG)
|
|
||||||
find_package(glslang REQUIRED)
|
|
||||||
add_library(glslang INTERFACE)
|
|
||||||
add_library(SPIRV INTERFACE)
|
|
||||||
target_link_libraries(glslang INTERFACE glslang::glslang)
|
|
||||||
target_link_libraries(SPIRV INTERFACE glslang::SPIRV)
|
|
||||||
# System include path is different from submodule include path
|
|
||||||
get_target_property(GLSLANG_PREFIX glslang::SPIRV INTERFACE_INCLUDE_DIRECTORIES)
|
|
||||||
target_include_directories(SPIRV SYSTEM INTERFACE "${GLSLANG_PREFIX}/glslang")
|
|
||||||
else()
|
|
||||||
set(SKIP_GLSLANG_INSTALL ON CACHE BOOL "")
|
|
||||||
set(ENABLE_GLSLANG_BINARIES OFF CACHE BOOL "")
|
|
||||||
set(ENABLE_SPVREMAPPER OFF CACHE BOOL "")
|
|
||||||
set(ENABLE_CTEST OFF CACHE BOOL "")
|
|
||||||
set(ENABLE_HLSL OFF CACHE BOOL "")
|
|
||||||
set(BUILD_EXTERNAL OFF CACHE BOOL "")
|
|
||||||
add_subdirectory(glslang)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# inih
|
# inih
|
||||||
if(USE_SYSTEM_INIH)
|
if(USE_SYSTEM_INIH)
|
||||||
find_package(inih REQUIRED COMPONENTS inih inir)
|
find_package(inih REQUIRED COMPONENTS inih inir)
|
||||||
@ -197,9 +174,6 @@ if(NOT USE_SYSTEM_SOUNDTOUCH)
|
|||||||
target_compile_definitions(SoundTouch PUBLIC SOUNDTOUCH_INTEGER_SAMPLES)
|
target_compile_definitions(SoundTouch PUBLIC SOUNDTOUCH_INTEGER_SAMPLES)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# sirit
|
|
||||||
add_subdirectory(sirit EXCLUDE_FROM_ALL)
|
|
||||||
|
|
||||||
# Teakra
|
# Teakra
|
||||||
add_subdirectory(teakra EXCLUDE_FROM_ALL)
|
add_subdirectory(teakra EXCLUDE_FROM_ALL)
|
||||||
|
|
||||||
@ -371,32 +345,64 @@ if (ENABLE_OPENAL)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# VMA
|
# OpenGL dependencies
|
||||||
if(USE_SYSTEM_VMA)
|
if (ENABLE_OPENGL)
|
||||||
add_library(vma INTERFACE)
|
# Glad
|
||||||
find_package(VulkanMemoryAllocator REQUIRED)
|
add_subdirectory(glad)
|
||||||
if(TARGET GPUOpen::VulkanMemoryAllocator)
|
|
||||||
message(STATUS "Found VulkanMemoryAllocator")
|
|
||||||
target_link_libraries(vma INTERFACE GPUOpen::VulkanMemoryAllocator)
|
|
||||||
endif()
|
|
||||||
else()
|
|
||||||
add_library(vma INTERFACE)
|
|
||||||
target_include_directories(vma SYSTEM INTERFACE ./vma/include)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# vulkan-headers
|
# Vulkan dependencies
|
||||||
add_library(vulkan-headers INTERFACE)
|
if (ENABLE_VULKAN)
|
||||||
if(USE_SYSTEM_VULKAN_HEADERS)
|
# glslang
|
||||||
find_package(Vulkan REQUIRED)
|
if(USE_SYSTEM_GLSLANG)
|
||||||
if(TARGET Vulkan::Headers)
|
find_package(glslang REQUIRED)
|
||||||
message(STATUS "Found Vulkan headers")
|
add_library(glslang INTERFACE)
|
||||||
target_link_libraries(vulkan-headers INTERFACE Vulkan::Headers)
|
add_library(SPIRV INTERFACE)
|
||||||
|
target_link_libraries(glslang INTERFACE glslang::glslang)
|
||||||
|
target_link_libraries(SPIRV INTERFACE glslang::SPIRV)
|
||||||
|
# System include path is different from submodule include path
|
||||||
|
get_target_property(GLSLANG_PREFIX glslang::SPIRV INTERFACE_INCLUDE_DIRECTORIES)
|
||||||
|
target_include_directories(SPIRV SYSTEM INTERFACE "${GLSLANG_PREFIX}/glslang")
|
||||||
|
else()
|
||||||
|
set(SKIP_GLSLANG_INSTALL ON CACHE BOOL "")
|
||||||
|
set(ENABLE_GLSLANG_BINARIES OFF CACHE BOOL "")
|
||||||
|
set(ENABLE_SPVREMAPPER OFF CACHE BOOL "")
|
||||||
|
set(ENABLE_CTEST OFF CACHE BOOL "")
|
||||||
|
set(ENABLE_HLSL OFF CACHE BOOL "")
|
||||||
|
set(BUILD_EXTERNAL OFF CACHE BOOL "")
|
||||||
|
add_subdirectory(glslang)
|
||||||
endif()
|
endif()
|
||||||
else()
|
|
||||||
target_include_directories(vulkan-headers SYSTEM INTERFACE ./vulkan-headers/include)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# adrenotools
|
# sirit
|
||||||
if (ANDROID AND "arm64" IN_LIST ARCHITECTURE)
|
add_subdirectory(sirit EXCLUDE_FROM_ALL)
|
||||||
add_subdirectory(libadrenotools)
|
|
||||||
|
# VMA
|
||||||
|
if(USE_SYSTEM_VMA)
|
||||||
|
add_library(vma INTERFACE)
|
||||||
|
find_package(VulkanMemoryAllocator REQUIRED)
|
||||||
|
if(TARGET GPUOpen::VulkanMemoryAllocator)
|
||||||
|
message(STATUS "Found VulkanMemoryAllocator")
|
||||||
|
target_link_libraries(vma INTERFACE GPUOpen::VulkanMemoryAllocator)
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
add_library(vma INTERFACE)
|
||||||
|
target_include_directories(vma SYSTEM INTERFACE ./vma/include)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# vulkan-headers
|
||||||
|
add_library(vulkan-headers INTERFACE)
|
||||||
|
if(USE_SYSTEM_VULKAN_HEADERS)
|
||||||
|
find_package(Vulkan REQUIRED)
|
||||||
|
if(TARGET Vulkan::Headers)
|
||||||
|
message(STATUS "Found Vulkan headers")
|
||||||
|
target_link_libraries(vulkan-headers INTERFACE Vulkan::Headers)
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
target_include_directories(vulkan-headers SYSTEM INTERFACE ./vulkan-headers/include)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# adrenotools
|
||||||
|
if (ANDROID AND "arm64" IN_LIST ARCHITECTURE)
|
||||||
|
add_subdirectory(libadrenotools)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
@ -159,8 +159,14 @@ else()
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (NOT APPLE)
|
if(ENABLE_SOFTWARE_RENDERER)
|
||||||
add_compile_definitions(HAS_OPENGL)
|
add_compile_definitions(ENABLE_SOFTWARE_RENDERER)
|
||||||
|
endif()
|
||||||
|
if(ENABLE_OPENGL)
|
||||||
|
add_compile_definitions(ENABLE_OPENGL)
|
||||||
|
endif()
|
||||||
|
if(ENABLE_VULKAN)
|
||||||
|
add_compile_definitions(ENABLE_VULKAN)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_subdirectory(common)
|
add_subdirectory(common)
|
||||||
|
@ -19,10 +19,6 @@ add_library(citra-android SHARED
|
|||||||
default_ini.h
|
default_ini.h
|
||||||
emu_window/emu_window.cpp
|
emu_window/emu_window.cpp
|
||||||
emu_window/emu_window.h
|
emu_window/emu_window.h
|
||||||
emu_window/emu_window_gl.cpp
|
|
||||||
emu_window/emu_window_gl.h
|
|
||||||
emu_window/emu_window_vk.cpp
|
|
||||||
emu_window/emu_window_vk.h
|
|
||||||
game_info.cpp
|
game_info.cpp
|
||||||
game_settings.cpp
|
game_settings.cpp
|
||||||
game_settings.h
|
game_settings.h
|
||||||
@ -35,10 +31,23 @@ add_library(citra-android SHARED
|
|||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(citra-android PRIVATE audio_core citra_common citra_core input_common network)
|
target_link_libraries(citra-android PRIVATE audio_core citra_common citra_core input_common network)
|
||||||
target_link_libraries(citra-android PRIVATE android camera2ndk EGL glad inih jnigraphics log mediandk yuv)
|
target_link_libraries(citra-android PRIVATE android camera2ndk inih jnigraphics log mediandk yuv)
|
||||||
|
|
||||||
if ("arm64" IN_LIST ARCHITECTURE)
|
if (ENABLE_OPENGL)
|
||||||
target_link_libraries(citra-android PRIVATE adrenotools)
|
target_sources(citra-android PRIVATE
|
||||||
|
emu_window/emu_window_gl.cpp
|
||||||
|
emu_window/emu_window_gl.h
|
||||||
|
)
|
||||||
|
target_link_libraries(citra-android PRIVATE EGL glad)
|
||||||
|
endif()
|
||||||
|
if (ENABLE_VULKAN)
|
||||||
|
target_sources(citra-android PRIVATE
|
||||||
|
emu_window/emu_window_vk.cpp
|
||||||
|
emu_window/emu_window_vk.h
|
||||||
|
)
|
||||||
|
if ("arm64" IN_LIST ARCHITECTURE)
|
||||||
|
target_link_libraries(citra-android PRIVATE adrenotools)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(CPACK_PACKAGE_EXECUTABLES ${CPACK_PACKAGE_EXECUTABLES} citra-android)
|
set(CPACK_PACKAGE_EXECUTABLES ${CPACK_PACKAGE_EXECUTABLES} citra-android)
|
||||||
|
@ -45,8 +45,12 @@
|
|||||||
#include "jni/camera/ndk_camera.h"
|
#include "jni/camera/ndk_camera.h"
|
||||||
#include "jni/camera/still_image_camera.h"
|
#include "jni/camera/still_image_camera.h"
|
||||||
#include "jni/config.h"
|
#include "jni/config.h"
|
||||||
|
#ifdef ENABLE_OPENGL
|
||||||
#include "jni/emu_window/emu_window_gl.h"
|
#include "jni/emu_window/emu_window_gl.h"
|
||||||
|
#endif
|
||||||
|
#ifdef ENABLE_VULKAN
|
||||||
#include "jni/emu_window/emu_window_vk.h"
|
#include "jni/emu_window/emu_window_vk.h"
|
||||||
|
#endif
|
||||||
#include "jni/game_settings.h"
|
#include "jni/game_settings.h"
|
||||||
#include "jni/id_cache.h"
|
#include "jni/id_cache.h"
|
||||||
#include "jni/input_manager.h"
|
#include "jni/input_manager.h"
|
||||||
@ -55,7 +59,7 @@
|
|||||||
#include "video_core/gpu.h"
|
#include "video_core/gpu.h"
|
||||||
#include "video_core/renderer_base.h"
|
#include "video_core/renderer_base.h"
|
||||||
|
|
||||||
#if CITRA_ARCH(arm64)
|
#if defined(ENABLE_VULKAN) && CITRA_ARCH(arm64)
|
||||||
#include <adrenotools/driver.h>
|
#include <adrenotools/driver.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -142,15 +146,29 @@ static Core::System::ResultStatus RunCitra(const std::string& filepath) {
|
|||||||
|
|
||||||
const auto graphics_api = Settings::values.graphics_api.GetValue();
|
const auto graphics_api = Settings::values.graphics_api.GetValue();
|
||||||
switch (graphics_api) {
|
switch (graphics_api) {
|
||||||
|
#ifdef ENABLE_OPENGL
|
||||||
case Settings::GraphicsAPI::OpenGL:
|
case Settings::GraphicsAPI::OpenGL:
|
||||||
window = std::make_unique<EmuWindow_Android_OpenGL>(system, s_surf);
|
window = std::make_unique<EmuWindow_Android_OpenGL>(system, s_surf);
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
|
#ifdef ENABLE_VULKAN
|
||||||
case Settings::GraphicsAPI::Vulkan:
|
case Settings::GraphicsAPI::Vulkan:
|
||||||
window = std::make_unique<EmuWindow_Android_Vulkan>(s_surf, vulkan_library);
|
window = std::make_unique<EmuWindow_Android_Vulkan>(s_surf, vulkan_library);
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
default:
|
default:
|
||||||
LOG_CRITICAL(Frontend, "Unknown graphics API {}, using Vulkan", graphics_api);
|
LOG_CRITICAL(Frontend,
|
||||||
|
"Unknown or unsupported graphics API {}, falling back to available default",
|
||||||
|
graphics_api);
|
||||||
|
#ifdef ENABLE_OPENGL
|
||||||
|
window = std::make_unique<EmuWindow_Android_OpenGL>(system, s_surf);
|
||||||
|
#elif ENABLE_VULKAN
|
||||||
window = std::make_unique<EmuWindow_Android_Vulkan>(s_surf, vulkan_library);
|
window = std::make_unique<EmuWindow_Android_Vulkan>(s_surf, vulkan_library);
|
||||||
|
#else
|
||||||
|
// TODO: Add a null renderer backend for this, perhaps.
|
||||||
|
#error "At least one renderer must be enabled."
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Forces a config reload on game boot, if the user changed settings in the UI
|
// Forces a config reload on game boot, if the user changed settings in the UI
|
||||||
@ -239,7 +257,7 @@ static Core::System::ResultStatus RunCitra(const std::string& filepath) {
|
|||||||
void InitializeGpuDriver(const std::string& hook_lib_dir, const std::string& custom_driver_dir,
|
void InitializeGpuDriver(const std::string& hook_lib_dir, const std::string& custom_driver_dir,
|
||||||
const std::string& custom_driver_name,
|
const std::string& custom_driver_name,
|
||||||
const std::string& file_redirect_dir) {
|
const std::string& file_redirect_dir) {
|
||||||
#if CITRA_ARCH(arm64)
|
#if defined(ENABLE_VULKAN) && CITRA_ARCH(arm64)
|
||||||
void* handle{};
|
void* handle{};
|
||||||
const char* file_redirect_dir_{};
|
const char* file_redirect_dir_{};
|
||||||
int featureFlags{};
|
int featureFlags{};
|
||||||
|
@ -8,25 +8,42 @@ add_executable(citra
|
|||||||
default_ini.h
|
default_ini.h
|
||||||
emu_window/emu_window_sdl2.cpp
|
emu_window/emu_window_sdl2.cpp
|
||||||
emu_window/emu_window_sdl2.h
|
emu_window/emu_window_sdl2.h
|
||||||
emu_window/emu_window_sdl2_gl.cpp
|
|
||||||
emu_window/emu_window_sdl2_gl.h
|
|
||||||
emu_window/emu_window_sdl2_sw.cpp
|
|
||||||
emu_window/emu_window_sdl2_sw.h
|
|
||||||
emu_window/emu_window_sdl2_vk.cpp
|
|
||||||
emu_window/emu_window_sdl2_vk.h
|
|
||||||
precompiled_headers.h
|
precompiled_headers.h
|
||||||
resource.h
|
resource.h
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if (ENABLE_SOFTWARE_RENDERER)
|
||||||
|
target_sources(citra PRIVATE
|
||||||
|
emu_window/emu_window_sdl2_sw.cpp
|
||||||
|
emu_window/emu_window_sdl2_sw.h
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
if (ENABLE_OPENGL)
|
||||||
|
target_sources(citra PRIVATE
|
||||||
|
emu_window/emu_window_sdl2_gl.cpp
|
||||||
|
emu_window/emu_window_sdl2_gl.h
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
if (ENABLE_VULKAN)
|
||||||
|
target_sources(citra PRIVATE
|
||||||
|
emu_window/emu_window_sdl2_vk.cpp
|
||||||
|
emu_window/emu_window_sdl2_vk.h
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
create_target_directory_groups(citra)
|
create_target_directory_groups(citra)
|
||||||
|
|
||||||
target_link_libraries(citra PRIVATE citra_common citra_core input_common network)
|
target_link_libraries(citra PRIVATE citra_common citra_core input_common network)
|
||||||
target_link_libraries(citra PRIVATE inih glad)
|
target_link_libraries(citra PRIVATE inih)
|
||||||
if (MSVC)
|
if (MSVC)
|
||||||
target_link_libraries(citra PRIVATE getopt)
|
target_link_libraries(citra PRIVATE getopt)
|
||||||
endif()
|
endif()
|
||||||
target_link_libraries(citra PRIVATE ${PLATFORM_LIBRARIES} SDL2::SDL2 Threads::Threads)
|
target_link_libraries(citra PRIVATE ${PLATFORM_LIBRARIES} SDL2::SDL2 Threads::Threads)
|
||||||
|
|
||||||
|
if (ENABLE_OPENGL)
|
||||||
|
target_link_libraries(citra PRIVATE glad)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(UNIX AND NOT APPLE)
|
if(UNIX AND NOT APPLE)
|
||||||
install(TARGETS citra RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/bin")
|
install(TARGETS citra RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/bin")
|
||||||
endif()
|
endif()
|
||||||
|
@ -13,9 +13,15 @@
|
|||||||
|
|
||||||
#include "citra/config.h"
|
#include "citra/config.h"
|
||||||
#include "citra/emu_window/emu_window_sdl2.h"
|
#include "citra/emu_window/emu_window_sdl2.h"
|
||||||
|
#ifdef ENABLE_OPENGL
|
||||||
#include "citra/emu_window/emu_window_sdl2_gl.h"
|
#include "citra/emu_window/emu_window_sdl2_gl.h"
|
||||||
|
#endif
|
||||||
|
#ifdef ENABLE_SOFTWARE_RENDERER
|
||||||
#include "citra/emu_window/emu_window_sdl2_sw.h"
|
#include "citra/emu_window/emu_window_sdl2_sw.h"
|
||||||
|
#endif
|
||||||
|
#ifdef ENABLE_VULKAN
|
||||||
#include "citra/emu_window/emu_window_sdl2_vk.h"
|
#include "citra/emu_window/emu_window_sdl2_vk.h"
|
||||||
|
#endif
|
||||||
#include "common/common_paths.h"
|
#include "common/common_paths.h"
|
||||||
#include "common/detached_tasks.h"
|
#include "common/detached_tasks.h"
|
||||||
#include "common/file_util.h"
|
#include "common/file_util.h"
|
||||||
@ -354,16 +360,36 @@ int main(int argc, char** argv) {
|
|||||||
|
|
||||||
const auto create_emu_window = [&](bool fullscreen,
|
const auto create_emu_window = [&](bool fullscreen,
|
||||||
bool is_secondary) -> std::unique_ptr<EmuWindow_SDL2> {
|
bool is_secondary) -> std::unique_ptr<EmuWindow_SDL2> {
|
||||||
switch (Settings::values.graphics_api.GetValue()) {
|
const auto graphics_api = Settings::values.graphics_api.GetValue();
|
||||||
|
switch (graphics_api) {
|
||||||
|
#ifdef ENABLE_OPENGL
|
||||||
case Settings::GraphicsAPI::OpenGL:
|
case Settings::GraphicsAPI::OpenGL:
|
||||||
return std::make_unique<EmuWindow_SDL2_GL>(system, fullscreen, is_secondary);
|
return std::make_unique<EmuWindow_SDL2_GL>(system, fullscreen, is_secondary);
|
||||||
|
#endif
|
||||||
|
#ifdef ENABLE_VULKAN
|
||||||
case Settings::GraphicsAPI::Vulkan:
|
case Settings::GraphicsAPI::Vulkan:
|
||||||
return std::make_unique<EmuWindow_SDL2_VK>(system, fullscreen, is_secondary);
|
return std::make_unique<EmuWindow_SDL2_VK>(system, fullscreen, is_secondary);
|
||||||
|
#endif
|
||||||
|
#ifdef ENABLE_SOFTWARE_RENDERER
|
||||||
case Settings::GraphicsAPI::Software:
|
case Settings::GraphicsAPI::Software:
|
||||||
return std::make_unique<EmuWindow_SDL2_SW>(system, fullscreen, is_secondary);
|
return std::make_unique<EmuWindow_SDL2_SW>(system, fullscreen, is_secondary);
|
||||||
|
#endif
|
||||||
|
default:
|
||||||
|
LOG_CRITICAL(
|
||||||
|
Frontend,
|
||||||
|
"Unknown or unsupported graphics API {}, falling back to available default",
|
||||||
|
graphics_api);
|
||||||
|
#ifdef ENABLE_OPENGL
|
||||||
|
return std::make_unique<EmuWindow_SDL2_GL>(system, fullscreen, is_secondary);
|
||||||
|
#elif ENABLE_VULKAN
|
||||||
|
return std::make_unique<EmuWindow_SDL2_VK>(system, fullscreen, is_secondary);
|
||||||
|
#elif ENABLE_SOFTWARE_RENDERER
|
||||||
|
return std::make_unique<EmuWindow_SDL2_SW>(system, fullscreen, is_secondary);
|
||||||
|
#else
|
||||||
|
// TODO: Add a null renderer backend for this, perhaps.
|
||||||
|
#error "At least one renderer must be enabled."
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
LOG_ERROR(Frontend, "Invalid Graphics API, using OpenGL");
|
|
||||||
return std::make_unique<EmuWindow_SDL2_GL>(system, fullscreen, is_secondary);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const auto emu_window{create_emu_window(fullscreen, false)};
|
const auto emu_window{create_emu_window(fullscreen, false)};
|
||||||
|
@ -185,10 +185,15 @@ add_executable(citra-qt
|
|||||||
util/spinbox.h
|
util/spinbox.h
|
||||||
util/util.cpp
|
util/util.cpp
|
||||||
util/util.h
|
util/util.h
|
||||||
util/vk_device_info.cpp
|
|
||||||
util/vk_device_info.h
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if (ENABLE_VULKAN)
|
||||||
|
target_sources(citra-qt PRIVATE
|
||||||
|
util/vk_device_info.cpp
|
||||||
|
util/vk_device_info.h
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
file(GLOB COMPAT_LIST
|
file(GLOB COMPAT_LIST
|
||||||
${PROJECT_BINARY_DIR}/dist/compatibility_list/compatibility_list.qrc
|
${PROJECT_BINARY_DIR}/dist/compatibility_list/compatibility_list.qrc
|
||||||
${PROJECT_BINARY_DIR}/dist/compatibility_list/compatibility_list.json)
|
${PROJECT_BINARY_DIR}/dist/compatibility_list/compatibility_list.json)
|
||||||
@ -300,8 +305,16 @@ endif()
|
|||||||
create_target_directory_groups(citra-qt)
|
create_target_directory_groups(citra-qt)
|
||||||
|
|
||||||
target_link_libraries(citra-qt PRIVATE audio_core citra_common citra_core input_common network video_core)
|
target_link_libraries(citra-qt PRIVATE audio_core citra_common citra_core input_common network video_core)
|
||||||
target_link_libraries(citra-qt PRIVATE Boost::boost glad nihstro-headers Qt6::Widgets Qt6::Multimedia Qt6::Concurrent)
|
target_link_libraries(citra-qt PRIVATE Boost::boost nihstro-headers Qt6::Widgets Qt6::Multimedia Qt6::Concurrent)
|
||||||
target_link_libraries(citra-qt PRIVATE ${PLATFORM_LIBRARIES} Threads::Threads vulkan-headers)
|
target_link_libraries(citra-qt PRIVATE ${PLATFORM_LIBRARIES} Threads::Threads)
|
||||||
|
|
||||||
|
if (ENABLE_OPENGL)
|
||||||
|
target_link_libraries(citra-qt PRIVATE glad)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (ENABLE_VULKAN)
|
||||||
|
target_link_libraries(citra-qt PRIVATE vulkan-headers)
|
||||||
|
endif()
|
||||||
|
|
||||||
if (NOT WIN32)
|
if (NOT WIN32)
|
||||||
target_include_directories(citra-qt PRIVATE ${Qt6Gui_PRIVATE_INCLUDE_DIRS})
|
target_include_directories(citra-qt PRIVATE ${Qt6Gui_PRIVATE_INCLUDE_DIRS})
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
#include "video_core/renderer_base.h"
|
#include "video_core/renderer_base.h"
|
||||||
#include "video_core/renderer_software/renderer_software.h"
|
#include "video_core/renderer_software/renderer_software.h"
|
||||||
|
|
||||||
#ifdef HAS_OPENGL
|
#ifdef ENABLE_OPENGL
|
||||||
#include <glad/glad.h>
|
#include <glad/glad.h>
|
||||||
|
|
||||||
#include <QOffscreenSurface>
|
#include <QOffscreenSurface>
|
||||||
@ -137,7 +137,7 @@ void EmuThread::run() {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAS_OPENGL
|
#ifdef ENABLE_OPENGL
|
||||||
static std::unique_ptr<QOpenGLContext> CreateQOpenGLContext(bool gles) {
|
static std::unique_ptr<QOpenGLContext> CreateQOpenGLContext(bool gles) {
|
||||||
QSurfaceFormat format;
|
QSurfaceFormat format;
|
||||||
if (gles) {
|
if (gles) {
|
||||||
@ -258,7 +258,7 @@ public:
|
|||||||
virtual ~RenderWidget() = default;
|
virtual ~RenderWidget() = default;
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef HAS_OPENGL
|
#ifdef ENABLE_OPENGL
|
||||||
class OpenGLRenderWidget : public RenderWidget {
|
class OpenGLRenderWidget : public RenderWidget {
|
||||||
public:
|
public:
|
||||||
explicit OpenGLRenderWidget(GRenderWindow* parent, Core::System& system_, bool is_secondary)
|
explicit OpenGLRenderWidget(GRenderWindow* parent, Core::System& system_, bool is_secondary)
|
||||||
@ -305,6 +305,7 @@ private:
|
|||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef ENABLE_VULKAN
|
||||||
class VulkanRenderWidget : public RenderWidget {
|
class VulkanRenderWidget : public RenderWidget {
|
||||||
public:
|
public:
|
||||||
explicit VulkanRenderWidget(GRenderWindow* parent) : RenderWidget(parent) {
|
explicit VulkanRenderWidget(GRenderWindow* parent) : RenderWidget(parent) {
|
||||||
@ -324,7 +325,9 @@ public:
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef ENABLE_SOFTWARE_RENDERER
|
||||||
struct SoftwareRenderWidget : public RenderWidget {
|
struct SoftwareRenderWidget : public RenderWidget {
|
||||||
explicit SoftwareRenderWidget(GRenderWindow* parent, Core::System& system_)
|
explicit SoftwareRenderWidget(GRenderWindow* parent, Core::System& system_)
|
||||||
: RenderWidget(parent), system(system_) {}
|
: RenderWidget(parent), system(system_) {}
|
||||||
@ -377,6 +380,7 @@ struct SoftwareRenderWidget : public RenderWidget {
|
|||||||
private:
|
private:
|
||||||
Core::System& system;
|
Core::System& system;
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
static Frontend::WindowSystemType GetWindowSystemType() {
|
static Frontend::WindowSystemType GetWindowSystemType() {
|
||||||
// Determine WSI type based on Qt platform.
|
// Determine WSI type based on Qt platform.
|
||||||
@ -636,17 +640,40 @@ bool GRenderWindow::InitRenderTarget() {
|
|||||||
|
|
||||||
const auto graphics_api = Settings::values.graphics_api.GetValue();
|
const auto graphics_api = Settings::values.graphics_api.GetValue();
|
||||||
switch (graphics_api) {
|
switch (graphics_api) {
|
||||||
|
#ifdef ENABLE_SOFTWARE_RENDERER
|
||||||
case Settings::GraphicsAPI::Software:
|
case Settings::GraphicsAPI::Software:
|
||||||
InitializeSoftware();
|
InitializeSoftware();
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
|
#ifdef ENABLE_OPENGL
|
||||||
case Settings::GraphicsAPI::OpenGL:
|
case Settings::GraphicsAPI::OpenGL:
|
||||||
if (!InitializeOpenGL() || !LoadOpenGL()) {
|
if (!InitializeOpenGL() || !LoadOpenGL()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
|
#ifdef ENABLE_VULKAN
|
||||||
case Settings::GraphicsAPI::Vulkan:
|
case Settings::GraphicsAPI::Vulkan:
|
||||||
InitializeVulkan();
|
InitializeVulkan();
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
|
default:
|
||||||
|
LOG_CRITICAL(Frontend,
|
||||||
|
"Unknown or unsupported graphics API {}, falling back to available default",
|
||||||
|
graphics_api);
|
||||||
|
#ifdef ENABLE_OPENGL
|
||||||
|
if (!InitializeOpenGL() || !LoadOpenGL()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
#elif ENABLE_VULKAN
|
||||||
|
InitializeVulkan();
|
||||||
|
#elif ENABLE_SOFTWARE_RENDERER
|
||||||
|
InitializeSoftware();
|
||||||
|
#else
|
||||||
|
// TODO: Add a null renderer backend for this, perhaps.
|
||||||
|
#error "At least one renderer must be enabled."
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update the Window System information with the new render target
|
// Update the Window System information with the new render target
|
||||||
@ -700,8 +727,8 @@ void GRenderWindow::OnMinimalClientAreaChangeRequest(std::pair<u32, u32> minimal
|
|||||||
setMinimumSize(minimal_size.first, minimal_size.second);
|
setMinimumSize(minimal_size.first, minimal_size.second);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef ENABLE_OPENGL
|
||||||
bool GRenderWindow::InitializeOpenGL() {
|
bool GRenderWindow::InitializeOpenGL() {
|
||||||
#ifdef HAS_OPENGL
|
|
||||||
if (!QOpenGLContext::supportsThreadedOpenGL()) {
|
if (!QOpenGLContext::supportsThreadedOpenGL()) {
|
||||||
QMessageBox::warning(this, tr("OpenGL not available!"),
|
QMessageBox::warning(this, tr("OpenGL not available!"),
|
||||||
tr("OpenGL shared contexts are not supported."));
|
tr("OpenGL shared contexts are not supported."));
|
||||||
@ -726,33 +753,13 @@ bool GRenderWindow::InitializeOpenGL() {
|
|||||||
child_widget->windowHandle()->setFormat(format);
|
child_widget->windowHandle()->setFormat(format);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
#else
|
|
||||||
QMessageBox::warning(this, tr("OpenGL not available!"),
|
|
||||||
tr("Citra has not been compiled with OpenGL support."));
|
|
||||||
return false;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GRenderWindow::InitializeVulkan() {
|
|
||||||
auto child = new VulkanRenderWidget(this);
|
|
||||||
child_widget = child;
|
|
||||||
child_widget->windowHandle()->create();
|
|
||||||
main_context = std::make_unique<DummyContext>();
|
|
||||||
}
|
|
||||||
|
|
||||||
void GRenderWindow::InitializeSoftware() {
|
|
||||||
child_widget = new SoftwareRenderWidget(this, system);
|
|
||||||
main_context = std::make_unique<DummyContext>();
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef HAS_OPENGL
|
|
||||||
static void* GetProcAddressGL(const char* name) {
|
static void* GetProcAddressGL(const char* name) {
|
||||||
return reinterpret_cast<void*>(QOpenGLContext::currentContext()->getProcAddress(name));
|
return reinterpret_cast<void*>(QOpenGLContext::currentContext()->getProcAddress(name));
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
bool GRenderWindow::LoadOpenGL() {
|
bool GRenderWindow::LoadOpenGL() {
|
||||||
#ifdef HAS_OPENGL
|
|
||||||
auto context = CreateSharedContext();
|
auto context = CreateSharedContext();
|
||||||
auto scope = context->Acquire();
|
auto scope = context->Acquire();
|
||||||
const auto gles = context->IsGLES();
|
const auto gles = context->IsGLES();
|
||||||
@ -785,12 +792,24 @@ bool GRenderWindow::LoadOpenGL() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
#else
|
|
||||||
QMessageBox::warning(this, tr("OpenGL not available!"),
|
|
||||||
tr("Citra has not been compiled with OpenGL support."));
|
|
||||||
return false;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef ENABLE_VULKAN
|
||||||
|
void GRenderWindow::InitializeVulkan() {
|
||||||
|
auto child = new VulkanRenderWidget(this);
|
||||||
|
child_widget = child;
|
||||||
|
child_widget->windowHandle()->create();
|
||||||
|
main_context = std::make_unique<DummyContext>();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef ENABLE_SOFTWARE_RENDERER
|
||||||
|
void GRenderWindow::InitializeSoftware() {
|
||||||
|
child_widget = new SoftwareRenderWidget(this, system);
|
||||||
|
main_context = std::make_unique<DummyContext>();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void GRenderWindow::OnEmulationStarting(EmuThread* emu_thread) {
|
void GRenderWindow::OnEmulationStarting(EmuThread* emu_thread) {
|
||||||
this->emu_thread = emu_thread;
|
this->emu_thread = emu_thread;
|
||||||
@ -805,7 +824,7 @@ void GRenderWindow::showEvent(QShowEvent* event) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<Frontend::GraphicsContext> GRenderWindow::CreateSharedContext() const {
|
std::unique_ptr<Frontend::GraphicsContext> GRenderWindow::CreateSharedContext() const {
|
||||||
#ifdef HAS_OPENGL
|
#ifdef ENABLE_OPENGL
|
||||||
const auto graphics_api = Settings::values.graphics_api.GetValue();
|
const auto graphics_api = Settings::values.graphics_api.GetValue();
|
||||||
if (graphics_api == Settings::GraphicsAPI::OpenGL) {
|
if (graphics_api == Settings::GraphicsAPI::OpenGL) {
|
||||||
auto gl_context = static_cast<OpenGLSharedContext*>(main_context.get());
|
auto gl_context = static_cast<OpenGLSharedContext*>(main_context.get());
|
||||||
|
@ -186,10 +186,16 @@ private:
|
|||||||
|
|
||||||
void OnMinimalClientAreaChangeRequest(std::pair<u32, u32> minimal_size) override;
|
void OnMinimalClientAreaChangeRequest(std::pair<u32, u32> minimal_size) override;
|
||||||
|
|
||||||
|
#ifdef ENABLE_OPENGL
|
||||||
bool InitializeOpenGL();
|
bool InitializeOpenGL();
|
||||||
void InitializeVulkan();
|
|
||||||
void InitializeSoftware();
|
|
||||||
bool LoadOpenGL();
|
bool LoadOpenGL();
|
||||||
|
#endif
|
||||||
|
#ifdef ENABLE_VULKAN
|
||||||
|
void InitializeVulkan();
|
||||||
|
#endif
|
||||||
|
#ifdef ENABLE_SOFTWARE_RENDERER
|
||||||
|
void InitializeSoftware();
|
||||||
|
#endif
|
||||||
|
|
||||||
QWidget* child_widget = nullptr;
|
QWidget* child_widget = nullptr;
|
||||||
|
|
||||||
|
@ -13,7 +13,9 @@
|
|||||||
#include "common/logging/backend.h"
|
#include "common/logging/backend.h"
|
||||||
#include "common/settings.h"
|
#include "common/settings.h"
|
||||||
#include "ui_configure_debug.h"
|
#include "ui_configure_debug.h"
|
||||||
|
#ifdef ENABLE_VULKAN
|
||||||
#include "video_core/renderer_vulkan/vk_instance.h"
|
#include "video_core/renderer_vulkan/vk_instance.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
// The QSlider doesn't have an easy way to set a custom step amount,
|
// The QSlider doesn't have an easy way to set a custom step amount,
|
||||||
// so we can just convert from the sliders range (0 - 79) to the expected
|
// so we can just convert from the sliders range (0 - 79) to the expected
|
||||||
@ -36,6 +38,7 @@ ConfigureDebug::ConfigureDebug(bool is_powered_on_, QWidget* parent)
|
|||||||
QDesktopServices::openUrl(QUrl::fromLocalFile(path));
|
QDesktopServices::openUrl(QUrl::fromLocalFile(path));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
#ifdef ENABLE_VULKAN
|
||||||
connect(ui->toggle_renderer_debug, &QCheckBox::clicked, this, [this](bool checked) {
|
connect(ui->toggle_renderer_debug, &QCheckBox::clicked, this, [this](bool checked) {
|
||||||
if (checked && Settings::values.graphics_api.GetValue() == Settings::GraphicsAPI::Vulkan) {
|
if (checked && Settings::values.graphics_api.GetValue() == Settings::GraphicsAPI::Vulkan) {
|
||||||
try {
|
try {
|
||||||
@ -65,6 +68,7 @@ ConfigureDebug::ConfigureDebug(bool is_powered_on_, QWidget* parent)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
#endif
|
||||||
|
|
||||||
ui->toggle_cpu_jit->setEnabled(!is_powered_on);
|
ui->toggle_cpu_jit->setEnabled(!is_powered_on);
|
||||||
ui->toggle_renderer_debug->setEnabled(!is_powered_on);
|
ui->toggle_renderer_debug->setEnabled(!is_powered_on);
|
||||||
|
@ -7,7 +7,9 @@
|
|||||||
#include "citra_qt/configuration/configure_enhancements.h"
|
#include "citra_qt/configuration/configure_enhancements.h"
|
||||||
#include "common/settings.h"
|
#include "common/settings.h"
|
||||||
#include "ui_configure_enhancements.h"
|
#include "ui_configure_enhancements.h"
|
||||||
|
#ifdef ENABLE_OPENGL
|
||||||
#include "video_core/renderer_opengl/post_processing_opengl.h"
|
#include "video_core/renderer_opengl/post_processing_opengl.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
ConfigureEnhancements::ConfigureEnhancements(QWidget* parent)
|
ConfigureEnhancements::ConfigureEnhancements(QWidget* parent)
|
||||||
: QWidget(parent), ui(std::make_unique<Ui::ConfigureEnhancements>()) {
|
: QWidget(parent), ui(std::make_unique<Ui::ConfigureEnhancements>()) {
|
||||||
@ -117,12 +119,14 @@ void ConfigureEnhancements::updateShaders(Settings::StereoRenderOption stereo_op
|
|||||||
|
|
||||||
ui->shader_combobox->setCurrentIndex(0);
|
ui->shader_combobox->setCurrentIndex(0);
|
||||||
|
|
||||||
|
#ifdef ENABLE_OPENGL
|
||||||
for (const auto& shader : OpenGL::GetPostProcessingShaderList(
|
for (const auto& shader : OpenGL::GetPostProcessingShaderList(
|
||||||
stereo_option == Settings::StereoRenderOption::Anaglyph)) {
|
stereo_option == Settings::StereoRenderOption::Anaglyph)) {
|
||||||
ui->shader_combobox->addItem(QString::fromStdString(shader));
|
ui->shader_combobox->addItem(QString::fromStdString(shader));
|
||||||
if (current_shader == shader)
|
if (current_shader == shader)
|
||||||
ui->shader_combobox->setCurrentIndex(ui->shader_combobox->count() - 1);
|
ui->shader_combobox->setCurrentIndex(ui->shader_combobox->count() - 1);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureEnhancements::RetranslateUI() {
|
void ConfigureEnhancements::RetranslateUI() {
|
||||||
|
@ -3,11 +3,14 @@
|
|||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
#include <QColorDialog>
|
#include <QColorDialog>
|
||||||
|
#include <QStandardItemModel>
|
||||||
#include "citra_qt/configuration/configuration_shared.h"
|
#include "citra_qt/configuration/configuration_shared.h"
|
||||||
#include "citra_qt/configuration/configure_graphics.h"
|
#include "citra_qt/configuration/configure_graphics.h"
|
||||||
#include "common/settings.h"
|
#include "common/settings.h"
|
||||||
#include "ui_configure_graphics.h"
|
#include "ui_configure_graphics.h"
|
||||||
|
#ifdef ENABLE_VULKAN
|
||||||
#include "video_core/renderer_vulkan/vk_instance.h"
|
#include "video_core/renderer_vulkan/vk_instance.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
ConfigureGraphics::ConfigureGraphics(std::span<const QString> physical_devices, bool is_powered_on,
|
ConfigureGraphics::ConfigureGraphics(std::span<const QString> physical_devices, bool is_powered_on,
|
||||||
QWidget* parent)
|
QWidget* parent)
|
||||||
@ -27,12 +30,32 @@ ConfigureGraphics::ConfigureGraphics(std::span<const QString> physical_devices,
|
|||||||
// Set the index to -1 to ensure the below lambda is called with setCurrentIndex
|
// Set the index to -1 to ensure the below lambda is called with setCurrentIndex
|
||||||
ui->graphics_api_combo->setCurrentIndex(-1);
|
ui->graphics_api_combo->setCurrentIndex(-1);
|
||||||
|
|
||||||
|
auto graphics_api_combo_model =
|
||||||
|
qobject_cast<QStandardItemModel*>(ui->graphics_api_combo->model());
|
||||||
|
#ifndef ENABLE_SOFTWARE_RENDERER
|
||||||
|
const auto software_item =
|
||||||
|
graphics_api_combo_model->item(static_cast<u32>(Settings::GraphicsAPI::Software));
|
||||||
|
software_item->setFlags(software_item->flags() & ~Qt::ItemIsEnabled);
|
||||||
|
#endif
|
||||||
|
#ifndef ENABLE_OPENGL
|
||||||
|
const auto opengl_item =
|
||||||
|
graphics_api_combo_model->item(static_cast<u32>(Settings::GraphicsAPI::OpenGL));
|
||||||
|
opengl_item->setFlags(opengl_item->flags() & ~Qt::ItemIsEnabled);
|
||||||
|
#endif
|
||||||
|
#ifndef ENABLE_VULKAN
|
||||||
|
const auto vulkan_item =
|
||||||
|
graphics_api_combo_model->item(static_cast<u32>(Settings::GraphicsAPI::Vulkan));
|
||||||
|
vulkan_item->setFlags(vulkan_item->flags() & ~Qt::ItemIsEnabled);
|
||||||
|
#else
|
||||||
if (physical_devices.empty()) {
|
if (physical_devices.empty()) {
|
||||||
const u32 index = static_cast<u32>(Settings::GraphicsAPI::Vulkan);
|
const auto vulkan_item =
|
||||||
ui->graphics_api_combo->removeItem(index);
|
graphics_api_combo_model->item(static_cast<u32>(Settings::GraphicsAPI::Vulkan));
|
||||||
|
vulkan_item->setFlags(vulkan_item->flags() & ~Qt::ItemIsEnabled);
|
||||||
|
|
||||||
ui->physical_device_combo->setVisible(false);
|
ui->physical_device_combo->setVisible(false);
|
||||||
ui->spirv_shader_gen->setVisible(false);
|
ui->spirv_shader_gen->setVisible(false);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
connect(ui->graphics_api_combo, qOverload<int>(&QComboBox::currentIndexChanged), this,
|
connect(ui->graphics_api_combo, qOverload<int>(&QComboBox::currentIndexChanged), this,
|
||||||
[this](int index) {
|
[this](int index) {
|
||||||
|
@ -519,6 +519,7 @@ void GameList::UpdateColumnVisibility() {
|
|||||||
tree_view->setColumnHidden(COLUMN_SIZE, !UISettings::values.show_size_column);
|
tree_view->setColumnHidden(COLUMN_SIZE, !UISettings::values.show_size_column);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef ENABLE_OPENGL
|
||||||
void ForEachOpenGLCacheFile(u64 program_id, auto func) {
|
void ForEachOpenGLCacheFile(u64 program_id, auto func) {
|
||||||
for (const std::string_view cache_type : {"separable", "conventional"}) {
|
for (const std::string_view cache_type : {"separable", "conventional"}) {
|
||||||
const std::string path = fmt::format("{}opengl/precompiled/{}/{:016X}.bin",
|
const std::string path = fmt::format("{}opengl/precompiled/{}/{:016X}.bin",
|
||||||
@ -528,6 +529,7 @@ void ForEachOpenGLCacheFile(u64 program_id, auto func) {
|
|||||||
func(file);
|
func(file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void GameList::AddGamePopup(QMenu& context_menu, const QString& path, const QString& name,
|
void GameList::AddGamePopup(QMenu& context_menu, const QString& path, const QString& name,
|
||||||
u64 program_id, u64 extdata_id, Service::FS::MediaType media_type) {
|
u64 program_id, u64 extdata_id, Service::FS::MediaType media_type) {
|
||||||
@ -545,8 +547,10 @@ void GameList::AddGamePopup(QMenu& context_menu, const QString& path, const QStr
|
|||||||
QMenu* shader_menu = context_menu.addMenu(tr("Disk Shader Cache"));
|
QMenu* shader_menu = context_menu.addMenu(tr("Disk Shader Cache"));
|
||||||
QAction* open_shader_cache_location = shader_menu->addAction(tr("Open Shader Cache Location"));
|
QAction* open_shader_cache_location = shader_menu->addAction(tr("Open Shader Cache Location"));
|
||||||
shader_menu->addSeparator();
|
shader_menu->addSeparator();
|
||||||
|
#ifdef ENABLE_OPENGL
|
||||||
QAction* delete_opengl_disk_shader_cache =
|
QAction* delete_opengl_disk_shader_cache =
|
||||||
shader_menu->addAction(tr("Delete OpenGL Shader Cache"));
|
shader_menu->addAction(tr("Delete OpenGL Shader Cache"));
|
||||||
|
#endif
|
||||||
|
|
||||||
QMenu* uninstall_menu = context_menu.addMenu(tr("Uninstall"));
|
QMenu* uninstall_menu = context_menu.addMenu(tr("Uninstall"));
|
||||||
QAction* uninstall_all = uninstall_menu->addAction(tr("Everything"));
|
QAction* uninstall_all = uninstall_menu->addAction(tr("Everything"));
|
||||||
@ -564,9 +568,11 @@ void GameList::AddGamePopup(QMenu& context_menu, const QString& path, const QStr
|
|||||||
const bool is_application = program_id_high == 0x00040000 || program_id_high == 0x00040002 ||
|
const bool is_application = program_id_high == 0x00040000 || program_id_high == 0x00040002 ||
|
||||||
program_id_high == 0x00040010;
|
program_id_high == 0x00040010;
|
||||||
|
|
||||||
|
#ifdef ENABLE_OPENGL
|
||||||
bool opengl_cache_exists = false;
|
bool opengl_cache_exists = false;
|
||||||
ForEachOpenGLCacheFile(
|
ForEachOpenGLCacheFile(
|
||||||
program_id, [&opengl_cache_exists](QFile& file) { opengl_cache_exists |= file.exists(); });
|
program_id, [&opengl_cache_exists](QFile& file) { opengl_cache_exists |= file.exists(); });
|
||||||
|
#endif
|
||||||
|
|
||||||
std::string sdmc_dir = FileUtil::GetUserPath(FileUtil::UserPath::SDMCDir);
|
std::string sdmc_dir = FileUtil::GetUserPath(FileUtil::UserPath::SDMCDir);
|
||||||
open_save_location->setEnabled(
|
open_save_location->setEnabled(
|
||||||
@ -603,7 +609,9 @@ void GameList::AddGamePopup(QMenu& context_menu, const QString& path, const QStr
|
|||||||
open_mods_location->setEnabled(is_application);
|
open_mods_location->setEnabled(is_application);
|
||||||
dump_romfs->setEnabled(is_application);
|
dump_romfs->setEnabled(is_application);
|
||||||
|
|
||||||
|
#ifdef ENABLE_OPENGL
|
||||||
delete_opengl_disk_shader_cache->setEnabled(opengl_cache_exists);
|
delete_opengl_disk_shader_cache->setEnabled(opengl_cache_exists);
|
||||||
|
#endif
|
||||||
|
|
||||||
uninstall_all->setEnabled(is_installed || has_update || has_dlc);
|
uninstall_all->setEnabled(is_installed || has_update || has_dlc);
|
||||||
uninstall_game->setEnabled(is_installed);
|
uninstall_game->setEnabled(is_installed);
|
||||||
@ -669,9 +677,11 @@ void GameList::AddGamePopup(QMenu& context_menu, const QString& path, const QStr
|
|||||||
emit OpenFolderRequested(program_id, GameListOpenTarget::SHADER_CACHE);
|
emit OpenFolderRequested(program_id, GameListOpenTarget::SHADER_CACHE);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
#ifdef ENABLE_OPENGL
|
||||||
connect(delete_opengl_disk_shader_cache, &QAction::triggered, this, [program_id] {
|
connect(delete_opengl_disk_shader_cache, &QAction::triggered, this, [program_id] {
|
||||||
ForEachOpenGLCacheFile(program_id, [](QFile& file) { file.remove(); });
|
ForEachOpenGLCacheFile(program_id, [](QFile& file) { file.remove(); });
|
||||||
});
|
});
|
||||||
|
#endif
|
||||||
connect(uninstall_all, &QAction::triggered, this, [=, this] {
|
connect(uninstall_all, &QAction::triggered, this, [=, this] {
|
||||||
QMessageBox::StandardButton answer = QMessageBox::question(
|
QMessageBox::StandardButton answer = QMessageBox::question(
|
||||||
this, tr("Citra"),
|
this, tr("Citra"),
|
||||||
|
@ -270,6 +270,7 @@ GMainWindow::GMainWindow(Core::System& system_)
|
|||||||
connect(&mouse_hide_timer, &QTimer::timeout, this, &GMainWindow::HideMouseCursor);
|
connect(&mouse_hide_timer, &QTimer::timeout, this, &GMainWindow::HideMouseCursor);
|
||||||
connect(ui->menubar, &QMenuBar::hovered, this, &GMainWindow::OnMouseActivity);
|
connect(ui->menubar, &QMenuBar::hovered, this, &GMainWindow::OnMouseActivity);
|
||||||
|
|
||||||
|
#ifdef ENABLE_VULKAN
|
||||||
physical_devices = GetVulkanPhysicalDevices();
|
physical_devices = GetVulkanPhysicalDevices();
|
||||||
if (physical_devices.empty()) {
|
if (physical_devices.empty()) {
|
||||||
QMessageBox::warning(this, tr("No Suitable Vulkan Devices Detected"),
|
QMessageBox::warning(this, tr("No Suitable Vulkan Devices Detected"),
|
||||||
@ -277,6 +278,7 @@ GMainWindow::GMainWindow(Core::System& system_)
|
|||||||
"Your GPU may not support Vulkan 1.1, or you do not "
|
"Your GPU may not support Vulkan 1.1, or you do not "
|
||||||
"have the latest graphics driver."));
|
"have the latest graphics driver."));
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#if ENABLE_QT_UPDATER
|
#if ENABLE_QT_UPDATER
|
||||||
if (UISettings::values.check_for_update_on_start) {
|
if (UISettings::values.check_for_update_on_start) {
|
||||||
@ -2689,6 +2691,22 @@ void GMainWindow::UpdateAPIIndicator(bool update) {
|
|||||||
u32 api_index = static_cast<u32>(Settings::values.graphics_api.GetValue());
|
u32 api_index = static_cast<u32>(Settings::values.graphics_api.GetValue());
|
||||||
if (update) {
|
if (update) {
|
||||||
api_index = (api_index + 1) % graphics_apis.size();
|
api_index = (api_index + 1) % graphics_apis.size();
|
||||||
|
// Skip past any disabled renderers.
|
||||||
|
#ifndef ENABLE_SOFTWARE_RENDERER
|
||||||
|
if (api_index == static_cast<u32>(Settings::GraphicsAPI::Software)) {
|
||||||
|
api_index = (api_index + 1) % graphics_apis.size();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#ifndef ENABLE_OPENGL
|
||||||
|
if (api_index == static_cast<u32>(Settings::GraphicsAPI::OpenGL)) {
|
||||||
|
api_index = (api_index + 1) % graphics_apis.size();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#ifndef ENABLE_VULKAN
|
||||||
|
if (api_index == static_cast<u32>(Settings::GraphicsAPI::Vulkan)) {
|
||||||
|
api_index = (api_index + 1) % graphics_apis.size();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
Settings::values.graphics_api = static_cast<Settings::GraphicsAPI>(api_index);
|
Settings::values.graphics_api = static_cast<Settings::GraphicsAPI>(api_index);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3164,8 +3182,11 @@ int main(int argc, char* argv[]) {
|
|||||||
chdir(bin_path.c_str());
|
chdir(bin_path.c_str());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef ENABLE_OPENGL
|
||||||
QCoreApplication::setAttribute(Qt::AA_DontCheckOpenGLContextThreadAffinity);
|
QCoreApplication::setAttribute(Qt::AA_DontCheckOpenGLContextThreadAffinity);
|
||||||
QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts);
|
QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts);
|
||||||
|
#endif
|
||||||
|
|
||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
|
|
||||||
// Qt changes the locale and causes issues in float conversion using std::to_string() when
|
// Qt changes the locale and causes issues in float conversion using std::to_string() when
|
||||||
|
@ -449,13 +449,19 @@ struct Values {
|
|||||||
Setting<bool> allow_plugin_loader{true, "allow_plugin_loader"};
|
Setting<bool> allow_plugin_loader{true, "allow_plugin_loader"};
|
||||||
|
|
||||||
// Renderer
|
// Renderer
|
||||||
SwitchableSetting<GraphicsAPI, true> graphics_api{
|
SwitchableSetting<GraphicsAPI, true> graphics_api {
|
||||||
#ifdef HAS_OPENGL
|
#if defined(ENABLE_OPENGL)
|
||||||
GraphicsAPI::OpenGL,
|
GraphicsAPI::OpenGL,
|
||||||
#else
|
#elif defined(ENABLE_VULKAN)
|
||||||
GraphicsAPI::Vulkan,
|
GraphicsAPI::Vulkan,
|
||||||
|
#elif defined(ENABLE_SOFTWARE_RENDERER)
|
||||||
|
GraphicsAPI::Software,
|
||||||
|
#else
|
||||||
|
// TODO: Add a null renderer backend for this, perhaps.
|
||||||
|
#error "At least one renderer must be enabled."
|
||||||
#endif
|
#endif
|
||||||
GraphicsAPI::Software, GraphicsAPI::Vulkan, "graphics_api"};
|
GraphicsAPI::Software, GraphicsAPI::Vulkan, "graphics_api"
|
||||||
|
};
|
||||||
SwitchableSetting<u32> physical_device{0, "physical_device"};
|
SwitchableSetting<u32> physical_device{0, "physical_device"};
|
||||||
Setting<bool> use_gles{false, "use_gles"};
|
Setting<bool> use_gles{false, "use_gles"};
|
||||||
Setting<bool> renderer_debug{false, "renderer_debug"};
|
Setting<bool> renderer_debug{false, "renderer_debug"};
|
||||||
|
@ -60,94 +60,9 @@ add_library(video_core STATIC
|
|||||||
rasterizer_cache/texture_cube.h
|
rasterizer_cache/texture_cube.h
|
||||||
rasterizer_cache/utils.cpp
|
rasterizer_cache/utils.cpp
|
||||||
rasterizer_cache/utils.h
|
rasterizer_cache/utils.h
|
||||||
renderer_opengl/frame_dumper_opengl.cpp
|
# Needed as a fallback regardless of enabled renderers.
|
||||||
renderer_opengl/frame_dumper_opengl.h
|
|
||||||
renderer_opengl/gl_blit_helper.cpp
|
|
||||||
renderer_opengl/gl_blit_helper.h
|
|
||||||
renderer_opengl/gl_driver.cpp
|
|
||||||
renderer_opengl/gl_driver.h
|
|
||||||
renderer_opengl/gl_rasterizer.cpp
|
|
||||||
renderer_opengl/gl_rasterizer.h
|
|
||||||
renderer_opengl/gl_rasterizer_cache.cpp
|
|
||||||
renderer_opengl/gl_resource_manager.cpp
|
|
||||||
renderer_opengl/gl_resource_manager.h
|
|
||||||
renderer_opengl/gl_shader_disk_cache.cpp
|
|
||||||
renderer_opengl/gl_shader_disk_cache.h
|
|
||||||
renderer_opengl/gl_shader_manager.cpp
|
|
||||||
renderer_opengl/gl_shader_manager.h
|
|
||||||
renderer_opengl/gl_shader_util.cpp
|
|
||||||
renderer_opengl/gl_shader_util.h
|
|
||||||
renderer_opengl/gl_state.cpp
|
|
||||||
renderer_opengl/gl_state.h
|
|
||||||
renderer_opengl/gl_stream_buffer.cpp
|
|
||||||
renderer_opengl/gl_stream_buffer.h
|
|
||||||
renderer_opengl/gl_texture_mailbox.cpp
|
|
||||||
renderer_opengl/gl_texture_mailbox.h
|
|
||||||
renderer_opengl/gl_texture_runtime.cpp
|
|
||||||
renderer_opengl/gl_texture_runtime.h
|
|
||||||
renderer_opengl/gl_vars.cpp
|
|
||||||
renderer_opengl/gl_vars.h
|
|
||||||
renderer_opengl/pica_to_gl.h
|
|
||||||
renderer_opengl/post_processing_opengl.cpp
|
|
||||||
renderer_opengl/post_processing_opengl.h
|
|
||||||
renderer_opengl/renderer_opengl.cpp
|
|
||||||
renderer_opengl/renderer_opengl.h
|
|
||||||
renderer_software/renderer_software.cpp
|
|
||||||
renderer_software/renderer_software.h
|
|
||||||
renderer_software/sw_blitter.cpp
|
renderer_software/sw_blitter.cpp
|
||||||
renderer_software/sw_blitter.h
|
renderer_software/sw_blitter.h
|
||||||
renderer_software/sw_clipper.cpp
|
|
||||||
renderer_software/sw_clipper.h
|
|
||||||
renderer_software/sw_framebuffer.cpp
|
|
||||||
renderer_software/sw_framebuffer.h
|
|
||||||
renderer_software/sw_lighting.cpp
|
|
||||||
renderer_software/sw_lighting.h
|
|
||||||
renderer_software/sw_proctex.cpp
|
|
||||||
renderer_software/sw_proctex.h
|
|
||||||
renderer_software/sw_rasterizer.cpp
|
|
||||||
renderer_software/sw_rasterizer.h
|
|
||||||
renderer_software/sw_texturing.cpp
|
|
||||||
renderer_software/sw_texturing.h
|
|
||||||
renderer_vulkan/pica_to_vk.h
|
|
||||||
renderer_vulkan/renderer_vulkan.cpp
|
|
||||||
renderer_vulkan/renderer_vulkan.h
|
|
||||||
renderer_vulkan/vk_blit_helper.cpp
|
|
||||||
renderer_vulkan/vk_blit_helper.h
|
|
||||||
renderer_vulkan/vk_common.cpp
|
|
||||||
renderer_vulkan/vk_common.h
|
|
||||||
renderer_vulkan/vk_descriptor_pool.cpp
|
|
||||||
renderer_vulkan/vk_descriptor_pool.h
|
|
||||||
renderer_vulkan/vk_graphics_pipeline.cpp
|
|
||||||
renderer_vulkan/vk_graphics_pipeline.h
|
|
||||||
renderer_vulkan/vk_master_semaphore.cpp
|
|
||||||
renderer_vulkan/vk_master_semaphore.h
|
|
||||||
renderer_vulkan/vk_memory_util.cpp
|
|
||||||
renderer_vulkan/vk_memory_util.h
|
|
||||||
renderer_vulkan/vk_rasterizer.cpp
|
|
||||||
renderer_vulkan/vk_rasterizer.h
|
|
||||||
renderer_vulkan/vk_rasterizer_cache.cpp
|
|
||||||
renderer_vulkan/vk_scheduler.cpp
|
|
||||||
renderer_vulkan/vk_scheduler.h
|
|
||||||
renderer_vulkan/vk_resource_pool.cpp
|
|
||||||
renderer_vulkan/vk_resource_pool.h
|
|
||||||
renderer_vulkan/vk_instance.cpp
|
|
||||||
renderer_vulkan/vk_instance.h
|
|
||||||
renderer_vulkan/vk_pipeline_cache.cpp
|
|
||||||
renderer_vulkan/vk_pipeline_cache.h
|
|
||||||
renderer_vulkan/vk_platform.cpp
|
|
||||||
renderer_vulkan/vk_platform.h
|
|
||||||
renderer_vulkan/vk_present_window.cpp
|
|
||||||
renderer_vulkan/vk_present_window.h
|
|
||||||
renderer_vulkan/vk_renderpass_cache.cpp
|
|
||||||
renderer_vulkan/vk_renderpass_cache.h
|
|
||||||
renderer_vulkan/vk_shader_util.cpp
|
|
||||||
renderer_vulkan/vk_shader_util.h
|
|
||||||
renderer_vulkan/vk_stream_buffer.cpp
|
|
||||||
renderer_vulkan/vk_stream_buffer.h
|
|
||||||
renderer_vulkan/vk_swapchain.cpp
|
|
||||||
renderer_vulkan/vk_swapchain.h
|
|
||||||
renderer_vulkan/vk_texture_runtime.cpp
|
|
||||||
renderer_vulkan/vk_texture_runtime.h
|
|
||||||
shader/debug_data.h
|
shader/debug_data.h
|
||||||
shader/generator/glsl_fs_shader_gen.cpp
|
shader/generator/glsl_fs_shader_gen.cpp
|
||||||
shader/generator/glsl_fs_shader_gen.h
|
shader/generator/glsl_fs_shader_gen.h
|
||||||
@ -162,8 +77,6 @@ add_library(video_core STATIC
|
|||||||
shader/generator/shader_gen.h
|
shader/generator/shader_gen.h
|
||||||
shader/generator/shader_uniforms.cpp
|
shader/generator/shader_uniforms.cpp
|
||||||
shader/generator/shader_uniforms.h
|
shader/generator/shader_uniforms.h
|
||||||
shader/generator/spv_fs_shader_gen.cpp
|
|
||||||
shader/generator/spv_fs_shader_gen.h
|
|
||||||
shader/shader.cpp
|
shader/shader.cpp
|
||||||
shader/shader.h
|
shader/shader.h
|
||||||
shader/shader_interpreter.cpp
|
shader/shader_interpreter.cpp
|
||||||
@ -183,6 +96,109 @@ add_library(video_core STATIC
|
|||||||
video_core.h
|
video_core.h
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if (ENABLE_SOFTWARE_RENDERER)
|
||||||
|
target_sources(video_core PRIVATE
|
||||||
|
renderer_software/renderer_software.cpp
|
||||||
|
renderer_software/renderer_software.h
|
||||||
|
renderer_software/sw_clipper.cpp
|
||||||
|
renderer_software/sw_clipper.h
|
||||||
|
renderer_software/sw_framebuffer.cpp
|
||||||
|
renderer_software/sw_framebuffer.h
|
||||||
|
renderer_software/sw_lighting.cpp
|
||||||
|
renderer_software/sw_lighting.h
|
||||||
|
renderer_software/sw_proctex.cpp
|
||||||
|
renderer_software/sw_proctex.h
|
||||||
|
renderer_software/sw_rasterizer.cpp
|
||||||
|
renderer_software/sw_rasterizer.h
|
||||||
|
renderer_software/sw_texturing.cpp
|
||||||
|
renderer_software/sw_texturing.h
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
if (ENABLE_OPENGL)
|
||||||
|
target_sources(video_core PRIVATE
|
||||||
|
renderer_opengl/frame_dumper_opengl.cpp
|
||||||
|
renderer_opengl/frame_dumper_opengl.h
|
||||||
|
renderer_opengl/gl_blit_helper.cpp
|
||||||
|
renderer_opengl/gl_blit_helper.h
|
||||||
|
renderer_opengl/gl_driver.cpp
|
||||||
|
renderer_opengl/gl_driver.h
|
||||||
|
renderer_opengl/gl_rasterizer.cpp
|
||||||
|
renderer_opengl/gl_rasterizer.h
|
||||||
|
renderer_opengl/gl_rasterizer_cache.cpp
|
||||||
|
renderer_opengl/gl_resource_manager.cpp
|
||||||
|
renderer_opengl/gl_resource_manager.h
|
||||||
|
renderer_opengl/gl_shader_disk_cache.cpp
|
||||||
|
renderer_opengl/gl_shader_disk_cache.h
|
||||||
|
renderer_opengl/gl_shader_manager.cpp
|
||||||
|
renderer_opengl/gl_shader_manager.h
|
||||||
|
renderer_opengl/gl_shader_util.cpp
|
||||||
|
renderer_opengl/gl_shader_util.h
|
||||||
|
renderer_opengl/gl_state.cpp
|
||||||
|
renderer_opengl/gl_state.h
|
||||||
|
renderer_opengl/gl_stream_buffer.cpp
|
||||||
|
renderer_opengl/gl_stream_buffer.h
|
||||||
|
renderer_opengl/gl_texture_mailbox.cpp
|
||||||
|
renderer_opengl/gl_texture_mailbox.h
|
||||||
|
renderer_opengl/gl_texture_runtime.cpp
|
||||||
|
renderer_opengl/gl_texture_runtime.h
|
||||||
|
renderer_opengl/gl_vars.cpp
|
||||||
|
renderer_opengl/gl_vars.h
|
||||||
|
renderer_opengl/pica_to_gl.h
|
||||||
|
renderer_opengl/post_processing_opengl.cpp
|
||||||
|
renderer_opengl/post_processing_opengl.h
|
||||||
|
renderer_opengl/renderer_opengl.cpp
|
||||||
|
renderer_opengl/renderer_opengl.h
|
||||||
|
)
|
||||||
|
target_link_libraries(video_core PRIVATE glad)
|
||||||
|
endif()
|
||||||
|
if (ENABLE_VULKAN)
|
||||||
|
target_sources(video_core PRIVATE
|
||||||
|
renderer_vulkan/pica_to_vk.h
|
||||||
|
renderer_vulkan/renderer_vulkan.cpp
|
||||||
|
renderer_vulkan/renderer_vulkan.h
|
||||||
|
renderer_vulkan/vk_blit_helper.cpp
|
||||||
|
renderer_vulkan/vk_blit_helper.h
|
||||||
|
renderer_vulkan/vk_common.cpp
|
||||||
|
renderer_vulkan/vk_common.h
|
||||||
|
renderer_vulkan/vk_descriptor_pool.cpp
|
||||||
|
renderer_vulkan/vk_descriptor_pool.h
|
||||||
|
renderer_vulkan/vk_graphics_pipeline.cpp
|
||||||
|
renderer_vulkan/vk_graphics_pipeline.h
|
||||||
|
renderer_vulkan/vk_master_semaphore.cpp
|
||||||
|
renderer_vulkan/vk_master_semaphore.h
|
||||||
|
renderer_vulkan/vk_memory_util.cpp
|
||||||
|
renderer_vulkan/vk_memory_util.h
|
||||||
|
renderer_vulkan/vk_rasterizer.cpp
|
||||||
|
renderer_vulkan/vk_rasterizer.h
|
||||||
|
renderer_vulkan/vk_rasterizer_cache.cpp
|
||||||
|
renderer_vulkan/vk_scheduler.cpp
|
||||||
|
renderer_vulkan/vk_scheduler.h
|
||||||
|
renderer_vulkan/vk_resource_pool.cpp
|
||||||
|
renderer_vulkan/vk_resource_pool.h
|
||||||
|
renderer_vulkan/vk_instance.cpp
|
||||||
|
renderer_vulkan/vk_instance.h
|
||||||
|
renderer_vulkan/vk_pipeline_cache.cpp
|
||||||
|
renderer_vulkan/vk_pipeline_cache.h
|
||||||
|
renderer_vulkan/vk_platform.cpp
|
||||||
|
renderer_vulkan/vk_platform.h
|
||||||
|
renderer_vulkan/vk_present_window.cpp
|
||||||
|
renderer_vulkan/vk_present_window.h
|
||||||
|
renderer_vulkan/vk_renderpass_cache.cpp
|
||||||
|
renderer_vulkan/vk_renderpass_cache.h
|
||||||
|
renderer_vulkan/vk_shader_util.cpp
|
||||||
|
renderer_vulkan/vk_shader_util.h
|
||||||
|
renderer_vulkan/vk_stream_buffer.cpp
|
||||||
|
renderer_vulkan/vk_stream_buffer.h
|
||||||
|
renderer_vulkan/vk_swapchain.cpp
|
||||||
|
renderer_vulkan/vk_swapchain.h
|
||||||
|
renderer_vulkan/vk_texture_runtime.cpp
|
||||||
|
renderer_vulkan/vk_texture_runtime.h
|
||||||
|
shader/generator/spv_fs_shader_gen.cpp
|
||||||
|
shader/generator/spv_fs_shader_gen.h
|
||||||
|
)
|
||||||
|
target_link_libraries(video_core PRIVATE vulkan-headers vma sirit SPIRV glslang)
|
||||||
|
endif()
|
||||||
|
|
||||||
add_dependencies(video_core host_shaders)
|
add_dependencies(video_core host_shaders)
|
||||||
target_include_directories(video_core PRIVATE ${HOST_SHADERS_INCLUDE})
|
target_include_directories(video_core PRIVATE ${HOST_SHADERS_INCLUDE})
|
||||||
|
|
||||||
@ -190,7 +206,6 @@ create_target_directory_groups(video_core)
|
|||||||
|
|
||||||
target_link_libraries(video_core PUBLIC citra_common citra_core)
|
target_link_libraries(video_core PUBLIC citra_common citra_core)
|
||||||
target_link_libraries(video_core PRIVATE Boost::serialization dds-ktx json-headers nihstro-headers tsl::robin_map)
|
target_link_libraries(video_core PRIVATE Boost::serialization dds-ktx json-headers nihstro-headers tsl::robin_map)
|
||||||
target_link_libraries(video_core PRIVATE vulkan-headers vma glad sirit SPIRV glslang)
|
|
||||||
|
|
||||||
if ("x86_64" IN_LIST ARCHITECTURE)
|
if ("x86_64" IN_LIST ARCHITECTURE)
|
||||||
target_link_libraries(video_core PUBLIC xbyak)
|
target_link_libraries(video_core PUBLIC xbyak)
|
||||||
|
@ -5,9 +5,15 @@
|
|||||||
#include "common/logging/log.h"
|
#include "common/logging/log.h"
|
||||||
#include "common/settings.h"
|
#include "common/settings.h"
|
||||||
#include "video_core/gpu.h"
|
#include "video_core/gpu.h"
|
||||||
|
#ifdef ENABLE_OPENGL
|
||||||
#include "video_core/renderer_opengl/renderer_opengl.h"
|
#include "video_core/renderer_opengl/renderer_opengl.h"
|
||||||
|
#endif
|
||||||
|
#ifdef ENABLE_SOFTWARE_RENDERER
|
||||||
#include "video_core/renderer_software/renderer_software.h"
|
#include "video_core/renderer_software/renderer_software.h"
|
||||||
|
#endif
|
||||||
|
#ifdef ENABLE_VULKAN
|
||||||
#include "video_core/renderer_vulkan/renderer_vulkan.h"
|
#include "video_core/renderer_vulkan/renderer_vulkan.h"
|
||||||
|
#endif
|
||||||
#include "video_core/video_core.h"
|
#include "video_core/video_core.h"
|
||||||
|
|
||||||
namespace VideoCore {
|
namespace VideoCore {
|
||||||
@ -17,15 +23,32 @@ std::unique_ptr<RendererBase> CreateRenderer(Frontend::EmuWindow& emu_window,
|
|||||||
Pica::PicaCore& pica, Core::System& system) {
|
Pica::PicaCore& pica, Core::System& system) {
|
||||||
const Settings::GraphicsAPI graphics_api = Settings::values.graphics_api.GetValue();
|
const Settings::GraphicsAPI graphics_api = Settings::values.graphics_api.GetValue();
|
||||||
switch (graphics_api) {
|
switch (graphics_api) {
|
||||||
|
#ifdef ENABLE_SOFTWARE_RENDERER
|
||||||
case Settings::GraphicsAPI::Software:
|
case Settings::GraphicsAPI::Software:
|
||||||
return std::make_unique<SwRenderer::RendererSoftware>(system, pica, emu_window);
|
return std::make_unique<SwRenderer::RendererSoftware>(system, pica, emu_window);
|
||||||
|
#endif
|
||||||
|
#ifdef ENABLE_VULKAN
|
||||||
case Settings::GraphicsAPI::Vulkan:
|
case Settings::GraphicsAPI::Vulkan:
|
||||||
return std::make_unique<Vulkan::RendererVulkan>(system, pica, emu_window, secondary_window);
|
return std::make_unique<Vulkan::RendererVulkan>(system, pica, emu_window, secondary_window);
|
||||||
|
#endif
|
||||||
|
#ifdef ENABLE_OPENGL
|
||||||
case Settings::GraphicsAPI::OpenGL:
|
case Settings::GraphicsAPI::OpenGL:
|
||||||
return std::make_unique<OpenGL::RendererOpenGL>(system, pica, emu_window, secondary_window);
|
return std::make_unique<OpenGL::RendererOpenGL>(system, pica, emu_window, secondary_window);
|
||||||
|
#endif
|
||||||
default:
|
default:
|
||||||
LOG_CRITICAL(Render, "Unknown graphics API {}, using OpenGL", graphics_api);
|
LOG_CRITICAL(Render,
|
||||||
|
"Unknown or unsupported graphics API {}, falling back to available default",
|
||||||
|
graphics_api);
|
||||||
|
#ifdef ENABLE_OPENGL
|
||||||
return std::make_unique<OpenGL::RendererOpenGL>(system, pica, emu_window, secondary_window);
|
return std::make_unique<OpenGL::RendererOpenGL>(system, pica, emu_window, secondary_window);
|
||||||
|
#elif ENABLE_VULKAN
|
||||||
|
return std::make_unique<Vulkan::RendererVulkan>(system, pica, emu_window, secondary_window);
|
||||||
|
#elif ENABLE_SOFTWARE_RENDERER
|
||||||
|
return std::make_unique<SwRenderer::RendererSoftware>(system, pica, emu_window);
|
||||||
|
#else
|
||||||
|
// TODO: Add a null renderer backend for this, perhaps.
|
||||||
|
#error "At least one renderer must be enabled."
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user