summaryrefslogtreecommitdiffstats
path: root/src/video_core/renderer_vulkan
diff options
context:
space:
mode:
authorReinUsesLisp <reinuseslisp@airmail.cc>2020-12-25 06:27:57 +0100
committerReinUsesLisp <reinuseslisp@airmail.cc>2020-12-31 06:07:33 +0100
commit085adfea00a525796a3bf4b2dd345e1df656c930 (patch)
treef606a6c4fb19bf3207e9fe36b692c7c17d3fcca9 /src/video_core/renderer_vulkan
parentrenderer_vulkan: Initialize surface in separate file (diff)
downloadyuzu-085adfea00a525796a3bf4b2dd345e1df656c930.tar
yuzu-085adfea00a525796a3bf4b2dd345e1df656c930.tar.gz
yuzu-085adfea00a525796a3bf4b2dd345e1df656c930.tar.bz2
yuzu-085adfea00a525796a3bf4b2dd345e1df656c930.tar.lz
yuzu-085adfea00a525796a3bf4b2dd345e1df656c930.tar.xz
yuzu-085adfea00a525796a3bf4b2dd345e1df656c930.tar.zst
yuzu-085adfea00a525796a3bf4b2dd345e1df656c930.zip
Diffstat (limited to 'src/video_core/renderer_vulkan')
-rw-r--r--src/video_core/renderer_vulkan/renderer_vulkan.cpp35
1 files changed, 13 insertions, 22 deletions
diff --git a/src/video_core/renderer_vulkan/renderer_vulkan.cpp b/src/video_core/renderer_vulkan/renderer_vulkan.cpp
index 831c204c2..f64318f25 100644
--- a/src/video_core/renderer_vulkan/renderer_vulkan.cpp
+++ b/src/video_core/renderer_vulkan/renderer_vulkan.cpp
@@ -170,7 +170,6 @@ void RendererVulkan::ShutDown() {
if (const auto& dev = device->GetLogical()) {
dev.WaitIdle();
}
-
rasterizer.reset();
blit_screen.reset();
scheduler.reset();
@@ -180,19 +179,13 @@ void RendererVulkan::ShutDown() {
}
bool RendererVulkan::PickDevices() {
- const auto devices = instance.EnumeratePhysicalDevices();
- if (!devices) {
- LOG_ERROR(Render_Vulkan, "Failed to enumerate physical devices");
- return false;
- }
-
+ const std::vector<VkPhysicalDevice> devices = instance.EnumeratePhysicalDevices();
const s32 device_index = Settings::values.vulkan_device.GetValue();
- if (device_index < 0 || device_index >= static_cast<s32>(devices->size())) {
+ if (device_index < 0 || device_index >= static_cast<s32>(devices.size())) {
LOG_ERROR(Render_Vulkan, "Invalid device index {}!", device_index);
return false;
}
- const vk::PhysicalDevice physical_device((*devices)[static_cast<std::size_t>(device_index)],
- dld);
+ const vk::PhysicalDevice physical_device(devices[static_cast<std::size_t>(device_index)], dld);
if (!VKDevice::IsSuitable(physical_device, *surface)) {
return false;
}
@@ -224,23 +217,21 @@ void RendererVulkan::Report() const {
telemetry_session.AddField(field, "GPU_Vulkan_Extensions", extensions);
}
-std::vector<std::string> RendererVulkan::EnumerateDevices() {
+std::vector<std::string> RendererVulkan::EnumerateDevices() try {
vk::InstanceDispatch dld;
- Common::DynamicLibrary library = OpenLibrary();
- vk::Instance instance = CreateInstance(library, dld).first;
- if (!instance) {
- return {};
- }
- const std::optional physical_devices = instance.EnumeratePhysicalDevices();
- if (!physical_devices) {
- return {};
- }
+ const Common::DynamicLibrary library = OpenLibrary();
+ const vk::Instance instance = CreateInstance(library, dld).first;
+ const std::vector<VkPhysicalDevice> physical_devices = instance.EnumeratePhysicalDevices();
std::vector<std::string> names;
- names.reserve(physical_devices->size());
- for (const auto& device : *physical_devices) {
+ names.reserve(physical_devices.size());
+ for (const VkPhysicalDevice device : physical_devices) {
names.push_back(vk::PhysicalDevice(device, dld).GetProperties().deviceName);
}
return names;
+
+} catch (const vk::Exception& exception) {
+ LOG_ERROR(Render_Vulkan, "Failed to enumerate devices with error: {}", exception.what());
+ return {};
}
} // namespace Vulkan