mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2024-11-30 03:54:24 +01:00
Merge pull request #9024 from liamwhite/async-screenshot
video_core: don't block rendering on screenshots
This commit is contained in:
commit
e158167139
@ -1,6 +1,8 @@
|
|||||||
// SPDX-FileCopyrightText: 2015 Citra Emulator Project
|
// SPDX-FileCopyrightText: 2015 Citra Emulator Project
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
|
#include <thread>
|
||||||
|
|
||||||
#include "common/logging/log.h"
|
#include "common/logging/log.h"
|
||||||
#include "core/frontend/emu_window.h"
|
#include "core/frontend/emu_window.h"
|
||||||
#include "video_core/renderer_base.h"
|
#include "video_core/renderer_base.h"
|
||||||
@ -35,8 +37,12 @@ void RendererBase::RequestScreenshot(void* data, std::function<void(bool)> callb
|
|||||||
LOG_ERROR(Render, "A screenshot is already requested or in progress, ignoring the request");
|
LOG_ERROR(Render, "A screenshot is already requested or in progress, ignoring the request");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
auto async_callback{[callback = std::move(callback)](bool invert_y) {
|
||||||
|
std::thread t{callback, invert_y};
|
||||||
|
t.detach();
|
||||||
|
}};
|
||||||
renderer_settings.screenshot_bits = data;
|
renderer_settings.screenshot_bits = data;
|
||||||
renderer_settings.screenshot_complete_callback = std::move(callback);
|
renderer_settings.screenshot_complete_callback = async_callback;
|
||||||
renderer_settings.screenshot_framebuffer_layout = layout;
|
renderer_settings.screenshot_framebuffer_layout = layout;
|
||||||
renderer_settings.screenshot_requested = true;
|
renderer_settings.screenshot_requested = true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user