Browse Source
Merge pull request #8393 from lat9nq/default-vulkan
Merge pull request #8393 from lat9nq/default-vulkan
general: Set renderer_backend's default to Vulkanpull/15/merge
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 184 additions and 48 deletions
-
2src/common/settings.h
-
4src/video_core/vulkan_common/vulkan_library.cpp
-
2src/yuzu/CMakeLists.txt
-
53src/yuzu/check_vulkan.cpp
-
6src/yuzu/check_vulkan.h
-
8src/yuzu/configuration/config.cpp
-
36src/yuzu/configuration/configure_graphics.cpp
-
2src/yuzu/configuration/configure_graphics.h
-
91src/yuzu/configuration/configure_graphics.ui
-
24src/yuzu/main.cpp
-
2src/yuzu/uisettings.h
-
2src/yuzu_cmd/default_ini.h
@ -0,0 +1,53 @@ |
|||
// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
|
|||
// SPDX-License-Identifier: GPL-2.0-or-later
|
|||
|
|||
#include "video_core/vulkan_common/vulkan_wrapper.h"
|
|||
|
|||
#include <filesystem>
|
|||
#include <fstream>
|
|||
#include "common/fs/fs.h"
|
|||
#include "common/fs/path_util.h"
|
|||
#include "common/logging/log.h"
|
|||
#include "video_core/vulkan_common/vulkan_instance.h"
|
|||
#include "video_core/vulkan_common/vulkan_library.h"
|
|||
#include "yuzu/check_vulkan.h"
|
|||
#include "yuzu/uisettings.h"
|
|||
|
|||
constexpr char TEMP_FILE_NAME[] = "vulkan_check"; |
|||
|
|||
bool CheckVulkan() { |
|||
if (UISettings::values.has_broken_vulkan) { |
|||
return true; |
|||
} |
|||
|
|||
LOG_DEBUG(Frontend, "Checking presence of Vulkan"); |
|||
|
|||
const auto fs_config_loc = Common::FS::GetYuzuPath(Common::FS::YuzuPath::ConfigDir); |
|||
const auto temp_file_loc = fs_config_loc / TEMP_FILE_NAME; |
|||
|
|||
if (std::filesystem::exists(temp_file_loc)) { |
|||
LOG_WARNING(Frontend, "Detected recovery from previous failed Vulkan initialization"); |
|||
|
|||
UISettings::values.has_broken_vulkan = true; |
|||
std::filesystem::remove(temp_file_loc); |
|||
return false; |
|||
} |
|||
|
|||
std::ofstream temp_file_handle(temp_file_loc); |
|||
temp_file_handle.close(); |
|||
|
|||
try { |
|||
Vulkan::vk::InstanceDispatch dld; |
|||
const Common::DynamicLibrary library = Vulkan::OpenLibrary(); |
|||
const Vulkan::vk::Instance instance = |
|||
Vulkan::CreateInstance(library, dld, VK_API_VERSION_1_0); |
|||
|
|||
} catch (const Vulkan::vk::Exception& exception) { |
|||
LOG_ERROR(Frontend, "Failed to initialize Vulkan: {}", exception.what()); |
|||
// Don't set has_broken_vulkan to true here: we care when loading Vulkan crashes the
|
|||
// application, not when we can handle it.
|
|||
} |
|||
|
|||
std::filesystem::remove(temp_file_loc); |
|||
return true; |
|||
} |
|||
@ -0,0 +1,6 @@ |
|||
// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project |
|||
// SPDX-License-Identifier: GPL-2.0-or-later |
|||
|
|||
#pragma once |
|||
|
|||
bool CheckVulkan(); |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue