diff options
| author | 2023-06-01 20:08:38 -0700 | |
|---|---|---|
| committer | 2023-06-03 00:06:08 -0700 | |
| commit | df70fdc95b1f1aea81517398c28e6be38e585747 (patch) | |
| tree | 4ba14ff4af7a144fc18dbd6ab9a21e38ed23a831 /src | |
| parent | android: EmulationFragment: Remove unnecessary surface destroy on pause. (diff) | |
| download | yuzu-df70fdc95b1f1aea81517398c28e6be38e585747.tar.gz yuzu-df70fdc95b1f1aea81517398c28e6be38e585747.tar.xz yuzu-df70fdc95b1f1aea81517398c28e6be38e585747.zip | |
android: vk_turbo_mode: Remove unnecessary device recreation.
- Fixes a rare crash.
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/renderer_vulkan/vk_turbo_mode.cpp | 11 | ||||
| -rw-r--r-- | src/video_core/renderer_vulkan/vk_turbo_mode.h | 2 |
2 files changed, 11 insertions, 2 deletions
diff --git a/src/video_core/renderer_vulkan/vk_turbo_mode.cpp b/src/video_core/renderer_vulkan/vk_turbo_mode.cpp index 22dbf272e..a802d3c49 100644 --- a/src/video_core/renderer_vulkan/vk_turbo_mode.cpp +++ b/src/video_core/renderer_vulkan/vk_turbo_mode.cpp | |||
| @@ -17,7 +17,10 @@ namespace Vulkan { | |||
| 17 | using namespace Common::Literals; | 17 | using namespace Common::Literals; |
| 18 | 18 | ||
| 19 | TurboMode::TurboMode(const vk::Instance& instance, const vk::InstanceDispatch& dld) | 19 | TurboMode::TurboMode(const vk::Instance& instance, const vk::InstanceDispatch& dld) |
| 20 | : m_device{CreateDevice(instance, dld, VK_NULL_HANDLE)}, m_allocator{m_device, false} { | 20 | #ifndef ANDROID |
| 21 | : m_device{CreateDevice(instance, dld, VK_NULL_HANDLE)}, m_allocator{m_device, false} | ||
| 22 | #endif | ||
| 23 | { | ||
| 21 | { | 24 | { |
| 22 | std::scoped_lock lk{m_submission_lock}; | 25 | std::scoped_lock lk{m_submission_lock}; |
| 23 | m_submission_time = std::chrono::steady_clock::now(); | 26 | m_submission_time = std::chrono::steady_clock::now(); |
| @@ -34,6 +37,7 @@ void TurboMode::QueueSubmitted() { | |||
| 34 | } | 37 | } |
| 35 | 38 | ||
| 36 | void TurboMode::Run(std::stop_token stop_token) { | 39 | void TurboMode::Run(std::stop_token stop_token) { |
| 40 | #ifndef ANDROID | ||
| 37 | auto& dld = m_device.GetLogical(); | 41 | auto& dld = m_device.GetLogical(); |
| 38 | 42 | ||
| 39 | // Allocate buffer. 2MiB should be sufficient. | 43 | // Allocate buffer. 2MiB should be sufficient. |
| @@ -146,10 +150,13 @@ void TurboMode::Run(std::stop_token stop_token) { | |||
| 146 | // Create a single command buffer. | 150 | // Create a single command buffer. |
| 147 | auto cmdbufs = command_pool.Allocate(1, VK_COMMAND_BUFFER_LEVEL_PRIMARY); | 151 | auto cmdbufs = command_pool.Allocate(1, VK_COMMAND_BUFFER_LEVEL_PRIMARY); |
| 148 | auto cmdbuf = vk::CommandBuffer{cmdbufs[0], m_device.GetDispatchLoader()}; | 152 | auto cmdbuf = vk::CommandBuffer{cmdbufs[0], m_device.GetDispatchLoader()}; |
| 153 | #endif | ||
| 149 | 154 | ||
| 150 | while (!stop_token.stop_requested()) { | 155 | while (!stop_token.stop_requested()) { |
| 151 | #if defined(ANDROID) && defined(ARCHITECTURE_arm64) | 156 | #ifdef ANDROID |
| 157 | #ifdef ARCHITECTURE_arm64 | ||
| 152 | adrenotools_set_turbo(true); | 158 | adrenotools_set_turbo(true); |
| 159 | #endif | ||
| 153 | #else | 160 | #else |
| 154 | // Reset the fence. | 161 | // Reset the fence. |
| 155 | fence.Reset(); | 162 | fence.Reset(); |
diff --git a/src/video_core/renderer_vulkan/vk_turbo_mode.h b/src/video_core/renderer_vulkan/vk_turbo_mode.h index 99b5ac50b..9341c9867 100644 --- a/src/video_core/renderer_vulkan/vk_turbo_mode.h +++ b/src/video_core/renderer_vulkan/vk_turbo_mode.h | |||
| @@ -23,8 +23,10 @@ public: | |||
| 23 | private: | 23 | private: |
| 24 | void Run(std::stop_token stop_token); | 24 | void Run(std::stop_token stop_token); |
| 25 | 25 | ||
| 26 | #ifndef ANDROID | ||
| 26 | Device m_device; | 27 | Device m_device; |
| 27 | MemoryAllocator m_allocator; | 28 | MemoryAllocator m_allocator; |
| 29 | #endif | ||
| 28 | std::mutex m_submission_lock; | 30 | std::mutex m_submission_lock; |
| 29 | std::condition_variable_any m_submission_cv; | 31 | std::condition_variable_any m_submission_cv; |
| 30 | std::chrono::time_point<std::chrono::steady_clock> m_submission_time{}; | 32 | std::chrono::time_point<std::chrono::steady_clock> m_submission_time{}; |