From be7996894507b64bfc5e36eadeb799b32ab64bd9 Mon Sep 17 00:00:00 2001 From: pineappleEA Date: Sat, 7 Jan 2023 19:23:45 +0100 Subject: [PATCH] early-access version 3297 --- README.md | 2 +- .../renderer_vulkan/renderer_vulkan.cpp | 2 +- .../vulkan_common/vulkan_device.cpp | 20 +++++++++++++++++-- src/video_core/vulkan_common/vulkan_device.h | 2 ++ src/yuzu/main.cpp | 10 +++++++--- 5 files changed, 29 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 5a8420841..79391ed7c 100755 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ yuzu emulator early access ============= -This is the source code for early-access 3296. +This is the source code for early-access 3297. ## Legal Notice diff --git a/src/video_core/renderer_vulkan/renderer_vulkan.cpp b/src/video_core/renderer_vulkan/renderer_vulkan.cpp index b006cd5f3..3d250599a 100755 --- a/src/video_core/renderer_vulkan/renderer_vulkan.cpp +++ b/src/video_core/renderer_vulkan/renderer_vulkan.cpp @@ -110,7 +110,7 @@ RendererVulkan::RendererVulkan(Core::TelemetrySession& telemetry_session_, screen_info), rasterizer(render_window, gpu, cpu_memory, screen_info, device, memory_allocator, state_tracker, scheduler) { - if (Settings::values.renderer_force_max_clock.GetValue()) { + if (Settings::values.renderer_force_max_clock.GetValue() && device.ShouldBoostClocks()) { turbo_mode.emplace(instance, dld); } Report(); diff --git a/src/video_core/vulkan_common/vulkan_device.cpp b/src/video_core/vulkan_common/vulkan_device.cpp index 7e745b47c..0a2196961 100755 --- a/src/video_core/vulkan_common/vulkan_device.cpp +++ b/src/video_core/vulkan_common/vulkan_device.cpp @@ -991,6 +991,18 @@ std::string Device::GetDriverName() const { } } +bool Device::ShouldBoostClocks() const { + const bool validated_driver = + driver_id == VK_DRIVER_ID_AMD_PROPRIETARY || driver_id == VK_DRIVER_ID_AMD_OPEN_SOURCE || + driver_id == VK_DRIVER_ID_MESA_RADV || driver_id == VK_DRIVER_ID_NVIDIA_PROPRIETARY || + driver_id == VK_DRIVER_ID_INTEL_PROPRIETARY_WINDOWS || + driver_id == VK_DRIVER_ID_INTEL_OPEN_SOURCE_MESA; + + const bool is_steam_deck = properties.vendorID == 0x1002 && properties.deviceID == 0x163F; + + return validated_driver && !is_steam_deck; +} + static std::vector ExtensionsRequiredForInstanceVersion(u32 available_version) { std::vector extensions{REQUIRED_EXTENSIONS.begin(), REQUIRED_EXTENSIONS.end()}; @@ -1520,8 +1532,12 @@ void Device::SetupFamilies(VkSurfaceKHR surface) { LOG_ERROR(Render_Vulkan, "Device lacks a present queue"); throw vk::Exception(VK_ERROR_FEATURE_NOT_PRESENT); } - graphics_family = *graphics; - present_family = *present; + if (graphics) { + graphics_family = *graphics; + } + if (present) { + present_family = *present; + } } void Device::SetupFeatures() { diff --git a/src/video_core/vulkan_common/vulkan_device.h b/src/video_core/vulkan_common/vulkan_device.h index ec6ca9611..bf274c4c5 100755 --- a/src/video_core/vulkan_common/vulkan_device.h +++ b/src/video_core/vulkan_common/vulkan_device.h @@ -106,6 +106,8 @@ public: return driver_id; } + bool ShouldBoostClocks() const; + /// Returns uniform buffer alignment requeriment. VkDeviceSize GetUniformBufferAlignment() const { return properties.limits.minUniformBufferOffsetAlignment; diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index a95eba1ad..de5461d1c 100755 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -1838,9 +1838,11 @@ void GMainWindow::OnEmulationStopTimeExpired() { void GMainWindow::OnEmulationStopped() { shutdown_timer.stop(); - emu_thread->disconnect(); - emu_thread->wait(); - emu_thread = nullptr; + if (emu_thread) { + emu_thread->disconnect(); + emu_thread->wait(); + emu_thread.reset(); + } if (shutdown_dialog) { shutdown_dialog->deleteLater(); @@ -3028,6 +3030,8 @@ void GMainWindow::OnStopGame() { if (OnShutdownBegin()) { OnShutdownBeginDialog(); + } else { + OnEmulationStopped(); } }