summaryrefslogtreecommitdiffstats
path: root/src/video_core/renderer_vulkan
diff options
context:
space:
mode:
authorReinUsesLisp <reinuseslisp@airmail.cc>2020-12-25 01:24:34 +0100
committerReinUsesLisp <reinuseslisp@airmail.cc>2020-12-31 06:02:48 +0100
commitd93742142243dea1355012b9f0ce7f5ac8a2dc02 (patch)
tree67538ec18461b8d0f2e125fb7b797b89b8189db8 /src/video_core/renderer_vulkan
parentMerge pull request #5263 from lioncash/uninit (diff)
downloadyuzu-d93742142243dea1355012b9f0ce7f5ac8a2dc02.tar
yuzu-d93742142243dea1355012b9f0ce7f5ac8a2dc02.tar.gz
yuzu-d93742142243dea1355012b9f0ce7f5ac8a2dc02.tar.bz2
yuzu-d93742142243dea1355012b9f0ce7f5ac8a2dc02.tar.lz
yuzu-d93742142243dea1355012b9f0ce7f5ac8a2dc02.tar.xz
yuzu-d93742142243dea1355012b9f0ce7f5ac8a2dc02.tar.zst
yuzu-d93742142243dea1355012b9f0ce7f5ac8a2dc02.zip
Diffstat (limited to 'src/video_core/renderer_vulkan')
-rw-r--r--src/video_core/renderer_vulkan/renderer_vulkan.cpp39
1 files changed, 8 insertions, 31 deletions
diff --git a/src/video_core/renderer_vulkan/renderer_vulkan.cpp b/src/video_core/renderer_vulkan/renderer_vulkan.cpp
index 7f521cb9b..7a34c95ab 100644
--- a/src/video_core/renderer_vulkan/renderer_vulkan.cpp
+++ b/src/video_core/renderer_vulkan/renderer_vulkan.cpp
@@ -12,8 +12,6 @@
#include <fmt/format.h>
-#include "common/dynamic_library.h"
-#include "common/file_util.h"
#include "common/logging/log.h"
#include "common/telemetry.h"
#include "core/core.h"
@@ -32,6 +30,7 @@
#include "video_core/renderer_vulkan/vk_state_tracker.h"
#include "video_core/renderer_vulkan/vk_swapchain.h"
#include "video_core/renderer_vulkan/wrapper.h"
+#include "video_core/vulkan_common/vulkan_library.h"
// Include these late to avoid polluting previous headers
#ifdef _WIN32
@@ -70,31 +69,10 @@ VkBool32 DebugCallback(VkDebugUtilsMessageSeverityFlagBitsEXT severity,
return VK_FALSE;
}
-Common::DynamicLibrary OpenVulkanLibrary() {
- Common::DynamicLibrary library;
-#ifdef __APPLE__
- // Check if a path to a specific Vulkan library has been specified.
- char* libvulkan_env = getenv("LIBVULKAN_PATH");
- if (!libvulkan_env || !library.Open(libvulkan_env)) {
- // Use the libvulkan.dylib from the application bundle.
- const std::string filename =
- Common::FS::GetBundleDirectory() + "/Contents/Frameworks/libvulkan.dylib";
- library.Open(filename.c_str());
- }
-#else
- std::string filename = Common::DynamicLibrary::GetVersionedFilename("vulkan", 1);
- if (!library.Open(filename.c_str())) {
- // Android devices may not have libvulkan.so.1, only libvulkan.so.
- filename = Common::DynamicLibrary::GetVersionedFilename("vulkan");
- (void)library.Open(filename.c_str());
- }
-#endif
- return library;
-}
-
-std::pair<vk::Instance, u32> CreateInstance(Common::DynamicLibrary& library,
- vk::InstanceDispatch& dld, WindowSystemType window_type,
- bool enable_debug_utils, bool enable_layers) {
+std::pair<vk::Instance, u32> CreateInstance(
+ Common::DynamicLibrary& library, vk::InstanceDispatch& dld,
+ WindowSystemType window_type = WindowSystemType::Headless, bool enable_debug_utils = false,
+ bool enable_layers = false) {
if (!library.IsOpen()) {
LOG_ERROR(Render_Vulkan, "Vulkan library not available");
return {};
@@ -285,7 +263,7 @@ void RendererVulkan::SwapBuffers(const Tegra::FramebufferConfig* framebuffer) {
}
bool RendererVulkan::Init() {
- library = OpenVulkanLibrary();
+ library = OpenLibrary();
std::tie(instance, instance_version) = CreateInstance(
library, dld, render_window.GetWindowInfo().type, true, Settings::values.renderer_debug);
if (!instance || !CreateDebugCallback() || !CreateSurface() || !PickDevices()) {
@@ -446,9 +424,8 @@ void RendererVulkan::Report() const {
std::vector<std::string> RendererVulkan::EnumerateDevices() {
vk::InstanceDispatch dld;
- Common::DynamicLibrary library = OpenVulkanLibrary();
- vk::Instance instance =
- CreateInstance(library, dld, WindowSystemType::Headless, false, false).first;
+ Common::DynamicLibrary library = OpenLibrary();
+ vk::Instance instance = CreateInstance(library, dld).first;
if (!instance) {
return {};
}