mirror of
https://git.suyu.dev/suyu/suyu
synced 2024-12-24 18:32:49 -06:00
android: vk_turbo_mode: Remove unnecessary device recreation.
- Fixes a rare crash.
This commit is contained in:
parent
4ac9778652
commit
df70fdc95b
2 changed files with 11 additions and 2 deletions
|
@ -17,7 +17,10 @@ namespace Vulkan {
|
||||||
using namespace Common::Literals;
|
using namespace Common::Literals;
|
||||||
|
|
||||||
TurboMode::TurboMode(const vk::Instance& instance, const vk::InstanceDispatch& dld)
|
TurboMode::TurboMode(const vk::Instance& instance, const vk::InstanceDispatch& dld)
|
||||||
: m_device{CreateDevice(instance, dld, VK_NULL_HANDLE)}, m_allocator{m_device, false} {
|
#ifndef ANDROID
|
||||||
|
: m_device{CreateDevice(instance, dld, VK_NULL_HANDLE)}, m_allocator{m_device, false}
|
||||||
|
#endif
|
||||||
|
{
|
||||||
{
|
{
|
||||||
std::scoped_lock lk{m_submission_lock};
|
std::scoped_lock lk{m_submission_lock};
|
||||||
m_submission_time = std::chrono::steady_clock::now();
|
m_submission_time = std::chrono::steady_clock::now();
|
||||||
|
@ -34,6 +37,7 @@ void TurboMode::QueueSubmitted() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void TurboMode::Run(std::stop_token stop_token) {
|
void TurboMode::Run(std::stop_token stop_token) {
|
||||||
|
#ifndef ANDROID
|
||||||
auto& dld = m_device.GetLogical();
|
auto& dld = m_device.GetLogical();
|
||||||
|
|
||||||
// Allocate buffer. 2MiB should be sufficient.
|
// Allocate buffer. 2MiB should be sufficient.
|
||||||
|
@ -146,10 +150,13 @@ void TurboMode::Run(std::stop_token stop_token) {
|
||||||
// Create a single command buffer.
|
// Create a single command buffer.
|
||||||
auto cmdbufs = command_pool.Allocate(1, VK_COMMAND_BUFFER_LEVEL_PRIMARY);
|
auto cmdbufs = command_pool.Allocate(1, VK_COMMAND_BUFFER_LEVEL_PRIMARY);
|
||||||
auto cmdbuf = vk::CommandBuffer{cmdbufs[0], m_device.GetDispatchLoader()};
|
auto cmdbuf = vk::CommandBuffer{cmdbufs[0], m_device.GetDispatchLoader()};
|
||||||
|
#endif
|
||||||
|
|
||||||
while (!stop_token.stop_requested()) {
|
while (!stop_token.stop_requested()) {
|
||||||
#if defined(ANDROID) && defined(ARCHITECTURE_arm64)
|
#ifdef ANDROID
|
||||||
|
#ifdef ARCHITECTURE_arm64
|
||||||
adrenotools_set_turbo(true);
|
adrenotools_set_turbo(true);
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
// Reset the fence.
|
// Reset the fence.
|
||||||
fence.Reset();
|
fence.Reset();
|
||||||
|
|
|
@ -23,8 +23,10 @@ public:
|
||||||
private:
|
private:
|
||||||
void Run(std::stop_token stop_token);
|
void Run(std::stop_token stop_token);
|
||||||
|
|
||||||
|
#ifndef ANDROID
|
||||||
Device m_device;
|
Device m_device;
|
||||||
MemoryAllocator m_allocator;
|
MemoryAllocator m_allocator;
|
||||||
|
#endif
|
||||||
std::mutex m_submission_lock;
|
std::mutex m_submission_lock;
|
||||||
std::condition_variable_any m_submission_cv;
|
std::condition_variable_any m_submission_cv;
|
||||||
std::chrono::time_point<std::chrono::steady_clock> m_submission_time{};
|
std::chrono::time_point<std::chrono::steady_clock> m_submission_time{};
|
||||||
|
|
Loading…
Reference in a new issue